X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_config.inc;h=92c87511716d8da745d968cd700fa5d413b3c131;hb=382443db9d291ebe40f97a94534a0913f7c0a6ef;hp=9e4339de70665980af724772df30c415ed2cafdd;hpb=37365c4bde464fd3fe7c34576b321aa42f0b3f8e;p=gosa.git diff --git a/include/class_config.inc b/include/class_config.inc index 9e4339de7..92c875117 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( 'FAXFORMATS' => array() ), + 'MAIN' => array(), 'MENU' => array(), 'SERVICE' => array()); var $basedir= ""; @@ -47,6 +47,8 @@ class config { var $idepartments= array(); var $adepartments= array(); var $tdepartments= array(); + var $filename = ""; + var $last_modified = 0; function config($filename, $basedir= "") { @@ -62,16 +64,47 @@ class config { } } + + function check_and_reload() + { + if($this->filename != "" && filemtime($this->filename) != $this->last_modified){ + + $this->config_found= FALSE; + $this->tags= array(); + $this->level= 0; + $this->gpc= 0; + $this->section= ""; + $this->currentLocation= ""; + + $this->parser = xml_parser_create(); + xml_set_object($this->parser, $this); + xml_set_element_handler($this->parser, "tag_open", "tag_close"); + $this->parse($this->filename); + if(isset($_SESSION['plist'])){ + unset($_SESSION['plist']); + } + if(isset($_SESSION['plug'])){ + unset($_SESSION['plug']); + } + if(isset($_GET['plug'])){ + unset($_GET['plug']); + } + } + } + + function parse($filename) { + $this->last_modified = filemtime($filename); + $this->filename = $filename; $fh= fopen($filename, "r"); $xmldata= fread($fh, 100000); fclose($fh); if(!xml_parse($this->parser, chop($xmldata))){ - print_red(sprintf(_("XML error in gosa.conf: %s at line %d"), + $msg = sprintf(_("XML error in gosa.conf: %s at line %d"), xml_error_string(xml_get_error_code($this->parser)), - xml_get_current_line_number($this->parser))); - echo $_SESSION['errors']; + xml_get_current_line_number($this->parser)); + msg_dialog::display(_("Config file parsing"), $msg, FATAL_ERROR_DIALOG); exit; } } @@ -143,14 +176,6 @@ class config { } break; - /* Handle faxformat */ - case 'FAXFORMAT': - if ($this->tags[$this->level-2] == 'MAIN'){ - /* Add fax formats */ - $this->data['MAIN']['FAXFORMATS'][]= $attrs['TYPE']; - } - break; - /* Load main parameters */ case 'MAIN': $this->data['MAIN']= array_merge ($this->data['MAIN'], $attrs); @@ -315,19 +340,34 @@ class config { /* Fill imap servers */ $ldap= $this->get_ldap_link(); $ldap->cd ($this->current['BASE']); - $ldap->search ("(objectClass=goImapServer)"); + if (!isset($this->current['MAILMETHOD'])){ + $this->current['MAILMETHOD']= ""; + } + if ($this->current['MAILMETHOD'] == ""){ + $ldap->search ("(objectClass=goMailServer)", array('cn')); + $this->data['SERVERS']['IMAP']= array(); + error_reporting(0); + while ($attrs= $ldap->fetch()){ + $name= $attrs['cn'][0]; + $this->data['SERVERS']['IMAP'][$name]= $name; + } + error_reporting(E_ALL); + } else { + $ldap->search ("(objectClass=goImapServer)", array('goImapName', 'goImapConnect', 'goImapAdmin', 'goImapPassword', + 'goImapSieveServer', 'goImapSievePort')); - $this->data['SERVERS']['IMAP']= array(); - error_reporting(0); - while ($attrs= $ldap->fetch()){ - $name= $attrs['goImapName'][0]; - $this->data['SERVERS']['IMAP'][$name]= array( "connect" => $attrs['goImapConnect'][0], - "admin" => $attrs['goImapAdmin'][0], - "password" => $attrs['goImapPassword'][0], - "sieve_server" => $attrs['goImapSieveServer'][0], - "sieve_port" => $attrs['goImapSievePort'][0]); - } - error_reporting(E_ALL | E_STRICT); + $this->data['SERVERS']['IMAP']= array(); + error_reporting(0); + while ($attrs= $ldap->fetch()){ + $name= $attrs['goImapName'][0]; + $this->data['SERVERS']['IMAP'][$name]= array( "connect" => $attrs['goImapConnect'][0], + "admin" => $attrs['goImapAdmin'][0], + "password" => $attrs['goImapPassword'][0], + "sieve_server" => $attrs['goImapSieveServer'][0], + "sieve_port" => $attrs['goImapSievePort'][0]); + } + error_reporting(E_ALL); + } /* Get kerberos server. FIXME: only one is supported currently */ $ldap->cd ($this->current['BASE']);