| @@ 60-85 (lines=26) @@ | ||
| 57 | * |
|
| 58 | * @return boolean true if okey, false if something went wrong. |
|
| 59 | */ |
|
| 60 | public function callbackSubmit() |
|
| 61 | { |
|
| 62 | // Get values from the submitted form |
|
| 63 | // |
|
| 64 | $commentComment = new CommentComments(); |
|
| 65 | $commentComment->setDB($this->di->get("db")); |
|
| 66 | $data = $this->form->value("text"); |
|
| 67 | $text = $this->di->get("textfilter")->doFilter($data, ["bbcode", "clickable", |
|
| 68 | "shortcode", "markdown", "purify"]); |
|
| 69 | $commentComment->textcomment = $text; |
|
| 70 | $commentComment->idcommentcomment = htmlentities($this->form->value("hiddenid")); |
|
| 71 | $commentComment->postuser = $this->di->get("session")->get("email"); |
|
| 72 | ||
| 73 | $idpost = htmlentities($this->form->value("hiddenpost")); |
|
| 74 | $user = new User(); |
|
| 75 | $user->setDb($this->di->get("db")); |
|
| 76 | $user->getInformation($commentComment->postuser); |
|
| 77 | $user->points += 1; |
|
| 78 | ||
| 79 | $user->save(); |
|
| 80 | $commentComment->save(); |
|
| 81 | ||
| 82 | $url = $this->di->get("url")->create("comment/retrieve/$idpost"); |
|
| 83 | $this->di->get("response")->redirect($url); |
|
| 84 | return true; |
|
| 85 | } |
|
| 86 | } |
|
| 87 | ||
| @@ 60-89 (lines=30) @@ | ||
| 57 | * |
|
| 58 | * @return boolean true if okey, false if something went wrong. |
|
| 59 | */ |
|
| 60 | public function callbackSubmit() |
|
| 61 | { |
|
| 62 | // Get values from the submitted form |
|
| 63 | // |
|
| 64 | $post = new Post(); |
|
| 65 | $post->setDB($this->di->get("db")); |
|
| 66 | $post->posttitle = htmlentities($this->form->value("title")); |
|
| 67 | $data = $this->form->value("text"); |
|
| 68 | $text = $this->di->get("textfilter")->doFilter($data, ["shortcode", "markdown", "clickable", "bbcode"]); |
|
| 69 | ||
| 70 | $post->posttext = $text; |
|
| 71 | $post->postname = htmlentities($this->di->get("session")->get("email")); |
|
| 72 | ||
| 73 | $tags = htmlspecialchars($this->form->value("tags")); |
|
| 74 | ||
| 75 | $user = new User(); |
|
| 76 | $user->setDb($this->di->get("db")); |
|
| 77 | $user->getInformation($post->postname); |
|
| 78 | $user->points += 2; |
|
| 79 | ||
| 80 | $user->save(); |
|
| 81 | $post->save(); |
|
| 82 | ||
| 83 | ||
| 84 | $this->createCategory($tags, $post->id); |
|
| 85 | ||
| 86 | $url = $this->di->get("url")->create("comment/viewAllPosts"); |
|
| 87 | $this->di->get("response")->redirect($url); |
|
| 88 | return true; |
|
| 89 | } |
|
| 90 | ||
| 91 | ||
| 92 | public function createCategory($tags, $postId) |
|