[Chameleon-dev] [Bug 1369] New: fileSystemToURL cannot deal with
skins outside of chameleon dir
bugzilla-daemon at bugzilla.maptools.org
bugzilla-daemon at bugzilla.maptools.org
Mon Mar 20 02:56:55 EST 2006
http://bugzilla.maptools.org/show_bug.cgi?id=1369
Summary: fileSystemToURL cannot deal with skins outside of
chameleon dir
Product: Chameleon
Version: 2.2
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Core
AssignedTo: chameleon-dev at lists.maptools.org
ReportedBy: bartvde at xs4all.nl
The fileSystemToURL function cannot deal with a situation in which a skin
resides outside of the Chameleon directory. This will result in url's given back
like:
http://145.50.148.45:82/data/geoservices-50/apps/geoservices/htdocs/skins/geoservices/images/ruler_pix.gif
I propose the following patch to fileSystemToURL (if the function does not
return within the first three options, it needs to be made web-accessible
automatically, so set $bMakeWebVisible=true):
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));
// bartvde, if the function does not return before here, it needs to be
made web visible automatically
$bMakeWebVisible = true;
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;
Any objections against this?
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
Please do NOT reply to this email, use the link above instead to
login to bugzilla and submit your comment. Any email reply to this
address will be lost.
More information about the Chameleon-dev
mailing list