3 * @file mod/starred.php
6 use Friendica\Core\System;
7 use Friendica\Database\DBM;
8 use Friendica\Model\Item;
10 function starred_init(App $a) {
12 require_once("include/threads.php");
20 $message_id = intval($a->argv[1]);
26 $r = q("SELECT `starred` FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
30 if (! DBM::is_result($r)) {
34 if (! intval($r[0]['starred'])) {
38 $r = q("UPDATE `item` SET `starred` = %d WHERE `uid` = %d AND `id` = %d",
44 Item::updateThread($message_id);
46 // See if we've been passed a return path to redirect to
47 $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
49 $rand = '_=' . time();
50 if (strpos($return_path, '?')) {
56 goaway(System::baseUrl() . "/" . $return_path . $rand);
59 // the json doesn't really matter, it will either be 0 or 1
61 echo json_encode($starred);