pereorga / minimalist-web-notepad

Minimalist Web Notepad
https://notes.orga.cat
1.13k stars 282 forks source link

php: Remove sanitizeString function #24

Closed pereorga closed 6 years ago

pereorga commented 6 years ago
pereorga commented 6 years ago

@qex what do you think?

qex commented 6 years ago

This is hard to do, you need to change the logic of sanitizeString($_GET['f']) !== $_GET['f'].

that can be done, and will make code a little harder to read I think.

qex commented 6 years ago

Oh my mistake, I didn't notice this is a PR so I didn't see your code ...

you made the point, it is a clever move!

what if change if ( isset( $_GET['f'] ) ... line into

if ( isset($_GET['f']) && preg_match('/^[a-z0-9]+$/i', $_GET['f'] ) ) {

then you can just put !strlen() section into else, no need to pre-define an empty $name.

pereorga commented 6 years ago

That makes sense!

qex commented 6 years ago

You can remove the two new branch auto-generate by this PR make the project clean.

pereorga commented 6 years ago

Thanks again!