phpBB API Documentation
Class

phpbb_captcha_qa

class phpbb_captcha_qa

And now to something completely different.

Let's make a captcha without extending the abstract class. QA CAPTCHA sample implementation

Properties

$confirm_id
$answer
$question_ids
$question_text
$question_lang
$question_strict
$attempts
$type
$solved

Methods

init(int $type)

get_instance()

API function

is_installed()

See if the captcha has created its tables.

is_available()

API function - for the captcha to be available, it must have installed itself and there has to be at least one question in the board's default lang

has_config()

API function

get_name()

API function

get_class_name()

API function

execute_demo()

API function - not needed as we don't display an image

execute()

API function - not needed as we don't display an image

get_template()

API function - send the question to the template

get_demo_template()

API function - we just display a mockup so that the captcha doesn't need to be installed

get_hidden_fields()

API function

garbage_collect($type)

API function

uninstall()

API function - we don't drop the tables here, as that would cause the loss of all entered questions.

install()

API function - set up shop

validate()

API function - see what has to be done to validate

select_question()

Select a question

reselect_question()

New Question, if desired.

new_attempt()

Wrong answer, so we increase the attempts and use a different question.

load_confirm_id()

See if there is already an entry for the current session.

load_answer()

Look up everything we need and populate the instance variables.

check_answer()

The actual validation

delete_code()

API function - clean the entry

get_attempt_count()

API function

reset()

API function

is_solved()

API function

acp_page($id, $module)

API function - The ACP backend, this marks the end of the easy methods

acp_question_list($module)

This handles the list overview

acp_get_question_data($question_id)

Grab a question and bring it into a format the editor understands

acp_get_question_input()

Grab a question from input and bring it into a format the editor understands

acp_update_question($data, $question_id)

Update a question.

acp_add_question($data)

Insert a question.

acp_insert_answers($data, $question_id)

Insert the answers.

acp_delete_question($question_id)

Delete a question.

validate_input($question_data)

Check if the entered data can be inserted/used param mixed $data : an array as created from acpgetquestioninput or acpgetquestiondata

get_languages()

List the installed language packs

acp_is_last($question_id)

See if there is a question other than the one we have

Details

at line 47
public init(int $type)

Parameters

int $type as per the CAPTCHA API docs, the type

at line 102
public get_instance()

API function

at line 112
public is_installed()

See if the captcha has created its tables.

at line 128
public is_available()

API function - for the captcha to be available, it must have installed itself and there has to be at least one question in the board's default lang

at line 153
public has_config()

API function

at line 161
public get_name()

API function

at line 169
public get_class_name()

API function

at line 177
public execute_demo()

API function - not needed as we don't display an image

at line 184
public execute()

API function - not needed as we don't display an image

at line 191
public get_template()

API function - send the question to the template

at line 215
public get_demo_template()

API function - we just display a mockup so that the captcha doesn't need to be installed

at line 239
public get_hidden_fields()

API function

at line 256
public garbage_collect($type)

API function

Parameters

$type

at line 291
public uninstall()

API function - we don't drop the tables here, as that would cause the loss of all entered questions.

at line 299
public install()

API function - set up shop

at line 363
public validate()

API function - see what has to be done to validate

at line 408
public select_question()

Select a question

at line 434
public reselect_question()

New Question, if desired.

at line 458
public new_attempt()

Wrong answer, so we increase the attempts and use a different question.

at line 480
public load_confirm_id()

See if there is already an entry for the current session.

at line 505
public load_answer()

Look up everything we need and populate the instance variables.

at line 542
public check_answer()

The actual validation

at line 572
public delete_code()

API function - clean the entry

at line 586
public get_attempt_count()

API function

at line 594
public reset()

API function

at line 610
public is_solved()

API function

at line 623
public acp_page($id, $module)

API function - The ACP backend, this marks the end of the easy methods

Parameters

$id
$module

at line 770
public acp_question_list($module)

This handles the list overview

Parameters

$module

at line 800
public acp_get_question_data($question_id)

Grab a question and bring it into a format the editor understands

Parameters

$question_id

at line 838
public acp_get_question_input()

Grab a question from input and bring it into a format the editor understands

at line 855
public acp_update_question($data, $question_id)

Update a question.

param mixed $data : an array as created from acpgetquestioninput or acpgetquestiondata

Parameters

$data
$question_id

at line 882
public acp_add_question($data)

Insert a question.

param mixed $data : an array as created from acpgetquestioninput or acpgetquestiondata

Parameters

$data

at line 906
public acp_insert_answers($data, $question_id)

Insert the answers.

param mixed $data : an array as created from acpgetquestioninput or acpgetquestiondata

Parameters

$data
$question_id

at line 927
public acp_delete_question($question_id)

Delete a question.

Parameters

$question_id

at line 947
public validate_input($question_data)

Check if the entered data can be inserted/used param mixed $data : an array as created from acpgetquestioninput or acpgetquestiondata

Parameters

$question_data

at line 973
public get_languages()

List the installed language packs

at line 999
public acp_is_last($question_id)

See if there is a question other than the one we have

Parameters

$question_id