[LIB][Util] Make Common::config return the unserialized value instead of the entity
This commit is contained in:
parent
284fbe2c5b
commit
d6cd52cede
@ -40,7 +40,7 @@ abstract class Common
|
|||||||
*/
|
*/
|
||||||
public static function config(string $section, string $setting)
|
public static function config(string $section, string $setting)
|
||||||
{
|
{
|
||||||
return DB::find('config', ['section' => $section, 'setting' => $setting]);
|
return unserialize(DB::find('config', ['section' => $section, 'setting' => $setting])->getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,29 +61,32 @@ abstract class Common
|
|||||||
*/
|
*/
|
||||||
public static function isSystemPath(string $str): bool
|
public static function isSystemPath(string $str): bool
|
||||||
{
|
{
|
||||||
$paths = [];
|
// TODO Implement
|
||||||
|
return false;
|
||||||
|
|
||||||
// All directory and file names in site root should be blacklisted
|
// $paths = [];
|
||||||
$d = dir(PUBLICDIR);
|
|
||||||
while (false !== ($entry = $d->read())) {
|
|
||||||
$paths[$entry] = true;
|
|
||||||
}
|
|
||||||
$d->close();
|
|
||||||
|
|
||||||
// All top level names in the router should be blocked
|
// // All directory and file names in site root should be blacklisted
|
||||||
$router = Router::get();
|
// $d = dir(PUBLICDIR);
|
||||||
foreach ($router->m->getPaths() as $path) {
|
// while (false !== ($entry = $d->read())) {
|
||||||
if (preg_match('/^([^\/\?]+)[\/\?]/', $path, $matches) && isset($matches[1])) {
|
// $paths[$entry] = true;
|
||||||
$paths[$matches[1]] = true;
|
// }
|
||||||
}
|
// $d->close();
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: this assumes the 'path' is in the first-level directory, though common it's not certain
|
// // All top level names in the router should be blocked
|
||||||
foreach (['avatar', 'attachments'] as $cat) {
|
// $router = Router::get();
|
||||||
$paths[basename(common_config($cat, 'path'))] = true;
|
// foreach ($router->m->getPaths() as $path) {
|
||||||
}
|
// if (preg_match('/^([^\/\?]+)[\/\?]/', $path, $matches) && isset($matches[1])) {
|
||||||
|
// $paths[$matches[1]] = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
return in_array($str, array_keys($paths));
|
// // FIXME: this assumes the 'path' is in the first-level directory, though common it's not certain
|
||||||
|
// foreach (['avatar', 'attachments'] as $cat) {
|
||||||
|
// $paths[basename(common_config($cat, 'path'))] = true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return in_array($str, array_keys($paths));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user