MDL-22015 fixed more string_manager encapsulation issues
authorPetr Skoda <skodak@moodle.org>
Wed, 14 Apr 2010 14:38:33 +0000 (14:38 +0000)
committerPetr Skoda <skodak@moodle.org>
Wed, 14 Apr 2010 14:38:33 +0000 (14:38 +0000)
admin/blocks.php
admin/modules.php
lib/setup.php

index 44b35d0..b2f2a21 100644 (file)
@@ -51,7 +51,7 @@
             print_error('blockdoesnotexist', 'error');
         }
 
             print_error('blockdoesnotexist', 'error');
         }
 
-        if (file_exists("$CFG->dirroot/blocks/$block->name/lang/en/block_$block->name.php")) {
+        if (get_string_manager()->string_exists('pluginname', "block_$block->name")) {
             $strblockname = get_string('pluginname', "block_$block->name");
         } else {
             $strblockname = $block->name;
             $strblockname = get_string('pluginname', "block_$block->name");
         } else {
             $strblockname = $block->name;
index 2a3c8f2..d95c5ec 100644 (file)
@@ -74,8 +74,8 @@
         echo $OUTPUT->header();
         echo $OUTPUT->heading($stractivities);
 
         echo $OUTPUT->header();
         echo $OUTPUT->heading($stractivities);
 
-        if (file_exists("$CFG->dirroot/mod/$delete/lang/en/$delete.php")) {
-            $strmodulename = get_string("modulename", "$delete");
+        if (get_string_manager()->string_exists('modulename', $delete)) {
+            $strmodulename = get_string('modulename', $delete);
         } else {
             $strmodulename = $delete;
         }
         } else {
             $strmodulename = $delete;
         }
index 7f62cd3..b6571dd 100644 (file)
@@ -582,7 +582,7 @@ if (!isset($CFG->theme)) {
 // majority of cases), use the stored locale specified by admin.
 // note: do not accept lang parameter from POST
 if (isset($_GET['lang']) and ($lang = optional_param('lang', '', PARAM_SAFEDIR))) {
 // majority of cases), use the stored locale specified by admin.
 // note: do not accept lang parameter from POST
 if (isset($_GET['lang']) and ($lang = optional_param('lang', '', PARAM_SAFEDIR))) {
-    if (file_exists($CFG->langotherroot.'/'.$lang) or file_exists($CFG->dirroot.'/lang/'.$lang)) {
+    if (get_string_manager()->translation_exists($lang, false)) {
         $SESSION->lang = $lang;
     }
 }
         $SESSION->lang = $lang;
     }
 }