mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-17773 new get_login_url() function - fixes missing httpslogin tweaks
This commit is contained in:
parent
27df7ae8a5
commit
93f66983cc
@ -22,7 +22,7 @@ if ($hassiteconfig
|
||||
$temp->add(new admin_setting_configselect('guestloginbutton', get_string('guestloginbutton', 'auth'),
|
||||
get_string('showguestlogin', 'auth'), '1', array('0'=>get_string('hide'), '1'=>get_string('show'))));
|
||||
$temp->add(new admin_setting_configtext('alternateloginurl', get_string('alternateloginurl', 'auth'),
|
||||
get_string('alternatelogin', 'auth', htmlspecialchars($CFG->wwwroot.'/login/index.php')), ''));
|
||||
get_string('alternatelogin', 'auth', htmlspecialchars(get_login_url())), ''));
|
||||
$temp->add(new admin_setting_configtext('forgottenpasswordurl', get_string('forgottenpasswordurl', 'auth'),
|
||||
get_string('forgottenpassword', 'auth'), ''));
|
||||
$temp->add(new admin_setting_configtextarea('auth_instructions', get_string('instructions', 'auth'),
|
||||
|
@ -14,22 +14,23 @@
|
||||
$cancel = optional_param( 'cancel' );
|
||||
$launch = optional_param( 'launch' );
|
||||
|
||||
$loginurl = get_login_url();
|
||||
|
||||
if (!empty($id)) {
|
||||
require_login($id);
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
print_error('cannotuseadminadminorteacher', 'error', "$CFG->wwwroot/login/index.php");
|
||||
print_error('cannotuseadminadminorteacher', 'error', $loginurl);
|
||||
}
|
||||
} else {
|
||||
require_login();
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error('cannotuseadmin', 'error', "$CFG->wwwroot/login/index.php");
|
||||
print_error('cannotuseadmin', 'error', $loginurl);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($to)) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
print_error('cannotuseadminadminorteacher', 'error', "$CFG->wwwroot/login/index.php");
|
||||
print_error('cannotuseadminadminorteacher', 'error', $loginurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,19 +4,21 @@
|
||||
//Check login
|
||||
require_login();
|
||||
|
||||
$loginurl = get_login_url();
|
||||
|
||||
if (!empty($course->id)) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if (empty($to)) {
|
||||
print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadminadminorteacher", '', $loginurl);
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadminadminorteacher", '', $loginurl);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadmin", '', $loginurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,19 +4,21 @@
|
||||
//Check login
|
||||
require_login();
|
||||
|
||||
$loginurl = get_login_url();
|
||||
|
||||
if (!empty($course->id)) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if (empty($to)) {
|
||||
print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadminadminorteacher", '', $loginurl);
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadminadminorteacher", '', $loginurl);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadmin", '', $loginurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,19 +5,21 @@
|
||||
//Check login
|
||||
require_login();
|
||||
|
||||
$loginurl = get_login_url();
|
||||
|
||||
if (!empty($course->id)) {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if (empty($to)) {
|
||||
print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadminadminorteacher", '', $loginurl);
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadminadminorteacher", '', $loginurl);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadmin", '', $loginurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,21 +61,23 @@
|
||||
$to = $SESSION->restore->course_id;
|
||||
}
|
||||
|
||||
$loginurl = get_login_url();
|
||||
|
||||
if (!empty($id)) {
|
||||
require_login($id);
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
if (empty($to)) {
|
||||
print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadminadminorteacher", '', $loginurl);
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
|
||||
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadminadminorteacher", '', $loginurl);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadmin", '', $loginurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,14 +190,16 @@
|
||||
//Check login
|
||||
require_login();
|
||||
|
||||
$loginurl = get_login_url();
|
||||
|
||||
//Check admin
|
||||
if (!empty($id)) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadminadminorteacher", '', $loginurl);
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadmin", '', $loginurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,21 +20,23 @@
|
||||
//Check login
|
||||
require_login();
|
||||
|
||||
$loginurl = get_login_url();
|
||||
|
||||
//Check admin
|
||||
if (!empty($id)) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
if (empty($to)) {
|
||||
print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadminadminorteacher", '', $loginurl);
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
|
||||
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadminadminorteacher", '', $loginurl);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadmin", '', $loginurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,14 +25,16 @@
|
||||
//Check login
|
||||
require_login();
|
||||
|
||||
$loginurl = get_login_url();
|
||||
|
||||
//Check admin
|
||||
if (!empty($id)) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
print_error('cannotuseadminadminorteacher', '', '$CFG->wwwroot/login/index.php');
|
||||
print_error('cannotuseadminadminorteacher', '', $loginurl);
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error('cannotuseadmin', '', '$CFG->wwwroot/login/index.php');
|
||||
print_error('cannotuseadmin', '', $loginurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,22 +11,24 @@
|
||||
|
||||
//Check login
|
||||
require_login();
|
||||
|
||||
|
||||
$loginurl = get_login_url();
|
||||
|
||||
//Check admin
|
||||
if (!empty($id)) {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
|
||||
if (empty($to)) {
|
||||
print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadminadminorteacher", '', $loginurl);
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
|
||||
&& !has_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $to))) {
|
||||
print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadminadminorteacher", '', $loginurl);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
|
||||
print_error("cannotuseadmin", '', $loginurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ class block_login extends block_base {
|
||||
|
||||
if (!isloggedin() or isguestuser()) { // Show the block
|
||||
|
||||
$this->content->text .= "\n".'<form class="loginform" id="login" method="post" action="'.$wwwroot.'/login/index.php">';
|
||||
$this->content->text .= "\n".'<form class="loginform" id="login" method="post" action="'.get_login_url().'">';
|
||||
|
||||
$this->content->text .= '<div class="c1 fld username"><label for="login_username">'.get_string('username').'</label>';
|
||||
$this->content->text .= '<input type="text" name="username" id="login_username" value="'.s($username).'" /></div>';
|
||||
|
@ -309,7 +309,7 @@ EOT;
|
||||
} else {
|
||||
//if not logged in
|
||||
$this->content->footer = '<hr />'.get_string('please', $tagslang).'
|
||||
<a href="'.$CFG->wwwroot.'/login/index.php">'.get_string('login', $tagslang).'
|
||||
<a href="'.get_login_url().'">'.get_string('login', $tagslang).'
|
||||
</a> '.get_string('tagunits', $tagslang);
|
||||
}
|
||||
}
|
||||
|
@ -11,12 +11,8 @@
|
||||
$loginasguest = optional_param('loginasguest', 0, PARAM_BOOL); // hmm, is this still needed?
|
||||
|
||||
if (!isloggedin()) {
|
||||
$wwwroot = $CFG->wwwroot;
|
||||
if (!empty($CFG->loginhttps)) {
|
||||
$wwwroot = str_replace('http:','https:', $wwwroot);
|
||||
}
|
||||
// do not use require_login here because we are usually comming from it
|
||||
redirect($wwwroot.'/login/index.php');
|
||||
redirect(get_login_url());
|
||||
}
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
|
@ -39,12 +39,7 @@
|
||||
|
||||
if (isguestuser()) {
|
||||
print_box_start('centerpara');
|
||||
if (empty($CFG->loginhttps)) {
|
||||
$loginurl = $CFG->wwwroot .'/login/index.php';
|
||||
} else {
|
||||
$wwwroot = str_replace('http:','https:', $CFG->wwwroot);
|
||||
$loginurl = $wwwroot .'/login/index.php';
|
||||
}
|
||||
$loginurl = get_login_url();
|
||||
print_single_button($loginurl, null, get_string('login'));
|
||||
print_box_end();
|
||||
}
|
||||
|
@ -1861,6 +1861,27 @@ function course_setup($courseorid=0) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns full login url.
|
||||
*
|
||||
* @param bool $loginguest add login guest param
|
||||
* @return string login url
|
||||
*/
|
||||
function get_login_url($loginguest=false) {
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->loginhttps) or $loginguest) { //do not require https for guest logins
|
||||
$loginguest = $loginguest ? '?loginguest=true' : '';
|
||||
$url = "$CFG->wwwroot/login/index.php$loginguest";
|
||||
|
||||
} else {
|
||||
$wwwroot = str_replace('http:','https:', $CFG->wwwroot);
|
||||
$url = "$wwwroot/login/index.php";
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks that the current user is logged in and has the
|
||||
* required privileges
|
||||
@ -1906,17 +1927,12 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null, $setwantsu
|
||||
$SESSION->fromurl = $_SERVER['HTTP_REFERER'];
|
||||
}
|
||||
if ($autologinguest and !empty($CFG->guestloginbutton) and !empty($CFG->autologinguests) and ($COURSE->id == SITEID or $COURSE->guest) ) {
|
||||
$loginguest = '?loginguest=true';
|
||||
$loginguest = true;
|
||||
} else {
|
||||
$loginguest = '';
|
||||
$loginguest = false;
|
||||
}
|
||||
if (empty($CFG->loginhttps) or $loginguest) { //do not require https for guest logins
|
||||
redirect($CFG->wwwroot .'/login/index.php'. $loginguest);
|
||||
} else {
|
||||
$wwwroot = str_replace('http:','https:', $CFG->wwwroot);
|
||||
redirect($wwwroot .'/login/index.php');
|
||||
}
|
||||
exit;
|
||||
redirect(get_login_url($loginguest));
|
||||
exit; // never reached
|
||||
}
|
||||
|
||||
/// loginas as redirection if needed
|
||||
@ -1956,13 +1972,6 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null, $setwantsu
|
||||
redirect($CFG->wwwroot .'/user/edit.php?id='. $USER->id .'&course='. SITEID);
|
||||
}
|
||||
|
||||
/// Make sure current IP matches the one for this session (if required)
|
||||
if (!empty($CFG->tracksessionip)) {
|
||||
if ($USER->sessionIP != md5(getremoteaddr())) {
|
||||
print_error('sessionipnomatch', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/// Make sure the USER has a sesskey set up. Used for checking script parameters.
|
||||
sesskey();
|
||||
|
||||
@ -2069,7 +2078,7 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null, $setwantsu
|
||||
case 1: /// Guests always allowed
|
||||
if (!has_capability('moodle/course:view', $COURSE->context)) { // Prohibited by capability
|
||||
print_header_simple();
|
||||
notice(get_string('guestsnotallowed', '', format_string($COURSE->fullname)), "$CFG->wwwroot/login/index.php");
|
||||
notice(get_string('guestsnotallowed', '', format_string($COURSE->fullname)), get_login_url());
|
||||
}
|
||||
if (!empty($cm) and !$cm->visible) { // Not allowed to see module, send to course page
|
||||
redirect($CFG->wwwroot.'/course/view.php?id='.$cm->course,
|
||||
@ -2094,7 +2103,7 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null, $setwantsu
|
||||
print_header_simple('', '',
|
||||
build_navigation(array(array('name' => $strloggedinasguest, 'link' => null, 'type' => 'misc'))));
|
||||
if (empty($USER->access['rsw'][$COURSE->context->path])) { // Normal guest
|
||||
notice(get_string('guestsnotallowed', '', format_string($COURSE->fullname)), "$CFG->wwwroot/login/index.php");
|
||||
notice(get_string('guestsnotallowed', '', format_string($COURSE->fullname)), get_login_url());
|
||||
} else {
|
||||
notify(get_string('guestsnotallowed', '', format_string($COURSE->fullname)));
|
||||
echo '<div class="notifyproblem">'.switchroles_form($COURSE->id).'</div>';
|
||||
|
@ -95,6 +95,29 @@ class moodle_session {
|
||||
session_set_user($user);
|
||||
}
|
||||
|
||||
protected function check_security() {
|
||||
global $CFG;
|
||||
|
||||
if (!empty($_SESSION['USER']->id)) {
|
||||
/// Make sure current IP matches the one for this session (if required)
|
||||
$remoteaddr = getremoteaddr();
|
||||
|
||||
if (empty($_SESSION['USER']->sessionip)) {
|
||||
$_SESSION['USER']->sessionip = $remoteaddr;
|
||||
}
|
||||
|
||||
if ($_SESSION['USER']->sessionip != $remoteaddr) {
|
||||
if (!is_guestuser($_SESSION['USER'])) {
|
||||
$link = '';
|
||||
} else {
|
||||
|
||||
}
|
||||
print_error('sessionipnomatch', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Terminates active moodle session
|
||||
*/
|
||||
|
@ -3506,11 +3506,7 @@ function user_login_string($course=NULL, $user=NULL) {
|
||||
$realuserinfo = '';
|
||||
}
|
||||
|
||||
if (empty($CFG->loginhttps)) {
|
||||
$wwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$wwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
$loginurl = get_login_url();
|
||||
|
||||
if (empty($course->id)) {
|
||||
// $course->id is not defined during installation
|
||||
@ -3525,7 +3521,7 @@ function user_login_string($course=NULL, $user=NULL) {
|
||||
}
|
||||
if (isset($user->username) && $user->username == 'guest') {
|
||||
$loggedinas = $realuserinfo.get_string('loggedinasguest').
|
||||
" (<a $CFG->frametarget href=\"$wwwroot/login/index.php\">".get_string('login').'</a>)';
|
||||
" (<a $CFG->frametarget href=\"$loginurl\">".get_string('login').'</a>)';
|
||||
} else if (!empty($user->access['rsw'][$context->path])) {
|
||||
$rolename = '';
|
||||
if ($role = $DB->get_record('role', array('id'=>$user->access['rsw'][$context->path]))) {
|
||||
@ -3540,7 +3536,7 @@ function user_login_string($course=NULL, $user=NULL) {
|
||||
}
|
||||
} else {
|
||||
$loggedinas = get_string('loggedinnot', 'moodle').
|
||||
" (<a $CFG->frametarget href=\"$wwwroot/login/index.php\">".get_string('login').'</a>)';
|
||||
" (<a $CFG->frametarget href=\"$loginurl\">".get_string('login').'</a>)';
|
||||
}
|
||||
return '<div class="logininfo">'.$loggedinas.'</div>';
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
if (empty($SESSION->wantsurl)) {
|
||||
$SESSION->wantsurl = $CFG->httpswwwroot.'/login/change_password.php';
|
||||
}
|
||||
redirect($CFG->httpswwwroot.'/login/index.php');
|
||||
redirect(get_login_url());
|
||||
}
|
||||
|
||||
// do not require change own password cap if change forced
|
||||
|
@ -18,7 +18,7 @@ $systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
$strforgotten = get_string('passwordforgotten');
|
||||
$strlogin = get_string('login');
|
||||
|
||||
$navigation = build_navigation(array(array('name' => $strlogin, 'link' => "$CFG->wwwroot/login/index.php", 'type' => 'misc'),
|
||||
$navigation = build_navigation(array(array('name' => $strlogin, 'link' => get_login_url(), 'type' => 'misc'),
|
||||
array('name' => $strforgotten, 'link' => null, 'type' => 'misc')));
|
||||
|
||||
// if alternatepasswordurl is defined, then we'll just head there
|
||||
@ -91,7 +91,7 @@ if ($p_secret !== false) {
|
||||
$mform = new login_forgot_password_form();
|
||||
|
||||
if ($mform->is_cancelled()) {
|
||||
redirect($CFG->httpswwwroot.'/login/index.php');
|
||||
redirect(get_login_url());
|
||||
|
||||
} else if ($data = $mform->get_data()) {
|
||||
/// find the user in the database and mail info
|
||||
|
@ -29,7 +29,7 @@
|
||||
$mform_signup = new login_signup_form();
|
||||
|
||||
if ($mform_signup->is_cancelled()) {
|
||||
redirect($CFG->httpswwwroot.'/login/index.php');
|
||||
redirect(get_login_url());
|
||||
|
||||
} else if ($user = $mform_signup->get_data()) {
|
||||
$user->confirmed = 0;
|
||||
|
@ -51,7 +51,7 @@
|
||||
if (empty($SESSION->wantsurl)) {
|
||||
$SESSION->wantsurl = $CFG->httpswwwroot.'/message/edit.php';
|
||||
}
|
||||
redirect($CFG->httpswwwroot.'/login/index.php');
|
||||
redirect(get_login_url());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,13 +50,9 @@
|
||||
$navigation = build_navigation('', $cm);
|
||||
print_header_simple(format_string($chat->name), '', $navigation,
|
||||
'', '', true, '', navmenu($course, $cm));
|
||||
$wwwroot = $CFG->wwwroot.'/login/index.php';
|
||||
if (!empty($CFG->loginhttps)) {
|
||||
$wwwroot = str_replace('http:','https:', $wwwroot);
|
||||
}
|
||||
|
||||
notice_yesno(get_string('noguests', 'chat').'<br /><br />'.get_string('liketologin'),
|
||||
$wwwroot, $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id);
|
||||
|
||||
print_footer($course);
|
||||
exit;
|
||||
|
@ -127,12 +127,8 @@
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
if (has_capability('moodle/legacy:guest', $sitecontext, NULL, false)) { // Guest on whole site
|
||||
$wwwroot = $CFG->wwwroot.'/login/index.php';
|
||||
if (!empty($CFG->loginhttps)) {
|
||||
$wwwroot = str_replace('http:','https:', $wwwroot);
|
||||
}
|
||||
notice_yesno(get_string('noguestchoose', 'choice').'<br /><br />'.get_string('liketologin'),
|
||||
$wwwroot, $_SERVER['HTTP_REFERER']);
|
||||
get_login_url(), $_SERVER['HTTP_REFERER']);
|
||||
|
||||
} else if (has_capability('moodle/legacy:guest', $context, NULL, false)) { // Guest in this course only
|
||||
$SESSION->wantsurl = $FULLME;
|
||||
|
@ -33,15 +33,10 @@
|
||||
}
|
||||
|
||||
if (isguest()) { // Guests can't change forum
|
||||
$wwwroot = $CFG->wwwroot.'/login/index.php';
|
||||
if (!empty($CFG->loginhttps)) {
|
||||
$wwwroot = str_replace('http:','https:', $wwwroot);
|
||||
}
|
||||
|
||||
$navigation = build_navigation('', $cm);
|
||||
print_header($course->shortname, $course->fullname, $navigation, '', '', true, "", navmenu($course, $cm));
|
||||
notice_yesno(get_string('noguesttracking', 'forum').'<br /><br />'.get_string('liketologin'),
|
||||
$wwwroot, $returnto);
|
||||
get_login_url(), $returnto);
|
||||
print_footer($course);
|
||||
exit;
|
||||
}
|
||||
|
@ -24,11 +24,6 @@
|
||||
|
||||
if (has_capability('moodle/legacy:guest', $sitecontext, NULL, false)) {
|
||||
|
||||
$wwwroot = $CFG->wwwroot.'/login/index.php';
|
||||
if (!empty($CFG->loginhttps)) {
|
||||
$wwwroot = str_replace('http:', 'https:', $wwwroot);
|
||||
}
|
||||
|
||||
if (!empty($forum)) { // User is starting a new discussion in a forum
|
||||
if (! $forum = $DB->get_record('forum', array('id' => $forum))) {
|
||||
print_error('invalidforumid', 'forum');
|
||||
@ -62,7 +57,7 @@
|
||||
print_header($course->shortname, $course->fullname, $navigation, '' , '', true, "", navmenu($course, $cm));
|
||||
|
||||
notice_yesno(get_string('noguestpost', 'forum').'<br /><br />'.get_string('liketologin'),
|
||||
$wwwroot, get_referer(false));
|
||||
get_login_url(), get_referer(false));
|
||||
print_footer($course);
|
||||
exit;
|
||||
}
|
||||
|
@ -46,16 +46,12 @@
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
if (isguest()) { // Guests can't subscribe
|
||||
$wwwroot = $CFG->wwwroot.'/login/index.php';
|
||||
if (!empty($CFG->loginhttps)) {
|
||||
$wwwroot = str_replace('http:','https:', $wwwroot);
|
||||
}
|
||||
|
||||
$navigation = build_navigation('', $cm);
|
||||
print_header($course->shortname, $course->fullname, $navigation, '', '', true, "", navmenu($course, $cm));
|
||||
|
||||
notice_yesno(get_string('noguestsubscribe', 'forum').'<br /><br />'.get_string('liketologin'),
|
||||
$wwwroot, $_SERVER['HTTP_REFERER']);
|
||||
get_login_url(), $_SERVER['HTTP_REFERER']);
|
||||
print_footer($course);
|
||||
exit;
|
||||
}
|
||||
|
@ -117,13 +117,8 @@
|
||||
|
||||
/// Guests can't do a quiz, so offer them a choice of logging in or going back.
|
||||
if (isguestuser()) {
|
||||
$loginurl = $CFG->wwwroot.'/login/index.php';
|
||||
if (!empty($CFG->loginhttps)) {
|
||||
$loginurl = str_replace('http:','https:', $loginurl);
|
||||
}
|
||||
|
||||
notice_yesno('<p>' . get_string('guestsno', 'quiz') . "</p>\n\n<p>" .
|
||||
get_string('liketologin') . "</p>\n", $loginurl, get_referer(false));
|
||||
get_string('liketologin') . "</p>\n", get_login_url(), get_referer(false));
|
||||
finish_page($course);
|
||||
}
|
||||
|
||||
|
@ -12,14 +12,9 @@
|
||||
$mymoodlestr = get_string('mymoodle','my');
|
||||
|
||||
if (isguest()) {
|
||||
$wwwroot = $CFG->wwwroot.'/login/index.php';
|
||||
if (!empty($CFG->loginhttps)) {
|
||||
$wwwroot = str_replace('http:','https:', $wwwroot);
|
||||
}
|
||||
|
||||
print_header($mymoodlestr);
|
||||
notice_yesno(get_string('noguest', 'my').'<br /><br />'.get_string('liketologin'),
|
||||
$wwwroot, $CFG->wwwroot);
|
||||
get_login_url(), $CFG->wwwroot);
|
||||
print_footer();
|
||||
die();
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
if (!has_capability('moodle/site:doanything', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error('beadmin', 'search', "$CFG->wwwroot/login/index.php");
|
||||
print_error('beadmin', 'search', get_login_url());
|
||||
}
|
||||
|
||||
/// check for php5 (lib.php)
|
||||
|
@ -32,7 +32,7 @@
|
||||
}
|
||||
|
||||
if (!has_capability('moodle/site:doanything', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error('beadmin', 'search', "$CFG->wwwroot/login/index.php");
|
||||
print_error('beadmin', 'search', get_login_url());
|
||||
} //if
|
||||
|
||||
try {
|
||||
|
@ -49,7 +49,7 @@ $separator = (array_key_exists('WINDIR', $_SERVER)) ? ';' : ':' ;
|
||||
}
|
||||
|
||||
if (!has_capability('moodle/site:doanything', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error('beadmin', 'search', "$CFG->wwwroot/login/index.php");
|
||||
print_error('beadmin', 'search', get_login_url());
|
||||
}
|
||||
|
||||
/// confirmation flag to prevent accidental reindexing (indexersplash.php is the correct entry point)
|
||||
|
@ -33,7 +33,7 @@ ini_set('include_path', $CFG->dirroot.'\search'.$separator.ini_get('include_path
|
||||
}
|
||||
|
||||
if (!has_capability('moodle/site:doanything', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error('beadmin', 'search', "$CFG->wwwroot/login/index.php");
|
||||
print_error('beadmin', 'search', get_login_url());
|
||||
}
|
||||
|
||||
require_once("$CFG->dirroot/search/indexlib.php");
|
||||
|
@ -24,7 +24,7 @@
|
||||
}
|
||||
|
||||
if (!has_capability('moodle/site:doanything', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error('onlyadmins', 'error', "$CFG->wwwroot/login/index.php");
|
||||
print_error('onlyadmins', 'error', get_login_url());
|
||||
} //if
|
||||
|
||||
mtrace('<pre>Server Time: '.date('r',time()));
|
||||
|
@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
if (!has_capability('moodle/site:doanything', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
print_error('beadmin', 'search', "$CFG->wwwroot/login/index.php");
|
||||
print_error('beadmin', 'search', get_login_url());
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -22,7 +22,7 @@
|
||||
if (empty($SESSION->wantsurl)) {
|
||||
$SESSION->wantsurl = $CFG->httpswwwroot.'/user/edit.php';
|
||||
}
|
||||
redirect($CFG->httpswwwroot.'/login/index.php');
|
||||
redirect(get_login_url());
|
||||
}
|
||||
|
||||
// Guest can not edit
|
||||
|
@ -50,7 +50,7 @@
|
||||
if (!empty($CFG->forceloginforprofiles)) {
|
||||
require_login();
|
||||
if (isguest()) {
|
||||
redirect("$CFG->wwwroot/login/index.php");
|
||||
redirect(get_login_url());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user