diff --git a/Dockerfile b/Dockerfile index 5d0ba45..85f46ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,8 +22,7 @@ RUN docker-php-ext-install \ WORKDIR /var/www/html COPY tinyfilemanager.php index.php -COPY config-sample.php config.php -RUN sed -i "s/\$root_path =.*;/\$root_path = \$_SERVER['DOCUMENT_ROOT'].'\/data';/g" config.php && \ - sed -i "s/\$root_url = '';/\$root_url = 'data\/';/g" config.php +RUN sed -i "s/\$root_path =.*;/\$root_path = \$_SERVER['DOCUMENT_ROOT'].'\/data';/g" index.php && \ + sed -i "s/\$root_url = '';/\$root_url = 'data\/';/g" index.php CMD ["sh", "-c", "php -S 0.0.0.0:80"] diff --git a/README.md b/README.md index 633a60c..c279e96 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ To enable/disable authentication set `$use_auth` to true or false. - :zap: Backup files and IP blacklist and whitelist - :mag_right: Search - Search and filter files using `datatable js` - :file_folder: Exclude folders and files from listing -- :globe_with_meridians: Multi-language(20+) support and for translations `translation.json` is file required +- :globe_with_meridians: Multi-language(32+) support and for translations `translation.json` is file required - :bangbang: lots more... ## Deploy by Docker @@ -103,10 +103,10 @@ $root_path = $_SERVER['DOCUMENT_ROOT'].'/data'; $root_url = 'data/'; ``` -Then, change another config what you want, and add a new volume `-v /absolute/path/config.php:/var/www/html/config.php` in `docker run` command, like this: +Then, change another config what you want, and add a new volume `-v /absolute/path/index.php:/var/www/html/index.php` in `docker run` command, like this: ```shell -$ docker run -d -v /absolute/path:/var/www/html/data -v /absolute/path/config.php:/var/www/html/config.php -p 80:80 --restart=always --name tinyfilemanager tinyfilemanager/tinyfilemanager:master +$ docker run -d -v /absolute/path:/var/www/html/data -v /absolute/path/index.php:/var/www/html/index.php -p 80:80 --restart=always --name tinyfilemanager tinyfilemanager/tinyfilemanager:master ``` #### Stop running @@ -121,6 +121,6 @@ $ docker rm -f tinyfilemanager - Available under the [GNU license](https://github.com/prasathmani/tinyfilemanager/blob/master/LICENSE) - Original concept and development by github.com/alexantr/filemanager -- CDN Used - _jQuery, Bootstrap, Font Awesome, Highlight js, ace js, DropZone js, ekko-lightbox js, and DataTable js_ +- CDN Used - _jQuery, Bootstrap, Font Awesome, Highlight js, ace js, DropZone js, and DataTable js_ - To report a bug or request a feature, please file an [issue](https://github.com/prasathmani/tinyfilemanager/issues) - [Contributors](https://github.com/prasathmani/tinyfilemanager/wiki/Authors-and-Contributors) diff --git a/tinyfilemanager.php b/tinyfilemanager.php index ecfa45f..1c0f7f8 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -2,11 +2,12 @@ //Default Configuration $CONFIG = '{"lang":"en","error_reporting":false,"show_hidden":false,"hide_Cols":false,"theme":"light"}'; - /** * H3K | Tiny File Manager V2.5.0 - * CCP Programmers | ccpprogrammers@gmail.com - * https://tinyfilemanager.github.io + * @author Prasath Mani | CCP Programmers + * @email ccpprogrammers@gmail.com + * @github https://github.com/prasathmani/tinyfilemanager + * @link https://tinyfilemanager.github.io */ //TFM version @@ -95,8 +96,8 @@ $exclude_items = array(); // Online office Docs Viewer // Availabe rules are 'google', 'microsoft' or false -// google => View documents using Google Docs Viewer -// microsoft => View documents using Microsoft Web Apps Viewer +// Google => View documents using Google Docs Viewer +// Microsoft => View documents using Microsoft Web Apps Viewer // false => disable online doc viewer $online_viewer = 'google'; @@ -132,6 +133,7 @@ $ip_blacklist = array( ); // if User has the customized config file, try to use it to override the default config above +// sample config - https://tinyfilemanager.github.io/config-sample.txt $config_file = __DIR__.'/config.php'; if (is_readable($config_file)) { @include($config_file); @@ -259,9 +261,7 @@ if ($ip_ruleset != 'OFF') { } $clientIp = getClientIP(); - $proceed = false; - $whitelisted = in_array($clientIp, $ip_whitelist); $blacklisted = in_array($clientIp, $ip_blacklist); @@ -284,12 +284,11 @@ if ($ip_ruleset != 'OFF') { fm_show_header_login(); fm_show_message(); } - exit(); } } -// Auth +// Checking if the user is logged in or not. If not, it will show the login form. if ($use_auth) { if (isset($_SESSION[FM_SESSION_ID]['logged'], $auth_users[$_SESSION[FM_SESSION_ID]['logged']])) { // Logged @@ -423,7 +422,7 @@ unset($p, $use_auth, $iconv_input_encoding, $use_highlightjs, $highlightjs_style /*************************** ACTIONS ***************************/ -// AJAX Request +// Handle all AJAX Request if (isset($_POST['ajax'], $_POST['token']) && !FM_READONLY) { if(!verifyToken($_POST['token'])) { header('HTTP/1.0 401 Unauthorized'); @@ -630,11 +629,9 @@ if (isset($_POST['ajax'], $_POST['token']) && !FM_READONLY) { event_callback(array("fail" => $err)); } } - exit(); } - // Delete file / folder if (isset($_GET['del'], $_POST['token']) && !FM_READONLY) { $del = str_replace( '/', '', fm_clean_path( $_GET['del'] ) ); @@ -941,8 +938,6 @@ if (!empty($_FILES) && !FM_READONLY) { umask($old); } - - if (empty($f['file']['error']) && !empty($tmp_name) && $tmp_name != 'none' && $isFileAllowed) { if ($chunkTotal){ $out = @fopen("{$fullPath}.part", $chunkIndex == 0 ? "wb" : "ab"); @@ -978,8 +973,6 @@ if (!empty($_FILES) && !FM_READONLY) { ); } - - if ($chunkIndex == $chunkTotal - 1) { rename("{$fullPath}.part", $fullPath); } @@ -1050,7 +1043,7 @@ if (isset($_POST['group'], $_POST['delete'], $_POST['token']) && !FM_READONLY) { $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } -// Pack files +// Pack files zip, tar if (isset($_POST['group'], $_POST['token']) && (isset($_POST['zip']) || isset($_POST['tar'])) && !FM_READONLY) { if(!verifyToken($_POST['token'])) { @@ -1066,7 +1059,6 @@ if (isset($_POST['group'], $_POST['token']) && (isset($_POST['zip']) || isset($_ //set pack type $ext = isset($_POST['tar']) ? 'tar' : 'zip'; - if (($ext == "zip" && !class_exists('ZipArchive')) || ($ext == "tar" && !class_exists('PharData'))) { fm_set_msg(lng('Operations with archives are not available'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); @@ -1104,7 +1096,7 @@ if (isset($_POST['group'], $_POST['token']) && (isset($_POST['zip']) || isset($_ $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } -// Unpack +// Unpack zip, tar if (isset($_POST['unzip'], $_POST['token']) && !FM_READONLY) { if(!verifyToken($_POST['token'])) { @@ -1129,7 +1121,6 @@ if (isset($_POST['unzip'], $_POST['token']) && !FM_READONLY) { fm_set_msg(lng('File not found'), 'error'); } - if (($ext == "zip" && !class_exists('ZipArchive')) || ($ext == "tar" && !class_exists('PharData'))) { fm_set_msg(lng('Operations with archives are not available'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); @@ -1167,7 +1158,6 @@ if (isset($_POST['unzip'], $_POST['token']) && !FM_READONLY) { } else { fm_set_msg(lng('Archive not unpacked'), 'error'); } - } else { fm_set_msg(lng('File not found'), 'error'); } @@ -1232,7 +1222,7 @@ if (isset($_POST['chmod'], $_POST['token']) && !FM_READONLY && !FM_IS_WIN) { $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } -/*************************** /ACTIONS ***************************/ +/*************************** ACTIONS ***************************/ // get current path $path = FM_ROOT_PATH; @@ -1340,7 +1330,7 @@ if (isset($_GET['upload']) && !FM_READONLY) { forceChunking: true, retryChunks: true, retryChunksLimit: 3, - parallelUploads: 2, // does not support more than 1! + parallelUploads: 2, parallelChunkUploads: true, timeout: 120000, maxFilesize: "", @@ -1358,7 +1348,6 @@ if (isset($_GET['upload']) && !FM_READONLY) { if(_response.status == "error") { toast(_response.info); } - }).on("error", function(file, response) { toast(response); }); @@ -1491,18 +1480,6 @@ if (isset($_GET['settings']) && !FM_READONLY) { -
@@ -1924,7 +1901,6 @@ if (isset($_GET['chmod']) && !FM_READONLY && !FM_IS_WIN) { $file_path = $path . '/' . $file; $mode = fileperms($path . '/' . $file); - ?>
@@ -1980,11 +1956,11 @@ if (isset($_GET['chmod']) && !FM_READONLY && !FM_IS_WIN) { exit; } -//--- FILEMANAGER MAIN +// --- TINYFILEMANAGER MAIN --- fm_show_header(); // HEADER fm_show_nav_path(FM_PATH); // current path -// messages +// show alert messages fm_show_message(); $num_files = count($files); @@ -2196,13 +2172,12 @@ $tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white
- ">
- - +