Fix logging in and switching conferences, man, this is becoming a mess

This commit is contained in:
james 2010-08-31 17:35:58 +00:00
parent e03902bbec
commit 81f3f3235a
3 changed files with 27 additions and 7 deletions

View File

@ -209,7 +209,8 @@ if(is_array($nav)) {
?> ?>
<ul class="primarynav"> <ul class="primarynav">
<? <?
/* //if they arent logged in, we need _some_ sort of navigation
if(!is_array($_SESSION['roles'])) {
if ($config['website']) { if ($config['website']) {
if ($config['website_name']) { if ($config['website_name']) {
echo "<li><a href=\"{$config['website']}\">{$config['website_name']}</a></li>"; echo "<li><a href=\"{$config['website']}\">{$config['website_name']}</a></li>";
@ -236,6 +237,9 @@ if(is_array($nav)) {
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/important_dates.php\">".i18n("Important Dates").'</a></li>'; echo "<li><a href=\"{$config['SFIABDIRECTORY']}/important_dates.php\">".i18n("Important Dates").'</a></li>';
echo $registrationconfirmationlink; echo $registrationconfirmationlink;
}
/*
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/register_participants.php\">".i18n("Participant Registration").'</a></li>'; echo "<li><a href=\"{$config['SFIABDIRECTORY']}/register_participants.php\">".i18n("Participant Registration").'</a></li>';
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/user_login.php?type=judge\">".i18n("Judges Registration").'</a></li>'; echo "<li><a href=\"{$config['SFIABDIRECTORY']}/user_login.php?type=judge\">".i18n("Judges Registration").'</a></li>';
if($config['volunteer_enable'] == 'yes') { if($config['volunteer_enable'] == 'yes') {

View File

@ -759,6 +759,9 @@ function try_login($user, $pass)
function user_conference_load($accounts_id,$conferences_id) { function user_conference_load($accounts_id,$conferences_id) {
global $config; global $config;
if(! ($accounts_id && $conferences_id))
return $config['SFIABDIRECTORY']."/index.php";
/* Use the active conference to find the user id to load */ /* Use the active conference to find the user id to load */
/* FIXME: Need to be able to handle the case where there is no /* FIXME: Need to be able to handle the case where there is no
* active conference, but one step at a time */ * active conference, but one step at a time */

View File

@ -108,14 +108,27 @@ if(isset($_SESSION['accounts_id'])) {
$val=null; $val=null;
if($val=user_conference_load($accounts_id,$_SESSION['conferences_id'])) { if($val=user_conference_load($accounts_id,$_SESSION['conferences_id'])) {
header("Location: $status");
}
} else if($_GET['action']=="switchconference") {
//get rid of their current roles, and load their record for the new conference
$_SESSION['roles']=array();
if($val=user_conference_load($_SESSION['accounts_id'],$_SESSION['conferences_id'])) {
header("Location: $val"); header("Location: $val");
} }
else
header("Location: ".$config['SFIABDIRECTORY']."/index.php");
exit;
} else if($_GET['action']=="switchconference") {
//get rid of their current roles, and load their record for the new conference
if(is_array($_SESSION['roles'])) {
$_SESSION['roles']=array();
if($val=user_conference_load($_SESSION['accounts_id'],$_SESSION['conferences_id'])) {
header("Location: $val");
exit;
}
else {
header("Location: ".$config['SFIABDIRECTORY']."/index.php");
}
}
else {
header("Location: ".$config['SFIABDIRECTORY']."/index.php");
}
} else if($_GET['action']=='logout') { } else if($_GET['action']=='logout') {
/* Session keys to skip on logout */ /* Session keys to skip on logout */
$skip = array('debug', 'lang', 'messages'); $skip = array('debug', 'lang', 'messages');