Skip to content

Commit

Permalink
MDL-12561: Regression fix: banish insecure items warning in IE7 in HT…
Browse files Browse the repository at this point in the history
…TPS sites.

blank.html now loaded with a https: URL in sites/pages using SSL.


Author: Jonathan Harker <jonathan@catalyst.net.nz>
  • Loading branch information
jonathanharker committed Jun 9, 2009
1 parent f9fad87 commit b5ebbaa
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
8 changes: 6 additions & 2 deletions lib/editor/htmlarea/coursefiles.php
Expand Up @@ -25,7 +25,6 @@
$text = optional_param('text', '', PARAM_RAW); $text = optional_param('text', '', PARAM_RAW);
$confirm = optional_param('confirm', 0, PARAM_BOOL); $confirm = optional_param('confirm', 0, PARAM_BOOL);



if (! $course = get_record("course", "id", $id) ) { if (! $course = get_record("course", "id", $id) ) {
error("That's an invalid course id"); error("That's an invalid course id");
} }
Expand All @@ -40,6 +39,11 @@ function html_footer() {
function html_header($course, $wdir, $formfield=""){ function html_header($course, $wdir, $formfield=""){


global $CFG; 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/';
}


?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
Expand Down Expand Up @@ -142,7 +146,7 @@ function reset_value() {


var prev = window.parent.ipreview; var prev = window.parent.ipreview;
if(prev != null) { if(prev != null) {
prev.location.replace('<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/blank.html'); prev.location.replace('<?php echo $url ?>blank.html');
} }
var uploader = window.parent.document.forms['uploader']; var uploader = window.parent.document.forms['uploader'];
if(uploader != null) { if(uploader != null) {
Expand Down
6 changes: 2 additions & 4 deletions lib/editor/htmlarea/htmlarea.php
Expand Up @@ -29,9 +29,7 @@
$lang = "en"; $lang = "en";
} }


if ($httpsrequired) { if ($httpsrequired or (!empty($_SERVER['HTTPS']) and $_SERVER['HTTPS'] != 'off')) {
// 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
$url = preg_replace('|https?://[^/]+|', '', $CFG->wwwroot).'/lib/editor/htmlarea/'; $url = preg_replace('|https?://[^/]+|', '', $CFG->wwwroot).'/lib/editor/htmlarea/';
} else { } else {
$url = $CFG->wwwroot.'/lib/editor/htmlarea/'; $url = $CFG->wwwroot.'/lib/editor/htmlarea/';
Expand Down Expand Up @@ -721,7 +719,7 @@ function createButton(txt) {
// create the IFRAME // create the IFRAME
var iframe = document.createElement("iframe"); var iframe = document.createElement("iframe");


iframe.src = "<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/blank.html"; iframe.src = "<?php echo $url ?>blank.html";


iframe.className = "iframe"; iframe.className = "iframe";


Expand Down
12 changes: 9 additions & 3 deletions lib/editor/htmlarea/popups/insert_image.php
Expand Up @@ -11,6 +11,12 @@


$upload_max_filesize = get_max_upload_file_size($CFG->maxbytes); $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/';
}

?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Expand Down Expand Up @@ -90,9 +96,9 @@ function onPreview() {
img.src = url; img.src = url;
var win = null; var win = null;
if (!document.all) { if (!document.all) {
win = window.open("<?php echo $CFG->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("<?php echo $url ?>blank.html", "ha_imgpreview", "toolbar=no,menubar=no,personalbar=no,innerWidth=100,innerHeight=100,scrollbars=no,resizable=yes");
} else { } else {
win = window.open("<?php echo $CFG->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("<?php echo $url ?>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; preview_window = win;
var doc = win.document; var doc = win.document;
Expand Down Expand Up @@ -269,7 +275,7 @@ function submit_form(dothis) {
?> ?>
</td> </td>
<td width="45%" valign="top"><?php print_string("preview","editor");?>:<br /> <td width="45%" valign="top"><?php print_string("preview","editor");?>:<br />
<iframe id="ipreview" name="ipreview" src="<?php echo $CFG->wwwroot ?>/lib/editor/htmlarea/blank.html" style="width: 100%; height: 200px;"></iframe> <iframe id="ipreview" name="ipreview" src="<?php echo $url ?>blank.html" style="width: 100%; height: 200px;"></iframe>
</td> </td>
</tr> </tr>
</table> </table>
Expand Down
11 changes: 9 additions & 2 deletions lib/editor/htmlarea/popups/insert_image_std.php
Expand Up @@ -5,6 +5,13 @@


require_course_login($id); require_course_login($id);
@header('Content-Type: text/html; charset=utf-8'); @header('Content-Type: text/html; charset=utf-8');

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/';
}

?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Expand Down Expand Up @@ -82,9 +89,9 @@ function onPreview() {
img.src = url; img.src = url;
var win = null; var win = null;
if (!document.all) { if (!document.all) {
win = window.open("<?php echo $CFG->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("<?php echo $url ?>blank.html", "ha_imgpreview", "toolbar=no,menubar=no,personalbar=no,innerWidth=100,innerHeight=100,scrollbars=no,resizable=yes");
} else { } else {
win = window.open("<?php echo $CFG->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("<?php echo $url ?>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; preview_window = win;
var doc = win.document; var doc = win.document;
Expand Down

0 comments on commit b5ebbaa

Please sign in to comment.