aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenry Sudhof <kellanved@phpbb.com>2010-01-26 10:57:00 +0000
committerHenry Sudhof <kellanved@phpbb.com>2010-01-26 10:57:00 +0000
commitb4c87cc504216af360f18bcb3123540fbea5091a (patch)
tree7380af646fd1aca930fb2140853e3c985fa2822c
parentb4d6b1e980473914601e1fb1a9c0cc0e4a6fde57 (diff)
downloadforums-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
-rw-r--r--phpBB/adm/style/captcha_qa_acp_demo.html2
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php73
-rw-r--r--phpBB/language/en/captcha_qa.php2
3 files changed, 64 insertions, 13 deletions
diff --git a/phpBB/adm/style/captcha_qa_acp_demo.html b/phpBB/adm/style/captcha_qa_acp_demo.html
index 57bed8af53..0ea2d6a024 100644
--- a/phpBB/adm/style/captcha_qa_acp_demo.html
+++ b/phpBB/adm/style/captcha_qa_acp_demo.html
@@ -1,5 +1,5 @@
<dl>
- <dt><label for="answer">{L_CONFIRM_QUESTION}:</label><br /><span>{L_CONFIRM_QUESTION_EXPLAIN}</span></dt>
+ <dt><label for="answer"><!-- IF QA_CONFIRM_QUESTION --> {QA_CONFIRM_QUESTION} <!-- ELSE --> {L_CONFIRM_QUESTION} <!-- ENDIF -->:</label><br /><span>{L_CONFIRM_QUESTION_EXPLAIN}</span></dt>
<dd>
<input type="text" tabindex="10" name="answer" id="answer" size="45" class="inputbox autowidth" title="{L_ANSWER}" />
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
diff --git a/phpBB/language/en/captcha_qa.php b/phpBB/language/en/captcha_qa.php
index 1d443e995a..5cd822b3c4 100644
--- a/phpBB/language/en/captcha_qa.php
+++ b/phpBB/language/en/captcha_qa.php
@@ -58,6 +58,8 @@ $lang = array_merge($lang, array(
'QUESTION_TEXT_EXPLAIN' => 'The question that will be asked on registration.',
'QA_ERROR_MSG' => 'Please fill in all fields and enter at least one answer.',
+ 'QA_LAST_QUESTION' => 'You cannot delete all questions while the plugin is active.',
+
));
?> \ No newline at end of file