MDL-10870 A few more fixes to the file.php page's navigation
[moodle-pu.git] / login / signup.php
blobbe1f6000c101972c08860696c1428e485756c161
1 <?php // $Id$
3 require_once('../config.php');
4 require_once('signup_form.php');
6 if (empty($CFG->registerauth)) {
7 error("Sorry, you may not use this page.");
9 $authplugin = get_auth_plugin($CFG->registerauth);
11 if (!$authplugin->can_signup()) {
12 error("Sorry, you may not use this page.");
15 //HTTPS is potentially required in this page
16 httpsrequired();
18 $mform_signup = new login_signup_form();
20 if ($mform_signup->is_cancelled()) {
21 redirect($CFG->httpswwwroot.'/login/index.php');
23 } else if ($user = $mform_signup->get_data()) {
24 $user->confirmed = 0;
25 $user->lang = current_language();
26 $user->firstaccess = time();
27 $user->mnethostid = $CFG->mnet_localhost_id;
28 $user->secret = random_string(15);
29 $user->auth = $CFG->registerauth;
31 $authplugin->user_signup($user, true); // prints notice and link to login/index.php
32 exit; //never reached
35 $newaccount = get_string('newaccount');
36 $login = get_string('login');
38 if (empty($CFG->langmenu)) {
39 $langmenu = '';
40 } else {
41 $currlang = current_language();
42 $langs = get_list_of_languages();
43 $langmenu = popup_form ("$CFG->wwwroot/login/signup.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
45 print_header($newaccount, $newaccount, "<a href=\"index.php\">$login</a> -> $newaccount", $mform_signup->focus(), "", true, "<div class=\"langmenu\">$langmenu</div>");
47 $mform_signup->display();
48 print_footer();