mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +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.
|
||||
*
|
||||
* @param array $options
|
||||
* @return none
|
||||
* @return null
|
||||
*/
|
||||
public function __construct($options = array())
|
||||
{
|
||||
@@ -112,6 +112,7 @@ class e_admin_log
|
||||
$this->_messages = array();
|
||||
$this->_allMessages = array();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,27 +179,8 @@ class e_admin_log
|
||||
$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();
|
||||
|
||||
/*
|
||||
$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
|
||||
if (!is_array($event_detail))
|
||||
{
|
||||
// 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);
|
||||
@@ -225,7 +207,7 @@ class e_admin_log
|
||||
* @param bool $finished
|
||||
* @param int $target_logs
|
||||
* @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 )
|
||||
{
|
||||
@@ -257,7 +239,7 @@ class e_admin_log
|
||||
* LOG_TO_AUDIT - audit log
|
||||
* LOG_TO_ROLLING - rolling log
|
||||
* @param array $userData - attribute user to log entry. array('user_id'=>2, 'user_name'=>'whatever');
|
||||
* @return none
|
||||
* @return null
|
||||
|
||||
* @todo - check microtime() call
|
||||
* @deprecated - use add() method instead or addEvent() as a direct replacement.
|
||||
@@ -414,6 +396,8 @@ class e_admin_log
|
||||
|
||||
if ($finished)
|
||||
exit; // Optional abort for all logs
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
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.
|
||||
* 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)
|
||||
{
|
||||
@@ -627,6 +611,8 @@ class e_admin_log
|
||||
$spacer = '[!br!]';
|
||||
}
|
||||
$this->add($event, $logString, E_LOG_INFORMATIVE, '');
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -842,7 +828,7 @@ class e_admin_log
|
||||
{
|
||||
if($this->logFile == null)
|
||||
{
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if(count($this->_allMessages))
|
||||
@@ -852,7 +838,7 @@ class e_admin_log
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$text = '';
|
||||
|
@@ -88,12 +88,16 @@ class notify
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
// e107::getEvent()->debug();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generic Notification method when none defined.
|
||||
*
|
||||
* @param $data
|
||||
* @param $id
|
||||
*/
|
||||
function generic($data,$id)
|
||||
{
|
||||
@@ -102,8 +106,6 @@ class notify
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Send an email notification following an event.
|
||||
*
|
||||
@@ -112,6 +114,7 @@ class notify
|
||||
* @param string $id - identifies event actions
|
||||
* @param string $subject - subject for email
|
||||
* @param string $message - email message body
|
||||
* @param array $media
|
||||
* @return void
|
||||
*
|
||||
* @todo handle 'everyone except' clauses (email address filter done)
|
||||
@@ -128,6 +131,7 @@ class notify
|
||||
// $message = $tp->toEmail($message);
|
||||
$emailFilter = '';
|
||||
$notifyTarget = $this->notify_prefs['event'][$id]['class'];
|
||||
$qry = '';
|
||||
|
||||
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);
|
||||
|
||||
@@ -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
|
||||
{
|
||||
$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 = "";
|
||||
foreach ($data as $key => $value)
|
||||
@@ -321,7 +329,9 @@ class notify
|
||||
$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()
|
||||
|
@@ -96,7 +96,7 @@ class forum_notify extends notify
|
||||
private function getData($type, $id)
|
||||
{
|
||||
if (intval($id) < 1) return false;
|
||||
$qry = '';
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case 'post':
|
||||
|
Reference in New Issue
Block a user