4 use Friendica\Core\System;
6 function starred_init(App $a) {
8 require_once("include/threads.php");
16 $message_id = intval($a->argv[1]);
22 $r = q("SELECT `starred` FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
26 if (! dbm::is_result($r)) {
30 if (! intval($r[0]['starred'])) {
34 $r = q("UPDATE `item` SET `starred` = %d WHERE `uid` = %d AND `id` = %d",
40 update_thread($message_id);
42 // See if we've been passed a return path to redirect to
43 $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
45 $rand = '_=' . time();
46 if (strpos($return_path, '?')) {
52 goaway(System::baseUrl() . "/" . $return_path . $rand);
55 // the json doesn't really matter, it will either be 0 or 1
57 echo json_encode($starred);