Verzeichnisstruktur phpBB-3.0.0
- Veröffentlicht
- 12.12.2007
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 |
mcp_ban.php
001 <?php
002 /**
003 *
004 * @package mcp
005 * @version $Id$
006 * @copyright (c) 2005 phpBB Group
007 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
008 *
009 */
010
011 /**
012 * @ignore
013 */
014 if (!defined('IN_PHPBB'))
015 {
016 exit;
017 }
018
019 /**
020 * @package mcp
021 */
022 class mcp_ban
023 {
024 var $u_action;
025
026 function main($id, $mode)
027 {
028 global $config, $db, $user, $auth, $template, $cache;
029 global $phpbb_root_path, $phpEx;
030
031 include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
032
033 // Include the admin banning interface...
034 include($phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx);
035
036 $bansubmit = (isset($_POST['bansubmit'])) ? true : false;
037 $unbansubmit = (isset($_POST['unbansubmit'])) ? true : false;
038 $current_time = time();
039
040 $user->add_lang(array('acp/ban', 'acp/users'));
041 $this->tpl_name = 'mcp_ban';
042
043 // Ban submitted?
044 if ($bansubmit)
045 {
046 // Grab the list of entries
047 $ban = request_var('ban', '', ($mode === 'user') ? true : false);
048
049 if ($mode === 'user')
050 {
051 $ban = utf8_normalize_nfc($ban);
052 }
053
054 $ban_len = request_var('banlength', 0);
055 $ban_len_other = request_var('banlengthother', '');
056 $ban_exclude = request_var('banexclude', 0);
057 $ban_reason = utf8_normalize_nfc(request_var('banreason', '', true));
058 $ban_give_reason = utf8_normalize_nfc(request_var('bangivereason', '', true));
059
060 if ($ban)
061 {
062 if (confirm_box(true))
063 {
064 user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason);
065
066 trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">« ' . $user->lang['BACK_TO_PREV'] . '</a>');
067 }
068 else
069 {
070 confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
071 'mode' => $mode,
072 'ban' => $ban,
073 'bansubmit' => true,
074 'banlength' => $ban_len,
075 'banlengthother' => $ban_len_other,
076 'banexclude' => $ban_exclude,
077 'banreason' => $ban_reason,
078 'bangivereason' => $ban_give_reason)));
079 }
080 }
081 }
082 else if ($unbansubmit)
083 {
084 $ban = request_var('unban', array(''));
085
086 if ($ban)
087 {
088 if (confirm_box(true))
089 {
090 user_unban($mode, $ban);
091
092 trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">« ' . $user->lang['BACK_TO_PREV'] . '</a>');
093 }
094 else
095 {
096 confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
097 'mode' => $mode,
098 'unbansubmit' => true,
099 'unban' => $ban)));
100 }
101 }
102 }
103
104 // Ban length options
105 $ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['UNTIL'] . ' -> ');
106
107 $ban_end_options = '';
108 foreach ($ban_end_text as $length => $text)
109 {
110 $ban_end_options .= '<option value="' . $length . '">' . $text . '</option>';
111 }
112
113 // Define language vars
114 $this->page_title = $user->lang[strtoupper($mode) . '_BAN'];
115
116 $l_ban_explain = $user->lang[strtoupper($mode) . '_BAN_EXPLAIN'];
117 $l_ban_exclude_explain = $user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN'];
118 $l_unban_title = $user->lang[strtoupper($mode) . '_UNBAN'];
119 $l_unban_explain = $user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN'];
120 $l_no_ban_cell = $user->lang[strtoupper($mode) . '_NO_BANNED'];
121
122 switch ($mode)
123 {
124 case 'user':
125 $l_ban_cell = $user->lang['USERNAME'];
126 break;
127
128 case 'ip':
129 $l_ban_cell = $user->lang['IP_HOSTNAME'];
130 break;
131
132 case 'email':
133 $l_ban_cell = $user->lang['EMAIL_ADDRESS'];
134 break;
135 }
136
137 acp_ban::display_ban_options($mode);
138
139 $template->assign_vars(array(
140 'L_TITLE' => $this->page_title,
141 'L_EXPLAIN' => $l_ban_explain,
142 'L_UNBAN_TITLE' => $l_unban_title,
143 'L_UNBAN_EXPLAIN' => $l_unban_explain,
144 'L_BAN_CELL' => $l_ban_cell,
145 'L_BAN_EXCLUDE_EXPLAIN' => $l_ban_exclude_explain,
146 'L_NO_BAN_CELL' => $l_no_ban_cell,
147
148 'S_USERNAME_BAN' => ($mode == 'user') ? true : false,
149
150 'U_ACTION' => $this->u_action,
151 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp_ban&field=ban'),
152 ));
153
154 if ($mode != 'user')
155 {
156 return;
157 }
158
159 // As a "service" we will check if any post id is specified and populate the username of the poster id if given
160 $post_id = request_var('p', 0);
161 $user_id = request_var('u', 0);
162 $username = false;
163
164 if ($user_id && $user_id <> ANONYMOUS)
165 {
166 $sql = 'SELECT username
167 FROM ' . USERS_TABLE . '
168 WHERE user_id = ' . $user_id;
169 $result = $db->sql_query($sql);
170 $username = (string) $db->sql_fetchfield('username');
171 $db->sql_freeresult($result);
172 }
173 else if ($post_id)
174 {
175 $post_info = get_post_data($post_id, 'm_ban');
176
177 if (sizeof($post_info) && !empty($post_info[$post_id]))
178 {
179 $username = $post_info[$post_id]['username'];
180 }
181 }
182
183 if ($username)
184 {
185 $template->assign_var('USERNAMES', $username);
186 }
187 }
188 }
189
190 ?>