aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-08-29 20:47:49 -0700
committerzotlabs <mike@macgirvin.com>2017-08-29 20:47:49 -0700
commit77267e049a4a6039100e5b2b724ff78ced4a1b74 (patch)
treea0633e27c7d37fd874b0636817f64a2f89fe75eb
parente2b6464f83313bd56c2d9c962e089d978927cdfd (diff)
downloadvolse-hubzilla-77267e049a4a6039100e5b2b724ff78ced4a1b74.tar.gz
volse-hubzilla-77267e049a4a6039100e5b2b724ff78ced4a1b74.tar.bz2
volse-hubzilla-77267e049a4a6039100e5b2b724ff78ced4a1b74.zip
use iso 8601 "Zulu" for log timestamps so it can be easily processed with fail2ban
-rwxr-xr-xboot.php2
-rw-r--r--include/text.php9
2 files changed, 7 insertions, 4 deletions
diff --git a/boot.php b/boot.php
index d9a6cd230..8512bb2b7 100755
--- a/boot.php
+++ b/boot.php
@@ -64,7 +64,7 @@ define ( 'PROJECT_BASE', __DIR__ );
* This can be used in HTML and JavaScript where needed a line break.
*/
define ( 'EOL', '<br>' . "\r\n" );
-define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
+define ( 'ATOM_TIME', 'Y-m-d\\TH:i:s\\Z' ); // aka ISO 8601 "Zulu"
define ( 'TEMPLATE_BUILD_PATH', 'store/[data]/smarty3' );
define ( 'DIRECTORY_MODE_NORMAL', 0x0000); // A directory client
diff --git a/include/text.php b/include/text.php
index 4b34364ce..1919e4b57 100644
--- a/include/text.php
+++ b/include/text.php
@@ -651,7 +651,7 @@ function logger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
$where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': ';
- $s = datetime_convert() . ':' . log_priority_str($priority) . ':' . session_id() . ':' . $where . $msg . PHP_EOL;
+ $s = datetime_convert('UTC','UTC', 'now', ATOM_TIME) . ':' . log_priority_str($priority) . ':' . session_id() . ':' . $where . $msg . PHP_EOL;
$pluginfo = array('filename' => $logfile, 'loglevel' => $level, 'message' => $s,'priority' => $priority, 'logged' => false);
if(! (App::$module == 'setup'))
@@ -679,7 +679,7 @@ function btlogger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
if(file_exists(BTLOGGER_DEBUG_FILE) && is_writable(BTLOGGER_DEBUG_FILE)) {
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
$where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': ';
- $s = datetime_convert() . ':' . log_priority_str($priority) . ':' . session_id() . ':' . $where . $msg . PHP_EOL;
+ $s = datetime_convert('UTC','UTC', 'now', ATOM_TIME) . ':' . log_priority_str($priority) . ':' . session_id() . ':' . $where . $msg . PHP_EOL;
@file_put_contents(BTLOGGER_DEBUG_FILE, $s, FILE_APPEND);
}
@@ -750,7 +750,7 @@ function dlogger($msg, $level = 0) {
$where = basename($stack[0]['file']) . ':' . $stack[0]['line'] . ':' . $stack[1]['function'] . ': ';
- @file_put_contents($logfile, datetime_convert() . ':' . session_id() . ' ' . $where . $msg . PHP_EOL, FILE_APPEND);
+ @file_put_contents($logfile, datetime_convert('UTC','UTC', 'now', ATOM_TIME) . ':' . session_id() . ' ' . $where . $msg . PHP_EOL, FILE_APPEND);
}
@@ -2966,6 +2966,9 @@ function flatten_array_recursive($arr) {
* @param string $s Text to highlight
* @param string $lang Which language should be highlighted
* @return string
+ * Important: The returned text has the text pattern 'http' translated to '%eY9-!' which should be converted back
+ * after further processing. This was done to prevent oembed links from occurring inside code blocks.
+ * See include/bbcode.php
*/
function text_highlight($s, $lang) {