Esempio n. 1
0
 static function render($viewName)
 {
     $viewName = str_replace('\\', DIRECTORY_SEPARATOR, $viewName);
     if (!self::exists($viewName)) {
         throw new ViewNotFoundException('View not found: ' . $viewName);
     }
     // Add some useful vars to the response
     $config = \ManiaLib\Application\Config::getInstance();
     $session = \ManiaLib\Application\Session::getInstance();
     $response = \ManiaLib\Application\Response::getInstance();
     $tracking = \ManiaLib\Application\Tracking\Config::getInstance();
     $response->login = $session->login;
     $response->mediaURL = $config->getMediaURL();
     $response->appURL = $config->getLinkCreationURL();
     $response->baseURL = $config->URL;
     $response->trackingAccount = $tracking->account;
     $vars = \ManiaLib\Application\Response::getInstance()->getAll();
     extract($vars);
     error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
     if (file_exists(MANIALIB_APP_PATH . 'resources/' . $viewName . '.php')) {
         require MANIALIB_APP_PATH . 'resources/' . $viewName . '.php';
     } else {
         require MANIALIB_APP_PATH . 'ressources/' . $viewName . '.php';
     }
     error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);
 }
Esempio n. 2
0
 function postFilter()
 {
     $response = \ManiaLib\Application\Response::getInstance();
     if ($this->account) {
         $trackingURL = $response->get('trackingURL');
         if ($trackingURL) {
             $trackingURL[] = $this->tracker->getTrackingURL();
             $response->trackingURL = $trackingURL;
         } else {
             $response->trackingURL = array($this->tracker->getTrackingURL());
         }
     }
     $response->registerView('\\ManiaLib\\Application\\Tracking\\View');
 }
Esempio n. 3
0
 protected function executeAction($actionName, $registerView = true, $resetViews = false)
 {
     $this->checkActionExists($actionName);
     if ($resetViews) {
         $this->response->resetViews();
     }
     if ($registerView) {
         $this->response->registerView($this->response->getViewClassName($this->controllerName, $actionName));
     }
     $callParameters = array();
     $requiredParameters = $this->reflectionMethods[$actionName]->getParameters();
     foreach ($requiredParameters as $parameter) {
         if ($parameter->isDefaultValueAvailable()) {
             $callParameters[] = $this->request->get($parameter->getName(), $parameter->getDefaultValue());
         } else {
             $pname = $parameter->getName();
             $pmessage = 'Undefined parameter: $<$o' . $pname . '$>';
             $callParameters[] = $this->request->getStrict($pname, $pmessage);
         }
     }
     $this->actionName = $actionName;
     call_user_func_array(array($this, $actionName), $callParameters);
 }
Esempio n. 4
0
 /**
  * Call the parent constructor when you override it in your filters!
  */
 function __construct()
 {
     $this->request = \ManiaLib\Application\Request::getInstance();
     $this->response = \ManiaLib\Application\Response::getInstance();
     $this->session = \ManiaLib\Application\Session::getInstance();
 }
Esempio n. 5
0
 /**
  * Creates a Manialink redirection to the previously registered referer, or
  * the index if no referer was previously registered
  */
 function redirectToReferer()
 {
     Response::getInstance()->redirect($this->getReferer());
 }