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]); } }