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.
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:51 - Dateigröße: 4.79 KiB


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