本文整理汇总了PHP中IPSLib::runMemberSync方法的典型用法代码示例。如果您正苦于以下问题:PHP IPSLib::runMemberSync方法的具体用法?PHP IPSLib::runMemberSync怎么用?PHP IPSLib::runMemberSync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPSLib
的用法示例。
在下文中一共展示了IPSLib::runMemberSync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
//.........这里部分代码省略.........
}
if (!count($tmp_mids)) {
return false;
}
$mids = ' IN (' . implode(",", $tmp_mids) . ')';
//-----------------------------------------
// Get avatars / photo
//-----------------------------------------
$delete_files = array();
ipsRegistry::DB()->build(array('select' => '*', 'from' => 'profile_portal', 'where' => 'pp_member_id' . $mids));
ipsRegistry::DB()->execute();
while ($r = ipsRegistry::DB()->fetch()) {
if ($r['pp_main_photo']) {
$delete_files[] = $r['pp_main_photo'];
}
if ($r['pp_thumb_photo']) {
$delete_files[] = $r['pp_thumb_photo'];
}
if ($r['avatar_type'] == 'upload' and $r['avatar_location']) {
$delete_files[] = $r['avatar_location'];
}
}
//-----------------------------------------
// Take care of forum stuff
//-----------------------------------------
ipsRegistry::DB()->update('posts', array('author_id' => 0), "author_id" . $mids);
ipsRegistry::DB()->update('topics', array('starter_id' => 0), "starter_id" . $mids);
ipsRegistry::DB()->update('announcements', array('announce_member_id' => 0), "announce_member_id" . $mids);
ipsRegistry::DB()->update('attachments', array('attach_member_id' => 0), "attach_member_id" . $mids);
ipsRegistry::DB()->update('polls', array('starter_id' => 0), "starter_id" . $mids);
//ipsRegistry::DB()->update( 'topic_ratings' , array( 'rating_member_id' => 0 ), "rating_member_id" . $mids );
ipsRegistry::DB()->update('voters', array('member_id' => 0), "member_id" . $mids);
ipsRegistry::DB()->update('forums', array('last_poster_name' => ''), "last_poster_id" . $mids);
ipsRegistry::DB()->update('forums', array('seo_last_name' => ''), "last_poster_id" . $mids);
ipsRegistry::DB()->update('forums', array('last_poster_id' => 0), "last_poster_id" . $mids);
//-----------------------------------------
// Clean up profile stuff
//-----------------------------------------
ipsRegistry::DB()->update('profile_comments', array('comment_by_member_id' => 0), "comment_by_member_id" . $mids);
ipsRegistry::DB()->update('profile_ratings', array('rating_by_member_id' => 0), "rating_by_member_id" . $mids);
ipsRegistry::DB()->delete('profile_comments', "comment_for_member_id" . $mids);
ipsRegistry::DB()->delete('profile_ratings', "rating_for_member_id" . $mids);
ipsRegistry::DB()->delete('profile_portal', "pp_member_id" . $mids);
ipsRegistry::DB()->delete('profile_portal_views', "views_member_id" . $mids);
ipsRegistry::DB()->delete('profile_friends', "friends_member_id" . $mids);
ipsRegistry::DB()->delete('profile_friends', "friends_friend_id" . $mids);
ipsRegistry::DB()->delete('dnames_change', "dname_member_id" . $mids);
//-----------------------------------------
// Delete member...
//-----------------------------------------
ipsRegistry::DB()->delete('pfields_content', "member_id" . $mids);
ipsRegistry::DB()->delete('members_partial', "partial_member_id" . $mids);
ipsRegistry::DB()->delete('moderators', "member_id" . $mids);
ipsRegistry::DB()->delete('sessions', "member_id" . $mids);
ipsRegistry::DB()->delete('warn_logs', "wlog_mid" . $mids);
ipsRegistry::DB()->update('warn_logs', array('wlog_addedby' => 0), "wlog_addedby" . $mids);
//-----------------------------------------
// Update admin stuff
//-----------------------------------------
ipsRegistry::DB()->delete('admin_permission_rows', "row_id_type='member' AND row_id" . $mids);
ipsRegistry::DB()->delete('core_sys_cp_sessions', 'session_member_id' . $mids);
ipsRegistry::DB()->update('upgrade_history', array('upgrade_mid' => 0), "upgrade_mid" . $mids);
//-----------------------------------------
// Fix up member messages...
//-----------------------------------------
ipsRegistry::DB()->delete('message_topic_user_map', 'map_user_id' . $mids);
ipsRegistry::DB()->update('message_posts', array('msg_author_id' => 0), 'msg_author_id' . $mids);
ipsRegistry::DB()->update('message_topics', array('mt_starter_id' => 0), 'mt_starter_id' . $mids);
ipsRegistry::DB()->delete('ignored_users', "ignore_owner_id" . $mids . " or ignore_ignore_id" . $mids);
//-----------------------------------------
// Delete subs, views, markers
//-----------------------------------------
ipsRegistry::DB()->delete('tracker', "member_id" . $mids);
ipsRegistry::DB()->delete('forum_tracker', "member_id" . $mids);
ipsRegistry::DB()->delete('core_item_markers', "item_member_id" . $mids);
//-----------------------------------------
// Delete from validating..
//-----------------------------------------
ipsRegistry::DB()->delete('validating', "member_id" . $mids);
ipsRegistry::DB()->delete('members', "member_id" . $mids);
//-----------------------------------------
// Delete avatars / photos
//-----------------------------------------
if (count($delete_files)) {
foreach ($delete_files as $file) {
@unlink(ipsRegistry::$settings['upload_dir'] . "/" . $file);
}
}
//-----------------------------------------
// Member Sync
//-----------------------------------------
IPSLib::runMemberSync('onDelete', $mids);
/* Remove from cache */
IPSContentCache::drop('sig', $tmp_mids);
//-----------------------------------------
// Get current stats...
//-----------------------------------------
ipsRegistry::cache()->rebuildCache('stats', 'global');
ipsRegistry::cache()->rebuildCache('moderators', 'global');
}
示例2: save_member_name
//.........这里部分代码省略.........
//-----------------------------------------
if ($member['g_access_cp'] and !$this->registry->getClass('class_permissions')->checkPermission('member_edit_admin', 'members', 'members')) {
$this->returnJsonError($this->lang->words['m_editadmin']);
exit;
}
if ($field == 'members_display_name') {
$display_name = $this->convertAndMakeSafe($_POST['display_name'], 1);
$display_name = str_replace("+", "+", $display_name);
} else {
$display_name = $this->convertAndMakeSafe($_POST['name'], 1);
$display_name = str_replace("+", "+", $display_name);
$display_name = str_replace('|', '|', $display_name);
$display_name = trim(preg_replace("/\\s{2,}/", " ", $display_name));
}
if ($this->settings['strip_space_chr']) {
// use hexdec to convert between '0xAD' and chr
$display_name = IPSText::removeControlCharacters($display_name);
}
if ($field == 'members_display_name' and preg_match("#[\\[\\];,\\|]#", str_replace(''', "'", str_replace('&', '&', $members_display_name)))) {
$this->returnJsonError($this->lang->words['m_displaynames']);
}
try {
if (IPSMember::getFunction()->updateName($member_id, $display_name, $field) === TRUE) {
if ($field == 'members_display_name') {
ipsRegistry::getClass('adminFunctions')->saveAdminLog(sprintf($this->lang->words['m_dnamelog'], $member['members_display_name'], $display_name));
} else {
ipsRegistry::getClass('adminFunctions')->saveAdminLog(sprintf($this->lang->words['m_namelog'], $member['name'], $display_name));
//-----------------------------------------
// If updating a name, and display names
// disabled, update display name too
//-----------------------------------------
if (!ipsRegistry::$settings['auth_allow_dnames']) {
IPSMember::getFunction()->updateName($member_id, $display_name, 'members_display_name');
}
//-----------------------------------------
// I say, did we choose to email 'dis member?
//-----------------------------------------
if ($this->request['send_email'] == 1) {
//-----------------------------------------
// By golly, we did!
//-----------------------------------------
$msg = trim(IPSText::stripslashes(nl2br($_POST['email_contents'])));
$msg = str_replace("{old_name}", $member['name'], $msg);
$msg = str_replace("{new_name}", $display_name, $msg);
$msg = str_replace("<#BOARD_NAME#>", $this->settings['board_name'], $msg);
$msg = str_replace("<#BOARD_ADDRESS#>", $this->settings['board_url'] . '/index.' . $this->settings['php_ext'], $msg);
IPSText::getTextClass('email')->message = stripslashes(IPSText::getTextClass('email')->cleanMessage($msg));
IPSText::getTextClass('email')->subject = $this->lang->words['m_changesubj'];
IPSText::getTextClass('email')->to = $member['email'];
IPSText::getTextClass('email')->sendMail();
}
}
$this->cache->rebuildCache('stats', 'global');
} else {
# We should absolutely never get here. So this is a fail-safe, really to
# prevent a "false" positive outcome for the end-user
$this->returnJsonError($this->lang->words['m_namealready']);
}
} catch (Exception $error) {
$this->returnJsonError($error->getMessage());
switch ($error->getMessage()) {
case 'NO_USER':
$this->returnJsonError($this->lang->words['m_noid']);
break;
case 'NO_PERMISSION':
case 'NO_NAME':
$this->returnJsonError(sprintf($this->lang->words['m_morethan3'], $this->settings['max_user_name_length']));
break;
case 'ILLEGAL_CHARS':
$this->returnJsonError($this->lang->words['m_illegal']);
break;
case 'USER_NAME_EXISTS':
$this->returnJsonError($this->lang->words['m_namealready']);
break;
default:
$this->returnJsonError($error->getMessage());
break;
}
}
//-----------------------------------------
// Load handler...
//-----------------------------------------
if ($field == 'name') {
require_once IPS_ROOT_PATH . 'sources/handlers/han_login.php';
$han_login = new han_login($this->registry);
$han_login->init();
$han_login->changeName($member['name'], $display_name, $member['email']);
} else {
IPSLib::runMemberSync('onNameChange', $member_id, $display_name);
}
$__display_name = addslashes($display_name);
$_string = <<<EOF
\t\t{
\t\t\t'success' : true,
\t\t\t'display_name' : "{$__display_name}"
\t\t}
\t\t
EOF;
$this->returnString($_string);
}
示例3: updateName
//.........这里部分代码省略.........
* Error Codes:
* NO_USER Could not load the user
* NO_PERMISSION This user cannot change their display name at all
* NO_MORE_CHANGES The user cannot change their display name again in this time period
* NO_NAME No display name (or shorter than 3 chars was given)
* ILLEGAL_CHARS The display name contains illegal characters
* USER_NAME_EXISTS The username already exists
*/
public function updateName($member_id, $name, $field = 'members_display_name', $discount = FALSE)
{
//-----------------------------------------
// Load the member
//-----------------------------------------
$member = IPSMember::load($member_id);
$_seoName = IPSText::makeSeoTitle($name);
if (!$member['member_id']) {
throw new Exception("NO_USER");
}
//-----------------------------------------
// Make sure name does not exist
//-----------------------------------------
try {
if ($this->checkNameExists($name, $member, $field) === TRUE) {
throw new Exception("USER_NAME_EXISTS");
} else {
if ($field == 'members_display_name') {
$this->DB->setDataType(array('dname_previous', 'dname_current'), 'string');
if ($member['members_display_name'] != $name) {
$this->DB->insert('dnames_change', array('dname_member_id' => $member_id, 'dname_date' => time(), 'dname_ip_address' => $member['ip_address'], 'dname_previous' => $member['members_display_name'], 'dname_current' => $name, 'dname_discount' => $discount ? 1 : 0));
}
//-----------------------------------------
// Still here? Change it then
//-----------------------------------------
IPSMember::save($member['member_id'], array('core' => array('members_display_name' => $name, 'members_l_display_name' => mb_strtolower($name), 'members_seo_name' => $_seoName)));
$this->DB->setDataType(array('last_poster_name', 'seo_last_name'), 'string');
$this->DB->update('forums', array('last_poster_name' => $name, 'seo_last_name' => $_seoName), "last_poster_id=" . $member['member_id']);
$this->DB->setDataType(array('member_name', 'seo_name'), 'string');
$this->DB->update('sessions', array('member_name' => $name, 'seo_name' => $_seoName), "member_id=" . $member['member_id']);
$this->DB->setDataType(array('starter_name', 'seo_first_name'), 'string');
$this->DB->update('topics', array('starter_name' => $name, 'seo_first_name' => $_seoName), "starter_id=" . $member['member_id']);
$this->DB->setDataType(array('last_poster_name', 'seo_last_name'), 'string');
$this->DB->update('topics', array('last_poster_name' => $name, 'seo_last_name' => $_seoName), "last_poster_id=" . $member['member_id']);
$this->DB->update('posts', array('author_name' => $name), "author_id=" . $member['member_id']);
/* Update archived posts */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/writer.php', 'classes_archive_writer');
$archiveWriter = new $classToLoad();
$archiveWriter->setApp('forums');
$archiveWriter->update(array('archive_author_name' => $name), 'archive_author_id=' . $member['member_id']);
} else {
//-----------------------------------------
// If one gets here, one can assume that the new name is correct for one, er...one.
// So, lets do the converteroo
//-----------------------------------------
IPSMember::save($member['member_id'], array('core' => array('name' => $name, 'members_l_username' => mb_strtolower($name))));
$this->DB->setDataType('member_name', 'string');
$this->DB->update('moderators', array('member_name' => $name), "member_id=" . $member['member_id']);
if (!$this->settings['auth_allow_dnames']) {
//-----------------------------------------
// Not using sep. display names?
//-----------------------------------------
IPSMember::save($member['member_id'], array('core' => array('members_display_name' => $name, 'members_l_display_name' => mb_strtolower($name), 'members_seo_name' => $_seoName)));
$this->DB->setDataType(array('last_poster_name', 'seo_last_name'), 'string');
$this->DB->update('forums', array('last_poster_name' => $name, 'seo_last_name' => $_seoName), "last_poster_id=" . $member['member_id']);
$this->DB->setDataType(array('member_name', 'seo_name'), 'string');
$this->DB->update('sessions', array('member_name' => $name, 'seo_name' => $_seoName), "member_id=" . $member['member_id']);
$this->DB->setDataType(array('starter_name', 'seo_first_name'), 'string');
$this->DB->update('topics', array('starter_name' => $name, 'seo_first_name' => $_seoName), "starter_id=" . $member['member_id']);
$this->DB->setDataType(array('last_poster_name', 'seo_last_name'), 'string');
$this->DB->update('topics', array('last_poster_name' => $name, 'seo_last_name' => $_seoName), "last_poster_id=" . $member['member_id']);
$this->DB->update('posts', array('author_name' => $name), "author_id=" . $member['member_id']);
/* Update archived posts */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/writer.php', 'classes_archive_writer');
$archiveWriter = new $classToLoad();
$archiveWriter->setApp('forums');
$archiveWriter->update(array('archive_author_name' => $name), 'archive_author_id=' . $member['member_id']);
}
}
//-----------------------------------------
// Recache moderators
//-----------------------------------------
$this->registry->cache()->rebuildCache('moderators', 'forums');
//-----------------------------------------
// Recache announcements
//-----------------------------------------
$this->registry->cache()->rebuildCache('announcements', 'forums');
//-----------------------------------------
// Stats to Update?
//-----------------------------------------
$this->registry->cache()->rebuildCache('stats', 'core');
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
$han_login = new $classToLoad($this->registry);
$han_login->init();
$han_login->changeName($member[$field], $name, $member['email'], $member, $field);
IPSLib::runMemberSync('onNameChange', $member['member_id'], $name);
return TRUE;
}
} catch (Exception $error) {
throw new Exception($error->getMessage());
}
}
示例4: _completeMerge
//.........这里部分代码省略.........
// Profile friends
//-----------------------------------------
$myFriends = array();
$friendsMy = array();
$this->DB->build(array('select' => 'friends_member_id,friends_friend_id', 'from' => 'profile_friends', 'where' => 'friends_member_id=' . $member['member_id'] . ' OR friends_friend_id=' . $member['member_id']));
$this->DB->execute();
while ($r = $this->DB->fetch()) {
if ($r['friends_member_id'] == $member['member_id']) {
$myFriends[] = $r['friends_friend_id'];
}
if ($r['friends_friend_id'] == $member['member_id']) {
$friendsMy[] = $r['friends_member_id'];
}
}
if (count($myFriends)) {
$this->DB->update('profile_friends', array('friends_member_id' => $member['member_id']), "friends_member_id=" . $member2['member_id'] . " AND friends_friend_id NOT IN(" . implode(',', $myFriends) . ")");
} else {
$this->DB->update('profile_friends', array('friends_member_id' => $member['member_id']), "friends_member_id=" . $member2['member_id']);
}
if (count($friendsMy)) {
$this->DB->update('profile_friends', array('friends_friend_id' => $member['member_id']), "friends_friend_id=" . $member2['member_id'] . " AND friends_member_id NOT IN(" . implode(',', $friendsMy) . ")");
} else {
$this->DB->update('profile_friends', array('friends_friend_id' => $member['member_id']), "friends_friend_id=" . $member2['member_id']);
}
//-----------------------------------------
// Ignored users
//-----------------------------------------
$myIgnored = array();
$ignoredMe = array();
$this->DB->build(array('select' => 'ignore_owner_id,ignore_ignore_id', 'from' => 'ignored_users', 'where' => 'ignore_owner_id=' . $member['member_id'] . ' OR ignore_ignore_id=' . $member['member_id']));
$this->DB->execute();
while ($r = $this->DB->fetch()) {
if ($r['ignore_owner_id'] == $member['member_id']) {
$myIgnored[] = $r['ignore_ignore_id'];
}
if ($r['ignore_ignore_id'] == $member['member_id']) {
$ignoredMe[] = $r['ignore_owner_id'];
}
}
if (count($myIgnored)) {
$this->DB->update('ignored_users', array('ignore_owner_id' => $member['member_id']), "ignore_owner_id=" . $member2['member_id'] . " AND ignore_ignore_id NOT IN(" . implode(',', $myIgnored) . ")");
} else {
$this->DB->update('ignored_users', array('ignore_owner_id' => $member['member_id']), "ignore_owner_id=" . $member2['member_id']);
}
if (count($ignoredMe)) {
$this->DB->update('ignored_users', array('ignore_ignore_id' => $member['member_id']), "ignore_ignore_id=" . $member2['member_id'] . " AND ignore_owner_id NOT IN(" . implode(',', $ignoredMe) . ")");
} else {
$this->DB->update('ignored_users', array('ignore_ignore_id' => $member['member_id']), "ignore_ignore_id=" . $member2['member_id']);
}
//-----------------------------------------
// Message topic mapping
//-----------------------------------------
$pms = array();
$this->DB->build(array('select' => 'map_topic_id', 'from' => 'message_topic_user_map', 'where' => 'map_user_id=' . $member['member_id']));
$this->DB->execute();
while ($r = $this->DB->fetch()) {
$pms[] = $r['map_topic_id'];
}
if (count($pms)) {
$this->DB->update('message_topic_user_map', array('map_user_id' => $member['member_id']), "map_user_id=" . $member2['member_id'] . " AND map_topic_id NOT IN(" . implode(',', $pms) . ")");
} else {
$this->DB->update('message_topic_user_map', array('map_user_id' => $member['member_id']), 'map_user_id=' . $member2['member_id']);
}
//-----------------------------------------
// Admin permissions
//-----------------------------------------
$count = $this->DB->buildAndFetch(array('select' => 'row_id', 'from' => 'admin_permission_rows', 'where' => "row_id_type='member' AND row_id=" . $member['member_id']));
if (!$count['row_id']) {
$this->DB->update('admin_permission_rows', array('row_id' => $member['member_id']), "row_id_type='member' AND row_id=" . $member2['member_id']);
}
//-----------------------------------------
// Member Sync
//-----------------------------------------
try {
IPSMember::save($member['member_id'], array('core' => array('posts' => $member['posts'] + $member2['posts'], 'warn_level' => $member['warn_level'] + $member2['warn_level'], 'warn_lastwarn' => $member2['warn_lastwarn'] > $member['warn_lastwarn'] ? $member2['warn_lastwarn'] : $member['warn_lastwarn'], 'last_post' => $member2['last_post'] > $member['last_post'] ? intval($member2['last_post']) : intval($member['last_post']), 'last_visit' => $member2['last_visit'] > $member['last_visit'] ? $member2['last_visit'] : $member['last_visit']), 'extendedProfile' => array('pp_reputation_points' => $member['pp_reputation_points'] + $member2['pp_reputation_points'])));
} catch (Exception $error) {
$this->registry->output->showError($error->getMessage(), 11247);
}
IPSLib::runMemberSync('onMerge', $member, $member2);
//-----------------------------------------
// Delete member 2
//-----------------------------------------
IPSMember::remove($member2['member_id'], false);
//-----------------------------------------
// Get current stats...
//-----------------------------------------
$this->cache->rebuildCache('stats', 'global');
$this->cache->rebuildCache('moderators', 'forums');
$this->cache->rebuildCache('announcements', 'forums');
//-----------------------------------------
// Admin logs
//-----------------------------------------
$this->registry->adminFunctions->saveAdminLog(sprintf($this->lang->words['merged_accounts_log'], $member2['members_display_name'], $member['members_display_name']));
//-----------------------------------------
// Redirect
//-----------------------------------------
$this->registry->output->global_message = $this->lang->words['merged_members'];
$this->registry->output->silentRedirectWithMessage($this->settings['base_url'] . "module=members&section=members&do=viewmember&member_id=" . $member['member_id']);
}
}
示例5: finishLogin
//.........这里部分代码省略.........
/* A little gymnastics */
$this->_userData = $_userData;
$_userData = $this->fetchUserData($rToken);
/* Got a member linked already? */
$_member = IPSMember::load($_userData['id'], 'all', 'fb_uid');
/* Not connected, check email address */
if (!$_member['member_id'] and $_userData['email']) {
$_member = IPSMember::load($_userData['email'], 'all', 'email');
/* We do have an existing account, so trash email forcing user to sign up with new */
if ($_member['member_id']) {
/* Update row */
IPSMember::save($_member['member_id'], array('core' => array('fb_uid' => $_userData['id'], 'fb_token' => $rToken)));
}
}
if ($_member['member_id']) {
$memberData = $_member;
/* Ensure user's row is up to date */
IPSMember::save($memberData['member_id'], array('core' => array('fb_token' => $rToken)));
/* Here, so log us in!! */
/* changed by denchu 26/12/12 */
$r = $this->_login()->loginWithoutCheckingCredentials($memberData['member_id'], TRUE);
if (is_array($r)) {
if (isset($r[1])) {
$this->registry->getClass('output')->redirectScreen($r[0], $r[1]);
$this->registry->getClass('output')->silentRedirect($r[1]);
} else {
$this->registry->getClass('output')->silentRedirect($r[0]);
}
} elseif (!$r) {
throw new Exception('LINKED_MEMBER_LOGIN_FAIL');
} else {
$this->registry->getClass('output')->silentRedirect($this->settings['base_url']);
}
} else {
/* No? Create a new member */
foreach (array('fbc_s_pic', 'fbc_s_status', 'fbc_s_aboutme') as $field) {
$toSave[$field] = 1;
}
$fb_bwoptions = IPSBWOptions::freeze($toSave, 'facebook');
$safeFBName = IPS_DOC_CHAR_SET != 'UTF-8' ? IPSText::utf8ToEntities($_userData['name']) : $_userData['name'];
/* Make sure usernames are safe */
if ($this->settings['username_characters']) {
$check_against = preg_quote($this->settings['username_characters'], "/");
$check_against = str_replace('\\-', '-', $check_against);
$safeFBName = preg_replace('/[^' . $check_against . ']+/i', '', $safeFBName);
}
/* Check ban filters? */
if (IPSMember::isBanned('email', $_userData['email']) or IPSMember::isBanned('name', $safeFBName)) {
$this->registry->output->showError('you_are_banned', 1090003);
}
$displayName = $this->settings['fb_realname'] == 'enforced' ? $safeFBName : '';
/* From reg, so create new account properly */
$toSave = array('core' => array('name' => IPSText::parseCleanValue($safeFBName), 'members_display_name' => IPSText::parseCleanValue($displayName), 'members_created_remote' => 1, 'member_group_id' => $this->settings['fbc_mgid'] ? $this->settings['fbc_mgid'] : $this->settings['member_group'], 'email' => $_userData['email'], 'fb_uid' => $_userData['id'], 'time_offset' => $_userData['timezone'], 'members_auto_dst' => 1, 'fb_token' => $rToken), 'extendedProfile' => array('pp_about_me' => IPSText::getTextClass('bbcode')->stripBadWords(IPSText::convertCharsets($_userData['about'], 'utf-8', IPS_DOC_CHAR_SET)), 'fb_bwoptions' => $fb_bwoptions));
$memberData = IPSMember::create($toSave, FALSE, FALSE, TRUE);
if (!$memberData['member_id']) {
throw new Exception('CREATION_FAIL');
}
/* Sync up photo */
$this->syncMember($memberData['member_id']);
$pmember = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'members_partial', 'where' => "partial_member_id=" . $memberData['member_id']));
if ($pmember['partial_member_id']) {
$this->registry->getClass('output')->silentRedirect($this->settings['base_url'] . 'app=core&module=global§ion=register&do=complete_login&mid=' . $memberData['member_id'] . '&key=' . $pmember['partial_date']);
} else {
/* Already got a display name */
if ($displayName) {
/* Here, so log us in!! */
$r = $this->_login()->loginWithoutCheckingCredentials($memberData['member_id'], TRUE);
IPSLib::runMemberSync('onCompleteAccount', $memberData);
if ($this->settings['new_reg_notify']) {
$this->registry->class_localization->loadLanguageFile(array('public_register'), 'core');
IPSText::getTextClass('email')->setPlainTextTemplate(IPSText::getTextClass('email')->getTemplate("admin_newuser"));
IPSText::getTextClass('email')->buildMessage(array('DATE' => $this->registry->getClass('class_localization')->getDate(time(), 'LONG', 1), 'LOG_IN_NAME' => $safeFBName, 'EMAIL' => $_userData['email'], 'IP' => $this->member->ip_address, 'DISPLAY_NAME' => $displayName));
IPSText::getTextClass('email')->subject = sprintf($this->lang->words['new_registration_email'], $this->settings['board_name']);
IPSText::getTextClass('email')->to = $this->settings['email_in'];
IPSText::getTextClass('email')->sendMail();
}
if (is_array($r)) {
if (isset($r[1])) {
$this->registry->getClass('output')->redirectScreen($r[0], $r[1]);
$this->registry->getClass('output')->silentRedirect($r[1]);
} else {
$this->registry->getClass('output')->silentRedirect($r[0]);
}
} elseif (!$r) {
throw new Exception('LINKED_MEMBER_LOGIN_FAIL');
} else {
$this->registry->getClass('output')->silentRedirect($this->settings['base_url']);
}
} else {
throw new Exception('CREATION_FAIL');
}
}
}
} else {
throw new Exception('CREATION_FAIL');
}
} else {
/* Need to re-auth */
}
}
示例6: registerProcessForm
//.........这里部分代码省略.........
$this->settings['reg_auth_type'] = '';
break;
/* Deny registration */
/* Deny registration */
case 4:
$this->registry->output->showError('spam_denied_account', '100x001', FALSE, '', 200);
break;
}
}
//-----------------------------------------
// Create the account
//-----------------------------------------
$member = IPSMember::create(array('members' => $member, 'pfields_content' => $custom_fields->out_fields), FALSE, FALSE, FALSE);
//-----------------------------------------
// Login handler create account callback
//-----------------------------------------
$this->han_login->createAccount(array('member_id' => $member['member_id'], 'email' => $member['email'], 'joined' => $member['joined'], 'password' => $in_password, 'ip_address' => $this->member->ip_address, 'username' => $member['members_display_name'], 'name' => $member['name'], 'members_display_name' => $member['members_display_name']));
//-----------------------------------------
// We'll just ignore if this fails - it shouldn't hold up IPB anyways
//-----------------------------------------
/*if ( $han_login->return_code AND ( $han_login->return_code != 'METHOD_NOT_DEFINED' AND $han_login->return_code != 'SUCCESS' ) )
{
$this->registry->output->showError( 'han_login_create_failed', 2017, true );
}*/
//-----------------------------------------
// Validation
//-----------------------------------------
$validate_key = md5(IPSMember::makePassword() . time());
$time = time();
if ($coppa != 1) {
if ($this->settings['reg_auth_type'] == 'user' or $this->settings['reg_auth_type'] == 'admin' or $this->settings['reg_auth_type'] == 'admin_user') {
//-----------------------------------------
// We want to validate all reg's via email,
// after email verificiation has taken place,
// we restore their previous group and remove the validate_key
//-----------------------------------------
$this->DB->insert('validating', array('vid' => $validate_key, 'member_id' => $member['member_id'], 'real_group' => $this->settings['member_group'], 'temp_group' => $this->settings['auth_group'], 'entry_date' => $time, 'coppa_user' => $coppa, 'new_reg' => 1, 'ip_address' => $member['ip_address'], 'spam_flag' => $_spamFlag));
if ($this->settings['reg_auth_type'] == 'user' or $this->settings['reg_auth_type'] == 'admin_user') {
/* Send out the email. */
$message = array('THE_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global§ion=register&do=auto_validate&uid=" . urlencode($member['member_id']) . "&aid=" . urlencode($validate_key), 'publicNoSession', 'false'), 'NAME' => $member['members_display_name'], 'MAN_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global§ion=register&do=05", 'publicNoSession', 'false'), 'EMAIL' => $member['email'], 'ID' => $member['member_id'], 'CODE' => $validate_key);
IPSText::getTextClass('email')->setPlainTextTemplate(IPSText::getTextClass('email')->getTemplate("reg_validate", $this->member->language_id));
IPSText::getTextClass('email')->buildPlainTextContent($message);
IPSText::getTextClass('email')->buildHtmlContent($message);
IPSText::getTextClass('email')->subject = sprintf($this->lang->words['new_registration_email'], $this->settings['board_name']);
IPSText::getTextClass('email')->to = $member['email'];
IPSText::getTextClass('email')->sendMail();
$this->output = $this->registry->output->getTemplate('register')->showAuthorize($member);
} else {
if ($this->settings['reg_auth_type'] == 'admin') {
$this->output = $this->registry->output->getTemplate('register')->showPreview($member);
}
}
/* Only send new registration email if the member wasn't banned */
if ($this->settings['new_reg_notify'] and !$member['member_banned']) {
$date = $this->registry->class_localization->getDate(time(), 'LONG', 1);
IPSText::getTextClass('email')->getTemplate('admin_newuser');
IPSText::getTextClass('email')->buildMessage(array('DATE' => $date, 'LOG_IN_NAME' => $member['name'], 'EMAIL' => $member['email'], 'IP' => $member['ip_address'], 'DISPLAY_NAME' => $member['members_display_name']));
IPSText::getTextClass('email')->subject = sprintf($this->lang->words['new_registration_email1'], $this->settings['board_name']);
IPSText::getTextClass('email')->to = $this->settings['email_in'];
IPSText::getTextClass('email')->sendMail();
}
$this->registry->output->setTitle($this->lang->words['reg_success'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->output->addNavigation($this->lang->words['nav_reg'], '');
} else {
/* We don't want to preview, or get them to validate via email. */
$stat_cache = $this->cache->getCache('stats');
if ($member['members_display_name'] and $member['member_id'] and !$this->caches['group_cache'][$member['member_group_id']]['g_hide_online_list']) {
$stat_cache['last_mem_name'] = $member['members_display_name'];
$stat_cache['last_mem_name_seo'] = IPSText::makeSeoTitle($member['members_display_name']);
$stat_cache['last_mem_id'] = $member['member_id'];
}
$stat_cache['mem_count'] += 1;
$this->cache->setCache('stats', $stat_cache, array('array' => 1));
/* Only send new registration email if the member wasn't banned */
if ($this->settings['new_reg_notify'] and !$member['member_banned']) {
$date = $this->registry->class_localization->getDate(time(), 'LONG', 1);
IPSText::getTextClass('email')->getTemplate('admin_newuser');
IPSText::getTextClass('email')->buildMessage(array('DATE' => $date, 'LOG_IN_NAME' => $member['name'], 'EMAIL' => $member['email'], 'IP' => $member['ip_address'], 'DISPLAY_NAME' => $member['members_display_name']));
IPSText::getTextClass('email')->subject = sprintf($this->lang->words['new_registration_email1'], $this->settings['board_name']);
IPSText::getTextClass('email')->to = $this->settings['email_in'];
IPSText::getTextClass('email')->sendMail();
}
IPSCookie::set('pass_hash', $member['member_login_key'], 1);
IPSCookie::set('member_id', $member['member_id'], 1);
//-----------------------------------------
// Fix up session
//-----------------------------------------
$privacy = $member['g_hide_online_list'] || empty($this->settings['disable_anonymous']) && !empty($this->request['Privacy']) ? 1 : 0;
# Update value for onCompleteAccount call
$member['login_anonymous'] = $privacy . '&1';
$this->member->sessionClass()->convertGuestToMember(array('member_name' => $member['members_display_name'], 'member_id' => $member['member_id'], 'member_group' => $member['member_group_id'], 'login_type' => $privacy));
IPSLib::runMemberSync('onCompleteAccount', $member);
$this->registry->output->silentRedirect($this->settings['base_url'] . '&app=core&module=global§ion=login&do=autologin&fromreg=1');
}
} else {
/* This is a COPPA user, so lets tell them they registered OK and redirect to the form. */
$this->DB->insert('validating', array('vid' => $validate_key, 'member_id' => $member['member_id'], 'real_group' => $this->settings['member_group'], 'temp_group' => $this->settings['auth_group'], 'entry_date' => $time, 'coppa_user' => $coppa, 'new_reg' => 1, 'ip_address' => $member['ip_address']));
$this->registry->output->redirectScreen($this->lang->words['cp_success'], $this->settings['base_url'] . 'app=core&module=global&section=register&do=12');
}
}
示例7: doLogout
/**
* Log a user out
*
* @param integer Flag to check md5 key
* @return mixed Error message or array [0=immediate|redirect, 1=words to show, 2=URL to send to]
*/
public function doLogout($check_key = true)
{
//-----------------------------------------
// INIT
//-----------------------------------------
if ($check_key) {
$key = $this->request['k'];
# Check for funny business
if ($key != $this->member->form_hash) {
$this->registry->getClass('output')->showError('bad_logout_key', 2012);
}
}
//-----------------------------------------
// Set some cookies
//-----------------------------------------
IPSCookie::set("member_id", "0", 1, 0, FALSE, TRUE);
IPSCookie::set("pass_hash", "0", 1, 0, FALSE, TRUE);
if (IPSCookie::get("ipsconnect_" . md5($this->settings['board_url'] . '/interface/ipsconnect/ipsconnect.php'))) {
IPSCookie::set("ipsconnect_" . md5($this->settings['board_url'] . '/interface/ipsconnect/ipsconnect.php'), '0', 1, 0, FALSE, FALSE);
}
//-----------------------------------------
// IPS Connect
//-----------------------------------------
foreach ($this->caches['login_methods'] as $k => $data) {
if ($data['login_folder_name'] == 'ipsconnect' and $data['login_enabled']) {
$ipsConnectSettings = unserialize($data['login_custom_config']);
IPSCookie::set("ipsconnect_" . md5($ipsConnectSettings['master_url']), '0', 1, 0, FALSE, FALSE);
}
}
if (is_array($_COOKIE)) {
foreach ($_COOKIE as $cookie => $value) {
if (stripos($cookie, $this->settings['cookie_id'] . 'ipbforumpass') !== false and !strstr($value, 'mobileApp')) {
IPSCookie::set(str_replace($this->settings['cookie_id'], "", $cookie), '-', -1);
}
}
}
//-----------------------------------------
// Do it..
//-----------------------------------------
$this->member->sessionClass()->convertMemberToGuest();
$privacy = intval(IPSMember::isLoggedInAnon($this->memberData));
IPSMember::save($this->memberData['member_id'], array('core' => array('login_anonymous' => "{$privacy}&0", 'last_activity' => IPS_UNIX_TIME_NOW)));
//-----------------------------------------
// Logout callbacks...
//-----------------------------------------
IPSLib::runMemberSync('onLogOut', $this->memberData);
$this->han_login->logoutCallback($this->memberData);
//-----------------------------------------
// Return..
//-----------------------------------------
$url = "";
if ($this->request['return'] and $this->request['return'] != "") {
$return = urldecode($this->request['return']);
if (strpos($return, "http://") === 0) {
return array('immediate', '', $return);
}
}
return array('redirect', $this->lang->words['thanks_for_logout'], $this->settings['board_url']);
}
示例8: _saveForm
/**
* Save new email and/or pass
*
* @return @e void
*/
protected function _saveForm()
{
if (!$this->request['email'] and !$this->request['password']) {
$this->registry->output->global_error = $this->lang->words['change_nothing_update'];
$this->_showForm();
return;
}
if ($this->request['email']) {
if (!$this->request['email_confirm']) {
$this->registry->output->global_error = $this->lang->words['change_both_fields'];
$this->_showForm();
return;
} else {
if ($this->request['email'] != $this->request['email_confirm']) {
$this->registry->output->global_error = $this->lang->words['change_not_match'];
$this->_showForm();
return;
}
}
$email = trim($this->request['email']);
if (!IPSText::checkEmailAddress($email)) {
$this->registry->output->global_error = $this->lang->words['bad_email_supplied'];
$this->_showForm();
return;
}
$email_check = IPSMember::load(strtolower($email));
if ($email_check['member_id']) {
if ($email_check['member_id'] == $this->memberData['member_id']) {
$this->registry->output->global_error = $this->lang->words['already_using_email'];
} else {
$this->registry->output->global_error = $this->lang->words['change_email_already_used'];
}
$this->_showForm();
return;
}
//-----------------------------------------
// Load handler...
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
$han_login = new $classToLoad($this->registry);
$han_login->init();
$han_login->changeEmail(trim(strtolower($this->memberData['email'])), trim(strtolower($email)), $this->memberData);
IPSLib::runMemberSync('onEmailChange', $this->memberData['member_id'], strtolower($email), $this->memberData['email']);
IPSMember::save($this->memberData['member_id'], array('core' => array('email' => strtolower($email))));
ipsRegistry::getClass('adminFunctions')->saveAdminLog(sprintf($this->lang->words['changed_email'], $email));
}
if ($this->request['password']) {
if (!$this->request['password_confirm']) {
$this->registry->output->global_error = $this->lang->words['change_both_fields'];
$this->_showForm();
return;
} else {
if ($this->request['password'] != $this->request['password_confirm']) {
$this->registry->output->global_error = $this->lang->words['change_not_match_pw'];
$this->_showForm();
return;
}
}
$password = $this->request['password'];
$salt = str_replace('\\', "\\\\", IPSMember::generatePasswordSalt(5));
$key = IPSMember::generateAutoLoginKey();
$md5_once = md5(trim($password));
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
$han_login = new $classToLoad($this->registry);
$han_login->init();
$han_login->changePass($this->memberData['email'], $md5_once, $password, $this->memberData);
IPSMember::save($this->memberData['member_id'], array('core' => array('members_pass_salt' => $salt, 'member_login_key' => $key)));
IPSMember::updatePassword($this->memberData['member_id'], $md5_once);
IPSLib::runMemberSync('onPassChange', $this->memberData['member_id'], $password);
ipsRegistry::getClass('adminFunctions')->saveAdminLog($this->lang->words['changed_password']);
}
$this->registry->output->global_message = $this->lang->words['details_updated'];
$this->registry->output->silentRedirectWithMessage($this->settings['base_url']);
}
示例9: autoLogin
/**
* Attempt to automatically log a user in
*
* @access public
* @return array [0=Words to display,1=URL to send to]
*/
public function autoLogin()
{
/* Verify the login */
$this->han_login->verifyLogin();
/* Lang Bits */
$true_words = $this->lang->words['logged_in'];
$false_words = $this->lang->words['not_logged_in'];
$method = 'no_show';
/* Register Redirect */
if ($this->request['fromreg'] == 1) {
$true_words = $this->lang->words['reg_log_in'];
$false_words = $this->lang->words['reg_not_log_in'];
$method = 'show';
} else {
if ($this->request['fromemail'] == 1) {
$true_words = $this->lang->words['email_log_in'];
$false_words = $this->lang->words['email_not_log_in'];
$method = 'show';
} else {
if ($this->request['frompass'] == 1) {
$true_words = $this->lang->words['pass_log_in'];
$false_words = $this->lang->words['pass_not_log_in'];
$method = 'show';
}
}
}
if ($this->memberData['member_id']) {
/* Member Sync */
IPSLib::runMemberSync('onLogin', $this->memberData);
if (!$this->request['fromreg']) {
IPSCookie::set('session_id', '0', -1);
}
if ($method == 'show') {
$this->registry->getClass('output')->redirectScreen($true_words, $this->settings['base_url']);
} else {
$this->registry->getClass('output')->silentRedirect($this->settings['board_url'] . '/index.php');
}
} else {
if ($method == 'show') {
$this->registry->getClass('output')->redirectScreen($false_words, $this->settings['base_url'] . 'app=core&module=global§ion=login');
} else {
$this->registry->getClass('output')->silentRedirect($this->settings['base_url'] . 'app=core&module=global§ion=login');
}
}
}
示例10: flagMemberAsSpammer
/**
* Flag an account as spammer
*
* @param int|array $member Member Data
* @param array $marker The person marking this person a spammer
* @param bool $resetLastMember If FALSE skips resetting the last registered member
* @return void
*/
public static function flagMemberAsSpammer($member, $marker = NULL, $resetLastMember = TRUE)
{
//-----------------------------------------
// Init
//-----------------------------------------
/* Load Member */
if (!is_array($member)) {
$member = self::load($member);
}
/* Load moderator library (we'll need this to unapprove posts and log) */
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums');
$modLibrary = new $classToLoad(ipsRegistry::instance());
//-----------------------------------------
// Do it
//-----------------------------------------
$toSave = array();
$toSave['core']['bw_is_spammer'] = TRUE;
/* Shut off twitter/FB status importing */
$bwOptions = IPSBWOptions::thaw($member['tc_bwoptions'], 'twitter');
$bwOptions['tc_si_status'] = 0;
$twitter = IPSBWOptions::freeze($bwOptions, 'twitter');
$bwOptions = IPSBWOptions::thaw($member['fb_bwoptions'], 'facebook');
$bwOptions['fbc_si_status'] = 0;
$facebook = IPSBWOptions::freeze($bwOptions, 'facebook');
$toSave['extendedProfile']['tc_bwoptions'] = $twitter;
$toSave['extendedProfile']['fb_bwoptions'] = $facebook;
/* Do any disabling, unapproving, banning - no breaks here since if we ban, we also want to unapprove posts, etc. */
/* Note that there are DELIBERATELY no breaks in this switch since the options are cascading (if you ban, you also want to unapprove content) */
switch (ipsRegistry::$settings['spm_option']) {
/* Empty profile and ban account */
case 'ban':
// ban
$toSave['core']['member_banned'] = TRUE;
// wipe data
$toSave['core']['title'] = '';
$toSave['extendedProfile']['signature'] = '';
$toSave['extendedProfile']['pp_about_me'] = '';
// wipe photo
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/member/photo.php', 'classes_member_photo');
$photos = new $classToLoad(ipsRegistry::instance());
$photos->remove($member['member_id']);
// wipe custom fields
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
$fields = new $classToLoad();
$fields->member_data = $member;
$fields->initData('edit');
$fields->parseToSave(array());
if (count($fields->out_fields)) {
$toSave['customFields'] = $fields->out_fields;
}
// wipe signature
IPSContentCache::update($member['member_id'], 'sig', '');
/* Unapprove posts */
/* Unapprove posts */
case 'unapprove':
$modLibrary->deleteMemberContent($member['member_id'], 'all', intval(ipsRegistry::$settings['spm_post_days']) * 24);
/* Disable Post/PM permission */
/* Disable Post/PM permission */
case 'disable':
$toSave['core']['restrict_post'] = 1;
$toSave['core']['members_disable_pm'] = 2;
}
self::save($member['member_id'], $toSave);
//-----------------------------------------
// Run memberSync
//-----------------------------------------
IPSLib::runMemberSync('onSetAsSpammer', array_merge($member, $toSave));
//-----------------------------------------
// Let the admin know if necessary
//-----------------------------------------
if ($marker !== NULL and ipsRegistry::$settings['spm_notify'] and ipsRegistry::$settings['email_in'] != $marker['email']) {
ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_mod'), 'forums');
ipsRegistry::getClass('class_localization')->loadLanguageFile(array('admin_member'), 'members');
IPSText::getTextClass('email')->getTemplate('possibleSpammer');
IPSText::getTextClass('email')->buildMessage(array('DATE' => ipsRegistry::getClass('class_localization')->getDate($member['joined'], 'LONG', 1), 'MEMBER_NAME' => $member['members_display_name'], 'IP' => $member['ip_address'], 'EMAIL' => $member['email'], 'LINK' => ipsRegistry::getClass('output')->buildSEOUrl("showuser=" . $member['member_id'], 'public', $member['members_seo_name'], 'showuser')));
IPSText::getTextClass('email')->subject = sprintf(ipsRegistry::getClass('class_localization')->words['new_registration_email_spammer'], ipsRegistry::$settings['board_name']);
IPSText::getTextClass('email')->to = ipsRegistry::$settings['email_in'];
IPSText::getTextClass('email')->sendMail();
}
/* Reset last member? */
if ($resetLastMember) {
self::resetLastRegisteredMember();
}
//-----------------------------------------
// Let IPS know
//-----------------------------------------
if (ipsRegistry::$settings['spam_service_send_to_ips']) {
self::querySpamService($member['email'], $member['ip_address'], 'markspam');
}
//-----------------------------------------
// Log
//-----------------------------------------
//.........这里部分代码省略.........
示例11: approveMembers
/**
* Approve member(s)
*
* @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 approveMembers($ids)
{
$approved = array();
//-----------------------------------------
// Get members
//-----------------------------------------
$this->DB->build(array('select' => 'v.*', 'from' => array('validating' => 'v'), 'where' => "m.member_id IN(" . implode(",", $ids) . ")", 'add_join' => array(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => 'm.member_id=v.member_id', 'type' => 'left'))));
$main = $this->DB->execute();
while ($row = $this->DB->fetch($main)) {
$approved[] = $row['name'];
//-----------------------------------------
// Only approve if the user is validating
//-----------------------------------------
if ($row['member_group_id'] != $this->settings['auth_group']) {
$row['real_group'] = $row['member_group_id'];
// Let's still "validate", but leave them in the group they're in
//continue;
}
//-----------------------------------------
// Don't approve if no real_group set
//-----------------------------------------
if (!$row['real_group']) {
//$row['real_group'] = $this->settings['member_group'];
continue;
}
//-----------------------------------------
// We don't approve lost pass requests
//-----------------------------------------
if ($row['lost_pass'] == 1) {
continue;
}
if ($row['real_group'] != $row['member_group_id']) {
IPSMember::save($row['member_id'], array('core' => array('member_group_id' => $row['real_group'])));
}
IPSText::getTextClass('email')->buildMessage(array());
//-----------------------------------------
// Using 'name' on purpose
// @link http://forums.invisionpower.com/index.php?autocom=tracker&showissue=11564&view=findpost&p=45269
//-----------------------------------------
IPSText::getTextClass('email')->getTemplate('complete_reg', $row['language']);
IPSText::getTextClass('email')->buildMessage(array('NAME' => $row['name']));
IPSText::getTextClass('email')->subject = sprintf($this->lang->words['subject__complete_reg'], $row['name'], $this->settings['board_name']);
IPSText::getTextClass('email')->to = $row['email'];
IPSText::getTextClass('email')->sendMail();
IPSLib::runMemberSync('onCompleteAccount', $row);
IPSLib::runMemberSync('onGroupChange', $row['member_id'], $row['real_group'], $row['member_group_id']);
}
$this->DB->delete('validating', "member_id IN(" . implode(",", $ids) . ")");
//-----------------------------------------
// Stats to Update?
//-----------------------------------------
$this->cache->rebuildCache('stats', 'global');
$message = sprintf($this->lang->words['t_memregapp2'], count($ids), implode(", ", $approved));
ipsRegistry::getClass('adminFunctions')->saveAdminLog($message);
return $message;
}
示例12: _emailUnapprove
/**
* Unapprove email change request
*
* @access private
* @return void [Outputs to screen]
*/
private function _emailUnapprove()
{
//-----------------------------------------
// GET member
//-----------------------------------------
if (!$this->request['mid']) {
$this->registry->output->showError($this->lang->words['t_noemailloc'], 11249);
}
$member = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'validating', 'where' => 'email_chg=1 AND member_id=' . intval($this->request['mid'])));
if (!$member['vid']) {
$this->registry->output->showError($this->lang->words['t_noemailloc'], 11250);
}
$this->DB->delete("validating", "vid='{$member['vid']}'");
try {
IPSMember::save($member['member_id'], array('core' => array('email' => $member['prev_email'], 'member_group_id' => $member['real_group'])));
} catch (Exception $error) {
$this->registry->output->showError($error->getMessage(), 11247);
}
IPSLib::runMemberSync('onGroupChange', $member['member_id'], $member['real_group']);
ipsRegistry::getClass('adminFunctions')->saveAdminLog(sprintf($this->lang->words['t_emailchangeun'], $member['member_id']));
$this->registry->output->global_message = sprintf($this->lang->words['t_emailchangeun'], $member['member_id']);
$this->_viewQueue('validating');
}
示例13: verifyLogin
//.........这里部分代码省略.........
} else {
if ($this->return_code == 'WRONG_OPENID') {
return array(null, null, 'wrong_openid');
} else {
if ($this->return_code == 'FLAGGED_REMOTE') {
return array(null, null, 'flagged_remote');
} else {
return array(null, null, 'wrong_auth');
}
}
}
}
//-----------------------------------------
// Is this a partial member?
// Not completed their sign in?
//-----------------------------------------
if ($member['members_created_remote'] and isset($member['full']) and !$member['full']) {
return array($this->lang->words['partial_login'], $this->settings['base_url'] . 'app=core&module=global&section=register&do=complete_login&mid=' . $member['member_id'] . '&key=' . $member['timenow']);
}
//-----------------------------------------
// Generate a new log in key
//-----------------------------------------
$_ok = 1;
$_time = $this->settings['login_key_expire'] ? time() + intval($this->settings['login_key_expire']) * 86400 : 0;
$_sticky = $_time ? 0 : 1;
$_days = $_time ? $this->settings['login_key_expire'] : 365;
if ($this->settings['login_change_key'] or !$member['member_login_key'] or $this->settings['login_key_expire'] and time() > $member['member_login_key_expire']) {
$member['member_login_key'] = IPSMember::generateAutoLoginKey();
$core['member_login_key'] = $member['member_login_key'];
$core['member_login_key_expire'] = $_time;
}
//-----------------------------------------
// Cookie me softly?
//-----------------------------------------
if ($this->request['rememberMe']) {
IPSCookie::set("member_id", $member['member_id'], 1);
IPSCookie::set("pass_hash", $member['member_login_key'], $_sticky, $_days);
} else {
IPSCookie::set("member_id", $member['member_id'], 0);
IPSCookie::set("pass_hash", $member['member_login_key'], 0);
}
//-----------------------------------------
// Remove any COPPA cookies previously set
//-----------------------------------------
IPSCookie::set("coppa", '0', 0);
//-----------------------------------------
// Update profile if IP addr missing
//-----------------------------------------
if ($member['ip_address'] == "" or $member['ip_address'] == '127.0.0.1') {
$core['ip_address'] = $this->member->ip_address;
}
//-----------------------------------------
// Create / Update session
//-----------------------------------------
$privacy = $this->request['anonymous'] ? 1 : 0;
if ($member['g_hide_online_list']) {
$privacy = 1;
}
$session_id = $this->member->sessionClass()->convertGuestToMember(array('member_name' => $member['members_display_name'], 'member_id' => $member['member_id'], 'member_group' => $member['member_group_id'], 'login_type' => $privacy));
if ($this->request['referer'] and $this->request['referer'] and $this->request['section'] != 'register') {
if (stripos($this->request['referer'], 'section=register') or stripos($this->request['referer'], 'section=login') or stripos($this->request['referer'], 'section=lostpass') or stripos($this->request['referer'], CP_DIRECTORY . '/')) {
$url = $this->settings['base_url'] . '?';
} else {
$url = str_replace('&', '&', $this->request['referer']);
$url = preg_replace("#s=(\\w){32}#", "", $url);
if ($this->member->session_type != 'cookie') {
$url = $this->settings['board_url'] . '/index.php?s=' . $session_id;
}
}
} else {
$url = $this->settings['base_url'] . '?';
}
//-----------------------------------------
// Set our privacy status
//-----------------------------------------
$core['login_anonymous'] = intval($privacy) . '&1';
$core['failed_logins'] = '';
$core['failed_login_count'] = 0;
IPSMember::save($member['member_id'], array('core' => $core));
//-----------------------------------------
// Clear out any passy change stuff
//-----------------------------------------
$this->DB->delete('validating', 'member_id=' . $this->memberData['member_id'] . ' AND lost_pass=1');
//-----------------------------------------
// Redirect them to either the board
// index, or where they came from
//-----------------------------------------
if ($this->request['return']) {
$return = urldecode($this->request['return']);
if (strpos($return, "http://") === 0) {
return array($this->lang->words['partial_login'], $return);
}
}
//-----------------------------------------
// Still here?
//-----------------------------------------
/* Member Sync */
IPSLib::runMemberSync('onLogin', $member);
return array($this->lang->words['partial_login'], $url);
}
示例14: finishLogin
/**
* Completes the connection
*
* @access public
* @return redirect
*
*/
public function finishLogin()
{
/* From reg flag */
if ($_REQUEST['code']) {
/* Reset api to ensure user is not logged in */
$this->resetApi();
/* Ensure URL is correct */
$_urlExtra = '';
if ($_REQUEST['key']) {
$_urlExtra .= '&key=' . $_REQUEST['key'];
}
if ($_REQUEST['reg']) {
$_urlExtra .= '®=1';
}
/* Update callback url */
$this->_api->setVariable('authorize_callback_uri', VKONTAKTE_CALLBACK . $_urlExtra);
/* Generate oAuth token */
$rToken = $this->_api->getAccessToken();
if (is_string($rToken)) {
try {
$oAuthSession = $this->_api->getSession();
$r = $this->_api->api('getProfiles', 'GET', array('uids' => $oAuthSession['user_id'], 'fields' => 'uid,first_name,last_name,nickname,photo,photo_medium,photo_big,timezone,sex,nickname,activity'));
$_userData = array_pop($r['response']);
} catch (Exception $e) {
}
/* A little gymnastics */
$this->_userData = $_userData;
$this->_userData['photo'] = $_userData['photo_big'];
/* Got a member linked already? */
$_member = IPSMember::load($_userData['uid'], 'all', 'vk_uid');
if ($_member['member_id']) {
$memberData = $_member;
/* Ensure user's row is up to date */
IPSMember::save($memberData['member_id'], array('core' => array('vk_token' => $rToken)));
/* Here, so log us in!! */
/* changed by denchu 26/12/12 */
$r = $this->_login()->loginWithoutCheckingCredentials($memberData['member_id'], TRUE);
if (is_array($r)) {
if (isset($r[1])) {
$this->registry->getClass('output')->redirectScreen($r[0], $r[1]);
$this->registry->getClass('output')->silentRedirect($r[1]);
} else {
$this->registry->getClass('output')->silentRedirect($r[0]);
}
} elseif (!$r) {
throw new Exception('LINKED_MEMBER_LOGIN_FAIL');
} else {
$this->registry->getClass('output')->silentRedirect($this->settings['base_url']);
}
} else {
/* No? Create a new member */
foreach (array('vc_s_pic', 'vc_s_status') as $field) {
$toSave[$field] = 1;
}
$vk_bwoptions = IPSBWOptions::freeze($toSave, 'vkontakte');
$safeName = IPSText::convertCharsets($_userData['first_name'] . ' ' . $_userData['last_name'], 'utf-8', IPS_DOC_CHAR_SET);
$displayName = $this->settings['fb_realname'] == 'enforced' ? $safeName : '';
//$displayName = ( ! $this->settings['auth_allow_dnames'] ) ? $safeName : FALSE;
/* Make sure usernames are safe */
if ($this->settings['username_characters']) {
$check_against = preg_quote($this->settings['username_characters'], "/");
$check_against = str_replace('\\-', '-', $check_against);
$safeName = preg_replace('/[^' . $check_against . ']+/i', '', $safeName);
}
if (IPSText::mbstrlen($safeName) > $this->settings['max_user_name_length']) {
$safeName = mb_substr(IPSText::convertCharsets($_userData['last_name'], 'utf-8', IPS_DOC_CHAR_SET), 0, $this->settings['max_user_name_length'], 'UTF-8');
}
/* Check ban filters? */
if (IPSMember::isBanned('name', $safeName)) {
$this->registry->output->showError('you_are_banned', 1090003);
}
/* From reg, so create new account properly */
$toSave = array('core' => array('name' => $safeName, 'members_display_name' => $displayName, 'members_created_remote' => 1, 'member_group_id' => $this->settings['vk_mgid'] ? $this->settings['vk_mgid'] : $this->settings['member_group'], 'email' => '', 'vk_uid' => $_userData['uid'], 'time_offset' => $_userData['timezone'], 'vk_token' => $rToken), 'extendedProfile' => array('vk_bwoptions' => $vk_bwoptions));
$memberData = IPSMember::create($toSave, TRUE, FALSE, TRUE);
if (!$memberData['member_id']) {
throw new Exception('CREATION_FAIL');
}
/* Sync up photo */
$this->syncMember($memberData['member_id']);
$pmember = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'members_partial', 'where' => "partial_member_id=" . $memberData['member_id']));
if ($pmember['partial_member_id']) {
$this->registry->getClass('output')->silentRedirect($this->settings['base_url'] . 'app=core&module=global§ion=register&do=complete_login&mid=' . $memberData['member_id'] . '&key=' . $pmember['partial_date']);
} else {
/* Already got a display name */
if ($displayName) {
/* Here, so log us in!! */
/* changed by denchu 26/12/12*/
$r = $this->_login()->loginWithoutCheckingCredentials($memberData['member_id'], TRUE);
IPSLib::runMemberSync('onCompleteAccount', $memberData);
if ($this->settings['new_reg_notify']) {
$this->registry->class_localization->loadLanguageFile(array('public_register'), 'core');
IPSText::getTextClass('email')->setPlainTextTemplate(IPSText::getTextClass('email')->getTemplate("admin_newuser"));
IPSText::getTextClass('email')->buildMessage(array('DATE' => $this->registry->getClass('class_localization')->getDate(time(), 'LONG', 1), 'LOG_IN_NAME' => $safeFBName, 'EMAIL' => $_userData['email'], 'IP' => $this->member->ip_address, 'DISPLAY_NAME' => $displayName));
//.........这里部分代码省略.........
示例15: lostPasswordValidate
/**
* Validates a lost password request
*
* @return @e void
*/
public function lostPasswordValidate()
{
/* Check for input and it's in a valid format. */
$in_user_id = intval(trim(urldecode($this->request['uid'])));
$in_validate_key = IPSText::md5Clean(trim(urldecode($this->request['aid'])));
/* Check Input */
if (!$in_validate_key) {
$this->registry->output->showError('validation_key_incorrect', 1015);
}
if (!preg_match('/^(?:\\d){1,}$/', $in_user_id)) {
$this->registry->output->showError('uid_key_incorrect', 1016);
}
/* Attempt to get the profile of the requesting user */
$member = IPSMember::load($in_user_id);
if (!$member['member_id']) {
$this->registry->output->showError('lostpass_no_member', 1017);
}
/* Get validating info.. */
$validate = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'validating', 'where' => 'member_id=' . $in_user_id . ' and lost_pass=1'));
if (!$validate['member_id']) {
$this->registry->output->showError('lostpass_not_validating', 1018);
}
if ($validate['new_reg'] == 1 && $this->settings['reg_auth_type'] == "admin") {
$this->registry->output->showError('lostpass_new_reg', 4010, true);
}
if ($validate['vid'] != $in_validate_key) {
$this->registry->output->showError('lostpass_key_wrong', 1019);
} else {
/* On the same page? */
if ($validate['lost_pass'] != 1) {
$this->registry->output->showError('lostpass_not_lostpass', 4011, true);
}
/* Send a new random password? */
if ($this->settings['lp_method'] == 'random') {
//-----------------------------------------
// INIT
//-----------------------------------------
$save_array = array();
//-----------------------------------------
// Generate a new random password
//-----------------------------------------
$new_pass = IPSMember::makePassword();
//-----------------------------------------
// Generate a new salt
//-----------------------------------------
$salt = IPSMember::generatePasswordSalt(5);
$salt = str_replace('\\', "\\\\", $salt);
//-----------------------------------------
// New log in key
//-----------------------------------------
$key = IPSMember::generateAutoLoginKey();
//-----------------------------------------
// Update...
//-----------------------------------------
$save_array['members_pass_salt'] = $salt;
$save_array['members_pass_hash'] = md5(md5($salt) . md5($new_pass));
$save_array['member_login_key'] = $key;
$save_array['member_login_key_expire'] = $this->settings['login_key_expire'] * 60 * 60 * 24;
$save_array['failed_logins'] = null;
$save_array['failed_login_count'] = 0;
//-----------------------------------------
// Load handler...
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
$this->han_login = new $classToLoad($this->registry);
$this->han_login->init();
$this->han_login->changePass($member['email'], md5($new_pass), $new_pass, $member);
//if ( $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'SUCCESS' )
//{
// $this->registry->output->showError( $this->lang->words['lostpass_external_fail'], 2013 );
//}
IPSMember::save($member['member_id'], array('members' => $save_array));
/* Password has been changed! */
IPSLib::runMemberSync('onPassChange', $member['member_id'], $new_pass);
//-----------------------------------------
// Send out the email...
//-----------------------------------------
$message = array('NAME' => $member['members_display_name'], 'THE_LINK' => $this->registry->getClass('output')->buildUrl('app=core&module=usercp&tab=core&area=email', 'publicNoSession'), 'PASSWORD' => $new_pass, 'LOGIN' => $this->registry->getClass('output')->buildUrl('app=core&module=global§ion=login', 'publicNoSession'), 'USERNAME' => $member['name'], 'EMAIL' => $member['email'], 'ID' => $member['member_id']);
IPSText::getTextClass('email')->setPlainTextTemplate(IPSText::getTextClass('email')->getTemplate("lost_pass_email_pass", $member['language']));
IPSText::getTextClass('email')->buildPlainTextContent($message);
IPSText::getTextClass('email')->buildHtmlContent($message);
IPSText::getTextClass('email')->subject = $this->lang->words['lp_random_pass_subject'] . ' ' . $this->settings['board_name'];
IPSText::getTextClass('email')->to = $member['email'];
IPSText::getTextClass('email')->sendMail();
$this->registry->output->setTitle($this->lang->words['activation_form'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->output = $this->registry->getClass('output')->getTemplate('register')->showLostPassWaitRandom($member);
} else {
if ($_POST['pass1'] == "") {
$this->registry->output->showError('pass_blank', 10184);
}
if ($_POST['pass2'] == "") {
$this->registry->output->showError('pass_blank', 10185);
}
$pass_a = trim($this->request['pass1']);
$pass_b = trim($this->request['pass2']);
//.........这里部分代码省略.........