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) {
18 $message_id = intval($a->argv[1]);
24 $r = q("SELECT `starred` FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
28 if (! DBM::is_result($r)) {
32 if (! intval($r[0]['starred'])) {
36 Item::update(['starred' => $starred], ['id' => $message_id]);
38 // See if we've been passed a return path to redirect to
39 $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
41 $rand = '_=' . time();
42 if (strpos($return_path, '?')) {
48 goaway(System::baseUrl() . "/" . $return_path . $rand);
51 // the json doesn't really matter, it will either be 0 or 1
53 echo json_encode($starred);