Better implementation of "hidewall"

This commit is contained in:
Michael Vogel 2016-05-06 11:04:21 +02:00
commit 6f72bc8d3a
2 changed files with 9 additions and 6 deletions

View file

@ -25,6 +25,8 @@ function dfrn_poll_init(&$a) {
$dfrn_id = substr($dfrn_id,2);
}
$hidewall = false;
if(($dfrn_id === '') && (! x($_POST,'dfrn_id'))) {
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
http_status_exit(403);
@ -35,16 +37,17 @@ function dfrn_poll_init(&$a) {
$r = q("SELECT `hidewall`,`nickname` FROM `user` WHERE `user`.`nickname` = '%s' LIMIT 1",
dbesc($a->argv[1])
);
if(! $r)
if (!$r)
http_status_exit(404);
if(($r[0]['hidewall']) && (! local_user()))
http_status_exit(403);
$hidewall = ($r[0]['hidewall'] && !local_user());
$user = $r[0]['nickname'];
}
logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $user);
header("Content-type: application/atom+xml");
echo dfrn::feed('', $user,$last_update);
echo dfrn::feed('', $user,$last_update, 0, $hidewall);
killme();
}