Commit 7593c372 authored by David Mudrak's avatar David Mudrak Committed by Nigel McNie
Browse files

look for helpfiles in proper locations

Allow language packs being installed outside the docroot. Fallback to
the English help file if the localized one is not found.
(cherry picked from commit 13e02387)
parent 582f5220
......@@ -208,7 +208,7 @@ function get_helpfile($plugintype, $pluginname, $form, $element, $page=null, $se
function get_helpfile_location($plugintype, $pluginname, $form, $element, $page=null, $section=null) {
$location = get_config('docroot') ;
$location = get_language_root();
$file = 'help/';
if ($plugintype != 'core') {
......@@ -256,12 +256,12 @@ function get_helpfile_location($plugintype, $pluginname, $form, $element, $page=
// if it's not found, try the parent language if there is one...
if (empty($data) && empty($trieden)) {
$langfile = get_config('docroot') . 'lang/' . $lang . '/langconfig.php';
$langfile = get_language_root($lang) . 'lang/' . $lang . '/langconfig.php';
if ($parentlang = get_string_from_file('parentlanguage', $langfile)) {
if ($parentlang == 'en.utf8') {
$trieden = true;
}
$langfile = get_config('docroot') . 'lang/' . $parentlang . '/' . $file;
$langfile = get_language_root($parentlang) . 'lang/' . $parentlang . '/' . $file;
if (is_readable($langfile)) {
return $langfile;
}
......@@ -270,11 +270,12 @@ function get_helpfile_location($plugintype, $pluginname, $form, $element, $page=
// if it's STILL not found, and we haven't already tried english ...
if (empty($data) && empty($trieden)) {
$langfile = $location . 'en.utf8/' . $file;
$langfile = get_language_root('en.utf8') . 'lang/en.utf8/' . $file;
if (is_readable($langfile)) {
return $langfile;
}
}
log_debug("Helpfile not found! $file", true, false);
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment