mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Fixes #80
This commit is contained in:
parent
8c1e601bfd
commit
dd04acdb59
|
|
@ -142,7 +142,7 @@ class FileCache implements CacheInterface
|
|||
return false;
|
||||
}
|
||||
|
||||
$path = File::sanitize($key);
|
||||
$path = File::sanitize($key, '~');
|
||||
|
||||
file_put_contents($this->cachePath . '/' . $path, $this->build($value, $expire));
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ class FileCache implements CacheInterface
|
|||
return false;
|
||||
}
|
||||
|
||||
$path = File::sanitize($key);
|
||||
$path = File::sanitize($key, '~');
|
||||
|
||||
if (!file_exists($this->cachePath . '/' . $path)) {
|
||||
file_put_contents($this->cachePath . '/' . $path, $this->build($value, $expire));
|
||||
|
|
@ -274,7 +274,7 @@ class FileCache implements CacheInterface
|
|||
return null;
|
||||
}
|
||||
|
||||
$name = File::sanitize($key);
|
||||
$name = File::sanitize($key, '~');
|
||||
$path = $this->cachePath . '/' . $name;
|
||||
|
||||
if(!file_exists($path)) {
|
||||
|
|
@ -341,7 +341,7 @@ class FileCache implements CacheInterface
|
|||
return false;
|
||||
}
|
||||
|
||||
$name = File::sanitize($key);
|
||||
$name = File::sanitize($key, '~');
|
||||
$path = $this->cachePath . '/' . $name;
|
||||
|
||||
if ($expire < 0 && file_exists($path)) {
|
||||
|
|
@ -404,7 +404,7 @@ class FileCache implements CacheInterface
|
|||
return false;
|
||||
}
|
||||
|
||||
$path = File::sanitize($key);
|
||||
$path = File::sanitize($key, '~');
|
||||
|
||||
if (file_exists($this->cachePath . '/' . $path)) {
|
||||
file_put_contents($this->cachePath . '/' . $path, $this->build($value, $expire));
|
||||
|
|
|
|||
|
|
@ -197,13 +197,14 @@ interface ContainerInterface
|
|||
* Make name/path operating system safe.
|
||||
*
|
||||
* @param string $path Path of the resource
|
||||
* @param string $replace Replace invalid chars with
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function sanitize(string $path) : string;
|
||||
public static function sanitize(string $path, string $replace = '') : string;
|
||||
|
||||
/**
|
||||
* Get amount of sub-resources.
|
||||
|
|
|
|||
|
|
@ -260,9 +260,9 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function sanitize(string $path) : string
|
||||
public static function sanitize(string $path, string $replace = '') : string
|
||||
{
|
||||
return preg_replace('[^\w\s\d\.\-_~,;:\[\]\(\]\/]', '', $path);
|
||||
return preg_replace('[^\w\s\d\.\-_~,;:\[\]\(\]\/]', $replace, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -143,9 +143,9 @@ class File extends FileAbstract implements FileInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function sanitize(string $path) : string
|
||||
public static function sanitize(string $path, string $replace = '') : string
|
||||
{
|
||||
return preg_replace('/[^\w\s\d\.\-_~,;\[\]\(\]]/', '', $path);
|
||||
return preg_replace('/[^\w\s\d\.\-_~,;\[\]\(\]]/', $replace, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user