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_disallow.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 3.05 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_disallow
023  {
024      var $u_action;
025   
026      function main($id, $mode)
027      {
028          global $db, $user, $auth, $template, $cache;
029          global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
030   
031          include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
032   
033          $user->add_lang('acp/posting');
034   
035          // Set up general vars
036          $this->tpl_name = 'acp_disallow';
037          $this->page_title = 'ACP_DISALLOW_USERNAMES';
038   
039          $form_key = 'acp_disallow';
040          add_form_key($form_key);
041   
042          $disallow = (isset($_POST['disallow'])) ? true : false;
043          $allow = (isset($_POST['allow'])) ? true : false;
044   
045          if (($allow || $disallow) && !check_form_key($form_key))
046          {
047              trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
048          }
049   
050          if ($disallow)
051          {
052              $disallowed_user = str_replace('*', '%', utf8_normalize_nfc(request_var('disallowed_user', '', true)));
053   
054              if (!$disallowed_user)
055              {
056                  trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING);
057              }
058   
059              $sql = 'SELECT disallow_id
060                  FROM ' . DISALLOW_TABLE . "
061                  WHERE disallow_username = '" . $db->sql_escape($disallowed_user) . "'";
062              $result = $db->sql_query($sql);
063              $row = $db->sql_fetchrow($result);
064              $db->sql_freeresult($result);
065   
066              if ($row)
067              {
068                  trigger_error($user->lang['DISALLOWED_ALREADY'] . adm_back_link($this->u_action), E_USER_WARNING);
069              }
070   
071              $sql = 'INSERT INTO ' . DISALLOW_TABLE . ' ' . $db->sql_build_array('INSERT', array('disallow_username' => $disallowed_user));
072              $db->sql_query($sql);
073   
074              $cache->destroy('_disallowed_usernames');
075   
076              $message = $user->lang['DISALLOW_SUCCESSFUL'];
077              add_log('admin', 'LOG_DISALLOW_ADD', str_replace('%', '*', $disallowed_user));
078   
079              trigger_error($message . adm_back_link($this->u_action));
080          }
081          else if ($allow)
082          {
083              $disallowed_id = request_var('disallowed_id', 0);
084   
085              if (!$disallowed_id)
086              {
087                  trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING);
088              }
089   
090              $sql = 'DELETE FROM ' . DISALLOW_TABLE . '
091                  WHERE disallow_id = ' . $disallowed_id;
092              $db->sql_query($sql);
093   
094              $cache->destroy('_disallowed_usernames');
095   
096              add_log('admin', 'LOG_DISALLOW_DELETE');
097   
098              trigger_error($user->lang['DISALLOWED_DELETED'] . adm_back_link($this->u_action));
099          }
100   
101          // Grab the current list of disallowed usernames...
102          $sql = 'SELECT *
103              FROM ' . DISALLOW_TABLE;
104          $result = $db->sql_query($sql);
105   
106          $disallow_select = '';
107          while ($row = $db->sql_fetchrow($result))
108          {
109              $disallow_select .= '<option value="' . $row['disallow_id'] . '">' . str_replace('%', '*', $row['disallow_username']) . '</option>';
110          }
111          $db->sql_freeresult($result);
112   
113          $template->assign_vars(array(
114              'U_ACTION'                => $this->u_action,
115              'S_DISALLOWED_NAMES'    => $disallow_select)
116          );
117      }
118  }
119