aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)) {