Update Filemanager 9.14

This commit is contained in:
fredtempez 2019-01-11 09:54:40 +01:00
parent fa395d1845
commit 1a57893154
22 changed files with 10249 additions and 820 deletions

View File

@ -380,6 +380,10 @@ class UploadHandler
$file->error = $this->get_error_message('accept_file_types');
return false;
}
if (preg_match($this->options['image_file_types'], $file->name) && function_exists('exif_imagetype') && !@exif_imagetype($uploaded_file)) {
$file->error = $this->get_error_message('accept_file_types');
return false;
}
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
$file_size = $this->get_file_size($uploaded_file);
} else {
@ -519,7 +523,7 @@ class UploadHandler
// Remove path information and dots around the filename, to prevent uploading
// into different directories or replacing hidden system files.
// Also remove control characters and spaces (\x00..\x20) around the filename:
$name = trim($this->basename(stripslashes($name)), ".\x00..\x20");
$name = trim($this->basename(stripslashes($name)), "\x00..\x20");
// Use a timestamp for empty filenames:
if (!$name) {
$name = str_replace('.', '-', microtime(true));
@ -1330,6 +1334,11 @@ class UploadHandler
'',
$content_disposition_header
)) : null;
// TODO check
// if (isset($content_disposition_header) && !empty($content_disposition_header) ) {
// $file_name = str_replace('attachment; filename="', '', $content_disposition_header);
// $file_name = str_replace('"', '', $file_name);
// }
// Parse the Content-Range header, which has the following form:
// Content-Range: bytes 0-524287/2000000
$content_range_header = $this->get_server_var('HTTP_CONTENT_RANGE');

View File

