Esempio n. 1
0
 public function startup()
 {
     parent::startup();
     if (!$this->lang) {
         $this->lang = 'cs';
     }
 }
Esempio n. 2
0
 public function beforeRender()
 {
     parent::beforeRender();
     $this->template->nazev_rubriky = $this->nazev_rubriky;
     $this->template->id_rubriky = $this->id_rubriky;
     $this->template->pozadi = "<style type='text/css'>\n                 body {background-image: url(/css/" . $this->redakce->findPozadiById($this->id_rubriky) . ");}\n                </style>";
 }
 public function startup()
 {
     parent::startup();
     if (!$this->user->isLoggedIn()) {
         $this->redirect('Home:default');
     }
 }
Esempio n. 4
0
 public function startup()
 {
     parent::startup();
     $user = $this->getUser();
     $backlink = $this->storeRequest();
     if (!$this->context->parameters['productionMode'] && ($this->name == "Changelog:Changelog" || $this->name == 'Secured')) {
         // User can run changelog
     } else {
         // Ckecks if user is logged in, if not, redirect him to log in page
         if (!$user->isLoggedIn() || !$user->isALlowed("Admin:Homepage", 'view')) {
             if ($user->getLogoutReason() === User::INACTIVITY) {
                 $this->flashMessage('You have been logged out due to long inactivity.', 'warning');
             }
             // Fix for new ACL
             $this->user->logout(TRUE);
             $this->redirect(':Login:'******'backlink' => $backlink));
             $this->terminate();
         }
         // Check for access to current presenter && view, else throw exception
         $manageActionsArray = array("edit", "delete", "add");
         $requiredPrivilege = "view";
         foreach ($manageActionsArray as $action) {
             if (strpos($this->getAction(), $action) !== FALSE) {
                 $requiredPrivilege = "manage";
             }
         }
         if (!$user->isAllowed($this->getName(), $requiredPrivilege)) {
             $this->logger->logUnauthorizedAccess();
             throw new HQ\UnauthorizedAccessException("Sorry, you are not authorized to enter this site.");
         }
     }
 }
