2012-12-26 14:02:27 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2013-10-13 00:52:44 +02:00
|
|
|
* Write a log entry.
|
|
|
|
* This should be used to log user's activity.
|
|
|
|
*
|
|
|
|
* @param
|
|
|
|
* $message
|
2012-12-26 14:02:27 +01:00
|
|
|
*/
|
2017-01-02 03:57:23 +01:00
|
|
|
function engelsystem_log($message)
|
|
|
|
{
|
|
|
|
global $user;
|
2014-12-26 19:26:53 +01:00
|
|
|
|
2017-01-02 03:57:23 +01:00
|
|
|
$nick = "Guest";
|
|
|
|
if (isset($user)) {
|
|
|
|
$nick = User_Nick_render($user);
|
|
|
|
}
|
|
|
|
LogEntry_create($nick, $message);
|
2012-12-26 14:02:27 +01:00
|
|
|
}
|
|
|
|
|
2013-10-13 00:52:44 +02:00
|
|
|
/**
|
|
|
|
* Generates a PHP Stacktrace.
|
|
|
|
*/
|
2017-01-02 03:57:23 +01:00
|
|
|
function debug_string_backtrace()
|
|
|
|
{
|
|
|
|
ob_start();
|
|
|
|
debug_print_backtrace();
|
|
|
|
$trace = ob_get_contents();
|
|
|
|
ob_end_clean();
|
2014-12-26 19:26:53 +01:00
|
|
|
|
2013-10-13 00:52:44 +02:00
|
|
|
// Remove first item from backtrace as it's this function which
|
|
|
|
// is redundant.
|
|
|
|
$trace = preg_replace('/^#0\s+' . __FUNCTION__ . "[^\n]*\n/", '', $trace, 1);
|
2014-12-26 19:26:53 +01:00
|
|
|
|
2013-10-13 00:52:44 +02:00
|
|
|
// Renumber backtrace items.
|
2016-03-22 14:41:32 +01:00
|
|
|
// $trace = preg_replace('/^#(\d+)/me', '\'#\' . ($1 - 1)', $trace);
|
2014-12-26 19:26:53 +01:00
|
|
|
|
2013-10-13 00:52:44 +02:00
|
|
|
return $trace;
|
|
|
|
}
|