| @@ 82-96 (lines=15) @@ | ||
| 79 | * creates a new post |
|
| 80 | * |
|
| 81 | */ |
|
| 82 | public function create(){ |
|
| 83 | ||
| 84 | $title = $this->request->data("title"); |
|
| 85 | $content = $this->request->data("content"); |
|
| 86 | ||
| 87 | $result = $this->post->create(Session::getUserId(), $title, $content); |
|
| 88 | ||
| 89 | if(!$result){ |
|
| 90 | Session::set('posts-errors', $this->post->errors()); |
|
| 91 | }else{ |
|
| 92 | Session::set('posts-success', "Post has been created"); |
|
| 93 | } |
|
| 94 | ||
| 95 | Redirector::root("Posts/newPost"); |
|
| 96 | } |
|
| 97 | ||
| 98 | /** |
|
| 99 | * update a post |
|
| @@ 145-160 (lines=16) @@ | ||
| 142 | * send email to admin for reporting any bugs, features, or enhancement |
|
| 143 | * |
|
| 144 | */ |
|
| 145 | public function reportBug(){ |
|
| 146 | ||
| 147 | $subject = $this->request->data("subject"); |
|
| 148 | $label = $this->request->data("label"); |
|
| 149 | $message = $this->request->data("message"); |
|
| 150 | ||
| 151 | $result = $this->user->reportBug(Session::getUserId(), $subject, $label, $message); |
|
| 152 | ||
| 153 | if(!$result){ |
|
| 154 | Session::set('report-bug-errors', $this->user->errors()); |
|
| 155 | }else{ |
|
| 156 | Session::set('report-bug-success', "Email has been sent successfully, We will consider your report."); |
|
| 157 | } |
|
| 158 | ||
| 159 | Redirector::root("User/Bugs"); |
|
| 160 | } |
|
| 161 | ||
| 162 | public function isAuthorized(){ |
|
| 163 | return true; |
|