changed way to calculate global_id, changed way to get next post_id to integrate text (hostnames)

main
fuzzykitten 2025-07-02 11:15:46 -04:00
parent 7631092175
commit 3ccb85125e
1 changed files with 9 additions and 4 deletions

View File

@ -364,10 +364,13 @@ function get_new_post_id($db, $sub)
while ($row = $result->fetchArray(SQLITE3_NUM)) {
$largest = "{$row[0]}";
}
$largest = filter($largest, 'num', 10);
// more than 10 digits are not necessary for a post_id
$largest++;
// we increase the largest number by one to get the new post_id
return $largest;
}
@ -450,7 +453,8 @@ function make_edit($db, $sub, $post_id, $ip, $settings)
$text = strip_tags($_POST['edit_text']);
$text_id = hash('sha512', $text);
$global_id = hash('sha512', $sub . $new_post_id . $org_id . $text);
$global_id = hash('sha512', $sub . $new_post_id .
$settings['site_name'] . $text);
$edit_message = 'edited by user, click "edit" to see the history';
$statement = $db->prepare("INSERT INTO threads(post_id, sub, text,
@ -519,7 +523,8 @@ function make_post($db, $sub, $settings, $text, $org_id)
quit($db, "<h1>Post $org_id on sub $sub does not exist.</h1>");
}
$global_id = hash('sha512', $sub . $post_id . $org_id . $text);
$global_id = hash('sha512', $sub . $post_id .
$settings['site_name'] . $text);
$text_id = hash('sha512', $text);
if ( ( $settings['enable_timestamps'] == TRUE ) &&