Example #1
0
function debug($vr)
{
    global $config;
    echo $vr;
    if ($_GET["ajax"] || !$config["debug"]) {
        return;
    }
    if (class_exists("Debug_HackerConsole_Main")) {
        Debug_HackerConsole_Main::out($vr);
    }
}
Example #2
0
 /**
  *  We need manual custom print_r() to use it in OB handlers
  * (original print_r() cannot work inside OB handler).
  */
 function print_r($obj, $no_print = 0, $level = 0)
 {
     if ($level < 10) {
         if (is_array($obj)) {
             $type = "Array[" . count($obj) . "]";
         } elseif (is_object($obj)) {
             $type = "Object";
         } elseif (gettype($obj) == "boolean") {
             $type = $obj ? "TRUE" : "FALSE";
         } elseif ($obj === null) {
             $type = "NULL";
         } else {
             $type = preg_replace("/\r?\n/", "\\n", $obj);
         }
         $buf = $type;
         if (is_array($obj) || is_object($obj)) {
             $leftSp = str_repeat("    ", $level + 1);
             for (reset($obj); list($k, $v) = each($obj);) {
                 if ($k === "GLOBALS") {
                     continue;
                 }
                 $buf .= "\n{$leftSp}[{$k}] => " . Debug_HackerConsole_Main::print_r($v, $no_print, $level + 1);
             }
         }
     } else {
         $buf = "*RECURSION*";
     }
     $buf = str_replace("", " ", $buf);
     // PHP5 private methods contain \x00 in names
     if ($no_print) {
         return $buf;
     } else {
         echo $buf;
     }
     return null;
 }