src/ExtranetRegistrationGuestBundle/pkgExtranet/objects/WebModules/MTExtranetRegistrationGuestCore/MTExtranetRegistrationGuestCore.class.php
protected function RegisterGuestUser($sSuccessURL = null, $sFailureURL = null)
    {
        if (null === $sSuccessURL) {
            if ($this->global->UserDataExists('sSuccessURL')) {
                $sSuccessURL = $this->global->GetUserData('sSuccessURL', array(), TCMSUserInput::FILTER_URL);
            }
            if (empty($sSuccessURL)) {
                $sSuccessURL = null;
            }
        }
        if (null === $sFailureURL) {
            if ($this->global->UserDataExists('sFailureURL')) {
                $sFailureURL = $this->global->GetUserData('sFailureURL', array(), TCMSUserInput::FILTER_URL);
            }
            if (empty($sFailureURL)) {
                $sFailureURL = null;
            }
        }
        $oStep = TdbShopOrderStep::GetStep('thankyou');
        if (null !== $oStep) {
            $oTmpUser = $oStep->GetLastUserBoughtFromSession();
            $aData = $this->GetFilteredUserData('aUser');
            if (is_array($aData) && 2 == count($aData) && array_key_exists('password', $aData) && array_key_exists('password2', $aData)) {
                foreach ($aData as $key => $val) {
                    $oTmpUser->sqlData[$key] = trim($val);
                }
                $aData = $oTmpUser->sqlData;

                $extranetUserProvider = $this->getExtranetUserProvider();
                $extranetUserProvider->reset();
                $oUser = $extranetUserProvider->getActiveUser();
                $oUser->LoadFromRow($aData);
                $bDataValid = $this->ValidateUserLoginData();
                $bDataValid = $this->ValidateUserData() && $bDataValid;
                if ($bDataValid) {
                    $oUserOrder = &TShopBasket::GetLastCreatedOrder();
                    $sNewUserId = $oUser->Register();
                    $this->UpdateUserAddress(null, null, true);
                    $oUserOrder->AllowEditByAll(true);
                    $oUserOrder->SaveFieldsFast(array('data_extranet_user_id' => $sNewUserId));
                    $oUserOrder->AllowEditByAll(false);
                    if (!is_null($sSuccessURL)) {
                        $this->controller->HeaderURLRedirect($sSuccessURL, true);
                    } else {
                        $oExtranetConf = &TdbDataExtranet::GetInstance();
                        $this->controller->HeaderURLRedirect($oExtranetConf->GetLinkRegisterSuccessPage(), true);
                    }
                    $oStep->RemoveLastUserBoughtFromSession();
                }
            }
        }
        if (null !== $sFailureURL) {
            $this->controller->HeaderURLRedirect($sFailureURL, true);
        } else {
            $oUser = TdbDataExtranetUser::GetInstance();
            $this->controller->HeaderURLRedirect($oUser->GetLinkForRegistrationGuest(), true);
        }
    }
protected function RegisterGuestUser($sSuccessURL = null, $sFailureURL = null)
    {
        if (null === $sSuccessURL) {
            if ($this->global->UserDataExists('sSuccessURL')) {
                $sSuccessURL = $this->global->GetUserData('sSuccessURL', array(), TCMSUserInput::FILTER_URL);
            }
            if (empty($sSuccessURL)) {
                $sSuccessURL = null;
            }
        }
        if (null === $sFailureURL) {
            if ($this->global->UserDataExists('sFailureURL')) {
                $sFailureURL = $this->global->GetUserData('sFailureURL', array(), TCMSUserInput::FILTER_URL);
            }
            if (empty($sFailureURL)) {
                $sFailureURL = null;
            }
        }
        $oStep = TdbShopOrderStep::GetStep('thankyou');
        if (null !== $oStep) {
            $oTmpUser = $oStep->GetLastUserBoughtFromSession();
            $aData = $this->GetFilteredUserData('aUser');
            if (is_array($aData) && 2 == count($aData) && array_key_exists('password', $aData) && array_key_exists('password2', $aData)) {
                foreach ($aData as $key => $val) {
                    $oTmpUser->sqlData[$key] = trim($val);
                }
                $aData = $oTmpUser->sqlData;

                $extranetUserProvider = $this->getExtranetUserProvider();
                $extranetUserProvider->reset();
                $oUser = $extranetUserProvider->getActiveUser();
                $oUser->LoadFromRow($aData);
                $bDataValid = $this->ValidateUserLoginData();
                $bDataValid = $this->ValidateUserData() && $bDataValid;
                if ($bDataValid) {
                    $oUserOrder = &TShopBasket::GetLastCreatedOrder();
                    $sNewUserId = $oUser->Register();
                    $this->UpdateUserAddress(null, null, true);
                    $oUserOrder->AllowEditByAll(true);
                    $oUserOrder->SaveFieldsFast(array('data_extranet_user_id' => $sNewUserId));
                    $oUserOrder->AllowEditByAll(false);
                    if (!is_null($sSuccessURL)) {
                        $this->controller->HeaderURLRedirect($sSuccessURL, true);
                    } else {
                        $oExtranetConf = &TdbDataExtranet::GetInstance();
                        $this->controller->HeaderURLRedirect($oExtranetConf->GetLinkRegisterSuccessPage(), true);
                    }
                    $oStep->RemoveLastUserBoughtFromSession();
                }
            }
        }
        if (null !== $sFailureURL) {
            $this->controller->HeaderURLRedirect($sFailureURL, true);
        } else {
            $oUser = TdbDataExtranetUser::GetInstance();
            $this->controller->HeaderURLRedirect($oUser->GetLinkForRegistrationGuest(), true);
        }
    }
