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