1
0
Fork 0
mirror of https://github.com/Oreolek/oreolek.ru.git synced 2024-05-31 23:38:13 +03:00

More strict antispam check

This commit is contained in:
Alexander Yakovlev 2013-10-31 10:18:54 +07:00
parent 854fbf278f
commit 6e39a4c84b
2 changed files with 8 additions and 8 deletions

View file

@ -28,14 +28,14 @@ class Controller_Comment extends Controller_Layout {
$title = $this->request->post('title');
$name = $this->request->post('name');
if (empty($email) AND empty($title) AND empty($name) AND $comment->check()) {
if (Kohana::$config->load('common.comment_approval'))
if (Kohana::$config->load('common')->get('comment_approval'))
{
if (
Model_Comment::antispam_check($comment->content) AND
Model_Comment::useragent_check(Request::user_agent('browser'))
Model_Comment::antispam_check($comment->content) == FALSE OR
Model_Comment::useragent_check(Request::user_agent('browser') == FALSE)
)
{
$comment->is_approved = Model_Comment::STATUS_PENDING;
$comment->is_approved = Model_Comment::STATUS_SPAM;
}
else
{
@ -44,7 +44,7 @@ class Controller_Comment extends Controller_Layout {
}
else
{
$comment->is_approved = Model_Comment::STATUS_APPROVED;
$comment->is_approved = Model_Comment::STATUS_PENDING;
}
$comment->create();
$this->redirect('post/view/' . $post_id);
@ -122,7 +122,7 @@ class Controller_Comment extends Controller_Layout {
}
$this->template = new View_Delete;
$this->template->title = 'Удаление комментария';
$this->template->content_title = 'Комментарий от '.$comment->author_name;
$this->template->content_title = 'Комментарий от '.$model->author_name;
$this->template->content = Markdown::instance()->transform($model->content);
$confirmation = $this->request->post('confirmation');

View file

@ -1,7 +1,7 @@
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Comment panel view controller.
* Comment panel view controller. Only for administrator.
**/
class View_Comment_Index extends View_Index {
public $scripts = array(
@ -36,7 +36,7 @@ class View_Comment_Index extends View_Index {
$output['is_approved'] = Form::checkbox(
'is_approved',
$item->id,
(boolean) $item->is_approved,
$item->is_approved == Model_Comment::STATUS_APPROVED,
array(
'data-edit-url' => Route::url('default', array('controller' => 'Comment','action' => 'edit','id' => $item->id)),
)