From 5719ebab3d30ca972321520d5aca6f5c0979af75 Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 16 Jan 2008 08:09:15 +0000 Subject: [PATCH] Added missing functions git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8382 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_plugin.inc | 2 +- gosa-core/include/functions.inc | 39 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 3194ffabb..346699bad 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -1029,7 +1029,7 @@ class plugin } /* Remove tags that may already be here... */ - $this->remove_objectClass("gosaAdministrativeUnitTag", &$at); + remove_objectClass("gosaAdministrativeUnitTag", &$at); if (isset($at['gosaUnitTag'])){ unset($at['gosaUnitTag']); } diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 314a0d05f..8f45c429b 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -2555,6 +2555,45 @@ function getEntryCSN($dn) } +/* Add a given objectClass to an attrs entry */ +function add_objectClass($classes, &$attrs) +{ + if (is_array($classes)){ + $list= $classes; + } else { + $list= array($classes); + } + + foreach ($list as $class){ + $attrs['objectClass'][]= $class; + } +} + + +/* Removes a given objectClass from the attrs entry */ +function remove_objectClass($classes, &$attrs) +{ + if (isset($attrs['objectClass'])){ + /* Array? */ + if (is_array($classes)){ + $list= $classes; + } else { + $list= array($classes); + } + + $tmp= array(); + foreach ($attrs['objectClass'] as $oc) { + foreach ($list as $class){ + if ($oc != $class){ + $tmp[]= $oc; + } + } + } + $attrs['objectClass']= $tmp; + } +} + + function display_error_page() { $smarty= get_smarty(); -- 2.30.2