]> git.mjollnir.org Git - moodle.git/commitdiff
Merged fixes from MOODLE_18_STABLE (from 1.88.2.3 to 1.88.2.4)
authormudrd8mz <mudrd8mz>
Sat, 7 Apr 2007 18:38:04 +0000 (18:38 +0000)
committermudrd8mz <mudrd8mz>
Sat, 7 Apr 2007 18:38:04 +0000 (18:38 +0000)
admin/lang.php

index d361fefe181bc2b6fa6e0639a5c384e8b9b04551..ad7f353db5e6b3479ba8a44a73c2582942bc0874 100644 (file)
                 echo '</td></tr>';
             }
             echo '</table>';
-            echo '</div>'; 
-            echo '</form>'; 
+            if ($editable) {
+                echo '</div>'; 
+                echo '</form>'; 
+            }
 
         } else {
             // no $currentfile specified
@@ -526,10 +528,12 @@ function lang_save_file($path, $file, $strings, $local, $packstrings) {
         $value = lang_fix_value_before_save($value);
         if ($id == "string" and $value != ""){
             if ((!$local) || (lang_fix_value_from_file($packstrings[$stringname]) <> lang_fix_value_from_file($value))) {
+                // Either we are saving the master language pack
+                // or we are saving local language pack and the strings differ.
                 fwrite($f,"\$string['$stringname'] = '$value';\n");
-                if (LANG_KEEP_ORPHANS && isset($orphans[$stringname])) {
-                    unset($orphans[$stringname]);
-                }
+            }
+            if (LANG_KEEP_ORPHANS && isset($orphans[$stringname])) {
+                unset($orphans[$stringname]);
             }
         }
     }
@@ -560,6 +564,7 @@ function lang_fix_value_from_file($value='') {
     $value = trim($value);                             // Delete leading/trailing white space
     $value = str_replace("\\","",$value);              // Delete all slashes
     $value = str_replace("%%","%",$value);
+    $value = str_replace("&","&amp;",$value);          // Fixes MDL-9248
     $value = str_replace("<","&lt;",$value);
     $value = str_replace(">","&gt;",$value);
     $value = str_replace('"',"&quot;",$value);