isDir($ftp_base_folder . $upload_dir . $rfm_subfolder . $subdir)) || (!$ftp && !file_exists($current_path . $rfm_subfolder . $subdir))) {
$subdir = '';
$rfm_subfolder = "";
}
if (trim($rfm_subfolder) == "") {
$cur_dir = $upload_dir . $subdir;
$cur_dir_show_url = $upload_dir_view_url . $subdir;
$cur_path = $current_path . $subdir;
$thumbs_path = $thumbs_base_path;
$parent = $subdir;
} else {
$cur_dir = $upload_dir . $rfm_subfolder . $subdir;
$cur_path = $current_path . $rfm_subfolder . $subdir;
$cur_dir_show_url = $upload_dir_view_url . $rfm_subfolder . $subdir;
$thumbs_path = $thumbs_base_path . $rfm_subfolder;
$parent = $rfm_subfolder . $subdir;
}
if ($ftp) {
$cur_dir = $ftp_base_folder . $cur_dir;
$cur_path = str_replace(array('/..', '..'), '', $cur_dir);
$thumbs_path = str_replace(array('/..', '..'), '', $ftp_base_folder . $ftp_thumbs_dir . $rfm_subfolder);
$parent = $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($current_path . $parent . "config.php")) {
require_once $current_path . $parent . "config.php";
$cycle = FALSE;
}
if ($parent == "")
$cycle = FALSE;
else
$parent = fix_dirname($parent) . "/";
}
if (!is_dir($thumbs_path . $subdir)) {
create_folder(FALSE, $thumbs_path . $subdir);
}
}
if (isset($_GET['callback'])) {
$callback = strip_tags($_GET['callback']);
} else
$callback = 0;
if (isset($_GET['popup'])) {
$popup = strip_tags($_GET['popup']);
} else
$popup = 0;
//Sanitize popup
$popup = !!$popup;
if (isset($_GET['crossdomain'])) {
$crossdomain = strip_tags($_GET['crossdomain']);
} else
$crossdomain = 0;
//Sanitize crossdomain
$crossdomain = !!$crossdomain;
//view type
if (!isset($_SESSION['SDSRF']["view_type"])) {
$view = $default_view;
$_SESSION['SDSRF']["view_type"] = $view;
}
if (isset($_GET['view'])) {
$view = fix_get_params($_GET['view']);
$_SESSION['SDSRF']["view_type"] = $view;
}
$view = $_SESSION['SDSRF']["view_type"];
//filter
$filter = "";
if (isset($_SESSION['SDSRF']["filter"])) {
$filter = $_SESSION['SDSRF']["filter"];
}
if (isset($_GET["filter"])) {
$filter = fix_get_params($_GET["filter"]);
}
if (!isset($_SESSION['SDSRF']['sort_by'])) {
$_SESSION['SDSRF']['sort_by'] = 'name';
}
if (isset($_GET["sort_by"])) {
$sort_by = $_SESSION['SDSRF']['sort_by'] = fix_get_params($_GET["sort_by"]);
} else
$sort_by = $_SESSION['SDSRF']['sort_by'];
if (!isset($_SESSION['SDSRF']['descending'])) {
$_SESSION['SDSRF']['descending'] = TRUE;
}
if (isset($_GET["descending"])) {
$descending = $_SESSION['SDSRF']['descending'] = fix_get_params($_GET["descending"]) == 1;
} else {
$descending = $_SESSION['SDSRF']['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;
}
if ($_GET['type'] == 1 || $_GET['type'] == 3) {
$filter = '';
}
$extensions = null;
if (isset($_GET['extensions'])) {
$extensions = json_decode(urldecode($_GET['extensions']));
if ($extensions) {
$ext = $extensions;
$show_filter_buttons = false;
}
}
if (isset($_GET['editor'])) {
$editor = strip_tags($_GET['editor']);
} else {
if ($_GET['type'] == 0) {
$editor = false;
} else {
$editor = 'tinymce';
}
}
if (!isset($_GET['field_id']))
$_GET['field_id'] = '';
$field_id = isset($_GET['field_id']) ? fix_get_params($_GET['field_id']) : '';
$type_param = fix_get_params($_GET['type']);
if ($type_param == 1)
$apply = 'apply_img';
elseif ($type_param == 2)
$apply = 'apply_link';
elseif ($type_param == 0 && $_GET['field_id'] == '')
$apply = 'apply_none';
elseif ($type_param == 3)
$apply = 'apply_video';
else
$apply = 'apply';
$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,
'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);
?>
scanDir("/" . $ftp_base_folder . $upload_dir . $rfm_subfolder . $subdir);
if (!$ftp->isDir("/" . $ftp_base_folder . $ftp_thumbs_dir . $rfm_subfolder . $subdir)) {
create_folder(false, "/" . $ftp_base_folder . $ftp_thumbs_dir . $rfm_subfolder . $subdir, $ftp, $config);
}
} catch (FtpClient\FtpException $e) {
echo "Error: ";
echo $e->getMessage();
echo "
Please check configurations";
die();
}
} else {
$__makePath = $current_path . $rfm_subfolder . $subdir;
if (!is_dir($__makePath)) {
create_folder(FALSE, $__makePath);
}
$files = scandir($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);
} else {
$current_folders_number++;
$file_ext = trans('Type_dir');
}
$sorted[$k] = array(
'file' => $file['name'],
'file_lcase' => strtolower($file['name']),
'date' => $date,
'size' => $size,
'permissions' => $file['permissions'],
'extension' => strtolower($file_ext)
);
} else {
if ($file != "." && $file != "..") {
if (is_dir($current_path . $rfm_subfolder . $subdir . $file)) {
$date = filemtime($current_path . $rfm_subfolder . $subdir . $file);
$current_folders_number++;
if ($show_folder_size) {
list($size, $nfiles, $nfolders) = folder_info($current_path . $rfm_subfolder . $subdir . $file, false);
} else {
$size = 0;
}
$file_ext = trans('Type_dir');
$sorted[$k] = array(
'file' => $file,
'file_lcase' => strtolower($file),
'date' => $date,
'size' => $size,
'permissions' => '',
'extension' => strtolower($file_ext)
);
if ($show_folder_size) {
$sorted[$k]['nfiles'] = $nfiles;
$sorted[$k]['nfolders'] = $nfolders;
}
} else {
$current_files_number++;
$file_path = $current_path . $rfm_subfolder . $subdir . $file;
$date = filemtime($file_path);
$size = filesize($file_path);
$file_ext = substr(strrchr($file, '.'), 1);
$sorted[$k] = array(
'file' => $file,
'file_lcase' => strtolower($file),
'date' => $date,
'size' => $size,
'permissions' => '',
'extension' => strtolower($file_ext)
);
}
}
}
}
// Should lazy loading be enabled
$lazy_loading_enabled = ($lazy_loading_file_number_threshold == 0 || $lazy_loading_file_number_threshold != -1 && $n_files > $lazy_loading_file_number_threshold) ? true : false;
function filenameSort($x, $y) {
return $x['file_lcase'] < $y['file_lcase'];
}
function dateSort($x, $y) {
return $x['date'] < $y['date'];
}
function sizeSort($x, $y) {
return $x['size'] < $y['size'];
}
function extensionSort($x, $y) {
return $x['extension'] < $y['extension'];
}
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 (!$descending) {
$sorted = array_reverse($sorted);
}
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($ftp_base_folder . $upload_dir . $rfm_subfolder . $subdir)) || (!$ftp && @opendir($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">
$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($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 . $subdir . $file)) {
create_folder(false, $thumbs_path . $subdir . $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 . "/";
}
if($file != 'sds_rfm' && $file != 'revslider'){
?>
- >
directory" data-type="">
"/>
">

.png" />

.png" />
" title="" data-folder="1" data-permissions="" data-path="">
" title="" data-confirm="" data-path="" >
$file_array) {
$file = $file_array['file'];
if ($file == '.' || $file == '..' || $file_array['extension'] == trans('Type_dir') || in_array($file, $hidden_files) || !in_array(fix_strtolower($file_array['extension']), $ext) || ($filter != '' && $n_files > $file_number_limit_js && stripos($file, $filter) === false))
continue;
$filename = substr($file, 0, '-' . (strlen($file_array['extension']) + 1));
if (!$ftp) {
$file_path = $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 = ($current_path . $rfm_subfolder . $subdir . $file1);
if (file_exists($file_path1)) {
$i = 1;
$info = pathinfo($file1);
while (file_exists($current_path . $rfm_subfolder . $subdir . $info['filename'] . ".[" . $i . "]." . $info['extension'])) {
$i++;
}
$file1 = $info['filename'] . ".[" . $i . "]." . $info['extension'];
$file_path1 = ($current_path . $rfm_subfolder . $subdir . $file1);
}
$filename = substr($file1, 0, '-' . (strlen($file_array['extension']) + 1));
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'] . $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'], $ext_img)) {
$src = $file_path;
$is_img = true;
$img_width = $img_height = "";
if ($ftp) {
$mini_src = $src_thumb = $config['ftp_base_url'] . $ftp_thumbs_dir . $subdir . $file;
$creation_thumb_path = "/" . $config['ftp_base_folder'] . $ftp_thumbs_dir . $subdir . $file;
} else {
$creation_thumb_path = $mini_src = $src_thumb = $thumbs_path . $subdir . $file;
if (!file_exists($src_thumb)) {
if (!create_img($file_path, $creation_thumb_path, 122, 91, 'crop', $ftp, $config)) {
$src_thumb = $mini_src = "";
} else {
// new_thumbnails_creation($current_path . $rfm_subfolder . $subdir, $file_path, $file, $current_path, '', '', '', '', '', '', '', $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height, $fixed_image_creation_option);
}
}
//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 = $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/' . $icon_theme . '/' . $file_array['extension'] . ".jpg")) {
$src_thumb = 'img/' . $icon_theme . '/' . $file_array['extension'] . ".jpg";
} else {
$src_thumb = "img/" . $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'], $ext_video)) {
$class_ext = 4;
$is_video = true;
} elseif (in_array($file_array['extension'], $ext_img)) {
$class_ext = 2;
} elseif (in_array($file_array['extension'], $ext_music)) {
$class_ext = 5;
$is_audio = true;
} elseif (in_array($file_array['extension'], $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) {
?>
- >
">
">
![]()
" src="">
">