aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-10-28 18:20:04 -0700
committerfriendica <info@friendica.com>2013-10-28 18:20:04 -0700
commit4415ed78202c2d4b23375ac6737f9f6e49640b20 (patch)
treef3a5a05cb2316d25456a9dbefb753dbf2c49567b
parent1380bee82caad1dce6ffda7c35cb4ce3e94911f2 (diff)
downloadvolse-hubzilla-4415ed78202c2d4b23375ac6737f9f6e49640b20.tar.gz
volse-hubzilla-4415ed78202c2d4b23375ac6737f9f6e49640b20.tar.bz2
volse-hubzilla-4415ed78202c2d4b23375ac6737f9f6e49640b20.zip
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.
-rw-r--r--mod/display.php20
1 files changed, 19 insertions, 1 deletions
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)) {