mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
move extension translate_string and file_repo pandora_enterprise#12333
This commit is contained in:
parent
6eefd38f65
commit
5bd689500c
@ -24,7 +24,7 @@ CREATE TABLE IF NOT EXISTS `tfiles_repo` (
|
|||||||
`description` varchar(500) NULL default '',
|
`description` varchar(500) NULL default '',
|
||||||
`hash` varchar(8) NULL default '',
|
`hash` varchar(8) NULL default '',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `tfiles_repo_group` (
|
CREATE TABLE IF NOT EXISTS `tfiles_repo_group` (
|
||||||
`id` int(10) unsigned NOT NULL auto_increment,
|
`id` int(10) unsigned NOT NULL auto_increment,
|
||||||
@ -32,6 +32,6 @@ CREATE TABLE IF NOT EXISTS `tfiles_repo_group` (
|
|||||||
`id_group` int(4) unsigned NOT NULL,
|
`id_group` int(4) unsigned NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
FOREIGN KEY (`id_file`) REFERENCES tfiles_repo(`id`) ON DELETE CASCADE
|
FOREIGN KEY (`id_file`) REFERENCES tfiles_repo(`id`) ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
81
pandora_console/godmode/files_repo/files_repo_get_file.php
Normal file
81
pandora_console/godmode/files_repo/files_repo_get_file.php
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Get public file repository.
|
||||||
|
*
|
||||||
|
* @category Files repository
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Enterprise
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2007-2023 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||||
|
* This code is NOT free software. This code is NOT licenced under GPL2 licence
|
||||||
|
* You cannnot redistribute it without written permission of copyright holder.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once '../../include/config.php';
|
||||||
|
|
||||||
|
$file_hash = (string) get_parameter('file');
|
||||||
|
|
||||||
|
// Only allow 1 parameter in the request.
|
||||||
|
$check_request = (count($_REQUEST) === 1) ? true : false;
|
||||||
|
$check_get = (count($_GET) === 1) ? true : false;
|
||||||
|
$check_post = (count($_POST) === 0) ? true : false;
|
||||||
|
|
||||||
|
// Only allow the parameter 'file'.
|
||||||
|
$check_parameter = (empty($file_hash) === false) ? true : false;
|
||||||
|
$check_string = (preg_match('/^[0-9a-zA-Z]{8}$/', $file_hash) === 1) ? true : false;
|
||||||
|
|
||||||
|
$checks = ($check_request && $check_get && $check_post && $check_parameter && $check_string);
|
||||||
|
if (!$checks) {
|
||||||
|
throw_error(15);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the db file row.
|
||||||
|
$file = db_get_row_filter('tfiles_repo', ['hash' => $file_hash]);
|
||||||
|
if (!$file) {
|
||||||
|
throw_error(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Case sensitive check.
|
||||||
|
$check_hash = ($file['hash'] == $file_hash) ? true : false;
|
||||||
|
if (!$check_hash) {
|
||||||
|
throw_error(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the location.
|
||||||
|
$files_repo_path = io_safe_output($config['attachment_store']).'/files_repo';
|
||||||
|
$location = $files_repo_path.'/'.$file['id'].'_'.$file['name'];
|
||||||
|
if (!file_exists($location) || !is_readable($location) || !is_file($location)) {
|
||||||
|
throw_error(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
// All checks are fine. Download the file!
|
||||||
|
header('Content-type: aplication/octet-stream;');
|
||||||
|
header('Content-Length: '.filesize($location));
|
||||||
|
header('Content-Disposition: attachment; filename="'.$file['name'].'"');
|
||||||
|
readfile($location);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show errors
|
||||||
|
*
|
||||||
|
* @param integer $time Sleep.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function throw_error($time=15)
|
||||||
|
{
|
||||||
|
sleep($time);
|
||||||
|
|
||||||
|
$styleError = 'background:url("../images/err.png") no-repeat scroll 0 0 transparent; padding:4px 1px 6px 30px; color:#CC0000;';
|
||||||
|
echo "<h3 style='".$styleError."'>".__('Unreliable petition').'. '.__('Please contact the administrator').'</h3>';
|
||||||
|
exit;
|
||||||
|
}
|
@ -94,8 +94,12 @@ if (empty($files) === false) {
|
|||||||
$data[4] = '';
|
$data[4] = '';
|
||||||
$table->cellclass[][4] = 'table_action_buttons';
|
$table->cellclass[][4] = 'table_action_buttons';
|
||||||
if (empty($file['hash']) === false) {
|
if (empty($file['hash']) === false) {
|
||||||
|
$url_get_public_file = ui_get_full_url(
|
||||||
|
'godmode/files_repo/files_repo_get_file.php?file='.$file['hash']
|
||||||
|
);
|
||||||
|
|
||||||
$message = __('Copy to clipboard').': Ctrl+C -> Enter';
|
$message = __('Copy to clipboard').': Ctrl+C -> Enter';
|
||||||
$action = 'window.prompt(\''.$message.'\', \''.$url_get_file.'\');';
|
$action = 'window.prompt(\''.$message.'\', \''.$url_get_public_file.'\');';
|
||||||
$data[4] .= '<a href="javascript:;" onclick="'.$action.'">';
|
$data[4] .= '<a href="javascript:;" onclick="'.$action.'">';
|
||||||
$data[4] .= html_print_image(
|
$data[4] .= html_print_image(
|
||||||
'images/world.png',
|
'images/world.png',
|
||||||
|
@ -712,15 +712,25 @@ if ($access_console_node === true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($access_console_node === true) {
|
if ($access_console_node === true) {
|
||||||
// Tools
|
// Tools.
|
||||||
$menu_godmode['tools']['text'] = __('Tools');
|
$menu_godmode['tools']['text'] = __('Tools');
|
||||||
$menu_godmode['tools']['sec2'] = 'operation/extensions';
|
$menu_godmode['tools']['sec2'] = 'operation/extensions';
|
||||||
$menu_godmode['tools']['id'] = 'oper-extensions';
|
$menu_godmode['tools']['id'] = 'oper-extensions';
|
||||||
$sub = [];
|
$sub = [];
|
||||||
$sub['operation/agentes/exportdata']['text'] = __('Export data');
|
|
||||||
$sub['operation/agentes/exportdata']['id'] = 'export_data';
|
if (check_acl($config['id_user'], 0, 'RR')
|
||||||
$sub['extensions/files_repo']['text'] = __('File repository');
|
|| check_acl($config['id_user'], 0, 'RW')
|
||||||
$sub['extensions/files_repo']['id'] = 'file_repository';
|
|| check_acl($config['id_user'], 0, 'RM')
|
||||||
|
) {
|
||||||
|
$sub['operation/agentes/exportdata']['text'] = __('Export data');
|
||||||
|
$sub['operation/agentes/exportdata']['id'] = 'export_data';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
||||||
|
$sub['godmode/files_repo/files_repo']['text'] = __('File repository');
|
||||||
|
$sub['godmode/files_repo/files_repo']['id'] = 'file_repository';
|
||||||
|
}
|
||||||
|
|
||||||
$menu_godmode['tools']['sub'] = $sub;
|
$menu_godmode['tools']['sub'] = $sub;
|
||||||
|
|
||||||
// About.
|
// About.
|
||||||
|
@ -734,29 +734,8 @@ if ($access_console_node === true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($access_console_node === true) {
|
if ($access_console_node === true) {
|
||||||
// Rest of options, all with AR privilege (or should events be with incidents?)
|
|
||||||
// ~ if (check_acl ($config['id_user'], 0, "AR")) {
|
|
||||||
// Extensions menu additions.
|
// Extensions menu additions.
|
||||||
if (is_array($config['extensions'])) {
|
if (is_array($config['extensions'])) {
|
||||||
$sub = [];
|
|
||||||
$sub2 = [];
|
|
||||||
|
|
||||||
if (check_acl($config['id_user'], 0, 'RR') || check_acl($config['id_user'], 0, 'RW') || check_acl($config['id_user'], 0, 'RM')) {
|
|
||||||
$sub['operation/agentes/exportdata']['text'] = __('Export data');
|
|
||||||
$sub['operation/agentes/exportdata']['id'] = 'Export_data';
|
|
||||||
$sub['operation/agentes/exportdata']['subsecs'] = ['operation/agentes/exportdata'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (check_acl($config['id_user'], 0, 'AR') || check_acl($config['id_user'], 0, 'AD') || check_acl($config['id_user'], 0, 'AW')) {
|
|
||||||
$sub['godmode/agentes/planned_downtime.list']['text'] = __('Scheduled downtime');
|
|
||||||
$sub['godmode/agentes/planned_downtime.list']['id'] = 'Scheduled_downtime';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
|
|
||||||
$sub['godmode/files_repo/files_repo']['text'] = __('File Repository');
|
|
||||||
$sub['godmode/files_repo/files_repo']['id'] = 'File_repository';
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($config['extensions'] as $extension) {
|
foreach ($config['extensions'] as $extension) {
|
||||||
// If no operation_menu is a godmode extension.
|
// If no operation_menu is a godmode extension.
|
||||||
if ($extension['operation_menu'] == '') {
|
if ($extension['operation_menu'] == '') {
|
||||||
@ -777,39 +756,19 @@ if ($access_console_node === true) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if was displayed inside other menu.
|
if (array_key_exists('fatherId', $extension_menu)) {
|
||||||
if ($extension['operation_menu']['fatherId'] == '') {
|
// Check that extension father ID exists previously on the menu.
|
||||||
if ($extension_menu['name'] == 'Update manager') {
|
if ((strlen($extension_menu['fatherId']) > 0)) {
|
||||||
continue;
|
if (array_key_exists('subfatherId', $extension_menu) && empty($extension_menu['subfatherId']) === false) {
|
||||||
}
|
if ((strlen($extension_menu['subfatherId']) > 0)) {
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['text'] = __($extension_menu['name']);
|
||||||
$sub[$extension_menu['sec2']]['text'] = $extension_menu['name'];
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
||||||
$sub[$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['refr'] = 0;
|
||||||
$sub[$extension_menu['sec2']]['refr'] = 0;
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['icon'] = $extension_menu['icon'];
|
||||||
} else {
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['sec'] = 'extensions';
|
||||||
if (array_key_exists('fatherId', $extension_menu)) {
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['extension'] = true;
|
||||||
// Check that extension father ID exists previously on the menu.
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['enterprise'] = $extension['enterprise'];
|
||||||
if ((strlen($extension_menu['fatherId']) > 0)) {
|
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
|
||||||
if (array_key_exists('subfatherId', $extension_menu) && empty($extension_menu['subfatherId']) === false) {
|
|
||||||
if ((strlen($extension_menu['subfatherId']) > 0)) {
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['text'] = __($extension_menu['name']);
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['refr'] = 0;
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['icon'] = $extension_menu['icon'];
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['sec'] = 'extensions';
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['extension'] = true;
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['enterprise'] = $extension['enterprise'];
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
|
|
||||||
} else {
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['text'] = __($extension_menu['name']);
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['refr'] = 0;
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['icon'] = $extension_menu['icon'];
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['sec'] = 'extensions';
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['extension'] = true;
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['enterprise'] = $extension['enterprise'];
|
|
||||||
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['text'] = __($extension_menu['name']);
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['text'] = __($extension_menu['name']);
|
||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
||||||
@ -820,13 +779,20 @@ if ($access_console_node === true) {
|
|||||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['enterprise'] = $extension['enterprise'];
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['enterprise'] = $extension['enterprise'];
|
||||||
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
|
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['text'] = __($extension_menu['name']);
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']);
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['refr'] = 0;
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['icon'] = $extension_menu['icon'];
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['sec'] = 'extensions';
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['extension'] = true;
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['enterprise'] = $extension['enterprise'];
|
||||||
|
$menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~ }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$menu_operation['about_operation']['text'] = __('About');
|
$menu_operation['about_operation']['text'] = __('About');
|
||||||
|
@ -125,10 +125,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||||||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||||
('custom_report_front_header', ''),
|
('custom_report_front_header', ''),
|
||||||
('custom_report_front_footer', ''),
|
('custom_report_front_footer', ''),
|
||||||
('MR', 66),
|
('MR', 67),
|
||||||
('identification_reminder', 1),
|
('identification_reminder', 1),
|
||||||
('identification_reminder_timestamp', 0),
|
('identification_reminder_timestamp', 0),
|
||||||
('current_package', 774),
|
('current_package', 775),
|
||||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.00097656250000":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'),
|
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.00097656250000":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'),
|
||||||
('custom_docs_logo', 'default_docs.png'),
|
('custom_docs_logo', 'default_docs.png'),
|
||||||
('custom_support_logo', 'default_support.png'),
|
('custom_support_logo', 'default_support.png'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user