/**
* 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
}
if ( $val <> '' ) {
- $ret .= ">$val</$tag>";
+ $ret .= ">$val</$tag>\n";
} else {
- $ret .= '>';
+ $ret .= '>'. "\n";
}
return( $ret );
/* 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('/&/','&',$url);
+ preg_replace('/&/','&',$url);
switch (true) {
case (preg_match($pat_a[0],$url,$regs)):
$k = $regs[1];
if ($k) {
if ($val) {
$rpl = "$k=$val";
- if ($link) {
- $rpl = preg_replace('/&/','&',$rpl);
- }
+ if ($link) {
+ $rpl = preg_replace('/&/','&',$rpl);
+ }
} else {
$rpl = '';
}
+ if( substr($v,-1)=='&' ) {
+ $rpl .= '&';
+ }
$pat = "/$k=$v/";
$url = preg_replace($pat,$rpl,$url);
}