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 @@
'.$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)) { ?>