More changes to be able to at least barely use the system again

This commit is contained in:
james 2010-08-31 19:41:32 +00:00
parent 3766b0a3f6
commit ec3be0f10f
3 changed files with 9 additions and 10 deletions

View File

@ -39,7 +39,7 @@ function user_valid_role($role)
function user_load($users_id, $accounts_id = false)
{
/* Load user, join accounts so we also load the email, superuser flag */
$query = "SELECT * FROM users JOIN accounts ON accounts.id=users.accounts_id WHERE ";
$query = "SELECT users.* FROM users JOIN accounts ON accounts.id=users.accounts_id WHERE ";
if($accounts_id != false) {
$accounts_id = intval($accounts_id);
$query .= "`users`.`accounts_id`='$accounts_id' LIMIT 1";
@ -511,10 +511,10 @@ function user_auth_required($all_required = array(), $one_required = array())
$ok = true;
unset($_SESSION['request_uri']);
if(!isset($_SESSION['roles']) || !isset($_SESSION['users_id'])) {
if(!isset($_SESSION['roles']) || !isset($_SESSION['accounts_id'])) {
message_push(error(i18n("You must login to view that page")));
$_SESSION['request_uri'] = $_SERVER['REQUEST_URI'];
header("location: {$config['SFIABDIRECTORY']}/user_login.php?type=$type");
header("location: {$config['SFIABDIRECTORY']}/user_login.php");
exit;
}
@ -566,7 +566,7 @@ function api_user_auth_required($all_required = array(), $one_required = array()
$ok = true;
$ret=array();
if(!isset($_SESSION['roles'])) {
if(!isset($_SESSION['roles']) || !isset($_SESSION['accounts_id'])) {
$ret['status']="error";
$ret['error']="Not logged in";
return $ret;

View File

@ -156,7 +156,7 @@ case 'save':
$d = '';
$email = $a['email'];
$username_link = ($a['link_username_to_email'] == 'yes') ? 'checked="checked"' : '';
$username = $email;
$username = $a['username'];
if($_SESSION['password_expired'] == true) {
echo error(i18n('Your password has expired. You must choose a new password now.'));

View File

@ -46,7 +46,7 @@ $tabs = array( 'fairinfo' => array(
'personal' => array(
'label' => 'Personal',
'name' => 'Personal Information',
'types' => array('student','judge','committee','volunteer','sponsor','fair'),
'types' => array('teacher','student','judge','committee','volunteer','sponsor','fair'),
'file' => 'user_personal.php',
'status_func' => 'user_personal_info_status',
),
@ -96,14 +96,14 @@ $tabs = array( 'fairinfo' => array(
'account' => array(
'label' => 'Account/Login',
'name' => 'Change Username/Email/Password',
'types' => array('student','judge','committee','volunteer','sponsor','fair'),
'types' => array('teacher','student','judge','committee','volunteer','sponsor','fair'),
'file' => 'user_account.php',
'status_func' => false,
),
'roles' => array(
'label' => 'Roles',
'name' => 'Add/Remove Roles',
'types' => array('student','judge','committee','volunteer','sponsor','fair'),
'types' => array('teacher','student','judge','committee','volunteer','sponsor','fair'),
'file' => 'user_roles.php',
'status_func' => false,
),
@ -137,7 +137,6 @@ if(count($a) == 0) {
send_header(i18n("User Editor").": {$u['name']}");
/* Setup tabs */
echo '<div id="tabs">';
echo '<ul>';
@ -165,7 +164,7 @@ foreach($tabs as $k=>$t) {
$index++;
/* Show the tab */
$href = "{$t['file']}?id=$id";
$href = "{$t['file']}?id=$edit_id";
echo "<li><a href=\"$href\"><span>".i18n($t['label'])."</span></a></li>";
}