From 78f5305c3887ab89b273bc577a78523efc183af5 Mon Sep 17 00:00:00 2001 From: SuperDev Date: Thu, 19 Jan 2023 11:46:03 -0600 Subject: [PATCH] Revert "Apply fixes from StyleCI" --- admin/captcha.php | 80 ++++++++-------- admin/check.php | 59 ++++++------ admin/dashboard/files.php | 138 ++++++++++++++------------- admin/dashboard/index.php | 116 ++++++++++++----------- admin/dashboard/main.php | 59 ++++++------ admin/dashboard/settings.php | 27 +++--- admin/index.php | 4 +- admin/protect.php | 17 ++-- api.php | 18 ++-- download.php | 64 +++++++------ error.php | 12 +-- index.php | 82 ++++++++-------- installer.php | 175 +++++++++++++++++------------------ protect.php | 95 ++++++++++--------- system/config.php | 5 +- system/core.class.php | 47 ++++------ 16 files changed, 497 insertions(+), 501 deletions(-) diff --git a/admin/captcha.php b/admin/captcha.php index 6066c42..1db6371 100644 --- a/admin/captcha.php +++ b/admin/captcha.php @@ -1,40 +1,40 @@ - \ No newline at end of file diff --git a/admin/check.php b/admin/check.php index 6aab516..2578bc5 100644 --- a/admin/check.php +++ b/admin/check.php @@ -1,40 +1,37 @@ password, // USER AND PASSWORD PULLED FROM CONFIGURATION FILE - ]; - - // (B2) CHECK & VERIFY - if (isset($users[$_POST['user']])) { - // check captcha - if ($_SESSION['captcha'] !== $_POST['captcha']) { - header('Location: ?capfail'); - exit(0); - } - // end captcha - if ($users[$_POST['user']] == $_POST['password']) { - $_SESSION['user'] = $_POST['user']; - } - } - - // (B3) FAILED LOGIN FLAG - if (!isset($_SESSION['user'])) { - $failed = true; +if (isset($_POST["user"]) && !isset($_SESSION["user"])) { + // (B1) USERS & PASSWORDS - SET YOUR OWN ! + $users = [ + email => password // USER AND PASSWORD PULLED FROM CONFIGURATION FILE + ]; + + // (B2) CHECK & VERIFY + if (isset($users[$_POST["user"]])) { + // check captcha + if ($_SESSION['captcha'] !== $_POST['captcha']) { + header("Location: ?capfail"); + exit(0); +} + // end captcha + if ($users[$_POST["user"]] == $_POST["password"]) { + $_SESSION["user"] = $_POST["user"]; } + } + + // (B3) FAILED LOGIN FLAG + if (!isset($_SESSION["user"])) { $failed = true; } } - + // (C) REDIRECT USER TO DASHBOARD IF SIGNED IN -if (isset($_SESSION['user'])) { - header('Location: dashboard'); // REDIRECT TO DASHBOARD - exit(); -} +if (isset($_SESSION["user"])) { + header("Location: dashboard"); // REDIRECT TO DASHBOARD + exit(); +} \ No newline at end of file diff --git a/admin/dashboard/files.php b/admin/dashboard/files.php index 7a6b5df..6f8bcc8 100644 --- a/admin/dashboard/files.php +++ b/admin/dashboard/files.php @@ -1,6 +1,6 @@ '; - echo ''; - echo $file; - echo ''; - echo ''; - echo 'Download'; - echo 'Delete'; - echo ''; - echo ''; - } - } - - closedir($handle); - } - } +function list_directory_files($dir) { + + if (is_dir($dir)) { + if ($handle = opendir($dir)) { + + while (($file = readdir($handle)) !== false) { + if ($file != "." && $file != ".." && $file != "Thumbs.db" && $file != "index.php") { + echo ''; + echo ''; + echo $file; + echo ''; + echo ''; + echo 'Download'; + echo 'Delete'; + echo ''; + echo ''; + + } + } + + closedir($handle); + + } + } } // download file -if (isset($_GET['path'])) { - //Read the url - $url = $_GET['path']; +if(isset($_GET['path'])) +{ +//Read the url +$url = $_GET['path']; - //Clear the cache - clearstatcache(); +//Clear the cache +clearstatcache(); - //Check the file path exists or not - if (file_exists($url)) { +//Check the file path exists or not +if(file_exists($url)) { //Define header information - header('Content-Description: File Transfer'); - header('Content-Type: application/octet-stream'); - header('Content-Disposition: attachment; filename="'.basename($url).'"'); - header('Content-Length: '.filesize($url)); - header('Pragma: public'); - - //Clear system output buffer - flush(); - - //Read the size of the file - readfile($url, true); - - //Terminate from the script - exit(); - } else { - // do nothing - } +header('Content-Description: File Transfer'); +header('Content-Type: application/octet-stream'); +header('Content-Disposition: attachment; filename="'.basename($url).'"'); +header('Content-Length: ' . filesize($url)); +header('Pragma: public'); + +//Clear system output buffer +flush(); + +//Read the size of the file +readfile($url,true); + +//Terminate from the script +die(); +} +else{ + // do nothing +} } // do nothing -if (isset($_GET['delete'], $_GET['file'])) { - $delfile = $_GET['file']; - /* - header("Location: $delfile"); - */ - if (unlink($delfile)) { - // file was successfully deleted - header('Refresh:0 url=files.php?success_msg=1'); - } else { - // there was a problem deleting the file - header('Refresh:0 url=files.php?error_msg=1'); - } + +if(isset($_GET['delete'], $_GET['file'])){ + +$delfile = $_GET['file']; +/* +header("Location: $delfile"); +*/ +If (unlink($delfile)) { + // file was successfully deleted + header("Refresh:0 url=files.php?success_msg=1"); +} else { + // there was a problem deleting the file + header("Refresh:0 url=files.php?error_msg=1"); + } +} + ?> @@ -127,22 +137,22 @@ if (isset($_GET['delete'], $_GET['file'])) { - +

