本文整理匯總了PHP中Backend\Core\Engine\Model::submitHam方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model::submitHam方法的具體用法?PHP Model::submitHam怎麽用?PHP Model::submitHam使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Backend\Core\Engine\Model
的用法示例。
在下文中一共展示了Model::submitHam方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
/**
* 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';
}
//.........這裏部分代碼省略.........