4 define(
'USER_LOGIN_SUCCESS', 1);
5 define(
'USER_LOGIN_FAIL', 2);
6 define(
'USER_LOGOUT', 3);
112 if ($this->
getParent()->isEnabledPrivateSales()) {
115 $sClass = $this->
getParent()->getClassName();
118 if (!$oUser && !in_array($sClass, $this->_aAllowedClasses)) {
122 if ($oUser && !$oUser->isTermsAccepted() && !in_array($sClass, $this->_aAllowedClasses)) {
144 if ($oUser->inGroup(
'oxidblocked')) {
145 $sUrl =
$myConfig->getShopHomeURL() .
'cl=content&tpl=user_blocked.tpl';
150 if ($oUser->isLoadedFromCookie() && !
$myConfig->getConfigParam(
'blPerfNoBasketSaving')) {
152 if ($oBasket = $this->
getSession()->getBasket()) {
154 $oBasket->onUpdate();
184 $oUser =
oxNew(
'oxuser');
185 $oUser->login($sUser, $sPassword, $sCookie);
189 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false,
true,
'',
false);
223 $oSession->regenerateSessionId();
229 if ($oUser->inGroup(
'oxidblocked')) {
230 $sUrl =
$myConfig->getShopHomeURL() .
'cl=content&tpl=user_blocked.tpl';
235 if ($oBasket = $oSession->getBasket()) {
236 $oBasket->onUpdate();
251 if ($this->
getParent()->isEnabledPrivateSales() && $blAgb !== null && ($oUser = $this->
getUser())) {
253 $oUser->acceptTerms();
258 if (!$this->
isAdmin() && !$this->
getConfig()->getConfigParam(
'blPerfNoBasketSaving')) {
261 if ($oBasket = $this->
getSession()->getBasket()) {
283 if ($oUser = $this->
getUser()) {
285 if ($oUser->updateFbId()) {
305 if (($oBasket = $this->
getSession()->getBasket())) {
306 $oBasket->resetUserInfo();
307 $oBasket->onUpdate();
324 $oUser =
oxNew(
'oxuser');
326 if ($oUser->logout()) {
334 if ($this->
getParent()->isEnabledPrivateSales()) {
358 if ($blUserRegistered ===
true) {
361 return $blUserRegistered;
378 return 'account_user';
404 $blActiveLogin = $this->
getParent()->isEnabledPrivateSales();
408 if ($blActiveLogin && !$oConfig->getRequestParameter(
'ord_agb') && $oConfig->getConfigParam(
'blConfirmAGB')) {
409 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay(
'READ_AND_CONFIRM_TERMS',
false,
true);
415 $sUser = $oConfig->getRequestParameter(
'lgn_usr');
418 $sPassword = $oConfig->getRequestParameter(
'lgn_pwd',
true);
421 $sPassword2 = $oConfig->getRequestParameter(
'lgn_pwd2',
true);
423 $aInvAdress = $oConfig->getRequestParameter(
'invadr',
true);
430 $oUser =
oxNew(
'oxuser');
434 $oUser->checkValues($sUser, $sPassword, $sPassword2, $aInvAdress, $aDelAdress);
436 $iActState = $blActiveLogin ? 0 : 1;
440 $oUser->setPassword($sPassword);
444 $iSubscriptionStatus = $oUser->getNewsSubscription()->getOptInStatus();
446 $oUser->createUser();
447 $oUser->load($oUser->getId());
448 $oUser->changeUserData($oUser->oxuser__oxusername->value, $sPassword, $sPassword, $aInvAdress, $aDelAdress);
450 if ($blActiveLogin) {
452 $oUser->acceptTerms();
457 if ($this->
getConfig()->getConfigParam(
'blInvitationsEnabled') && $sUserId && $sRecEmail) {
459 $oUser->setCreditPointsForRegistrant($sUserId, $sRecEmail);
464 if ($blOptin && $iSubscriptionStatus == 1) {
468 $oUser->getNewsSubscription()->setOptInStatus(1);
469 $oUser->addToGroup(
'oxidnewsletter');
470 $this->_blNewsSubscriptionStatus = 1;
472 $blOrderOptInEmailParam = $this->
getConfig()->getConfigParam(
'blOrderOptInEmail');
473 $this->_blNewsSubscriptionStatus = $oUser->setNewsSubscription($blOptin, $blOrderOptInEmailParam);
476 $oUser->addToGroup(
'oxidnotyetordered');
493 if (!$blActiveLogin) {
510 $oxEMail =
oxNew(
'oxemail');
511 if ($blActiveLogin) {
512 $oxEMail->sendRegisterConfirmEmail($oUser);
514 $oxEMail->sendRegisterEmail($oUser);
519 $this->_blIsNewUser =
true;
521 $sAction =
'payment?new_user=1&success=1';
522 if ($this->_blNewsSubscriptionStatus !== null && !$this->_blNewsSubscriptionStatus) {
523 $sAction =
'payment?new_user=1&success=1&newslettererror=4';
537 if ($this->createuser() !=
false && $this->_blIsNewUser) {
538 if ($this->_blNewsSubscriptionStatus === null || $this->_blNewsSubscriptionStatus) {
539 return 'register?success=1';
541 return 'register?success=1&newslettererror=4';
554 if ($this->
getConfig()->getConfigParam(
'blInvitationsEnabled')) {
568 if (!isset($blShow)) {
569 $blShow = $oSession->getVariable(
'blshowshipaddress');
572 $oSession->setVariable(
'blshowshipaddress', $blShow);
590 if (!$this->
getSession()->checkSessionChallenge()) {
608 $sUserName = $oUser->oxuser__oxusername->value;
609 $sPassword = $sPassword2 = $oUser->oxuser__oxpassword->value;
612 $oUser->changeUserData($sUserName, $sPassword, $sPassword2, $aInvAdress, $aDelAdress);
615 $blOptin = $oUser->getNewsSubscription()->getOptInStatus();
618 $sBillingUsername = $aInvAdress[
'oxuser__oxusername'];
619 $blForceCheckOptIn = ($sBillingUsername !== null && $sBillingUsername !== $sUserName);
620 $blEmailParam = $this->
getConfig()->getConfigParam(
'blOrderOptInEmail');
621 $this->_blNewsSubscriptionStatus = $oUser->setNewsSubscription($blOptin, $blEmailParam, $blForceCheckOptIn);
631 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false,
true,
'input_not_all_fields');
651 if ($oBasket = $this->
getSession()->getBasket()) {
652 $oBasket->setBasketUser(null);
653 $oBasket->onUpdate();
668 if (is_array($aBillingAddress)) {
669 $skipFields = array(
'oxuser__oxid',
'oxid',
'oxuser__oxpoints',
'oxpoints',
'oxuser__oxboni',
'oxboni');
670 $aBillingAddress = array_change_key_case($aBillingAddress);
671 $aBillingAddress = array_diff_key($aBillingAddress, array_flip($skipFields));
673 return $aBillingAddress;
685 if (is_array($aDeliveryAddress)) {
686 $skipFields = array(
'oxaddress__oxid',
'oxid',
'oxaddress__oxuserid',
'oxuserid',
'oxaddress__oxaddressuserid',
'oxaddressuserid');
687 $aDeliveryAddress = array_change_key_case($aDeliveryAddress);
688 $aDeliveryAddress = array_diff_key($aDeliveryAddress, array_flip($skipFields));
690 return $aDeliveryAddress;
705 $aDeladr = ($blShowShipAddressParameter || $blShowShipAddressVariable) ? $sDeliveryAddressParameter : array();
706 $aDelAdress = $aDeladr;
708 if (is_array($aDeladr)) {
710 if (isset($aDeladr[
'oxaddress__oxsal'])) {
711 unset($aDeladr[
'oxaddress__oxsal']);
713 if (!count($aDeladr) || implode(
'', $aDeladr) ==
'') {
715 $aDelAdress = array();
731 $sLogoutLink = $oConfig->isSsl() ? $oConfig->getShopSecureHomeUrl() : $oConfig->getShopHomeUrl();
732 $sLogoutLink .=
'cl=' . $oConfig->getRequestParameter(
'cl') . $this->
getParent()->getDynUrlParams();
733 if ($sParam = $oConfig->getRequestParameter(
'anid')) {
734 $sLogoutLink .=
'&anid=' . $sParam;
736 if ($sParam = $oConfig->getRequestParameter(
'cnid')) {
737 $sLogoutLink .=
'&cnid=' . $sParam;
739 if ($sParam = $oConfig->getRequestParameter(
'mnid')) {
740 $sLogoutLink .=
'&mnid=' . $sParam;
742 if ($sParam = $oConfig->getRequestParameter(
'tpl')) {
743 $sLogoutLink .=
'&tpl=' . $sParam;
745 if ($sParam = $oConfig->getRequestParameter(
'oxloadid')) {
746 $sLogoutLink .=
'&oxloadid=' . $sParam;
749 if ($sParam = $oConfig->getRequestParameter(
'recommid')) {
750 $sLogoutLink .=
'&recommid=' . $sParam;
754 return $sLogoutLink .
'&fnc=logout';
764 $this->_iLoginStatus = $iStatus;