Compare commits

..

2 Commits

Author SHA1 Message Date
8168035f00
Merge branch 'rel_1.x' into main 2023-05-04 14:59:21 +02:00
99328c27cc
update documentation 2023-05-04 12:01:39 +02:00

View File

@ -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);
} }