]>
Commit | Line | Data |
---|---|---|
d8c46ff7 GJ |
1 | <?php |
2 | ||
3 | /** | |
4 | * User configurable settings for Uguu. | |
5 | */ | |
6 | ||
7 | /* | |
8 | * PDO connection socket | |
9 | * | |
10 | * Database connection to use for communication. Currently, MySQL is the only | |
11 | * DSN prefix supported. | |
12 | * | |
13 | * @see http://php.net/manual/en/ref.pdo-mysql.connection.php PHP manual for | |
14 | * PDO_MYSQL DSN. | |
8fa0750d | 15 | * @param string UGUU_DB_CONN DSN:host|unix_socket=hostname|path;dbname=database |
d8c46ff7 GJ |
16 | */ |
17 | define('UGUU_DB_CONN', 'sqlite:/path/to/db/uguu.sq3'); | |
18 | ||
19 | /* | |
20 | * PDO database login credentials | |
21 | */ | |
22 | ||
8fa0750d | 23 | /* @param string UGUU_DB_NAME Database username */ |
d8c46ff7 | 24 | define('UGUU_DB_USER', 'NULL'); |
8fa0750d | 25 | /* @param string UGUU_DB_PASS Database password */ |
d8c46ff7 GJ |
26 | define('UGUU_DB_PASS', 'NULL'); |
27 | ||
5e56fb98 GJ |
28 | /** |
29 | * @param boolean Log IP of uploads | |
30 | */ | |
a24bf794 | 31 | define('LOG_IP', false); |
d9744300 | 32 | |
5e56fb98 GJ |
33 | /** |
34 | * @param boolean anti-dupe | |
35 | */ | |
a24bf794 | 36 | define('ANTI_DUPE', false); |
8fa0750d | 37 | |
d8c46ff7 GJ |
38 | /* |
39 | * File system location where to store uploaded files | |
40 | * | |
41 | * @param string Path to directory with trailing delimiter | |
42 | */ | |
43 | define('UGUU_FILES_ROOT', '/path/to/file/'); | |
44 | ||
45 | /* | |
46 | * Maximum number of iterations while generating a new filename | |
47 | * | |
e36e72e5 | 48 | * Uguu uses an algorithm to generate random filenames. Sometimes a file may |
d8c46ff7 GJ |
49 | * exist under a randomly generated filename, so we count tries and keep trying. |
50 | * If this value is exceeded, we give up trying to generate a new filename. | |
51 | * | |
8fa0750d | 52 | * @param int UGUU_FILES_RETRIES Number of attempts to retry |
d8c46ff7 GJ |
53 | */ |
54 | define('UGUU_FILES_RETRIES', 15); | |
55 | ||
56 | /* | |
57 | * The length of generated filename (without file extension) | |
58 | * | |
8fa0750d | 59 | * @param int UGUU_FILES_LENGTH Number of random alphabetical ASCII characters |
d8c46ff7 GJ |
60 | * to use |
61 | */ | |
62 | define('UGUU_FILES_LENGTH', 8); | |
63 | ||
64 | /* | |
65 | * URI to prepend to links for uploaded files | |
66 | * | |
8fa0750d | 67 | * @param string UGUU_URL URI with trailing delimiter |
d8c46ff7 | 68 | */ |
db13e9c4 | 69 | define('UGUU_URL', 'https://url.to.subdomain.where.files.will.be.served.com/'); |
d8c46ff7 GJ |
70 | |
71 | /* | |
72 | * URI for filename generation | |
73 | * | |
74 | * @param string characters to be used in generateName() | |
75 | */ | |
76 | define('ID_CHARSET', 'abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ'); | |
77 | ||
78 | /* | |
79 | * Filtered mime types | |
d8c46ff7 | 80 | */ |
ef50e752 GJ |
81 | define('CONFIG_BLOCKED_EXTENSIONS', serialize(['exe', 'scr', 'com', 'vbs', 'bat', 'cmd', 'htm', 'html', 'jar', 'msi', 'apk', 'phtml', 'svg'])); |
82 | define('CONFIG_BLOCKED_MIME', serialize(['application/msword', 'text/html', 'application/x-dosexec', 'application/java', 'application/java-archive', 'application/x-executable', 'application/x-mach-binary', 'image/svg+xml'])); | |
d8c46ff7 GJ |
83 | |
84 | /** | |
5e56fb98 GJ |
85 | * Whitelist or blacklist mode |
86 | * @param boolean blacklist (false) | whitelist (true) | |
d8c46ff7 | 87 | */ |
5e56fb98 GJ |
88 | define('CONFIG_FILTER_MODE', false); |
89 | ||
d8c46ff7 GJ |
90 | /** |
91 | * Double dot file extensions. | |
92 | * | |
e36e72e5 | 93 | * Uguu keeps the last file extension for the uploaded file. In other words, an |
d8c46ff7 GJ |
94 | * uploaded file with `.tar.gz` extension will be given a random filename which |
95 | * ends in `.gz` unless configured here to ignore discards for `.tar.gz`. | |
96 | * | |
97 | * @param string[] $doubledots Array of double dot file extensions strings | |
98 | * without the first prefixing dot | |
99 | */ | |
100 | $doubledots = array_map('strrev', [ | |
101 | 'tar.gz', | |
102 | 'tar.bz', | |
103 | 'tar.bz2', | |
104 | 'tar.xz', | |
105 | 'user.js', | |
106 | ]); |