X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Ffai%2Fadmin%2Ffai%2Fclass_faiHook.inc;h=e71fc1b855f504c9007428c6ab98c1a7d3a75b1e;hb=cb773874cb502bc0f01aeefc43849e0522e1a4d9;hp=9ae982c296160c1899921f16445f58ffd9faa6cc;hpb=40175c4513f975e3fd7e125dc2b4290f73025a66;p=gosa.git diff --git a/gosa-plugins/fai/admin/fai/class_faiHook.inc b/gosa-plugins/fai/admin/fai/class_faiHook.inc index 9ae982c29..e71fc1b85 100644 --- a/gosa-plugins/fai/admin/fai/class_faiHook.inc +++ b/gosa-plugins/fai/admin/fai/class_faiHook.inc @@ -50,7 +50,7 @@ class faiHook extends plugin foreach($res as $obj){ /* Skip not relevant objects */ - if(!preg_match("/".normalizePreg($this->dn)."$/i",$obj['dn'])) continue; + if(!preg_match("/".preg_quote($this->dn, '/')."$/i",$obj['dn'])) continue; $objects = array(); $objects['status'] = "FreshLoaded"; @@ -100,9 +100,9 @@ class faiHook extends plugin function acl_base_for_current_object($dn) { - if($dn == "new"){ + if($dn == "new" || $dn == ""){ if($this->dn == "new"){ - $dn = session::get('CurrentMainBase'); + $dn= $this->parent->parent->acl_base; }else{ $dn = $this->dn; } @@ -158,7 +158,7 @@ class faiHook extends plugin $this->dialog->set_acl_base($this->acl_base_for_current_object($obj['dn'])); $this->dialog->set_acl_category("fai"); - session::set('objectinfo',$obj['dn']); + set_object_info($obj['dn']); $this->dialog->parent = &$this; $this->is_dialog=true; } @@ -195,13 +195,15 @@ class faiHook extends plugin if(isset($_GET['act']) && isset($_GET['id'])){ if($_GET['act'] == "edit" && isset($this->SubObjects[base64_decode($_GET['id'])])){ $obj = $this->SubObjects[base64_decode($_GET['id'])]; - if($obj['status'] == "FreshLoaded"){ + if($obj['status'] == "FreshLoaded"){ $obj = $this->get_object_attributes($obj,$this->sub_Load_Later); } $this->dialog= new $this->subClassName($this->config,$this->dn,$obj); $this->dialog->FAIstate = $this->FAIstate; $this->dialog->acl = $this->acl; - session::set('objectinfo',$obj['dn']); + $this->dialog->set_acl_base($this->acl_base_for_current_object($obj['dn'])); + $this->dialog->set_acl_category("fai"); + set_object_info($obj['dn']); $this->dialog->parent = &$this; $this->is_dialog=true; } @@ -399,12 +401,12 @@ class faiHook extends plugin $ldap = $this->config->get_ldap_link(); $ldap->cd ($this->dn); $release = $this->parent->parent->fai_release; - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn); + $use_dn = preg_replace("/".preg_quote(FAI::get_release_dn($this->dn), '/')."/i", $release, $this->dn); new log("remove","fai/".get_class($this),$use_dn,$this->attributes); FAI::prepare_to_save_FAI_object($use_dn,array(),true); foreach($this->SubObjects as $name => $obj){ - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $obj['dn']); + $use_dn = preg_replace("/".preg_quote(FAI::get_release_dn($this->dn), '/')."/i", $release, $obj['dn']); FAI::prepare_to_save_FAI_object($use_dn,array(),true); } $this->handle_post_events("remove"); @@ -418,11 +420,6 @@ class faiHook extends plugin { if((isset($_POST['FAIhook_posted'])) && !preg_match("/^freeze/", $this->FAIstate)){ plugin::save_object(); - foreach($this->attributes as $attrs){ - if(isset($_POST[$attrs])){ - $this->$attrs = $_POST[$attrs]; - } - } } } @@ -437,7 +434,7 @@ class faiHook extends plugin */ if($this->is_new){ $release = $this->parent->parent->fai_release; - $new_dn= 'cn='.$this->cn.",".get_ou('faihookou').get_ou('faiou').$release; + $new_dn= 'cn='.$this->cn.",".get_ou('faiHookRDN').get_ou('faiBaseRDN').$release; $res = faiManagement::check_class_name("FAIhook",$this->cn,$new_dn); if(isset($res[$this->cn])){ $message[] = msgPool::duplicated(_("Name")); @@ -488,7 +485,8 @@ class faiHook extends plugin $tmp = array(); $attributes = array_merge($this->sub_Load_Later,$this->subAttributes); foreach($attributes as $attrs){ - if(empty($obj[$attrs])){ + if(!isset($obj[$attrs])) continue; + if($obj[$attrs] == ""){ $obj[$attrs] = array(); } if(!is_array($obj[$attrs])){ @@ -536,7 +534,7 @@ class faiHook extends plugin foreach($res as $obj){ /* Skip not relevant objects */ - if(!preg_match("/".normalizePreg($source['dn'])."$/i",$obj['dn'])) continue; + if(!preg_match("/".preg_quote($source['dn'], '/')."$/i",$obj['dn'])) continue; $objects = array(); $objects['status'] = "edited";