/**
  * Check the cache for the IP
  */
 private function _doIpCheckCache()
 {
     if (1 == $this->_core_options['general']['useipcache']) {
         $time_start = microtime(true);
         $this->_ip_in_cache = $this->_ipcachedb->getIP($this->_visiting_ip);
         $time_end = microtime(true);
         $time = $time_end - $time_start;
         if (!(false === $this->_ip_in_cache)) {
             if ($this->_ip_in_cache->spam == "1") {
                 $this->_spaminfo['cache']['time'] = $time;
                 $this->_spammer_detected = true;
             }
         }
     }
 }
 /**
  * Checks if the user clicked on the Report & Delete link.
  *
  * @WordPress Action wp_ajax_avh-fdas-reportcomment
  */
 public function actionAjaxReportComment()
 {
     if ('avh-fdas-reportcomment' == $_REQUEST['action']) {
         $comment_id = absint($_REQUEST['id']);
         check_ajax_referer('report-comment_' . $comment_id);
         if (!($comment = get_comment($comment_id))) {
             $this->_comment_footer_die(__('Oops, no comment with this ID.') . sprintf(' <a href="%s">' . __('Go back') . '</a>!', 'edit-comments.php'));
         }
         if (!current_user_can('edit_post', $comment->comment_post_ID)) {
             $this->_comment_footer_die(__('You are not allowed to edit comments on this post.'));
         }
         $options = $this->_core->getOptions();
         // If we use IP Cache and the Reported IP isn't spam, delete it from the IP cache.
         if (1 == $options['general']['useipcache']) {
             $ip_info = $this->_db->getIP($comment->comment_author_IP, OBJECT);
             if (is_object($ip_info) && 0 == $ip_info->spam) {
                 $comment_date = get_comment_date('Y-m-d H:i:s', $comment_id);
                 $this->_db->updateIpCache(array('ip' => $comment->comment_author_IP, 'spam' => 1, 'lastseen' => $comment_date));
             }
         }
         if ($options['sfs']['sfsapikey'] != '' && !empty($comment->comment_author_email)) {
             $this->_handleReportSpammer($comment->comment_author, $comment->comment_author_email, $comment->comment_author_IP);
         }
         if (1 == $options['general']['addblacklist']) {
             $blacklist = $this->_core->getDataElement('lists', 'blacklist');
             if (!empty($blacklist)) {
                 $b = explode("\r\n", $blacklist);
             } else {
                 $b = array();
             }
             if (!in_array($comment->comment_author_IP, $b)) {
                 array_push($b, $comment->comment_author_IP);
                 $this->_setBlacklistOption($b);
             }
         }
         // Delete the comment
         $r = wp_delete_comment($comment->comment_ID);
         die($r ? '1' : '0');
     }
 }