WIP: updating to match uguu #1

Draft
Soper wants to merge 51 commits from gitbot:master into master
3 changed files with 21 additions and 6 deletions
Showing only changes of commit fb13a2a304 - Show all commits

View File

@ -3,7 +3,7 @@
"allowErrors": false
},
"dest": "dist",
"pkgVersion": "1.5.0",
"pkgVersion": "1.5.1",
"banners": [
"banners/malware_scans.swig",
"banners/donations.swig"

View File

@ -1,6 +1,6 @@
{
"name": "uguu",
"version": "1.5.0",
"version": "1.5.1",
"description": "Kawaii file host",
"homepage": "https://uguu.se/",
"repository": {

View File

@ -119,19 +119,34 @@ class Upload
];
}
public static function getIP()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
self::$IP = $_SERVER['HTTP_CLIENT_IP'];
}
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
self::$IP = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
if (!isset(self::$IP)) {
self::$IP = $_SERVER['REMOTE_ADDR'];
}
}
public static function fileInfo()
{
if (isset($_FILES['files'])) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
self::$FILE_MIME = finfo_file($finfo, self::$TEMP_FILE);
$extension = explode('.', self::$FILE_NAME, 2);
self::$FILE_EXTENSION = $extension['1'];
finfo_close($finfo);
$extension = explode('.', self::$FILE_NAME);
self::$FILE_EXTENSION = $extension[count($extension)-2].'.'.$extension[count($extension)-1];
if (Settings::$LOG_IP) {
self::$IP = $_SERVER['REMOTE_ADDR'];
self::getIP();
} else {
self::$IP = '0';
self::$IP = null;
}
}
}