Commit 80708df7 authored by Penny Leach's avatar Penny Leach
Browse files

fixing bugs in get_string

parent 145541d6
...@@ -93,12 +93,11 @@ function get_string($identifier,$section) { ...@@ -93,12 +93,11 @@ function get_string($identifier,$section) {
} }
// Define the locations of language strings for this section // Define the locations of language strings for this section
$libroot = get_config('libroot');
$docroot = get_config('docroot'); $docroot = get_config('docroot');
$locations = array(); $locations = array();
if ($section == 'mahara' || $section != 'langconfig') { if ($section == 'mahara' || $section != 'langconfig') {
$locations[] = $libroot.'lang/'; $locations[] = $docroot.'lang/';
} else { } else {
$extras = array('artefacts','auth'); // more later.. $extras = array('artefacts','auth'); // more later..
foreach ($extras as $tocheck) { foreach ($extras as $tocheck) {
...@@ -113,7 +112,7 @@ function get_string($identifier,$section) { ...@@ -113,7 +112,7 @@ function get_string($identifier,$section) {
foreach ($locations as $location) { foreach ($locations as $location) {
//if local directory not found, or particular string does not exist in local direcotry //if local directory not found, or particular string does not exist in local direcotry
$langfile = $location.$lang.'/'.$section.'.php'; $langfile = $location.$lang.'/'.$section.'.php';
if (file_exists($langfile)) { if (is_readable($langfile)) {
if ($result = get_string_from_file($identifier, $langfile)) { if ($result = get_string_from_file($identifier, $langfile)) {
return format_langstring($result,$variables); return format_langstring($result,$variables);
} }
...@@ -130,10 +129,10 @@ function get_string($identifier,$section) { ...@@ -130,10 +129,10 @@ function get_string($identifier,$section) {
foreach ($locations as $location) { foreach ($locations as $location) {
$langfile = $location.$lang.'/langconfig.php'; $langfile = $location.$lang.'/langconfig.php';
if (file_exists($langfile)) { if (is_readable($langfile)) {
if ($parentlang = get_string_from_file('parentlanguage', $langfile)) { if ($parentlang = get_string_from_file('parentlanguage', $langfile)) {
$langfile = $location.$parentlang.'/'.$section.'.php'; $langfile = $location.$parentlang.'/'.$section.'.php';
if (file_exists($langfile)) { if (is_readable($langfile)) {
if ($result = get_string_from_file($identifier, $langfile)) { if ($result = get_string_from_file($identifier, $langfile)) {
return format_langstring($result,$variables); return format_langstring($result,$variables);
} }
...@@ -146,7 +145,7 @@ function get_string($identifier,$section) { ...@@ -146,7 +145,7 @@ function get_string($identifier,$section) {
foreach ($locations as $location) { foreach ($locations as $location) {
//if local_en not found, or string not found in local_en //if local_en not found, or string not found in local_en
$langfile = $location.'en.utf8/'.$module.'.php'; $langfile = $location.'en.utf8/'.$module.'.php';
if (file_exists($langfile)) { if (is_readable($langfile)) {
if ($result = get_string_from_file($identifier, $langfile)) { if ($result = get_string_from_file($identifier, $langfile)) {
return format_langstring($result,$variables); return format_langstring($result,$variables);
} }
......
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