本文整理匯總了PHP中IPSMember::rebuildIgnoredUsersCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSMember::rebuildIgnoredUsersCache方法的具體用法?PHP IPSMember::rebuildIgnoredUsersCache怎麽用?PHP IPSMember::rebuildIgnoredUsersCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSMember
的用法示例。
在下文中一共展示了IPSMember::rebuildIgnoredUsersCache方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doExecute
/**
* Main class entry point
*
* @param object ipsRegistry reference
* @return @e void [Outputs to screen]
*/
public function doExecute(ipsRegistry $registry)
{
//-----------------------------------------
// Got sess ID and mem ID?
//-----------------------------------------
if (!$this->member->getProperty('member_id')) {
$this->returnString("no");
}
//-----------------------------------------
// Get data
//-----------------------------------------
$block = $this->request['block'] ? true : false;
$id = intval($this->request['id']);
if (!$id) {
$this->returnString("no");
}
//-----------------------------------------
// Get member record and verify we can ignore
//-----------------------------------------
$member = IPSMember::load($id, 'core');
if ($member['_canBeIgnored'] !== TRUE) {
$this->returnString("no");
}
//-----------------------------------------
// Get ignore record
//-----------------------------------------
$_ignore = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'ignored_users', 'where' => "ignore_owner_id=" . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $id));
if ($_ignore['ignore_id']) {
$this->DB->update('ignored_users', array('ignore_chats' => $block ? 1 : 0), 'ignore_id=' . $_ignore['ignore_id']);
} else {
$_ignore = array('ignore_owner_id' => $this->memberData['member_id'], 'ignore_ignore_id' => $id, 'ignore_chats' => 1);
$this->DB->insert('ignored_users', $_ignore);
}
//-----------------------------------------
// Update cache
//-----------------------------------------
IPSMember::rebuildIgnoredUsersCache($this->memberData);
//-----------------------------------------
// Something to return
//-----------------------------------------
$this->returnString("ok");
}
示例2: saveIgnoredUsers
/**
* UserCP Save Form: Ignore Users
*
* @return array Errors
*/
public function saveIgnoredUsers()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$newName = $this->request['newbox_1'];
$dnvs = intval($this->request['donot_view_sigs']);
IPSMember::save($this->memberData['member_id'], array('core' => array('view_sigs' => $dnvs ? 0 : 1)));
if (trim($newName) && $_POST['newbox_1'] != $this->lang->words['ucp_members_name']) {
//-----------------------------------------
// Load
//-----------------------------------------
$member = IPSMember::load($newName, 'core', 'displayname');
if (!$member['member_id']) {
return array(0 => $this->lang->words['ignoreuser_nomem']);
}
if ($member['member_id'] == $this->memberData['member_id']) {
return array(0 => $this->lang->words['ignoreuser_cannot']);
}
//-----------------------------------------
// Already ignoring?
//-----------------------------------------
$ignoreMe = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'ignored_users', 'where' => 'ignore_owner_id=' . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $member['member_id']));
if ($ignoreMe['ignore_id']) {
return array(0 => $this->lang->words['ignoreuser_already']);
}
//-----------------------------------------
// Can we ignore them?
//-----------------------------------------
if ($member['_canBeIgnored'] !== TRUE) {
return array(0 => $this->lang->words['ignoreuser_cannot']);
}
//-----------------------------------------
// Add it
//-----------------------------------------
$this->DB->insert('ignored_users', array('ignore_owner_id' => $this->memberData['member_id'], 'ignore_ignore_id' => $member['member_id'], 'ignore_messages' => !empty($this->request['ignore_messages']) ? 1 : 0, 'ignore_topics' => !empty($this->request['ignore_topics']) ? 1 : 0, 'ignore_signatures' => !empty($this->request['ignore_signatures']) ? 1 : 0, 'ignore_chats' => !empty($this->request['ignore_chats']) ? 1 : 0));
/* Rebuild cache */
IPSMember::rebuildIgnoredUsersCache($this->memberData);
}
return TRUE;
}
示例3: convertIgnored
/**
* Convert ignored chat users
*
* @return @e void
*/
public function convertIgnored()
{
/* Init */
$st = intval($this->request['st']);
$did = 0;
/* Find chat ignored users */
$this->DB->build(array('select' => 'member_id, members_cache', 'from' => 'members', 'order' => 'member_id ASC', 'limit' => array($st, $this->perPage)));
$outer = $this->DB->execute();
while ($r = $this->DB->fetch($outer)) {
$did++;
/* Unpack cache */
$_cache = unserialize($r['members_cache']);
/* Now look for ignored users in chat */
if (is_array($_cache['ignore_chat']) and count($_cache['ignore_chat'])) {
foreach ($_cache['ignore_chat'] as $_mid) {
/* Are we already 'ignoring' this user for other reasons? */
$_check = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'ignored_users', 'where' => "ignore_owner_id=" . $r['member_id'] . ' AND ignore_ignore_id=' . $_mid));
/* If yes, then update record to also ignore chat */
if ($_check['ignore_id']) {
$this->DB->update('ignored_users', array('ignore_chats' => 1), 'ignore_id=' . $_check['ignore_id']);
} else {
$this->DB->insert('ignored_users', array('ignore_chats' => 1, 'ignore_owner_id' => $r['member_id'], 'ignore_ignore_id' => $_mid));
}
}
/* Rebuild cache */
IPSMember::rebuildIgnoredUsersCache($r);
/* Clean up members_cache */
unset($_cache['ignore_chat']);
$_cache = serialize($_cache);
$this->DB->update('members', array('members_cache' => $_cache), 'member_id=' . $r['member_id']);
}
}
if ($did > 0) {
$next = $st + $this->perPage;
$this->registry->output->html .= $this->registry->output->global_template->temporaryRedirect($this->settings['base_url'] . $this->form_code . '&do=ignored&st=' . $next, sprintf($this->lang->words['upto_converted_sofar'], $next));
} else {
$this->registry->output->redirect($this->settings['base_url'] . $this->form_code, $this->lang->words['all_converted_sofar'], 1);
}
}
示例4: stopIgnoringMember
/**
* Stop ignoring the user's topics
*
* @access public
* @param integer Member ID to stop ignoring
* @param string Column to update
* @return array Array of info
*/
public function stopIgnoringMember($ignoreId, $type = 'topics')
{
//-----------------------------------------
// INIT
//-----------------------------------------
$this->lang->loadLanguageFile(array('public_usercp'), 'core');
$ignoreId = intval($ignoreId);
$md5check = IPSText::md5Clean($this->request['md5check']);
$antiType = $type == 'topics' ? 'messages' : 'topics';
//-----------------------------------------
// MD5 check
//-----------------------------------------
if (!$ignoreId) {
return array('error' => $this->lang->words['noignoreuser_noid']);
}
if ($md5check != $this->member->form_hash) {
return array('error' => $this->lang->words['securehash_not_secure']);
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load($ignoreId, 'core');
//-----------------------------------------
// Check
//-----------------------------------------
if (!$member['member_id']) {
return array('error' => $this->lang->words['noignoreuser_noid']);
}
//-----------------------------------------
// Already ignoring?
//-----------------------------------------
$ignoreMe = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'ignored_users', 'where' => 'ignore_owner_id=' . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $member['member_id']));
if ($ignoreMe['ignore_id']) {
if (!$ignoreMe['ignore_' . $antiType]) {
$this->DB->delete('ignored_users', 'ignore_id=' . $ignoreMe['ignore_id']);
} else {
$this->DB->update('ignored_users', array('ignore_' . $type => 0), 'ignore_id=' . $ignoreMe['ignore_id']);
}
/* Rebuild cache */
IPSMember::rebuildIgnoredUsersCache($this->memberData);
return array('message' => $this->lang->words['noignoreuser_success']);
} else {
return array('error' => $this->lang->words['noignoreuser_noid']);
}
}
示例5: _ignoreSig
/**
* Ignore signature
*/
protected function _ignoreSig()
{
$memberId = trim($this->request['memberId']);
$memberId = is_numeric($memberId) ? $memberId : 'all';
/* Whut */
if ($memberId == 'all') {
IPSMember::save($this->memberData['member_id'], array('core' => array('view_sigs' => 0)));
} else {
/* Insert or update? */
$ignored = IPSMember::fetchIgnoredUsers($this->memberData);
if (!empty($ignored[$memberId])) {
/* Update */
$this->DB->update('ignored_users', array('ignore_signatures' => 1), 'ignore_owner_id=' . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $memberId);
} else {
$this->DB->insert('ignored_users', array('ignore_owner_id' => $this->memberData['member_id'], 'ignore_ignore_id' => $memberId, 'ignore_messages' => 0, 'ignore_topics' => 0, 'ignore_signatures' => 1));
}
/* Rebuild cache */
IPSMember::rebuildIgnoredUsersCache($this->memberData);
}
$this->returnJsonArray(array('status' => 'ok'));
}
示例6: saveIgnoredUsers
/**
* UserCP Save Form: Ignore Users
*
* @access public
* @return array Errors
*/
public function saveIgnoredUsers()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$newName = $this->request['newbox_1'];
if (!trim($newName)) {
return array(0 => $this->lang->words['ignoreuser_nomem']);
}
//-----------------------------------------
// Load
//-----------------------------------------
$member = IPSMember::load($newName, 'core', 'displayname');
if (!$member['member_id']) {
return array(0 => $this->lang->words['ignoreuser_nomem']);
}
if ($member['member_id'] == $this->memberData['member_id']) {
return array(0 => $this->lang->words['ignoreuser_cannot']);
}
//-----------------------------------------
// Already ignoring?
//-----------------------------------------
$ignoreMe = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'ignored_users', 'where' => 'ignore_owner_id=' . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $member['member_id']));
if ($ignoreMe['ignore_id']) {
return array(0 => $this->lang->words['ignoreuser_already']);
}
//-----------------------------------------
// Can we ignore them?
//-----------------------------------------
if ($member['_canBeIgnored'] !== TRUE) {
return array(0 => $this->lang->words['ignoreuser_cannot']);
}
//-----------------------------------------
// Add it
//-----------------------------------------
$this->DB->insert('ignored_users', array('ignore_owner_id' => $this->memberData['member_id'], 'ignore_ignore_id' => $member['member_id'], 'ignore_messages' => isset($this->request['ignore_messages']) && $this->request['ignore_messages'] ? 1 : 0, 'ignore_topics' => isset($this->request['ignore_topics']) && $this->request['ignore_topics'] ? 1 : 0));
/* Rebuild cache */
IPSMember::rebuildIgnoredUsersCache($this->memberData);
return TRUE;
}
示例7: convertIgnored
/**
* Convert ignored users
*
* @param int
* @return @e void
*/
public function convertIgnored()
{
/* Are we skipping this step? */
$options = IPSSetUp::getSavedData('custom_options');
$_skip = $options['ipchat'][13000]['skipIgnoredUsers'];
if ($_skip) {
$this->registry->output->addMessage("Skipping chat ignored users conversion...");
$this->request['st'] = 0;
$this->request['workact'] = '';
return;
}
/* Init */
$st = intval($this->request['st']);
$did = 0;
$each = 500;
/* Find chat ignored users */
$this->DB->build(array('select' => 'member_id, members_cache', 'from' => 'members', 'order' => 'member_id ASC', 'limit' => array($st, $each)));
$outer = $this->DB->execute();
while ($r = $this->DB->fetch($outer)) {
$did++;
/* Unpack cache */
$_cache = unserialize($r['members_cache']);
/* Now look for ignored users in chat */
if (is_array($_cache['ignore_chat']) and count($_cache['ignore_chat'])) {
foreach ($_cache['ignore_chat'] as $_mid) {
/* Are we already 'ignoring' this user for other reasons? */
$_check = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'ignored_users', 'where' => "ignore_owner_id=" . $r['member_id'] . ' AND ignore_ignore_id=' . $_mid));
/* If yes, then update record to also ignore chat */
if ($_check['ignore_id']) {
$this->DB->update('ignored_users', array('ignore_chats' => 1), 'ignore_id=' . $_check['ignore_id']);
} else {
$this->DB->insert('ignored_users', array('ignore_chats' => 1, 'ignore_owner_id' => $r['member_id'], 'ignore_ignore_id' => $_mid));
}
}
/* Rebuild cache */
IPSMember::rebuildIgnoredUsersCache($r);
/* Clean up members_cache */
unset($_cache['ignore_chat']);
$_cache = serialize($_cache);
$this->DB->update('members', array('members_cache' => $_cache), 'member_id=' . $r['member_id']);
}
}
/* Show message and redirect */
if ($did > 0) {
$this->request['st'] = $st + $did;
$this->request['workact'] = 'ignored';
$this->registry->output->addMessage("Up to {$this->request['st']} members checked for ignored chat users...");
} else {
$this->request['st'] = 0;
$this->request['workact'] = '';
$this->registry->output->addMessage("All ignored chat users converted...");
}
/* Next Page */
return;
}