PR for everything except the file upload:
https://github.com/splitbrain/dokuwiki/pull/1548
The file upload script should be completely changed anyway, it is old, buggy and the original is not maintained anymore (or rather, it has grown into something much bigger and different).