Refactor - Set settings

This commit is contained in:
Sharif El Shobkshy 2020-12-30 12:54:20 -03:00
parent ef09231454
commit e777ea35a8
2 changed files with 31 additions and 26 deletions

View File

@ -11,10 +11,15 @@ or
#################################################################################################################
*/
// SHARIF.
define('CONFIG', '{"lang":"en","error_reporting":false,"show_hidden":false,"hide_Cols":false,"calc_folder":false}');
define('ROOT_PATH', $_SERVER['DOCUMENT_ROOT'] . '/sites/default/files/public');
define('ROOT_URL', 'sites/default/files/public');
// Auth with login/password
// set true/false to enable/disable it
// Is independent from IP white- and blacklisting
$use_auth = true;
$use_auth = false;
// Login user name and password
// Users: array('Username' => 'Password', 'Username2' => 'Password2', ...)
@ -50,11 +55,11 @@ $default_timezone = 'Etc/UTC'; // UTC
// Root path for file manager
// use absolute path of directory i.e: '/var/www/folder' or $_SERVER['DOCUMENT_ROOT'].'/folder'
$root_path = $_SERVER['DOCUMENT_ROOT'];
$root_path = $_SERVER['DOCUMENT_ROOT'] . '/sites/default/files/public';
// Root url for links in file manager.Relative to $http_host. Variants: '', 'path/to/subfolder'
// Will not working if $root_path will be outside of server document root
$root_url = '';
$root_url = 'sites/default/files/public';
// Server hostname. Can set manually if wrong
$http_host = $_SERVER['HTTP_HOST'];

View File

@ -132,6 +132,8 @@ $ip_blacklist = array(
// if User has the customized config file, try to use it to override the default config above
$config_file = './config.php';
// Sharif.
$config_file = dirname(__FILE__) . '/config.php';
if (is_readable($config_file)) {
@include($config_file);
}
@ -3218,8 +3220,6 @@ class FM_Zipper_Tar
}
}
/**
* Save Configuration
*/
@ -3230,15 +3230,15 @@ class FM_Zipper_Tar
function __construct()
{
global $root_path, $root_url, $CONFIG;
$fm_url = $root_url.$_SERVER["PHP_SELF"];
$fm_url = ROOT_URL.$_SERVER["PHP_SELF"];
$this->data = array(
'lang' => 'en',
'error_reporting' => true,
'show_hidden' => true
);
$data = false;
if (strlen($CONFIG)) {
$data = fm_object_to_array(json_decode($CONFIG));
if (strlen(CONFIG)) {
$data = fm_object_to_array(json_decode(CONFIG));
} else {
$msg = 'Tiny File Manager<br>Error: Cannot load configuration';
if (substr($fm_url, -1) == '/') {