Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
8168035f00 | |||
99328c27cc |
@ -90,12 +90,6 @@ function verifyPath(string $path): void
|
|||||||
function fixPath(string $path): string
|
function fixPath(string $path): string
|
||||||
{
|
{
|
||||||
$path = dirname($_SERVER['SCRIPT_FILENAME']) . '/../../../../../../' . $path;
|
$path = dirname($_SERVER['SCRIPT_FILENAME']) . '/../../../../../../' . $path;
|
||||||
|
|
||||||
$re = '/\/[^\/.]*\/\.\.\//mU';
|
|
||||||
while(preg_match($re, $path)) {
|
|
||||||
$path = preg_replace($re, "/", $path);
|
|
||||||
}
|
|
||||||
|
|
||||||
$path = str_replace('\\', '/', $path);
|
$path = str_replace('\\', '/', $path);
|
||||||
$path = RoxyFile::FixPath($path);
|
$path = RoxyFile::FixPath($path);
|
||||||
return $path;
|
return $path;
|
||||||
@ -172,7 +166,7 @@ class RoxyFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $path
|
* @param $path
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function CreatePath(string $path): bool
|
public static function CreatePath(string $path): bool
|
||||||
@ -180,9 +174,8 @@ class RoxyFile
|
|||||||
if (is_dir($path)) {
|
if (is_dir($path)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$prev_path = substr($path, 0, strrpos($path, '/', -2) + 1);
|
$prev_path = substr($path, 0, strrpos($path, '/', -2) + 1);
|
||||||
$return = self::CreatePath( $prev_path);
|
$return = self::createPath($prev_path);
|
||||||
return $return && is_writable($prev_path) && mkdir($path);
|
return $return && is_writable($prev_path) && mkdir($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user