[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * user signup page. 20 * 21 * @package core 22 * @subpackage auth 23 * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 27 require('../config.php'); 28 require_once($CFG->dirroot . '/user/editlib.php'); 29 30 // Try to prevent searching for sites that allow sign-up. 31 if (!isset($CFG->additionalhtmlhead)) { 32 $CFG->additionalhtmlhead = ''; 33 } 34 $CFG->additionalhtmlhead .= '<meta name="robots" content="noindex" />'; 35 36 if (empty($CFG->registerauth)) { 37 print_error('notlocalisederrormessage', 'error', '', 'Sorry, you may not use this page.'); 38 } 39 $authplugin = get_auth_plugin($CFG->registerauth); 40 41 if (!$authplugin->can_signup()) { 42 print_error('notlocalisederrormessage', 'error', '', 'Sorry, you may not use this page.'); 43 } 44 45 //HTTPS is required in this page when $CFG->loginhttps enabled 46 $PAGE->https_required(); 47 48 $PAGE->set_url('/login/signup.php'); 49 $PAGE->set_context(context_system::instance()); 50 51 $mform_signup = $authplugin->signup_form(); 52 53 if ($mform_signup->is_cancelled()) { 54 redirect(get_login_url()); 55 56 } else if ($user = $mform_signup->get_data()) { 57 $user->confirmed = 0; 58 $user->lang = current_language(); 59 $user->firstaccess = time(); 60 $user->timecreated = time(); 61 $user->mnethostid = $CFG->mnet_localhost_id; 62 $user->secret = random_string(15); 63 $user->auth = $CFG->registerauth; 64 // Initialize alternate name fields to empty strings. 65 $namefields = array_diff(get_all_user_name_fields(), useredit_get_required_name_fields()); 66 foreach ($namefields as $namefield) { 67 $user->$namefield = ''; 68 } 69 70 $authplugin->user_signup($user, true); // prints notice and link to login/index.php 71 exit; //never reached 72 } 73 74 // make sure we really are on the https page when https login required 75 $PAGE->verify_https_required(); 76 77 78 $newaccount = get_string('newaccount'); 79 $login = get_string('login'); 80 81 $PAGE->navbar->add($login); 82 $PAGE->navbar->add($newaccount); 83 84 $PAGE->set_title($newaccount); 85 $PAGE->set_heading($SITE->fullname); 86 87 echo $OUTPUT->header(); 88 $mform_signup->display(); 89 echo $OUTPUT->footer();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |