• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisión4105374f95c18e0a446092e6ccec77cf84a9d4a0 (tree)
Tiempo2017-09-12 01:16:33
Autorumorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack/2213 Improve Canonical URL and reload links

Cambiar Resumen

Diferencia incremental

--- a/lib/func.php
+++ b/lib/func.php
@@ -733,6 +733,10 @@ function get_base_uri($uri_type = PKWK_URI_RELATIVE)
733733 */
734734 function get_page_uri($page, $uri_type = PKWK_URI_RELATIVE)
735735 {
736+ global $defaultpage;
737+ if ($page === $defaultpage) {
738+ return get_base_uri($uri_type);
739+ }
736740 return get_base_uri($uri_type) . '?' . pagename_urlencode($page);
737741 }
738742
--- a/lib/html.php
+++ b/lib/html.php
@@ -48,11 +48,7 @@ function catbody($title, $page, $body)
4848 $r_page = pagename_urlencode($_page);
4949
5050 // Canonical URL
51- if ($_page === $defaultpage) {
52- $canonical_url = get_base_uri(PKWK_URI_ABSOLUTE);
53- } else {
54- $canonical_url = get_page_uri($_page, PKWK_URI_ABSOLUTE);
55- }
51+ $canonical_url = get_page_uri($_page, PKWK_URI_ABSOLUTE);
5652
5753 // Set $_LINK for skin
5854 $_LINK['add'] = "$script?cmd=add&amp;page=$r_page";
@@ -62,20 +58,21 @@ function catbody($title, $page, $body)
6258 $_LINK['edit'] = "$script?cmd=edit&amp;page=$r_page";
6359 $_LINK['filelist'] = "$script?cmd=filelist";
6460 $_LINK['freeze'] = "$script?cmd=freeze&amp;page=$r_page";
65- $_LINK['help'] = "$script?" . pagename_urlencode($help_page);
61+ $_LINK['help'] = get_page_uri($help_page);
6662 $_LINK['list'] = "$script?cmd=list";
6763 $_LINK['new'] = "$script?plugin=newpage&amp;refer=$r_page";
6864 $_LINK['rdf'] = "$script?cmd=rss&amp;ver=1.0";
69- $_LINK['recent'] = "$script?" . pagename_urlencode($whatsnew);
70- $_LINK['reload'] = $canonical_url;
65+ $_LINK['recent'] = get_page_uri($whatsnew);
66+ $_LINK['reload'] = get_page_uri($_page);
7167 $_LINK['rename'] = "$script?plugin=rename&amp;refer=$r_page";
7268 $_LINK['rss'] = "$script?cmd=rss";
7369 $_LINK['rss10'] = "$script?cmd=rss&amp;ver=1.0"; // Same as 'rdf'
7470 $_LINK['rss20'] = "$script?cmd=rss&amp;ver=2.0";
7571 $_LINK['search'] = "$script?cmd=search";
76- $_LINK['top'] = "$script?" . pagename_urlencode($defaultpage);
72+ $_LINK['top'] = get_page_uri($defaultpage);
7773 $_LINK['unfreeze'] = "$script?cmd=unfreeze&amp;page=$r_page";
7874 $_LINK['upload'] = "$script?plugin=attach&amp;pcmd=upload&amp;page=$r_page";
75+ $_LINK['canonical_url'] = $canonical_url;
7976 $login_link = "#LOGIN_ERROR"; // dummy link that is not used
8077 switch ($auth_type) {
8178 case AUTH_TYPE_FORM:
@@ -375,7 +372,7 @@ $template
375372 EOD;
376373
377374 $body .= '<ul><li><a href="' .
378- $script . '?' . pagename_urlencode($rule_page) .
375+ get_page_uri($rule_page) .
379376 '" target="_blank">' . $_msg_help . '</a></li></ul>';
380377 return $body;
381378 }
@@ -399,13 +396,13 @@ function make_related($page, $tag = '')
399396 foreach ($links as $page=>$lastmod) {
400397 if (check_non_list($page)) continue;
401398
402- $r_page = pagename_urlencode($page);
399+ $page_uri = get_page_uri($page);
403400 $s_page = htmlsc($page);
404401 $passage = get_passage($lastmod);
405402 $_links[] = $tag ?
406- '<a href="' . $script . '?' . $r_page . '" title="' .
403+ '<a href="' . $page_uri . '" title="' .
407404 $s_page . ' ' . $passage . '">' . $s_page . '</a>' :
408- '<a href="' . $script . '?' . $r_page . '">' .
405+ '<a href="' . $page_uri . '">' .
409406 $s_page . '</a>' . $passage;
410407 }
411408 if (empty($_links)) return ''; // Nothing
--- a/skin/pukiwiki.skin.php
+++ b/skin/pukiwiki.skin.php
@@ -81,7 +81,7 @@ header('Content-Type: text/html; charset=' . CONTENT_CHARSET);
8181
8282 <?php if ($is_page) { ?>
8383 <?php if(SKIN_DEFAULT_DISABLE_TOPICPATH) { ?>
84- <a href="<?php echo $link['reload'] ?>"><span class="small"><?php echo $link['reload'] ?></span></a>
84+ <a href="<?php echo $link['canonical_url'] ?>"><span class="small"><?php echo $link['canonical_url'] ?></span></a>
8585 <?php } else { ?>
8686 <span class="small">
8787 <?php require_once(PLUGIN_DIR . 'topicpath.inc.php'); echo plugin_topicpath_inline(); ?>
--- a/skin/tdiary.skin.php
+++ b/skin/tdiary.skin.php
@@ -2,7 +2,7 @@
22 // PukiWiki - Yet another WikiWikiWeb clone.
33 // tdiary.skin.php
44 // Copyright
5-// 2002-2016 PukiWiki Development Team
5+// 2002-2017 PukiWiki Development Team
66 // 2001-2002 Originally written by yu-ji
77 // License: GPL v2 or (at your option) any later version
88 //
@@ -651,7 +651,7 @@ function _navigator($key, $value = '', $javascript = ''){
651651 <div class="calendar">
652652 <?php if ($is_page && TDIARY_CALENDAR_DESIGN !== NULL) { ?>
653653 <?php if(TDIARY_CALENDAR_DESIGN) { ?>
654- <a href="<?php echo $link['reload'] ?>"><span class="small"><?php echo $link['reload'] ?></span></a>
654+ <a href="<?php echo $link['canonical_url'] ?>"><span class="small"><?php echo $link['canonical_url'] ?></span></a>
655655 <?php } else { ?>
656656 <?php require_once(PLUGIN_DIR . 'topicpath.inc.php'); echo plugin_topicpath_inline(); ?>
657657 <?php } ?>