Don't have any escapestrings stuff to worry about now...
[isso.git] / kernel.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Iris Studios Shared Object Framework [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
6 || #
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.
10 || #
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
14 || # more details.
15 || #
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 \*=====================================================================*/
21
22 /**
23 * Iris Studios Shared Object Framework Kernel
24 * kernel.php
25 *
26 * @package ISSO
27 */
28
29 if (!function_exists('version_compare'))
30 {
31 trigger_error('You need PHP version 4.1.0 or newer to run ISSO', E_USER_ERROR);
32 exit;
33 }
34
35 if (version_compare(PHP_VERSION, '5.0.0', '>='))
36 {
37 if (ini_get('error_reporting') & E_NOTICE)
38 {
39 error_reporting(ini_get('error_reporting') - E_NOTICE);
40 }
41 if (ini_get('error_reporting') & E_USER_NOTICE)
42 {
43 error_reporting(ini_get('error_reporting') - E_USER_NOTICE);
44 }
45 }
46
47 $oldlevel = ini_get('error_reporting');
48 $newlevel = $oldlevel;
49 $levels = array(E_ERROR => E_USER_ERROR, E_WARNING => E_USER_WARNING, E_NOTICE => E_USER_NOTICE);
50 foreach ($levels AS $php => $isso)
51 {
52 if ($oldlevel & $php)
53 {
54 if (!($oldlevel & $isso))
55 {
56 $newlevel += $isso;
57 }
58 }
59 else
60 {
61 if ($oldlevel & $isso)
62 {
63 $newlevel -= $isso;
64 }
65 }
66 }
67 error_reporting($newlevel);
68
69 if ((bool)ini_get('register_globals') === true)
70 {
71 $superglobals = array('_GET', '_COOKIE', '_FILES', '_POST', '_SERVER', '_ENV');
72 foreach ($superglobals AS $global)
73 {
74 if (is_array(${$global}))
75 {
76 foreach (${$global} AS $_key => $_val)
77 {
78 if (isset(${$_key}))
79 {
80 unset(${$_key});
81 }
82 }
83 }
84 }
85 }
86
87 /**#@+
88 * Input cleaning type constant
89 */
90 /**
91 * Integer type
92 */
93 define('TYPE_INT', 1);
94
95 /**
96 * Unsigned integer
97 */
98 define('TYPE_UINT', 2);
99
100 /**
101 * Float type
102 */
103 define('TYPE_FLOAT', 4);
104
105 /**
106 * Boolean type
107 */
108 define('TYPE_BOOL', 8);
109
110 /**
111 * String - cleaned
112 */
113 define('TYPE_STR', 16);
114
115 /**
116 * String - deliberate unclean
117 */
118 define('TYPE_STRUN', 32);
119
120 /**
121 * No cleaning - here for use in API
122 */
123 define('TYPE_NOCLEAN', 64);
124 /**#@-*/
125
126 /**
127 * Iris Studios Shared Object Framework (ISSO)
128 *
129 * This framework allows a common backend to be used amongst all Iris
130 * Studios applications and is built to be abstract and flexible.
131 * The base framework handles all loading and module management.
132 *
133 * @author Iris Studios, Inc.
134 * @copyright Copyright ©2002 - [#]year[#], Iris Studios, Inc.
135 * @version $Revision$
136 * @package ISSO
137 *
138 */
139 class Shared_Object_Framework
140 {
141 /**
142 * ISSO version
143 * @var string
144 */
145 var $version = '[#]version[#]';
146
147 /**
148 * Location of ISSO, used for internal linking
149 * @var string
150 */
151 var $sourcepath = '';
152
153 /**
154 * Path of the current application
155 * @var string
156 */
157 var $apppath = '';
158
159 /**
160 * Web path used to get the web location of the installation of ISSO; only used for Printer module
161 * @var string
162 */
163 var $webpath = '';
164
165 /**
166 * Name of the current application
167 * @var string
168 */
169 var $application = '';
170
171 /**
172 * Version of the current application
173 * @var string
174 */
175 var $appversion = '';
176
177 /**
178 * Whether debug mode is on or off
179 * @var bool
180 */
181 var $debug = false;
182
183 /**
184 * List of all active debug messages
185 * @var array
186 */
187 var $debuginfo = array();
188
189 /**
190 * List of loaded modules
191 * @var array
192 */
193 var $modules = array();
194
195 /**
196 * An array of sanitized variables that have been cleaned for HTML tag openers and double quotes
197 * @var array
198 */
199 var $in = array();
200
201 /**
202 * If we are running with magic_quotes_gpc on or off
203 * @var int
204 */
205 var $magicquotes = 0;
206
207 /**
208 * If we should automagically escape strings, mimicking magic_quotes_gpc
209 * @var bool
210 */
211 var $escapestrings = false;
212
213 // ###################################################################
214 /**
215 * Constructor
216 */
217 function __construct()
218 {
219 // error reporting
220 set_error_handler(array(&$this, '_error_handler'));
221
222 // magic quotes
223 $this->magicquotes = get_magic_quotes_gpc();
224 set_magic_quotes_runtime(0);
225
226 // start input sanitize using variable_order GPC
227 if (!defined('ISSO_NO_INPUT_SANITIZE'))
228 {
229 $this->exec_sanitize_data();
230 }
231
232 if (defined('ISSO_CHECK_POST_REFERER'))
233 {
234 $this->exec_referer_check();
235 }
236
237 $GLOBALS['isso:null-framework'] = null;
238 }
239
240 // ###################################################################
241 /**
242 * (PHP 4) Constructor
243 */
244 function Shared_Object_Framework()
245 {
246 $this->__construct();
247 }
248
249 // ###################################################################
250 /**
251 * Prepares a path for being set as the sourcepath
252 *
253 * @access public
254 *
255 * @param string Source path or URL
256 *
257 * @return string Prepared source path
258 */
259 function fetch_sourcepath($source)
260 {
261 if (substr($source, strlen($source) - 1) != DIRECTORY_SEPARATOR)
262 {
263 $source .= DIRECTORY_SEPARATOR;
264 }
265 return $source;
266 }
267
268 // ###################################################################
269 /**
270 * Loads a framework module
271 *
272 * @access public
273 *
274 * @param string Name of the framework file to load
275 * @param string Internal variable to initialize as; to not instantiate (just require) leave it as NULL
276 * @param bool Globalize the internal variable?
277 *
278 * @return object Instantiated instance
279 */
280 function &load($framework, $asobject, $globalize = false)
281 {
282 // set the object interlock
283 if (!method_exists($GLOBALS['isso:null-framework'], 'load'))
284 {
285 $GLOBALS['isso:null-framework'] =& $this;
286 }
287
288 if ($this->is_loaded($framework))
289 {
290 return $this->modules["$framework"];
291 }
292
293 if ($this->sourcepath == '')
294 {
295 trigger_error('Invalid sourcepath specified', E_USER_ERROR);
296 }
297
298 if (file_exists($this->sourcepath . $framework . '.php'))
299 {
300 require_once($this->sourcepath . $framework . '.php');
301 }
302 else
303 {
304 trigger_error('Could not find the framework ' . $this->sourcepath . $framework . '.php', E_USER_ERROR);
305 }
306
307 if ($asobject === null)
308 {
309 return;
310 }
311
312 if (isset($this->$asobject))
313 {
314 trigger_error('Cannot instantiate framework `' . $framework . '` into `' . $asobject . '`', E_USER_ERROR);
315 }
316
317 $this->$asobject = new $framework($this);
318
319 $this->modules["$framework"] =& $this->$asobject;
320
321 if ($globalize)
322 {
323 $GLOBALS["$asobject"] =& $this->$asobject;
324 }
325
326 return $this->$asobject;
327 }
328
329 // ###################################################################
330 /**
331 * Prints a list of all currently loaded framework modules
332 *
333 * @access public
334 *
335 * @param bool Return the data as an array?
336 *
337 * @return mixed HTML output or an array of loaded modules
338 */
339 function show_modules($return = false)
340 {
341 foreach ($this->modules AS $object)
342 {
343 $modules[] = get_class($object);
344 }
345
346 if ($return)
347 {
348 return $modules;
349 }
350 else
351 {
352 $output = "\n\n<ul>\n\t<li>";
353 $output .= implode("</li>\n\t<li>", $modules);
354 $output .= "</li>\n</ul>\n\n";
355 $this->message('Loaded Modules', $output, 1);
356 }
357 }
358
359 // ###################################################################
360 /**
361 * Verifies to see if a framework has been loaded
362 *
363 * @access public
364 *
365 * @param string Framework name
366 *
367 * @return bool Whether or not the framework has been loaded
368 */
369 function is_loaded($framework)
370 {
371 if (isset($this->modules["$framework"]))
372 {
373 return true;
374 }
375 else
376 {
377 return false;
378 }
379 }
380
381 // ###################################################################
382 /**
383 * Prints an ISSO message
384 *
385 * @access public
386 *
387 * @param string The title of the message
388 * @param string The content of the message
389 * @param integer Type of message to be printed
390 * @param bool Return the output?
391 * @param bool Show the debug stack?
392 *
393 * @return mixed Output or null
394 */
395 function message($title, $message, $type, $return = false, $stack = true)
396 {
397 switch ($type)
398 {
399 // Message
400 case 1:
401 $prefix = 'Message';
402 $color = '#669900';
403 $font = '#000000';
404 break;
405
406 // Warning
407 case 2:
408 $prefix = 'Warning';
409 $color = '#003399';
410 $font = '#FFFFFF';
411 break;
412
413 case 3:
414 $prefix = 'Error';
415 $color = '#990000';
416 $font = '#EFEFEF';
417 break;
418 }
419
420 $backtrace = debug_backtrace();
421 unset($backtrace[0]);
422
423 $output = "\n<br />\n<table cellpadding=\"4\" cellspacing=\"1\" border=\"0\" width=\"500\" style=\"background-color: $color; color: black; font-family: Verdana, sans-serif; font-size: 12px;\">";
424 $output .= "\n<tr style=\"color: $font; text-align: left\">\n\t<td><strong>$prefix: $title</strong></td>\n</tr>";
425 $output .= "\n<tr style=\"background-color: #FFFFFF; text-align: left\">\n\t<td>$message</td>\n</tr>";
426 $output .= (($stack AND $GLOBALS['isso:null-framework']->debug) ? "\n<tr style=\"background-color: #FFFFFF; text-align: left\">\n\t<td><strong>Debug Stack:</strong> <pre>" . print_r($backtrace, true) . "</pre></td>\n</tr>" : '');
427 $output .= "\n</table>\n<br />\n";
428
429 if ($return)
430 {
431 return $output;
432 }
433 else
434 {
435 print($output);
436 }
437 }
438
439 // ###################################################################
440 /**
441 * Custom error handler for ISSO; only handle E_WARNING, E_NOTICE,
442 * E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE
443 *
444 * @access private
445 *
446 * @param integer Error number
447 * @param string Error message string
448 * @param string File that contains the error
449 * @param string The line number of the error
450 * @param string The active symbol table at which point the error occurred
451 */
452 function _error_handler($errno, $errstr, $errfile, $errline)
453 {
454 switch ($errno)
455 {
456 // Fatal
457 case E_USER_ERROR:
458 $title = 'Fatal';
459 $level = 3;
460 if (!(ini_get('error_reporting') & E_USER_ERROR))
461 {
462 return;
463 }
464 break;
465
466 // Error
467 case E_USER_WARNING:
468 $title = 'Warning';
469 $level = 2;
470 if (!(ini_get('error_reporting') & E_USER_WARNING) AND !(ini_get('error_reporting') & E_WARNING))
471 {
472 return;
473 }
474 break;
475
476 // Warning
477 case E_USER_NOTICE:
478 default:
479 $title = 'Notice';
480 $level = 1;
481 if (!(ini_get('error_reporting') & E_USER_NOTICE) AND !(ini_get('error_reporting') & E_NOTICE))
482 {
483 return;
484 }
485 break;
486 }
487
488 $errfile = str_replace(array(getcwd(), dirname(getcwd())), '', $errfile);
489
490 $errstr .= " in <strong>$errfile</strong> on line <strong>$errline</strong>";
491
492 $this->message($title, $errstr, $level);
493
494 if ($errno == E_USER_ERROR)
495 {
496 exit;
497 }
498 }
499
500 // ###################################################################
501 /**
502 * Creates a table that explains the error reporting levels and their
503 * state
504 *
505 * @access public
506 */
507 function explain_error_reporting()
508 {
509 $levels = array(
510 'E_ERROR' => E_ERROR,
511 'E_WARNING' => E_WARNING,
512 'E_PARSE' => E_PARSE,
513 'E_NOTICE' => E_NOTICE,
514 'E_CORE_ERROR' => E_CORE_ERROR,
515 'E_CORE_WARNING' => E_CORE_WARNING,
516 'E_COMPILE_ERROR' => 64,
517 'E_COMPILE_WARNING' => 128,
518 'E_USER_ERROR' => E_USER_ERROR,
519 'E_USER_WARNING' => E_USER_WARNING,
520 'E_USER_NOTICE' => E_USER_NOTICE,
521 'E_ALL' => E_ALL,
522 'E_STRICT' => 2048
523 );
524
525 $table = '<table cellspacing="0" cellpadding="2" border="0">';
526
527 foreach ($levels AS $name => $value)
528 {
529 $table .= '
530 <tr>
531 <td>' . $name . '</td>
532 <td>' . (ini_get('error_reporting') & $value) . '</td>
533 </tr>';
534 }
535
536 $table .= '
537 </table>';
538
539 $this->message('Error Reporting', $table, 1);
540 }
541
542 // ###################################################################
543 /**
544 * Logs a debug message for verbose output
545 *
546 * @access public
547 *
548 * @param string Message
549 */
550 function debug($message)
551 {
552 $this->debuginfo[] = $message;
553 }
554
555 // ###################################################################
556 /**
557 * Recursive XSS cleaner
558 *
559 * @access private
560 *
561 * @param mixed Unsanitized REQUEST data
562 *
563 * @return mixed Sanitized data
564 */
565 function _sanitize_input_recursive($data)
566 {
567 foreach ($data AS $key => $value)
568 {
569 if (is_array($value))
570 {
571 $data["$key"] = $this->_sanitize_input_recursive($value);
572 }
573 else
574 {
575 $data["$key"] = $this->sanitize($value);
576 }
577 }
578 return $data;
579 }
580
581 // ###################################################################
582 /**
583 * Simple way to protect against HTML attacks with Unicode support
584 *
585 * @access public
586 *
587 * @param string Unsanitzed text
588 *
589 * @return string Properly protected text that only encodes potential threats
590 */
591 function sanitize($text)
592 {
593 if ($this->magicquotes)
594 {
595 return str_replace(array('<', '>', '\"', '"'), array('&lt;', '&gt;', '&quot;', '&quot;'), $text);
596 }
597 else
598 {
599 return str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $text);
600 }
601 }
602
603 // ###################################################################
604 /**
605 * Unicode-safe entity encoding system; similar to sanitize()
606 *
607 * @access public
608 *
609 * @param string Unsanitized text
610 *
611 * @return string Unicode-safe sanitized text with entities preserved
612 */
613 function entity_encode($text)
614 {
615 $text = str_replace('&', '&amp;', $text);
616 $text = $this->sanitize($text);
617 return $text;
618 }
619
620 // ###################################################################
621 /**
622 * Takes text that has been processed for HTML and unsanitizes it
623 *
624 * @access public
625 *
626 * @param string Text that needs to be turned back into HTML
627 *
628 * @return string Unsanitized text
629 */
630 function unsanitize($text)
631 {
632 return str_replace(array('&lt;', '&gt;', '&quot;'), array('<', '>', '"'), $text);
633 }
634
635 // ###################################################################
636 /**
637 * Smart addslashes() that only applies itself it the Magic Quotes GPC
638 * is off. This should only be run on database query values.
639 *
640 * @access public
641 *
642 * @param string Some string
643 * @param bool If the data is binary; if so it'll be run through DB::escape_stringing()
644 * @param bool Force magic quotes to be off
645 *
646 * @return string String that has slashes added
647 */
648 function escape($str, $binary = false, $force = true)
649 {
650 if ($this->magicquotes AND !$force)
651 {
652 if (isset($this->db) AND $binary)
653 {
654 if (is_resource($this->db->link_id))
655 {
656 return $this->db->escape_string(str_replace(array("\'", '\"'), array("'", '"'), $str));
657 }
658 }
659 return $str;
660 }
661 else
662 {
663 if (isset($this->db) AND $binary)
664 {
665 if (is_resource($this->db->link_id))
666 {
667 return $this->db->escape_string($str);
668 }
669 }
670 return addslashes($str);
671 }
672 }
673
674 // ###################################################################
675 /**
676 * Runs through all of the input data and sanitizes it.
677 *
678 * @access public
679 */
680 function exec_sanitize_data()
681 {
682 $this->in = $this->_sanitize_input_recursive(array_merge($_GET, $_POST, $_COOKIE));
683 }
684
685 // ###################################################################
686 /**
687 * Sanitize function for something other than a string (which
688 * everything is sanitized for if you use exec_sanitize_data(). Cleaned
689 * data is placed back into $isso->in; this makes it so you don't have
690 * to constantly intval() [etc.] data.
691 *
692 * @access public
693 *
694 * @param array Array of elements to clean as varname => type
695 */
696 function input_clean_array($vars)
697 {
698 foreach ($vars AS $varname => $type)
699 {
700 $this->input_clean($varname, $type);
701 }
702 }
703
704 // ###################################################################
705 /**
706 * Sanitize function that does a single variable as oppoesd to an array
707 * (see input_clean_array() for more details)
708 *
709 * @access public
710 *
711 * @param string Variable name in $isso->in[]
712 * @param integer Sanitization type constant
713 */
714 function input_clean($varname, $type)
715 {
716 if (isset($this->in["$varname"]))
717 {
718 $this->in["$varname"] = $this->clean($this->in["$varname"], $type);
719 }
720 else
721 {
722 $this->in["$varname"] = null;
723 }
724 }
725
726 // ###################################################################
727 /**
728 * Cleaning function that does the work for input_clean(); this is
729 * moved here so it can be used to clean things that aren't in
730 * $isso->in[]
731 *
732 * @access public
733 *
734 * @param mixed Data
735 * @param integer Sanitization type constant
736 *
737 * @return mixed Cleaned data
738 */
739 function clean($value, $type)
740 {
741 if ($type == TYPE_INT)
742 {
743 $value = intval($value);
744 }
745 else if ($type == TYPE_UINT)
746 {
747 $value = abs(intval($value));
748 }
749 else if ($type == TYPE_FLOAT)
750 {
751 $value = floatval($value);
752 }
753 else if ($type == TYPE_BOOL)
754 {
755 $value = (bool)$value;
756 }
757 else if ($type == TYPE_STR)
758 {
759 $value = $value;
760 }
761 else if ($type == TYPE_STRUN)
762 {
763 $value = $this->unsanitize($value);
764 }
765 else if ($type == TYPE_NOCLEAN)
766 {
767 $value = $value;
768 }
769 else
770 {
771 trigger_error('Invalid clean type `' . $type . '` specified', E_USER_ERROR);
772 }
773
774 return $value;
775 }
776
777 // ###################################################################
778 /**
779 * Checks to see if a POST refer is actually from us
780 *
781 * @access public
782 */
783 function exec_referer_check()
784 {
785 if ($_SERVER['REQUEST_METHOD'] == 'POST')
786 {
787 $host = ($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_ENV['HTTP_HOST'];
788
789 if ($host AND $_SERVER['HTTP_REFERER'])
790 {
791 $parts = parse_url($_SERVER['HTTP_REFERER']);
792 $ourhost = $parts['host'] . (($parts['port']) ? ":$parts[port]" : '');
793
794 if ($ourhost != $host)
795 {
796 trigger_error('No external hosts are allowed to POST to this application', E_USER_ERROR);
797 }
798 $this->debug('remote post check = ok');
799 }
800 else
801 {
802 $this->debug('remote post check = FAILED');
803 }
804 }
805 }
806
807 // ###################################################################
808 /**
809 * Constructs a debug information box that contains various debugging
810 * information points
811 *
812 * @access public
813 *
814 * @param bool Show template information?
815 *
816 * @return string Debugging block
817 */
818 function construct_debug_block($dotemplates)
819 {
820 $debug = '';
821
822 if ($this->debug)
823 {
824 $debug = "\n<ul>";
825
826 // templates
827 if ($dotemplates)
828 {
829 // both template and template_fs are viable, so we need to determine the right one
830 if ($this->is_loaded('template'))
831 {
832 $tpl_obj =& $this->modules['template'];
833 }
834 else if ($this->is_loaded('template_fs'))
835 {
836 $tpl_obj =& $this->modules['template_fs'];
837 }
838 else
839 {
840 $tpl_obj = null;
841 }
842
843 $optlist = array();
844 $usage = array();
845 foreach ($tpl_obj->usage AS $name => $count)
846 {
847 if (in_array($name, $tpl_obj->uncached))
848 {
849 $optlist[] = $name . '[' . $count . ']';
850 }
851 $usage[] = $name . " ($count)";
852 }
853
854 $sizeof = sizeof($tpl_obj->uncached);
855 if ($sizeof > 0)
856 {
857 $debug .= "\n\t<li><strong style=\"color: red\">Uncached Template(s):</strong> $sizeof ( " . implode(' &nbsp; ', $optlist) . " )</li>";
858 }
859 }
860
861 // source control
862 $scinfo = 'Not Under Source Control';
863 if (defined('SVN'))
864 {
865 $scinfo = constant('SVN');
866
867 if ($test == '$' . 'Id: $')
868 {
869 $scinfo = 'Not Under Source Control';
870 }
871 else
872 {
873 $scinfo = preg_replace('#\$' . '(Head)?URL: (.+?) \$#e', "end(explode('/', '\\2'))", $scinfo);
874 $scinfo = preg_replace('#\$' . '(LastModified)?Revision: (.+?) \$#', 'SVN \\2', $scinfo);
875 $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);
876 }
877 }
878
879 $scinfo = trim($scinfo);
880 $debug .= "\n\t<li><strong>Source Control:</strong> $scinfo</li>";
881
882 // query information
883 if (is_object($this->modules['db_mysql']))
884 {
885 $debug .= "\n\t<li><strong>Total Queries:</strong> " . sizeof($this->modules['db_mysql']->history) . " (<a href=\"" . $this->sanitize($_SERVER['REQUEST_URI']) . ((strpos($_SERVER['REQUEST_URI'], '?') !== false) ? '&amp;query=1' : '?query=1') . "\">?</a>)</li>";
886 }
887
888 // total execution time
889 if (defined('ISSO_MT_START'))
890 {
891 $this->registry->load('functions', 'functions');
892 $debug .= "\n\t<li><strong>Total Execution Time:</strong> " . round($this->modules['functions']->fetch_microtime_diff(ISSO_MT_START), 10) . "</li>";
893 }
894
895 // debug notices
896 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Debug Notices (" . sizeof($this->debuginfo) . ")</option>";
897 foreach ((array)$this->debuginfo AS $msg)
898 {
899 $debug .= "\n\t\t\t<option>--- $msg</option>";
900 }
901 $debug .= "\n\t\t</select>\n\t</li>";
902
903 // loaded modules
904 $modules = $this->show_modules(true);
905 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Loaded Modules (" . sizeof($modules) . ")</option>";
906 foreach ($modules AS $mod)
907 {
908 $debug .= "\n\t\t\t<option>--- $mod</option>";
909 }
910 $debug .= "\n\t\t</select>\n\t</li>";
911
912 // template usage
913 if ($dotemplates)
914 {
915 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Template Usage (" . array_sum($tpl_obj->usage) . ")</option>";
916 foreach ($usage AS $tpl)
917 {
918 $debug .= "\n\t\t\t<option>--- $tpl</option>";
919 }
920 $debug .= "\n\t\t</select>\n\t</li>";
921 }
922
923 $debug .= "\n</ul>";
924
925 $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";
926 }
927
928 return $debug;
929 }
930 }
931
932 /*=====================================================================*\
933 || ###################################################################
934 || # $HeadURL$
935 || # $Id$
936 || ###################################################################
937 \*=====================================================================*/
938 ?>