\Vor\application\Frontend::class, ]; $methodMap = [ // Add public allowed methods 'Frontend' => ['clean'], ]; $target = trim((string)($_POST['target'] ?? '')); $method = trim((string)($_POST['method'] ?? '')); if($target === '' || $method === ''){ Sys::json(['status' => 'fail', 'message' => 'Missing target'], 400); } if(!isset($classMap[$target])){ Sys::json(['status' => 'fail', 'message' => 'Invalid class'], 404); } if(!in_array($method, $methodMap[$target] ?? [], true)){ Sys::json(['status' => 'fail', 'message' => 'Invalid method'], 404); } $obj = new $classMap[$target]; foreach($_POST as $k => $v){ if($k === 'target' || $k === 'method'){ continue; } if(property_exists($obj, $k)){ $obj->$k = $v; } } foreach(($_FILES ?? []) as $k => $v){ if(property_exists($obj, $k)){ $obj->$k = $v; } } try{ $resp = $obj->$method(); Sys::json(['status' => $resp ? 'success' : 'fail', 'message' => $resp], 200); }catch(\Throwable $e){ error_log($e->getMessage()); Sys::json(['status' => 'fail', 'message' => 'Server error'], 500); }