edit.php 751 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Elgg external pages: create or update
  4. *
  5. */
  6. // Get input data and don't filter the content
  7. $contents = get_input('expagescontent', '', false);
  8. $type = get_input('content_type');
  9. $guid = get_input('guid');
  10. if ($guid) {
  11. // update
  12. $expages = get_entity($guid);
  13. if (!$expages) {
  14. register_error(elgg_echo("expages:error"));
  15. forward(REFERER);
  16. }
  17. } else {
  18. // create
  19. $expages = new ElggObject();
  20. $expages->subtype = $type;
  21. }
  22. $expages->owner_guid = elgg_get_logged_in_user_guid();
  23. $expages->access_id = ACCESS_PUBLIC;
  24. $expages->title = $type;
  25. $expages->description = $contents;
  26. if (!$expages->save()) {
  27. register_error(elgg_echo("expages:error"));
  28. forward(REFERER);
  29. }
  30. system_message(elgg_echo("expages:posted"));
  31. forward(REFERER);