public function __construct() { // check if the user is logged in $this->validateLogin(); // named application if (!defined('NAMED_APPLICATION')) { define('NAMED_APPLICATION', 'backend_ajax'); } // get values from the GET-parameters $module = isset($_GET['fork']['module']) ? $_GET['fork']['module'] : ''; $action = isset($_GET['fork']['action']) ? $_GET['fork']['action'] : ''; $language = isset($_GET['fork']['language']) ? $_GET['fork']['language'] : SITE_DEFAULT_LANGUAGE; // overrule the values with the ones provided through POST $module = isset($_POST['fork']['module']) ? $_POST['fork']['module'] : $module; $action = isset($_POST['fork']['action']) ? $_POST['fork']['action'] : $action; $language = isset($_POST['fork']['language']) ? $_POST['fork']['language'] : $language; // create URL instance, since the template modifiers need this object $URL = new BackendURL(); $URL->setModule($module); $this->setModule($module); $this->setAction($action); $this->setLanguage($language); // create a new action $action = new BackendAJAXAction(); $action->setModule($this->getModule()); $action->setAction($this->getAction()); try { $action->execute(); } catch (Exception $e) { // set correct headers SpoonHTTP::setHeadersByCode(500); // if we are debugging we should see the exceptions if (SPOON_DEBUG) { throw $e; } // output $fakeAction = new BackendBaseAJAXAction(); $fakeAction->output(BackendBaseAJAXAction::ERROR, null, $e->getMessage()); } }