mirror of
https://github.com/e107inc/e107.git
synced 2025-08-11 17:14:42 +02:00
Remove some references to deprecated functions/methods.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2010 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2010 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* Admin Log Handler
|
||||
*
|
||||
* USAGE:
|
||||
@@ -13,24 +13,24 @@
|
||||
* @example Log and Add to Message Handler: e107::getAdminLog()->addSuccess("Successfully executed")->save('PREF_01');
|
||||
* @example Log Only: e107::getAdminLog()->addSuccess("Successfully executed",false)->save('PREF_01');
|
||||
* @example Log Array Diff: e107::getAdminLog()->addArray($array1, $array2)->save('PREF_01');
|
||||
* @example Log Array Diff and Add to Message Handler: e107::getAdminLog()->addArray($array1, $array2, E_MESSAGE_ERROR )->save('PREF_01');
|
||||
*
|
||||
*/
|
||||
* @example Log Array Diff and Add to Message Handler: e107::getAdminLog()->addArray($array1, $array2, E_MESSAGE_ERROR )->save('PREF_01');
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
define('LOG_MESSAGE_NODISPLAY', 'nodisplay');
|
||||
|
||||
define('LOG_MESSAGE_NODISPLAY', 'nodisplay');
|
||||
|
||||
/**
|
||||
* Admin logging class.
|
||||
*
|
||||
* @package e107
|
||||
* @subpackage e107_handlers
|
||||
* @version $Id$;
|
||||
* @author e107steved
|
||||
* @version $Id$;
|
||||
* @author e107steved
|
||||
*/
|
||||
class e_admin_log
|
||||
{
|
||||
@@ -47,16 +47,16 @@ class e_admin_log
|
||||
|
||||
|
||||
protected $logFile = null;
|
||||
/**
|
||||
* Log messages
|
||||
* @var array
|
||||
*/
|
||||
/**
|
||||
* Log messages
|
||||
* @var array
|
||||
*/
|
||||
protected $_messages;
|
||||
|
||||
|
||||
protected $_allMessages; // similar to $_messages except it is never flushed.
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. Sets up constants and overwrites default options where set.
|
||||
*
|
||||
@@ -98,14 +98,14 @@ class e_admin_log
|
||||
define('USER_AUDIT_BANNED', 22); // User banned
|
||||
define('USER_AUDIT_BOUNCE_RESET', 23); // User bounce reset
|
||||
define('USER_AUDIT_TEMP_ACCOUNT', 24); // User temporary account
|
||||
|
||||
// Init E_MESSAGE_* constants if not already done
|
||||
|
||||
// Init E_MESSAGE_* constants if not already done
|
||||
// e107::getMessage(); - just include, message handler is creating session in construct
|
||||
// it breaks stuff (see class2 - language detection and comments)
|
||||
require_once(e_HANDLER.'message_handler.php');
|
||||
require_once(e_HANDLER.'message_handler.php');
|
||||
$this->_messages = array();
|
||||
$this->_allMessages = array();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,7 +175,7 @@ class e_admin_log
|
||||
{
|
||||
// handled inside e_log_event();
|
||||
|
||||
/*
|
||||
/*
|
||||
$tmp = array();
|
||||
if (isset($event_detail['data']))
|
||||
{
|
||||
@@ -187,7 +187,7 @@ class e_admin_log
|
||||
}
|
||||
$event_detail = implode("[!br!]\n", $tmp);
|
||||
unset($tmp);
|
||||
*/
|
||||
*/
|
||||
|
||||
}
|
||||
else
|
||||
@@ -313,7 +313,7 @@ class e_admin_log
|
||||
//---------------------------------------
|
||||
// Rolling Log
|
||||
//---------------------------------------
|
||||
if (($target_logs & LOG_TO_ROLLING) && varsettrue($pref['roll_log_active']))
|
||||
if (($target_logs & LOG_TO_ROLLING) && vartrue($pref['roll_log_active']))
|
||||
{ // Rolling log
|
||||
|
||||
// Process source_call info
|
||||
@@ -462,7 +462,7 @@ class e_admin_log
|
||||
*
|
||||
* @return bool true if changes found and logged, false otherwise.
|
||||
*/
|
||||
function logArrayDiffs($new, $old, $event, $logNow = true)
|
||||
function logArrayDiffs($new, $old, $event, $logNow = true)
|
||||
{
|
||||
// $changes = array();
|
||||
|
||||
@@ -478,7 +478,7 @@ class e_admin_log
|
||||
{
|
||||
$this->logMessage($changes, LOG_MESSAGE_NODISPLAY, E_MESSAGE_INFO);
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -528,24 +528,24 @@ class e_admin_log
|
||||
}
|
||||
$this->add($event, $logString, E_LOG_INFORMATIVE, '');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The next two routines accept and buffers messages which are destined for both admin log and message handler
|
||||
* The next two routines accept and buffers messages which are destined for both admin log and message handler
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add a message to the queue
|
||||
*
|
||||
* @param string $text - the message text for logging/display
|
||||
* @param int $type - the 'importance' of the message. E_MESSAGE_SUCCESS|E_MESSAGE_ERROR|E_MESSAGE_INFO|E_MESSAGE_DEBUG|E_MESSAGE_NODISPLAY
|
||||
* @param int $type - the 'importance' of the message. E_MESSAGE_SUCCESS|E_MESSAGE_ERROR|E_MESSAGE_INFO|E_MESSAGE_DEBUG|E_MESSAGE_NODISPLAY
|
||||
* (Values as used in message handler, apart from the last, which causes the message to not be passed to the message handler
|
||||
* @param boolean|int $logLevel - TRUE to give same importance as for message display. FALSE to not log.
|
||||
* one of the values specified for $mesLevel to determine the prefix attached to the log message
|
||||
* @param boolean $session add session message
|
||||
*
|
||||
* @return e_admin_log
|
||||
* @param boolean $session add session message
|
||||
*
|
||||
* @return e_admin_log
|
||||
*/
|
||||
public function logMessage($text, $type = '', $logLevel = TRUE, $session = FALSE)
|
||||
public function logMessage($text, $type = '', $logLevel = TRUE, $session = FALSE)
|
||||
{
|
||||
|
||||
if(is_array($text))
|
||||
@@ -558,17 +558,17 @@ class e_admin_log
|
||||
e107::getMessage()->addDebug("Log Message was empty: ".print_a($bt[1],true));
|
||||
return $this; // changing to text will break chained methods.
|
||||
}
|
||||
|
||||
if(!$type) $type = E_MESSAGE_INFO;
|
||||
|
||||
if(!$type) $type = E_MESSAGE_INFO;
|
||||
if($logLevel === TRUE) $logLevel = $type;
|
||||
|
||||
$logArray = array('message' => $text, 'dislevel' => $type, 'loglevel' => $logLevel, 'session' => $session, 'time'=>time());
|
||||
|
||||
|
||||
$this->_messages[] = $logArray;
|
||||
$this->_allMessages[] = $logArray;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -607,18 +607,18 @@ class e_admin_log
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add an error message to the log queue
|
||||
*
|
||||
* @param string $text
|
||||
* @param boolean $message if true (default) - register with eMessage handler, set to false to hide.
|
||||
* @param boolean $session add session message
|
||||
* @return e_admin_log
|
||||
*/
|
||||
public function addError($text, $message = true, $session = false)
|
||||
{
|
||||
return $this->logMessage($text, ($message ? E_MESSAGE_ERROR : LOG_MESSAGE_NODISPLAY), E_MESSAGE_ERROR, $session);
|
||||
}
|
||||
/**
|
||||
* Add an error message to the log queue
|
||||
*
|
||||
* @param string $text
|
||||
* @param boolean $message if true (default) - register with eMessage handler, set to false to hide.
|
||||
* @param boolean $session add session message
|
||||
* @return e_admin_log
|
||||
*/
|
||||
public function addError($text, $message = true, $session = false)
|
||||
{
|
||||
return $this->logMessage($text, ($message ? E_MESSAGE_ERROR : LOG_MESSAGE_NODISPLAY), E_MESSAGE_ERROR, $session);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -681,7 +681,7 @@ class e_admin_log
|
||||
* @param int $logImportance - passed directly to admin log
|
||||
* @param string $logEventCode - passed directly to admin log
|
||||
* @param string $mstack [optional] message stack passed to message handler
|
||||
* @return e_admin_log
|
||||
* @return e_admin_log
|
||||
*/
|
||||
public function flushMessages($logTitle, $logImportance = E_LOG_INFORMATIVE, $logEventCode = '', $mstack = false)
|
||||
{
|
||||
@@ -690,34 +690,34 @@ class e_admin_log
|
||||
$resultTypes = array(E_MESSAGE_SUCCESS - 'Success', E_MESSAGE_ERROR => 'Fail'); // Add LANS here. Could add other codes
|
||||
$separator = '';
|
||||
$logString = '';
|
||||
foreach ($this->_messages as $m)
|
||||
foreach ($this->_messages as $m)
|
||||
{
|
||||
if ($m['loglevel'] !== FALSE)
|
||||
{
|
||||
$logString .= $separator;
|
||||
if ($m['loglevel'] == LOG_MESSAGE_NODISPLAY) { $logString .= ' '; } // Indent supplementary messages
|
||||
// Not sure about next line - might want to log the <br /> as text, rather than it forcing a newline
|
||||
$logString .= strip_tags(str_replace(array('<br>', '<br/>', '<br />'), '[!br!]', $m['message']));
|
||||
// Not sure about next line - might want to log the <br /> as text, rather than it forcing a newline
|
||||
$logString .= strip_tags(str_replace(array('<br>', '<br/>', '<br />'), '[!br!]', $m['message']));
|
||||
if (isset($resultTypes[$m['loglevel']]))
|
||||
{
|
||||
$logString .= ' - '.$resultTypes[$m['loglevel']];
|
||||
}
|
||||
$separator = '[!br!]';
|
||||
}
|
||||
if ($m['dislevel'] != LOG_MESSAGE_NODISPLAY)
|
||||
if ($m['dislevel'] != LOG_MESSAGE_NODISPLAY)
|
||||
{
|
||||
if($mstack)
|
||||
{
|
||||
$mes->addStack($m['message'], $mstack, $m['dislevel'], $m['session']);
|
||||
// move to main stack OUTSIDE if needed
|
||||
}
|
||||
else $mes->add($m['message'], $m['dislevel'], $m['session']);
|
||||
else $mes->add($m['message'], $m['dislevel'], $m['session']);
|
||||
}
|
||||
}
|
||||
e107::getAdminLog()->add($logTitle, $logString, $logImportance, $logEventCode);
|
||||
$this->_messages = array(); // Clear the memory for reuse
|
||||
|
||||
return $this;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
@@ -751,8 +751,8 @@ class e_admin_log
|
||||
$head .= "-------------------------------------------------------------------------------------------\n\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach($this->_allMessages as $m)
|
||||
@@ -785,9 +785,9 @@ class e_admin_log
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$app = null;
|
||||
$text = $head . $text;
|
||||
$text = $head . $text;
|
||||
}
|
||||
|
||||
if(file_put_contents($fileName, $text, $app))
|
||||
@@ -796,8 +796,8 @@ class e_admin_log
|
||||
return $this->logFile;
|
||||
}
|
||||
elseif(getperms('0') && E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
echo "Could Save to Log File: ".$fileName;
|
||||
{
|
||||
echo "Could Save to Log File: ".$fileName;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user