當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IPSMember::getFunction方法代碼示例

本文整理匯總了PHP中IPSMember::getFunction方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSMember::getFunction方法的具體用法?PHP IPSMember::getFunction怎麽用?PHP IPSMember::getFunction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在IPSMember的用法示例。


在下文中一共展示了IPSMember::getFunction方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: displayNameCheck

 /**
  * Checks a display name
  *
  * @return	@e void		[Outputs JSON to browser AJAX call]
  */
 protected function displayNameCheck()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $name = strtolower($this->convertAndMakeSafe($this->request['name'], 0));
     $name = str_replace("+", "+", $name);
     $member = array();
     $return = TRUE;
     $id = intval($this->request['member_id']);
     # Set member ID
     $id = $this->memberData['member_id'] ? $this->memberData['member_id'] : $id;
     //-----------------------------------------
     // Load member if required
     //-----------------------------------------
     if ($id != $this->memberData['member_id']) {
         $member = IPSMember::load($id, 'all');
     } else {
         $member = $this->member->fetchMemberData();
     }
     //-----------------------------------------
     // Test name
     //-----------------------------------------
     try {
         $return = IPSMember::getFunction()->checkNameExists($name, $member);
     } catch (Exception $error) {
         $_msg = $error->getMessage();
         if ($_msg == 'NO_MORE_CHANGES') {
             $this->returnString('nomorechanges');
             return;
         }
         # Really, we're not very interested why it didn't work at this point, so
         # just return with a 'found' string which will make a nice red cross and
         # force the user to choose another.
         $this->returnString('found');
         return;
     }
     //-----------------------------------------
     // So, what's it to be?
     //-----------------------------------------
     $this->returnString($return === TRUE ? 'found' : 'notfound');
 }
開發者ID:ConnorChristie,項目名稱:GrabViews-Live,代碼行數:47,代碼來源:usercp.php

示例2: create

 /**
  * Create new member
  * Very basic functionality at this point.
  *
  * @access	public
  * @param	array 	Fields to save in the following format: array( 'members'      => array( 'email'     => 'test@test.com',
  *																				         'joined'   => time() ),
  *															   'extendedProfile' => array( 'signature' => 'My signature' ) );
  *					Tables: members, pfields_content, profile_portal.
  *					You can also use the aliases: 'core [members]', 'extendedProfile [profile_portal]', and 'customFields [pfields_content]'
  * @param	bool	Flag to attempt to auto create a name if the desired is taken
  * @param	bool	Bypass custom field saving (if using the sso session integration this is required as member object isn't ready yet)
  * @return	array 	Final member Data including member_id
  *
  * EXCEPTION CODES
  * CUSTOM_FIELDS_EMPTY    - Custom fields were not populated
  * CUSTOM_FIELDS_INVALID  - Custom fields were invalid
  * CUSTOM_FIELDS_TOOBIG   - Custom fields too big
  */
 public static function create($tables = array(), $autoCreateName = FALSE, $bypassCfields = FALSE)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $finalTables = array();
     $password = '';
     $bitWiseFields = ipsRegistry::fetchBitWiseOptions('global');
     //-----------------------------------------
     // Remap tables if required
     //-----------------------------------------
     foreach ($tables as $table => $data) {
         $_name = isset(self::$remap[$table]) ? self::$remap[$table] : $table;
         if ($_name == 'members') {
             /* Magic password field */
             $password = isset($data['password']) ? trim($data['password']) : IPSLib::makePassword();
             $md_5_password = md5($password);
             unset($data['password']);
         }
         $finalTables[$_name] = $data;
     }
     //-----------------------------------------
     // Custom profile field stuff
     //-----------------------------------------
     if (!$bypassCfields) {
         require_once IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php';
         $fields = new customProfileFields();
         if (is_array($finalTables['pfields_content']) and count($finalTables['pfields_content'])) {
             $fields->member_data = $finalTables['pfields_content'];
         }
         $_cfieldMode = 'normal';
         $fields->initData('edit');
         $fields->parseToSave($finalTables['pfields_content'], 'register');
         /* Check */
         if (count($fields->error_fields['empty'])) {
             //throw new Exception( 'CUSTOM_FIELDS_EMPTY' );
         }
         if (count($fields->error_fields['invalid'])) {
             //throw new Exception( 'CUSTOM_FIELDS_INVALID' );
         }
         if (count($fields->error_fields['toobig'])) {
             //throw new Exception( 'CUSTOM_FIELDS_TOOBIG' );
         }
     }
     //-----------------------------------------
     // Make sure the account doesn't exist
     //-----------------------------------------
     if ($finalTables['members']['email']) {
         $existing = IPSMember::load($finalTables['members']['email'], 'all');
         if ($existing['member_id']) {
             $existing['full'] = true;
             $existing['timenow'] = time();
             return $existing;
         }
     }
     //-----------------------------------------
     // Fix up usernames and display names
     //-----------------------------------------
     /* Ensure we have a display name */
     $finalTables['members']['members_display_name'] = $finalTables['members']['members_display_name'] ? $finalTables['members']['members_display_name'] : $finalTables['members']['name'];
     //-----------------------------------------
     // Clean up characters
     //-----------------------------------------
     if ($finalTables['members']['name']) {
         $userName = IPSMember::getFunction()->cleanAndCheckName($finalTables['members']['name'], array(), 'name');
         if ($userName['errors']) {
             $finalTables['members']['name'] = '';
         } else {
             $finalTables['members']['name'] = $userName['username'];
         }
     }
     if ($finalTables['members']['members_display_name']) {
         $displayName = IPSMember::getFunction()->cleanAndCheckName($finalTables['members']['members_display_name']);
         if ($displayName['errors']) {
             $finalTables['members']['members_display_name'] = '';
         } else {
             $finalTables['members']['members_display_name'] = $displayName['members_display_name'];
         }
     }
     //-----------------------------------------
     // Remove some basic HTML tags
//.........這裏部分代碼省略.........
開發者ID:dalandis,項目名稱:Visualization-of-Cell-Phone-Locations,代碼行數:101,代碼來源:core.php

