diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-07-06 20:37:09 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-07-06 20:37:09 +0000 |
commit | 2beb39c812b23319cce2f00a8fd80a06ce788be7 (patch) | |
tree | c95f3431d52c5554d077b718af85f90658e3c2d5 /phpBB/admin | |
parent | 20da9bb86d7c8e397d0add67ffe768d459d9b32d (diff) | |
download | forums-2beb39c812b23319cce2f00a8fd80a06ce788be7.tar forums-2beb39c812b23319cce2f00a8fd80a06ce788be7.tar.gz forums-2beb39c812b23319cce2f00a8fd80a06ce788be7.tar.bz2 forums-2beb39c812b23319cce2f00a8fd80a06ce788be7.tar.xz forums-2beb39c812b23319cce2f00a8fd80a06ce788be7.zip |
Have log ... will view
git-svn-id: file:///svn/phpbb/trunk@2654 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/admin')
-rw-r--r-- | phpBB/admin/admin_viewlogs.php | 243 |
1 files changed, 243 insertions, 0 deletions
diff --git a/phpBB/admin/admin_viewlogs.php b/phpBB/admin/admin_viewlogs.php new file mode 100644 index 0000000000..1bcd9a3596 --- /dev/null +++ b/phpBB/admin/admin_viewlogs.php @@ -0,0 +1,243 @@ +<?php +/*************************************************************************** + * admin_viewlogs.php + * ------------------- + * begin : Friday, May 11, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + ***************************************************************************/ + +if ( !empty($setmodules) ) +{ + if ( !$acl->get_acl_admin('general') ) + { + return; + } + + $filename = basename(__FILE__); + $module['General']['View_admin_log'] = $filename . "$SID&mode=admin"; + + return; +} + +define('IN_PHPBB', 1); +// +// Include files +// +$phpbb_root_path = '../'; +require($phpbb_root_path . 'extension.inc'); +require('pagestart.' . $phpEx); + +// +// Do we have styles admin permissions? +// +if ( !$acl->get_acl_admin('general') ) +{ + message_die(MESSAGE, $lang['No_admin']); +} + +$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; + +if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) ) +{ + $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; +} +else +{ + $mode = 'admin'; +} + +if ( ( isset($HTTP_POST_VARS['delmarked']) || isset($HTTP_POST_VARS['delall']) ) && $acl->get_acl_admin('clearlogs')) +{ + $where_sql = ''; + if ( isset($HTTP_POST_VARS['delmarked']) && isset($HTTP_POST_VARS['mark']) ) + { + foreach ( $HTTP_POST_VARS['mark'] as $marked ) + { + $where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . intval($marked); + } + $where_sql = "WHERE log_id IN ($where_sql)"; + } + + $sql = "DELETE FROM " . LOG_ADMIN_TABLE . " + $where_sql"; + $db->sql_query($sql); +} + +if ( isset($HTTP_POST_VARS['sort']) ) +{ + if ( !empty($HTTP_POST_VARS['sort_days']) ) + { + $sort_days = ( !empty($HTTP_POST_VARS['sort_days']) ) ? intval($HTTP_POST_VARS['sort_days']) : intval($HTTP_GET_VARS['sort_days']); + $where_sql = time() - ( $sort_days * 86400 ); + } + else + { + $where_sql = 0; + } + + $start = 0; + $sort_key = ( isset($HTTP_POST_VARS['sort_key']) ) ? $HTTP_POST_VARS['sort_key'] : $HTTP_GET_VARS['sort_key']; + $sort_dir = ( isset($HTTP_POST_VARS['sort_dir']) ) ? $HTTP_POST_VARS['sort_dir'] : $HTTP_GET_VARS['sort_dir']; +} +else +{ + $where_sql = 0; + + $sort_days = 0; + $sort_key = 't'; + $sort_dir = 'd'; +} + +// +// Sorting +// +$previous_days = array(0 => $lang['All_Entries'], 1 => $lang['1_Day'], 7 => $lang['7_Days'], 14 => $lang['2_Weeks'], 30 => $lang['1_Month'], 90 => $lang['3_Months'], 180 => $lang['6_Months'], 364 => $lang['1_Year']); +$sort_by_text = array('u' => $lang['Sort_Username'], 't' => $lang['Sort_date'], 'i' => $lang['Sort_ip'], 'o' => $lang['Sort_action']); +$sort_by = array('u' => 'l.user_id', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); + +$sort_day_options = ''; +foreach ( $previous_days as $day => $text ) +{ + $selected = ( $sort_days == $day ) ? ' selected="selected"' : ''; + $sort_day_options .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>'; +} + +$sort_key_options = ''; +foreach ( $sort_by_text as $key => $text ) +{ + $selected = ( $sort_key == $key ) ? ' selected="selected"' : ''; + $sort_key_options .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>'; +} + +$sort_order_options = ( $sort_dir == 'a' ) ? '<option value="a" selected="selected">' . $lang['Sort_Ascending'] . '</option><option value="d">' . $lang['Sort_Descending'] . '</option>' : '<option value="a">' . $lang['Sort_Ascending'] . '</option><option value="d" selected="selected">' . $lang['Sort_Descending'] . '</option>'; + +$sort_sql = $sort_by[$sort_key] . ' ' . ( ( $sort_dir == 'd' ) ? 'DESC' : 'ASC' ); + +// +// Grab data +// +$sql = "SELECT COUNT(*) AS total_entries + FROM " . LOG_ADMIN_TABLE . " + WHERE log_time >= $where_sql"; +$result = $db->sql_query($sql); + +$row = $db->sql_fetchrow($result); +$db->sql_freeresult($result); + +$total_entries = $row['total_entries']; +$pagination = generate_pagination("admin_viewlogs.$phpEx$SID&mode=$mode&order=$sort_order", $total_entries, $board_config['topics_per_page'], $start). ' '; + +page_header($lang['General']); + +?> + +<h1><?php echo $lang['Admin_log']; ?></h1> + +<p><?php echo $lang['Admin_log_explain']; ?></p> + +<form method="post" name="log" action="<?php echo "admin_viewlogs.$phpEx$SID&mode=$mode"; ?>"><table width="100%" cellpadding="4" cellspacing="1" border="0" bgcolor="#98AAB1"> + <tr> + <td class="cat" colspan="5" height="28" align="center"><span class="gensmall"><?php echo $lang['Display_log']; ?>: <select name="sort_days"><?php echo $sort_day_options; ?></select> <?php echo $lang['Sort_by']; ?> <select name="sort_key"><?php echo $sort_key_options; ?></select> <select name="sort_dir"><?php echo $sort_order_options; ?></select> <input class="liteoption" type="submit" value="<?php echo $lang['Go']; ?>" name="sort" /></span></td> + </tr> + <tr> + <th width="15%" height="25" nowrap="nowrap"><?php echo $lang['Username']; ?></th> + <th width="15%" nowrap="nowrap"><?php echo $lang['IP']; ?></th> + <th width="20%" nowrap="nowrap"><?php echo $lang['Time']; ?></th> + <th width="45%" nowrap="nowrap"><?php echo $lang['Action']; ?></th> + <th nowrap="nowrap"><?php echo $lang['Mark']; ?></th> + </tr> +<?php + +$log_data = view_admin_log($board_config['topics_per_page'], $start, $where_sql, $sort_sql); + +if ( sizeof($log_data) ) +{ + for($i = 0; $i < sizeof($log_data); $i++) + { + $cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1'; + +?> + <tr> + <td class="<?php echo $cell_bg; ?>" nowrap="nowrap"><?php echo $log_data[$i]['username']; ?></td> + <td class="<?php echo $cell_bg; ?>" align="center" nowrap="nowrap"><?php echo $log_data[$i]['ip']; ?></td> + <td class="<?php echo $cell_bg; ?>" align="center" nowrap="nowrap"><?php echo create_date($board_config['default_dateformat'], $log_data[$i]['time'], $board_config['board_timezone']); ?></td> + <td class="<?php echo $cell_bg; ?>"><?php echo $log_data[$i]['action']; ?></td> + <td class="<?php echo $cell_bg; ?>" align="center" nowrap="nowrap"><input type="checkbox" name="mark[]" value="<?php echo $log_data[$i]['id']; ?>" /></td> + </tr> +<?php + + } + + if ( $acl->get_acl_admin('clearlogs') ) + { + +?> + <tr> + <td class="cat" colspan="5" height="28" align="right"><input class="liteoption" type="submit" name="delmarked" value="<?php echo $lang['Delete_marked']; ?>" /> <input class="liteoption" type="submit" name="delall" value="<?php echo $lang['Delete_all']; ?>" /> </td> + </tr> +<?php + + } +} +else +{ +?> + <tr> + <td class="row1" nowrap="nowrap"><?php echo $lang['No_entries']; ?></td> + </tr> +<?php +} + +?> +</table> + +<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> + <tr> + <td align="left" valign="top"> <span class="nav"><?php echo sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $total_entries / $board_config['topics_per_page'] )); ?></span></td> + <td align="right" valign="top" nowrap="nowrap"><?php + + if ( $acl->get_acl_admin('clearlogs') ) + { + + +?><b><span class="gensmall"><a href="javascript:marklist(true);" class="gensmall"><?php echo $lang['Mark_all']; ?></a> :: <a href="javascript:marklist(false);" class="gensmall"><?php echo $lang['Unmark_all']; ?></a></span></b> <br /><br /><?php + + } + + ?><span class="nav"><?php echo $pagination; ?></span></td> + </tr> +</table></form> + +<script language="Javascript" type="text/javascript"> +<!-- +// +// Should really check the browser to stop this whining ... +// +function marklist(status) +{ + for (i = 0; i < document.log.length; i++) + { + document.log.elements[i].checked = status; + } +} +//--> +</script> + +<?php + +page_footer(); + +?>
\ No newline at end of file |