|
|
ef5584 |
|
|
|
ef5584 |
/**
|
|
|
ef5584 |
*
|
|
|
ef5584 |
* @package acp
|
|
|
ef5584 |
* @version $Id: acp_logs.php 8479 2008-03-29 00:22:48Z naderman $
|
|
|
ef5584 |
* @copyright (c) 2005 phpBB Group
|
|
|
ef5584 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
ef5584 |
*
|
|
|
ef5584 |
*/
|
|
|
ef5584 |
|
|
|
ef5584 |
/**
|
|
|
ef5584 |
* @ignore
|
|
|
ef5584 |
*/
|
|
|
ef5584 |
if (!defined('IN_PHPBB'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
exit;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
/**
|
|
|
ef5584 |
* @package acp
|
|
|
ef5584 |
*/
|
|
|
ef5584 |
class acp_logs
|
|
|
ef5584 |
{
|
|
|
ef5584 |
var $u_action;
|
|
|
ef5584 |
|
|
|
ef5584 |
function main($id, $mode)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
global $db, $user, $auth, $template, $cache;
|
|
|
ef5584 |
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
|
|
ef5584 |
|
|
|
ef5584 |
$user->add_lang('mcp');
|
|
|
ef5584 |
|
|
|
ef5584 |
// Set up general vars
|
|
|
ef5584 |
$action = request_var('action', '');
|
|
|
ef5584 |
$forum_id = request_var('f', 0);
|
|
|
ef5584 |
$start = request_var('start', 0);
|
|
|
ef5584 |
$deletemark = (!empty($_POST['delmarked'])) ? true : false;
|
|
|
ef5584 |
$deleteall = (!empty($_POST['delall'])) ? true : false;
|
|
|
ef5584 |
$marked = request_var('mark', array(0));
|
|
|
ef5584 |
|
|
|
ef5584 |
// Sort keys
|
|
|
ef5584 |
$sort_days = request_var('st', 0);
|
|
|
ef5584 |
$sort_key = request_var('sk', 't');
|
|
|
ef5584 |
$sort_dir = request_var('sd', 'd');
|
|
|
ef5584 |
|
|
|
ef5584 |
$this->tpl_name = 'acp_logs';
|
|
|
ef5584 |
$this->log_type = constant('LOG_' . strtoupper($mode));
|
|
|
ef5584 |
|
|
|
ef5584 |
// Delete entries if requested and able
|
|
|
ef5584 |
if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if (confirm_box(true))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$where_sql = '';
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($deletemark && sizeof($marked))
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql_in = array();
|
|
|
ef5584 |
foreach ($marked as $mark)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql_in[] = $mark;
|
|
|
ef5584 |
}
|
|
|
ef5584 |
$where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in);
|
|
|
ef5584 |
unset($sql_in);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
if ($where_sql || $deleteall)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$sql = 'DELETE FROM ' . LOG_TABLE . "
|
|
|
ef5584 |
WHERE log_type = {$this->log_type}
|
|
|
ef5584 |
$where_sql";
|
|
|
ef5584 |
$db->sql_query($sql);
|
|
|
ef5584 |
|
|
|
ef5584 |
add_log('admin', 'LOG_CLEAR_' . strtoupper($mode));
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
else
|
|
|
ef5584 |
{
|
|
|
ef5584 |
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
|
|
|
ef5584 |
'f' => $forum_id,
|
|
|
ef5584 |
'start' => $start,
|
|
|
ef5584 |
'delmarked' => $deletemark,
|
|
|
ef5584 |
'delall' => $deleteall,
|
|
|
ef5584 |
'mark' => $marked,
|
|
|
ef5584 |
'st' => $sort_days,
|
|
|
ef5584 |
'sk' => $sort_key,
|
|
|
ef5584 |
'sd' => $sort_dir,
|
|
|
ef5584 |
'i' => $id,
|
|
|
ef5584 |
'mode' => $mode,
|
|
|
ef5584 |
'action' => $action))
|
|
|
ef5584 |
);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Sorting
|
|
|
ef5584 |
$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']);
|
|
|
ef5584 |
$sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
|
|
|
ef5584 |
$sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
|
|
|
ef5584 |
|
|
|
ef5584 |
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
|
|
|
ef5584 |
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);
|
|
|
ef5584 |
|
|
|
ef5584 |
// Define where and sort sql for use in displaying logs
|
|
|
ef5584 |
$sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
|
|
|
ef5584 |
$sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
|
|
|
ef5584 |
|
|
|
ef5584 |
$l_title = $user->lang['ACP_' . strtoupper($mode) . '_LOGS'];
|
|
|
ef5584 |
$l_title_explain = $user->lang['ACP_' . strtoupper($mode) . '_LOGS_EXPLAIN'];
|
|
|
ef5584 |
|
|
|
ef5584 |
$this->page_title = $l_title;
|
|
|
ef5584 |
|
|
|
ef5584 |
// Define forum list if we're looking @ mod logs
|
|
|
ef5584 |
if ($mode == 'mod')
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id);
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'S_SHOW_FORUMS' => true,
|
|
|
ef5584 |
'S_FORUM_BOX' => $forum_box)
|
|
|
ef5584 |
);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
// Grab log data
|
|
|
ef5584 |
$log_data = array();
|
|
|
ef5584 |
$log_count = 0;
|
|
|
ef5584 |
view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort);
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->assign_vars(array(
|
|
|
ef5584 |
'L_TITLE' => $l_title,
|
|
|
ef5584 |
'L_EXPLAIN' => $l_title_explain,
|
|
|
ef5584 |
'U_ACTION' => $this->u_action,
|
|
|
ef5584 |
|
|
|
ef5584 |
'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start),
|
|
|
ef5584 |
'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $log_count, $config['topics_per_page'], $start, true),
|
|
|
ef5584 |
|
|
|
ef5584 |
'S_LIMIT_DAYS' => $s_limit_days,
|
|
|
ef5584 |
'S_SORT_KEY' => $s_sort_key,
|
|
|
ef5584 |
'S_SORT_DIR' => $s_sort_dir,
|
|
|
ef5584 |
'S_CLEARLOGS' => $auth->acl_get('a_clearlogs'),
|
|
|
ef5584 |
)
|
|
|
ef5584 |
);
|
|
|
ef5584 |
|
|
|
ef5584 |
foreach ($log_data as $row)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$data = array();
|
|
|
ef5584 |
|
|
|
ef5584 |
$checks = array('viewtopic', 'viewlogs', 'viewforum');
|
|
|
ef5584 |
foreach ($checks as $check)
|
|
|
ef5584 |
{
|
|
|
ef5584 |
if (isset($row[$check]) && $row[$check])
|
|
|
ef5584 |
{
|
|
|
ef5584 |
$data[] = '' . $user->lang['LOGVIEW_' . strtoupper($check)] . '';
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
$template->assign_block_vars('log', array(
|
|
|
ef5584 |
'USERNAME' => $row['username_full'],
|
|
|
ef5584 |
'REPORTEE_USERNAME' => ($row['reportee_username'] && $row['user_id'] != $row['reportee_id']) ? $row['reportee_username_full'] : '',
|
|
|
ef5584 |
|
|
|
ef5584 |
'IP' => $row['ip'],
|
|
|
ef5584 |
'DATE' => $user->format_date($row['time']),
|
|
|
ef5584 |
'ACTION' => $row['action'],
|
|
|
ef5584 |
'DATA' => (sizeof($data)) ? implode(' | ', $data) : '',
|
|
|
ef5584 |
'ID' => $row['id'],
|
|
|
ef5584 |
)
|
|
|
ef5584 |
);
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
}
|
|
|
ef5584 |
|
|
|
ef5584 |
?>
|