- + - +

- +
diff --git a/admin/dashboard/index.php b/admin/dashboard/index.php index bbf32ca..ed3933c 100644 --- a/admin/dashboard/index.php +++ b/admin/dashboard/index.php @@ -11,71 +11,74 @@ error_reporting(E_ALL); ?> $filename) { - if ($filename != '..' && $filename != '.' && $filename != 'index.php') { - if (is_dir($dir.'/'.$filename)) { - $new_foldersize = foldersize($dir.'/'.$filename); - $count_size = $count_size + $new_foldersize; - } elseif (is_file($dir.'/'.$filename)) { - $count_size = $count_size + filesize($dir.'/'.$filename); - $count++; - } +function folderSize($dir){ +$count_size = 0; +$count = 0; +$dir_array = scandir($dir); + foreach($dir_array as $key=>$filename){ + if($filename!=".." && $filename!="." && $filename!="index.php"){ + if(is_dir($dir."/".$filename)){ + $new_foldersize = foldersize($dir."/".$filename); + $count_size = $count_size+ $new_foldersize; + }else if(is_file($dir."/".$filename)){ + $count_size = $count_size + filesize($dir."/".$filename); + $count++; } - } - - return $count_size; + } + } +return $count_size; } // size converter -function sizeFormat($bytes) -{ - $kb = 1024; - $mb = $kb * 1024; - $gb = $mb * 1024; - $tb = $gb * 1024; - - if (($bytes >= 0) && ($bytes < $kb)) { - return $bytes.' B'; - } elseif (($bytes >= $kb) && ($bytes < $mb)) { - return ceil($bytes / $kb).' KB'; - } elseif (($bytes >= $mb) && ($bytes < $gb)) { - return ceil($bytes / $mb).' MB'; - } elseif (($bytes >= $gb) && ($bytes < $tb)) { - return ceil($bytes / $gb).' GB'; - } elseif ($bytes >= $tb) { - return ceil($bytes / $tb).' TB'; - } else { - return $bytes.' B'; - } +function sizeFormat($bytes){ +$kb = 1024; +$mb = $kb * 1024; +$gb = $mb * 1024; +$tb = $gb * 1024; + +if (($bytes >= 0) && ($bytes < $kb)) { +return $bytes . ' B'; + +} elseif (($bytes >= $kb) && ($bytes < $mb)) { +return ceil($bytes / $kb) . ' KB'; + +} elseif (($bytes >= $mb) && ($bytes < $gb)) { +return ceil($bytes / $mb) . ' MB'; + +} elseif (($bytes >= $gb) && ($bytes < $tb)) { +return ceil($bytes / $gb) . ' GB'; + +} elseif ($bytes >= $tb) { +return ceil($bytes / $tb) . ' TB'; +} else { +return $bytes . ' B'; +} } -// get size of folders in a folder +// get size of folders in a folder $plugin_count = count(glob('../../plugins/*', GLOB_ONLYDIR)); // Update checker $PATCH_URL = 'https://raw.githubusercontent.com/Supernova3339/anonfiles/main/'; -$version_filename = 'latest.txt?token=GHSAT0AAAAAAB4S7HM4SZGF7VWPABQO3KRSY5FDV4Q'; // REMOVE TOKEN +$version_filename = 'latest.txt?token=GHSAT0AAAAAAB4S7HM4SZGF7VWPABQO3KRSY5FDV4Q'; # REMOVE TOKEN // Get version - $ch = curl_init($PATCH_URL.$version_filename); + $ch = curl_init($PATCH_URL . $version_filename); - curl_setopt($ch, CURLOPT_HEADER, 0); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - $str = curl_exec($ch); - curl_close($ch); + $str = curl_exec($ch); + curl_close($ch); - $server_version = str_to_version_info($str); + $server_version = str_to_version_info($str); ?> @@ -113,11 +116,11 @@ $version_filename = 'latest.txt?token=GHSAT0AAAAAAB4S7HM4SZGF7VWPABQO3KRSY5FDV4Q

- version) { - echo '

update available

'; + version){ + echo '

update available

'; } - echo $server_version; + echo $server_version; ?>

@@ -127,10 +130,11 @@ $version_filename = 'latest.txt?token=GHSAT0AAAAAAB4S7HM4SZGF7VWPABQO3KRSY5FDV4Q
- - '; - } + + '; +} + template_admin_footer(); diff --git a/admin/dashboard/main.php b/admin/dashboard/main.php index dad9c88..592f3a8 100644 --- a/admin/dashboard/main.php +++ b/admin/dashboard/main.php @@ -1,5 +1,4 @@ -if (isset($_GET['logout'])) { +if(isset($_GET['logout'])) +{ logout(); } // Logout Function --> -function logout() -{ +function logout(){ session_destroy(); - header('Location: ../'); + header("Location: ../"); exit(); } // Template admin header -function template_admin_header($title, $selected = 'dashboard', $selected_child = '') -{ +function template_admin_header($title, $selected = 'dashboard', $selected_child = '') { // Admin HTML links $admin_links = ' - Dashboard - Files - Settings + Dashboard + Files + Settings '; // Indenting the below code may cause an error - echo << @@ -59,10 +57,9 @@ function template_admin_header($title, $selected = 'dashboard', $selected_child EOT; } // Template admin footer -function template_admin_footer() -{ +function template_admin_footer() { // Indenting the below code may cause an error - echo << '; ?> - + diff --git a/error.php b/error.php index 5258d1b..506a81a 100644 --- a/error.php +++ b/error.php @@ -1,14 +1,14 @@ 'Forbidden', 404 => '404 Not Found', - 500 => 'Internal Server Error', - ]; + 500 => 'Internal Server Error' + ); $source_url = 'http'.((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 's' : '').'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; if (array_key_exists($code, $codes) && is_numeric($code)) { - exit("Error $code: {$codes[$code]}"); + die("Error $code: {$codes[$code]}"); } else { - exit('Unknown error'); + die('Unknown error'); } +?> \ No newline at end of file diff --git a/index.php b/index.php index cf8c039..8c8f1af 100644 --- a/index.php +++ b/index.php @@ -1,27 +1,30 @@ -= 0) && ($bytes < $kb)) { - return $bytes.' B'; - } elseif (($bytes >= $kb) && ($bytes < $mb)) { - return ceil($bytes / $kb).' KB'; - } elseif (($bytes >= $mb) && ($bytes < $gb)) { - return ceil($bytes / $mb).' MB'; - } elseif (($bytes >= $gb) && ($bytes < $tb)) { - return ceil($bytes / $gb).' GB'; - } elseif ($bytes >= $tb) { - return ceil($bytes / $tb).' TB'; - } else { - return $bytes.' B'; - } +if (($bytes >= 0) && ($bytes < $kb)) { +return $bytes . ' B'; + +} elseif (($bytes >= $kb) && ($bytes < $mb)) { +return ceil($bytes / $kb) . ' KB'; + +} elseif (($bytes >= $mb) && ($bytes < $gb)) { +return ceil($bytes / $mb) . ' MB'; + +} elseif (($bytes >= $gb) && ($bytes < $tb)) { +return ceil($bytes / $gb) . ' GB'; + +} elseif ($bytes >= $tb) { +return ceil($bytes / $tb) . ' TB'; +} else { +return $bytes . ' B'; +} } $maxsize = max_size; @@ -39,38 +42,39 @@ $core = new Core();
-FileTypeVerification($_FILES['fileToUpload'])) { - if ($core->FileSizeVerification($_FILES['fileToUpload'])) { - $newfilename = $core->FileNameConvertor($_FILES['fileToUpload']); - if ($core->UploadFile($_FILES['fileToUpload'], $newfilename)) { - $destination = base64_encode(file_destination.'/'.$newfilename); ?> +FileTypeVerification($_FILES["fileToUpload"])){ + if($core->FileSizeVerification($_FILES["fileToUpload"])){ + $newfilename = $core->FileNameConvertor($_FILES["fileToUpload"]); + if($core->UploadFile($_FILES["fileToUpload"], $newfilename)){ + $destination = base64_encode(file_destination.'/'.$newfilename); + ?>
Success ! Your file are available here: download.php?file=
+ }else{ + ?>
An error occured while trying to upload your file(s).
+ } + }else{ + ?>
Your file is too high/low.
+ } + }else{ + ?>
Incorrect file format.
@@ -97,7 +101,7 @@ $(document).ready(function(){ }); - + diff --git a/installer.php b/installer.php index 072a40a..9e50a3d 100644 --- a/installer.php +++ b/installer.php @@ -1,81 +1,78 @@ $v) { - if ($k == 'code') { - continue; - } - $v = in_array(strtolower($v), ['true', 'false']) || is_numeric($v) ? strtolower($v) : '\''.$v.'\''; - $contents .= 'define(\''.$k.'\','.$v.');'.PHP_EOL; - } - $contents .= '?>'; - if (!file_put_contents($config_file, $contents)) { - return false; +function install($config_file = 'system/config.php') { + $contents = ' $v) { + if ($k == 'code') continue; + $v = in_array(strtolower($v), ['true', 'false']) || is_numeric($v) ? strtolower($v) : '\'' . $v . '\''; + $contents .= 'define(\'' . $k . '\',' . $v . ');' . PHP_EOL; } - - return true; + $contents .= '?>'; + if (!file_put_contents($config_file, $contents)) { + return FALSE; + } + return TRUE; } /*Verify Purchase Code function*/ function verify($code) { - - /*If the submit form is success*/ - if (!empty($code)) { - - /*add purchase code to the API link*/ - $purchase_code = $code; - $url = 'https://dl.supers0ft.us/anonuptest/api.php?code='.$purchase_code; - $curl = curl_init($url); - - /*Set your personal token*/ - // $personal_token = "9COT6mduU2sZSMIlC09aYAQveaRdQ2H9"; - - /*Correct header for the curl extension*/ - $header = []; - $header[] = 'Authorization: Bearer '.$personal_token; - $header[] = 'User-Agent: Purchase code verification'; - $header[] = 'timeout: 20'; - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($curl, CURLOPT_HTTPHEADER, $header); - - /*Connect to the API, and get values from there*/ - $envatoCheck = curl_exec($curl); - curl_close($curl); - $envatoCheck = json_decode($envatoCheck); - - /*Variable request from the API*/ - $date = new DateTime(isset($envatoCheck->supported_until) ? $envatoCheck->supported_until : false); - $support_date = $date->format('Y-m-d H:i:s'); - $sold = new DateTime(isset($envatoCheck->sold_at) ? $envatoCheck->sold_at : false); - $sold_at = $sold->format('Y-m-d H:i:s'); - $buyer = (isset($envatoCheck->buyer) ? $envatoCheck->buyer : false); - $license = (isset($envatoCheck->license) ? $envatoCheck->license : false); - $count = (isset($envatoCheck->purchase_count) ? $envatoCheck->purchase_count : false); - $support_amount = (isset($envatoCheck->support_amount) ? $envatoCheck->support_amount : false); - $item = (isset($envatoCheck->item->previews->landscape_preview->landscape_url) ? $envatoCheck->item->previews->landscape_preview->landscape_url : false); - - /*Check for Special Characters*/ - if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬]/', $code)) { - return 'Not allowed to use special characters!'; - } - - /*Check for Empty Spaces*/ - if (!isset($code) || trim($code) == '') { - return 'You need to fill up the input area!'; - } - - /*If Purchase code exists, But Purchase ended*/ - if (isset($envatoCheck->item->name) && (date('Y-m-d H:i:s') >= $support_date)) { - return " + + /*If the submit form is success*/ + if(!empty($code)){ + + /*add purchase code to the API link*/ + $purchase_code = $code; + $url = "https://dl.supers0ft.us/anonuptest/api.php?code=".$purchase_code; + $curl = curl_init($url); + + /*Set your personal token*/ + // $personal_token = "9COT6mduU2sZSMIlC09aYAQveaRdQ2H9"; + + /*Correct header for the curl extension*/ + $header = array(); + $header[] = 'Authorization: Bearer '.$personal_token; + $header[] = 'User-Agent: Purchase code verification'; + $header[] = 'timeout: 20'; + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_HTTPHEADER,$header); + + /*Connect to the API, and get values from there*/ + $envatoCheck = curl_exec($curl); + curl_close($curl); + $envatoCheck = json_decode($envatoCheck); + + /*Variable request from the API*/ + $date = new DateTime(isset($envatoCheck->supported_until) ? $envatoCheck->supported_until : false); + $support_date = $date->format('Y-m-d H:i:s'); + $sold = new DateTime(isset($envatoCheck->sold_at) ? $envatoCheck->sold_at : false); + $sold_at = $sold->format('Y-m-d H:i:s'); + $buyer = (isset( $envatoCheck->buyer) ? $envatoCheck->buyer : false); + $license = (isset( $envatoCheck->license) ? $envatoCheck->license : false); + $count = (isset( $envatoCheck->purchase_count) ? $envatoCheck->purchase_count : false); + $support_amount = (isset( $envatoCheck->support_amount) ? $envatoCheck->support_amount : false); + $item = (isset( $envatoCheck->item->previews->landscape_preview->landscape_url ) ? $envatoCheck->item->previews->landscape_preview->landscape_url : false); + + + /*Check for Special Characters*/ + if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬]/', $code)){ + return 'Not allowed to use special characters!'; + } + + /*Check for Empty Spaces*/ + if(!isset($code) || trim($code) == ''){ + return 'You need to fill up the input area!'; + } + + /*If Purchase code exists, But Purchase ended*/ + if (isset($envatoCheck->item->name) && (date('Y-m-d H:i:s') >= $support_date)){ + return " "; - } - - /*If Purchase code exists, display client information*/ - if (isset($envatoCheck->item->name) && (date('Y-m-d H:i:s') < $support_date)) { - if (!install()) { - return '

Error!

Could not write to file! Please check permissions and try again!'; - } - - return " + } + + /*If Purchase code exists, display client information*/ + if (isset($envatoCheck->item->name) && (date('Y-m-d H:i:s') < $support_date)){ + if (!install()) { + return '

Error!

Could not write to file! Please check permissions and try again!'; + } + return "

"; - } + } - /*If Purchase Code doesn't exist, no information will be displayed*/ - if (!isset($envatoCheck->item->name)) { - return " + /*If Purchase Code doesn't exist, no information will be displayed*/ + if (!isset($envatoCheck->item->name)){ + return " "; - } - } + } + + } } if ($_POST) { if (isset($_POST['code'])) { - // Validate code - $response = verify($_POST['code']); - } else { - // No code specified - $response = '

Error!

Please enter your Envato code!

'; - } + // Validate code + $response = verify($_POST['code']); + } else { + // No code specified + $response = '

Error!

Please enter your Envato code!

'; + } } ?> @@ -427,9 +424,9 @@ if ($_POST) { } }; }); - + setStep(5); - + diff --git a/protect.php b/protect.php index 32e62b2..e4388a5 100644 --- a/protect.php +++ b/protect.php @@ -1,25 +1,24 @@ 'userpass', - 'admin' => 'adminpass', -]; +$LOGIN_INFORMATION = array( +'user' => 'userpass', +'admin' => 'adminpass' +); define('USE_USERNAME', true); define('LOGOUT_URL', 'https://dl.supers0ft.us/logout.php/'); define('TIMEOUT_MINUTES', 0); define('TIMEOUT_CHECK_ACTIVITY', true); -if (isset($_GET['help'])) { - exit('Include following code into every page you would like to protect, at the very beginning (first line):
<?php include("'.str_replace('\\', '\\\\', __FILE__).'"); ?>'); +if(isset($_GET['help'])) { +die('Include following code into every page you would like to protect, at the very beginning (first line):
<?php include("' . str_replace('\\','\\\\',__FILE__) . '"); ?>'); } $timeout = (TIMEOUT_MINUTES == 0 ? 0 : time() + TIMEOUT_MINUTES * 60); -if (isset($_GET['logout'])) { - setcookie('verify', '', $timeout, '/'); - header('Location: '.LOGOUT_URL); - exit(); +if(isset($_GET['logout'])) { +setcookie("verify", '', $timeout, '/'); +header('Location: ' . LOGOUT_URL); +exit(); } -if (!function_exists('showLoginPasswordProtect')) { - function showLoginPasswordProtect($error_msg) - { - ?> +if(!function_exists('showLoginPasswordProtect')) { +function showLoginPasswordProtect($error_msg) { +?> @@ -62,9 +61,7 @@ input { border: 1px solid black; }

Administration Panel

-


'; - } ?> +


'; ?>

@@ -73,39 +70,41 @@ input { border: 1px solid black; } $val) { - $lp = (USE_USERNAME ? $key : '').'%'.$val; - if ($_COOKIE['auth'] == md5($lp)) { - $found = true; - if (TIMEOUT_CHECK_ACTIVITY) { - setcookie('auth', md5($lp), $timeout, '/'); - } - break; - } - } - if (!$found) { - showLoginPasswordProtect(''); - } +showLoginPasswordProtect("Incorrect data."); +} +else { +setcookie("auth", md5($login.'%'.$pass), $timeout, '/'); +unset($_POST['access_login']); +unset($_POST['access_password']); +unset($_POST['Submit']); +} +} +else { +if (!isset($_COOKIE['auth'])) { +showLoginPasswordProtect(""); +} +$found = false; +foreach($LOGIN_INFORMATION as $key=>$val) { +$lp = (USE_USERNAME ? $key : '') .'%'.$val; +if ($_COOKIE['auth'] == md5($lp)) { +$found = true; +if (TIMEOUT_CHECK_ACTIVITY) { +setcookie("auth", md5($lp), $timeout, '/'); +} +break; +} +} +if (!$found) { +showLoginPasswordProtect(""); +} } ?> \ No newline at end of file diff --git a/system/config.php b/system/config.php index 9816a5a..3fb8514 100644 --- a/system/config.php +++ b/system/config.php @@ -22,7 +22,7 @@ $filelist = getenv('APP_FILELIST') ?? 'jpeg,jpg,gif,png,zip,xls,doc,mp3,mp4,mpeg $sizeverification = getenv('APP_SIZE_VERIFICATION') ?? true; $filedestination = getenv('APP_FILE_DESTINATION') ?? 'files'; $baseurl = getenv('APP_BASE_URL') ?? $_SERVER['HTTP_HOST']; -$maxsize = getenv('APP_MAX_SIZE') ?? (int) (ini_get('upload_max_filesize')); +$maxsize = getenv('APP_MAX_SIZE') ?? (int)(ini_get('upload_max_filesize')); $minsize = getenv('APP_MIN_SIZE') ?? '0'; $waitfor = getenv('APP_DOWNLOAD_TIME'); @@ -52,3 +52,6 @@ define('plausible_embed', $plausibleembed); define('plausibleembedtoken', $plausibleembedtoken); /* version */ define('version', 'v1.0.0'); // DO NOT FORGET TO CHANGE THIS + + +?> diff --git a/system/core.class.php b/system/core.class.php index 4d4eb4e..c5ccc51 100644 --- a/system/core.class.php +++ b/system/core.class.php @@ -1,27 +1,24 @@ min_size) { + public function FileSizeVerification($file){ + if(size_verification == true){ + if($file["size"] < max_size && $file["size"] > min_size){ return true; - } else { + }else{ return false; } - } else { + }else{ return true; - } + } } /* * @module File Name Convertor * @desc This Module convert file name into a encrypted name. This option can be disabled in config file */ - public function FileNameConvertor($file) - { + public function FileNameConvertor($file){ $TransformFileName = substr(str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIKLMNOPQRSTUVWXYZ123456789'), 0, 15); - $filename = $TransformFileName.'-'.basename($_FILES['fileToUpload']['name']); - - return $filename; + $filename = $TransformFileName.'-'.basename($_FILES["fileToUpload"]["name"]); + return $filename; } - public function UploadFile($file, $target) - { + public function UploadFile($file, $target){ $newtarget = file_destination.'/'.$target; - if (move_uploaded_file($file['tmp_name'], $newtarget)) { + if(move_uploaded_file($file["tmp_name"], $newtarget)){ return true; - } else { + }else{ return false; } }