Exemplo n.º 1
0
 public function execute()
 {
     $this->doAction();
     if (isset($_GET['forum_id'])) {
         $forum_id = $_GET['forum_id'];
         $this->forum = DbForum::GetById($forum_id);
         if (!$this->forum->isNull()) {
             $this->topics = DbTopic::GetByForum($forum_id);
         } else {
             header('location: forums.php');
         }
     } else {
         header('location: forums.php');
     }
 }
Exemplo n.º 2
0
 public static function NewTopic($forum_id, $title, $user_id)
 {
     $topic = new Topic();
     $topic->forumId = $forum_id;
     $topic->title = $title;
     $topic->user->id = $user_id;
     $stamp = time();
     $con = new DbConnection();
     $query = "INSERT INTO topics (forum_id, topic_title, user_id, created_on) VALUES(?, ?, ?, ?)";
     $st = $con->prepare($query);
     $st->bind_param("isii", $forum_id, $title, $user_id, $stamp);
     $st->execute();
     $con->close();
     $topic_id = DbTopic::GetTopicId($forum_id, $title, $user_id, $stamp);
     return $topic_id;
 }