Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
948 B

  1. <?php
  2. function ignored_init(&$a) {
  3. $ignored = 0;
  4. if(! local_user())
  5. killme();
  6. if($a->argc > 1)
  7. $message_id = intval($a->argv[1]);
  8. if(! $message_id)
  9. killme();
  10. $r = q("SELECT `ignored` FROM `thread` WHERE `uid` = %d AND `iid` = %d LIMIT 1",
  11. intval(local_user()),
  12. intval($message_id)
  13. );
  14. if(! count($r))
  15. killme();
  16. if(! intval($r[0]['ignored']))
  17. $ignored = 1;
  18. $r = q("UPDATE `thread` SET `ignored` = %d WHERE `uid` = %d and `iid` = %d",
  19. intval($ignored),
  20. intval(local_user()),
  21. intval($message_id)
  22. );
  23. // See if we've been passed a return path to redirect to
  24. $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
  25. if($return_path) {
  26. $rand = '_=' . time();
  27. if(strpos($return_path, '?')) $rand = "&$rand";
  28. else $rand = "?$rand";
  29. goaway($a->get_baseurl() . "/" . $return_path . $rand);
  30. }
  31. // the json doesn't really matter, it will either be 0 or 1
  32. echo json_encode($ignored);
  33. killme();
  34. }