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. |
|
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
mcp_logs.php
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 /**
023 * mcp_logs
024 * Handling warning the users
025 */
026 class mcp_logs
027 {
028 var $u_action;
029 var $p_master;
030
031 function __construct($p_master)
032 {
033 $this->p_master = $p_master;
034 }
035
036 function main($id, $mode)
037 {
038 global $auth, $db, $user, $template, $request;
039 global $config, $phpbb_container, $phpbb_log;
040
041 $user->add_lang('acp/common');
042 $this->p_master->add_mod_info('acp');
043
044 $action = $request->variable('action', array('' => ''));
045
046 if (is_array($action))
047 {
048 $action = key($action);
049 }
050 else
051 {
052 $action = $request->variable('action', '');
053 }
054
055 // Set up general vars
056 $start = $request->variable('start', 0);
057 $deletemark = ($action == 'del_marked') ? true : false;
058 $deleteall = ($action == 'del_all') ? true : false;
059 $marked = $request->variable('mark', array(0));
060
061 // Sort keys
062 $sort_days = $request->variable('st', 0);
063 $sort_key = $request->variable('sk', 't');
064 $sort_dir = $request->variable('sd', 'd');
065
066 $this->tpl_name = 'mcp_logs';
067 $this->page_title = 'MCP_LOGS';
068
069 /* @var $pagination \phpbb\pagination */
070 $pagination = $phpbb_container->get('pagination');
071
072 $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_')));
073 $forum_list[] = 0;
074
075 $forum_id = $topic_id = 0;
076
077 switch ($mode)
078 {
079 case 'front':
080 break;
081
082 case 'forum_logs':
083 $forum_id = $request->variable('f', 0);
084
085 if (!in_array($forum_id, $forum_list))
086 {
087 send_status_line(403, 'Forbidden');
088 trigger_error('NOT_AUTHORISED');
089 }
090
091 $forum_list = array($forum_id);
092 break;
093
094 case 'topic_logs':
095 $topic_id = $request->variable('t', 0);
096
097 $sql = 'SELECT forum_id
098 FROM ' . TOPICS_TABLE . '
099 WHERE topic_id = ' . $topic_id;
100 $result = $db->sql_query($sql);
101 $forum_id = (int) $db->sql_fetchfield('forum_id');
102 $db->sql_freeresult($result);
103
104 if (!in_array($forum_id, $forum_list))
105 {
106 send_status_line(403, 'Forbidden');
107 trigger_error('NOT_AUTHORISED');
108 }
109
110 $forum_list = array($forum_id);
111 break;
112 }
113
114 // Delete entries if requested and able
115 if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
116 {
117 if (confirm_box(true))
118 {
119 if ($deletemark && count($marked))
120 {
121 $conditions = array(
122 'forum_id' => array('IN' => $forum_list),
123 'log_id' => array('IN' => $marked),
124 );
125
126 $phpbb_log->delete('mod', $conditions);
127 }
128 else if ($deleteall)
129 {
130 $keywords = $request->variable('keywords', '', true);
131
132 $conditions = array(
133 'forum_id' => array('IN' => $forum_list),
134 'keywords' => $keywords,
135 );
136
137 if ($sort_days)
138 {
139 $conditions['log_time'] = array('>=', time() - ($sort_days * 86400));
140 }
141
142 if ($mode == 'topic_logs')
143 {
144 $conditions['topic_id'] = $topic_id;
145 }
146
147 $phpbb_log->delete('mod', $conditions);
148 }
149 }
150 else
151 {
152 confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
153 'f' => $forum_id,
154 't' => $topic_id,
155 'start' => $start,
156 'delmarked' => $deletemark,
157 'delall' => $deleteall,
158 'mark' => $marked,
159 'st' => $sort_days,
160 'sk' => $sort_key,
161 'sd' => $sort_dir,
162 'i' => $id,
163 'mode' => $mode,
164 'action' => $request->variable('action', array('' => ''))))
165 );
166 }
167 }
168
169 // Sorting
170 $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
171 $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
172 $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
173
174 $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
175 gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
176
177 // Define where and sort sql for use in displaying logs
178 $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
179 $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
180
181 $keywords = $request->variable('keywords', '', true);
182 $keywords_param = !empty($keywords) ? '&keywords=' . urlencode(html_entity_decode($keywords, ENT_COMPAT)) : '';
183
184 // Grab log data
185 $log_data = array();
186 $log_count = 0;
187 $start = view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords);
188
189 $base_url = $this->u_action . "&$u_sort_param$keywords_param";
190 $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
191
192 $template->assign_vars(array(
193 'TOTAL' => $user->lang('TOTAL_LOGS', (int) $log_count),
194
195 'L_TITLE' => $user->lang['MCP_LOGS'],
196
197 'U_POST_ACTION' => $this->u_action . "&$u_sort_param$keywords_param&start=$start",
198 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false,
199 'S_SELECT_SORT_DIR' => $s_sort_dir,
200 'S_SELECT_SORT_KEY' => $s_sort_key,
201 'S_SELECT_SORT_DAYS' => $s_limit_days,
202 'S_LOGS' => ($log_count > 0),
203 'S_KEYWORDS' => $keywords,
204 )
205 );
206
207 foreach ($log_data as $row)
208 {
209 $data = array();
210
211 $checks = array('viewpost', 'viewtopic', 'viewforum');
212 foreach ($checks as $check)
213 {
214 if (isset($row[$check]) && $row[$check])
215 {
216 $data[] = '<a href="' . $row[$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>';
217 }
218 }
219
220 $template->assign_block_vars('log', array(
221 'USERNAME' => $row['username_full'],
222 'IP' => $row['ip'],
223 'DATE' => $user->format_date($row['time']),
224 'ACTION' => $row['action'],
225 'DATA' => (count($data)) ? implode(' | ', $data) : '',
226 'ID' => $row['id'],
227 )
228 );
229 }
230 }
231 }
232