Code

Updated multi_plug class
[gosa.git] / gosa-core / include / functions_FAI.inc
index 26c0a572659f10287d156965b74bdb68579e2095..7b2b6170fa0212b9197fd43fe74fec490882308b 100644 (file)
@@ -105,8 +105,8 @@ function get_all_releases_from_base($dn,$appendedName=false)
 {
   global $config;
     
-  if(!preg_match("/ou=fai,ou=configs,ou=systems,/",$dn)){
-    $base = "ou=fai,ou=configs,ou=systems,".$dn;
+  if(!preg_match("/".normalizePreg(get_ou('faiou'))."/",$dn)){
+    $base = get_ou('faiou').$dn;
   }else{
     $base = $dn;
   }
@@ -117,7 +117,7 @@ function get_all_releases_from_base($dn,$appendedName=false)
   $ldap->search("(objectClass=FAIbranch)",array("ou","dn"));
   while($attrs = $ldap->fetch()){
     if($appendedName){
-      $res[$attrs['dn']] = convert_department_dn(preg_replace("/,ou=fai,ou=configs,ou=system.*$/","",$attrs['dn']));
+      $res[$attrs['dn']] = convert_department_dn(preg_replace("/,".normalizePreg(get_ou('faiou')).".*$/","",$attrs['dn']));
     }else{
       $res[$attrs['dn']] = $attrs['ou'][0];
     }
@@ -151,8 +151,9 @@ function prepare_to_save_FAI_object($Current_DN,$objectAttrs,$removed = false)
       }
     } 
   }
-   
-  $_SESSION['FAI_objects_to_save'][$Current_DN] =  $addObj;
+  $FAI_objects_to_save = session::get('FAI_objects_to_save') ;
+  $FAI_objects_to_save[$Current_DN] =  $addObj;
+  session::set('FAI_objects_to_save',$FAI_objects_to_save);
 }
 
 
@@ -214,16 +215,18 @@ function save_release_changes_now()
   $to_save = array();
 
   /* check which objects must be saved */
-  foreach($_SESSION['FAI_objects_to_save'] as $Current_DN => $object){
+  $FAI_objects_to_save = session::get('FAI_objects_to_save');
+  foreach($FAI_objects_to_save as $Current_DN => $object){
     if($object['diff']){
       $sub_name = $Current_DN;
-      while(isset($_SESSION['FAI_objects_to_save'][$sub_name])){
-        $to_save[strlen($sub_name)][$sub_name] = $_SESSION['FAI_objects_to_save'][$sub_name]; 
-        unset($_SESSION['FAI_objects_to_save'][$sub_name]);
+      while(isset($FAI_objects_to_save[$sub_name])){
+        $to_save[strlen($sub_name)][$sub_name] = $FAI_objects_to_save[$sub_name]; 
+        unset($FAI_objects_to_save[$sub_name]);
         $sub_name = preg_replace('/^[^,]+,/', '', $sub_name);
       }
     }
   }
+  session::set('FAI_objects_to_save',$FAI_objects_to_save);
 
   /* Sort list of objects that must be saved, and ensure that 
       container   objects are safed, before their childs are saved */
@@ -373,12 +376,12 @@ function save_release_changes_now()
         save_FAI_object($parent_obj,$objectAttrs);
 
         if(($parent_obj != $Current_DN)){
-          print_red(sprintf(_("Error, following objects should be equal '%s' and '%s'"),$parent_obj,$Current_DN));
+          msg_dialog::display(_("Error"), sprintf(_("Error, following objects should be equal '%s' and '%s'"),$parent_obj,$Current_DN), ERROR_DIALOG);
         }
       }
     }
   } 
-  $_SESSION['FAI_objects_to_save'] = array();
+  session::set('FAI_objects_to_save',array());
 }