Split up the looooooooooooooong page into separate files, to make editing

a little easier!
This commit is contained in:
moodler 2003-10-08 05:44:56 +00:00
parent 8aed17838e
commit 094640f170

View file

@ -3,6 +3,7 @@
require_once("../config.php");
optional_variable($mode, "");
optional_variable($currentfile, "moodle.php");
require_login();
@ -65,7 +66,7 @@
}
foreach ($stringfiles as $key => $file) {
if ($file == "README" or $file == "help" or $file == "docs" or $file == "fonts") {
if (substr($file, -4) != ".php") {
unset($stringfiles[$key]);
}
}
@ -135,54 +136,61 @@
} else if ($mode == "compare") {
if (isset($_POST['file'])){ // Save a file
if (isset($_POST['currentfile'])){ // Save a file
$newstrings = $_POST;
$file = $newstrings['file'];
unset($newstrings['file']);
if (lang_save_file($langdir, $file, $newstrings)) {
notify(get_string("changessaved")." ($langdir/$file)");
unset($newstrings['currentfile']);
if (lang_save_file($langdir, $currentfile, $newstrings)) {
notify(get_string("changessaved")." ($langdir/$currentfile)", "green");
} else {
error("Could not save the file '$file'!", "lang.php?mode=compare");
error("Could not save the file '$currentfile'!", "lang.php?mode=compare&currentfile=$currentfile");
}
}
print_heading($strcomparelanguage);
echo "<center>";
helpbutton("langedit",$strcomparelanguage);
echo "</center>";
print_heading_with_help($strcomparelanguage, "langedit");
print_simple_box_start("center", "80%");
echo '<center><font size="2">';
foreach ($stringfiles as $file) {
if ($file == $currentfile) {
echo "<b>$file</b> &nbsp; ";
} else {
echo "<a href=\"lang.php?mode=compare&currentfile=$file\">$file</a> &nbsp; ";
}
}
echo '</font></center>';
print_simple_box_end();
print_heading("$file", "LEFT", 4);
if (!file_exists("$langdir/$file")) {
if (!touch("$langdir/$file")) {
echo "<p><font color=red>".get_string("filemissing", "", "$langdir/$file")."</font></p>";
print_heading("$currentfile", "LEFT", 4);
if (!file_exists("$langdir/$currentfile")) {
if (!touch("$langdir/$currentfile")) {
echo "<p><font color=red>".get_string("filemissing", "", "$langdir/$currentfile")."</font></p>";
continue;
}
}
error_reporting(0);
if ($f = fopen("$langdir/$file","r+")) {
if ($f = fopen("$langdir/$currentfile","r+")) {
$editable = true;
fclose($f);
} else {
$editable = false;
echo "<p><font size=1>".get_string("makeeditable", "", "$langdir/$file")."</font></p>";
echo "<p><font size=1>".get_string("makeeditable", "", "$langdir/$currentfile")."</font></p>";
}
error_reporting(7);
unset($string);
include("$enlangdir/$file");
include("$enlangdir/$currentfile");
$enstring = $string;
ksort($enstring);
unset($string);
include("$langdir/$file");
include("$langdir/$currentfile");
if ($editable) {
echo "<form name=\"$file\" action=\"lang.php\" method=\"post\">";
echo "<form name=\"$currentfile\" action=\"lang.php\" method=\"post\">";
}
echo "<table width=\"100%\" cellpadding=2 cellspacing=3 border=0>";
foreach ($enstring as $key => $envalue) {
@ -231,17 +239,14 @@
}
}
if ($editable) {
echo "<tr><td colspan=2>&nbsp;<td>";
echo " <input type=\"hidden\" name=\"file\" value=\"$file\">";
echo "<tr><td colspan=2>&nbsp;<td><br />";
echo " <input type=\"hidden\" name=\"currentfile\" value=\"$currentfile\">";
echo " <input type=\"hidden\" name=\"mode\" value=\"compare\">";
echo " <input type=\"submit\" name=\"update\" value=\"".get_string("savechanges").": $file\">";
echo " <input type=\"submit\" name=\"update\" value=\"".get_string("savechanges").": $currentfile\">";
echo "</td></tr>";
}
echo "</table>";
echo "</form>";
}
print_continue("lang.php");
}