| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 51 | public function callbackSubmit() |
||
| 52 | { |
||
| 53 | // Get values from the submitted form |
||
| 54 | $sentComment = $this->form->value("comment"); |
||
| 55 | |||
| 56 | $comment = new Comment(); |
||
| 57 | $comment->setDb($this->di->get("db")); |
||
| 58 | |||
| 59 | if (!$this->di->get('session')->has("user")) { |
||
| 60 | $this->form->addOutput("You need to log in"); |
||
| 61 | return false; |
||
| 62 | } |
||
| 63 | |||
| 64 | $user = $this->di->get('session')->get("user"); # get user name |
||
| 65 | |||
| 66 | $comment->user = $user; |
||
| 67 | $comment->comment = $sentComment; |
||
| 68 | $comment->save(); |
||
| 69 | return true; |
||
| 70 | } |
||
| 71 | } |
||
| 72 |