1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Admin logging for admin log, file manager, mailout - that's basically the core done

This commit is contained in:
e107steved
2008-12-07 14:22:40 +00:00
parent bff38dadde
commit 5e09a59466
4 changed files with 235 additions and 135 deletions

View File

@@ -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.19 $
| $Date: 2008-11-23 20:26:23 $
| $Revision: 1.20 $
| $Date: 2008-12-07 14:22:32 $
| $Author: e107steved $
|
| Preferences:
@@ -35,39 +35,6 @@ if (!getperms("S"))
}
// Main language file should automatically be loaded
unset($qs);
require_once(e_ADMIN."auth.php");
define ('AL_DATE_TIME_FORMAT', 'y-m-d H:i:s');
if (isset($_POST['setoptions']))
{
$pref['roll_log_active'] = intval($_POST['roll_log_active']);
$pref['roll_log_days'] = intval($_POST['roll_log_days']);
save_prefs();
$message = RL_LAN_006 ; // "Options updated.";
}
if (isset($_POST['setcommonoptions']))
{
$pref['sys_log_perpage'] = intval($_POST['sys_log_perpage']);
save_prefs();
$message = RL_LAN_006 ; // "Options updated.";
}
if (e_QUERY)
{ // Must explode after calling auth.php
$qs = explode(".", e_QUERY);
}
$action = varset($qs[0],'adminlog');
// Load language files for log messages
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_log_messages.php'); //... for core functions
if (is_array($pref['logLanguageFile'])) //... and for any plugins which support it
@@ -80,6 +47,71 @@ if (is_array($pref['logLanguageFile'])) //... and for any plugins which
}
unset($qs);
require_once(e_ADMIN."auth.php");
define ('AL_DATE_TIME_FORMAT', 'y-m-d H:i:s');
if (isset($_POST['setoptions']))
{
unset($temp);
$temp['roll_log_active'] = intval($_POST['roll_log_active']);
$temp['roll_log_days'] = intval($_POST['roll_log_days']);
if ($admin_log->logArrayDiffs($temp, $pref, 'ADLOG_01'))
{
save_prefs(); // Only save if changes
$message = RL_LAN_006 ; // "Options updated.";
}
}
if (isset($_POST['setcommonoptions']))
{
unset($temp);
$temp['sys_log_perpage'] = intval($_POST['sys_log_perpage']);
if ($admin_log->logArrayDiffs($temp, $pref, 'ADLOG_01'))
{
save_prefs(); // Only save if changes
$message = RL_LAN_006 ; // "Options updated.";
}
}
// User audit prefs
if (isset($_POST['setauditoptions']))
{
unset($temp);
$message = RL_LAN_063;
if (in_array((string)USER_AUDIT_LOGIN,$_POST['user_audit_opts']))
{
$_POST['user_audit_opts'][] = USER_AUDIT_LOGOUT;
}
foreach ($_POST['user_audit_opts'] as $k => $v)
{
if (!is_numeric($v))
{
unset($_POST['user_audit_opts'][$k]);
}
}
$temp['user_audit_opts'] = implode(',',$_POST['user_audit_opts']);
$temp['user_audit_class'] = intval($_POST['user_audit_class']);
if ($admin_log->logArrayDiffs($temp, $pref, 'ADLOG_04'))
{
save_prefs(); // Only save if changes
}
}
if (e_QUERY)
{ // Must explode after calling auth.php
$qs = explode(".", e_QUERY);
}
$action = varset($qs[0],'adminlog');
// Delete comments if appropriate
if (isset($_POST['deleteitems']) && ($action == 'comments'))
@@ -151,12 +183,12 @@ if (($action == "backdel") && isset($_POST['backdeltype']))
case 'confdel' :
$db_table = 'admin_log';
$db_name = RL_LAN_052;
$db_msg = 'LAN_ADMIN_LOG_002';
$db_msg = "ADLOG_02";
break;
case 'auditdel' :
$db_table = 'audit_log';
$db_name = RL_LAN_053;
$db_msg = 'LAN_ADMIN_LOG_003';
$db_msg = "ADLOG_03";
break;
default :
exit; // Someone fooling around!
@@ -166,7 +198,7 @@ if (($action == "backdel") && isset($_POST['backdeltype']))
{
// Add in a log event
$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)<br />".$message.'<br />'.$db_table.' '.$qry, 4,'LOG_01');
$admin_log->log_event($db_msg,"db_Delete - earlier than {$old_string} (past {$qs[2]} days)[!br!]".$message.'[!br!]'.$db_table.' '.$qry, E_LOG_INFORMATIVE,'');
}
else
{
@@ -174,6 +206,7 @@ if (($action == "backdel") && isset($_POST['backdeltype']))
}
}
if (isset($_POST['confirmcancelold']))
{
$message = RL_LAN_056;
@@ -184,19 +217,6 @@ if (($action == "backdel") && isset($_POST['backdeltype']))
}
// User audit prefs
if (isset($_POST['setauditoptions']))
{
$message = RL_LAN_063;
if (in_array((string)USER_AUDIT_LOGIN,$_POST['user_audit_opts']))
{
$_POST['user_audit_opts'][] = USER_AUDIT_LOGOUT;
}
$pref['user_audit_opts'] = implode(',',$_POST['user_audit_opts']);
$pref['user_audit_class'] = intval($_POST['user_audit_class']);
save_prefs();
}
if (varsettrue($message))
{

View File

@@ -11,13 +11,14 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/filemanager.php,v $
| $Revision: 1.5 $
| $Date: 2008-10-19 11:35:00 $
| $Revision: 1.6 $
| $Date: 2008-12-07 14:22:32 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
require_once("../class2.php");
if (!getperms("6")) {
if (!getperms("6"))
{
header("location:".e_BASE."index.php");
exit;
}
@@ -42,7 +43,8 @@ $imagedir = e_IMAGE."packs/".$imode."/filemanager/";
$path = str_replace("../", "", e_QUERY);
if (!$path) {
if (!$path)
{
$path = str_replace("../", "", $adchoice[0]);
}
@@ -58,70 +60,111 @@ if($path == "/")
if (isset($_POST['deleteconfirm']))
{
$deleteList = array();
$moveList = array();
foreach($_POST['deleteconfirm'] as $key=>$delfile)
{
// check for delete.
if (isset($_POST['selectedfile'][$key]) && isset($_POST['deletefiles'])) {
if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
if (isset($_POST['selectedfile'][$key]) && isset($_POST['deletefiles']))
{
if (!$_POST['ac'] == md5(ADMINPWCHANGE))
{
exit;
}
$destination_file = e_BASE.$delfile;
if (@unlink($destination_file)) {
if (@unlink($destination_file))
{
$message .= FMLAN_26." '".$destination_file."' ".FMLAN_27.".<br />";
} else {
$deleteList[] = $destination_file;
}
else
{
$message .= FMLAN_28." '".$destination_file."'.<br />";
}
}
// check for move to downloads or downloadimages.
if (isset($_POST['selectedfile'][$key]) && (isset($_POST['movetodls'])) ){
if (isset($_POST['selectedfile'][$key]) && (isset($_POST['movetodls'])) )
{
$newfile = str_replace($path,"",$delfile);
// Move file to whatever folder.
if (isset($_POST['movetodls'])){
if (isset($_POST['movetodls']))
{
$newpath = $_POST['movepath'];
if (rename(e_BASE.$delfile,$newpath.$newfile)){
if (rename(e_BASE.$delfile,$newpath.$newfile))
{
$message .= FMLAN_38." ".$newpath.$newfile."<br />";
} else {
$moveList[] = e_BASE.$delfile.'=>'.$newpath.$newfile;
}
else
{
$message .= FMLAN_39." ".$newpath.$newfile."<br />";
$message .= (!is_writable($newpath)) ? $newpath.LAN_NOTWRITABLE : "";
}
}
}
}
if (count($deleteList))
{
$admin_log->log_event('FILEMAN_01',implode('[!br!]',$deleteList),E_LOG_INFORMATIVE,'');
}
if (count($moveList))
{
$admin_log->log_event('FILEMAN_02',implode('[!br!]',$moveList),E_LOG_INFORMATIVE,'');
}
}
if (isset($_POST['upload'])) {
if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
if (isset($_POST['upload']))
{
if (!$_POST['ac'] == md5(ADMINPWCHANGE))
{
exit;
}
$uploadList = array();
$pref['upload_storagetype'] = "1";
require_once(e_HANDLER."upload_handler.php");
$files = $_FILES['file_userfile'];
foreach($files['name'] as $key => $name) {
if ($files['size'][$key]) {
foreach($files['name'] as $key => $name)
{
if ($files['size'][$key])
{
$uploaded = file_upload(e_BASE.$_POST['upload_dir'][$key]);
$uploadList[] = $_POST['upload_dir'][$key].$uploaded[0]['name'];
}
}
if (count($uploadList))
{
$admin_log->log_event('FILEMAN_03',implode('[!br!]',$uploadList),E_LOG_INFORMATIVE,'');
}
}
if (isset($message)) {
if (isset($message))
{
$ns->tablerender("", "<div style=\"text-align:center\"><b>".$message."</b></div>");
}
if (strpos(e_QUERY, ".") && !is_dir(realpath(e_BASE.$path))){
if (strpos(e_QUERY, ".") && !is_dir(realpath(e_BASE.$path)))
{
echo "<iframe style=\"width:100%\" src=\"".e_BASE.e_QUERY."\" height=\"300\" scrolling=\"yes\"></iframe><br /><br />";
if (!strpos(e_QUERY, "/")) {
if (!strpos(e_QUERY, "/"))
{
$path = "";
} else {
}
else
{
$path = substr($path, 0, strrpos(substr($path, 0, -1), "/"))."/";
}
}
$files = array();
$dirs = array();
$path = explode("?", $path);
@@ -129,7 +172,8 @@ $path = $path[0];
$path = explode(".. ", $path);
$path = $path[0];
if ($handle = opendir(e_BASE.$path)) {
if ($handle = opendir(e_BASE.$path))
{
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {

View File

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/mailout.php,v $
| $Revision: 1.11 $
| $Date: 2008-11-14 06:01:06 $
| $Author: e107coders $
| $Revision: 1.12 $
| $Date: 2008-12-07 14:22:32 $
| $Author: e107steved $
|
| Work in progress - supplementary mailer plugin
|
@@ -165,6 +165,7 @@ if (isset($_POST['testemail']) && getperms("0"))
else
{
$message = LAN_MAILOUT_81. "(".$sendto.")";
$admin_log->log_event('MAIL_01',$sendto,E_LOG_INFORMATIVE,'');
}
}
}
@@ -358,6 +359,7 @@ Table data:
}
$sql->db_Update('generic',"`gen_intdata`={$c} WHERE `gen_id`={$mail_text_id}");
$admin_log->log_event('MAIL_02','ID: '.$mail_text_id.' '.$c.'[!br!]'.$_POST['email_from_name']." &lt;".$_POST['email_from_email'],E_LOG_INFORMATIVE,'');
@@ -465,12 +467,13 @@ Table data:
if (isset($_POST['updateprefs']) && getperms("0"))
{
$pref['mailer'] = $_POST['mailer'];
unset($temp);
$temp['mailer'] = $_POST['mailer'];
// Allow qmail as an option as well - works much as sendmail
if ((strpos($_POST['sendmail'],'sendmail') !== FALSE) || (strpos($_POST['sendmail'],'qmail') !== FALSE)) $pref['sendmail'] = $_POST['sendmail'];
$pref['smtp_server'] = $tp->toDB($_POST['smtp_server']);
$pref['smtp_username'] = $tp->toDB($_POST['smtp_username']);
$pref['smtp_password'] = $tp->toDB($_POST['smtp_password']);
if ((strpos($_POST['sendmail'],'sendmail') !== FALSE) || (strpos($_POST['sendmail'],'qmail') !== FALSE)) $temp['sendmail'] = $_POST['sendmail'];
$temp['smtp_server'] = $tp->toDB($_POST['smtp_server']);
$temp['smtp_username'] = $tp->toDB($_POST['smtp_username']);
$temp['smtp_password'] = $tp->toDB($_POST['smtp_password']);
$smtp_opts = array();
switch (trim($_POST['smtp_options']))
@@ -488,26 +491,33 @@ if (isset($_POST['updateprefs']) && getperms("0"))
if (varsettrue($_POST['smtp_keepalive'])) $smtp_opts[] = 'keepalive';
if (varsettrue($_POST['smtp_useVERP'])) $smtp_opts[] = 'useVERP';
$pref['smtp_pop3auth'] = in_array('pop3auth',$smpt_opts); // This will go!
$pref['smtp_keepalive'] = $_POST['smtp_keepalive']; // This will go!
$temp['smtp_pop3auth'] = in_array('pop3auth',$smpt_opts); // This will go!
$temp['smtp_keepalive'] = $_POST['smtp_keepalive']; // This will go!
$pref['smtp_options'] = implode(',',$smtp_opts);
$temp['smtp_options'] = implode(',',$smtp_opts);
$pref['mail_pause'] = $_POST['mail_pause'];
$pref['mail_pausetime'] = $_POST['mail_pausetime'];
$pref['mail_bounce_email'] = $_POST['mail_bounce_email'];
$pref['mail_bounce_pop3'] = $_POST['mail_bounce_pop3'];
$pref['mail_bounce_user'] = $_POST['mail_bounce_user'];
$pref['mail_bounce_pass'] = $_POST['mail_bounce_pass'];
$pref['mail_bounce_type'] = $_POST['mail_bounce_type'];
$pref['mail_bounce_delete'] = $_POST['mail_bounce_delete'];
$temp['mail_pause'] = intval($_POST['mail_pause']);
$temp['mail_pausetime'] = intval($_POST['mail_pausetime']);
$temp['mail_bounce_email'] = $tp->toDB($_POST['mail_bounce_email']);
$temp['mail_bounce_pop3'] = $tp->toDB($_POST['mail_bounce_pop3']);
$temp['mail_bounce_user'] = $tp->toDB($_POST['mail_bounce_user']);
$temp['mail_bounce_pass'] = $tp->toDB($_POST['mail_bounce_pass']);
$temp['mail_bounce_type'] = $tp->toDB($_POST['mail_bounce_type']);
$temp['mail_bounce_delete'] = intval($_POST['mail_bounce_delete']);
$pref['mailout_enabled'] = implode(',',$_POST['mail_mailer_enabled']);
$pref['mail_log_options'] = intval($_POST['mail_log_option']).','.intval($_POST['mail_log_email']);
$temp['mailout_enabled'] = implode(',',$_POST['mail_mailer_enabled']);
$temp['mail_log_options'] = intval($_POST['mail_log_option']).','.intval($_POST['mail_log_email']);
save_prefs();
if ($admin_log->logArrayDiffs($temp, $pref, 'MAIL_03'))
{
save_prefs(); // Only save if changes
$message = LAN_SETSAVED;
}
else
{
$message = IMALAN_20;
}
}
if (isset($message))
@@ -572,6 +582,7 @@ function showMailouts($sub_par,$mail_id)
if ($sql->db_Select('generic','gen_datestamp',"`gen_datestamp`={$mail_id} AND `gen_type`='savemail'"))
{
$message = $sql->db_Delete('generic',"`gen_datestamp`={$mail_id} AND (`gen_type`='sendmail' OR `gen_type`='savemail')") ? LAN_DELETED : LAN_DELETED_FAILED;
$admin_log->log_event('MAIL_04',$mail_id,E_LOG_INFORMATIVE,'');
}
else
{ // Should only happen if people fiddle!
@@ -683,6 +694,7 @@ function showMailouts($sub_par,$mail_id)
if ($sql->db_Select('generic','gen_datestamp',"`gen_datestamp`={$mail_id} AND `gen_type`='sendmail'"))
{
$message = $sql->db_Delete('generic',"`gen_datestamp`={$mail_id} AND `gen_type`='sendmail'") ? LAN_DELETED : LAN_DELETED_FAILED;
$admin_log->log_event('MAIL_04',$mail_i5,E_LOG_INFORMATIVE,'');
}
else
{ // Should only happen if people fiddle!

View File

@@ -1,6 +1,6 @@
<?php
// e107 Language File.
// $Id: lan_log_messages.php,v 1.33 2008-12-07 13:08:48 e107steved Exp $
// $Id: lan_log_messages.php,v 1.34 2008-12-07 14:22:40 e107steved Exp $
/*
The definitions in this file are for standard 'explanatory' messages which might be entered
@@ -36,8 +36,11 @@ define('LAN_AUDIT_LOG_020', 'User added by admin');
// Admin log events
//-----------------
define('LAN_ADMIN_LOG_002', 'Admin log - delete old data');
define('LAN_ADMIN_LOG_003', 'User Audit log - delete old data');
define('LAN_AL_ADLOG_01', 'Admin log - prefs updated');
define('LAN_AL_ADLOG_02', 'Admin log - delete old data');
define('LAN_AL_ADLOG_03', 'User Audit log - delete old data');
define('LAN_AL_ADLOG_04', 'User audit options updated');
define('LAN_AL_ADLOG_05', '');
// User edits
//-----------
@@ -315,5 +318,26 @@ define('LAN_AL_NEWS_08', 'News item added');
define('LAN_AL_NEWS_09', 'News item updated');
define('LAN_AL_NEWS_10', '');
// Comments
//---------
define('LAN_AL_COMMENT_01', 'Comment(s) deleted');
// File Manager
//-------------
define('LAN_AL_FILEMAN_01','File(s) deleted');
define('LAN_AL_FILEMAN_02','File(s) moved');
define('LAN_AL_FILEMAN_03','File(s) uploaded');
define('LAN_AL_FILEMAN_04','');
// Mail
//-----
define('LAN_AL_MAIL_01', 'Test email sent');
define('LAN_AL_MAIL_02', 'Mailshot created');
define('LAN_AL_MAIL_03', 'Mail settings updated');
define('LAN_AL_MAIL_04', 'Mailshot details deleted');
define('LAN_AL_MAIL_05', 'Delete orphaned emails');
define('LAN_AL_MAIL_06', '');
define('LAN_AL_MAIL_07', '');
?>