public function EditCommentAction() { $request = Project::getRequest(); $user = Project::getUser()->getDbUser(); $isAdmin = $user->user_type_id == 1 ? true : false; $item_name = $request->item_name; switch ($item_name) { case 'article': $item_controller = 'Article'; $item_action = 'ArticleView'; break; case 'questions': $item_controller = 'QuestionAnswer'; $item_action = 'ViewQuestion'; break; case 'photo': $item_controller = 'Photo'; $item_action = 'View'; break; case 'bookmarks': $item_controller = 'Bookmarks'; $item_action = 'BookmarksView'; break; case 'social': $item_controller = 'Social'; $item_action = 'SocialView'; break; case 'blog': $item_controller = 'Blog'; $item_action = 'Comments'; break; } $comment_model = new CommentModel($item_name . '_comment', $item_name . '_id', $request->comment_id); if ($request->change_comment && ($isAdmin || $comment_model->user_id == $user->id)) { $warning_id = 0; if ($request->warning_text) { $warningModel = new WarningModel(); $warning_id = $warningModel->add($comment_model->user_id, $request->warning_text); } $comment_model->editComment($comment_model->user_id, $warning_id, $request->editCommentArea, (int) $isAdmin); } Project::getResponse()->redirect($request->createUrl($item_controller, $item_action, array($request->element_id))); }