mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-07 01:06:48 +02:00
- compress is nicer (fixed a bug :P)
- UTF-8 code is nicer (fixed a bug :P) - new CAPTCHA. Replaced the old one for size and usability issues. The old CAPTCHA will most likely be released as a separate package git-svn-id: file:///svn/phpbb/trunk@6549 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -21,91 +21,37 @@ class acp_captcha
|
||||
|
||||
$user->add_lang('acp/board');
|
||||
|
||||
$config_vars = array('enable_confirm' => 'REG_ENABLE',
|
||||
'enable_post_confirm' => 'POST_ENABLE',
|
||||
'policy_overlap' => 'OVERLAP_ENABLE',
|
||||
'policy_overlap_noise_pixel' => 'OVERLAP_NOISE_PIXEL',
|
||||
'policy_overlap_noise_line' => 'OVERLAP_NOISE_LINE_ENABLE',
|
||||
'policy_entropy' => 'ENTROPY_ENABLE',
|
||||
'policy_entropy_noise_pixel' => 'ENTROPY_NOISE_PIXEL',
|
||||
'policy_entropy_noise_line' => 'ENTROPY_NOISE_LINE_ENABLE',
|
||||
'policy_shape' => 'SHAPE_ENABLE',
|
||||
'policy_shape_noise_pixel' => 'SHAPE_NOISE_PIXEL',
|
||||
'policy_shape_noise_line' => 'SHAPE_NOISE_LINE_ENABLE',
|
||||
'policy_3dbitmap' => 'THREEDBITMAP_ENABLE',
|
||||
'policy_cells' => 'CELLS_ENABLE',
|
||||
'policy_stencil' => 'STENCIL_ENABLE',
|
||||
'policy_composite' => 'COMPOSITE_ENABLE'
|
||||
);
|
||||
$config_vars = array(
|
||||
'enable_confirm' => 'REG_ENABLE',
|
||||
'enable_post_confirm' => 'POST_ENABLE',
|
||||
'captcha_gd' => 'CAPTCHA_GD',
|
||||
'captcha_gd_noise' => 'CAPTCHA_GD_NOISE',
|
||||
);
|
||||
|
||||
$policy_modules = array('policy_entropy', 'policy_3dbitmap', 'policy_overlap', 'policy_shape', 'policy_cells', 'policy_stencil', 'policy_composite');
|
||||
|
||||
switch ($mode)
|
||||
$this->tpl_name = 'acp_captcha';
|
||||
$this->page_title = 'ACP_VC_SETTINGS';
|
||||
$submit = request_var('submit', '');
|
||||
if ($submit)
|
||||
{
|
||||
case 'visual':
|
||||
$this->tpl_name = 'acp_captcha';
|
||||
$this->page_title = 'ACP_VC_SETTINGS';
|
||||
$submit = request_var('submit', '');
|
||||
if ($submit)
|
||||
{
|
||||
$config_vars = array_keys($config_vars);
|
||||
foreach ($config_vars as $config_var)
|
||||
{
|
||||
set_config($config_var, request_var($config_var, ''));
|
||||
}
|
||||
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
|
||||
}
|
||||
else
|
||||
{
|
||||
$array = array();
|
||||
$config_vars = array_keys($config_vars);
|
||||
foreach ($config_vars as $config_var)
|
||||
{
|
||||
set_config($config_var, request_var($config_var, ''));
|
||||
}
|
||||
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
|
||||
}
|
||||
else
|
||||
{
|
||||
$array = array();
|
||||
|
||||
foreach ($config_vars as $config_var => $template_var)
|
||||
{
|
||||
$array[$template_var] = $config[$config_var];
|
||||
}
|
||||
$template->assign_vars($array);
|
||||
|
||||
|
||||
if (@extension_loaded('gd'))
|
||||
{
|
||||
$template->assign_var('GD', true);
|
||||
foreach ($policy_modules as $module_name)
|
||||
{
|
||||
$template->assign_var('U_' . strtoupper($module_name), sprintf($user->lang['CAPTCHA_EXPLAIN'], '<a href="' . append_sid("{$phpbb_root_path}adm/index.$phpEx", 'i=captcha&mode=img&policy=' . $module_name) . '">', '</a>'));
|
||||
}
|
||||
if (function_exists('imagettfbbox') && function_exists('imagettftext'))
|
||||
{
|
||||
$template->assign_var('TTF', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'img':
|
||||
$policy = request_var('policy', '');
|
||||
|
||||
if (!@extension_loaded('gd'))
|
||||
{
|
||||
trigger_error($user->lang['NO_GD'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (!($policy === 'policy_entropy' || $policy === 'policy_3dbitmap') && (!function_exists('imagettfbbox') || !function_exists('imagettftext')))
|
||||
{
|
||||
trigger_error($user->lang['NO_TTF'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (!in_array($policy, $policy_modules))
|
||||
{
|
||||
trigger_error($user->lang['BAD_POLICY'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$user->add_lang('ucp');
|
||||
|
||||
include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
|
||||
|
||||
$captcha = new captcha();
|
||||
$captcha->execute(gen_rand_string(), $policy);
|
||||
break;
|
||||
if (@extension_loaded('gd') && function_exists('imagettfbbox') && function_exists('imagettftext'))
|
||||
{
|
||||
$template->assign_var('GD', true);
|
||||
}
|
||||
foreach ($config_vars as $config_var => $template_var)
|
||||
{
|
||||
$template->assign_var($template_var, $config[$config_var]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user