From 044bd0e54d0080974ac9b34ea44d81e0cdb8de34 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 23 Mar 2023 15:57:32 +0100 Subject: [PATCH 1/3] #10793 changed collation tables tips --- pandora_console/extras/mr/62.sql | 4 ++-- pandora_console/pandoradb.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/extras/mr/62.sql b/pandora_console/extras/mr/62.sql index eaef394fcc..d7925a31c1 100644 --- a/pandora_console/extras/mr/62.sql +++ b/pandora_console/extras/mr/62.sql @@ -105,7 +105,7 @@ CREATE TABLE IF NOT EXISTS `twelcome_tip` ( `url` VARCHAR(255) NULL, `enable` TINYINT NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `twelcome_tip_file` ( `id` INT NOT NULL AUTO_INCREMENT, @@ -117,7 +117,7 @@ CREATE TABLE IF NOT EXISTS `twelcome_tip_file` ( FOREIGN KEY (`twelcome_tip_file`) REFERENCES `twelcome_tip` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `twelcome_tip` VALUES (1,'es',0,'¿Sabías que puedes monitorizar webs?','De manera sencilla a través de chequeos HTTP estándar o transaccional mediante transacciones centralizadas WUX, o descentralizadas con el plugin UX de agente.','https://pandorafms.com/manual/es/documentation/03_monitoring/06_web_monitoring','1'), diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 9ff30ae74f..eee8a22efd 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -4240,7 +4240,7 @@ CREATE TABLE IF NOT EXISTS `twelcome_tip` ( `url` VARCHAR(255) NULL, `enable` TINYINT NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `twelcome_tip_file` ( @@ -4253,7 +4253,7 @@ CREATE TABLE IF NOT EXISTS `twelcome_tip_file` ( FOREIGN KEY (`twelcome_tip_file`) REFERENCES `twelcome_tip` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- --------------------------------------------------------------------- -- Table `tfavmenu_user` From d3408442d389ce67908c2e52304485dacb0f2ef2 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 23 Mar 2023 16:25:08 +0100 Subject: [PATCH 2/3] #10793 fixed collation in sql --- pandora_console/extras/mr/62.sql | 4 ++-- pandora_console/include/class/TipsWindow.class.php | 2 +- pandora_console/pandoradb.sql | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_console/extras/mr/62.sql b/pandora_console/extras/mr/62.sql index d7925a31c1..eaef394fcc 100644 --- a/pandora_console/extras/mr/62.sql +++ b/pandora_console/extras/mr/62.sql @@ -105,7 +105,7 @@ CREATE TABLE IF NOT EXISTS `twelcome_tip` ( `url` VARCHAR(255) NULL, `enable` TINYINT NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; CREATE TABLE IF NOT EXISTS `twelcome_tip_file` ( `id` INT NOT NULL AUTO_INCREMENT, @@ -117,7 +117,7 @@ CREATE TABLE IF NOT EXISTS `twelcome_tip_file` ( FOREIGN KEY (`twelcome_tip_file`) REFERENCES `twelcome_tip` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; INSERT INTO `twelcome_tip` VALUES (1,'es',0,'¿Sabías que puedes monitorizar webs?','De manera sencilla a través de chequeos HTTP estándar o transaccional mediante transacciones centralizadas WUX, o descentralizadas con el plugin UX de agente.','https://pandorafms.com/manual/es/documentation/03_monitoring/06_web_monitoring','1'), diff --git a/pandora_console/include/class/TipsWindow.class.php b/pandora_console/include/class/TipsWindow.class.php index 0dffdb7994..7e6fddc234 100644 --- a/pandora_console/include/class/TipsWindow.class.php +++ b/pandora_console/include/class/TipsWindow.class.php @@ -581,7 +581,7 @@ class TipsWindow $sql = sprintf( 'SELECT id, name AS language, title, text, url, enable FROM twelcome_tip t - LEFT JOIN tlanguage l ON t.id_lang = l.id_language + LEFT JOIN tlanguage l ON t.id_lang = l.id_language COLLATE utf8mb4_0900_ai_ci %s %s %s', $filter, $order, diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index eee8a22efd..9ff30ae74f 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -4240,7 +4240,7 @@ CREATE TABLE IF NOT EXISTS `twelcome_tip` ( `url` VARCHAR(255) NULL, `enable` TINYINT NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; CREATE TABLE IF NOT EXISTS `twelcome_tip_file` ( @@ -4253,7 +4253,7 @@ CREATE TABLE IF NOT EXISTS `twelcome_tip_file` ( FOREIGN KEY (`twelcome_tip_file`) REFERENCES `twelcome_tip` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; -- --------------------------------------------------------------------- -- Table `tfavmenu_user` From 31fd4a616c88c086dd9e5479b5483a1dce52df2e Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 23 Mar 2023 16:36:06 +0100 Subject: [PATCH 3/3] #10793 fixed pagination filter --- .../include/class/TipsWindow.class.php | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/pandora_console/include/class/TipsWindow.class.php b/pandora_console/include/class/TipsWindow.class.php index 7e6fddc234..1c52aae4fd 100644 --- a/pandora_console/include/class/TipsWindow.class.php +++ b/pandora_console/include/class/TipsWindow.class.php @@ -301,17 +301,6 @@ class TipsWindow } - /** - * Get number of tips in database - * - * @return integer - */ - public function getTotalTips() - { - return db_get_sql('SELECT count(*) FROM twelcome_tip'); - } - - /** * Get totals tips that user can show * @@ -590,6 +579,16 @@ class TipsWindow $data = db_get_all_rows_sql($sql); + $sqlCount = sprintf( + 'SELECT count(*) + FROM twelcome_tip t + LEFT JOIN tlanguage l ON t.id_lang = l.id_language COLLATE utf8mb4_0900_ai_ci + %s', + $filter + ); + + $total = db_get_sql($sqlCount); + foreach ($data as $key => $row) { if ($row['enable'] === '1') { $data[$key]['enable'] = ''; @@ -626,8 +625,6 @@ class TipsWindow if (empty($data) === true) { $total = 0; $data = []; - } else { - $total = $this->getTotalTips(); } echo json_encode(