本文整理匯總了PHP中IPSText::checkEmailAddress方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::checkEmailAddress方法的具體用法?PHP IPSText::checkEmailAddress怎麽用?PHP IPSText::checkEmailAddress使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::checkEmailAddress方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkEmail
/**
* Check the email address
*
* @return @e void [Outputs to screen]
*/
public function checkEmail()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$email = '';
$banfilters = array();
if (is_string($_REQUEST['email'])) {
$email = strtolower(IPSText::parseCleanValue(rawurldecode($_REQUEST['email'])));
}
if (!$email) {
$this->returnString('found');
}
if (!IPSText::checkEmailAddress($email)) {
$this->returnString('found');
}
//-----------------------------------------
// Got the member?
//-----------------------------------------
if (!IPSMember::checkByEmail($email)) {
//-----------------------------------------
// Load ban filters
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'banfilters'));
$this->DB->execute();
while ($r = $this->DB->fetch()) {
$banfilters[$r['ban_type']][] = $r['ban_content'];
}
//-----------------------------------------
// Are they banned [EMAIL]?
//-----------------------------------------
if (is_array($banfilters['email']) and count($banfilters['email'])) {
foreach ($banfilters['email'] as $memail) {
$memail = str_replace("*", '.*', preg_quote($memail, "/"));
if (preg_match("/^{$memail}\$/", $email)) {
$this->returnString('banned');
break;
}
}
}
//-----------------------------------------
// Load handler...
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
$han_login = new $classToLoad($this->registry);
$han_login->init();
$han_login->emailExistsCheck($email);
if ($han_login->return_code and $han_login->return_code != 'METHOD_NOT_DEFINED' and $han_login->return_code != 'EMAIL_NOT_IN_USE') {
$this->returnString('found');
}
$this->returnString('notfound');
} else {
$this->returnString('found');
}
}
示例2: doExecute
/**
* Execute selected method
*
* @access public
* @param object Registry object
* @return @e void
*/
public function doExecute(ipsRegistry $registry)
{
$_e = 0;
/* Check input? */
if ($this->request['do'] == 'check') {
if (!$this->request['username']) {
$_e = 1;
$this->registry->output->addWarning('Необходимо указать отображаемое имя пользователя');
}
if (!$this->request['password']) {
$_e = 1;
$this->registry->output->addWarning('Необходимо ввести пароль');
} else {
if ($this->request['password'] != $this->request['confirm_password']) {
$_e = 1;
$this->registry->output->addWarning('Введенные пароли не совпадают');
}
}
if (!$this->request['email'] or IPSText::checkEmailAddress($this->request['email']) !== TRUE) {
$_e = 1;
$this->registry->output->addWarning('Необходимо указать Email');
}
if ($_e) {
$this->registry->output->setTitle("Администратор: Ошибка");
$this->registry->output->setNextAction('admin&do=check');
$this->registry->output->addContent($this->registry->output->template()->page_admin());
$this->registry->output->sendOutput();
} else {
/* Save Form Data */
IPSSetUp::setSavedData('admin_user', $this->request['username']);
IPSSetUp::setSavedData('admin_pass', $this->request['password']);
IPSSetUp::setSavedData('admin_email', $this->request['email']);
/* Next Action */
$this->registry->autoLoadNextAction('install');
return;
}
}
/* Output */
$this->registry->output->setTitle("Создание учетной записи администратора");
$this->registry->output->setNextAction('admin&do=check');
$this->registry->output->addContent($this->registry->output->template()->page_admin());
$this->registry->output->sendOutput();
}
示例3: 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;
//.........這裏部分代碼省略.........
示例4: authenticateLogIn
/**
* Authenticate log in
*
* @access public
* @param string Username (from $this->request)
* @param string Password (from $this->request)
* @return mixed TRUE if successful, string (message) if not
*/
public function authenticateLogIn($username, $password)
{
require_once IPS_ROOT_PATH . 'sources/handlers/han_login.php';
$han_login = new han_login($this->registry);
$han_login->is_admin_auth = 1;
$han_login->init();
$email = '';
/* Is this a username or email address? */
if (IPSText::checkEmailAddress($username)) {
$email = $username;
$username = '';
}
$han_login->loginAuthenticate($username, $email, $password);
$mem = $han_login->member_data;
if (!$mem['member_id'] or $han_login->return_code == 'NO_USER') {
return 'No user found by that sign in name';
}
if ($han_login->return_code == 'NO_ACCESS') {
return 'You do not have access to the upgrade system';
} else {
if ($han_login->return_code != 'SUCCESS') {
return 'Password or sign in name incorrect';
}
}
/* Test seconday groups */
$mem = ipsRegistry::member()->setUpSecondaryGroups($mem);
if ($mem['g_access_cp'] != 1) {
return 'You do not have access to the upgrade system';
}
/* Set up _member */
$this->loadMemberData($mem['member_id']);
/* Still here? */
return TRUE;
}
示例5: 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 {
//.........這裏部分代碼省略.........
示例6: verifyLogin
/**
* Wrapper for loginAuthenticate - returns more information
*
* @access public
* @return mixed array [0=Words to show, 1=URL to send to, 2=error message language key]
*/
public function verifyLogin()
{
$url = "";
$member = array();
$username = '';
$email = '';
$password = trim($this->request['password']);
$errors = '';
$core = array();
//-----------------------------------------
// Is this a username or email address?
//-----------------------------------------
if (IPSText::checkEmailAddress($this->request['username'])) {
$email = $this->request['username'];
} else {
$username = $this->request['username'];
}
//-----------------------------------------
// Check auth
//-----------------------------------------
$this->loginAuthenticate($username, $email, $password);
$member = $this->member_data;
//-----------------------------------------
// Check return code...
//-----------------------------------------
if ($this->return_code != 'SUCCESS') {
if ($this->return_code == 'MISSING_DATA') {
return array(null, null, 'complete_form');
}
if ($this->return_code == 'ACCOUNT_LOCKED') {
$extra = "<!-- -->";
if ($this->settings['ipb_bruteforce_unlock']) {
if ($this->account_unlock) {
$time = time() - $this->account_unlock;
$time = $this->settings['ipb_bruteforce_period'] - ceil($time / 60) > 0 ? $this->settings['ipb_bruteforce_period'] - ceil($time / 60) : 1;
}
}
return array(null, null, 'bruteforce_account_unlock', $time);
} else {
if ($this->return_code == 'WRONG_OPENID') {
return array(null, null, 'wrong_openid');
} else {
if ($this->return_code == 'FLAGGED_REMOTE') {
return array(null, null, 'flagged_remote');
} else {
return array(null, null, 'wrong_auth');
}
}
}
}
//-----------------------------------------
// Is this a partial member?
// Not completed their sign in?
//-----------------------------------------
if ($member['members_created_remote'] and isset($member['full']) and !$member['full']) {
return array($this->lang->words['partial_login'], $this->settings['base_url'] . 'app=core&module=global&section=register&do=complete_login&mid=' . $member['member_id'] . '&key=' . $member['timenow']);
}
//-----------------------------------------
// Generate a new log in key
//-----------------------------------------
$_ok = 1;
$_time = $this->settings['login_key_expire'] ? time() + intval($this->settings['login_key_expire']) * 86400 : 0;
$_sticky = $_time ? 0 : 1;
$_days = $_time ? $this->settings['login_key_expire'] : 365;
if ($this->settings['login_change_key'] or !$member['member_login_key'] or $this->settings['login_key_expire'] and time() > $member['member_login_key_expire']) {
$member['member_login_key'] = IPSMember::generateAutoLoginKey();
$core['member_login_key'] = $member['member_login_key'];
$core['member_login_key_expire'] = $_time;
}
//-----------------------------------------
// Cookie me softly?
//-----------------------------------------
if ($this->request['rememberMe']) {
IPSCookie::set("member_id", $member['member_id'], 1);
IPSCookie::set("pass_hash", $member['member_login_key'], $_sticky, $_days);
} else {
IPSCookie::set("member_id", $member['member_id'], 0);
IPSCookie::set("pass_hash", $member['member_login_key'], 0);
}
//-----------------------------------------
// Remove any COPPA cookies previously set
//-----------------------------------------
IPSCookie::set("coppa", '0', 0);
//-----------------------------------------
// Update profile if IP addr missing
//-----------------------------------------
if ($member['ip_address'] == "" or $member['ip_address'] == '127.0.0.1') {
$core['ip_address'] = $this->member->ip_address;
}
//-----------------------------------------
// Create / Update session
//-----------------------------------------
$privacy = $this->request['anonymous'] ? 1 : 0;
if ($member['g_hide_online_list']) {
//.........這裏部分代碼省略.........
示例7: verifyLogin
/**
* Wrapper for loginAuthenticate - returns more information
*
* @return mixed array [0=Words to show, 1=URL to send to, 2=error message language key]
*/
public function verifyLogin()
{
$url = "";
$member = array();
$username = '';
$email = '';
$password = trim($this->request['ips_password']);
$errors = '';
$core = array();
$mobileSSO = false;
$memberData = $this->registry->member()->fetchMemberData();
/* Mobile app + sso */
if ($memberData['userAgentType'] == 'mobileApp') {
$file = IPS_ROOT_PATH . 'sources/classes/session/ssoMobileAppLogIn.php';
if (is_file($file)) {
require_once $file;
if (class_exists('ssoMobileAppLogIn')) {
$mobileSSO = true;
$logIn = new ssoMobileAppLogIn($this->registry);
$done = $logIn->authenticate($this->request['ips_username'], $password);
$this->return_code = $done['code'];
$this->member_data = IPSMember::load(intval($done['memberId']));
$member = $this->member_data;
}
}
}
/* No mobile log in? Log in normally */
if (!$mobileSSO) {
//-----------------------------------------
// Is this a username or email address?
//-----------------------------------------
if (IPSText::checkEmailAddress($this->request['ips_username'])) {
$email = $this->request['ips_username'];
} else {
$username = $this->request['ips_username'];
}
//-----------------------------------------
// Check auth
//-----------------------------------------
$this->loginAuthenticate($username, $email, $password);
$member = $this->member_data;
}
//-----------------------------------------
// Check return code...
//-----------------------------------------
if ($this->return_code != 'SUCCESS') {
if ($this->return_code == 'MISSING_DATA') {
return array(null, null, 'complete_form');
}
if ($this->return_code == 'ACCOUNT_LOCKED') {
$extra = "<!-- -->";
if ($this->settings['ipb_bruteforce_unlock']) {
if ($this->account_unlock) {
$time = time() - $this->account_unlock;
$time = $this->settings['ipb_bruteforce_period'] - ceil($time / 60) > 0 ? $this->settings['ipb_bruteforce_period'] - ceil($time / 60) : 1;
}
}
return array(null, null, $this->settings['ipb_bruteforce_unlock'] ? 'bruteforce_account_unlock' : 'bruteforce_account_lock', $time);
} else {
if ($this->return_code == 'MISSING_EXTENSIONS') {
return array(null, null, 'missing_extensions');
} else {
if ($this->return_code == 'FLAGGED_REMOTE') {
return array(null, null, 'flagged_remote');
} else {
if ($this->return_code == 'VALIDATING') {
if ($this->revalidate_url == 'ADMIN_VALIDATION') {
return array(null, null, 'validating_remote', ipsRegistry::getClass('class_localization')->words['admin_validation_msg']);
} else {
return array(null, null, 'validating_remote', "<a href='{$this->revalidate_url}' target='_blank'>" . ipsRegistry::getClass('class_localization')->words['resend_val'] . "</a>");
}
} else {
return array(null, null, 'wrong_auth');
}
}
}
}
}
//-----------------------------------------
// Is this a partial member?
// Not completed their sign in?
//-----------------------------------------
if ($member['members_created_remote'] and isset($member['full']) and !$member['full']) {
return array($this->registry->getClass('class_localization')->words['partial_login'], $this->settings['base_url'] . 'app=core&module=global&section=register&do=complete_login&mid=' . $member['member_id'] . '&key=' . $member['timenow']);
}
//-----------------------------------------
// Generate a new log in key
//-----------------------------------------
$_ok = 1;
$_time = $this->settings['login_key_expire'] ? time() + intval($this->settings['login_key_expire']) * 86400 : 0;
$_sticky = $_time ? 0 : 1;
$_days = $_time ? $this->settings['login_key_expire'] : 365;
if (!$member['member_login_key'] or $this->settings['login_key_expire'] and time() > $member['member_login_key_expire']) {
$member['member_login_key'] = IPSMember::generateAutoLoginKey();
$core['member_login_key'] = $member['member_login_key'];
//.........這裏部分代碼省略.........
示例8: loginComplete
/**
* Check and verify the login was successful
*
* @access public
* @return void
*/
public function loginComplete()
{
//-----------------------------------------
// Check form details.
//-----------------------------------------
$this->request['email'] = str_replace('|', '|', $this->request['email']);
$username = '';
$email = '';
//-----------------------------------------
// Is this a username or email address?
//-----------------------------------------
if (IPSText::checkEmailAddress($this->request['username'])) {
$email = $this->request['username'];
} else {
$username = $this->request['username'];
}
//-----------------------------------------
// Check auth
//-----------------------------------------
$this->han_login->loginAuthenticate($username, $email, trim($this->request['password']));
//-----------------------------------------
// Check return code...
//-----------------------------------------
$mem = $this->han_login->member_data;
if (!$mem['member_id'] or $this->han_login->return_code == 'NO_USER') {
$this->_writeToLog($this->request['username'], 'fail');
$this->loginForm($this->lang->words['bad_email_password']);
}
if ($this->han_login->return_code == 'NO_ACCESS') {
$this->_writeToLog($this->request['username'], 'fail');
$this->loginForm($this->lang->words['no_acp_access']);
} else {
if ($this->han_login->return_code != 'SUCCESS') {
$this->_writeToLog($this->request['username'], 'fail');
$this->loginForm($this->lang->words['bad_email_password']);
}
}
//-----------------------------------------
// And sort secondary groups...
//-----------------------------------------
$mem = $this->member->setUpSecondaryGroups($mem);
//-----------------------------------------
// Check access...
//-----------------------------------------
if ($mem['g_access_cp'] != 1) {
$this->_writeToLog($this->request['username'], 'fail');
$this->loginForm($this->lang->words['no_acp_access']);
} else {
//-----------------------------------------
// Fix up query string...
//-----------------------------------------
$extra_query = "";
if ($_POST['qstring']) {
$extra_query = stripslashes($_POST['qstring']);
$extra_query = str_replace($this->settings['_original_base_url'], "", $extra_query);
$extra_query = str_ireplace("?index." . $this->settings['php_ext'], "", $extra_query);
$extra_query = ltrim($extra_query, '?');
$extra_query = preg_replace("!adsess=(\\w){32}!", "", $extra_query);
$extra_query = str_replace("adsess=x", "", $extra_query);
$extra_query = str_replace(array('old_&', 'old_&'), "", $extra_query);
$extra_query = preg_replace("!s=(\\w){32}!", "", $extra_query);
$extra_query = str_replace("module=login", "", $extra_query);
$extra_query = str_replace("do=login-complete", "", $extra_query);
$extra_query = str_replace("/admin", "", $extra_query);
$extra_query = str_replace('&', '&', $extra_query);
$extra_query = preg_replace("#&{1,}#", "&", $extra_query);
}
//-----------------------------------------
// Insert session
//-----------------------------------------
$sess_id = md5(uniqid(microtime()));
$this->DB->delete('core_sys_cp_sessions', 'session_member_id=' . $mem['member_id']);
/* Grab user agent */
$uAgent = array();
$this->DB->insert('core_sys_cp_sessions', array('session_id' => $sess_id, 'session_ip_address' => $this->member->ip_address, 'session_member_name' => $mem['members_display_name'], 'session_member_id' => $mem['member_id'], 'session_member_login_key' => $mem['member_login_key'], 'session_location' => 'index', 'session_log_in_time' => time(), 'session_running_time' => time(), 'session_app_data' => serialize($uAgent), 'session_url' => ''));
$this->request['adsess'] = $sess_id;
//-----------------------------------------
// Redirect...
//-----------------------------------------
$url = $this->settings['_original_base_url'] . '/' . CP_DIRECTORY . '/index.php?adsess=' . $sess_id . '&' . $extra_query;
$this->_writeToLog($this->request['username'], 'ok');
ipsRegistry::getClass('output')->redirect($url, $this->lang->words['login_successful']);
}
}
示例9: saveFormEmailPassword
/**
* UserCP Save Form: Email Address
*
* @return mixed Array of errors / boolean true
*/
public function saveFormEmailPassword()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$_emailOne = strtolower(trim($this->request['in_email_1']));
$_emailTwo = strtolower(trim($this->request['in_email_2']));
$cur_pass = trim($this->request['current_pass']);
$new_pass = trim($this->request['new_pass_1']);
$chk_pass = trim($this->request['new_pass_2']);
$isRemote = (!$this->memberData['bw_local_password_set'] and $this->memberData['members_created_remote']) ? true : false;
if ($cur_pass or $new_pass) {
if ($this->memberData['g_access_cp']) {
return array(0 => $this->lang->words['admin_emailpassword']);
}
if ($isRemote === false and (!$_POST['current_pass'] or empty($new_pass) or empty($chk_pass))) {
return array(0 => $this->lang->words['complete_entire_form']);
}
//-----------------------------------------
// Do the passwords actually match?
//-----------------------------------------
if ($new_pass != $chk_pass) {
return array(0 => $this->lang->words['passwords_not_matchy']);
}
//-----------------------------------------
// Check password...
//-----------------------------------------
if ($isRemote === false) {
if ($this->_checkPassword($cur_pass) !== TRUE) {
return array(0 => $this->lang->words['current_pw_bad']);
}
} else {
/* This is INIT in _checkPassword */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
$this->han_login = new $classToLoad($this->registry);
$this->han_login->init();
}
//-----------------------------------------
// Create new password...
//-----------------------------------------
$md5_pass = md5($new_pass);
//-----------------------------------------
// han_login was loaded during check_password
//-----------------------------------------
$this->han_login->changePass($this->memberData['email'], $md5_pass, $new_pass, $this->memberData);
if ($this->han_login->return_code and $this->han_login->return_code != 'METHOD_NOT_DEFINED' and $this->han_login->return_code != 'SUCCESS') {
return array(0 => $this->lang->words['hanlogin_pw_failed']);
}
//-----------------------------------------
// Update the DB
//-----------------------------------------
IPSMember::updatePassword($this->memberData['email'], $md5_pass);
IPSLib::runMemberSync('onPassChange', $this->memberData['member_id'], $new_pass);
//-----------------------------------------
// Update members log in key...
//-----------------------------------------
$key = IPSMember::generateAutoLoginKey();
IPSMember::save($this->memberData['member_id'], array('core' => array('member_login_key' => $key, 'bw_local_password_set' => 1)));
$this->ok_message = $this->lang->words['pw_change_successful'];
}
if ($_emailOne or $_emailTwo) {
//-----------------------------------------
// Do not allow validating members to change
// email when admin validation is on
// @see http://community.invisionpower.com/tracker/issue-19964-loophole-in-registration-procedure/
//-----------------------------------------
if ($this->memberData['member_group_id'] == $this->settings['auth_group'] and in_array($this->settings['reg_auth_type'], array('admin', 'admin_user'))) {
$this->registry->output->showError($this->lang->words['admin_val_no_email_chg'], 10190);
}
//-----------------------------------------
// Check input
//-----------------------------------------
if ($this->memberData['g_access_cp']) {
return array(0 => $this->lang->words['admin_emailpassword']);
}
if (!$_POST['in_email_1'] or !$_POST['in_email_2']) {
return array(0 => $this->lang->words['complete_entire_form']);
}
//-----------------------------------------
// Check password...
//-----------------------------------------
if (!$this->_isFBUser) {
if ($this->_checkPassword($this->request['password']) === FALSE) {
return array(0 => $this->lang->words['current_pw_bad']);
}
}
//-----------------------------------------
// Test email addresses
//-----------------------------------------
if ($_emailOne != $_emailTwo) {
return array(0 => $this->lang->words['emails_no_matchy']);
}
if (IPSText::checkEmailAddress($_emailOne) !== TRUE) {
return array(0 => $this->lang->words['email_not_valid']);
}
//.........這裏部分代碼省略.........
示例10: _sendEmail
/**
* Forward the page (sends the email)
*
* @access private
* @return void [Outputs to screen/redirects]
*/
private function _sendEmail()
{
//-----------------------------------------
// Check
//-----------------------------------------
if ($this->request['k'] != $this->member->form_hash) {
$this->registry->getClass('output')->showError('no_permission', 2029);
}
$lang_to_use = 1;
foreach (ipsRegistry::cache()->getCache('lang_data') as $l) {
if ($this->request['lang'] == $l['lang_id']) {
$lang_to_use = $l['lang_id'];
}
}
$check_array = array('to_name' => 'stf_no_name', 'to_email' => 'stf_no_email', 'message' => 'stf_no_msg', 'subject' => 'stf_no_subject');
foreach ($check_array as $input => $msg) {
if (!$this->request[$input]) {
$this->registry->output->showError($msg, 10325);
}
}
if (!IPSText::checkEmailAddress($this->request['to_email'])) {
$this->registry->output->showError('email_address_invalid', 10326);
}
IPSText::getTextClass('email')->getTemplate("forward_page", $lang_to_use);
IPSText::getTextClass('email')->buildMessage(array('THE_MESSAGE' => $this->request['message'], 'TO_NAME' => $this->request['to_name'], 'FROM_NAME' => $this->memberData['members_display_name']));
IPSText::getTextClass('email')->subject = $this->request['subject'];
IPSText::getTextClass('email')->to = $this->request['to_email'];
IPSText::getTextClass('email')->from = $this->memberData['email'];
IPSText::getTextClass('email')->sendMail();
$this->registry->output->redirectScreen($this->lang->words['redirect'], $this->settings['base_url'] . "showtopic=" . $this->topic['tid'] . "&st=" . $this->request['st']);
}
示例11: _memberDoAdd
/**
* Add a member [process]
*
* @return @e void
*/
protected function _memberDoAdd()
{
/* Init vars */
$in_username = trim($this->request['name']);
$in_password = trim($this->request['password']);
$in_email = trim(strtolower($this->request['email']));
$members_display_name = $this->request['mirror_loginname'] ? $in_username : trim($this->request['members_display_name']);
$this->registry->output->global_error = '';
$this->registry->class_localization->loadLanguageFile(array('public_register'), 'core');
/* Check erros */
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_error = $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'])) {
$_message = $this->lang->words[$userName['errors']['username']] ? $this->lang->words[$userName['errors']['username']] : $userName['errors']['username'];
$this->registry->output->global_error .= '<p>' . $this->lang->words['sm_loginname'] . ': ' . $_message . '</p>';
}
if ($this->settings['auth_allow_dnames'] and count($displayName['errors'])) {
$_message = $this->lang->words[$displayName['errors']['dname']] ? $this->lang->words[$displayName['errors']['dname']] : $displayName['errors']['dname'];
$this->registry->output->global_error .= '<p>' . $this->lang->words['sm_display'] . ': ' . $_message . '</p>';
}
/* Errors? */
if ($this->registry->output->global_error) {
$this->_memberAddForm();
return;
}
//-----------------------------------------
// 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();
//-----------------------------------------
// Only check local, else a user being in Converge
// means that you can't manually add the user to the board
//-----------------------------------------
$email_check = $this->DB->buildAndFetch(array('select' => 'member_id', 'from' => 'members', 'where' => "email='" . $in_email . "'"));
if ($email_check['member_id']) {
$this->registry->output->global_error = $this->lang->words['m_emailalready'];
$this->_memberAddForm();
return;
}
//$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_error = $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, 'language' => IPSLib::getDefaultLanguage());
//-----------------------------------------
// Create the account
//-----------------------------------------
$member = IPSMember::create(array('members' => $member, 'pfields_content' => $this->request), FALSE, FALSE, FALSE);
//-----------------------------------------
// 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['member_id'], 'row_perm_cache' => $this->memberData['row_perm_cache'], 'row_updated' => time()));
}
}
//-----------------------------------------
// Send teh email (I love 'teh' as much as !!11!!1)
//.........這裏部分代碼省略.........
示例12: _saveForm
/**
* Save new email and/or pass
*
* @return @e void
*/
protected function _saveForm()
{
if (!$this->request['email'] and !$this->request['password']) {
$this->registry->output->global_error = $this->lang->words['change_nothing_update'];
$this->_showForm();
return;
}
if ($this->request['email']) {
if (!$this->request['email_confirm']) {
$this->registry->output->global_error = $this->lang->words['change_both_fields'];
$this->_showForm();
return;
} else {
if ($this->request['email'] != $this->request['email_confirm']) {
$this->registry->output->global_error = $this->lang->words['change_not_match'];
$this->_showForm();
return;
}
}
$email = trim($this->request['email']);
if (!IPSText::checkEmailAddress($email)) {
$this->registry->output->global_error = $this->lang->words['bad_email_supplied'];
$this->_showForm();
return;
}
$email_check = IPSMember::load(strtolower($email));
if ($email_check['member_id']) {
if ($email_check['member_id'] == $this->memberData['member_id']) {
$this->registry->output->global_error = $this->lang->words['already_using_email'];
} else {
$this->registry->output->global_error = $this->lang->words['change_email_already_used'];
}
$this->_showForm();
return;
}
//-----------------------------------------
// Load handler...
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
$han_login = new $classToLoad($this->registry);
$han_login->init();
$han_login->changeEmail(trim(strtolower($this->memberData['email'])), trim(strtolower($email)), $this->memberData);
IPSLib::runMemberSync('onEmailChange', $this->memberData['member_id'], strtolower($email), $this->memberData['email']);
IPSMember::save($this->memberData['member_id'], array('core' => array('email' => strtolower($email))));
ipsRegistry::getClass('adminFunctions')->saveAdminLog(sprintf($this->lang->words['changed_email'], $email));
}
if ($this->request['password']) {
if (!$this->request['password_confirm']) {
$this->registry->output->global_error = $this->lang->words['change_both_fields'];
$this->_showForm();
return;
} else {
if ($this->request['password'] != $this->request['password_confirm']) {
$this->registry->output->global_error = $this->lang->words['change_not_match_pw'];
$this->_showForm();
return;
}
}
$password = $this->request['password'];
$salt = str_replace('\\', "\\\\", IPSMember::generatePasswordSalt(5));
$key = IPSMember::generateAutoLoginKey();
$md5_once = md5(trim($password));
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
$han_login = new $classToLoad($this->registry);
$han_login->init();
$han_login->changePass($this->memberData['email'], $md5_once, $password, $this->memberData);
IPSMember::save($this->memberData['member_id'], array('core' => array('members_pass_salt' => $salt, 'member_login_key' => $key)));
IPSMember::updatePassword($this->memberData['member_id'], $md5_once);
IPSLib::runMemberSync('onPassChange', $this->memberData['member_id'], $password);
ipsRegistry::getClass('adminFunctions')->saveAdminLog($this->lang->words['changed_password']);
}
$this->registry->output->global_message = $this->lang->words['details_updated'];
$this->registry->output->silentRedirectWithMessage($this->settings['base_url']);
}
示例13: authenticateLogIn
/**
* Authenticate log in
*
* @access public
* @param string Username (from $this->request)
* @param string Password (from $this->request)
* @return mixed TRUE if successful, string (message) if not
*/
public function authenticateLogIn($username, $password)
{
require_once IPS_ROOT_PATH . 'sources/handlers/han_login.php';
/*noLibHook*/
$han_login = new han_login($this->registry);
$han_login->is_admin_auth = 1;
$han_login->init();
$email = '';
/* Is this a username or email address? */
if (IPSText::checkEmailAddress($username)) {
$email = $username;
$username = '';
}
$han_login->loginAuthenticate($username, $email, $password);
$mem = $han_login->member_data;
if (!$mem['member_id'] or $han_login->return_code == 'NO_USER') {
return 'Пользователь не найден';
}
if ($han_login->return_code == 'NO_ACCESS') {
return 'У вас нет доступа к системе обновления';
} else {
if ($han_login->return_code != 'SUCCESS') {
return 'Имя пользователя или пароль неверны';
}
}
/* Test seconday groups */
$mem = ipsRegistry::member()->setUpSecondaryGroups($mem);
if ($mem['g_access_cp'] != 1) {
return 'У вас нет доступа к системе обновления';
}
/* Set up _member */
$this->loadMemberData($mem['member_id']);
/* Still here? */
return TRUE;
}
示例14: _processEventObject
/**
* Parse event object in an ical feed
*
* @param int $start Line number
* @return @e void
* @link http://community.invisionpower.com/resources/bugs.html/_/ip-calendar/recurring-events-can-sometimes-be-skipped-in-ics-r41033
*/
protected function _processEventObject($start)
{
//-----------------------------------------
// Init
//-----------------------------------------
$_break = false;
$_event = array();
//-----------------------------------------
// Loop over lines
//-----------------------------------------
$_recid = null;
for ($i = $start, $j = count($this->_rawIcsData); $i < $j; $i++) {
//-----------------------------------------
// Unparse and get the data
//-----------------------------------------
$tmp = $this->_unparseContent($this->_rawIcsData[$i], $i);
if (!$tmp) {
continue;
}
$_type = $tmp['type'];
$_data = $tmp['data'];
switch ($_type) {
case 'CLASS':
$_event['access_class'] = $_data;
break;
case 'CREATED':
if (!$_event['created']) {
$_event['created'] = strtotime($_data);
}
break;
case 'SUMMARY':
/* @link http://community.invisionpower.com/tracker/issue-32941-ical-summary/ */
if (strpos($_data, 'LANGUAGE=') === 0) {
$_data = preg_replace("/^LANGUAGE=(.+?):(.+?)\$/i", "\\2", $_data);
}
$_event['summary'] = $this->_unencodeSpecialCharacters($_data);
break;
case 'DESCRIPTION':
$_event['description'] = $this->_unencodeSpecialCharacters($_data);
break;
case 'DURATION':
$_event['duration'] = $_data;
break;
case 'DTSTART':
$_event['start'] = $this->_unparseTimeInfo($this->_rawIcsData[$i]);
break;
case 'DTEND':
$_event['end'] = $this->_unparseTimeInfo($this->_rawIcsData[$i]);
break;
case 'DTSTAMP':
$_event['created'] = strtotime($_data);
break;
case 'LAST-MODIFIED':
$_event['last_modified'] = strtotime($_data);
break;
case 'TRANSP':
$_event['time_transparent'] = $_data;
break;
case 'GEO':
$_event['geo'] = $_data;
break;
case 'ORGANIZER':
$line = explode(':', $_data);
$_event['organizer'] = array('name' => str_replace('CN=', '', $line[0]), 'email' => $line[2]);
break;
case 'ATTENDEE':
$line = explode(':', $_data);
$_email = '';
foreach ($line as $_line) {
$_line = str_replace('cn=', '', strtolower($_line));
if (IPSText::checkEmailAddress($_line)) {
$_email = $_line;
}
}
$_event['attendee'][] = array('name' => str_replace('CN=', '', $line[0]), 'email' => $_email);
break;
case 'UID':
$_event['uid'] = $_data;
break;
case 'STATUS':
$_event['status'] = $_data;
break;
case 'LOCATION':
$_event['location'] = $_data;
break;
case 'SEQUENCE':
$_event['sequence'] = intval($_data);
break;
case 'RRULE':
$_event['recurr'] = $_event['recurr'] ? $_event['recurr'] : array();
$_event['recurr'] = array_merge($_event['recurr'], $this->_getRecurrenceData($_data));
break;
case 'BEGIN':
//.........這裏部分代碼省略.........
示例15: _sendEmail
/**
* Forward the page (sends the email)
*
* @return @e void [Outputs to screen/redirects]
*/
protected function _sendEmail()
{
//-----------------------------------------
// Check
//-----------------------------------------
if ($this->request['k'] != $this->member->form_hash) {
$this->registry->getClass('output')->showError('no_permission', 2029, null, null, 403);
}
/* Check the CAPTCHA */
if ($this->settings['bot_antispam_type'] != 'none') {
if ($this->registry->getClass('class_captcha')->validate() !== TRUE) {
return $this->_showForm('err_reg_code');
}
}
$lang_to_use = '';
foreach (ipsRegistry::cache()->getCache('lang_data') as $l) {
if ($this->request['lang'] == $l['lang_id']) {
$lang_to_use = $l['lang_id'];
}
}
$check_array = array('to_name' => 'stf_no_name', 'to_email' => 'stf_no_email', 'message' => 'stf_no_msg', 'subject' => 'stf_no_subject');
foreach ($check_array as $input => $msg) {
if (!$this->request[$input]) {
$this->registry->output->showError($msg, 10325);
}
}
if (!IPSText::checkEmailAddress($this->request['to_email'])) {
$this->registry->output->showError('email_address_invalid', 10326);
}
IPSText::getTextClass('email')->getTemplate("forward_page", $lang_to_use);
IPSText::getTextClass('email')->buildMessage(array('THE_MESSAGE' => $this->request['message'], 'TO_NAME' => $this->request['to_name'], 'FROM_NAME' => $this->memberData['members_display_name']));
IPSText::getTextClass('email')->subject = $this->request['subject'];
IPSText::getTextClass('email')->to = $this->request['to_email'];
IPSText::getTextClass('email')->from = $this->memberData['email'];
IPSText::getTextClass('email')->sendMail();
$this->registry->output->redirectScreen($this->lang->words['redirect'], $this->page['url']);
}