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