Allow loading map tiles when HTTPS is not used

This commit is contained in:
Madhura Jayaratne 2013-04-13 17:06:31 +05:30
parent 8b50d0771c
commit 0862f0a1ee

View File

@ -439,6 +439,9 @@ class PMA_Header
*/ */
public function sendHttpHeaders() public function sendHttpHeaders()
{ {
$https = $GLOBALS['PMA_Config']->isHttps();
$mapTilesUrls = ' *.tile.openstreetmap.org *.tile.opencyclemap.org';
/** /**
* Sends http headers * Sends http headers
*/ */
@ -447,7 +450,9 @@ class PMA_Header
header( header(
"X-Content-Security-Policy: allow 'self';" "X-Content-Security-Policy: allow 'self';"
. "options inline-script eval-script;" . "options inline-script eval-script;"
. "img-src 'self' data:; " . "img-src 'self' data:"
. ($https ? "" : $mapTilesUrls)
. ";"
); );
if (PMA_USR_BROWSER_AGENT == 'SAFARI' if (PMA_USR_BROWSER_AGENT == 'SAFARI'
&& PMA_USR_BROWSER_VER < '6.0.0' && PMA_USR_BROWSER_VER < '6.0.0'
@ -455,13 +460,18 @@ class PMA_Header
header( header(
"X-WebKit-CSP: allow 'self';" "X-WebKit-CSP: allow 'self';"
. "options inline-script eval-script;" . "options inline-script eval-script;"
. "img-src 'self' data:; " . "img-src 'self' data:"
. ($https ? "" : $mapTilesUrls)
. ";"
); );
} else { } else {
header( header(
"X-WebKit-CSP: default-src 'self';" "X-WebKit-CSP: default-src 'self';"
. "script-src 'self' 'unsafe-inline' 'unsafe-eval';" . "script-src 'self' 'unsafe-inline' 'unsafe-eval';"
. "style-src 'self' 'unsafe-inline'" . "style-src 'self' 'unsafe-inline';"
. "img-src 'self' data:"
. ($https ? "" : $mapTilesUrls)
. ";"
); );
} }
} }