From ad0468e4e1c8161e250153efa7cff0399cda3094 Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 13 Jul 2010 03:30:17 +0000 Subject: [PATCH] Convert to new user_auth_required. Some report edits too that I don't feel like filtering out --- admin/award_awardcreatedivisional.php | 2 +- admin/award_awards.php | 2 +- admin/award_download.php | 2 +- admin/award_upload.php | 2 +- admin/awards.php | 2 +- admin/cms.php | 2 +- admin/committees.php | 2 +- admin/communication.php | 2 +- admin/communication_send_status.php | 2 +- admin/curl.inc.php | 2 +- admin/cwsfregister.php | 2 +- admin/documentdownloader.php | 2 +- admin/documents.php | 2 +- admin/donations.php | 2 +- admin/donors.php | 2 +- admin/donors_search.php | 2 +- admin/events.php | 2 +- admin/eventsscheduling.php | 2 +- admin/export_checkin.php | 2 +- admin/fair_stats.php | 2 +- admin/fair_stats_select.php | 2 +- admin/fix_judges_autocomplete.php | 2 +- admin/fundraising.php | 2 +- admin/fundraising_campaigns.php | 2 +- admin/fundraising_campaigns_prospecting.php | 2 +- admin/fundraising_reports.php | 2 +- admin/fundraising_reports_std.php | 2 +- admin/fundraising_setup.php | 2 +- admin/fundraising_sponsorship.php | 2 +- admin/fundraising_types.php | 2 +- admin/gettranslation.php | 2 +- admin/index.php | 2 +- admin/judges.php | 2 +- admin/judges_info.php | 2 +- admin/judges_invite.php | 2 +- admin/judges_jdiv.php | 2 +- admin/judges_schedulerconfig.php | 2 +- admin/judges_teams.php | 2 +- admin/judges_teams_members.php | 2 +- admin/judges_teams_projects.php | 2 +- admin/judges_teams_timeslots.php | 2 +- admin/judges_timeslots.php | 2 +- admin/judging_score_edit.php | 2 +- admin/judging_score_entry.php | 2 +- admin/locations.php | 2 +- admin/project_editor.php | 3 +- admin/regfee_items_manager.php | 2 +- admin/registration.php | 2 +- admin/registration_list.php | 2 +- admin/registration_receivedforms.php | 2 +- admin/registration_stats.php | 2 +- admin/registration_webconsent.php | 2 +- admin/reports.php | 8 +- admin/reports_acscript.php | 2 +- admin/reports_appeal_letters.php | 2 +- admin/reports_ceremony.php | 2 +- admin/reports_committees.inc.php | 9 +- admin/reports_editor.php | 2 +- admin/reports_fairs.inc.php | 4 +- admin/reports_fundraising.inc.php | 4 +- admin/reports_gen.php | 6 +- admin/reports_judges.inc.php | 172 ++++++++------------ admin/reports_judges.php | 2 +- admin/reports_judges_teams_projects.php | 2 +- admin/reports_mailinglabels.php | 2 +- admin/reports_mailinglabels_generator.php | 2 +- admin/reports_old.php | 2 +- admin/reports_program_awards.php | 2 +- admin/reports_projects_details.php | 2 +- admin/reports_projects_judges_teams.php | 2 +- admin/reports_volunteers.inc.php | 23 +-- admin/schedule.php | 2 +- admin/schools.php | 2 +- admin/schoolsimport.php | 2 +- admin/sciencefairs.php | 2 +- admin/settranslation.php | 2 +- admin/sponsor_contacts.php | 2 +- admin/student_editor.php | 2 +- admin/tours.php | 2 +- admin/tours_assignments.php | 2 +- admin/tours_manager.php | 2 +- admin/tours_sa_config.php | 2 +- admin/translations.php | 2 +- admin/user_editor_window.php | 2 +- admin/user_list.php | 2 +- admin/volunteer_positions_manager.php | 2 +- admin/volunteers.php | 2 +- admin/winners.php | 2 +- 88 files changed, 174 insertions(+), 215 deletions(-) diff --git a/admin/award_awardcreatedivisional.php b/admin/award_awardcreatedivisional.php index f69ef4e..cd3f37b 100644 --- a/admin/award_awardcreatedivisional.php +++ b/admin/award_awardcreatedivisional.php @@ -25,7 +25,7 @@ require("../common.inc.php"); require_once("../user.inc.php"); require_once("awards.inc.php"); - user_auth_required('committee', 'admin'); + user_auth_required('admin'); send_header('Create All Divisional Awards', array('Committee Main' => 'committee_main.php', diff --git a/admin/award_awards.php b/admin/award_awards.php index 427ffcd..efdb7fd 100644 --- a/admin/award_awards.php +++ b/admin/award_awards.php @@ -24,7 +24,7 @@ 'committee_main.php', diff --git a/admin/cms.php b/admin/cms.php index 06103f4..a993bb5 100644 --- a/admin/cms.php +++ b/admin/cms.php @@ -23,7 +23,7 @@ 'committee_main.php', 'Administration' => 'admin/index.php'), diff --git a/admin/documentdownloader.php b/admin/documentdownloader.php index 0efec64..1f77cfc 100644 --- a/admin/documentdownloader.php +++ b/admin/documentdownloader.php @@ -23,7 +23,7 @@ 'committee_main.php', 'Administration' => 'admin/index.php'), diff --git a/admin/donations.php b/admin/donations.php index 9921e8a..9521aaa 100644 --- a/admin/donations.php +++ b/admin/donations.php @@ -25,7 +25,7 @@ require("../tableeditor.class.php"); require_once("../user.inc.php"); - user_auth_required('committee', 'admin'); + user_auth_required('admin'); include ("fundraising_sponsorship_handler.inc.php"); include ("fundraising_goals_handler.inc.php"); diff --git a/admin/donors.php b/admin/donors.php index ae5cb74..7eb752e 100644 --- a/admin/donors.php +++ b/admin/donors.php @@ -24,7 +24,7 @@ \n"; //$q=mysql_query("SELECT * FROM award_sponsors WHERE year='".$config['FAIRYEAR']."' ORDER BY organization"); diff --git a/admin/events.php b/admin/events.php index 6ba4c83..80ab229 100644 --- a/admin/events.php +++ b/admin/events.php @@ -25,7 +25,7 @@ require("../common.inc.php"); require("../tableeditor.class.php"); require_once("../user.inc.php"); - user_auth_required('committee', 'admin'); + user_auth_required('admin'); send_header("Events Management", array('Committee Main' => 'committee_main.php', diff --git a/admin/eventsscheduling.php b/admin/eventsscheduling.php index 8a388b2..30e7a2b 100644 --- a/admin/eventsscheduling.php +++ b/admin/eventsscheduling.php @@ -24,7 +24,7 @@ 'committee_main.php', diff --git a/admin/export_checkin.php b/admin/export_checkin.php index 456b1d2..d972f16 100644 --- a/admin/export_checkin.php +++ b/admin/export_checkin.php @@ -24,7 +24,7 @@ 'Delegate information/jacket size for CWSF', ); - user_auth_required('committee', 'admin'); + user_auth_required('admin'); switch($_GET['action']) { diff --git a/admin/fix_judges_autocomplete.php b/admin/fix_judges_autocomplete.php index dec1036..22c96a4 100644 --- a/admin/fix_judges_autocomplete.php +++ b/admin/fix_judges_autocomplete.php @@ -3,7 +3,7 @@ require_once("../common.inc.php"); require_once("../user.inc.php"); -user_auth_required('committee', 'admin'); +user_auth_required('admin'); $q = mysql_query("SELECT * FROM judges WHERE passwordexpiry IS NULL"); while($i = mysql_fetch_object($q)) { diff --git a/admin/fundraising.php b/admin/fundraising.php index b122085..746390e 100644 --- a/admin/fundraising.php +++ b/admin/fundraising.php @@ -24,7 +24,7 @@ require("../common.inc.php"); require_once("../user.inc.php"); - user_auth_required('committee', 'admin'); + user_auth_required('admin'); if($_GET['action']=="refresh") { ?> diff --git a/admin/fundraising_campaigns.php b/admin/fundraising_campaigns.php index e1823da..a44dc36 100644 --- a/admin/fundraising_campaigns.php +++ b/admin/fundraising_campaigns.php @@ -23,7 +23,7 @@ $ln) { if($l==$config['default_language']) continue; diff --git a/admin/index.php b/admin/index.php index fab6a3c..559a1b7 100644 --- a/admin/index.php +++ b/admin/index.php @@ -26,7 +26,7 @@ require_once("../user.inc.php"); require_once("../committee.inc.php"); - user_auth_required('committee','admin'); + user_auth_required('admin'); send_header("Administration", array('Committee Main' => 'committee_main.php'), diff --git a/admin/judges.php b/admin/judges.php index 1aa7320..0563b5e 100644 --- a/admin/judges.php +++ b/admin/judges.php @@ -24,7 +24,7 @@ 'committee_main.php', diff --git a/admin/judges_info.php b/admin/judges_info.php index 3b6b6ae..ca22dbc 100644 --- a/admin/judges_info.php +++ b/admin/judges_info.php @@ -29,7 +29,7 @@ require("../common.inc.php"); require_once("../user.inc.php"); - user_auth_required('committee', 'admin'); + user_auth_required('admin'); $preferencechoices=array( -2=>"Very Low", diff --git a/admin/judges_invite.php b/admin/judges_invite.php index 488fa33..52e2713 100644 --- a/admin/judges_invite.php +++ b/admin/judges_invite.php @@ -24,7 +24,7 @@ 'Judging Timeslot', diff --git a/admin/judges_timeslots.php b/admin/judges_timeslots.php index 28de931..877f453 100644 --- a/admin/judges_timeslots.php +++ b/admin/judges_timeslots.php @@ -24,7 +24,7 @@ 'Judging Timeslot', 'divisional1' => 'Divisional Round 1', diff --git a/admin/judging_score_edit.php b/admin/judging_score_edit.php index 3013f89..8bceaf2 100644 --- a/admin/judging_score_edit.php +++ b/admin/judging_score_edit.php @@ -25,7 +25,7 @@ require("../common.inc.php"); require_once("../user.inc.php"); require_once("judges.inc.php"); - user_auth_required('committee', 'admin'); + user_auth_required('admin'); send_header("Judging Score Entry - Update", array('Committee Main' => 'committee_main.php', 'Administration' => 'admin/index.php', diff --git a/admin/judging_score_entry.php b/admin/judging_score_entry.php index 9bc7224..9547408 100644 --- a/admin/judging_score_entry.php +++ b/admin/judging_score_entry.php @@ -25,7 +25,7 @@ require("../common.inc.php"); require_once("../user.inc.php"); require_once("judges.inc.php"); - user_auth_required('committee', 'admin'); + user_auth_required('admin'); if($_GET['year']) $year=$_GET['year']; else $year=$config['FAIRYEAR']; diff --git a/admin/locations.php b/admin/locations.php index 43e7fe9..86a0fd7 100644 --- a/admin/locations.php +++ b/admin/locations.php @@ -25,7 +25,7 @@ require("../common.inc.php"); require("../tableeditor.class.php"); require_once("../user.inc.php"); -user_auth_required('committee', 'admin'); +user_auth_required('admin'); send_header("Event Locations", array('Committee Main' => 'committee_main.php', diff --git a/admin/project_editor.php b/admin/project_editor.php index 4a0cb8a..ac1716f 100644 --- a/admin/project_editor.php +++ b/admin/project_editor.php @@ -26,8 +26,7 @@ require_once('../common.inc.php'); require_once('../user.inc.php'); require_once('../register_participants.inc.php'); -$auth_type = user_auth_required(array('fair','committee'), 'admin'); - +$auth_type = user_auth_required(array(), array('fair','admin')); $registrations_id=intval($_GET['id']); $action = $_GET['action']; diff --git a/admin/regfee_items_manager.php b/admin/regfee_items_manager.php index 40fc984..5232fbd 100644 --- a/admin/regfee_items_manager.php +++ b/admin/regfee_items_manager.php @@ -25,7 +25,7 @@ require("../tableeditor.class.php"); require_once("../user.inc.php"); - user_auth_required('committee', 'admin'); + user_auth_required('admin'); send_header("Registration Fee Items Manager", array('Committee Main' => 'committee_main.php', 'Administration' => 'admin/index.php'), diff --git a/admin/registration.php b/admin/registration.php index 0a632c1..6dc03df 100644 --- a/admin/registration.php +++ b/admin/registration.php @@ -24,7 +24,7 @@ 'committee_main.php', 'Administration' => 'admin/index.php'), diff --git a/admin/registration_list.php b/admin/registration_list.php index 9857c4d..7bfdc3e 100644 --- a/admin/registration_list.php +++ b/admin/registration_list.php @@ -25,7 +25,7 @@ require_once('../common.inc.php'); require_once('../user.inc.php'); -$auth_type = user_auth_required(array('fair','committee'), 'admin'); +$auth_type = user_auth_required(array(), array('fair', 'admin'); //require_once('../register_participants.inc.php'); diff --git a/admin/registration_receivedforms.php b/admin/registration_receivedforms.php index 53b58ff..0669cad 100644 --- a/admin/registration_receivedforms.php +++ b/admin/registration_receivedforms.php @@ -24,7 +24,7 @@ 'committee_main.php', diff --git a/admin/reports.php b/admin/reports.php index 617e3e2..30db59c 100644 --- a/admin/reports.php +++ b/admin/reports.php @@ -36,7 +36,7 @@ switch($_GET['action']) { case 'remove_report': $id = intval($_GET['id']); mysql_query("DELETE FROM reports_committee WHERE - users_id='{$_SESSION['users_uid']}' AND id='$id'"); + users_id='{$_SESSION['accounts_id']}' AND id='$id'"); happy_('Report successfully removed'); exit; case 'reload': @@ -67,7 +67,7 @@ case 'load_report': /* Load available categories */ $q = mysql_query("SELECT DISTINCT category FROM reports_committee - WHERE users_id='{$_SESSION['users_uid']}' + WHERE users_id='{$_SESSION['accounts_id']}' ORDER BY category"); while($i = mysql_fetch_object($q)) $ret['cat'][] = $i->category; @@ -82,7 +82,7 @@ case 'save': if($id == -1) { /* New entry */ mysql_query("INSERT INTO `reports_committee` (`users_id`,`reports_id`) - VALUES('{$_SESSION['users_uid']}','$reports_id');"); + VALUES('{$_SESSION['accounts_id']}','$reports_id');"); echo mysql_error(); $id = mysql_insert_id(); } @@ -240,7 +240,7 @@ $(document).ready(function() { $q = mysql_query("SELECT reports_committee.*,reports.name FROM reports_committee LEFT JOIN reports ON reports.id=reports_committee.reports_id - WHERE users_id='{$_SESSION['users_uid']}' + WHERE users_id='{$_SESSION['accounts_id']}' ORDER BY category,id"); echo mysql_error(); if(mysql_num_rows($q) == 0) { diff --git a/admin/reports_acscript.php b/admin/reports_acscript.php index f6dad03..254f1b6 100644 --- a/admin/reports_acscript.php +++ b/admin/reports_acscript.php @@ -1,7 +1,7 @@ 'committee_main.php', 'Administration' => 'admin/index.php'), diff --git a/admin/reports_committees.inc.php b/admin/reports_committees.inc.php index 03f7d77..2f95cf4 100644 --- a/admin/reports_committees.inc.php +++ b/admin/reports_committees.inc.php @@ -47,7 +47,7 @@ $report_committees_fields = array( 'name' => 'Committee Member -- Email', 'header' => 'Email', 'width' => 50.8 /*mm*/, - 'table' => 'users.email'), + 'table' => 'accounts.email'), 'phone_home' => array( 'name' => 'Committee Member -- Phone (Home)', @@ -160,10 +160,11 @@ $report_committees_fields = array( AND committees_teams.year='$year'"; } */ - $q = " FROM - users + $q = " FROM users + LEFT JOIN user_roles on user_roles.users_id=users.id + LEFT JOIN accounts ON accounts.id=users.accounts_id WHERE - users.types LIKE '%committee%' + user_role.type='committee' "; return $q; diff --git a/admin/reports_editor.php b/admin/reports_editor.php index bf5529e..45641b6 100644 --- a/admin/reports_editor.php +++ b/admin/reports_editor.php @@ -24,7 +24,7 @@ '', 'width' => 2.54 /*mm*/, 'table' => 'MAX(users.year)', - 'group_by' => array('users.uid'), + 'group_by' => array('users.accounts_id'), 'components' => array('users') ), 'static_text' => array( @@ -183,7 +183,7 @@ $report_fundraisings_fields = array( if(in_array('users', $components)) { $users_from = 'LEFT JOIN fundraising_campaigns_users_link ON fundraising_campaigns.id=fundraising_campaigns_users_link.fundraising_campaigns_id - LEFT JOIN users ON users.uid=fundraising_campaigns_users_link.users_uid + LEFT JOIN users ON users.accounts_id=fundraising_campaigns_users_link.users_uid LEFT JOIN users_sponsor ON users_sponsor.users_id=users.id'; $users_where = "users.deleted!='yes' AND"; } diff --git a/admin/reports_gen.php b/admin/reports_gen.php index 48857cb..8e26f76 100644 --- a/admin/reports_gen.php +++ b/admin/reports_gen.php @@ -24,7 +24,7 @@ 0) { $i = mysql_fetch_assoc($q); @@ -216,7 +216,7 @@ case 'dialog_gen': echo '
'; /* See if the report is in this committee member's list */ $q = mysql_query("SELECT * FROM reports_committee - WHERE users_id='{$_SESSION['users_uid']}' + WHERE users_id='{$_SESSION['accounts_id']}' AND reports_id='{$report['id']}'"); echo "

