From: moodler Date: Wed, 10 Sep 2003 12:37:59 +0000 (+0000) Subject: Try to create missing string files if possible (thanks Gustav) X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=11863e8663ad08bfe498884f8a4e6039eaf7d504;p=moodle.git Try to create missing string files if possible (thanks Gustav) --- diff --git a/admin/lang.php b/admin/lang.php index 59eb83a8e4..7b019bb9f3 100644 --- a/admin/lang.php +++ b/admin/lang.php @@ -75,8 +75,10 @@ foreach ($stringfiles as $file) { if (!file_exists("$langdir/$file")) { - echo "

".get_string("filemissing", "", "$langdir/$file")."

"; - continue; + if (!touch("$langdir/$file")) { + echo "

".get_string("filemissing", "", "$langdir/$file")."

"; + continue; + } } unset($string); @@ -108,7 +110,7 @@ foreach ($files as $filekey => $file) { // check all the help files. if (!file_exists("$langdir/help/$file")) { - echo "

".get_string("filemissing", "", "$langdir/help/$file")."

"; + echo "

".get_string("filemissing", "", "$langdir/help/$file")."

"; $somethingfound = true; continue; } @@ -145,17 +147,19 @@ } print_heading($strcomparelanguage); - echo "
"; + echo "
"; helpbutton("langedit",$strcomparelanguage); - echo "
"; + echo "
"; foreach ($stringfiles as $file) { print_heading("$file", "LEFT", 4); if (!file_exists("$langdir/$file")) { - echo "

".get_string("filemissing", "", "$langdir/$file")."

"; - continue; + if (!touch("$langdir/$file")) { + echo "

".get_string("filemissing", "", "$langdir/$file")."

"; + continue; + } } error_reporting(0); @@ -164,7 +168,7 @@ fclose($f); } else { $editable = false; - echo "

".get_string("makeeditable", "", "$langdir/$file")."

"; + echo "

".get_string("makeeditable", "", "$langdir/$file")."

"; } error_reporting(7); @@ -178,17 +182,17 @@ include("$langdir/$file"); if ($editable) { - echo "
"; + echo ""; } - echo ""; + echo "
"; foreach ($enstring as $key => $envalue) { $envalue = nl2br(htmlspecialchars($envalue)); $envalue = preg_replace('/(\$a\-\>[a-zA-Z0-9]*|\$a)/', '$0', $envalue); // Make variables bold. $envalue = str_replace("%%","%",$envalue); - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; $value = $string[$key]; $value = str_replace("\r","",$value); // Bad character caused by Windows @@ -204,7 +208,7 @@ $cellcolour = $value ? $THEME->cellcontent: $THEME->highlight; if ($editable) { - echo ""; + echo ""; } echo ""; } else { - echo ""; + echo ""; } } if ($editable) { - echo ""; + echo ""; } - echo "
cellheading\" NOWRAP VALIGN=TOP>$keycellheading\" VALIGN=TOP>$envalue
cellheading\" nowrap valign=top>$keycellheading\" valign=top>$envalue"; + echo ""; if (isset($string[$key])) { $valuelen = strlen($value); } else { @@ -213,28 +217,28 @@ $cols=50; if (strstr($value, "\r") or strstr($value, "\n") or $valuelen > $cols) { $rows = ceil($valuelen / $cols); - echo ""; + echo ""; } else { if ($valuelen) { $cols = $valuelen + 2; } - echo "$value$value
 "; - echo " "; - echo " "; - echo " "; - echo "
 "; + echo " "; + echo " "; + echo " "; + echo "
"; - echo "
"; + echo ""; + echo ""; } print_continue("lang.php");