]>
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. | |
15 | * @param string POMF_DB_CONN DSN:host|unix_socket=hostname|path;dbname=database | |
16 | */ | |
17 | define('UGUU_DB_CONN', 'sqlite:/path/to/db/uguu.sq3'); | |
18 | ||
19 | /* | |
20 | * PDO database login credentials | |
21 | */ | |
22 | ||
23 | /* @param string POMF_DB_NAME Database username */ | |
24 | define('UGUU_DB_USER', 'NULL'); | |
25 | /* @param string POMF_DB_PASS Database password */ | |
26 | define('UGUU_DB_PASS', 'NULL'); | |
27 | ||
28 | /* | |
29 | * File system location where to store uploaded files | |
30 | * | |
31 | * @param string Path to directory with trailing delimiter | |
32 | */ | |
33 | define('UGUU_FILES_ROOT', '/path/to/file/'); | |
34 | ||
35 | /* | |
36 | * Maximum number of iterations while generating a new filename | |
37 | * | |
38 | * Pomf uses an algorithm to generate random filenames. Sometimes a file may | |
39 | * exist under a randomly generated filename, so we count tries and keep trying. | |
40 | * If this value is exceeded, we give up trying to generate a new filename. | |
41 | * | |
42 | * @param int POMF_FILES_RETRIES Number of attempts to retry | |
43 | */ | |
44 | define('UGUU_FILES_RETRIES', 15); | |
45 | ||
46 | /* | |
47 | * The length of generated filename (without file extension) | |
48 | * | |
49 | * @param int POMF_FILES_LENGTH Number of random alphabetical ASCII characters | |
50 | * to use | |
51 | */ | |
52 | define('UGUU_FILES_LENGTH', 8); | |
53 | ||
54 | /* | |
55 | * URI to prepend to links for uploaded files | |
56 | * | |
57 | * @param string POMF_URL URI with trailing delimiter | |
58 | */ | |
59 | define('UGUU_URL', 'https://a.uguu.se/'); | |
60 | ||
61 | /* | |
62 | * URI for filename generation | |
63 | * | |
64 | * @param string characters to be used in generateName() | |
65 | */ | |
66 | define('ID_CHARSET', 'abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ'); | |
67 | ||
68 | /* | |
69 | * Filtered mime types | |
70 | * @param string[] $FILTER_MIME allowed/blocked mime types | |
71 | */ | |
72 | //$FILTER_MIME = array("application/octet-stream", "application/msword", "text/html", "application/x-dosexec", "application/zip", "application/java", "application/java-archive", "application/pdf", "application/x-executable"); | |
73 | //$FILTER_EXT = array("exe", "scr", "com", "vbs", "bat", "cmd", "htm", "html", "zip", "jar", "msi", "apk", "pdf"); | |
74 | ||
75 | define('CONFIG_BLOCKED_EXTENSIONS', serialize(['exe', 'scr', 'com', 'vbs', 'bat', 'cmd', 'htm', 'html', 'jar', 'msi', 'apk', 'phtml'])); | |
76 | define('CONFIG_BLOCKED_MIME', serialize(['application/msword', 'text/html', 'application/x-dosexec', 'application/java', 'application/java-archive', 'application/x-executable', 'application/x-mach-binary'])); | |
77 | ||
78 | /** | |
79 | * Filter mode: whitelist (true) or blacklist (false). | |
80 | * | |
81 | * @param bool $FILTER_MODE mime type filter mode | |
82 | */ | |
83 | $FILTER_MODE = false; | |
84 | /** | |
85 | * Double dot file extensions. | |
86 | * | |
87 | * Pomf keeps the last file extension for the uploaded file. In other words, an | |
88 | * uploaded file with `.tar.gz` extension will be given a random filename which | |
89 | * ends in `.gz` unless configured here to ignore discards for `.tar.gz`. | |
90 | * | |
91 | * @param string[] $doubledots Array of double dot file extensions strings | |
92 | * without the first prefixing dot | |
93 | */ | |
94 | $doubledots = array_map('strrev', [ | |
95 | 'tar.gz', | |
96 | 'tar.bz', | |
97 | 'tar.bz2', | |
98 | 'tar.xz', | |
99 | 'user.js', | |
100 | ]); |