Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
acp_captcha.php
001 <?php
002 /**
003 *
004 * This file is part of the phpBB Forum Software package.
005 *
006 * @copyright (c) phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 * For full copyright and license information, please see
010 * the docs/CREDITS.txt file.
011 *
012 */
013
014 /**
015 * @ignore
016 */
017 if (!defined('IN_PHPBB'))
018 {
019 exit;
020 }
021
022 class acp_captcha
023 {
024 var $u_action;
025
026 function main($id, $mode)
027 {
028 global $user, $template, $phpbb_log, $request;
029 global $config, $phpbb_container;
030
031 $user->add_lang('acp/board');
032
033 /* @var $factory \phpbb\captcha\factory */
034 $factory = $phpbb_container->get('captcha.factory');
035 $captchas = $factory->get_captcha_types();
036
037 $selected = $request->variable('select_captcha', $config['captcha_plugin']);
038 $selected = (isset($captchas['available'][$selected]) || isset($captchas['unavailable'][$selected])) ? $selected : $config['captcha_plugin'];
039 $configure = $request->variable('configure', false);
040
041 // Oh, they are just here for the view
042 if (isset($_GET['captcha_demo']))
043 {
044 $this->deliver_demo($selected);
045 }
046
047 // Delegate
048 if ($configure)
049 {
050 $config_captcha = $factory->get_instance($selected);
051 $config_captcha->acp_page($id, $this);
052 }
053 else
054 {
055 $config_vars = array(
056 'enable_confirm' => array(
057 'tpl' => 'REG_ENABLE',
058 'default' => false,
059 'validate' => 'bool',
060 'lang' => 'VISUAL_CONFIRM_REG',
061 ),
062 'enable_post_confirm' => array(
063 'tpl' => 'POST_ENABLE',
064 'default' => false,
065 'validate' => 'bool',
066 'lang' => 'VISUAL_CONFIRM_POST',
067 ),
068 'confirm_refresh' => array(
069 'tpl' => 'CONFIRM_REFRESH',
070 'default' => false,
071 'validate' => 'bool',
072 'lang' => 'VISUAL_CONFIRM_REFRESH',
073 ),
074 'max_reg_attempts' => array(
075 'tpl' => 'REG_LIMIT',
076 'default' => 0,
077 'validate' => 'int:0:99999',
078 'lang' => 'REG_LIMIT',
079 ),
080 'max_login_attempts' => array(
081 'tpl' => 'MAX_LOGIN_ATTEMPTS',
082 'default' => 0,
083 'validate' => 'int:0:99999',
084 'lang' => 'MAX_LOGIN_ATTEMPTS',
085 ),
086 );
087
088 $this->tpl_name = 'acp_captcha';
089 $this->page_title = 'ACP_VC_SETTINGS';
090 $form_key = 'acp_captcha';
091 add_form_key($form_key);
092
093 $submit = $request->variable('main_submit', false);
094 $error = $cfg_array = array();
095
096 if ($submit)
097 {
098 foreach ($config_vars as $config_var => $options)
099 {
100 $cfg_array[$config_var] = $request->variable($config_var, $options['default']);
101 }
102 validate_config_vars($config_vars, $cfg_array, $error);
103
104 if (!check_form_key($form_key))
105 {
106 $error[] = $user->lang['FORM_INVALID'];
107 }
108 if ($error)
109 {
110 $submit = false;
111 }
112 }
113
114 if ($submit)
115 {
116 foreach ($cfg_array as $key => $value)
117 {
118 $config->set($key, $value);
119 }
120
121 if ($selected !== $config['captcha_plugin'])
122 {
123 // sanity check
124 if (isset($captchas['available'][$selected]))
125 {
126 $old_captcha = $factory->get_instance($config['captcha_plugin']);
127 $old_captcha->uninstall();
128
129 $config->set('captcha_plugin', $selected);
130 $new_captcha = $factory->get_instance($config['captcha_plugin']);
131 $new_captcha->install();
132
133 $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_VISUAL');
134 }
135 else
136 {
137 trigger_error($user->lang['CAPTCHA_UNAVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
138 }
139 }
140 trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
141 }
142 else
143 {
144 $captcha_select = '';
145 foreach ($captchas['available'] as $value => $title)
146 {
147 $current = ($selected !== false && $value == $selected) ? ' selected="selected"' : '';
148 $captcha_select .= '<option value="' . $value . '"' . $current . '>' . $user->lang($title) . '</option>';
149 }
150
151 foreach ($captchas['unavailable'] as $value => $title)
152 {
153 $current = ($selected !== false && $value == $selected) ? ' selected="selected"' : '';
154 $captcha_select .= '<option value="' . $value . '"' . $current . ' class="disabled-option">' . $user->lang($title) . '</option>';
155 }
156
157 $demo_captcha = $factory->get_instance($selected);
158
159 foreach ($config_vars as $config_var => $options)
160 {
161 $template->assign_var($options['tpl'], (isset($_POST[$config_var])) ? $request->variable($config_var, $options['default']) : $config[$config_var]) ;
162 }
163
164 $template->assign_vars(array(
165 'CAPTCHA_PREVIEW_TPL' => $demo_captcha->get_demo_template($id),
166 'S_CAPTCHA_HAS_CONFIG' => $demo_captcha->has_config(),
167 'CAPTCHA_SELECT' => $captcha_select,
168 'ERROR_MSG' => implode('<br />', $error),
169
170 'U_ACTION' => $this->u_action,
171 ));
172 }
173 }
174 }
175
176 /**
177 * Entry point for delivering image CAPTCHAs in the ACP.
178 */
179 function deliver_demo($selected)
180 {
181 global $phpbb_container;
182
183 $captcha = $phpbb_container->get('captcha.factory')->get_instance($selected);
184 $captcha->init(CONFIRM_REG);
185 $captcha->execute_demo();
186
187 garbage_collection();
188 exit_handler();
189 }
190 }
191