diff --git a/e107_admin/admin_log.php b/e107_admin/admin_log.php
index 9ec04b78b..767cf0e3f 100644
--- a/e107_admin/admin_log.php
+++ b/e107_admin/admin_log.php
@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/admin_log.php,v $
-| $Revision: 1.6 $
-| $Date: 2007-12-26 15:12:59 $
+| $Revision: 1.7 $
+| $Date: 2007-12-29 22:07:42 $
| $Author: e107steved $
|
| Preferences:
@@ -32,7 +32,8 @@ Todo:
require_once("../class2.php");
if (!getperms("S"))
{
- header("location:".e_BASE."index.php");
+ header("location:".e_BASE."index.php");
+ exit;
}
// Main language file should automatically be loaded
@@ -69,17 +70,30 @@ $action = varset($qs[0],'adminlog');
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_log_messages.php');
+
+
// ****************** MAINTENANCE ******************
+unset($back_count);
if (isset($_POST['deleteoldadmin']) && isset($_POST['rolllog_clearadmin']))
{
$back_count = $_POST['rolllog_clearadmin'];
+ $next_action = 'confdel';
+}
+elseif (isset($_POST['deleteoldaudit']) && isset($_POST['rolllog_clearaudit']))
+{
+ $back_count = $_POST['rolllog_clearaudit'];
+ $next_action = 'auditdel';
+}
+
+if (isset($back_count) && isset($next_action))
+{
if (($back_count >= 1) && ($back_count <= 90))
{
$temp_date = getdate();
$old_date = intval(mktime(0,0,0,$temp_date['mon'],$temp_date['mday']-$back_count,$temp_date['year']));
$old_string = strftime("%d %B %Y",$old_date);
// $message = "Back delete ".$back_count." days. Oldest date = ".$old_string;
- $action = "confdel";
+ $action = $next_action;
$qs[1] = $old_date;
$qs[2] = $back_count;
}
@@ -87,23 +101,40 @@ if (isset($_POST['deleteoldadmin']) && isset($_POST['rolllog_clearadmin']))
$message = RL_LAN_050;
}
+
+
if (!isset($admin_log)) $message .= " Admin Log not valid";
-// Actually delete back events
-if ($action == "backdel")
+// Actually delete back events - admin or user audit log
+if (($action == "backdel") && isset($_POST['backdeltype']))
{
-if (isset($_POST['confirmdeleteold']))
+ if (isset($_POST['confirmdeleteold']))
{
$old_date = intval($qs[1]);
$old_string = strftime("%d %B %Y",$old_date);
- $qry = "dblog_datestamp < ".$old_date;
+ $qry = "dblog_datestamp < ".$old_date; // Same field for both logs
+ switch ($_POST['backdeltype'])
+ {
+ case 'confdel' :
+ $db_table = 'admin_log';
+ $db_name = RL_LAN_052;
+ $db_msg = 'LAN_ADMIN_LOG_002';
+ break;
+ case 'auditdel' :
+ $db_table = 'audit_log';
+ $db_name = RL_LAN_053;
+ $db_msg = 'LAN_ADMIN_LOG_003';
+ break;
+ default :
+ exit; // Someone fooling around!
+ }
// $message = "Back delete, oldest date = {$old_string} Query = {$qry}";
- if ($del_count = $sql -> db_Delete("admin_log",$qry))
+ if ($del_count = $sql -> db_Delete($db_table,$qry))
{
// Add in a log event
- $admin_log->log_event ("db_Delete - earlier than {$old_string} (past {$qs[2]} days)", $qry, 4);
- $message = RL_LAN_052.$old_string.RL_LAN_057.$del_count.RL_LAN_053;
+ $message = $db_name.str_replace(array('--OLD--','--NUM--'),array($old_string,$del_count),RL_LAN_057);
+ $admin_log->log_event($db_msg,"db_Delete - earlier than {$old_string} (past {$qs[2]} days)
".$message.'
'.$db_table.' '.$qry, 4,'LOG_01');
}
else
{
@@ -140,15 +171,19 @@ if (varsettrue($message))
$ns->tablerender("", "