From 1453bf776792f93a473e6efcbe2693197571dddd Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sun, 11 Apr 2010 14:54:50 +0000 Subject: [PATCH] MDL-21694 fixed regression caused by moving langs to tinymce editor plugin --- lib/editor/tinymce/extra/strings.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/editor/tinymce/extra/strings.php b/lib/editor/tinymce/extra/strings.php index 9c0cf359655..845b9a2c442 100644 --- a/lib/editor/tinymce/extra/strings.php +++ b/lib/editor/tinymce/extra/strings.php @@ -32,10 +32,9 @@ require_once('../../../../config.php'); $lang = optional_param('elanguage', 'en', PARAM_SAFEDIR); $theme = optional_param('etheme', 'advanced', PARAM_SAFEDIR); -if (file_exists($CFG->dataroot .'/lang/'. $lang) or file_exists($CFG->dirroot .'/lang/'. $lang)) { +if ($lang === 'en') { //ok -} else if (file_exists($CFG->dataroot.'/lang/'.$lang) or - file_exists($CFG->dirroot .'/lang/'.$lang)) { +} else if (file_exists($CFG->langotherroot .'/'. $lang)) { //$lang = $lang; } else { $lang = 'en'; @@ -43,7 +42,7 @@ if (file_exists($CFG->dataroot .'/lang/'. $lang) or file_exists($CFG->dirroot .' // load english defaults $string = array(); -foreach (get_langpack_locations('en') as $location) { +foreach (get_langpack_en_locations() as $location) { if (!file_exists($location)) { continue; } @@ -99,13 +98,22 @@ echo $output; /// ======= Functions ================= +function get_langpack_en_locations() { + global $CFG; + + $result = array(); + $result[] = "$CFG->dirroot/lib/editor/tinymce/lang/en/editor_tinymce.php"; + $result[] = "$CFG->langlocalroot/en_local/editor_tinymce.php"; + + return $result; +} + function get_langpack_locations($lang) { global $CFG; $result = array(); - $result[] = "$CFG->dirroot/lang/$lang/editor_tinymce.php"; - $result[] = "$CFG->dataroot/lang/$lang/editor_tinymce.php"; - $result[] = "$CFG->dataroot/lang/{$lang}_local/editor_tinymce.php"; + $result[] = "$CFG->langotherroot/$lang/editor_tinymce.php"; + $result[] = "$CFG->langlocalroot/{$lang}_local/editor_tinymce.php"; return $result; } -- 2.43.0