| [ Index ] |
PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008] |
[Summary view] [Print] [Text view]
1 <?PHP //$Id: block_login.php,v 1.22.2.4 2008/03/03 11:41:03 moodler Exp $ 2 3 class block_login extends block_base { 4 function init() { 5 $this->title = get_string('login'); 6 $this->version = 2007101509; 7 } 8 9 function applicable_formats() { 10 return array('site' => true); 11 } 12 13 function get_content () { 14 global $USER, $CFG; 15 $wwwroot = ''; 16 $signup = ''; 17 18 if ($this->content !== NULL) { 19 return $this->content; 20 } 21 22 if (empty($CFG->loginhttps)) { 23 $wwwroot = $CFG->wwwroot; 24 } else { 25 // This actually is not so secure ;-), 'cause we're 26 // in unencrypted connection... 27 $wwwroot = str_replace("http://", "https://", $CFG->wwwroot); 28 } 29 30 if (!empty($CFG->registerauth)) { 31 $authplugin = get_auth_plugin($CFG->registerauth); 32 if ($authplugin->can_signup()) { 33 $signup = $wwwroot . '/login/signup.php'; 34 } 35 } 36 // TODO: now that we have multiauth it is hard to find out if there is a way to change password 37 $forgot = $wwwroot . '/login/forgot_password.php'; 38 39 $username = get_moodle_cookie() === 'nobody' ? '' : get_moodle_cookie(); 40 41 $this->content->footer = ''; 42 $this->content->text = ''; 43 44 if (!isloggedin() or isguestuser()) { // Show the block 45 46 $this->content->text .= "\n".'<form class="loginform" id="login" method="post" action="'.$wwwroot.'/login/index.php">'; 47 48 $this->content->text .= '<div class="c1 fld username"><label for="login_username">'.get_string('username').'</label>'; 49 $this->content->text .= '<input type="text" name="username" id="login_username" value="'.s($username).'" /></div>'; 50 51 $this->content->text .= '<div class="c1 fld password"><label for="login_password">'.get_string('password').'</label>'; 52 $this->content->text .= '<input type="password" name="password" id="login_password" value="" /></div>'; 53 54 $this->content->text .= '<div class="c1 btn"><input type="submit" value="'.get_string('login').'" /></div>'; 55 56 $this->content->text .= "</form>\n"; 57 58 if (!empty($signup)) { 59 $this->content->footer .= '<div><a href="'.$signup.'">'.get_string('startsignup').'</a></div>'; 60 } 61 if (!empty($forgot)) { 62 $this->content->footer .= '<div><a href="'.$forgot.'">'.get_string('forgotaccount').'</a></div>'; 63 } 64 } 65 66 return $this->content; 67 } 68 } 69 70 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 14 11:33:29 2009 | Cross-referenced by PHPXref 0.7 |