~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/php/phpBB3/includes/acp/acp_captcha.php

  • Committer: William Grant
  • Date: 2009-02-23 23:47:02 UTC
  • mfrom: (1099.1.211 new-dispatch)
  • Revision ID: grantw@unimelb.edu.au-20090223234702-db4b1llly46ignwo
Merge from lp:~ivle-dev/ivle/new-dispatch.

Pretty much everything changes. Reread the setup docs. Backup your databases.
Every file is now in a different installed location, the configuration system
is rewritten, the dispatch system is rewritten, URLs are different, the
database is different, worksheets and exercises are no longer on the
filesystem, we use a templating engine, jail service protocols are rewritten,
we don't repeat ourselves, we have authorization rewritten, phpBB is gone,
and probably lots of other things that I cannot remember.

This is certainly the biggest commit I have ever made, and hopefully
the largest I ever will.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/**
3
 
*
4
 
* @package acp
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
8
 
*/
9
 
 
10
 
/**
11
 
* @ignore
12
 
*/
13
 
if (!defined('IN_PHPBB'))
14
 
{
15
 
        exit;
16
 
}
17
 
 
18
 
/**
19
 
* @package acp
20
 
*/
21
 
class acp_captcha
22
 
{
23
 
        var $u_action;
24
 
 
25
 
        function main($id, $mode)
26
 
        {
27
 
                global $db, $user, $auth, $template;
28
 
                global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
29
 
 
30
 
                $user->add_lang('acp/board');
31
 
 
32
 
                
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'
38
 
                );
39
 
 
40
 
                if (isset($_GET['demo']))
41
 
                {
42
 
                        $captcha_vars = array_keys($captcha_vars);
43
 
                        foreach ($captcha_vars as $captcha_var)
44
 
                        {
45
 
                                $config[$captcha_var] = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var];
46
 
                        }
47
 
                        if ($config['captcha_gd'])
48
 
                        {
49
 
                                include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
50
 
                        }
51
 
                        else
52
 
                        {
53
 
                                include($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx);
54
 
                        }
55
 
                        $captcha = new captcha();
56
 
                        $captcha->execute(gen_rand_string(mt_rand(5, 8)), time());
57
 
                        exit_handler();
58
 
                }
59
 
 
60
 
                $config_vars = array(
61
 
                        'enable_confirm'                => 'REG_ENABLE',
62
 
                        'enable_post_confirm'   => 'POST_ENABLE',
63
 
                        'captcha_gd'                    => 'CAPTCHA_GD',
64
 
                );
65
 
 
66
 
                $this->tpl_name = 'acp_captcha';
67
 
                $this->page_title = 'ACP_VC_SETTINGS';
68
 
                $form_key = 'acp_captcha';
69
 
                add_form_key($form_key);
70
 
 
71
 
                $submit = request_var('submit', '');
72
 
 
73
 
                if ($submit && check_form_key($form_key))
74
 
                {
75
 
                        $config_vars = array_keys($config_vars);
76
 
                        foreach ($config_vars as $config_var)
77
 
                        {
78
 
                                set_config($config_var, request_var($config_var, ''));
79
 
                        }
80
 
                        $captcha_vars = array_keys($captcha_vars);
81
 
                        foreach ($captcha_vars as $captcha_var)
82
 
                        {
83
 
                                set_config($captcha_var, request_var($captcha_var, 0));
84
 
                        }
85
 
                        trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
86
 
                }
87
 
                else if ($submit)
88
 
                {
89
 
                                trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
90
 
                }
91
 
                else
92
 
                {
93
 
                        
94
 
                        $preview_image_src = append_sid(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&amp;demo=demo"));
95
 
                        if (@extension_loaded('gd'))
96
 
                        {
97
 
                                $template->assign_var('GD', true);
98
 
                        }
99
 
                        foreach ($config_vars as $config_var => $template_var)
100
 
                        {
101
 
                                $template->assign_var($template_var, (isset($_REQUEST[$config_var])) ? request_var($config_var, '') : $config[$config_var]) ;
102
 
                        }
103
 
                        foreach ($captcha_vars as $captcha_var => $template_var)
104
 
                        {
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 .= "&amp;$captcha_var=" . $var;
108
 
                        }
109
 
                        $template->assign_vars(array(
110
 
                                'CAPTCHA_PREVIEW'       => $preview_image_src,
111
 
                                'PREVIEW'                       => isset($_POST['preview']),
112
 
                        ));
113
 
                        
114
 
                }
115
 
        }
116
 
}
117
 
 
118
 
?>
 
 
b'\\ No newline at end of file'