public function actionEditPost($id)
 {
     if (!YiiForum::checkAuth('post_edit')) {
         return $this->noPermission();
     }
     YiiForum::checkIsGuest();
     $boardId = YiiForum::getGetValue('boardid');
     $model = Post::findOne(['id' => $id]);
     $data = YiiForum::getPostValue('Post');
     if ($data == null) {
         $thread = Thread::findOne(['id' => $model['thread_id']]);
         $locals = [];
         $locals['thread'] = $thread;
         $locals['currentBoard'] = $this->getBoard($boardId);
         $locals['model'] = $model;
         return $this->render('edit-post', $locals);
     } else {
         $model->load(Yii::$app->request->post());
         $model->modify_time = TTimeHelper::getCurrentTime();
         $model->save();
         return $this->redirect(['view', 'id' => $model->thread_id]);
     }
 }
 /**
  * Finds the Thread model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Thread the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Thread::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }