/** * Generate debug output for players who have the SU_DEBUG_OUTPUT flag set in the superuser mask * * @param string $text The string to output * @param bool $force If true, force debug output even for non SU/non flagged */ function debug($text, $force = false) { global $session, $block_new_output; $temp = $block_new_output; set_block_new_output(false); if ($force || $session['user']['superuser'] & SU_DEBUG_OUTPUT) { $trace = debug_backtrace(); if (is_array($text)) { require_once "lib/dump_item.php"; $text = appoencode(dump_item($text), true); } $file1 = $trace[0]['file']; $line1 = $trace[0]['line']; $file2 = $trace[1]['file']; $line2 = $trace[1]['line']; rawoutput("<div class='debug'>{$file1}, line {$line1}, from {$file2}, line {$line2}<br />{$text}</div>"); } set_block_new_output($temp); }
/** * Generate debug output for players who have the SU_DEBUG_OUTPUT flag set in the superuser mask * * @param string $text The string to output * @param bool $force If true, force debug output even for non SU/non flagged */ function debug($text, $force = false) { global $session, $block_new_output; $temp = $block_new_output; set_block_new_output(false); if ($force || $session['user']['superuser'] & SU_DEBUG_OUTPUT) { if (is_array($text)) { require_once "lib/dump_item.php"; $text = appoencode(dump_item($text), true); } rawoutput("<div class='debug'>{$text}</div>"); } set_block_new_output($temp); }