]> git.mxchange.org Git - friendica.git/blobdiff - mod/starred.php
Some more direct SQL calls had been replaced
[friendica.git] / mod / starred.php
index c23b07b8b595b22757b0fd1a0c7f31f4eed5ac3c..ce0c8fc09c658652234aac744d325cfe1edb6d3b 100644 (file)
@@ -1,11 +1,15 @@
 <?php
-
-
-function starred_init(App &$a) {
-
-       require_once("include/threads.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) {
        $starred = 0;
+       $message_id = null;
 
        if (! local_user()) {
                killme();
@@ -21,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();
        }
 
@@ -29,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'] : '');
@@ -47,7 +45,7 @@ function starred_init(App &$a) {
                        $rand = "?$rand";
                }
 
-               goaway(App::get_baseurl() . "/" . $return_path . $rand);
+               goaway(System::baseUrl() . "/" . $return_path . $rand);
        }
 
        // the json doesn't really matter, it will either be 0 or 1