]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_poll.php
Merge pull request #2676 from tobiasd/20160713-lighttpdconfig
[friendica.git] / mod / dfrn_poll.php
index b9fcd8c4a4c7be4978944d1882cf57a0dfa3124c..9613229dab04e3381f63a657448acb447f55e6ca 100644 (file)
@@ -1,9 +1,7 @@
 <?php
-
-
-
 require_once('include/items.php');
 require_once('include/auth.php');
+require_once('include/dfrn.php');
 
 
 function dfrn_poll_init(&$a) {
@@ -27,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);
@@ -37,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 get_feed_for($a, '', $user,$last_update);
+               echo dfrn::feed('', $user,$last_update, 0, $hidewall);
                killme();
        }
 
@@ -373,7 +374,7 @@ function dfrn_poll_post(&$a) {
                }
 
                header("Content-type: application/atom+xml");
-               $o = get_feed_for($a,$dfrn_id, $a->argv[1], $last_update, $direction);
+               $o = dfrn::feed($dfrn_id, $a->argv[1], $last_update, $direction);
                echo $o;
                killme();
 
@@ -389,7 +390,7 @@ function dfrn_poll_content(&$a) {
        $sec             = ((x($_GET,'sec'))             ? $_GET['sec']                  : '');
        $dfrn_version    = ((x($_GET,'dfrn_version'))    ? (float) $_GET['dfrn_version'] : 2.0);
        $perm            = ((x($_GET,'perm'))            ? $_GET['perm']                 : 'r');
-       $quiet                   = ((x($_GET,'quiet'))                   ? true                                                  : false);
+       $quiet           = ((x($_GET,'quiet'))           ? true                          : false);
 
        $direction = (-1);
        if(strpos($dfrn_id,':') == 1) {
@@ -476,8 +477,8 @@ function dfrn_poll_content(&$a) {
                        // URL reply
 
                        if($dfrn_version < 2.2) {
-                               $s = fetch_url($r[0]['poll'] 
-                                       . '?dfrn_id=' . $encrypted_id 
+                               $s = fetch_url($r[0]['poll']
+                                       . '?dfrn_id=' . $encrypted_id
                                        . '&type=profile-check'
                                        . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
                                        . '&challenge=' . $challenge
@@ -493,7 +494,7 @@ function dfrn_poll_content(&$a) {
                                        'sec' => $sec
                                ));
                        }
-                       
+
                        $profile = ((count($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
 
                        switch($destination_url) {
@@ -506,7 +507,7 @@ function dfrn_poll_content(&$a) {
                                case 'status':
                                case '':
                                        $dest = $a->get_baseurl() . '/profile/' . $profile;
-                                       break;          
+                                       break;
                                default:
                                        $dest = $destination_url . '?f=&redir=1';
                                        break;
@@ -564,5 +565,3 @@ function dfrn_poll_content(&$a) {
                }
        }
 }
-
-