[Phpfreechat-svn] SF.net SVN: phpfreechat: [657] trunk/src/pfctools.php
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-07-17 14:57:14
|
Revision: 657 Author: kerphi Date: 2006-07-17 07:57:01 -0700 (Mon, 17 Jul 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=657&view=rev Log Message: ----------- Bug fix: some paths were wrongly calculated (https://sourceforge.net/support/tracker.php?aid=1523821) Modified Paths: -------------- trunk/src/pfctools.php Modified: trunk/src/pfctools.php =================================================================== --- trunk/src/pfctools.php 2006-07-17 14:20:51 UTC (rev 656) +++ trunk/src/pfctools.php 2006-07-17 14:57:01 UTC (rev 657) @@ -64,14 +64,20 @@ $res = ""; //echo $p1."<br>"; //echo $p2."<br>"; - while( $p1 != "" && $p1 != "/" && strpos($p2, $p1) === FALSE) + while( $p1 != "" && $p1 != "/" && strpos($p2, $p1) !== 0) { $res .= "../"; $p1 = dirname($p1); } - $p2 = (isset($_SERVER["WINDIR"]) || isset($_SERVER["windir"])) ? - str_replace("\\","/",substr($p2, strlen($p1)+1, strlen($p2)-strlen($p1))) : - substr($p2, strlen($p1)+1, strlen($p2)-strlen($p1)); + if (isset($_SERVER["WINDIR"]) || isset($_SERVER["windir"])) { + $p2 = str_replace("\\","/",substr($p2, strlen($p1)+1, strlen($p2)-strlen($p1))); + } else { + if ($p1 === "/" || $p1 === "") { + $p2 = substr($p2, strlen($p1)); + } else { + $p2 = substr($p2, strlen($p1)+1); + } + } $res .= $p2; // remove the last "/" if (preg_match("/.*\/$/", $res)) $res = preg_replace("/(.*)\//","$1",$res); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |