diff --git a/filemanager/UploadHandler.php b/filemanager/UploadHandler.php index 025a048..0070a7c 100755 --- a/filemanager/UploadHandler.php +++ b/filemanager/UploadHandler.php @@ -13,7 +13,7 @@ class UploadHandler { - public $response = array(); + public array $response = []; protected $options; @@ -436,6 +436,7 @@ protected function validate($uploaded_file, $file, $error, $index) { $max_height = @$this->options['max_height']; $min_width = @$this->options['min_width']; $min_height = @$this->options['min_height']; + $img_height = 0; if (($max_width || $max_height || $min_width || $min_height) && $this->is_valid_image_file($uploaded_file)) { list($img_width, $img_height) = $this->get_image_size($uploaded_file); @@ -1448,11 +1449,11 @@ public function post($print_response = true) { $totalSize = $this->get_file_size($this->get_upload_path($name)); if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) { $this->onUploadEnd($res); - }else{ + } else { $this->head(); $this->body(json_encode($res)); } - }else{ + } else { $this->head(); $this->body(json_encode($res)); } @@ -1476,7 +1477,7 @@ public function onUploadEnd ($res){ chmod($targetFile, $this->options['config']['folderPermission']); } } - }else{ + } else { $targetFile = $this->options['config']['ftp_temp_folder'].$res['files'][0]->name; $targetFileThumb = $this->options['config']['ftp_temp_folder']."thumbs/". $res['files'][0]->name; } @@ -1506,7 +1507,7 @@ public function onUploadEnd ($res){ { if($thumbResult === false){ $res['files'][0]->error = trans("Not enough Memory"); - }else{ + } else { $res['files'][0]->error = $thumbResult; } } diff --git a/filemanager/ajax_calls.php b/filemanager/ajax_calls.php index c7aa17b..8e78d32 100755 --- a/filemanager/ajax_calls.php +++ b/filemanager/ajax_calls.php @@ -207,11 +207,11 @@ $FullFileName = $zip->statIndex($i); if (checkRelativePath($FullFileName['name'])) { - if (substr($FullFileName['name'], -1, 1) == "/") { + if (substr($FullFileName['name'], -1, 1) === "/") { create_folder($base_folder . $FullFileName['name']); } - if (! (substr($FullFileName['name'], -1, 1) == "/")) { + if (! (substr($FullFileName['name'], -1, 1) === "/")) { $fileinfo = pathinfo($FullFileName['name']); if (in_array(strtolower($fileinfo['extension']), $config['ext'])) { copy('zip://' . $path . '#' . $FullFileName['name'], $base_folder . $FullFileName['name']); @@ -265,7 +265,7 @@ } if($ftp){ $preview_file = $config['ftp_base_url'].$config['upload_dir'] . $_GET['file']; - }else{ + } else { $preview_file = $config['current_path'] . $_GET["file"]; } $info = pathinfo($preview_file); @@ -375,17 +375,17 @@ break; case 'copy_cut': - if ($_POST['sub_action'] != 'copy' && $_POST['sub_action'] != 'cut') { + if ($_POST['sub_action'] !== 'copy' && $_POST['sub_action'] !== 'cut') { response(trans('wrong sub-action').AddErrorLocation())->send(); exit; } - if (trim($_POST['path']) == '') { + if (trim($_POST['path']) === '') { response(trans('no path').AddErrorLocation())->send(); exit; } - $msg_sub_action = ($_POST['sub_action'] == 'copy' ? trans('Copy') : trans('Cut')); + $msg_sub_action = ($_POST['sub_action'] === 'copy' ? trans('Copy') : trans('Cut')); $path = $config['current_path'] . $_POST['path']; if (is_dir($path)) { @@ -435,8 +435,8 @@ if ($ftp) { $path = $config['ftp_base_url'] . $config['upload_dir'] . $_POST['path']; if ( - ($_POST['folder']==1 && $config['chmod_dirs'] === false) - || ($_POST['folder']==0 && $config['chmod_files'] === false) + ($_POST['folder'] == 1 && $config['chmod_dirs'] === false) + || ($_POST['folder'] == 0 && $config['chmod_files'] === false) || (is_function_callable("chmod") === false)) { response(sprintf(trans('File_Permission_Not_Allowed'), (is_dir($path) ? trans('Folders') : trans('Files')), 403).AddErrorLocation())->send(); exit; @@ -493,21 +493,21 @@ '.trans('User').' - - - + + + '.trans('Group').' - - - + + + '.trans('All').' - - - + + + @@ -540,7 +540,7 @@ } $languages = include 'lang/languages.php'; - if (! isset($languages) || ! is_array($languages)) { + if (!isset($languages) || !is_array($languages)) { response(trans('Lang_Not_Found').AddErrorLocation())->send(); exit; } @@ -596,15 +596,15 @@ $sub_action = $_GET['sub_action']; $preview_mode = $_GET["preview_mode"]; - if ($sub_action != 'preview' && $sub_action != 'edit') { + if ($sub_action !== 'preview' && $sub_action !== 'edit') { response(trans('wrong action').AddErrorLocation())->send(); exit; } if ($ftp) { - $selected_file = ($sub_action == 'preview' ? $config['ftp_base_url'].$config['upload_dir'] . $_GET['file'] : $config['ftp_base_url'].$config['upload_dir'] . $_POST['path']); + $selected_file = ($sub_action === 'preview' ? $config['ftp_base_url'].$config['upload_dir'] . $_GET['file'] : $config['ftp_base_url'].$config['upload_dir'] . $_POST['path']); } else { - $selected_file = ($sub_action == 'preview' ? $config['current_path'] . $_GET['file'] : $config['current_path'] . $_POST['path']); + $selected_file = ($sub_action === 'preview' ? $config['current_path'] . $_GET['file'] : $config['current_path'] . $_POST['path']); if (! file_exists($selected_file)) { response(trans('File_Not_Found').AddErrorLocation())->send(); @@ -614,15 +614,15 @@ $info = pathinfo($selected_file); - if ($preview_mode == 'text') { - $is_allowed = ($sub_action == 'preview' ? $config['preview_text_files'] : $config['edit_text_files']); - $allowed_file_exts = ($sub_action == 'preview' ? $config['previewable_text_file_exts'] : $config['editable_text_file_exts']); - } elseif ($preview_mode == 'google') { + if ($preview_mode === 'text') { + $is_allowed = ($sub_action === 'preview' ? $config['preview_text_files'] : $config['edit_text_files']); + $allowed_file_exts = ($sub_action === 'preview' ? $config['previewable_text_file_exts'] : $config['editable_text_file_exts']); + } elseif ($preview_mode === 'google') { $is_allowed = $config['googledoc_enabled']; $allowed_file_exts = $config['googledoc_file_exts']; } - if (! isset($allowed_file_exts) || ! is_array($allowed_file_exts)) { + if (!isset($allowed_file_exts) || !is_array($allowed_file_exts)) { $allowed_file_exts = []; } @@ -630,23 +630,24 @@ $info['extension']=''; } if (! in_array($info['extension'], $allowed_file_exts) - || ! isset($is_allowed) + || !isset($is_allowed) || $is_allowed === false - || (!$ftp && ! is_readable($selected_file)) + || (!$ftp && !is_readable($selected_file)) ) { - response(sprintf(trans('File_Open_Edit_Not_Allowed'), ($sub_action == 'preview' ? strtolower(trans('Open')) : strtolower(trans('Edit')))).AddErrorLocation())->send(); + response(sprintf(trans('File_Open_Edit_Not_Allowed'), ($sub_action === 'preview' ? strtolower(trans('Open')) : strtolower(trans('Edit')))).AddErrorLocation())->send(); exit; } - if ($sub_action == 'preview') { - if ($preview_mode == 'text') { + + $ret = ''; + if ($sub_action === 'preview') { + if ($preview_mode === 'text') { // get and sanities $data = file_get_contents($selected_file); $data = htmlspecialchars(htmlspecialchars_decode($data)); - $ret = ''; $ret .= ''; $ret .= '
'.$data.'
'; - } elseif ($preview_mode == 'google') { + } elseif ($preview_mode === 'google') { if ($ftp) { $url_file = $selected_file; } else { @@ -656,11 +657,11 @@ $googledoc_url = urlencode($url_file); $ret = ""; } - }else{ + } else { $data = stripslashes(htmlspecialchars(file_get_contents($selected_file))); if(in_array($info['extension'], ['html','html'])){ $ret = ''; - }else{ + } else { $ret = ''; } diff --git a/filemanager/dialog.php b/filemanager/dialog.php index 9a3d71f..c91df55 100644 --- a/filemanager/dialog.php +++ b/filemanager/dialog.php @@ -77,7 +77,7 @@ $subdir = ''; } -if ($subdir == "") { +if (empty($subdir)) { if (!empty($_COOKIE['last_position']) && strpos($_COOKIE['last_position'], '.') === false) { $subdir = trim($_COOKIE['last_position']); } @@ -85,7 +85,7 @@ //remember last position setcookie('last_position', $subdir, time() + (86400 * 7)); -if ($subdir == "/") { +if ($subdir === "/") { $subdir = ""; } @@ -94,7 +94,7 @@ // If hidden folder appears in the path specified in URL parameter "fldr" $dirs = explode('/', $subdir); foreach ($dirs as $dir) { - if ($dir !== '' && in_array($dir, $config['hidden_folders'])) { + if (!empty($dir) && in_array($dir, $config['hidden_folders'])) { // Ignore the path $subdir = ""; break; @@ -121,7 +121,7 @@ $rfm_subfolder = $_SESSION['RF']['subfolder']; } -if ($rfm_subfolder != "" && $rfm_subfolder[strlen($rfm_subfolder) - 1] != "/") { +if (!empty($rfm_subfolder) && $rfm_subfolder[strlen($rfm_subfolder) - 1] !== "/") { $rfm_subfolder .= "/"; } @@ -154,7 +154,7 @@ while ($cycle && $i < $max_cycles) { $i++; - if ($parent == "./") { + if ($parent === "./") { $parent = ""; } @@ -176,7 +176,7 @@ $cycle = false; } - if ($parent == "") { + if (empty($parent)) { $cycle = false; } else { $parent = fix_dirname($parent) . "/"; @@ -329,7 +329,7 @@ 'field_id' => $field_id, 'multiple' => $multiple, 'relative_url' => $return_relative_url, - 'akey' => (isset($_GET['akey']) && $_GET['akey'] != '' ? $_GET['akey'] : 'key') + 'akey' => !empty($_GET['akey']) ? $_GET['akey'] : 'key', ]; if (isset($_GET['CKEditorFuncNum'])) { $get_params['CKEditorFuncNum'] = $_GET['CKEditorFuncNum']; @@ -497,7 +497,7 @@ echo $descending ? 1 : 0; ?>"/> @@ -801,7 +801,7 @@ if ($ftp) { $date = strtotime($file['day'] . " " . $file['month'] . " " . date('Y') . " " . $file['time']); $size = $file['size']; - if ($file['type'] == 'file') { + if ($file['type'] === 'file') { $current_files_number++; $file_ext = substr(strrchr($file['name'], '.'), 1); $is_dir = false; @@ -820,19 +820,19 @@ 'extension' => fix_strtolower($file_ext) ]; } else { - if ($file != "." && $file != "..") { + if ($file !== "." && $file !== "..") { if (is_dir($config['current_path'] . $rfm_subfolder . $subdir . $file)) { $date = filemtime($config['current_path'] . $rfm_subfolder . $subdir . $file); - if (!($file == '.' || substr($file, 0, 1) == '.' || + if (!($file === '.' || substr($file, 0, 1) === '.' || (isset($file_array['extension']) && $file_array['extension'] == fix_strtolower( trans('Type_dir') )) || (isset($file_array['extension']) && $file_array['extension'] != fix_strtolower( trans('Type_dir') )) || - ($file == '..' && $subdir == '') || + ($file === '..' && empty($subdir)) || in_array($file, $config['hidden_folders']) || - ($filter != '' && $n_files > $config['file_number_limit_js'] && $file != ".." && stripos( + (!empty($filter) && $n_files > $config['file_number_limit_js'] && $file !== ".." && stripos( $file, $filter ) === false))) { @@ -932,7 +932,7 @@ break; } - if ($subdir != "") { + if (!empty($subdir)) { $sorted = array_merge([['file' => '..']], $sorted); } @@ -996,7 +996,7 @@ class="icon-folder-open"> + if ($apply_type !== "apply_none" && $config['multiple_selection_action_button']) { ?> @@ -1132,7 +1132,7 @@ class="tip btn btn-inverse ff-label-type-all">
  • + } elseif (!empty($b)) { ?>
  • @@ -1170,17 +1170,17 @@ class="icon-globe"> } ?>" href="javascript:void('')" data-sort="name">
  • " href="javascript:void('')" data-sort="date">
  • " href="javascript:void('')" data-sort="size">
  • " href="javascript:void('')" data-sort="extension">
  • @@ -1217,7 +1217,7 @@ class="icon-globe">
    There is an error! The upload folder there isn't. Check your config.php file.
    - +

    @@ -1229,24 +1229,24 @@ class="icon-globe">
    ">
    " href="javascript:void('')" data-sort="name">
    " href="javascript:void('')" data-sort="date">
    " href="javascript:void('')" data-sort="size">
    " href="javascript:void('')" data-sort="extension">
    @@ -1265,59 +1265,55 @@ class="icon-globe"> foreach ($files as $file_array) { $file = $file_array['file']; - if ($file == '.' || (substr( - $file, - 0, - 1 - ) == '.' && isset($file_array['extension']) && $file_array['extension'] == fix_strtolower( + if ($file === '.' || (substr($file, 0, 1) === '.' && isset($file_array['extension']) && $file_array['extension'] == fix_strtolower( trans('Type_dir') )) || (isset($file_array['extension']) && $file_array['extension'] != fix_strtolower( trans('Type_dir') - )) || ($file == '..' && $subdir == '') || in_array( + )) || ($file === '..' && empty($subdir)) || in_array( $file, $config['hidden_folders'] - ) || ($filter != '' && $n_files > $config['file_number_limit_js'] && $file != ".." && stripos( + ) || (!empty($filter) && $n_files > $config['file_number_limit_js'] && $file !== ".." && stripos( $file, $filter ) === false)) { continue; } $new_name = fix_filename($file, $config); - if ($ftp && $file != '..' && $file != $new_name) { + if ($ftp && $file !== '..' && $file != $new_name) { //rename rename_folder($config['current_path'] . $subdir . $file, $new_name, $ftp, $config); $file = $new_name; } //add in thumbs folder if not exist - if ($file != '..') { + if ($file !== '..') { if (!$ftp && !file_exists($thumbs_path . $file)) { create_folder(false, $thumbs_path . $file, $ftp, $config); } } $class_ext = 3; - if ($file == '..' && trim($subdir) != '') { + if ($file === '..' && trim($subdir) !== '') { $src = explode("/", $subdir); unset($src[count($src) - 2]); $src = implode("/", $src); - if ($src == '') { + if (empty($src)) { $src = "/"; } - } elseif ($file != '..') { + } elseif ($file !== '..') { $src = $subdir . $file . "/"; } ?>
    directory" data-type=""> + if ($file === "..") { ?>
    .png"/>
    @@ -1362,13 +1358,13 @@ class="icon-globe"> .png"/>
    + if ($file === ".."){ ?>

    @@ -1446,15 +1442,13 @@ class="icon-globe"> as $nu => $file_array) { $file = $file_array['file']; - if ($file == '.' || $file == '..' || $file_array['extension'] == fix_strtolower( + if ($file === '.' || $file === '..' || $file_array['extension'] == fix_strtolower( trans('Type_dir') ) || !check_extension( $file_array['extension'], $config - ) || ($filter != '' && $n_files > $config['file_number_limit_js'] && stripos( - $file, - $filter - ) === false)) { + ) || (!empty($filter) && $n_files > $config['file_number_limit_js'] && + stripos($file, $filter) === false)) { continue; } foreach ($config['hidden_files'] as $hidden_file) { @@ -1537,7 +1531,7 @@ class="icon-globe"> $is_icon_thumb = false; $is_icon_thumb_mini = false; $no_thumb = false; - if ($src_thumb == "") { + if (empty($src_thumb)) { $no_thumb = true; if (file_exists('img/' . $config['icon_theme'] . '/' . $file_array['extension'] . ".jpg")) { $src_thumb = 'img/' . $config['icon_theme'] . '/' . $file_array['extension'] . ".jpg"; @@ -1546,7 +1540,7 @@ class="icon-globe"> } $is_icon_thumb = true; } - if ($mini_src == "") { + if (empty($mini_src)) { $is_icon_thumb_mini = false; } @@ -1571,7 +1565,7 @@ class="icon-globe"> if (!$config['multiple_selection']) { ?>no-selector" data-name="" > echo $file_array['extension'] ?>
    + if (!empty($mini_src)) { ?> " data-src=""> + if ($is_img && !empty($src_thumb)) { ?> diff --git a/filemanager/execute.php b/filemanager/execute.php index 83c0c55..c1c8d4b 100755 --- a/filemanager/execute.php +++ b/filemanager/execute.php @@ -3,7 +3,7 @@ include 'include/utils.php'; -if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager") { +if ($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") { response(trans('forbidden') . AddErrorLocation())->send(); exit; } @@ -108,9 +108,9 @@ function returnPaths($_path, $_name, $config) } $info = pathinfo($path); -if (isset($info['extension']) && !(isset($_GET['action']) && $_GET['action'] == 'delete_folder') && +if (isset($info['extension']) && !(isset($_GET['action']) && $_GET['action'] === 'delete_folder') && !check_extension($info['extension'], $config) - && $_GET['action'] != 'create_file') { + && $_GET['action'] !== 'create_file') { response(trans('wrong extension') . AddErrorLocation())->send(); exit; } @@ -135,7 +135,7 @@ function returnPaths($_path, $_name, $config) if($ftp){ deleteDir($path,$ftp,$config); deleteDir($path_thumb,$ftp,$config); - }else{ + } else { if (is_dir($path_thumb)) { deleteDir($path_thumb,NULL,$config); @@ -147,7 +147,7 @@ function returnPaths($_path, $_name, $config) if ($config['fixed_image_creation']) { foreach($config['fixed_path_from_filemanager'] as $k=>$paths){ - if ($paths!="" && $paths[strlen($paths)-1] != "/") $paths.="/"; + if (!empty($paths) && $paths[strlen($paths)-1] !== "/") $paths .= "/"; $base_dir=$paths.substr_replace($path, '', 0, strlen($config['current_path'])); if (is_dir($base_dir)) deleteDir($base_dir,NULL,$config); @@ -187,7 +187,7 @@ function returnPaths($_path, $_name, $config) rename_folder($path_thumb, $name, $ftp, $config); if (!$ftp && $config['fixed_image_creation']) { foreach ($config['fixed_path_from_filemanager'] as $k => $paths) { - if ($paths != "" && $paths[strlen($paths) - 1] != "/") { + if (!empty($paths) && $paths[strlen($paths) - 1] !== "/") { $paths .= "/"; } @@ -281,7 +281,7 @@ function returnPaths($_path, $_name, $config) $info = pathinfo($path); foreach ($config['fixed_path_from_filemanager'] as $k => $paths) { - if ($paths != "" && $paths[strlen($paths) - 1] != "/") { + if (!empty($paths) && $paths[strlen($paths) - 1] !== "/") { $paths .= "/"; } @@ -316,7 +316,7 @@ function returnPaths($_path, $_name, $config) if (!$ftp && $config['fixed_image_creation']) { $info = pathinfo($path); foreach ($config['fixed_path_from_filemanager'] as $k => $paths) { - if ($paths != "" && $paths[strlen($paths) - 1] != "/") { + if (!empty($paths) && $paths[strlen($paths) - 1] !== "/") { $paths .= "/"; } @@ -336,8 +336,8 @@ function returnPaths($_path, $_name, $config) case 'paste_clipboard': if (!isset($_SESSION['RF']['clipboard_action'], $_SESSION['RF']['clipboard']['path']) - || $_SESSION['RF']['clipboard_action'] == '' - || $_SESSION['RF']['clipboard']['path'] == '') { + || empty($_SESSION['RF']['clipboard_action']) + || empty($_SESSION['RF']['clipboard']['path'])) { response()->send(); exit; } @@ -347,7 +347,7 @@ function returnPaths($_path, $_name, $config) if ($ftp) { - if ($_POST['path'] != "") { + if (!empty($_POST['path'])) { $path .= DIRECTORY_SEPARATOR; $path_thumb .= DIRECTORY_SEPARATOR; } @@ -375,12 +375,12 @@ function returnPaths($_path, $_name, $config) } // something terribly gone wrong - if ($action != 'copy' && $action != 'cut') { + if ($action !== 'copy' && $action !== 'cut') { response(trans('wrong action') . AddErrorLocation())->send(); exit; } if ($ftp) { - if ($action == 'copy') { + if ($action === 'copy') { $tmp = time() . basename($data['path']); $ftp->get($tmp, $data['path'], FTP_BINARY); $ftp->put(DIRECTORY_SEPARATOR . $path, $tmp, FTP_BINARY); @@ -392,7 +392,7 @@ function returnPaths($_path, $_name, $config) @$ftp->put(DIRECTORY_SEPARATOR . $path_thumb, $tmp, FTP_BINARY); unlink($tmp); } - } elseif ($action == 'cut') { + } elseif ($action === 'cut') { $ftp->rename($data['path'], DIRECTORY_SEPARATOR . $path); if (url_exists($data['path_thumb'])) { @$ftp->rename($data['path_thumb'], DIRECTORY_SEPARATOR . $path_thumb); @@ -406,11 +406,11 @@ function returnPaths($_path, $_name, $config) } // check if server disables copy or rename - if (is_function_callable(($action == 'copy' ? 'copy' : 'rename')) === false) { - response(sprintf(trans('Function_Disabled'), ($action == 'copy' ? (trans('Copy')) : (trans('Cut')))) . AddErrorLocation())->send(); + if (is_function_callable(($action === 'copy' ? 'copy' : 'rename')) === false) { + response(sprintf(trans('Function_Disabled'), ($action === 'copy' ? (trans('Copy')) : (trans('Cut')))) . AddErrorLocation())->send(); exit; } - if ($action == 'copy') { + if ($action === 'copy') { list($sizeFolderToCopy, $fileNum, $foldersCount) = folder_info($path, false); if (!checkresultingsize($sizeFolderToCopy)) { response(sprintf(trans('max_size_reached'), $config['MaxSizeTotal']) . AddErrorLocation())->send(); @@ -418,7 +418,7 @@ function returnPaths($_path, $_name, $config) } rcopy($data['path'], $path); rcopy($data['path_thumb'], $path_thumb); - } elseif ($action == 'cut') { + } elseif ($action === 'cut') { rrename($data['path'], $path); rrename($data['path_thumb'], $path_thumb); diff --git a/filemanager/force_download.php b/filemanager/force_download.php index 42f1666..c17c723 100755 --- a/filemanager/force_download.php +++ b/filemanager/force_download.php @@ -5,7 +5,7 @@ include 'include/utils.php'; include 'include/mime_type_lib.php'; -if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager") { +if ($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") { response(trans('forbidden') . AddErrorLocation(), 403)->send(); exit; } @@ -76,15 +76,16 @@ header("Content-Transfer-Encoding: binary"); header('Accept-Ranges: bytes'); + $range = 0; if (isset($_SERVER['HTTP_RANGE'])) { list($a, $range) = explode("=", $_SERVER['HTTP_RANGE'], 2); list($range) = explode(",", $range, 2); list($range, $range_end) = explode("-", $range); - $range = intval($range); + $range = (int)$range; if (!$range_end) { $range_end = $size - 1; } else { - $range_end = intval($range_end); + $range_end = (int)$range_end; } $new_length = $range_end - $range + 1; diff --git a/filemanager/include/ftp_class.php b/filemanager/include/ftp_class.php index 87a9be6..af9a438 100755 --- a/filemanager/include/ftp_class.php +++ b/filemanager/include/ftp_class.php @@ -34,7 +34,7 @@ public function connect ($server, $ftpUser, $ftpPassword, $isPassive = false) // *** Check connection if ((!$this->connectionId) || (!$loginResult)) { $this->logMessage('FTP connection has failed!'); - $this->logMessage('Attempted to connect to ' . $server . ' for user ' . $ftpUser, true); + $this->logMessage('Attempted to connect to ' . $server . ' for user ' . $ftpUser); return false; } else { $this->logMessage('Connected to ' . $server . ', for user ' . $ftpUser); diff --git a/filemanager/include/get_png_imageinfo.php b/filemanager/include/get_png_imageinfo.php index 38c7450..faf63c0 100644 --- a/filemanager/include/get_png_imageinfo.php +++ b/filemanager/include/get_png_imageinfo.php @@ -31,7 +31,7 @@ * @return array|bool image information, FALSE on error */ function get_png_imageinfo($file) { - if (! is_file($file)) { + if (!is_file($file)) { return false; } diff --git a/filemanager/include/php_image_magician.php b/filemanager/include/php_image_magician.php index 5e90e76..88cc968 100755 --- a/filemanager/include/php_image_magician.php +++ b/filemanager/include/php_image_magician.php @@ -1485,7 +1485,7 @@ public function roundCorners($radius = 5, $bgColor = 'transparent') // *** Check if the user wants transparency $isTransparent = false; - if ( ! is_array($bgColor)) + if ( !is_array($bgColor)) { if (fix_strtolower($bgColor) == 'transparent') { @@ -2629,7 +2629,7 @@ private function filterOpacity(&$img, $opacity = 75) # { - if ( ! isset($opacity)) + if ( !isset($opacity)) { return false; } @@ -2792,7 +2792,7 @@ public function saveImage($savePath, $imageQuality = "100") { // *** Perform a check or two. - if (! is_resource($this->imageResized) && ! $this->imageResized instanceof \GdImage) + if (!is_resource($this->imageResized) && ! $this->imageResized instanceof \GdImage) { if ($this->debug) { @@ -2805,7 +2805,7 @@ public function saveImage($savePath, $imageQuality = "100") } $fileInfoArray = pathInfo($savePath); clearstatcache(); - if ( ! is_writable($fileInfoArray['dirname'])) + if ( !is_writable($fileInfoArray['dirname'])) { if ($this->debug) { @@ -2914,7 +2914,7 @@ public function displayImage($fileType = 'jpg', $imageQuality = "100") # { - if (! is_resource($this->imageResized) && ! $this->imageResized instanceof \GdImage) + if (!is_resource($this->imageResized) && ! $this->imageResized instanceof \GdImage) { if ($this->debug) { @@ -3488,7 +3488,7 @@ private function GetPixelColor(&$img, $x, $y) # Notes: # { - if (! is_resource($img) && ! $img instanceof \GdImage) + if (!is_resource($img) && ! $img instanceof \GdImage) { return false; } diff --git a/filemanager/include/utils.php b/filemanager/include/utils.php index 198eb41..45d5eee 100755 --- a/filemanager/include/utils.php +++ b/filemanager/include/utils.php @@ -1,6 +1,6 @@ $path) { - if ($path != "" && $path[strlen($path) - 1] != "/") { + if (!empty($path) && $path[strlen($path) - 1] !== "/") { $path .= "/"; } @@ -187,7 +187,7 @@ function deleteFile($path, $path_thumb, $config) if (!$ftp && $config['fixed_image_creation']) { foreach ($config['fixed_path_from_filemanager'] as $k => $path) { - if ($path != "" && $path[strlen($path) - 1] != "/") { + if (!empty($path) && $path[strlen($path) - 1] !== "/") { $path .= "/"; } @@ -228,7 +228,7 @@ function deleteDir($dir, $ftp = null, $config = null) return unlink($dir); } foreach (scandir($dir) as $item) { - if ($item == '.' || $item == '..') { + if ($item === '.' || $item === '..') { continue; } if (!deleteDir($dir . DIRECTORY_SEPARATOR . $item)) { @@ -490,8 +490,8 @@ function folder_info($path, $count_hidden = true) $files_count = 0; $folders_count = 0; foreach ($files as $t) { - if ($t != "." && $t != "..") { - if ($count_hidden or !(in_array($t, $config['hidden_folders']) or in_array($t, $config['hidden_files']))) { + if ($t !== "." && $t !== "..") { + if ($count_hidden || !(in_array($t, $config['hidden_folders']) || in_array($t, $config['hidden_files']))) { $currentFile = $cleanPath . $t; if (is_dir($currentFile)) { list($size, $tmp, $tmp1) = folder_info($currentFile); @@ -524,8 +524,8 @@ function filescount($path, $count_hidden = true) $cleanPath = rtrim($path, '/') . '/'; foreach ($files as $t) { - if ($t != "." && $t != "..") { - if ($count_hidden or !(in_array($t, $config['hidden_folders']) or in_array($t, $config['hidden_files']))) { + if ($t !== "." && $t !== "..") { + if ($count_hidden || !(in_array($t, $config['hidden_folders']) || in_array($t, $config['hidden_files']))) { $currentFile = $cleanPath . $t; if (is_dir($currentFile)) { $size = filescount($currentFile); @@ -641,7 +641,7 @@ function check_file_extension($extension, $config) } } - if ($config['files_without_extension'] && $extension == '') { + if ($config['files_without_extension'] && empty($extension)) { $check = true; } @@ -814,7 +814,7 @@ function fix_path($path, $config) $info = pathinfo($path); $tmp_path = $info['dirname']; $str = fix_filename($info['filename'], $config); - if ($tmp_path != "") { + if (!empty($tmp_path)) { return $tmp_path . DIRECTORY_SEPARATOR . $str; } return $str; @@ -834,7 +834,7 @@ function config_loading($current_path, $fld) return true; } echo "!!!!" . $parent = fix_dirname($fld); - if ($parent != "." && !empty($parent)) { + if ($parent !== "." && !empty($parent)) { config_loading($current_path, $parent); } @@ -859,10 +859,10 @@ function image_check_memory_usage($img, $max_breedte, $max_hoogte) $mem = ini_get('memory_limit'); $memory_limit = 0; if (strpos($mem, 'M') !== false) { - $memory_limit = abs(intval(str_replace(['M'], '', $mem) * 1024 * 1024)); + $memory_limit = abs((int)(str_replace(['M'], '', $mem) * 1024 * 1024)); } if (strpos($mem, 'G') !== false) { - $memory_limit = abs(intval(str_replace(['G'], '', $mem) * 1024 * 1024 * 1024)); + $memory_limit = abs((int)(str_replace(['G'], '', $mem) * 1024 * 1024 * 1024)); } if (($image_properties = getimagesize($img)) === false) { @@ -898,7 +898,7 @@ function image_check_memory_usage($img, $max_breedte, $max_hoogte) $image_memory_usage = $K64 + ($image_width * $image_height * ($image_bits * $image_channels / 8) * 2); $thumb_memory_usage = $K64 + ($max_breedte * $max_hoogte * ($image_bits * $image_channels / 8) * 2); - $memory_needed = abs(intval($memory_usage + $image_memory_usage + $thumb_memory_usage)); + $memory_needed = abs((int)($memory_usage + $image_memory_usage + $thumb_memory_usage)); if ($memory_needed > $memory_limit) { return false; @@ -920,7 +920,7 @@ function image_check_memory_usage($img, $max_breedte, $max_hoogte) if (!function_exists('ends_with')) { function ends_with($haystack, $needle) { - return $needle === "" || substr($haystack, -strlen($needle)) === $needle; + return empty($needle) || substr($haystack, -strlen($needle)) === $needle; } } @@ -958,7 +958,7 @@ function new_thumbnails_creation($targetPath, $targetFile, $name, $current_path, $info['filename'] = fix_filename($info['filename'], $config); if ($config['relative_image_creation']) { foreach ($config['relative_path_from_current_pos'] as $k => $path) { - if ($path != "" && $path[strlen($path) - 1] != "/") { + if (!empty($path) && $path[strlen($path) - 1] !== "/") { $path .= "/"; } if (!file_exists($targetPath . $path)) { @@ -981,7 +981,7 @@ function new_thumbnails_creation($targetPath, $targetFile, $name, $current_path, //create fixed thumbs if ($config['fixed_image_creation']) { foreach ($config['fixed_path_from_filemanager'] as $k => $path) { - if ($path != "" && $path[strlen($path) - 1] != "/") { + if (!empty($path) && $path[strlen($path) - 1] !== "/") { $path .= "/"; } $base_dir = $path . substr_replace($targetPath, '', 0, strlen($current_path)); @@ -1049,7 +1049,7 @@ function is_really_writable($dir) { $dir = rtrim($dir, '/'); // linux, safe off - if (DIRECTORY_SEPARATOR == '/' && @ini_get("safe_mode") == false) { + if (DIRECTORY_SEPARATOR === '/' && @ini_get("safe_mode") == false) { return is_writable($dir); } @@ -1113,7 +1113,7 @@ function rcopy($source, $destination, $is_rec = false) $files = scandir($source); foreach ($files as $file) { - if ($file != "." && $file != "..") { + if ($file !== "." && $file !== "..") { rcopy( $source . DIRECTORY_SEPARATOR . $file, rtrim($destination, '/') . DIRECTORY_SEPARATOR . $file, @@ -1160,7 +1160,7 @@ function rrename($source, $destination, $is_rec = false) $files = scandir($source); foreach ($files as $file) { - if ($file != "." && $file != "..") { + if ($file !== "." && $file !== "..") { rrename( $source . DIRECTORY_SEPARATOR . $file, rtrim($destination, '/') . DIRECTORY_SEPARATOR . $file, @@ -1196,7 +1196,7 @@ function rrename_after_cleaner($source) $files = scandir($source); foreach ($files as $file) { - if ($file != "." && $file != "..") { + if ($file !== "." && $file !== "..") { if (is_dir($source . DIRECTORY_SEPARATOR . $file)) { rrename_after_cleaner($source . DIRECTORY_SEPARATOR . $file); } else { @@ -1217,7 +1217,7 @@ function rrename_after_cleaner($source) */ function rchmod($source, $mode, $rec_option = "none", $is_rec = false) { - if ($rec_option == "none") { + if ($rec_option === "none") { chmod($source, $mode); } else { if ($is_rec === false) { @@ -1227,14 +1227,14 @@ function rchmod($source, $mode, $rec_option = "none", $is_rec = false) $files = scandir($source); foreach ($files as $file) { - if ($file != "." && $file != "..") { + if ($file !== "." && $file !== "..") { if (is_dir($source . DIRECTORY_SEPARATOR . $file)) { - if ($rec_option == "folders" || $rec_option == "both") { + if ($rec_option === "folders" || $rec_option === "both") { chmod($source . DIRECTORY_SEPARATOR . $file, $mode); } rchmod($source . DIRECTORY_SEPARATOR . $file, $mode, $rec_option, true); } else { - if ($rec_option == "files" || $rec_option == "both") { + if ($rec_option === "files" || $rec_option === "both") { chmod($source . DIRECTORY_SEPARATOR . $file, $mode); } } diff --git a/filemanager/upload.php b/filemanager/upload.php index 295f44d..e7413c2 100755 --- a/filemanager/upload.php +++ b/filemanager/upload.php @@ -7,7 +7,7 @@ include 'include/utils.php'; - if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager") { + if ($_SESSION['RF']["verify"] !== "RESPONSIVEfilemanager") { response(trans('forbidden') . AddErrorLocation(), 403)->send(); exit; } @@ -123,7 +123,7 @@ } $extension = get_extension_from_mime($mime_type); - if ($extension == 'so' || $extension == '' || $mime_type == "text/troff") { + if ($extension === 'so' || empty($extension) || $mime_type === "text/troff") { $extension = $info['extension']; } $filename = $info['filename'] . "." . $extension;