本文整理汇总了PHP中Phpfox::isSpammer方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox::isSpammer方法的具体用法?PHP Phpfox::isSpammer怎么用?PHP Phpfox::isSpammer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phpfox
的用法示例。
在下文中一共展示了Phpfox::isSpammer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
$bFriendIsSelected = false;
if ($iUserId = $this->request()->getInt('to')) {
$aUser = Phpfox::getService('user')->getUser($iUserId, Phpfox::getUserField());
if (isset($aUser['user_id'])) {
//if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'mail.send_message'))
if (!Phpfox::getService('mail')->canMessageUser($aUser['user_id'])) {
return Phpfox_Error::display(Phpfox::getPhrase('mail.unable_to_send_a_private_message_to_this_user_at_the_moment'));
}
$bFriendIsSelected = true;
$this->template()->assign('aUser', $aUser);
}
}
if (Phpfox::getParam('mail.spam_check_messages') && Phpfox::isSpammer()) {
return Phpfox_Error::display(Phpfox::getPhrase('mail.currently_your_account_is_marked_as_a_spammer'));
}
$aValidation = array('subject' => Phpfox::getPhrase('mail.provide_subject_for_your_message'), 'message' => Phpfox::getPhrase('mail.provide_message'));
$oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
if ($aVals = $this->request()->getArray('val')) {
// Lets make sure they are actually trying to send someone a message.
if ((!isset($aVals['to']) || isset($aVals['to']) && !count($aVals['to'])) && (!isset($aVals['copy_to_self']) || $aVals['copy_to_self'] != 1)) {
Phpfox_Error::set(Phpfox::getPhrase('mail.select_a_member_to_send_a_message_to'));
}
if ($oValid->isValid($aVals)) {
if (Phpfox::getParam('mail.mail_hash_check')) {
Phpfox::getLib('spam.hash', array('table' => 'mail_hash', 'total' => Phpfox::getParam('mail.total_mail_messages_to_check'), 'time' => Phpfox::getParam('mail.total_minutes_to_wait_for_pm'), 'content' => $aVals['message']))->isSpam();
}
if (Phpfox::getParam('mail.spam_check_messages')) {
if (Phpfox::getLib('spam')->check(array('action' => 'isSpam', 'params' => array('module' => 'comment', 'content' => Phpfox::getLib('parse.input')->prepare($aVals['message']))))) {
Phpfox_Error::set(Phpfox::getPhrase('mail.this_message_feels_like_spam_try_again'));
}
}
if (Phpfox_Error::isPassed()) {
$aIds = Phpfox::getService('mail.process')->add($aVals);
$this->url()->send('mail.view', array('id' => $aIds[0]));
}
}
}
$this->template()->assign(array('bMobileInboxIsActive' => true, 'bFriendIsSelected' => $bFriendIsSelected, 'aMobileSubMenus' => array($this->url()->makeUrl('mail') => Phpfox::getPhrase('mail.mobile_messages'), $this->url()->makeUrl('mail', 'sent') => Phpfox::getPhrase('mail.sent'), $this->url()->makeUrl('mail', 'compose') => Phpfox::getPhrase('mail.compose')), 'sActiveMobileSubMenu' => $this->url()->makeUrl('mail', 'compose')));
}
示例2: process
public function process()
{
Phpfox::isUser(true);
Phpfox::getUserParam('mail.can_compose_message', true);
$bClaiming = $this->getParam('page_id') != false;
if (Phpfox::getParam('mail.spam_check_messages') && Phpfox::isSpammer()) {
return Phpfox_Error::display(Phpfox::getPhrase('mail.currently_your_account_is_marked_as_a_spammer'));
}
$aVals = $this->request()->getArray('val');
$bIsSending = isset($aVals['sending_message']);
$aUser = array();
if (($iUserId = $this->request()->get('id')) || ($iUserId = $this->getParam('id'))) {
$aUser = Phpfox::getService('user')->getUser($iUserId, Phpfox::getUserField());
if (isset($aUser['user_id'])) {
if ($bClaiming == false && $bIsSending != true && Phpfox::getService('mail')->canMessageUser($aUser['user_id']) == false) {
return Phpfox_Error::display(Phpfox::getPhrase('mail.unable_to_send_a_private_message_to_this_user_at_the_moment'));
}
$this->template()->assign('aUser', $aUser);
if ($bClaiming) {
$aPage = Phpfox::getService('pages')->getPage($this->getParam('page_id'));
$this->template()->assign(array('iPageId' => $this->getParam('page_id'), 'aPage' => $aPage, 'sMessageClaim' => Phpfox::getPhrase('mail.page_claim_message', array('title' => $aPage['title'], 'url' => Phpfox::permalink('pages', $aPage['page_id'], $aPage['title'])))));
}
}
($sPlugin = Phpfox_Plugin::get('mail.component_controller_compose_controller_to')) ? eval($sPlugin) : false;
}
$bIsThreadForward = false;
$iThreadId = 0;
if ($iThreadId = $this->request()->getInt('forward_thread_id')) {
$bIsThreadForward = true;
}
$aValidation = array('subject' => Phpfox::getPhrase('mail.provide_subject_for_your_message'), 'message' => Phpfox::getPhrase('mail.provide_message'));
if (Phpfox::getParam('mail.threaded_mail_conversation')) {
unset($aValidation['subject']);
}
if (Phpfox::isModule('captcha') && Phpfox::getUserParam('mail.enable_captcha_on_mail')) {
$aValidation['image_verification'] = Phpfox::getPhrase('captcha.complete_captcha_challenge');
}
($sPlugin = Phpfox_Plugin::get('mail.component_controller_compose_controller_validation')) ? eval($sPlugin) : false;
$oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
if ($aVals = $this->request()->getArray('val')) {
// Lets make sure they are actually trying to send someone a message.
if ((!isset($aVals['to']) || isset($aVals['to']) && !count($aVals['to'])) && (!isset($aVals['copy_to_self']) || $aVals['copy_to_self'] != 1)) {
Phpfox_Error::set(Phpfox::getPhrase('mail.select_a_member_to_send_a_message_to'));
}
if ($oValid->isValid($aVals)) {
if (Phpfox::getParam('mail.mail_hash_check')) {
Phpfox::getLib('spam.hash', array('table' => 'mail_hash', 'total' => Phpfox::getParam('mail.total_mail_messages_to_check'), 'time' => Phpfox::getParam('mail.total_minutes_to_wait_for_pm'), 'content' => $aVals['message']))->isSpam();
}
if (Phpfox::getParam('mail.spam_check_messages')) {
if (Phpfox::getLib('spam')->check(array('action' => 'isSpam', 'params' => array('module' => 'comment', 'content' => Phpfox::getLib('parse.input')->prepare($aVals['message']))))) {
Phpfox_Error::set(Phpfox::getPhrase('mail.this_message_feels_like_spam_try_again'));
}
}
if (Phpfox_Error::isPassed()) {
if ($bClaiming) {
$aVals['claim_page'] = true;
}
if ($aIds = Phpfox::getService('mail.process')->add($aVals)) {
if (isset($aVals['page_id']) && !empty($aVals['page_id'])) {
Phpfox::getLib('database')->insert(Phpfox::getT('pages_claim'), array('status_id' => '1', 'page_id' => (int) $aVals['page_id'], 'user_id' => Phpfox::getUserId(), 'time_stamp' => PHPFOX_TIME));
}
if (PHPFOX_IS_AJAX) {
$this->_bReturn = true;
return true;
}
if (Phpfox::getParam('mail.threaded_mail_conversation')) {
$this->url()->send('mail.thread', array('id' => $aIds));
} else {
if (count($aIds) > 1) {
$this->url()->send('mail.view', array('id' => base64_encode(serialize($aIds))));
} elseif (isset($aIds[0])) {
$this->url()->send('mail.view', array('id' => $aIds[0]));
}
}
} else {
if (PHPFOX_IS_AJAX) {
$this->_bReturn = false;
return false;
}
}
} else {
if (PHPFOX_IS_AJAX) {
$this->_bReturn = false;
return false;
}
}
} else {
if (PHPFOX_IS_AJAX) {
$this->_bReturn = false;
return false;
}
}
}
Phpfox::getService('mail')->buildMenu();
if (Phpfox::isModule('friend')) {
$this->template()->setPhrase(array('friend.loading'));
}
if (Phpfox::getParam('core.wysiwyg') == 'tiny_mce') {
Phpfox::getService('tinymce')->load();
$sTinyMceCode = str_replace('\'', '\\\'', Phpfox::getService('tinymce')->getJsCode());
//.........这里部分代码省略.........
示例3: sendEmail
public function sendEmail()
{
$sSubject = $this->_oApi->get('subject', '');
if (empty($sSubject)) {
$iId = Phpfox::getService('mail.process')->add(array('to' => $this->_oApi->get('to'), 'attachment' => '', 'message' => $this->_oApi->get('message'), 'parent_id' => $this->_oApi->get('parent_id')));
return array('mail_id' => $iId);
}
if (!Phpfox::getUserParam('mail.can_compose_message', false)) {
return $this->_oApi->error('accountapi.can_not_compose_message', 'User donot have permission composing email.');
}
if (Phpfox::getParam('mail.spam_check_messages') && Phpfox::isSpammer()) {
return $this->_oApi->error('accountapi.current_your_account_is_marked_as_a_spammer', Phpfox::getPhrase('mail.currently_your_account_is_marked_as_a_spammer'));
}
$aValidation = array('subject' => Phpfox::getPhrase('mail.provide_subject_for_your_message'), 'message' => Phpfox::getPhrase('mail.provide_message'));
$oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
$aVals = array('subject' => $this->_oApi->get('subject'), 'message' => $this->_oApi->get('message'), 'to' => $this->_oApi->get('to'), 'parent_id' => $this->_oApi->get('parent_id'), 'thread_id' => $this->_oApi->get('thread_id'));
if ($aVals['parent_id'] || $aVals['thread_id']) {
if ($aVals['to'] == '') {
$aVals['to'] = 1;
}
if ($aVals['subject'] == '') {
$aVals['subject'] = 'BRODEV';
}
}
if ((!isset($aVals['to']) || isset($aVals['to']) && !count($aVals['to'])) && (!isset($aVals['copy_to_self']) || $aVals['copy_to_self'] != 1)) {
return $this->_oApi->error('accountapi.user_receive_email_is_missing', Phpfox::getPhrase('mail.select_a_member_to_send_a_message_to'));
}
if ($oValid->isValid($aVals)) {
if (Phpfox::getParam('mail.mail_hash_check')) {
Phpfox::getLib('spam.hash', array('table' => 'mail_hash', 'total' => Phpfox::getParam('mail.total_mail_messages_to_check'), 'time' => Phpfox::getParam('mail.total_minutes_to_wait_for_pm'), 'content' => $aVals['message']))->isSpam();
}
if (Phpfox::getParam('mail.spam_check_messages')) {
if (Phpfox::getLib('spam')->check(array('action' => 'isSpam', 'params' => array('module' => 'comment', 'content' => Phpfox::getLib('parse.input')->prepare($aVals['message']))))) {
return $this->_oApi->error('accountapi.spam_is_detected', Phpfox::getPhrase('mail.this_message_feels_like_spam_try_again'));
}
}
if (Phpfox_Error::isPassed()) {
if ($aVals['thread_id'] && Phpfox::getParam('mail.threaded_mail_conversation')) {
unset($aVals['to']);
unset($aVals['parent_id']);
} else {
unset($aVals['thread_id']);
}
if ($aVals['parent_id'] > 0) {
unset($aVals['thread_id']);
} else {
unset($aVals['parent_id']);
}
if ($iId = Phpfox::getService('accountapi.mail')->add($aVals)) {
if (Phpfox::getParam('mail.threaded_mail_conversation')) {
return array('thread_id' => $iId);
} else {
return array('mail_id' => $iId);
}
}
}
}
return $this->_oApi->error('accountapi.error_is_detected', implode(', ', Phpfox_Error::get()));
}
示例4: process
public function process()
{
Phpfox::isUser(true);
Phpfox::getUserParam('mail.can_compose_message', true);
if (Phpfox::getParam('mail.spam_check_messages') && Phpfox::isSpammer())
{
return Phpfox_Error::display(Phpfox::getPhrase('mail.currently_your_account_is_marked_as_a_spammer'));
}
$aUser = array();
if (($iUserId = $this->request()->get('id')) || ($iUserId = $this->getParam('id')))
{
$aUser = Phpfox::getService('user')->getUser($iUserId, Phpfox::getUserField());
if (isset($aUser['user_id']))
{
if (Phpfox::getService('mail')->canMessageUser($aUser['user_id']) == false)
{
return Phpfox_Error::display(Phpfox::getPhrase('mail.unable_to_send_a_private_message_to_this_user_at_the_moment'));
}
$this->template()->assign('aUser', $aUser);
}
(($sPlugin = Phpfox_Plugin::get('mail.component_controller_compose_controller_to')) ? eval($sPlugin) : false);
}
$aValidation = array(
'subject' => Phpfox::getPhrase('mail.provide_subject_for_your_message'),
'message' => Phpfox::getPhrase('mail.provide_message')
);
if (Phpfox::isModule('captcha') && Phpfox::getUserParam('mail.enable_captcha_on_mail'))
{
$aValidation['image_verification'] = Phpfox::getPhrase('captcha.complete_captcha_challenge');
}
(($sPlugin = Phpfox_Plugin::get('mail.component_controller_compose_controller_validation')) ? eval($sPlugin) : false);
$oValid = Phpfox::getLib('validator')->set(array(
'sFormName' => 'js_form',
'aParams' => $aValidation
)
);
if ($aVals = $this->request()->getArray('val'))
{
// Lets make sure they are actually trying to send someone a message.
if (((!isset($aVals['to'])) || (isset($aVals['to']) && !count($aVals['to']))) && (!isset($aVals['copy_to_self']) || $aVals['copy_to_self'] != 1))
{
Phpfox_Error::set(Phpfox::getPhrase('mail.select_a_member_to_send_a_message_to'));
}
if ($oValid->isValid($aVals))
{
if (Phpfox::getParam('mail.mail_hash_check'))
{
Phpfox::getLib('spam.hash', array(
'table' => 'mail_hash',
'total' => Phpfox::getParam('mail.total_mail_messages_to_check'),
'time' => Phpfox::getParam('mail.total_minutes_to_wait_for_pm'),
'content' => $aVals['message']
)
)->isSpam();
}
if (Phpfox::getParam('mail.spam_check_messages'))
{
if (Phpfox::getLib('spam')->check(array(
'action' => 'isSpam',
'params' => array(
'module' => 'comment',
'content' => Phpfox::getLib('parse.input')->prepare($aVals['message'])
)
)
)
)
{
Phpfox_Error::set(Phpfox::getPhrase('mail.this_message_feels_like_spam_try_again'));
}
}
if (Phpfox_Error::isPassed())
{
if ($aIds = Phpfox::getService('mail.process')->add($aVals))
{
if (PHPFOX_IS_AJAX)
{
$this->_bReturn = true;
return true;
}
if (count($aIds) > 1)
{
$this->url()->send('mail.view' , array('id' => base64_encode(serialize($aIds))));
}
elseif(isset($aIds[0]))
{
$this->url()->send('mail.view' , array('id' => $aIds[0]));
//.........这里部分代码省略.........