diff --git a/class2.php b/class2.php index 04c465b8d..f6613d6f5 100644 --- a/class2.php +++ b/class2.php @@ -9,8 +9,8 @@ * General purpose file * * $Source: /cvs_backup/e107_0.8/class2.php,v $ -* $Revision: 1.149 $ -* $Date: 2009-10-01 15:05:41 $ +* $Revision: 1.150 $ +* $Date: 2009-10-20 16:00:38 $ * $Author: secretr $ * */ @@ -879,7 +879,7 @@ if (!function_exists('checkvalidtheme')) $sql->db_Mark_Time('Start: Misc Setup'); //------------------------------------------------------------------------------------------------------------------------------------// -if (!class_exists('e107table')) +if (!class_exists('e107table', false)) { class e107table { @@ -1248,11 +1248,11 @@ else define('e_REFERER_SELF', FALSE); } -//BC, DEPRECATED - use e107::getDateConvert() -if (!class_exists('convert')) +//BC, DEPRECATED - use e107::getDateConvert(), catched by __autoload as well +/*if (!class_exists('convert')) { require_once(e_HANDLER.'date_handler.php'); -} +}*/ //@require_once(e_HANDLER."IPB_int.php"); //@require_once(e_HANDLER."debug_handler.php"); @@ -2099,18 +2099,38 @@ function plugInstalled($plugname) return isset($pref['plug_installed'][$plugname]);*/ } -function __autoload($className) { +/** + * Magic autoload + * TODO - move to spl_autoload[_*] some day (PHP5 > 5.1.2) + * @param string $className + * @return void + */ +function __autoload($className) +{ + //Security... + if (strpos($className, '/') !== false) + { + return; + } $tmp = explode('_', $className); - //TODO: Make it support core classes in e107_handlers - if('plugin' !== $tmp[0]) { return; } - if('plugin' == $tmp[0]) + + switch($tmp[0]) { - array_shift($tmp); - $filename = e_PLUGIN.implode('/', $tmp).'.php'; + case 'plugin': + case 'eplug_': + array_shift($tmp); + $filename = e_PLUGIN.implode('/', $tmp).'.php'; + //TODO add debug screen Auto-loaded classes - ['plugin: '.$filename.' - '.$className]; + break; + + default: //core libraries + $filename = e107::getHandlerPath($className, true); + //TODO add debug screen Auto-loaded classes - ['core: '.$filename.' - '.$className]; + break; } - else + + if($filename) { - $filename = e_HANDLER.implode('/', $tmp).'.php'; + include($filename); } - require_once($filename); -} // end __autoload +} diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php index 679c9b077..fe4ea203c 100644 --- a/e107_handlers/shortcode_handler.php +++ b/e107_handlers/shortcode_handler.php @@ -9,8 +9,8 @@ * e107 Shortcode handler * * $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $ - * $Revision: 1.33 $ - * $Date: 2009-09-25 20:15:19 $ + * $Revision: 1.34 $ + * $Date: 2009-10-20 16:00:37 $ * $Author: secretr $ */ @@ -215,9 +215,7 @@ class e_shortcode } } } - - - + /** * Register Plugin Shortcode Batch files (e_shortcode.php) for use site-wide. * Equivalent to multiple .sc files in the plugin's folder. @@ -260,6 +258,7 @@ class e_shortcode /** * Register Core Shortcode Batches. + * FIXME - currently loaded all the time (even on front-end) * @return */ function loadCoreShortcodes() @@ -392,7 +391,7 @@ class e_shortcode $_method = 'sc_'.strtolower($code); if(!isset($this->scClasses[$_class])) { - if(!class_exists($_class) && $this->registered_codes[$code]['path']) + if(!class_exists($_class, false) && $this->registered_codes[$code]['path']) { include_once($this->registered_codes[$code]['path']); }