Beispiel #1
0
 /**
  * Redirects the user to the specified URL.
  *
  * @param string $url
  * @api
  */
 public static function redirectToUrl($url)
 {
     // Close the session manually.
     // We should not have to call this because it was registered via register_shutdown_function,
     // but it is not always called fast enough
     Session::close();
     if (UrlHelper::isLookLikeUrl($url) || strpos($url, 'index.php') === 0) {
         @header("Location: {$url}");
     } else {
         echo "Invalid URL to redirect to.";
     }
     if (Common::isPhpCliMode()) {
         throw new Exception("If you were using a browser, Piwik would redirect you to this URL: {$url} \n\n");
     }
     exit;
 }
 private function closeSessionEarlyForFasterUI()
 {
     $isDashboardReferrer = !empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'module=CoreHome&action=index') !== false;
     $isAllWebsitesReferrer = !empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'module=MultiSites&action=index') !== false;
     if ($isDashboardReferrer && !empty($_POST['token_auth']) && Common::getRequestVar('widget', 0, 'int') === 1) {
         Session::close();
     }
     if (($isDashboardReferrer || $isAllWebsitesReferrer) && Common::getRequestVar('viewDataTable', '', 'string') === 'sparkline') {
         Session::close();
     }
 }
Beispiel #3
0
 /**
  * Redirects the user to the specified URL.
  *
  * @param string $url
  * @throws Exception
  * @api
  */
 public static function redirectToUrl($url)
 {
     // Close the session manually.
     // We should not have to call this because it was registered via register_shutdown_function,
     // but it is not always called fast enough
     Session::close();
     self::redirectToUrlNoExit($url);
     exit;
 }