コード例 #1
0
ファイル: UrlTest.php プロジェクト: FluentDevelopment/piwik
 /**
  * @group Core
  *
  * @dataProvider getIsHostInUrls
  */
 public function testIsHostInUrlsl($isHost, $host, $urls)
 {
     $this->assertEquals($isHost, Url::isHostInUrls($host, $urls));
 }
コード例 #2
0
 public function shouldPerformRedirectToUrl()
 {
     if (!$this->hasRedirectUrl()) {
         return false;
     }
     if (!$this->hasRequests()) {
         return false;
     }
     $redirectUrl = $this->getRedirectUrl();
     $host = Url::getHostFromUrl($redirectUrl);
     if (empty($host)) {
         return false;
     }
     $urls = new SiteUrls();
     $siteUrls = $urls->getAllCachedSiteUrls();
     $siteIds = $this->getAllSiteIdsWithinRequest();
     foreach ($siteIds as $siteId) {
         if (empty($siteUrls[$siteId])) {
             $siteUrls[$siteId] = array();
         }
         if (Url::isHostInUrls($host, $siteUrls[$siteId])) {
             return $redirectUrl;
         }
     }
     return false;
 }
コード例 #3
0
ファイル: Tracker.php プロジェクト: mats116/piwik
 private function performRedirectToUrlIfSet()
 {
     if (!$this->hasRedirectUrl()) {
         return;
     }
     if (empty($this->requests)) {
         return;
     }
     $redirectUrl = $this->getRedirectUrl();
     $host = Url::getHostFromUrl($redirectUrl);
     if (empty($host)) {
         return;
     }
     $siteIds = array();
     foreach ($this->requests as $request) {
         $siteIds[] = (int) $request['idsite'];
     }
     $siteIds = array_unique($siteIds);
     $model = new Model();
     foreach ($siteIds as $siteId) {
         $siteUrls = $model->getSiteUrlsFromId($siteId);
         if (Url::isHostInUrls($host, $siteUrls)) {
             Url::redirectToUrl($redirectUrl);
         }
     }
 }
コード例 #4
0
ファイル: Tracker.php プロジェクト: TensorWrenchOSS/piwik
 private function performRedirectToUrlIfSet()
 {
     if (!$this->hasRedirectUrl()) {
         return;
     }
     if (empty($this->requests)) {
         return;
     }
     $redirectUrl = $this->getRedirectUrl();
     $host = Url::getHostFromUrl($redirectUrl);
     if (empty($host)) {
         return;
     }
     $urls = new SiteUrls();
     $siteUrls = $urls->getAllCachedSiteUrls();
     $siteIds = $this->getAllSiteIdsWithinRequest();
     foreach ($siteIds as $siteId) {
         if (empty($siteUrls[$siteId])) {
             continue;
         }
         if (Url::isHostInUrls($host, $siteUrls[$siteId])) {
             Url::redirectToUrl($redirectUrl);
         }
     }
 }