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.

This commit is contained in:
Michael Vogel 2014-08-28 01:06:41 +02:00
parent 4ad2bbddc7
commit 4bdd905b3e
4 changed files with 31 additions and 25 deletions

View file

@ -1414,7 +1414,9 @@ if(! function_exists('profile_load')) {
$a->page['title'] = $a->profile['name'] . " @ " . $a->config['sitename']; $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']; $_SESSION['mobile-theme'] = $a->profile['mobile-theme'];
/** /**

View file

@ -55,7 +55,7 @@ function nav_info(&$a) {
*/ */
$myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : ''); $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 ); $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"), 'icon' => (count($r) ? $a->get_cached_avatar_image($r[0]['micro']) : $a->get_baseurl($ssl_state)."/images/person-48.jpg"),
'name' => $a->user['username'], 'name' => $a->user['username'],
); );
} }
else { else {
$nav['login'] = Array('login',t('Login'), ($a->module == 'login'?'selected':''), t('Sign in')); $nav['login'] = Array('login',t('Login'), ($a->module == 'login'?'selected':''), t('Sign in'));
@ -101,7 +101,7 @@ function nav_info(&$a) {
if(! $homelink) if(! $homelink)
$homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : ''); $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')); $nav['home'] = array($homelink, t('Home'), "", t('Home Page'));

View file

@ -33,7 +33,7 @@ function display_init(&$a) {
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
AND `item`.`deny_cid` = '' AND `item`.`deny_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`.`guid` = '%s'", $a->argv[1]);
// AND `item`.`private` = 0 AND `item`.`wall` = 1 // AND `item`.`private` = 0 AND `item`.`wall` = 1
if (count($r)) { if (count($r)) {
@ -65,6 +65,10 @@ function display_init(&$a) {
} else } else
$profiledata = array(); $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 WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
AND `item`.`deny_cid` = '' AND `item`.`deny_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`.`guid` = '%s'", $a->argv[1]);
// AND `item`.`private` = 0 AND `item`.`wall` = 1 // AND `item`.`private` = 0 AND `item`.`wall` = 1
if (count($r)) { if (count($r)) {

View file

@ -736,7 +736,7 @@ function item_post(&$a) {
update_thread($post_id); update_thread($post_id);
// update filetags in pconfig // 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"); proc_run('php', "include/notifier.php", 'edit_post', "$post_id");
if((x($_REQUEST,'return')) && strlen($return_path)) { if((x($_REQUEST,'return')) && strlen($return_path)) {
@ -792,8 +792,8 @@ function item_post(&$a) {
dbesc($datarray['attach']), dbesc($datarray['attach']),
intval($datarray['bookmark']), intval($datarray['bookmark']),
intval($datarray['origin']), intval($datarray['origin']),
intval($datarray['moderated']), intval($datarray['moderated']),
dbesc($datarray['file']) dbesc($datarray['file'])
); );
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1", $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
@ -804,7 +804,7 @@ function item_post(&$a) {
add_thread($post_id); add_thread($post_id);
// update filetags in pconfig // 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 // Store the fresh generated item into the cache
$cachefile = get_cachefile($datarray["guid"]."-".hash("md5", $datarray['body'])); $cachefile = get_cachefile($datarray["guid"]."-".hash("md5", $datarray['body']));
@ -942,25 +942,25 @@ function item_post(&$a) {
. '<br />'; . '<br />';
$disclaimer .= sprintf( t('You may visit them online at %s'), $a->get_baseurl() . '/profile/' . $a->user['nickname']) . EOL; $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; $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
if (!$datarray['title']=='') { if (!$datarray['title']=='') {
$subject = email_header_encode($datarray['title'],'UTF-8'); $subject = email_header_encode($datarray['title'],'UTF-8');
} else { } else {
$subject = email_header_encode('[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']),'UTF-8'); $subject = email_header_encode('[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']),'UTF-8');
} }
$link = '<a href="' . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />'; $link = '<a href="' . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />';
$html = prepare_body($datarray); $html = prepare_body($datarray);
$message = '<html><body>' . $link . $html . $disclaimer . '</body></html>'; $message = '<html><body>' . $link . $html . $disclaimer . '</body></html>';
include_once('include/html2plain.php'); include_once('include/html2plain.php');
$params = array ( $params = array (
'fromName' => $a->user['username'], 'fromName' => $a->user['username'],
'fromEmail' => $a->user['email'], 'fromEmail' => $a->user['email'],
'toEmail' => $addr, 'toEmail' => $addr,
'replyTo' => $a->user['email'], 'replyTo' => $a->user['email'],
'messageSubject' => $subject, 'messageSubject' => $subject,
'htmlVersion' => $message, 'htmlVersion' => $message,
'textVersion' => html2plain($html.$disclaimer), 'textVersion' => html2plain($html.$disclaimer),
); );
enotify::send($params); enotify::send($params);
} }
} }
} }