]> git.mxchange.org Git - friendica.git/commitdiff
Better implementation of "hidewall"
authorMichael Vogel <icarus@dabo.de>
Fri, 6 May 2016 09:04:21 +0000 (11:04 +0200)
committerMichael Vogel <icarus@dabo.de>
Fri, 6 May 2016 09:04:21 +0000 (11:04 +0200)
include/dfrn.php
mod/dfrn_poll.php

index f1b325b5719c6b27fc94ecb59fc646cd8d8c8de4..5778d4ba5fc5fbe06bd4da290d1876516b380935 100644 (file)
@@ -71,7 +71,7 @@ class dfrn {
         *
         * @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();
 
@@ -234,7 +234,7 @@ class dfrn {
                // This hook can't work anymore
                //      call_hooks('atom_feed', $atom);
 
-               if(! count($items)) {
+               if (!count($items) OR $onlyheader) {
                        $atom = trim($doc->saveXML());
 
                        call_hooks('atom_feed_end', $atom);
index ab6637607e564b2d71eb2ba1353b6944a6216c65..9613229dab04e3381f63a657448acb447f55e6ca 100644 (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();
        }