stops double encoding of &. & became &
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 9 Oct 2006 22:11:56 +0000 (22:11 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 9 Oct 2006 22:11:56 +0000 (22:11 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11894 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/html.php

index 217ecfe022aba86e83bd01ef54f822a6fb8d27e6..004565ba711af6153a0ae27b204aa9d18305dfe2 100644 (file)
@@ -109,7 +109,7 @@ function set_url_var($url, $var, $val=0, $link=true) {
                     '/.+(\\?'.$var.')=(.*)$/AU',     /* at front and only var */
                     '/.+(\\&'.$var.')=(.*)$/AU'      /* at the end */
                     );
-    $url = preg_replace('/&amp;/','&',$url);
+    $url = str_replace('&amp;','&',$url);
 
     // FIXME: why switch is used instead of if () or one preg_match()
     switch (true) {
@@ -143,9 +143,6 @@ function set_url_var($url, $var, $val=0, $link=true) {
     if ($k) {
         if ($val) {
             $rpl = "$k=$val";
-            if ($link) {
-                $rpl = preg_replace('/&/','&amp;',$rpl);
-            }
         } else {
             $rpl = '';
         }
@@ -155,6 +152,8 @@ function set_url_var($url, $var, $val=0, $link=true) {
         $pat = "/$k=$v/";
         $url = preg_replace($pat,$rpl,$url);
     }
-    $url = preg_replace('/&/','&amp;',$url);
+    if ($link) {
+        $url = str_replace('&','&amp;',$url);
+    }
     return $url;
 }