X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_config.inc;h=17b860c58386189fc00acba33f58227ca1acbe9d;hb=652bb3908381dd238ce5bc023203ec8d67ae7bff;hp=c11a7dbbfcfb596362cf685c938e12dd31b3db00;hpb=65ebaf35d1b6ee57beb5cc7285d5766b22bdc320;p=gosa.git diff --git a/gosa-core/include/class_config.inc b/gosa-core/include/class_config.inc index c11a7dbbf..17b860c58 100644 --- a/gosa-core/include/class_config.inc +++ b/gosa-core/include/class_config.inc @@ -64,6 +64,8 @@ class config { var $filename = ""; var $last_modified = 0; + private $jsonRPChandle = NULL; + public $configRegistry = NULL; /*! \brief Class constructor of the config class @@ -251,6 +253,10 @@ class config { $this->data['PATHMENU']= array(); ; break; + case 'SHORTCUTMENU': + $this->data['SHORTCUTMENU']= array(); ; + break; + /* Inser plugins */ case 'PLUGIN': if ($this->tags[$this->level-3] == 'MENU' && @@ -261,6 +267,9 @@ class config { if ($this->tags[$this->level-2] == 'PATHMENU'){ $this->data['PATHMENU'][$this->gpc++]= $attrs; } + if ($this->tags[$this->level-2] == 'SHORTCUTMENU'){ + $this->data['SHORTCUTMENU'][$this->gpc++]= $attrs; + } if ($this->tags[$this->level-2] == 'SERVICEMENU'){ $this->data['SERVICE'][$attrs['CLASS']]= $attrs; } @@ -295,6 +304,16 @@ class config { } + function getRpcHandle() + { + // Create jsonRPC handle on demand. + if(!$this->jsonRPChandle){ + $this->jsonRPChandle = new jsonRPC($this); + } + return($this->jsonRPChandle); + } + + /*! \brief Get a LDAP link object * * This function can be used to get an ldap object, which in turn can @@ -334,8 +353,8 @@ class config { } if (!session::global_is_set('size_limit')){ - session::global_set('size_limit',$this->current['LDAPSIZELIMIT']); - session::global_set('size_ignore',$this->current['LDAPSIZEIGNORE']); + session::global_set('size_limit', $this->get_cfg_value('core', 'ldapSizelimit')); + session::global_set('size_ignore', $this->boolValueIsTrue('core', 'ldapSizeIgnore')); } } @@ -866,7 +885,7 @@ class config { */ function getShareList($listboxEntry = false) { - $tmp = get_sub_list("(&(objectClass=goShareServer)(goExportEntry=*))","server",get_ou("serverRDN"), + $tmp = get_sub_list("(&(objectClass=goShareServer)(goExportEntry=*))","server",get_ou("servgeneric", "serverRDN"), $this->current['BASE'],array("goExportEntry","cn"), GL_NONE); $return =array(); foreach($tmp as $entry){ @@ -908,7 +927,7 @@ class config { $ui = get_userinfo(); $base = $config->current['BASE']; $res= get_sub_list("(&(objectClass=goShareServer)(goExportEntry=*))", "server", - get_ou("serverRDN"), $base,array("goExportEntry","cn"),GL_NONE | GL_NO_ACL_CHECK); + get_ou("servgeneric", "serverRDN"), $base,array("goExportEntry","cn"),GL_NONE | GL_NO_ACL_CHECK); foreach($res as $entry){ @@ -974,7 +993,9 @@ class config { } - /*! Search for a configuration setting in different categories + /*! Outdated - try to use pluginEnabled, boolValueIsTrue or get_cfg_value instead. + * + * (Search for a configuration setting in different categories * * Searches for the value of a given key in the configuration data. * Optionally the list of categories to search (tabs, main, locations) can @@ -984,6 +1005,7 @@ class config { * \code * $postcmd = $this->config->search(get_class($this), "POSTCOMMAND", array("menu", "tabs")); * \endcode + * ) * * */ function search($class, $value, $categories= "") @@ -1006,6 +1028,14 @@ class config { return (""); } + + /*! \brief Check whether a plugin is activated or not + */ + function pluginEnabled($class){ + $tmp = $this->search($class, "CLASS",array('menu','tabs')); + return(!empty($tmp)); + } + /*! \brief Get a configuration value from the config * @@ -1022,28 +1052,30 @@ class config { * * */ - function get_cfg_value($class,$name, $default= "") + function get_cfg_value($class,$name, $default= NULL) { + // The default parameter is deprecated + if($default != NULL){ +# trigger_error("Third parameter 'default' is deprecated for function 'get_cfg_value'!"); + } + // Return the matching property value if it exists. if($this->configRegistry->propertyExists($class,$name)){ return($this->configRegistry->getPropertyValue($class,$name)); } - syslog(1, $name); - - $name= strtoupper($name); - - /* Check if we have a current value for $name */ - if (isset($this->current[$name])){ - return ($this->current[$name]); - } - - /* Check if we have a global value for $name */ - if (isset($this->data["MAIN"][$name])){ - return ($this->data["MAIN"][$name]); + // Show a warning in the syslog if there is an undefined property requested. + if($this->configRegistry->propertyInitializationComplete() && + "{$class}::{$name}" != 'core::config' && // <--- This on is never set, only in gosa.conf. + "{$class}::{$name}" != 'core::logging'){ // <--- This one may cause endless recursions in class_log.inc + new log("debug","","Unconfigured property: '{$class}::{$name}'",array(),''); } - return ($default); + // Try to find the property in the config file directly. + $name= strtoupper($name); + if (isset($this->current[$name])) return ($this->current[$name]); + if (isset($this->data["MAIN"][$name])) return ($this->data["MAIN"][$name]); + return (""); }