From a16382529135a76c5afaf4d4189856734a8e7f58 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 21 May 2012 22:54:39 -0700 Subject: redir links for permission controlled attachments --- mod/item.php | 16 ++++++---------- mod/redir.php | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index 9f6b2aef4..81dd553cd 100644 --- a/mod/item.php +++ b/mod/item.php @@ -290,18 +290,16 @@ function item_post(&$a) { $author = null; $self = false; - if(($_SESSION['uid']) && ($_SESSION['uid'] == $profile_uid)) { + if((local_user()) && (local_user() == $profile_uid)) { $self = true; $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", intval($_SESSION['uid']) ); } - else { - if((x($_SESSION,'visitor_id')) && (intval($_SESSION['visitor_id']))) { - $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", - intval($_SESSION['visitor_id']) - ); - } + elseif(remote_user()) { + $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", + intval(remote_user()) + ); } if(count($r)) { @@ -311,7 +309,7 @@ function item_post(&$a) { // get contact info for owner - if($profile_uid == $_SESSION['uid']) { + if($profile_uid == local_user()) { $contact_record = $author; } else { @@ -322,8 +320,6 @@ function item_post(&$a) { $contact_record = $r[0]; } - - $post_type = notags(trim($_REQUEST['type'])); if($post_type === 'net-comment') { diff --git a/mod/redir.php b/mod/redir.php index 9223e5483..0f7b5cc23 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -6,7 +6,7 @@ function redir_init(&$a) { // traditional DFRN - if(local_user() && $a->argc == 2 && intval($a->argv[1])) { + if(local_user() && $a->argc > 1 && intval($a->argv[1])) { $cid = $a->argv[1]; -- cgit v1.2.3