]> git.mxchange.org Git - friendica.git/blobdiff - mod/pubsubhubbub.php
get_basepath() uses a lot $this (which means object-referenced calls, or
[friendica.git] / mod / pubsubhubbub.php
index ad75268a9422f674c1d0d64b93e1f80474d2a60a..bfe553c44caf1e8c91b5ee7cc74f1e2167fe3408 100644 (file)
@@ -55,7 +55,7 @@ function pubsubhubbub_init(&$a) {
                           " AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
                           dbesc($nick));
 
-               if(!count($r)) {
+               if (!dbm::is_result($r)) {
                        logger('pubsubhubbub: local account not found: ' . $nick);
                        http_status_exit(404);
                }
@@ -70,10 +70,10 @@ function pubsubhubbub_init(&$a) {
                }
 
                // get corresponding row from contact table
-               $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0" .
-                          " AND `pending` = 0 LIMIT 1",
+               $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked`".
+                          " AND NOT `pending` AND `self` LIMIT 1",
                           intval($owner['uid']));
-               if(!count($r)) {
+               if (!dbm::is_result($r)) {
                        logger('pubsubhubbub: contact not found.');
                        http_status_exit(404);
                }
@@ -132,7 +132,7 @@ function pubsubhubbub_init(&$a) {
 
                        // if we are just updating an old subscription, keep the
                        // old values for push and last_update
-                       if (count($r)) {
+                       if (dbm::is_result($r)) {
                                $last_update = $r[0]['last_update'];
                                $push_flag = $r[0]['push'];
                        }