3 * @file mod/starred.php
6 use Friendica\Database\DBA;
7 use Friendica\Model\Item;
9 function starred_init(App $a) {
17 $message_id = intval($a->argv[1]);
23 $item = Item::selectFirstForUser(local_user(), ['starred'], ['uid' => local_user(), 'id' => $message_id]);
24 if (!DBA::isResult($item)) {
28 if (!intval($item['starred'])) {
32 Item::update(['starred' => $starred], ['id' => $message_id]);
34 // See if we've been passed a return path to redirect to
35 $return_path = defaults($_REQUEST, 'return', '');
37 $rand = '_=' . time();
38 if (strpos($return_path, '?')) {
44 $a->internalRedirect($return_path . $rand);
47 // the json doesn't really matter, it will either be 0 or 1
49 echo json_encode($starred);