From 855655931d43e6ee2619b84410321f92c321617c Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 17 Mar 2011 11:43:09 +0100 Subject: [PATCH] set lib.doctrine = NULL to use php's include path, thx to jahir --- htdocs/backend.php | 2 +- lib/Util/ClassLoader.php | 6 +++--- lib/Util/Configuration.php | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/backend.php b/htdocs/backend.php index 262b110..1eaa4a8 100644 --- a/htdocs/backend.php +++ b/htdocs/backend.php @@ -43,7 +43,7 @@ require_once VZ_DIR . '/lib/Util/Configuration.php'; Util\Configuration::load(VZ_DIR . '/etc/volkszaehler.conf'); $classLoaders = array( - new Util\ClassLoader('Doctrine', Util\Configuration::read('lib.doctrine')), + new Util\ClassLoader('Doctrine', (is_null(Util\Configuration::read('lib.doctrine')) ? 'Doctrine' : Util\Configuration::read('lib.doctrine')), new Util\ClassLoader('Volkszaehler', VZ_DIR . '/lib') ); diff --git a/lib/Util/ClassLoader.php b/lib/Util/ClassLoader.php index b86ce07..7f194fd 100644 --- a/lib/Util/ClassLoader.php +++ b/lib/Util/ClassLoader.php @@ -47,11 +47,11 @@ class ClassLoader { * If neither a namespace nor an include path is given, the ClassLoader will * be responsible for loading all classes, thereby relying on the PHP include_path. * - * @param string $ns The namespace of the classes to load. + * @param string $namespace The namespace of the classes to load. * @param string $includePath The base include path to use. */ - public function __construct($ns = NULL, $includePath = NULL) { - $this->namespace = $ns; + public function __construct($namespace = NULL, $includePath = NULL) { + $this->namespace = $namespace; $this->includePath = $includePath; } diff --git a/lib/Util/Configuration.php b/lib/Util/Configuration.php index 3808deb..b6860d2 100644 --- a/lib/Util/Configuration.php +++ b/lib/Util/Configuration.php @@ -47,7 +47,12 @@ class Configuration { $values = self::$values; foreach ($tree as $part) { - $values = $values[$part]; + if (isset($values[$part])) { + $values = $values[$part]; + } + else { + return NULL; + } } return $values;