From 40b2db3e504d44a5824a80aa48d4d941b24810e9 Mon Sep 17 00:00:00 2001 From: Madpwnhammer Date: Mon, 25 Sep 2023 16:55:12 +0300 Subject: [PATCH] fix flt_class --- filters.inc.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/filters.inc.php b/filters.inc.php index b83739c..6e03e0e 100644 --- a/filters.inc.php +++ b/filters.inc.php @@ -86,18 +86,14 @@ function flt_class($val, $name, $struct, $args) $conf_path = \taskman\config_real_path($conf_path); - $lines = file($conf_path); - foreach($lines as $line) - { - if(preg_match('~"?class"?\s*:\s*"([^"]+)"~', $line, $matches)) - { - $conf_class = $matches[1]; - if($conf_class != $args[0] && !is_subclass_of($conf_class, $args[0])) - throw new Exception($val.". Config class is \"".$conf_class."\". Must be \"".$args[0]."\" or it's child"); - else - return $val; - } - } + $cce = \taskman\config_fetch_by_path($conf_path); + + $conf_class = $cce->class; + + if($conf_class != $args[0] && !is_subclass_of($conf_class, $args[0])) + throw new Exception($val.". Config class is \"".$conf_class."\". Must be \"".$args[0]."\" or it's child"); + else + return $val; throw new Exception($val.". Config class is not found in '$conf_path'"); }