3 * @file mod/starred.php
6 use Friendica\Core\System;
7 use Friendica\Database\DBA;
8 use Friendica\Model\Item;
10 function starred_init(App $a) {
18 $message_id = intval($a->argv[1]);
24 $item = Item::selectFirstForUser(local_user(), ['starred'], ['uid' => local_user(), 'id' => $message_id]);
25 if (!DBA::isResult($item)) {
29 if (!intval($item['starred'])) {
33 Item::update(['starred' => $starred], ['id' => $message_id]);
35 // See if we've been passed a return path to redirect to
36 $return_path = defaults($_REQUEST, 'return', '');
38 $rand = '_=' . time();
39 if (strpos($return_path, '?')) {
45 $a->internalRedirect($return_path . $rand);
48 // the json doesn't really matter, it will either be 0 or 1
50 echo json_encode($starred);