".i18n('My Reports Info')."

"; if(mysql_num_rows($q) > 0) { diff --git a/admin/reports_judges.inc.php b/admin/reports_judges.inc.php index 809ab87..401b34a 100644 --- a/admin/reports_judges.inc.php +++ b/admin/reports_judges.inc.php @@ -23,7 +23,7 @@ require_once('../questions.inc.php'); -/* Take the language array in users_judge, unserialize it, and join it +/* Take the language array in users, unserialize it, and join it * with a space */ function report_judges_languages(&$report, $field, $text) { @@ -69,7 +69,7 @@ function report_judges_divs_at_exp(&$report, $field, $text) $exp = substr($field, 12,1); $long = (strlen($field) == 13) ? false : true; - /* Text is users_judge.div_prefs */ + /* Text is users.div_prefs */ $year = $report['year']; $divprefs = unserialize($text); if(!is_array($divprefs)) return ''; @@ -98,7 +98,7 @@ function report_judges_cats_at_pref(&$report, $field, $text) $pref = $prefs[substr($field, 13,1)]; $long = (strlen($field) == 14) ? false : true; - /* Text is users_judge.cat_prefs */ + /* Text is users.cat_prefs */ $year = $report['year']; $catprefs = unserialize($text); if(!is_array($catprefs)) return ''; @@ -345,9 +345,8 @@ $report_judges_fields = array( 'name' => 'Judge -- Languages', 'header' => 'Lang', 'width' => 19.05 /*mm*/, - 'table' => 'users_judge.languages', - 'exec_function' => 'report_judges_languages', - 'components' => array('users_judge')), + 'table' => 'users.languages', + 'exec_function' => 'report_judges_languages'), 'captain' => array( 'name' => 'Judge Team -- Team Captain? (Is the judge the captain? Yes/No)', @@ -361,52 +360,45 @@ $report_judges_fields = array( 'name' => 'Judge -- Willing Chair', 'header' => 'Will Chair?', 'width' => 25.4 /*mm*/, - 'table' => 'users_judge.willing_chair', - 'value_map' => array ('no' => 'No', 'yes' => 'Yes'), - 'components' => array('users_judge')), + 'table' => 'users.willing_chair', + 'value_map' => array ('no' => 'No', 'yes' => 'Yes')), 'special_award_only' => array( 'name' => 'Judge -- Special Award Only Requested', 'header' => 'SA Only', 'width' => 20.32 /*mm*/, - 'table' => 'users_judge.special_award_only', - 'components' => array('users_judge')), + 'table' => 'users.special_award_only'), 'years_school' => array( 'start_option_group' => 'Judge Experience', 'name' => 'Judge -- Years of Experience at School level', 'header' => 'Sch', 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.years_school', - 'components' => array('users_judge')), + 'table' => 'users.years_school'), 'years_regional' => array( 'name' => 'Judge -- Years of Experience at Regional level', 'header' => 'Rgn', 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.years_regional', - 'components' => array('users_judge')), + 'table' => 'users.years_regional'), 'years_national' => array( 'name' => 'Judge -- Years of Experience at National level', 'header' => 'Ntl', 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.years_national', - 'components' => array('users_judge')), + 'table' => 'users.years_national'), 'highest_psd' => array( 'name' => 'Judge -- Highest Post-Secondary Degree', 'header' => 'Highest PSD', 'width' => 31.75 /*mm*/, - 'table' => 'users_judge.highest_psd', - 'components' => array('users_judge')), + 'table' => 'users.highest_psd'), 'expertise_other' => array( 'name' => 'Judge -- Other Expertise', 'header' => 'Other Expertise', 'width' => 30 /*mm*/, - 'table' => 'users_judge.expertise_other', - 'components' => array('users_judge')), + 'table' => 'users.expertise_other'), /* Headers for Division Expertise/Preference Selection */ @@ -414,49 +406,43 @@ $report_judges_fields = array( 'name' => 'Judge -- Divisions Selected as Expertise 5-Expert (Shortform)', 'header' => 'Expert Div', 'width' => 25.4 /*mm*/, - 'table' => 'users_judge.div_prefs', - 'exec_function' => 'report_judges_divs_at_exp', - 'components' => array('users_judge')), + 'table' => 'users.div_prefs', + 'exec_function' => 'report_judges_divs_at_exp'), 'divs_at_exp_5_long' => array( 'name' => 'Judge -- Divisions Selected as Expertise 5-Expert (Full division names)', 'header' => 'Expert Div', 'width' => 38.1 /*mm*/, - 'table' => 'users_judge.div_prefs', - 'exec_function' => 'report_judges_divs_at_exp', /* Yes, the same function as divs_at_exp_5 */ - 'components' => array('users_judge')), + 'table' => 'users.div_prefs', + 'exec_function' => 'report_judges_divs_at_exp'), /* Yes, the same function as divs_at_exp_5 */ 'divs_at_exp_4' => array( 'name' => 'Judge -- Divisions Selected as Expertise 4 (Shortform)', 'header' => '4 Div', 'width' => 25.4 /*mm*/, - 'table' => 'users_judge.div_prefs', - 'exec_function' => 'report_judges_divs_at_exp', - 'components' => array('users_judge')), + 'table' => 'users.div_prefs', + 'exec_function' => 'report_judges_divs_at_exp'), 'divs_at_exp_4_long' => array( 'name' => 'Judge -- Divisions Selected as Expertise 4 (Full division names)', 'header' => '4 Div', 'width' => 38.1 /*mm*/, - 'table' => 'users_judge.div_prefs', - 'exec_function' => 'report_judges_divs_at_exp', /* Yes, the same function as divs_at_exp_5 */ - 'components' => array('users_judge')), + 'table' => 'users.div_prefs', + 'exec_function' => 'report_judges_divs_at_exp'), /* Yes, the same function as divs_at_exp_5 */ 'divs_at_exp_3' => array( 'name' => 'Judge -- Divisions Selected as Expertise 3 (Shortform)', 'header' => '3 Div', 'width' => 25.4 /*mm*/, - 'table' => 'users_judge.div_prefs', - 'exec_function' => 'report_judges_divs_at_exp', - 'components' => array('users_judge')), + 'table' => 'users.div_prefs', + 'exec_function' => 'report_judges_divs_at_exp'), 'divs_at_exp_3_long' => array( 'name' => 'Judge -- Divisions Selected as Expertise 3 (Full division names)', 'header' => '3 Div', 'width' => 38.1 /*mm*/, - 'table' => 'users_judge.div_prefs', - 'exec_function' => 'report_judges_divs_at_exp', /* Yes, the same function as divs_at_exp_5 */ - 'components' => array('users_judge')), + 'table' => 'users.div_prefs', + 'exec_function' => 'report_judges_divs_at_exp'), /* Yes, the same function as divs_at_exp_5 */ /* Fill these in below, they're all the same */ 'div_exp_1' => array(), 'div_exp_2' => array(), 'div_exp_3' => array(), 'div_exp_4' => array(), 'div_exp_5' => array(), @@ -477,130 +463,114 @@ $report_judges_fields = array( 'name' => 'Judge -- Age Categories Selected as Preference: Highest (Shortform)', 'header' => 'Highest', 'width' => 20.32 /*mm*/, - 'table' => 'users_judge.cat_prefs', - 'exec_function' => 'report_judges_cats_at_pref', - 'components' => array('users_judge')), + 'table' => 'users.cat_prefs', + 'exec_function' => 'report_judges_cats_at_pref'), 'cats_at_pref_H_long' => array( 'name' => 'Judge -- Age Categories Selected as Preference: Highest (Full category names)', 'header' => 'Highest', 'width' => 30.48 /*mm*/, - 'table' => 'users_judge.cat_prefs', - 'exec_function' => 'report_judges_cats_at_pref',/* Yes, the same function as cats_at_pref_H */ - 'components' => array('users_judge')), + 'table' => 'users.cat_prefs', + 'exec_function' => 'report_judges_cats_at_pref'),/* Yes, the same function as cats_at_pref_H */ 'cats_at_pref_h' => array( 'name' => 'Judge -- Age Categories Selected as Preference: High (Shortform)', 'header' => 'High', 'width' => 20.32 /*mm*/, - 'table' => 'users_judge.cat_prefs', - 'exec_function' => 'report_judges_cats_at_pref', - 'components' => array('users_judge')), + 'table' => 'users.cat_prefs', + 'exec_function' => 'report_judges_cats_at_pref'), 'cats_at_pref_h_long' => array( 'name' => 'Judge -- Age Categories Selected as Preference: High (Full category names)', 'header' => 'High', 'width' => 30.48 /*mm*/, - 'table' => 'users_judge.cat_prefs', - 'exec_function' => 'report_judges_cats_at_pref',/* Yes, the same function as cats_at_pref_H */ - 'components' => array('users_judge')), + 'table' => 'users.cat_prefs', + 'exec_function' => 'report_judges_cats_at_pref'),/* Yes, the same function as cats_at_pref_H */ 'cats_at_pref_i' => array( 'name' => 'Judge -- Age Categories Selected as Preference: Indifferent (Shortform)', 'header' => 'Indifferent', 'width' => 20.32 /*mm*/, - 'table' => 'users_judge.cat_prefs', - 'exec_function' => 'report_judges_cats_at_pref', - 'components' => array('users_judge')), + 'table' => 'users.cat_prefs', + 'exec_function' => 'report_judges_cats_at_pref'), 'cats_at_pref_i_long' => array( 'name' => 'Judge -- Age Categories Selected as Preference: Indifferent (Full category names)', 'header' => 'Indifferent', 'width' => 30.48 /*mm*/, - 'table' => 'users_judge.cat_prefs', - 'exec_function' => 'report_judges_cats_at_pref',/* Yes, the same function as cats_at_pref_H */ - 'components' => array('users_judge')), + 'table' => 'users.cat_prefs', + 'exec_function' => 'report_judges_cats_at_pref'),/* Yes, the same function as cats_at_pref_H */ 'cat_pref_1' => array( 'name' => 'Judge -- Age Category Preference for Category ID 1', 'header' => 'cat1', 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.cat_prefs', + 'table' => 'users.cat_prefs', 'editor_disabled' => true, /* Only disables in the report editor, a report can still use it */ - 'exec_function' => 'report_judges_cat_pref', - 'components' => array('users_judge')), + 'exec_function' => 'report_judges_cat_pref'), 'cat_pref_2' => array( 'name' => 'Judge -- Age Category Preference for Category ID 2', 'header' => 'cat2', 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.cat_prefs', + 'table' => 'users.cat_prefs', 'editor_disabled' => true, - 'exec_function' => 'report_judges_cat_pref', - 'components' => array('users_judge')), + 'exec_function' => 'report_judges_cat_pref'), 'cat_pref_3' => array( 'name' => 'Judge -- Age Category Preference for Category ID 3', 'header' => 'cat3', 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.cat_prefs', + 'table' => 'users.cat_prefs', 'editor_disabled' => true, - 'exec_function' => 'report_judges_cat_pref', - 'components' => array('users_judge')), + 'exec_function' => 'report_judges_cat_pref'), 'cat_pref_4' => array( 'name' => 'Judge -- Age Category Preference for Category ID 4', 'header' => 'cat4', 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.cat_prefs', + 'table' => 'users.cat_prefs', 'editor_disabled' => true, - 'exec_function' => 'report_judges_cat_pref', - 'components' => array('users_judge')), + 'exec_function' => 'report_judges_cat_pref'), 'cat_pref_5' => array( 'name' => 'Judge -- Age Category Preference for Category ID 5', 'header' => 'cat5', 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.cat_prefs', + 'table' => 'users.cat_prefs', 'editor_disabled' => true, - 'exec_function' => 'report_judges_cat_pref', - 'components' => array('users_judge')), + 'exec_function' => 'report_judges_cat_pref'), 'cat_pref_6' => array( 'name' => 'Judge -- Age Category Preference for Category ID 6', 'header' => 'cat6', 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.cat_prefs', + 'table' => 'users.cat_prefs', 'editor_disabled' => true, - 'exec_function' => 'report_judges_cat_pref', - 'components' => array('users_judge')), + 'exec_function' => 'report_judges_cat_pref'), 'cat_pref_7' => array( 'name' => 'Judge -- Age Category Preference for Category ID 7', 'header' => 'cat7', 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.cat_prefs', + 'table' => 'users.cat_prefs', 'editor_disabled' => true, - 'exec_function' => 'report_judges_cat_pref', - 'components' => array('users_judge')), + 'exec_function' => 'report_judges_cat_pref'), 'cat_pref_8' => array( 'name' => 'Judge -- Age Category Preference for Category ID 8', 'header' => 'cat8', 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.cat_prefs', + 'table' => 'users.cat_prefs', 'editor_disabled' => true, - 'exec_function' => 'report_judges_cat_pref', - 'components' => array('users_judge')), + 'exec_function' => 'report_judges_cat_pref'), 'cat_pref_9' => array( 'name' => 'Judge -- Age Category Preference for Category ID 9', 'header' => 'cat9', 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.cat_prefs', + 'table' => 'users.cat_prefs', 'editor_disabled' => true, - 'exec_function' => 'report_judges_cat_pref', - 'components' => array('users_judge')), + 'exec_function' => 'report_judges_cat_pref'), 'cat_pref_10' => array( 'name' => 'Judge -- Age Category Preference for Category ID 10', 'header' => 'cat10', 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.cat_prefs', + 'table' => 'users.cat_prefs', 'editor_disabled' => true, - 'exec_function' => 'report_judges_cat_pref', - 'components' => array('users_judge')), + 'exec_function' => 'report_judges_cat_pref'), /* Time Availability */ 'available_in_divisional1' => array( @@ -624,17 +594,15 @@ $report_judges_fields = array( 'name' => 'Judge -- Registration Complete', 'header' => 'Cmpl', 'width' => 10.16 /*mm*/, - 'table' => 'users_judge.judge_complete', - 'value_map' => array ('no' => 'No', 'yes' => 'Yes'), - 'components' => array('users_judge')), + 'table' => 'ROLE_JUDGE.complete', + 'value_map' => array ('no' => 'No', 'yes' => 'Yes')), 'active' => array( 'name' => 'Judge -- Registration Active for this year', 'header' => 'Act', 'width' => 10.16 /*mm*/, - 'table' => 'users_judge.judge_active', - 'value_map' => array ('no' => 'No', 'yes' => 'Yes'), - 'components' => array('users_judge')), + 'table' => 'ROLE_JUDGE.active', + 'value_map' => array ('no' => 'No', 'yes' => 'Yes')), 'year' => array( 'name' => 'Judge -- Year', @@ -648,11 +616,11 @@ $report_judges_fields = array( 'width' => 10 /*mm*/, 'table' => 'users.id'), - 'users_uid' => array( - 'name' => 'Judge -- User Unique ID', + 'users_account_id' => array( + 'name' => 'Judge -- User Account ID (unique for a login)', 'header' => 'UID', 'width' => 10 /*mm*/, - 'table' => 'users.uid'), + 'table' => 'users.accounts_id'), 'team' => array( @@ -891,10 +859,9 @@ for($x=1;$x<=50;$x++) { 'name' => "Judge -- Expertise for Division ID $x", 'header' => "div$x", 'width' => 12.7 /*mm*/, - 'table' => 'users_judge.div_prefs', + 'table' => 'users.div_prefs', 'editor_disabled' => true, /* Only disables in the report editor, a report can still use it */ - 'exec_function' => 'report_judges_div_exp', - 'components' => array('users_judge')); + 'exec_function' => 'report_judges_div_exp'); } /* Overwrite the question_1 .. question_10 fields with the @@ -973,10 +940,6 @@ function report_judges_fromwhere($report, $components) $report_judges_questions_updated = true; } - if(in_array('users_judge', $components)) { - $uj_from = 'LEFT JOIN users_judge ON users_judge.users_id=users.id'; - } - $teams_from = ''; $teams_where = ''; if(in_array('teams', $components)) { @@ -1014,10 +977,11 @@ function report_judges_fromwhere($report, $components) } $q = " FROM users + LEFT JOIN accounts ON accounts.id=users.accounts_id + LEFT JOIN user_roles as ROLE_JUDGE ON (ROLE_JUDGE.users_id=users.id AND ROLE_JUDGE.type='judge') $teams_from $projects_from $students_from - $uj_from WHERE users.types LIKE '%judge%' $year_where diff --git a/admin/reports_judges.php b/admin/reports_judges.php index b71139a..55e2f77 100644 --- a/admin/reports_judges.php +++ b/admin/reports_judges.php @@ -24,7 +24,7 @@ 'committee_main.php', 'Administration' => 'admin/index.php', diff --git a/admin/reports_mailinglabels_generator.php b/admin/reports_mailinglabels_generator.php index 8580134..e194b98 100644 --- a/admin/reports_mailinglabels_generator.php +++ b/admin/reports_mailinglabels_generator.php @@ -24,7 +24,7 @@ 'committee_main.php', 'Administration' => 'admin/index.php') diff --git a/admin/reports_program_awards.php b/admin/reports_program_awards.php index d56114c..e5d8a4f 100644 --- a/admin/reports_program_awards.php +++ b/admin/reports_program_awards.php @@ -1,7 +1,7 @@ 'Volunteer -- Email', 'header' => 'Email', 'width' => 44.45 /*mm*/, - 'table' => 'users.email'), + 'table' => 'accounts.email'), 'phone' => array( 'name' => 'Volunteer -- Phone', @@ -94,9 +94,8 @@ $report_volunteers_fields = array( 'name' => 'Volunteer -- Registration Complete', 'header' => 'Cmpl', 'width' => 10.16 /*mm*/, - 'table' => 'users_volunteer.volunteer_complete', - 'value_map' => array ('no' => 'No', 'yes' => 'Yes'), - 'components' => array('users_volunteer')), + 'table' => 'user_roles.complete', + 'value_map' => array ('no' => 'No', 'yes' => 'Yes')); 'position_name' => array ( 'name' => 'Volunteer Position -- Name', @@ -136,15 +135,10 @@ $report_volunteers_fields = array( function report_volunteers_fromwhere($report, $components) { - global $config, $report_volutneers_fields; + global $config; - $fields = $report_volutneers_fields; $year = $report['year']; - if(in_array('users_volunteer', $components)) { - $uv_from = 'LEFT JOIN users_volunteer ON users_volunteer.users_id=users.id'; - } - $signup_join = ''; $signup_where = ''; @@ -156,12 +150,13 @@ $report_volunteers_fields = array( $signup_where = "AND (volunteer_positions_signup.year = '$year' OR volunteer_positions_signup.year IS NULL)"; } - $q = " FROM - users + $q = " FROM users + LEFT JOIN user_roles on user_roles.users_id=users.id + LEFT JOIN accounts ON accounts.id=users.accounts_id $signup_join $uv_from - WHERE - users.types LIKE '%volunteer%' + WHEE + user_roles.type='volunteer' AND users.year='$year' $signup_where "; diff --git a/admin/schedule.php b/admin/schedule.php index 4ac01dc..eabf3dc 100644 --- a/admin/schedule.php +++ b/admin/schedule.php @@ -26,7 +26,7 @@ require_once("../user.inc.php"); require_once("../schedule.inc.php"); - user_auth_required('committee', 'admin'); + user_auth_required('admin'); if($_GET['action']=="loadschedule") { $date=$_POST['date']; diff --git a/admin/schools.php b/admin/schools.php index c4851fc..dd7f8da 100644 --- a/admin/schools.php +++ b/admin/schools.php @@ -24,7 +24,7 @@ 'committee_main.php', diff --git a/admin/sciencefairs.php b/admin/sciencefairs.php index 328dd06..feca00c 100644 --- a/admin/sciencefairs.php +++ b/admin/sciencefairs.php @@ -24,7 +24,7 @@ 'committee_main.php', diff --git a/admin/settranslation.php b/admin/settranslation.php index dcdf269..03bf3e9 100644 --- a/admin/settranslation.php +++ b/admin/settranslation.php @@ -24,7 +24,7 @@ $ln) { if($l==$config['default_language']) continue; diff --git a/admin/sponsor_contacts.php b/admin/sponsor_contacts.php index 5c9a9ee..0913d4f 100644 --- a/admin/sponsor_contacts.php +++ b/admin/sponsor_contacts.php @@ -24,7 +24,7 @@ 'committee_main.php', diff --git a/admin/student_editor.php b/admin/student_editor.php index 83bdea9..31f0e51 100644 --- a/admin/student_editor.php +++ b/admin/student_editor.php @@ -24,7 +24,7 @@ 'committee_main.php', diff --git a/admin/tours_assignments.php b/admin/tours_assignments.php index db12534..4157eb8 100644 --- a/admin/tours_assignments.php +++ b/admin/tours_assignments.php @@ -25,7 +25,7 @@ /dev/null 2>&1 &"); diff --git a/admin/translations.php b/admin/translations.php index 78fc446..2de53e5 100644 --- a/admin/translations.php +++ b/admin/translations.php @@ -24,7 +24,7 @@ 'committee_main.php', diff --git a/admin/user_editor_window.php b/admin/user_editor_window.php index 7fbd841..19dd716 100644 --- a/admin/user_editor_window.php +++ b/admin/user_editor_window.php @@ -24,7 +24,7 @@ array( diff --git a/admin/user_list.php b/admin/user_list.php index 4b9e806..b20267f 100644 --- a/admin/user_list.php +++ b/admin/user_list.php @@ -25,7 +25,7 @@ require_once('../common.inc.php'); require_once('../user.inc.php'); require_once('../judge.inc.php'); - user_auth_required('committee', 'admin'); + user_auth_required('admin'); require_once('judges.inc.php'); diff --git a/admin/volunteer_positions_manager.php b/admin/volunteer_positions_manager.php index 5c8f4ee..02ee90c 100644 --- a/admin/volunteer_positions_manager.php +++ b/admin/volunteer_positions_manager.php @@ -26,7 +26,7 @@ require_once("../user.inc.php"); require("../tableeditor.class.php"); - user_auth_required('committee', 'admin'); + user_auth_required('admin'); send_header("Volunteer Positions Manager", array("Committee Main" => 'committee_main.php', "Administration" => "admin/", diff --git a/admin/volunteers.php b/admin/volunteers.php index f44d9be..77a6285 100644 --- a/admin/volunteers.php +++ b/admin/volunteers.php @@ -24,7 +24,7 @@ 'committee_main.php', diff --git a/admin/winners.php b/admin/winners.php index 6836b5e..31532d5 100644 --- a/admin/winners.php +++ b/admin/winners.php @@ -27,7 +27,7 @@ require_once('../user.inc.php'); require_once('../projects.inc.php'); require_once('../fair_additional_materials.inc.php'); -$auth_type = user_auth_required(array('fair','committee'), 'admin'); +$auth_type = user_auth_required(array(), array('fair','admin'); $award_awards_id = intval($_GET['award_awards_id']); $action = $_GET['action'];