[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/login/ -> signup.php (source)

   1  <?php  // $Id: signup.php,v 1.56.2.2 2008/09/25 07:40:54 skodak Exp $
   2  
   3      require_once ('../config.php');
   4      
   5      /**
   6       * Returns whether or not the captcha element is enabled, and the admin settings fulfil its requirements.
   7       * @return bool
   8       */
   9      function signup_captcha_enabled() {
  10          global $CFG;
  11          return !empty($CFG->recaptchapublickey) && !empty($CFG->recaptchaprivatekey) && get_config('auth/email', 'recaptcha');
  12      }
  13      
  14      require_once ('signup_form.php');
  15      
  16  
  17      if (empty($CFG->registerauth)) {
  18          error("Sorry, you may not use this page.");
  19      }
  20      $authplugin = get_auth_plugin($CFG->registerauth);
  21  
  22      if (!$authplugin->can_signup()) {
  23          error("Sorry, you may not use this page.");
  24      }
  25  
  26      //HTTPS is potentially required in this page
  27      httpsrequired();
  28  
  29      $mform_signup = new login_signup_form();
  30  
  31      if ($mform_signup->is_cancelled()) {
  32          redirect($CFG->httpswwwroot.'/login/index.php');
  33  
  34      } else if ($user = $mform_signup->get_data()) {
  35          $user->confirmed   = 0;
  36          $user->lang        = current_language();
  37          $user->firstaccess = time();
  38          $user->mnethostid  = $CFG->mnet_localhost_id;
  39          $user->secret      = random_string(15);
  40          $user->auth        = $CFG->registerauth;
  41  
  42          $authplugin->user_signup($user, true); // prints notice and link to login/index.php
  43          exit; //never reached
  44      }
  45  
  46      $newaccount = get_string('newaccount');
  47      $login      = get_string('login');
  48  
  49      if (empty($CFG->langmenu)) {
  50          $langmenu = '';
  51      } else {
  52          $currlang = current_language();
  53          $langs    = get_list_of_languages();
  54          $langmenu = popup_form ("$CFG->wwwroot/login/signup.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
  55      }
  56  
  57      $navlinks = array();
  58      $navlinks[] = array('name' => $login, 'link' => "index.php", 'type' => 'misc');
  59      $navlinks[] = array('name' => $newaccount, 'link' => null, 'type' => 'misc');
  60      $navigation = build_navigation($navlinks);
  61      print_header($newaccount, $newaccount, $navigation, $mform_signup->focus(), "", true, "<div class=\"langmenu\">$langmenu</div>");
  62      
  63      $mform_signup->display();
  64      print_footer();
  65  
  66  
  67  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7