From: cajus Date: Wed, 16 Jan 2008 16:12:10 +0000 (+0000) Subject: Made loading of xml file more tolerant X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=344a6a0362a6073ba639203b0dc6af354e458d7c;p=gosa.git Made loading of xml file more tolerant git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8403 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_pluglist.inc b/gosa-core/include/class_pluglist.inc index 1bce72412..87dcd7693 100644 --- a/gosa-core/include/class_pluglist.inc +++ b/gosa-core/include/class_pluglist.inc @@ -114,9 +114,11 @@ class pluglist { if(count($this->headlines) == 0){ foreach($this->config->data['MENU'] as $headline => $plugins){ foreach( $plugins as $id => $plug){ - $attrs = (get_class_vars($plug['CLASS'])); - $ret[$id]['HEADLINE'] = $headline; - $ret[$id]['NAME'] = $attrs['plHeadline']; + if (plugin_available($plug['CLASS'])){ + $attrs = (get_class_vars($plug['CLASS'])); + $ret[$id]['HEADLINE'] = $headline; + $ret[$id]['NAME'] = $attrs['plHeadline']; + } } } $this->headlines = $ret; @@ -150,6 +152,9 @@ class pluglist { msg_dialog::display(_("Configuration error"), _("The configuration format has changed. Please re-run setup!"), ERROR_DIALOG); display_error_page(); } + if (!plugin_available($info['CLASS'])){ + continue; + } $vars= get_class_vars($info['CLASS']); $plHeadline= $vars['plHeadline']; $plDescription= $vars['plDescription']; @@ -259,6 +264,10 @@ class pluglist { foreach ($plug as $info){ + if (!plugin_available($info['CLASS'])){ + continue; + } + /* Read information from class variable */ $vars= get_class_vars($info['CLASS']); $plHeadline= $vars['plHeadline']; diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 3ab7a4053..b1123007d 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -96,11 +96,26 @@ function __autoload($class_name) { if (isset($class_mapping[$class_name])){ require_once($BASE_DIR."/".$class_mapping[$class_name]); } else { - echo _("Fatal: cannot load class \"$class_name\" - execution aborted"); + echo sprintf(_("Fatal error: cannot load class '%s' - execution aborted"), $class_name); + print_a(debug_backtrace()); + exit; } } +/* Check if plugin is avaliable */ +function plugin_available($plugin) +{ + global $class_mapping, $BASE_DIR; + + if (!isset($class_mapping[$plugin])){ + return false; + } else { + return file_exists($BASE_DIR."/".$class_mapping[$plugin]); + } +} + + /* Create seed with microseconds */ function make_seed() { list($usec, $sec) = explode(' ', microtime());