From: hickert Date: Fri, 4 Jan 2008 11:08:36 +0000 (+0000) Subject: Fixed fai classes. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=48690797b40f986c9237143343ef9ee7d9553f13;p=gosa.git Fixed fai classes. 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 --- diff --git a/gosa-core/plugins/admin/fai/class_faiHook.inc b/gosa-core/plugins/admin/fai/class_faiHook.inc index 7e6b1c705..49b49fb74 100644 --- a/gosa-core/plugins/admin/fai/class_faiHook.inc +++ b/gosa-core/plugins/admin/fai/class_faiHook.inc @@ -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); diff --git a/gosa-core/plugins/admin/fai/class_faiManagement.inc b/gosa-core/plugins/admin/fai/class_faiManagement.inc index 07189b177..16ae87f73 100644 --- a/gosa-core/plugins/admin/fai/class_faiManagement.inc +++ b/gosa-core/plugins/admin/fai/class_faiManagement.inc @@ -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; diff --git a/gosa-core/plugins/admin/fai/class_faiPackage.inc b/gosa-core/plugins/admin/fai/class_faiPackage.inc index c3a3fe971..cd591d1fd 100644 --- a/gosa-core/plugins/admin/fai/class_faiPackage.inc +++ b/gosa-core/plugins/admin/fai/class_faiPackage.inc @@ -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= ""; diff --git a/gosa-core/plugins/admin/fai/class_faiPartitionTable.inc b/gosa-core/plugins/admin/fai/class_faiPartitionTable.inc index 960b73e02..f75117cd2 100644 --- a/gosa-core/plugins/admin/fai/class_faiPartitionTable.inc +++ b/gosa-core/plugins/admin/fai/class_faiPartitionTable.inc @@ -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); diff --git a/gosa-core/plugins/admin/fai/class_faiProfile.inc b/gosa-core/plugins/admin/fai/class_faiProfile.inc index 048e29348..a2f86663d 100644 --- a/gosa-core/plugins/admin/fai/class_faiProfile.inc +++ b/gosa-core/plugins/admin/fai/class_faiProfile.inc @@ -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'); } diff --git a/gosa-core/plugins/admin/fai/class_faiProfileEntry.inc b/gosa-core/plugins/admin/fai/class_faiProfileEntry.inc index f0fe7f06a..3b51823b6 100644 --- a/gosa-core/plugins/admin/fai/class_faiProfileEntry.inc +++ b/gosa-core/plugins/admin/fai/class_faiProfileEntry.inc @@ -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; diff --git a/gosa-core/plugins/admin/fai/class_faiScript.inc b/gosa-core/plugins/admin/fai/class_faiScript.inc index b5310e40e..33101d560 100644 --- a/gosa-core/plugins/admin/fai/class_faiScript.inc +++ b/gosa-core/plugins/admin/fai/class_faiScript.inc @@ -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); diff --git a/gosa-core/plugins/admin/fai/class_faiSummaryTab.inc b/gosa-core/plugins/admin/fai/class_faiSummaryTab.inc index 1fde58e56..eccfc0bd0 100644 --- a/gosa-core/plugins/admin/fai/class_faiSummaryTab.inc +++ b/gosa-core/plugins/admin/fai/class_faiSummaryTab.inc @@ -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 diff --git a/gosa-core/plugins/admin/fai/class_faiTemplate.inc b/gosa-core/plugins/admin/fai/class_faiTemplate.inc index 89e0b2d06..9c1699624 100644 --- a/gosa-core/plugins/admin/fai/class_faiTemplate.inc +++ b/gosa-core/plugins/admin/fai/class_faiTemplate.inc @@ -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); diff --git a/gosa-core/plugins/admin/fai/class_faiTemplateEntry.inc b/gosa-core/plugins/admin/fai/class_faiTemplateEntry.inc index 44621681f..a0734aa6a 100644 --- a/gosa-core/plugins/admin/fai/class_faiTemplateEntry.inc +++ b/gosa-core/plugins/admin/fai/class_faiTemplateEntry.inc @@ -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)); } } diff --git a/gosa-core/plugins/admin/fai/class_faiVariable.inc b/gosa-core/plugins/admin/fai/class_faiVariable.inc index f21ab7cdc..ce543b15c 100644 --- a/gosa-core/plugins/admin/fai/class_faiVariable.inc +++ b/gosa-core/plugins/admin/fai/class_faiVariable.inc @@ -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);