composer.lock
docker/uguuForDocker.tar.gz
!/.php-cs-fixer.cache
+test.php
{
"name": "uguu",
- "version": "1.8.3",
+ "version": "1.8.4",
"description": "Uguu is a simple lightweight temporary file host with support for drop, paste, click and API uploading.",
"homepage": "https://uguu.se",
"repository": {
<?php
- /**
+ /*
* Uguu
*
- * @copyright Copyright (c) 2022-2023 Go Johansson (nokonoko) <neku@pomf.se>
+ * @copyright Copyright (c) 2022-2024 Go Johansson (nokonoko) <neku@pomf.se>
+ *
+ * Note that this was previously distributed under the MIT license 2015-2022.
+ *
+ * If you are a company that wants to use Uguu I urge you to contact me to
+ * solve any potential license issues rather then using pre-2022 code.
+ *
+ * A special thanks goes out to the open source community around the world
+ * for supporting and being the backbone of projects like Uguu.
+ *
+ * This project can be found at <https://github.com/nokonoko/Uguu>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
$this->DB = new PDO(
$this->CONFIG['DB_MODE'] . ':' . $this->CONFIG['DB_PATH'],
$this->CONFIG['DB_USER'],
- $this->CONFIG['DB_PASS']
+ $this->CONFIG['DB_PASS'],
);
}
}
\ No newline at end of file
<?php
- /**
+ /*
* Uguu
*
- * @copyright Copyright (c) 2022-2023 Go Johansson (nokonoko) <neku@pomf.se>
+ * @copyright Copyright (c) 2022-2024 Go Johansson (nokonoko) <neku@pomf.se>
+ *
+ * Note that this was previously distributed under the MIT license 2015-2022.
+ *
+ * If you are a company that wants to use Uguu I urge you to contact me to
+ * solve any potential license issues rather then using pre-2022 code.
+ *
+ * A special thanks goes out to the open source community around the world
+ * for supporting and being the backbone of projects like Uguu.
+ *
+ * This project can be found at <https://github.com/nokonoko/Uguu>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
<?php
- /**
+ /*
* Uguu
*
- * @copyright Copyright (c) 2022-2023 Go Johansson (nokonoko) <neku@pomf.se>
+ * @copyright Copyright (c) 2022-2024 Go Johansson (nokonoko) <neku@pomf.se>
+ *
+ * Note that this was previously distributed under the MIT license 2015-2022.
+ *
+ * If you are a company that wants to use Uguu I urge you to contact me to
+ * solve any potential license issues rather then using pre-2022 code.
+ *
+ * A special thanks goes out to the open source community around the world
+ * for supporting and being the backbone of projects like Uguu.
+ *
+ * This project can be found at <https://github.com/nokonoko/Uguu>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
return false;
}
-
}
\ No newline at end of file
<?php
- /**
+ /*
* Uguu
*
- * @copyright Copyright (c) 2022-2023 Go Johansson (nokonoko) <neku@pomf.se>
+ * @copyright Copyright (c) 2022-2024 Go Johansson (nokonoko) <neku@pomf.se>
+ *
+ * Note that this was previously distributed under the MIT license 2015-2022.
+ *
+ * If you are a company that wants to use Uguu I urge you to contact me to
+ * solve any potential license issues rather then using pre-2022 code.
+ *
+ * A special thanks goes out to the open source community around the world
+ * for supporting and being the backbone of projects like Uguu.
+ *
+ * This project can be found at <https://github.com/nokonoko/Uguu>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
<?php
- /**
+ /*
* Uguu
*
- * @copyright Copyright (c) 2022-2023 Go Johansson (nokonoko) <neku@pomf.se>
+ * @copyright Copyright (c) 2022-2024 Go Johansson (nokonoko) <neku@pomf.se>
+ *
+ * Note that this was previously distributed under the MIT license 2015-2022.
+ *
+ * If you are a company that wants to use Uguu I urge you to contact me to
+ * solve any potential license issues rather then using pre-2022 code.
+ *
+ * A special thanks goes out to the open source community around the world
+ * for supporting and being the backbone of projects like Uguu.
+ *
+ * This project can be found at <https://github.com/nokonoko/Uguu>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
<?php
- /**
+ /*
* Uguu
*
- * @copyright Copyright (c) 2022-2023 Go Johansson (nokonoko) <neku@pomf.se>
+ * @copyright Copyright (c) 2022-2024 Go Johansson (nokonoko) <neku@pomf.se>
+ * @links
+ *
+ * Note that this was previously distributed under the MIT license 2015-2022.
+ *
+ * If you are a company that wants to use Uguu I urge you to contact me to
+ * solve any potential license issues rather then using pre-2022 code.
+ *
+ * A special thanks goes out to the open source community around the world
+ * for supporting and being the backbone of projects like Uguu.
+ *
+ * This project can be found at <https://github.com/nokonoko/Uguu>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
private mixed $Connector;
/**
- * Takes an array of files, and returns an array of arrays containing the file's temporary name,
- * name, size, XXH3 hash, extension, and MIME type
+ * Resolves and processes an array of files, performing various checks and operations on each file.
+ *
+ * Check if the file is a dupe (if enabled).
+ * Generate a new name (if not a dupe).
+ * Generate hash of the file.
+ * Get the extension of the file.
+ * Get the MIME of the file.
+ * Get the size of the file.
*
- * @param $files array The files array from the $_FILES superglobal.
+ * @param array $files An array of file data. Each element should be an associative array
+ * * with the following keys:
+ * * - 'tmp_name' : The temporary name of the uploaded file.
+ * * - 'name' : The original name of the file.
+ * * - 'size' : The size of the file in bytes.
*
- * @return array An array of arrays.
+ * @return array An array containing information about each uploaded file. Each element of the array
+ * * is an associative array with the following keys:
+ * * - 'temp_name' : The temporary name of the uploaded file.
+ * * - 'name' : The processed name of the file after checking for length and removing tags.
+ * * - 'size' : The size of the uploaded file in bytes.
+ * * - 'xxh' : The xxhash of the uploaded file.
+ * * - 'extension' : The file extension.
+ * * - 'mime' : The MIME type of the file.
+ * * - 'dupe' : Indicates if the uploaded file is a duplicate.
+ * * - 'filename' : The final filename of the uploaded file.
*/
public function reFiles(array $files):array
{
'TEMP_NAME' => $file['tmp_name'],
'NAME' => strip_tags($this->checkNameLength($file['name'])),
'SIZE' => $file['size'],
- 'XXH' => hash_file('xxh3', $file['tmp_name']),
+ 'XXH' => hash_file('xxh3', $file['tmp_name']),
'EXTENSION' => $this->fileExtension($file),
'MIME' => $this->fileMIME($file),
'DUPE' => false,
}
/**
- * Takes an array of arrays and returns an array of arrays with the keys and values swapped
- *
- * @param $files array an array of arrays
- *
- * @return array ```
- * array:2 [▼
- * 0 => array:2 [▼
- * 'TEMP_NAME' => 'example'
- * 'NAME' => 'example'
- * 'SIZE' => 'example'
- * 'XXH' => 'example'
- * 'EXTENSION' => 'example'
- * 'MIME' => 'example'
- *
- * ]
- * 1 => array:2 [▼
- * 'TEMP_NAME' => 'example'
- * 'NAME' => 'example'
- * 'SIZE' => 'example'
- * 'XXH' => 'example'
- * 'EXTENSION' => 'example'
- * 'MIME' => 'example'
- * ]
- * ]
- * ```
+ * Rearranges a multidimensional array by exchanging the keys of the first and second level.
+ *
+ * @param array $files The multidimensional array to be rearranged.
+ *
+ * @return array The rearranged array with exchanged keys of the first and second level.
*/
public function diverseArray(array $files):array
{
}
/**
- * Takes a file, checks if it's blacklisted, moves it to the file storage, and then logs it to the database
+ * Performs various checks (if enabled), insert info into database, moves file to storage
+ * location, then returns an array of file information.
+ *
+ * If a check is triggered or another error occurs it will return an error stating why
+ * the file was unable to be uploaded.
*
- * @return array An array containing the hash, name, url, and size of the file.
+ * @return array An array containing the following information:
+ * - hash : The hash value of the uploaded file
+ * - name : The name of the uploaded file
+ * - filename : The filename of the uploaded file
+ * - url : The URL of the uploaded file
+ * - size : The size of the uploaded file
+ * - dupe : Boolean indicating whether the file is a duplicate
*/
public function uploadFile():array
{
- switch (true) {
- case $this->Connector->CONFIG['RATE_LIMIT']:
- if (
- $this->Connector->checkRateLimit(
- $this->fingerPrintInfo,
- $this->Connector->CONFIG['RATE_LIMIT_TIMEOUT'],
- $this->Connector->CONFIG['RATE_LIMIT_FILES'],
- )
- ) {
- $this->Connector->response->error(
- 500,
- 'Rate limit, please wait ' . $this->Connector->CONFIG['RATE_LIMIT_TIMEOUT'] .
- ' seconds before uploading again.',
- );
- }
- // Continue
- case $this->Connector->CONFIG['BLACKLIST_DB']:
- $this->Connector->checkFileBlacklist($this->FILE_INFO['XXH']);
- // Continue
- case $this->Connector->CONFIG['FILTER_MODE'] && empty($this->FILE_INFO['EXTENSION']):
- $this->checkMimeBlacklist();
- // Continue
- case $this->Connector->CONFIG['FILTER_MODE'] && !empty($this->FILE_INFO['EXTENSION']):
- $this->checkMimeBlacklist();
- $this->checkExtensionBlacklist();
- // Continue
+ if ($this->Connector->CONFIG['RATE_LIMIT']) {
+ if (
+ $this->Connector->checkRateLimit(
+ $this->fingerPrintInfo,
+ $this->Connector->CONFIG['RATE_LIMIT_TIMEOUT'],
+ $this->Connector->CONFIG['RATE_LIMIT_FILES'],
+ )
+ ) {
+ $this->Connector->response->error(
+ 500,
+ 'Rate limit, please wait ' . $this->Connector->CONFIG['RATE_LIMIT_TIMEOUT'] .
+ ' seconds before uploading again.',
+ );
+ }
+ }
+ if ($this->Connector->CONFIG['BLACKLIST_DB']) {
+ $this->Connector->checkFileBlacklist($this->FILE_INFO['XXH']);
+ }
+ if ($this->Connector->CONFIG['FILTER_MODE'] && empty($this->FILE_INFO['EXTENSION'])) {
+ $this->checkMimeBlacklist();
+ }
+ if ($this->Connector->CONFIG['FILTER_MODE'] && !empty($this->FILE_INFO['EXTENSION'])) {
+ $this->checkMimeBlacklist();
+ $this->checkExtensionBlacklist();
+ }
+ if (!$this->Connector->CONFIG['FILTER_MODE'] && empty($this->FILE_INFO['EXTENSION'])) {
+ $this->checkMimeWhitelist();
+ }
+ if (!$this->Connector->CONFIG['FILTER_MODE'] && !empty($this->FILE_INFO['EXTENSION'])) {
+ $this->checkMimeWhitelist();
+ $this->checkExtensionWhitelist();
}
// If its not a dupe then skip checking if file can be written and
// skip inserting it into the DB.
/**
* Takes the amount of files that are being uploaded, and creates a fingerprint of the user's IP address,
- * user agent, and the amount of files being
- * uploaded
+ * user agent, and the amount of files being uploaded.
*
* @param $files_amount int The amount of files that are being uploaded.
*
}
/**
- * It takes an array of strings, and returns the last two strings joined by a dot,
- * unless the last two strings are in the array of strings in the
- * `DOUBLE_DOTS_EXTENSIONS` config variable, in which case it returns the last string
+ * Determines the double dot file extension from the given file.
*
- * @param $extension array The extension of the file.
+ * If the last two elements of the array contain double dots, those will be extracted and concatenated.
+ * If the resulting double-dot extension is present in the whitelist, it will be returned.
+ * Otherwise, the last element of the array will be returned.
*
- * @return string The last two elements of the array are joined together and returned.
+ * @param array $extension An array of strings representing file extensions.
+ *
+ * @return string The extracted extension.
*/
public function doubleDotExtension(array $extension):string
{
}
/**
- * Takes a file and returns the file extension
+ * Determines the file extension from the given file.
+ *
+ * The method checks if the file name contains a dot (.). If it does, the file name is split
+ * using the dot as the delimiter to extract the extension. The number of dots in the file name
+ * is also counted to handle special cases.
+ *
+ * If the file name contains exactly two dots, the method calls the doubleDotExtension() function
+ * to handle the special case. Otherwise, the method returns the last element of the exploded
+ * file name array, which represents the extension.
*
- * @param $file array The file you want to get the extension from.
+ * @param array $file The file array containing the name of the file.
*
- * @return string | bool The file extension of the file.
+ * @return string|bool The file extension if it exists, or false if the file name does not contain a dot.
*/
- public function fileExtension(array $file):string | bool
+ public function fileExtension(array $file):string|bool
{
- if(str_contains($file['name'], '.')){
- $extension = explode('.', $file['name']);
- $dotCount = substr_count($file['name'], '.');
- return match ($dotCount) {
- 2 => $this->doubleDotExtension($extension),
- default => end($extension)
- };
+ if (str_contains($file['name'], '.')) {
+ $extension = explode('.', $file['name']);
+ $dotCount = substr_count($file['name'], '.');
+ return match ($dotCount) {
+ 2 => $this->doubleDotExtension($extension),
+ default => end($extension)
+ };
}
return false;
}
/**
- * > Check if the file's MIME type is in the blacklist
+ * Checks if the MIME type of the uploaded file is in the blacklist.
+ *
+ * If the MIME is in the blacklist, an error is returned indicating that the filetype
+ * is not allowed.
*
*/
public function checkMimeBlacklist():void
{
- if (in_array($this->FILE_INFO['MIME'], $this->Connector->CONFIG['BLOCKED_MIME'])) {
+ if (in_array($this->FILE_INFO['MIME'], $this->Connector->CONFIG['FILTER_MIME'])) {
$this->Connector->response->error(415, 'Filetype not allowed');
}
}
/**
- * > Check if the file extension is in the blacklist
+ * Checks if the MIME type of the uploaded file is in the whitelist.
+ *
+ * If the MIME type is not in the whitelist, an error is returned indicating that the filetype
+ * is not allowed.
+ *
+ */
+ public function checkMimeWhitelist():void
+ {
+ if (!in_array($this->FILE_INFO['MIME'], $this->Connector->CONFIG['FILTER_MIME'])) {
+ $this->Connector->response->error(415, 'Filetype not allowed');
+ }
+ }
+
+ /**
+ * Checks if the extension of the uploaded file is in the blacklist.
+ *
+ * If the extension is in the blacklist, an error is returned indicating that the filetype
+ * is not allowed.
*
*/
public function checkExtensionBlacklist():void
{
- if (in_array($this->FILE_INFO['EXTENSION'], $this->Connector->CONFIG['BLOCKED_EXTENSIONS'])) {
+ if (in_array($this->FILE_INFO['EXTENSION'], $this->Connector->CONFIG['FILTER_EXTENSIONS'])) {
$this->Connector->response->error(415, 'Filetype not allowed');
}
}
+ /**
+ * Checks if the extension of the uploaded file is in the whitelist.
+ *
+ * If the extension is not in the whitelist, an error is returned indicating that the filetype
+ * is not allowed.
+ *
+ */
+ public function checkExtensionWhitelist():void
+ {
+ if (!in_array($this->FILE_INFO['EXTENSION'], $this->Connector->CONFIG['FILTER_EXTENSIONS'])) {
+ $this->Connector->response->error(415, 'Filetype not allowed');
+ }
+ }
+
+ /**
+ * Checks if the length of the given filename exceeds 250 characters.
+ *
+ * If the length of the filename exceeds 250 characters, it is truncated to a maximum of 250 characters.
+ * Otherwise, the filename remains unchanged.
+ *
+ * @param string $fileName The filename to check the length for.
+ *
+ * @return string The filename, either unchanged or truncated if its length exceeds 250 characters.
+ */
public function checkNameLength(string $fileName):string
{
if (strlen($fileName) > 250) {
}
/**
- * Generates a random string of characters, checks if it exists in the database,
- * and if it does, it generates another one
+ * Generates a unique name for a file.
+ *
+ * This method generates a random name for a file by selecting characters from the ID_CHARSET
+ * defined in the Connector's CONFIG. If an extension is provided, it appends the extension
+ * to the generated name. The method then checks if the generated name already exists in the
+ * database using the dbCheckNameExists() function. If the generated name
+ * already exists, it generates a new name until a unique one is found. If the maximum number
+ * of retries is reached, an error is returned.
*
- * @param $extension string The file extension.
+ * @param string $extension The extension of the file.
*
- * @return string A string
+ * @return string The generated unique name for the file.
*/
public function generateName(string $extension):string
{
<?php
-
-namespace Pomf\Uguu\Classes;
-use PDO;
-class expireChecker
-{
- public PDO $DB;
- public string $dbType;
- public array $CONFIG;
- public string $timeUnit;
-
- public function checkDB(): bool | array {
- if(is_int($this->CONFIG['expireTime'])) {
- $this->timeUnit = strtoupper($this->CONFIG['expireTimeUnit']);
- if(!in_array($this->timeUnit, ['SECONDS', 'MINUTES', 'HOURS', 'DAYS', 'WEEKS', 'MONTHS', 'YEARS'])){
- $this->timeUnit = "HOURS";
+ /*
+ * Uguu
+ *
+ * @copyright Copyright (c) 2022-2024 Go Johansson (nokonoko) <neku@pomf.se>
+ *
+ * Note that this was previously distributed under the MIT license 2015-2022.
+ *
+ * If you are a company that wants to use Uguu I urge you to contact me to
+ * solve any potential license issues rather then using pre-2022 code.
+ *
+ * A special thanks goes out to the open source community around the world
+ * for supporting and being the backbone of projects like Uguu.
+ *
+ * This project can be found at <https://github.com/nokonoko/Uguu>.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+ namespace Pomf\Uguu\Classes;
+
+ use PDO;
+
+ class expireChecker
+ {
+ public PDO $DB;
+ public string $dbType;
+ public array $CONFIG;
+ public string $timeUnit;
+
+ public function checkDB():bool|array
+ {
+ if (is_int($this->CONFIG['expireTime'])) {
+ $this->timeUnit = strtoupper($this->CONFIG['expireTimeUnit']);
+ if (!in_array($this->timeUnit, ['SECONDS', 'MINUTES', 'HOURS', 'DAYS', 'WEEKS', 'MONTHS', 'YEARS'])) {
+ $this->timeUnit = "HOURS";
+ }
+ $query = match ($this->dbType) {
+ 'pgsql' => 'SELECT id, filename FROM files WHERE date < EXTRACT(epoch from NOW() - INTERVAL \'' . $this->CONFIG['expireTime'] . ' ' . $this->timeUnit . '\')',
+ default => 'SELECT id, filename FROM files WHERE date <= strftime(\'%s\', datetime(\'now\', \'-' . $this->CONFIG['expireTime'] . ' ' . $this->timeUnit . '\'));'
+ };
+ $q = $this->DB->prepare($query);
+ $q->execute();
+ $result = $q->fetchAll(PDO::FETCH_ASSOC);
+ $q->closeCursor();
+ $returnArray = [
+ 'ids' => [],
+ 'filenames' => [],
+ ];
+ foreach ($result as $array) {
+ $returnArray['ids'][] = $array['id'];
+ $returnArray['filenames'][] = $array['filename'];
+ }
+ return $returnArray;
+ } else {
+ return false;
}
+ }
+
+ public function cleanRateLimitDB():void
+ {
$query = match ($this->dbType) {
- 'pgsql' => 'SELECT id, filename FROM files WHERE date < EXTRACT(epoch from NOW() - INTERVAL \'' . $this->CONFIG['expireTime'] . ' ' . $this->timeUnit . '\')',
- default => 'SELECT id, filename FROM files WHERE date <= strftime(\'%s\', datetime(\'now\', \'-' . $this->CONFIG['expireTime'] . ' ' . $this->timeUnit . '\'));'
+ 'pgsql' => 'DELETE FROM ratelimit WHERE time < EXTRACT(epoch from NOW() - INTERVAL \'24 HOURS\')',
+ default => 'DELETE FROM ratelimit WHERE time <= strftime(\'%s\', datetime(\'now\', \'-24 HOURS\'));'
};
$q = $this->DB->prepare($query);
$q->execute();
- $result = $q->fetchAll(PDO::FETCH_ASSOC);
$q->closeCursor();
- $returnArray = [
- 'ids' => [],
- 'filenames' => []
- ];
- foreach ($result as $array){
- $returnArray['ids'][] = $array['id'];
- $returnArray['filenames'][] = $array['filename'];
- }
- return $returnArray;
- } else {
- return false;
}
- }
-
- public function cleanRateLimitDB(): void {
- $query = match ($this->dbType) {
- 'pgsql' => 'DELETE FROM ratelimit WHERE time < EXTRACT(epoch from NOW() - INTERVAL \'24 HOURS\')',
- default => 'DELETE FROM ratelimit WHERE time <= strftime(\'%s\', datetime(\'now\', \'-24 HOURS\'));'
- };
- $q = $this->DB->prepare($query);
- $q->execute();
- $q->closeCursor();
- }
- public function deleteFiles(array $filenames): void {
- foreach ($filenames as $filename) {
- unlink($this->CONFIG['FILES_ROOT'] . $filename);
+
+ public function deleteFiles(array $filenames):void
+ {
+ foreach ($filenames as $filename) {
+ unlink($this->CONFIG['FILES_ROOT'] . $filename);
+ }
}
- }
-
- public function deleteFromDB(array $ids): void {
- foreach ($ids as $id) {
- $query = match ($this->dbType) {
- 'pgsql' => 'DELETE FROM files WHERE id = (:id)',
- default => 'DELETE FROM files WHERE id = (:id)'
- };
- $q = $this->DB->prepare($query);
- $q->bindValue(':id', $id);
- $q->execute();
- $q->closeCursor();
+
+ public function deleteFromDB(array $ids):void
+ {
+ foreach ($ids as $id) {
+ $query = match ($this->dbType) {
+ 'pgsql' => 'DELETE FROM files WHERE id = (:id)',
+ default => 'DELETE FROM files WHERE id = (:id)'
+ };
+ $q = $this->DB->prepare($query);
+ $q->bindValue(':id', $id);
+ $q->execute();
+ $q->closeCursor();
+ }
}
- }
-
- /**
- * Reads the config.json file and populates the CONFIG property with the settings
- * Also assembles the PDO DB connection and registers error handlers.
- *
- */
- public function __construct()
- {
- $this->response = new Response('json');
- if (!file_exists(__DIR__ . '/../config.json')) {
- $this->response->error(500, 'Cant read settings file.');
+
+ /**
+ * Reads the config.json file and populates the CONFIG property with the settings
+ * Also assembles the PDO DB connection and registers error handlers.
+ *
+ */
+ public function __construct()
+ {
+ $this->response = new Response('json');
+ if (!file_exists(__DIR__ . '/../config.json')) {
+ $this->response->error(500, 'Cant read settings file.');
+ }
+ $this->CONFIG = json_decode(
+ file_get_contents(__DIR__ . '/../config.json'),
+ true,
+ );
+ ini_set('display_errors', 0);
+ $this->dbType = $this->CONFIG['DB_MODE'];
+ $this->DB = new PDO(
+ $this->CONFIG['DB_MODE'] . ':' . $this->CONFIG['DB_PATH'],
+ $this->CONFIG['DB_USER'],
+ $this->CONFIG['DB_PASS'],
+ );
}
- $this->CONFIG = json_decode(
- file_get_contents(__DIR__ . '/../config.json'),
- true,
- );
- ini_set('display_errors', 0);
- $this->dbType = $this->CONFIG['DB_MODE'];
- $this->DB = new PDO(
- $this->CONFIG['DB_MODE'] . ':' . $this->CONFIG['DB_PATH'],
- $this->CONFIG['DB_USER'],
- $this->CONFIG['DB_PASS']
- );
}
-}
{
"dest": "dist",
- "pkgVersion": "1.8.3",
+ "pkgVersion": "1.8.4",
"pages": [
"index.ejs",
"faq.ejs",
"min.js",
"conf.bak"
],
- "BLOCKED_EXTENSIONS": [
+ "FILTER_EXTENSIONS": [
"exe",
"scr",
"com",
"phtml",
"svg"
],
- "BLOCKED_MIME": [
+ "FILTER_MIME": [
"application/msword",
"text/html",
"application/x-dosexec",
<?php
-
-/**
- * Uguu
- *
- * @copyright Copyright (c) 2022-2023 Go Johansson (nokonoko) <neku@pomf.se>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-require_once __DIR__ . '/vendor/autoload.php';
-
-use Pomf\Uguu\Classes\expireChecker;
-
-$check = new expireChecker();
-$dbResult = $check->checkDB();
-$check->cleanRateLimitDB();
-if(empty($dbResult['ids'])){
- echo "No file(s) expired, nothing to do.";
-} else {
- $check->deleteFromDB($dbResult['ids']);
- $check->deleteFiles($dbResult['filenames']);
-}
\ No newline at end of file
+ /*
+ * Uguu
+ *
+ * @copyright Copyright (c) 2022-2024 Go Johansson (nokonoko) <neku@pomf.se>
+ *
+ * Note that this was previously distributed under the MIT license 2015-2022.
+ *
+ * If you are a company that wants to use Uguu I urge you to contact me to
+ * solve any potential license issues rather then using pre-2022 code.
+ *
+ * A special thanks goes out to the open source community around the world
+ * for supporting and being the backbone of projects like Uguu.
+ *
+ * This project can be found at <https://github.com/nokonoko/Uguu>.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+ require_once __DIR__ . '/vendor/autoload.php';
+
+ use Pomf\Uguu\Classes\expireChecker;
+
+ $check = new expireChecker();
+ $dbResult = $check->checkDB();
+ $check->cleanRateLimitDB();
+ if (empty($dbResult['ids'])) {
+ echo "No file(s) expired, nothing to do.";
+ } else {
+ $check->deleteFromDB($dbResult['ids']);
+ $check->deleteFiles($dbResult['filenames']);
+ }
\ No newline at end of file
<?php
-
- /**
+ /*
* Uguu
*
- * @copyright Copyright (c) 2022-2023 Go Johansson (nokonoko) <neku@pomf.se>
+ * @copyright Copyright (c) 2022-2024 Go Johansson (nokonoko) <neku@pomf.se>
+ *
+ * Note that this was previously distributed under the MIT license 2015-2022.
+ *
+ * If you are a company that wants to use Uguu I urge you to contact me to
+ * solve any potential license issues rather then using pre-2022 code.
+ *
+ * A special thanks goes out to the open source community around the world
+ * for supporting and being the backbone of projects like Uguu.
+ *
+ * This project can be found at <https://github.com/nokonoko/Uguu>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+
require_once __DIR__ . '/../vendor/autoload.php';
use Pomf\Uguu\Classes\GrillLoader;
<?php
-
- /**
+ /*
* Uguu
*
- * @copyright Copyright (c) 2022-2023 Go Johansson (nokonoko) <neku@pomf.se>
+ * @copyright Copyright (c) 2022-2024 Go Johansson (nokonoko) <neku@pomf.se>
+ *
+ * Note that this was previously distributed under the MIT license 2015-2022.
+ *
+ * If you are a company that wants to use Uguu I urge you to contact me to
+ * solve any potential license issues rather then using pre-2022 code.
+ *
+ * A special thanks goes out to the open source community around the world
+ * for supporting and being the backbone of projects like Uguu.
+ *
+ * This project can be found at <https://github.com/nokonoko/Uguu>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+
require_once __DIR__ . '/../vendor/autoload.php';
use Pomf\Uguu\Classes\Upload;
$upload->send($res);
}
}
+
$resType = (isset($_GET['output']) and !empty($_GET['output'])) ? strtolower(preg_replace('/[^a-zA-Z]/', '', $_GET['output'])) : 'json';
$response = new Response($resType);
if (!isset($_FILES['files']) or empty($_FILES['files'])) {