Skip to content

Commit

Permalink
fixed problem when set both loginhttps and https in wwwroot, closes b…
Browse files Browse the repository at this point in the history
…ug #5507 and #3848; merged from MOODLE_16_STABLE
  • Loading branch information
skodak committed May 15, 2006
1 parent 91d7ead commit 2c3432e
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion auth/cas/login.php
Expand Up @@ -18,7 +18,7 @@
if (empty($CFG->loginhttps)) {
$wwwroot = $CFG->wwwroot;
} else {
$wwwroot = str_replace('http','https',$CFG->wwwroot);
$wwwroot = str_replace('http:','https:',$CFG->wwwroot);
}
$langmenu = popup_form ("$wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/moodlelib.php
Expand Up @@ -1525,7 +1525,7 @@ function require_login($courseid=0, $autologinguest=true, $cm=null) {
if (empty($CFG->loginhttps)) {
redirect($CFG->wwwroot .'/login/index.php'. $loginguest);
} else {
$wwwroot = str_replace('http','https', $CFG->wwwroot);
$wwwroot = str_replace('http:','https:', $CFG->wwwroot);
redirect($wwwroot .'/login/index.php'. $loginguest);
}
exit;
Expand Down
12 changes: 6 additions & 6 deletions lib/weblib.php
Expand Up @@ -1906,11 +1906,11 @@ function print_header ($title='', $heading='', $navigation='', $focus='', $meta=

/// We have to change some URLs in styles if we are in a $HTTPSPAGEREQUIRED page
if (!empty($HTTPSPAGEREQUIRED)) {
$CFG->themewww = str_replace('http', 'https', $CFG->themewww);
$CFG->pixpath = str_replace('http', 'https', $CFG->pixpath);
$CFG->modpixpath = str_replace('http', 'https', $CFG->modpixpath);
$CFG->themewww = str_replace('http:', 'https:', $CFG->themewww);
$CFG->pixpath = str_replace('http:', 'https:', $CFG->pixpath);
$CFG->modpixpath = str_replace('http:', 'https:', $CFG->modpixpath);
foreach ($CFG->stylesheets as $key => $stylesheet) {
$CFG->stylesheets[$key] = str_replace('http', 'https', $stylesheet);
$CFG->stylesheets[$key] = str_replace('http:', 'https:', $stylesheet);
}
}

Expand Down Expand Up @@ -1945,7 +1945,7 @@ function print_header ($title='', $heading='', $navigation='', $focus='', $meta=
if (empty($CFG->loginhttps)) {
$wwwroot = $CFG->wwwroot;
} else {
$wwwroot = str_replace('http','https',$CFG->wwwroot);
$wwwroot = str_replace('http:','https:',$CFG->wwwroot);
}
if (isset($course->id)) {
$menu = user_login_string($course);
Expand Down Expand Up @@ -2430,7 +2430,7 @@ function user_login_string($course=NULL, $user=NULL) {
if (empty($CFG->loginhttps)) {
$wwwroot = $CFG->wwwroot;
} else {
$wwwroot = str_replace('http','https',$CFG->wwwroot);
$wwwroot = str_replace('http:','https:',$CFG->wwwroot);
}

if (isset($user->id) and $user->id) {
Expand Down
2 changes: 1 addition & 1 deletion mod/chat/view.php
Expand Up @@ -108,7 +108,7 @@

$wwwroot = $CFG->wwwroot.'/login/index.php';
if (!empty($CFG->loginhttps)) {
$wwwroot = str_replace('http','https', $wwwroot);
$wwwroot = str_replace('http:','https:', $wwwroot);
}

notice_yesno(get_string('noguests', 'chat').'<br /><br />'.get_string('liketologin'),
Expand Down
2 changes: 1 addition & 1 deletion mod/forum/markposts.php
Expand Up @@ -29,7 +29,7 @@
if (isguest()) { // Guests can't change forum
$wwwroot = $CFG->wwwroot.'/login/index.php';
if (!empty($CFG->loginhttps)) {
$wwwroot = str_replace('http','https', $wwwroot);
$wwwroot = str_replace('http:','https:', $wwwroot);
}

$strforums = get_string('modulenameplural', 'forum');
Expand Down
2 changes: 1 addition & 1 deletion mod/forum/post.php
Expand Up @@ -16,7 +16,7 @@
if (isguest()) {
$wwwroot = $CFG->wwwroot.'/login/index.php';
if (!empty($CFG->loginhttps)) {
$wwwroot = str_replace('http','https', $wwwroot);
$wwwroot = str_replace('http:','https:', $wwwroot);
}

if (isset($forum)) { // User is starting a new discussion in a forum
Expand Down
2 changes: 1 addition & 1 deletion mod/forum/settracking.php
Expand Up @@ -27,7 +27,7 @@
if (isguest()) { // Guests can't change tracking
$wwwroot = $CFG->wwwroot.'/login/index.php';
if (!empty($CFG->loginhttps)) {
$wwwroot = str_replace('http','https', $wwwroot);
$wwwroot = str_replace('http:','https:', $wwwroot);
}

$strforums = get_string('modulenameplural', 'forum');
Expand Down
2 changes: 1 addition & 1 deletion mod/forum/subscribe.php
Expand Up @@ -43,7 +43,7 @@
if (isguest()) { // Guests can't subscribe
$wwwroot = $CFG->wwwroot.'/login/index.php';
if (!empty($CFG->loginhttps)) {
$wwwroot = str_replace('http','https', $wwwroot);
$wwwroot = str_replace('http:','https:', $wwwroot);
}

$strforums = get_string('modulenameplural', 'forum');
Expand Down
2 changes: 1 addition & 1 deletion mod/quiz/view.php
Expand Up @@ -127,7 +127,7 @@

$wwwroot = $CFG->wwwroot.'/login/index.php';
if (!empty($CFG->loginhttps)) {
$wwwroot = str_replace('http','https', $wwwroot);
$wwwroot = str_replace('http:','https:', $wwwroot);
}

notice_yesno(get_string('guestsno', 'quiz').'<br /><br />'.get_string('liketologin'),
Expand Down
2 changes: 1 addition & 1 deletion my/index.php
Expand Up @@ -14,7 +14,7 @@
if (isguest()) {
$wwwroot = $CFG->wwwroot.'/login/index.php';
if (!empty($CFG->loginhttps)) {
$wwwroot = str_replace('http','https', $wwwroot);
$wwwroot = str_replace('http:','https:', $wwwroot);
}

print_header($mymoodlestr);
Expand Down
2 changes: 1 addition & 1 deletion user/tabs.php
Expand Up @@ -93,7 +93,7 @@
if(empty($CFG->loginhttps)) {
$wwwroot = $CFG->wwwroot;
} else {
$wwwroot = str_replace('http','https',$CFG->wwwroot);
$wwwroot = str_replace('http:','https:',$CFG->wwwroot);
}

$toprow[] = new tabobject('editprofile', $wwwroot.'/user/edit.php?id='.$user->id.'&amp;course='.$course->id, get_string('editmyprofile'));
Expand Down
2 changes: 1 addition & 1 deletion user/view.php
Expand Up @@ -289,7 +289,7 @@
if (empty($CFG->loginhttps)) {
$internalpassword = "$CFG->wwwroot/login/change_password.php";
} else {
$internalpassword = str_replace('http','https',$CFG->wwwroot.'/login/change_password.php');
$internalpassword = str_replace('http:','https:',$CFG->wwwroot.'/login/change_password.php');
}
}

Expand Down

0 comments on commit 2c3432e

Please sign in to comment.