diff --git a/gosa-plugins/fai/admin/fai/class_faiScriptEntry.inc b/gosa-plugins/fai/admin/fai/class_faiScriptEntry.inc
index 370c892a07054ef27ec7165ecfe72ceccba95cf6..a0ba363c99bb006685447226502687eefeee6e2c 100644 (file)
function faiScriptEntry (&$config, $dn= NULL,$object=false)
{
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'];
if($dn != "new"){
$this->orig_cn= $object['cn'];
$this->dn=$object['dn'];
$oname = $name;
$this->$oname=$value;
}
$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'];
}else{
if(is_array($object)&&count($object)){
$this->orig_cn= $object['cn'];
/* Fill templating stuff */
$smarty = get_smarty();
/* 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")){
if(($_FILES['ImportFile']['error']!=0)){
$display = "";
if(isset($_POST['ImportUpload']) && $this->acl_is_writeable("FAIscript")){
if(($_FILES['ImportFile']['error']!=0)){
- msg_dialog::display(_("Error"), _("Upload failed!"), ERROR_DIALOG);
+ msg_dialog::display(_("Error"), msgPool::incorrectUpload(), ERROR_DIALOG);
}else
if(($_FILES['ImportFile']['size']==0)){
}else
if(($_FILES['ImportFile']['size']==0)){
- msg_dialog::display(_("Error"), _("Uploaded file is empty!"), ERROR_DIALOG);
+ msg_dialog::display(_("Error"), msgPool::incorrectUpload(_("file is empty")), ERROR_DIALOG);
}else{
$str = utf8_encode(addslashes(file_get_contents($_FILES['ImportFile']['tmp_name'])));
$this->FAIscript = $str;
}else{
$str = utf8_encode(addslashes(file_get_contents($_FILES['ImportFile']['tmp_name'])));
$this->FAIscript = $str;
}
/* File download requested */
}
/* 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")){
send_binary_content(stripslashes($this->FAIscript),$this->cn.".FAIscript");
}
/* Create download button*/
if($this->dn != "new" && $this->acl_is_readable("FAIscript")){
- $smarty->assign("DownMe","<a href='?plug=".$_GET['plug']."&getFAIScript'>
- <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0 class='center'>
- </a>");
+ $smarty->assign("DownMe", image('images/save.png','download',_("Download")));
}else{
$smarty->assign("DownMe","");
}
}else{
$smarty->assign("DownMe","");
}
$tmp = $this->plInfo();
foreach($tmp['plProvidedAcls'] as $name => $translated){
$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);
}
$smarty->assign($name."ACL",$acl);
}
$message[] = msgPool::duplicated(_("Name"));
}
$message[] = msgPool::duplicated(_("Name"));
}
- if(empty($this->cn)){
+ $c = trim($this->cn);
+ if($c == ""){
$message[] = msgPool::required(_("Name"));
}
$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"));
}
$message[]= msgPool::required(_("Script"));
}