From 4bdd905b3ecf8f0f29f7b4b85bc5a0f5c7899d5d Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Thu, 28 Aug 2014 01:06:41 +0200 Subject: [PATCH] Only show foreign items if the profile of the user isn't hidden. Show the user's theme - not the theme of the viewed profile. --- boot.php | 4 +++- include/nav.php | 6 +++--- mod/display.php | 8 ++++++-- mod/item.php | 38 +++++++++++++++++++------------------- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/boot.php b/boot.php index f4468bee92..122201839c 100644 --- a/boot.php +++ b/boot.php @@ -1414,7 +1414,9 @@ if(! function_exists('profile_load')) { $a->page['title'] = $a->profile['name'] . " @ " . $a->config['sitename']; - $_SESSION['theme'] = $a->profile['theme']; + if (!$profiledata) + $_SESSION['theme'] = $a->profile['theme']; + $_SESSION['mobile-theme'] = $a->profile['mobile-theme']; /** diff --git a/include/nav.php b/include/nav.php index f838830a88..7708f09e6b 100644 --- a/include/nav.php +++ b/include/nav.php @@ -55,7 +55,7 @@ function nav_info(&$a) { */ $myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : ''); - + $sitelocation = $myident . substr($a->get_baseurl($ssl_state),strpos($a->get_baseurl($ssl_state),'//') + 2 ); @@ -86,7 +86,7 @@ function nav_info(&$a) { 'icon' => (count($r) ? $a->get_cached_avatar_image($r[0]['micro']) : $a->get_baseurl($ssl_state)."/images/person-48.jpg"), 'name' => $a->user['username'], ); - + } else { $nav['login'] = Array('login',t('Login'), ($a->module == 'login'?'selected':''), t('Sign in')); @@ -101,7 +101,7 @@ function nav_info(&$a) { if(! $homelink) $homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : ''); - if(($a->module != 'home') && (! (local_user()))) + if(($a->module != 'home') && (! (local_user()))) $nav['home'] = array($homelink, t('Home'), "", t('Home Page')); diff --git a/mod/display.php b/mod/display.php index c6d33ce05f..abb03b6d5b 100644 --- a/mod/display.php +++ b/mod/display.php @@ -33,7 +33,7 @@ function display_init(&$a) { WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' - AND `item`.`private` = 0 + AND `item`.`private` = 0 AND NOT `user`.`hidewall` AND `item`.`guid` = '%s'", $a->argv[1]); // AND `item`.`private` = 0 AND `item`.`wall` = 1 if (count($r)) { @@ -65,6 +65,10 @@ function display_init(&$a) { } else $profiledata = array(); } + } else { + $a->error = 404; + notice( t('Item not found.') . EOL); + return; } } @@ -220,7 +224,7 @@ function display_content(&$a, $update = 0) { WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' - AND `item`.`private` = 0 + AND `item`.`private` = 0 AND NOT `user`.`hidewall` AND `item`.`guid` = '%s'", $a->argv[1]); // AND `item`.`private` = 0 AND `item`.`wall` = 1 if (count($r)) { diff --git a/mod/item.php b/mod/item.php index a08d0e02b3..0e2fce7bf7 100644 --- a/mod/item.php +++ b/mod/item.php @@ -736,7 +736,7 @@ function item_post(&$a) { update_thread($post_id); // update filetags in pconfig - file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); + file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); proc_run('php', "include/notifier.php", 'edit_post', "$post_id"); if((x($_REQUEST,'return')) && strlen($return_path)) { @@ -792,8 +792,8 @@ function item_post(&$a) { dbesc($datarray['attach']), intval($datarray['bookmark']), intval($datarray['origin']), - intval($datarray['moderated']), - dbesc($datarray['file']) + intval($datarray['moderated']), + dbesc($datarray['file']) ); $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1", @@ -804,7 +804,7 @@ function item_post(&$a) { add_thread($post_id); // update filetags in pconfig - file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); + file_tag_update_pconfig($uid,$categories_old,$categories_new,'category'); // Store the fresh generated item into the cache $cachefile = get_cachefile($datarray["guid"]."-".hash("md5", $datarray['body'])); @@ -942,25 +942,25 @@ function item_post(&$a) { . '
'; $disclaimer .= sprintf( t('You may visit them online at %s'), $a->get_baseurl() . '/profile/' . $a->user['nickname']) . EOL; $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL; - if (!$datarray['title']=='') { - $subject = email_header_encode($datarray['title'],'UTF-8'); - } else { + if (!$datarray['title']=='') { + $subject = email_header_encode($datarray['title'],'UTF-8'); + } else { $subject = email_header_encode('[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']),'UTF-8'); - } + } $link = '' . $a->user['username'] . '

'; $html = prepare_body($datarray); $message = '' . $link . $html . $disclaimer . ''; - include_once('include/html2plain.php'); - $params = array ( - 'fromName' => $a->user['username'], - 'fromEmail' => $a->user['email'], - 'toEmail' => $addr, - 'replyTo' => $a->user['email'], - 'messageSubject' => $subject, - 'htmlVersion' => $message, - 'textVersion' => html2plain($html.$disclaimer), - ); - enotify::send($params); + include_once('include/html2plain.php'); + $params = array ( + 'fromName' => $a->user['username'], + 'fromEmail' => $a->user['email'], + 'toEmail' => $addr, + 'replyTo' => $a->user['email'], + 'messageSubject' => $subject, + 'htmlVersion' => $message, + 'textVersion' => html2plain($html.$disclaimer), + ); + enotify::send($params); } } }