From 4e8a97f30a585eb707081a9216f840eb443a8764 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sat, 28 May 2011 00:42:01 -0700 Subject: [PATCH] bug #38 posts and photos only visible to friends if so configured --- include/event.php | 4 ++-- mod/photos.php | 11 +++++++++++ mod/profile.php | 11 ++++++----- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/event.php b/include/event.php index d7071bd1f9..06239b2abb 100644 --- a/include/event.php +++ b/include/event.php @@ -14,14 +14,14 @@ function format_event_html($ev) { . datetime_convert('UTC','UTC',$ev['start'], ATOM_TIME) . '" >' . datetime_convert('UTC', date_default_timezone_get(), - $ev['start'] /*, format /*) + $ev['start'] /*, format */ ) . '

'; $o .= '

' . t('Ends: ') . '' . datetime_convert('UTC', date_default_timezone_get(), - $ev['finish'] /*, format /*) + $ev['finish'] /*, format */ ) . '

'; $o .= '

' . t('Location:') . '' diff --git a/mod/photos.php b/mod/photos.php index 89fef2ee86..1fb6ee5817 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -722,6 +722,8 @@ function photos_content(&$a) { $owner_uid = $a->data['user']['uid']; + + $community_page = (($a->data['user']['page-flags'] == PAGE_COMMUNITY) ? true : false); if((local_user()) && (local_user() == $owner_uid)) @@ -763,6 +765,15 @@ function photos_content(&$a) { } } + $r = q("SELECT `hidewall` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1", + intval($owner_uid) + ); + + if(count($r) && $r[0]['hidewall'] && (local_user() !== $owner_uid) && (! remote_contact)) { + notice( t('Access to this item is restricted.') . EOL); + return; + } + // default permissions - anonymous user $sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' "; diff --git a/mod/profile.php b/mod/profile.php index 8d46d6c5ba..4db5485770 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -55,11 +55,6 @@ function profile_content(&$a, $update = 0) { return login(); } - if($a->profile['hidewall'] && (! local_user()) && (! remote_user())) { - notice( t('Access to this profile has been restricted.') . EOL); - return; - } - require_once("include/bbcode.php"); require_once('include/security.php'); require_once('include/conversation.php'); @@ -102,6 +97,12 @@ function profile_content(&$a, $update = 0) { } $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false); + + if($a->profile['hidewall'] && (! $is_owner) && (! remote_contact)) { + notice( t('Access to this profile has been restricted.') . EOL); + return; + } + if(! $update) { if(x($_GET,'tab'))