[Chameleon-dev] [Bug 575] [chameleon] Keymap widget cannot use a
URL for file location
bugzilla-daemon at www.maptools.org
bugzilla-daemon at www.maptools.org
Fri Oct 1 10:38:47 EDT 2004
http://www.maptools.org/bugzilla/show_bug.cgi?id=575
------- Additional Comments From jlacroix at dmsolutions.ca 2004-10-01 10:38 -------
I noticed 2 problems while working on this. But I want to make sure with Paul
that they were not intentional before commiting anything. My change would be in
the core, so I want to make sure they are ok.
1- The fileSystemToURL() function did not check for the TmpImgPath directory.
2- There's no way of making a non-web-visible file web-visible.
To fix that I added in this function the functionality to copy files to the
TmpWebPath directory and to get file from the TmpIngPath.
Should I've done a new function for this purpose? Or is it ok to put them there?
Look:
function fileSystemToURL( $szFileSystemPath, $bMakeWebVisible=false )
{
$szFileSystemPath = str_replace( '\\', '/', $szFileSystemPath );
$szFileSystemPath = ereg_replace ("/+", "/", $szFileSystemPath);
//echo "filesystem path: $szFileSystemPath<BR>";
$szAppPath = str_replace( '\\', '/', realpath($_SESSION['gszAppPath']) );
$szAppPath = ereg_replace ("/+", "/", $szAppPath);
//echo "app path: $szAppPath<BR>";
if (strncmp( $szFileSystemPath, $szAppPath, strlen($szAppPath) ) == 0)
return $_SESSION['gszAppWebPath'].'/'.substr( $szFileSystemPath,
strlen($szAppPath));
$szCorePath = str_replace( '\\', '/', realpath($_SESSION['gszCorePath']) );
$szCorePath = ereg_replace ("/+", "/", $szCorePath);
if (strncmp( $szFileSystemPath, $szCorePath, strlen($szCorePath) ) == 0)
return
$_SESSION['gszCoreWebPath'].'/'.substr($szFileSystemPath,strlen($szCorePath));
$szTmpImgPath = str_replace( '\\', '/',
realpath($_SESSION['gszTmpImgPath']) );
$szTmpImgPath = ereg_replace ("/+", "/", $szTmpImgPath);
if (strncmp( $szFileSystemPath, $szTmpImgPath, strlen($szTmpImgPath) ) == 0)
return
$_SESSION['gszTmpWebPath'].'/'.substr($szFileSystemPath,strlen($szTmpImgPath));
if($bMakeWebVisible == true && is_file($szFileSystemPath))
{
$szDestFileName = $szTmpImgPath.'/'.
substr($szFileSystemPath, strrpos($szFileSystemPath, '/'));
copy($szFileSystemPath, $szDestFileName);
return
$_SESSION['gszTmpWebPath'].'/'.substr($szDestFileName,strlen($szTmpImgPath)+1);
}
return $szFileSystemPath;
}
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the Chameleon-dev
mailing list