Code

Fixed fai classes.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 4 Jan 2008 11:08:36 +0000 (11:08 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 4 Jan 2008 11:08:36 +0000 (11:08 +0000)
Session calls will now be done via class_session

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8217 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/fai/class_faiHook.inc
gosa-core/plugins/admin/fai/class_faiManagement.inc
gosa-core/plugins/admin/fai/class_faiPackage.inc
gosa-core/plugins/admin/fai/class_faiPartitionTable.inc
gosa-core/plugins/admin/fai/class_faiProfile.inc
gosa-core/plugins/admin/fai/class_faiProfileEntry.inc
gosa-core/plugins/admin/fai/class_faiScript.inc
gosa-core/plugins/admin/fai/class_faiSummaryTab.inc
gosa-core/plugins/admin/fai/class_faiTemplate.inc
gosa-core/plugins/admin/fai/class_faiTemplateEntry.inc
gosa-core/plugins/admin/fai/class_faiVariable.inc

index 7e6b1c70517fdddda21aa7e26f59b67a23135328..49b49fb74800082d32d7a8277ac2b2b86b09a0f1 100644 (file)
@@ -403,9 +403,9 @@ class faiHook extends plugin
     $ldap = $this->config->get_ldap_link();
     $ldap->cd ($this->dn);
 
-#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
-    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-    if($_SESSION['faifilter']['branch'] == "main"){
+    $faifilter = session::get('faifilter');
+    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
+    if($faifilter['branch'] == "main"){
       $use_dn = $this->dn;
     }
 
@@ -414,9 +414,8 @@ class faiHook extends plugin
     new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
 
     foreach($this->SubObjects as $name => $obj){
-#      $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']);
-      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
-      if($_SESSION['faifilter']['branch'] == "main"){
+      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $obj['dn']);
+      if($faifilter['branch'] == "main"){
         $use_dn = $obj['dn'];
       }
       prepare_to_save_FAI_object($use_dn,array(),true);
index 07189b177ee2ffbaf75f6d1eb47e2dc9d0b219da..16ae87f73f1bf39cb4424b83803e5c2ac06afb1f 100644 (file)
@@ -507,8 +507,15 @@ class faiManagement extends plugin
       }
 
       if($is_ok){
-        $_SESSION['LASTPOST']['base'] = $base;
-        $_SESSION['LASTPOST']['type'] = $type;
+
+        if(session::is_set('LASTPOST')){
+          $LASTPOST = session::get('LASTPOST');
+        }else{
+          $LASTPOST = array();
+        }
+        $LASTPOST['base'] = $base;
+        $LASTPOST['type'] = $type;
+        session::set('LASTPOST',$LASTPOST);
         $smarty->assign("iframe", true);
         $smarty->assign("plugID", $_GET['plug']);
         $display       = $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
@@ -530,11 +537,13 @@ class faiManagement extends plugin
         /* Create it know */
         $this->dispNewBranch = false;
         $this->dispNewFreeze = false;
-        $base = $_SESSION['LASTPOST']['base'];
+
+        $LASTPOST = session::get('LASTPOST');
+        $base = $LASTPOST['base'];
         $_POST  = session::get('LASTPOST');      
         $name = $_POST['BranchName'];
 
-        $type = $_SESSION['LASTPOST']['type'];
+        $type = $LASTPOST['type'];
         $ldap = $this->config->get_ldap_link();
 
         $baseToUse = $base;
index c3a3fe971010101226f2978a335534c882ce3009..cd591d1fdbc364338fc40d8f4f86296ea9597c2a 100644 (file)
@@ -185,7 +185,8 @@ class faiPackage extends plugin
     if(!$this->is_account){
 
       /* Assemble release name */
-      $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $_SESSION['faifilter']['branch']);
+      $faifilter = session::get('faifilter');
+      $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $faifilter['branch']);
       $tmp= preg_replace('/ou=/', '', $tmp);
       $rev= array_reverse(split(',', $tmp));
       $this->FAIdebianRelease= "";
@@ -335,9 +336,8 @@ class faiPackage extends plugin
     $ldap = $this->config->get_ldap_link();
     $ldap->cd ($this->dn);
 
-#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
-    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-    if($_SESSION['faifilter']['branch'] == "main"){
+    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
+    if($faifilter['branch'] == "main"){
       $use_dn = $this->dn;
     }
 
@@ -348,9 +348,8 @@ class faiPackage extends plugin
     foreach($this->ConfiguredPackages as $pkgname => $attrs){
       foreach($attrs as $name => $attr){
         $pkgdn =  "FAIvariable=".$name.",".$this->dn;
-#        $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $pkgdn);
-        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $pkgdn);
-        if($_SESSION['faifilter']['branch'] == "main"){
+        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $pkgdn);
+        if($faifilter['branch'] == "main"){
           $use_dn = $obj['dn'];
         }
         prepare_to_save_FAI_object($use_dn,array(),true);
@@ -468,7 +467,8 @@ class faiPackage extends plugin
 
     /* Assemble release name */
     if($this->FAIdebianRelease == "ClearFromCopyPaste"){
-      $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $_SESSION['faifilter']['branch']);
+      $faifilter = session::get('faifilter');
+      $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $faifilter['branch']);
       $tmp= preg_replace('/ou=/', '', $tmp);
       $rev= array_reverse(split(',', $tmp));
       $this->FAIdebianRelease= "";
index 960b73e02b4b6c2e8247c8e4ff2fa3b3523537e1..f75117cd2f7876bc0c46f78fc4852f8fb8218485 100644 (file)
@@ -345,9 +345,9 @@ class faiPartitionTable extends plugin
     $ldap = $this->config->get_ldap_link();
     $ldap->cd ($this->dn);
 
-#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
-    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-    if($_SESSION['faifilter']['branch'] == "main"){
+    $faifilter = session::get('faifilter');
+    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
+    if($faifilter['branch'] == "main"){
       $use_dn = $this->dn;
     }
 
@@ -358,9 +358,8 @@ class faiPartitionTable extends plugin
     foreach($this->disks as $disk){
 
       $disk_dn = "cn=".$disk['cn'].",".$this->dn;
-#      $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $disk_dn);
-      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $disk_dn);
-      if($_SESSION['faifilter']['branch'] == "main"){
+      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $disk_dn);
+      if($faifilter['branch'] == "main"){
         $use_dn = $disk_dn;
       }
       prepare_to_save_FAI_object($use_dn,array(),true);
@@ -368,9 +367,8 @@ class faiPartitionTable extends plugin
       foreach($disk['partitions'] as $key => $partition){    
      
         $partition_dn= "FAIpartitionNr=".$partition['FAIpartitionNr'].",".$disk_dn;      
-#        $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $partition_dn);
-        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $partition_dn);
-        if($_SESSION['faifilter']['branch'] == "main"){
+        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $partition_dn);
+        if($faifilter['branch'] == "main"){
           $use_dn = $disk_dn;
         }
         prepare_to_save_FAI_object($use_dn,array(),true);
index 048e29348efd191c88c7a8bf6458e3a0e01924ca..a2f86663d42210a6e924f202121571b147ac3f1d 100644 (file)
@@ -369,9 +369,9 @@ class faiProfile extends plugin
     $ldap = $this->config->get_ldap_link();
     $ldap->cd ($this->dn);
 
-#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
-    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-    if($_SESSION['faifilter']['branch'] == "main"){
+    $faifilter = session::get('faifilter');
+    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
+    if($faifilter['branch'] == "main"){
       $use_dn = $this->dn;
     }
 
@@ -404,8 +404,8 @@ class faiProfile extends plugin
     }
 
     $ldap = $this->config->get_ldap_link();
-
-    $base = $_SESSION['faifilter']['branch'];
+    $faifilter = session::get('faifilter');
+    $base = $faifilter['branch'];
     if($base == "main"){
       $base  = session::get('CurrentMainBase');
     }
index f0fe7f06ad15de1ec45416875e51307e713e6daa..3b51823b6dc4e615948308e5d694f4af808f1c00 100644 (file)
@@ -21,9 +21,10 @@ class faiProfileEntry extends plugin
     plugin::plugin ($config, $dn);
 
     /* Search only in fai tree */
-    $base = get_ou('faiou').$_SESSION['CurrentMainBase'];
-    if($_SESSION['faifilter']['branch']!="main"){
-      $base = $_SESSION['faifilter']['branch'];
+    $base = get_ou('faiou').session::get('CurrentMainBase');
+    $faifilter = session::get('faifilter');
+    if($faifilter['branch']!="main"){
+      $base = $faifilter['branch'];
     }
   
     $this->ui = get_userinfo();
@@ -85,7 +86,7 @@ class faiProfileEntry extends plugin
 
     /* If no search filter is set, create one */
     if (!is_global("SUBfaifilter")){
-      $SUBfaifilter= array("base" => get_ou('faiou').$_SESSION['CurrentMainBase'], "Sregex" => "*");
+      $SUBfaifilter= array("base" => get_ou('faiou').session::get('CurrentMainBase'), "Sregex" => "*");
       $SUBfaifilter['SShowTemplates'] = true;
       $SUBfaifilter['SShowScripts']   = true;
       $SUBfaifilter['SShowHooks']     = true;
index b5310e40ebffb04f13cc1ddc1ab0e48f7dcfdb52..33101d560f90e3f196afb6ed7cf013025d0ae66c 100644 (file)
@@ -128,7 +128,7 @@ class faiScript extends plugin
   {
     if($dn == "new"){
       if($this->dn == "new"){
-        $dn= "cn=dummy,".$_SESSION['CurrentMainBase'];
+        $dn= "cn=dummy,".session::get('CurrentMainBase');
       }else{
         $dn = $this->dn;
       }
@@ -437,9 +437,9 @@ class faiScript extends plugin
     if($this->acl_is_removeable()){
       $ldap = $this->config->get_ldap_link();
       $ldap->cd ($this->dn);
-
-      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-      if($_SESSION['faifilter']['branch'] == "main"){
+      $faifilter = session::get('faifilter');
+      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
+      if($faifilter['branch'] == "main"){
         $use_dn = $this->dn;
       }
    
@@ -448,8 +448,8 @@ class faiScript extends plugin
       prepare_to_save_FAI_object($use_dn,array(),true);
       
       foreach($this->SubObjects as $name => $obj){
-        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
-        if($_SESSION['faifilter']['branch'] == "main"){
+        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $obj['dn']);
+        if($faifilter['branch'] == "main"){
           $use_dn = $obj['dn'];
         }
         prepare_to_save_FAI_object($use_dn,array(),true);
index 1fde58e56bcd3cabc83a804576187b2982b87c8f..eccfc0bd046121b3a9570a9d7191dff6047737fa 100644 (file)
@@ -58,7 +58,6 @@ class faiSummaryTab extends plugin{
   {
     $this->InitCalled = true;
     $this->Result = array();
-    $_SESSION['faiSummaryTab']['UniqueID'] = 0; 
   
     /* Get classes & release name 
        There are 2 different tabs which use the summary tab
index 89e0b2d06f1a84d07981dbb1f9c3be760884f5df..9c1699624089dbdb40535d04fdc1fe6433fce642 100644 (file)
@@ -387,9 +387,9 @@ class faiTemplate extends plugin
     $ldap = $this->config->get_ldap_link();
     $ldap->cd ($this->dn);
 
-#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
-    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-    if($_SESSION['faifilter']['branch'] == "main"){
+    $faifilter = session::get('faifilter');
+    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
+    if($faifilter['branch'] == "main"){
       $use_dn = $this->dn;
     }
 
@@ -397,9 +397,8 @@ class faiTemplate extends plugin
     new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
 
     foreach($this->SubObjects as $name => $obj){
-#      $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']);
-      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
-      if($_SESSION['faifilter']['branch'] == "main"){
+      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $obj['dn']);
+      if($faifilter['branch'] == "main"){
         $use_dn = $obj['dn'];
       }
       prepare_to_save_FAI_object($use_dn,array(),true);
index 44621681f29f2e2eef70e8f66969685804965332..a0734aa6abc34d62ace4dd68551d2cc14187efbf 100644 (file)
@@ -55,7 +55,7 @@ class faiTemplateEntry extends plugin
 
     session::set('binary',$this->FAItemplateFile);
     session::set('binarytype','octet-stream');
-    $_SESSION['binaryfile'] = basename( $this->FAItemplatePath );
+    session::set('binaryfile',basename($this->FAItemplatePath));
 
     if(!empty($this->dn) && $this->dn != "new"){
       $ldap = $this->config->get_ldap_link();
@@ -88,7 +88,7 @@ class faiTemplateEntry extends plugin
 
         session::set('binary',$this->FAItemplateFile);
         session::set('binarytype','octet-stream');
-        $_SESSION['binaryfile'] = basename( $this->FAItemplatePath );
+        session::set('binaryfile',basename($this->FAItemplatePath));
       }
     }
     
index f21ab7cdc1e13fe0580147fb1fd24e75e38f598d..ce543b15c94441bdccb9c43f99ed44cd1682613a 100644 (file)
@@ -284,8 +284,9 @@ class faiVariable extends plugin
       $ldap = $this->config->get_ldap_link();
       $ldap->cd ($this->dn);
 
-      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
-      if($_SESSION['faifilter']['branch'] == "main"){
+      $faifilter = session::get('faifilter');
+      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn);
+      if($faifilter['branch'] == "main"){
         $use_dn = $this->dn;
       }
   
@@ -293,8 +294,8 @@ class faiVariable extends plugin
       new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
 
       foreach($this->SubObjects as $name => $obj){
-        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
-        if($_SESSION['faifilter']['branch'] == "main"){
+        $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $faifilter['branch'], $obj['dn']);
+        if($faifilter['branch'] == "main"){
           $use_dn = $obj['dn'];
         }
         prepare_to_save_FAI_object($use_dn,array(),true);