fixed bug that made edited posts reappear (in the first form) after bumping

main
fuzzykitten 2025-04-13 04:15:44 -04:00
parent a0df126e3e
commit 51a9e8e961
1 changed files with 24 additions and 17 deletions

View File

@ -103,27 +103,31 @@ function bump_message($db, $org_id, $sub, $settings)
} }
} }
$statement = $db->prepare("SELECT text, global_id, text_id, timestamp, $statement = $db->prepare("SELECT post_id, text, global_id, text_id,
name, tripcode, original timestamp, name, tripcode, original,
edit_message, move_message
FROM threads FROM threads
WHERE post_id = '$org_id' WHERE original = '$org_id'
AND org_id = '$org_id' AND shadow = 'no'
AND sub = '$sub'"); AND sub = '$sub'");
$result = $statement->execute(); $result = $statement->execute();
while ($row = $result->fetchArray(SQLITE3_NUM)) { while ($row = $result->fetchArray(SQLITE3_NUM)) {
$text = "{$row[0]}"; $post_id = "{$row[0]}";
$global_id = "{$row[1]}"; $text = "{$row[1]}";
$text_id = "{$row[2]}"; $global_id = "{$row[2]}";
$timestamp = "{$row[3]}"; $text_id = "{$row[3]}";
$name = "{$row[4]}"; $timestamp = "{$row[4]}";
$tripcode = "{$row[5]}"; $name = "{$row[5]}";
$original = "{$row[6]}"; $tripcode = "{$row[6]}";
$original = "{$row[7]}";
$edit_message = "{$row[8]}";
$move_message = "{$row[9]}";
} }
$statement = $db->prepare("DELETE FROM threads $statement = $db->prepare("DELETE FROM threads
WHERE post_id = '$org_id' WHERE original = '$org_id'
AND org_id = '$org_id' AND shadow = 'no'
AND sub = '$sub'"); AND sub = '$sub'");
$result = $statement->execute(); $result = $statement->execute();
@ -131,13 +135,16 @@ function bump_message($db, $org_id, $sub, $settings)
org_id, shadow, org_id, shadow,
global_id, text_id, global_id, text_id,
timestamp, name, tripcode, timestamp, name, tripcode,
original) original,
VALUES ('$org_id', '$sub', ?, '$org_id', edit_message,
move_message)
VALUES ('$post_id', '$sub', ?, '$org_id',
'no', '$global_id', '$text_id', 'no', '$global_id', '$text_id',
'$timestamp', '$name', '$tripcode', '$timestamp', '$name', '$tripcode',
'$original')"); '$original', ?, ?)");
$statement->bindParam(1, $text); $statement->bindParam(1, $text);
$statement->bindParam(2, $edit_message);
$statement->bindParam(3, $move_message);
$statement->execute(); $statement->execute();
} }