<?php
/*
$Header: /cvs/hol/src/user/fbx_Switch.php,v 1.5 2005/03/16 16:01:59 jakuza Exp $
<fusedoc fuse="fbx_switch.php">
<responsibilities>
I am the switch statement that handles the fuseaction, delegating work to various fuses
</responsibilities>
<io>
<out>
<string name="$Fusebox['fuseaction']" />
<string name="$Fusebox['circuit']" />
</out>
</io>
</fusedoc>
*/
$fuseSuccess = true;
$fuseFailure = false;
switch($Fusebox["fuseaction"]) {
/*
Authenticate the user
*/
case 'Authenticate':
include('actAuthenticate.php');
//TODO modified redirect url
$XFA['Denied'] = 'User.LoginForm';
$XFA['Granted'] = 'home.Logged';
include('urlGrantedDenied.php');
break;
/*
Check if the user is authorized to use a fuseaction
This fuseaction is deprecated since it's quicker to call checkFuseaction methos from upper level
without Fusebox overhead
*/
case 'CheckFuseaction':
$user->checkFuseaction($attributes['parentCircuit'], $attributes['parentFuseaction']);
break;
/*
Logout the user
*/
case 'Logout':
include('actLogout.php');
include('urlLogOut.php');
break;
/*
Shows a form to register a user
*/
case 'RegistrationForm':
$XFA['XFA_Register'] = 'User.ValidateRegistration';
include('actCreateRegForm.php');
include('dspRegForm.php');
$_REQUEST['page']['subtitle'] = $GLOBALS['language']['user']['title']['regform'];
break;
/*
Validates and saves registration data in session
*/
case 'ValidateRegistration':
$XFA['XFA_RegisterSuccess'] = 'User.RegistrationSummary';
$XFA['XFA_Register'] = 'User.ValidateRegistration';
include('actCreateRegForm.php');
include('actRegValidateSave.php');
$_REQUEST['page']['subtitle'] = $GLOBALS['language']['user']['title']['regvalidation'];
break;
/*
Shows a registration data resume
*/
case 'RegistrationSummary':
$XFA['XFA_RegisterCancel'] = 'User.RegistrationForm';
$XFA['XFA_RegUserConfirm'] = 'User.Wait';
include('dspRegSummary.php');
$_REQUEST['page']['subtitle'] = $GLOBALS['language']['user']['title']['regsummary'];
break;
/*
Prepares user account and asks for user confirmation
It saves registration data, sends the confirmation code by mail and asks the user to complete the procedure.
*/
case 'Wait':
$XFA['XFA_Activate'] = 'User.Activate';
include('qryRegister.php');
include('actSendCode.php');
include('dspWait.php');
$_REQUEST['page']['subtitle'] = $GLOBALS['language']['user']['title']['wait'];
break;
/*
Shows the quick login form to be included in the layout
*/
case 'QuickLoginForm':
if ($user->isAuthenticated()) {
$XFA['XFA_Logout'] = 'User.Logout';
include('dspLogged.php');
} else {
$XFA['XFA_RegistrationForm'] = 'User.RegistrationForm';
$XFA['XFA_Login'] = 'User.ValidateLogin';
include('actCreateQLogin.php');
include('dspQLogin.php');
}
break;
/*
Shows login form
*/
case 'LoginForm':
include('actTurn2SSL.php');
$XFA['XFA_RegistrationForm'] = 'User.RegistrationForm';
$XFA['XFA_Login'] = 'User.ValidateLogin';
include('actCreateLoginForm.php');
include('dspLoginForm.php');
$_REQUEST['page']['subtitle'] = $GLOBALS['language']['user']['title']['login'];
break;
/*
Check for login data
It processes both validation and authentication.
*/
case 'ValidateLogin':
$XFA['XFA_Login'] = 'User.ValidateLogin';
include('actCreateLoginForm.php');
include('actValidateLogin.php');
if ($fuseFailure) {
include('dspLoginForm.php');
} else {
$rXFA = $MainLogin->GetInputValue('returnFuseaction');
if ($rXFA === '') {
if ($user->checkGroup(AFFILIATE))
$XFA['XFA_LoginSuccess'] = 'Affiliate.AffiliatePanel';
elseif ($user->checkGroup(ADMIN))
$XFA['XFA_LoginSuccess'] = 'Admin.AdminPanel';
else $XFA['XFA_LoginSuccess'] = 'Home.Homepage';
} else
$XFA['XFA_LoginSuccess'] = $rXFA;
include('actSuccess.php');
}
$_REQUEST['page']['subtitle'] = $GLOBALS['language']['user']['title']['failedlogin'];
break;
/*
Activates a user account
*/
case 'Activate':
include('qryActivate.php');
$XFA['XFA_LoginActivated'] = 'User.LoginForm';
include('actActivated.php');
include('dspActivated.php');
break;
# Default Fuseaction
default:
print 'I received a fuseaction called ' . $Fusebox['fuseaction'] . ' that circuit ' . $Fusebox['circuit'] . ' does not have a handler for.';
break;
}
// Kylnas' Circuit: user
/*
switch ($Fusebox["fuseaction"]) {
//
Shows login form to the user
//
case "LoginForm":
case "Fusebox.defaultFuseaction":
include('dspLoginForm.php');
$_REQUEST["page"]["subtitle"] = "LoginForm";
break;
//
Authenticate the user
//
case "Authenticate":
include('actAuthenticate.php');
$XFA["Denied"] = "home.Homepage";
$XFA["Granted"] = "home.Logged";
include('urlGrantedDenied.php');
break;
//
Shows the register form to the user
//
case "RegisterForm":
$XFA["Register"] = "user.RegisterUser";
include('dspRegisterForm.php');
$_REQUEST["page"]["subtitle"] = "RegisterForm";
break;
//
Register the user into the database
//
case "RegisterUser":
$invalidInput = false; #initialize the error flag
include('actInputValidation.php'); #check the form fields
$XFA["Valid"] = "home.Homepage";
$XFA["Invalid"] = "user.RegisterForm";
include('urlValidInvalid.php'); #redirect the user
include('dspRegisterUser.php');
$_REQUEST["page"]["subtitle"] = "RegisterUser";
break;
//
Check if the user is authorized to use a fuseaction
//
case "CheckFuseaction":
$user->checkFuseaction($attributes['parentCircuit'], $attributes['parentFuseaction']);
break;
//
Logout the user
//
case "Logout":
$user->logOut(true);
include('urlLogOut.php');
break;
//
User doesn't have fuseaction permissions
//
case "NoValidLogin":
include('actLogout.php');
include('urlLogOut.php');
break;
default:
echo $language['UnknownFuseaction'];
break;
}
*/
?>