added iframe code (used when show_html_default = true)
[squirrelmail.git] / functions / html.php
index 91acef9542da20b5b00dde4b667b2a8bb19f127f..f575572480eb5fac7d25313a43e31a799d01ca2a 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * html.php
  *
- * Copyright (c) 1999-2004 The SquirrelMail Project Team
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * The idea is to inlcude here some functions to make easier
@@ -81,9 +81,9 @@ function html_tag( $tag,                // Tag to output
         }
 
         if ( $val <> '' ) {
-            $ret .= ">$val</$tag>";
+            $ret .= ">$val</$tag>\n";
         } else {
-            $ret .= '>';
+            $ret .= '>'. "\n";
         }
 
         return( $ret );
@@ -93,14 +93,13 @@ function html_tag( $tag,                // Tag to output
     /* especially usefull when $url = $PHP_SELF */
     function set_url_var($url, $var, $val=0, $link=true) {
         $k = '';
-        $ret = '';
         $pat_a = array (
                        '/.+(\\&'.$var.')=(.*)\\&/AU',   /* in the middle */
                        '/.+\\?('.$var.')=(.*\\&).+/AU', /* at front, more follow */
                        '/.+(\\?'.$var.')=(.*)$/AU',     /* at front and only var */
                        '/.+(\\&'.$var.')=(.*)$/AU'      /* at the end */
                      );
-       preg_replace('/&amp;/','&',$url);
+        preg_replace('/&amp;/','&',$url);
         switch (true) {
             case (preg_match($pat_a[0],$url,$regs)):
                 $k = $regs[1];
@@ -132,12 +131,15 @@ function html_tag( $tag,                // Tag to output
         if ($k) {
             if ($val) {
                 $rpl = "$k=$val";
-               if ($link) {
-                   $rpl = preg_replace('/&/','&amp;',$rpl);
-               }
+                if ($link) {
+                    $rpl = preg_replace('/&/','&amp;',$rpl);
+                }
             } else {
                 $rpl = '';
             }
+            if( substr($v,-1)=='&' ) {
+                $rpl .= '&';
+            }
             $pat = "/$k=$v/";
             $url = preg_replace($pat,$rpl,$url);
         }