Example #1
0
 /**
  * Erzeugt das Captchafeld für das Template
  *
  * @param integer $captchaLength
  * @param string  $formFieldId
  * @param bool    $inputOnly
  * @param string  $path
  *
  * @return string
  */
 public function captcha($captchaLength = self::CAPTCHA_DEFAULT_LENGTH, $formFieldId = self::CAPTCHA_DEFAULT_INPUT_ID, $inputOnly = false, $path = '')
 {
     if ($this->user->isAuthenticated() === false) {
         $path = sha1($this->router->route(empty($path) === true ? $this->request->getQuery() : $path));
         $this->sessionHandler->set('captcha_' . $path, $this->secureHelper->salt($captchaLength));
         $this->view->assign('captcha', ['width' => $captchaLength * 25, 'id' => $formFieldId, 'height' => 30, 'input_only' => $inputOnly, 'path' => $path]);
         return $this->view->fetchTemplate('Captcha/Partials/captcha.tpl');
     }
     return '';
 }
Example #2
0
 /**
  * @param string $menu
  *
  * @return int
  */
 protected function selectMenuItem($menu)
 {
     if ($this->request->getArea() !== Core\Controller\AreaEnum::AREA_ADMIN) {
         $in = [$this->request->getQuery(), $this->request->getUriWithoutPages(), $this->request->getFullPath(), $this->request->getModuleAndController(), $this->request->getModule()];
         return $this->menuItemRepository->getLeftIdByUris($menu, $in);
     }
     return 0;
 }
Example #3
0
 /**
  * @param bool         $customUris
  * @param array|string $page
  * @param int          $pageNumber
  * @param int          $currentIndex
  *
  * @return bool
  */
 protected function isCurrentPage($customUris, $page, $pageNumber, $currentIndex)
 {
     if ($customUris === true) {
         if (is_array($page) === true && $page['uri'] === $this->router->route($this->request->getQuery()) || $this->router->route($this->request->getQuery()) === $this->router->route($this->request->getFullPath()) && $currentIndex == 0) {
             return true;
         }
     } elseif ($this->integerValidationRule->isValid($this->request->getParameters()->get('page')) === false && $currentIndex === 0 || $this->request->getParameters()->get('page') === $pageNumber) {
         return true;
     }
     return false;
 }
 /**
  * @return bool
  */
 private function uriAliasExists()
 {
     return $this->aliases->uriAliasExists($this->request->getQuery()) === true && $this->request->getPathInfo() !== $this->aliases->getUriAlias($this->request->getQuery()) . '/';
 }
Example #5
0
 /**
  * Checks, whether the maintenance mode is active
  *
  * @param \ACP3\Core\Http\RequestInterface $request
  *
  * @return bool
  */
 private function isMaintenanceModeEnabled(RequestInterface $request)
 {
     return (bool) $this->systemSettings['maintenance_mode'] === true && $request->getArea() !== AreaEnum::AREA_ADMIN && strpos($request->getQuery(), 'users/index/login/') !== 0;
 }
 /**
  * @param string $value
  * @param string $path
  * @return bool
  */
 protected function checkCaptcha($value, $path)
 {
     $indexName = 'captcha_' . sha1($this->router->route(empty($path) === true ? $this->request->getQuery() : $path));
     return preg_match('/^[a-zA-Z0-9]+$/', $value) && strtolower($value) === strtolower($this->sessionHandler->get($indexName, ''));
 }