From 5c8801fb2fd9497bc1e17a8feb56d7a0f8aa1899 Mon Sep 17 00:00:00 2001 From: Banana Date: Sun, 7 Mar 2021 16:31:23 +0100 Subject: [PATCH] new branch with new fixes --- ChangeLog | 4 +++- webroot/lib/link.class.php | 26 ++++++++------------- webroot/lib/management.class.php | 40 ++++++++++++++------------------ 3 files changed, 30 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 42fbc38..ff1eb15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +version 2.5.3 - Hypostyle + + Fixed sql problems with Maria DB. Any_value is not supported there + version 2.5.2 - Darkmere (2020-09-12) + Fixed bug #8 It is possible to add empty tags and categories. @@ -5,7 +8,6 @@ version 2.5.2 - Darkmere (2020-09-12) + Fixed bug #7 Edit categories/tags. Rename and move + Fixed feature #3 Reduce whitespace in frontend - version 2.5.1 - Caves of Circe (2020-03-22) + Bugfix release diff --git a/webroot/lib/link.class.php b/webroot/lib/link.class.php index d85943f..64793d6 100644 --- a/webroot/lib/link.class.php +++ b/webroot/lib/link.class.php @@ -55,15 +55,15 @@ class Link { if (!empty($hash)) { $queryStr = "SELECT - any_value(`id`) as id, - any_value(`link`) as link, - any_value(`created`) as created, - any_value(`updated`) as `updated`, - any_value(`status`) as `status`, - any_value(`description`) as description, - any_value(`title`) as title, - any_value(`image`) as image, - any_value(`hash`) as hash + `id`, + `link`, + `created`, + `updated`, + `status`, + `description`, + `title`, + `image`, + `hash` FROM `" . DB_PREFIX . "_link` WHERE `hash` = '" . $this->DB->real_escape_string($hash) . "'"; $query = $this->DB->query($queryStr); @@ -93,13 +93,7 @@ class Link { $this->_data = array(); if (!empty($hash)) { - $queryStr = "SELECT - any_value(`id`) as id, - any_value(`link`) as link, - any_value(`description`) as description, - any_value(`title`) as title, - any_value(`image`) as image, - any_value(`hash`) as hash + $queryStr = "SELECT `id`,`link`,`description`,`title`,`image`,`hash` FROM `" . DB_PREFIX . "_link` WHERE `hash` = '" . $this->DB->real_escape_string($hash) . "'"; diff --git a/webroot/lib/management.class.php b/webroot/lib/management.class.php index 08ce708..2fe8e71 100644 --- a/webroot/lib/management.class.php +++ b/webroot/lib/management.class.php @@ -30,18 +30,18 @@ class Management { const LINK_QUERY_STATUS = 2; - const COMBINED_SELECT_VALUES = "any_value(`id`) as id, - any_value(`link`) as link, - any_value(`created`) as created, - any_value(`status`) as `status`, - any_value(`description`) as description, - any_value(`title`) as title, - any_value(`image`) as image, - any_value(`hash`) as hash, - any_value(`tag`) as tag, - any_value(`category`) as category, - any_value(`categoryId`) as categoryId, - any_value(`tagId`) as tagId"; + const COMBINED_SELECT_VALUES = "`id`, + `link`, + `created`, + `status`, + `description`, + `title`, + `image`, + `hash`, + `tag`, + `category`, + `categoryId`, + `tagId`"; /** * the database object @@ -98,7 +98,7 @@ class Management { if($stats === true) { $queryStr = "SELECT COUNT(*) AS amount, - any_value(cr.categoryid) AS categoryId + cr.categoryid AS categoryId FROM `".DB_PREFIX."_categoryrelation` AS cr, `".DB_PREFIX."_link` AS t WHERE cr.linkid = t.id"; $queryStr .= " AND ".$this->_decideLinkTypeForQuery(); @@ -112,9 +112,7 @@ class Management { } } - $queryStr = "SELECT - any_value(`id`) as id, - any_value(`name`) as name + $queryStr = "SELECT `id`, `name` FROM `".DB_PREFIX."_category` ORDER BY `name` ASC"; if(!empty($limit)) { @@ -148,9 +146,8 @@ class Management { $statsInfo = array(); if($stats === true) { - $queryStr = "SELECT - COUNT(*) AS amount, - any_value(tr.tagid) AS tagId + $queryStr = "SELECT COUNT(*) AS amount, + tr.tagid AS tagId FROM `".DB_PREFIX."_tagrelation` AS tr, `".DB_PREFIX."_link` AS t WHERE tr.linkid = t.id"; $queryStr .= " AND ".$this->_decideLinkTypeForQuery(); @@ -164,9 +161,7 @@ class Management { } } - $queryStr = "SELECT - any_value(`id`) as id, - any_value(`name`) as name + $queryStr = "SELECT `id`, `name` FROM `".DB_PREFIX."_tag` ORDER BY `name` ASC"; if(!empty($limit)) { @@ -864,4 +859,3 @@ class Management { return $ret; } } - -- 2.39.5