Esempio n. 5
0
 protected function startup()
 {
     parent::startup();
     if (!$this->user->isLoggedIn()) {
         $this->redirect('sign:in');
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function startup()
 {
     parent::startup();
     if (!$this->user->isLoggedIn()) {
         $this->redirect('Sign:in', ['backlink' => $this->storeRequest()]);
     }
 }
Esempio n. 7
0
 function startup()
 {
     parent::startup();
     $cache = NEnvironment::getCache();
     if (!isset($cache['acl'])) {
         $cache['acl'] = new Acl();
     }
     NEnvironment::getUser()->setAuthorizator($cache['acl']);
     $user = NEnvironment::getUser();
     $aclModel = new AclModel();
     // user authentication
     if (!$this->user->isLoggedIn()) {
         $backlink = $this->application->storeRequest();
         $this->redirect(':Admin:Login:default', array('backlink' => $backlink, 'lang' => $this->lang));
     }
     if (!$this->user->isAllowed('cms', 'edit')) {
         $this->flashMessage('Nemáte dostatočné prava.');
         $backlink = $this->application->storeRequest();
         $this->redirect(':Admin:Login:default', array('backlink' => $backlink, 'lang' => $this->lang));
     }
     //		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
     $this['header']['css']->addFile('../templates/admin/css/index.css');
     $this['header']['css']->addFile('ajax.css');
     $this['header']['css']->addFile('../jscripts/jquery/flick/jquery-ui-1.8.6.custom.css');
     $this['header']['css']->addFile('../jscripts/jquery/tags/jquery.tagsinput.css');
     $this['header']['js']->addFile('jquery/tags/jquery.tagsinput.js');
     //		$this['header']['js']->addFile('/jquery/jquery-1.4.2.js');
     $this['header']['js']->addFile('/jquery/jquery.nette.js');
     $this['header']['js']->addFile('/jquery/jquery.livequery.js');
     $this['header']['js']->addFile('jquery/jquery-ui-1.8.5.custom.min.js');
     $this['header']['js']->addFile('jquery/jquery.highlight.js');
     $this['header']['js']->addFile('jquery/jquery.easy-confirm-dialog.js');
     $this['header']['js']->addFile('confl.js');
     //		$this['header']->setHtmlTag( NHtml::el('script type="text/javacript"')->add( 'alert(1)' ) );
 }
 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $texy = new \Texy();
     $texy->encoding = 'utf-8';
     $texy->setOutputMode(\Texy::HTML5);
     // config as in \TexyConfigurator::safeMode($texy);
     $safeTags = array('a' => array('href', 'title'), 'acronym' => array('title'), 'b' => array(), 'br' => array(), 'cite' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'strong' => array(), 'sub' => array(), 'sup' => array(), 'q' => array(), 'small' => array());
     $texy->allowedClasses = \Texy::NONE;
     // no class or ID are allowed
     $texy->allowedStyles = \Texy::NONE;
     // style modifiers are disabled
     $texy->allowedTags = $safeTags;
     // only some "safe" HTML tags and attributes are allowed
     $texy->urlSchemeFilters[\Texy::FILTER_ANCHOR] = '#https?:|ftp:|mailto:#A';
     $texy->urlSchemeFilters[\Texy::FILTER_IMAGE] = '#https?:#A';
     $texy->allowed['image'] = FALSE;
     // disable images
     $texy->allowed['link/definition'] = FALSE;
     // disable [ref]: URL  reference definitions
     $texy->allowed['html/comment'] = FALSE;
     // disable HTML comments
     $texy->linkModule->forceNoFollow = TRUE;
     // force rel="nofollow"
     $template->registerHelper('texy', callback($texy, 'process'));
     return $template;
 }
Esempio n. 9
0
 protected function startup()
 {
     parent::startup();
     $this->template->module = "foo";
     $rbb = $this->getParam('__rbb');
     if ($rbb) {
         $this->isRequestButton = $this->template->isRequestButton = true;
     } else {
         $this->isRequestButton = $this->template->isRequestButton = false;
     }
     //Debug::dump($this->presenterName);
     //Debug::dump($this->action);
     /**
      * Nastaveni obecneho pristupu do administrace
      */
     if (!$this->context->user->isAllowed('backend', 'default')) {
         $backlink = $this->storeRequest();
         $this->redirect(':Sign:in', $backlink);
     }
     /**
     * Nastaveni pristupu na urovni presenter-action
     
      if (!$this->context->user->isAllowed(strtolower($this->presenterName), strtolower($this->action))) {
      $this->flashMessage('You are not allowed to access in this module.', 'info');
      $backlink = $this->getApplication()->storeRequest();
      $this->redirect(':Auth:login', $backlink);
      }
     */
     //		Debug::dump($this->mainSession->sorting);
     $this->orderBy = isset($this->mainSession->sorting['orderBy']) ? $this->mainSession->sorting['orderBy'] : $this->orderBy;
     $this->sort = isset($this->mainSession->sorting['sort']) ? $this->mainSession->sorting['sort'] : $this->sort;
     $this->template->sort = $this->sort;
     $this->template->orderBy = $this->orderBy;
 }
Esempio n. 10
0
 /**
  * Protect for secured, if not logged in redirect to the Sign
  */
 public function startup()
 {
     parent::startup();
     if ($this->user->isLoggedIn() === FALSE) {
         $this->redirect('Sign:in', array('backlink' => $this->storeRequest()));
     }
 }
Esempio n. 11
0
 protected function startup()
 {
     if (!Environment::isConsole()) {
         throw new InvalidStateException('Access allowed only from console!');
     }
     parent::startup();
 }
 public function startup()
 {
     parent::startup();
     if (!$this->user->isAllowed('errors', 'view')) {
         throw new \Nette\Application\BadRequestException('Forbidden', 403);
     }
 }
Esempio n. 13
0
 /**
  * startup method
  * @return void
  */
 public function startup()
 {
     parent::startup();
     $this->groups = array_merge(array('' => _("All")), $this->model->getConfig()["groups"]);
     $this->compressions = $this->model->getConfig()["compressions"];
     return;
 }
Esempio n. 14
0
 protected function startup()
 {
     parent::startup();
     if (!$this->getUser()->isLoggedIn()) {
         $this->redirect('Sign:in');
     }
 }
Esempio n. 15
0
 /**
  * startup description
  * @throws \Nette\Application\BadRequestException
  */
 public function startup()
 {
     parent::startup();
     if (!$this->getRequest()->isMethod(\Nette\Application\Request::FORWARD)) {
         $this->error();
     }
 }
Esempio n. 16
0
 public function startup()
 {
     parent::startup();
     if (!$this->installed) {
         $this->redirect(':Install:Default:default');
     }
 }
Esempio n. 17
0
 public function beforeRender()
 {
     parent::beforeRender();
     $id = $this->getParam('id');
     $params = array('treeNodeId' => $id, 'lang' => $this->langManagerService->getDefaultLanguage());
     $page = $this->pageManagerService->getPage($params);
     $this->template->page = $page;
 }
Esempio n. 18
0
 protected function startup()
 {
     parent::startup();
     $httpRequest = $this->context->getService('httpRequest');
     $url = $httpRequest->getUrl()->host;
     $this->logger = $this->getService('logger');
     $this->logger->setId_uzivatele('');
 }
 protected function startup()
 {
     parent::startup();
     // we don't want authenticated users see the login form again
     if ($this->getUser()->isLoggedIn()) {
         $this->redirect('HomePage:');
     }
 }
Esempio n. 20
0
 protected function startup()
 {
     parent::startup();
     $captcha = new CaptchaBase();
     $captcha->setExtension(new SeznamCaptcha());
     //$captcha->setExtension(new reCaptcha());
     NFormContainer::extensionMethod('addCaptcha', [$captcha, 'captcha']);
 }
Esempio n. 21
0
 protected function startup()
 {
     parent::startup();
     $this->logger = $this->getService('logger');
     $this->getUser()->logout(TRUE);
     $this->osobyRepository = $this->getService('osobyRepository');
     $this->odeslani_mailu = $this->getService('odeslaniMailu');
 }
Esempio n. 22
0
 public function startup()
 {
     parent::startup();
     if ($this->user->isAllowed("Admin:Board")) {
         $this->redirect("Board:default");
     } else {
         $this->redirect("PersonalChange:default");
     }
 }
 /**
  * Startup
  */
 public function startup()
 {
     parent::startup();
     $texy = Environment::getService("Texy");
     $this->baseFolderPath = $texy->imageModule->fileRoot;
     $this->baseFolderUri = $texy->imageModule->root;
     $this->tempDir = WWW_DIR . "/webtemp";
     $this->tempUri = Environment::getVariable("baseUri") . "/webtemp";
 }
Esempio n. 24
0
 /**
  * Startup
  */
 public function startup()
 {
     parent::startup();
     $texy = $this->getService('Texy');
     $this->baseFolderPath = $texy->imageModule->fileRoot;
     $this->baseFolderUri = $texy->imageModule->root;
     $this->tempDir = TEMP_DIR;
     $this->tempUri = $this->template->basePath . "/temp";
 }
Esempio n. 25
0
 protected function beforeRender()
 {
     parent::beforeRender();
     $this->template->modules = AdminModule::getModules();
     $this->template->title = 'Admin';
     $this->template->heading = 'Administrácia';
     $this->template->isAdminModule = TRUE;
     $this->setRenderSections(array(self::RENDER_SECTION_FILEUPLOAD => false, self::RENDER_SECTION_FILTERS => false, self::RENDER_SECTION_OPTIONS => false));
 }
Esempio n. 26
0
 public function beforeRender()
 {
     parent::beforeRender();
     // Notice: Undefined variable: lang
     //echo $acl->isAllowed('administrator', 'poll', 'vote'); // TRUE
     dump($this->user->isAllowed('Front', 'editor'));
     dump($this->user->id);
     dump($this->user->getRoles());
 }
Esempio n. 27
0
 /**
  * Setup presenter - only users with view privileges can view
  * @return void
  */
 public function startup()
 {
     parent::startup();
     if (!$this->user->isAllowed("config", "view")) {
         $this->flashMessage(_("You are not allowed to manage server !"), "danger");
         $this->redirect(":Homepage:default");
     }
     return;
 }
Esempio n. 28
0
 protected function startup()
 {
     parent::startup();
     if (($page = $this->pageRepository->findOneBy(array('special' => 'tags'))) === NULL) {
         $this->flashMessage($this->translator->translate('Page with tags does not exist.'), 'warning');
     } else {
         $this->extendedPage = $this->getEntityManager()->getRepository($page->class)->findOneBy(array('page' => $page));
     }
 }
Esempio n. 29
0
 public function beforeRender()
 {
     parent::beforeRender();
     //        dump($this->labelId);
     $labelId = $this->labelId;
     if (!empty($labelId)) {
         $label = $this->pageManagerService->getLabel($this->labelId);
         $this->template->labelName = $label ? $label['name'] : '';
     }
 }
Esempio n. 30
0
 public function startup()
 {
     parent::startup();
     if ($this->lang == 'cs') {
         $this->categories = $this->categoriesCs;
         $this->subcategories = $this->subcategoriesCs;
     } else {
         $this->categories = $this->categoriesEn;
         $this->subcategories = $this->subcategoriesEn;
     }
 }