protected function RegisterGuestUser ( $ sSuccessURL = null , $ sFailureURL = null ) { if ( null === $ sSuccessURL ) { if ( $ this -> global -> UserDataExists ( 'sSuccessURL' ) ) { $ sSuccessURL = $ this -> global -> GetUserData ( 'sSuccessURL' , array ( ) , TCMSUserInput :: FILTER_URL ) ; } if ( empty ( $ sSuccessURL ) ) { $ sSuccessURL = null ; } } if ( null === $ sFailureURL ) { if ( $ this -> global -> UserDataExists ( 'sFailureURL' ) ) { $ sFailureURL = $ this -> global -> GetUserData ( 'sFailureURL' , array ( ) , TCMSUserInput :: FILTER_URL ) ; } if ( empty ( $ sFailureURL ) ) { $ sFailureURL = null ; } } $ oStep = TdbShopOrderStep :: GetStep ( 'thankyou' ) ; if ( null !== $ oStep ) { $ oTmpUser = $ oStep -> GetLastUserBoughtFromSession ( ) ; $ aData = $ this -> GetFilteredUserData ( 'aUser' ) ; if ( is_array ( $ aData ) && 2 == count ( $ aData ) && array_key_exists ( 'password' , $ aData ) && array_key_exists ( 'password2' , $ aData ) ) { foreach ( $ aData as $ key => $ val ) { $ oTmpUser -> sqlData [ $ key ] = trim ( $ val ) ; } $ aData = $ oTmpUser -> sqlData ; $ extranetUserProvider = $ this -> getExtranetUserProvider ( ) ; $ extranetUserProvider -> reset ( ) ; $ oUser = $ extranetUserProvider -> getActiveUser ( ) ; $ oUser -> LoadFromRow ( $ aData ) ; $ bDataValid = $ this -> ValidateUserLoginData ( ) ; $ bDataValid = $ this -> ValidateUserData ( ) && $ bDataValid ; if ( $ bDataValid ) { $ oUserOrder = & TShopBasket :: GetLastCreatedOrder ( ) ; $ sNewUserId = $ oUser -> Register ( ) ; $ this -> UpdateUserAddress ( null , null , true ) ; $ oUserOrder -> AllowEditByAll ( true ) ; $ oUserOrder -> SaveFieldsFast ( array ( 'data_extranet_user_id' => $ sNewUserId ) ) ; $ oUserOrder -> AllowEditByAll ( false ) ; if ( ! is_null ( $ sSuccessURL ) ) { $ this -> controller -> HeaderURLRedirect ( $ sSuccessURL , true ) ; } else { $ oExtranetConf = & TdbDataExtranet :: GetInstance ( ) ; $ this -> controller -> HeaderURLRedirect ( $ oExtranetConf -> GetLinkRegisterSuccessPage ( ) , true ) ; } $ oStep -> RemoveLastUserBoughtFromSession ( ) ; } } } if ( null !== $ sFailureURL ) { $ this -> controller -> HeaderURLRedirect ( $ sFailureURL , true ) ; } else { $ oUser = TdbDataExtranetUser :: GetInstance ( ) ; $ this -> controller -> HeaderURLRedirect ( $ oUser -> GetLinkForRegistrationGuest ( ) , true ) ; } }
Register guest user. Requires last basket step to be thankyou.

@param null $sSuccessURL
@param null $sFailureURL
Register guest user . Requires last basket step to be thankyou .