From 4415ed78202c2d4b23375ac6737f9f6e49640b20 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 28 Oct 2013 18:20:04 -0700 Subject: mod_display - if we are given the mid of a webpage, redirect to that webpage. This lets us include webpages in searches and 'view in context' will do the right thing. --- mod/display.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/display.php b/mod/display.php index d91d14d01..e95a038ea 100644 --- a/mod/display.php +++ b/mod/display.php @@ -69,7 +69,7 @@ function display_content(&$a, $update = 0, $load = false) { $target_item = null; - $r = q("select mid, parent_mid from item where mid = '%s' limit 1", + $r = q("select id, uid, mid, parent_mid, item_restrict from item where mid = '%s' limit 1", dbesc($item_hash) ); @@ -77,6 +77,24 @@ function display_content(&$a, $update = 0, $load = false) { $target_item = $r[0]; } + if($target_item['item_restrict'] & ITEM_WEBPAGE) { + $x = q("select * from channel where channel_id = %d limit 1", + intval($target_item['uid']) + ); + $y = q("select * from item_id where uid = %d and service = 'WEBPAGE' and iid = %d limit 1", + intval($target_item['uid']), + intval($target_item['id']) + ); + if($x && $y) { + goaway(z_root() . '/page/' . $x[0]['channel_address'] . '/' . $y[0]['sid']); + } + else { + notice( t('Page not found.') . EOL); + return ''; + } + } + + if((! $update) && (! $load)) { -- cgit v1.2.3