From 2c3432e6842aae32783092def6f6b68512feb9b7 Mon Sep 17 00:00:00 2001 From: skodak Date: Mon, 15 May 2006 21:36:46 +0000 Subject: [PATCH] fixed problem when set both loginhttps and https in wwwroot, closes bug #5507 and #3848; merged from MOODLE_16_STABLE --- auth/cas/login.php | 2 +- lib/moodlelib.php | 2 +- lib/weblib.php | 12 ++++++------ mod/chat/view.php | 2 +- mod/forum/markposts.php | 2 +- mod/forum/post.php | 2 +- mod/forum/settracking.php | 2 +- mod/forum/subscribe.php | 2 +- mod/quiz/view.php | 2 +- my/index.php | 2 +- user/tabs.php | 2 +- user/view.php | 2 +- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/auth/cas/login.php b/auth/cas/login.php index ba86d7598b..36cfd69775 100644 --- a/auth/cas/login.php +++ b/auth/cas/login.php @@ -18,7 +18,7 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); 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); } diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 576da03c5e..88deb9bdf6 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -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; diff --git a/lib/weblib.php b/lib/weblib.php index 16231e780f..3f9dfb3b64 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -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); } } @@ -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); @@ -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) { diff --git a/mod/chat/view.php b/mod/chat/view.php index e6f73a1279..d908c3714f 100644 --- a/mod/chat/view.php +++ b/mod/chat/view.php @@ -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').'

'.get_string('liketologin'), diff --git a/mod/forum/markposts.php b/mod/forum/markposts.php index 45cb80f335..933ff38c41 100644 --- a/mod/forum/markposts.php +++ b/mod/forum/markposts.php @@ -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'); diff --git a/mod/forum/post.php b/mod/forum/post.php index df78008903..d420360fa4 100644 --- a/mod/forum/post.php +++ b/mod/forum/post.php @@ -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 diff --git a/mod/forum/settracking.php b/mod/forum/settracking.php index 111452b0da..8acd9a8df5 100644 --- a/mod/forum/settracking.php +++ b/mod/forum/settracking.php @@ -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'); diff --git a/mod/forum/subscribe.php b/mod/forum/subscribe.php index 323f299c8d..ad8d1d7c18 100644 --- a/mod/forum/subscribe.php +++ b/mod/forum/subscribe.php @@ -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'); diff --git a/mod/quiz/view.php b/mod/quiz/view.php index d408728d3c..e79c92bf00 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -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').'

'.get_string('liketologin'), diff --git a/my/index.php b/my/index.php index 00e4fab6c4..de6ca4653d 100644 --- a/my/index.php +++ b/my/index.php @@ -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); diff --git a/user/tabs.php b/user/tabs.php index ae5c04423f..85dd670723 100644 --- a/user/tabs.php +++ b/user/tabs.php @@ -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.'&course='.$course->id, get_string('editmyprofile')); diff --git a/user/view.php b/user/view.php index 90adf252c9..44ef0f38e9 100644 --- a/user/view.php +++ b/user/view.php @@ -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'); } } -- 2.39.5