5
* @version $Id: acp_logs.php,v 1.17 2007/10/05 14:36:32 acydburn Exp $
6
* @copyright (c) 2005 phpBB Group
7
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
14
if (!defined('IN_PHPBB'))
26
function main($id, $mode)
28
global $db, $user, $auth, $template, $cache;
29
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
31
$user->add_lang('mcp');
33
// Set up general vars
34
$action = request_var('action', '');
35
$forum_id = request_var('f', 0);
36
$start = request_var('start', 0);
37
$deletemark = (!empty($_POST['delmarked'])) ? true : false;
38
$deleteall = (!empty($_POST['delall'])) ? true : false;
39
$marked = request_var('mark', array(0));
42
$sort_days = request_var('st', 0);
43
$sort_key = request_var('sk', 't');
44
$sort_dir = request_var('sd', 'd');
46
$this->tpl_name = 'acp_logs';
47
$this->log_type = constant('LOG_' . strtoupper($mode));
49
// Delete entries if requested and able
50
if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
52
if (confirm_box(true))
56
if ($deletemark && sizeof($marked))
59
foreach ($marked as $mark)
63
$where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in);
67
if ($where_sql || $deleteall)
69
$sql = 'DELETE FROM ' . LOG_TABLE . "
70
WHERE log_type = {$this->log_type}
74
add_log('admin', 'LOG_CLEAR_' . strtoupper($mode));
79
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
82
'delmarked' => $deletemark,
83
'delall' => $deleteall,
96
$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']);
97
$sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
98
$sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
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);
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');
107
$l_title = $user->lang['ACP_' . strtoupper($mode) . '_LOGS'];
108
$l_title_explain = $user->lang['ACP_' . strtoupper($mode) . '_LOGS_EXPLAIN'];
110
$this->page_title = $l_title;
112
// Define forum list if we're looking @ mod logs
115
$forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id);
117
$template->assign_vars(array(
118
'S_SHOW_FORUMS' => true,
119
'S_FORUM_BOX' => $forum_box)
126
view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort);
128
$template->assign_vars(array(
129
'L_TITLE' => $l_title,
130
'L_EXPLAIN' => $l_title_explain,
131
'U_ACTION' => $this->u_action,
133
'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start),
134
'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $log_count, $config['topics_per_page'], $start, true),
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'),
143
foreach ($log_data as $row)
147
$checks = array('viewtopic', 'viewlogs', 'viewforum');
148
foreach ($checks as $check)
150
if (isset($row[$check]) && $row[$check])
152
$data[] = '<a href="' . $row[$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>';
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'] : '',
161
'DATE' => $user->format_date($row['time']),
162
'ACTION' => $row['action'],
163
'DATA' => (sizeof($data)) ? implode(' | ', $data) : '',
b'\\ No newline at end of file'