Example #1
0
 /**
  * @return $this
  * @throws Core\ACL\Exception\AccessForbiddenException
  */
 public function preDispatch()
 {
     $path = $this->request->getArea() . '/' . $this->request->getFullPathWithoutArea();
     if ($this->acl->hasPermission($path) === false) {
         throw new Core\ACL\Exception\AccessForbiddenException();
     }
     $this->view->assign(['PHP_SELF' => $this->appPath->getPhpSelf(), 'ROOT_DIR' => $this->appPath->getWebRoot(), 'HOST_NAME' => $this->request->getHttpHost(), 'ROOT_DIR_ABSOLUTE' => $this->request->getScheme() . '://' . $this->request->getHttpHost() . $this->appPath->getWebRoot(), 'DESIGN_PATH' => $this->appPath->getDesignPathWeb(), 'DESIGN_PATH_ABSOLUTE' => $this->appPath->getDesignPathAbsolute(), 'LANG_DIRECTION' => $this->translator->getDirection(), 'LANG' => $this->translator->getShortIsoCode()]);
     return $this;
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function route($path, $absolute = false, $forceSecure = false)
 {
     $path = $path . (!preg_match('/\\/$/', $path) ? '/' : '');
     $pathArray = preg_split('=/=', $path, -1, PREG_SPLIT_NO_EMPTY);
     if (isset($pathArray[1]) === false) {
         $path .= 'index/';
     }
     if (isset($pathArray[2]) === false) {
         $path .= 'index/';
     }
     $prefix = '';
     // Append the current hostname to the URL
     if ($absolute === true) {
         $prefix .= $forceSecure === true ? 'https://' : $this->request->getScheme() . '://';
         $prefix .= $this->request->getHost();
     }
     $prefix .= $this->appPath->getPhpSelf() . '/';
     return $prefix . $path;
 }
Example #3
0
File: Router.php Project: acp3/core
 /**
  * @param string $path
  * @param bool   $isAbsolute
  * @param bool   $forceSecure
  *
  * @return string
  */
 protected function addUriPrefix($path, $isAbsolute, $forceSecure)
 {
     $prefix = '';
     if ($isAbsolute === true || $forceSecure === true) {
         $prefix .= $forceSecure === true ? 'https://' : $this->request->getScheme() . '://';
         $prefix .= $this->request->getHost();
     }
     $prefix .= $this->useModRewrite($path) ? $this->appPath->getWebRoot() : $this->appPath->getPhpSelf() . '/';
     return $prefix;
 }