X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_servRepositorySetup.inc;h=6bbfb43483c57af16ed7b8474d89d583fb634d95;hb=d59800c1cb10d2d61ac402e4e4e5253a19810a02;hp=538fed150ed2b7748e4c5ce1542a7ff6cbcc2d6d;hpb=3cfea2bff34eb4b8311377b84768d00e6d579a53;p=gosa.git diff --git a/plugins/admin/systems/class_servRepositorySetup.inc b/plugins/admin/systems/class_servRepositorySetup.inc index 538fed150..6bbfb4348 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) { @@ -60,7 +61,24 @@ class servRepositorySetup extends plugin $smarty= get_smarty(); if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){ - $this->Sections[$_POST['SectionName']]=$_POST['SectionName']; + + /* Replace multiple spaces with a single, and cut of white spaces (trim)*/ + $val = preg_replace("/\ \ * /" , " ", trim($_POST['SectionName'])); + + /* check if there are more than one entry given ( "section1 section2 )*/ + if(preg_match("/ /",$val)){ + + /* Generate list of new section names */ + $vals = split(" ",$val); + + /* Add new entries */ + foreach($vals as $entry){ + $entry = trim($entry); + $this->Sections[$entry]=$entry; + } + }else{ + $this->Sections[$val]=$val; + } } foreach($_POST as $name => $value){ @@ -111,7 +129,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 +162,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]; } @@ -159,19 +179,26 @@ class servRepositorySetup extends plugin function GetHookElements() { $ret = array(); - $cmd= search_config($this->config->data['TABS'], "servrepository", "EXTERNAL_HOOK"); + $cmd= search_config($this->config->data['TABS'], "servrepository", "REPOSITORY_HOOK"); if(!empty($cmd)){ $res = shell_exec($cmd); + $res2 = trim($res); if(!$res){ - print_red(sprintf(_("Can't execute specified '%s' please check your gosa.conf."),$cmd)); - }else{ + print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s'. Please check your gosa.conf."),$cmd)); + }elseif(empty($res2)){ + print_red(sprintf(_("The specified REPOSITORY_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)) || (!preg_match("/:/",$hook))) continue; - - $hookinfo = split(":",$hook); - $ret[$hookinfo[1]] = $hookinfo[0]; + if(empty($hook)) continue; + + if(preg_match("/;/",$hook)){ + $hookinfo = split(";",$hook); + $ret[$hookinfo[0]] = $hookinfo[0]; + }else{ + $ret[$hook] = $hook; + } } } }