// most likely doesn't work yet. THIS IS FOR DEVELOPERS ONLY, IT IS
// NOT RECOMMENDED FOR PRODUCTION SITES
// $CFG->unicode = true;
+//
+// Turning this on will make Moodle use a https connection just for the
+// login page (providing a secure login), and then afterwards revert
+// back to the normal http URL. Requires https to be enabled on the
+// web server.
+// $CFG->loginhttps = true;
}
if (empty($USER->id)) {
- $loginstring = "<font size=2><a href=\"$CFG->wwwroot/login/index.php\">".get_string("login")."</a></font>";
+ if (empty($CFG->loginhttps)) {
+ $wwwroot = $CFG->wwwroot;
+ } else {
+ $wwwroot = str_replace('http','https',$CFG->wwwroot);
+ }
+ $loginstring = "<font size=2><a href=\"$wwwroot/login/index.php\">".get_string("login")."</a></font>";
} else {
$loginstring = "<font size=1>".user_login_string($site)."</font>";
}
$SESSION->fromurl = $_SERVER["HTTP_REFERER"];
}
$USER = NULL;
- redirect("$CFG->wwwroot/login/index.php");
+ if (empty($CFG->loginhttps)) {
+ redirect("$CFG->wwwroot/login/index.php");
+ } else {
+ $wwwroot = str_replace('http','https',$CFG->wwwroot);
+ redirect("$wwwroot/login/index.php");
+ }
die;
}
}
if (!$menu and $navigation) {
+ if (empty($CFG->loginhttps)) {
+ $wwwroot = $CFG->wwwroot;
+ } else {
+ $wwwroot = str_replace('http','https',$CFG->wwwroot);
+ }
if (isset($USER->id)) {
- $menu = "<font size=\"2\"><a target=\"$CFG->framename\" href=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</a></font>";
+ $menu = "<font size=\"2\"><a target=\"$CFG->framename\" href=\"$wwwroot/login/logout.php\">".get_string("logout")."</a></font>";
} else {
- $menu = "<font size=\"2\"><a target=\"$CFG->framename\" href=\"$CFG->wwwroot/login/index.php\">".get_string("login")."</a></font>";
+ $menu = "<font size=\"2\"><a target=\"$CFG->framename\" href=\"$wwwroot/login/index.php\">".get_string("login")."</a></font>";
}
}
}
if (isset($user->id) and $user->id) {
+ if (empty($CFG->loginhttps)) {
+ $wwwroot = $CFG->wwwroot;
+ } else {
+ $wwwroot = str_replace('http','https',$CFG->wwwroot);
+ }
$fullname = fullname($user, true);
$username = "<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id\">$fullname</a>";
if (isguest($user->id)) {
$loggedinas = $realuserinfo.get_string("loggedinas", "moodle", "$username").
- " (<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/login/index.php\">".get_string("login")."</a>)";
+ " (<a target=\"{$CFG->framename}\" href=\"$wwwroot/login/index.php\">".get_string("login")."</a>)";
} else {
$loggedinas = $realuserinfo.get_string("loggedinas", "moodle", "$username").
" (<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</a>)";
}
} else {
$loggedinas = get_string("loggedinnot", "moodle").
- " (<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/login/index.php\">".get_string("login")."</a>)";
+ " (<a target=\"{$CFG->framename}\" href=\"$wwwroot/login/index.php\">".get_string("login")."</a>)";
}
return $loggedinas;
}
} else {
$currlang = current_language();
$langs = get_list_of_languages();
- $langmenu = popup_form ("$CFG->wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
+ if (empty($CFG->loginhttps)) {
+ $wwwroot = $CFG->wwwroot;
+ } else {
+ $wwwroot = str_replace('http','https',$CFG->wwwroot);
+ }
+ $langmenu = popup_form ("$wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
}
$loginsite = get_string("loginsite");