Better implementation of "hidewall"
This commit is contained in:
parent
a1d06cc45e
commit
6f72bc8d3a
2 changed files with 9 additions and 6 deletions
|
@ -71,7 +71,7 @@ class dfrn {
|
||||||
*
|
*
|
||||||
* @return string DFRN feed entries
|
* @return string DFRN feed entries
|
||||||
*/
|
*/
|
||||||
public static function feed($dfrn_id, $owner_nick, $last_update, $direction = 0) {
|
public static function feed($dfrn_id, $owner_nick, $last_update, $direction = 0, $onlyheader = false) {
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ class dfrn {
|
||||||
// This hook can't work anymore
|
// This hook can't work anymore
|
||||||
// call_hooks('atom_feed', $atom);
|
// call_hooks('atom_feed', $atom);
|
||||||
|
|
||||||
if(! count($items)) {
|
if (!count($items) OR $onlyheader) {
|
||||||
$atom = trim($doc->saveXML());
|
$atom = trim($doc->saveXML());
|
||||||
|
|
||||||
call_hooks('atom_feed_end', $atom);
|
call_hooks('atom_feed_end', $atom);
|
||||||
|
|
|
@ -25,6 +25,8 @@ function dfrn_poll_init(&$a) {
|
||||||
$dfrn_id = substr($dfrn_id,2);
|
$dfrn_id = substr($dfrn_id,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$hidewall = false;
|
||||||
|
|
||||||
if(($dfrn_id === '') && (! x($_POST,'dfrn_id'))) {
|
if(($dfrn_id === '') && (! x($_POST,'dfrn_id'))) {
|
||||||
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
|
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
|
||||||
http_status_exit(403);
|
http_status_exit(403);
|
||||||
|
@ -37,14 +39,15 @@ function dfrn_poll_init(&$a) {
|
||||||
);
|
);
|
||||||
if (!$r)
|
if (!$r)
|
||||||
http_status_exit(404);
|
http_status_exit(404);
|
||||||
if(($r[0]['hidewall']) && (! local_user()))
|
|
||||||
http_status_exit(403);
|
$hidewall = ($r[0]['hidewall'] && !local_user());
|
||||||
|
|
||||||
$user = $r[0]['nickname'];
|
$user = $r[0]['nickname'];
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $user);
|
logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $user);
|
||||||
header("Content-type: application/atom+xml");
|
header("Content-type: application/atom+xml");
|
||||||
echo dfrn::feed('', $user,$last_update);
|
echo dfrn::feed('', $user,$last_update, 0, $hidewall);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue