|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
* @package acp
|
|
|
4c79b5 |
* @version $Id: acp_captcha.php 8722 2008-07-29 15:13:13Z Kellanved $
|
|
|
4c79b5 |
* @copyright (c) 2005 phpBB Group
|
|
|
4c79b5 |
* @license http:
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* @ignore
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
if (!defined('IN_PHPBB'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
exit;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* @package acp
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
class acp_captcha
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
var $u_action;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
function main($id, $mode)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $db, $user, $auth, $template;
|
|
|
4c79b5 |
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$user->add_lang('acp/board');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$captcha_vars = array(
|
|
|
4c79b5 |
'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID',
|
|
|
4c79b5 |
'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID',
|
|
|
4c79b5 |
'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE',
|
|
|
4c79b5 |
'captcha_gd' => 'CAPTCHA_GD_PREVIEWED'
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (isset($_GET['demo']))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$captcha_vars = array_keys($captcha_vars);
|
|
|
4c79b5 |
foreach ($captcha_vars as $captcha_var)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$config[$captcha_var] = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
if ($config['captcha_gd'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
include($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$captcha = new captcha();
|
|
|
4c79b5 |
$captcha->execute(gen_rand_string(mt_rand(5, 8)), time());
|
|
|
4c79b5 |
exit;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$config_vars = array(
|
|
|
4c79b5 |
'enable_confirm' => 'REG_ENABLE',
|
|
|
4c79b5 |
'enable_post_confirm' => 'POST_ENABLE',
|
|
|
4c79b5 |
'captcha_gd' => 'CAPTCHA_GD',
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->tpl_name = 'acp_captcha';
|
|
|
4c79b5 |
$this->page_title = 'ACP_VC_SETTINGS';
|
|
|
4c79b5 |
$form_key = 'acp_captcha';
|
|
|
4c79b5 |
add_form_key($form_key);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$submit = request_var('submit', '');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($submit && check_form_key($form_key))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$config_vars = array_keys($config_vars);
|
|
|
4c79b5 |
foreach ($config_vars as $config_var)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
set_config($config_var, request_var($config_var, ''));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$captcha_vars = array_keys($captcha_vars);
|
|
|
4c79b5 |
foreach ($captcha_vars as $captcha_var)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$value = request_var($captcha_var, 0);
|
|
|
4c79b5 |
if ($value >= 0)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
set_config($captcha_var, $value);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else if ($submit)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$preview_image_src = append_sid(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&demo=demo"));
|
|
|
4c79b5 |
if (@extension_loaded('gd'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_var('GD', true);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
foreach ($config_vars as $config_var => $template_var)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_var($template_var, (isset($_REQUEST[$config_var])) ? request_var($config_var, '') : $config[$config_var]) ;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
foreach ($captcha_vars as $captcha_var => $template_var)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$var = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var];
|
|
|
4c79b5 |
$template->assign_var($template_var, $var);
|
|
|
4c79b5 |
$preview_image_src .= "&$captcha_var=" . $var;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'CAPTCHA_PREVIEW' => $preview_image_src,
|
|
|
4c79b5 |
'PREVIEW' => isset($_POST['preview']),
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
?>
|