mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
ACP usability
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10450 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
b4d6b1e980
commit
b4c87cc504
3 changed files with 64 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
||||||
<dl>
|
<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>
|
<dd>
|
||||||
<input type="text" tabindex="10" name="answer" id="answer" size="45" class="inputbox autowidth" title="{L_ANSWER}" />
|
<input type="text" tabindex="10" name="answer" id="answer" size="45" class="inputbox autowidth" title="{L_ANSWER}" />
|
||||||
|
|
|
@ -214,6 +214,22 @@ class phpbb_captcha_qa
|
||||||
*/
|
*/
|
||||||
function get_demo_template()
|
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';
|
return 'captcha_qa_acp_demo.html';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,7 +409,6 @@ class phpbb_captcha_qa
|
||||||
{
|
{
|
||||||
global $db, $user;
|
global $db, $user;
|
||||||
|
|
||||||
|
|
||||||
if (!sizeof($this->question_ids))
|
if (!sizeof($this->question_ids))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -616,6 +631,8 @@ class phpbb_captcha_qa
|
||||||
$this->acp_question_list($module);
|
$this->acp_question_list($module);
|
||||||
}
|
}
|
||||||
else if ($question_id && $action == 'delete')
|
else if ($question_id && $action == 'delete')
|
||||||
|
{
|
||||||
|
if ($this->get_class_name() !== $config['captcha_plugin'] || !$this->acp_is_last($question_id))
|
||||||
{
|
{
|
||||||
if (confirm_box(true))
|
if (confirm_box(true))
|
||||||
{
|
{
|
||||||
|
@ -635,6 +652,11 @@ class phpbb_captcha_qa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
trigger_error($user->lang['QA_LAST_QUESTION'] . adm_back_link($list_url), E_USER_WARNING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// okay, show the editor
|
// okay, show the editor
|
||||||
$error = false;
|
$error = false;
|
||||||
|
@ -711,7 +733,7 @@ class phpbb_captcha_qa
|
||||||
}
|
}
|
||||||
else if ($submit)
|
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;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -58,6 +58,8 @@ $lang = array_merge($lang, array(
|
||||||
'QUESTION_TEXT_EXPLAIN' => 'The question that will be asked on registration.',
|
'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_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.',
|
||||||
|
|
||||||
));
|
));
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue