git.shiar.nl
/
minimedit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
page: referrer policy to include details cross-origin
[minimedit.git]
/
page.php
diff --git
a/page.php
b/page.php
index f9dabf07caf4f7a9e3e2d231a4e67f6efad86da9..9f9ce626b0236e7ee5a805911861828422ae8e83 100644
(file)
--- a/
page.php
+++ b/
page.php
@@
-26,7
+26,7
@@
elseif (file_exists("$request/index.html")) {
require_once('article.inc.php');
$Page = new ArchiveArticle($staticpage);
require_once('article.inc.php');
$Page = new ArchiveArticle($staticpage);
-if ($_SERVER['HTTP_ACCEPT'] === 'text/plain') {
+if (
@
$_SERVER['HTTP_ACCEPT'] === 'text/plain') {
$Page->api = TRUE;
}
$Page->api = TRUE;
}
@@
-50,6
+50,7
@@
header(sprintf('Content-Security-Policy: %s', implode('; ', [
"base-uri 'self'", # only local pages
"frame-ancestors 'none'", # prevent malicious embedding
])));
"base-uri 'self'", # only local pages
"frame-ancestors 'none'", # prevent malicious embedding
])));
+header('Referrer-Policy: no-referrer-when-downgrade');
$Page->place += [
'user' => $User->login ?: '',
$Page->place += [
'user' => $User->login ?: '',
@@
-60,7
+61,8
@@
if ($Page->editable = $User->admin("edit {$Page->link}")) {
include_once 'edit/head.inc.php';
}
include_once 'edit/head.inc.php';
}
-if (isset($Page->raw)) {
+if (isset($Page->raw)
+and @$_SERVER['HTTP_ACCEPT'] !== 'application/xml') {
$Page->raw = '<div class="static">'."\n\n".$Page->raw."</div>\n\n";
}
$Page->raw = '<div class="static">'."\n\n".$Page->raw."</div>\n\n";
}
@@
-83,7
+85,7
@@
else {
}
}
}
}
-if ($_SERVER['HTTP_ACCEPT'] === 'application/xml') {
+if (
@
$_SERVER['HTTP_ACCEPT'] === 'application/xml') {
header('Access-Control-Allow-Origin: *');
}
elseif (!$Page->api) {
header('Access-Control-Allow-Origin: *');
}
elseif (!$Page->api) {