diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-08-02 16:39:59 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-08-02 16:39:59 +0000 |
commit | 97798bb0b2700e3400a886ec9b10a954e07f8f4d (patch) | |
tree | 2136ae073ad8b98ccceedd750f26da41c2bfa83a | |
parent | 74d60e4c1a2400d8f62966c6310decc40ed8f3b4 (diff) | |
download | forums-97798bb0b2700e3400a886ec9b10a954e07f8f4d.tar forums-97798bb0b2700e3400a886ec9b10a954e07f8f4d.tar.gz forums-97798bb0b2700e3400a886ec9b10a954e07f8f4d.tar.bz2 forums-97798bb0b2700e3400a886ec9b10a954e07f8f4d.tar.xz forums-97798bb0b2700e3400a886ec9b10a954e07f8f4d.zip |
Add moderator log viewing
git-svn-id: file:///svn/phpbb/trunk@2811 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/admin/admin_viewlogs.php | 104 | ||||
-rw-r--r-- | phpBB/admin/pagestart.php | 35 | ||||
-rw-r--r-- | phpBB/language/lang_english/lang_admin.php | 28 |
3 files changed, 127 insertions, 40 deletions
diff --git a/phpBB/admin/admin_viewlogs.php b/phpBB/admin/admin_viewlogs.php index bdd48ac1cc..003835b860 100644 --- a/phpBB/admin/admin_viewlogs.php +++ b/phpBB/admin/admin_viewlogs.php @@ -28,6 +28,7 @@ if ( !empty($setmodules) ) $filename = basename(__FILE__); $module['General']['Admin_logs'] = $filename . "$SID&mode=admin"; + $module['General']['Mod_logs'] = $filename . "$SID&mode=mod"; return; } @@ -48,6 +49,9 @@ if ( !$acl->get_acl_admin('general') ) message_die(MESSAGE, $lang['No_admin']); } +// +// Set some variables +// $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) ) @@ -59,6 +63,16 @@ else $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' ) ? $lang['Admin_logs'] : $lang['Mod_logs']; +$l_title_explain = ( $mode == 'admin' ) ? $lang['Admin_logs_explain'] : $lang['Mod_logs_explain']; + +// +// Delete entries if requested and able +// if ( ( isset($HTTP_POST_VARS['delmarked']) || isset($HTTP_POST_VARS['delall']) ) && $acl->get_acl_admin('clearlogs')) { $where_sql = ''; @@ -71,15 +85,15 @@ if ( ( isset($HTTP_POST_VARS['delmarked']) || isset($HTTP_POST_VARS['delall']) ) $where_sql = "WHERE log_id IN ($where_sql)"; } - $sql = "DELETE FROM " . LOG_ADMIN_TABLE . " + $sql = "DELETE FROM $table_sql $where_sql"; $db->sql_query($sql); - add_admin_log('log_admin_clear'); + add_admin_log('log_' . $mode . '_clear'); } // -// +// Sorting ... this could become a function // if ( isset($HTTP_POST_VARS['sort']) || $start ) { @@ -105,9 +119,6 @@ else $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'); @@ -131,29 +142,64 @@ $sort_order_options = ( $sort_dir == 'a' ) ? '<option value="a" selected="select $sort_sql = $sort_by[$sort_key] . ' ' . ( ( $sort_dir == 'd' ) ? 'DESC' : 'ASC' ); // -// Grab data +// Define forum list if we're looking @ mod logs // -$sql = "SELECT COUNT(*) AS total_entries - FROM " . LOG_ADMIN_TABLE . " - WHERE log_time >= $where_sql"; -$result = $db->sql_query($sql); +$forum_options = ''; +if ( $mode == 'mod' ) +{ + $sql = "SELECT forum_id, forum_name + FROM " . FORUMS_TABLE . " + ORDER BY cat_id, forum_order"; + $result = $db->sql_query($sql); -$row = $db->sql_fetchrow($result); -$db->sql_freeresult($result); + if ( $row = $db->sql_fetchrow($result) ) + { + $forum_id = ( isset($HTTP_POST_VARS['f']) ) ? intval($HTTP_POST_VARS['f']) : $row['forum_id']; -$total_entries = $row['total_entries']; -$pagination = generate_pagination("admin_viewlogs.$phpEx$SID&mode=$mode&sort_days=$sort_days&sort_key=$sort_key&sort_dir=$sort_dir -", $total_entries, $board_config['topics_per_page'], $start). ' '; + do + { + $selected = ( $row['forum_id'] == $forum_id ) ? ' selected="selected"' : ''; + $forum_options .= '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $row['forum_name'] . '</option>'; + } + while ( $row = $db->sql_fetchrow($result) ); + } + else + { + $forum_id = 0; + $forum_options = '<option>' . $lang['No_forums'] . '</option>'; + } +} -page_header($lang['Admin_logs']); +// +// Output page +// +page_header($l_title); ?> -<h1><?php echo $lang['Admin_logs']; ?></h1> +<h1><?php echo $l_title; ?></h1> -<p><?php echo $lang['Admin_log_explain']; ?></p> +<p><?php echo $l_title_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"> +<form method="post" name="log" action="<?php echo "admin_viewlogs.$phpEx$SID&mode=$mode"; ?>"> +<?php + +if ( $mode == 'mod' ) +{ + +?> +<table width="100%" cellpadding="1" cellspacing="1" border="0"> + <tr> + <td align="right"><?php echo $lang['Select_forum']; ?>: <select name="f"><?php echo $forum_options; ?></select> <input class="liteoption" type="submit" value="<?php echo $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 $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> @@ -166,9 +212,14 @@ page_header($lang['Admin_logs']); </tr> <?php -$log_data = view_admin_log($board_config['topics_per_page'], $start, $where_sql, $sort_sql); +// +// Grab log data +// +$log_data = array(); +$log_count = 0; +view_log($mode, $log_data, $log_count, $board_config['topics_per_page'], $start, $forum_id, $where_sql, $sort_sql); -if ( sizeof($log_data) ) +if ( $log_count ) { for($i = 0; $i < sizeof($log_data); $i++) { @@ -201,9 +252,10 @@ else { ?> <tr> - <td class="row1" colspan="5" nowrap="nowrap"><?php echo $lang['No_entries']; ?></td> + <td class="row1" colspan="5" align="center" nowrap="nowrap"><?php echo $lang['No_entries']; ?></td> </tr> <?php + } ?> @@ -211,7 +263,7 @@ else <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="left" valign="top"> <span class="nav"><?php echo on_page($log_count, $board_config['topics_per_page'], $start); ?></span></td> <td align="right" valign="top" nowrap="nowrap"><?php if ( $acl->get_acl_admin('clearlogs') ) @@ -221,7 +273,9 @@ else ?><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 } - + + $pagination = generate_pagination("admin_viewlogs.$phpEx$SID&mode=$mode&sort_days=$sort_days&sort_key=$sort_key&sort_dir=$sort_dir", $log_count, $board_config['topics_per_page'], $start); + ?><span class="nav"><?php echo $pagination; ?></span></td> </tr> </table></form> diff --git a/phpBB/admin/pagestart.php b/phpBB/admin/pagestart.php index 63adc5be57..55098ed41b 100644 --- a/phpBB/admin/pagestart.php +++ b/phpBB/admin/pagestart.php @@ -136,31 +136,35 @@ function add_admin_log() return; } -function view_admin_log($limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'l.log_time DESC') +function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC') { global $db, $lang, $phpEx, $SID; + $table_sql = ( $mode == 'admin' ) ? LOG_ADMIN_TABLE : LOG_MOD_TABLE; + $forum_sql = ( $mode == 'mod' && $forum_id ) ? "AND l.forum_id = $forum_id" : ''; $limit_sql = ( $limit ) ? ( ( $offset ) ? "LIMIT $offset, $limit" : "LIMIT $limit" ) : ''; + $sql = "SELECT l.log_id, l.user_id, l.log_ip, l.log_time, l.log_operation, l.log_data, u.username - FROM " . LOG_ADMIN_TABLE . " l, " . USERS_TABLE . " u + FROM $table_sql l, " . USERS_TABLE . " u WHERE u.user_id = l.user_id AND l.log_time >= $limit_days + $forum_sql ORDER BY $sort_by $limit_sql"; $result = $db->sql_query($sql); - $admin_log = array(); + $log = array(); if ( $row = $db->sql_fetchrow($result) ) { $i = 0; do { - $admin_log[$i]['id'] = $row['log_id']; - $admin_log[$i]['username'] = '<a href="admin_users.'.$phpEx . $SID . '&u=' . $row['user_id'] . '">' . $row['username'] . '</a>'; - $admin_log[$i]['ip'] = $row['log_ip']; - $admin_log[$i]['time'] = $row['log_time']; + $log[$i]['id'] = $row['log_id']; + $log[$i]['username'] = '<a href="admin_users.'.$phpEx . $SID . '&u=' . $row['user_id'] . '">' . $row['username'] . '</a>'; + $log[$i]['ip'] = $row['log_ip']; + $log[$i]['time'] = $row['log_time']; - $admin_log[$i]['action'] = ( !empty($lang[$row['log_operation']]) ) ? $lang[$row['log_operation']] : ucfirst(str_replace('_', ' ', $row['log_operation'])); + $log[$i]['action'] = ( !empty($lang[$row['log_operation']]) ) ? $lang[$row['log_operation']] : ucfirst(str_replace('_', ' ', $row['log_operation'])); if ( !empty($row['log_data']) ) { @@ -168,7 +172,7 @@ function view_admin_log($limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'l. foreach ( $log_data_ary as $log_data ) { - $admin_log[$i]['action'] = preg_replace('#%s#', $log_data, $admin_log[$i]['action'], 1); + $log[$i]['action'] = preg_replace('#%s#', $log_data, $log[$i]['action'], 1); } } @@ -179,7 +183,18 @@ function view_admin_log($limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'l. $db->sql_freeresult($result); - return $admin_log; + $sql = "SELECT COUNT(*) AS total_entries + FROM $table_sql l + WHERE l.log_time >= $limit_days + $forum_sql"; + $result = $db->sql_query($sql); + + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $log_count = $row['total_entries']; + + return; } // // End Functions diff --git a/phpBB/language/lang_english/lang_admin.php b/phpBB/language/lang_english/lang_admin.php index b2e86c0448..4dcfe966d4 100644 --- a/phpBB/language/lang_english/lang_admin.php +++ b/phpBB/language/lang_english/lang_admin.php @@ -63,6 +63,7 @@ $lang['DB_Restore'] = 'DB Restore'; $lang['Basic_Config'] = 'Basic Configuration'; $lang['Administrators'] = 'Administrators'; $lang['Admin_logs'] = 'Admin Log'; +$lang['Mod_logs'] = 'Moderator Log'; $lang['Users'] = 'Users'; $lang['Groups'] = 'Groups'; @@ -116,7 +117,8 @@ $lang['log_prune_user_del_anon'] = '<b>Users Pruned and Posts Retained</b> => %s // // View log // -$lang['Admin_log_explain'] = 'This lists all the actions carried out by board administrators. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.'; +$lang['Admin_logs_explain'] = 'This lists all the actions carried out by board administrators. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.'; +$lang['Mod_logs_explain'] = 'This lists the actions carried out by board moderators, select a forum from the drop down list. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.'; $lang['Display_log'] = 'Display entries from previous'; $lang['All_Entries'] = 'All entries'; $lang['Sort_ip'] = 'IP address'; @@ -171,17 +173,25 @@ $lang['Database_Utilities'] = 'Database Utilities'; $lang['Restore'] = 'Restore'; $lang['Backup'] = 'Backup'; -$lang['Restore_explain'] = 'This will perform a full restore of all phpBB tables from a saved file. If your server supports it you may upload a gzip compressed text file and it will automatically be decompressed. <b>WARNING</b> This will overwrite any existing data. The restore may take a long time to process please do not move from this page till it is complete.'; +$lang['Restore_explain'] = 'This will perform a full restore of all phpBB tables from a saved file. You can <u>either</u> upload the backup file via this form or upload it manually to a location on the server. If your server supports it you may use a gzip compressed text file and it will automatically be decompressed. <b>WARNING</b> This will overwrite any existing data. The restore may take a long time to process please do not move from this page till it is complete.'; $lang['Backup_explain'] = 'Here you can backup all your phpBB related data. If you have any additional custom tables in the same database with phpBB that you would like to back up as well please enter their names separated by commas in the Additional Tables textbox below. If your server supports it you may also gzip compress the file to reduce its size before download.'; $lang['Backup_options'] = 'Backup options'; +$lang['Backup_type'] = 'Backup type'; $lang['Start_backup'] = 'Start Backup'; -$lang['Full_backup'] = 'Full backup'; -$lang['Structure_backup'] = 'Structure Only backup'; -$lang['Data_backup'] = 'Data only backup'; +$lang['Full_backup'] = 'Full'; +$lang['Structure_only'] = 'Structure Only'; +$lang['Data_only'] = 'Data only'; +$lang['Include_search_index'] = 'Include Search Index tables'; +$lang['Include_search_index_explain'] = 'Disabling this will exclude the <i>search</i> tables in full or data only backups, reducing the backup size but requiring a Search Index upon restore.'; $lang['Additional_tables'] = 'Additional tables'; +$lang['Additional_tables_explain'] = 'Include any other tables you wish to backup here each seperated by a comma.'; $lang['Gzip_compress'] = 'Gzip compress file'; + +$lang['Upload_file'] = 'Upload backup file'; $lang['Select_file'] = 'Select a file'; +$lang['Local_backup_file'] = 'Location of backup file'; +$lang['Local_backup_file_explain'] = 'Location on the server where backup file is stored relative to the phpBB root, e.g. ../tmp/backup.sql'; $lang['Start_Restore'] = 'Start Restore'; $lang['Restore_success'] = 'The Database has been successfully restored.<br /><br />Your board should be back to the state it was when the backup was made.'; @@ -203,8 +213,16 @@ $lang['Permissions_explain'] = 'Here you can alter which users and groups can ac $lang['Moderators'] = 'Moderators'; $lang['Moderators_explain'] = 'Here you can assign users and groups as forum moderators. You can give users or groups individual access to certain moderator functions as you set fit. Moderators have additional power in a given forum and by default can post and reply even when a forum or topic is locked.'; +$lang['Super_Moderators'] = 'Super Moderators'; +$lang['Super_Moderators_explain'] = 'Here you can assign users and groups as super moderators. Super Moderators are like ordinary moderators accept they have access to every forum on your board. You can give users or groups individual access to certain moderator functions as you set fit. As with moderators, super moderators have additional power in a given forum and by default can post and reply even when a forum or topic is locked.'; + $lang['Administrators_explain'] = 'Here you can assign administrator rights to users or groups. All users with admin permissions can view the administration panel. However you can limit selected users or groups to only certain sections if you wish by clicking <i>Advanced</i>.'; +$lang['ADMINISTRATORS'] = 'ADMINISTRATORS'; +$lang['SUPER_MODERATORS'] = 'SUPER MODERATORS'; +$lang['REGISTERED'] = 'REGISTERED USERS'; +$lang['GUESTS'] = 'GUESTS'; + $lang['Manage_users'] = 'Manage Users'; $lang['Add_users'] = 'Add Users'; $lang['Manage_groups'] = 'Manage Groups'; |