]>
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 | ||
8fa0750d | 28 | /** Log IP of uploads */ |
d9744300 GJ |
29 | define('LOG_IP', 'false'); |
30 | ||
31 | /** Dont upload a file already in the DB */ | |
32 | define('ANTI_DUPE', 'false'); | |
8fa0750d | 33 | |
d8c46ff7 GJ |
34 | /* |
35 | * File system location where to store uploaded files | |
36 | * | |
37 | * @param string Path to directory with trailing delimiter | |
38 | */ | |
39 | define('UGUU_FILES_ROOT', '/path/to/file/'); | |
40 | ||
41 | /* | |
42 | * Maximum number of iterations while generating a new filename | |
43 | * | |
e36e72e5 | 44 | * Uguu uses an algorithm to generate random filenames. Sometimes a file may |
d8c46ff7 GJ |
45 | * exist under a randomly generated filename, so we count tries and keep trying. |
46 | * If this value is exceeded, we give up trying to generate a new filename. | |
47 | * | |
8fa0750d | 48 | * @param int UGUU_FILES_RETRIES Number of attempts to retry |
d8c46ff7 GJ |
49 | */ |
50 | define('UGUU_FILES_RETRIES', 15); | |
51 | ||
52 | /* | |
53 | * The length of generated filename (without file extension) | |
54 | * | |
8fa0750d | 55 | * @param int UGUU_FILES_LENGTH Number of random alphabetical ASCII characters |
d8c46ff7 GJ |
56 | * to use |
57 | */ | |
58 | define('UGUU_FILES_LENGTH', 8); | |
59 | ||
60 | /* | |
61 | * URI to prepend to links for uploaded files | |
62 | * | |
8fa0750d | 63 | * @param string UGUU_URL URI with trailing delimiter |
d8c46ff7 | 64 | */ |
db13e9c4 | 65 | define('UGUU_URL', 'https://url.to.subdomain.where.files.will.be.served.com/'); |
d8c46ff7 GJ |
66 | |
67 | /* | |
68 | * URI for filename generation | |
69 | * | |
70 | * @param string characters to be used in generateName() | |
71 | */ | |
72 | define('ID_CHARSET', 'abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ'); | |
73 | ||
74 | /* | |
75 | * Filtered mime types | |
d8c46ff7 | 76 | */ |
ef50e752 GJ |
77 | define('CONFIG_BLOCKED_EXTENSIONS', serialize(['exe', 'scr', 'com', 'vbs', 'bat', 'cmd', 'htm', 'html', 'jar', 'msi', 'apk', 'phtml', 'svg'])); |
78 | 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 |
79 | |
80 | /** | |
81 | * Filter mode: whitelist (true) or blacklist (false). | |
82 | * | |
83 | * @param bool $FILTER_MODE mime type filter mode | |
84 | */ | |
85 | $FILTER_MODE = false; | |
86 | /** | |
87 | * Double dot file extensions. | |
88 | * | |
e36e72e5 | 89 | * Uguu keeps the last file extension for the uploaded file. In other words, an |
d8c46ff7 GJ |
90 | * uploaded file with `.tar.gz` extension will be given a random filename which |
91 | * ends in `.gz` unless configured here to ignore discards for `.tar.gz`. | |
92 | * | |
93 | * @param string[] $doubledots Array of double dot file extensions strings | |
94 | * without the first prefixing dot | |
95 | */ | |
96 | $doubledots = array_map('strrev', [ | |
97 | 'tar.gz', | |
98 | 'tar.bz', | |
99 | 'tar.bz2', | |
100 | 'tar.xz', | |
101 | 'user.js', | |
102 | ]); |