Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixes MDL-9248 and two other untracked bugs.

* MDL-9248 - lang.php now keeps <, >,   and other HTML entities
* There was an XHTML compliance error with redundant </form></div> tags in non-editable mode
* There was an bug with ORPHANed strings in local language pack
  • Loading branch information...
commit c711a66af2cb638c75c9d17ed6137521921819a1 1 parent 4abc657
mudrd8mz authored

Showing 1 changed file with 10 additions and 5 deletions. Show diff stats Hide diff stats

  1. +10 5 admin/lang.php
15 admin/lang.php
@@ -468,8 +468,10 @@
468 468 echo '</td></tr>';
469 469 }
470 470 echo '</table>';
471   - echo '</div>';
472   - echo '</form>';
  471 + if ($editable) {
  472 + echo '</div>';
  473 + echo '</form>';
  474 + }
473 475
474 476 } else {
475 477 // no $currentfile specified
@@ -526,10 +528,12 @@ function lang_save_file($path, $file, $strings, $local, $packstrings) {
526 528 $value = lang_fix_value_before_save($value);
527 529 if ($id == "string" and $value != ""){
528 530 if ((!$local) || (lang_fix_value_from_file($packstrings[$stringname]) <> lang_fix_value_from_file($value))) {
  531 + // Either we are saving the master language pack
  532 + // or we are saving local language pack and the strings differ.
529 533 fwrite($f,"\$string['$stringname'] = '$value';\n");
530   - if (LANG_KEEP_ORPHANS && isset($orphans[$stringname])) {
531   - unset($orphans[$stringname]);
532   - }
  534 + }
  535 + if (LANG_KEEP_ORPHANS && isset($orphans[$stringname])) {
  536 + unset($orphans[$stringname]);
533 537 }
534 538 }
535 539 }
@@ -560,6 +564,7 @@ function lang_fix_value_from_file($value='') {
560 564 $value = trim($value); // Delete leading/trailing white space
561 565 $value = str_replace("\\","",$value); // Delete all slashes
562 566 $value = str_replace("%%","%",$value);
  567 + $value = str_replace("&","&amp;",$value); // Fixes MDL-9248
563 568 $value = str_replace("<","&lt;",$value);
564 569 $value = str_replace(">","&gt;",$value);
565 570 $value = str_replace('"',"&quot;",$value);

0 comments on commit c711a66

Please sign in to comment.
Something went wrong with that request. Please try again.