Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

acp_captcha.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 4.18 KiB


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 $db, $user, $auth, $template;
029          global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container;
030   
031          $user->add_lang('acp/board');
032   
033          $factory = $phpbb_container->get('captcha.factory');
034          $captchas = $factory->get_captcha_types();
035   
036          $selected = request_var('select_captcha', $config['captcha_plugin']);
037          $selected = (isset($captchas['available'][$selected]) || isset($captchas['unavailable'][$selected])) ? $selected : $config['captcha_plugin'];
038          $configure = request_var('configure', false);
039   
040          // Oh, they are just here for the view
041          if (isset($_GET['captcha_demo']))
042          {
043              $this->deliver_demo($selected);
044          }
045   
046          // Delegate
047          if ($configure)
048          {
049              $config_captcha = $factory->get_instance($selected);
050              $config_captcha->acp_page($id, $this);
051          }
052          else
053          {
054              $config_vars = array(
055                  'enable_confirm'        => array('tpl' => 'REG_ENABLE', 'default' => false),
056                  'enable_post_confirm'    => array('tpl' => 'POST_ENABLE', 'default' => false),
057                  'confirm_refresh'        => array('tpl' => 'CONFIRM_REFRESH', 'default' => false),
058                  'max_reg_attempts'        => array('tpl' => 'REG_LIMIT', 'default' => 0),
059                  'max_login_attempts'        => array('tpl' => 'MAX_LOGIN_ATTEMPTS', 'default' => 0),
060              );
061   
062              $this->tpl_name = 'acp_captcha';
063              $this->page_title = 'ACP_VC_SETTINGS';
064              $form_key = 'acp_captcha';
065              add_form_key($form_key);
066   
067              $submit = request_var('main_submit', false);
068   
069              if ($submit && check_form_key($form_key))
070              {
071                  foreach ($config_vars as $config_var => $options)
072                  {
073                      set_config($config_var, request_var($config_var, $options['default']));
074                  }
075   
076                  if ($selected !== $config['captcha_plugin'])
077                  {
078                      // sanity check
079                      if (isset($captchas['available'][$selected]))
080                      {
081                          $old_captcha = $factory->get_instance($config['captcha_plugin']);
082                          $old_captcha->uninstall();
083   
084                          set_config('captcha_plugin', $selected);
085                          $new_captcha = $factory->get_instance($config['captcha_plugin']);
086                          $new_captcha->install();
087   
088                          add_log('admin', 'LOG_CONFIG_VISUAL');
089                      }
090                      else
091                      {
092                          trigger_error($user->lang['CAPTCHA_UNAVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
093                      }
094                  }
095                  trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
096              }
097              else if ($submit)
098              {
099                  trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
100              }
101              else
102              {
103                  $captcha_select = '';
104                  foreach ($captchas['available'] as $value => $title)
105                  {
106                      $current = ($selected !== false && $value == $selected) ? ' selected="selected"' : '';
107                      $captcha_select .= '<option value="' . $value . '"' . $current . '>' . $user->lang($title) . '</option>';
108                  }
109   
110                  foreach ($captchas['unavailable'] as $value => $title)
111                  {
112                      $current = ($selected !== false && $value == $selected) ? ' selected="selected"' : '';
113                      $captcha_select .= '<option value="' . $value . '"' . $current . ' class="disabled-option">' . $user->lang($title) . '</option>';
114                  }
115   
116                  $demo_captcha = $factory->get_instance($selected);
117   
118                  foreach ($config_vars as $config_var => $options)
119                  {
120                      $template->assign_var($options['tpl'], (isset($_POST[$config_var])) ? request_var($config_var, $options['default']) : $config[$config_var]) ;
121                  }
122   
123                  $template->assign_vars(array(
124                      'CAPTCHA_PREVIEW_TPL'    => $demo_captcha->get_demo_template($id),
125                      'S_CAPTCHA_HAS_CONFIG'    => $demo_captcha->has_config(),
126                      'CAPTCHA_SELECT'        => $captcha_select,
127   
128                      'U_ACTION'                => $this->u_action,
129                  ));
130              }
131          }
132      }
133   
134      /**
135      * Entry point for delivering image CAPTCHAs in the ACP.
136      */
137      function deliver_demo($selected)
138      {
139          global $db, $user, $config, $phpbb_container;
140   
141          $captcha = $phpbb_container->get('captcha.factory')->get_instance($selected);
142          $captcha->init(CONFIRM_REG);
143          $captcha->execute_demo();
144   
145          garbage_collection();
146          exit_handler();
147      }
148  }
149