expanding the autoload function to enable it to step through the registered modules to find old naming shema classes.

This is due to a bug in felamimail, when typing an address, the auto completion produces an XML Error, because the
socontacts_sql class is not found. 
The problem may be resolved by another method, the solution provided here is probably not wanted, for proper style reasons, 
and will not solve all possible autoload problems.
This commit is contained in:
Klaus Leithoff 2008-01-11 12:33:17 +00:00
parent 835bf3050d
commit 2aa82e48ff

View File

@ -1306,8 +1306,9 @@
*/ */
function __autoload($class) function __autoload($class)
{ {
list($app,$baseclass) = explode('_',$class); $components = explode('_',$class);
$app =array_shift($components);
$baseclass = implode('_', $components);
// classes using the new naming schema app_class_name, eg. admin_cmd // classes using the new naming schema app_class_name, eg. admin_cmd
if (file_exists($file = EGW_INCLUDE_ROOT.'/'.$app.'/inc/class.'.$class.'.inc.php') || if (file_exists($file = EGW_INCLUDE_ROOT.'/'.$app.'/inc/class.'.$class.'.inc.php') ||
// classes using the new naming schema app_class_name, eg. admin_cmd // classes using the new naming schema app_class_name, eg. admin_cmd
@ -1323,6 +1324,13 @@ function __autoload($class)
{ {
//error_log("autoloaded class $class from $file"); //error_log("autoloaded class $class from $file");
include_once($file); include_once($file);
} else {
foreach($GLOBALS['egw_info']['apps'] as $lapp=>$appvalue){
if (file_exists($file = EGW_INCLUDE_ROOT.'/'.$lapp.'/inc/class.'.$class.'.inc.php')){
#echo "$lapp,$class<br>";
include_once($file);
}
}
} }
} }