diff options
author | Mario Vavti <mario@mariovavti.com> | 2017-08-16 10:32:35 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-08-16 10:32:35 +0200 |
commit | 4a7384bc0ce1893a432bf4b7d67bca23796fe9db (patch) | |
tree | 5623c66a3f66445284529d6207e4ab4a2edb2810 /Zotlabs/Module/Page.php | |
parent | c664a4bdcd1bd578f5ec3c2884f7c97e9f68d2d7 (diff) | |
parent | 90bc21f2d560d879d7eaf05a85af6d6dca53ebac (diff) | |
download | volse-hubzilla-4a7384bc0ce1893a432bf4b7d67bca23796fe9db.tar.gz volse-hubzilla-4a7384bc0ce1893a432bf4b7d67bca23796fe9db.tar.bz2 volse-hubzilla-4a7384bc0ce1893a432bf4b7d67bca23796fe9db.zip |
Merge branch '2.6RC'2.6
Diffstat (limited to 'Zotlabs/Module/Page.php')
-rw-r--r-- | Zotlabs/Module/Page.php | 60 |
1 files changed, 47 insertions, 13 deletions
diff --git a/Zotlabs/Module/Page.php b/Zotlabs/Module/Page.php index 6ef285dd0..c142afe77 100644 --- a/Zotlabs/Module/Page.php +++ b/Zotlabs/Module/Page.php @@ -3,7 +3,6 @@ namespace Zotlabs\Module; require_once('include/items.php'); require_once('include/conversation.php'); -require_once('include/page_widgets.php'); class Page extends \Zotlabs\Web\Controller { @@ -43,11 +42,31 @@ class Page extends \Zotlabs\Web\Controller { $channel_address = argv(1); + // Always look first for the page name prefixed by the observer language; for instance page/nickname/de/foo + // followed by page/nickname/foo if that is not found. + // If your browser language is de and you want to access the default in this case, + // use page/nickname/-/foo to over-ride the language and access only the page with pagelink of 'foo' + + $page_name = ''; + $ignore_language = false; + + for($x = 2; $x < argc(); $x ++) { + if($page_name === '' && argv($x) === '-') { + $ignore_language = true; + continue; + } + if($page_name) + $page_name .= '/'; + $page_name .= argv($x); + } + + // The page link title was stored in a urlencoded format // php or the browser may/will have decoded it, so re-encode it for our search - $page_id = urlencode(argv(2)); - + $page_id = urlencode($page_name); + $lang_page_id = urlencode(\App::$language . '/' . $page_name); + $u = q("select channel_id from channel where channel_address = '%s' limit 1", dbesc($channel_address) ); @@ -64,16 +83,31 @@ class Page extends \Zotlabs\Web\Controller { require_once('include/security.php'); $sql_options = item_permissions_sql($u[0]['channel_id']); - - $r = q("select item.* from item left join iconfig on item.id = iconfig.iid - where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0 - and (( iconfig.k = 'WEBPAGE' and item_type = %d ) - OR ( iconfig.k = 'PDL' AND item_type = %d )) $sql_options $revision limit 1", - intval($u[0]['channel_id']), - dbesc($page_id), - intval(ITEM_TYPE_WEBPAGE), - intval(ITEM_TYPE_PDL) - ); + + $r = null; + + if(! $ignore_language) { + $r = q("select item.* from item left join iconfig on item.id = iconfig.iid + where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0 + and (( iconfig.k = 'WEBPAGE' and item_type = %d ) + OR ( iconfig.k = 'PDL' AND item_type = %d )) $sql_options $revision limit 1", + intval($u[0]['channel_id']), + dbesc($lang_page_id), + intval(ITEM_TYPE_WEBPAGE), + intval(ITEM_TYPE_PDL) + ); + } + if(! $r) { + $r = q("select item.* from item left join iconfig on item.id = iconfig.iid + where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0 + and (( iconfig.k = 'WEBPAGE' and item_type = %d ) + OR ( iconfig.k = 'PDL' AND item_type = %d )) $sql_options $revision limit 1", + intval($u[0]['channel_id']), + dbesc($page_id), + intval(ITEM_TYPE_WEBPAGE), + intval(ITEM_TYPE_PDL) + ); + } if(! $r) { // Check again with no permissions clause to see if it is a permissions issue |