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