[ Index ]

PHP Cross Reference of phpBB-3.2.8-deutsch

title

Body

[close]

/includes/acp/ -> acp_logs.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  /**
  15  * @ignore
  16  */
  17  if (!defined('IN_PHPBB'))
  18  {
  19      exit;
  20  }
  21  
  22  class acp_logs
  23  {
  24      var $u_action;
  25  
  26  	function main($id, $mode)
  27      {
  28          global $user, $auth, $template, $phpbb_container;
  29          global $config;
  30          global $request;
  31  
  32          $user->add_lang('mcp');
  33  
  34          // Set up general vars
  35          $action        = $request->variable('action', '');
  36          $forum_id    = $request->variable('f', 0);
  37          $start        = $request->variable('start', 0);
  38          $deletemark = $request->variable('delmarked', false, false, \phpbb\request\request_interface::POST);
  39          $deleteall    = $request->variable('delall', false, false, \phpbb\request\request_interface::POST);
  40          $marked        = $request->variable('mark', array(0));
  41  
  42          // Sort keys
  43          $sort_days    = $request->variable('st', 0);
  44          $sort_key    = $request->variable('sk', 't');
  45          $sort_dir    = $request->variable('sd', 'd');
  46  
  47          $this->tpl_name = 'acp_logs';
  48          $this->log_type = constant('LOG_' . strtoupper($mode));
  49  
  50          /* @var $pagination \phpbb\pagination */
  51          $pagination = $phpbb_container->get('pagination');
  52  
  53          // Delete entries if requested and able
  54          if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
  55          {
  56              if (confirm_box(true))
  57              {
  58                  $conditions = array();
  59  
  60                  if ($deletemark && count($marked))
  61                  {
  62                      $conditions['log_id'] = array('IN' => $marked);
  63                  }
  64  
  65                  if ($deleteall)
  66                  {
  67                      if ($sort_days)
  68                      {
  69                          $conditions['log_time'] = array('>=', time() - ($sort_days * 86400));
  70                      }
  71  
  72                      $keywords = $request->variable('keywords', '', true);
  73                      $conditions['keywords'] = $keywords;
  74                  }
  75  
  76                  /* @var $phpbb_log \phpbb\log\log_interface */
  77                  $phpbb_log = $phpbb_container->get('log');
  78                  $phpbb_log->delete($mode, $conditions);
  79              }
  80              else
  81              {
  82                  confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
  83                      'f'            => $forum_id,
  84                      'start'        => $start,
  85                      'delmarked'    => $deletemark,
  86                      'delall'    => $deleteall,
  87                      'mark'        => $marked,
  88                      'st'        => $sort_days,
  89                      'sk'        => $sort_key,
  90                      'sd'        => $sort_dir,
  91                      'i'            => $id,
  92                      'mode'        => $mode,
  93                      'action'    => $action))
  94                  );
  95              }
  96          }
  97  
  98          // Sorting
  99          $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('viewpost', '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'                => (count($data)) ? implode(' | ', $data) : '',
 171                  'ID'                => $row['id'],
 172                  )
 173              );
 174          }
 175      }
 176  }


Generated: Sat Oct 26 11:28:42 2019 Cross-referenced by PHPXref 0.7.1