mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9975 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
52250a33b4
commit
918e667587
6 changed files with 65 additions and 29 deletions
|
@ -39,10 +39,12 @@
|
||||||
<dt><label for="captcha_select">{L_CAPTCHA_SELECT}:</label><br /><span>{L_CAPTCHA_SELECT_EXPLAIN}</span></dt>
|
<dt><label for="captcha_select">{L_CAPTCHA_SELECT}:</label><br /><span>{L_CAPTCHA_SELECT_EXPLAIN}</span></dt>
|
||||||
<dd><select id="captcha_select" name="select_captcha" onchange="(document.getElementById('acp_captcha')).submit()" >{CAPTCHA_SELECT}</select></dd>
|
<dd><select id="captcha_select" name="select_captcha" onchange="(document.getElementById('acp_captcha')).submit()" >{CAPTCHA_SELECT}</select></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
<!-- IF S_CAPTCHA_HAS_CONFIG -->
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="configure">{L_CAPTCHA_CONFIGURE}:</label><br /><span>{L_CAPTCHA_CONFIGURE_EXPLAIN}</span></dt>
|
<dt><label for="configure">{L_CAPTCHA_CONFIGURE}:</label><br /><span>{L_CAPTCHA_CONFIGURE_EXPLAIN}</span></dt>
|
||||||
<dd><input class="button2" type="submit" id="configure" name="configure" value="{L_CONFIGURE}" /></dd>
|
<dd><input class="button2" type="submit" id="configure" name="configure" value="{L_CONFIGURE}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
<!-- ENDIF -->
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<!-- IF CAPTCHA_PREVIEW_TPL -->
|
<!-- IF CAPTCHA_PREVIEW_TPL -->
|
||||||
|
|
|
@ -67,7 +67,6 @@ class acp_captcha
|
||||||
|
|
||||||
if ($submit && check_form_key($form_key))
|
if ($submit && check_form_key($form_key))
|
||||||
{
|
{
|
||||||
$config_vars = array_keys($config_vars);
|
|
||||||
foreach ($config_vars as $config_var => $options)
|
foreach ($config_vars as $config_var => $options)
|
||||||
{
|
{
|
||||||
set_config($config_var, request_var($config_var, $options['default']));
|
set_config($config_var, request_var($config_var, $options['default']));
|
||||||
|
@ -122,6 +121,7 @@ class acp_captcha
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'CAPTCHA_PREVIEW_TPL' => $demo_captcha->get_demo_template($id),
|
'CAPTCHA_PREVIEW_TPL' => $demo_captcha->get_demo_template($id),
|
||||||
|
'S_CAPTCHA_HAS_CONFIG' => $demo_captcha->has_config(),
|
||||||
'CAPTCHA_SELECT' => $captcha_select,
|
'CAPTCHA_SELECT' => $captcha_select,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,6 +362,14 @@ class phpbb_default_captcha
|
||||||
return (bool) $this->solved;
|
return (bool) $this->solved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API function
|
||||||
|
*/
|
||||||
|
function has_config()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -73,6 +73,14 @@ class phpbb_captcha_gd extends phpbb_default_captcha
|
||||||
return can_load_dll('gd');
|
return can_load_dll('gd');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API function
|
||||||
|
*/
|
||||||
|
function has_config()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function get_name()
|
function get_name()
|
||||||
{
|
{
|
||||||
return 'CAPTCHA_GD';
|
return 'CAPTCHA_GD';
|
||||||
|
|
|
@ -17,9 +17,9 @@ if (!defined('IN_PHPBB'))
|
||||||
}
|
}
|
||||||
|
|
||||||
global $table_prefix;
|
global $table_prefix;
|
||||||
define('QUESTIONS_TABLE', $table_prefix . 'captcha_questions');
|
define('CAPTCHA_QUESTIONS_TABLE', $table_prefix . 'captcha_questions');
|
||||||
define('ANSWERS_TABLE', $table_prefix . 'captcha_answers');
|
define('CAPTCHA_ANSWERS_TABLE', $table_prefix . 'captcha_answers');
|
||||||
define('QA_CONFIRM_TABLE', $table_prefix . 'qa_confirm');
|
define('CAPTCHA_QA_CONFIRM_TABLE', $table_prefix . 'qa_confirm');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class phpbb_captcha_qa
|
||||||
$this->question_lang = $user->data['user_lang'];
|
$this->question_lang = $user->data['user_lang'];
|
||||||
// we need all defined questions - shouldn't be too many, so we can just grab them
|
// we need all defined questions - shouldn't be too many, so we can just grab them
|
||||||
// try the user's lang first
|
// try the user's lang first
|
||||||
$sql = 'SELECT question_id FROM ' . QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($user->data['user_lang']) . '\'';
|
$sql = 'SELECT question_id FROM ' . CAPTCHA_QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($user->data['user_lang']) . '\'';
|
||||||
$result = $db->sql_query($sql, 3600);
|
$result = $db->sql_query($sql, 3600);
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ class phpbb_captcha_qa
|
||||||
if (!sizeof($this->question_ids))
|
if (!sizeof($this->question_ids))
|
||||||
{
|
{
|
||||||
$this->question_lang = $config['default_lang'];
|
$this->question_lang = $config['default_lang'];
|
||||||
$sql = 'SELECT question_id FROM ' . QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($config['default_lang']) . '\'';
|
$sql = 'SELECT question_id FROM ' . CAPTCHA_QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($config['default_lang']) . '\'';
|
||||||
$result = $db->sql_query($sql, 7200);
|
$result = $db->sql_query($sql, 7200);
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
@ -108,7 +108,7 @@ class phpbb_captcha_qa
|
||||||
include("$phpbb_root_path/includes/db/db_tools.$phpEx");
|
include("$phpbb_root_path/includes/db/db_tools.$phpEx");
|
||||||
}
|
}
|
||||||
$db_tool = new phpbb_db_tools($db);
|
$db_tool = new phpbb_db_tools($db);
|
||||||
return $db_tool->sql_table_exists(QUESTIONS_TABLE);
|
return $db_tool->sql_table_exists(CAPTCHA_QUESTIONS_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,13 +125,23 @@ class phpbb_captcha_qa
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$sql = 'SELECT COUNT(question_id) as count FROM ' . QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($config['default_lang']) . '\'';
|
$sql = 'SELECT COUNT(question_id) as count FROM ' . CAPTCHA_QUESTIONS_TABLE . ' WHERE lang_iso = \'' . $db->sql_escape($config['default_lang']) . '\'';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
return ((bool) $row['count']);
|
return ((bool) $row['count']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API function
|
||||||
|
*/
|
||||||
|
function has_config()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API function
|
* API function
|
||||||
*/
|
*/
|
||||||
|
@ -219,7 +229,7 @@ class phpbb_captcha_qa
|
||||||
global $db, $config;
|
global $db, $config;
|
||||||
|
|
||||||
$sql = 'SELECT DISTINCT c.session_id
|
$sql = 'SELECT DISTINCT c.session_id
|
||||||
FROM ' . QA_CONFIRM_TABLE . ' c
|
FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' c
|
||||||
LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id)
|
LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id)
|
||||||
WHERE s.session_id IS NULL' .
|
WHERE s.session_id IS NULL' .
|
||||||
((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type);
|
((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type);
|
||||||
|
@ -236,7 +246,7 @@ class phpbb_captcha_qa
|
||||||
|
|
||||||
if (sizeof($sql_in))
|
if (sizeof($sql_in))
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM ' . QA_CONFIRM_TABLE . '
|
$sql = 'DELETE FROM ' . CAPTCHA_QA_CONFIRM_TABLE . '
|
||||||
WHERE ' . $db->sql_in_set('session_id', $sql_in);
|
WHERE ' . $db->sql_in_set('session_id', $sql_in);
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
@ -264,10 +274,10 @@ class phpbb_captcha_qa
|
||||||
include("$phpbb_root_path/includes/db/db_tools.$phpEx");
|
include("$phpbb_root_path/includes/db/db_tools.$phpEx");
|
||||||
}
|
}
|
||||||
$db_tool = new phpbb_db_tools($db);
|
$db_tool = new phpbb_db_tools($db);
|
||||||
$tables = array(QUESTIONS_TABLE, ANSWERS_TABLE, QA_CONFIRM_TABLE);
|
$tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE);
|
||||||
|
|
||||||
$schemas = array(
|
$schemas = array(
|
||||||
QUESTIONS_TABLE => array (
|
CAPTCHA_QUESTIONS_TABLE => array (
|
||||||
'COLUMNS' => array(
|
'COLUMNS' => array(
|
||||||
'question_id' => array('UINT', Null, 'auto_increment'),
|
'question_id' => array('UINT', Null, 'auto_increment'),
|
||||||
'strict' => array('BOOL', 0),
|
'strict' => array('BOOL', 0),
|
||||||
|
@ -280,7 +290,7 @@ class phpbb_captcha_qa
|
||||||
'lang_iso' => array('INDEX', 'lang_iso'),
|
'lang_iso' => array('INDEX', 'lang_iso'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ANSWERS_TABLE => array (
|
CAPTCHA_ANSWERS_TABLE => array (
|
||||||
'COLUMNS' => array(
|
'COLUMNS' => array(
|
||||||
'question_id' => array('UINT', 0),
|
'question_id' => array('UINT', 0),
|
||||||
'answer_text' => array('STEXT_UNI', ''),
|
'answer_text' => array('STEXT_UNI', ''),
|
||||||
|
@ -289,7 +299,7 @@ class phpbb_captcha_qa
|
||||||
'question_id' => array('INDEX', 'question_id'),
|
'question_id' => array('INDEX', 'question_id'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
QA_CONFIRM_TABLE => array (
|
CAPTCHA_QA_CONFIRM_TABLE => array (
|
||||||
'COLUMNS' => array(
|
'COLUMNS' => array(
|
||||||
'session_id' => array('CHAR:32', ''),
|
'session_id' => array('CHAR:32', ''),
|
||||||
'confirm_id' => array('CHAR:32', ''),
|
'confirm_id' => array('CHAR:32', ''),
|
||||||
|
@ -363,7 +373,7 @@ class phpbb_captcha_qa
|
||||||
$this->confirm_id = md5(unique_id($user->ip));
|
$this->confirm_id = md5(unique_id($user->ip));
|
||||||
$this->question = (int) array_rand($this->question_ids);
|
$this->question = (int) array_rand($this->question_ids);
|
||||||
|
|
||||||
$sql = 'INSERT INTO ' . QA_CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
$sql = 'INSERT INTO ' . CAPTCHA_QA_CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
||||||
'confirm_id' => (string) $this->confirm_id,
|
'confirm_id' => (string) $this->confirm_id,
|
||||||
'session_id' => (string) $user->session_id,
|
'session_id' => (string) $user->session_id,
|
||||||
'lang_iso' => (string) $this->question_lang,
|
'lang_iso' => (string) $this->question_lang,
|
||||||
|
@ -386,7 +396,7 @@ class phpbb_captcha_qa
|
||||||
$this->solved = 0;
|
$this->solved = 0;
|
||||||
// compute $seed % 0x7fffffff
|
// compute $seed % 0x7fffffff
|
||||||
|
|
||||||
$sql = 'UPDATE ' . QA_CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
|
$sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
|
||||||
'question' => (int) $this->question,)) . '
|
'question' => (int) $this->question,)) . '
|
||||||
WHERE
|
WHERE
|
||||||
confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\'
|
confirm_id = \'' . $db->sql_escape($this->confirm_id) . '\'
|
||||||
|
@ -407,7 +417,7 @@ class phpbb_captcha_qa
|
||||||
$this->solved = 0;
|
$this->solved = 0;
|
||||||
// compute $seed % 0x7fffffff
|
// compute $seed % 0x7fffffff
|
||||||
|
|
||||||
$sql = 'UPDATE ' . QA_CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
|
$sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
|
||||||
'question_id' => (int) $this->question)) . ',
|
'question_id' => (int) $this->question)) . ',
|
||||||
attempts = attempts + 1
|
attempts = attempts + 1
|
||||||
WHERE
|
WHERE
|
||||||
|
@ -425,7 +435,7 @@ class phpbb_captcha_qa
|
||||||
global $db, $user;
|
global $db, $user;
|
||||||
|
|
||||||
$sql = 'SELECT con.question_id, attempts, question_text, strict
|
$sql = 'SELECT con.question_id, attempts, question_text, strict
|
||||||
FROM ' . QA_CONFIRM_TABLE . ' con, ' . QUESTIONS_TABLE . " qes
|
FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' con, ' . CAPTCHA_QUESTIONS_TABLE . " qes
|
||||||
WHERE con.question_id = qes.question_id
|
WHERE con.question_id = qes.question_id
|
||||||
AND confirm_id = '" . $db->sql_escape($this->confirm_id) . "'
|
AND confirm_id = '" . $db->sql_escape($this->confirm_id) . "'
|
||||||
AND session_id = '" . $db->sql_escape($user->session_id) . "'
|
AND session_id = '" . $db->sql_escape($user->session_id) . "'
|
||||||
|
@ -457,7 +467,7 @@ class phpbb_captcha_qa
|
||||||
$answer = ($this->question_strict) ? request_var('qa_answer', '', true) : utf8_clean_string(request_var('qa_answer', '', true));
|
$answer = ($this->question_strict) ? request_var('qa_answer', '', true) : utf8_clean_string(request_var('qa_answer', '', true));
|
||||||
|
|
||||||
$sql = 'SELECT answer_text
|
$sql = 'SELECT answer_text
|
||||||
FROM ' . ANSWERS_TABLE . '
|
FROM ' . CAPTCHA_ANSWERS_TABLE . '
|
||||||
WHERE question_id = ' . (int) $this->question;
|
WHERE question_id = ' . (int) $this->question;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
@ -480,7 +490,7 @@ class phpbb_captcha_qa
|
||||||
{
|
{
|
||||||
global $db, $user;
|
global $db, $user;
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . QA_CONFIRM_TABLE . "
|
$sql = 'DELETE FROM ' . CAPTCHA_QA_CONFIRM_TABLE . "
|
||||||
WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'
|
WHERE confirm_id = '" . $db->sql_escape($confirm_id) . "'
|
||||||
AND session_id = '" . $db->sql_escape($user->session_id) . "'
|
AND session_id = '" . $db->sql_escape($user->session_id) . "'
|
||||||
AND confirm_type = " . $this->type;
|
AND confirm_type = " . $this->type;
|
||||||
|
@ -502,7 +512,7 @@ class phpbb_captcha_qa
|
||||||
{
|
{
|
||||||
global $db, $user;
|
global $db, $user;
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . QA_CONFIRM_TABLE . "
|
$sql = 'DELETE FROM ' . CAPTCHA_QA_CONFIRM_TABLE . "
|
||||||
WHERE session_id = '" . $db->sql_escape($user->session_id) . "'
|
WHERE session_id = '" . $db->sql_escape($user->session_id) . "'
|
||||||
AND confirm_type = " . (int) $this->type;
|
AND confirm_type = " . (int) $this->type;
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
@ -666,7 +676,7 @@ class phpbb_captcha_qa
|
||||||
{
|
{
|
||||||
global $db, $template;
|
global $db, $template;
|
||||||
|
|
||||||
$sql = 'SELECT * FROM ' . QUESTIONS_TABLE . ' WHERE 1';
|
$sql = 'SELECT * FROM ' . CAPTCHA_QUESTIONS_TABLE . ' WHERE 1';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_LIST' => true,
|
'S_LIST' => true,
|
||||||
|
@ -697,7 +707,7 @@ class phpbb_captcha_qa
|
||||||
|
|
||||||
if ($question_id)
|
if ($question_id)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT * FROM ' . QUESTIONS_TABLE . ' WHERE question_id = ' . $question_id;
|
$sql = 'SELECT * FROM ' . CAPTCHA_QUESTIONS_TABLE . ' WHERE question_id = ' . $question_id;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if ($row = $db->sql_fetchrow($result))
|
if ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
@ -709,7 +719,7 @@ class phpbb_captcha_qa
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$question['answers'] = array();
|
$question['answers'] = array();
|
||||||
$sql = 'SELECT * FROM ' . ANSWERS_TABLE . ' WHERE question_id = ' . $question_id;
|
$sql = 'SELECT * FROM ' . CAPTCHA_ANSWERS_TABLE . ' WHERE question_id = ' . $question_id;
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
@ -748,13 +758,13 @@ class phpbb_captcha_qa
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
// easier to delete all answers than to figure out which to update
|
// easier to delete all answers than to figure out which to update
|
||||||
$sql = "DELETE FROM " . ANSWERS_TABLE . " WHERE question_id = $question_id";
|
$sql = "DELETE FROM " . CAPTCHA_ANSWERS_TABLE . " WHERE question_id = $question_id";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
$langs = $this->get_languages();
|
$langs = $this->get_languages();
|
||||||
$question_ary = $data;
|
$question_ary = $data;
|
||||||
$question_ary['lang_id'] = $langs[$question_ary['lang_iso']]['id'];
|
$question_ary['lang_id'] = $langs[$question_ary['lang_iso']]['id'];
|
||||||
unset($question_ary['answers']);
|
unset($question_ary['answers']);
|
||||||
$sql = "UPDATE " . QUESTIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $question_ary) . "
|
$sql = "UPDATE " . CAPTCHA_QUESTIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $question_ary) . "
|
||||||
WHERE question_id = $question_id";
|
WHERE question_id = $question_id";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
$this->acp_insert_answers($data, $question_id);
|
$this->acp_insert_answers($data, $question_id);
|
||||||
|
@ -773,7 +783,7 @@ class phpbb_captcha_qa
|
||||||
|
|
||||||
$question_ary['lang_id'] = $langs[$data['lang_iso']]['id'];
|
$question_ary['lang_id'] = $langs[$data['lang_iso']]['id'];
|
||||||
unset($question_ary['answers']);
|
unset($question_ary['answers']);
|
||||||
$sql = "INSERT INTO " . QUESTIONS_TABLE . $db->sql_build_array('INSERT', $question_ary);
|
$sql = "INSERT INTO " . CAPTCHA_QUESTIONS_TABLE . $db->sql_build_array('INSERT', $question_ary);
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
$question_id = $db->sql_nextid();
|
$question_id = $db->sql_nextid();
|
||||||
$this->acp_insert_answers($data, $question_id);
|
$this->acp_insert_answers($data, $question_id);
|
||||||
|
@ -793,7 +803,7 @@ class phpbb_captcha_qa
|
||||||
'question_id' => $question_id,
|
'question_id' => $question_id,
|
||||||
'answer_text' => $answer,
|
'answer_text' => $answer,
|
||||||
);
|
);
|
||||||
$sql = "INSERT INTO " . ANSWERS_TABLE . $db->sql_build_array('INSERT', $answer_ary);
|
$sql = "INSERT INTO " . CAPTCHA_ANSWERS_TABLE . $db->sql_build_array('INSERT', $answer_ary);
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -806,7 +816,7 @@ class phpbb_captcha_qa
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$tables = array(QUESTIONS_TABLE, ANSWERS_TABLE);
|
$tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE);
|
||||||
foreach($tables as $table)
|
foreach($tables as $table)
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM $table WHERE question_id = $question_id";
|
$sql = "DELETE FROM $table WHERE question_id = $question_id";
|
||||||
|
|
|
@ -54,6 +54,14 @@ class phpbb_recaptcha extends phpbb_default_captcha
|
||||||
$user->add_lang('captcha_recaptcha');
|
$user->add_lang('captcha_recaptcha');
|
||||||
return (isset($config['recaptcha_pubkey']) && !empty($config['recaptcha_pubkey']));
|
return (isset($config['recaptcha_pubkey']) && !empty($config['recaptcha_pubkey']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API function
|
||||||
|
*/
|
||||||
|
function has_config()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function get_name()
|
function get_name()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue