phpBB

Code Changes

File: phpbb/captcha/plugins/qa.php

  Unmodified   Added   Modified   Removed
Line 95Line 95

while ($row = $db->sql_fetchrow($result))
{


while ($row = $db->sql_fetchrow($result))
{

 
				$this->question_ids[$row['question_id']] = $row['question_id'];
}
$db->sql_freeresult($result);
}

// final fallback to any language
if (!sizeof($this->question_ids))
{
$this->question_lang = '';

$sql = 'SELECT q.question_id, q.lang_iso
FROM ' . $this->table_captcha_questions . ' q, ' . $this->table_captcha_answers . ' a
WHERE q.question_id = a.question_id
GROUP BY lang_iso';
$result = $db->sql_query($sql, 7200);

while ($row = $db->sql_fetchrow($result))
{
if (empty($this->question_lang))
{
$this->question_lang = $row['lang_iso'];
}

				$this->question_ids[$row['question_id']] = $row['question_id'];
}
$db->sql_freeresult($result);

				$this->question_ids[$row['question_id']] = $row['question_id'];
}
$db->sql_freeresult($result);

Line 198Line 220
	*/
function get_template()
{

	*/
function get_template()
{

		global $template;

		global $phpbb_log, $template, $user;


if ($this->is_solved())
{


if ($this->is_solved())
{

 
			return false;
}
else if (empty($this->question_text) || !count($this->question_ids))
{
/** @var \phpbb\log\log_interface $phpbb_log */
$phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING')));

			return false;
}
else
{
$template->assign_vars(array(

			return false;
}
else
{
$template->assign_vars(array(

				'QA_CONFIRM_QUESTION'		=> $this->question_text,
'QA_CONFIRM_ID' => $this->confirm_id,
'S_CONFIRM_CODE' => true,
'S_TYPE' => $this->type,

				'QA_CONFIRM_QUESTION'	=> $this->question_text,
'QA_CONFIRM_ID' => $this->confirm_id,
'S_CONFIRM_CODE' => true,
'S_TYPE' => $this->type,

			));

return 'captcha_qa.html';

			));

return 'captcha_qa.html';

Line 350Line 378
				),
);


				),
);


		foreach($schemas as $table => $schema)

		foreach ($schemas as $table => $schema)

		{
if (!$db_tool->sql_table_exists($table))
{

		{
if (!$db_tool->sql_table_exists($table))
{

Line 364Line 392
	*/
function validate()
{

	*/
function validate()
{

		global $user;

		global $phpbb_log, $user;


$error = '';

if (!sizeof($this->question_ids))
{


$error = '';

if (!sizeof($this->question_ids))
{

			return false;



			/** @var \phpbb\log\log_interface $phpbb_log */
$phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING')));
return $user->lang('CONFIRM_QUESTION_MISSING');

		}

if (!$this->confirm_id)

		}

if (!$this->confirm_id)