add.php 789 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Elgg collection add page
  4. *
  5. * @package Elgg.Core
  6. * @subpackage Friends.Collections
  7. */
  8. $collection_name = htmlspecialchars(get_input('collection_name', '', false), ENT_QUOTES, 'UTF-8');
  9. $friends = get_input('friends_collection');
  10. if (!$collection_name) {
  11. register_error(elgg_echo("friends:nocollectionname"));
  12. forward(REFERER);
  13. }
  14. $id = create_access_collection($collection_name);
  15. if ($id) {
  16. $result = update_access_collection($id, $friends);
  17. if ($result) {
  18. system_message(elgg_echo("friends:collectionadded"));
  19. forward("collections/owner/" . elgg_get_logged_in_user_entity()->username);
  20. } else {
  21. register_error(elgg_echo("friends:nocollectionname"));
  22. forward(REFERER);
  23. }
  24. } else {
  25. register_error(elgg_echo("friends:nocollectionname"));
  26. forward(REFERER);
  27. }