From 2beb39c812b23319cce2f00a8fd80a06ce788be7 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sat, 6 Jul 2002 20:37:09 +0000 Subject: [PATCH] Have log ... will view git-svn-id: file:///svn/phpbb/trunk@2654 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/admin/admin_viewlogs.php | 243 +++++++++++++++++++++++++++++++++ 1 file changed, 243 insertions(+) create mode 100644 phpBB/admin/admin_viewlogs.php 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 @@ +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 .= ''; +} + +$sort_key_options = ''; +foreach ( $sort_by_text as $key => $text ) +{ + $selected = ( $sort_key == $key ) ? ' selected="selected"' : ''; + $sort_key_options .= ''; +} + +$sort_order_options = ( $sort_dir == 'a' ) ? '' : ''; + +$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']); + +?> + +

+ +

+ +
"> + + + + + + + + + + + + + + + + + + +get_acl_admin('clearlogs') ) + { + +?> + + + + + + + + +
:     
   
+ + + + + + +
 get_acl_admin('clearlogs') ) + { + + +?> ::  

+ + + + \ No newline at end of file