PHP3 fixes

This commit is contained in:
Zone 2002-02-10 04:19:43 +00:00
parent e00280c5b0
commit 5d6721af18
6 changed files with 31 additions and 26 deletions

View File

@ -367,7 +367,7 @@ function html_link ($href = NULL, $text = NULL, $return = 0, $encode = 1, $linko
$href = SEP . $href;
/* $phpgw->link requires that the extra vars be passed separately */
$link_parts = explode ("?", $href, 2);
$link_parts = explode ("?", $href);
$address = $GLOBALS['phpgw']->link ($link_parts[0], $link_parts[1]);
}
else

View File

@ -179,7 +179,16 @@ function string_encode ($string, $return = False)
{
if (preg_match ("/=(.*)(&|$)/U", $string))
{
$rstring = preg_replace ("/=(.*)(&|$)/Ue", "'=' . rawurlencode (base64_encode ('\\1')) . '\\2'", $string);
$rstring = $string;
preg_match_all ("/=(.*)(&|$)/U", $string, $matches, PREG_SET_ORDER);
reset ($matches);
while (list (,$match_array) = each ($matches))
{
$var_encoded = rawurlencode (base64_encode ($match_array[1]));
$rstring = str_replace ($match_array[0], '=' . $var_encoded . $match_array[2], $rstring);
}
}
elseif (ereg ('^'.$GLOBALS['hostname'], $string))
{

View File

@ -7,13 +7,13 @@
$phpwh_debug = 0;
@reset ($GLOBALS['HTTP_POST_VARS']);
while (list ($name,) = each ($GLOBALS['HTTP_POST_VARS']))
while (list ($name,) = @each ($GLOBALS['HTTP_POST_VARS']))
{
$$name = $GLOBALS['HTTP_POST_VARS'][$name];
}
@reset ($GLOBALS['HTTP_GET_VARS']);
while (list ($name,) = each ($GLOBALS['HTTP_GET_VARS']))
while (list ($name,) = @each ($GLOBALS['HTTP_GET_VARS']))
{
$$name = $GLOBALS['HTTP_GET_VARS'][$name];
}
@ -235,7 +235,13 @@ if (($path == $GLOBALS['homedir'])
)
{
$GLOBALS['phpgw']->vfs->override_acl = 1;
$GLOBALS['phpgw']->vfs->mkdir (array ('string' => $GLOBALS['homedir'], 'relatives' => array (RELATIVE_NONE)));
if (!$GLOBALS['phpgw']->vfs->mkdir (array ('string' => $GLOBALS['homedir'], 'relatives' => array (RELATIVE_NONE))))
{
$p = $phpgw->vfs->path_parts (array ('string' => $GLOBALS['homedir'], 'relatives' => array (RELATIVE_NONE)));
echo $GLOBALS['phpgw']->common->error_list (array ('Could not create directory ' . $GLOBALS['homedir'] . ' (' . $p->real_full_path . ')'));
}
$GLOBALS['phpgw']->vfs->override_acl = 0;
}
elseif (preg_match ('|^'.$GLOBALS['fakebase'].'\/(.*)$|U', $path, $matches))

View File

@ -81,7 +81,7 @@
$templates = array (
'pref' => 'pref.tpl',
'pref_colspan' => 'pref_colspan.tpl',
'pref_list' => 'pref_list.tpl',
'pref_list' => 'pref_list.tpl'
);
$p->set_file ($templates);

View File

@ -9,7 +9,7 @@ include("../header.inc.php");
/*
General format for output is:
function - current directory - input[...] - what output should be - what output was
sequence number - function - current directory - input[...] - what output should be - what output was
*/
html_break (1);
@ -28,8 +28,6 @@ $currentapp = $phpgw_info["flags"]["currentapp"];
$sequence_num = 1;
$phpgw->vfs->cd ();
//$phpgw->common->phpgw_footer ();
//$phpgw->common->phpgw_exit ();
$io = array ("" => "$homedir", "dir" => "$homedir/dir", "dir/file" => "$homedir/dir/file", "dir/dir2" => "$homedir/dir/dir2", "dir/dir2/file" => "$homedir/dir/dir2/file", "`~!@#$%^&*()-_=+/|[{]};:'\",<.>?" => "$homedir/`~!@#$%^&*()-_=+/|[{]};:'\",<.>?");
while (list ($i, $o) = each ($io))
@ -80,7 +78,7 @@ while (list ($i, $o) = each ($io))
$sequence_num = 4;
$cd = "";
$phpgw->vfs->cd (array(
'string' => $cd,
'string' => $cd
)
);
$relatives = array (RELATIVE_USER);
@ -101,7 +99,7 @@ $cd = "test2/test4";
$phpgw->vfs->cd (array(
'string' => $cd,
'relative' => False,
'relatives' => array (RELATIVE_NONE),
'relatives' => array (RELATIVE_NONE)
)
);
$relatives = array (RELATIVE_NONE);
@ -121,7 +119,7 @@ $cd = "test3/test5";
$phpgw->vfs->cd (array(
'string' => $cd,
'relative' => False,
'relatives' => array (RELATIVE_NONE),
'relatives' => array (RELATIVE_NONE)
)
);
$relatives = array (RELATIVE_USER_APP);
@ -271,6 +269,8 @@ while (list ($i, $o) = each ($io))
# end of path_parts tests
###
$phpgw->vfs->cd ();
html_break (2);
html_text_bold ("The less output, the better. Please file errors as a " . html_link ("https://sourceforge.net/tracker/?group_id=7305&atid=107305", "bug report", True, False) . ". Be sure to include the system information line at the top, and anything special about your setup. Thanks!");

View File

@ -181,7 +181,7 @@
*/
function get_relative ()
{
if (isset ($this->relative))
if (isset ($this->relative) && $this->relative)
{
return $this->relative;
}
@ -1051,7 +1051,7 @@
$basedir = ereg_replace ($sep . $sep, $sep, $basedir);
}
$basedir = ereg_replace ($sep.'$', '', $basedir);
$basedir = ereg_replace ($sep . '$', '', $basedir);
return $basedir;
}
@ -2685,8 +2685,6 @@
*/
function get_ext_mime_type ($data)
{
static $mimetype = Array();
if (!is_array ($data))
{
$data = array ();
@ -2701,11 +2699,6 @@
$parts=explode('.',strtolower($file));
$ext=$parts[(sizeof($parts)-1)];
if(isset($mimetype[$ext]))
{
return $mimetype[$ext];
}
for($i=0;$i<sizeof($contents);$i++)
{
if (!ereg("^#",$contents[$i]))
@ -2717,17 +2710,14 @@
{
if($line[$j] == $ext)
{
$mimetype[$ext] = $line[0];
return $mimetype[$ext];
return $line[0];
}
}
}
}
}
$mimetype[$ext] = '';
return $mimetype[$ext];
return '';
}
/*!