diff --git a/tinyfilemanager.php b/tinyfilemanager.php index 55c8173..337f78f 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -12,7 +12,7 @@ $lang = 'en'; // Auth with login/password (set true/false to enable/disable it) $use_auth = true; -// Users: array('Username' => 'Password', 'Username2' => 'Password2', ...), Password has to encripted into MD5 +// Users: array('Username' => 'Password', 'Username2' => 'Password2', ...), Password has to be encrypted into MD5 $auth_users = array( 'admin' => '21232f297a57a5a743894a0e4a801fc3', //admin 'user' => '827ccb0eea8a706c4c34a16891f84e7b', //12345 @@ -23,6 +23,10 @@ $readonly_users = array( 'user' ); +//user specific directories +//array('Username' => 'Directory path', 'Username2' => 'Directory path', ...) +$directories_users = array(); + // Show or hide files and folders that starts with a dot $show_hidden_files = true; @@ -105,20 +109,10 @@ if (empty($auth_users)) { $is_https = isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'; -// clean and check $root_path -$root_path = rtrim($root_path, '\\/'); -$root_path = str_replace('\\', '/', $root_path); -if (!@is_dir($root_path)) { - echo "

Root path \"{$root_path}\" not found!

"; - exit; -} - // clean $root_url $root_url = fm_clean_path($root_url); // abs path for site -defined('FM_SHOW_HIDDEN') || define('FM_SHOW_HIDDEN', $show_hidden_files); -defined('FM_ROOT_PATH') || define('FM_ROOT_PATH', $root_path); defined('FM_ROOT_URL') || define('FM_ROOT_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . (!empty($root_url) ? '/' . $root_url : '')); defined('FM_SELF_URL') || define('FM_SELF_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . $_SERVER['PHP_SELF']); @@ -156,7 +150,7 @@ if ($use_auth) { fm_show_message(); ?>
- H3K File manager + H3K File Manager


@@ -169,6 +163,21 @@ if ($use_auth) { } } +//update root path +if($use_auth && isset($_SESSION['logged'])) { + $root_path = isset($directories_users[$_SESSION['logged']]) ? $directories_users[$_SESSION['logged']] : $root_path; +} + +// clean and check $root_path +$root_path = rtrim($root_path, '\\/'); +$root_path = str_replace('\\', '/', $root_path); +if (!@is_dir($root_path)) { + echo "

Root path \"{$root_path}\" not found!

"; + exit; +} + +defined('FM_SHOW_HIDDEN') || define('FM_SHOW_HIDDEN', $show_hidden_files); +defined('FM_ROOT_PATH') || define('FM_ROOT_PATH', $root_path); defined('FM_LANG') || define('FM_LANG', $lang); defined('FM_EXTENSION') || define('FM_EXTENSION', $upload_extensions); defined('FM_TREEVIEW') || define('FM_TREEVIEW', $show_tree_view);