<?php

/************************************************************************
*
* TO CUSTOMIZE THE SIGNUP DON'T MODIFY THIS FILE,
* MODIFY INSTEAD THE FOLLOWING FILES:
*
* /modules/admin/views/public/Signup_0_ShowPackages.php
* /modules/admin/views/Signup_1_DomainNameForm.php
* /modules/admin/views/Signup_2_OrderForm.php
* /modules/admin/views/Signup_3_Validation.php
* /modules/admin/views/Signup_3b_PhoneVerification.php
* /modules/admin/views/Signup_4_CreateAccounts.php
* /modules/admin/views/Signup_5_ProcessBilling.php
* /modules/admin/views/Signup_6_Finish.php
*
*
*************************************************************************/

// We will need this to determine certain validation routines for server plugins' validateCredentials() method.
define('NE_SIGNUP', true);

if (!isset($_REQUEST['step'])) {
    $_REQUEST['step'] = 0;
}

// paypal doesn't seem to decide on how to return to the merchant
if (    isset($_SERVER['REQUEST_URI'])
        && (    strpos($_SERVER['REQUEST_URI'], 'Access+Your+Subscription') !== false
                || strpos($_SERVER['REQUEST_URI'], 'Return+To+Merchant') !== false
                || strpos($_SERVER['REQUEST_URI'], 'merchant_return_link') !== false))
{
    $_REQUEST['step'] = 5;
    $_REQUEST['pass'] = 1;
}


switch ($_REQUEST['step'])
{
    case 0:
        $_GET['view'] = 'Signup_0_PackageGroup';
        break;
    case 1:
        $_GET['view'] = 'Signup_1_PackageSelection';
        break;
    case 2:
        if(@$_GET['domain']) {
            $_GET['view'] = 'Signup_2_Domain';
        } else {
            $_GET['view'] = 'Signup_2_ConfigureProduct';
        }
        break;
    case 3:
        $_GET['view'] = 'Signup_3_Summary';
        break;
    case 4:
        $_GET['view'] = 'Signup_4_YourInfo';
        break;
    case 5:
		if ( $_REQUEST['pass'] == '1' ) {
			$_GET['view'] = 'Signup_5_Complete';
		} else { 
			$_GET['view'] = 'Signup_5_Failed';
		}
        break;
    case 6:
        $_GET['view'] = 'Signup_6_Finish';
        break;
    case 7:
        $_GET['view'] = 'Signup_3b_PhoneVerification';
        break;
}

// Override for domain search
if(isset($_GET['step']) && $_GET['step'] == 'search') {
    $_GET['view'] = 'domainSearchResults';
}

// Override for tax updatesd
if(isset($_GET['step']) && $_GET['step'] == 'updateTax') {
    $_GET['view'] = 'Signup_4_TaxInfo';
}

// Override for processing
if(isset($_GET['step']) && $_GET['step'] == 'process') {
    $_GET['view'] = 'Signup_Process';
}

// Override for phoneVerify
if(isset($_GET['step']) && $_GET['step'] == 'phoneVerify') {
    $_GET['view'] = 'Signup_PhoneVerification';
}

// Override for productGroup with no step
if(!$_REQUEST['step'] && isset($_REQUEST['productGroup'])) {
    $_GET['view'] = 'Signup_1_PackageSelection';
}

$_GET['fuse'] = 'admin';

require 'newedge/front.php';
?>
