MDL-21694 fixed regression caused by moving langs to tinymce editor plugin

This commit is contained in:
Petr Skoda 2010-04-11 14:54:50 +00:00
parent df973cf57d
commit 1453bf7767

View file

@ -32,10 +32,9 @@ require_once('../../../../config.php');
$lang = optional_param('elanguage', 'en', PARAM_SAFEDIR); $lang = optional_param('elanguage', 'en', PARAM_SAFEDIR);
$theme = optional_param('etheme', 'advanced', 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 //ok
} else if (file_exists($CFG->dataroot.'/lang/'.$lang) or } else if (file_exists($CFG->langotherroot .'/'. $lang)) {
file_exists($CFG->dirroot .'/lang/'.$lang)) {
//$lang = $lang; //$lang = $lang;
} else { } else {
$lang = 'en'; $lang = 'en';
@ -43,7 +42,7 @@ if (file_exists($CFG->dataroot .'/lang/'. $lang) or file_exists($CFG->dirroot .'
// load english defaults // load english defaults
$string = array(); $string = array();
foreach (get_langpack_locations('en') as $location) { foreach (get_langpack_en_locations() as $location) {
if (!file_exists($location)) { if (!file_exists($location)) {
continue; continue;
} }
@ -99,13 +98,22 @@ echo $output;
/// ======= Functions ================= /// ======= 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) { function get_langpack_locations($lang) {
global $CFG; global $CFG;
$result = array(); $result = array();
$result[] = "$CFG->dirroot/lang/$lang/editor_tinymce.php"; $result[] = "$CFG->langotherroot/$lang/editor_tinymce.php";
$result[] = "$CFG->dataroot/lang/$lang/editor_tinymce.php"; $result[] = "$CFG->langlocalroot/{$lang}_local/editor_tinymce.php";
$result[] = "$CFG->dataroot/lang/{$lang}_local/editor_tinymce.php";
return $result; return $result;
} }