update_basic.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Updates the basic settings for the primary site object.
  4. *
  5. * Basic site settings are saved as metadata on the site object,
  6. * with the exception of the default language, which is saved in
  7. * the config table.
  8. *
  9. * @package Elgg.Core
  10. * @subpackage Administration.Site
  11. */
  12. $site = elgg_get_site_entity();
  13. if (!$site) {
  14. throw new InstallationException("The system is missing an ElggSite entity!");
  15. }
  16. if (!($site instanceof ElggSite)) {
  17. throw new InstallationException("Passing a non-ElggSite to an ElggSite constructor!");
  18. }
  19. $site->description = get_input('sitedescription');
  20. $site->name = strip_tags(get_input('sitename'));
  21. $site->email = get_input('siteemail');
  22. $site->save();
  23. set_config('language', get_input('language'), $site->guid);
  24. $default_limit = (int)get_input('default_limit');
  25. if ($default_limit < 1) {
  26. register_error(elgg_echo('admin:configuration:default_limit'));
  27. forward(REFERER);
  28. }
  29. set_config('default_limit', $default_limit, $site->guid);
  30. system_message(elgg_echo('admin:configuration:success'));
  31. forward(REFERER);