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

mcp_logs.php

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