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

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 5.36 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_logs
023  {
024      var $u_action;
025   
026      function main($id, $mode)
027      {
028          global $user, $auth, $template, $phpbb_container;
029          global $config;
030          global $request;
031   
032          $user->add_lang('mcp');
033   
034          // Set up general vars
035          $action        = $request->variable('action', '');
036          $forum_id    = $request->variable('f', 0);
037          $start        = $request->variable('start', 0);
038          $deletemark = $request->variable('delmarked', false, false, \phpbb\request\request_interface::POST);
039          $deleteall    = $request->variable('delall', false, false, \phpbb\request\request_interface::POST);
040          $marked        = $request->variable('mark', array(0));
041   
042          // Sort keys
043          $sort_days    = $request->variable('st', 0);
044          $sort_key    = $request->variable('sk', 't');
045          $sort_dir    = $request->variable('sd', 'd');
046   
047          $this->tpl_name = 'acp_logs';
048          $this->log_type = constant('LOG_' . strtoupper($mode));
049   
050          /* @var $pagination \phpbb\pagination */
051          $pagination = $phpbb_container->get('pagination');
052   
053          // Delete entries if requested and able
054          if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
055          {
056              if (confirm_box(true))
057              {
058                  $conditions = array();
059   
060                  if ($deletemark && sizeof($marked))
061                  {
062                      $conditions['log_id'] = array('IN' => $marked);
063                  }
064   
065                  if ($deleteall)
066                  {
067                      if ($sort_days)
068                      {
069                          $conditions['log_time'] = array('>=', time() - ($sort_days * 86400));
070                      }
071   
072                      $keywords = $request->variable('keywords', '', true);
073                      $conditions['keywords'] = $keywords;
074                  }
075   
076                  /* @var $phpbb_log \phpbb\log\log_interface */
077                  $phpbb_log = $phpbb_container->get('log');
078                  $phpbb_log->delete($mode, $conditions);
079              }
080              else
081              {
082                  confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
083                      'f'            => $forum_id,
084                      'start'        => $start,
085                      'delmarked'    => $deletemark,
086                      'delall'    => $deleteall,
087                      'mark'        => $marked,
088                      'st'        => $sort_days,
089                      'sk'        => $sort_key,
090                      'sd'        => $sort_dir,
091                      'i'            => $id,
092                      'mode'        => $mode,
093                      'action'    => $action))
094                  );
095              }
096          }
097   
098          // Sorting
099          $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']);
100          $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
101          $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
102   
103          $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
104          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);
105   
106          // Define where and sort sql for use in displaying logs
107          $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
108          $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
109   
110          $keywords = $request->variable('keywords', '', true);
111          $keywords_param = !empty($keywords) ? '&amp;keywords=' . urlencode(htmlspecialchars_decode($keywords)) : '';
112   
113          $l_title = $user->lang['ACP_' . strtoupper($mode) . '_LOGS'];
114          $l_title_explain = $user->lang['ACP_' . strtoupper($mode) . '_LOGS_EXPLAIN'];
115   
116          $this->page_title = $l_title;
117   
118          // Define forum list if we're looking @ mod logs
119          if ($mode == 'mod')
120          {
121              $forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id);
122   
123              $template->assign_vars(array(
124                  'S_SHOW_FORUMS'            => true,
125                  'S_FORUM_BOX'            => $forum_box)
126              );
127          }
128   
129          // Grab log data
130          $log_data = array();
131          $log_count = 0;
132          $start = view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort, $keywords);
133   
134          $base_url = $this->u_action . "&amp;$u_sort_param$keywords_param";
135          $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
136   
137          $template->assign_vars(array(
138              'L_TITLE'        => $l_title,
139              'L_EXPLAIN'        => $l_title_explain,
140              'U_ACTION'        => $this->u_action . "&amp;$u_sort_param$keywords_param&amp;start=$start",
141   
142              'S_LIMIT_DAYS'    => $s_limit_days,
143              'S_SORT_KEY'    => $s_sort_key,
144              'S_SORT_DIR'    => $s_sort_dir,
145              'S_CLEARLOGS'    => $auth->acl_get('a_clearlogs'),
146              'S_KEYWORDS'    => $keywords,
147              )
148          );
149   
150          foreach ($log_data as $row)
151          {
152              $data = array();
153   
154              $checks = array('viewtopic', 'viewlogs', 'viewforum');
155              foreach ($checks as $check)
156              {
157                  if (isset($row[$check]) && $row[$check])
158                  {
159                      $data[] = '<a href="' . $row[$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>';
160                  }
161              }
162   
163              $template->assign_block_vars('log', array(
164                  'USERNAME'            => $row['username_full'],
165                  'REPORTEE_USERNAME'    => ($row['reportee_username'] && $row['user_id'] != $row['reportee_id']) ? $row['reportee_username_full'] : '',
166   
167                  'IP'                => $row['ip'],
168                  'DATE'                => $user->format_date($row['time']),
169                  'ACTION'            => $row['action'],
170                  'DATA'                => (sizeof($data)) ? implode(' | ', $data) : '',
171                  'ID'                => $row['id'],
172                  )
173              );
174          }
175      }
176  }
177