delete_img.php 683 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Elgg Market Plugin
  4. * @package market
  5. */
  6. // Get input data
  7. $guid = (int) get_input('guid');
  8. $imagenum = (int) get_input('img');
  9. // Make sure we actually have permission to edit
  10. $post = get_entity($guid);
  11. if ($post->getSubtype() == "market" && $post->canEdit()) {
  12. elgg_load_library('market');
  13. // Delete the market post
  14. $return = market_delete_image($post, $imagenum);
  15. if ($return) {
  16. // Success message
  17. system_message(elgg_echo("market:image:deleted"));
  18. } else {
  19. // Error message
  20. register_error(elgg_echo("market:image:notdeleted"));
  21. }
  22. } else {
  23. register_error(elgg_echo("market:image:notdeleted"));
  24. }
  25. forward(REFERER);