4 function starred_init(App &$a) {
6 require_once("include/threads.php");
14 $message_id = intval($a->argv[1]);
20 $r = q("SELECT `starred` FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
24 if (! dbm::is_result($r)) {
28 if (! intval($r[0]['starred'])) {
32 $r = q("UPDATE `item` SET `starred` = %d WHERE `uid` = %d AND `id` = %d",
38 update_thread($message_id);
40 // See if we've been passed a return path to redirect to
41 $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
43 $rand = '_=' . time();
44 if (strpos($return_path, '?')) {
50 goaway(App::get_baseurl() . "/" . $return_path . $rand);
53 // the json doesn't really matter, it will either be 0 or 1
55 echo json_encode($starred);