phpDocumentor updates
[squirrelmail.git] / functions / html.php
index b82dc5eefd9ad3ddebfaea305037f383cb5bbed3..62733c4d814f8bbb88c6f1231407f51822f8dc0f 100644 (file)
@@ -3,14 +3,13 @@
 /**
  * html.php
  *
- * Copyright (c) 1999-2003 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
  * the right to left implementation by "functionize" some
  * html outputs.
  *
- * $Id$
+ * @copyright © 1999-2005 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
  * @package squirrelmail
  */
 
@@ -51,7 +50,7 @@ function html_tag( $tag,                // Tag to output
         }
 
         if ( $bgcolor <> '' ) {
-            $bgc = " bgcolor=\"$bgcolor\""; 
+            $bgc = " bgcolor=\"$bgcolor\"";
         }
 
         switch ( $align ) {
@@ -81,10 +80,10 @@ function html_tag( $tag,                // Tag to output
         }
 
         if ( $val <> '' ) {
-            $ret .= ">$val</$tag>";
+            $ret .= ">$val</$tag>\n";
         } else {
-            $ret .= '>';
-        } 
+            $ret .= '>'. "\n";
+        }
 
         return( $ret );
     }
@@ -93,14 +92,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 +130,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);
         }
@@ -151,7 +152,7 @@ function html_tag( $tag,                // Tag to output
     function echo_template_var($var, $format_ar = array() ) {
         $frm_last = count($format_ar) -1;
 
-        if (isset($format_ar[0])) echo $format_ar[0]; 
+        if (isset($format_ar[0])) echo $format_ar[0];
             $i = 1;
 
         switch (true) {
@@ -179,4 +180,4 @@ function html_tag( $tag,                // Tag to output
             echo $format_ar[$frm_last];
         }
     }
-?>
+?>
\ No newline at end of file