summaryrefslogtreecommitdiff
path: root/php
diff options
context:
space:
mode:
authorEliot Whalan <ewhal@pantsu.cat>2016-06-20 04:52:12 +0200
committerEliot Whalan <ewhal@pantsu.cat>2016-06-20 04:52:12 +0200
commit4bffe638dabf29660a8cd411ce24137f441c7c42 (patch)
treef5b789e6d685ce65e5ed5b1c1a5fbbccea398706 /php
parenta8f7a435d2f4f064f9937d7c41f5654236f002d1 (diff)
parent3d38c13d8d977d420bfbca5ef8e642ea5e1102e9 (diff)
Merge branch 'id-charset'
Diffstat (limited to 'php')
-rw-r--r--php/includes/settings.inc.php8
-rw-r--r--php/upload.php4
2 files changed, 10 insertions, 2 deletions
diff --git a/php/includes/settings.inc.php b/php/includes/settings.inc.php
index 0695981..19a3987 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 6ee85ad..9b58ba4 100644
--- a/php/upload.php
+++ b/php/upload.php
@@ -42,10 +42,10 @@ 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)];
+ $name .= $chars[mt_rand(0, strlen($chars))];
}
// Add the extension to the file name