mirror of
https://github.com/nokonoko/Uguu.git
synced 2024-01-06 13:35:15 +00:00
d8c46ff78a
This is the code that uguu.se is running, based off Pomf.
101 lines
3.1 KiB
PHP
101 lines
3.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* User configurable settings for Uguu.
|
|
*/
|
|
|
|
/*
|
|
* PDO connection socket
|
|
*
|
|
* Database connection to use for communication. Currently, MySQL is the only
|
|
* DSN prefix supported.
|
|
*
|
|
* @see http://php.net/manual/en/ref.pdo-mysql.connection.php PHP manual for
|
|
* PDO_MYSQL DSN.
|
|
* @param string POMF_DB_CONN DSN:host|unix_socket=hostname|path;dbname=database
|
|
*/
|
|
define('UGUU_DB_CONN', 'sqlite:/path/to/db/uguu.sq3');
|
|
|
|
/*
|
|
* PDO database login credentials
|
|
*/
|
|
|
|
/* @param string POMF_DB_NAME Database username */
|
|
define('UGUU_DB_USER', 'NULL');
|
|
/* @param string POMF_DB_PASS Database password */
|
|
define('UGUU_DB_PASS', 'NULL');
|
|
|
|
/*
|
|
* File system location where to store uploaded files
|
|
*
|
|
* @param string Path to directory with trailing delimiter
|
|
*/
|
|
define('UGUU_FILES_ROOT', '/path/to/file/');
|
|
|
|
/*
|
|
* Maximum number of iterations while generating a new filename
|
|
*
|
|
* Pomf uses an algorithm to generate random filenames. Sometimes a file may
|
|
* exist under a randomly generated filename, so we count tries and keep trying.
|
|
* If this value is exceeded, we give up trying to generate a new filename.
|
|
*
|
|
* @param int POMF_FILES_RETRIES Number of attempts to retry
|
|
*/
|
|
define('UGUU_FILES_RETRIES', 15);
|
|
|
|
/*
|
|
* The length of generated filename (without file extension)
|
|
*
|
|
* @param int POMF_FILES_LENGTH Number of random alphabetical ASCII characters
|
|
* to use
|
|
*/
|
|
define('UGUU_FILES_LENGTH', 8);
|
|
|
|
/*
|
|
* URI to prepend to links for uploaded files
|
|
*
|
|
* @param string POMF_URL URI with trailing delimiter
|
|
*/
|
|
define('UGUU_URL', 'https://a.uguu.se/');
|
|
|
|
/*
|
|
* URI for filename generation
|
|
*
|
|
* @param string characters to be used in generateName()
|
|
*/
|
|
define('ID_CHARSET', 'abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ');
|
|
|
|
/*
|
|
* Filtered mime types
|
|
* @param string[] $FILTER_MIME allowed/blocked mime types
|
|
*/
|
|
//$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");
|
|
//$FILTER_EXT = array("exe", "scr", "com", "vbs", "bat", "cmd", "htm", "html", "zip", "jar", "msi", "apk", "pdf");
|
|
|
|
define('CONFIG_BLOCKED_EXTENSIONS', serialize(['exe', 'scr', 'com', 'vbs', 'bat', 'cmd', 'htm', 'html', 'jar', 'msi', 'apk', 'phtml']));
|
|
define('CONFIG_BLOCKED_MIME', serialize(['application/msword', 'text/html', 'application/x-dosexec', 'application/java', 'application/java-archive', 'application/x-executable', 'application/x-mach-binary']));
|
|
|
|
/**
|
|
* Filter mode: whitelist (true) or blacklist (false).
|
|
*
|
|
* @param bool $FILTER_MODE mime type filter mode
|
|
*/
|
|
$FILTER_MODE = false;
|
|
/**
|
|
* Double dot file extensions.
|
|
*
|
|
* Pomf keeps the last file extension for the uploaded file. In other words, an
|
|
* uploaded file with `.tar.gz` extension will be given a random filename which
|
|
* ends in `.gz` unless configured here to ignore discards for `.tar.gz`.
|
|
*
|
|
* @param string[] $doubledots Array of double dot file extensions strings
|
|
* without the first prefixing dot
|
|
*/
|
|
$doubledots = array_map('strrev', [
|
|
'tar.gz',
|
|
'tar.bz',
|
|
'tar.bz2',
|
|
'tar.xz',
|
|
'user.js',
|
|
]);
|