From b934b85140ee99c367fd5d2e55436e368f7b844a Mon Sep 17 00:00:00 2001 From: ilya <ilya@lebedev.net> Date: Sat, 12 Apr 2008 14:46:28 +0200 Subject: [PATCH] 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 --- inc/init.php | 7 +++++-- 1 file 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 -- GitLab