本文整理匯總了PHP中IPSMember::flagMemberAsSpammer方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSMember::flagMemberAsSpammer方法的具體用法?PHP IPSMember::flagMemberAsSpammer怎麽用?PHP IPSMember::flagMemberAsSpammer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSMember
的用法示例。
在下文中一共展示了IPSMember::flagMemberAsSpammer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: markMembersAsSpam
/**
* Marks member(s) as spam
*
* @note Exceptions CAN bubble up, so you should still capture exceptions from calls to this method
* @param array Array of member ids
* @return string Confirmation message
*/
public function markMembersAsSpam($ids)
{
/* Grab members */
$members = IPSMember::load($ids);
/* Load moderator's library */
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums');
$modLibrary = new $classToLoad($this->registry);
/* Load custom profile fields class */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
$fields = new $classToLoad();
/* Load language file */
$this->registry->getClass('class_localization')->loadLanguageFile(array('public_mod'), 'forums');
/* Cycle all members */
foreach ($members as $member_id => $member) {
/* Protected group? */
if (IPSMember::isInGroup($member, explode(',', ipsRegistry::$settings['warn_protected']))) {
continue;
}
/**
* Update member group and then flag as spammer,
* we're removing them from the validating queue anyway
*
* We must run this query here before they're flagged as spammer because
* the 'onProfileUpdate' member sync call could edit further their group
*/
$this->DB->update('members', array('member_group_id' => $this->settings['member_group']), 'member_id=' . $member['member_id']);
$member['member_group_id'] = $this->settings['member_group'];
# Change group here too to reflect the update just in case
IPSMember::flagMemberAsSpammer($member, $this->memberData, FALSE);
}
/* Remove validating rows */
$this->DB->delete('validating', "member_id IN (" . implode(",", $ids) . ")");
/* Reset last member */
IPSMember::resetLastRegisteredMember();
$message = sprintf($this->lang->words['t_setasspammers'], count($ids));
ipsRegistry::getClass('adminFunctions')->saveAdminLog($message);
return $message;
}
示例2: _memberToggleSpam
/**
* Toggle member spam [process]
*
* @return @e void
*/
protected function _memberToggleSpam()
{
/* INIT */
$toSave = array();
$this->request['member_id'] = intval($this->request['member_id']);
if (!$this->request['member_id']) {
$this->registry->output->showError($this->lang->words['m_specify'], 11228);
}
$member = IPSMember::load($this->request['member_id']);
if (!$member['member_id']) {
$this->registry->output->showError($this->lang->words['m_noid'], 11229);
}
//-----------------------------------------
// Allowed to spam administrators?
//-----------------------------------------
if ($member['g_access_cp'] and !$this->registry->getClass('class_permissions')->checkPermission('member_ban_admin')) {
$this->registry->output->global_message = $this->lang->words['m_banadmin'];
$this->_memberView();
return;
}
/* Load mod lib */
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums');
$this->modLibrary = new $classToLoad($this->registry);
/* Spam or not ? */
if ($member['bw_is_spammer']) {
$toSave['core']['bw_is_spammer'] = 0;
$toSave['core']['restrict_post'] = 0;
$toSave['core']['members_disable_pm'] = 0;
/* Flag them as not a spammer */
IPSMember::save($member['member_id'], $toSave);
/* Un-spammed ;) */
IPSLib::runMemberSync('onUnSetAsSpammer', $member);
} else {
IPSMember::flagMemberAsSpammer($member, $this->memberData);
}
//-----------------------------------------
// Redirect
//-----------------------------------------
ipsRegistry::getClass('adminFunctions')->saveAdminLog(sprintf($this->lang->words['t_log_spam'], $member['members_display_name']));
$this->registry->output->global_message = $this->lang->words['t_log_spam'];
$this->registry->output->silentRedirectWithMessage($this->settings['base_url'] . $this->form_code . '&do=viewmember&member_id=' . $member['member_id']);
}
示例3: _setAsSpammer
/**
* Flag a user account as a spammer
*
* @return @e void
*/
protected function _setAsSpammer()
{
//-----------------------------------------
// Init
//-----------------------------------------
$member_id = intval($this->request['member_id']);
$toSave = array('core' => array('bw_is_spammer' => 1));
$topicId = intval($this->request['t']);
$topic = array();
if ($topicId) {
$topic = $this->DB->buildAndFetch(array('select' => 'tid, title_seo, forum_id', 'from' => 'topics', 'where' => 'tid=' . $topicId));
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load($member_id);
if (!$member['member_id']) {
$this->registry->output->showError('moderate_no_permission', 10311900, true, null, 404);
}
if (!$this->memberData['g_access_cp'] and $member['g_access_cp']) {
return $this->registry->getClass('output')->getTemplate('modcp')->modcpMessage($this->lang->words['mod_cannot_edit_admin']);
}
//-----------------------------------------
// Check permissions
//-----------------------------------------
if (!$this->memberData['g_is_supmod'] and !$this->memberData['forumsModeratorData'][$topic['forum_id']]['bw_flag_spammers']) {
$this->registry->output->showError('moderate_no_permission', 103119, true, null, 403);
}
if (IPSMember::isInGroup($member, explode(',', $this->settings['warn_protected']))) {
$this->registry->output->showError('moderate_no_permission', 10311901, true, null, 403);
}
if ($this->request['auth_key'] != $this->member->form_hash) {
$this->registry->output->showError('moderate_no_permission', 10311902, null, null, 403);
}
//-----------------------------------------
// Do it
//-----------------------------------------
IPSMember::flagMemberAsSpammer($member, $this->memberData);
//-----------------------------------------
// Redirect
//-----------------------------------------
if ($topicId) {
$this->registry->output->redirectScreen($this->lang->words['flag_spam_done'], $this->settings['base_url'] . "showtopic=" . $topic['tid'] . "&st=" . intval($this->request['st']), $topic['title_seo'], 'showtopic');
} else {
$this->registry->output->redirectScreen($this->lang->words['flag_spam_done'], $this->settings['base_url'] . "showuser=" . $member['member_id'], $member['members_seo_name'], 'showuser');
}
}