From: cajus Date: Fri, 21 Sep 2007 11:33:31 +0000 (+0000) Subject: Re-Checkin X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4e6a70fc61f88c0dff720a5ac10c8c3f11e9abc6;p=gosa.git Re-Checkin git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7369 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_config.inc b/include/class_config.inc index d8d28684e..da6ca0432 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -751,6 +751,46 @@ class config { return FALSE; } + + function __search(&$arr, $name, $return) + { + $return= strtoupper($return); + if (is_array($arr)){ + foreach ($arr as &$a){ + if (isset($a['CLASS']) && preg_match("/^$name$/i", $a['CLASS'])){ + return(isset($a[$return])?$a[$return]:""); + } else { + $res= $this->__search ($a, $name, $return); + if ($res != ""){ + return $res; + } + } + } + } + return (""); + } + + + function search($class, $value, $categories= "") + { + if (is_array($categories)){ + foreach ($categories as $category){ + $res= $this->__search($this->data[strtoupper($category)], $class, $value); + if ($res != ""){ + return $res; + } + } + } else { + if ($categories == "") { + return $this->__search($this->data, $class, $value); + } else { + return $this->__search($this->data[strtoupper($categories)], $class, $value); + } + } + + return (""); + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/include/functions.inc b/include/functions.inc index ba51ca911..23335677d 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -1936,30 +1936,6 @@ function array_key_ics($ikey, $items) } -function search_config(&$arr, $name, $return) -{ - $lname= strtolower($name); - if (is_array($arr)){ - foreach ($arr as $a){ - if (isset($a['CLASS']) && strtolower($a['CLASS']) == $lname){ - - if (isset($a[$return])){ - return ($a[$return]); - } else { - return (""); - } - } else { - $res= search_config ($a, $name, $return); - if ($res != ""){ - return $res; - } - } - } - } - return (""); -} - - function array_differs($src, $dst) { /* If the count is differing, the arrays differ */