aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-05-22 20:18:47 -0700
committerMario Vavti <mario@mariovavti.com>2017-05-23 21:51:17 +0200
commitda682717ab6b37f87e2620a4305fa78131d57063 (patch)
tree15fba75e7dda2b25215e7d8e19104866e5baf5ec /Zotlabs
parent647b5d098f0985a12acbaf6fc1d3d89c2a758129 (diff)
downloadvolse-hubzilla-da682717ab6b37f87e2620a4305fa78131d57063.tar.gz
volse-hubzilla-da682717ab6b37f87e2620a4305fa78131d57063.tar.bz2
volse-hubzilla-da682717ab6b37f87e2620a4305fa78131d57063.zip
wiki auto language select to match webpages implementation
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/NativeWikiPage.php2
-rw-r--r--Zotlabs/Module/Wiki.php32
2 files changed, 28 insertions, 6 deletions
diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php
index ed3df436c..78b54ebda 100644
--- a/Zotlabs/Lib/NativeWikiPage.php
+++ b/Zotlabs/Lib/NativeWikiPage.php
@@ -44,7 +44,7 @@ class NativeWikiPage {
$pages[] = [
'resource_id' => $resource_id,
'title' => escape_tags($title),
- 'url' => urlencode(urlencode($title)),
+ 'url' => str_replace('%2F','/',urlencode(str_replace('%2F','/',urlencode($title)))),
'link_id' => 'id_' . substr($resource_id, 0, 10) . '_' . $page_item['id']
];
}
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index a1e377e68..f3b34401d 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -192,12 +192,28 @@ class Wiki extends \Zotlabs\Web\Controller {
goaway(z_root() . '/' . argv(0) . '/' . argv(1) . '/' . $wikiUrlName . '/Home');
case 4:
+ default:
// GET /wiki/channel/wiki/page
// Fetch the wiki info and determine observer permissions
$wikiUrlName = urldecode(argv(2));
- $pageUrlName = urldecode(argv(3));
+
+ $page_name = '';
+ $ignore_language = false;
+
+ for($x = 3; $x < argc(); $x ++) {
+ if($page_name === '' && argv($x) === '-') {
+ $ignore_language = true;
+ continue;
+ }
+ if($page_name)
+ $page_name .= '/';
+ $page_name .= argv($x);
+ }
+
+ $pageUrlName = urldecode($page_name);
+ $langPageUrlName = urldecode(\App::$language . '/' . $page_name);
$w = Zlib\NativeWiki::exists_by_name($owner['channel_id'], $wikiUrlName);
@@ -227,9 +243,15 @@ class Wiki extends \Zotlabs\Web\Controller {
$wikiheaderPage = urldecode($pageUrlName);
$renamePage = (($wikiheaderPage === 'Home') ? '' : t('Rename page'));
+ $p = [];
- $p = Zlib\NativeWikiPage::get_page_content(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName));
- if(! $p['success']) {
+ if(! $ignore_language) {
+ $p = Zlib\NativeWikiPage::get_page_content(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $langPageUrlName));
+ }
+ if(! ($p && $p['success'])) {
+ $p = Zlib\NativeWikiPage::get_page_content(array('channel_id' => $owner['channel_id'], 'observer_hash' => $observer_hash, 'resource_id' => $resource_id, 'pageUrlName' => $pageUrlName));
+ }
+ if(! ($p && $p['success'])) {
notice( t('Error retrieving page content') . EOL);
goaway(z_root() . '/' . argv(0) . '/' . argv(1) );
}
@@ -251,8 +273,8 @@ class Wiki extends \Zotlabs\Web\Controller {
}
$showPageControls = $wiki_editor;
break;
- default: // Strip the extraneous URL components
- goaway('/' . argv(0) . '/' . argv(1) . '/' . $wikiUrlName . '/' . $pageUrlName);
+// default: // Strip the extraneous URL components
+// goaway('/' . argv(0) . '/' . argv(1) . '/' . $wikiUrlName . '/' . $pageUrlName);
}