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.'<br>'.$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.'<br>'.$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 .= '</div>'; + $output .= '> </div>'; if ($return === false) { echo $output; + } else { + return $output; } - - return $output; - } diff --git a/pandora_console/mobile/include/style/main.css b/pandora_console/mobile/include/style/main.css index 70fbdd9da7..c93ac542c3 100755 --- a/pandora_console/mobile/include/style/main.css +++ b/pandora_console/mobile/include/style/main.css @@ -1348,6 +1348,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 ' <title>'.$this->title."</title>\n"; echo " <meta charset='UTF-8' />\n"; echo " <meta name='viewport' content='width=device-width, initial-scale=1'>\n"; + echo ' <link rel="icon" href="'.ui_get_full_url('/').ui_get_favicon().'" type="image/ico" />'."\n"; + echo ' <link rel="shortcut icon" href="'.ui_get_full_url('/').ui_get_favicon().'" type="image/x-icon" />'."\n"; echo " <link rel='stylesheet' href='include/style/main.css' />\n"; - // echo " <link rel='stylesheet' href='include/style/jquery.mobile-1.4.5.css' />\n"; echo " <link rel='stylesheet' href='include/style/jquery.mobile-1.5.0-rc1.min.css' />\n"; - // echo " <script src='include/javascript/jquery.js.bakc'></script>\n"; echo " <script src='include/javascript/jquery.js'></script>\n"; - // echo " <script src='include/javascript/jquery.mobile-1.4.5.js'></script>\n"; echo " <script src='include/javascript/jquery.mobile-1.5.0-rc1.js'></script>\n"; echo " <script src='../include/javascript/pandora.js'></script>\n"; echo " <script src='../include/javascript/pandora_ui.js'></script>\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 @@ <?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 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. +// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps +/** + * Agent view for mobile + * + * @category Mobile + * @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. + * ============================================================================ + */ + +// Begin. require_once '../include/functions_users.php'; class Agent @@ -41,7 +59,7 @@ class Agent var isgentoo = /Gentoo/i.test(navigator.userAgent); var iscentos = /CentOS/i.test(navigator.userAgent); var issuse = /SUSE/i.test(navigator.userAgent); - + if(!(ismobile) && !(iswindows) && !(ismac) && !(isubuntu) && !(isfedora) && !(isredhat) && !(isdebian) && !(isgentoo) && !(iscentos) && !(issuse)){ window.location.href = '".$config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$this->id."'; @@ -256,10 +274,9 @@ class Agent SECONDS_1DAY, '', true, - false, true, - 1, - '' + 500, + 1 ); $html .= '</div>'; $html .= '</div>'; 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 @@ <?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 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. +// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps +/** + * Agents list view for mobile + * + * @category Mobile + * @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. + * ============================================================================ + */ + +// Begin. class Agents { @@ -67,7 +85,7 @@ class Agents $listAgents = $this->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 "<script type=\"text/javascript\"> var load_more_rows = 1; var page = 1; - + function custom_scroll() { - if (load_more_rows) { if ($(this).scrollTop() + $(this).height() >= ($(document).height() - 100)) { - load_more_rows = 0; - + postvars = {}; postvars[\"action\"] = \"ajax\"; postvars[\"parameter1\"] = \"agents\"; @@ -479,7 +495,7 @@ class Agents postvars[\"free_search\"] = $(\"input[name='free_search']\").val(); postvars[\"page\"] = page; page++; - + $.post(\"index.php\", postvars, function (data) { @@ -499,23 +515,26 @@ class Agents \"<td class='cell_6'>\" + agent[8] + \"</td>\" + \"</tr>\"); }); - + load_more_rows = 1; refresh_link_listener_list_agents(); } - - }, \"json\"); + // Clean + $('#loading_rows').remove(); } } } - + $(document).ready(function() { + // Be sure of fill all of screen first. + custom_scroll(); + $(window).bind(\"scroll\", function () { custom_scroll(); }); - + $(window).on(\"touchmove\", function(event) { custom_scroll(); }); diff --git a/pandora_console/mobile/operation/alerts.php b/pandora_console/mobile/operation/alerts.php index d898b7584b..c1857f44f5 100644 --- a/pandora_console/mobile/operation/alerts.php +++ b/pandora_console/mobile/operation/alerts.php @@ -1,15 +1,33 @@ <?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 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. +// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps +/** + * Alerts list view for mobile + * + * @category Mobile + * @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. + * ============================================================================ + */ + +// Begin. class Alerts { diff --git a/pandora_console/mobile/operation/modules.php b/pandora_console/mobile/operation/modules.php index 1d0b91bcb5..d610c5a13a 100644 --- a/pandora_console/mobile/operation/modules.php +++ b/pandora_console/mobile/operation/modules.php @@ -1,15 +1,33 @@ <?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 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. +// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps +/** + * Modules list view for mobile + * + * @category Mobile + * @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. + * ============================================================================ + */ + +// Begin. class Modules { @@ -106,7 +124,7 @@ class Modules } if (isset($filters['status'])) { - $this->status = $filters['status']; + $this->status = (int) $filters['status']; } if (isset($filters['name'])) { @@ -143,7 +161,7 @@ class Modules } $this->status = $system->getRequest('status', __('Status')); - if (($this->status === __('Status')) || ($this->status == AGENT_MODULE_STATUS_ALL)) { + if (($this->status === __('Status')) || ((int) $this->status === AGENT_MODULE_STATUS_ALL)) { $this->status = AGENT_MODULE_STATUS_ALL; } else { $this->default = false; @@ -390,35 +408,28 @@ class Modules } // Part SQL fro Status - if ($this->status == AGENT_MODULE_STATUS_NORMAL) { - // Normal - $sql_conditions .= ' AND tagente_estado.estado = 0 + if ((int) $this->status == AGENT_MODULE_STATUS_NORMAL) { + // Normal. + $sql_conditions .= ' AND tagente_estado.estado = 0 AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) '; - } else if ($this->status == AGENT_MODULE_STATUS_CRITICAL_BAD) { - // Critical + } else if ((int) $this->status === AGENT_MODULE_STATUS_CRITICAL_BAD) { + // Critical. $sql_conditions .= ' AND tagente_estado.estado = 1 AND utimestamp > 0'; - } else if ($this->status == AGENT_MODULE_STATUS_WARNING) { - // Warning + } else if ((int) $this->status === AGENT_MODULE_STATUS_WARNING) { + // Warning. $sql_conditions .= ' AND tagente_estado.estado = 2 AND utimestamp > 0'; - } else if ($this->status == AGENT_MODULE_STATUS_NOT_NORMAL) { - // Not normal + } else if ((int) $this->status === AGENT_MODULE_STATUS_NOT_NORMAL) { + // Not normal. $sql_conditions .= ' AND tagente_estado.estado <> 0'; - } else if ($this->status == AGENT_MODULE_STATUS_UNKNOWN) { - // Unknown + } else if ((int) $this->status === AGENT_MODULE_STATUS_UNKNOWN) { + // Unknown. $sql_conditions .= ' AND tagente_estado.estado = 3 AND tagente_estado.utimestamp <> 0'; - } else if ($this->status == AGENT_MODULE_STATUS_NOT_INIT) { - // Not init + } else if ((int) $this->status === AGENT_MODULE_STATUS_NOT_INIT) { + // Not init. $sql_conditions .= ' AND tagente_estado.utimestamp = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)'; } - if ($this->status != AGENT_MODULE_STATUS_NOT_INIT) { - // When filter is not "not init" - // Not show not init modules. It's only operation view - $sql_conditions .= ' AND (tagente_estado.utimestamp != 0 - OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))'; - } - if ($this->tag > 0) { $sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN ( SELECT ttag_module.id_agente_modulo @@ -435,7 +446,7 @@ class Modules SELECT ttag_module.id_tag FROM ttag_module WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo)) - AS tags, + AS tags, tagente_modulo.id_agente_modulo, tagente.intervalo AS agent_interval, tagente.nombre AS agent_name, @@ -476,6 +487,7 @@ class Modules ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo'.$sql_conditions_all; $sql_limit = 'ORDER BY tagente.nombre ASC '; + if (!$this->all_modules) { $sql_limit = ' LIMIT '.(int) ($page * $system->getPageSize()).','.(int) $system->getPageSize(); }