]> git.mxchange.org Git - friendica.git/blobdiff - include/dfrn.php
merged 2 if() into one as requested by CR
[friendica.git] / include / dfrn.php
index 1064d7bd824399bc93360f2fabbb4d65d46b4ac4..83d76a0ae45cea961b58cd1ea60944fac1f10a0c 100644 (file)
@@ -216,13 +216,10 @@ class dfrn {
                        dbesc($sort)
                );
 
-               if (!dbm::is_result($r)) {
-                       /// @TODO Some logging?
-                       killme();
-               }
-
-               // Will check further below if this actually returned results.
-               // We will provide an empty feed if that is the case.
+               /*
+                * Will check further below if this actually returned results.
+                * We will provide an empty feed if that is the case.
+                */
 
                $items = $r;
 
@@ -243,10 +240,10 @@ class dfrn {
 
                $root = self::add_header($doc, $owner, $author, $alternatelink, true);
 
-               // This hook can't work anymore
+               /// @TODO This hook can't work anymore
                //      call_hooks('atom_feed', $atom);
 
-               if (!count($items) OR $onlyheader) {
+               if (!dbm::is_result($items) OR $onlyheader) {
                        $atom = trim($doc->saveXML());
 
                        call_hooks('atom_feed_end', $atom);
@@ -918,12 +915,7 @@ class dfrn {
                                intval($owner["uid"]),
                                dbesc(normalise_link($mention)));
 
-                       if (!dbm::is_result($r)) {
-                               /// @TODO Maybe some logging?
-                               killme();
-                       }
-
-                       if ($r[0]["forum"] OR $r[0]["prv"]) {
+                       if (dbm::is_result($r) AND ($r[0]["forum"] OR $r[0]["prv"])) {
                                xml::add_element($doc, $entry, "link", "", array("rel" => "mentioned",
                                                                                        "ostatus:object-type" => ACTIVITY_OBJ_GROUP,
                                                                                        "href" => $mention));
@@ -963,7 +955,7 @@ class dfrn {
                        $idtosend = '1:' . $orig_id;
                }
 
-               $rino = get_config('system','rino_encrypt');
+               $rino = get_config('system', 'rino_encrypt');
                $rino = intval($rino);
 
                // use RINO1 if mcrypt isn't installed and RINO2 was selected
@@ -1137,10 +1129,9 @@ class dfrn {
 
 
                        if ($dfrn_version >= 2.1) {
-                               if (($contact['duplex'] && strlen($contact['pubkey'])) {
-                                       || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))
-                                       || ($contact['rel'] == CONTACT_IS_SHARING && strlen($contact['pubkey'])))
-
+                               if (($contact['duplex'] && strlen($contact['pubkey']))
+                                               || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))
+                                               || ($contact['rel'] == CONTACT_IS_SHARING && strlen($contact['pubkey']))) {
                                        openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
                                } else {
                                        openssl_private_encrypt($key,$postvars['key'],$contact['prvkey']);
@@ -1751,11 +1742,7 @@ class dfrn {
                        intval($importer["importer_uid"]));
 
                if (!dbm::is_result($r)) {
-                       /*
-                        * @TODO maybe one day:
                        logger("Query failed to execute, no result returned in " . __FUNCTION__);
-                       killme();
-                       */
                        return false;
                }
 
@@ -1866,7 +1853,7 @@ class dfrn {
 
                        // do not accept (ignore) an earlier edit than one we currently have.
                        if (datetime_convert("UTC","UTC",$item["edited"]) < $current["edited"]) {
-                               return(false);
+                               return false;
                        }
 
                        $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s', `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
@@ -1961,11 +1948,9 @@ class dfrn {
                         */
 
                        /// @TODO Maybe merge these if() blocks into one?
-                       if ($is_a_remote_action && $community) {
-                               if ((!$r[0]["forum_mode"]) && (!$r[0]["wall"])) {
-                                       $is_a_remote_action = false;
-                                       logger("not a community action");
-                               }
+                       if ($is_a_remote_action && $community && (!$r[0]["forum_mode"]) && (!$r[0]["wall"])) {
+                               $is_a_remote_action = false;
+                               logger("not a community action");
                        }
 
                        if ($is_a_remote_action) {
@@ -2123,11 +2108,7 @@ class dfrn {
                                        );
 
                                        if (!dbm::is_result($r)) {
-                                               /*
-                                                * @TODO maybe one day:
                                                logger("Query failed to execute, no result returned in " . __FUNCTION__);
-                                               killme();
-                                               */
                                                return false;
                                        }