diff --git a/admin/index.php b/admin/index.php index 48c714431b2..8d0199ee1dd 100644 --- a/admin/index.php +++ b/admin/index.php @@ -875,6 +875,8 @@ if (empty($CFG->disabledevlibdirscheck) && (is_dir($CFG->dirroot.'/vendor') || i } else { $devlibdir = false; } +// Check if the site is being foced onto ssl. +$overridetossl = !empty($CFG->overridetossl); admin_externalpage_setup('adminnotifications'); @@ -883,4 +885,4 @@ $output = $PAGE->get_renderer('core', 'admin'); echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed, $cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb, $registered, $cachewarnings, $eventshandlers, $themedesignermode, $devlibdir, - $mobileconfigured); + $mobileconfigured, $overridetossl); diff --git a/admin/renderer.php b/admin/renderer.php index 1fd8cb5ff95..9ea4ea1d280 100644 --- a/admin/renderer.php +++ b/admin/renderer.php @@ -279,13 +279,15 @@ class core_admin_renderer extends plugin_renderer_base { * @param bool $themedesignermode Warn about the theme designer mode. * @param bool $devlibdir Warn about development libs directory presence. * @param bool $mobileconfigured Whether the mobile web services have been enabled + * @param bool $overridetossl Whether or not ssl is being forced. * * @return string HTML to output. */ public function admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed, $cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb, $registered, array $cachewarnings = array(), $eventshandlers = 0, - $themedesignermode = false, $devlibdir = false, $mobileconfigured = false) { + $themedesignermode = false, $devlibdir = false, $mobileconfigured = false, + $overridetossl = false) { global $CFG; $output = ''; @@ -301,6 +303,7 @@ class core_admin_renderer extends plugin_renderer_base { $output .= $this->cron_overdue_warning($cronoverdue); $output .= $this->db_problems($dbproblems); $output .= $this->maintenance_mode_warning($maintenancemode); + $output .= $this->overridetossl_warning($overridetossl); $output .= $this->cache_warnings($cachewarnings); $output .= $this->events_handlers($eventshandlers); $output .= $this->registration_warning($registered); @@ -668,6 +671,20 @@ class core_admin_renderer extends plugin_renderer_base { return $this->warning(get_string('sitemaintenancewarning2', 'admin', $url)); } + /** + * Render a warning that ssl is forced because the site was on loginhttps. + * + * @param bool $overridetossl Whether or not ssl is being forced. + * @return string + */ + protected function overridetossl_warning($overridetossl) { + if (!$overridetossl) { + return ''; + } + $warning = get_string('overridetossl', 'core_admin'); + return $this->warning($warning, 'warning'); + } + /** * Display a warning about installing development code if necesary. * @param int $maturity diff --git a/admin/settings/security.php b/admin/settings/security.php index 061d4b1a83e..56b727acfe7 100644 --- a/admin/settings/security.php +++ b/admin/settings/security.php @@ -124,7 +124,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page // "httpsecurity" settingpage $temp = new admin_settingpage('httpsecurity', new lang_string('httpsecurity', 'admin')); - $temp->add(new admin_setting_configcheckbox('loginhttps', new lang_string('loginhttps', 'admin'), new lang_string('configloginhttps', 'admin'), 0)); + $temp->add(new admin_setting_configcheckbox('cookiesecure', new lang_string('cookiesecure', 'admin'), new lang_string('configcookiesecure', 'admin'), 1)); $temp->add(new admin_setting_configcheckbox('cookiehttponly', new lang_string('cookiehttponly', 'admin'), new lang_string('configcookiehttponly', 'admin'), 0)); $temp->add(new admin_setting_configcheckbox('allowframembedding', new lang_string('allowframembedding', 'admin'), new lang_string('allowframembedding_help', 'admin'), 0)); diff --git a/admin/settings/users.php b/admin/settings/users.php index a82d5d6bf93..7fc752f38e3 100644 --- a/admin/settings/users.php +++ b/admin/settings/users.php @@ -15,15 +15,10 @@ if ($hassiteconfig or has_capability('moodle/cohort:view', $systemcontext)) { // speedup for non-admins, add all caps used on this page - if (empty($CFG->loginhttps)) { - $securewwwroot = $CFG->wwwroot; - } else { - $securewwwroot = str_replace('http:','https:',$CFG->wwwroot); - } // stuff under the "accounts" subcategory $ADMIN->add('accounts', new admin_externalpage('editusers', new lang_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete'))); $ADMIN->add('accounts', new admin_externalpage('userbulk', new lang_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user/user_bulk.php", array('moodle/user:update', 'moodle/user:delete'))); - $ADMIN->add('accounts', new admin_externalpage('addnewuser', new lang_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create')); + $ADMIN->add('accounts', new admin_externalpage('addnewuser', new lang_string('addnewuser'), "$CFG->wwwroot/user/editadvanced.php?id=-1", 'moodle/user:create')); // "User default preferences" settingpage. $temp = new admin_settingpage('userdefaultpreferences', new lang_string('userdefaultpreferences', 'admin')); diff --git a/admin/tool/mobile/autologin.php b/admin/tool/mobile/autologin.php index d5ef969439a..13154b3d3ef 100644 --- a/admin/tool/mobile/autologin.php +++ b/admin/tool/mobile/autologin.php @@ -31,8 +31,6 @@ $urltogo = optional_param('urltogo', $CFG->wwwroot, PARAM_URL); // URL to red $context = context_system::instance(); $PAGE->set_context($context); -// Force https. -$PAGE->https_required(); // Check if the user is already logged-in. if (isloggedin() and !isguestuser()) { diff --git a/admin/tool/mobile/classes/api.php b/admin/tool/mobile/classes/api.php index 8741016dbe0..bfc42ee0226 100644 --- a/admin/tool/mobile/classes/api.php +++ b/admin/tool/mobile/classes/api.php @@ -134,7 +134,7 @@ class api { list($maintenancemessage, $notusedformat) = external_format_text($CFG->maintenance_message, FORMAT_MOODLE, $context->id); $settings = array( 'wwwroot' => $CFG->wwwroot, - 'httpswwwroot' => $CFG->httpswwwroot, + 'httpswwwroot' => $CFG->wwwroot, 'sitename' => external_format_string($SITE->fullname, $context->id, true), 'guestlogin' => $CFG->guestloginbutton, 'rememberusername' => $CFG->rememberusername, diff --git a/admin/tool/mobile/tests/externallib_test.php b/admin/tool/mobile/tests/externallib_test.php index 328011a492e..b5986aa9d9a 100644 --- a/admin/tool/mobile/tests/externallib_test.php +++ b/admin/tool/mobile/tests/externallib_test.php @@ -235,7 +235,6 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase { // Need to simulate a non HTTPS site here. $CFG->wwwroot = str_replace('https:', 'http:', $CFG->wwwroot); - $CFG->httpswwwroot = str_replace('https:', 'http:', $CFG->wwwroot); $this->resetAfterTest(true); $this->setAdminUser(); diff --git a/admin/user.php b/admin/user.php index 65f9f8ce36a..65bf4e63ec9 100644 --- a/admin/user.php +++ b/admin/user.php @@ -38,12 +38,6 @@ $strunlock = get_string('unlockaccount', 'admin'); $strconfirm = get_string('confirm'); - if (empty($CFG->loginhttps)) { - $securewwwroot = $CFG->wwwroot; - } else { - $securewwwroot = str_replace('http:','https:',$CFG->wwwroot); - } - $returnurl = new moodle_url('/admin/user.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage, 'page'=>$page)); // The $user variable is also used outside of these if statements. @@ -339,7 +333,7 @@ if (has_capability('moodle/user:update', $sitecontext)) { // prevent editing of admins by non-admins if (is_siteadmin($USER) or !is_siteadmin($user)) { - $url = new moodle_url($securewwwroot.'/user/editadvanced.php', array('id'=>$user->id, 'course'=>$site->id)); + $url = new moodle_url('/user/editadvanced.php', array('id'=>$user->id, 'course'=>$site->id)); $buttons[] = html_writer::link($url, $OUTPUT->pix_icon('t/edit', $stredit)); } } @@ -398,7 +392,7 @@ echo $OUTPUT->paging_bar($usercount, $page, $perpage, $baseurl); } if (has_capability('moodle/user:create', $sitecontext)) { - $url = new moodle_url($securewwwroot . '/user/editadvanced.php', array('id' => -1)); + $url = new moodle_url('/user/editadvanced.php', array('id' => -1)); echo $OUTPUT->single_button($url, get_string('addnewuser'), 'get'); } diff --git a/auth/classes/output/login.php b/auth/classes/output/login.php index 8bdf91de9e2..9ec9c329cbb 100644 --- a/auth/classes/output/login.php +++ b/auth/classes/output/login.php @@ -90,8 +90,8 @@ class login implements renderable, templatable { $this->autofocusform = !empty($CFG->loginpageautofocus); $this->rememberusername = isset($CFG->rememberusername) and $CFG->rememberusername == 2; - $this->forgotpasswordurl = new moodle_url($CFG->httpswwwroot . '/login/forgot_password.php'); - $this->loginurl = new moodle_url($CFG->httpswwwroot . '/login/index.php'); + $this->forgotpasswordurl = new moodle_url('/login/forgot_password.php'); + $this->loginurl = new moodle_url('/login/index.php'); $this->signupurl = new moodle_url('/login/signup.php'); // Authentication instructions. diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php index 6cf1f2819ec..91218ad193f 100644 --- a/auth/ldap/auth.php +++ b/auth/ldap/auth.php @@ -1671,8 +1671,8 @@ class auth_plugin_ldap extends auth_plugin_base { if ($referer && $referer != $CFG->wwwroot && $referer != $CFG->wwwroot . '/' && - $referer != $CFG->httpswwwroot . '/login/' && - $referer != $CFG->httpswwwroot . '/login/index.php') { + $referer != $CFG->wwwroot . '/login/' && + $referer != $CFG->wwwroot . '/login/index.php') { $SESSION->wantsurl = $referer; } } @@ -1684,7 +1684,7 @@ class auth_plugin_ldap extends auth_plugin_base { $sesskey = sesskey(); redirect($CFG->wwwroot.'/auth/ldap/ntlmsso_magic.php?sesskey='.$sesskey); } else if ($this->config->ntlmsso_ie_fastpath == AUTH_NTLM_FASTPATH_YESFORM) { - redirect($CFG->httpswwwroot.'/login/index.php?authldap_skipntlmsso=1'); + redirect($CFG-wwwroot.'/login/index.php?authldap_skipntlmsso=1'); } } redirect($CFG->wwwroot.'/auth/ldap/ntlmsso_attempt.php'); @@ -1699,7 +1699,7 @@ class auth_plugin_ldap extends auth_plugin_base { // we don't want to use at all. As we can't get rid of it, just point // $SESSION->wantsurl to $CFG->wwwroot (after all, we came from there). if (empty($SESSION->wantsurl) - && (get_local_referer() == $CFG->httpswwwroot.'/auth/ldap/ntlmsso_finish.php')) { + && (get_local_referer() == $CFG->wwwroot.'/auth/ldap/ntlmsso_finish.php')) { $SESSION->wantsurl = $CFG->wwwroot; } diff --git a/auth/ldap/ntlmsso_attempt.php b/auth/ldap/ntlmsso_attempt.php index 561d7bf9d47..3a7ad512906 100644 --- a/auth/ldap/ntlmsso_attempt.php +++ b/auth/ldap/ntlmsso_attempt.php @@ -2,9 +2,6 @@ require(__DIR__.'/../../config.php'); -//HTTPS is required in this page when $CFG->loginhttps enabled -$PAGE->https_required(); - $PAGE->set_url('/auth/ldap/ntlmsso_attempt.php'); $PAGE->set_context(context_system::instance()); @@ -33,9 +30,8 @@ $PAGE->set_title("$site->fullname: $loginsite"); $PAGE->set_heading($site->fullname); echo $OUTPUT->header(); -// $PAGE->https_required() up above takes care of what $CFG->httpswwwroot should be. $msg = '

'.get_string('ntlmsso_attempting', 'auth_ldap').'

' . 'wwwroot . '/auth/ldap/ntlmsso_magic.php?sesskey=' . $sesskey . '" />'; -redirect($CFG->httpswwwroot . '/auth/ldap/ntlmsso_finish.php', $msg, 3); +redirect($CFG->wwwroot . '/auth/ldap/ntlmsso_finish.php', $msg, 3); diff --git a/auth/ldap/ntlmsso_finish.php b/auth/ldap/ntlmsso_finish.php index 26a5129fa2f..31732425259 100644 --- a/auth/ldap/ntlmsso_finish.php +++ b/auth/ldap/ntlmsso_finish.php @@ -2,9 +2,6 @@ require(__DIR__.'/../../config.php'); -//HTTPS is required in this page when $CFG->loginhttps enabled -$PAGE->https_required(); - $PAGE->set_url('/auth/ldap/ntlmsso_finish.php'); $PAGE->set_context(context_system::instance()); @@ -32,6 +29,6 @@ if (!$authplugin->ntlmsso_finish()) { $PAGE->set_title("$site->fullname: $loginsite"); $PAGE->set_heading($site->fullname); echo $OUTPUT->header(); - redirect($CFG->httpswwwroot . '/login/index.php?authldap_skipntlmsso=1', + redirect($CFG->wwwroot . '/login/index.php?authldap_skipntlmsso=1', get_string('ntlmsso_failed','auth_ldap'), 3); } diff --git a/auth/ldap/ntlmsso_magic.php b/auth/ldap/ntlmsso_magic.php index 5d02ebe61c5..9b85989d400 100644 --- a/auth/ldap/ntlmsso_magic.php +++ b/auth/ldap/ntlmsso_magic.php @@ -8,9 +8,6 @@ define('NO_MOODLE_COOKIES', true); require(__DIR__.'/../../config.php'); -//HTTPS is required in this page when $CFG->loginhttps enabled -$PAGE->https_required(); - $PAGE->set_context(context_system::instance()); $authsequence = get_enabled_auth_plugins(true); // auths, in sequence @@ -29,8 +26,7 @@ $file = $CFG->dirroot.'/pix/spacer.gif'; if ($authplugin->ntlmsso_magic($sesskey) && file_exists($file)) { if (!empty($authplugin->config->ntlmsso_ie_fastpath)) { if (core_useragent::is_ie()) { - // $PAGE->https_required() up above takes care of what $CFG->httpswwwroot should be. - redirect($CFG->httpswwwroot.'/auth/ldap/ntlmsso_finish.php'); + redirect($CFG->wwwroot.'/auth/ldap/ntlmsso_finish.php'); } } diff --git a/auth/mnet/auth.php b/auth/mnet/auth.php index d4293f459cd..1f269f77ff2 100644 --- a/auth/mnet/auth.php +++ b/auth/mnet/auth.php @@ -1073,7 +1073,7 @@ class auth_plugin_mnet extends auth_plugin_base { global $DB, $CFG; // strip off wwwroot, since the remote site will prefix it's return url with this - $wantsurl = preg_replace('/(' . preg_quote($CFG->wwwroot, '/') . '|' . preg_quote($CFG->httpswwwroot, '/') . ')/', '', $wantsurl); + $wantsurl = preg_replace('/(' . preg_quote($CFG->wwwroot, '/') . ')/', '', $wantsurl); $sql = "SELECT DISTINCT h.id, h.wwwroot, h.name, a.sso_jump_url, a.name as application FROM {mnet_host} h diff --git a/auth/oauth2/classes/auth.php b/auth/oauth2/classes/auth.php index be9901285ce..1761768c223 100644 --- a/auth/oauth2/classes/auth.php +++ b/auth/oauth2/classes/auth.php @@ -339,7 +339,7 @@ class auth extends \auth_plugin_base { $PAGE->set_title($title); $PAGE->set_heading($PAGE->course->fullname); echo $OUTPUT->header(); - notice($message, "$CFG->httpswwwroot/index.php"); + notice($message, "$CFG->wwwroot/index.php"); } /** @@ -363,7 +363,7 @@ class auth extends \auth_plugin_base { $errormsg = get_string('loginerror_nouserinfo', 'auth_oauth2'); $SESSION->loginerrormsg = $errormsg; $client->log_out(); - redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php')); + redirect(new moodle_url('/login/index.php')); } if (empty($userinfo['username']) || empty($userinfo['email'])) { // Trigger login failed event. @@ -375,7 +375,7 @@ class auth extends \auth_plugin_base { $errormsg = get_string('loginerror_userincomplete', 'auth_oauth2'); $SESSION->loginerrormsg = $errormsg; $client->log_out(); - redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php')); + redirect(new moodle_url('/login/index.php')); } $userinfo['username'] = trim(core_text::strtolower($userinfo['username'])); @@ -416,7 +416,7 @@ class auth extends \auth_plugin_base { $errormsg = get_string('confirmationpending', 'auth_oauth2'); $SESSION->loginerrormsg = $errormsg; $client->log_out(); - redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php')); + redirect(new moodle_url('/login/index.php')); } } else if (!empty($linkedlogin)) { // Trigger login failed event. @@ -428,7 +428,7 @@ class auth extends \auth_plugin_base { $errormsg = get_string('confirmationpending', 'auth_oauth2'); $SESSION->loginerrormsg = $errormsg; $client->log_out(); - redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php')); + redirect(new moodle_url('/login/index.php')); } $issuer = $client->get_issuer(); @@ -442,7 +442,7 @@ class auth extends \auth_plugin_base { $errormsg = get_string('notloggedindebug', 'auth_oauth2', get_string('loginerror_invaliddomain', 'auth_oauth2')); $SESSION->loginerrormsg = $errormsg; $client->log_out(); - redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php')); + redirect(new moodle_url('/login/index.php')); } if (!$userwasmapped) { @@ -481,7 +481,7 @@ class auth extends \auth_plugin_base { $errormsg = get_string('accountexists', 'auth_oauth2'); $SESSION->loginerrormsg = $errormsg; $client->log_out(); - redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php')); + redirect(new moodle_url('/login/index.php')); } if (email_is_not_allowed($userinfo['email'])) { @@ -495,7 +495,7 @@ class auth extends \auth_plugin_base { $errormsg = get_string('notloggedindebug', 'auth_oauth2', $reason); $SESSION->loginerrormsg = $errormsg; $client->log_out(); - redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php')); + redirect(new moodle_url('/login/index.php')); } if (!empty($CFG->authpreventaccountcreation)) { @@ -509,7 +509,7 @@ class auth extends \auth_plugin_base { $errormsg = get_string('notloggedindebug', 'auth_oauth2', $reason); $SESSION->loginerrormsg = $errormsg; $client->log_out(); - redirect(new moodle_url($CFG->httpswwwroot . '/login/index.php')); + redirect(new moodle_url('/login/index.php')); } if ($issuer->get('requireconfirmation')) { @@ -542,5 +542,3 @@ class auth extends \auth_plugin_base { redirect($redirecturl); } } - - diff --git a/auth/shibboleth/login.php b/auth/shibboleth/login.php index cfe474e06d5..721af8079f9 100644 --- a/auth/shibboleth/login.php +++ b/auth/shibboleth/login.php @@ -15,9 +15,6 @@ } -//HTTPS is required in this page when $CFG->loginhttps enabled -$PAGE->https_required(); - /// Define variables used in page $site = get_site(); @@ -44,17 +41,17 @@ $PAGE->https_required(); // Redirect to SessionInitiator with entityID as argument if (isset($IdPs[$selectedIdP][1]) && !empty($IdPs[$selectedIdP][1])) { // For Shibbolet 1.x Service Providers - header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php')); + header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php')); // For Shibbolet 2.x Service Providers - // header('Location: '.$IdPs[$selectedIdP][1].'?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php')); + // header('Location: '.$IdPs[$selectedIdP][1].'?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php')); } else { // For Shibbolet 1.x Service Providers - header('Location: /Shibboleth.sso?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php')); + header('Location: /Shibboleth.sso?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php')); // For Shibboleth 2.x Service Providers - // header('Location: /Shibboleth.sso/DS?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php')); + // header('Location: /Shibboleth.sso/DS?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php')); } } elseif (isset($_POST['idp']) && !isset($IdPs[$_POST['idp']])) { $errormsg = get_string('auth_shibboleth_errormsg', 'auth_shibboleth'); diff --git a/blocks/login/block_login.php b/blocks/login/block_login.php index e8f2491d20c..e17aea1aa10 100644 --- a/blocks/login/block_login.php +++ b/blocks/login/block_login.php @@ -42,13 +42,7 @@ class block_login extends block_base { return $this->content; } - if (empty($CFG->loginhttps)) { - $wwwroot = $CFG->wwwroot; - } else { - // This actually is not so secure ;-), 'cause we're - // in unencrypted connection... - $wwwroot = str_replace("http://", "https://", $CFG->wwwroot); - } + $wwwroot = $CFG->wwwroot; if (signup_is_enabled()) { $signup = $wwwroot . '/login/signup.php'; diff --git a/comment/index.php b/comment/index.php index c6e1a4233da..470d3a5417f 100644 --- a/comment/index.php +++ b/comment/index.php @@ -61,7 +61,7 @@ if ($action === 'delete') { die; } else { if ($manager->delete_comment($commentid)) { - redirect($CFG->httpswwwroot.'/comment/'); + redirect($CFG->wwwroot.'/comment/'); } else { $err = 'cannotdeletecomment'; } @@ -81,7 +81,7 @@ echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('comments')); echo $OUTPUT->box_start('generalbox commentsreport'); if (!empty($err)) { - print_error($err, 'error', $CFG->httpswwwroot.'/comment/'); + print_error($err, 'error', $CFG->wwwroot.'/comment/'); } if (empty($action)) { echo '
'; diff --git a/enrol/paypal/lib.php b/enrol/paypal/lib.php index 7c0fbf748bd..c22e6f2b522 100644 --- a/enrol/paypal/lib.php +++ b/enrol/paypal/lib.php @@ -203,13 +203,7 @@ class enrol_paypal_plugin extends enrol_plugin { $cost = format_float($cost, 2, false); if (isguestuser()) { // force login only for guest user, not real users with guest role - if (empty($CFG->loginhttps)) { - $wwwroot = $CFG->wwwroot; - } else { - // This actually is not so secure ;-), 'cause we're - // in unencrypted connection... - $wwwroot = str_replace("http://", "https://", $CFG->wwwroot); - } + $wwwroot = $CFG->wwwroot; echo '

'.get_string('paymentrequired').'

'; echo '

'.get_string('cost').": $instance->currency $localisedcost".'

'; echo '

'.get_string('loginsite').'

'; diff --git a/lang/en/admin.php b/lang/en/admin.php index 2449b314589..89832944e8d 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -258,7 +258,6 @@ $string['configlanglist'] = 'Leave this blank to allow users to choose from any $string['configlangmenu'] = 'Choose whether or not you want to display the general-purpose language menu on the home page, login page etc. This does not affect the user\'s ability to set the preferred language in their own profile.'; $string['configlatinexcelexport'] = 'Choose the encoding for Excel exports.'; $string['configlocale'] = 'Choose a sitewide locale - this will override the format and language of dates for all language packs (though names of days in calendar are not affected). You need to have this locale data installed on your operating system (eg for linux en_US.UTF-8 or es_ES.UTF-8). In most cases this field should be left blank.'; -$string['configloginhttps'] = 'Turning this on will make Moodle use a secure https connection just for the login page (providing a secure login), and then afterwards revert back to the normal http URL for general speed. CAUTION: this setting REQUIRES https to be specifically enabled on the web server - if it is not then YOU COULD LOCK YOURSELF OUT OF YOUR SITE.'; $string['configloglifetime'] = 'This specifies the length of time you want to keep logs about user activity. Logs that are older than this age are automatically deleted. It is best to keep logs as long as possible, in case you need them, but if you have a very busy server and are experiencing performance problems, then you may want to lower the log lifetime. Values lower than 30 are not recommended because statistics may not work properly.'; $string['configlookahead'] = 'Days to look ahead'; $string['configmailnewline'] = 'Newline characters used in mail messages. CRLF is required according to RFC 822bis, some mail servers do automatic conversion from LF to CRLF, other mail servers do incorrect conversion from CRLF to CRCRLF, yet others reject mails with bare LF (qmail for example). Try changing this setting if you are having problems with undelivered emails or double newlines.'; @@ -680,7 +679,6 @@ $string['lockoutwindow_desc'] = 'Observation time for lockout threshold, if ther $string['log'] = 'Logs'; $string['logguests'] = 'Log guest access'; $string['logguests_help'] = 'This setting enables logging of actions by guest account and not logged in users. High profile sites may want to disable this logging for performance reasons. It is recommended to keep this setting enabled on production sites.'; -$string['loginhttps'] = 'Use HTTPS for logins'; $string['loginpageautofocus'] = 'Autofocus login page form'; $string['loginpageautofocus_help'] = 'Enabling this option improves usability of the login page, but automatically focusing fields may be considered an accessibility issue.'; $string['loglifetime'] = 'Keep logs for'; @@ -815,6 +813,7 @@ $string['order2'] = 'Second'; $string['order3'] = 'Third'; $string['order4'] = 'Fourth'; $string['outgoingmailconfig'] = 'Outgoing mail configuration'; +$string['overridetossl'] = 'HTTPS for logins has now been deprecated. This instance is now forced to SSL. To remedy this warning change your wwwroot in config.php to https://'; $string['passwordchangelogout'] = 'Log out after password change'; $string['passwordchangelogout_desc'] = 'If enabled, when a password is changed, all browser sessions are terminated, apart from the one in which the new password is specified. (This setting does not affect password changes via bulk user upload.)'; $string['passwordchangetokendeletion'] = 'Remove web service access tokens after password change'; @@ -1285,3 +1284,5 @@ $string['unoconvwarning'] = 'The version of unoconv you have installed is not su // Deprecated since Moodle 3.4 $string['moodleorghubname'] = 'Moodle.net'; $string['hubs'] = 'Hubs'; +$string['configloginhttps'] = 'Turning this on will make Moodle use a secure https connection just for the login page (providing a secure login), and then afterwards revert back to the normal http URL for general speed. CAUTION: this setting REQUIRES https to be specifically enabled on the web server - if it is not then YOU COULD LOCK YOURSELF OUT OF YOUR SITE.'; +$string['loginhttps'] = 'Use HTTPS for logins'; diff --git a/lang/en/deprecated.txt b/lang/en/deprecated.txt index 4fde1a4431f..b912982899b 100644 --- a/lang/en/deprecated.txt +++ b/lang/en/deprecated.txt @@ -157,3 +157,5 @@ quickdownloadcalendar,core_calendar ical,core_calendar privacy,core_hub privacy_help,core_hub +configloginhttps,core_admin +loginhttps,core_admin diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 02c60ea1615..50599a736eb 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2781,5 +2781,17 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2017101900.02); } + if ($oldversion < 2017102100.01) { + // We will need to force them onto ssl if loginhttps is set. + if (!empty($CFG->loginhttps)) { + set_config('overridetossl', 1); + } + // Loginhttps should no longer be set. + unset_config('loginhttps'); + + // Main savepoint reached. + upgrade_main_savepoint(true, 2017102100.01); + } + return true; } diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 6d35d855ffb..33e039816e0 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -501,10 +501,10 @@ function filter_text($text, $courseid = NULL) { } /** - * @deprecated use $PAGE->https_required() instead + * @deprecated Loginhttps is no longer supported */ function httpsrequired() { - throw new coding_exception('httpsrequired() can not be used any more use $PAGE->https_required() instead.'); + throw new coding_exception('httpsrequired() can not be used any more. Loginhttps is no longer supported.'); } /** @@ -534,9 +534,6 @@ function get_file_url($path, $options=null, $type='coursefile') { case 'rssfile': $url = $CFG->wwwroot."/rss/file.php"; break; - case 'httpscoursefile': - $url = $CFG->httpswwwroot."/file.php"; - break; case 'coursefile': default: $url = $CFG->wwwroot."/file.php"; diff --git a/lib/editor/tinymce/lib.php b/lib/editor/tinymce/lib.php index e82709296b7..a886e1ef705 100644 --- a/lib/editor/tinymce/lib.php +++ b/lib/editor/tinymce/lib.php @@ -80,9 +80,9 @@ class tinymce_texteditor extends texteditor { global $PAGE, $CFG; // Note: use full moodle_url instance to prevent standard JS loader, make sure we are using https on profile page if required. if ($CFG->debugdeveloper) { - $PAGE->requires->js(new moodle_url($CFG->httpswwwroot.'/lib/editor/tinymce/tiny_mce/'.$this->version.'/tiny_mce_src.js')); + $PAGE->requires->js(new moodle_url('/lib/editor/tinymce/tiny_mce/'.$this->version.'/tiny_mce_src.js')); } else { - $PAGE->requires->js(new moodle_url($CFG->httpswwwroot.'/lib/editor/tinymce/tiny_mce/'.$this->version.'/tiny_mce.js')); + $PAGE->requires->js(new moodle_url('/lib/editor/tinymce/tiny_mce/'.$this->version.'/tiny_mce.js')); } $PAGE->requires->js_init_call('M.editor_tinymce.init_editor', array($elementid, $this->get_init_params($elementid, $options)), true); if ($fpoptions) { @@ -127,8 +127,8 @@ class tinymce_texteditor extends texteditor { 'mode' => "exact", 'elements' => $elementid, 'relative_urls' => false, - 'document_base_url' => $CFG->httpswwwroot, - 'moodle_plugin_base' => "$CFG->httpswwwroot/lib/editor/tinymce/plugins/", + 'document_base_url' => $CFG->wwwroot, + 'moodle_plugin_base' => "$CFG->wwwroot/lib/editor/tinymce/plugins/", 'content_css' => $contentcss, 'language' => $lang, 'directionality' => $directionality, @@ -257,7 +257,7 @@ class tinymce_texteditor extends texteditor { */ public function get_tinymce_base_url() { global $CFG; - return new moodle_url("$CFG->httpswwwroot/lib/editor/tinymce/tiny_mce/$this->version/"); + return new moodle_url("/lib/editor/tinymce/tiny_mce/$this->version/"); } } diff --git a/lib/editor/tinymce/plugins/spellchecker/lib.php b/lib/editor/tinymce/plugins/spellchecker/lib.php index 330bbe44eae..230a8744a37 100644 --- a/lib/editor/tinymce/plugins/spellchecker/lib.php +++ b/lib/editor/tinymce/plugins/spellchecker/lib.php @@ -55,7 +55,7 @@ class tinymce_spellchecker extends editor_tinymce_plugin { // Add JS file, which uses default name. $this->add_js_plugin($params); - $params['spellchecker_rpc_url'] = $CFG->httpswwwroot . + $params['spellchecker_rpc_url'] = $CFG->wwwroot . '/lib/editor/tinymce/plugins/spellchecker/rpc.php'; $params['spellchecker_languages'] = $spelllanguagelist; } diff --git a/lib/editor/tinymce/tests/editor_test.php b/lib/editor/tinymce/tests/editor_test.php index 331c2d559fc..d2358db1801 100644 --- a/lib/editor/tinymce/tests/editor_test.php +++ b/lib/editor/tinymce/tests/editor_test.php @@ -74,7 +74,7 @@ class editor_tinymce_testcase extends advanced_testcase { 'xhtmlxtras,template,pagebreak', 'gecko_spellcheck' => true, 'theme_advanced_font_sizes' => "1,2,3,4,5,6,7", - 'moodle_plugin_base' => "$CFG->httpswwwroot/lib/editor/tinymce/plugins/", + 'moodle_plugin_base' => "$CFG->wwwroot/lib/editor/tinymce/plugins/", 'theme_advanced_font_sizes' => "1,2,3,4,5,6,7", 'theme_advanced_layout_manager' => "SimpleLayout", 'theme_advanced_buttons1' => 'one,two,|,three,four', diff --git a/lib/filelib.php b/lib/filelib.php index 61b5bcec52a..0e17a8111a6 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -436,7 +436,7 @@ function file_prepare_draft_area(&$draftitemid, $contextid, $component, $fileare // at this point there should not be any draftfile links yet, // because this is a new text from database that should still contain the @@pluginfile@@ links // this happens when developers forget to post process the text - $text = str_replace("\"$CFG->httpswwwroot/draftfile.php", "\"$CFG->httpswwwroot/brokenfile.php#", $text); + $text = str_replace("\"$CFG->wwwroot/draftfile.php", "\"$CFG->wwwroot/brokenfile.php#", $text); } } else { // nothing to do diff --git a/lib/filterlib.php b/lib/filterlib.php index 516f3030eeb..0a9753ba4f6 100644 --- a/lib/filterlib.php +++ b/lib/filterlib.php @@ -1527,7 +1527,7 @@ function filter_add_javascript($text) {