domain_based.php 936 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Save the domains for domain based joining of a group
  4. */
  5. $group_guid = (int) get_input("group_guid");
  6. $domains = get_input("domains");
  7. $forward_url = REFERER;
  8. if (!empty($group_guid)) {
  9. $group = get_entity($group_guid);
  10. if (!empty($group) && elgg_instanceof($group, "group")) {
  11. if ($group->canEdit()) {
  12. if (!empty($domains)) {
  13. $domains = string_to_tag_array($domains);
  14. $domains = "|" . implode("|", $domains) . "|";
  15. $group->setPrivateSetting("domain_based", $domains);
  16. } else {
  17. $group->removePrivateSetting("domain_based");
  18. }
  19. system_message(elgg_echo("group_tools:action:domain_based:success"));
  20. $forward_url = $group->getURL();
  21. } else {
  22. register_error(elgg_echo("groups:cantedit"));
  23. }
  24. } else {
  25. register_error(elgg_echo("groups:notfound:details"));
  26. }
  27. } else {
  28. register_error(elgg_echo("InvalidParameterException:MissingParameter"));
  29. }
  30. forward($forward_url);