5
* @version $Id: acp_captcha.php,v 1.12 2007/10/05 14:36:32 acydburn Exp $
6
* @copyright (c) 2005 phpBB Group
7
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
13
if (!defined('IN_PHPBB'))
25
function main($id, $mode)
27
global $db, $user, $auth, $template;
28
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
30
$user->add_lang('acp/board');
33
$captcha_vars = array(
34
'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID',
35
'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID',
36
'captcha_gd_foreground_noise' => 'CAPTCHA_GD_FOREGROUND_NOISE',
37
'captcha_gd' => 'CAPTCHA_GD_PREVIEWED'
40
if (isset($_GET['demo']))
42
$captcha_vars = array_keys($captcha_vars);
43
foreach ($captcha_vars as $captcha_var)
45
$config[$captcha_var] = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var];
47
if ($config['captcha_gd'])
49
include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
53
include($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx);
55
$captcha = new captcha();
56
$captcha->execute(gen_rand_string(mt_rand(5, 8)), time());
61
'enable_confirm' => 'REG_ENABLE',
62
'enable_post_confirm' => 'POST_ENABLE',
63
'captcha_gd' => 'CAPTCHA_GD',
66
$this->tpl_name = 'acp_captcha';
67
$this->page_title = 'ACP_VC_SETTINGS';
68
$form_key = 'acp_captcha';
69
add_form_key($form_key);
71
$submit = request_var('submit', '');
73
if ($submit && check_form_key($form_key))
75
$config_vars = array_keys($config_vars);
76
foreach ($config_vars as $config_var)
78
set_config($config_var, request_var($config_var, ''));
80
$captcha_vars = array_keys($captcha_vars);
81
foreach ($captcha_vars as $captcha_var)
83
set_config($captcha_var, request_var($captcha_var, 0));
85
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
89
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
94
$preview_image_src = append_sid(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&demo=demo"));
95
if (@extension_loaded('gd'))
97
$template->assign_var('GD', true);
99
foreach ($config_vars as $config_var => $template_var)
101
$template->assign_var($template_var, (isset($_REQUEST[$config_var])) ? request_var($config_var, '') : $config[$config_var]) ;
103
foreach ($captcha_vars as $captcha_var => $template_var)
105
$var = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var];
106
$template->assign_var($template_var, $var);
107
$preview_image_src .= "&$captcha_var=" . $var;
109
$template->assign_vars(array(
110
'CAPTCHA_PREVIEW' => $preview_image_src,
111
'PREVIEW' => isset($_POST['preview']),
b'\\ No newline at end of file'