mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 01:25:39 +00:00
show user's magnets and comments on this node with access label
This commit is contained in:
parent
9f2841220a
commit
6b25c2ebff
3 changed files with 62 additions and 3 deletions
|
|
@ -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++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue