add.php 877 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Action for adding a wire post
  4. *
  5. */
  6. // don't filter since we strip and filter escapes some characters
  7. $body = get_input('body', '', false);
  8. $access_id = ACCESS_PUBLIC;
  9. $method = 'site';
  10. $parent_guid = (int) get_input('parent_guid');
  11. // make sure the post isn't blank
  12. if (empty($body)) {
  13. register_error(elgg_echo("thewire:blank"));
  14. forward(REFERER);
  15. }
  16. $guid = thewire_save_post($body, elgg_get_logged_in_user_guid(), $access_id, $parent_guid, $method);
  17. if (!$guid) {
  18. register_error(elgg_echo("thewire:error"));
  19. forward(REFERER);
  20. }
  21. // Send response to original poster if not already registered to receive notification
  22. if ($parent_guid) {
  23. thewire_send_response_notification($guid, $parent_guid, $user);
  24. $parent = get_entity($parent_guid);
  25. forward("thewire/thread/$parent->wire_thread");
  26. }
  27. system_message(elgg_echo("thewire:posted"));
  28. forward(REFERER);