Beispiel #1
0
 public function dealNewThreadPost($reputation)
 {
     if (!$this->isEmailValidated) {
         header("location: /home/");
         die;
     }
     if ($reputation < 0) {
         header("location: /home/");
         die;
     }
     $data = array();
     $time = time();
     $data["title"] = $_POST["title"];
     $data["content"] = $_POST["content"];
     $data["createby"] = $this->username;
     $data["createbyid"] = $this->userid;
     $data["createdate"] = $time;
     $data["updatedate"] = $time;
     $data["score"] = $time;
     $data["tags"] = $_POST["tags"];
     if (strlen($_POST["title"]) > 0) {
         if (strlen($_POST["content"]) > 0) {
             $threadModel = new ThreadModel();
             $threadid = $threadModel->newThread($data);
             if ($threadid == -1) {
                 $this->viewFile = "Thread/duplicate.html";
                 $this->display();
                 die;
             }
             $tags = $_POST["tags"];
             $threadModel->addTags($tags, $threadid);
             header("location: /thread/show/{$threadid}/");
             die;
         }
     }
 }