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


PHP EnmasseHelper::checkSpammer方法代码示例

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


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

示例1: submit_review

 function submit_review()
 {
     $nDealId = JRequest::getVar('nDealId');
     $nRating = JRequest::getVar('nRating');
     $sReviewBody = JRequest::getVar('sReviewBody');
     // Be sure this is a valid deal id
     if ($nDealId > 0) {
         // Check for a valid rating number and review content
         // User has to select his/her rating (the number is from 1 to 5)
         // and has enter his/her review
         if ($nRating <= 0 || $nRating > 5) {
             $sMessage = JText::_('PLEASE_RATE');
             $sRedirectUrl = JRoute::_('index.php?option=com_enmasse&controller=deal&task=comment&id=' . $nDealId, false);
         } elseif ($sReviewBody == '') {
             $sMessage = JText::_('PLEASE_ENTER_REVIEW');
             $sRedirectUrl = JRoute::_('index.php?option=com_enmasse&controller=deal&task=comment&id=' . $nDealId, false);
         } else {
             if (EnmasseHelper::checkSpammer(JFactory::getUser()->get('id'))) {
                 // If this user is a spammer, lie to him/her that the review is submitted but actually we store nothing
                 $sMessage = JText::_('REVIEW_SUBMITTED_SUCCESSFULLY');
                 $sRedirectUrl = JRoute::_('index.php?option=com_enmasse&controller=deal&task=comment&id=' . $nDealId, false);
             } else {
                 $aComment = array();
                 $aComment['deal_id'] = $nDealId;
                 $aComment['user_id'] = JFactory::getUser()->get('id');
                 $aComment['comment'] = $sReviewBody;
                 $aComment['rating'] = $nRating;
                 $aComment['created_at'] = DatetimeWrapper::getDatetimeOfNow();
                 $aComment['status'] = 0;
                 $oRow = JModel::getInstance('comment', 'enmasseModel')->store($aComment);
                 if ($oRow->success) {
                     $sMessage = JText::_('REVIEW_SUBMITTED_SUCCESSFULLY');
                 } else {
                     $sMessage = JText::_('SAVE_REVIEW_FAILED');
                 }
                 $sRedirectUrl = JRoute::_('index.php?option=com_enmasse&controller=deal&task=comment&id=' . $nDealId, false);
             }
         }
     } else {
         $sMessage = JText::_('SAVE_REVIEW_FAILED');
         $sRedirectUrl = JRoute::_('index.php?option=com_enmasse&view=dealtoday', false);
     }
     $this->setRedirect($sRedirectUrl, $sMessage);
 }
开发者ID:marsa1985,项目名称:kazabiz,代码行数:44,代码来源:comment.php

示例2: markUserAsSpammer

 public static function markUserAsSpammer($nCommentId)
 {
     $comment = JModel::getInstance('Comment', 'EnmasseModel')->getCommentById($nCommentId);
     $user = JFactory::getUser($comment->user_id);
     if (EnmasseHelper::checkSpammer($comment->user_id)) {
         $sMessage = JText::sprintf('COMMENT_USER_ALREADY_SPAMMER', $user->name);
     } else {
         $db = JFactory::getDBO();
         $query = "SELECT id FROM #__enmasse_comment WHERE user_id = " . $comment->user_id;
         $db->setQuery($query);
         $aIDs = $db->loadResultArray();
         $sCommentIds = implode(',', $aIDs);
         $bResult = JModel::getInstance('Comment', 'EnmasseModel')->changeCommentStatus($sCommentIds, 3);
         if ($bResult) {
             $sMessage = JText::_('COMMENT_SPAMMED_SUCCESSFULLY');
         } else {
             $sMessage = JText::_('COMMENT_SPAMMED_FAILED');
         }
         $query = "INSERT INTO #__enmasse_comment_spammer VALUES ('', {$comment->user_id}) ";
         $db->setQuery($query);
         $db->query();
         if ($db->getErrorNum()) {
             $sMessage = JText::sprintf('COMMENT_USER_SPAMMED_FAILED', $user->name);
             JJFactory::getApplication()->redirect('index.php?option=com_enmasse&controller=comment', $sMessage, 'error');
         }
         $sMessage = JText::sprintf('COMMENT_MARK_SPAMMER_SUCCESSFULLY', $user->name);
     }
     JFactory::getApplication()->redirect('index.php?option=com_enmasse&controller=comment', $sMessage);
 }
开发者ID:marsa1985,项目名称:kazabiz,代码行数:29,代码来源:EnmasseHelper.class.php


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