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