<?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;
if (! local_user()) {
intval(local_user()),
intval($message_id)
);
- if (! dbm::is_result($r)) {
+ if (! DBM::is_result($r)) {
killme();
}
$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'] : '');
$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