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