Merge branch 'ent-7804-modificar-comportamiento-file-manager' into 'develop'
Created token for hande file creation Closes pandora_enterprise#7804 See merge request artica/pandorafms!4305
This commit is contained in:
commit
a2ef804cec
|
@ -97,5 +97,6 @@ filemanager_file_explorer(
|
|||
'',
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
|
|
@ -250,7 +250,7 @@ function create_text_file($default_real_directory)
|
|||
return;
|
||||
}
|
||||
|
||||
$filename = io_safe_output(get_parameter('name_file'));
|
||||
$filename = filemanager_safe_directory((string) get_parameter('name_file'));
|
||||
|
||||
if (empty($filename) === false) {
|
||||
$real_directory = filemanager_safe_directory((string) get_parameter('real_directory'));
|
||||
|
@ -473,13 +473,12 @@ function filemanager_read_recursive_dir($dir, $relative_path='', $add_empty_dirs
|
|||
* @param string $url The url to set in the forms and some links in the explorer.
|
||||
* @param string $father The directory father don't navigate bottom this.
|
||||
* @param boolean $editor The flag to set the edition of text files.
|
||||
* @param boolean $readOnly The flag to set read only.
|
||||
* @param boolean $readOnly If true, only can read the files.
|
||||
* @param string $url_file The url to put in the files instead the default. By default empty string and use the url of filemanager.
|
||||
* @param boolean $download_button The flag to show download button, by default false.
|
||||
* @param string $umask The umask as hex values to set the new files or updload.
|
||||
* @param mixed $homedir_filemanager Homedir of file manager.
|
||||
*
|
||||
* @return void
|
||||
* @param boolean $homedir_filemanager Homedir filemanager.
|
||||
* @param boolean $allowCreateText If true, 'Create Text' button will be shown.
|
||||
*/
|
||||
function filemanager_file_explorer(
|
||||
$real_directory,
|
||||
|
@ -491,7 +490,8 @@ function filemanager_file_explorer(
|
|||
$url_file='',
|
||||
$download_button=false,
|
||||
$umask='',
|
||||
$homedir_filemanager=false
|
||||
$homedir_filemanager=false,
|
||||
$allowCreateText=true
|
||||
) {
|
||||
global $config;
|
||||
|
||||
|
@ -504,10 +504,7 @@ function filemanager_file_explorer(
|
|||
$homedir_filemanager = $config['homedir'];
|
||||
}
|
||||
|
||||
$hack_metaconsole = '';
|
||||
if (is_metaconsole() === true) {
|
||||
$hack_metaconsole = '../../';
|
||||
}
|
||||
$hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
@ -516,13 +513,13 @@ function filemanager_file_explorer(
|
|||
$("#create_folder").css("display", "block");
|
||||
check_opened_dialog('create_folder');
|
||||
}
|
||||
|
||||
<?php if ($allowCreateText === true) : ?>
|
||||
function show_create_text_file() {
|
||||
actions_dialog('create_text_file');
|
||||
$("#create_text_file").css("display", "block");
|
||||
check_opened_dialog('create_text_file');
|
||||
}
|
||||
|
||||
<?php endif ?>
|
||||
function show_upload_file() {
|
||||
actions_dialog('upload_file');
|
||||
$("#upload_file").css("display", "block");
|
||||
|
@ -535,12 +532,13 @@ function filemanager_file_explorer(
|
|||
$('#create_folder').dialog('close');
|
||||
}
|
||||
}
|
||||
|
||||
<?php if ($allowCreateText === true) : ?>
|
||||
if(check_opened !== 'create_text_file'){
|
||||
if (($("#create_text_file").hasClass("ui-dialog-content") && $('#create_text_file').dialog('isOpen') === true)) {
|
||||
$('#create_text_file').dialog('close');
|
||||
}
|
||||
}
|
||||
<?php endif ?>
|
||||
if(check_opened !== 'upload_file'){
|
||||
if (($("#upload_file").hasClass("ui-dialog-content") && $('#upload_file').dialog('isOpen')) === true) {
|
||||
$('#upload_file').dialog('close');
|
||||
|
@ -555,11 +553,11 @@ function filemanager_file_explorer(
|
|||
case 'create_folder':
|
||||
title_action = "<?php echo __('Create a Directory'); ?>";
|
||||
break;
|
||||
|
||||
<?php if ($allowCreateText === true) : ?>
|
||||
case 'create_text_file':
|
||||
title_action = "<?php echo __('Create a Text'); ?>";
|
||||
break;
|
||||
|
||||
<?php endif ?>
|
||||
case 'upload_file':
|
||||
title_action = "<?php echo __('Upload Files'); ?>";
|
||||
break;
|
||||
|
@ -624,6 +622,7 @@ function filemanager_file_explorer(
|
|||
$table->head[4] = __('Actions');
|
||||
|
||||
$prev_dir = explode('/', $relative_directory);
|
||||
$count_prev_dir = count($prev_dir);
|
||||
$prev_dir_str = '';
|
||||
$prev_dir_count = count($prev_dir);
|
||||
for ($i = 0; $i < ($prev_dir_count - 1); $i++) {
|
||||
|
@ -735,7 +734,7 @@ function filemanager_file_explorer(
|
|||
|
||||
$relative_dir = str_replace($homedir_filemanager, '', str_replace('\\', '/', dirname($fileinfo['realpath'])));
|
||||
|
||||
if ($relative_dir[0] == '/') {
|
||||
if ($relative_dir[0] === '/') {
|
||||
$relative_dir = substr($relative_dir, 1);
|
||||
}
|
||||
|
||||
|
@ -790,18 +789,24 @@ function filemanager_file_explorer(
|
|||
]
|
||||
).'<span>'.__('Create a Directory').'</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="create_text_file">
|
||||
<a href="javascript: show_create_text_file();">'.html_print_image(
|
||||
'images/create_file.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Create a Text'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'<span>'.__('Create a Text').'</span>
|
||||
</a>
|
||||
</li>
|
||||
</li>';
|
||||
|
||||
if ($allowCreateText === true) {
|
||||
$tabs_dialog .= '
|
||||
<li class="create_text_file">
|
||||
<a href="javascript: show_create_text_file();">'.html_print_image(
|
||||
'images/create_file.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Create a Text'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'<span>'.__('Create a Text').'</span>
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
|
||||
$tabs_dialog .= '
|
||||
<li class="upload_file">
|
||||
<a href="javascript: show_upload_file();">'.html_print_image(
|
||||
'images/upload_file.png',
|
||||
|
@ -812,7 +817,9 @@ function filemanager_file_explorer(
|
|||
]
|
||||
).'<span>'.__('Upload Files').'</span>
|
||||
</a>
|
||||
</li></ul>';
|
||||
</li>';
|
||||
|
||||
$tabs_dialog .= '</ul>';
|
||||
|
||||
echo '<div id="create_folder" class="invisible">'.$tabs_dialog.'
|
||||
<form method="post" action="'.$url.'">'.html_print_input_text('dirname', '', '', 30, 255, true).html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"', true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('create_dir', 1, true).html_print_input_hidden('hash', md5($relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('hash2', md5($relative_directory.$config['server_unique_identifier']), true).'</form></div>';
|
||||
|
@ -820,8 +827,10 @@ function filemanager_file_explorer(
|
|||
echo '<div id="upload_file" class="invisible"> '.$tabs_dialog.'
|
||||
<form method="post" action="'.$url.'" enctype="multipart/form-data">'.ui_print_help_tip(__('The zip upload in this dir, easy to upload multiple files.'), true).html_print_input_file('file', true, false).html_print_input_hidden('umask', $umask, true).html_print_checkbox('decompress', 1, false, true).__('Decompress').html_print_submit_button(__('Go'), 'go', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('hash2', md5($relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('upload_file_or_zip', 1, true).'</form></div>';
|
||||
|
||||
echo ' <div id="create_text_file" class="invisible">'.$tabs_dialog.'
|
||||
<form method="post" action="'.$url.'">'.html_print_input_text('name_file', '', '', 30, 50, true).html_print_submit_button(__('Create'), 'create', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('umask', $umask, true).html_print_input_hidden('create_text_file', 1, true).'</form></div>';
|
||||
if ($allowCreateText === true) {
|
||||
echo ' <div id="create_text_file" class="invisible">'.$tabs_dialog.'
|
||||
<form method="post" action="'.$url.'">'.html_print_input_text('name_file', '', '', 30, 50, true).html_print_submit_button(__('Create'), 'create', false, 'class="sub next"', true).html_print_input_hidden('real_directory', $real_directory, true).html_print_input_hidden('directory', $relative_directory, true).html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true).html_print_input_hidden('umask', $umask, true).html_print_input_hidden('create_text_file', 1, true).'</form></div>';
|
||||
}
|
||||
|
||||
echo "<div style='width: ".$table->width.";' class='file_table_buttons'>";
|
||||
|
||||
|
@ -836,16 +845,18 @@ function filemanager_file_explorer(
|
|||
);
|
||||
echo '</a>';
|
||||
|
||||
echo "<a href='javascript: show_create_text_file();'>";
|
||||
echo html_print_image(
|
||||
'images/create_file.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Create text'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
echo '</a>';
|
||||
if ($allowCreateText === true) {
|
||||
echo "<a href='javascript: show_create_text_file();'>";
|
||||
echo html_print_image(
|
||||
'images/create_file.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Create text'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
echo '</a>';
|
||||
}
|
||||
|
||||
echo "<a href='javascript: show_upload_file();'>";
|
||||
echo html_print_image(
|
||||
|
@ -970,8 +981,8 @@ function filemanager_safe_directory(
|
|||
$directory = io_safe_output($directory);
|
||||
$forbiddenAttempting = false;
|
||||
|
||||
if ((bool) preg_match('/(\.){1,2}/', $directory) !== false) {
|
||||
$directory = preg_replace('/(\.){1,2}/', '', (empty($safedDirectory) === true) ? $directory : $safedDirectory);
|
||||
if ((bool) preg_match('/(\.){2}/', $directory) !== false) {
|
||||
$directory = preg_replace('/(\.){2}/', '', (empty($safedDirectory) === true) ? $directory : $safedDirectory);
|
||||
$forbiddenAttempting = true;
|
||||
}
|
||||
|
||||
|
@ -985,4 +996,4 @@ function filemanager_safe_directory(
|
|||
}
|
||||
|
||||
return $directory;
|
||||
}
|
||||
}
|
|
@ -1,11 +1,8 @@
|
|||
/**
|
||||
*
|
||||
* Name: Default theme
|
||||
* Pandora Stylesheet
|
||||
*
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @category Stylesheet
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
|
@ -4969,7 +4966,6 @@ input:checked + .p-slider:before {
|
|||
|
||||
#file_table_modal {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue