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']))
31 $r = q("UPDATE item SET starred = %d WHERE uid = %d and id = %d",
37 update_thread($message_id);
39 // See if we've been passed a return path to redirect to
40 $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
42 $rand = '_=' . time();
43 if(strpos($return_path, '?')) $rand = "&$rand";
44 else $rand = "?$rand";
46 goaway(App::get_baseurl() . "/" . $return_path . $rand);
49 // the json doesn't really matter, it will either be 0 or 1
51 echo json_encode($starred);