summaryrefslogtreecommitdiff
path: root/inc/init.php
diff options
context:
space:
mode:
authorilya <ilya@lebedev.net>2008-04-12 14:46:28 +0200
committerilya <ilya@lebedev.net>2008-04-12 14:46:28 +0200
commitb934b85140ee99c367fd5d2e55436e368f7b844a (patch)
treeda7b7bcff737fd38b20af1e09515ab96d47ccea5 /inc/init.php
parent4a808d36e6b3fb527f5b9bc77c97464672515b2b (diff)
downloadrpg-b934b85140ee99c367fd5d2e55436e368f7b844a.tar.gz
rpg-b934b85140ee99c367fd5d2e55436e368f7b844a.tar.bz2
fix for UNC paths
This patch fixes use of UNC path in $conf['savedir'] and calling of /bin/ scripts. darcs-hash:20080412124628-51399-9f85214fa4d787d5ad3a3b3c1ca655a29efc07e4.gz
Diffstat (limited to 'inc/init.php')
-rw-r--r--inc/init.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/inc/init.php b/inc/init.php
index ee82bbe0e..5a565c9af 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -420,12 +420,14 @@ EOT;
*/
function fullpath($path){
$iswin = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
+ $isunc = 0===strpos($path,'\\\\');
if($iswin) $path = str_replace('\\','/',$path); // windows compatibility
// check if path begins with "/" or "c:" ie. is absolute
// if it isnt concat with script path
- if ((!$iswin && $path{0} !== '/') ||
- ($iswin && $path{1} !== ':')) {
+ if (!$isunc &&
+ ((!$iswin && $path{0} !== '/') ||
+ ($iswin && $path{1} !== ':'))) {
$base=dirname($_SERVER['SCRIPT_FILENAME']);
$path=$base."/".$path;
}
@@ -442,6 +444,7 @@ function fullpath($path){
array_push($newpath, $p);
}
$finalpath = implode('/', $newpath);
+ if($isunc) $finalpath = '//'.$finalpath;
if(!$iswin) $finalpath = '/'.$finalpath;
// check then return valid path or filename