mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-06 04:28:41 +00:00
Fixes #80
This commit is contained in:
parent
8c1e601bfd
commit
dd04acdb59
|
|
@ -142,7 +142,7 @@ class FileCache implements CacheInterface
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = File::sanitize($key);
|
$path = File::sanitize($key, '~');
|
||||||
|
|
||||||
file_put_contents($this->cachePath . '/' . $path, $this->build($value, $expire));
|
file_put_contents($this->cachePath . '/' . $path, $this->build($value, $expire));
|
||||||
|
|
||||||
|
|
@ -158,7 +158,7 @@ class FileCache implements CacheInterface
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = File::sanitize($key);
|
$path = File::sanitize($key, '~');
|
||||||
|
|
||||||
if (!file_exists($this->cachePath . '/' . $path)) {
|
if (!file_exists($this->cachePath . '/' . $path)) {
|
||||||
file_put_contents($this->cachePath . '/' . $path, $this->build($value, $expire));
|
file_put_contents($this->cachePath . '/' . $path, $this->build($value, $expire));
|
||||||
|
|
@ -274,7 +274,7 @@ class FileCache implements CacheInterface
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = File::sanitize($key);
|
$name = File::sanitize($key, '~');
|
||||||
$path = $this->cachePath . '/' . $name;
|
$path = $this->cachePath . '/' . $name;
|
||||||
|
|
||||||
if(!file_exists($path)) {
|
if(!file_exists($path)) {
|
||||||
|
|
@ -341,7 +341,7 @@ class FileCache implements CacheInterface
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = File::sanitize($key);
|
$name = File::sanitize($key, '~');
|
||||||
$path = $this->cachePath . '/' . $name;
|
$path = $this->cachePath . '/' . $name;
|
||||||
|
|
||||||
if ($expire < 0 && file_exists($path)) {
|
if ($expire < 0 && file_exists($path)) {
|
||||||
|
|
@ -404,7 +404,7 @@ class FileCache implements CacheInterface
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = File::sanitize($key);
|
$path = File::sanitize($key, '~');
|
||||||
|
|
||||||
if (file_exists($this->cachePath . '/' . $path)) {
|
if (file_exists($this->cachePath . '/' . $path)) {
|
||||||
file_put_contents($this->cachePath . '/' . $path, $this->build($value, $expire));
|
file_put_contents($this->cachePath . '/' . $path, $this->build($value, $expire));
|
||||||
|
|
|
||||||
|
|
@ -197,13 +197,14 @@ interface ContainerInterface
|
||||||
* Make name/path operating system safe.
|
* Make name/path operating system safe.
|
||||||
*
|
*
|
||||||
* @param string $path Path of the resource
|
* @param string $path Path of the resource
|
||||||
|
* @param string $replace Replace invalid chars with
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
* @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.
|
* Get amount of sub-resources.
|
||||||
|
|
|
||||||
|
|
@ -260,9 +260,9 @@ class Directory extends FileAbstract implements DirectoryInterface
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@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}
|
* {@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