index 5f3d8ceb56b0c281fe144fbd073d6a04109b6c5d..036872656097e5a8e376521e14ff64081267e1d1 100644 (file)
--- a/include/class_config.inc
+++ b/include/class_config.inc
/* 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= "";
}
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'){
function load_servers ()
{
/* Only perform actions if current is set */
- if ($this->current == NULL){
+ if ($this->current === NULL){
return;
}
"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']);
'DB' => $attrs['goGlpiDatabase'][0]);
}
+
/* Get logdb server */
$ldap->cd ($this->current['BASE']);
$ldap->search ("(objectClass=goLogDBServer)");
'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 */
$depth ++;
/* Walk through array */
+ ksort($arr);
foreach($arr as $name => $entries){
/* If this department is the last in the current tree position
if(isset($entries['ENTRY'])){
$a = "";
for($i = 0 ; $i < $depth ; $i ++){
- $a.=" ";
+ $a.=".";
}
$ret[$entries['ENTRY']]=$a." ".$name;
}
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: