aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/captcha/plugins
diff options
context:
space:
mode:
authorHenry Sudhof <kellanved@phpbb.com>2010-01-26 14:01:20 +0000
committerHenry Sudhof <kellanved@phpbb.com>2010-01-26 14:01:20 +0000
commit8a9c7c92bef76a8dfbb72556aaf55f961aa711b3 (patch)
tree267cf7054bc4674cf7926adb874226ec56b3fca3 /phpBB/includes/captcha/plugins
parent3e224cf856f7ef414e341a980d8175da0e373fc8 (diff)
downloadforums-8a9c7c92bef76a8dfbb72556aaf55f961aa711b3.tar
forums-8a9c7c92bef76a8dfbb72556aaf55f961aa711b3.tar.gz
forums-8a9c7c92bef76a8dfbb72556aaf55f961aa711b3.tar.bz2
forums-8a9c7c92bef76a8dfbb72556aaf55f961aa711b3.tar.xz
forums-8a9c7c92bef76a8dfbb72556aaf55f961aa711b3.zip
tuning
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10454 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/captcha/plugins')
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
index c8f68f23f0..619a05663f 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
@@ -87,6 +87,12 @@ class phpbb_captcha_qa
}
$db->sql_freeresult($result);
}
+
+ // Possible snag: the user didn't send a confirm_id. See, if we have something on file.
+ if (!strlen($this->confirm_id))
+ {
+ $this->load_confirm_id();
+ }
// okay, if there is a confirm_id, we try to load that confirm's state
if (!strlen($this->confirm_id) || !$this->load_answer())
@@ -473,6 +479,38 @@ class phpbb_captcha_qa
$this->load_answer();
}
+
+ /**
+ * See if there is already an entry for the current session.
+ */
+ function load_confirm_id()
+ {
+ global $db, $user;
+
+ if (!sizeof($this->question_ids))
+ {
+ return false;
+ }
+
+ $sql = 'SELECT confirm_id
+ FROM ' . CAPTCHA_QA_CONFIRM_TABLE . "
+ WHERE
+ session_id = '" . $db->sql_escape($user->session_id) . "'
+ AND lang_iso = '" . $db->sql_escape($this->question_lang) . "'
+ AND confirm_type = " . $this->type;
+ $result = $db->sql_query_limit($sql, 1);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ if ($row)
+ {
+ $this->confirm_id = $row['confirm_id'];
+ return true;
+ }
+
+ return false;
+ }
+
/**
* Look up everything we need and populate the instance variables.
*/