mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-04-27 06:45:39 +00:00
replacing } with \n properly
This commit is contained in:
parent
e379ae20e3
commit
e3801abaf4
@ -90,6 +90,9 @@ if ($cmd == "getTable") {
|
|||||||
|
|
||||||
// Iterate over the rows
|
// Iterate over the rows
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
|
|
||||||
|
$row['String'] = str_replace('}', ' ', $row['String']);
|
||||||
|
|
||||||
$tableMarkup .= "<tr class='row-{$row['rowid']}'>";
|
$tableMarkup .= "<tr class='row-{$row['rowid']}'>";
|
||||||
|
|
||||||
$tableMarkup .= "<td style='width: 64px;'>{$row['rowid']}</td>";
|
$tableMarkup .= "<td style='width: 64px;'>{$row['rowid']}</td>";
|
||||||
@ -120,8 +123,14 @@ if ($cmd == "getTable") {
|
|||||||
|
|
||||||
|
|
||||||
if ($cmd == "update") {
|
if ($cmd == "update") {
|
||||||
|
|
||||||
|
//ddump($_REQUEST);
|
||||||
|
|
||||||
|
$string = str_replace('\n', '}', $_REQUEST['string']);
|
||||||
|
|
||||||
|
|
||||||
$query = "UPDATE $tableName SET Key = ?, String = ? WHERE Key = ?";
|
$query = "UPDATE $tableName SET Key = ?, String = ? WHERE Key = ?";
|
||||||
PDO_Execute($query, [$_REQUEST['key'], $_REQUEST['string'], $_REQUEST['key']]);
|
PDO_Execute($query, [$_REQUEST['key'], $string, $_REQUEST['key']]);
|
||||||
|
|
||||||
// Update the corresponding row in the text file
|
// Update the corresponding row in the text file
|
||||||
$filePath = "{$_SESSION['tbl']}/$tableName.txt";
|
$filePath = "{$_SESSION['tbl']}/$tableName.txt";
|
||||||
@ -131,7 +140,7 @@ if ($cmd == "update") {
|
|||||||
$lineNumber = $_REQUEST['rowid'];
|
$lineNumber = $_REQUEST['rowid'];
|
||||||
|
|
||||||
// Update the line in the file with the new key and string values
|
// Update the line in the file with the new key and string values
|
||||||
$fileLines[$lineNumber - 1] = "{$_REQUEST['key']}\t{$_REQUEST['string']}\n";
|
$fileLines[$lineNumber - 1] = "{$_REQUEST['key']}\t{$string}\n";
|
||||||
|
|
||||||
// Save the updated content back to the text file
|
// Save the updated content back to the text file
|
||||||
file_put_contents($filePath, implode("", array_filter($fileLines)));
|
file_put_contents($filePath, implode("", array_filter($fileLines)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user