4 define(
'USER_LOGIN_SUCCESS', 1 );
5 define(
'USER_LOGIN_FAIL', 2 );
6 define(
'USER_LOGOUT', 3 );
78 $this->_blActiveLogin = $blActiveLogin;
104 if (!isset($blShow)) {
112 if ( $this->
getConfig()->getConfigParam(
'blInvitationsEnabled' ) ) {
159 if ( $this->
getParent()->isEnabledPrivateSales() ) {
162 $sClass = $this->
getParent()->getClassName();
165 if ( !$oUser && !in_array( $sClass, $this->_aAllowedClasses ) ) {
169 if ( $oUser && !$oUser->isTermsAccepted() && !in_array( $sClass, $this->_aAllowedClasses ) ) {
170 oxRegistry::getUtils()->redirect( $oConfig->getShopHomeURL() .
'cl=account&term=1',
false, 302 );
191 if ( $oUser->inGroup(
'oxidblocked' ) ) {
196 if ( $oUser->isLoadedFromCookie() && !
$myConfig->getConfigParam(
'blPerfNoBasketSaving' )) {
198 if ( $oBasket = $this->
getSession()->getBasket() ) {
200 $oBasket->onUpdate();
229 $oUser =
oxNew(
'oxuser' );
230 $oUser->login( $sUser, $sPassword, $sCookie );
234 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay( $oEx,
false,
true,
'',
false );
267 $oSession->regenerateSessionId();
273 if ( $oUser->inGroup(
'oxidblocked' ) ) {
281 if ( $oBasket = $oSession->getBasket() ) {
282 $oBasket->onUpdate();
299 if ( $this->
getParent()->isEnabledPrivateSales() && $blAgb !== null && ( $oUser = $this->
getUser() ) ) {
301 $oUser->acceptTerms();
306 if ( !$this->
isAdmin() && !$this->
getConfig()->getConfigParam(
'blPerfNoBasketSaving' )) {
309 if ( $oBasket = $this->
getSession()->getBasket() ) {
331 if ( $oUser = $this->
getUser() ) {
333 if ( $oUser->updateFbId() ) {
355 if ( ( $oBasket = $this->
getSession()->getBasket() ) ) {
356 $oBasket->resetUserInfo();
357 $oBasket->onUpdate();
374 $oUser =
oxNew(
'oxuser' );
376 if ( $oUser->logout() ) {
384 if ( $this->
getParent()->isEnabledPrivateSales() ) {
408 if ( $blUserRegistered ===
true ) {
411 return $blUserRegistered;
428 return 'account_user';
455 $blActiveLogin = $this->
getParent()->isEnabledPrivateSales();
460 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay(
'READ_AND_CONFIRM_TERMS',
false,
true );
481 $oUser =
oxNew(
'oxuser' );
485 $oUser->checkValues( $sUser, $sPassword, $sPassword2, $aInvAdress, $aDelAdress );
487 $iActState = $blActiveLogin ? 0 : 1;
491 $oUser->setPassword( $sPassword );
495 $iSubscriptionStatus = $oUser->getNewsSubscription()->getOptInStatus();
497 $oUser->createUser();
498 $oUser->load($oUser->getId());
499 $oUser->changeUserData( $oUser->oxuser__oxusername->value, $sPassword, $sPassword, $aInvAdress, $aDelAdress );
501 if ( $blActiveLogin ) {
503 $oUser->acceptTerms();
508 if ( $this->
getConfig()->getConfigParam(
'blInvitationsEnabled' ) && $sUserId && $sRecEmail ) {
510 $oUser->setCreditPointsForRegistrant( $sUserId, $sRecEmail );
515 if ( $blOptin && $iSubscriptionStatus == 1 ) {
517 $oUser->getNewsSubscription()->setOptInStatus(1);
518 $oUser->addToGroup(
'oxidnewsletter' );
519 $this->_blNewsSubscriptionStatus = 1;
521 $this->_blNewsSubscriptionStatus = $oUser->setNewsSubscription( $blOptin, $this->
getConfig()->getConfigParam(
'blOrderOptInEmail' ) );
524 $oUser->addToGroup(
'oxidnotyetordered' );
529 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay( $oEx,
false,
true );
532 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay( $oEx,
false,
true );
535 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay( $oEx,
false,
true );
546 $this->_blIsNewUser =
true;
548 $sAction =
'payment?new_user=1&success=1';
549 if ($this->_blNewsSubscriptionStatus !== null && !$this->_blNewsSubscriptionStatus) {
550 $sAction =
'payment?new_user=1&success=1&newslettererror=4';
564 if ( $this->createuser()!=
false && $this->_blIsNewUser ) {
565 if ( $this->_blNewsSubscriptionStatus === null || $this->_blNewsSubscriptionStatus ) {
566 return 'register?success=1';
568 return 'register?success=1&newslettererror=4';
591 if (!$this->
getSession()->checkSessionChallenge()) {
609 $sUserName = $oUser->oxuser__oxusername->value;
610 $sPassword = $sPassword2 = $oUser->oxuser__oxpassword->value;
613 $oUser->changeUserData( $sUserName, $sPassword, $sPassword2, $aInvAdress, $aDelAdress );
616 $blOptin = $oUser->getNewsSubscription()->getOptInStatus();
619 $blForceCheckOptIn = ( $aInvAdress[
'oxuser__oxusername'] !== null && $aInvAdress[
'oxuser__oxusername'] !== $sUserName );
620 $this->_blNewsSubscriptionStatus = $oUser->setNewsSubscription( $blOptin, $this->
getConfig()->getConfigParam(
'blOrderOptInEmail' ), $blForceCheckOptIn );
629 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false,
true,
'input_not_all_fields');
641 if ( $sOrderRemark ) {
647 if ( $oBasket = $this->
getSession()->getBasket() ) {
648 $oBasket->onUpdate();
662 if (is_array($aBillingAddress)) {
663 $skipFields = array(
'oxuser__oxid',
'oxid',
'oxuser__oxpoints',
'oxpoints',
'oxuser__oxboni',
'oxboni');
664 $aBillingAddress = array_diff_key($aBillingAddress, array_flip($skipFields));
666 return $aBillingAddress;
678 if (is_array($aDeliveryAddress)) {
679 $skipFields = array(
'oxaddress__oxid',
'oxid',
'oxaddress__oxuserid',
'oxuserid',
'oxaddress__oxaddressuserid',
'oxaddressuserid');
680 $aDeliveryAddress = array_diff_key($aDeliveryAddress, array_flip($skipFields));
682 return $aDeliveryAddress;
696 if ( is_array( $aDeladr ) ) {
698 if ( isset( $aDeladr[
'oxaddress__oxsal'] ) ) {
699 unset( $aDeladr[
'oxaddress__oxsal'] );
701 if ( !count( $aDeladr ) || implode(
'', $aDeladr ) ==
'' ) {
703 $aDelAdress = array();
718 $sLogoutLink = $oConfig->isSsl()? $oConfig->getShopSecureHomeUrl() : $oConfig->getShopHomeUrl();
719 $sLogoutLink .=
'cl='.$oConfig->getRequestParameter(
'cl').$this->getParent()->getDynUrlParams();
720 if ( $sParam = $oConfig->getRequestParameter(
'anid') ) {
721 $sLogoutLink .=
'&anid='.$sParam;
723 if ( $sParam = $oConfig->getRequestParameter(
'cnid') ) {
724 $sLogoutLink .=
'&cnid='.$sParam;
726 if ( $sParam = $oConfig->getRequestParameter(
'mnid') ) {
727 $sLogoutLink .=
'&mnid='.$sParam;
729 if ( $sParam = $oConfig->getRequestParameter(
'tpl') ) {
730 $sLogoutLink .=
'&tpl='.$sParam;
732 if ( $sParam = $oConfig->getRequestParameter(
'oxloadid') ) {
733 $sLogoutLink .=
'&oxloadid='.$sParam;
735 if ( $sParam = $oConfig->getRequestParameter(
'recommid') ) {
736 $sLogoutLink .=
'&recommid='.$sParam;
738 return $sLogoutLink.
'&fnc=logout';
750 $this->_iLoginStatus = $iStatus;
802 if ( !$blActiveLogin ) {
811 if ( $sOrderRemark ) {
828 $oxEMail =
oxNew(
'oxemail' );
829 if ( $blActiveLogin ) {
830 $oxEMail->sendRegisterConfirmEmail( $oUser );
832 $oxEMail->sendRegisterEmail( $oUser );