register.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Assembles and outputs the registration page.
  4. *
  5. * Since 1.8, registration can be disabled via administration. If this is
  6. * the case, calls to this page will forward to the network front page.
  7. *
  8. * If the user is logged in, this page will forward to the network
  9. * front page.
  10. *
  11. * @package Elgg.Core
  12. * @subpackage Registration
  13. */
  14. // check new registration allowed
  15. if (elgg_get_config('allow_registration') == false) {
  16. register_error(elgg_echo('registerdisabled'));
  17. forward();
  18. }
  19. $friend_guid = (int) get_input('friend_guid', 0);
  20. $invitecode = get_input('invitecode');
  21. // only logged out people need to register
  22. if (elgg_is_logged_in()) {
  23. forward();
  24. }
  25. $title = elgg_echo("register");
  26. // create the registration url - including switching to https if configured
  27. $register_url = elgg_get_site_url() . 'action/register';
  28. if (elgg_get_config('https_login')) {
  29. $register_url = str_replace("http:", "https:", $register_url);
  30. }
  31. $form_params = array(
  32. 'action' => $register_url,
  33. 'class' => 'elgg-form-account',
  34. );
  35. $body_params = array(
  36. 'friend_guid' => $friend_guid,
  37. 'invitecode' => $invitecode
  38. );
  39. $content = elgg_view_form('register', $form_params, $body_params);
  40. $content .= elgg_view('help/register');
  41. if (elgg_get_config('walled_garden')) {
  42. elgg_load_css('elgg.walled_garden');
  43. $body = elgg_view_layout('walled_garden', array('content' => $content));
  44. echo elgg_view_page($title, $body, 'walled_garden');
  45. } else {
  46. $body = elgg_view_layout('one_column', array(
  47. 'title' => $title,
  48. 'content' => $content,
  49. ));
  50. echo elgg_view_page($title, $body);
  51. }