Feat/mixed changes (#502)

* remove trailing whitespace

Signed-off-by: ccdd13 <78702084+ccdd13@users.noreply.github.com>

* safe include config.php with __DIR__

* replace doc url for $datetime_format from function.date.php to datetime.format.php

Signed-off-by: ccdd13 <ccdd13@users.noreply.github.com>

* put $auth_users & $readonly_users together

Signed-off-by: ccdd13 <ccdd13@users.noreply.github.com>

* update $datetime_format

Signed-off-by: ccdd13 <ccdd13@users.noreply.github.com>

Co-authored-by: ammm ccdd12 <mamok43076@dashseat.com>
Co-authored-by: ccdd13 <ccdd13@users.noreply.github.com>
This commit is contained in:
ccdd13 2021-02-24 08:07:38 +01:00 committed by GitHub
parent a19ff20768
commit dd9d7c09a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 30 deletions

View file

@ -4,7 +4,7 @@
[![Live demo](https://img.shields.io/badge/Live-Demo-brightgreen.svg?style=flat-square)](https://tinyfilemanager.github.io/demo/)
[![Live demo](https://img.shields.io/badge/Help-Docs-lightgrey.svg?style=flat-square)](https://github.com/prasathmani/tinyfilemanager/wiki)
[![GitHub Release](https://img.shields.io/github/release/qubyte/rubidium.svg?style=flat-square)](https://github.com/prasathmani/tinyfilemanager/releases)
[![GitHub License](https://img.shields.io/github/license/prasathmani/tinyfilemanager.svg?style=flat-square)](https://github.com/prasathmani/tinyfilemanager/blob/master/LICENSE)
[![GitHub License](https://img.shields.io/github/license/prasathmani/tinyfilemanager.svg?style=flat-square)](https://github.com/prasathmani/tinyfilemanager/blob/master/LICENSE)
[![Paypal](https://img.shields.io/badge/Donate-Paypal-lightgrey.svg?style=flat-square)](https://www.paypal.me/prasathmani)
> TinyFileManager is web based file manager and it is a simple, fast and small file manager with a single file, multi-language ready web application for storing, uploading, editing and managing files and folders online via web browser. The Application runs on PHP 5.5+, It allows the creation of multiple users and each user can have its own directory and a build-in support for managing text files with cloud9 IDE and it supports syntax highlighting for over 150+ languages and over 35+ themes.
@ -39,12 +39,12 @@ Default username/password: **admin/admin@123** and **user/12345**.
To enable/disable authentication set `$use_auth` to true or false.
### :loudspeaker: Features
### :loudspeaker: Features
- :cd: Open Source, light and extremely simple
- :iphone: Mobile friendly view for touch devices
- :information_source: Basic features likes Create, Delete, Modify, View, Quick Preview, Download, Copy and Move files
- :arrow_double_up: Ajax Upload, Ability to drag & drop, upload from URL, multiple files upload with file extensions filter
- :information_source: Basic features likes Create, Delete, Modify, View, Quick Preview, Download, Copy and Move files
- :arrow_double_up: Ajax Upload, Ability to drag & drop, upload from URL, multiple files upload with file extensions filter
- :file_folder: Ability to create folders and files
- :gift: Ability to compress, extract files (`zip`, `tar`)
- :sunglasses: Support user permissions - based on session and each user root folder mapping
@ -58,7 +58,7 @@ To enable/disable authentication set `$use_auth` to true or false.
- :bangbang: lots more...
### <a name=license></a>License, Credit
### <a name=license></a>License, Credit
- Available under the [GNU license](https://github.com/prasathmani/tinyfilemanager/blob/master/LICENSE)
- Original concept and development by github.com/alexantr/filemanager

View file

@ -24,16 +24,16 @@ $auth_users = array(
'user' => '$2y$10$Fg6Dz8oH9fPoZ2jJan5tZuv6Z4Kp7avtQ9bDfrdRntXtPeiMAZyGO' //12345
);
//set application theme
//options - 'light' and 'dark'
$theme = 'light';
// Readonly users
// e.g. array('users', 'guest', ...)
$readonly_users = array(
'user'
);
//set application theme
//options - 'light' and 'dark'
$theme = 'light';
// Enable highlight.js (https://highlightjs.org/) on view's page
$use_highlightjs = true;
@ -67,8 +67,8 @@ $directories_users = array();
$iconv_input_encoding = 'UTF-8';
// date() format for file modification date
// Doc - https://www.php.net/manual/en/function.date.php
$datetime_format = 'd.m.y H:i';
// Doc - https://www.php.net/manual/en/datetime.format.php
$datetime_format = 'd.m.y H:i:s';
// Allowed file extensions for create and rename files
// e.g. 'txt,html,css,js'

View file

@ -16,7 +16,7 @@ define('APP_TITLE', 'Tiny File Manager');
// --- EDIT BELOW CONFIGURATION CAREFULLY ---
// Auth with login/password
// Auth with login/password
// set true/false to enable/disable it
// Is independent from IP white- and blacklisting
$use_auth = true;
@ -33,7 +33,7 @@ $auth_users = array(
//options - 'light' and 'dark'
$theme = 'light';
// Readonly users
// Readonly users
// e.g. array('users', 'guest', ...)
$readonly_users = array(
'user'
@ -131,7 +131,7 @@ $ip_blacklist = array(
);
// if User has the customized config file, try to use it to override the default config above
$config_file = './config.php';
$config_file = __DIR__.'/config.php';
if (is_readable($config_file)) {
@include($config_file);
}
@ -429,14 +429,14 @@ if (isset($_POST['ajax']) && !FM_READONLY) {
fm_set_msg('File not found', 'error');
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
header('X-XSS-Protection:0');
header('X-XSS-Protection:0');
$file_path = $path . '/' . $file;
$writedata = $_POST['content'];
$fd = fopen($file_path, "w");
$write_results = @fwrite($fd, $writedata);
fclose($fd);
if ($write_results === false){
if ($write_results === false){
header("HTTP/1.1 500 Internal Server Error");
die("Could Not Write File! - Check Permissions / Ownership");
}
@ -450,7 +450,7 @@ if (isset($_POST['ajax']) && !FM_READONLY) {
echo json_encode($response);
exit();
}
// backup files
if (isset($_POST['type']) && $_POST['type'] == "backup" && !empty($_POST['file'])) {
$fileName = $_POST['file'];
@ -540,7 +540,7 @@ if (isset($_POST['ajax']) && !FM_READONLY) {
$allowed = (FM_UPLOAD_EXTENSION) ? explode(',', FM_UPLOAD_EXTENSION) : false;
$ext = strtolower(pathinfo($fileinfo->name, PATHINFO_EXTENSION));
$isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true;
function event_callback ($message) {
global $callback;
echo json_encode($message);
@ -1944,7 +1944,7 @@ $tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white
<td data-sort="a-<?php echo str_pad($filesize_raw, 18, "0", STR_PAD_LEFT);?>">
<?php echo $filesize; ?>
</td>
<td data-sort="a-<?php echo $modif_raw;?>"><?php echo $modif ?></td>
<td data-sort="a-<?php echo $modif_raw;?>"><?php echo $modif ?></td>
<?php if (!FM_IS_WIN && !$hide_Cols): ?>
<td><?php if (!FM_READONLY): ?><a title="Change Permissions" href="?p=<?php echo urlencode(FM_PATH) ?>&amp;chmod=<?php echo urlencode($f) ?>"><?php echo $perms ?></a><?php else: ?><?php echo $perms ?><?php endif; ?>
</td>
@ -1990,7 +1990,7 @@ $tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white
</div>
</td><?php endif; ?>
<td>
<div class="filename">
<div class="filename">
<?php
if (in_array(strtolower(pathinfo($f, PATHINFO_EXTENSION)), array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico', 'svg'))): ?>
<?php $imagePreview = fm_enc(FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $f); ?>
@ -2419,7 +2419,7 @@ function fm_get_size($file)
static $isdarwin;
if (!isset($iswin)) {
$iswin = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN');
}
}
if (!isset($isdarwin)) {
$isdarwin = (strtoupper(substr(PHP_OS, 0)) == "DARWIN");
}
@ -3416,10 +3416,10 @@ global $lang, $root_url, $favicon_path;
.fm-login-page .form-group label{ width:100%}
.fm-login-page .btn.btn-block{ padding:12px 10px}
.fm-login-page .footer{ margin:40px 0;color:#888;text-align:center}
@media screen and (max-width:425px){
@media screen and (max-width:425px){
.fm-login-page .card-wrapper{ width:90%;margin:0 auto;margin-top:10%;}
}
@media screen and (max-width:320px){
@media screen and (max-width:320px){
.fm-login-page .card.fat{ padding:0}
.fm-login-page .card.fat .card-body{ padding:15px}
}
@ -3527,7 +3527,7 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
.break-word + .float-right { padding-right:30px;position:relative }
.break-word + .float-right > a { color:#7d7d7d;font-size:1.2em;margin-right:4px }
#editor { position:absolute;right:15px;top:100px;bottom:15px;left:15px }
@media (max-width:481px) {
@media (max-width:481px) {
#editor { top:150px; }
}
#normal-editor { border-radius:3px;border-width:2px;padding:10px;outline:none; }
@ -3759,7 +3759,7 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
if (n) {
if(true){
var data = {ajax: true, content: n, type: 'save'};
$.ajax({
type: "POST",
url: window.location,
@ -3771,7 +3771,7 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
failure: function(mes) {toast("Error: try again");},
error: function(mes) {toast(`<p style="background-color:red">${mes.responseText}</p>`);}
});
}
else{
var a = document.createElement("form");
@ -3891,7 +3891,7 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
});
});
</script>
<?php if (isset($_GET['edit']) && isset($_GET['env']) && FM_EDIT_FILE):
<?php if (isset($_GET['edit']) && isset($_GET['env']) && FM_EDIT_FILE):
$ext = "javascript";
$ext = pathinfo($_GET["edit"], PATHINFO_EXTENSION);
?>
@ -3943,7 +3943,7 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
} else if(selectedValue && selectionType == "theme") {
editor.setTheme(selectedValue);
}else if(selectedValue && selectionType == "fontSize") {
editor.setFontSize(parseInt(selectedValue));
editor.setFontSize(parseInt(selectedValue));
}
});
});
@ -4042,7 +4042,7 @@ function lng($txt) {
$tr['en']['Check Latest Version'] = 'Check Latest Version';$tr['en']['Generate new password hash'] = 'Generate new password hash';
$tr['en']['You are logged in'] = 'You are logged in'; $tr['en']['Login failed. Invalid username or password'] = 'Login failed. Invalid username or password';
$tr['en']['password_hash not supported, Upgrade PHP version'] = 'password_hash not supported, Upgrade PHP version';
$i18n = fm_get_translations($tr);
$tr = $i18n ? $i18n : $tr;