diff options
| author | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-03-13 12:14:48 +0000 |
|---|---|---|
| committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-03-13 12:14:48 +0000 |
| commit | 8bb5de9861e30160bac90ae8ba78497fe2c207de (patch) | |
| tree | ae6fac268cb5199496770f415288f1a7f2a308a7 /phpBB/adm/admin_viewlogs.php | |
| parent | 9d2989b9272e89904a0b9a6a3a3376dc793a3ed1 (diff) | |
| download | forums-8bb5de9861e30160bac90ae8ba78497fe2c207de.tar forums-8bb5de9861e30160bac90ae8ba78497fe2c207de.tar.gz forums-8bb5de9861e30160bac90ae8ba78497fe2c207de.tar.bz2 forums-8bb5de9861e30160bac90ae8ba78497fe2c207de.tar.xz forums-8bb5de9861e30160bac90ae8ba78497fe2c207de.zip | |
New directory name
git-svn-id: file:///svn/phpbb/trunk@3646 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/adm/admin_viewlogs.php')
| -rw-r--r-- | phpBB/adm/admin_viewlogs.php | 254 |
1 files changed, 254 insertions, 0 deletions
diff --git a/phpBB/adm/admin_viewlogs.php b/phpBB/adm/admin_viewlogs.php new file mode 100644 index 0000000000..e544fd144a --- /dev/null +++ b/phpBB/adm/admin_viewlogs.php @@ -0,0 +1,254 @@ +<?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 (!$auth->acl_get('a_general')) + { + return; + } + + $filename = basename(__FILE__); + $module['LOG']['ADMIN_LOGS'] = $filename . "$SID&mode=admin"; + $module['LOG']['MOD_LOGS'] = $filename . "$SID&mode=mod"; + + 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 (!$auth->acl_get('a_general')) +{ + trigger_error($user->lang['NO_ADMIN']); +} + +// Set some variables +$forum_id = (isset($_REQUEST['f'])) ? intval($_REQUEST['f']) : 0; +$start = (isset($_GET['start'])) ? intval($_GET['start']) : 0; +$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : 'admin'; + +// Define some vars depending on which logs we're looking at +$log_table_sql = ($mode == 'admin') ? LOG_ADMIN_TABLE : LOG_MOD_TABLE; +$l_title = ($mode == 'admin') ? $user->lang['ADMIN_LOGS'] : $user->lang['MOD_LOGS']; +$l_title_explain = ($mode == 'admin') ? $user->lang['ADMIN_LOGS_EXPLAIN'] : $user->lang['MOD_LOGS_EXPLAIN']; + +// Delete entries if requested and able +if ((isset($_POST['delmarked']) || isset($_POST['delall'])) && $auth->acl_get('a_clearlogs')) +{ + $where_sql = ''; + if (isset($_POST['delmarked']) && isset($_POST['mark'])) + { + foreach ($_POST['mark'] as $marked) + { + $where_sql .= (($where_sql != '') ? ', ' : '') . intval($marked); + } + $where_sql = "WHERE log_id IN ($where_sql)"; + } + + $sql = "DELETE FROM $table_sql + $where_sql"; + $db->sql_query($sql); + + add_log('admin', 'log_' . $mode . '_clear'); +} + +// Sorting ... this could become a function +if (isset($_POST['sort']) || $start) +{ + if (!empty($_POST['sort_days'])) + { + $sort_days = intval($_POST['sort_days']); + $where_sql = time() - ($sort_days * 86400); + } + else + { + $where_sql = 0; + } + + $sort_key = (isset($_POST['sort_key'])) ? $_POST['sort_key'] : ''; + $sort_dir = (isset($_POST['sort_dir'])) ? $_POST['sort_dir'] : ''; +} +else +{ + $where_sql = 0; + + $sort_days = 0; + $sort_key = 't'; + $sort_dir = 'd'; +} + + + +$previous_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'], 364 => $user->lang['1_YEAR']); +$sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->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">' . $user->lang['SORT_ASCENDING'] . '</option><option value="d">' . $user->lang['SORT_DESCENDING'] . '</option>' : '<option value="a">' . $user->lang['SORT_ASCENDING'] . '</option><option value="d" selected="selected">' . $user->lang['SORT_DESCENDING'] . '</option>'; + +$sort_sql = $sort_by[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + +// Output page +page_header($l_title); + +?> + +<h1><?php echo $l_title; ?></h1> + +<p><?php echo $l_title_explain; ?></p> + +<form method="post" action="<?php echo "admin_viewlogs.$phpEx$SID&mode=$mode"; ?>"> +<?php + +// Define forum list if we're looking @ mod logs +if ($mode == 'mod') +{ + + $forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id, false, false); + +?> +<table width="100%" cellpadding="1" cellspacing="1" border="0"> + <tr> + <td align="right"><?php echo $user->lang['SELECT_FORUM']; ?>: <select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.submit() }"><?php echo $forum_box; ?></select> <input class="liteoption" type="submit" value="<?php echo $user->lang['GO']; ?>" /></td> + </tr> +</table> +<?php + +} + +?> + +<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0"> + <tr> + <td class="cat" colspan="5" height="28" align="center"><span class="gensmall"><?php echo $user->lang['DISPLAY_LOG']; ?>: <select name="sort_days"><?php echo $sort_day_options; ?></select> <?php echo $user->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 $user->lang['GO']; ?>" name="sort" /></span></td> + </tr> + <tr> + <th width="15%" height="25" nowrap="nowrap"><?php echo $user->lang['USERNAME']; ?></th> + <th width="15%" nowrap="nowrap"><?php echo $user->lang['IP']; ?></th> + <th width="20%" nowrap="nowrap"><?php echo $user->lang['TIME']; ?></th> + <th width="45%" nowrap="nowrap"><?php echo $user->lang['ACTION']; ?></th> + <th nowrap="nowrap"><?php echo $user->lang['MARK']; ?></th> + </tr> +<?php + +// +// Grab log data +// +$log_data = array(); +$log_count = 0; +view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, $where_sql, $sort_sql); + +if ($log_count) +{ + for($i = 0; $i < sizeof($log_data); $i++) + { + $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; + +?> + <tr> + <td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $log_data[$i]['username']; ?></td> + <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo $log_data[$i]['ip']; ?></td> + <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo $user->format_date($log_data[$i]['time']); ?></td> + <td class="<?php echo $row_class; ?>"><?php echo $log_data[$i]['action']; ?></td> + <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><input type="checkbox" name="mark[]" value="<?php echo $log_data[$i]['id']; ?>" /></td> + </tr> +<?php + + } + + if ($auth->acl_get('a_clearlogs')) + { + +?> + <tr> + <td class="cat" colspan="5" height="28" align="right"><input class="liteoption" type="submit" name="delmarked" value="<?php echo $user->lang['DELETE_MARKED']; ?>" /> <input class="liteoption" type="submit" name="delall" value="<?php echo $user->lang['DELETE_ALL']; ?>" /> </td> + </tr> +<?php + + } +} +else +{ +?> + <tr> + <td class="row1" colspan="5" align="center" nowrap="nowrap"><?php echo $user->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 on_page($log_count, $config['topics_per_page'], $start); ?></span></td> + <td align="right" valign="top" nowrap="nowrap"><?php + + if ($auth->acl_get('a_clearlogs')) + { + + +?><b><span class="gensmall"><a href="javascript:marklist(true);" class="gensmall"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist(false);" class="gensmall"><?php echo $user->lang['UNMARK_ALL']; ?></a></span></b> <br /><br /><?php + + } + + $pagination = generate_pagination("admin_viewlogs.$phpEx$SID&mode=$mode&sort_days=$sort_days&sort_key=$sort_key&sort_dir=$sort_dir", $log_count, $config['topics_per_page'], $start); + + ?><span class="nav"><?php echo $pagination; ?></span></td> + </tr> +</table></form> + +<script language="Javascript" type="text/javascript"> +<!-- +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 |
