- Timestamp:
- Aug 8, 2020 10:13:07 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/App.inc.php
r726 r732 980 980 $event_short['url'] = truncate($event_short['url'], 120); 981 981 982 // Restore original locale. 983 setlocale(LC_TIME, $locale); 982 // Email info. 983 $hostname = ('' != $this->getParam('site_hostname')) ? $this->getParam('site_hostname') : php_uname('n'); 984 $headers = sprintf("From: %s\nX-File: %s\nX-Line: %s", $this->getParam('site_email'), $file, $line); 984 985 985 986 // FILE ACTION … … 990 991 991 992 // EMAIL ACTION 992 if (false !== $this->getParam('log_email_priority') && $priority <= $this->getParam('log_email_priority') && $send_notifications) { 993 $hostname = ('' != $this->getParam('site_hostname')) ? $this->getParam('site_hostname') : php_uname('n'); 993 if (false !== $this->getParam('log_email_priority') && $priority <= $this->getParam('log_email_priority') && '' != $this->getParam('log_to_email_address') && $send_notifications) { 994 994 $subject = sprintf('[%s %s] %s', $hostname, $event['type'], mb_substr($event['message'], 0, 64)); 995 995 $email_msg = sprintf("A log event of type '%s' occurred on %s\n\n", $event['type'], $hostname); 996 $headers = 'From: ' . $this->getParam('site_email');997 996 foreach ($event as $k=>$v) { 998 997 $email_msg .= sprintf("%-16s %s\n", $k, $v); … … 1004 1003 1005 1004 // SMS ACTION 1006 if (false !== $this->getParam('log_sms_priority') && $priority <= $this->getParam('log_sms_priority') && $send_notifications) { 1007 $hostname = ('' != $this->getParam('site_hostname')) ? $this->getParam('site_hostname') : php_uname('n'); 1008 $subject = sprintf('[%s %s]', $hostname, $priority); 1005 if (false !== $this->getParam('log_sms_priority') && $priority <= $this->getParam('log_sms_priority') && '' != $this->getParam('log_to_sms_address') && $send_notifications) { 1006 $subject = sprintf('[%s %s]', $hostname, $this->logPriorityToString($priority)); 1009 1007 $sms_msg = sprintf('%s [%s:%s]', mb_substr($event_short['message'], 0, 64), basename($file), $line); 1010 $headers = 'From: ' . $this->getParam('site_email');1011 1008 mb_send_mail($this->getParam('log_to_sms_address'), $subject, $sms_msg, $headers); 1012 1009 } … … 1016 1013 file_put_contents('php://stderr', "[{$event['type']}] [{$event['message']}]\n", FILE_APPEND); 1017 1014 } 1015 1016 // Restore original locale. 1017 setlocale(LC_TIME, $locale); 1018 1018 1019 1019 return true;
Note: See TracChangeset
for help on using the changeset viewer.