bugfixes in import_overboard and move_message

main
fuzzykitten 2025-08-02 17:03:36 -04:00
parent 413c8da4e1
commit 8c1b28a8d3
1 changed files with 16 additions and 11 deletions

View File

@ -710,7 +710,7 @@ function import_overboard($db, $settings)
// not more than 10 digits needed for the number
$text = strip_tags($post['text']);
$sub = filter($post['sub'], 'alnum', $settings['max_name_sub'];
$sub = filter($post['sub'], 'alnum', $settings['max_name_sub']);
$org_id = filter($post['org_id'], 'email', 50);
// org_id does not need more than 50 digits
$shadow = filter($post['shadow'], 'alpha', 3);
@ -722,8 +722,10 @@ function import_overboard($db, $settings)
if (!empty($post['replied_to'])) {
$replied_to = $post['replied_to'];
} elseif ( $post_id == $org_id ) {
$replied_to = '';
} else {
$replied_to = $post_id;
$replied_to = $org_id;
}
if (!empty($post['timestamp'])) {
@ -775,18 +777,19 @@ function import_overboard($db, $settings)
shadow, global_id, text_id,
timestamp, name, tripcode,
original, move_message,
edit_message)
edit_message, replied_to)
VALUES (?, '$post_number',
'$sub', ?,
'$org_id', '$shadow', '$global_id',
'$text_id', '$timestamp',
'$name', '$tripcode',
?, ?, ?)");
?, ?, ?, ?)");
$statement->bindParam(1, $post_id);
$statement->bindParam(2, $text);
$statement->bindParam(3, $post_id);
$statement->bindParam(4, $move_message);
$statement->bindParam(5, $edit_message);
$statement->bindParam(6, $replied_to);
$statement->execute();
@ -881,7 +884,7 @@ function move_post($db, $settings, $delete_array, $sub, $target_sub, $name)
$statement = $db->prepare("SELECT post_id, org_id, text, name,
timestamp, tripcode, move_message,
edit_message
edit_message, original
FROM threads
WHERE org_id = '$post_id'
AND post_id != '$post_id'
@ -920,7 +923,8 @@ function move_post($db, $settings, $delete_array, $sub, $target_sub, $name)
$statement = $db->prepare("UPDATE threads
SET move_message = '$new_move',
edit_message = '$edit_message',
original = '$new_id'
original = '$new_reply_id',
replied_to = '$new_id'
WHERE post_id = '$new_reply_id'
AND sub = '$target_sub'");
$result = $statement->execute();
@ -930,7 +934,7 @@ function move_post($db, $settings, $delete_array, $sub, $target_sub, $name)
$statement = $db->prepare("UPDATE threads
SET name = '$name',
tripcode = '$tripcode'
WHERE post_id = '$new_id'
WHERE post_id = '$new_reply_id'
AND sub = '$target_sub'");
$result = $statement->execute();
}
@ -939,7 +943,7 @@ function move_post($db, $settings, $delete_array, $sub, $target_sub, $name)
$new_move = "system message: post "
. "$post_id from sub \"$sub\" was moved "
. "to sub \"$target_sub\"";
$new_id = make_post($db, $target_sub, $settings, $text, '');
$new_reply_id = make_post($db, $target_sub, $settings, $text, '');
$delete_message = "message $post_id from sub $sub moved"
. " to $target_sub";
log_event($db, $settings, "del", $delete_message, '');
@ -955,8 +959,9 @@ function move_post($db, $settings, $delete_array, $sub, $target_sub, $name)
$statement = $db->prepare("UPDATE threads
SET move_message = '$new_move',
edit_message = '$edit_message',
original = '$new_id'
WHERE post_id = '$new_id'
original = '$new_reply_id',
replied_to = ''
WHERE post_id = '$new_reply_id'
AND sub = '$target_sub'");
$result = $statement->execute();
@ -965,7 +970,7 @@ function move_post($db, $settings, $delete_array, $sub, $target_sub, $name)
$statement = $db->prepare("UPDATE threads
SET name = '$name',
tripcode = '$tripcode'
WHERE post_id = '$new_id'
WHERE post_id = '$new_reply_id'
AND sub = '$target_sub'");
$result = $statement->execute();
}