示例3: convertMember

 /**
  * Convert a member
  *
  * @access	public
  * @param 	array		Basic data (id number, username, email, group, joined date, password)
  * @param 	array 		Data to insert to members table
  * @param 	array 		Data to insert to profile table
  * @param 	array 		Data to insert to custom profile fields table
  * @param 	string 		Path to avatars folder
  * @param 	string 		Path to profile pictures folder
  * @return 	boolean		Success or fail
  **/
 public function convertMember($info, $members, $profile, $custom, $pic_path = '', $groupLink = TRUE)
 {
     //-----------------------------------------
     // Make sure we have everything we need
     //-----------------------------------------
     if (!$info['id']) {
         $this->logError($info['id'], 'No ID number provided');
         return false;
     }
     if (!$info['username']) {
         $this->logError($info['id'], 'No username provided');
         return false;
     }
     if (!$info['email']) {
         // See Tracker Report #28874 for reasons why this got changed.
         $info['email'] = $info['id'] . '@' . time() . '.com';
         //$info['email'] = rand(1, 100).'@'.time().'.com';
         $this->logError($info['id'], 'No email address provided - member converted with ' . $info['email']);
     }
     // Check profile photo
     if (!is_writeable($this->settings['upload_dir'] . '/profile')) {
         $this->error($this->settings['upload_dir'] . '/profile is not writeable, cannot continue');
         return false;
     }
     //-----------------------------------------
     // Set some needed variables
     //-----------------------------------------
     $now = time();
     $joined = $info['joined'] ? $info['joined'] : $now;
     if ($info['md5pass']) {
         $salt = IPSMember::generatePasswordSalt(5);
         $hash = IPSMember::generateCompiledPasshash($salt, $info['md5pass']);
     } elseif ($info['plainpass']) {
         $salt = IPSMember::generatePasswordSalt(5);
         $hash = IPSMember::generateCompiledPasshash($salt, md5($info['plainpass']));
     } elseif ($info['pass_hash']) {
         $salt = $info['pass_salt'];
         $hash = $info['pass_hash'];
     } elseif ($info['password'] !== NULL) {
         $members['conv_password'] = $info['password'];
     } else {
         // give em a random pass, let's stop those posts by these users being lost and assigned to guests.
         $randPass = IPSMember::makePassword();
         $salt = IPSMember::generatePasswordSalt(5);
         $hash = IPSMember::generateCompiledPasshash($salt, $randPass);
         $this->logError($info['id'], 'No password provided. Member has still been converted with password: ' . $randPass);
         //return false;
     }
     $duplicateMember = IPSMember::load($info['email'], 'all');
     if ($duplicateMember['member_id']) {
         $this->logError($info['id'], "Duplicate member found. {$info['username']} has been merged with the account email {$duplicateMember['username']}");
         $this->addLink($duplicateMember['member_id'], $info['id'], 'members');
         $this->DB->update('conv_link', array('duplicate' => '1'), "type = 'members' AND app={$this->app['app_id']} AND foreign_id='{$info['id']}'");
         if ($info['posts'] > 0) {
             $this->DB->update('members', array('posts' => "posts+'{$info['posts']}'"), "member_id='{$duplicateMember['member_id']}'");
         }
         // we have a customavatar and the one we have on file does not match what we've been given, time to update it.
         if ($profile['photo_type'] == 'custom' and $duplicateMember['pp_main_photo'] != $profile['pp_main_photo']) {
             if ($profile['photo_data']) {
                 // open file for writing
                 if (!($handle = fopen($this->settings['upload_dir'] . '/profile/photo-' . $profile['pp_member_id'] . '.png', 'w'))) {
                     $this->logError($info['id'], 'Could not write to file.');
                 }
                 // Write image to our opened file.
                 if (fwrite($handle, $profile['photo_data']) === FALSE) {
                     $this->logError($info['id'], 'Could not write to file.');
                 }
                 // log it all into DB
                 $profile['pp_main_photo'] = 'profile/photo-' . $profile['pp_member_id'] . '.png';
             }
         }
         return TRUE;
     }
     //-----------------------------------------
     // Handle Names
     //-----------------------------------------
     // Apostrophe is an allowed character but needs converting
     $info['username'] = str_replace("'", ''', $info['username']);
     $info['username'] = str_replace("!", '!', $info['username']);
     // as is an excalamation point.
     $nameCheck = IPSMember::getFunction()->cleanAndCheckName($info['username'], array(), 'name');
     // Check for illegal characters
     if ($nameCheck['errors']['username'] == ipsRegistry::getClass('class_localization')->words['reg_error_chars']) {
         // Illegal characters exist, clean them out with dashes
         $nameCheckMap['disallowed'] = array("'", "\"", "&#34;", "<", ">", "\\", "&#92;", "\$", "&#036;", "]", "[", ",", "|");
         $nameCheckMap['replace'] = array('&#39;', '&#quot;', '&#quot;', '&#lt;', '&#gt;', '-', '-', '-', '-', '-', '-', '-', '-');
         $nameCheck['members_display_name'] = str_replace($nameCheckMap['disallowed'], $nameCheckMap['replace'], $nameCheck['username']);
         $this->logError($info['id'], "{$nameCheck['errors']['username']} with name {$info['username']}. Member has still been created but with username as {$nameCheck['username']}");
//.........這裏部分代碼省略.........
開發者ID:mover5,項目名稱:imobackup,代碼行數:101,代碼來源:lib_master.php

示例4: save_member_name

 /**
  * Update a user's login or display name
  *
  * @param	string		Field to update
  * @return	@e void		[Outputs to screen]
  */
 protected function save_member_name($field = 'members_display_name')
 {
     $member_id = intval($this->request['member_id']);
     $member = IPSMember::load($member_id);
     //-----------------------------------------
     // Allowed to edit administrators?
     //-----------------------------------------
     if ($member['g_access_cp'] and !$this->registry->getClass('class_permissions')->checkPermission('member_edit_admin', 'members', 'members')) {
         $this->registry->output->showError($this->lang->words['m_editadmin']);
     }
     if ($field == 'members_display_name') {
         $display_name = $this->request['display_name'];
         $display_name = str_replace("&#43;", "+", $display_name);
     } else {
         $display_name = $this->request['name'];
         $display_name = str_replace("&#43;", "+", $display_name);
         $display_name = str_replace('|', '&#124;', $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("#[\\[\\];,\\|]#", IPSText::UNhtmlspecialchars($display_name))) {
         $this->registry->output->showError($this->lang->words['m_displaynames']);
     }
     try {
         if (IPSMember::getFunction()->updateName($member_id, $display_name, $field, TRUE) === 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', TRUE);
                 }
                 //-----------------------------------------
                 // 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->registry->output->showError($this->lang->words['m_namealready']);
         }
     } catch (Exception $error) {
         //	$this->returnJsonError( $error->getMessage() );
         switch ($error->getMessage()) {
             case 'NO_USER':
                 $this->registry->output->showError($this->lang->words['m_noid']);
                 break;
             case 'NO_PERMISSION':
             case 'NO_NAME':
                 $this->registry->output->showError(sprintf($this->lang->words['m_morethan3'], $this->settings['max_user_name_length']));
                 break;
             case 'ILLEGAL_CHARS':
                 $this->registry->output->showError($this->lang->words['m_illegal']);
                 break;
             case 'USER_NAME_EXISTS':
                 $this->registry->output->showError($this->lang->words['m_namealready']);
                 break;
             default:
                 $this->registry->output->showError($error->getMessage());
                 break;
         }
     }
     $this->registry->output->global_message = $this->lang->words[$field . '_updated_success'];
     $this->registry->output->silentRedirectWithMessage($this->settings['base_url'] . 'module=members&do=viewmember&member_id=' . $member_id);
 }
開發者ID:Advanture,項目名稱:Online-RolePlay,代碼行數:93,代碼來源:editform.php

示例5: saveFormDisplayname

 /**
  * UserCP Save Form: Display Name
  *
  * @return	mixed	Array of errors / boolean true
  */
 public function saveFormDisplayname()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $members_display_name = trim($this->request['displayName']);
     $password_check = trim($this->request['displayPassword']);
     //-----------------------------------------
     // Check for blanks...
     //-----------------------------------------
     if (!$members_display_name or !$this->_isFBUser and !$password_check) {
         return array(0 => $this->lang->words['complete_entire_form']);
     }
     //-----------------------------------------
     // Check password
     //-----------------------------------------
     if (!$this->_isFBUser) {
         if ($this->_checkPassword($password_check) === FALSE) {
             return array(0 => $this->lang->words['current_pw_bad']);
         }
     }
     try {
         if (IPSMember::getFunction()->updateName($this->memberData['member_id'], $members_display_name, 'members_display_name') === TRUE) {
             $this->cache->rebuildCache('stats', 'global');
             return $this->showFormDisplayname('', $this->lang->words['dname_change_ok']);
         } else {
             # We should absolutely never get here. So this is a fail-safe, really to
             # prevent a "false" positive outcome for the end-user
             return array(0 => $this->lang->words['name_taken_change']);
         }
     } catch (Exception $error) {
         switch ($error->getMessage()) {
             case 'NO_MORE_CHANGES':
                 return array(0 => $this->lang->words['name_change_no_more']);
                 break;
             case 'NO_USER':
                 return array(0 => $this->lang->words['name_change_noload']);
                 break;
             case 'NO_PERMISSION':
                 return array(0 => $this->lang->words['name_change_noperm']);
             case 'NO_NAME':
                 return array(0 => sprintf($this->lang->words['name_change_tooshort'], $this->settings['max_user_name_length']));
                 break;
             case 'TOO_LONG':
                 return array(0 => sprintf($this->lang->words['name_change_tooshort'], $this->settings['max_user_name_length']));
                 break;
             case 'ILLEGAL_CHARS':
                 return array(0 => $this->lang->words['name_change_illegal']);
                 break;
             case 'USER_NAME_EXISTS':
                 return array(0 => $this->lang->words['name_change_taken']);
                 break;
             default:
                 return array(0 => $error->getMessage());
                 break;
         }
     }
     return TRUE;
 }
開發者ID:Advanture,項目名稱:Online-RolePlay,代碼行數:64,代碼來源:usercpForms.php

示例6: _processAvatar

 /**
  * Update a member's avatar
  *
  * @access	private
  * @return	void		[Outputs to screen]
  * @author	Brandon Farber
  * @since	IPB3 / 9 June 2008
  */
 private function _processAvatar()
 {
     $member_id = intval($this->request['member_id']);
     try {
         IPSMember::getFunction()->saveNewAvatar($member_id);
     } catch (Exception $error) {
         switch ($error->getMessage()) {
             case 'NO_MEMBER_ID':
                 $this->registry->output->showError($this->lang->words['t_noid'], 11356);
                 break;
             case 'NO_PERMISSION':
                 $this->registry->output->showError($this->lang->words['t_permav'], 11357, true);
                 break;
             case 'UPLOAD_NO_IMAGE':
                 $this->registry->output->showError($this->lang->words['t_uploadfail1'], 11358);
                 break;
             case 'UPLOAD_INVALID_FILE_EXT':
                 $this->registry->output->showError($this->lang->words['t_uploadfail2'], 11359);
                 break;
             case 'UPLOAD_TOO_LARGE':
                 $this->registry->output->showError($this->lang->words['t_uploadfail3'], 11360);
                 break;
             case 'UPLOAD_CANT_BE_MOVED':
                 $this->registry->output->showError($this->lang->words['t_uploadfail4'], 11361);
                 break;
             case 'UPLOAD_NOT_IMAGE':
                 $this->registry->output->showError($this->lang->words['t_uploadfail5'], 2131, true);
                 break;
             case 'NO_AVATAR_TO_SAVE':
                 $this->registry->output->showError($this->lang->words['t_noav'], 11362);
                 break;
             case 'INVALID_FILE_EXT':
                 $this->registry->output->showError($this->lang->words['t_badavext'], 11362);
                 break;
         }
     }
     $this->registry->output->redirect($this->settings['_base_url'] . "app=members&amp;module=members&amp;section=members&amp;do=viewmember&amp;member_id={$this->request['member_id']}", $this->lang->words['t_avupdated']);
 }
開發者ID:dalandis,項目名稱:Visualization-of-Cell-Phone-Locations,代碼行數:46,代碼來源:tools.php

示例7: change

 /**
  * Change account data
  *
  * @param	int		ID number
  * @param	string	md5( IPS Connect Key (see login method) . ID number )
  * @param	string	New username (blank means do not change)
  * @param	string	New displayname (blank means do not change)
  * @param	string	New email address (blank means do not change)
  * @param	string	New password, md5 encoded (blank means do not change)
  * @param	string	Redirect URL, Base64 encoded
  * @param	string	md5( IPS Connect Key . $redirect )
  * @return	mixed	If the redirect URL is provided, this function should redirect the user to that URL with a single paramater - 'status'
  *					If blank, will output to screen a JSON object with the same parameter
  *					Values:
  *						BAD_KEY				Invalid Key
  *						NO_USER				ID number not match any member account
  *						SUCCESS				Information changed successfully
  *						USERNAME_IN_USE		The chosen username was in use and as a result NO information was changed
  *						DISPLAYNAME_IN_USE	The chosen username was in use and as a result NO information was changed
  *						EMAIL_IN_USE		The chosen username was in use and as a result NO information was changed
  *						MISSING_DATA		No details to be changed were provided
  */
 public function change($id, $key, $username, $displayname, $email, $md5Password, $redirect, $redirectHash)
 {
     if ($key != md5($this->masterKey . $id)) {
         $this->_return(base64_encode($this->settings['board_url']), array('status' => 'BAD_KEY'));
     }
     $member = IPSMember::load(intval($id), 'none', 'id');
     if (!$member['member_id']) {
         $this->_return($redirect, array('status' => 'NO_USER'));
     }
     $update = array();
     if ($username) {
         if (IPSMember::getFunction()->checkNameExists($username, $member, 'name', TRUE)) {
             $this->_return($redirect, array('status' => 'USERNAME_IN_USE'));
         }
         $update['name'] = $username;
     }
     if ($displayname) {
         if (IPSMember::getFunction()->checkNameExists($displayname, $member, 'members_display_name', TRUE)) {
             $this->_return($redirect, array('status' => 'DISPLAYNAME_IN_USE'));
         }
         $update['members_display_name'] = $displayname;
     }
     if ($email) {
         if (IPSMember::checkByEmail($email)) {
             $this->_return($redirect, array('status' => 'EMAIL_IN_USE'));
         }
         $update['email'] = $email;
     }
     if (empty($update)) {
         if (!$md5Password) {
             $this->_return($redirect, array('status' => 'MISSING_DATA'));
         }
     } else {
         IPSMember::save($member['member_id'], array('members' => $update));
     }
     if ($md5Password) {
         IPSMember::updatePassword($member['member_id'], $md5Password);
     }
     if ($redirect) {
         $redirect = $redirectHash == md5($this->masterKey . $redirect) ? $redirect : base64_encode($this->settings['board_url']);
     }
     $this->_return($redirect, array('status' => 'SUCCESS'));
 }
開發者ID:ConnorChristie,項目名稱:GrabViews,代碼行數:65,代碼來源:ipsconnect.php

示例8: registerProcessForm

 /**
  * Processes the registration form
  *
  * @access	public
  * @return	void
  */
 public function registerProcessForm()
 {
     $form_errors = array();
     $coppa = $this->request['coppa_user'] == 1 ? 1 : 0;
     $in_password = trim($this->request['PassWord']);
     $in_email = strtolower(trim($this->request['EmailAddress']));
     $_SFS_FOUND = FALSE;
     /* Check */
     if ($this->settings['no_reg'] == 1) {
         $this->registry->output->showError('registration_disabled', 2016, true);
     }
     /* Custom profile field stuff */
     require_once IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php';
     $custom_fields = new customProfileFields();
     $custom_fields->initData('edit');
     $custom_fields->parseToSave($this->request, 'register');
     /* Check */
     if ($custom_fields->error_messages) {
         $form_errors['general'] = $custom_fields->error_messages;
     }
     /* Check the email address */
     if (!$in_email or strlen($in_email) < 6 or !IPSText::checkEmailAddress($in_email)) {
         $form_errors['email'][$this->lang->words['err_invalid_email']] = $this->lang->words['err_invalid_email'];
     }
     if (trim($this->request['PassWord_Check']) != $in_password) {
         $form_errors['password'][$this->lang->words['passwords_not_match']] = $this->lang->words['passwords_not_match'];
     }
     /* Test email address */
     $this->request['EmailAddress_two'] = strtolower(trim($this->request['EmailAddress_two']));
     $this->request['EmailAddress'] = strtolower(trim($this->request['EmailAddress']));
     if (!IPSText::checkEmailAddress($this->request['EmailAddress_two'])) {
         $form_errors['email'][$this->lang->words['reg_error_email_invalid']] = $this->lang->words['reg_error_email_invalid'];
     } else {
         if ($in_email and $this->request['EmailAddress_two'] != $in_email) {
             $form_errors['email'][$this->lang->words['reg_error_email_nm']] = $this->lang->words['reg_error_email_nm'];
         }
     }
     /* Need username? */
     $uses_name = false;
     foreach ($this->cache->getCache('login_methods') as $method) {
         if ($method['login_user_id'] == 'username') {
             $uses_name = true;
         }
     }
     if (!$uses_name) {
         $_REQUEST['UserName'] = $_REQUEST['members_display_name'];
         $this->request['UserName'] = $this->request['members_display_name'];
     }
     /* Check the username */
     $user_check = IPSMember::getFunction()->cleanAndCheckName($this->request['UserName'], array(), 'name');
     if ($this->settings['auth_allow_dnames']) {
         $disp_check = IPSMember::getFunction()->cleanAndCheckName($this->request['members_display_name'], array(), 'members_display_name');
     }
     if (is_array($user_check['errors']) && count($user_check['errors'])) {
         foreach ($user_check['errors'] as $key => $error) {
             $form_errors[$key][] = $error;
         }
     }
     if ($this->settings['auth_allow_dnames'] and is_array($disp_check['errors']) && count($disp_check['errors'])) {
         foreach ($disp_check['errors'] as $key => $error) {
             $form_errors[$key][] = $error;
         }
     }
     /* CHECK 1: Any errors (missing fields, etc)? */
     if (count($form_errors)) {
         $this->registerForm($form_errors);
         return;
     }
     /* Is this email addy taken? */
     if (IPSMember::checkByEmail($in_email) == TRUE) {
         $form_errors['email'][$this->lang->words['reg_error_email_taken']] = $this->lang->words['reg_error_email_taken'];
     }
     /* Load handler... */
     require_once IPS_ROOT_PATH . 'sources/handlers/han_login.php';
     $this->han_login = new han_login($this->registry);
     $this->han_login->init();
     $this->han_login->emailExistsCheck($in_email);
     if ($this->han_login->return_code and $this->han_login->return_code != 'METHOD_NOT_DEFINED' and $this->han_login->return_code != 'EMAIL_NOT_IN_USE') {
         $form_errors['email'][$this->lang->words['reg_error_email_taken']] = $this->lang->words['reg_error_email_taken'];
     }
     /* Are they banned [EMAIL]? */
     if (IPSMember::isBanned('email', $in_email) === TRUE) {
         $form_errors['email'][$this->lang->words['reg_error_email_ban']] = $this->lang->words['reg_error_email_ban'];
     }
     /* Check the CAPTCHA */
     if ($this->settings['bot_antispam']) {
         if ($this->registry->getClass('class_captcha')->validate() !== TRUE) {
             $form_errors['general'][$this->lang->words['err_reg_code']] = $this->lang->words['err_reg_code'];
         }
     }
     /* Check the Q and A */
     if ($this->settings['registration_qanda']) {
         $qanda = intval($this->request['qanda_id']);
         $pass = false;
//.........這裏部分代碼省略.........
開發者ID:dalandis,項目名稱:Visualization-of-Cell-Phone-Locations,代碼行數:101,代碼來源:register.php

示例9: _manageValidating


//.........這裏部分代碼省略.........
                     /* Load custom fields class */
                     require_once IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php';
                     $fields = new customProfileFields();
                     /* Load language file */
                     $this->registry->getClass('class_localization')->loadLanguageFile(array('public_mod'), 'forums');
                     foreach ($members as $member_id => $member) {
                         $toSave = array('core' => array('bw_is_spammer' => 1, 'member_group_id' => $this->settings['member_group']));
                         /* Protected group? */
                         if (strstr(',' . $this->settings['warn_protected'] . ',', ',' . $member['member_group_id'] . ',')) {
                             continue;
                         }
                         /* What do to.. */
                         if ($this->settings['spm_option']) {
                             switch ($this->settings['spm_option']) {
                                 case 'disable':
                                     $toSave['core']['restrict_post'] = 1;
                                     $toSave['core']['members_disable_pm'] = 2;
                                     break;
                                 case 'unapprove':
                                     $toSave['core']['restrict_post'] = 1;
                                     $toSave['core']['members_disable_pm'] = 2;
                                     /* Unapprove posts and topics */
                                     $modLibrary->toggleApproveMemberContent($member_id, FALSE, 'all', intval($this->settings['spm_post_days']) * 24);
                                     break;
                                 case 'ban':
                                     /* Unapprove posts and topics */
                                     $modLibrary->toggleApproveMemberContent($member_id, FALSE, 'all', intval($this->settings['spm_post_days']) * 24);
                                     $toSave = array('core' => array('member_banned' => 1, 'title' => '', 'bw_is_spammer' => 1), 'extendedProfile' => array('signature' => '', 'pp_bio_content' => '', 'pp_about_me' => '', 'pp_status' => ''));
                                     //-----------------------------------------
                                     // Avatar
                                     //-----------------------------------------
                                     $toSave['extendedProfile']['avatar_location'] = "";
                                     $toSave['extendedProfile']['avatar_size'] = "";
                                     try {
                                         IPSMember::getFunction()->removeAvatar($member['member_id']);
                                     } catch (Exception $e) {
                                         // Maybe should show an error or something
                                     }
                                     //-----------------------------------------
                                     // Photo
                                     //-----------------------------------------
                                     IPSMember::getFunction()->removeUploadedPhotos($member['member_id']);
                                     $toSave['extendedProfile'] = array_merge($toSave['extendedProfile'], array('pp_main_photo' => '', 'pp_main_width' => '', 'pp_main_height' => '', 'pp_thumb_photo' => '', 'pp_thumb_width' => '', 'pp_thumb_height' => ''));
                                     //-----------------------------------------
                                     // Profile fields
                                     //-----------------------------------------
                                     $fields->member_data = $member;
                                     $fields->initData('edit');
                                     $fields->parseToSave(array());
                                     if (count($fields->out_fields)) {
                                         $toSave['customFields'] = $fields->out_fields;
                                     }
                                     //-----------------------------------------
                                     // Update signature content cache
                                     //-----------------------------------------
                                     IPSContentCache::update($member['member_id'], 'sig', '');
                                     break;
                             }
                         }
                         /* Send an email */
                         if ($this->settings['spm_notify'] and $this->settings['email_out'] != $this->memberData['email']) {
                             IPSText::getTextClass('email')->getTemplate('possibleSpammer');
                             IPSText::getTextClass('email')->buildMessage(array('DATE' => $this->registry->class_localization->getDate($member['joined'], 'LONG', 1), 'MEMBER_NAME' => $member['members_display_name'], 'IP' => $member['ip_address'], 'EMAIL' => $member['email'], 'LINK' => $this->registry->getClass('output')->buildSEOUrl("showuser=" . $member['member_id'], 'public', $member['members_seo_name'], 'showuser')));
                             IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email_spammer'] . ' ' . $this->settings['board_name'];
                             IPSText::getTextClass('email')->to = $this->settings['email_out'];
                             IPSText::getTextClass('email')->sendMail();
                         }
                         /* Flag them as a spammer */
                         IPSMember::save($member['member_id'], $toSave);
                         /* Send Spammer to Spam Service */
                         if ($this->settings['spam_service_send_to_ips'] && $this->settings['spam_service_api_key']) {
                             IPSMember::querySpamService($member['email'], $member['ip_address'], 'markspam');
                         }
                         /* Remove validating rows */
                         $this->DB->delete('validating', "member_id IN(" . implode(",", $ids) . ")");
                         $this->registry->output->global_message = count($ids) . ' ' . $this->lang->words['t_setasspammers'];
                         $this->_viewQueue('validating');
                         return;
                     }
                 } else {
                     $denied = array();
                     $this->DB->build(array('select' => 'members_display_name', 'from' => 'members', 'where' => "member_id IN(" . implode(",", $ids) . ")"));
                     $this->DB->execute();
                     while ($r = $this->DB->fetch()) {
                         $denied[] = $r['members_display_name'];
                     }
                     try {
                         IPSMember::remove($ids);
                     } catch (Exception $error) {
                         $this->registry->output->showError($error->getMessage(), 11247);
                     }
                     ipsRegistry::getClass('adminFunctions')->saveAdminLog(count($ids) . $this->lang->words['t_regdenied'] . implode(", ", $denied));
                     $this->registry->output->global_message = count($ids) . $this->lang->words['t_removedmem'];
                     $this->_viewQueue('validating');
                     return;
                 }
             }
         }
     }
 }
開發者ID:dalandis,項目名稱:Visualization-of-Cell-Phone-Locations,代碼行數:101,代碼來源:tools.php

示例10: syncMember

 /**
  * Function to resync a member's Twitter data
  *
  * @access	public
  * @param	mixed		Member Data in an array form (result of IPSMember::load( $id, 'all' ) ) or a member ID
  * @return	array 		Updated member data	
  *
  * EXCEPTION CODES:
  * NO_MEMBER		Member ID does not exist
  * NOT_LINKED		Member ID or data specified is not linked to a FB profile
  */
 public function syncMember($memberData)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $exProfile = array();
     /* Do we need to load a member? */
     if (!is_array($memberData)) {
         $memberData = IPSMember::load(intval($memberData), 'all');
     }
     /* Got a member? */
     if (!$memberData['member_id']) {
         throw new Exception('NO_MEMBER');
     }
     /* Linked account? */
     if (!$memberData['twitter_id']) {
         throw new Exception('NOT_LINKED');
     }
     /* Not completed sign up ( no display name ) */
     if ($memberData['member_group_id'] == $this->settings['auth_group']) {
         return false;
     }
     /* Thaw Options */
     $bwOptions = IPSBWOptions::thaw($memberData['tc_bwoptions'], 'twitter');
     /* Grab the data */
     try {
         $this->resetApi($memberData['twitter_token'], $memberData['twitter_secret']);
         if ($this->isConnected()) {
             $user = $this->fetchUserData();
             /* Load library */
             if ($bwOptions['tc_s_pic']) {
                 $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/member/photo.php', 'classes_member_photo');
                 $photo = new $classToLoad($this->registry);
                 $photo->save($memberData, 'twitter');
             }
             if ($bwOptions['tc_s_aboutme']) {
                 $exProfile['pp_about_me'] = IPSText::getTextClass('bbcode')->stripBadWords(IPSText::convertCharsets($user['description'], 'utf-8', IPS_DOC_CHAR_SET));
             }
             if ($bwOptions['tc_si_status'] and (isset($memberData['gbw_no_status_import']) and !$memberData['gbw_no_status_import']) and !$memberData['bw_no_status_update']) {
                 /* Fetch timeline */
                 $memberData['tc_last_sid_import'] = $memberData['tc_last_sid_import'] < 1 ? 100 : $memberData['tc_last_sid_import'];
                 $_updates = $this->fetchUserTimeline($user['id'], $memberData['tc_last_sid_import'], true);
                 /* Got any? */
                 if (count($_updates)) {
                     $update = array_shift($_updates);
                     if (is_array($update) and isset($update['text'])) {
                         /* Load status class */
                         if (!$this->registry->isClassLoaded('memberStatus')) {
                             $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/member/status.php', 'memberStatus');
                             $this->registry->setClass('memberStatus', new $classToLoad(ipsRegistry::instance()));
                         }
                         /* Set Author */
                         $this->registry->getClass('memberStatus')->setAuthor($memberData);
                         $this->registry->getClass('memberStatus')->setStatusOwner($memberData);
                         /* Convert if need be */
                         if (IPS_DOC_CHAR_SET != 'UTF-8') {
                             $update['text'] = IPSText::utf8ToEntities($update['text']);
                         }
                         /* Set Content */
                         $this->registry->getClass('memberStatus')->setContent(trim(IPSText::getTextClass('bbcode')->stripBadWords($update['text'])));
                         /* Set as imported */
                         $this->registry->getClass('memberStatus')->setIsImport(1);
                         /* Set creator */
                         $this->registry->getClass('memberStatus')->setCreator('twitter');
                         /* Can we reply? */
                         if ($this->registry->getClass('memberStatus')->canCreate()) {
                             $this->registry->getClass('memberStatus')->create();
                             $exProfile['tc_last_sid_import'] = $update['id'];
                         }
                     }
                 }
             }
             /* Allowed profile customization? */
             if ($bwOptions['tc_s_bgimg'] and ($user['profile_background_image_url'] or $user['profile_background_color']) and ($this->memberData['gbw_allow_customization'] and !$this->memberData['bw_disable_customization'])) {
                 /* remove bg images */
                 IPSMember::getFunction()->removeUploadedBackgroundImages($memberData['member_id']);
                 $exProfile['pp_customization'] = serialize(array('bg_url' => $user['profile_background_image_url'], 'type' => $user['profile_background_image_url'] ? 'url' : 'color', 'bg_color' => IPSText::alphanumericalClean($user['profile_background_color']), 'bg_tile' => intval($user['profile_background_tile'])));
             }
             /* Update member */
             IPSMember::save($memberData['member_id'], array('core' => array('tc_lastsync' => time()), 'extendedProfile' => $exProfile));
             /* merge and return */
             $memberData['tc_lastsync'] = time();
             $memberData = array_merge($memberData, $exProfile);
         }
     } catch (Exception $e) {
     }
     return $memberData;
 }
開發者ID:Advanture,項目名稱:Online-RolePlay,代碼行數:99,代碼來源:connect.php

示例11: savePhoto

 /**
  * UserCP Save Form: Photo
  *
  * @access	public
  * @return	array	Errors
  */
 public function savePhoto()
 {
     //-----------------------------------------
     // Check to make sure that we can edit profiles..
     //-----------------------------------------
     if (!$this->memberData['g_edit_profile']) {
         $this->registry->getClass('output')->showError('members_profile_disabled', 1027);
     }
     //-----------------------------------------
     // Load lang file
     //-----------------------------------------
     $this->registry->class_localization->loadLanguageFile(array('public_profile'), 'members');
     //-----------------------------------------
     // Do upload...
     //-----------------------------------------
     $photo = IPSMember::getFunction()->uploadPhoto();
     if ($photo['status'] == 'fail') {
         return array(0 => $this->lang->words['pp_' . $photo['error']]);
     } else {
         IPSMember::save($this->memberData['member_id'], array('extendedProfile' => array('pp_main_photo' => $photo['final_location'], 'pp_main_width' => intval($photo['final_width']), 'pp_main_height' => intval($photo['final_height']), 'pp_thumb_photo' => $photo['t_final_location'], 'pp_thumb_width' => intval($photo['t_final_width']), 'pp_thumb_height' => intval($photo['t_final_height']))));
     }
     return TRUE;
 }
開發者ID:dalandis,項目名稱:Visualization-of-Cell-Phone-Locations,代碼行數:29,代碼來源:usercpForms.php

示例12: show

 /**
  * Show the form
  *
  * @access	protected
  * @return	void		[Outputs to screen]
  */
 protected function show()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $name = trim(IPSText::alphanumericalClean(ipsRegistry::$request['name']));
     $member_id = intval(ipsRegistry::$request['member_id']);
     $output = '';
     //-----------------------------------------
     // Get member data
     //-----------------------------------------
     $member = IPSMember::load($member_id, 'extendedProfile,customFields');
     //-----------------------------------------
     // Got a member?
     //-----------------------------------------
     if (!$member['member_id']) {
         $this->returnJsonError($this->lang->words['t_noid']);
     }
     //-----------------------------------------
     // Return the form
     //-----------------------------------------
     if (method_exists($this->html, $name)) {
         $output = $this->html->{$name}($member);
     } else {
         $save_to = '';
         $div_id = '';
         $form_field = '';
         $text = '';
         $description = '';
         $method = '';
         switch ($name) {
             /*case 'inline_warn_level':
             			$method			= 'inline_form_generic';
             			$save_to		= 'save_generic&amp;field=warn_level';
             			$div_id			= 'warn_level';
             			$form_field		= ipsRegistry::getClass('output')->formInput( "generic__field", $member['warn_level'] );
             			$text			= "Member Warn Level";
             			$description	= "Make adjustments to the member's overall warn level.  This does NOT add a warn log record - you should do so manually using the 'Add New Note' link if you wish to store a log of this adjustment";
             		break;*/
             case 'inline_avatar':
                 if (!$this->registry->getClass('class_permissions')->checkPermission('member_photo', 'members', 'members')) {
                     $this->returnJsonError($this->lang->words['m_nopermban']);
                 }
                 $form = array();
                 $form['avatar_url'] = ipsRegistry::getClass('output')->formInput("avatar_url", $member['avatar_type'] == 'url' ? $member['avatar_location'] : '');
                 $av_categories = array_merge(array(0 => array(0, $this->lang->words['m_selectcat'])), IPSMember::getFunction()->getHostedAvatarCategories());
                 $output = $this->html->inline_avatar_selector($member, $av_categories);
                 break;
         }
         if (!$output and $method and method_exists($html, $method)) {
             $output = $html->{$method}($member, $save_to, $div_id, $form_field, $text, $description);
         }
     }
     //-----------------------------------------
     // Print...
     //-----------------------------------------
     $this->returnHtml($output);
 }
開發者ID:dalandis,項目名稱:Visualization-of-Cell-Phone-Locations,代碼行數:64,代碼來源:member_editform.php

示例13: checkDisplayName

 /**
  * Check the name or display name
  *
  * @access	public
  * @return	void		[Outputs to screen]
  */
 public function checkDisplayName($field = 'members_display_name')
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $this->registry->class_localization->loadLanguageFile(array('public_register'));
     $name = '';
     if (is_string($_POST['name'])) {
         $name = strtolower(trim(rawurldecode($_POST['name'])));
     }
     if (!$name) {
         $this->returnString(sprintf(ipsRegistry::getClass('class_localization')->words['reg_error_no_name'], ipsRegistry::$settings['max_user_name_length']));
     }
     /* Check the username */
     $user_check = IPSMember::getFunction()->cleanAndCheckName($name, array(), $field);
     $errorField = $field == 'members_display_name' ? 'dname' : 'username';
     $nameField = $field == 'members_display_name' ? 'members_display_name' : 'username';
     if (is_array($user_check['errors'][$errorField]) && count($user_check['errors'][$errorField])) {
         $this->returnString($user_check['errors'][$errorField][0]);
         return;
     } else {
         if ($user_check['errors'][$errorField]) {
             $this->returnString($user_check['errors'][$errorField]);
         } else {
             $this->returnString('notfound');
         }
     }
 }
開發者ID:dalandis,項目名稱:Visualization-of-Cell-Phone-Locations,代碼行數:34,代碼來源:register.php

示例14: save_member_name

    /**
     * Update a user's login or display name
     *
     * @access	protected
     * @param	string		Field to update
     * @return	void		[Outputs to screen]
     */
    protected function save_member_name($field = 'members_display_name')
    {
        $member_id = intval($this->request['member_id']);
        $member = IPSMember::load($member_id);
        //-----------------------------------------
        // Allowed to edit administrators?
        //-----------------------------------------
        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("&#43;", "+", $display_name);
        } else {
            $display_name = $this->convertAndMakeSafe($_POST['name'], 1);
            $display_name = str_replace("&#43;", "+", $display_name);
            $display_name = str_replace('|', '&#124;', $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('&#39;', "'", str_replace('&amp;', '&', $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']);
//.........這裏部分代碼省略.........
開發者ID:dalandis,項目名稱:Visualization-of-Cell-Phone-Locations,代碼行數:101,代碼來源:editform.php

示例15: _memberDoAdd

 /**
  * Add a member [process]
  *
  * @access	private
  * @return	void		[Outputs to screen]
  */
 private function _memberDoAdd()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $in_username = trim($this->request['name']);
     $in_password = trim($this->request['password']);
     $in_email = trim(strtolower($this->request['email']));
     $members_display_name = trim($this->request['members_display_name']);
     $this->registry->output->global_message = '';
     //-----------------------------------------
     // Check form
     //-----------------------------------------
     foreach (array('name', 'password', 'email', 'member_group_id') as $field) {
         if (!$_POST[$field]) {
             $this->registry->output->showError($this->lang->words['m_completeform'], 11238);
         }
     }
     //-----------------------------------------
     // Check
     //-----------------------------------------
     if (!IPSText::checkEmailAddress($in_email)) {
         $this->registry->output->global_message = $this->lang->words['m_emailinv'];
     }
     $userName = IPSMember::getFunction()->cleanAndCheckName($in_username, array(), 'name');
     $displayName = IPSMember::getFunction()->cleanAndCheckName($members_display_name, array(), 'members_display_name');
     if (count($userName['errors'])) {
         $this->registry->output->global_message .= '<p>' . $this->lang->words['sm_loginname'] . ' ' . $userName['errors']['username'] . '</p>';
     }
     if ($this->settings['auth_allow_dnames'] and count($displayName['errors'])) {
         $this->registry->output->global_message .= '<p>' . $this->lang->words['sm_display'] . ' ' . $displayName['errors']['dname'] . '</p>';
     }
     /* Errors? */
     if ($this->registry->output->global_message) {
         $this->_memberAddForm();
         return;
     }
     //-----------------------------------------
     // Load handler...
     //-----------------------------------------
     require_once IPS_ROOT_PATH . 'sources/handlers/han_login.php';
     $this->han_login = new han_login($this->registry);
     $this->han_login->init();
     $this->han_login->emailExistsCheck($in_email);
     if ($this->han_login->return_code and $this->han_login->return_code != 'METHOD_NOT_DEFINED' and $this->han_login->return_code != 'EMAIL_NOT_IN_USE') {
         $this->registry->output->global_message = $this->lang->words['m_emailalready'];
         $this->_memberAddForm();
         return;
     }
     //-----------------------------------------
     // Allowed to add administrators?
     //-----------------------------------------
     if ($this->caches['group_cache'][intval($this->request['member_group_id'])]['g_access_cp'] and !$this->registry->getClass('class_permissions')->checkPermission('member_add_admin')) {
         $this->registry->output->global_message = $this->lang->words['m_addadmin'];
         $this->_memberAddForm();
         return;
     }
     $member = array('name' => $in_username, 'members_display_name' => $members_display_name ? $members_display_name : $in_username, 'email' => $in_email, 'member_group_id' => intval($this->request['member_group_id']), 'joined' => time(), 'ip_address' => $this->member->ip_address, 'time_offset' => $this->settings['time_offset'], 'coppa_user' => intval($this->request['coppa']), 'allow_admin_mails' => 1, 'password' => $in_password);
     //-----------------------------------------
     // Create the account
     //-----------------------------------------
     $member = IPSMember::create(array('members' => $member, 'pfields_content' => $this->request));
     //-----------------------------------------
     // Login handler create account callback
     //-----------------------------------------
     $this->han_login->createAccount(array('email' => $in_email, 'joined' => $member['joined'], 'password' => $in_password, 'ip_address' => $member['ip_address'], 'username' => $member['members_display_name']));
     /*if( $this->han_login->return_code AND $this->han_login->return_code != 'METHOD_NOT_DEFINED' AND $this->han_login->return_code != 'SUCCESS' )
     		{
     			$this->registry->output->global_message = sprintf( $this->lang->words['m_cantadd'], $this->han_login->return_code ) . $this->han_login->return_details;
     			$this->_memberAddForm();
     			return;
     		}*/
     //-----------------------------------------
     // Restriction permissions stuff
     //-----------------------------------------
     if ($this->memberData['row_perm_cache']) {
         if ($this->caches['group_cache'][intval($this->request['member_group_id'])]['g_access_cp']) {
             //-----------------------------------------
             // Copy restrictions...
             //-----------------------------------------
             $this->DB->insert('admin_permission_rows', array('row_member_id' => $member_id, 'row_perm_cache' => $this->memberData['row_perm_cache'], 'row_updated' => time()));
         }
     }
     //-----------------------------------------
     // Send teh email (I love 'teh' as much as !!11!!1)
     //-----------------------------------------
     if ($this->request['sendemail']) {
         IPSText::getTextClass('email')->getTemplate("account_created");
         IPSText::getTextClass('email')->buildMessage(array('NAME' => $member['name'], 'EMAIL' => $member['email'], 'PASSWORD' => $in_password));
         IPSText::getTextClass('email')->to = $member['email'];
         IPSText::getTextClass('email')->sendMail();
     }
     //-----------------------------------------
     // Stats
//.........這裏部分代碼省略.........
開發者ID:dalandis,項目名稱:Visualization-of-Cell-Phone-Locations,代碼行數:101,代碼來源:members.php


注:本文中的IPSMember::getFunction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。