'',
'label' => __('Admin tools'),
],
[
'link' => '',
'label' => __('File manager'),
],
]
);
if (isset($config['filemanager']['message']) === true) {
echo $config['filemanager']['message'];
$config['filemanager']['message'] = null;
}
// Add custom directories here.
$fallback_directory = 'images';
// Get directory.
$directory = (string) get_parameter('directory');
$directory = str_replace('<', '', $text);
$directory = str_replace('>', '', $text);
if (empty($directory) === true) {
$directory = $fallback_directory;
} else {
$directory = str_replace('\\', '/', $directory);
$directory = filemanager_safe_directory($directory, $fallback_directory);
}
$real_directory = realpath($config['homedir'].'/'.$directory);
echo '
'.__('Index of %s', io_safe_input($directory)).'
';
$upload_file = (bool) get_parameter('upload_file');
$create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/');
// Remove double dot in filename path.
$file_name = $_FILES['file']['name'];
$path_parts = explode('/', $file_name);
$stripped_parts = array_filter(
$path_parts,
function ($value) {
return $value !== '..';
}
);
$stripped_path = implode('/', $stripped_parts);
$_FILES['file']['name'] = $stripped_path;
if ($upload_file === true) {
upload_file(
$upload_file,
$default_real_directory,
$real_directory,
[
MIME_TYPES['jpg'],
MIME_TYPES['png'],
MIME_TYPES['gif'],
]
);
}
if ($create_text_file === true) {
create_text_file($default_real_directory, $real_directory);
}
filemanager_file_explorer(
$real_directory,
$directory,
'index.php?sec=gsetup&sec2=godmode/setup/file_manager',
'',
false,
false,
'',
false,
'',
false,
false,
[]
);