From 4a3149d1ba9ad08c4603b727c1e9411eaa1bbde0 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 25 Oct 2017 22:33:03 -0700 Subject: hubzilla issue #890, separate the pdl preview feature from the mod_page webpage query so that the webpage will always win if a webpage and pdl have the same name. --- Zotlabs/Module/Page.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'Zotlabs/Module/Page.php') diff --git a/Zotlabs/Module/Page.php b/Zotlabs/Module/Page.php index c142afe77..d794a43a1 100644 --- a/Zotlabs/Module/Page.php +++ b/Zotlabs/Module/Page.php @@ -89,22 +89,30 @@ class Page extends \Zotlabs\Web\Controller { 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", + and iconfig.k = 'WEBPAGE' 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) + intval(ITEM_TYPE_WEBPAGE) ); } 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 ) + 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_WEBPAGE) + ); + } + if(! $r) { + // no webpage by that name, but we do allow you to load/preview a layout using this module. Try that. + $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 = 'PDL' AND item_type = %d $sql_options $revision limit 1", + intval($u[0]['channel_id']), + dbesc($page_id), intval(ITEM_TYPE_PDL) ); } @@ -129,7 +137,7 @@ class Page extends \Zotlabs\Web\Controller { } return; } - + if($r[0]['title']) \App::$page['title'] = escape_tags($r[0]['title']); -- cgit v1.2.3 From ceed0f7a1b6d7ee713c23937a9449bd84324caf6 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 29 Oct 2017 19:52:00 -0700 Subject: allow plugin class widgets, fix sql error in page module --- Zotlabs/Module/Page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Page.php') diff --git a/Zotlabs/Module/Page.php b/Zotlabs/Module/Page.php index d794a43a1..5fdd32825 100644 --- a/Zotlabs/Module/Page.php +++ b/Zotlabs/Module/Page.php @@ -100,7 +100,7 @@ class Page extends \Zotlabs\Web\Controller { $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", + $sql_options $revision limit 1", intval($u[0]['channel_id']), dbesc($page_id), intval(ITEM_TYPE_WEBPAGE) -- cgit v1.2.3