X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fthreads.php;h=bb978bc77428f05a962e9d3c355daa149043b20d;hb=2bad626be6a17423565a7aa69f001b8997da3efd;hp=3d0aa05c3c08646abbd9031894a1817d0d9f7f8a;hpb=53fbd7e7c3c69fd38ba9451c044eeed6ad2cd021;p=friendica.git diff --git a/include/threads.php b/include/threads.php index 3d0aa05c3c..bb978bc774 100644 --- a/include/threads.php +++ b/include/threads.php @@ -1,4 +1,7 @@ $data) if (!in_array($field, array("guid", "title", "body", "rendered-html", "rendered-hash"))) { - if ($sql != "") + if ($sql != "") { $sql .= ", "; + } $sql .= "`".$field."` = '".dbesc($data)."'"; } @@ -208,8 +216,9 @@ 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 (!$items) + if (!dbm::is_result($items)) { return; + } $result = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `rendered-html` = '%s', `rendered-hash` = '%s' WHERE `id` = %d", dbesc($item["title"]), @@ -224,9 +233,11 @@ 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(count($messages)) - foreach ($messages as $message) + if (dbm::is_result($messages)) { + foreach ($messages as $message) { delete_thread($message["id"], $itemuri); + } + } } function delete_thread($itemid, $itemuri = "") { @@ -242,9 +253,7 @@ function delete_thread($itemid, $itemuri = "") { intval($item["uid"]) ); if (!dbm::is_result($r)) { - $r = q("DELETE FROM `item` WHERE `uri` = '%s' AND `uid` = 0", - dbesc($itemuri) - ); + dba::delete('item', array('uri' => $itemuri, 'uid' => 0)); logger("delete_thread: Deleted shadow for item ".$itemuri." - ".print_r($result, true), LOGGER_DEBUG); } } @@ -293,4 +302,3 @@ function update_shadow_copy() { dba::close($messages); } -?>