Esempio n. 1
0
 public function onLoad()
 {
     // set parameters
     $this->container->setParameter('session.name', 'amun-' . md5($this->config['psx_url']));
     $this->container->setParameter('user.id', User::findUserId($this->getSession(), $this->getRegistry()));
     $this->container->setParameter('gadget.id', $this->location->getServiceId());
     // dependencies
     $this->get = $this->getInputGet();
     $this->post = $this->getInputPost();
     $this->registry = $this->getRegistry();
     $this->session = $this->getSession();
     $this->user = $this->getUser();
     $this->gadget = $this->getGadget();
     $this->args = $this->gadget->getArgs();
     // manager
     $this->hm = $this->getHandlerManager();
     // load cache
     if ($this->gadget->hasCache() && Base::getRequestMethod() == 'GET') {
         $expire = $this->gadget->getExpire();
         $expire = $expire instanceof DateInterval ? $expire : new DateInterval('P1D');
         $modified = new DateTime();
         $expires = clone $modified;
         $expires->add($expire);
         $type = $this->user->isAnonymous() ? 'public' : 'private';
         $maxAge = DateTime::convertIntervalToSeconds($expire);
         header('Expires: ' . $expires->format(DateTime::RFC1123));
         header('Last-Modified: ' . $modified->format(DateTime::RFC1123));
         header('Cache-Control: ' . $type . ', max-age=' . $maxAge);
         header('Pragma:');
         // remove pragma header
     }
 }
Esempio n. 2
0
 public function onLoad()
 {
     parent::onLoad();
     $this->container->setParameter('session.name', 'amun-' . md5($this->config['psx_url']));
     $this->container->setParameter('user.id', User::findUserId($this->getSession(), $this->getRegistry()));
     // dependencies
     $this->base = $this->getBase();
     $this->config = $this->getConfig();
     $this->sql = $this->getSql();
     $this->registry = $this->getRegistry();
     $this->session = $this->getSession();
     $this->user = $this->getUser();
 }
Esempio n. 3
0
 public function onLoad()
 {
     // set parameters
     if (!$this->container->hasParameter('session.name')) {
         $this->container->setParameter('session.name', 'amun-' . md5($this->config['psx_url']));
     }
     if (!$this->container->hasParameter('user.id')) {
         $this->container->setParameter('user.id', User::findUserId($this->getSession(), $this->getRegistry()));
     }
     $this->container->setParameter('service.id', $this->location->getServiceId());
     // dependencies
     $this->get = $this->getInputGet();
     $this->post = $this->getInputPost();
     $this->registry = $this->getRegistry();
     $this->session = $this->getSession();
     $this->user = $this->getUser();
     $this->service = $this->getService();
     // manager
     $this->hm = $this->getHandlerManager();
 }
Esempio n. 4
0
 public function onLoad()
 {
     // set parameters
     $this->container->setParameter('session.name', 'amun-' . md5($this->config['psx_url']));
     $this->container->setParameter('user.id', User::findUserId($this->getSession(), $this->getRegistry()));
     $this->container->setParameter('page.id', $this->location->getServiceId());
     $this->container->setParameter('service.id', $this->getPage()->getServiceId());
     // set xrds location header
     header('X-XRDS-Location: ' . $this->config['psx_url'] . '/' . $this->config['psx_dispatch'] . 'api/xrds');
     // dependencies
     $this->validate = $this->getValidate();
     $this->get = $this->getInputGet();
     $this->post = $this->getInputPost();
     $this->registry = $this->getRegistry();
     $this->session = $this->getSession();
     $this->user = $this->getUser();
     $this->page = $this->getPage();
     $this->service = $this->getService();
     $this->template = $this->getTemplate();
     // manager
     $this->hm = $this->getHandlerManager();
     // load nav
     if ($this->page->hasNav()) {
         $this->navigation = $this->getNavigation();
         $this->navigation->load();
     }
     // load path
     if ($this->page->hasPath()) {
         $this->path = $this->getPath();
         $this->path->load();
     }
     // load gadgets
     if ($this->page->hasGadget()) {
         $this->gadgetContainer = $this->getGadgetContainer();
         $this->gadgetContainer->load($this->getLoader(), $this->page, $this->getHtmlCss());
     }
     // load cache
     if ($this->page->hasCache() && Base::getRequestMethod() == 'GET') {
         $expire = $this->page->getExpire();
         $expire = $expire instanceof DateInterval ? $expire : new DateInterval('P1D');
         $modified = new DateTime();
         $expires = clone $modified;
         $expires->add($expire);
         $type = $this->user->isAnonymous() ? 'public' : 'private';
         $maxAge = DateTime::convertIntervalToSeconds($expire);
         header('Expires: ' . $expires->format(DateTime::RFC1123));
         header('Last-Modified: ' . $modified->format(DateTime::RFC1123));
         header('Cache-Control: ' . $type . ', max-age=' . $maxAge);
         header('Pragma:');
         // remove pragma header
     }
     // template dependencies
     $this->htmlJs = $this->getHtmlJs();
     $this->htmlCss = $this->getHtmlCss();
     $this->htmlContent = $this->getHtmlContent();
     // set application template path
     $dir = $this->service->getAutoloadPath() . '/' . $this->service->getNamespace() . '/Resource';
     $dir = str_replace('\\', '/', $dir);
     $this->template->setDir($dir);
     // add html fragments
     $this->loadHtmlFragments();
     // add default css
     $this->htmlCss->add('default');
     $this->htmlJs->add('amun');
 }