/** * You have to specify the action and module so we know what to do with this instance * * @param string $action The action to load. * @param string $module The module to load. */ public function __construct($action, $module) { $this->setModule($module); $this->setAction($action); $this->loadConfig(); $allowed = false; // is this an allowed action if (BackendAuthentication::isAllowedAction($action, $this->getModule())) { $allowed = true; } // is this an allowed AJAX-action? if (!$allowed) { // set correct headers SpoonHTTP::setHeadersByCode(403); // output $fakeAction = new BackendBaseAJAXAction('', ''); $fakeAction->output(BackendBaseAJAXAction::FORBIDDEN, null, 'Not logged in.'); } }
/** * Do authentication stuff * This method could end the script by throwing an exception * * @return void */ private function validateLogin() { // check if the user is logged on, if not he shouldn't load any JS-file if (!BackendAuthentication::isLoggedIn()) { // set the correct header SpoonHTTP::setHeadersByCode(403); // output $fakeAction = new BackendBaseAJAXAction('', ''); $fakeAction->output(BackendBaseAJAXAction::FORBIDDEN, null, 'Not logged in.'); } // set interface language BackendLanguage::setLocale(BackendAuthentication::getUser()->getSetting('interface_language')); }