Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 5.13 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_ban
023  {
024      var $u_action;
025   
026      function main($id, $mode)
027      {
028          global $user, $template, $request, $phpbb_dispatcher;
029          global $phpbb_root_path, $phpEx;
030   
031          if (!function_exists('user_ban'))
032          {
033              include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
034          }
035   
036          $bansubmit    = $request->is_set_post('bansubmit');
037          $unbansubmit = $request->is_set_post('unbansubmit');
038   
039          $user->add_lang(array('acp/ban', 'acp/users'));
040          $this->tpl_name = 'acp_ban';
041          $form_key = 'acp_ban';
042          add_form_key($form_key);
043   
044          if (($bansubmit || $unbansubmit) && !check_form_key($form_key))
045          {
046              trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
047          }
048   
049          // Ban submitted?
050          if ($bansubmit)
051          {
052              // Grab the list of entries
053              $ban                = $request->variable('ban', '', true);
054              $ban_length            = $request->variable('banlength', 0);
055              $ban_length_other    = $request->variable('banlengthother', '');
056              $ban_exclude        = $request->variable('banexclude', 0);
057              $ban_reason            = $request->variable('banreason', '', true);
058              $ban_give_reason    = $request->variable('bangivereason', '', true);
059   
060              if ($ban)
061              {
062                  $abort_ban = false;
063                  /**
064                  * Use this event to modify the ban details before the ban is performed
065                  *
066                  * @event core.acp_ban_before
067                  * @var    string    mode                One of the following: user, ip, email
068                  * @var    string    ban                    Either string or array with usernames, ips or email addresses
069                  * @var    int        ban_length            Ban length in minutes
070                  * @var    string    ban_length_other    Ban length as a date (YYYY-MM-DD)
071                  * @var    bool    ban_exclude            Are we banning or excluding from another ban
072                  * @var    string    ban_reason            Ban reason displayed to moderators
073                  * @var    string    ban_give_reason        Ban reason displayed to the banned user
074                  * @var    mixed    abort_ban            Either false, or an error message that is displayed to the user.
075                  *                                    If a string is given the bans are not issued.
076                  * @since 3.1.0-RC5
077                  */
078                  $vars = array(
079                      'mode',
080                      'ban',
081                      'ban_length',
082                      'ban_length_other',
083                      'ban_exclude',
084                      'ban_reason',
085                      'ban_give_reason',
086                      'abort_ban',
087                  );
088                  extract($phpbb_dispatcher->trigger_event('core.acp_ban_before', compact($vars)));
089   
090                  if ($abort_ban)
091                  {
092                      trigger_error($abort_ban . adm_back_link($this->u_action));
093                  }
094                  user_ban($mode, $ban, $ban_length, $ban_length_other, $ban_exclude, $ban_reason, $ban_give_reason);
095   
096                  /**
097                  * Use this event to perform actions after the ban has been performed
098                  *
099                  * @event core.acp_ban_after
100                  * @var    string    mode                One of the following: user, ip, email
101                  * @var    string    ban                    Either string or array with usernames, ips or email addresses
102                  * @var    int        ban_length            Ban length in minutes
103                  * @var    string    ban_length_other    Ban length as a date (YYYY-MM-DD)
104                  * @var    bool    ban_exclude            Are we banning or excluding from another ban
105                  * @var    string    ban_reason            Ban reason displayed to moderators
106                  * @var    string    ban_give_reason        Ban reason displayed to the banned user
107                  * @since 3.1.0-RC5
108                  */
109                  $vars = array(
110                      'mode',
111                      'ban',
112                      'ban_length',
113                      'ban_length_other',
114                      'ban_exclude',
115                      'ban_reason',
116                      'ban_give_reason',
117                  );
118                  extract($phpbb_dispatcher->trigger_event('core.acp_ban_after', compact($vars)));
119   
120                  trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . adm_back_link($this->u_action));
121              }
122          }
123          else if ($unbansubmit)
124          {
125              $ban = $request->variable('unban', array(''));
126   
127              if ($ban)
128              {
129                  user_unban($mode, $ban);
130   
131                  trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . adm_back_link($this->u_action));
132              }
133          }
134   
135          // Define language vars
136          $this->page_title = $user->lang[strtoupper($mode) . '_BAN'];
137   
138          $l_ban_explain = $user->lang[strtoupper($mode) . '_BAN_EXPLAIN'];
139          $l_ban_exclude_explain = $user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN'];
140          $l_unban_title = $user->lang[strtoupper($mode) . '_UNBAN'];
141          $l_unban_explain = $user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN'];
142          $l_no_ban_cell = $user->lang[strtoupper($mode) . '_NO_BANNED'];
143   
144          switch ($mode)
145          {
146              case 'user':
147                  $l_ban_cell = $user->lang['USERNAME'];
148              break;
149   
150              case 'ip':
151                  $l_ban_cell = $user->lang['IP_HOSTNAME'];
152              break;
153   
154              case 'email':
155                  $l_ban_cell = $user->lang['EMAIL_ADDRESS'];
156              break;
157          }
158   
159          display_ban_end_options();
160          display_ban_options($mode);
161   
162          $template->assign_vars(array(
163              'L_TITLE'                => $this->page_title,
164              'L_EXPLAIN'                => $l_ban_explain,
165              'L_UNBAN_TITLE'            => $l_unban_title,
166              'L_UNBAN_EXPLAIN'        => $l_unban_explain,
167              'L_BAN_CELL'            => $l_ban_cell,
168              'L_BAN_EXCLUDE_EXPLAIN'    => $l_ban_exclude_explain,
169              'L_NO_BAN_CELL'            => $l_no_ban_cell,
170   
171              'S_USERNAME_BAN'    => ($mode == 'user') ? true : false,
172   
173              'U_ACTION'            => $this->u_action,
174              'U_FIND_USERNAME'    => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=acp_ban&amp;field=ban'),
175          ));
176      }
177  }
178