diff --git a/gosa-plugins/fai/admin/fai/class_faiHookEntry.inc b/gosa-plugins/fai/admin/fai/class_faiHookEntry.inc
index 679e740b61cedf3581dd62014edc10c72fe2916a..09b5d8dbfb4cb528ea11ee4d4f0882e639643de8 100644 (file)
function faiHookEntry (&$config, $dn= NULL,$object=false)
{
function faiHookEntry (&$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];
- }
-
}elseif(is_array($object)){
if(count($object)){
$this->orig_cn= $object['cn'];
}elseif(is_array($object)){
if(count($object)){
$this->orig_cn= $object['cn'];
if(isset($_POST['ImportUpload'])){
if(($_FILES['ImportFile']['error']!=0)){
if(isset($_POST['ImportUpload'])){
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(file_get_contents($_FILES['ImportFile']['tmp_name']));
}else{
$str = utf8_encode(file_get_contents($_FILES['ImportFile']['tmp_name']));
- $this->FAIscript = $str;
+ $this->FAIscript = addslashes ($str);
}
}
/* File download requested */
if(isset($_GET['getFAIHook'])){
}
}
/* File download requested */
if(isset($_GET['getFAIHook'])){
- send_binary_content($this->FAIscript,$this->cn.".FAIhook");
+ send_binary_content(stripslashes($this->FAIscript),$this->cn.".FAIhook");
}
/* Create download button*/
}
/* Create download button*/
$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/",$this->FAIstate));
$smarty->assign($name."ACL",$acl);
}
$smarty->assign($name."ACL",$acl);
}
}else{
$smarty->assign("FAIscript" , htmlentities($this->FAIscript));
}
}else{
$smarty->assign("FAIscript" , htmlentities($this->FAIscript));
}
+ $smarty->assign("freeze" , preg_match("/freeze/",$this->FAIstate));
$display.= $smarty->fetch(get_template_path('faiHookEntry.tpl', TRUE));
return($display);
}
$display.= $smarty->fetch(get_template_path('faiHookEntry.tpl', TRUE));
return($display);
}
/* Save data to object */
function save_object()
{
/* Save data to object */
function save_object()
{
- if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
+ if((isset($_POST['SubObjectFormSubmitted'])) && !preg_match("/^freeze/", $this->FAIstate)){
foreach($this->attributes as $attrs){
if($this->acl_is_writeable($attrs)){
if(isset($_POST[$attrs])){
foreach($this->attributes as $attrs){
if($this->acl_is_writeable($attrs)){
if(isset($_POST[$attrs])){
$message[]= msgPool::duplicated(_("Name"));
}
$message[]= msgPool::duplicated(_("Name"));
}
- if(empty($this->FAIscript)) {
- $message[]= msgPool::required(_("Script"));
+ $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->cn)){
- $message[]= msgPool::required(_("Name"));
+ $s = trim($this->FAIscript);
+ if($s == ""){
+ $message[]= msgPool::required(_("Script"));
}
return ($message);
}
return ($message);