Changeset:
4537f79f8fe7
https://sourceforge.net/p/mrbs/hg-code/ci/4537f79f8fe725cbad6149cfa7b4cf6a0801ecd9
Author:
John Beranek <[email protected]>
Date:
Sun Oct 02 10:23:00 2016 +0100
Log message:
A few improvements to checklang.php
diffstat:
checklang.php | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diffs (78 lines):
diff -r 675911c25058 -r 4537f79f8fe7 checklang.php
--- a/checklang.php Sun Oct 02 09:46:57 2016 +0100
+++ b/checklang.php Sun Oct 02 10:23:00 2016 +0100
@@ -1,6 +1,3 @@
-<?php
- // $Id$
-?>
<html>
<head><title>Language File Checker</title></head>
<body>
@@ -24,12 +21,12 @@
if (!empty($_GET))
{
$lang = $_GET['lang'];
- $update = $_GET['update'];
+ $update = empty($_GET['update']) ? false : true;
}
else if (!empty($HTTP_GET_VARS))
{
$lang = (array)$HTTP_GET_VARS['lang'];
- $update = $HTTP_GET_VARS['update'];
+ $update = empty($HTTP_GET_VARS['update']) ? false : true;
}
@@ -116,16 +113,18 @@
while (!feof($in))
{
$line = fgets($in);
+ $token_match = "";
if (preg_match('/^\$vocab\["([^"]+)"\]/', $line, $matches))
{
// DEBUG print "<tr><td>$matches[1]</td><td>".key($ref_lines);
+ $token_match = $matches[1];
- if (!array_key_exists($matches[1], $ref_lines))
+ if (!array_key_exists($token_match, $ref_lines))
{
fwrite($out, "// REMOVED - ".$line);
continue;
}
- while (($matches[1] != key($ref_lines)) &&
+ while (($token_match != key($ref_lines)) &&
(!array_key_exists(key($ref_lines), $vocab)))
{
if (array_key_exists(key($ref_lines), $seen))
@@ -134,7 +133,7 @@
}
$seen[key($ref_lines)] = 1;
fwrite($out, current($ref_lines));
- $added[] = key($ref_lines);
+ $added[] = htmlspecialchars(key($ref_lines));
$ret = next($ref_lines);
// DEBUG print " ".key($ref_lines);
if (!$ret)
@@ -144,7 +143,7 @@
}
next($ref_lines);
}
- $seen[$matches[1]] = 1;
+ $seen[$token_match] = 1;
fwrite($out, $line);
// DEBUG print "</td></tr>\n";
}
@@ -170,11 +169,11 @@
print "No token lines added.";
unlink("$path_to_mrbs/$langs$l.new") or
print "<span style=\"color: red; font-weight: bold\">
- Failed to delete $path_to_mrbs/$langs$l.new</span>.\n";
+ Failed to delete
$path_to_mrbs/$langs".htmlspecialchars($l).".new</span>.\n";
}
}
?>
-<h2>Language: <?php echo $l ?></h2>
+<h2>Language: <?php echo htmlspecialchars($l) ?></h2>
<table border="1">
<tr>
<th>Problem</th>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits