[Return]

Report a post

Preview
I found that link as the first result on google. Thanks for the source link. Google didn't want to give it to me!

From a quick glance it looks like anything we need is already here: the db field md5chksum already saves the image checksum, all that's left is to use this as the internal filename instead of the timestamp (or use both together, which will basically guarantee no conflict ever, to do that simply concatenate the two keys instead of using just md5chksum in the below).

The db IO code (pio stuff, for each backend) already gives you all the rows in the db for each post, so you already receive the checksum. You have to go in koko.php and find the instances of $tim $ext usages (this reconstitutes imagenames) and replace this by using $md5chksum instead of $tim everywhere this is used (including for the thumbnail that will involve just passing the $tim part to a function that resolves the name, or appending s to the name... anyway, straightforward).
The variables corresponding to the database columns are made local to the functions (in for example
https://github.com/Heyuri/kokonotsuba/blob/eb09e6777fe329bd6788ebbb0bad68e6e0fd89fe/koko.php#L1026
) through the 'extract' method that just imports symbols into the local namespace. Hence, there's no need for any extra work to access any arbitrary column.

The caveat is that unless you write a script to rename all files currently on the server to their md5 (which you can access via the db at least), you will either need to wipe or get broken files.
Post number No.63955
Board Site Discussion@Heyuri
Optional. Describe what's wrong with it.