function actionSpam($id, $action) { $where = 'id = ' . intval($id); $row = $this->fetchRow($where); if ($row == null) { return 'Id invalid : ' . $id; } $data = Zend_Json::decode($row['fields']); Zend_Debug::dump($data); $akismet = new Zend_Service_Akismet($this->akismet_api, $this->akismet_blog); switch ($action) { case "spam": /* C'est un spam */ $akismet->submitSpam($data); $data['spam'] = true; break; case 'ham': $akismet->submitHam($data); $data['spam'] = false; break; case 'isspam': $data['spam'] = $akismet->isSpam($data); break; } $maj = array('spam' => $data['spam'], 'fields' => Zend_Json::encode($data)); $ret = $this->update($maj, $where); if ($ret == 1) { return true; } else { return false; } }
protected function _submitHamCommentData($contentType, $contentId, array $params) { if (XenForo_Application::getOptions()->akismetKey && !empty($params['akismetIsSpam']) && !empty($params['akismet'])) { $akismet = new Zend_Service_Akismet(XenForo_Application::getOptions()->akismetKey, XenForo_Application::getOptions()->boardUrl); try { $akismet->submitHam($params['akismet']); } catch (Zend_Http_Exception $e) { } catch (Zend_Service_Exception $e) { } } }
protected function _submitHamCommentData($contentType, $contentId, array $params) { if (trim(XenForo_Application::getOptions()->akismetKey) && !empty($params['akismetIsSpam']) && !empty($params['akismet'])) { $akismet = new Zend_Service_Akismet(trim(XenForo_Application::getOptions()->akismetKey), XenForo_Application::getOptions()->boardUrl); try { $akismet->submitHam($params['akismet']); } catch (Zend_Http_Exception $e) { XenForo_Error::logException($e, false, 'Akismet HTTP error: '); } catch (Zend_Service_Exception $e) { XenForo_Error::logException($e, false, 'Akismet service error: '); } } }
public function updateApprovedAction() { $wordPressAPIKey = get_option('commenting_wpapi_key'); $commentIds = $_POST['ids']; $status = $_POST['approved']; $table = $this->_helper->db->getTable(); if (!$commentIds) { return; } foreach ($commentIds as $commentId) { $comment = $table->find($commentId); $comment->approved = $status; //if approved, it isn't spam if ($status == 1 && $comment->is_spam == 1) { $comment->is_spam = 0; $ak = new Zend_Service_Akismet($wordPressAPIKey, WEB_ROOT); $data = $comment->getAkismetData(); try { $ak->submitHam($data); $response = array('status' => 'ok'); $comment->save(); } catch (Exception $e) { _log($e->getMessage()); $response = array('status' => 'fail', 'message' => $e->getMessage()); } } else { try { $comment->save(); $response = array('status' => 'ok'); } catch (Exception $e) { $response = array('status' => 'fail', 'message' => $e->getMessage()); _log($e->getMessage()); } } } $this->_helper->json($response); }