[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * @package acp 5 * @version $Id$ 6 * @copyright (c) 2005 phpBB Group 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License 8 * 9 */ 10 11 /** 12 * @ignore 13 */ 14 if (!defined('IN_PHPBB')) 15 { 16 exit; 17 } 18 19 /** 20 * @package acp 21 */ 22 class acp_logs 23 { 24 var $u_action; 25 26 function main($id, $mode) 27 { 28 global $db, $user, $auth, $template, $cache; 29 global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; 30 31 $user->add_lang('mcp'); 32 33 // Set up general vars 34 $action = request_var('action', ''); 35 $forum_id = request_var('f', 0); 36 $topic_id = request_var('t', 0); 37 $start = request_var('start', 0); 38 $deletemark = (!empty($_POST['delmarked'])) ? true : false; 39 $deleteall = (!empty($_POST['delall'])) ? true : false; 40 $marked = request_var('mark', array(0)); 41 42 // Sort keys 43 $sort_days = request_var('st', 0); 44 $sort_key = request_var('sk', 't'); 45 $sort_dir = request_var('sd', 'd'); 46 47 $this->tpl_name = 'acp_logs'; 48 $this->log_type = constant('LOG_' . strtoupper($mode)); 49 50 // Delete entries if requested and able 51 if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) 52 { 53 if (confirm_box(true)) 54 { 55 $where_sql = ''; 56 57 if ($deletemark && sizeof($marked)) 58 { 59 $sql_in = array(); 60 foreach ($marked as $mark) 61 { 62 $sql_in[] = $mark; 63 } 64 $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); 65 unset($sql_in); 66 } 67 68 if ($where_sql || $deleteall) 69 { 70 $sql = 'DELETE FROM ' . LOG_TABLE . " 71 WHERE log_type = {$this->log_type} 72 $where_sql"; 73 $db->sql_query($sql); 74 75 add_log('admin', 'LOG_CLEAR_' . strtoupper($mode)); 76 } 77 } 78 else 79 { 80 confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( 81 'f' => $forum_id, 82 'start' => $start, 83 'delmarked' => $deletemark, 84 'delall' => $deleteall, 85 'mark' => $marked, 86 'st' => $sort_days, 87 'sk' => $sort_key, 88 'sd' => $sort_dir, 89 'i' => $id, 90 'mode' => $mode, 91 'action' => $action)) 92 ); 93 } 94 } 95 96 // Sorting 97 $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']); 98 $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); 99 $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); 100 101 $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; 102 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); 103 104 // Define where and sort sql for use in displaying logs 105 $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; 106 $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); 107 108 $keywords = utf8_normalize_nfc(request_var('keywords', '', true)); 109 $keywords_param = !empty($keywords) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : ''; 110 111 $l_title = $user->lang['ACP_' . strtoupper($mode) . '_LOGS']; 112 $l_title_explain = $user->lang['ACP_' . strtoupper($mode) . '_LOGS_EXPLAIN']; 113 114 $this->page_title = $l_title; 115 116 // Define forum list if we're looking @ mod logs 117 if ($mode == 'mod') 118 { 119 $forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id); 120 121 $template->assign_vars(array( 122 'S_SHOW_FORUMS' => true, 123 'S_FORUM_BOX' => $forum_box) 124 ); 125 } 126 127 // Grab log data 128 $log_data = array(); 129 $log_count = 0; 130 $start = view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort, $keywords); 131 132 $template->assign_vars(array( 133 'L_TITLE' => $l_title, 134 'L_EXPLAIN' => $l_title_explain, 135 'U_ACTION' => $this->u_action . "&$u_sort_param$keywords_param&start=$start", 136 137 'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start), 138 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start, true), 139 140 'S_LIMIT_DAYS' => $s_limit_days, 141 'S_SORT_KEY' => $s_sort_key, 142 'S_SORT_DIR' => $s_sort_dir, 143 'S_CLEARLOGS' => $auth->acl_get('a_clearlogs'), 144 'S_KEYWORDS' => $keywords, 145 ) 146 ); 147 148 foreach ($log_data as $row) 149 { 150 $data = array(); 151 152 $checks = array('viewtopic', 'viewlogs', 'viewforum'); 153 foreach ($checks as $check) 154 { 155 if (isset($row[$check]) && $row[$check]) 156 { 157 $data[] = '<a href="' . $row[$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>'; 158 } 159 } 160 161 $template->assign_block_vars('log', array( 162 'USERNAME' => $row['username_full'], 163 'REPORTEE_USERNAME' => ($row['reportee_username'] && $row['user_id'] != $row['reportee_id']) ? $row['reportee_username_full'] : '', 164 165 'IP' => $row['ip'], 166 'DATE' => $user->format_date($row['time']), 167 'ACTION' => $row['action'], 168 'DATA' => (sizeof($data)) ? implode(' | ', $data) : '', 169 'ID' => $row['id'], 170 ) 171 ); 172 } 173 } 174 } 175 176 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Oct 2 15:03:47 2013 | Cross-referenced by PHPXref 0.7.1 |