• 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ónd82def10cf5f997425492b8484b43622ca33df8e (tree)
Tiempo2019-03-29 10:30:39
Autorumorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack/2487 READONLY - Link only existing pages in topicpath title

Cambiar Resumen

Diferencia incremental

--- a/lib/html.php
+++ b/lib/html.php
@@ -303,7 +303,8 @@ EOS;
303303 }
304304 // Topicpath title
305305 $topicpath_data = '';
306- if ($topicpath_title && exist_plugin('topicpath')) {
306+ if ($topicpath_title && exist_plugin('topicpath') &&
307+ function_exists('plugin_topicpath_parent_links')) {
307308 $parents = plugin_topicpath_parent_links($page);
308309 $h_topicpath = htmlsc_json($parents);
309310 $topicpath_data = <<<EOS
--- a/plugin/topicpath.inc.php
+++ b/plugin/topicpath.inc.php
@@ -32,6 +32,26 @@ function plugin_topicpath_convert()
3232
3333 function plugin_topicpath_parent_links($page)
3434 {
35+ $links = plugin_topicpath_parent_all_links($page);
36+ if (PKWK_READONLY) {
37+ $active_links = array();
38+ foreach ($links as $link) {
39+ if (is_page($link['page'])) {
40+ $active_links[] = $link;
41+ } else {
42+ $active_links[] = array(
43+ 'page' => $link['page'],
44+ 'leaf' => $link['leaf'],
45+ );
46+ }
47+ }
48+ return $active_links;
49+ }
50+ return $links;
51+}
52+
53+function plugin_topicpath_parent_all_links($page)
54+{
3555 $parts = explode('/', $page);
3656 $parents = array();
3757 for ($i = 0, $pos = 0; $pos = strpos($page, '/', $i); $i = $pos + 1) {
@@ -50,7 +70,7 @@ function plugin_topicpath_inline()
5070 global $vars, $defaultpage;
5171 $page = isset($vars['page']) ? $vars['page'] : '';
5272 if ($page == '' || $page == $defaultpage) return '';
53- $parents = plugin_topicpath_parent_links($page);
73+ $parents = plugin_topicpath_parent_all_links($page);
5474 $topic_path = array();
5575 foreach ($parents as $p) {
5676 if (PKWK_READONLY && !is_page($p['page'])) {
--- a/skin/main.js
+++ b/skin/main.js
@@ -583,11 +583,17 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function(
583583 var fragment = document.createDocumentFragment();
584584 for (var i = 0, n = topicpathLinks.length; i < n; i++) {
585585 var path = topicpathLinks[i];
586- var a1 = document.createElement('a');
587- a1.setAttribute('href', path.uri);
588- a1.setAttribute('title', path.page);
589- a1.textContent = path.leaf;
590- fragment.appendChild(a1);
586+ if (path.uri) {
587+ var a1 = document.createElement('a');
588+ a1.setAttribute('href', path.uri);
589+ a1.setAttribute('title', path.page);
590+ a1.textContent = path.leaf;
591+ fragment.appendChild(a1);
592+ } else {
593+ var s1 = document.createElement('span');
594+ s1.textContent = path.leaf;
595+ fragment.appendChild(s1);
596+ }
591597 var span = document.createElement('span');
592598 span.className = 'topicpath-slash';
593599 span.textContent = '/';