mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
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,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
@ -250,7 +250,7 @@ function create_text_file($default_real_directory)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename = io_safe_output(get_parameter('name_file'));
|
$filename = filemanager_safe_directory((string) get_parameter('name_file'));
|
||||||
|
|
||||||
if (empty($filename) === false) {
|
if (empty($filename) === false) {
|
||||||
$real_directory = filemanager_safe_directory((string) get_parameter('real_directory'));
|
$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 $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 string $father The directory father don't navigate bottom this.
|
||||||
* @param boolean $editor The flag to set the edition of text files.
|
* @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 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 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 string $umask The umask as hex values to set the new files or updload.
|
||||||
* @param mixed $homedir_filemanager Homedir of file manager.
|
* @param boolean $homedir_filemanager Homedir filemanager.
|
||||||
*
|
* @param boolean $allowCreateText If true, 'Create Text' button will be shown.
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
function filemanager_file_explorer(
|
function filemanager_file_explorer(
|
||||||
$real_directory,
|
$real_directory,
|
||||||
@ -491,7 +490,8 @@ function filemanager_file_explorer(
|
|||||||
$url_file='',
|
$url_file='',
|
||||||
$download_button=false,
|
$download_button=false,
|
||||||
$umask='',
|
$umask='',
|
||||||
$homedir_filemanager=false
|
$homedir_filemanager=false,
|
||||||
|
$allowCreateText=true
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -504,10 +504,7 @@ function filemanager_file_explorer(
|
|||||||
$homedir_filemanager = $config['homedir'];
|
$homedir_filemanager = $config['homedir'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$hack_metaconsole = '';
|
$hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
|
||||||
if (is_metaconsole() === true) {
|
|
||||||
$hack_metaconsole = '../../';
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -516,13 +513,13 @@ function filemanager_file_explorer(
|
|||||||
$("#create_folder").css("display", "block");
|
$("#create_folder").css("display", "block");
|
||||||
check_opened_dialog('create_folder');
|
check_opened_dialog('create_folder');
|
||||||
}
|
}
|
||||||
|
<?php if ($allowCreateText === true) : ?>
|
||||||
function show_create_text_file() {
|
function show_create_text_file() {
|
||||||
actions_dialog('create_text_file');
|
actions_dialog('create_text_file');
|
||||||
$("#create_text_file").css("display", "block");
|
$("#create_text_file").css("display", "block");
|
||||||
check_opened_dialog('create_text_file');
|
check_opened_dialog('create_text_file');
|
||||||
}
|
}
|
||||||
|
<?php endif ?>
|
||||||
function show_upload_file() {
|
function show_upload_file() {
|
||||||
actions_dialog('upload_file');
|
actions_dialog('upload_file');
|
||||||
$("#upload_file").css("display", "block");
|
$("#upload_file").css("display", "block");
|
||||||
@ -535,12 +532,13 @@ function filemanager_file_explorer(
|
|||||||
$('#create_folder').dialog('close');
|
$('#create_folder').dialog('close');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
<?php if ($allowCreateText === true) : ?>
|
||||||
if(check_opened !== 'create_text_file'){
|
if(check_opened !== 'create_text_file'){
|
||||||
if (($("#create_text_file").hasClass("ui-dialog-content") && $('#create_text_file').dialog('isOpen') === true)) {
|
if (($("#create_text_file").hasClass("ui-dialog-content") && $('#create_text_file').dialog('isOpen') === true)) {
|
||||||
$('#create_text_file').dialog('close');
|
$('#create_text_file').dialog('close');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
<?php endif ?>
|
||||||
if(check_opened !== 'upload_file'){
|
if(check_opened !== 'upload_file'){
|
||||||
if (($("#upload_file").hasClass("ui-dialog-content") && $('#upload_file').dialog('isOpen')) === true) {
|
if (($("#upload_file").hasClass("ui-dialog-content") && $('#upload_file').dialog('isOpen')) === true) {
|
||||||
$('#upload_file').dialog('close');
|
$('#upload_file').dialog('close');
|
||||||
@ -555,11 +553,11 @@ function filemanager_file_explorer(
|
|||||||
case 'create_folder':
|
case 'create_folder':
|
||||||
title_action = "<?php echo __('Create a Directory'); ?>";
|
title_action = "<?php echo __('Create a Directory'); ?>";
|
||||||
break;
|
break;
|
||||||
|
<?php if ($allowCreateText === true) : ?>
|
||||||
case 'create_text_file':
|
case 'create_text_file':
|
||||||
title_action = "<?php echo __('Create a Text'); ?>";
|
title_action = "<?php echo __('Create a Text'); ?>";
|
||||||
break;
|
break;
|
||||||
|
<?php endif ?>
|
||||||
case 'upload_file':
|
case 'upload_file':
|
||||||
title_action = "<?php echo __('Upload Files'); ?>";
|
title_action = "<?php echo __('Upload Files'); ?>";
|
||||||
break;
|
break;
|
||||||
@ -624,6 +622,7 @@ function filemanager_file_explorer(
|
|||||||
$table->head[4] = __('Actions');
|
$table->head[4] = __('Actions');
|
||||||
|
|
||||||
$prev_dir = explode('/', $relative_directory);
|
$prev_dir = explode('/', $relative_directory);
|
||||||
|
$count_prev_dir = count($prev_dir);
|
||||||
$prev_dir_str = '';
|
$prev_dir_str = '';
|
||||||
$prev_dir_count = count($prev_dir);
|
$prev_dir_count = count($prev_dir);
|
||||||
for ($i = 0; $i < ($prev_dir_count - 1); $i++) {
|
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'])));
|
$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);
|
$relative_dir = substr($relative_dir, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -790,7 +789,10 @@ function filemanager_file_explorer(
|
|||||||
]
|
]
|
||||||
).'<span>'.__('Create a Directory').'</span>
|
).'<span>'.__('Create a Directory').'</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>';
|
||||||
|
|
||||||
|
if ($allowCreateText === true) {
|
||||||
|
$tabs_dialog .= '
|
||||||
<li class="create_text_file">
|
<li class="create_text_file">
|
||||||
<a href="javascript: show_create_text_file();">'.html_print_image(
|
<a href="javascript: show_create_text_file();">'.html_print_image(
|
||||||
'images/create_file.png',
|
'images/create_file.png',
|
||||||
@ -801,7 +803,10 @@ function filemanager_file_explorer(
|
|||||||
]
|
]
|
||||||
).'<span>'.__('Create a Text').'</span>
|
).'<span>'.__('Create a Text').'</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$tabs_dialog .= '
|
||||||
<li class="upload_file">
|
<li class="upload_file">
|
||||||
<a href="javascript: show_upload_file();">'.html_print_image(
|
<a href="javascript: show_upload_file();">'.html_print_image(
|
||||||
'images/upload_file.png',
|
'images/upload_file.png',
|
||||||
@ -812,7 +817,9 @@ function filemanager_file_explorer(
|
|||||||
]
|
]
|
||||||
).'<span>'.__('Upload Files').'</span>
|
).'<span>'.__('Upload Files').'</span>
|
||||||
</a>
|
</a>
|
||||||
</li></ul>';
|
</li>';
|
||||||
|
|
||||||
|
$tabs_dialog .= '</ul>';
|
||||||
|
|
||||||
echo '<div id="create_folder" class="invisible">'.$tabs_dialog.'
|
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>';
|
<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.'
|
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>';
|
<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>';
|
||||||
|
|
||||||
|
if ($allowCreateText === true) {
|
||||||
echo ' <div id="create_text_file" class="invisible">'.$tabs_dialog.'
|
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>';
|
<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'>";
|
echo "<div style='width: ".$table->width.";' class='file_table_buttons'>";
|
||||||
|
|
||||||
@ -836,6 +845,7 @@ function filemanager_file_explorer(
|
|||||||
);
|
);
|
||||||
echo '</a>';
|
echo '</a>';
|
||||||
|
|
||||||
|
if ($allowCreateText === true) {
|
||||||
echo "<a href='javascript: show_create_text_file();'>";
|
echo "<a href='javascript: show_create_text_file();'>";
|
||||||
echo html_print_image(
|
echo html_print_image(
|
||||||
'images/create_file.png',
|
'images/create_file.png',
|
||||||
@ -846,6 +856,7 @@ function filemanager_file_explorer(
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
echo '</a>';
|
echo '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
echo "<a href='javascript: show_upload_file();'>";
|
echo "<a href='javascript: show_upload_file();'>";
|
||||||
echo html_print_image(
|
echo html_print_image(
|
||||||
@ -970,8 +981,8 @@ function filemanager_safe_directory(
|
|||||||
$directory = io_safe_output($directory);
|
$directory = io_safe_output($directory);
|
||||||
$forbiddenAttempting = false;
|
$forbiddenAttempting = false;
|
||||||
|
|
||||||
if ((bool) preg_match('/(\.){1,2}/', $directory) !== false) {
|
if ((bool) preg_match('/(\.){2}/', $directory) !== false) {
|
||||||
$directory = preg_replace('/(\.){1,2}/', '', (empty($safedDirectory) === true) ? $directory : $safedDirectory);
|
$directory = preg_replace('/(\.){2}/', '', (empty($safedDirectory) === true) ? $directory : $safedDirectory);
|
||||||
$forbiddenAttempting = true;
|
$forbiddenAttempting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Name: Default theme
|
* Pandora Stylesheet
|
||||||
*
|
*
|
||||||
* Extension to manage a list of gateways and the node address where they should
|
* @category Stylesheet
|
||||||
* point to.
|
|
||||||
*
|
|
||||||
* @category Extensions
|
|
||||||
* @package Pandora FMS
|
* @package Pandora FMS
|
||||||
* @subpackage Community
|
* @subpackage Community
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
@ -4969,7 +4966,6 @@ input:checked + .p-slider:before {
|
|||||||
|
|
||||||
#file_table_modal {
|
#file_table_modal {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
|
||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user