diff options
author | Henry Sudhof <kellanved@phpbb.com> | 2010-01-26 10:57:00 +0000 |
---|---|---|
committer | Henry Sudhof <kellanved@phpbb.com> | 2010-01-26 10:57:00 +0000 |
commit | b4c87cc504216af360f18bcb3123540fbea5091a (patch) | |
tree | 7380af646fd1aca930fb2140853e3c985fa2822c /phpBB/includes/captcha | |
parent | b4d6b1e980473914601e1fb1a9c0cc0e4a6fde57 (diff) | |
download | forums-b4c87cc504216af360f18bcb3123540fbea5091a.tar forums-b4c87cc504216af360f18bcb3123540fbea5091a.tar.gz forums-b4c87cc504216af360f18bcb3123540fbea5091a.tar.bz2 forums-b4c87cc504216af360f18bcb3123540fbea5091a.tar.xz forums-b4c87cc504216af360f18bcb3123540fbea5091a.zip |
ACP usability
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10450 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/captcha')
-rw-r--r-- | phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php | 73 |
1 files changed, 61 insertions, 12 deletions
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index 45811c5d26..7526cb67cf 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -214,6 +214,22 @@ class phpbb_captcha_qa */ function get_demo_template() { + global $config, $db, $template; + + if ($this->is_available()) + { + $sql = 'SELECT question_text + FROM ' . CAPTCHA_QUESTIONS_TABLE . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + $result = $db->sql_query_limit($sql, 1); + if ($row = $db->sql_fetchrow($result)) + { + $template->assign_vars(array( + 'QA_CONFIRM_QUESTION' => $row['question_text'], + )); + } + $db->sql_freeresult($result); + } return 'captcha_qa_acp_demo.html'; } @@ -393,7 +409,6 @@ class phpbb_captcha_qa { global $db, $user; - if (!sizeof($this->question_ids)) { return false; @@ -617,21 +632,28 @@ class phpbb_captcha_qa } else if ($question_id && $action == 'delete') { - if (confirm_box(true)) + if ($this->get_class_name() !== $config['captcha_plugin'] || !$this->acp_is_last($question_id)) { - $this->acp_delete_question($question_id); + if (confirm_box(true)) + { + $this->acp_delete_question($question_id); - trigger_error($user->lang['QUESTION_DELETED'] . adm_back_link($list_url)); + trigger_error($user->lang['QUESTION_DELETED'] . adm_back_link($list_url)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'question_id' => $question_id, + 'action' => $action, + 'configure' => 1, + 'select_captcha' => $this->get_class_name(), + )) + ); + } } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( - 'question_id' => $question_id, - 'action' => $action, - 'configure' => 1, - 'select_captcha' => $this->get_class_name(), - )) - ); + trigger_error($user->lang['QA_LAST_QUESTION'] . adm_back_link($list_url), E_USER_WARNING); } } else @@ -711,7 +733,7 @@ class phpbb_captcha_qa } else if ($submit) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link($list_url)); + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($list_url), E_USER_WARNING); } } } @@ -942,6 +964,33 @@ class phpbb_captcha_qa return $langs; } + + + + /** + * See if there is a question other than the one we have + */ + function acp_is_last($question_id) + { + global $config, $db; + + if ($question_id) + { + $sql = 'SELECT question_id + FROM ' . CAPTCHA_QUESTIONS_TABLE . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "' + AND question_id <> " . (int) $question_id; + $result = $db->sql_query_limit($sql, 1); + $question = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$question) + { + return true; + } + return false; + } + } } ?>
\ No newline at end of file |