Skip to content

Commit

Permalink
making a change to the _get_count method in blacklist model
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Frost committed Jul 17, 2012
1 parent b802b3a commit 065de90
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions system/cms/modules/comments/models/comment_blacklists_m.php
Expand Up @@ -19,25 +19,20 @@ public function __construct()

public function insert($data)
{
if ($this->_get_count($data)->count < 1)
if ($this->_get_count($data) < 1)
{
return parent::insert($data);
}
}

private function _get_count($data)
{
foreach($data as $k => $v)
{
$where .= "`$k`='$v' OR ";
}
$this->db->select('count(*) as count')->from('comment_blacklists')->where(substr($where,0,-4));
return $this->db->get()->row();
return $this->db->or_where($data)->count_all_results('comment_blacklists');
}

public function is_blacklisted($data)
{
if ($this->_get_count($data)->count > 0)
if ($this->_get_count($data) > 0)
{
return true;
}
Expand Down

0 comments on commit 065de90

Please sign in to comment.