diff --git a/src/library/database.php b/src/library/database.php index 56c415c..bb0c218 100644 --- a/src/library/database.php +++ b/src/library/database.php @@ -610,7 +610,7 @@ class Database { return $query->fetchAll(); } - public function getMagnetsTotal() { + public function getMagnetsTotal() : int { $this->_debug->query->select->total++; @@ -621,6 +621,17 @@ class Database { return $query->fetch()->result; } + public function getMagnetsTotalByUserId(int $userId) : int { + + $this->_debug->query->select->total++; + + $query = $this->_db->prepare('SELECT COUNT(*) AS `result` FROM `magnet` WHERE `userId` = ?'); + + $query->execute([$userId]); + + return $query->fetch()->result; + } + public function updateMagnetDn(int $magnetId, string $dn, int $timeUpdated) : int { $this->_debug->query->update->total++; @@ -1215,6 +1226,26 @@ class Database { return $query->fetch()->result; } + public function getMagnetCommentsTotalByUserId(int $userId, mixed $magnetId = null) : int { + + $this->_debug->query->select->total++; + + if ($magnetId) + { + $query = $this->_db->prepare('SELECT COUNT(*) AS `result` FROM `magnetComment` WHERE `userId` = ? AND `magnetId` = ?'); + + $query->execute([$userId, $magnetId]); + } + else + { + $query = $this->_db->prepare('SELECT COUNT(*) AS `result` FROM `magnetComment` WHERE `userId` = ?'); + + $query->execute([$userId]); + } + + return $query->fetch()->result; + } + public function getMagnetComments(int $magnetId, mixed $magnetCommentIdParent = null) { $this->_debug->query->select->total++; diff --git a/src/public/assets/theme/default/css/framework.css b/src/public/assets/theme/default/css/framework.css index 090d649..9b3ebff 100644 --- a/src/public/assets/theme/default/css/framework.css +++ b/src/public/assets/theme/default/css/framework.css @@ -44,6 +44,10 @@ color: #b55cab; } +.text-color-default { + color: #ccc; +} + /* .text-color-pink { color: #a44399; diff --git a/src/public/node.php b/src/public/node.php index 3c8368e..8ccc233 100644 --- a/src/public/node.php +++ b/src/public/node.php @@ -112,11 +112,35 @@ else if (is_null($user->public)) - getMagnetsTotal() ?> + + getMagnetsTotal() ?> + / + + getMagnetsTotalByUserId($user->userId) ?> + + + + + + + - getMagnetCommentsTotal() ?> + + getMagnetCommentsTotal() ?> + getMagnetCommentsTotalByUserId($user->userId)) { ?> + / + + + + + + + + + +