Compare commits

...

9 commits

Author SHA1 Message Date
Andrei c021119a77
Merge b1ca169ef7 into a1ae0fa729 2024-05-07 21:48:50 +05:30
BANKA2017 a1ae0fa729
fix: #52 Does not respect directory tree while uploading a folder containing sub-folders (#1056) 2024-05-01 10:01:27 +05:30
Torusrxxx ca4b1b1743
Disable excluded extension name from viewing (#1151) 2024-03-25 11:09:24 +05:30
Andrei Bautu b1ca169ef7 Merge branch 'environment_configuration' 2022-11-26 16:24:22 +02:00
Andrei Bautu 1d5dc40543 Add environmental variables for configuration 2022-11-26 16:23:01 +02:00
Andrei Bautu 36ad7f601b Merge branch 'environment_configuration' 2022-11-26 10:33:05 +02:00
Andrei Bautu 5ebea63410 Add environmental variables for configuration 2022-11-26 10:31:26 +02:00
Andrei Bautu 348de71354 Add environmental variables for configuration 2022-11-26 10:24:49 +02:00
Andrei Bautu f3c941a1ac Fix PHP 8 incompatibility 2022-11-26 08:57:31 +02:00

View file

@ -142,9 +142,30 @@ $ip_blacklist = array(
'::' // non-routable meta ipv6
);
if (getenv('TFM_USE_AUTH') !== false) {
$use_auth = filter_var(getenv('TFM_USE_AUTH'), FILTER_VALIDATE_BOOLEAN);
}
if (getenv('TFM_AUTH_USERS') !== false) {
$auth_users = array();
foreach(explode(',', getenv('TFM_AUTH_USERS')) as $u) {
$u = explode('=', $u);
$auth_users[$u[0]] = $u[1];
}
}
if (getenv('TFM_READONLY_USERS') !== false) {
$readonly_users = explode(',', getenv('TFM_READONLY_USERS'));
}
if (getenv('TFM_ROOT_PATH') !== false) {
$root_path = getenv('TFM_ROOT_PATH');
}
// if User has the external config file, try to use it to override the default config above [config.php]
// sample config - https://tinyfilemanager.github.io/config-sample.txt
$config_file = __DIR__.'/config.php';
$config_file = getenv('TFM_CONFIG_FILE') !== false ? getenv('TFM_CONFIG_FILE') : __DIR__.'/config.php';
if (is_readable($config_file)) {
@include($config_file);
}
@ -958,7 +979,7 @@ if (!empty($_FILES) && !FM_READONLY) {
$targetPath = $path . $ds;
if ( is_writable($targetPath) ) {
$fullPath = $path . '/' . basename($fullPathInput);
$fullPath = $path . '/' . $fullPathInput;
$folder = substr($fullPath, 0, strrpos($fullPath, "/"));
if (!is_dir($folder)) {
@ -1647,7 +1668,7 @@ if (isset($_GET['view'])) {
$file = $_GET['view'];
$file = fm_clean_path($file, false);
$file = str_replace('/', '', $file);
if ($file == '' || !is_file($path . '/' . $file) || in_array($file, $GLOBALS['exclude_items'])) {
if ($file == '' || !is_file($path . '/' . $file) || !fm_is_exclude_items($file)) {
fm_set_msg(lng('File not found'), 'error');
$FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
}
@ -1846,7 +1867,7 @@ if (isset($_GET['edit']) && !FM_READONLY) {
$file = $_GET['edit'];
$file = fm_clean_path($file, false);
$file = str_replace('/', '', $file);
if ($file == '' || !is_file($path . '/' . $file) || in_array($file, $GLOBALS['exclude_items'])) {
if ($file == '' || !is_file($path . '/' . $file) || !fm_is_exclude_items($file)) {
fm_set_msg(lng('File not found'), 'error');
$FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH));
}