]> git.mxchange.org Git - friendica.git/blobdiff - mod/starred.php
Replace old database queries with the new ones
[friendica.git] / mod / starred.php
index f8e845bc6ec8f27181838abb00a542fdeedcac82..ce0c8fc09c658652234aac744d325cfe1edb6d3b 100644 (file)
@@ -1,13 +1,15 @@
 <?php
-
+/**
+ * @file mod/starred.php
+ */
 use Friendica\App;
 use Friendica\Core\System;
+use Friendica\Database\DBM;
+use Friendica\Model\Item;
 
 function starred_init(App $a) {
-
-       require_once("include/threads.php");
-
        $starred = 0;
+       $message_id = null;
 
        if (! local_user()) {
                killme();
@@ -23,7 +25,7 @@ function starred_init(App $a) {
                intval(local_user()),
                intval($message_id)
        );
-       if (! dbm::is_result($r)) {
+       if (! DBM::is_result($r)) {
                killme();
        }
 
@@ -31,13 +33,7 @@ function starred_init(App $a) {
                $starred = 1;
        }
 
-       $r = q("UPDATE `item` SET `starred` = %d WHERE `uid` = %d AND `id` = %d",
-               intval($starred),
-               intval(local_user()),
-               intval($message_id)
-       );
-
-       update_thread($message_id);
+       Item::update(['starred' => $starred], ['id' => $message_id]);
 
        // See if we've been passed a return path to redirect to
        $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');