Submit spam, his call is for submitting comments that weren't marked as spam but should have been.
public static submitSpam ( string $userIp, string $userAgent, string $content, string $author = null, string $email = null, string $url = null, string $permalink = null, string $type = null, string $referrer = null, array $others = null ) : boolean | ||
$userIp | string | IP address of the comment submitter. |
$userAgent | string | User agent information. |
$content | string | The content that was submitted. |
$author | string | Submitted name with the comment. |
string | Submitted email address. | |
$url | string | Commenter URL. |
$permalink | string | The permanent location of the entry the comment was submitted to. |
$type | string | May be blank, comment, trackback, pingback, or a made up value like "registration". |
$referrer | string | The content of the HTTP_REFERER header should be sent here. |
$others | array | Other data (the variables from $_SERVER). |
return | boolean | If everything went fine true will be returned, otherwise an exception will be triggered. |
/** * Execute the action */ public function execute() { parent::execute(); // current status $from = \SpoonFilter::getGetValue('from', array('published', 'moderation', 'spam'), 'published'); // action to execute $action = \SpoonFilter::getGetValue('action', array('published', 'moderation', 'spam', 'delete'), 'spam'); // no id's provided if (!isset($_GET['id'])) { $this->redirect(BackendModel::createURLForAction('Comments') . '&error=no-comments-selected'); } // redefine id's $ids = (array) $_GET['id']; // delete comment(s) if ($action == 'delete') { BackendBlogModel::deleteComments($ids); } elseif ($action == 'spam') { // is the spamfilter active? if ($this->get('fork.settings')->get($this->URL->getModule(), 'spamfilter', false)) { // get data $comments = BackendBlogModel::getComments($ids); // loop comments foreach ($comments as $row) { // unserialize data $row['data'] = unserialize($row['data']); // check if needed data is available if (!isset($row['data']['server']['REMOTE_ADDR'])) { continue; } if (!isset($row['data']['server']['HTTP_USER_AGENT'])) { continue; } // build vars $userIp = $row['data']['server']['REMOTE_ADDR']; $userAgent = $row['data']['server']['HTTP_USER_AGENT']; $content = $row['text']; $author = $row['author']; $email = $row['email']; $url = isset($row['website']) && $row['website'] != '' ? $row['website'] : null; $referrer = isset($row['data']['server']['HTTP_REFERER']) ? $row['data']['server']['HTTP_REFERER'] : null; $others = $row['data']['server']; // submit as spam BackendModel::submitSpam($userIp, $userAgent, $content, $author, $email, $url, null, 'comment', $referrer, $others); } } // set new status BackendBlogModel::updateCommentStatuses($ids, $action); } else { // published? if ($action == 'published') { // is the spamfilter active? if ($this->get('fork.settings')->get($this->URL->getModule(), 'spamfilter', false)) { // get data $comments = BackendBlogModel::getComments($ids); // loop comments foreach ($comments as $row) { // previous status is spam if ($row['status'] == 'spam') { // unserialize data $row['data'] = unserialize($row['data']); // check if needed data is available if (!isset($row['data']['server']['REMOTE_ADDR'])) { continue; } if (!isset($row['data']['server']['HTTP_USER_AGENT'])) { continue; } // build vars $userIp = $row['data']['server']['REMOTE_ADDR']; $userAgent = $row['data']['server']['HTTP_USER_AGENT']; $content = $row['text']; $author = $row['author']; $email = $row['email']; $url = isset($row['website']) && $row['website'] != '' ? $row['website'] : null; $referrer = isset($row['data']['server']['HTTP_REFERER']) ? $row['data']['server']['HTTP_REFERER'] : null; $others = $row['data']['server']; // submit as spam BackendModel::submitHam($userIp, $userAgent, $content, $author, $email, $url, null, 'comment', $referrer, $others); } } } } // set new status BackendBlogModel::updateCommentStatuses($ids, $action); } // define report $report = count($ids) > 1 ? 'comments-' : 'comment-'; // init var if ($action == 'published') { $report .= 'moved-published'; } elseif ($action == 'moderation') { $report .= 'moved-moderation'; } elseif ($action == 'spam') { $report .= 'moved-spam'; } elseif ($action == 'delete') { $report .= 'deleted'; } // redirect $this->redirect(BackendModel::createURLForAction('Comments') . '&report=' . $report . '#tab' . \SpoonFilter::ucfirst($from)); }