@ -1,8 +1,6 @@
<?php
$config = include 'config/config.php';
//TODO switch to array
extract($config, EXTR_OVERWRITE);
require_once 'include/utils.php';
@ -25,6 +23,21 @@ if (isset($_SESSION['RF']['language']) && file_exists('lang/' . basename($_SESSI
response(trans('Lang_Not_Found').AddErrorLocation())->send();
exit;
}
//check $_GET['file']
if(isset($_GET['file']) && !checkRelativePath($_GET['file'])) {
response(trans('wrong path').AddErrorLocation())->send();
exit;
}
//check $_POST['file']
if(isset($_POST['path']) && !checkRelativePath($_POST['path'])) {
response(trans('wrong path').AddErrorLocation())->send();
exit;
}
$ftp = ftp_con($config);
if(isset($_GET['action']))
@ -52,7 +65,7 @@ if(isset($_GET['action']))
case 'filter':
if (isset($_GET['type']))
{
if (isset($remember_text_filter) && $remember_text_filter)
if (isset($config['remember_text_filter']) && $config['remember_text_filter'])
{
$_SESSION['RF']["filter"] = $_GET['type'];
}
@ -73,24 +86,10 @@ if(isset($_GET['action']))
$_SESSION['RF']["descending"] = $_GET['descending'];
}
break;
case 'image_size': // not used
$pos = strpos($_POST['path'], $upload_dir);
if ($pos !== false)
{
$info = getimagesize(substr_replace($_POST['path'], $current_path, $pos, strlen($upload_dir)));
response($info)->send();
exit;
}
break;
case 'save_img':
$info = pathinfo($_POST['name']);
if (
strpos($_POST['path'], '/') === 0
|| strpos($_POST['path'], '../') !== false
|| strpos($_POST['path'], '..\\') !== false
|| strpos($_POST['path'], './') === 0
|| (strpos($_POST['url'], 'http://s3.amazonaws.com/feather') !== 0 && strpos($_POST['url'], 'https://s3.amazonaws.com/feather') !== 0)
if ((strpos($_POST['url'], 'http://s3.amazonaws.com/feather') !== 0 && strpos($_POST['url'], 'https://s3.amazonaws.com/feather') !== 0)
|| $_POST['name'] != fix_filename($_POST['name'], $config)
|| ! in_array(strtolower($info['extension']), array( 'jpg', 'jpeg', 'png' ))
)
@ -106,7 +105,7 @@ if(isset($_GET['action']))
}
if (!checkresultingsize(strlen($image_data))) {
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
response(sprintf(trans('max_size_reached'),$config['MaxSizeTotal']).AddErrorLocation())->send();
exit;
}
if($ftp){
@ -116,42 +115,36 @@ if(isset($_GET['action']))
$temp .=".".substr(strrchr($_POST['url'],'.'),1);
file_put_contents($temp,$image_data);
$ftp->put($ftp_base_folder.$upload_dir . $_POST['path'] . $_POST['name'], $temp, FTP_BINARY);
$ftp->put($config['ftp_base_folder'].$config['upload_dir'] . $_POST['path'] . $_POST['name'], $temp, FTP_BINARY);
create_img($temp,$temp,122,91);
$ftp->put($ftp_base_folder.$ftp_thumbs_dir. $_POST['path'] . $_POST['name'], $temp, FTP_BINARY);
$ftp->put($config['ftp_base_folder'].$config['ftp_thumbs_dir']. $_POST['path'] . $_POST['name'], $temp, FTP_BINARY);
unlink($temp);
}else{
file_put_contents($current_path . $_POST['path'] . $_POST['name'],$image_data);
create_img($current_path . $_POST['path'] . $_POST['name'], $thumbs_base_path.$_POST['path'].$_POST['name'], 122, 91);
file_put_contents($config['current_path'] . $_POST['path'] . $_POST['name'],$image_data);
create_img($config['current_path'] . $_POST['path'] . $_POST['name'], $config['thumbs_base_path'].$_POST['path'].$_POST['name'], 122, 91);
// TODO something with this function cause its blowing my mind
new_thumbnails_creation(
$current_path.$_POST['path'],
$current_path.$_POST['path'].$_POST['name'],
$config['current_path'].$_POST['path'],
$config['current_path'].$_POST['path'].$_POST['name'],
$_POST['name'],
$current_path,
$config['current_path'],
$config
);
}
break;
case 'extract':
if ( strpos($_POST['path'], '/') === 0
|| strpos($_POST['path'], '../') !== false
|| strpos($_POST['path'], '..\\') !== false
|| strpos($_POST['path'], './') === 0)
{
response(trans('wrong path'.AddErrorLocation()))->send();
exit;
if(!$config['extract_files']){
response(trans('wrong action').AddErrorLocation())->send();
}
if($ftp){
$path = $ftp_base_url.$upload_dir . $_POST['path'];
$base_folder = $ftp_base_url.$upload_dir . fix_dirname($_POST['path']) . "/";
$path = $config['ftp_base_url'].$config['upload_dir'] . $_POST['path'];
$base_folder = $config['ftp_base_url'].$config['upload_dir'] . fix_dirname($_POST['path']) . "/";
}else{
$path = $current_path . $_POST['path'];
$base_folder = $current_path . fix_dirname($_POST['path']) . "/";
$path = $config['current_path'] . $_POST['path'];
$base_folder = $config['current_path'] . fix_dirname($_POST['path']) . "/";
}
$info = pathinfo($path);
@ -184,32 +177,28 @@ if(isset($_GET['action']))
$sizeTotalFinal += $aStat['size'];
}
if (!checkresultingsize($sizeTotalFinal)) {
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
response(sprintf(trans('max_size_reached'),$config['MaxSizeTotal']).AddErrorLocation())->send();
exit;
}
//make all the folders
//make all the folders and unzip into the folders
for ($i = 0; $i < $zip->numFiles; $i++)
{
$OnlyFileName = $zip->getNameIndex($i);
$FullFileName = $zip->statIndex($i);
if (substr($FullFileName['name'], -1, 1) == "/")
{
create_folder($base_folder . $FullFileName['name']);
}
}
//unzip into the folders
for ($i = 0; $i < $zip->numFiles; $i++)
{
$OnlyFileName = $zip->getNameIndex($i);
$FullFileName = $zip->statIndex($i);
if ( ! (substr($FullFileName['name'], -1, 1) == "/"))
{
$fileinfo = pathinfo($OnlyFileName);
if (in_array(strtolower($fileinfo['extension']), $ext))
if(checkRelativePath($FullFileName['name'])){
if (substr($FullFileName['name'], -1, 1) == "/")
{
copy('zip://' . $path . '#' . $OnlyFileName, $base_folder . $FullFileName['name']);
create_folder($base_folder . $FullFileName['name']);
}
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']);
}
}
}
}
@ -234,7 +223,7 @@ if(isset($_GET['action']))
$phar = new PharData($path);
$phar->decompressFiles();
$files = array();
check_files_extensions_on_phar($phar, $files, '', $ext);
check_files_extensions_on_phar($phar, $files, '', $config);
$phar->extractTo($base_folder, $files, true);
break;
@ -246,22 +235,28 @@ if(isset($_GET['action']))
if($ftp){
unlink($path);
$ftp->putAll($base_folder, "/".$ftp_base_folder . $upload_dir . fix_dirname($_POST['path']), FTP_BINARY);
$ftp->putAll($base_folder, "/".$config['ftp_base_folder'] . $config['upload_dir'] . fix_dirname($_POST['path']), FTP_BINARY);
deleteDir($base_folder);
}
break;
case 'media_preview':
if(isset($_GET['file'])){
$_GET['file'] = sanitize($_GET['file']);
}
if(isset($_GET['title'])){
$_GET['title'] = sanitize($_GET['title']);
}
if($ftp){
$preview_file = $ftp_base_url.$upload_dir . $_GET['file'];
$preview_file = $config['ftp_base_url'].$config['upload_dir'] . $_GET['file'];
}else{
$preview_file = $current_path . $_GET["file"];
$preview_file = $config['current_path'] . $_GET["file"];
}
$info = pathinfo($preview_file);
ob_start();
?>
<div id="jp_container_1" class="jp-video " style="margin:0 auto;">
<div id="jp_container_1" class="jp-video" style="margin:0 auto;">
<div class="jp-type-single">
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div class="jp-gui">
@ -308,7 +303,7 @@ if(isset($_GET['action']))
</div>
</div>
</div>
<?php if(in_array(strtolower($info['extension']), $ext_music)): ?>
<?php if(in_array(strtolower($info['extension']), $config['ext_music'])): ?>
<script type="text/javascript">
$(document).ready(function(){
@ -332,7 +327,7 @@ if(isset($_GET['action']))
});
</script>
<?php elseif(in_array(strtolower($info['extension']), $ext_video)): ?>
<?php elseif(in_array(strtolower($info['extension']), $config['ext_video'])): ?>
<script type="text/javascript">
$(document).ready(function(){
@ -371,15 +366,6 @@ if(isset($_GET['action']))
exit;
}
if (strpos($_POST['path'],'../') !== FALSE
|| strpos($_POST['path'],'./') !== FALSE
|| strpos($_POST['path'],'..\\') !== FALSE
|| strpos($_POST['path'],'.\\') !== FALSE )
{
response(trans('wrong path'.AddErrorLocation()))->send();
exit;
}
if (trim($_POST['path']) == '')
{
response(trans('no path').AddErrorLocation())->send();
@ -387,12 +373,12 @@ if(isset($_GET['action']))
}
$msg_sub_action = ($_POST['sub_action'] == 'copy' ? trans('Copy') : trans('Cut'));
$path = $current_path . $_POST['path'];
$path = $config['current_path'] . $_POST['path'];
if (is_dir($path))
{
// can't copy/cut dirs
if ($copy_cut_dirs === false)
if ($config['copy_cut_dirs'] === false)
{
response(sprintf(trans('Copy_Cut_Not_Allowed'), $msg_sub_action, trans('Folders')).AddErrorLocation())->send();
exit;
@ -400,30 +386,30 @@ if(isset($_GET['action']))
list($sizeFolderToCopy,$fileNum,$foldersCount) = folder_info($path,false);
// size over limit
if ($copy_cut_max_size !== false && is_int($copy_cut_max_size)) {
if (($copy_cut_max_size * 1024 * 1024) < $sizeFolderToCopy) {
response(sprintf(trans('Copy_Cut_Size_Limit'), $msg_sub_action, $copy_cut_max_size).AddErrorLocation())->send();
if ($config['copy_cut_max_size'] !== false && is_int($config['copy_cut_max_size'])) {
if (($config['copy_cut_max_size'] * 1024 * 1024) < $sizeFolderToCopy) {
response(sprintf(trans('Copy_Cut_Size_Limit'), $msg_sub_action, $config['copy_cut_max_size']).AddErrorLocation())->send();
exit;
}
}
// file count over limit
if ($copy_cut_max_count !== false && is_int($copy_cut_max_count))
if ($config['copy_cut_max_count'] !== false && is_int($config['copy_cut_max_count']))
{
if ($copy_cut_max_count < $fileNum)
if ($config['copy_cut_max_count'] < $fileNum)
{
response(sprintf(trans('Copy_Cut_Count_Limit'), $msg_sub_action, $copy_cut_max_count).AddErrorLocation())->send();
response(sprintf(trans('Copy_Cut_Count_Limit'), $msg_sub_action, $config['copy_cut_max_count']).AddErrorLocation())->send();
exit;
}
}
if (!checkresultingsize($sizeFolderToCopy)) {
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
response(sprintf(trans('max_size_reached'),$config['MaxSizeTotal']).AddErrorLocation())->send();
exit;
}
} else {
// can't copy/cut files
if ($copy_cut_files === false)
if ($config['copy_cut_files'] === false)
{
response(sprintf(trans('Copy_Cut_Not_Allowed'), $msg_sub_action, trans('Files')).AddErrorLocation())->send();
exit;
@ -439,10 +425,10 @@ if(isset($_GET['action']))
break;
case 'chmod':
if($ftp){
$path = $ftp_base_url . $upload_dir . $_POST['path'];
$path = $config['ftp_base_url'] . $config['upload_dir'] . $_POST['path'];
if (
($_POST['folder']==1 && $chmod_dirs === false)
|| ($_POST['folder']==0 && $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();
@ -450,10 +436,10 @@ if(isset($_GET['action']))
}
$info = $_POST['permissions'];
}else{
$path = $current_path . $_POST['path'];
$path = $config['current_path'] . $_POST['path'];
if (
(is_dir($path) && $chmod_dirs === false)
|| (is_file($path) && $chmod_files === false)
(is_dir($path) && $config['chmod_dirs'] === false)
|| (is_file($path) && $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();
@ -586,9 +572,9 @@ if(isset($_GET['action']))
break;
case 'cad_preview':
if($ftp){
$selected_file = $ftp_base_url.$upload_dir . $_GET['file'];
$selected_file = $config['ftp_base_url'].$config['upload_dir'] . $_GET['file'];
}else{
$selected_file = $current_path . $_GET['file'];
$selected_file = $config['current_path'] . $_GET['file'];
if ( ! file_exists($selected_file))
{
@ -599,7 +585,7 @@ if(isset($_GET['action']))
if($ftp){
$url_file = $selected_file;
}else{
$url_file = $base_url . $upload_dir . str_replace($current_path, '', $_GET["file"]);
$url_file = $config['base_url'] . $config['upload_dir'] . str_replace($config['current_path'], '', $_GET["file"]);
}
$cad_url = urlencode($url_file);
@ -618,9 +604,9 @@ if(isset($_GET['action']))
}
if($ftp){
$selected_file = ($sub_action == 'preview' ? $ftp_base_url.$upload_dir . $_GET['file'] : $ftp_base_url.$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' ? $current_path . $_GET['file'] : $current_path . $_POST['path']);
$selected_file = ($sub_action == 'preview' ? $config['current_path'] . $_GET['file'] : $config['current_path'] . $_POST['path']);
if ( ! file_exists($selected_file))
{
@ -633,11 +619,11 @@ if(isset($_GET['action']))
if ($preview_mode == 'text')
{
$is_allowed = ($sub_action == 'preview' ? $preview_text_files : $edit_text_files);
$allowed_file_exts = ($sub_action == 'preview' ? $previewable_text_file_exts : $editable_text_file_exts);
$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 = $googledoc_enabled;
$allowed_file_exts = $googledoc_file_exts;
$is_allowed = $config['googledoc_enabled'];
$allowed_file_exts = $config['googledoc_file_exts'];
}
if ( ! isset($allowed_file_exts) || ! is_array($allowed_file_exts))
@ -645,6 +631,9 @@ if(isset($_GET['action']))
$allowed_file_exts = array();
}
if(!isset($info['extension'])){
$info['extension']='';
}
if ( ! in_array($info['extension'], $allowed_file_exts)
|| ! isset($is_allowed)
|| $is_allowed === false
@ -663,29 +652,29 @@ if(isset($_GET['action']))
$data = htmlspecialchars(htmlspecialchars_decode($data));
$ret = '';
if ( ! in_array($info['extension'],$previewable_text_file_exts_no_prettify))
{
$ret .= '<script src="https://rawgit.com/google/code-prettify/master/loader/run_prettify.js?autoload=true&skin=sunburst"></script>';
$ret .= '<?prettify lang='.$info['extension'].' linenums=true?><pre class="prettyprint"><code class="language-'.$info['extension'].'">'.$data.'</code></pre>';
} else {
$ret .= '<pre class="no-prettify">'.$data.'</pre>';
}
$ret .= '<script src="https://rawgit.com/google/code-prettify/master/loader/run_prettify.js?autoload=true&skin=sunburst"></script>';
$ret .= '<?prettify lang='.$info['extension'].' linenums=true?><pre class="prettyprint"><code class="language-'.$info['extension'].'">'.$data.'</code></pre>';
}
elseif ($preview_mode == 'google') {
if($ftp){
$url_file = $selected_file;
}else{
$url_file = $base_url . $upload_dir . str_replace($current_path, '', $_GET["file"]);
$url_file = $config['base_url'] . $config['upload_dir'] . str_replace($config['current_path'], '', $_GET["file"]);
}
$googledoc_url = urlencode($url_file);
$googledoc_html = "<iframe src=\"https://docs.google.com/viewer?url=" . $url_file . "&embedded=true\" class=\"google-iframe\"></iframe>";
$ret = $googledoc_html;
$ret = "<iframe src=\"https://docs.google.com/viewer?url=" . $url_file . "&embedded=true\" class=\"google-iframe\"></iframe>";
}
} else {
}else{
$data = stripslashes(htmlspecialchars(file_get_contents($selected_file)));
$ret = '<textarea id="textfile_edit_area" style="width:100%;height:300px;">'.$data.'</textarea>';
if(in_array($info['extension'],array('html','html'))){
$ret = '<script src="https://cdn.ckeditor.com/ckeditor5/11.1.1/classic/ckeditor.js"></script><textarea id="textfile_edit_area" style="width:100%;height:300px;">'.$data.'</textarea><script>setTimeout(function(){ ClassicEditor
.create( document.querySelector( "#textfile_edit_area" ),{ }).then( newEditor => { window.editor = newEditor; } ); }, 500);</script>';
}else{
$ret = '<textarea id="textfile_edit_area" style="width:100%;height:300px;">'.$data.'</textarea>';
}
}
response($ret)->send();
@ -700,4 +689,3 @@ if(isset($_GET['action']))
response(trans('no action passed').AddErrorLocation())->send();
exit;
}
?>

View File

@ -1,5 +1,5 @@
<?php
$version = "9.13.1";
$version = "9.13.4";
if (session_id() == '') session_start();
mb_internal_encoding('UTF-8');
@ -149,14 +149,14 @@ $config = array(
|--------------------------------------------------------------------------
| The user can delete multiple files, select all files , deselect all files
*/
'multiple_selection' => false,
'multiple_selection' => true,
/*
|
| The user can have a select button that pass a json to external input or pass the first file selected to editor
| If you use responsivefilemanager tinymce extension can copy into editor multiple object like images, videos, audios, links in the same time
|
*/
'multiple_selection_action_button' => false,
'multiple_selection_action_button' => true,
/*
|--------------------------------------------------------------------------
@ -330,23 +330,28 @@ $config = array(
'rename_files' => true,
'rename_folders' => true,
'duplicate_files' => true,
'extract_files' => true,
'copy_cut_files' => true, // for copy/cut files
'copy_cut_dirs' => true, // for copy/cut directories
'chmod_files' => true, // change file permissions
'chmod_dirs' => true, // change folder permissions
'preview_text_files' => true, // eg.: txt, log etc.
'edit_text_files' => true, // eg.: txt, log etc.
'create_text_files' => true, // only create files with exts. defined in $editable_text_file_exts
'create_text_files' => true, // only create files with exts. defined in $config['editable_text_file_exts']
'download_files' => true, // allow download files or just preview
// you can preview these type of files if $preview_text_files is true
'previewable_text_file_exts' => array( "bsh", "c","css", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html", "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh", "xhtml", "xml","xsl" ),
'previewable_text_file_exts_no_prettify' => array( 'txt', 'log' ),
'previewable_text_file_exts' => array( "bsh", "c","css", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html", "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh", "xhtml", "xml","xsl",'txt', 'log','' ),
// you can edit these type of files if $edit_text_files is true (only text based files)
// you can create these type of files if $create_text_files is true (only text based files)
// you can create these type of files if $config['create_text_files'] is true (only text based files)
// if you want you can add html,css etc.
// but for security reasons it's NOT RECOMMENDED!
'editable_text_file_exts' => array( 'txt', 'log', 'xml', 'html', 'css', 'htm', 'js' ),
'editable_text_file_exts' => array( 'txt', 'log', 'xml', 'html', 'css', 'htm', 'js','' ),
'jplayer_exts' => array("mp4","flv","webmv","webma","webm","m4a","m4v","ogv","oga","mp3","midi","mid","ogg","wav"),
'cad_exts' => array('dwg', 'dxf', 'hpgl', 'plt', 'spl', 'step', 'stp', 'iges', 'igs', 'sat', 'cgm', 'svg'),
// Preview with Google Documents
'googledoc_enabled' => true,
@ -363,8 +368,8 @@ $config = array(
//**********************
//Allowed extensions (lowercase insert)
//**********************
'ext_img' => array( 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'svg', 'ico' ), //Images
'ext_file' => array( 'doc', 'docx', 'rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv', 'html', 'xhtml', 'psd', 'sql', 'log', 'fla', 'xml', 'ade', 'adp', 'mdb', 'accdb', 'ppt', 'pptx', 'odt', 'ots', 'ott', 'odb', 'odg', 'otp', 'otg', 'odf', 'ods', 'odp', 'css', 'ai', 'kmz','dwg', 'dxf', 'hpgl', 'plt', 'spl', 'step', 'stp', 'iges', 'igs', 'sat', 'cgm', 'tiff'), //Files
'ext_img' => array( 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff','svg', 'ico' ), //Images
'ext_file' => array( 'doc', 'docx', 'rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv', 'html', 'xhtml', 'psd', 'sql', 'log', 'fla', 'xml', 'ade', 'adp', 'mdb', 'accdb', 'ppt', 'pptx', 'odt', 'ots', 'ott', 'odb', 'odg', 'otp', 'otg', 'odf', 'ods', 'odp', 'css', 'ai', 'kmz','dwg', 'dxf', 'hpgl', 'plt', 'spl', 'step', 'stp', 'iges', 'igs', 'sat', 'cgm', 'tiff',''), //Files
'ext_video' => array( 'mov', 'mpeg', 'm4v', 'mp4', 'avi', 'mpg', 'wma', "flv", "webm" ), //Video
'ext_music' => array( 'mp3', 'mpga', 'm4a', 'ac3', 'aiff', 'mid', 'ogg', 'wav' ), //Audio
'ext_misc' => array( 'zip', 'rar', 'gz', 'tar', 'iso', 'dmg' ), //Archives
@ -374,7 +379,21 @@ $config = array(
// If you insert an extensions blacklist array the filemanager don't check any extensions but simply block the extensions in the list
// otherwise check Allowed extensions configuration
//*********************
'ext_blacklist' => false, //['jpg'],
'ext_blacklist' => false,//['exe','bat','jpg'],
//Empty filename permits like .htaccess, .env, ...
'empty_filename' => false,
/*
|--------------------------------------------------------------------------
| accept files without extension
|--------------------------------------------------------------------------
|
| If you want to accept files without extension, remember to add '' extension on allowed extension
|
*/
'files_without_extension' => false,
/******************
* AVIARY config
@ -480,4 +499,3 @@ return array_merge(
),
)
);
?>

Binary file not shown.

View File

@ -4,17 +4,14 @@ $time = time();
$config = include 'config/config.php';
//TODO switch to array
extract($config, EXTR_OVERWRITE);
if (USE_ACCESS_KEYS == TRUE){
if (!isset($_GET['akey'], $access_keys) || empty($access_keys)){
if (!isset($_GET['akey'], $config['access_keys']) || empty($config['access_keys'])){
die('Access Denied!');
}
$_GET['akey'] = strip_tags(preg_replace( "/[^a-zA-Z0-9\._-]/", '', $_GET['akey']));
if (!in_array($_GET['akey'], $access_keys)){
if (!in_array($_GET['akey'], $config['access_keys'])){
die('Access Denied!');
}
}
@ -24,19 +21,22 @@ $_SESSION['RF']["verify"] = "RESPONSIVEfilemanager";
if(isset($_POST['submit'])){
include 'upload.php';
}else{
$config['default_language'] = $config['default_language'];
$available_languages = include 'lang/languages.php';
$lang = $config['default_language'];
$languages = include 'lang/languages.php';
if (isset($_GET['lang']))
{
$lang = strip_tags($_GET['lang']);
if(array_key_exists($lang,$languages)){
$_SESSION['RF']['language'] = $lang;
list($preferred_language) = array_values(array_filter(array(
isset($_GET['lang']) ? $_GET['lang'] : null,
isset($_SESSION['RF']['language']) ? $_SESSION['RF']['language'] : null,
$config['default_language']
)));
if(array_key_exists($preferred_language, $available_languages))
{
$_SESSION['RF']['language'] = $preferred_language;
}
}elseif(isset($_SESSION['RF']['language']) && $_SESSION['RF']['language'])
$lang = strip_tags($_SESSION['RF']['language']);
if(array_key_exists($lang,$languages)){
$_SESSION['RF']['language'] = $lang;
else
{
$_SESSION['RF']['language'] = $config['default_language'];
}
}
include 'include/utils.php';
@ -47,10 +47,8 @@ if (isset($_GET['fldr']) && !empty($_GET['fldr'])) {
}elseif(isset($_SESSION['RF']['fldr']) && !empty($_SESSION['RF']['fldr'])){
$subdir_path = rawurldecode(trim(strip_tags($_SESSION['RF']['fldr']),"/"));
}
if (strpos($subdir_path,'../') === FALSE
&& strpos($subdir_path,'./') === FALSE
&& strpos($subdir_path,'..\\') === FALSE
&& strpos($subdir_path,'.\\') === FALSE)
if ( checkRelativePath($subdir_path))
{
$subdir = strip_tags($subdir_path) ."/";
$_SESSION['RF']['fldr'] = $subdir_path;
@ -70,11 +68,11 @@ setcookie('last_position',$subdir,time() + (86400 * 7));
if ($subdir == "/") { $subdir = ""; }
// If hidden folders are specified
if(count($hidden_folders)){
if(count($config['hidden_folders'])){
// If hidden folder appears in the path specified in URL parameter "fldr"
$dirs = explode('/', $subdir);
foreach($dirs as $dir){
if($dir !== '' && in_array($dir, $hidden_folders)){
if($dir !== '' && in_array($dir, $config['hidden_folders'])){
// Ignore the path
$subdir = "";
break;
@ -82,8 +80,8 @@ if(count($hidden_folders)){
}
}
if ($show_total_size) {
list($sizeCurrentFolder,$fileCurrentNum,$foldersCurrentCount) = folder_info($current_path,false);
if ($config['show_total_size']) {
list($sizeCurrentFolder,$fileCurrentNum,$foldersCurrentCount) = folder_info($config['current_path'],false);
}
/***
*SUB-DIR CODE
@ -94,9 +92,10 @@ if (!isset($_SESSION['RF']["subfolder"]))
}
$rfm_subfolder = '';
if (!empty($_SESSION['RF']["subfolder"]) && strpos($_SESSION['RF']["subfolder"],'../') === FALSE && strpos($_SESSION['RF']["subfolder"],'..\\') === FALSE
&& strpos($_SESSION['RF']["subfolder"],'./') === FALSE && strpos($_SESSION['RF']["subfolder"],"/") !== 0
&& strpos($_SESSION['RF']["subfolder"],'.') === FALSE)
if (!empty($_SESSION['RF']["subfolder"])
&& strpos($_SESSION['RF']["subfolder"],"/") !== 0
&& strpos($_SESSION['RF']["subfolder"],'.') === FALSE
)
{
$rfm_subfolder = $_SESSION['RF']['subfolder'];
}
@ -105,23 +104,23 @@ if ($rfm_subfolder != "" && $rfm_subfolder[strlen($rfm_subfolder)-1] != "/") { $
$ftp=ftp_con($config);
if (($ftp && !$ftp->isDir($ftp_base_folder.$upload_dir.$rfm_subfolder.$subdir)) || (!$ftp && !file_exists($current_path.$rfm_subfolder.$subdir)))
if (($ftp && !$ftp->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 = $upload_dir.$rfm_subfolder.$subdir;
$cur_path = $current_path.$rfm_subfolder.$subdir;
$thumbs_path = $thumbs_base_path.$rfm_subfolder;
$cur_dir = $config['upload_dir'].$rfm_subfolder.$subdir;
$cur_path = $config['current_path'].$rfm_subfolder.$subdir;
$thumbs_path = $config['thumbs_base_path'].$rfm_subfolder;
$parent = $rfm_subfolder.$subdir;
if($ftp){
$cur_dir = $ftp_base_folder.$cur_dir;
$cur_dir = $config['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;
$thumbs_path = str_replace(array('/..','..'),'',$config['ftp_base_folder'].$config['ftp_thumbs_dir'].$rfm_subfolder);
$parent = $config['ftp_base_folder'].$parent;
}
if(!$ftp){
@ -132,11 +131,10 @@ if(!$ftp){
$i++;
if ($parent=="./") $parent="";
if (file_exists($current_path.$parent."config.php"))
if (file_exists($config['current_path'].$parent."config.php"))
{
$configTemp = include $current_path.$parent.'config.php';
$configTemp = include $config['current_path'].$parent.'config.php';
$config = array_merge($config,$configTemp);
extract($config, EXTR_OVERWRITE);
$cycle = FALSE;
}
@ -192,7 +190,7 @@ $crossdomain=!!$crossdomain;
//view type
if(!isset($_SESSION['RF']["view_type"]))
{
$view = $default_view;
$view = $config['default_view'];
$_SESSION['RF']["view_type"] = $view;
}
@ -253,7 +251,7 @@ if (isset($_GET['extensions'])){
$ext_tmp = array();
foreach($extensions as $extension){
$extension = fix_strtolower($extension);
if(in_array( $extension, $config['ext'])){
if(check_file_extension( $extension, $config)){
$ext_tmp[]=$extension;
}
}
@ -311,7 +309,7 @@ $get_params['fldr'] ='';
$get_params = http_build_query($get_params);
?>
<!DOCTYPE html>
<html xmlns="https://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -325,7 +323,7 @@ $get_params = http_build_query($get_params);
<!-- CSS adjustments for browsers with JavaScript disabled -->
<noscript><link rel="stylesheet" href="css/jquery.fileupload-noscript.css"></noscript>
<noscript><link rel="stylesheet" href="css/jquery.fileupload-ui-noscript.css"></noscript>
<link href="js/jPlayer/skin/blue.monday/jplayer.blue.monday.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jplayer/2.2.0/skin/blue.monday/jplayer.blue.monday.min.css" />
<link href="css/style.css?v=<?php echo $version; ?>" rel="stylesheet" type="text/css" />
<!--[if lt IE 8]><style>
.img-container span, .img-container-mini span {
@ -337,11 +335,11 @@ $get_params = http_build_query($get_params);
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js" type="text/javascript"></script>
<script src="js/plugins.js?v=<?php echo $version; ?>"></script>
<script src="js/jPlayer/jquery.jplayer/jquery.jplayer.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jplayer/2.9.2/jplayer/jquery.jplayer.min.js"></script>
<script src="js/modernizr.custom.js"></script>
<?php
if ($aviary_active){
if ($config['aviary_active']){
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) { ?>
<script src="https://dme0ih8comzn4.cloudfront.net/imaging/v3/editor.js"></script>
<?php }else{ ?>
@ -354,12 +352,12 @@ $get_params = http_build_query($get_params);
<![endif]-->
<script>
var ext_img=new Array('<?php echo implode("','", $ext_img)?>');
var image_editor=<?php echo $aviary_active?"true":"false";?>;
var ext_img=new Array('<?php echo implode("','", $config['ext_img'])?>');
var image_editor=<?php echo $config['aviary_active']?"true":"false";?>;
if (image_editor) {
var featherEditor = new Aviary.Feather({
<?php
foreach ($aviary_defaults_config as $aopt_key => $aopt_val) {
foreach ($config['aviary_defaults_config'] as $aopt_key => $aopt_val) {
echo $aopt_key.": ".json_encode($aopt_val).",";
} ?>
onReady: function() {
@ -430,7 +428,7 @@ $get_params = http_build_query($get_params);
<input type="hidden" id="field_id" value="<?php echo $field_id;?>" />
<input type="hidden" id="multiple" value="<?php echo $multiple;?>" />
<input type="hidden" id="type_param" value="<?php echo $type_param;?>" />
<input type="hidden" id="upload_dir" value="<?php echo $upload_dir;?>" />
<input type="hidden" id="upload_dir" value="<?php echo $config['upload_dir'];?>" />
<input type="hidden" id="cur_dir" value="<?php echo $cur_dir;?>" />
<input type="hidden" id="cur_dir_thumb" value="<?php echo $thumbs_path.$subdir;?>" />
<input type="hidden" id="insert_folder_name" value="<?php echo trans('Insert_Folder_Name');?>" />
@ -440,21 +438,21 @@ $get_params = http_build_query($get_params);
<input type="hidden" id="cancel" value="<?php echo trans('Cancel');?>" />
<input type="hidden" id="rename" value="<?php echo trans('Rename');?>" />
<input type="hidden" id="lang_duplicate" value="<?php echo trans('Duplicate');?>" />
<input type="hidden" id="duplicate" value="<?php if($duplicate_files) echo 1; else echo 0;?>" />
<input type="hidden" id="base_url" value="<?php echo $base_url?>"/>
<input type="hidden" id="ftp_base_url" value="<?php echo $ftp_base_url?>"/>
<input type="hidden" id="duplicate" value="<?php if($config['duplicate_files']) echo 1; else echo 0;?>" />
<input type="hidden" id="base_url" value="<?php echo $config['base_url']?>"/>
<input type="hidden" id="ftp_base_url" value="<?php echo $config['ftp_base_url']?>"/>
<input type="hidden" id="fldr_value" value="<?php echo $subdir;?>"/>
<input type="hidden" id="sub_folder" value="<?php echo $rfm_subfolder;?>"/>
<input type="hidden" id="return_relative_url" value="<?php echo $return_relative_url == true ? 1 : 0;?>"/>
<input type="hidden" id="file_number_limit_js" value="<?php echo $file_number_limit_js;?>" />
<input type="hidden" id="file_number_limit_js" value="<?php echo $config['file_number_limit_js'];?>" />
<input type="hidden" id="sort_by" value="<?php echo $sort_by;?>" />
<input type="hidden" id="descending" value="<?php echo $descending?1:0;?>" />
<input type="hidden" id="current_url" value="<?php echo str_replace(array('&filter='.$filter,'&sort_by='.$sort_by,'&descending='.intval($descending)),array(''),$base_url.$_SERVER['REQUEST_URI']);?>" />
<input type="hidden" id="current_url" value="<?php echo str_replace(array('&filter='.$filter,'&sort_by='.$sort_by,'&descending='.intval($descending)),array(''),$config['base_url'].$_SERVER['REQUEST_URI']);?>" />
<input type="hidden" id="lang_show_url" value="<?php echo trans('Show_url');?>" />
<input type="hidden" id="copy_cut_files_allowed" value="<?php if($config['copy_cut_files']) echo 1; else echo 0;?>" />
<input type="hidden" id="copy_cut_dirs_allowed" value="<?php if($config['copy_cut_dirs']) echo 1; else echo 0;?>" />
<input type="hidden" id="copy_cut_max_size" value="<?php echo $copy_cut_max_size;?>" />
<input type="hidden" id="copy_cut_max_count" value="<?php echo $copy_cut_max_count;?>" />
<input type="hidden" id="copy_cut_max_size" value="<?php echo $config['copy_cut_max_size'];?>" />
<input type="hidden" id="copy_cut_max_count" value="<?php echo $config['copy_cut_max_count'];?>" />
<input type="hidden" id="lang_copy" value="<?php echo trans('Copy');?>" />
<input type="hidden" id="lang_cut" value="<?php echo trans('Cut');?>" />
<input type="hidden" id="lang_paste" value="<?php echo trans('Paste');?>" />
@ -466,10 +464,10 @@ $get_params = http_build_query($get_params);
<input type="hidden" id="clipboard" value="<?php echo ((isset($_SESSION['RF']['clipboard']['path']) && trim($_SESSION['RF']['clipboard']['path']) != null) ? 1 : 0);?>" />
<input type="hidden" id="lang_clear_clipboard_confirm" value="<?php echo trans('Clear_Clipboard_Confirm');?>" />
<input type="hidden" id="lang_file_permission" value="<?php echo trans('File_Permission');?>" />
<input type="hidden" id="chmod_files_allowed" value="<?php if($chmod_files) echo 1; else echo 0;?>" />
<input type="hidden" id="chmod_dirs_allowed" value="<?php if($chmod_dirs) echo 1; else echo 0;?>" />
<input type="hidden" id="chmod_files_allowed" value="<?php if($config['chmod_files']) echo 1; else echo 0;?>" />
<input type="hidden" id="chmod_dirs_allowed" value="<?php if($config['chmod_dirs']) echo 1; else echo 0;?>" />
<input type="hidden" id="lang_lang_change" value="<?php echo trans('Lang_Change');?>" />
<input type="hidden" id="edit_text_files_allowed" value="<?php if($edit_text_files) echo 1; else echo 0;?>" />
<input type="hidden" id="edit_text_files_allowed" value="<?php if($config['edit_text_files']) echo 1; else echo 0;?>" />
<input type="hidden" id="lang_edit_file" value="<?php echo trans('Edit_File');?>" />
<input type="hidden" id="lang_new_file" value="<?php echo trans('New_File');?>" />
<input type="hidden" id="lang_filename" value="<?php echo trans('Filename');?>" />
@ -478,13 +476,14 @@ $get_params = http_build_query($get_params);
<input type="hidden" id="lang_error_upload" value="<?php echo trans('Error_Upload');?>" />
<input type="hidden" id="lang_select" value="<?php echo trans('Select');?>" />
<input type="hidden" id="lang_extract" value="<?php echo trans('Extract');?>" />
<input type="hidden" id="transliteration" value="<?php echo $transliteration?"true":"false";?>" />
<input type="hidden" id="convert_spaces" value="<?php echo $convert_spaces?"true":"false";?>" />
<input type="hidden" id="replace_with" value="<?php echo $convert_spaces? $replace_with : "";?>" />
<input type="hidden" id="lower_case" value="<?php echo $lower_case?"true":"false";?>" />
<input type="hidden" id="show_folder_size" value="<?php echo $show_folder_size;?>" />
<input type="hidden" id="add_time_to_img" value="<?php echo $add_time_to_img;?>" />
<?php if($upload_files){ ?>
<input type="hidden" id="extract_files" value="<?php if($config['extract_files']) echo 1; else echo 0;?>" />
<input type="hidden" id="transliteration" value="<?php echo $config['transliteration']?"true":"false";?>" />
<input type="hidden" id="convert_spaces" value="<?php echo $config['convert_spaces']?"true":"false";?>" />
<input type="hidden" id="replace_with" value="<?php echo $config['convert_spaces']? $config['replace_with'] : "";?>" />
<input type="hidden" id="lower_case" value="<?php echo $config['lower_case']?"true":"false";?>" />
<input type="hidden" id="show_folder_size" value="<?php echo $config['show_folder_size'];?>" />
<input type="hidden" id="add_time_to_img" value="<?php echo $config['add_time_to_img'];?>" />
<?php if($config['upload_files']){ ?>
<!-- uploader div start -->
<div class="uploader">
<div class="flex">
@ -496,7 +495,7 @@ $get_params = http_build_query($get_params);
<div class="container1">
<ul class="nav nav-tabs">
<li class="active"><a href="#baseUpload" data-toggle="tab"><?php echo trans('Upload_base');?></a></li>
<?php if($url_upload){ ?>
<?php if($config['url_upload']){ ?>
<li><a href="#urlUpload" data-toggle="tab"><?php echo trans('Upload_url');?></a></li>
<?php } ?>
</ul>
@ -601,7 +600,7 @@ $get_params = http_build_query($get_params);
{% } %}
</script>
</div>
<?php if($url_upload){ ?>
<?php if($config['url_upload']){ ?>
<div class="tab-pane" id="urlUpload">
<br/>
<form class="form-horizontal">
@ -634,9 +633,9 @@ $class_ext = '';
$src = '';
if($ftp){
try{
$files = $ftp->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);
$files = $ftp->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: ";
@ -645,7 +644,7 @@ if($ftp){
die();
}
}else{
$files = scandir($current_path.$rfm_subfolder.$subdir);
$files = scandir($config['current_path'].$rfm_subfolder.$subdir);
}
$n_files= count($files);
@ -664,11 +663,14 @@ foreach($files as $k=>$file){
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,
@ -680,16 +682,17 @@ foreach($files as $k=>$file){
if($file!="." && $file!=".."){
if(is_dir($current_path.$rfm_subfolder.$subdir.$file)){
$date=filemtime($current_path.$rfm_subfolder.$subdir. $file);
if(is_dir($config['current_path'].$rfm_subfolder.$subdir.$file)){
$date=filemtime($config['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);
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,
@ -697,17 +700,18 @@ foreach($files as $k=>$file){
'permissions' =>'',
'extension'=>fix_strtolower($file_ext)
);
if($show_folder_size){
if($config['show_folder_size']){
$sorted[$k]['nfiles'] = $nfiles;
$sorted[$k]['nfolders'] = $nfolders;
}
}else{
$current_files_number++;
$file_path=$current_path.$rfm_subfolder.$subdir.$file;
$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,
@ -720,18 +724,52 @@ foreach($files as $k=>$file){
}
}
function filenameSort($x, $y) {
return $x['file_lcase'] < $y['file_lcase'];
global $descending;
if($x['is_dir'] !== $y['is_dir']){
return $y['is_dir'];
} else {
return ($descending)
? $x['file_lcase'] < $y['file_lcase']
: $x['file_lcase'] >= $y['file_lcase'];
}
}
function dateSort($x, $y) {
return $x['date'] < $y['date'];
global $descending;
if($x['is_dir'] !== $y['is_dir']){
return $y['is_dir'];
} else {
return ($descending)
? $x['date'] < $y['date']
: $x['date'] >= $y['date'];
}
}
function sizeSort($x, $y) {
return $x['size'] < $y['size'];
global $descending;
if($x['is_dir'] !== $y['is_dir']){
return $y['is_dir'];
} else {
return ($descending)
? $x['size'] < $y['size']
: $x['size'] >= $y['size'];
}
}
function extensionSort($x, $y) {
return $x['extension'] < $y['extension'];
global $descending;
if($x['is_dir'] !== $y['is_dir']){
return $y['is_dir'];
} else {
return ($descending)
? $x['extension'] < $y['extension']
: $x['extension'] >= $y['extension'];
}
}
switch($sort_by){
@ -749,15 +787,12 @@ switch($sort_by){
break;
}
if(!$descending){
$sorted=array_reverse($sorted);
}
if($subdir!=""){
$sorted = array_merge(array(array('file'=>'..')),$sorted);
}
$files=$sorted;
?>
<!-- header div start -->
<div class="navbar navbar-fixed-top">
@ -773,13 +808,13 @@ $files=$sorted;
<div class="filters">
<div class="row-fluid">
<div class="span4 half">
<?php if($upload_files){ ?>
<?php if($config['upload_files']){ ?>
<button class="tip btn upload-btn" title="<?php echo trans('Upload_file');?>"><i class="rficon-upload"></i></button>
<?php } ?>
<?php if($create_text_files){ ?>
<?php if($config['create_text_files']){ ?>
<button class="tip btn create-file-btn" title="<?php echo trans('New_File');?>"><i class="icon-plus"></i><i class="icon-file"></i></button>
<?php } ?>
<?php if($create_folders){ ?>
<?php if($config['create_folders']){ ?>
<button class="tip btn new-folder" title="<?php echo trans('New_Folder')?>"><i class="icon-plus"></i><i class="icon-folder-open"></i></button>
<?php } ?>
<?php if($config['copy_cut_files'] || $config['copy_cut_dirs']){ ?>
@ -807,28 +842,28 @@ $files=$sorted;
<div class="span6 entire types">
<span><?php echo trans('Filters');?>:</span>
<?php if($_GET['type']!=1 && $_GET['type']!=3 && $config['show_filter_buttons']){ ?>
<?php if(count($ext_file)>0 or false){ ?>
<?php if(count($config['ext_file'])>0 or false){ ?>
<input id="select-type-1" name="radio-sort" type="radio" data-item="ff-item-type-1" checked="checked" class="hide" />
<label id="ff-item-type-1" title="<?php echo trans('Files');?>" for="select-type-1" class="tip btn ff-label-type-1"><i class="icon-file"></i></label>
<?php } ?>
<?php if(count($ext_img)>0 or false){ ?>
<?php if(count($config['ext_img'])>0 or false){ ?>
<input id="select-type-2" name="radio-sort" type="radio" data-item="ff-item-type-2" class="hide" />
<label id="ff-item-type-2" title="<?php echo trans('Images');?>" for="select-type-2" class="tip btn ff-label-type-2"><i class="icon-picture"></i></label>
<?php } ?>
<?php if(count($ext_misc)>0 or false){ ?>
<?php if(count($config['ext_misc'])>0 or false){ ?>
<input id="select-type-3" name="radio-sort" type="radio" data-item="ff-item-type-3" class="hide" />
<label id="ff-item-type-3" title="<?php echo trans('Archives');?>" for="select-type-3" class="tip btn ff-label-type-3"><i class="icon-inbox"></i></label>
<?php } ?>
<?php if(count($ext_video)>0 or false){ ?>
<?php if(count($config['ext_video'])>0 or false){ ?>
<input id="select-type-4" name="radio-sort" type="radio" data-item="ff-item-type-4" class="hide" />
<label id="ff-item-type-4" title="<?php echo trans('Videos');?>" for="select-type-4" class="tip btn ff-label-type-4"><i class="icon-film"></i></label>
<?php } ?>
<?php if(count($ext_music)>0 or false){ ?>
<?php if(count($config['ext_music'])>0 or false){ ?>
<input id="select-type-5" name="radio-sort" type="radio" data-item="ff-item-type-5" class="hide" />
<label id="ff-item-type-5" title="<?php echo trans('Music');?>" for="select-type-5" class="tip btn ff-label-type-5"><i class="icon-music"></i></label>
<?php } ?>
<?php } ?>
<input accesskey="f" type="text" class="filter-input <?php echo (($_GET['type']!=1 && $_GET['type']!=3) ? '' : 'filter-input-notype');?>" id="filter-input" name="filter" placeholder="<?php echo fix_strtolower(trans('Text_filter'));?>..." value="<?php echo $filter;?>"/><?php if($n_files>$file_number_limit_js){ ?><label id="filter" class="btn"><i class="icon-play"></i></label><?php } ?>
<input accesskey="f" type="text" class="filter-input <?php echo (($_GET['type']!=1 && $_GET['type']!=3) ? '' : 'filter-input-notype');?>" id="filter-input" name="filter" placeholder="<?php echo fix_strtolower(trans('Text_filter'));?>..." value="<?php echo $filter;?>"/><?php if($n_files>$config['file_number_limit_js']){ ?><label id="filter" class="btn"><i class="icon-play"></i></label><?php } ?>
<input id="select-type-all" name="radio-sort" type="radio" data-item="ff-item-type-all" class="hide" />
<label id="ff-item-type-all" title="<?php echo trans('All');?>" <?php if($_GET['type']==1 || $_GET['type']==3){ ?>style="visibility: hidden;" <?php } ?> data-item="ff-item-type-all" for="select-type-all" style="margin-rigth:0px;" class="tip btn btn-inverse ff-label-type-all"><i class="icon-remove icon-white"></i></label>
@ -867,7 +902,7 @@ $files=$sorted;
?>
<li class="pull-right"><a class="btn-small" href="javascript:void('')" id="info"><i class="icon-question-sign"></i></a></li>
<?php if($show_language_selection){ ?>
<?php if($config['show_language_selection']){ ?>
<li class="pull-right"><a class="btn-small" href="javascript:void('')" id="change_lang_btn"><i class="icon-globe"></i></a></li>
<?php } ?>
<li class="pull-right"><a id="refresh" class="btn-small" href="dialog.php?<?php echo $get_params.$subdir."&".uniqid() ?>"><i class="icon-refresh"></i></a></li>
@ -888,8 +923,8 @@ $files=$sorted;
</div>
</li>
<li><small class="hidden-phone">(<span id="files_number"><?php echo $current_files_number."</span> ".trans('Files')." - <span id='folders_number'>".$current_folders_number."</span> ".trans('Folders');?>)</small></li>
<?php if($show_total_size){ ?>
<li><small class="hidden-phone"><span title="<?php echo trans('total size').$MaxSizeTotal;?>"><?php echo trans('total size').": ".makeSize($sizeCurrentFolder).(($MaxSizeTotal !== false && is_int($MaxSizeTotal))? '/'.$MaxSizeTotal.' '.trans('MB'):'');?></span></small>
<?php if($config['show_total_size']){ ?>
<li><small class="hidden-phone"><span title="<?php echo trans('total size').$config['MaxSizeTotal'];?>"><?php echo trans('total size').": ".makeSize($sizeCurrentFolder).(($config['MaxSizeTotal'] !== false && is_int($config['MaxSizeTotal']))? '/'.$config['MaxSizeTotal'].' '.trans('MB'):'');?></span></small>
</li>
<?php } ?>
</ul>
@ -897,15 +932,15 @@ $files=$sorted;
<!-- breadcrumb div end -->
<div class="row-fluid ff-container">
<div class="span12">
<?php if( ($ftp && !$ftp->isDir($ftp_base_folder.$upload_dir.$rfm_subfolder.$subdir)) || (!$ftp && @opendir($current_path.$rfm_subfolder.$subdir)===FALSE)){ ?>
<?php if( ($ftp && !$ftp->isDir($config['ftp_base_folder'].$config['upload_dir'].$rfm_subfolder.$subdir)) || (!$ftp && @opendir($config['current_path'].$rfm_subfolder.$subdir)===FALSE)){ ?>
<br/>
<div class="alert alert-error">There is an error! The upload folder there isn't. Check your config.php file. </div>
<?php }else{ ?>
<h4 id="help"><?php echo trans('Swipe_help');?></h4>
<?php if(isset($folder_message)){ ?>
<div class="alert alert-block"><?php echo $folder_message;?></div>
<?php if(isset($config['folder_message'])){ ?>
<div class="alert alert-block"><?php echo $config['folder_message'];?></div>
<?php } ?>
<?php if($show_sorting_bar){ ?>
<?php if($config['show_sorting_bar']){ ?>
<!-- sorter -->
<div class="sorter-container <?php echo "list-view".$view;?>">
<div class="file-name"><a class="sorter sort-name <?php if($sort_by=="name"){ echo ($descending)?"descending":"ascending"; } ?>" href="javascript:void('')" data-sort="name"><?php echo trans('Filename');?></a></div>
@ -921,18 +956,17 @@ $files=$sorted;
<!--ul class="thumbnails ff-items"-->
<ul class="grid cs-style-2 <?php echo "list-view".$view;?>" id="main-item-container">
<?php
$jplayer_ext=array("mp4","flv","webmv","webma","webm","m4a","m4v","ogv","oga","mp3","midi","mid","ogg","wav");
foreach ($files as $file_array) {
$file=$file_array['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, $hidden_folders) || ($filter!='' && $n_files>$file_number_limit_js && $file!=".." && stripos($file,$filter)===false)){
if($file == '.' || ( substr($file, 0, 1) == '.' && isset( $file_array[ 'extension' ] ) && $file_array[ 'extension' ] == fix_strtolower(trans( 'Type_dir' ) )) || (isset($file_array['extension']) && $file_array