Example #1
0
 /**
  * Default constructor
  *
  * @return	void
  */
 public function __construct()
 {
     // check if the user is logged in
     $this->validateLogin();
     // named application
     if (!defined('NAMED_APPLICATION')) {
         define('NAMED_APPLICATION', 'backend_ajax');
     }
     // set the module
     $this->setModule(SpoonFilter::getGetValue('module', null, ''));
     // set the action
     $this->setAction(SpoonFilter::getGetValue('action', null, ''));
     // set the language
     $this->setLanguage(SpoonFilter::getGetValue('language', null, ''));
     // create a new action
     $action = new BackendAJAXAction($this->getAction(), $this->getModule());
     // try to execute
     try {
         // execute the action
         $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());
     }
 }
Example #2
0
 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;
     $this->setModule($module);
     $this->setAction($action);
     $this->setLanguage($language);
     // create a new action
     $action = new BackendAJAXAction($this->getAction(), $this->getModule());
     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());
     }
 }