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
This commit is contained in:
ilya 2008-04-12 14:46:28 +02:00
parent 4a808d36e6
commit b934b85140
1 changed files with 5 additions and 2 deletions

View File

@ -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