Initial commit

This commit is contained in:
Péntek Sándor
2016-06-18 10:07:35 +02:00
commit 41c686945a
398 changed files with 36832 additions and 0 deletions

View File

@ -0,0 +1,45 @@
<?php
class comments
{
private $id;
private $comments;
private $replies;
public function __construct($id)
{
if (!isnum($id)) return false;
$this->id = $id;
}
public function get_comments($check = false)
{
if (!$this->comments)
{
global $_sql;
$query = $_sql->query("SELECT `comments`.*, users.userName AS bySlug, users.userPublicName AS byName, users.userPic FROM `comments` INNER JOIN users ON commentBy = userId WHERE commentEntry = ".$this->id." AND commentReply = 0 ORDER BY commentTime DESC");
if ($check)
return $query->num_rows;
else
$this->comments = $query;
}
return $this->comments->fetch_assoc();
}
public function get_replies($check = false)
{
if (!$this->replies)
{
global $_sql;
$query = $_sql->query("SELECT `comments`.*, users.userName AS bySlug, users.userPublicName AS byName, users.userPic FROM `comments` INNER JOIN users ON commentBy = userId WHERE commentReply = ".$this->id." ORDER BY commentTime DESC");
if ($check)
return $query->num_rows;
$this->replies = $query;
}
return $this->replies->fetch_assoc();
}
}