mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Issue #4079 - Code Cleanup.
This commit is contained in:
@@ -64,7 +64,7 @@ class e_admin_log
|
|||||||
* Constructor. Sets up constants and overwrites default options where set.
|
* Constructor. Sets up constants and overwrites default options where set.
|
||||||
*
|
*
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @return none
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function __construct($options = array())
|
public function __construct($options = array())
|
||||||
{
|
{
|
||||||
@@ -112,6 +112,7 @@ class e_admin_log
|
|||||||
$this->_messages = array();
|
$this->_messages = array();
|
||||||
$this->_allMessages = array();
|
$this->_allMessages = array();
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,27 +179,8 @@ class e_admin_log
|
|||||||
$event_code = 'ADMIN';
|
$event_code = 'ADMIN';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//SecretR - now supports DB array as event_detail (see e.g. db::db_Insert())
|
|
||||||
if (is_array($event_detail))
|
|
||||||
{
|
|
||||||
// handled inside e_log_event();
|
|
||||||
|
|
||||||
/*
|
if (!is_array($event_detail))
|
||||||
$tmp = array();
|
|
||||||
if (isset($event_detail['data']))
|
|
||||||
{
|
|
||||||
$event_detail = $event_detail['data'];
|
|
||||||
}
|
|
||||||
foreach ($event_detail as $k => $v)
|
|
||||||
{
|
|
||||||
$tmp[] = $k.'=>'.$v;
|
|
||||||
}
|
|
||||||
$event_detail = implode("[!br!]\n", $tmp);
|
|
||||||
unset($tmp);
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// auto-format long details - TODO - shrink details on administration log page, expand/show in DHTML window full details.
|
// auto-format long details - TODO - shrink details on administration log page, expand/show in DHTML window full details.
|
||||||
$event_detail = str_replace("\n", "[!br!]", $event_detail);
|
$event_detail = str_replace("\n", "[!br!]", $event_detail);
|
||||||
@@ -225,7 +207,7 @@ class e_admin_log
|
|||||||
* @param bool $finished
|
* @param bool $finished
|
||||||
* @param int $target_logs
|
* @param int $target_logs
|
||||||
* @param null $userData
|
* @param null $userData
|
||||||
* @return none
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function addEvent($importance, $source_call, $eventcode = "GEN", $event_title = "Untitled", $explain = "", $finished = FALSE, $target_logs = LOG_TO_AUDIT, $userData=null )
|
public function addEvent($importance, $source_call, $eventcode = "GEN", $event_title = "Untitled", $explain = "", $finished = FALSE, $target_logs = LOG_TO_AUDIT, $userData=null )
|
||||||
{
|
{
|
||||||
@@ -257,7 +239,7 @@ class e_admin_log
|
|||||||
* LOG_TO_AUDIT - audit log
|
* LOG_TO_AUDIT - audit log
|
||||||
* LOG_TO_ROLLING - rolling log
|
* LOG_TO_ROLLING - rolling log
|
||||||
* @param array $userData - attribute user to log entry. array('user_id'=>2, 'user_name'=>'whatever');
|
* @param array $userData - attribute user to log entry. array('user_id'=>2, 'user_name'=>'whatever');
|
||||||
* @return none
|
* @return null
|
||||||
|
|
||||||
* @todo - check microtime() call
|
* @todo - check microtime() call
|
||||||
* @deprecated - use add() method instead or addEvent() as a direct replacement.
|
* @deprecated - use add() method instead or addEvent() as a direct replacement.
|
||||||
@@ -414,6 +396,8 @@ class e_admin_log
|
|||||||
|
|
||||||
if ($finished)
|
if ($finished)
|
||||||
exit; // Optional abort for all logs
|
exit; // Optional abort for all logs
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCurrentPlugin($plugdir)
|
public function setCurrentPlugin($plugdir)
|
||||||
@@ -595,7 +579,7 @@ class e_admin_log
|
|||||||
* @param array $niceNames - Normally data is logged in the format keyname=>value, one per line.
|
* @param array $niceNames - Normally data is logged in the format keyname=>value, one per line.
|
||||||
* If the $niceName array exists and has a definition, the 'nice Name' is displayed instead of the key name
|
* If the $niceName array exists and has a definition, the 'nice Name' is displayed instead of the key name
|
||||||
*
|
*
|
||||||
* @return none
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function logArrayAll($event, $target, $extra = '', $niceNames = NULL)
|
public function logArrayAll($event, $target, $extra = '', $niceNames = NULL)
|
||||||
{
|
{
|
||||||
@@ -627,6 +611,8 @@ class e_admin_log
|
|||||||
$spacer = '[!br!]';
|
$spacer = '[!br!]';
|
||||||
}
|
}
|
||||||
$this->add($event, $logString, E_LOG_INFORMATIVE, '');
|
$this->add($event, $logString, E_LOG_INFORMATIVE, '');
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -842,7 +828,7 @@ class e_admin_log
|
|||||||
{
|
{
|
||||||
if($this->logFile == null)
|
if($this->logFile == null)
|
||||||
{
|
{
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($this->_allMessages))
|
if(count($this->_allMessages))
|
||||||
@@ -852,7 +838,7 @@ class e_admin_log
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = '';
|
$text = '';
|
||||||
|
@@ -88,12 +88,16 @@ class notify
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
// e107::getEvent()->debug();
|
// e107::getEvent()->debug();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic Notification method when none defined.
|
* Generic Notification method when none defined.
|
||||||
|
*
|
||||||
|
* @param $data
|
||||||
|
* @param $id
|
||||||
*/
|
*/
|
||||||
function generic($data,$id)
|
function generic($data,$id)
|
||||||
{
|
{
|
||||||
@@ -102,20 +106,19 @@ class notify
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send an email notification following an event.
|
* Send an email notification following an event.
|
||||||
*
|
*
|
||||||
* The email is sent via a common interface, which will send immediately for small numbers of recipients, and queue for larger.
|
* The email is sent via a common interface, which will send immediately for small numbers of recipients, and queue for larger.
|
||||||
*
|
*
|
||||||
* @param string $id - identifies event actions
|
* @param string $id - identifies event actions
|
||||||
* @param string $subject - subject for email
|
* @param string $subject - subject for email
|
||||||
* @param string $message - email message body
|
* @param string $message - email message body
|
||||||
|
* @param array $media
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @todo handle 'everyone except' clauses (email address filter done)
|
* @todo handle 'everyone except' clauses (email address filter done)
|
||||||
* @todo set up pref to not notify originator of event which caused notify (see $blockOriginator)
|
* @todo set up pref to not notify originator of event which caused notify (see $blockOriginator)
|
||||||
*/
|
*/
|
||||||
function send($id, $subject, $message, $media=array())
|
function send($id, $subject, $message, $media=array())
|
||||||
{
|
{
|
||||||
@@ -128,6 +131,7 @@ class notify
|
|||||||
// $message = $tp->toEmail($message);
|
// $message = $tp->toEmail($message);
|
||||||
$emailFilter = '';
|
$emailFilter = '';
|
||||||
$notifyTarget = $this->notify_prefs['event'][$id]['class'];
|
$notifyTarget = $this->notify_prefs['event'][$id]['class'];
|
||||||
|
$qry = '';
|
||||||
|
|
||||||
if ($notifyTarget == '-email')
|
if ($notifyTarget == '-email')
|
||||||
{
|
{
|
||||||
@@ -216,7 +220,9 @@ class notify
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if((ADMIN || $pref['developer']) && E107_DEBUG_LEVEL > 0 || deftrue('e_DEBUG_NOTIFY'))
|
$devMode = e107::getPref('developer', false);
|
||||||
|
|
||||||
|
if((ADMIN || $devMode) && E107_DEBUG_LEVEL > 0 || deftrue('e_DEBUG_NOTIFY'))
|
||||||
{
|
{
|
||||||
$data = array('id'=>$id, 'subject'=>$subject, 'recipients'=> $recipients, 'prefs'=>$this->notify_prefs['event'][$id], 'message'=>$message);
|
$data = array('id'=>$id, 'subject'=>$subject, 'recipients'=> $recipients, 'prefs'=>$this->notify_prefs['event'][$id], 'message'=>$message);
|
||||||
|
|
||||||
@@ -257,14 +263,14 @@ class notify
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $mailer->sendEmails('notify', $mailData, $recipients);
|
$mailer->sendEmails('notify', $mailData, $recipients);
|
||||||
|
|
||||||
e107::getLog()->e_log_event(10,-1,'NOTIFY',$subject,$message,FALSE,LOG_TO_ROLLING);
|
e107::getLog()->addEvent(10,-1,'NOTIFY',$subject,$message,FALSE,LOG_TO_ROLLING);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$data = array('qry'=>$qry, 'error'=>'No recipients');
|
$data = array('qry'=>$qry, 'error'=>'No recipients');
|
||||||
e107::getLog()->add('Notify Debug', $data, E_LOG_WARNING_, "NOTIFY_DBG");
|
e107::getLog()->add('Notify Debug', $data, E_LOG_WARNING, "NOTIFY_DBG");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,8 +281,10 @@ class notify
|
|||||||
// ---------------------------------------
|
// ---------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
function notify_usersup($data)
|
* @param $data
|
||||||
|
*/
|
||||||
|
public function notify_usersup($data)
|
||||||
{
|
{
|
||||||
$message = "";
|
$message = "";
|
||||||
foreach ($data as $key => $value)
|
foreach ($data as $key => $value)
|
||||||
@@ -321,7 +329,9 @@ class notify
|
|||||||
$message .= $key.': '.$value.'<br />';
|
$message .= $key.': '.$value.'<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->send('login', NT_LAN_LI_1, $message);
|
$user = !empty($data['user_name']) ? " (".$data['user_name'].")" : "";
|
||||||
|
|
||||||
|
$this->send('login', NT_LAN_LI_1 . $user, $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
function notify_logout()
|
function notify_logout()
|
||||||
|
@@ -96,7 +96,7 @@ class forum_notify extends notify
|
|||||||
private function getData($type, $id)
|
private function getData($type, $id)
|
||||||
{
|
{
|
||||||
if (intval($id) < 1) return false;
|
if (intval($id) < 1) return false;
|
||||||
$qry = '';
|
|
||||||
switch($type)
|
switch($type)
|
||||||
{
|
{
|
||||||
case 'post':
|
case 'post':
|
||||||
|
Reference in New Issue
Block a user