isDir(
$config['ftp_base_folder'] . $config['upload_dir'] . $rfm_subfolder . $subdir
)) || (!$ftp && !file_exists($config['current_path'] . $rfm_subfolder . $subdir))) {
$subdir = '';
$rfm_subfolder = "";
}
$cur_dir = $config['upload_dir'] . $rfm_subfolder . $subdir;
$cur_dir_thumb = $config['thumbs_upload_dir'] . $rfm_subfolder . $subdir;
$thumbs_path = $config['thumbs_base_path'] . $rfm_subfolder . $subdir;
$parent = $rfm_subfolder . $subdir;
if ($ftp) {
$cur_dir = $config['ftp_base_folder'] . $cur_dir;
$cur_dir_thumb = $config['ftp_base_folder'] . $cur_dir_thumb;
$thumbs_path = str_replace(array('/..', '..'), '', $cur_dir_thumb);
$parent = $config['ftp_base_folder'] . $parent;
}
if (!$ftp) {
$cycle = true;
$max_cycles = 50;
$i = 0;
while ($cycle && $i < $max_cycles) {
$i++;
if ($parent == "./") {
$parent = "";
}
if (file_exists($config['current_path'] . $parent . "config.php")) {
$configMain = $config;
$configTemp = include $config['current_path'] . $parent . 'config.php';
if (is_array($configTemp) && count($configTemp) > 0) {
$config = array_merge($configMain, $configTemp);
$config['ext'] = array_merge(
$config['ext_img'],
$config['ext_file'],
$config['ext_misc'],
$config['ext_video'],
$config['ext_music']
);
} else {
$config = $configMain;
}
$cycle = false;
}
if ($parent == "") {
$cycle = false;
} else {
$parent = fix_dirname($parent) . "/";
}
}
if (!is_dir($thumbs_path)) {
create_folder(false, $thumbs_path, $ftp, $config);
}
}
$multiple = null;
if (isset($_GET['multiple'])) {
if ($_GET['multiple'] == 1) {
$multiple = 1;
$config['multiple_selection'] = true;
$config['multiple_selection_action_button'] = true;
} elseif ($_GET['multiple'] == 0) {
$multiple = 0;
$config['multiple_selection'] = false;
$config['multiple_selection_action_button'] = false;
}
}
if (isset($_GET['callback'])) {
$callback = strip_tags($_GET['callback']);
$_SESSION['RF']["callback"] = $callback;
} else {
$callback = 0;
if (isset($_SESSION['RF']["callback"])) {
$callback = $_SESSION['RF']["callback"];
}
}
$popup = isset($_GET['popup']) ? strip_tags($_GET['popup']) : 0;
//Sanitize popup
$popup = !!$popup;
$crossdomain = isset($_GET['crossdomain']) ? strip_tags($_GET['crossdomain']) : 0;
//Sanitize crossdomain
$crossdomain = !!$crossdomain;
//view type
if (!isset($_SESSION['RF']["view_type"])) {
$view = $config['default_view'];
$_SESSION['RF']["view_type"] = $view;
}
if (isset($_GET['view'])) {
$view = fix_get_params($_GET['view']);
$_SESSION['RF']["view_type"] = $view;
}
$view = $_SESSION['RF']["view_type"];
//filter
$filter = "";
if (isset($_SESSION['RF']["filter"])) {
$filter = $_SESSION['RF']["filter"];
}
if (isset($_GET["filter"])) {
$filter = fix_get_params($_GET["filter"]);
}
if (!isset($_SESSION['RF']['sort_by'])) {
$_SESSION['RF']['sort_by'] = 'name';
}
if (isset($_GET["sort_by"])) {
$sort_by = $_SESSION['RF']['sort_by'] = fix_get_params($_GET["sort_by"]);
} else {
$sort_by = $_SESSION['RF']['sort_by'];
}
if (!isset($_SESSION['RF']['descending'])) {
$_SESSION['RF']['descending'] = true;
}
if (isset($_GET["descending"])) {
$descending = $_SESSION['RF']['descending'] = fix_get_params($_GET["descending"]) == 1;
} else {
$descending = $_SESSION['RF']['descending'];
}
$boolarray = array(false => 'false', true => 'true');
$return_relative_url = isset($_GET['relative_url']) && $_GET['relative_url'] == "1" ? true : false;
if (!isset($_GET['type'])) {
$_GET['type'] = 0;
}
$extensions = null;
if (isset($_GET['extensions'])) {
$extensions = json_decode(urldecode($_GET['extensions']));
$ext_tmp = array();
foreach ($extensions as $extension) {
$extension = fix_strtolower($extension);
if (check_file_extension($extension, $config)) {
$ext_tmp[] = $extension;
}
}
if ($extensions) {
$ext = $ext_tmp;
$config['ext'] = $ext_tmp;
$config['show_filter_buttons'] = false;
}
}
if (isset($_GET['editor'])) {
$editor = strip_tags($_GET['editor']);
} else {
$editor = $_GET['type'] == 0 ? null : 'tinymce';
}
$field_id = isset($_GET['field_id']) ? fix_get_params($_GET['field_id']) : null;
$type_param = fix_get_params($_GET['type']);
$apply = null;
if ($multiple) {
$apply = 'apply_multiple';
}
if ($type_param == 1) {
$apply_type = 'apply_img';
} elseif ($type_param == 2) {
$apply_type = 'apply_link';
} elseif ($type_param == 0 && !$field_id) {
$apply_type = 'apply_none';
} elseif ($type_param == 3) {
$apply_type = 'apply_video';
} else {
$apply_type = 'apply';
}
if (!$apply) {
$apply = $apply_type;
}
$get_params = array(
'editor' => $editor,
'type' => $type_param,
'lang' => $lang,
'popup' => $popup,
'crossdomain' => $crossdomain,
'extensions' => ($extensions) ? urlencode(json_encode($extensions)) : null,
'field_id' => $field_id,
'multiple' => $multiple,
'relative_url' => $return_relative_url,
'akey' => (isset($_GET['akey']) && $_GET['akey'] != '' ? $_GET['akey'] : 'key')
);
if (isset($_GET['CKEditorFuncNum'])) {
$get_params['CKEditorFuncNum'] = $_GET['CKEditorFuncNum'];
$get_params['CKEditor'] = (isset($_GET['CKEditor']) ? $_GET['CKEditor'] : '');
}
$get_params['fldr'] = '';
$get_params = http_build_query($get_params);
?>
Responsive FileManager
"/>
"/>
"/>
"/>
scanDir($config['ftp_base_folder'] . $config['upload_dir'] . $rfm_subfolder . $subdir);
if (!$ftp->isDir($config['ftp_base_folder'] . $config['ftp_thumbs_dir'] . $rfm_subfolder . $subdir)) {
create_folder(
false,
$config['ftp_base_folder'] . $config['ftp_thumbs_dir'] . $rfm_subfolder . $subdir,
$ftp,
$config
);
}
} catch (FtpClient\FtpException $e) {
echo "Error: ";
echo $e->getMessage();
echo "
Please check configurations";
die();
}
} else {
$files = scandir($config['current_path'] . $rfm_subfolder . $subdir);
}
$n_files = count($files);
//php sorting
$sorted = array();
//$current_folder=array();
//$prev_folder=array();
$current_files_number = 0;
$current_folders_number = 0;
foreach ($files as $k => $file) {
if ($ftp) {
$date = strtotime($file['day'] . " " . $file['month'] . " " . date('Y') . " " . $file['time']);
$size = $file['size'];
if ($file['type'] == 'file') {
$current_files_number++;
$file_ext = substr(strrchr($file['name'], '.'), 1);
$is_dir = false;
} else {
$current_folders_number++;
$file_ext = trans('Type_dir');
$is_dir = true;
}
$sorted[$k] = array(
'is_dir' => $is_dir,
'file' => $file['name'],
'file_lcase' => strtolower($file['name']),
'date' => $date,
'size' => $size,
'permissions' => $file['permissions'],
'extension' => fix_strtolower($file_ext)
);
} else {
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) == '.' ||
(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, $config['hidden_folders']) ||
($filter != '' && $n_files > $config['file_number_limit_js'] && $file != ".." && stripos(
$file,
$filter
) === false))) {
$current_folders_number++;
}
if ($config['show_folder_size']) {
list($size, $nfiles, $nfolders) = folder_info(
$config['current_path'] . $rfm_subfolder . $subdir . $file,
false
);
} else {
$size = 0;
}
$file_ext = trans('Type_dir');
$sorted[$k] = array(
'is_dir' => true,
'file' => $file,
'file_lcase' => strtolower($file),
'date' => $date,
'size' => $size,
'permissions' => '',
'extension' => fix_strtolower($file_ext)
);
if ($config['show_folder_size']) {
$sorted[$k]['nfiles'] = $nfiles;
$sorted[$k]['nfolders'] = $nfolders;
}
} else {
$current_files_number++;
$file_path = $config['current_path'] . $rfm_subfolder . $subdir . $file;
$date = filemtime($file_path);
$size = filesize($file_path);
$file_ext = substr(strrchr($file, '.'), 1);
$sorted[$k] = array(
'is_dir' => false,
'file' => $file,
'file_lcase' => strtolower($file),
'date' => $date,
'size' => $size,
'permissions' => '',
'extension' => strtolower($file_ext)
);
}
}
}
}
function filenameSort($x, $y)
{
global $descending;
if ($x['is_dir'] !== $y['is_dir']) {
$greater = $y['is_dir'];
} else {
$greater = ($descending)
? $x['file_lcase'] < $y['file_lcase']
: $x['file_lcase'] >= $y['file_lcase'];
}
return $greater ? 1 : -1;
}
function dateSort($x, $y)
{
global $descending;
if ($x['is_dir'] !== $y['is_dir']) {
$greater = $y['is_dir'];
} else {
$greater = ($descending)
? $x['date'] < $y['date']
: $x['date'] >= $y['date'];
}
return $greater ? 1 : -1;
}
function sizeSort($x, $y)
{
global $descending;
if ($x['is_dir'] !== $y['is_dir']) {
$greater = $y['is_dir'];
} else {
$greater = ($descending)
? $x['size'] < $y['size']
: $x['size'] >= $y['size'];
}
return $greater ? 1 : -1;
}
function extensionSort($x, $y)
{
global $descending;
if ($x['is_dir'] !== $y['is_dir']) {
$greater = $y['is_dir'];
} else {
$greater = ($descending)
? $x['extension'] < $y['extension']
: $x['extension'] >= $y['extension'];
}
return $greater ? 1 : -1;
}
switch ($sort_by) {
case 'date':
usort($sorted, 'dateSort');
break;
case 'size':
usort($sorted, 'sizeSort');
break;
case 'extension':
usort($sorted, 'extensionSort');
break;
default:
usort($sorted, 'filenameSort');
break;
}
if ($subdir != "") {
$sorted = array_merge(array(array('file' => '..')), $sorted);
}
$files = $sorted;
?>
- /
$b) {
$tmp_path .= $b . "/";
if ($k == count($bc) - 2) {
?>
- ">
-
- ( " . trans(
'Files'
) . " - " . $current_folders_number . " " . trans(
'Folders'
); ?>)
-
isDir(
$config['ftp_base_folder'] . $config['upload_dir'] . $rfm_subfolder . $subdir
)) || (!$ftp && @opendir($config['current_path'] . $rfm_subfolder . $subdir) === false)){ ?>
There is an error! The upload folder there isn't. Check your config.php
file.
" id="main-item-container">
$config['file_number_limit_js'] && $file != ".." && stripos(
$file,
$filter
) === false)) {
continue;
}
$new_name = fix_filename($file, $config);
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 (!$ftp && !file_exists($thumbs_path . $file)) {
create_folder(false, $thumbs_path . $file, $ftp, $config);
}
}
$class_ext = 3;
if ($file == '..' && trim($subdir) != '') {
$src = explode("/", $subdir);
unset($src[count($src) - 2]);
$src = implode("/", $src);
if ($src == '') {
$src = "/";
}
} elseif ($file != '..') {
$src = $subdir . $file . "/";
}
?>
- >
$file_array) {
$file = $file_array['file'];
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)) {
continue;
}
foreach ($config['hidden_files'] as $hidden_file) {
if (fnmatch($hidden_file, $file, FNM_PATHNAME)) {
continue 2;
}
}
$filename = substr($file, 0, '-' . (strlen($file_array['extension']) + 1));
if (strlen($file_array['extension']) === 0) {
$filename = $file;
}
if (!$ftp) {
$file_path = $config['current_path'] . $rfm_subfolder . $subdir . $file;
//check if file have illegal caracter
if ($file != fix_filename($file, $config)) {
$file1 = fix_filename($file, $config);
$file_path1 = ($config['current_path'] . $rfm_subfolder . $subdir . $file1);
if (file_exists($file_path1)) {
$i = 1;
$info = pathinfo($file1);
while (file_exists(
$config['current_path'] . $rfm_subfolder . $subdir . $info['filename'] . ".[" . $i . "]." . $info['extension']
)) {
$i++;
}
$file1 = $info['filename'] . ".[" . $i . "]." . $info['extension'];
$file_path1 = ($config['current_path'] . $rfm_subfolder . $subdir . $file1);
}
$filename = substr($file1, 0, '-' . (strlen($file_array['extension']) + 1));
if (strlen($file_array['extension']) === 0) {
$filename = $file1;
}
rename_file($file_path, fix_filename($filename, $config), $ftp, $config);
$file = $file1;
$file_array['extension'] = fix_filename($file_array['extension'], $config);
$file_path = $file_path1;
}
} else {
$file_path = $config['ftp_base_url'] . $config['upload_dir'] . $rfm_subfolder . $subdir . $file;
}
$is_img = false;
$is_video = false;
$is_audio = false;
$show_original = false;
$show_original_mini = false;
$mini_src = "";
$src_thumb = "";
if (in_array($file_array['extension'], $config['ext_img'])) {
$src = $file_path;
$is_img = true;
$img_width = $img_height = "";
if ($ftp) {
$mini_src = $src_thumb = $config['ftp_base_url'] . $config['ftp_thumbs_dir'] . $subdir . $file;
$creation_thumb_path = "/" . $config['ftp_base_folder'] . $config['ftp_thumbs_dir'] . $subdir . $file;
} else {
$creation_thumb_path = $mini_src = $src_thumb = $thumbs_path . $file;
if (!file_exists($src_thumb)) {
if (create_img($file_path, $creation_thumb_path, 122, 91, 'crop', $config) !== true) {
$src_thumb = $mini_src = "";
}
}
//check if is smaller than thumb
list($img_width, $img_height, $img_type, $attr) = @getimagesize($file_path);
if ($img_width < 122 && $img_height < 91) {
$src_thumb = $file_path;
$show_original = true;
}
if ($img_width < 45 && $img_height < 38) {
$mini_src = $config['current_path'] . $rfm_subfolder . $subdir . $file;
$show_original_mini = true;
}
}
}
$is_icon_thumb = false;
$is_icon_thumb_mini = false;
$no_thumb = false;
if ($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";
} else {
$src_thumb = "img/" . $config['icon_theme'] . "/default.jpg";
}
$is_icon_thumb = true;
}
if ($mini_src == "") {
$is_icon_thumb_mini = false;
}
$class_ext = 0;
if (in_array($file_array['extension'], $config['ext_video'])) {
$class_ext = 4;
$is_video = true;
} elseif (in_array($file_array['extension'], $config['ext_img'])) {
$class_ext = 2;
} elseif (in_array($file_array['extension'], $config['ext_music'])) {
$class_ext = 5;
$is_audio = true;
} elseif (in_array($file_array['extension'], $config['ext_misc'])) {
$class_ext = 3;
} else {
$class_ext = 1;
}
if ((!($_GET['type'] == 1 && !$is_img) && !(($_GET['type'] == 3 && !$is_video) && ($_GET['type'] == 3 && !$is_audio))) && $class_ext > 0){
?>
- >