4 use Friendica\Core\System;
5 use Friendica\Database\DBA;
6 use Friendica\Model\Item;
8 function ignored_init(App $a)
17 $message_id = intval($a->argv[1]);
24 $thread = Item::selectFirstThreadForUser(local_user(), ['uid', 'ignored'], ['iid' => $message_id]);
25 if (!DBA::isResult($thread)) {
29 if (!$thread['ignored']) {
33 if ($thread['uid'] != 0) {
34 DBA::update('thread', ['ignored' => $ignored], ['iid' => $message_id]);
36 DBA::update('user-item', ['ignored' => $ignored], ['iid' => $message_id, 'uid' => local_user()], true);
39 // See if we've been passed a return path to redirect to
40 $return_path = defaults($_REQUEST, 'return', '');
42 $rand = '_=' . time();
43 if (strpos($return_path, '?')) {
49 goaway(System::baseUrl() . "/" . $return_path . $rand);
52 // the json doesn't really matter, it will either be 0 or 1
54 echo json_encode($ignored);