delete.php 707 B

1234567891011121314151617181920212223
  1. <?php
  2. $folder_guid = (int) get_input("guid");
  3. if (!empty($folder_guid)) {
  4. if ($folder = get_entity($folder_guid)) {
  5. if (elgg_instanceof($folder, "object", FILE_TOOLS_SUBTYPE) && $folder->canEdit()) {
  6. if ($folder->delete()) {
  7. system_message(elgg_echo("file_tools:actions:delete:success"));
  8. } else {
  9. register_error(elgg_echo("file_tools:actions:delete:error:delete"));
  10. }
  11. } else {
  12. register_error(elgg_echo("InvalidClassException:NotValidElggStar", array($folder_guid, FILE_TOOLS_SUBTYPE)));
  13. }
  14. } else {
  15. register_error(elgg_echo("InvalidParameterException:NoEntityFound"));
  16. }
  17. } else {
  18. register_error(elgg_echo("InvalidParameterException:MissingParameter"));
  19. }
  20. forward(REFERER);