diff options
| author | Eliot Whalan <ewhal@pantsu.cat> | 2016-06-20 02:01:10 +0200 |
|---|---|---|
| committer | Eliot Whalan <ewhal@pantsu.cat> | 2016-06-20 02:01:10 +0200 |
| commit | bba43b12a16784352dbb0bf63acdef0f0c169945 (patch) | |
| tree | 521686f0beed6cde47ace65f317e4a9c1e4b455b | |
| parent | 4decebe30f04fb42d6f0182b5584067a5ae28f44 (diff) | |
Add configurable filename charset option
| -rw-r--r-- | php/includes/settings.inc.php | 8 | ||||
| -rw-r--r-- | php/upload.php | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/php/includes/settings.inc.php b/php/includes/settings.inc.php index f8c78cb..cc33f7b 100644 --- a/php/includes/settings.inc.php +++ b/php/includes/settings.inc.php @@ -82,6 +82,14 @@ define('POMF_FILES_LENGTH', 6); define('POMF_URL', 'https://i.pantsu.cat/'); /** + * URI for filename generation + * + * @param string characters to be used in generateName() + */ +define('ID_CHARSET', 'abcdefghijklmnopqrstuvwxyz'); + + +/** * Blocked mime types * @param string[] $FILTER_MIME blocked mime types */ diff --git a/php/upload.php b/php/upload.php index 118552e..6f764f5 100644 --- a/php/upload.php +++ b/php/upload.php @@ -42,7 +42,7 @@ function generateName($file) 500); // HTTP status code "500 Internal Server Error" } - $chars = range('a', 'z'); + $chars = ID_CHARSET; $name = ''; for ($i = 0; $i < $length; ++$i) { $name .= $chars[array_rand($chars)]; |
