]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Item.php
Issue 9736: Fix for undroppable registrations
[friendica.git] / src / Model / Item.php
index d41e84c5b9f44c5e6ff0b1d61cb15c9d542c56a3..75c3d08384b1adfc01e105a97a83b79891397856 100644 (file)
@@ -223,13 +223,14 @@ class Item
         * Fetch a single item row
         *
         * @param mixed $stmt statement object
-        * @return array current row
+        * @return array|false current row or false
+        * @throws \Exception
         */
        public static function fetch($stmt)
        {
                $row = DBA::fetch($stmt);
 
-               if (is_bool($row)) {
+               if (!is_array($row)) {
                        return $row;
                }
 
@@ -1384,6 +1385,19 @@ class Item
                        return false;
                }
 
+               if (!empty($item['uid'])) {
+                       $owner = User::getOwnerDataById($item['uid'], false);
+                       if (!$owner) {
+                               Logger::notice('Missing item user owner data', ['uid' => $item['uid']]);
+                               return false;
+                       }
+
+                       if ($owner['account_expired'] || $owner['account_removed']) {
+                               Logger::notice('Item user has been deleted/expired/removed', ['uid' => $item['uid'], 'deleted' => $owner['deleted'], 'account_expired' => $owner['account_expired'], 'account_removed' => $owner['account_removed']]);
+                               return false;
+                       }
+               }
+
                if (!empty($item['author-id']) && Contact::isBlocked($item['author-id'])) {
                        Logger::notice('Author is blocked node-wide', ['author-link' => $item['author-link'], 'item-uri' => $item['uri']]);
                        return false;
@@ -1568,7 +1582,7 @@ class Item
                        $item['network'] = Protocol::DFRN;
                        $item['protocol'] = Conversation::PARCEL_DIRECT;
 
-                       if (is_int($notify)) {
+                       if (in_array($notify, PRIORITIES)) {
                                $priority = $notify;
                        }
                } else {
@@ -2909,10 +2923,10 @@ class Item
                $datarray['api_source'] = true;
 
                // We have to tell the hooks who we are - this really should be improved
-               $_SESSION["authenticated"] = true;
-               $_SESSION["uid"] = $contact['uid'];
+               $_SESSION['authenticated'] = true;
+               $_SESSION['uid'] = $contact['uid'];
 
-               return $result;
+               return (bool)$result;
        }
 
        /**