Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/login/signup.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00027 require('../config.php');
00028 require_once('signup_form.php');
00029 
00030 
00031 if (empty($CFG->registerauth)) {
00032     print_error('notlocalisederrormessage', 'error', '', 'Sorry, you may not use this page.');
00033 }
00034 $authplugin = get_auth_plugin($CFG->registerauth);
00035 
00036 if (!$authplugin->can_signup()) {
00037     print_error('notlocalisederrormessage', 'error', '', 'Sorry, you may not use this page.');
00038 }
00039 
00040 //HTTPS is required in this page when $CFG->loginhttps enabled
00041 $PAGE->https_required();
00042 
00043 $PAGE->set_url('/login/signup.php');
00044 $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
00045 
00046 $mform_signup = new login_signup_form(null, null, 'post', '', array('autocomplete'=>'on'));
00047 
00048 if ($mform_signup->is_cancelled()) {
00049     redirect(get_login_url());
00050 
00051 } else if ($user = $mform_signup->get_data()) {
00052     $user->confirmed   = 0;
00053     $user->lang        = current_language();
00054     $user->firstaccess = time();
00055     $user->timecreated = time();
00056     $user->mnethostid  = $CFG->mnet_localhost_id;
00057     $user->secret      = random_string(15);
00058     $user->auth        = $CFG->registerauth;
00059 
00060     $authplugin->user_signup($user, true); // prints notice and link to login/index.php
00061     exit; //never reached
00062 }
00063 
00064 // make sure we really are on the https page when https login required
00065 $PAGE->verify_https_required();
00066 
00067 
00068 $newaccount = get_string('newaccount');
00069 $login      = get_string('login');
00070 
00071 $PAGE->navbar->add($login);
00072 $PAGE->navbar->add($newaccount);
00073 
00074 $PAGE->set_title($newaccount);
00075 $PAGE->set_heading($SITE->fullname);
00076 
00077 echo $OUTPUT->header();
00078 $mform_signup->display();
00079 echo $OUTPUT->footer();
 All Data Structures Namespaces Files Functions Variables Enumerations