Code

More preg_replacements
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Nov 2008 13:22:02 +0000 (13:22 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Nov 2008 13:22:02 +0000 (13:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12872 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_ldap.inc
gosa-core/include/class_plugin.inc
gosa-core/include/functions_helpviewer.inc

index 8aa793cf1125952f874194a2b039c73393ce72ad..c7fa31f98107ead05b1d608a7788445adb442777 100644 (file)
@@ -118,7 +118,7 @@ class LDAP{
      requests. I.e. member=....                                               */
   static function prepare4filter($dn)
   {
-       return normalizeLdap(preg_replace('/\\\\/', '\\\\\\', LDAP::fix($dn)));
+       return normalizeLdap(str_replace('\\\\', '\\\\\\', LDAP::fix($dn)));
   }
 
 
index 4796f86ec06f99da9e6e796a1a5e240568a79c36..dee53fbb0e430cf55c139e40fba865d2404c849c 100644 (file)
@@ -632,7 +632,7 @@ class plugin
       /* Additional attributes */
       foreach ($tmp as $name => $len){
         $value = $add_attrs[$name];
-        $command= preg_replace("/%$name/", "$value", $command);
+        $command= str_replace("%$name", "$value", $command);
       }
 
       if (check_command($command)){
@@ -674,7 +674,7 @@ class plugin
       /* Additional attributes */
       foreach ($tmp as $name => $len){
         $value = $add_attrs[$name];
-        $command= preg_replace("/%$name/", "$value", $command);
+        $command= str_replace("%$name", "$value", $command);
       }
 
       if (check_command($command)){
@@ -714,7 +714,7 @@ class plugin
       /* Additional attributes */
       foreach ($tmp as $name => $len){
         $value = $add_attrs[$name];
-        $command= preg_replace("/%$name/", "$value", $command);
+        $command= str_replace("%$name", "$value", $command);
       }
 
       if (check_command($command)){
@@ -827,7 +827,7 @@ class plugin
      *  change \2C to , again, else this entry can't be saved ...
      */
     if((isset($new['ou'])) &&( preg_match("/\\,/",$new['ou']))){
-      $new['ou'] = preg_replace("/\\\\,/",",",$new['ou']);
+      $new['ou'] = str_replace("\\\\,",",",$new['ou']);
     }
 
     /* Save copy */
@@ -1263,7 +1263,7 @@ class plugin
       /* Create object */
 #$data             = preg_replace('/^dn:.*\n/', '', $ldap->gen_ldif($this->dn,"(!(objectClass=gosaDepartment))"));
       $data             = $ldap->gen_ldif($this->dn,"(&(!(objectClass=gosaDepartment))(!(objectClass=FAIclass)))");
-      $newName          = preg_replace("/\./", "", $sec."-".$usec);
+      $newName          = str_replace(".", "", $sec."-".$usec);
       $target= array();
       $target['objectClass']            = array("top", "gosaSnapshotObject");
       $target['gosaSnapshotData']       = gzcompress($data, 6);
@@ -1280,7 +1280,7 @@ class plugin
       $ldap_to->cat($new_dn);
       while($ldap_to->count()){
         $ldap_to->cat($new_dn);
-        $newName = preg_replace("/\./", "", $sec."-".($usec++));
+        $newName = str_replace(".", "", $sec."-".($usec++));
         $new_dn                           = "gosaSnapshotTimestamp=".$newName.",".$new_base;
         $target['gosaSnapshotTimestamp']  = $newName;
       } 
@@ -1519,12 +1519,12 @@ class plugin
     $this->parent = $parent;
 
     foreach($_POST as $name => $value){
+                       $entry = base64_decode(preg_replace("/_[xy]$/","",$name));
 
       /* Create a new snapshot, display a dialog */
       if(preg_match("/^CreateSnapShotDialog_/",$name) && $once){
         $once = false;
-        $entry = preg_replace("/^CreateSnapShotDialog_/","",$name);
-        $entry = base64_decode(preg_replace("/_[xy]$/","",$entry));
+        $entry = preg_replace("/^CreateSnapShotDialog_/","",$entry);
 
         if(!empty($entry) && $ui->allow_snapshot_create($entry,$this->parent->acl_module)){
           $this->snapDialog = new SnapShotDialog($this->config,$entry,$this);
@@ -1536,8 +1536,7 @@ class plugin
       /* Restore a snapshot, display a dialog with all snapshots of the current object */
       if(preg_match("/^RestoreSnapShotDialog_/",$name) && $once){
         $once = false;
-        $entry = preg_replace("/^RestoreSnapShotDialog_/","",$name);
-        $entry = base64_decode(preg_replace("/_[xy]$/","",$entry));
+        $entry = preg_replace("/^RestoreSnapShotDialog_/","",$entry);
         if(!empty($entry) && $ui->allow_snapshot_restore($entry,$this->parent->acl_module)){
           $this->snapDialog = new SnapShotDialog($this->config,$entry,$this);
           $this->snapDialog->display_restore_dialog = true;
@@ -1564,8 +1563,7 @@ class plugin
       /* Restore selected snapshot */
       if(preg_match("/^RestoreSnapShot_/",$name) && $once){
         $once = false;
-        $entry = preg_replace("/^RestoreSnapShot_/","",$name);
-        $entry = base64_decode(trim(preg_replace("/_[xy]$/","",$entry)));
+        $entry = preg_replace("/^RestoreSnapShot_/","",$entry);
         if(!empty($entry) && $ui->allow_snapshot_restore($entry,$this->parent->acl_module)){
           $this->restore_snapshot($entry);
           $this->snapDialog = NULL;
index 947489171cfa35dc3889781058b96a1d6ddb2d83..1c282794d9f475c0f055ca83a71448273904b09d 100644 (file)
@@ -258,8 +258,7 @@ function remove_unwanted_tags($str,$replacements)
 function linkwrapper($str,$link)
 {
   $str = preg_replace("/HREF=\"http/i","target=\"_blank\" href=\"http",$str);
-  $str = preg_replace("/HREF=\"/","href=\"".$link."?pg=",$str);
-  $str=str_replace("HREF=\"","href=\"".$link."?pg=",$str);  
+  $str = str_replace("HREF=\"","href=\"".$link."?pg=",$str);  
   return($str);
 }