From: Banana Date: Tue, 22 Oct 2019 08:36:41 +0000 (+0200) Subject: init of stats X-Git-Tag: 2.2_2019-12-27~14 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=004aabaae93386c8cb424f878718013261e99961;p=insipid.git init of stats --- diff --git a/webroot/lib/management.class.php b/webroot/lib/management.class.php index 68d5602..07ad6c4 100644 --- a/webroot/lib/management.class.php +++ b/webroot/lib/management.class.php @@ -460,6 +460,86 @@ class Management { return $ret; } + /** + * amount of links in the DB. Status 1 and 2 only + * @return int + */ + public function linkAmount() { + $ret = 0; + + $queryStr = "SELECT COUNT(*) AS amount FROM `".DB_PREFIX."_link`"; + if($this->_showPrivate === true) { + $queryStr .= " WHERE `status` IN (2,1)"; + } + else { + $queryStr .= " WHERE `status` = 2"; + } + + $query = $this->DB->query($queryStr); + if(!empty($query) && $query->num_rows > 0) { + $result = $query->fetch_assoc(); + $ret = $result['amount']; + } + + return $ret; + } + + + /** + * amount of tags + * @return int + */ + public function tagAmount() { + $ret = 0; + + $queryStr = "SELECT COUNT(*) AS amount FROM `".DB_PREFIX."_tag`"; + + $query = $this->DB->query($queryStr); + if(!empty($query) && $query->num_rows > 0) { + $result = $query->fetch_assoc(); + $ret = $result['amount']; + } + + return $ret; + } + + /** + * amount of categories + * @return int + */ + public function categoryAmount() { + $ret = 0; + + $queryStr = "SELECT COUNT(*) AS amount FROM `".DB_PREFIX."_category`"; + + $query = $this->DB->query($queryStr); + if(!empty($query) && $query->num_rows > 0) { + $result = $query->fetch_assoc(); + $ret = $result['amount']; + } + + return $ret; + } + + /** + * Amount of links need moderation + * @return int + */ + public function moderationAmount() { + $ret = 0; + + $queryStr = "SELECT COUNT(*) AS amount FROM `".DB_PREFIX."_link`"; + $queryStr .= " WHERE `status` = 3"; + + $query = $this->DB->query($queryStr); + if(!empty($query) && $query->num_rows > 0) { + $result = $query->fetch_assoc(); + $ret = $result['amount']; + } + + return $ret; + } + /** * for simpler management we have the search data in a separate column * it is not fancy or even technical nice but it damn works diff --git a/webroot/view/stats.inc.php b/webroot/view/stats.inc.php new file mode 100644 index 0000000..e72953a --- /dev/null +++ b/webroot/view/stats.inc.php @@ -0,0 +1,37 @@ + + * + * 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0. + * + */ +$_displayEditButton = false; +if(Summoner::simpleAuthCheck() === true) { + $_displayEditButton = true; + $moderationAmount = $Management->moderationAmount(); +} + +$linkAmount = $Management->linkAmount(); +$tagAmount = $Management->tagAmount(); +$categoryAmount = $Management->categoryAmount(); + diff --git a/webroot/view/stats.php b/webroot/view/stats.php new file mode 100644 index 0000000..dcf7628 --- /dev/null +++ b/webroot/view/stats.php @@ -0,0 +1,77 @@ + + * + * 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, either version 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0. + * + */ +?> +
+
+
+

+ + + + + + + + + +

+
+
+ +
+
+

Stats

+
+
+
+ +
+
+
+

Links

+

# of Links:

+

View all

+
+
+

Tags

+

# of Tags:

+

View all

+
+
+

Categories

+

# of Categories:

+

View all

+
+ +
+

Moderation

+

# Moderation needed:

+
+ +
+