[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


           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

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,
        $szCorePath = str_replace( '\\', '/', realpath($_SESSION['gszCorePath']) );
        $szCorePath = ereg_replace ("/+", "/", $szCorePath);
        if (strncmp( $szFileSystemPath, $szCorePath, strlen($szCorePath) ) == 0)
        $szTmpImgPath = str_replace( '\\', '/',
                                     realpath($_SESSION['gszTmpImgPath']) );
        $szTmpImgPath = ereg_replace ("/+", "/", $szTmpImgPath);
        if (strncmp( $szFileSystemPath, $szTmpImgPath, strlen($szTmpImgPath) ) == 0)
        // 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 $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