Skip to content
Extraits de code Groupes Projets
Valider b89cf6f2 rédigé par mattab's avatar mattab
Parcourir les fichiers

refs #6122 Adding CORS header to Overlay controller methods since they are...

refs #6122 Adding CORS header to Overlay controller methods since they are meant to be loaded from other domains where the overlay takes place.
parent 3bf2f6f4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
namespace Piwik\Plugins\Overlay; namespace Piwik\Plugins\Overlay;
use Piwik\API\CORSHandler;
use Piwik\API\Request; use Piwik\API\Request;
use Piwik\Common; use Piwik\Common;
use Piwik\Config; use Piwik\Config;
...@@ -44,6 +45,7 @@ class Controller extends \Piwik\Plugin\Controller ...@@ -44,6 +45,7 @@ class Controller extends \Piwik\Plugin\Controller
$view->ssl = ProxyHttp::isHttps(); $view->ssl = ProxyHttp::isHttps();
$this->outputCORSHeaders();
return $view->render(); return $view->render();
} }
...@@ -117,6 +119,8 @@ class Controller extends \Piwik\Plugin\Controller ...@@ -117,6 +119,8 @@ class Controller extends \Piwik\Plugin\Controller
$view->idSite = $idSite; $view->idSite = $idSite;
$view->period = $period; $view->period = $period;
$view->date = $date; $view->date = $date;
$this->outputCORSHeaders();
return $view->render(); return $view->render();
} }
...@@ -133,6 +137,7 @@ class Controller extends \Piwik\Plugin\Controller ...@@ -133,6 +137,7 @@ class Controller extends \Piwik\Plugin\Controller
$site = $sitesManager->getSiteFromId($idSite); $site = $sitesManager->getSiteFromId($idSite);
$urls = $sitesManager->getSiteUrlsFromId($idSite); $urls = $sitesManager->getSiteUrlsFromId($idSite);
$this->outputCORSHeaders();
Common::sendHeader('Content-Type: text/html; charset=UTF-8'); Common::sendHeader('Content-Type: text/html; charset=UTF-8');
return ' return '
<html><head><title></title></head><body> <html><head><title></title></head><body>
...@@ -218,6 +223,7 @@ class Controller extends \Piwik\Plugin\Controller ...@@ -218,6 +223,7 @@ class Controller extends \Piwik\Plugin\Controller
$view->troubleshoot = htmlentities(Piwik::translate('Overlay_RedirectUrlErrorUser')); $view->troubleshoot = htmlentities(Piwik::translate('Overlay_RedirectUrlErrorUser'));
} }
$this->outputCORSHeaders();
return $view->render(); return $view->render();
} }
...@@ -232,6 +238,13 @@ class Controller extends \Piwik\Plugin\Controller ...@@ -232,6 +238,13 @@ class Controller extends \Piwik\Plugin\Controller
public function notifyParentIframe() public function notifyParentIframe()
{ {
$view = new View('@Overlay/notifyParentIframe'); $view = new View('@Overlay/notifyParentIframe');
$this->outputCORSHeaders();
return $view->render(); return $view->render();
} }
protected function outputCORSHeaders()
{
$corsHandler = new CORSHandler();
$corsHandler->handle();
}
} }
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter