X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_config.inc;h=6dd0527b8a45e7755245a8970ae7d97ea7a8e744;hb=4b3498ae8e78a11c7c99663d45bab6a0a14df052;hp=e47586ff8667ceca6b3495beee7b7efa56a875a0;hpb=3cab42f378c95a0ee58ef0cb62dea7baaced83ff;p=gosa.git diff --git a/gosa-core/include/class_config.inc b/gosa-core/include/class_config.inc index e47586ff8..6dd0527b8 100644 --- a/gosa-core/include/class_config.inc +++ b/gosa-core/include/class_config.inc @@ -84,8 +84,6 @@ class config { $tmp = stat("../include/class_location.inc"); session::global_set("class_location.inc:timestamp",$tmp['mtime']); - - if($this->filename != "" && filemtime($this->filename) != $this->last_modified){ $this->config_found= FALSE; @@ -99,6 +97,7 @@ class config { xml_set_object($this->parser, $this); xml_set_element_handler($this->parser, "tag_open", "tag_close"); $this->parse($this->filename); + $this->set_current($this->current['NAME']); } } @@ -109,7 +108,6 @@ class config { $this->data = array( "TABS" => array(), "LOCATIONS" => array(), - "SERVERS" => array(), "MAIN" => array(), "MENU" => array(), "SERVICE" => array()); @@ -240,7 +238,15 @@ class config { function get_credentials($creds) { if (isset($_SERVER['HTTP_GOSA_KEY'])){ - return (cred_decrypt($creds, $_SERVER['HTTP_GOSA_KEY'])); + if (!session::global_is_set('HTTP_GOSA_KEY_CACHE')){ + session::global_set('HTTP_GOSA_KEY_CACHE',array()); + } + $cache = session::global_get('HTTP_GOSA_KEY_CACHE'); + if(!isset($cache[$creds])){ + $cache[$creds] = cred_decrypt($creds, $_SERVER['HTTP_GOSA_KEY']); + session::global_set('HTTP_GOSA_KEY_CACHE',$cache); + } + return ($cache[$creds]); } return ($creds); } @@ -524,12 +530,12 @@ class config { $ldap->search ("(objectClass=goLogDBServer)"); if ($ldap->count()){ $attrs= $ldap->fetch(); - if(!isset($attrs['goLogDB'][0])){ - $attrs['goLogDB'][0] = "gomon"; + if(!isset($attrs['gosaLogDB'][0])){ + $attrs['gosaLogDB'][0] = "gomon"; } $this->data['SERVERS']['LOG']= array( 'SERVER' => $attrs['cn'][0], 'LOGIN' => $attrs['goLogAdmin'][0], - 'DB' => $attrs['goLogDB'][0], + 'DB' => $attrs['gosaLogDB'][0], 'PASSWORD' => $attrs['goLogPassword'][0]); } @@ -999,6 +1005,63 @@ class config { return(TRUE); } } + + /* Returns true if snapshots are enabled, and false if it is disalbed + There will also be some errors psoted, if the configuration failed */ + function snapshotEnabled() + { + if($this->get_cfg_value("enableSnapshots") == "true"){ + + /* Check if the snapshot_base is defined */ + if ($this->get_cfg_value("snapshotBase") == ""){ + + /* Send message if not done already */ + if(!session::is_set("snapshotFailMessageSend")){ + session::set("snapshotFailMessageSend",TRUE); + msg_dialog::display(_("Configuration error"), + sprintf(_("The snapshot functionality is enabled, but the required variable '%s' is not set."), + "snapshotBase"), ERROR_DIALOG); + } + return(FALSE); + } + + /* Check if the snapshot_base is defined */ + if (!is_callable("gzcompress")){ + + /* Send message if not done already */ + if(!session::is_set("snapshotFailMessageSend")){ + session::set("snapshotFailMessageSend",TRUE); + msg_dialog::display(_("Configuration error"), + sprintf(_("The snapshot functionality is enabled, but the required compression module is missing. Please install '%s'."),"php5-zip / php5-gzip"), ERROR_DIALOG); + } + return(FALSE); + } + + /* check if there are special server configurations for snapshots */ + if ($this->get_cfg_value("snapshotURI") != ""){ + + /* check if all required vars are available to create a new ldap connection */ + $missing = ""; + foreach(array("snapshotURI","snapshotAdminDn","snapshotAdminPassword","snapshotBase") as $var){ + if($this->get_cfg_value($var) == ""){ + $missing .= $var." "; + + /* Send message if not done already */ + if(!session::is_set("snapshotFailMessageSend")){ + session::set("snapshotFailMessageSend",TRUE); + msg_dialog::display(_("Configuration error"), + sprintf(_("The snapshot functionality is enabled, but the required variable '%s' is not set."), + $missing), ERROR_DIALOG); + } + return(FALSE); + } + } + } + return(TRUE); + } + return(FALSE); + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: