diff --git a/lib/editor/htmlarea/coursefiles.php b/lib/editor/htmlarea/coursefiles.php index 2a7d6982b77..19a40583716 100644 --- a/lib/editor/htmlarea/coursefiles.php +++ b/lib/editor/htmlarea/coursefiles.php @@ -25,7 +25,6 @@ $text = optional_param('text', '', PARAM_RAW); $confirm = optional_param('confirm', 0, PARAM_BOOL); - if (! $course = get_record("course", "id", $id) ) { error("That's an invalid course id"); } @@ -40,6 +39,11 @@ function html_header($course, $wdir, $formfield=""){ global $CFG; + if (!empty($_SERVER['HTTPS']) and $_SERVER['HTTPS'] != 'off') { + $url = preg_replace('|https?://[^/]+|', '', $CFG->wwwroot).'/lib/editor/htmlarea/'; + } else { + $url = $CFG->wwwroot.'/lib/editor/htmlarea/'; + } ?> wwwroot ?>/lib/editor/htmlarea/blank.html'); + prev.location.replace('blank.html'); } var uploader = window.parent.document.forms['uploader']; if(uploader != null) { diff --git a/lib/editor/htmlarea/htmlarea.php b/lib/editor/htmlarea/htmlarea.php index fee6d1081fe..65e067b215d 100644 --- a/lib/editor/htmlarea/htmlarea.php +++ b/lib/editor/htmlarea/htmlarea.php @@ -29,9 +29,7 @@ $lang = "en"; } - if ($httpsrequired) { - // this is an ugly hack to allow partial operation of editor on pages that require https when loginhttps enabled - // please note that some popups still show nonsecurre items and fullscreen may not function properly in IE + if ($httpsrequired or (!empty($_SERVER['HTTPS']) and $_SERVER['HTTPS'] != 'off')) { $url = preg_replace('|https?://[^/]+|', '', $CFG->wwwroot).'/lib/editor/htmlarea/'; } else { $url = $CFG->wwwroot.'/lib/editor/htmlarea/'; @@ -721,7 +719,7 @@ HTMLArea.prototype.generate = function () { // create the IFRAME var iframe = document.createElement("iframe"); - iframe.src = "wwwroot ?>/lib/editor/htmlarea/blank.html"; + iframe.src = "blank.html"; iframe.className = "iframe"; diff --git a/lib/editor/htmlarea/popups/insert_image.php b/lib/editor/htmlarea/popups/insert_image.php index d68bec588b2..36a436aad0c 100644 --- a/lib/editor/htmlarea/popups/insert_image.php +++ b/lib/editor/htmlarea/popups/insert_image.php @@ -11,6 +11,12 @@ $upload_max_filesize = get_max_upload_file_size($CFG->maxbytes); + if ($httpsrequired or (!empty($_SERVER['HTTPS']) and $_SERVER['HTTPS'] != 'off')) { + $url = preg_replace('|https?://[^/]+|', '', $CFG->wwwroot).'/lib/editor/htmlarea/'; + } else { + $url = $CFG->wwwroot.'/lib/editor/htmlarea/'; + } + ?> @@ -90,9 +96,9 @@ function onPreview() { img.src = url; var win = null; if (!document.all) { - win = window.open("wwwroot ?>/lib/editor/htmlarea/blank.html", "ha_imgpreview", "toolbar=no,menubar=no,personalbar=no,innerWidth=100,innerHeight=100,scrollbars=no,resizable=yes"); + win = window.open("blank.html", "ha_imgpreview", "toolbar=no,menubar=no,personalbar=no,innerWidth=100,innerHeight=100,scrollbars=no,resizable=yes"); } else { - win = window.open("wwwroot ?>/lib/editor/htmlarea/blank.html", "ha_imgpreview", "channelmode=no,directories=no,height=100,width=100,location=no,menubar=no,resizable=yes,scrollbars=no,toolbar=no"); + win = window.open("blank.html", "ha_imgpreview", "channelmode=no,directories=no,height=100,width=100,location=no,menubar=no,resizable=yes,scrollbars=no,toolbar=no"); } preview_window = win; var doc = win.document; @@ -269,7 +275,7 @@ form { margin-bottom: 0px; margin-top: 0px; } ?>