X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fthreads.php;h=c214cf264487a6f89ddecab8248e7b81909ed5b8;hb=d9451ef969c2242b85401982669b7721483d107b;hp=5eb90b36889c0c32683e65ee7e7b5da740490308;hpb=09851331a9dc8601919cd0c9200686b92843d235;p=friendica.git diff --git a/include/threads.php b/include/threads.php index 5eb90b3688..c214cf2644 100644 --- a/include/threads.php +++ b/include/threads.php @@ -174,34 +174,29 @@ function add_shadow_entry($itemid) { function update_thread_uri($itemuri, $uid) { $messages = q("SELECT `id` FROM `item` WHERE uri ='%s' AND uid=%d", dbesc($itemuri), intval($uid)); - if (dbm::is_result($messages)) { - foreach ($messages as $message) { + if (dbm::is_result($messages)) + foreach ($messages as $message) update_thread($message["id"]); - } - } } function update_thread($itemid, $setmention = false) { $items = q("SELECT `uid`, `guid`, `title`, `body`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`, `deleted`, `origin`, `forum_mode`, `network`, `rendered-html`, `rendered-hash` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid)); - if (!dbm::is_result($items)) { + if (!dbm::is_result($items)) return; - } $item = $items[0]; - if ($setmention) { + if ($setmention) $item["mention"] = 1; - } $sql = ""; foreach ($item AS $field => $data) if (!in_array($field, array("guid", "title", "body", "rendered-html", "rendered-hash"))) { - if ($sql != "") { + if ($sql != "") $sql .= ", "; - } $sql .= "`".$field."` = '".dbesc($data)."'"; } @@ -213,9 +208,8 @@ function update_thread($itemid, $setmention = false) { // Updating a shadow item entry $items = q("SELECT `id` FROM `item` WHERE `guid` = '%s' AND `uid` = 0 LIMIT 1", dbesc($item["guid"])); - if (!dbm::is_result($items)) { + if (!$items) return; - } $result = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `rendered-html` = '%s', `rendered-hash` = '%s' WHERE `id` = %d", dbesc($item["title"]), @@ -230,11 +224,9 @@ function update_thread($itemid, $setmention = false) { function delete_thread_uri($itemuri, $uid) { $messages = q("SELECT `id` FROM `item` WHERE uri ='%s' AND uid=%d", dbesc($itemuri), intval($uid)); - if (dbm::is_result($messages)) { - foreach ($messages as $message) { + if(count($messages)) + foreach ($messages as $message) delete_thread($message["id"], $itemuri); - } - } } function delete_thread($itemid, $itemuri = "") {