You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write a log entry.
|
|
|
|
* This should be used to log user's activity.
|
|
|
|
*
|
|
|
|
* @param string $message
|
|
|
|
*/
|
|
|
|
function engelsystem_log($message)
|
|
|
|
{
|
|
|
|
global $user;
|
|
|
|
|
|
|
|
$nick = "Guest";
|
|
|
|
if (isset($user)) {
|
|
|
|
$nick = User_Nick_render($user);
|
|
|
|
}
|
|
|
|
LogEntry_create($nick, $message);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generates a PHP Stacktrace.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function debug_string_backtrace()
|
|
|
|
{
|
|
|
|
ob_start();
|
|
|
|
debug_print_backtrace();
|
|
|
|
$trace = ob_get_contents();
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
// Remove first item from backtrace as it's this function which
|
|
|
|
// is redundant.
|
|
|
|
$trace = preg_replace('/^#0\s+' . __FUNCTION__ . "[^\n]*\n/", '', $trace, 1);
|
|
|
|
|
|
|
|
// Renumber backtrace items.
|
|
|
|
// $trace = preg_replace('/^#(\d+)/me', '\'#\' . ($1 - 1)', $trace);
|
|
|
|
|
|
|
|
return $trace;
|
|
|
|
}
|