2 /*=====================================================================*\
3 || ###################################################################
4 || # Blue Static ISSO Framework [#]issoversion[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
23 * Blue Static ISSO Framework Kernel
29 if (!function_exists('stripos'))
31 trigger_error('You need PHP version 5.0.0 or newer to run ISSO', E_USER_ERROR
);
35 // when we are PHP5-nat instead of PHP5-compat, we can remove this
36 if (version_compare(PHP_VERSION
, '5.0.0', '>='))
38 if (ini_get('error_reporting') & E_NOTICE
)
40 error_reporting(ini_get('error_reporting') - E_NOTICE
);
42 if (ini_get('error_reporting') & E_USER_NOTICE
)
44 error_reporting(ini_get('error_reporting') - E_USER_NOTICE
);
48 if ((bool
)ini_get('register_globals') === true
)
50 $superglobals = array('_GET', '_COOKIE', '_FILES', '_POST', '_SERVER', '_ENV');
51 foreach ($superglobals AS $global)
53 if (is_array($
{$global}))
55 foreach ($
{$global} AS $_key => $_val)
66 $oldlevel = ini_get('error_reporting');
67 $newlevel = $oldlevel;
68 $levels = array(E_ERROR
=> E_USER_ERROR
, E_WARNING
=> E_USER_WARNING
, E_NOTICE
=> E_USER_NOTICE
);
69 foreach ($levels AS $php => $isso)
73 if (!($oldlevel & $isso))
80 if ($oldlevel & $isso)
86 error_reporting($newlevel);
89 * Input cleaning type constant
94 define('TYPE_INT', 1);
99 define('TYPE_UINT', 2);
104 define('TYPE_FLOAT', 4);
109 define('TYPE_BOOL', 8);
114 define('TYPE_STR', 16);
117 * String - deliberate unclean
119 define('TYPE_STRUN', 32);
122 * No cleaning - here for use in API
124 define('TYPE_NONE', 64);
127 * Macro for using DB->escape_binary() without cleaning - used in API
129 define('TYPE_BIN', 128);
135 define('REQ_YES', 1);
143 * Blue Static ISSO Framework (ISSO)
145 * This framework allows a common backend to be used amongst all Blue
146 * Static applications and is built to be abstract and flexible.
147 * The base framework handles all loading and module management.
150 * ISSO_NO_INPUT_SANITIZE - Disables the automatic input sanitizer
151 * ISSO_CHECK_POST_REFERER - Will check to make sure that on POSTed
152 * data, the referer matches the host
153 * ISSO_MT_START - Define the microtime() value at the top of your
154 * script and this will calculate the total execution
156 * SVN - Place SVN keywords (like $Id) to display the information on output
158 * @author Blue Static
159 * @copyright Copyright ©2002 - [#]year[#], Blue Static
160 * @version $Revision$
170 private $version = '[#]issoversion[#]';
173 * Location of ISSO, used for internal linking
176 private $sourcepath = '';
179 * Path of the current application
182 private $apppath = '';
185 * Web path used to get the web location of the installation of ISSO; only used for Printer module
188 private $webpath = '';
191 * Name of the current application
194 private $application = '';
197 * Version of the current application
200 private $appversion = '';
203 * Whether debug mode is on or off
206 private $debug = false
;
209 * List of all active debug messages
212 private $debuginfo = array();
215 * List of loaded modules
218 private $modules = array();
221 * An array of sanitized variables that have been cleaned for HTML tag openers and double quotes
224 public $in = array();
227 * If we are running with magic_quotes_gpc on or off
230 private $magicquotes = 0;
233 * Array of user-specified fields that are required for ISSO initialization
234 * fieldname => array(REQUIRED, CALLBACK PARSER, SET)
237 private $fields = array(
238 'sourcepath' => array(REQ_YES
, 'fetch_sourcepath', false
),
239 'apppath' => array(REQ_YES
, 'fetch_sourcepath', false
),
240 'webpath' => array(REQ_NO
, 'fetch_sourcepath', false
),
241 'application' => array(REQ_YES
, null
, false
),
242 'appversion' => array(REQ_NO
, null
, false
),
243 'debug' => array(REQ_NO
, null
, false
)
246 // ###################################################################
250 public function __construct()
252 $GLOBALS['isso:callback'] = null
;
255 set_error_handler(array(&$this, '_error_handler'));
258 $this->magicquotes
= get_magic_quotes_gpc();
259 set_magic_quotes_runtime(0);
261 // some debug info that's always useful
262 $this->debug('magic_quotes_gpc = ' . $this->magicquotes
);
263 $this->debug('register_globals = ' . ini_get('register_globals'));
265 // attempt to set the sourcepath
266 $path = call_user_func('debug_backtrace');
267 $this->set('sourcepath', str_replace('kernel.php', '', $path[0]['file']));
269 // start input sanitize using variable_order GPC
270 if (!defined('ISSO_NO_INPUT_SANITIZE'))
272 $this->exec_sanitize_data();
275 if (defined('ISSO_CHECK_POST_REFERER'))
277 $this->exec_referer_check();
281 // ###################################################################
283 * Sets a specified field in the ISSO. This is used to set all the
284 * required fields that ISSO uses for linking. It replaces the old
285 * method of setting the instance variables directly.
287 * @param string Field name
288 * @param mixed Value of the field
290 public function set($fieldname, $value)
292 $this->do_set($fieldname, $value, null
);
295 // ###################################################################
297 * Does the actual setting of the field. set() is defined in each
298 * module, but this controls the actual data. This is done so that
299 * there isn't an extra parameter in set() that controls module spaces
301 * @param string Field name
303 * @param string Module name (as referred to in ISSO->modules[]) to place in
305 protected function do_set($fieldname, $value, $module)
309 $field =& $this->fields
["$fieldname"];
313 $field =& $this->modules
["$module"]->fields
["$fieldname"];
316 if (is_array($field))
318 if ($field[1] != null
)
320 if (preg_match('#^\$(.*)#', $field[1]))
322 $caller = preg_replace('#^\$(.*)->([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$#', 'array(&$\1, "\2")', $field[1]);
323 eval('$caller = ' . $caller . ';');
327 $caller = array(&$this, $field[1]);
330 $value = call_user_func($caller, $value);
335 $this->$fieldname = $value;
339 $this->modules
["$module"]->$fieldname = $value;
346 trigger_error('Invalid field `' . $module . '.' . $fieldname . '` specified in ISSO->do_set()', E_USER_ERROR
);
350 // ###################################################################
352 * Fetches the value of a field. This is protected because get() should
353 * be defined in each module to make a call to this function.
355 * @param string Field name
356 * @param string Module name (as referred to in ISSO->modules[]) to fetch from
358 protected function do_get($fieldname, $module)
362 $field =& $this->fields
["$fieldname"];
366 $field =& $this->modules
["$module"]->fields
["$fieldname"];
369 if (is_array($field))
371 if ($field[2] == false
)
373 trigger_error('Field ' . $module . ':: ' . $filedname . ' is not set and therefore cannot be get()', E_USER_ERROR
);
378 return $this->$fieldname;
382 return $this->modules
["$module"]->$fieldname;
389 trigger_error('Invalid field `' . $module . '.' . $fieldname . '` specified in ISSO->do_get()', E_USER_ERROR
);
393 // ###################################################################
395 * Returns the value of an ISSO field. You should not access any instance
396 * variables directly, use this instead.
398 * @param string Field name
400 * @return mixed Value of the field
402 public function get($fieldname)
404 return $this->do_get($fieldname, null
);
407 // ###################################################################
409 * Makes sure that all of the required fields in ISSO are set before
410 * any action is done. This will throw an error block describing
411 * the fields that need to be set if any are missing.
413 * @param string Module to check for; null is kernel, string is a module name, false is all
414 * @param bool Is this a non-error environment that should display all fields?
416 public function check_isso_fields($module = null
, $called = false
)
420 if ($module === false
)
422 $modules = $this->show_modules(true
);
424 else if ($module === null
)
426 $modules = array(get_class($this));
430 $modules = array($module);
433 foreach ($modules AS $module)
435 if (empty($this->modules
["$module"]->fields
))
440 foreach ($this->modules
["$module"]->fields
AS $name => $field)
442 if ($field[0] == REQ_YES
AND $field[2] == false
AND $called == false
)
444 $missing[] = $module . ':: ' . $name;
446 else if ($called == true
AND $field[2] == false
)
448 $missing[] = $module . ':: ' . $name . ($field[0] == REQ_YES ?
' <strong>(REQUIRED)</strong>' : '');
453 if (sizeof($missing) > 0)
455 $error = ($called ?
'The following fields are not set:' : 'You are missing required ISSO fields. Please make sure you have set:');
459 foreach ($missing AS $field)
461 $error .= "\n\t" . '<li>' . $field . '</li>';
464 $error .= "\n" . '</ul>';
466 $this->message(($called ?
'' : 'Missing ') . 'Fields', $error, ($called ?
1 : 3));
468 if ($called == false
)
475 // ###################################################################
477 * Prepares a path for being set as the sourcepath
479 * @param string Source path or URL
481 * @return string Prepared source path
483 public function fetch_sourcepath($source)
485 if (substr($source, strlen($source) - 1) != DIRECTORY_SEPARATOR
)
487 $source .= DIRECTORY_SEPARATOR
;
492 // ###################################################################
494 * Loads a framework module
496 * @param string Name of the framework file to load
497 * @param string Internal variable to initialize as; to not instantiate (just require) leave it as NULL
498 * @param bool Globalize the internal variable?
500 * @return object Instantiated instance
502 public function &load($framework, $asobject, $globalize = false
)
504 $this->check_isso_fields(null
);
506 // set the object interlock
507 if (!method_exists($GLOBALS['isso:callback'], 'load'))
509 $GLOBALS['isso:callback'] =& $this;
510 $this->modules
['isso'] =& $this;
513 if ($this->is_loaded($framework))
515 return $this->modules
["$framework"];
518 if ($this->sourcepath
== '')
520 trigger_error('Invalid sourcepath specified', E_USER_ERROR
);
523 if (file_exists($this->sourcepath
. $framework . '.php'))
525 require_once($this->sourcepath
. $framework . '.php');
529 trigger_error('Could not find the framework ' . $this->sourcepath
. $framework . '.php', E_USER_ERROR
);
532 if ($asobject === null
)
537 if (isset($this->$asobject))
539 trigger_error('Cannot instantiate framework `' . $framework . '` into `' . $asobject . '`', E_USER_ERROR
);
542 $this->$asobject = new $framework($this);
544 $this->modules
["$framework"] =& $this->$asobject;
548 $GLOBALS["$asobject"] =& $this->$asobject;
551 // allow for init_as_package to link
552 if (method_exists($this->modules
["$framework"], 'init_as_package'))
554 $this->modules
[ $this->modules
["$framework"]->init_as_package() ] =& $this->modules
["$framework"];
557 return $this->$asobject;
560 // ###################################################################
562 * Prints a list of all currently loaded framework modules
564 * @param bool Return the data as an array?
566 * @return mixed HTML output or an array of loaded modules
568 public function show_modules($return = false
)
571 foreach ($this->modules
AS $object)
573 $module = get_class($object);
574 if (method_exists($object, 'init_as_package') AND in_array($module, $modules))
576 $module = $object->init_as_package() . " - ($module)";
579 $modules[] = $module;
588 $output = "\n\n<ul>\n\t<li>";
589 $output .= implode("</li>\n\t<li>", $modules);
590 $output .= "</li>\n</ul>\n\n";
591 $this->message('Loaded Modules', $output, 1);
595 // ###################################################################
597 * Verifies to see if a framework has been loaded
599 * @param string Framework name
601 * @return bool Whether or not the framework has been loaded
603 public function is_loaded($framework)
605 if (isset($this->modules
["$framework"]))
615 // ###################################################################
617 * Prints an ISSO message
619 * @param string The title of the message
620 * @param string The content of the message
621 * @param integer Type of message to be printed
622 * @param bool Return the output?
623 * @param bool Show the debug stack?
624 * @param integer Message width
626 * @return mixed Output or null
628 public function message($title, $message, $type, $return = false
, $stack = true
, $width = 500)
653 $backtrace = debug_backtrace();
654 array_shift($backtrace);
656 if (isset($backtrace[0]) AND $backtrace[0]['function'] == '_error_handler')
658 array_shift($backtrace);
661 $trace = $this->format_debug_trace($backtrace);
663 $output = "\n<br />\n<table cellpadding=\"4\" cellspacing=\"1\" border=\"0\" width=\"$width\" style=\"background-color: $color; color: black; font-family: Verdana, sans-serif; font-size: 12px;\">";
664 $output .= "\n<tr style=\"color: $font; text-align: left\">\n\t<td><strong>$prefix: $title</strong></td>\n</tr>";
665 $output .= "\n<tr style=\"background-color: #FFFFFF; text-align: left\">\n\t<td>$message</td>\n</tr>";
666 $output .= (($stack AND $GLOBALS['isso:callback']->debug
) ?
"\n<tr style=\"background-color: #FFFFFF; text-align: left\">\n\t<td><strong>Debug Stack:</strong> <pre>" . implode("\n", $trace) . "</pre></td>\n</tr>" : '');
667 $output .= "\n</table>\n<br />\n";
679 // ###################################################################
681 * Prepares a debug_backtrace() array for output to the browser by
682 * compressing the array into visible text
684 * @param array debug_backtrace() array
686 * @return array Formatted trace output
688 public function format_debug_trace($backtrace)
691 foreach ($backtrace AS $i => $step)
694 $file = $step['file'] . ':' . $step['line'];
695 $funct = (isset($step['class']) ?
$step['class'] . '::' . $step['function'] : $step['function']);
697 if (isset($step['args']) AND is_array($step['args']))
699 // we need to do this so we don't get "Array to string conversion" notices
700 foreach ($step['args'] AS $id => $arg)
704 $step['args']["$id"] = 'Array';
707 $args = implode(', ', $step['args']);
710 $trace[] = "#$i $funct($args) called at [$file]";
716 // ###################################################################
718 * Custom error handler for ISSO; only handle E_WARNING, E_NOTICE,
719 * E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE
721 * @param integer Error number
722 * @param string Error message string
723 * @param string File that contains the error
724 * @param string The line number of the error
725 * @param string The active symbol table at which point the error occurred
727 public function _error_handler($errno, $errstr, $errfile, $errline, $errcontext)
729 $level = ini_get('error_reporting');
737 if (!($level & E_USER_ERROR
))
748 if (! (($level & E_USER_WARNING
) AND ($level & E_WARNING
)) )
760 if (! (($level & E_USER_NOTICE
) AND ($level & E_NOTICE
)) )
767 $errstr .= " in <strong>$errfile</strong> on line <strong>$errline</strong>";
769 $errstr = str_replace(array(getcwd(), dirname(getcwd())), '', $errstr);
771 $this->message($title, $errstr, $mode);
773 if ($errno == E_USER_ERROR
)
779 // ###################################################################
781 * Creates a table that explains the error reporting levels and their
784 public function explain_error_reporting()
787 'E_ERROR' => E_ERROR
,
788 'E_WARNING' => E_WARNING
,
789 'E_PARSE' => E_PARSE
,
790 'E_NOTICE' => E_NOTICE
,
791 'E_CORE_ERROR' => E_CORE_ERROR
,
792 'E_CORE_WARNING' => E_CORE_WARNING
,
793 'E_COMPILE_ERROR' => E_COMPILE_ERROR
,
794 'E_COMPILE_WARNING' => E_COMPILE_WARNING
,
795 'E_USER_ERROR' => E_USER_ERROR
,
796 'E_USER_WARNING' => E_USER_WARNING
,
797 'E_USER_NOTICE' => E_USER_NOTICE
,
799 'E_STRICT' => E_STRICT
802 $table = '<table cellspacing="0" cellpadding="2" border="0">';
804 foreach ($levels AS $name => $value)
808 <td>' . $name . '</td>
809 <td>' . (ini_get('error_reporting') & $value) . '</td>
816 $this->message('Error Reporting', $table, 1);
819 // ###################################################################
821 * Logs a debug message for verbose output
823 * @param string Message
825 public function debug($message)
827 $this->debuginfo
[] = $message;
830 // ###################################################################
832 * Recursive XSS cleaner
834 * @param mixed Unsanitized REQUEST data
836 * @return mixed Sanitized data
838 public function _sanitize_input_recursive($data)
840 foreach ($data AS $key => $value)
842 if (is_array($value))
844 $data["$key"] = $this->_sanitize_input_recursive($value);
848 if ($this->magicquotes
)
850 $value = str_replace("\'", "'", $value);
852 $data["$key"] = $this->sanitize($value);
858 // ###################################################################
860 * Simple way to protect against HTML attacks with Unicode support
862 * @param string Unsanitzed text
864 * @return string Properly protected text that only encodes potential threats
866 public function sanitize($text)
868 if ($this->magicquotes
)
870 return str_replace(array('<', '>', '\"', '"'), array('<', '>', '"', '"'), $text);
874 return str_replace(array('<', '>', '"'), array('<', '>', '"'), $text);
878 // ###################################################################
880 * Unicode-safe entity encoding system; similar to sanitize()
882 * @param string Unsanitized text
884 * @return string Unicode-safe sanitized text with entities preserved
886 public function entity_encode($text)
888 $text = str_replace('&', '&', $text);
889 $text = $this->sanitize($text);
893 // ###################################################################
895 * Takes text that has been processed for HTML and unsanitizes it
897 * @param string Text that needs to be turned back into HTML
899 * @return string Unsanitized text
901 public function unsanitize($text)
903 return str_replace(array('<', '>', '"'), array('<', '>', '"'), $text);
906 // ###################################################################
908 * Smart addslashes() that only applies itself it the Magic Quotes GPC
909 * is off. This should only be run on database query values that come
910 * from ISSO->in[] input; data that needs sanitization should be run
911 * through ISSO->DB->escape_string()
913 * @param string Some string
914 * @param bool Force magic quotes to be off
916 * @return string String that has slashes added
918 public function escape($str, $force = true
)
920 if ($this->magicquotes
AND !$force)
922 if (isset($this->modules
[ISSO_DB_LAYER
]))
924 return $this->modules
[ISSO_DB_LAYER
]->escape_string(str_replace(array("\'", '\"'), array("'", '"'), $str));
930 if (isset($this->modules
[ISSO_DB_LAYER
]))
932 return $this->modules
[ISSO_DB_LAYER
]->escape_string($str);
934 return addslashes($str);
938 // ###################################################################
940 * Runs through all of the input data and sanitizes it.
942 private function exec_sanitize_data()
944 $this->in
= $this->_sanitize_input_recursive(array_merge($_GET, $_POST, $_COOKIE));
947 // ###################################################################
949 * Sanitize function for something other than a string (which
950 * everything is sanitized for if you use exec_sanitize_data(). Cleaned
951 * data is placed back into $isso->in; this makes it so you don't have
952 * to constantly intval() [etc.] data.
954 * @param array Array of elements to clean as varname => type
956 public function input_clean_array($vars)
958 foreach ($vars AS $varname => $type)
960 $this->input_clean($varname, $type);
964 // ###################################################################
966 * Sanitize function that does a single variable as oppoesd to an array
967 * (see input_clean_array() for more details)
969 * @param string Variable name in $isso->in[]
970 * @param integer Sanitization type constant
972 public function input_clean($varname, $type)
974 if (isset($this->in
["$varname"]))
976 $this->in
["$varname"] = $this->clean($this->in
["$varname"], $type);
980 $this->in
["$varname"] = $this->clean(null
, $type);
983 return $this->in
["$varname"];
986 // ###################################################################
988 * Runs ISSO->escape() on a variable on ISSO->in[]. This is just a
989 * short-hand wrapper so that queries can be shortened. When this is used,
990 * the actual value in ISSO->in[] is not changed, only the return value
993 * @param string Input variable
995 * @return string Escaped input
997 public function input_escape($varname)
999 if (isset($this->in
["$varname"]))
1001 return $this->escape($this->in
["$varname"]);
1005 return $this->escape(null
);
1009 // ###################################################################
1011 * Cleaning function that does the work for input_clean(); this is
1012 * moved here so it can be used to clean things that aren't in
1016 * @param integer Sanitization type constant
1018 * @return mixed Cleaned data
1020 public function clean($value, $type)
1022 if (is_array($value))
1024 return $this->clean_array($value, $type);
1027 if ($type == TYPE_INT
)
1029 $value = intval($value);
1031 else if ($type == TYPE_UINT
)
1033 $value = (($val = intval($value)) < 0 ?
0 : $val);
1035 else if ($type == TYPE_FLOAT
)
1037 $value = floatval($value);
1039 else if ($type == TYPE_BOOL
)
1041 $value = (bool
)$value;
1043 else if ($type == TYPE_STR
)
1047 else if ($type == TYPE_STRUN
)
1049 $value = $this->unsanitize($value);
1051 else if ($type == TYPE_NOCLEAN
)
1053 if ($this->magicquotes
)
1055 $value = str_replace(array('\"', "\'"), array('"', "'"), $value);
1062 else if ($type == TYPE_BIN
)
1068 trigger_error('Invalid clean type `' . $type . '` specified', E_USER_ERROR
);
1074 // ###################################################################
1076 * Recursion function for ISSO->clean()
1078 * @param array Uncleaned array
1079 * @param integer Sanitization type constant
1081 * @return array Cleaned array of data
1083 private function clean_array($array, $type)
1085 foreach ($array AS $key => $value)
1087 $array["$key"] = $this->clean($value, $type);
1093 // ###################################################################
1095 * Checks to see if a POST refer is actually from us
1097 public function exec_referer_check()
1099 if ($_SERVER['REQUEST_METHOD'] == 'POST')
1101 $host = ($_SERVER['HTTP_HOST']) ?
$_SERVER['HTTP_HOST'] : $_ENV['HTTP_HOST'];
1103 if ($host AND $_SERVER['HTTP_REFERER'])
1105 $parts = parse_url($_SERVER['HTTP_REFERER']);
1106 $ourhost = $parts['host'] . (isset($parts['port']) ?
":$parts[port]" : '');
1108 if ($ourhost != $host)
1110 trigger_error('No external hosts are allowed to POST to this application', E_USER_ERROR
);
1112 $this->debug('remote post check = ok');
1116 $this->debug('remote post check = FAILED');
1121 // ###################################################################
1123 * Constructs a debug information box that contains various debugging
1124 * information points
1126 * @param bool Show template information?
1128 * @return string Debugging block
1130 public function construct_debug_block($dotemplates)
1143 foreach ($this->modules
['template']->usage
AS $name => $count)
1145 if (in_array($name, $this->modules
['template']->uncached
))
1147 $optlist[] = $name . '[' . $count . ']';
1149 $usage[] = $name . " ($count)";
1152 $sizeof = sizeof($this->modules
['template']->uncached
);
1155 $debug .= "\n\t<li><strong style=\"color: red\">Uncached Template(s):</strong> $sizeof ( " . implode(' ', $optlist) . " )</li>";
1160 $scinfo = 'Not Under Source Control';
1163 $scinfo = constant('SVN');
1165 if (preg_match('#\$Id:?\s*\$#', $scinfo))
1167 $scinfo = 'Not Under Source Control';
1171 $scinfo = preg_replace('#\$' . '(Head)?URL: (.+?) \$#e', "end(explode('/', '\\2'))", $scinfo);
1172 $scinfo = preg_replace('#\$' . '(LastModified)?Revision: (.+?) \$#', 'SVN \\2', $scinfo);
1173 $scinfo = preg_replace('#\$' . 'Id: (.+?) ([0-9].+?) [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.+?) (.+?) \$#', '\\1 - SVN \\2', $scinfo);
1177 $scinfo = trim($scinfo);
1178 $debug .= "\n\t<li><strong>Source Control:</strong> $scinfo</li>";
1180 // query information
1181 if (is_object($this->modules
[ISSO_DB_LAYER
]))
1183 $debug .= "\n\t<li><strong>Total Queries:</strong> " . sizeof($this->modules
[ISSO_DB_LAYER
]->history
) . " (<a href=\"" . $this->sanitize($_SERVER['REQUEST_URI']) . ((strpos($_SERVER['REQUEST_URI'], '?') !== false
) ?
'&query=1' : '?query=1') . "\">?</a>)</li>";
1186 // total execution time
1187 if (defined('ISSO_MT_START'))
1189 $this->load('functions', 'functions');
1190 $debug .= "\n\t<li><strong>Total Execution Time:</strong> " . round($this->modules
['functions']->fetch_microtime_diff(ISSO_MT_START
), 10) . "</li>";
1194 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Debug Notices (" . sizeof($this->debuginfo
) . ")</option>";
1195 foreach ((array)$this->debuginfo
AS $msg)
1197 $debug .= "\n\t\t\t<option>--- $msg</option>";
1199 $debug .= "\n\t\t</select>\n\t</li>";
1202 $modules = $this->show_modules(true
);
1203 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Loaded Modules (" . sizeof($modules) . ")</option>";
1204 foreach ($modules AS $mod)
1206 $debug .= "\n\t\t\t<option>--- $mod</option>";
1208 $debug .= "\n\t\t</select>\n\t</li>";
1213 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Template Usage (" . array_sum($this->modules
['template']->usage
) . ")</option>";
1214 foreach ($usage AS $tpl)
1216 $debug .= "\n\t\t\t<option>--- $tpl</option>";
1218 $debug .= "\n\t\t</select>\n\t</li>";
1221 $debug .= "\n</ul>";
1223 $debug = "\n\n<!-- dev debug -->\n<div align=\"center\">\n\n<hr />\n" . $this->message('Debug Information', $debug, 1, true
, false
) . "\n</div>\n<!-- / dev debug -->\n\n";
1230 /*=====================================================================*\
1231 || ###################################################################
1234 || ###################################################################
1235 \*=====================================================================*/