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


PHP IPSMember::isBanned方法代碼示例

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


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

示例1: 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

示例2: finishLogin

 /**
  * Completes the connection
  *
  * @access	public
  * @return	redirect
  */
 public function finishLogin()
 {
     /* From reg flag */
     if ($_REQUEST['code']) {
         /* Load oAuth */
         require_once IPS_KERNEL_PATH . 'facebook/facebookoauth.php';
         /*noLibHook*/
         $this->_oauth = new FacebookOAuth(FACEBOOK_APP_ID, FACEBOOK_APP_SECRET, FACEBOOK_CALLBACK, $this->extendedPerms);
         /* Load API */
         require_once IPS_KERNEL_PATH . 'facebook/facebook.php';
         /*noLibHook*/
         $this->_api = new Facebook(array('appId' => FACEBOOK_APP_ID, 'secret' => FACEBOOK_APP_SECRET, 'cookie' => true));
         /* Ensure URL is correct */
         $_urlExtra = '';
         if ($_REQUEST['key']) {
             $_urlExtra .= '&key=' . $_REQUEST['key'];
         }
         if ($_REQUEST['_reg']) {
             $_urlExtra .= '&_reg=1';
         }
         /* Update callback url */
         $this->_oauth->setCallBackUrl(FACEBOOK_CALLBACK . $_urlExtra);
         /* Generate oAuth token */
         $rToken = $this->_oauth->getAccessToken($_REQUEST['code']);
         if (is_string($rToken)) {
             try {
                 $_userData = $this->_api->api('me', array('access_token' => $rToken));
             } catch (Exception $e) {
                 /* Try re-authorising */
                 if (stristr($e->getMessage(), 'invalid')) {
                     $this->redirectToConnectPage();
                 }
             }
             /* 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']) {
//.........這裏部分代碼省略.........
開發者ID:Advanture,項目名稱:Online-RolePlay,代碼行數:101,代碼來源:connect.php

示例3: loginForm

 /**
  * Show the login form
  *
  * @param	string		Message to show on login form
  * @return	string		Login form HTML
  */
 public function loginForm($message = "", $replacement = '')
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $extra_form = "";
     $show_form = 1;
     $template = '';
     $serviceClick = trim($this->request['serviceClick']);
     //-----------------------------------------
     // Are they banned?
     //-----------------------------------------
     if (IPSMember::isBanned('ip', $this->member->ip_address)) {
         $this->registry->getClass('output')->showError('you_are_banned', 2011, null, null, 403);
     }
     if ($message != "") {
         if ($replacement) {
             $message = sprintf($this->lang->words[$message], $replacement);
         } else {
             $message = $this->lang->words[$message];
         }
         $name = $this->request['UserName'] ? $this->request['UserName'] : $this->request['address'];
         $message = str_replace("<#NAME#>", "<b>" . $name . "</b>", $message);
         $template .= $this->registry->getClass('output')->getTemplate('login')->errors($message);
     }
     //-----------------------------------------
     // Using an alternate log in form?
     //-----------------------------------------
     $this->han_login->checkLoginUrlRedirect();
     /* Did we click a service? */
     if ($serviceClick) {
         switch ($serviceClick) {
             case 'facebook':
                 $this->registry->getClass('output')->silentRedirect($this->settings['_original_base_url'] . "/interface/facebook/index.php?_reg=1");
                 break;
             case 'twitter':
                 $this->registry->getClass('output')->silentRedirect($this->settings['_original_base_url'] . "/interface/twitter/index.php?_reg=1");
                 break;
         }
     }
     //-----------------------------------------
     // Extra  HTML?
     //-----------------------------------------
     $additionalForm = $this->han_login->additionalFormHTML();
     if (count($additionalForm[1])) {
         if ($additionalForm[0] == 'add') {
             $extra_form = $additionalForm[1];
             $show_form = 1;
         } else {
             if (is_array($additionalForm[1])) {
                 foreach ($additionalForm[1] as $_form) {
                     $template .= $_form;
                 }
             } else {
                 $template .= $additionalForm[1];
             }
             $show_form = 0;
         }
     }
     //-----------------------------------------
     // Continue...
     //-----------------------------------------
     if ($show_form) {
         if ($this->request['referer']) {
             $http_referrer = $this->request['referer'];
         } else {
             /* @link	http://community.invisionpower.com/tracker/issue-32302-login-redirect-when-activating */
             $_urlPieces = @parse_url($this->settings['board_url']);
             if (strpos(my_getenv('HTTP_REFERER'), $_urlPieces['host'] ? $_urlPieces['host'] : $this->settings['board_url']) !== false) {
                 $http_referrer = my_getenv('HTTP_REFERER');
             } else {
                 $http_referrer = '';
             }
         }
         $login_methods = false;
         $uses_name = false;
         $uses_email = false;
         foreach ($this->cache->getCache('login_methods') as $method) {
             $login_methods[$method['login_folder_name']] = $method['login_folder_name'];
             if ($method['login_user_id'] == 'username' or $method['login_user_id'] == 'either') {
                 $uses_name = true;
             }
             if ($method['login_user_id'] == 'email' or $method['login_user_id'] == 'either') {
                 $uses_email = true;
             }
         }
         if ($uses_name and $uses_email) {
             $this->lang->words['enter_name'] = $this->lang->words['enter_name_and_email'];
         } else {
             if ($uses_email) {
                 $this->lang->words['enter_name'] = $this->lang->words['enter_useremail'];
             } else {
                 $this->lang->words['enter_name'] = $this->lang->words['enter_username'];
             }
//.........這裏部分代碼省略.........
開發者ID:ConnorChristie,項目名稱:GrabViews,代碼行數:101,代碼來源:login.php

示例4: registerProcessForm

 /**
  * Processes the registration form
  *
  * @return	@e void
  */
 public function registerProcessForm()
 {
     $this->_resetMember();
     $form_errors = array();
     $coppa = $this->request['coppa_user'] == 1 ? 1 : 0;
     $in_password = trim($this->request['PassWord']);
     $in_email = strtolower(trim($this->request['EmailAddress']));
     /* Did we agree to the t&c? */
     if (!$this->request['agree_tos']) {
         $form_errors['tos'] = array($this->lang->words['must_agree_to_terms']);
     }
     /* Custom profile field stuff */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
     $custom_fields = new $classToLoad();
     $custom_fields->initData('edit');
     $custom_fields->parseToSave($_POST, '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 or !$in_password) {
         $form_errors['password'][$this->lang->words['passwords_not_match']] = $this->lang->words['passwords_not_match'];
     }
     /*
     There's no reason for this - http://community.invisionpower.com/resources/bugs.html/_/ip-board/registrations-limit-passwords-to-32-characters-for-no-apparent-reason-r37770
     elseif ( strlen( $in_password ) < 3 )
     {
     	$form_errors['password'][$this->lang->words['pass_too_short']] = $this->lang->words['pass_too_short'];
     }
     elseif ( strlen( $in_password ) > 32 )
     {
     	$form_errors['password'][$this->lang->words['pass_too_long']] = $this->lang->words['pass_too_long'];
     }
     */
     /* Check the username */
     $user_check = IPSMember::getFunction()->cleanAndCheckName($this->request['members_display_name'], array(), 'name');
     $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['dname'][$error] = isset($this->lang->words[$error]) ? $this->lang->words[$error] : $error;
         }
     }
     /* this duplicates username error above */
     /*if( is_array( $disp_check['errors'] ) && count( $disp_check['errors'] ) )
     		{
     			foreach( $disp_check['errors'] as $key => $error )
     			{
     				$form_errors['dname'][ $error ]	= isset($this->lang->words[ $error ]) ? $this->lang->words[ $error ] : $error;
     			}
     		}*/
     /* 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... */
     $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->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_type'] != 'none') {
         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 */
     $qanda = intval($this->request['qanda_id']);
     $pass = true;
     if ($qanda) {
         $pass = false;
         $data = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'question_and_answer', 'where' => 'qa_id=' . $qanda));
         if ($data['qa_id']) {
             $answers = explode("\n", str_replace("\r", "", $data['qa_answers']));
             if (count($answers)) {
                 foreach ($answers as $answer) {
                     $answer = trim($answer);
                     if (IPSText::mbstrlen($answer) and mb_strtolower($answer) == mb_strtolower($this->request['qa_answer'])) {
                         $pass = true;
                         break;
                     }
                 }
             }
         }
     } else {
//.........這裏部分代碼省略.........
開發者ID:Advanture,項目名稱:Online-RolePlay,代碼行數:101,代碼來源:register.php

示例5: init


//.........這裏部分代碼省略.........
     self::_fUrlComplete();
     self::instance()->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core');
     if (IPS_AREA == 'admin') {
         $validationStatus = self::member()->sessionClass()->getStatus();
         $validationMessage = self::member()->sessionClass()->getMessage();
         if (ipsRegistry::$request['module'] != 'login' and !$validationStatus) {
             //-----------------------------------------
             // Force log in
             //-----------------------------------------
             if (ipsRegistry::$request['module'] == 'ajax') {
                 @header("Content-type: application/json;charset=" . IPS_DOC_CHAR_SET);
                 print json_encode(array('error' => self::instance()->getClass('class_localization')->words['acp_sessiontimeout'], '__session__expired__log__out__' => 1));
                 exit;
             } elseif (ipsRegistry::$settings['logins_over_https'] && (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on')) {
                 /* Bug 38301 */
                 ipsRegistry::getClass('output')->silentRedirect(str_replace('http://', 'https://', ipsRegistry::$settings['this_url']));
                 return;
             } else {
                 ipsRegistry::$request['module'] = 'login';
                 ipsRegistry::$request['core'] = 'login';
                 $classToLoad = IPSLib::loadActionOverloader(IPSLib::getAppDir('core') . "/modules_admin/login/manualResolver.php", 'admin_core_login_manualResolver');
                 $runme = new $classToLoad(self::instance());
                 $runme->doExecute(self::instance());
                 exit;
             }
         }
     } else {
         if (IPS_AREA == 'public') {
             /* Set up member */
             self::$handles['member']->finalizePublicMember();
             /* Proper no cache key <update:1> */
             ipsRegistry::$settings['noCacheKey'] = md5('$Rev: 12261 $');
             /* Are we banned: Via IP Address? */
             if (IPSMember::isBanned('ipAddress', self::$handles['member']->ip_address) === TRUE) {
                 self::instance()->getClass('output')->showError('you_are_banned', 2000, true, null, 403);
             }
             /* Are we banned: By DB */
             if (self::$handles['member']->getProperty('member_banned') == 1 or self::$handles['member']->getProperty('temp_ban')) {
                 /* Don't show this message if we're viewing the warn log */
                 if (ipsRegistry::$request['module'] != 'ajax' or ipsRegistry::$request['section'] != 'warnings') {
                     self::getClass('class_localization')->loadLanguageFile('public_error', 'core');
                     $message = '';
                     if (self::$handles['member']->getProperty('member_banned')) {
                         $message = self::getClass('class_localization')->words['no_view_board_b'];
                     } else {
                         $ban_arr = IPSMember::processBanEntry(self::$handles['member']->getProperty('temp_ban'));
                         /* No longer banned */
                         if (time() >= $ban_arr['date_end']) {
                             self::DB()->update('members', array('temp_ban' => ''), 'member_id=' . self::$handles['member']->getProperty('member_id'));
                         } else {
                             $message = sprintf(self::getClass('class_localization')->words['account_susp'], self::getClass('class_localization')->getDate($ban_arr['date_end'], 'LONG', 1));
                         }
                     }
                     /* Get anything? */
                     if ($message) {
                         $warn = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'members_warn_logs', 'where' => 'wl_member=' . self::$handles['member']->getProperty('member_id') . ' AND wl_suspend<>0 AND wl_suspend<>-2', 'order' => 'wl_date DESC', 'limit' => 1));
                         if ($warn['wl_id'] and ipsRegistry::$settings['warn_show_own']) {
                             $moredetails = "<a href='javascript:void(0);' onclick='warningPopup( this, {$warn['wl_id']} );'>" . self::getClass('class_localization')->words['warnings_moreinfo'] . "</a>";
                         }
                         self::instance()->getClass('output')->showError("{$message} {$moredetails}", 1001, true, null, 403);
                     }
                 }
             }
             /* Check server load */
             if (ipsRegistry::$settings['load_limit'] > 0) {
                 $server_load = IPSDebug::getServerLoad();
開發者ID:ConnorChristie,項目名稱:GrabViews,代碼行數:67,代碼來源:ipsRegistry.php

示例6: loginForm

 /**
  * Show the login form
  *
  * @access	public
  * @param	string		Message to show on login form
  * @return	string		Login form HTML
  */
 public function loginForm($message = "", $replacement = '')
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $extra_form = "";
     $show_form = 1;
     $template = '';
     //-----------------------------------------
     // Are they banned?
     //-----------------------------------------
     if (IPSMember::isBanned('ip', $this->member->ip_address)) {
         $this->registry->getClass('output')->showError('you_are_banned', 2011);
     }
     if ($message != "") {
         if ($replacement) {
             $message = sprintf($this->lang->words[$message], $replacement);
         } else {
             $message = $this->lang->words[$message];
         }
         $name = $this->request['UserName'] ? $this->request['UserName'] : $this->request['address'];
         $message = str_replace("<#NAME#>", "<b>" . $name . "</b>", $message);
         $template .= $this->registry->getClass('output')->getTemplate('login')->errors($message);
     }
     //-----------------------------------------
     // Using an alternate log in form?
     //-----------------------------------------
     $this->han_login->checkLoginUrlRedirect();
     //-----------------------------------------
     // Extra  HTML?
     //-----------------------------------------
     $additionalForm = $this->han_login->additionalFormHTML();
     if (count($additionalForm[1])) {
         if ($additionalForm[0] == 'add') {
             $extra_form = $additionalForm[1];
             $show_form = 1;
         } else {
             $template .= $additionalForm[1];
             $show_form = 0;
         }
     }
     //-----------------------------------------
     // Continue...
     //-----------------------------------------
     if ($show_form) {
         if ($this->request['referer']) {
             $http_referrer = $this->request['referer'];
         } else {
             if (!my_getenv('HTTP_REFERER') or stripos(my_getenv('HTTP_REFERER'), $this->settings['board_url']) === false) {
                 // HTTP_REFERER isn't set when force_login is enabled
                 // This method will piece together the base url, and the querystring arguments
                 // This is not anymore secure/insecure than IPB, as IPB will have to process
                 // those arguments whether force_login is enabled or not.
                 $argv = is_array(my_getenv('argv')) && count(my_getenv('argv')) > 0 ? my_getenv('argv') : array();
                 $http_referrer = $this->settings['base_url'] . @implode("&amp;", $argv);
             } else {
                 $http_referrer = my_getenv('HTTP_REFERER');
             }
         }
         $facebookOpts = array();
         $login_methods = false;
         $uses_name = false;
         $uses_email = false;
         foreach ($this->cache->getCache('login_methods') as $method) {
             $login_methods[$method['login_folder_name']] = $method['login_folder_name'];
             if ($method['login_user_id'] == 'username') {
                 $uses_name = true;
             }
             if ($method['login_user_id'] == 'email') {
                 $uses_email = true;
             }
         }
         if ($uses_name and $uses_email) {
             $this->lang->words['enter_name'] = $this->lang->words['enter_name_and_email'];
         } else {
             if ($uses_email) {
                 $this->lang->words['enter_name'] = $this->lang->words['enter_useremail'];
             } else {
                 $this->lang->words['enter_name'] = $this->lang->words['enter_username'];
             }
         }
         $template .= $this->registry->getClass('output')->getTemplate('login')->showLogInForm($this->lang->words['please_log_in'], htmlentities(urldecode($http_referrer)), $extra_form, $login_methods, $facebookOpts);
     }
     /* Work around for bug http://bugs.developers.facebook.com/show_bug.cgi?id=3237 */
     if (IPSLib::fbc_enabled()) {
         $this->_facebook->testConnectSession();
     }
     $this->registry->getClass('output')->addNavigation($this->lang->words['log_in'], '');
     $this->registry->getClass('output')->setTitle($this->lang->words['log_in']);
     $this->registry->getClass('output')->addContent($template);
     $this->registry->getClass('output')->sendOutput();
 }
開發者ID:dalandis,項目名稱:Visualization-of-Cell-Phone-Locations,代碼行數:99,代碼來源:login.php

示例7: 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 .= '&reg=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&section=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));
//.........這裏部分代碼省略.........
開發者ID:Advanture,項目名稱:Online-RolePlay,代碼行數:101,代碼來源:connect.php


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