X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_config.inc;h=036872656097e5a8e376521e14ff64081267e1d1;hb=bc81ccefd133ead30e4d43c2be5896df4fb89486;hp=5f3d8ceb56b0c281fe144fbd073d6a04109b6c5d;hpb=c90644e2298d8362789937e4c4e59b6be8ed26c4;p=gosa.git diff --git a/include/class_config.inc b/include/class_config.inc index 5f3d8ceb5..036872656 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -38,7 +38,7 @@ class config { /* Configuration data */ var $data= array( 'TABS' => array(), 'LOCATIONS' => array(), 'SERVERS' => array(), - 'MAIN' => array( 'LANGUAGES' => array(), 'FAXFORMATS' => array() ), + 'MAIN' => array( 'FAXFORMATS' => array() ), 'MENU' => array(), 'SERVICE' => array()); var $basedir= ""; @@ -143,15 +143,6 @@ class config { } break; - /* Handle language */ - case 'LANGUAGE': - if ($this->tags[$this->level-2] == 'MAIN'){ - /* Add languages */ - $this->data['MAIN']['LANGUAGES'][$attrs['NAME']]= - $attrs['TAG']; - } - break; - /* Handle faxformat */ case 'FAXFORMAT': if ($this->tags[$this->level-2] == 'MAIN'){ @@ -317,7 +308,7 @@ class config { function load_servers () { /* Only perform actions if current is set */ - if ($this->current == NULL){ + if ($this->current === NULL){ return; } @@ -336,7 +327,7 @@ class config { "sieve_server" => $attrs['goImapSieveServer'][0], "sieve_port" => $attrs['goImapSievePort'][0]); } - error_reporting(E_ALL); + error_reporting(E_ALL | E_STRICT); /* Get kerberos server. FIXME: only one is supported currently */ $ldap->cd ($this->current['BASE']); @@ -421,6 +412,7 @@ class config { 'DB' => $attrs['goGlpiDatabase'][0]); } + /* Get logdb server */ $ldap->cd ($this->current['BASE']); $ldap->search ("(objectClass=goLogDBServer)"); @@ -431,18 +423,20 @@ class config { 'PASSWORD' => $attrs['goLogPassword'][0]); } - /* Logging databases */ - $this->data['SERVERS']['LOGGING']= - array("testserver1" => - array( - "SERVER" => "localhost", - "USER" => "gosa_log", - "PWD" => "tester", - "DB" => "gosa_log" - ) - ); - + /* GOsa logging databases */ + $ldap->cd ($this->current['BASE']); + $ldap->search ("(objectClass=gosaLogServer)"); + if ($ldap->count()){ + while($attrs= $ldap->fetch()){ + $this->data['SERVERS']['LOGGING'][$attrs['cn'][0]]= + array( + 'DN' => $attrs['dn'], + 'USER' => $attrs['goLogDBUser'][0], + 'DB' => $attrs['goLogDB'][0], + 'PWD' => $attrs['goLogDBPassword'][0]); + } + } /* Get NFS server lists */ @@ -641,6 +635,7 @@ class config { $depth ++; /* Walk through array */ + ksort($arr); foreach($arr as $name => $entries){ /* If this department is the last in the current tree position @@ -661,7 +656,7 @@ class config { if(isset($entries['ENTRY'])){ $a = ""; for($i = 0 ; $i < $depth ; $i ++){ - $a.=" "; + $a.="."; } $ret[$entries['ENTRY']]=$a." ".$name; } @@ -756,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']) && strcasecmp($name, $a['CLASS']) == 0){ + 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: