mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-08-20 09:18:38 +02:00
Improved error message
This commit is contained in:
parent
d553ab04a9
commit
67ade2fccd
@ -31,7 +31,7 @@ global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access File manager'
|
||||
@ -43,7 +43,24 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
require_once 'include/functions_filemanager.php';
|
||||
|
||||
// Header.
|
||||
ui_print_page_header(__('File manager'), '', false, '', true);
|
||||
ui_print_standard_header(
|
||||
__('File manager'),
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
[],
|
||||
[
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Admin tools'),
|
||||
],
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('File manager'),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
if (isset($config['filemanager']['message']) === true) {
|
||||
echo $config['filemanager']['message'];
|
||||
@ -66,7 +83,7 @@ $real_directory = realpath($config['homedir'].'/'.$directory);
|
||||
echo '<h4>'.__('Index of %s', io_safe_input($directory)).'</h4>';
|
||||
|
||||
$upload_file = (bool) get_parameter('upload_file');
|
||||
$create_text_file = (bool) get_parameter('create_text_file');
|
||||
$create_text_file = (bool) get_parameter('create_text_file');
|
||||
|
||||
$default_real_directory = realpath($config['homedir'].'/');
|
||||
|
||||
|
@ -476,6 +476,12 @@ function filemanager_file_explorer(
|
||||
$options=[]
|
||||
) {
|
||||
global $config;
|
||||
// Requirements for message dialog.
|
||||
ui_require_css_file('dialog');
|
||||
ui_require_jquery_file('jquery-ui.min');
|
||||
ui_require_jquery_file('jquery-ui_custom');
|
||||
// Check for errors.
|
||||
$errorOutput = (string) get_parameter('errorOutput');
|
||||
|
||||
// Windows compatibility.
|
||||
$real_directory = str_replace('\\', '/', $real_directory);
|
||||
@ -492,7 +498,17 @@ function filemanager_file_explorer(
|
||||
$hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
|
||||
|
||||
?>
|
||||
<div id="modalAlert"></div>
|
||||
<script type="text/javascript">
|
||||
<?php if (empty($errorOutput) === false) : ?>
|
||||
$("#modalAlert").html('<?php echo io_safe_output($errorOutput); ?>');
|
||||
$("#modalAlert").dialog ({
|
||||
title: '<?php echo __('Error'); ?>',
|
||||
resizable: false,
|
||||
draggable: false,
|
||||
width: 450
|
||||
});
|
||||
<?php endif; ?>
|
||||
function show_form_create_folder() {
|
||||
actions_dialog('create_folder');
|
||||
$("#create_folder").css("display", "block");
|
||||
|
@ -1,17 +1,32 @@
|
||||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Don't start a session before this import.
|
||||
// The session is configured and started inside the config process.
|
||||
/**
|
||||
* Get File script
|
||||
*
|
||||
* @category File manager
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Get global data.
|
||||
require_once 'config.php';
|
||||
require_once 'functions.php';
|
||||
require_once 'functions_filemanager.php';
|
||||
@ -22,7 +37,7 @@ check_login();
|
||||
|
||||
$auth_method = db_get_value('value', 'tconfig', 'token', 'auth');
|
||||
|
||||
if ($auth_method != 'ad' && $auth_method != 'ldap') {
|
||||
if ($auth_method !== 'ad' && $auth_method !== 'ldap') {
|
||||
include_once 'auth/'.$auth_method.'.php';
|
||||
}
|
||||
|
||||
@ -70,8 +85,21 @@ if ($file === '' || $hash === '' || $hash !== md5($file_raw.$config['server_uniq
|
||||
}
|
||||
}
|
||||
|
||||
if ($downloadable_file === '' || !file_exists($downloadable_file)) {
|
||||
echo "<h3 style='".$styleError."'>".__('File is missing in disk storage. Please contact the administrator.').'</h3>';
|
||||
if (empty($downloadable_file) === true || file_exists($downloadable_file) === false) {
|
||||
?>
|
||||
<div id="mainDiv"></div>
|
||||
<script type="text/javascript">
|
||||
var refererPath = '<?php echo $_SERVER['HTTP_REFERER']; ?>';
|
||||
var errorOutput = '<?php echo __('File is missing in disk storage. Please contact the administrator.'); ?>';
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('mainDiv').innerHTML = `<form action="` + refererPath + `" name="failedReturn" method="post" style="display:none;">
|
||||
<input type="hidden" name="errorOutput" value="` + errorOutput + `" />
|
||||
</form>`;
|
||||
|
||||
document.forms['failedReturn'].submit();
|
||||
}, false);
|
||||
</script>
|
||||
<?php
|
||||
} else {
|
||||
header('Content-type: aplication/octet-stream;');
|
||||
header('Content-type: '.mime_content_type($downloadable_file).';');
|
||||
|
Loading…
x
Reference in New Issue
Block a user