function showAddNew($lang) { iniTable(); $langFile = "lang." . $lang . ".php"; echo "<h1>{$langFile}</h1>"; echo "Your new languange file will be created from the english template! <br>"; echo "<form action='" . $_SERVER['PHP_SELF'] . "' method='post'>"; echo "<input type='hidden' name='strSource' value='lang.en.php' />"; echo "<input type='hidden' name='strDest' value='{$langFile}' /><br>"; echo "<input type='text' size='4' name='strCode' value='Code' onkeyup='return upBtn(this);'>"; echo "<input type='submit' id='Save' disabled='true' value='Create File' />"; echo "</form>"; endTable(); }
function showEdit($filename) { iniTable(); echo "<h1>" . $filename . "</h1>"; if ($filename != "lang.en.php") { echo "<h2>To prevent data losses Edit and Save only one record at a time!</h2>"; } $flines = file($filename); $isDictionary = False; echo '<table border="1" cellspacing="0">'; echo "<tr>"; echo "<th>ID</th>"; echo "<th>KEY</th>"; echo "<th>VALUE</th>"; echo "</tr>"; foreach ($flines as $line_num => $oneLine) { $oneLine = trim($oneLine); if ($isDictionary) { if ($oneLine == "}") { //End of the dictionary $isDictionary = False; } else { echo "<tr> "; echo "<td><a name='ID{$line_num}'>{$line_num}</a></td>"; if (strpos($oneLine, "=") !== false) { foreach (split("=", $oneLine) as $value) { $value = trim($value); if (substr($value, 0, 7) != "public ") { echo "<td >"; echo "<form action='" . $_SERVER['PHP_SELF'] . "#ID" . ((int) $line_num - 1) . "' method='post'>"; echo "<input type='hidden' name='intLine' value='{$line_num}' />"; echo "<input type='hidden' name='fileName' value='{$filename}' />"; echo "<input type='text' size='90' style=' border:0; font-family: Courier' name='strLine' value='" . str_replace("'", "'", $value) . "' />"; if ($filename != "lang.en.php") { echo "<input type='submit' value='Save' />"; } echo "</form>"; echo "</td >"; } else { echo "<td style='color:blue'>" . htmlspecialchars($value) . "</td>"; } } } else { if (substr($oneLine, 0, 2) == "//") { //Line Comments echo "<td colspan='2' style='color:green'>" . htmlspecialchars($oneLine) . "</td>"; } elseif ($oneLine == "") { //Blank spaces echo "<td colspan='2' > </td>"; } } echo "</tr>"; } } else { if (strpos($oneLine, "class language {") !== false) { //Begining of the dictionary $isDictionary = True; } } } echo "</table>"; echo "<br /><a href='index.php'>Back to main page</a>"; endTable(); }
$iniKey = "public \$"; $iniValue = '"";'; $strKey = $iniKey; $strValue = $iniValue; if (isset($_POST['strKey'], $_POST['strValue'])) { $strKey = str_replace("\\", "", $_POST['strKey']); $strValue = str_replace("\\", "", $_POST['strValue']); //Validate $strMessage = validate($strKey, $strValue); if ($strMessage == '') { $strMessage = doPost($strKey, $strValue); $strKey = $iniKey; $strValue = $iniValue; } } iniTable(); ?> <h1 align="center">- Select Action -</h1><br> <strong>1 - Edit Language File:</strong> <select onchange="location = 'edit.php?lang='+this.options[this.selectedIndex].value;"> <option value="">Select lang file </option> <?php foreach (getLangFiles() as $key => $value) { echo "<option value=" . $value . ">" . $value . "</option>"; } ?> </select> <br><br><br>