diff --git a/common.inc.php b/common.inc.php
index ceafaf4..d0aff96 100644
--- a/common.inc.php
+++ b/common.inc.php
@@ -79,8 +79,8 @@ function taskNav(id,pid,level) {
$("#tertiarymenu_accordion").accordion("destroy");
$("#tertiarymenu_accordion").load("=$config['SFIABDIRECTORY']?>/nav.php?level=2&id="+id,null,function() {
$("#tertiarymenu_accordion").accordion({clearStyle: true}); //"option", "collapsible", true);
- });
$("#tertiarymenu").show();
+ });
break;
}
@@ -147,7 +147,7 @@ if(!$_SESSION['conferences_id']) {
$cl="class=\"selected\"";
else
$cl="";
- echo "
".i18n('You are here:').' ';
diff --git a/db/db.update.204.php b/db/db.update.204.php
index 16e0ed9..7325b4c 100755
--- a/db/db.update.204.php
+++ b/db/db.update.204.php
@@ -16,7 +16,7 @@ function db_update_204_post()
);
// get the year => conference_id links
- $q1 = mysql_query("SELECT year, id FROM conferences");
+ $q1 = mysql_query("SELECT year, id FROM conferences WHERE year>0");
while($r = mysql_fetch_assoc($q1)){
foreach($tables as $tableName){
diff --git a/super/index.php b/super/index.php
index ca73206..0fec29c 100644
--- a/super/index.php
+++ b/super/index.php
@@ -35,7 +35,7 @@
echo "
";
echo " ".theme_icon("configuration_variables")." ".i18n("System Configuration Variables")." | ";
echo " ".theme_icon("conferences")." ".i18n("Conferences Setup")." | ";
- echo " | \n";
+ echo " ".theme_icon("rolestasks")." ".i18n("Roles Tasks Setup")." | ";
echo " | \n";
echo "
";
echo "\n";
diff --git a/user_login.php b/user_login.php
index 4fb278a..018ee95 100644
--- a/user_login.php
+++ b/user_login.php
@@ -65,90 +65,20 @@ function try_login($user, $pass)
return $r['id'];
}
-/* Don't do any login stuff if they're already logged in */
-if(isset($_SESSION['accounts_id'])) {
- /* They're already logged in, if they're not trying to logout, don't
- * let them see the login page */
- if($_GET['action'] != 'logout') {
- message_push(error(i18n('You are already logged in, please use the [Logout] link in the upper right to logout before logging in as different user')));
- header("location: user_main.php");
- exit;
- }
-}
-
- $notice=$_GET['notice'];
-
- $redirect = $_GET['redirect'];
- $redirect_data = $_GET['redirectdata'];
-
- switch($redirect) {
- case 'roleadd':
- $redirect_url = "&redirect=$redirect&redirectdata=$redirectdata";
- break;
- case 'roleattached':
- $redirect_url = "&redirect=$redirect";
- break;
- default:
- $redirect_url = '';
- break;
- }
-
-/*
- switch($role) {
- case 'volunteer':
- // returns "notopenyet", "closed", or "open"
- $reg_open = user_volunteer_registration_status();
- break;
- case 'committee':
- $reg_open = 'notpermitted';
- break;
- case 'judge':
- $reg_open = user_judge_registration_status();
- break;
- case 'fair':
- $reg_open = 'notpermitted';
- break;
- case 'sponsor':
- $reg_open = 'notpermitted';
- break;
- case 'parent': case 'alumni': case 'principal': case 'mentor':
- /* Always open, because they could have been auto-created
- $reg_open = 'open';
- break;
- case 'student':
- default:
- if($_GET['action']!="logout")
- exit;
- $reg_open = 'closed';
- break;
- }
-*/
-
- if($_POST['action']== 'login' ) {
-
- $user = $_POST['username'];
- $pass = $_POST['password'];
-
- $accounts_id = try_login($user, $pass);
- if($accounts_id == false) {
- message_push(error(i18n("Invalid Email/Password")));
- header("location: user_login.php");
- exit;
- }
-
- $a = account_load($accounts_id);
-
+function user_conference_load($accounts_id,$conferences_id) {
+ global $config;
/* Use the active conference to find the user id to load */
/* FIXME: Need to be able to handle the case where there is no
* active conference, but one step at a time */
- $q = mysql_query("SELECT id FROM users WHERE accounts_id=$accounts_id AND conferences_id={$_SESSION['conferences_id']}");
+ $q = mysql_query("SELECT id FROM users WHERE accounts_id=$accounts_id AND conferences_id=$conferences_id");
if(mysql_num_rows($q) == 0) {
/* FIXME: this should probably just return false, but for now, see if there's an error */
- echo "No user {$accounts_id} for conference {$_SESSION['conferences_id']}";
+ header("location: user_account.php");
+// echo "No user {$accounts_id} for conference {$_SESSION['conferences_id']}";
exit;
}
if(mysql_num_rows($q) > 1) {
- echo "DATABASE ERROR: More than one user for account $accounts_id conference {$_SESSION['conferences_id']}";
+ echo "DATABASE ERROR: More than one user for account $accounts_id conference {$conferences_id}";
exit;
}
$uid = mysql_fetch_assoc($q);
@@ -157,12 +87,8 @@ if(isset($_SESSION['accounts_id'])) {
$u = user_load($id);
$_SESSION['name']="{$u['firstname']} {$u['lastname']}";
- $_SESSION['username']=$u['username'];
- $_SESSION['email']=$u['email'];
$_SESSION['users_id']=$u['id'];
- $_SESSION['accounts_id']=$u['accounts_id'];
$_SESSION['roles']=array_keys($u['roles']);
- $_SESSION['superuser'] = ($a['superuser'] == 'yes') ? 'yes' : 'no';
/* Load the password expiry for each user role, and
* find the longest expiry, which is the one we'll use
@@ -246,7 +172,92 @@ if(isset($_SESSION['accounts_id'])) {
}
header("location: user_main.php");
exit;
+}
+
+/* Don't do any login stuff if they're already logged in */
+if(isset($_SESSION['accounts_id'])) {
+ /* They're already logged in, if they're not trying to logout, don't
+ * let them see the login page */
+ if($_GET['action'] != 'logout' && $_GET['action']!='switchconference') {
+ message_push(error(i18n('You are already logged in, please use the "Logout" link in the upper right to logout before logging in as different user')));
+ header("location: user_main.php");
+ exit;
+ }
+}
+
+ $notice=$_GET['notice'];
+
+ $redirect = $_GET['redirect'];
+ $redirect_data = $_GET['redirectdata'];
+
+ switch($redirect) {
+ case 'roleadd':
+ $redirect_url = "&redirect=$redirect&redirectdata=$redirectdata";
+ break;
+ case 'roleattached':
+ $redirect_url = "&redirect=$redirect";
+ break;
+ default:
+ $redirect_url = '';
+ break;
+ }
+
+/*
+ switch($role) {
+ case 'volunteer':
+ // returns "notopenyet", "closed", or "open"
+ $reg_open = user_volunteer_registration_status();
+ break;
+ case 'committee':
+ $reg_open = 'notpermitted';
+ break;
+ case 'judge':
+ $reg_open = user_judge_registration_status();
+ break;
+ case 'fair':
+ $reg_open = 'notpermitted';
+ break;
+ case 'sponsor':
+ $reg_open = 'notpermitted';
+ break;
+ case 'parent': case 'alumni': case 'principal': case 'mentor':
+ /* Always open, because they could have been auto-created
+ $reg_open = 'open';
+ break;
+ case 'student':
+ default:
+ if($_GET['action']!="logout")
+ exit;
+ $reg_open = 'closed';
+ break;
+ }
+*/
+
+ if($_POST['action']== 'login' ) {
+
+ $user = $_POST['username'];
+ $pass = $_POST['password'];
+
+ $accounts_id = try_login($user, $pass);
+ if($accounts_id == false) {
+ message_push(error(i18n("Invalid Email/Password")));
+ header("location: user_login.php");
+ exit;
+ }
+
+ $a = account_load($accounts_id);
+ $_SESSION['username']=$a['username'];
+ $_SESSION['email']=$a['email'];
+ $_SESSION['accounts_id']=$accounts_id;
+ $_SESSION['superuser'] = ($a['superuser'] == 'yes') ? 'yes' : 'no';
+ $_SESSION['roles']=array();
+
+ user_conference_load($accounts_id,$_SESSION['conferences_id']);
+ } else if($_GET['action']=="switchconference") {
+ //get rid of their current roles, and load their record for the new conference
+ $_SESSION['roles']=array();
+ user_conference_load($_SESSION['accounts_id'],$_SESSION['conferences_id']);
} else if($_GET['action']=='logout') {
/* Session keys to skip on logout */
$skip = array('debug', 'lang', 'messages');