X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_servRepositorySetup.inc;h=24f1c92bd483a512ecdea67ecfe360e30c02a313;hb=a07e09435049ea336a78091402dab09261688d6e;hp=ddc4e1e8d21358bae33b9ea630bf86ca746720b1;hpb=914c51ff10e5b749a62c27784380164ffe5bad98;p=gosa.git diff --git a/plugins/admin/systems/class_servRepositorySetup.inc b/plugins/admin/systems/class_servRepositorySetup.inc index ddc4e1e8d..24f1c92bd 100644 --- a/plugins/admin/systems/class_servRepositorySetup.inc +++ b/plugins/admin/systems/class_servRepositorySetup.inc @@ -9,16 +9,17 @@ class servRepositorySetup extends plugin /* attribute list for save action */ var $ignore_account = TRUE; - var $attributes = array("Release","ParentServer","Url"); + var $attributes = array("Release","ParentServer","Url","cn"); var $objectclasses = array("whatever"); /* Attributes */ - var $Release =""; - var $ParentServer =""; - var $Url =""; - var $Sections =array(); - var $ParentServers =""; - var $initialy_was=false; + var $Release = ""; + var $ParentServer = ""; + var $Url = ""; + var $Sections = array(); + var $ParentServers = ""; + var $initialy_was = false; + var $cn = ""; function servRepositorySetup ($config, $dn= NULL,$data = false) { @@ -111,7 +112,8 @@ class servRepositorySetup extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if(empty($this->Release)){ $message[]=_("Please enter a value for 'release'."); @@ -143,6 +145,7 @@ class servRepositorySetup extends plugin $ldap->cd($this->config->current['BASE']); $ldap->search("(objectClass=FAIrepositoryServer)",array("*")); while($attr = $ldap->fetch()){ + if($attr['cn'][0] == $this->cn) continue; $ret[$attr['cn'][0]]= $attr['cn'][0]; } @@ -162,14 +165,24 @@ class servRepositorySetup extends plugin $cmd= search_config($this->config->data['TABS'], "servrepository", "EXTERNAL_HOOK"); if(!empty($cmd)){ $res = shell_exec($cmd); - $tmp = split("\n",$res); - foreach($tmp as $hook){ - - /* skip empty */ - if((empty($hook)) || (!preg_match("/:/",$hook))) continue; - - $hookinfo = split(":",$hook); - $ret[$hookinfo[1]] = $hookinfo[0]; + $res2 = trim($res); + if((!$res)){ + print_red(sprintf(_("Can't execute specified EXTERNAL_HOOK '%s' please check your gosa.conf."),$cmd)); + }elseif(empty($res2)){ + print_red(sprintf(_("The specified EXTERNAL_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd)); + }else{ + $tmp = split("\n",$res); + foreach($tmp as $hook){ + /* skip empty */ + if(empty($hook)) continue; + + if(preg_match("/\:/",$hook)){ + $hookinfo = split(":",$hook); + $ret[$hookinfo[1]] = $hookinfo[0]; + }else{ + $ret[$hook] = $hook; + } + } } } return($ret);