Esempio n. 1
0
 /**
  * Check if users originated URL is one of the domain URLs assigned to scopes
  *
  * @return boolean
  */
 public function isOwnOriginUrl()
 {
     $scopeDomains = [];
     $referer = parse_url($this->_request->getServer('HTTP_REFERER'), PHP_URL_HOST);
     foreach ($this->_scopeResolver->getScopes() as $scope) {
         $scopeDomains[] = parse_url($scope->getBaseUrl(), PHP_URL_HOST);
         $scopeDomains[] = parse_url($scope->getBaseUrl(UrlInterface::URL_TYPE_LINK, true), PHP_URL_HOST);
     }
     $scopeDomains = array_unique($scopeDomains);
     if (empty($referer) || in_array($referer, $scopeDomains)) {
         return true;
     }
     return false;
 }