]>
src.bluestatic.org Git - isso.git/blob - kernel.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Iris Studios Shared Object Framework [#]version[#]
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 = '[#]version[#]';
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 // attempt to set the sourcepath
269 $path = call_user_func('debug_backtrace');
270 $this->set('sourcepath', str_replace('kernel.php', '', $path[0]['file']));
272 // start input sanitize using variable_order GPC
273 if (!defined('ISSO_NO_INPUT_SANITIZE'))
275 $this->exec_sanitize_data();
278 if (defined('ISSO_CHECK_POST_REFERER'))
280 $this->exec_referer_check();
284 // ###################################################################
286 * (PHP 4) Constructor
290 $this->__construct();
293 // ###################################################################
295 * Sets a specified field in the ISSO. This is used to set all the
296 * required fields that ISSO uses for linking. It replaces the old
297 * method of setting the instance variables directly.
301 * @param string Field name
302 * @param mixed Value of the field
304 function set($fieldname, $value)
306 $this->do_set($fieldname, $value, null);
309 // ###################################################################
311 * Does the actual setting of the field. set() is defined in each
312 * module, but this controls the actual data. This is done so that
313 * there isn't an extra parameter in set() that controls module spaces
317 * @param string Field name
319 * @param string Module name (as referred to in ISSO->modules[]) to place in
321 function do_set($fieldname, $value, $module)
325 $field =& $this->fields
["$fieldname"];
329 $field =& $this->modules["$module"]->fields
["$fieldname"];
332 if (is_array($field))
334 if ($field[1] != null)
336 if (preg_match('#^\$(.*)#', $field[1]))
338 $caller = preg_replace('#^\$(.*)->([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$#', 'array(&$\1, "\
2")', $field[1]);
339 eval('$caller = ' . $caller . ';');
343 $caller = array(&$this, $field[1]);
346 $value = call_user_func($caller, $value);
351 $this->$fieldname = $value;
355 $this->modules["$module"]->$fieldname = $value;
362 trigger_error('Invalid field `' . $module . '.' . $fieldname . '` specified in ISSO->do_set()', E_USER_ERROR
);
366 // ###################################################################
368 * Fetches the value of a field. This is protected because get() should
369 * be defined in each module to make a call to this function.
373 * @param string Field name
374 * @param string Module name (as referred to in ISSO->modules[]) to fetch from
376 function do_get($fieldname, $module)
380 $field =& $this->fields
["$fieldname"];
384 $field =& $this->modules["$module"]->fields
["$fieldname"];
387 if (is_array($field))
389 if ($field[2] == false)
391 trigger_error('Field ' . $module . ':: ' . $filedname . ' is not set and therefore cannot be get()', E_USER_ERROR);
396 return $this->$fieldname;
400 return $this->modules["$module"]->$fieldname;
407 trigger_error('Invalid field `' . $module . '.' . $fieldname . '` specified in ISSO->do_get()', E_USER_ERROR
);
411 // ###################################################################
413 * Returns the value of an ISSO field. You should not access any instance
414 * variables directly, use this instead.
418 * @param string Field name
420 * @return mixed Value of the field
422 function get($fieldname)
424 return $this->do_get($fieldname, null);
427 // ###################################################################
429 * Makes sure that all of the required fields in ISSO are set before
430 * any action is done. This will throw an error block describing
431 * the fields that need to be set if any are missing.
435 * @param string Module to check for; null is kernel, string is a module name, false is all
436 * @param bool Is this a non-error environment that should display all fields?
438 function check_isso_fields($module = null, $called = false)
442 if ($module === false)
444 $modules = $this->show_modules(true);
446 else if ($module === null)
448 $modules = array(get_class($this));
452 $modules = array($module);
455 foreach ($modules AS $module)
457 if (empty($this->modules
["$module"]->fields))
462 foreach ($this->modules["$module"]->fields
AS $name => $field)
464 if ($field[0] == REQ_YES
AND $field[2] == false AND $called == false)
466 $missing[] = $module . ':: ' . $name;
468 else if ($called == true AND $field[2] == false)
470 $missing[] = $module . ':: ' . $name . ($field[0] == REQ_YES
? ' <strong>(REQUIRED)</strong>' : '');
475 if (sizeof($missing) > 0)
477 $error = ($called ? 'The following fields are not set:' : 'You are missing required ISSO fields. Please make sure you have set:');
481 foreach ($missing AS $field)
483 $error .= "\n\t" . '<li>' . $field . '</li>';
486 $error .= "\n" . '</ul>';
488 $this->message(($called ? '' : 'Missing ') . 'Fields', $error, ($called ? 1 : 3));
490 if ($called == false)
497 // ###################################################################
499 * Prepares a path for being set as the sourcepath
503 * @param string Source path or URL
505 * @return string Prepared source path
507 function fetch_sourcepath($source)
509 if (substr($source, strlen($source) - 1) != DIRECTORY_SEPARATOR
)
511 $source .= DIRECTORY_SEPARATOR
;
516 // ###################################################################
518 * Loads a framework module
522 * @param string Name of the framework file to load
523 * @param string Internal variable to initialize as; to not instantiate (just require) leave it as NULL
524 * @param bool Globalize the internal variable?
526 * @return object Instantiated instance
528 function &load($framework, $asobject, $globalize = false)
530 $this->check_isso_fields(null);
532 // set the object interlock
533 if (!method_exists($GLOBALS['isso:callback'], 'load'))
535 $GLOBALS['isso:callback'] =& $this;
536 $this->modules
['isso'] =& $this;
539 if ($this->is_loaded($framework))
541 return $this->modules
["$framework"];
544 if ($this->sourcepath == '')
546 trigger_error('Invalid sourcepath specified', E_USER_ERROR);
549 if (file_exists($this->sourcepath . $framework . '.php'))
551 require_once($this->sourcepath . $framework . '.php');
555 trigger_error('Could not find the framework ' . $this->sourcepath . $framework . '.php', E_USER_ERROR);
558 if ($asobject === null)
563 if (isset($this->$asobject))
565 trigger_error('Cannot instantiate framework `' . $framework . '` into `' . $asobject . '`', E_USER_ERROR);
568 $this->$asobject = new $framework($this);
570 $this->modules["$framework"] =& $this->$asobject;
574 $GLOBALS["$asobject"] =& $this->$asobject;
577 // allow for init_as_package to link
578 if (method_exists($this->modules["$framework"], 'init_as_package'))
580 $this->modules
[ $this->modules
["$framework"]->init_as_package() ] =& $this->modules["$framework"];
583 return $this->$asobject;
586 // ###################################################################
588 * Prints a list of all currently loaded framework modules
592 * @param bool Return the data as an array?
594 * @return mixed HTML output or an array of loaded modules
596 function show_modules($return = false)
599 foreach ($this->modules
AS $object)
601 $module = get_class($object);
602 if (method_exists($object, 'init_as_package') AND in_array($module, $modules))
604 $module = $object->init_as_package() . " - ($module)";
607 $modules[] = $module;
616 $output = "\n\n<ul>\n\t<li>";
617 $output .= implode("</li>\n\t<li>", $modules);
618 $output .= "</li>\n</ul>\n\n";
619 $this->message('Loaded Modules', $output, 1);
623 // ###################################################################
625 * Verifies to see if a framework has been loaded
629 * @param string Framework name
631 * @return bool Whether or not the framework has been loaded
633 function is_loaded($framework)
635 if (isset($this->modules
["$framework"]))
645 // ###################################################################
647 * Prints an ISSO message
651 * @param string The title of the message
652 * @param string The content of the message
653 * @param integer Type of message to be printed
654 * @param bool Return the output?
655 * @param bool Show the debug stack?
656 * @param integer Message width
658 * @return mixed Output or null
660 function message($title, $message, $type, $return = false, $stack = true, $width = 500)
685 $backtrace = debug_backtrace();
686 array_shift($backtrace);
688 if (isset($backtrace[0]) AND $backtrace[0]['function'] == '_error_handler')
690 array_shift($backtrace);
693 $trace = $this->format_debug_trace($backtrace);
695 $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
;\">";
696 $output .= "\n
<tr style
=\"color
: $font; text
-align
: left\"
>\n\t<td
><strong
>$prefix: $title</strong
></td
>\n</tr
>";
697 $output .= "\n
<tr style
=\"background
-color
: #FFFFFF; text-align: left\">\n\t<td>$message</td>\n</tr>";
698 $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>" : '');
699 $output .= "\n</table>\n<br />\n";
711 // ###################################################################
713 * Prepares a debug_backtrace() array for output to the browser by
714 * compressing the array into visible text
718 * @param array debug_backtrace() array
720 * @return array Formatted trace output
722 function format_debug_trace($backtrace)
725 foreach ($backtrace AS $i => $step)
727 $file = $step['file'] . ':' . $step['line'];
728 $funct = (isset($step['class']) ? $step['class'] . '::' . $step['function'] : $step['function']);
729 $args = (is_array($step['args']) ? implode(', ', $step['args']) : '');
731 $trace[] = "#$i $funct($args) called at [$file]";
737 // ###################################################################
739 * Custom error handler for ISSO; only handle E_WARNING, E_NOTICE,
740 * E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE
744 * @param integer Error number
745 * @param string Error message string
746 * @param string File that contains the error
747 * @param string The line number of the error
748 * @param string The active symbol table at which point the error occurred
750 function _error_handler($errno, $errstr, $errfile, $errline)
758 if (!(ini_get('error_reporting') & E_USER_ERROR
))
768 if (!(ini_get('error_reporting') & E_USER_WARNING
) AND !(ini_get('error_reporting') & E_WARNING
))
779 if (!(ini_get('error_reporting') & E_USER_NOTICE
) AND !(ini_get('error_reporting') & E_NOTICE
))
786 $errstr .= " in <strong>$errfile</strong> on line <strong>$errline</strong>";
788 $errstr = str_replace(array(getcwd(), dirname(getcwd())), '', $errstr);
790 $this->message($title, $errstr, $level);
792 if ($errno == E_USER_ERROR
)
798 // ###################################################################
800 * Creates a table that explains the error reporting levels and their
805 function explain_error_reporting()
808 'E_ERROR' => E_ERROR
,
809 'E_WARNING' => E_WARNING
,
810 'E_PARSE' => E_PARSE
,
811 'E_NOTICE' => E_NOTICE
,
812 'E_CORE_ERROR' => E_CORE_ERROR
,
813 'E_CORE_WARNING' => E_CORE_WARNING
,
814 'E_COMPILE_ERROR' => 64,
815 'E_COMPILE_WARNING' => 128,
816 'E_USER_ERROR' => E_USER_ERROR
,
817 'E_USER_WARNING' => E_USER_WARNING
,
818 'E_USER_NOTICE' => E_USER_NOTICE
,
823 $table = '<table cellspacing="0" cellpadding="2" border="0">';
825 foreach ($levels AS $name => $value)
829 <td>' . $name . '</td>
830 <td>' . (ini_get('error_reporting') & $value) . '</td>
837 $this->message('Error Reporting', $table, 1);
840 // ###################################################################
842 * Logs a debug message for verbose output
846 * @param string Message
848 function debug($message)
850 $this->debuginfo
[] = $message;
853 // ###################################################################
855 * Recursive XSS cleaner
859 * @param mixed Unsanitized REQUEST data
861 * @return mixed Sanitized data
863 function _sanitize_input_recursive($data)
865 foreach ($data AS $key => $value)
867 if (is_array($value))
869 $data["$key"] = $this->_sanitize_input_recursive($value);
873 $data["$key"] = $this->sanitize($value);
879 // ###################################################################
881 * Simple way to protect against HTML attacks with Unicode support
885 * @param string Unsanitzed text
887 * @return string Properly protected text that only encodes potential threats
889 function sanitize($text)
891 if ($this->magicquotes
)
893 return str_replace(array('<', '>', '\"', '"'), array('<', '>', '"', '"'), $text);
897 return str_replace(array('<', '>', '"'), array('<', '>', '"'), $text);
901 // ###################################################################
903 * Unicode-safe entity encoding system; similar to sanitize()
907 * @param string Unsanitized text
909 * @return string Unicode-safe sanitized text with entities preserved
911 function entity_encode($text)
913 $text = str_replace('&', '&', $text);
914 $text = $this->sanitize($text);
918 // ###################################################################
920 * Takes text that has been processed for HTML and unsanitizes it
924 * @param string Text that needs to be turned back into HTML
926 * @return string Unsanitized text
928 function unsanitize($text)
930 return str_replace(array('<', '>', '"'), array('<', '>', '"'), $text);
933 // ###################################################################
935 * Smart addslashes() that only applies itself it the Magic Quotes GPC
936 * is off. This should only be run on database query values.
940 * @param string Some string
941 * @param bool Force magic quotes to be off
943 * @return string String that has slashes added
945 function escape($str, $force = true)
947 if ($this->magicquotes
AND !$force)
949 if (isset($this->modules
[ISSO_DB_LAYER
]))
951 return $this->modules
[ISSO_DB_LAYER
]->escape_string(str_replace(array("\'", '\"'), array("'", '"'), $str));
957 if (isset($this->modules
[ISSO_DB_LAYER
]))
959 return $this->modules
[ISSO_DB_LAYER
]->escape_string($str);
961 return addslashes($str);
965 // ###################################################################
967 * Runs through all of the input data and sanitizes it.
971 function exec_sanitize_data()
973 $this->in
= $this->_sanitize_input_recursive(array_merge($_GET, $_POST, $_COOKIE));
976 // ###################################################################
978 * Sanitize function for something other than a string (which
979 * everything is sanitized for if you use exec_sanitize_data(). Cleaned
980 * data is placed back into $isso->in; this makes it so you don't have
981 * to constantly intval() [etc.] data.
985 * @param array Array of elements to clean as varname => type
987 function input_clean_array($vars)
989 foreach ($vars AS $varname => $type)
991 $this->input_clean($varname, $type);
995 // ###################################################################
997 * Sanitize function that does a single variable as oppoesd to an array
998 * (see input_clean_array() for more details)
1002 * @param string Variable name in $isso->in[]
1003 * @param integer Sanitization type constant
1005 function input_clean($varname, $type)
1007 if (isset($this->in
["$varname"]))
1009 $this->in["$varname"] = $this->clean($this->in
["$varname"], $type);
1013 $this->in["$varname"] = null;
1016 return $this->in
["$varname"];
1019 // ###################################################################
1021 * Cleaning function that does the work for input_clean(); this is
1022 * moved here so it can be used to clean things that aren't in
1028 * @param integer Sanitization type constant
1030 * @return mixed Cleaned data
1032 function clean($value, $type)
1034 if (is_array($value))
1036 return $this->clean_array($value, $type);
1039 if ($type == TYPE_INT)
1041 $value = intval($value);
1043 else if ($type == TYPE_UINT)
1045 $value = (($val = intval($value)) < 0 ? 0 : $val);
1047 else if ($type == TYPE_FLOAT)
1049 $value = floatval($value);
1051 else if ($type == TYPE_BOOL)
1053 $value = (bool)$value;
1055 else if ($type == TYPE_STR)
1059 else if ($type == TYPE_STRUN)
1061 $value = $this->unsanitize($value);
1063 else if ($type == TYPE_NOCLEAN)
1069 trigger_error('Invalid clean type `' . $type . '` specified', E_USER_ERROR);
1075 // ###################################################################
1077 * Recursion function for ISSO->clean()
1081 * @param array Uncleaned array
1082 * @param integer Sanitization type constant
1084 * @return array Cleaned array of data
1086 function clean_array($array, $type)
1088 foreach ($array AS $key => $value)
1090 $array["$key"] = $this->clean($value, $type);
1096 // ###################################################################
1098 * Checks to see if a POST refer is actually from us
1102 function exec_referer_check()
1104 if ($_SERVER['REQUEST_METHOD'] == 'POST')
1106 $host = ($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_ENV['HTTP_HOST'];
1108 if ($host AND $_SERVER['HTTP_REFERER'])
1110 $parts = parse_url($_SERVER['HTTP_REFERER']);
1111 $ourhost = $parts['host'] . (isset($parts['port']) ? ":$parts[port]" : '');
1113 if ($ourhost != $host)
1115 trigger_error('No external hosts are allowed to POST to this application', E_USER_ERROR
);
1117 $this->debug('remote post check = ok');
1121 $this->debug('remote post check = FAILED');
1126 // ###################################################################
1128 * Constructs a debug information box that contains various debugging
1129 * information points
1133 * @param bool Show template information?
1135 * @return string Debugging block
1137 function construct_debug_block($dotemplates)
1150 foreach ($this->modules
['template']->usage
AS $name => $count)
1152 if (in_array($name, $this->modules
['template']->uncached
))
1154 $optlist[] = $name . '[' . $count . ']';
1156 $usage[] = $name . " ($count)";
1159 $sizeof = sizeof($this->modules
['template']->uncached
);
1162 $debug .= "\n\t<li><strong style=\"color: red\">Uncached Template(s):</strong> $sizeof ( " . implode(' ', $optlist) . " )</li>";
1167 $scinfo = 'Not Under Source Control';
1170 $scinfo = constant('SVN');
1172 if (preg_match('#\$Id:?\s*\$#', $scinfo))
1174 $scinfo = 'Not Under Source Control';
1178 $scinfo = preg_replace('#\$' . '(Head)?URL: (.+?) \$#e', "end(explode('/', '\\2'))", $scinfo);
1179 $scinfo = preg_replace('#\$' . '(LastModified)?Revision: (.+?) \$#', 'SVN \\2', $scinfo);
1180 $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);
1184 $scinfo = trim($scinfo);
1185 $debug .= "\n\t<li><strong>Source Control:</strong> $scinfo</li>";
1187 // query information
1188 if (is_object($this->modules
[ISSO_DB_LAYER
]))
1190 $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>";
1193 // total execution time
1194 if (defined('ISSO_MT_START'))
1196 $this->load('functions', 'functions');
1197 $debug .= "\n\t<li><strong>Total Execution Time:</strong> " . round($this->modules
['functions']->fetch_microtime_diff(ISSO_MT_START
), 10) . "</li>";
1201 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Debug Notices (" . sizeof($this->debuginfo
) . ")</option>";
1202 foreach ((array)$this->debuginfo
AS $msg)
1204 $debug .= "\n\t\t\t<option>--- $msg</option>";
1206 $debug .= "\n\t\t</select>\n\t</li>";
1209 $modules = $this->show_modules(true);
1210 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Loaded Modules (" . sizeof($modules) . ")</option>";
1211 foreach ($modules AS $mod)
1213 $debug .= "\n\t\t\t<option>--- $mod</option>";
1215 $debug .= "\n\t\t</select>\n\t</li>";
1220 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Template Usage (" . array_sum($this->modules
['template']->usage
) . ")</option>";
1221 foreach ($usage AS $tpl)
1223 $debug .= "\n\t\t\t<option>--- $tpl</option>";
1225 $debug .= "\n\t\t</select>\n\t</li>";
1228 $debug .= "\n</ul>";
1230 $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";
1237 /*=====================================================================*\
1238 || ###################################################################
1241 || ###################################################################
1242 \*=====================================================================*/