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()) {
281 if ($oUser = $this->
getUser()) {
283 if ($oUser->updateFbId()) {
303 if (($oBasket = $this->
getSession()->getBasket())) {
304 $oBasket->resetUserInfo();
305 $oBasket->onUpdate();
322 $oUser =
oxNew(
'oxuser');
324 if ($oUser->logout()) {
332 if ($this->
getParent()->isEnabledPrivateSales()) {
337 if (
oxRegistry::getConfig()->getRequestParameter(
'redirect') && $oConfig->getConfigParam(
'sSSLShopURL')) {
356 if ($blUserRegistered ===
true) {
359 return $blUserRegistered;
376 return 'account_user';
402 $blActiveLogin = $this->
getParent()->isEnabledPrivateSales();
406 if ($blActiveLogin && !$oConfig->getRequestParameter(
'ord_agb') && $oConfig->getConfigParam(
'blConfirmAGB')) {
407 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay(
'READ_AND_CONFIRM_TERMS',
false,
true);
413 $sUser = $oConfig->getRequestParameter(
'lgn_usr');
416 $sPassword = $oConfig->getRequestParameter(
'lgn_pwd',
true);
419 $sPassword2 = $oConfig->getRequestParameter(
'lgn_pwd2',
true);
421 $aInvAdress = $oConfig->getRequestParameter(
'invadr',
true);
428 $oUser =
oxNew(
'oxuser');
432 $oUser->checkValues($sUser, $sPassword, $sPassword2, $aInvAdress, $aDelAdress);
434 $iActState = $blActiveLogin ? 0 : 1;
438 $oUser->setPassword($sPassword);
442 $iSubscriptionStatus = $oUser->getNewsSubscription()->getOptInStatus();
444 $oUser->createUser();
445 $oUser->load($oUser->getId());
446 $oUser->changeUserData($oUser->oxuser__oxusername->value, $sPassword, $sPassword, $aInvAdress, $aDelAdress);
448 if ($blActiveLogin) {
450 $oUser->acceptTerms();
455 if ($this->
getConfig()->getConfigParam(
'blInvitationsEnabled') && $sUserId && $sRecEmail) {
457 $oUser->setCreditPointsForRegistrant($sUserId, $sRecEmail);
462 if ($blOptin && $iSubscriptionStatus == 1) {
466 $oUser->getNewsSubscription()->setOptInStatus(1);
467 $oUser->addToGroup(
'oxidnewsletter');
468 $this->_blNewsSubscriptionStatus = 1;
470 $blOrderOptInEmailParam = $this->
getConfig()->getConfigParam(
'blOrderOptInEmail');
471 $this->_blNewsSubscriptionStatus = $oUser->setNewsSubscription($blOptin, $blOrderOptInEmailParam);
474 $oUser->addToGroup(
'oxidnotyetordered');
491 if (!$blActiveLogin) {
508 $oxEMail =
oxNew(
'oxemail');
509 if ($blActiveLogin) {
510 $oxEMail->sendRegisterConfirmEmail($oUser);
512 $oxEMail->sendRegisterEmail($oUser);
517 $this->_blIsNewUser =
true;
519 $sAction =
'payment?new_user=1&success=1';
520 if ($this->_blNewsSubscriptionStatus !== null && !$this->_blNewsSubscriptionStatus) {
521 $sAction =
'payment?new_user=1&success=1&newslettererror=4';
535 if ($this->createuser() !=
false && $this->_blIsNewUser) {
536 if ($this->_blNewsSubscriptionStatus === null || $this->_blNewsSubscriptionStatus) {
537 return 'register?success=1';
539 return 'register?success=1&newslettererror=4';
552 if ($this->
getConfig()->getConfigParam(
'blInvitationsEnabled')) {
566 if (!isset($blShow)) {
567 $blShow = $oSession->getVariable(
'blshowshipaddress');
570 $oSession->setVariable(
'blshowshipaddress', $blShow);
588 if (!$this->
getSession()->checkSessionChallenge()) {
606 $sUserName = $oUser->oxuser__oxusername->value;
607 $sPassword = $sPassword2 = $oUser->oxuser__oxpassword->value;
610 $oUser->changeUserData($sUserName, $sPassword, $sPassword2, $aInvAdress, $aDelAdress);
613 $blOptin = $oUser->getNewsSubscription()->getOptInStatus();
616 $sBillingUsername = $aInvAdress[
'oxuser__oxusername'];
617 $blForceCheckOptIn = ($sBillingUsername !== null && $sBillingUsername !== $sUserName);
618 $blEmailParam = $this->
getConfig()->getConfigParam(
'blOrderOptInEmail');
619 $this->_blNewsSubscriptionStatus = $oUser->setNewsSubscription($blOptin, $blEmailParam, $blForceCheckOptIn);
629 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false,
true,
'input_not_all_fields');
649 if ($oBasket = $this->
getSession()->getBasket()) {
650 $oBasket->setBasketUser(null);
651 $oBasket->onUpdate();
666 if (is_array($aBillingAddress)) {
667 $skipFields = array(
'oxuser__oxid',
'oxid',
'oxuser__oxpoints',
'oxpoints',
'oxuser__oxboni',
'oxboni');
668 $aBillingAddress = array_change_key_case($aBillingAddress);
669 $aBillingAddress = array_diff_key($aBillingAddress, array_flip($skipFields));
671 return $aBillingAddress;
683 if (is_array($aDeliveryAddress)) {
684 $skipFields = array(
'oxaddress__oxid',
'oxid',
'oxaddress__oxuserid',
'oxuserid',
'oxaddress__oxaddressuserid',
'oxaddressuserid');
685 $aDeliveryAddress = array_change_key_case($aDeliveryAddress);
686 $aDeliveryAddress = array_diff_key($aDeliveryAddress, array_flip($skipFields));
688 return $aDeliveryAddress;
703 $aDeladr = ($blShowShipAddressParameter || $blShowShipAddressVariable) ? $sDeliveryAddressParameter : array();
704 $aDelAdress = $aDeladr;
706 if (is_array($aDeladr)) {
708 if (isset($aDeladr[
'oxaddress__oxsal'])) {
709 unset($aDeladr[
'oxaddress__oxsal']);
711 if (!count($aDeladr) || implode(
'', $aDeladr) ==
'') {
713 $aDelAdress = array();
729 $sLogoutLink = $oConfig->isSsl() ? $oConfig->getShopSecureHomeUrl() : $oConfig->getShopHomeUrl();
730 $sLogoutLink .=
'cl=' . $oConfig->getRequestParameter(
'cl') . $this->
getParent()->getDynUrlParams();
731 if ($sParam = $oConfig->getRequestParameter(
'anid')) {
732 $sLogoutLink .=
'&anid=' . $sParam;
734 if ($sParam = $oConfig->getRequestParameter(
'cnid')) {
735 $sLogoutLink .=
'&cnid=' . $sParam;
737 if ($sParam = $oConfig->getRequestParameter(
'mnid')) {
738 $sLogoutLink .=
'&mnid=' . $sParam;
740 if ($sParam = $oConfig->getRequestParameter(
'tpl')) {
741 $sLogoutLink .=
'&tpl=' . $sParam;
743 if ($sParam = $oConfig->getRequestParameter(
'oxloadid')) {
744 $sLogoutLink .=
'&oxloadid=' . $sParam;
746 if ($sParam = $oConfig->getRequestParameter(
'recommid')) {
747 $sLogoutLink .=
'&recommid=' . $sParam;
750 return $sLogoutLink .
'&fnc=logout';
760 $this->_iLoginStatus = $iStatus;