X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Ffai%2Fadmin%2Ffai%2Fclass_faiScriptEntry.inc;h=a0ba363c99bb006685447226502687eefeee6e2c;hb=9dc6ac611bbe02539e5d9326a6106f8160bc56c3;hp=a7a265eb16c6e45566795e9a724098b34bc4d06c;hpb=529006426d40019f1e5602f7eaf0d3ac276630ba;p=gosa.git diff --git a/gosa-plugins/fai/admin/fai/class_faiScriptEntry.inc b/gosa-plugins/fai/admin/fai/class_faiScriptEntry.inc index a7a265eb1..a0ba363c9 100644 --- a/gosa-plugins/fai/admin/fai/class_faiScriptEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiScriptEntry.inc @@ -20,7 +20,7 @@ class faiScriptEntry extends plugin function faiScriptEntry (&$config, $dn= NULL,$object=false) { - plugin::plugin ($config, $dn); + plugin::plugin ($config, NULL); if($dn != "new"){ $this->orig_cn= $object['cn']; $this->dn=$object['dn']; @@ -28,11 +28,6 @@ class faiScriptEntry extends plugin $oname = $name; $this->$oname=$value; } - - if(isset($this->attrs['FAIstate'][0])){ - $this->FAIstate = $this->attrs['FAIstate'][0]; - } - }else{ if(is_array($object)&&count($object)){ $this->orig_cn= $object['cn']; @@ -56,6 +51,7 @@ class faiScriptEntry extends plugin /* Fill templating stuff */ $smarty = get_smarty(); + $smarty->assign("freeze", preg_match("/freeze/i",$this->FAIstate)); $display = ""; if(isset($_POST['ImportUpload']) && $this->acl_is_writeable("FAIscript")){ @@ -82,15 +78,13 @@ class faiScriptEntry extends plugin } /* File download requested */ - if(isset($_GET['getFAIScript'])){ + if(isset($_POST['download'])){ send_binary_content(stripslashes($this->FAIscript),$this->cn.".FAIscript"); } /* Create download button*/ if($this->dn != "new" && $this->acl_is_readable("FAIscript")){ - $smarty->assign("DownMe"," - "._("Download")." - "); + $smarty->assign("DownMe", image('images/save.png','download',_("Download"))); }else{ $smarty->assign("DownMe",""); } @@ -101,10 +95,7 @@ class faiScriptEntry extends plugin $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $name => $translated){ - $acl = $this->getacl($name); - if($this->FAIstate == "freezed"){ - $acl = preg_replace("/w/","",$acl); - } + $acl = $this->getacl($name,preg_match("/freeze/i",$this->FAIstate)); $smarty->assign($name."ACL",$acl); } @@ -144,11 +135,16 @@ class faiScriptEntry extends plugin $message[] = msgPool::duplicated(_("Name")); } - if(empty($this->cn)){ + $c = trim($this->cn); + if($c == ""){ $message[] = msgPool::required(_("Name")); } + if(preg_match("/[^a-z0-9_\-]/i",$c)){ + $message[] = msgPool::invalid(_("Name"),$c,"/[a-z0-9_\-]/i"); + } - if(empty($this->FAIscript)){ + $s = trim($this->FAIscript); + if($s == ""){ $message[]= msgPool::required(_("Script")); }