[ Index ] |
PHP Cross Reference of phpBB 3.0 Beta 3 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * @package mcp 5 * @version $Id: mcp_logs.php,v 1.18 2006/08/12 13:12:18 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 * mcp_logs 13 * Handling warning the users 14 * @package mcp 15 */ 16 class mcp_logs 17 { 18 var $u_action; 19 var $p_master; 20 21 function mcp_main(&$p_master) 22 { 23 $this->p_master = &$p_master; 24 } 25 26 function main($id, $mode) 27 { 28 global $auth, $db, $user, $template; 29 global $config, $phpbb_root_path, $phpEx; 30 31 $user->add_lang('acp/common'); 32 33 $action = request_var('action', array('' => '')); 34 35 if (is_array($action)) 36 { 37 list($action, ) = each($action); 38 } 39 else 40 { 41 $action = request_var('action', ''); 42 } 43 44 // Set up general vars 45 $start = request_var('start', 0); 46 $deletemark = ($action == 'del_marked') ? true : false; 47 $deleteall = ($action == 'del_all') ? true : false; 48 $marked = request_var('mark', array(0)); 49 50 // Sort keys 51 $sort_days = request_var('st', 0); 52 $sort_key = request_var('sk', 't'); 53 $sort_dir = request_var('sd', 'd'); 54 55 $this->tpl_name = 'mcp_logs'; 56 $this->page_title = 'MCP_LOGS'; 57 58 $forum_id = $topic_id = 0; 59 switch ($mode) 60 { 61 case 'front': 62 $where_sql = ''; 63 break; 64 65 case 'forum_logs': 66 $forum_id = request_var('f', 0); 67 $where_sql = " AND forum_id = $forum_id"; 68 break; 69 70 case 'topic_logs': 71 $topic_id = request_var('t', 0); 72 $where_sql = " AND topic_id = $topic_id"; 73 break; 74 } 75 76 // Delete entries if requested and able 77 if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) 78 { 79 if ($deletemark && $marked) 80 { 81 $sql_in = array(); 82 foreach ($marked as $mark) 83 { 84 $sql_in[] = $mark; 85 } 86 87 $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); 88 unset($sql_in); 89 } 90 91 if ($where_sql || $deleteall) 92 { 93 $sql = 'DELETE FROM ' . LOG_TABLE . ' 94 WHERE log_type = ' . LOG_MOD . " 95 $where_sql"; 96 $db->sql_query($sql); 97 98 add_log('admin', 'LOG_CLEAR_MOD'); 99 } 100 } 101 102 // Sorting 103 $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']); 104 $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); 105 $sort_by_sql = array('u' => 'u.username', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); 106 107 $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; 108 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); 109 110 // Define where and sort sql for use in displaying logs 111 $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; 112 $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); 113 114 // Grab log data 115 $log_data = array(); 116 $log_count = 0; 117 view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, $topic_id, 0, $sql_where, $sql_sort); 118 119 $template->assign_vars(array( 120 'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start), 121 'TOTAL' => ($log_count == 1) ? $user->lang['TOTAL_LOG'] : sprintf($user->lang['TOTAL_LOGS'], $log_count), 122 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $log_count, $config['topics_per_page'], $start), 123 124 'L_TITLE' => $user->lang['MCP_LOGS'], 125 126 'U_POST_ACTION' => $this->u_action, 127 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, 128 'S_SELECT_SORT_DIR' => $s_sort_dir, 129 'S_SELECT_SORT_KEY' => $s_sort_key, 130 'S_SELECT_SORT_DAYS' => $s_limit_days, 131 'S_LOGS' => ($log_count > 0), 132 ) 133 ); 134 135 foreach ($log_data as $row) 136 { 137 $data = array(); 138 139 $checks = array('viewtopic', 'viewforum'); 140 foreach ($checks as $check) 141 { 142 if (isset($row[$check]) && $row[$check]) 143 { 144 $data[] = '<a href="' . $row[$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>'; 145 } 146 } 147 148 $template->assign_block_vars('log', array( 149 'USERNAME' => $row['username'], 150 'IP' => $row['ip'], 151 'DATE' => $user->format_date($row['time']), 152 'ACTION' => $row['action'], 153 'DATA' => (sizeof($data)) ? implode(' | ', $data) : '', 154 'ID' => $row['id'], 155 ) 156 ); 157 } 158 } 159 } 160 161 ?>
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 |