Skip to content

Instantly share code, notes, and snippets.

@anoriar
Created November 16, 2018 09:15
Show Gist options
  • Save anoriar/50678d13ccffa9e45a080c98fc69db2d to your computer and use it in GitHub Desktop.
Save anoriar/50678d13ccffa9e45a080c98fc69db2d to your computer and use it in GitHub Desktop.
safe get request + mvc
$request = Application::getInstance()->getContext()->getRequest();
try {
if (!Loader::includeModule('aero.main')) {
throw new Exception('Can\'t include module "Aero".');
}
$name = htmlspecialchars($request->getQuery("controller"));
$action = htmlspecialchars($request->getQuery("action"));
$controller = Mvc::factory($name);
$controller->doAction($action);
} catch(Exception $e) {
print $e->GetMessage();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment