5 function starred_init(App $a) {
7 require_once("include/threads.php");
15 $message_id = intval($a->argv[1]);
21 $r = q("SELECT `starred` FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
25 if (! dbm::is_result($r)) {
29 if (! intval($r[0]['starred'])) {
33 $r = q("UPDATE `item` SET `starred` = %d WHERE `uid` = %d AND `id` = %d",
39 update_thread($message_id);
41 // See if we've been passed a return path to redirect to
42 $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
44 $rand = '_=' . time();
45 if (strpos($return_path, '?')) {
51 goaway(App::get_baseurl() . "/" . $return_path . $rand);
54 // the json doesn't really matter, it will either be 0 or 1
56 echo json_encode($starred);