'), array('<', '>'), $_POST['text']); $html = strip_tags($_POST['text']); $html = str_replace(array('<', '>', "'"), array('<', '>', '′'), $html); $html = Markdown::liteProcessing($html); $html = nl2br($html); $comment = new Comment(array( 'userId' => App::$user->id, 'parentType' => ($_POST['parentType'] == 'article') ? 'article' : 'point', 'parentId' => (int) $_POST['parentId'], 'answerTo' => (int) $_POST['answerTo'], 'addDate' => time(), 'text' => $text, 'html' => $html, )); $comment->save(); App::redirect('/' . $_POST['parentType'] . '/' . $_POST['parentId'] . '#comment' . $comment->id); } static function actionDel() { if (!App::$user || !(int)App::getParam('id')) { App::error404(); } $id = (int)App::getParam('id'); $comment = Comment::model()->getByPK($id); if($comment->id && $comment->userId == App::$user->id) { $comment->delete($id); } App::redirect('/'.$comment->parentType.'/'.$comment->parentId); } }