2 /*=====================================================================*\
3 || ###################################################################
4 || # Iris Studios Shared Object Framework [#]issoversion[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
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 * Iris Studios Shared Object Framework Kernel
29 if (!function_exists('version_compare'))
31 trigger_error('You need PHP version 4.1.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_NOCLEAN', 64);
130 define('REQ_YES', 1);
138 * Iris Studios Shared Object Framework (ISSO)
140 * This framework allows a common backend to be used amongst all Iris
141 * Studios applications and is built to be abstract and flexible.
142 * The base framework handles all loading and module management.
145 * ISSO_NO_INPUT_SANITIZE - Disables the automatic input sanitizer
146 * ISSO_CHECK_POST_REFERER - Will check to make sure that on POSTed
147 * data, the referer matches the host
148 * ISSO_MT_START - Define the microtime() value at the top of your
149 * script and this will calculate the total execution
151 * SVN - Place SVN keywords (like $Id) to display the information on output
153 * @author Iris Studios, Inc.
154 * @copyright Copyright ©2002 - [#]year[#], Iris Studios, Inc.
155 * @version $Revision$
166 var $version = '[#]issoversion[#]';
169 * Location of ISSO, used for internal linking
173 var $sourcepath = '';
176 * Path of the current application
183 * Web path used to get the web location of the installation of ISSO; only used for Printer module
190 * Name of the current application
194 var $application = '';
197 * Version of the current application
201 var $appversion = '';
204 * Whether debug mode is on or off
211 * List of all active debug messages
215 var $debuginfo = array();
218 * List of loaded modules
222 var $modules = array();
225 * An array of sanitized variables that have been cleaned for HTML tag openers and double quotes
232 * If we are running with magic_quotes_gpc on or off
236 var $magicquotes = 0;
239 * Array of user-specified fields that are required for ISSO initialization
240 * fieldname => array(REQUIRED, CALLBACK PARSER, SET)
245 'sourcepath' => array(REQ_YES
, 'fetch_sourcepath', false
),
246 'apppath' => array(REQ_YES
, 'fetch_sourcepath', false
),
247 'webpath' => array(REQ_NO
, 'fetch_sourcepath', false
),
248 'application' => array(REQ_YES
, null
, false
),
249 'appversion' => array(REQ_NO
, null
, false
),
250 'debug' => array(REQ_NO
, null
, false
)
253 // ###################################################################
257 function __construct()
259 $GLOBALS['isso:callback'] = null
;
262 set_error_handler(array(&$this, '_error_handler'));
265 $this->magicquotes
= get_magic_quotes_gpc();
266 set_magic_quotes_runtime(0);
268 // some debug info that's always useful
269 $this->debug('magic_quotes_gpc = ' . $this->magicquotes
);
270 $this->debug('register_globals = ' . ini_get('register_globals'));
272 // attempt to set the sourcepath
273 $path = call_user_func('debug_backtrace');
274 $this->set('sourcepath', str_replace('kernel.php', '', $path[0]['file']));
276 // start input sanitize using variable_order GPC
277 if (!defined('ISSO_NO_INPUT_SANITIZE'))
279 $this->exec_sanitize_data();
282 if (defined('ISSO_CHECK_POST_REFERER'))
284 $this->exec_referer_check();
288 // ###################################################################
290 * (PHP 4) Constructor
294 $this->__construct();
297 // ###################################################################
299 * Sets a specified field in the ISSO. This is used to set all the
300 * required fields that ISSO uses for linking. It replaces the old
301 * method of setting the instance variables directly.
305 * @param string Field name
306 * @param mixed Value of the field
308 function set($fieldname, $value)
310 $this->do_set($fieldname, $value, null
);
313 // ###################################################################
315 * Does the actual setting of the field. set() is defined in each
316 * module, but this controls the actual data. This is done so that
317 * there isn't an extra parameter in set() that controls module spaces
321 * @param string Field name
323 * @param string Module name (as referred to in ISSO->modules[]) to place in
325 function do_set($fieldname, $value, $module)
329 $field =& $this->fields
["$fieldname"];
333 $field =& $this->modules
["$module"]->fields
["$fieldname"];
336 if (is_array($field))
338 if ($field[1] != null
)
340 if (preg_match('#^\$(.*)#', $field[1]))
342 $caller = preg_replace('#^\$(.*)->([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$#', 'array(&$\1, "\2")', $field[1]);
343 eval('$caller = ' . $caller . ';');
347 $caller = array(&$this, $field[1]);
350 $value = call_user_func($caller, $value);
355 $this->$fieldname = $value;
359 $this->modules
["$module"]->$fieldname = $value;
366 trigger_error('Invalid field `' . $module . '.' . $fieldname . '` specified in ISSO->do_set()', E_USER_ERROR
);
370 // ###################################################################
372 * Fetches the value of a field. This is protected because get() should
373 * be defined in each module to make a call to this function.
377 * @param string Field name
378 * @param string Module name (as referred to in ISSO->modules[]) to fetch from
380 function do_get($fieldname, $module)
384 $field =& $this->fields
["$fieldname"];
388 $field =& $this->modules
["$module"]->fields
["$fieldname"];
391 if (is_array($field))
393 if ($field[2] == false
)
395 trigger_error('Field ' . $module . ':: ' . $filedname . ' is not set and therefore cannot be get()', E_USER_ERROR
);
400 return $this->$fieldname;
404 return $this->modules
["$module"]->$fieldname;
411 trigger_error('Invalid field `' . $module . '.' . $fieldname . '` specified in ISSO->do_get()', E_USER_ERROR
);
415 // ###################################################################
417 * Returns the value of an ISSO field. You should not access any instance
418 * variables directly, use this instead.
422 * @param string Field name
424 * @return mixed Value of the field
426 function get($fieldname)
428 return $this->do_get($fieldname, null
);
431 // ###################################################################
433 * Makes sure that all of the required fields in ISSO are set before
434 * any action is done. This will throw an error block describing
435 * the fields that need to be set if any are missing.
439 * @param string Module to check for; null is kernel, string is a module name, false is all
440 * @param bool Is this a non-error environment that should display all fields?
442 function check_isso_fields($module = null
, $called = false
)
446 if ($module === false
)
448 $modules = $this->show_modules(true
);
450 else if ($module === null
)
452 $modules = array(get_class($this));
456 $modules = array($module);
459 foreach ($modules AS $module)
461 if (empty($this->modules
["$module"]->fields
))
466 foreach ($this->modules
["$module"]->fields
AS $name => $field)
468 if ($field[0] == REQ_YES
AND $field[2] == false
AND $called == false
)
470 $missing[] = $module . ':: ' . $name;
472 else if ($called == true
AND $field[2] == false
)
474 $missing[] = $module . ':: ' . $name . ($field[0] == REQ_YES ?
' <strong>(REQUIRED)</strong>' : '');
479 if (sizeof($missing) > 0)
481 $error = ($called ?
'The following fields are not set:' : 'You are missing required ISSO fields. Please make sure you have set:');
485 foreach ($missing AS $field)
487 $error .= "\n\t" . '<li>' . $field . '</li>';
490 $error .= "\n" . '</ul>';
492 $this->message(($called ?
'' : 'Missing ') . 'Fields', $error, ($called ?
1 : 3));
494 if ($called == false
)
501 // ###################################################################
503 * Prepares a path for being set as the sourcepath
507 * @param string Source path or URL
509 * @return string Prepared source path
511 function fetch_sourcepath($source)
513 if (substr($source, strlen($source) - 1) != DIRECTORY_SEPARATOR
)
515 $source .= DIRECTORY_SEPARATOR
;
520 // ###################################################################
522 * Loads a framework module
526 * @param string Name of the framework file to load
527 * @param string Internal variable to initialize as; to not instantiate (just require) leave it as NULL
528 * @param bool Globalize the internal variable?
530 * @return object Instantiated instance
532 function &load($framework, $asobject, $globalize = false
)
534 $this->check_isso_fields(null
);
536 // set the object interlock
537 if (!method_exists($GLOBALS['isso:callback'], 'load'))
539 $GLOBALS['isso:callback'] =& $this;
540 $this->modules
['isso'] =& $this;
543 if ($this->is_loaded($framework))
545 return $this->modules
["$framework"];
548 if ($this->sourcepath
== '')
550 trigger_error('Invalid sourcepath specified', E_USER_ERROR
);
553 if (file_exists($this->sourcepath
. $framework . '.php'))
555 require_once($this->sourcepath
. $framework . '.php');
559 trigger_error('Could not find the framework ' . $this->sourcepath
. $framework . '.php', E_USER_ERROR
);
562 if ($asobject === null
)
567 if (isset($this->$asobject))
569 trigger_error('Cannot instantiate framework `' . $framework . '` into `' . $asobject . '`', E_USER_ERROR
);
572 $this->$asobject = new $framework($this);
574 $this->modules
["$framework"] =& $this->$asobject;
578 $GLOBALS["$asobject"] =& $this->$asobject;
581 // allow for init_as_package to link
582 if (method_exists($this->modules
["$framework"], 'init_as_package'))
584 $this->modules
[ $this->modules
["$framework"]->init_as_package() ] =& $this->modules
["$framework"];
587 return $this->$asobject;
590 // ###################################################################
592 * Prints a list of all currently loaded framework modules
596 * @param bool Return the data as an array?
598 * @return mixed HTML output or an array of loaded modules
600 function show_modules($return = false
)
603 foreach ($this->modules
AS $object)
605 $module = get_class($object);
606 if (method_exists($object, 'init_as_package') AND in_array($module, $modules))
608 $module = $object->init_as_package() . " - ($module)";
611 $modules[] = $module;
620 $output = "\n\n<ul>\n\t<li>";
621 $output .= implode("</li>\n\t<li>", $modules);
622 $output .= "</li>\n</ul>\n\n";
623 $this->message('Loaded Modules', $output, 1);
627 // ###################################################################
629 * Verifies to see if a framework has been loaded
633 * @param string Framework name
635 * @return bool Whether or not the framework has been loaded
637 function is_loaded($framework)
639 if (isset($this->modules
["$framework"]))
649 // ###################################################################
651 * Prints an ISSO message
655 * @param string The title of the message
656 * @param string The content of the message
657 * @param integer Type of message to be printed
658 * @param bool Return the output?
659 * @param bool Show the debug stack?
660 * @param integer Message width
662 * @return mixed Output or null
664 function message($title, $message, $type, $return = false
, $stack = true
, $width = 500)
689 $backtrace = debug_backtrace();
690 array_shift($backtrace);
692 if (isset($backtrace[0]) AND $backtrace[0]['function'] == '_error_handler')
694 array_shift($backtrace);
697 $trace = $this->format_debug_trace($backtrace);
699 $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;\">";
700 $output .= "\n<tr style=\"color: $font; text-align: left\">\n\t<td><strong>$prefix: $title</strong></td>\n</tr>";
701 $output .= "\n<tr style=\"background-color: #FFFFFF; text-align: left\">\n\t<td>$message</td>\n</tr>";
702 $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>" : '');
703 $output .= "\n</table>\n<br />\n";
715 // ###################################################################
717 * Prepares a debug_backtrace() array for output to the browser by
718 * compressing the array into visible text
722 * @param array debug_backtrace() array
724 * @return array Formatted trace output
726 function format_debug_trace($backtrace)
729 foreach ($backtrace AS $i => $step)
732 $file = $step['file'] . ':' . $step['line'];
733 $funct = (isset($step['class']) ?
$step['class'] . '::' . $step['function'] : $step['function']);
735 if (isset($step['args']) AND is_array($step['args']))
737 // we need to do this so we don't get "Array to string conversion" notices
738 foreach ($step['args'] AS $id => $arg)
742 $step['args']["$id"] = 'Array';
745 $args = implode(', ', $step['args']);
748 $trace[] = "#$i $funct($args) called at [$file]";
754 // ###################################################################
756 * Custom error handler for ISSO; only handle E_WARNING, E_NOTICE,
757 * E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE
761 * @param integer Error number
762 * @param string Error message string
763 * @param string File that contains the error
764 * @param string The line number of the error
765 * @param string The active symbol table at which point the error occurred
767 function _error_handler($errno, $errstr, $errfile, $errline, $errcontext)
769 $level = ini_get('error_reporting');
777 if (!($level & E_USER_ERROR
))
788 if (! (($level & E_USER_WARNING
) AND ($level & E_WARNING
)) )
800 if (! (($level & E_USER_NOTICE
) AND ($level & E_NOTICE
)) )
807 $errstr .= " in <strong>$errfile</strong> on line <strong>$errline</strong>";
809 $errstr = str_replace(array(getcwd(), dirname(getcwd())), '', $errstr);
811 $this->message($title, $errstr, $mode);
813 if ($errno == E_USER_ERROR
)
819 // ###################################################################
821 * Creates a table that explains the error reporting levels and their
826 function explain_error_reporting()
829 'E_ERROR' => E_ERROR
,
830 'E_WARNING' => E_WARNING
,
831 'E_PARSE' => E_PARSE
,
832 'E_NOTICE' => E_NOTICE
,
833 'E_CORE_ERROR' => E_CORE_ERROR
,
834 'E_CORE_WARNING' => E_CORE_WARNING
,
835 'E_COMPILE_ERROR' => 64,
836 'E_COMPILE_WARNING' => 128,
837 'E_USER_ERROR' => E_USER_ERROR
,
838 'E_USER_WARNING' => E_USER_WARNING
,
839 'E_USER_NOTICE' => E_USER_NOTICE
,
844 $table = '<table cellspacing="0" cellpadding="2" border="0">';
846 foreach ($levels AS $name => $value)
850 <td>' . $name . '</td>
851 <td>' . (ini_get('error_reporting') & $value) . '</td>
858 $this->message('Error Reporting', $table, 1);
861 // ###################################################################
863 * Logs a debug message for verbose output
867 * @param string Message
869 function debug($message)
871 $this->debuginfo
[] = $message;
874 // ###################################################################
876 * Recursive XSS cleaner
880 * @param mixed Unsanitized REQUEST data
882 * @return mixed Sanitized data
884 function _sanitize_input_recursive($data)
886 foreach ($data AS $key => $value)
888 if (is_array($value))
890 $data["$key"] = $this->_sanitize_input_recursive($value);
894 if ($this->magicquotes
)
896 $value = str_replace("\'", "'", $value);
898 $data["$key"] = $this->sanitize($value);
904 // ###################################################################
906 * Simple way to protect against HTML attacks with Unicode support
910 * @param string Unsanitzed text
912 * @return string Properly protected text that only encodes potential threats
914 function sanitize($text)
916 if ($this->magicquotes
)
918 return str_replace(array('<', '>', '\"', '"'), array('<', '>', '"', '"'), $text);
922 return str_replace(array('<', '>', '"'), array('<', '>', '"'), $text);
926 // ###################################################################
928 * Unicode-safe entity encoding system; similar to sanitize()
932 * @param string Unsanitized text
934 * @return string Unicode-safe sanitized text with entities preserved
936 function entity_encode($text)
938 $text = str_replace('&', '&', $text);
939 $text = $this->sanitize($text);
943 // ###################################################################
945 * Takes text that has been processed for HTML and unsanitizes it
949 * @param string Text that needs to be turned back into HTML
951 * @return string Unsanitized text
953 function unsanitize($text)
955 return str_replace(array('<', '>', '"'), array('<', '>', '"'), $text);
958 // ###################################################################
960 * Smart addslashes() that only applies itself it the Magic Quotes GPC
961 * is off. This should only be run on database query values that come
962 * from ISSO->in[] input; data that needs sanitization should be run
963 * through ISSO->DB->escape_string()
967 * @param string Some string
968 * @param bool Force magic quotes to be off
970 * @return string String that has slashes added
972 function escape($str, $force = true
)
974 if ($this->magicquotes
AND !$force)
976 if (isset($this->modules
[ISSO_DB_LAYER
]))
978 return $this->modules
[ISSO_DB_LAYER
]->escape_string(str_replace(array("\'", '\"'), array("'", '"'), $str));
984 if (isset($this->modules
[ISSO_DB_LAYER
]))
986 return $this->modules
[ISSO_DB_LAYER
]->escape_string($str);
988 return addslashes($str);
992 // ###################################################################
994 * Runs through all of the input data and sanitizes it.
998 function exec_sanitize_data()
1000 $this->in
= $this->_sanitize_input_recursive(array_merge($_GET, $_POST, $_COOKIE));
1003 // ###################################################################
1005 * Sanitize function for something other than a string (which
1006 * everything is sanitized for if you use exec_sanitize_data(). Cleaned
1007 * data is placed back into $isso->in; this makes it so you don't have
1008 * to constantly intval() [etc.] data.
1012 * @param array Array of elements to clean as varname => type
1014 function input_clean_array($vars)
1016 foreach ($vars AS $varname => $type)
1018 $this->input_clean($varname, $type);
1022 // ###################################################################
1024 * Sanitize function that does a single variable as oppoesd to an array
1025 * (see input_clean_array() for more details)
1029 * @param string Variable name in $isso->in[]
1030 * @param integer Sanitization type constant
1032 function input_clean($varname, $type)
1034 if (isset($this->in
["$varname"]))
1036 $this->in
["$varname"] = $this->clean($this->in
["$varname"], $type);
1040 $this->in
["$varname"] = $this->clean(null
, $type);
1043 return $this->in
["$varname"];
1046 // ###################################################################
1048 * Runs ISSO->escape() on a variable on ISSO->in[]. This is just a
1049 * short-hand wrapper so that queries can be shortened. When this is used,
1050 * the actual value in ISSO->in[] is not changed, only the return value
1055 * @param string Input variable
1057 * @return string Escaped input
1059 function input_escape($varname)
1061 if (isset($this->in
["$varname"]))
1063 return $this->escape($this->in
["$varname"]);
1067 return $this->escape(null
);
1071 // ###################################################################
1073 * Cleaning function that does the work for input_clean(); this is
1074 * moved here so it can be used to clean things that aren't in
1080 * @param integer Sanitization type constant
1082 * @return mixed Cleaned data
1084 function clean($value, $type)
1086 if (is_array($value))
1088 return $this->clean_array($value, $type);
1091 if ($type == TYPE_INT
)
1093 $value = intval($value);
1095 else if ($type == TYPE_UINT
)
1097 $value = (($val = intval($value)) < 0 ?
0 : $val);
1099 else if ($type == TYPE_FLOAT
)
1101 $value = floatval($value);
1103 else if ($type == TYPE_BOOL
)
1105 $value = (bool
)$value;
1107 else if ($type == TYPE_STR
)
1111 else if ($type == TYPE_STRUN
)
1113 $value = $this->unsanitize($value);
1115 else if ($type == TYPE_NOCLEAN
)
1117 if ($this->magicquotes
)
1119 $value = str_replace(array('\"', "\'"), array('"', "'"), $value);
1128 trigger_error('Invalid clean type `' . $type . '` specified', E_USER_ERROR
);
1134 // ###################################################################
1136 * Recursion function for ISSO->clean()
1140 * @param array Uncleaned array
1141 * @param integer Sanitization type constant
1143 * @return array Cleaned array of data
1145 function clean_array($array, $type)
1147 foreach ($array AS $key => $value)
1149 $array["$key"] = $this->clean($value, $type);
1155 // ###################################################################
1157 * Checks to see if a POST refer is actually from us
1161 function exec_referer_check()
1163 if ($_SERVER['REQUEST_METHOD'] == 'POST')
1165 $host = ($_SERVER['HTTP_HOST']) ?
$_SERVER['HTTP_HOST'] : $_ENV['HTTP_HOST'];
1167 if ($host AND $_SERVER['HTTP_REFERER'])
1169 $parts = parse_url($_SERVER['HTTP_REFERER']);
1170 $ourhost = $parts['host'] . (isset($parts['port']) ?
":$parts[port]" : '');
1172 if ($ourhost != $host)
1174 trigger_error('No external hosts are allowed to POST to this application', E_USER_ERROR
);
1176 $this->debug('remote post check = ok');
1180 $this->debug('remote post check = FAILED');
1185 // ###################################################################
1187 * Constructs a debug information box that contains various debugging
1188 * information points
1192 * @param bool Show template information?
1194 * @return string Debugging block
1196 function construct_debug_block($dotemplates)
1209 foreach ($this->modules
['template']->usage
AS $name => $count)
1211 if (in_array($name, $this->modules
['template']->uncached
))
1213 $optlist[] = $name . '[' . $count . ']';
1215 $usage[] = $name . " ($count)";
1218 $sizeof = sizeof($this->modules
['template']->uncached
);
1221 $debug .= "\n\t<li><strong style=\"color: red\">Uncached Template(s):</strong> $sizeof ( " . implode(' ', $optlist) . " )</li>";
1226 $scinfo = 'Not Under Source Control';
1229 $scinfo = constant('SVN');
1231 if (preg_match('#\$Id:?\s*\$#', $scinfo))
1233 $scinfo = 'Not Under Source Control';
1237 $scinfo = preg_replace('#\$' . '(Head)?URL: (.+?) \$#e', "end(explode('/', '\\2'))", $scinfo);
1238 $scinfo = preg_replace('#\$' . '(LastModified)?Revision: (.+?) \$#', 'SVN \\2', $scinfo);
1239 $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);
1243 $scinfo = trim($scinfo);
1244 $debug .= "\n\t<li><strong>Source Control:</strong> $scinfo</li>";
1246 // query information
1247 if (is_object($this->modules
[ISSO_DB_LAYER
]))
1249 $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>";
1252 // total execution time
1253 if (defined('ISSO_MT_START'))
1255 $this->load('functions', 'functions');
1256 $debug .= "\n\t<li><strong>Total Execution Time:</strong> " . round($this->modules
['functions']->fetch_microtime_diff(ISSO_MT_START
), 10) . "</li>";
1260 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Debug Notices (" . sizeof($this->debuginfo
) . ")</option>";
1261 foreach ((array)$this->debuginfo
AS $msg)
1263 $debug .= "\n\t\t\t<option>--- $msg</option>";
1265 $debug .= "\n\t\t</select>\n\t</li>";
1268 $modules = $this->show_modules(true
);
1269 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Loaded Modules (" . sizeof($modules) . ")</option>";
1270 foreach ($modules AS $mod)
1272 $debug .= "\n\t\t\t<option>--- $mod</option>";
1274 $debug .= "\n\t\t</select>\n\t</li>";
1279 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Template Usage (" . array_sum($this->modules
['template']->usage
) . ")</option>";
1280 foreach ($usage AS $tpl)
1282 $debug .= "\n\t\t\t<option>--- $tpl</option>";
1284 $debug .= "\n\t\t</select>\n\t</li>";
1287 $debug .= "\n</ul>";
1289 $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";
1296 /*=====================================================================*\
1297 || ###################################################################
1300 || ###################################################################
1301 \*=====================================================================*/