diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php
index fbe3d7cb47..8c248367dc 100644
--- a/pandora_console/extensions/dbmanager.php
+++ b/pandora_console/extensions/dbmanager.php
@@ -11,6 +11,9 @@
// 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.
+use PandoraFMS\Enterprise\Metaconsole\Node;
+
+
function dbmanager_query($sql, &$error, $dbconnection)
{
global $config;
@@ -88,6 +91,10 @@ function dbmgr_extension_main()
global $config;
+ if (is_metaconsole() === true) {
+ open_meta_frame();
+ }
+
if (!is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
@@ -98,11 +105,59 @@ function dbmgr_extension_main()
}
$sql = (string) get_parameter('sql');
+ $node_id = (int) get_parameter('node_id', -1);
ui_print_page_header(__('Database interface'), 'images/gm_db.png', false, false, true);
- echo '
';
- echo __(
+ if (is_metaconsole() === true) {
+ $img = '../../images/warning_modern.png';
+ } else {
+ $img = 'images/warning_modern.png';
+ }
+
+ $msg = '
'.html_print_image(
+ $img,
+ true
+ );
+ $msg .= '
'.__(
+ 'Warning, you are accessing the database directly. You can leave the system inoperative if you run an inappropriate SQL statement'
+ ).'
';
+
+ $warning_message = '';
+
+ if (empty($sql) === true) {
+ echo $warning_message;
+ }
+
+ echo "
';
- echo ' ';
- echo "Some samples of usage: SHOW STATUS; DESCRIBE tagente SELECT * FROM tserver UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%' ";
+ $data[1][0] = "Some samples of usage: SHOW STATUS; DESCRIBE tagente SELECT * FROM tserver UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%' ";
- echo ' ';
- echo "';
// Processing SQL Code
@@ -137,10 +232,29 @@ function dbmgr_extension_main()
echo ' ';
echo ' ';
- $dbconnection = $config['dbconnection'];
- $error = '';
-
- $result = dbmanager_query($sql, $error, $dbconnection);
+ try {
+ if (\is_metaconsole() === true && $node_id !== -1) {
+ $node = new Node($node_id);
+ $dbconnection = @get_dbconnection(
+ [
+ 'dbhost' => $node->dbhost(),
+ 'dbport' => $node->dbport(),
+ 'dbname' => $node->dbname(),
+ 'dbuser' => $node->dbuser(),
+ 'dbpass' => $node->dbpass(),
+ ]
+ );
+ $error = '';
+ $result = dbmanager_query($sql, $error, $dbconnection);
+ } else {
+ $dbconnection = $config['dbconnection'];
+ $error = '';
+ $result = dbmanager_query($sql, $error, $dbconnection);
+ }
+ } catch (\Exception $e) {
+ $error = __('Error querying database node');
+ $result = false;
+ }
if ($result === false) {
echo 'An error has occured when querying the database. ';
@@ -181,9 +295,29 @@ function dbmgr_extension_main()
html_print_table($table);
echo '';
+
+ if (is_metaconsole()) {
+ close_meta_frame();
+ }
+
}
+if (is_metaconsole() === true) {
+ // This adds a option in the operation menu.
+ extensions_add_meta_menu_option(
+ 'DB interface',
+ 'PM',
+ 'gextensions',
+ 'database.png',
+ 'v1r1',
+ 'gdbman'
+ );
+
+ extensions_add_meta_function('dbmgr_extension_main');
+} else {
+}
+
// This adds a option in the operation menu
extensions_add_godmode_menu_option(__('DB interface'), 'PM', 'gextensions', 'dbmanager/icon.png', 'v1r1', 'gdbman');
diff --git a/pandora_console/extras/delete_files/delete_files.txt b/pandora_console/extras/delete_files/delete_files.txt
index 9cbab3b020..f7e065e3b0 100644
--- a/pandora_console/extras/delete_files/delete_files.txt
+++ b/pandora_console/extras/delete_files/delete_files.txt
@@ -119,4 +119,8 @@ godmode/admin_access_logs.php
enterprise/extensions/backup/main.php
enterprise/extensions/backup.php
mobile/include/javascript/jquery.mobile-1.4.5.js
-mobile/include/style/jquery.mobile-1.4.5.css
\ No newline at end of file
+mobile/include/style/jquery.mobile-1.4.5.css
+enterprise/extensions/backup/backup.js
+enterprise/extensions/backup/sql/backup.sql
+enterprise/extensions/backup/sql/backup.oracle.sql
+enterprise/extensions/backup/sql/backup.postgreSQL.sql
\ No newline at end of file
diff --git a/pandora_console/extras/mr/53.sql b/pandora_console/extras/mr/53.sql
new file mode 100644
index 0000000000..cbf408f5f2
--- /dev/null
+++ b/pandora_console/extras/mr/53.sql
@@ -0,0 +1,17 @@
+START TRANSACTION;
+
+UPDATE `tuser_task` SET `parameters` = 'a:3:{i:0;a:2:{s:11:"description";s:11:"Description";s:4:"type";s:4:"text";}i:1;a:3:{s:11:"description";s:20:"Save to disk in path";s:4:"type";s:6:"string";s:13:"default_value";s:21:"_%_ATTACHMENT_PATH_%_";}i:2;a:3:{s:11:"description";s:14:"Active backups";s:4:"type";s:6:"number";s:13:"default_value";i:3;}}' WHERE `function_name` = 'cron_task_do_backup';
+
+CREATE TABLE IF NOT EXISTS `tbackup` (
+ `id` SERIAL,
+ `utimestamp` BIGINT DEFAULT 0,
+ `filename` VARCHAR(512) DEFAULT '',
+ `id_user` VARCHAR(60) DEFAULT '',
+ `description` MEDIUMTEXT,
+ `pid` INT UNSIGNED DEFAULT 0,
+ `filepath` VARCHAR(512) DEFAULT '',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
+
+
+COMMIT;
\ No newline at end of file
diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php
index 4052f8af3d..21594cde81 100644
--- a/pandora_console/godmode/agentes/configurar_agente.php
+++ b/pandora_console/godmode/agentes/configurar_agente.php
@@ -31,6 +31,7 @@ global $config;
enterprise_include('godmode/agentes/configurar_agente.php');
enterprise_include_once('include/functions_modules.php');
+enterprise_include_once('include/functions_config_agents.php');
enterprise_include('include/functions_policies.php');
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_cron.php';
@@ -2001,6 +2002,7 @@ if ($disable_module) {
io_safe_output($module_name),
]
);
+
// Force disable.
$disabled = 1;
diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php
index fa881a6231..fa5b9d98b4 100644
--- a/pandora_console/godmode/servers/plugin.php
+++ b/pandora_console/godmode/servers/plugin.php
@@ -262,7 +262,8 @@ if ($filemanager) {
'index.php?sec=gservers&sec2=godmode/servers/plugin'.$chunck_url.'&plugin_command=[FILE_FULLPATH]&id_plugin='.$id_plugin,
true,
0775,
- false
+ false,
+ ['all' => true]
);
}
diff --git a/pandora_console/godmode/setup/file_manager.php b/pandora_console/godmode/setup/file_manager.php
index e969f1d57f..77a19d0072 100644
--- a/pandora_console/godmode/setup/file_manager.php
+++ b/pandora_console/godmode/setup/file_manager.php
@@ -65,13 +65,22 @@ $real_directory = realpath($config['homedir'].'/'.$directory);
echo ''.__('Index of %s', $directory).' ';
-$upload_file_or_zip = (bool) get_parameter('upload_file_or_zip');
+$upload_file = (bool) get_parameter('upload_file');
$create_text_file = (bool) get_parameter('create_text_file');
$default_real_directory = realpath($config['homedir'].'/');
-if ($upload_file_or_zip === true) {
- upload_file($upload_file_or_zip, $default_real_directory, $real_directory);
+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) {
@@ -89,5 +98,6 @@ filemanager_file_explorer(
false,
'',
false,
- false
+ false,
+ []
);
diff --git a/pandora_console/include/class/TreeGroup.class.php b/pandora_console/include/class/TreeGroup.class.php
index dbc48b9296..a5b9757fba 100644
--- a/pandora_console/include/class/TreeGroup.class.php
+++ b/pandora_console/include/class/TreeGroup.class.php
@@ -391,37 +391,29 @@ class TreeGroup extends Tree
$groups[$group['id']] = $group;
}
- // Build the module hierarchy
+ // Build the module hierarchy.
foreach ($groups as $id => $group) {
- if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) {
+ if (isset($groups[$id]['parent']) === true && ($groups[$id]['parent'] != 0)) {
$parent = $groups[$id]['parent'];
- // Parent exists
- if (!isset($groups[$parent]['children'])) {
+ // Parent exists.
+ if (isset($groups[$parent]['children']) === true) {
$groups[$parent]['children'] = [];
}
- // Store a reference to the group into the parent
+ // Store a reference to the group into the parent.
$groups[$parent]['children'][] = &$groups[$id];
- // This group was introduced into a parent
+ // This group was introduced into a parent.
$groups[$id]['have_parent'] = true;
}
}
- // Sort the children groups
+ // Sort the children groups.
foreach ($groups as $id => $group) {
- if (isset($groups[$id]['children'])) {
+ if (isset($groups[$id]['children']) === true) {
usort($groups[$id]['children'], ['Tree', 'cmpSortNames']);
}
}
- // Filter groups and eliminates the reference to children groups out of her parent
- $groups = array_filter(
- $groups,
- function ($group) {
- return !($group['have_parent'] ?? false);
- }
- );
-
return array_values($groups);
}
diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php
index ba7ef746da..d83bede062 100644
--- a/pandora_console/include/constants.php
+++ b/pandora_console/include/constants.php
@@ -788,6 +788,7 @@ define('AUDIT_LOG_MASSIVE_MANAGEMENT', 'Massive operation management');
define('AUDIT_LOG_POLICY_MANAGEMENT', 'Policy management');
define('AUDIT_LOG_AGENT_REMOTE_MANAGEMENT', 'Agent remote configuration');
define('AUDIT_LOG_FILE_COLLECTION', 'File collection');
+define('AUDIT_LOG_FILE_MANAGER', 'File manager');
define('AUDIT_LOG_ALERT_MANAGEMENT', 'Alert management');
define('AUDIT_LOG_ALERT_CORRELATION_MANAGEMENT', 'Alert correlation management');
define('AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT', 'Visual Console Management');
@@ -796,3 +797,58 @@ define('AUDIT_LOG_SNMP_MANAGEMENT', 'SNMP management');
define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management');
define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management');
define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');
+
+// MIMEs.
+define(
+ 'MIME_TYPES',
+ [
+ 'txt' => 'text/plain',
+ 'htm' => 'text/html',
+ 'html' => 'text/html',
+ 'php' => 'text/html',
+ 'css' => 'text/css',
+ 'js' => 'application/javascript',
+ 'json' => 'application/json',
+ 'xml' => 'application/xml',
+ 'swf' => 'application/x-shockwave-flash',
+ 'flv' => 'video/x-flv',
+ // Images.
+ 'png' => 'image/png',
+ 'jpe' => 'image/jpeg',
+ 'jpeg' => 'image/jpeg',
+ 'jpg' => 'image/jpeg',
+ 'gif' => 'image/gif',
+ 'bmp' => 'image/bmp',
+ 'ico' => 'image/vnd.microsoft.icon',
+ 'tiff' => 'image/tiff',
+ 'tif' => 'image/tiff',
+ 'svg' => 'image/svg+xml',
+ 'svgz' => 'image/svg+xml',
+ // Archives.
+ 'zip' => 'application/zip',
+ 'rar' => 'application/x-rar-compressed',
+ 'exe' => 'application/x-msdownload',
+ 'msi' => 'application/x-msdownload',
+ 'cab' => 'application/vnd.ms-cab-compressed',
+ 'gz' => 'application/x-gzip',
+ 'gz' => 'application/x-bzip2',
+ // Audio/Video.
+ 'mp3' => 'audio/mpeg',
+ 'qt' => 'video/quicktime',
+ 'mov' => 'video/quicktime',
+ // Adobe.
+ 'pdf' => 'application/pdf',
+ 'psd' => 'image/vnd.adobe.photoshop',
+ 'ai' => 'application/postscript',
+ 'eps' => 'application/postscript',
+ 'ps' => 'application/postscript',
+ // MS Office.
+ 'doc' => 'application/msword',
+ 'rtf' => 'application/rtf',
+ 'xls' => 'application/vnd.ms-excel',
+ 'ppt' => 'application/vnd.ms-powerpoint',
+ // Open Source Office files.
+ 'odt' => 'application/vnd.oasis.opendocument.text',
+ 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
+ ]
+);
diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php
index 26f41a2589..6733be09ae 100644
--- a/pandora_console/include/functions_events.php
+++ b/pandora_console/include/functions_events.php
@@ -4187,6 +4187,28 @@ function events_get_response_target(
);
}
+ if (strpos($target, '_owner_username_') !== false) {
+ if (empty($event['owner_user']) === false) {
+ $fullname = users_get_user_by_id($event['owner_user']);
+ $target = str_replace(
+ '_owner_username_',
+ io_safe_output($fullname['fullname']),
+ $target
+ );
+ } else {
+ $target = str_replace('_owner_username_', __('N/A'), $target);
+ }
+ }
+
+ if (strpos($target, '_current_username_') !== false) {
+ $fullname = users_get_user_by_id($config['id_user']);
+ $target = str_replace(
+ '_current_username_',
+ io_safe_output($fullname['fullname']),
+ $target
+ );
+ }
+
return $target;
}
@@ -7588,6 +7610,28 @@ function events_get_field_value_by_event_id(
$value = str_replace('_current_user_', $config['id_user'], $value);
}
+ if (strpos($value, '_owner_username_') !== false) {
+ if (empty($event['owner_user']) === false) {
+ $fullname = users_get_user_by_id($event['owner_user']);
+ $value = str_replace(
+ '_owner_username_',
+ io_safe_output($fullname['fullname']),
+ $value
+ );
+ } else {
+ $value = str_replace('_owner_username_', __('N/A'), $value);
+ }
+ }
+
+ if (strpos($value, '_current_username_') !== false) {
+ $fullname = users_get_user_by_id($config['id_user']);
+ $value = str_replace(
+ '_current_username_',
+ io_safe_output($fullname['fullname']),
+ $value
+ );
+ }
+
return $value;
}
diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php
index b33b68aac7..0879ce678c 100644
--- a/pandora_console/include/functions_filemanager.php
+++ b/pandora_console/include/functions_filemanager.php
@@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
- * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
+ * 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
@@ -48,69 +48,22 @@ if (function_exists('mime_content_type') === false) {
*/
function mime_content_type(string $filename)
{
- $mime_types = [
- 'txt' => 'text/plain',
- 'htm' => 'text/html',
- 'html' => 'text/html',
- 'php' => 'text/html',
- 'css' => 'text/css',
- 'js' => 'application/javascript',
- 'json' => 'application/json',
- 'xml' => 'application/xml',
- 'swf' => 'application/x-shockwave-flash',
- 'flv' => 'video/x-flv',
- // Images.
- 'png' => 'image/png',
- 'jpe' => 'image/jpeg',
- 'jpeg' => 'image/jpeg',
- 'jpg' => 'image/jpeg',
- 'gif' => 'image/gif',
- 'bmp' => 'image/bmp',
- 'ico' => 'image/vnd.microsoft.icon',
- 'tiff' => 'image/tiff',
- 'tif' => 'image/tiff',
- 'svg' => 'image/svg+xml',
- 'svgz' => 'image/svg+xml',
- // Archives.
- 'zip' => 'application/zip',
- 'rar' => 'application/x-rar-compressed',
- 'exe' => 'application/x-msdownload',
- 'msi' => 'application/x-msdownload',
- 'cab' => 'application/vnd.ms-cab-compressed',
- 'gz' => 'application/x-gzip',
- 'gz' => 'application/x-bzip2',
- // Audio/Video.
- 'mp3' => 'audio/mpeg',
- 'qt' => 'video/quicktime',
- 'mov' => 'video/quicktime',
- // Adobe.
- 'pdf' => 'application/pdf',
- 'psd' => 'image/vnd.adobe.photoshop',
- 'ai' => 'application/postscript',
- 'eps' => 'application/postscript',
- 'ps' => 'application/postscript',
- // MS Office.
- 'doc' => 'application/msword',
- 'rtf' => 'application/rtf',
- 'xls' => 'application/vnd.ms-excel',
- 'ppt' => 'application/vnd.ms-powerpoint',
- // Open Source Office files.
- 'odt' => 'application/vnd.oasis.opendocument.text',
- 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
- ];
-
$ext_fields = explode('.', $filename);
$ext = array_pop($ext_fields);
$ext = strtolower($ext);
- if (array_key_exists($ext, $mime_types) === true) {
- return $mime_types[$ext];
+ if (array_key_exists($ext, MIME_TYPES) === true) {
+ return MIME_TYPES[$ext];
} else if (function_exists('finfo_open') === true) {
$finfo = finfo_open(FILEINFO_MIME);
$mimetype = finfo_file($finfo, $filename);
finfo_close($finfo);
return $mimetype;
} else {
- error_log('Warning: Cannot find finfo_open function. Fileinfo extension is not enabled. Please add "extension=fileinfo.so" or "extension=fileinfo.dll" in your php.ini');
+ db_pandora_audit(
+ AUDIT_LOG_FILE_MANAGER,
+ 'Warning: Cannot find finfo_open function. Fileinfo extension is not enabled. Please add "extension=fileinfo.so" or "extension=fileinfo.dll" in your php.ini'
+ );
+
return 'unknown';
}
}
@@ -129,10 +82,12 @@ require_once $config['homedir'].'/vendor/autoload.php';
* @param boolean $upload_file_or_zip Upload file or zip.
* @param string $default_real_directory String with default directory.
* @param string $destination_directory String with destination directory.
+ * @param array $filterFilesType If come filled, filter uploaded files with this extensions.
*
+ * @throws Exception Exception.
* @return void
*/
-function upload_file($upload_file_or_zip, $default_real_directory, $destination_directory)
+function upload_file($upload_file_or_zip, $default_real_directory, $destination_directory, $filterFilesType=[])
{
global $config;
$config['filemanager'] = [];
@@ -179,13 +134,24 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
// controlled by corresponding .htaccess).
$config['filemanager']['message'] = ui_print_error_message(__('Security error'));
} else {
+ $result = false;
// Copy file to directory and change name.
$nombre_archivo = sprintf('%s/%s', $real_directory, $filename);
-
try {
- $result = copy($_FILES['file']['tmp_name'], $nombre_archivo);
+ $mimeContentType = mime_content_type($_FILES['file']['tmp_name']);
+
+ if (empty($filterFilesType) === true || in_array($mimeContentType, $filterFilesType) === true) {
+ $result = copy($_FILES['file']['tmp_name'], $nombre_archivo);
+ } else {
+ $error_message = 'The uploaded file is not allowed. Only gif, png or jpg files can be uploaded.';
+ throw new Exception(__($error_message));
+ }
} catch (Exception $ex) {
- $result = false;
+ db_pandora_audit(
+ AUDIT_LOG_FILE_MANAGER,
+ 'Error Uploading files: '.$ex->getMessage()
+ );
+ $config['filemanager']['message'] = ui_print_error_message(__('Upload error').': '.$ex->getMessage());
}
if ($result === true) {
@@ -203,8 +169,6 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
$config['filemanager']['correct_upload_file'] = 1;
// Delete temporal file.
unlink($_FILES['file']['tmp_name']);
- } else {
- $config['filemanager']['message'] = ui_print_error_message(__('Upload error'));
}
}
}
@@ -496,7 +460,7 @@ function filemanager_read_recursive_dir($dir, $relative_path='', $add_empty_dirs
* @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 boolean $homedir_filemanager Homedir filemanager.
- * @param boolean $allowCreateText If true, 'Create Text' button will be shown.
+ * @param array $options Associative array. ['all' => true] will show all options. Check function for valid options.
*/
function filemanager_file_explorer(
$real_directory,
@@ -509,7 +473,7 @@ function filemanager_file_explorer(
$download_button=false,
$umask='',
$homedir_filemanager=false,
- $allowCreateText=true
+ $options=[]
) {
global $config;
@@ -517,6 +481,9 @@ function filemanager_file_explorer(
$real_directory = str_replace('\\', '/', $real_directory);
$relative_directory = str_replace('\\', '/', $relative_directory);
$father = str_replace('\\', '/', $father);
+ // Options.
+ $allowZipFiles = (isset($options['all']) === true) || ((isset($options['allowZipFiles']) === true) && ($options['allowZipFiles'] === true));
+ $allowCreateText = (isset($options['all']) === true) || ((isset($options['allowCreateText']) === true) && ($options['allowCreateText'] === true));
if ($homedir_filemanager === false) {
$homedir_filemanager = $config['homedir'];
@@ -530,7 +497,7 @@ function filemanager_file_explorer(
actions_dialog('create_folder');
$("#create_folder").css("display", "block");
check_opened_dialog('create_folder');
- }
+ }
function show_create_text_file() {
actions_dialog('create_text_file');
@@ -542,7 +509,7 @@ function filemanager_file_explorer(
actions_dialog('upload_file');
$("#upload_file").css("display", "block");
check_opened_dialog('upload_file');
- }
+ }
function check_opened_dialog(check_opened){
if(check_opened !== 'create_folder'){
@@ -579,11 +546,11 @@ function filemanager_file_explorer(
case 'upload_file':
title_action = "";
break;
-
+
default:
break;
}
-
+
$('#'+action)
.dialog({
title: title_action,
@@ -839,15 +806,86 @@ function filemanager_file_explorer(
$tabs_dialog .= '';
- echo ''.$tabs_dialog.'
-
';
+ // Create folder section.
+ $createFolderElements = $tabs_dialog;
+ $createFolderElements .= sprintf('';
- echo ' '.$tabs_dialog.'
-
';
+ html_print_div(
+ [
+ 'id' => 'create_folder',
+ 'class' => 'invisible',
+ 'content' => $createFolderElements,
+ ]
+ );
+ // Upload file section.
+ $uploadFileElements = $tabs_dialog;
+ $uploadFileElements .= sprintf('';
+
+ html_print_div(
+ [
+ 'id' => 'upload_file',
+ 'class' => 'invisible',
+ 'content' => $uploadFileElements,
+ ]
+ );
+
+ // Create text section.
if ($allowCreateText === true) {
- echo ' '.$tabs_dialog.'
-
';
+ $createTextElements = $tabs_dialog;
+ $createTextElements .= '';
+
+ html_print_div(
+ [
+ 'id' => 'create_text_file',
+ 'class' => 'invisible',
+ 'content' => $createTextElements,
+ ]
+ );
}
echo "";
diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php
index 1d0c8cf298..a53246c071 100644
--- a/pandora_console/include/functions_html.php
+++ b/pandora_console/include/functions_html.php
@@ -4267,6 +4267,10 @@ function html_print_input_file($name, $return=false, $options=false)
if (isset($options['onchange'])) {
$output .= ' onchange="'.$options['onchange'].'"';
}
+
+ if (isset($options['style']) === true) {
+ $output .= ' style="'.$options['style'].'"';
+ }
}
$output .= ' />';
diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php
index 41f04104f1..95abe0ede1 100755
--- a/pandora_console/include/functions_ui.php
+++ b/pandora_console/include/functions_ui.php
@@ -2713,16 +2713,15 @@ function ui_print_status_image(
$imagepath = $path;
}
- if ($imagepath == 'images/status_sets/default') {
+ if ($imagepath === 'images/status_sets/default') {
$image_with_css = true;
}
- $imagepath .= '/'.$type;
-
if ($image_with_css === true) {
$shape_status = get_shape_status_set($type);
return ui_print_status_sets($type, $title, $return, $shape_status, $extra_info);
} else {
+ $imagepath .= '/'.$type;
if ($options === false) {
$options = [];
}
@@ -2871,7 +2870,7 @@ function ui_print_status_sets(
$options = [];
}
- if (isset($options['style'])) {
+ if (isset($options['style']) === true) {
$options['style'] .= ' display: inline-block;';
} else {
$options['style'] = 'display: inline-block;';
@@ -2881,15 +2880,15 @@ function ui_print_status_sets(
$options['style'] .= ' background: '.modules_get_color_status($status).';';
}
- if (isset($options['class'])) {
+ if (isset($options['class']) === true) {
$options['class'] = $options['class'];
}
- if ($title != '') {
- $options['title'] = empty($extra_info) ? $title : $title.'
'.$extra_info;
- $options['data-title'] = empty($extra_info) ? $title : $title.' '.$extra_info;
+ if (empty($title) === false) {
+ $options['title'] = (empty($extra_info) === true) ? $title : $title.'
'.$extra_info;
+ $options['data-title'] = (empty($extra_info) === true) ? $title : $title.' '.$extra_info;
$options['data-use_title_for_force_title'] = 1;
- if (isset($options['class'])) {
+ if (isset($options['class']) === true) {
$options['class'] .= ' forced_title';
} else {
$options['class'] = 'forced_title';
@@ -2901,15 +2900,13 @@ function ui_print_status_sets(
$output .= $k.'="'.$v.'"';
}
- $output .= '>';
- $output .= '
';
+ $output .= '> ';
if ($return === false) {
echo $output;
+ } else {
+ return $output;
}
-
- return $output;
-
}
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index b6a7a72d93..c270ddd8ac 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -5092,6 +5092,17 @@ input:checked + .p-slider:before {
margin-top: 10px;
}
+#upload_file #upload_file_input_full {
+ width: 100%;
+ border: 1px solid #cbcbcb;
+ border-radius: 2px;
+ padding: 5px 0;
+}
+
+#upload_file_input_full input#file-file::-webkit-file-upload-button {
+ margin-left: 5px;
+}
+
.file_table_modal_active {
background-color: #fff;
border: 1px solid #e6e6e6;
diff --git a/pandora_console/mobile/include/style/main.css b/pandora_console/mobile/include/style/main.css
index a87ecaff2a..a6a2e0713a 100755
--- a/pandora_console/mobile/include/style/main.css
+++ b/pandora_console/mobile/include/style/main.css
@@ -1344,6 +1344,12 @@ span.nobold * {
border-radius: 50%;
}
+.status_small_rectangles {
+ width: 20px;
+ height: 10px;
+ display: inline-block;
+}
+
.ui-content .ui-listview,
.ui-panel-inner > .ui-listview {
margin: 0 !important;
diff --git a/pandora_console/mobile/include/ui.class.php b/pandora_console/mobile/include/ui.class.php
index 023ee35ed7..4bfeae3fee 100755
--- a/pandora_console/mobile/include/ui.class.php
+++ b/pandora_console/mobile/include/ui.class.php
@@ -790,12 +790,11 @@ class Ui
echo ' '.$this->title." \n";
echo " \n";
echo " \n";
+ echo ' '."\n";
+ echo ' '."\n";
echo " \n";
- // echo " \n";
echo " \n";
- // echo " \n";
echo " \n";
- // echo " \n";
echo " \n";
echo " \n";
echo " \n";
diff --git a/pandora_console/mobile/operation/agent.php b/pandora_console/mobile/operation/agent.php
index 35b2155d07..84e45f3164 100644
--- a/pandora_console/mobile/operation/agent.php
+++ b/pandora_console/mobile/operation/agent.php
@@ -1,15 +1,33 @@
id."';
@@ -256,10 +274,9 @@ class Agent
SECONDS_1DAY,
'',
true,
- false,
true,
- 1,
- ''
+ 500,
+ 1
);
$html .= '';
$html .= '';
diff --git a/pandora_console/mobile/operation/agents.php b/pandora_console/mobile/operation/agents.php
index f76c17dab8..1a6b0061e2 100644
--- a/pandora_console/mobile/operation/agents.php
+++ b/pandora_console/mobile/operation/agents.php
@@ -1,15 +1,33 @@
getListAgents($page, true);
- if (!empty($listAgents['agents'])) {
+ if (empty($listAgents['agents']) === false) {
$end = 0;
$agents = [];
@@ -96,7 +114,7 @@ class Agents
$system = System::getInstance();
$user = User::getInstance();
- // Default
+ // Default.
$filters = [
'free_search' => '',
'status' => -1,
@@ -104,7 +122,7 @@ class Agents
];
$serialized_filters = (string) $system->getRequest('agents_filter');
- if (!empty($serialized_filters)) {
+ if (empty($serialized_filters) === true) {
$filters_unsafe = json_decode(base64_decode($serialized_filters, true), true);
if ($filters_unsafe) {
$filters = $system->safeInput($filters_unsafe);
@@ -144,8 +162,8 @@ class Agents
$filters['group'] = $this->group;
}
- if (!empty($filters)) {
- // Store the filter
+ if (empty($filters) === false) {
+ // Store the filter.
$this->serializedFilters = base64_encode(json_encode($system->safeOutput($filters)));
}
}
@@ -260,7 +278,7 @@ class Agents
$search_sql = '';
- if (!empty($this->free_search)) {
+ if (empty($this->free_search) === false) {
$search_sql = " AND (
alias LIKE '%".$this->free_search."%'
OR nombre LIKE '%".$this->free_search."%'
@@ -461,15 +479,13 @@ class Agents
"
@@ -347,12 +347,12 @@ enterprise_hook('close_meta_frame');
var treeController = TreeController.getController();
processTreeSearch();
-
+
$("form#tree_search").submit(function(e) {
e.preventDefault();
processTreeSearch();
});
-
+
function processTreeSearch () {
// Clear the tree
if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0)
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index e3d949cb48..84d526f396 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -4226,3 +4226,17 @@ CREATE TABLE IF NOT EXISTS `tncm_firmware` (
`path` TEXT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
+
+-- ----------------------------------------------------------------------
+-- Table `tbackup`
+-- ----------------------------------------------------------------------
+CREATE TABLE IF NOT EXISTS `tbackup` (
+ `id` SERIAL,
+ `utimestamp` BIGINT DEFAULT 0,
+ `filename` VARCHAR(512) DEFAULT '',
+ `id_user` VARCHAR(60) DEFAULT '',
+ `description` MEDIUMTEXT,
+ `pid` INT UNSIGNED DEFAULT 0,
+ `filepath` VARCHAR(512) DEFAULT '',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;