• R/O
  • HTTP
  • SSH
  • HTTPS

pukiwiki: Commit


Commit MetaInfo

Revisione4b93ba0df1d0dc6aee2b9439c72e407ed2ff1e4 (tree)
Time2018-03-25 17:30:17
Authorumorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack/2462 Customize Referrer Policy by HTML meta header

Some modern HTML5 web browsers supprt <meta name="referrer" />.
For example, content="no-referrer" means the browser don't send
any Referer headers to web servers.

Change Summary

Incremental Difference

--- a/lib/html.php
+++ b/lib/html.php
@@ -17,6 +17,7 @@ function catbody($title, $page, $body)
1717 global $javascript, $nofollow;
1818 global $_LANG, $_LINK, $_IMAGE;
1919 global $auth_type, $auth_user;
20+ global $html_meta_referrer_policy;
2021
2122 global $pkwk_dtd; // XHTML 1.1, XHTML1.0, HTML 4.01 Transitional...
2223 global $page_title; // Title of this site
--- a/pukiwiki.ini.php
+++ b/pukiwiki.ini.php
@@ -334,6 +334,12 @@ $external_link_cushion = array(
334334 );
335335
336336 /////////////////////////////////////////////////
337+// Output HTML meta Referrer Policy
338+// Value: '' (default), no-referrer, origin, same-origin, ...
339+// Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
340+$html_meta_referrer_policy = '';
341+
342+/////////////////////////////////////////////////
337343 // $whatsnew: Max number of RecentChanges
338344 $maxshow = 500;
339345
--- a/skin/pukiwiki.skin.php
+++ b/skin/pukiwiki.skin.php
@@ -62,6 +62,7 @@ header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
6262 <head>
6363 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CONTENT_CHARSET ?>" />
6464 <?php if ($nofollow || ! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
65+<?php if ($html_meta_referrer_policy) { ?> <meta name="referrer" content="<?php echo htmlsc(html_meta_referrer_policy) ?>" /><?php } ?>
6566
6667 <title><?php echo $title ?> - <?php echo $page_title ?></title>
6768
--- a/skin/tdiary.skin.php
+++ b/skin/tdiary.skin.php
@@ -562,6 +562,7 @@ header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
562562 <head>
563563 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CONTENT_CHARSET ?>" />
564564 <?php if ($nofollow || ! $is_read) { ?> <meta name="robots" content="NOINDEX,NOFOLLOW" /><?php } ?>
565+<?php if ($html_meta_referrer_policy) { ?> <meta name="referrer" content="<?php echo htmlsc(html_meta_referrer_policy) ?>" /><?php } ?>
565566
566567 <title><?php echo $title ?> - <?php echo $page_title ?></title>
567568
Show on old repository browser