From 2fd7b8e99925f934097408f0952162c95e39712b Mon Sep 17 00:00:00 2001 From: cajus Date: Fri, 25 Jul 2008 07:01:29 +0000 Subject: [PATCH] Fixed problem with non set config objects git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12038 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_plugin.inc | 4 ++-- gosa-core/include/functions.inc | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index b5952180d..8c8ca1dca 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -180,7 +180,7 @@ class plugin /* Set the template flag according to the existence of objectClass gosaUserTemplate */ if (isset($this->attrs['objectClass'])){ - if (in_array ("gosaUserTemplate", $this->attrs['objectClass'])){ + if (in_array_ics ("gosaUserTemplate", $this->attrs['objectClass'])){ $this->is_template= TRUE; @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "found", "Template check"); @@ -273,7 +273,7 @@ class plugin /* Remove objectClasses from entry */ $ldap->cd($this->dn); $this->attrs= array(); - $this->attrs['objectClass']= array_remove_entries($this->objectclasses,$oc); + $this->attrs['objectClass']= array_remove_entries_ics($this->objectclasses,$oc); /* Unset attributes from entry */ foreach ($this->attributes as $val){ diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 4354fdaea..b8825130b 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -231,7 +231,11 @@ function get_template_path($filename= '', $plugin= FALSE, $path= "") global $config, $BASE_DIR; /* Set theme */ - $theme= $config->get_cfg_value("theme", "default"); + if (isset ($config)){ + $theme= $config->get_cfg_value("theme", "default"); + } else { + $theme= "default"; + } /* Return path for empty filename */ if ($filename == ''){ @@ -289,6 +293,21 @@ function array_remove_entries($needles, $haystack) } +function array_remove_entries_ics($needles, $haystack) +{ + $tmp= array(); + + /* Loop through entries to be removed */ + foreach ($haystack as $entry){ + if (!in_array_ics($entry, $needles)){ + $tmp[]= $entry; + } + } + + return ($tmp); +} + + function gosa_array_merge($ar1,$ar2) { if(!is_array($ar1) || !is_array($ar2)){ @@ -2652,7 +2671,7 @@ function remove_objectClass($classes, &$attrs) $tmp= array(); foreach ($attrs['objectClass'] as $oc) { foreach ($list as $class){ - if ($oc != $class){ + if (strtolower($oc) != strtolower($class)){ $tmp[]= $oc; } } -- 2.30.2