いつからこのエラーが出るようになったのか,多分,2009/06/10頃のバージョンからだと思います.
添付ファイルのように$httpsrequiredがUndefinedであるというエラーが出ます.
lib/editor/htmlarea/popups/insert_image.phpに,以下のコードが追加されています.
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/';
}
この頭のところの$httpsrequiredですね.これが宣言されていない.その結果,$urlが空になってしまい,その後の処理に不具合が発生します.
自分自身は画像の挿入をまったく使わないので気付きませんでした.
対策ですが...moodlelib.php中のfunction httpsrequired()で,グローバル変数$HTTPSPAGEREQUIREDを設定しています.一つはこれを利用する手ですね.lib/weblib.php,filelib.php, moodlelib.php, ajax/ajaxlib.php, mod/forum/lib.php中の関数ではこのグローバル変数を利用している箇所がいつくかあります.
それに対して,lib/editor/htmlarea中,特にhtmlarea.phpでは,
$httpsrequired = optional_param('httpsrequired', 0, PARAM_BOOL); //flag indicating editor on page with required https
でパラメータとして受け取り,
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/';
}
このように処理に利用しています.って,このコード,今回問題になっているinsert_image.phpと全く同じですね.うーん,
// 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
あまつえ同じ2009/06/10のバージョンで上記警告のコメントを削除している.このパラメータで渡すという方法を良しとしたということでしょうか?