public function __construct($connection, $user, $dbPrefix) { $this->connect = $connection; $this->user = $user; $this->dbPrefix = $dbPrefix; foreach ($connection->query("SELECT * FROM " . $this->dbPrefix . "forum_threads;") as $row) { $this->nrOfThreads += 1; $thread = new thread(); $thread->setId($row['forumid']); $thread->setText($row['text']); $thread->setTimestamp($row['timestamp']); $thread->setTitle($row['title']); $thread->setUserId($row['userid']); $thread->setTopTopic($row['toptopic']); $thread->setThreadState($row['threadstate']); $thread->setEditCounter($row['editcounter']); if ($row['userid'] != -1) { $thread->setUsername(usertools::getUsernameById($row['userid'], $connection)); } else { $thread->setUsername("Public", $connection); } array_push($this->threads, $thread); } foreach ($this->threads as $thread) { $thread->setSubThreadCounter($this->countSubThreads($thread->getId())); } }