From 3b1085c41400a437168e9288f51c0fa8abd1aedb Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 8 Sep 2006 08:01:35 +0000 Subject: [PATCH] REplace stri_replace git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4626 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_faiHook.inc | 6 ++++-- plugins/admin/fai/class_faiPackage.inc | 6 ++++-- plugins/admin/fai/class_faiPartitionTable.inc | 9 ++++++--- plugins/admin/fai/class_faiProfile.inc | 3 ++- plugins/admin/fai/class_faiScript.inc | 6 ++++-- plugins/admin/fai/class_faiTemplate.inc | 6 ++++-- plugins/admin/fai/class_faiVariable.inc | 6 ++++-- 7 files changed, 28 insertions(+), 14 deletions(-) diff --git a/plugins/admin/fai/class_faiHook.inc b/plugins/admin/fai/class_faiHook.inc index a8f07b177..cc94b04f4 100644 --- a/plugins/admin/fai/class_faiHook.inc +++ b/plugins/admin/fai/class_faiHook.inc @@ -338,7 +338,8 @@ 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 = 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 = $this->dn; } @@ -346,7 +347,8 @@ class faiHook extends plugin prepare_to_save_FAI_object($use_dn,array(),true); foreach($this->SubObjects as $name => $obj){ - $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']); +# $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 = $obj['dn']; } diff --git a/plugins/admin/fai/class_faiPackage.inc b/plugins/admin/fai/class_faiPackage.inc index 4591201be..9114c3bb9 100644 --- a/plugins/admin/fai/class_faiPackage.inc +++ b/plugins/admin/fai/class_faiPackage.inc @@ -346,7 +346,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 = 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 = $this->dn; } @@ -356,7 +357,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 = 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 = $obj['dn']; } diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc index 59a1cc5d3..0e5e30921 100644 --- a/plugins/admin/fai/class_faiPartitionTable.inc +++ b/plugins/admin/fai/class_faiPartitionTable.inc @@ -305,7 +305,8 @@ 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 = 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 = $this->dn; } @@ -315,7 +316,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 = 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 = $disk_dn; } @@ -324,7 +326,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 = 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 = $disk_dn; } diff --git a/plugins/admin/fai/class_faiProfile.inc b/plugins/admin/fai/class_faiProfile.inc index 53a511ad7..c1e5c8f0f 100644 --- a/plugins/admin/fai/class_faiProfile.inc +++ b/plugins/admin/fai/class_faiProfile.inc @@ -352,7 +352,8 @@ 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 = 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 = $this->dn; } diff --git a/plugins/admin/fai/class_faiScript.inc b/plugins/admin/fai/class_faiScript.inc index 8807a6119..18f95aef3 100644 --- a/plugins/admin/fai/class_faiScript.inc +++ b/plugins/admin/fai/class_faiScript.inc @@ -328,7 +328,8 @@ class faiScript 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 = 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 = $this->dn; } @@ -336,7 +337,8 @@ class faiScript extends plugin prepare_to_save_FAI_object($use_dn,array(),true); foreach($this->SubObjects as $name => $obj){ - $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']); +# $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 = $obj['dn']; } diff --git a/plugins/admin/fai/class_faiTemplate.inc b/plugins/admin/fai/class_faiTemplate.inc index f20c35718..161d4fdcb 100644 --- a/plugins/admin/fai/class_faiTemplate.inc +++ b/plugins/admin/fai/class_faiTemplate.inc @@ -310,7 +310,8 @@ 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 = 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 = $this->dn; } @@ -318,7 +319,8 @@ class faiTemplate extends plugin prepare_to_save_FAI_object($use_dn,array(),true); foreach($this->SubObjects as $name => $obj){ - $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']); +# $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 = $obj['dn']; } diff --git a/plugins/admin/fai/class_faiVariable.inc b/plugins/admin/fai/class_faiVariable.inc index eb2c71c05..ccc6170b6 100644 --- a/plugins/admin/fai/class_faiVariable.inc +++ b/plugins/admin/fai/class_faiVariable.inc @@ -251,7 +251,8 @@ class faiVariable 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 = 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 = $this->dn; } @@ -259,7 +260,8 @@ class faiVariable extends plugin prepare_to_save_FAI_object($use_dn,array(),true); foreach($this->SubObjects as $name => $obj){ - $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']); +# $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 = $obj['dn']; } -- 2.30.2