当前位置: 首页>>代码示例>>PHP>>正文


PHP BackendModel::submitSpam方法代码示例

本文整理汇总了PHP中BackendModel::submitSpam方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendModel::submitSpam方法的具体用法?PHP BackendModel::submitSpam怎么用?PHP BackendModel::submitSpam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BackendModel的用法示例。


在下文中一共展示了BackendModel::submitSpam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Execute the action
  *
  * @return	void
  */
 public function execute()
 {
     // call parent, this will probably add some general CSS/JS or other required files
     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');
     } else {
         // redefine id's
         $ids = (array) $_GET['id'];
         // delete comment(s)
         if ($action == 'delete') {
             BackendBlogModel::deleteComments($ids);
         } elseif ($action == 'spam') {
             // is the spamfilter active?
             if (BackendModel::getModuleSetting($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 (BackendModel::getModuleSetting($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';
         }
         if ($action == 'moderation') {
             $report .= 'moved-moderation';
         }
//.........这里部分代码省略.........
开发者ID:netconstructor,项目名称:forkcms,代码行数:101,代码来源:mass_comment_action.php


注:本文中的BackendModel::submitSpam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。