mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-10 22:18:40 +00:00
More path fixes
This commit is contained in:
parent
a042552878
commit
f4ad56632f
|
|
@ -14,6 +14,8 @@
|
||||||
* @link http://orange-management.com
|
* @link http://orange-management.com
|
||||||
*/
|
*/
|
||||||
namespace phpOMS\Module;
|
namespace phpOMS\Module;
|
||||||
|
use phpOMS\System\FilePathException;
|
||||||
|
use phpOMS\Validation\Validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* InfoManager class.
|
* InfoManager class.
|
||||||
|
|
@ -45,7 +47,7 @@ class InfoManager
|
||||||
* @var \string
|
* @var \string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private static $module_path = __DIR__ . '/../../Modules/';
|
const MODULE_PATH = __DIR__ . '/../../Modules/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object constructor.
|
* Object constructor.
|
||||||
|
|
@ -57,9 +59,11 @@ class InfoManager
|
||||||
*/
|
*/
|
||||||
public function __construct(\string $module)
|
public function __construct(\string $module)
|
||||||
{
|
{
|
||||||
if (file_exists(self::$module_path . $module . '/info.json')) {
|
if (($path = realpath($oldPath = self::MODULE_PATH . $module . '/info.json')) === false || Validator::startsWith($path, self::MODULE_PATH)) {
|
||||||
$this->fp = fopen(self::$module_path . $module . '/info.json', 'r');
|
throw new FilePathException($oldPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->fp = fopen($oldPath, 'r');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update()
|
public function update()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user