diff --git a/admin/anneal.inc.php b/admin/anneal.inc.php index 7c49378c..b986b1e6 100644 --- a/admin/anneal.inc.php +++ b/admin/anneal.inc.php @@ -2,7 +2,7 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * * Copyright (C) 2005-2008 Sci-Tech Ontario Inc * Copyright (C) 2008-2012 Youth Science Ontario @@ -46,9 +46,14 @@ class annealer var $rate; var $move_bucket_ids; - function annealer($num_buckets, $start_temp, $start_moves, $rate, - $cost_function_cb, $items) - { + function annealer( + $num_buckets, + $start_temp, + $start_moves, + $rate, + $cost_function_cb, + $items + ) { $this->num_buckets = $num_buckets; $this->start_temp = $start_temp; $this->start_moves = $start_moves; @@ -389,12 +394,12 @@ class annealer function print_bucket($x) { $b = $this->bucket[$x]; - print ("Bucket $x: (cost: {$this->bucket_cost[$x]})\n"); - print (' '); + print("Bucket $x: (cost: {$this->bucket_cost[$x]})\n"); + print(' '); for ($y = 0; $y < count($b); $y++) { - print ("{$b[$y]} "); + print("{$b[$y]} "); } - print ("\n"); + print("\n"); } function print_buckets() diff --git a/admin/award_awardcreatedivisional.php b/admin/award_awardcreatedivisional.php index 449619a2..23632320 100644 --- a/admin/award_awardcreatedivisional.php +++ b/admin/award_awardcreatedivisional.php @@ -2,10 +2,11 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * * Copyright (C) 2005 Sci-Tech Ontario Inc * Copyright (C) 2005 James Grant + * Copyright (C) 2024 AlgoLibre Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -23,14 +24,18 @@ */ ?> 'committee_main.php', +send_header( + 'Create All Divisional Awards', + array( + 'Committee Main' => 'committee_main.php', 'Administration' => 'admin/index.php', - 'Awards Main' => 'admin/awards.php')); + 'Awards Main' => 'admin/awards.php' + ) +); if (get_value_from_array($_GET, 'sponsors_id')) $sponsors_id = $_GET['sponsors_id']; @@ -72,8 +77,8 @@ if ($r->num) { } } else { $divcat = array(); - foreach ($dkeys AS $d) { - foreach ($ckeys AS $c) { + foreach ($dkeys as $d) { + foreach ($ckeys as $c) { $divcat[] = array('c' => $c, 'd' => $d); } } @@ -101,7 +106,7 @@ if ($r->num) { $ord = 1; echo '
'; - foreach ($divcat AS $dc) { + foreach ($divcat as $dc) { $d_id = $dc['d']; $c_id = $dc['c']; $d_division = $div[$d_id]; @@ -129,7 +134,7 @@ if ($r->num) { $ord++; echo '  ' . i18n('Prizes: '); - foreach ($prizes AS $prize) { + foreach ($prizes as $prize) { $q = $pdo->prepare("INSERT INTO award_prizes (award_awards_id,cash,scholarship,value,prize,number,`order`,excludefromac,trophystudentkeeper,trophystudentreturn,trophyschoolkeeper,trophyschoolreturn,year) VALUES ( '$award_awards_id', '{$prize['cash']}', @@ -235,7 +240,7 @@ if ($r->num) { echo '' . i18n('We will create the following awards with the prizes listed above') . ':'; echo '
'; - foreach ($divcat AS $dc) { + foreach ($divcat as $dc) { $d_id = $dc['d']; $c_id = $dc['c']; $d_division = $div[$d_id]; diff --git a/admin/award_awards.php b/admin/award_awards.php index a9473f25..a01dc07f 100644 --- a/admin/award_awards.php +++ b/admin/award_awards.php @@ -2,10 +2,11 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * * Copyright (C) 2005 Sci-Tech Ontario Inc * Copyright (C) 2005 James Grant + * Copyright (C) 2024 AlgoLibre Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -23,23 +24,22 @@ */ ?> prepare("SELECT * FROM award_awards WHERE id='$id'"); $q->execute(); $ret = $q->fetch(PDO::FETCH_ASSOC); // json_encode NEEDS UTF8 DATA, but we store it in the database as ISO :( - foreach ($ret AS $k => $v) { + foreach ($ret as $k => $v) { $ret[$k] = iconv('ISO-8859-1', 'UTF-8', $v); } // echo iconv("ISO-8859-1","UTF-8",json_encode($ret)); @@ -56,6 +56,8 @@ switch ($_GET['action']) { $id = intval($_POST['id']); if ($id == -1) { + error_log("INSERT INTO award_awards (year,self_nominate,schedule_judges) + VALUES ('{$config['FAIRYEAR']}','yes','yes')"); $q = $pdo->prepare("INSERT INTO award_awards (year,self_nominate,schedule_judges) VALUES ('{$config['FAIRYEAR']}','yes','yes')"); $q->execute(); @@ -84,9 +86,10 @@ switch ($_GET['action']) { sponsors_id='" . intval($_POST['sponsors_id']) . "' "; } $q .= "WHERE id='$id'"; + error_log($q); $q = $pdo->prepare($q); $q->execute(); - + show_pdo_errors_if_any($pdo); happy_('Award information saved'); exit; @@ -103,7 +106,7 @@ switch ($_GET['action']) { } // select the current categories that this award is linked to - + $q = $pdo->$prepare("SELECT * FROM award_awards_projectdivisions WHERE award_awards_id='$id'"); $q->execute(); while ($r = $q->fetch(PDO::FETCH_ASSOC)) { @@ -124,7 +127,7 @@ switch ($_GET['action']) { // wipe out any old award-category links $q = $pdo->prepare("DELETE FROM award_awards_projectcategories WHERE award_awards_id='$id'"); $q->execute(); - foreach ($_POST['categories'] AS $key => $cat) { + foreach ($_POST['categories'] as $key => $cat) { $c = intval($cat); $q = $pdo->prepare('INSERT INTO award_awards_projectcategories (award_awards_id, projectcategories_id, year) VALUES (:id, :c, :year)'); @@ -142,7 +145,7 @@ switch ($_GET['action']) { $q->execute(); // now add the new ones - foreach ($_POST['divisions'] AS $key => $div) { + foreach ($_POST['divisions'] as $key => $div) { $d = intval($div); $q = $pdo->prepare('INSERT INTO award_awards_projectdivisions (award_awards_id, projectdivisions_id, year) @@ -188,14 +191,14 @@ switch ($_GET['action']) { case 'prizeinfo_load': $id = intval($_GET['id']); if ($id == -1) { - $q = $pdo->prepare("SELECT * FROM award_prizes WHERE year='-1' AND award_awards_id='0' ORDER BY `order`"); + $q = $pdo->prepare("SELECT * FROM award_prizes WHERE year='-1' AND award_awards_id='0' ORDER BY `order`"); $q->execute(); } else { $q = $pdo->prepare("SELECT * FROM award_prizes WHERE award_awards_id='$id' ORDER BY `order`"); $q->execute(); } while ($r = $q->fetch(PDO::FETCH_ASSOC)) { - foreach ($r AS $k => $v) { + foreach ($r as $k => $v) { $r[$k] = iconv('ISO-8859-1', 'UTF-8', $v); } $ret[] = $r; @@ -208,7 +211,7 @@ switch ($_GET['action']) { $q = $pdo->prepare("SELECT * FROM award_prizes WHERE id='$id'"); $q->execute(); $ret = $q->fetch(PDO::FETCH_ASSOC); - foreach ($ret AS $k => $v) { + foreach ($ret as $k => $v) { $ret[$k] = iconv('ISO-8859-1', 'UTF-8', $v); } echo json_encode($ret); @@ -290,54 +293,61 @@ switch ($_GET['action']) { $q = $pdo->prepare("SELECT * FROM award_awards WHERE id='$id'"); $q->execute(); $a = $q->fetch(PDO::FETCH_ASSOC); - ?> +?>

- + - -

/> -

+ +

/> +

- -

/> -

-
- - - - - - - - - -
:
/>
/>
-

- - - - - - +

/> +

+
+
+ + + + + + + + + + + + + + +
:
/>
/>
+

+ + + + + + + prepare("SELECT * FROM fairs WHERE type='feeder'"); - $q->execute(); - while ($r = $q->fetch(PDO::FETCH_ASSOC)) { - echo ""; - $ch = $dl[$r['id']] == true ? 'checked="checked"' : ''; - echo ""; - $ch = $ul[$r['id']] == true ? 'checked="checked"' : ''; - echo ""; - echo ''; - } - ?> -
{$r['name']}
-
-
- + $q = $pdo->prepare("SELECT * FROM fairs WHERE type='feeder'"); + $q->execute(); + while ($r = $q->fetch(PDO::FETCH_ASSOC)) { + echo "{$r['name']}"; + $ch = $dl[$r['id']] == true ? 'checked="checked"' : ''; + echo ""; + $ch = $ul[$r['id']] == true ? 'checked="checked"' : ''; + echo ""; + echo ''; + } + ?> + + +
+
- 'committee_main.php', +send_header( + 'Awards Management', + array( + 'Committee Main' => 'committee_main.php', 'Administration' => 'admin/index.php', - 'Awards Main' => 'admin/awards.php')); + 'Awards Main' => 'admin/awards.php' + ) +); ?> + // $("#editor_tabs").tabs({ + // show: function(event, ui) { + // switch(ui.panel.id) { + // case 'editor_tab_awardinfo': + // update_awardinfo(); + // break; + // case 'editor_tab_eligibility': + // update_eligibility(); + // break; + // case 'editor_tab_prizes': + // update_prizeinfo(); + // break; + // case 'editor_tab_feeder': + // update_feeder(); + // break; + // } + // return true; + // }, + // collapsible: true, + // selected: -1 /* None selected */ + // }); + }) + - - - fetch(PDO::FETCH_OBJ)) { ?> -
+
'; ?>
- - + +


@@ -1180,12 +1214,12 @@ echo '
'; // echo "Edit prizes for the generic prize template"; if ($_GET['action'] == 'edit_prize_template') { - ?> - + * @@ -22,11 +22,11 @@ */ ?> '; award_prize_delete($ep['id']); } @@ -248,7 +248,7 @@ switch (get_value_from_array($_GET, 'action')) { echo '
'; // remove any awards that are left in the $existingawards array, they must have been removed from the source - foreach ($existingawards AS $aid => $val) { + foreach ($existingawards as $aid => $val) { echo i18n('Removing award id %1 that was removed from external source', array($aid)) . '
'; award_delete($aid); } @@ -257,19 +257,21 @@ switch (get_value_from_array($_GET, 'action')) { exit; } -send_header('Download Awards', - array('Committee Main' => 'committee_main.php', +send_header( + 'Download Awards', + array( + 'Committee Main' => 'committee_main.php', 'Administration' => 'admin/index.php', - 'Awards Main' => 'admin/awards.php')); + 'Awards Main' => 'admin/awards.php' + ) +); ?> - - - - - - + + + + + + + + prepare("SELECT * FROM fairs WHERE enable_awards='yes' ORDER BY name"); -$q->execute(); -while ($r = $q->fetch(PDO::FETCH_OBJ)) { - echo ''; - echo "\n"; - echo ""; - echo ''; - echo ''; - // $checkurl.="&check[]={$r->id}"; -} + $q = $pdo->prepare("SELECT * FROM fairs WHERE enable_awards='yes' ORDER BY name"); + $q->execute(); + while ($r = $q->fetch(PDO::FETCH_OBJ)) { + echo ''; + echo "\n"; + echo ""; + echo ''; + echo ''; + // $checkurl.="&check[]={$r->id}"; + } -/* + /* * if($links) * echo "".i18n("Check all sources").""; */ -?> -
{$r->name}{$r->url}'; - if ($links) - echo "id})\">" . i18n('check') . ''; - else - echo 'n/a'; - echo '
{$r->name}{$r->url}'; + if ($links) + echo "id})\">" . i18n('check') . ''; + else + echo 'n/a'; + echo '
-
-
+ ?> + +
+
+?> \ No newline at end of file diff --git a/admin/award_upload.php b/admin/award_upload.php index e3dbc762..ab148254 100644 --- a/admin/award_upload.php +++ b/admin/award_upload.php @@ -2,7 +2,7 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * * Copyright (C) 2007 James Grant * @@ -21,10 +21,10 @@ * Boston, MA 02111-1307, USA. */ -require_once ('../common.inc.php'); -require_once ('../user.inc.php'); -require_once ('../projects.inc.php'); -require_once ('curl.inc.php'); +require_once('../common.inc.php'); +require_once('../user.inc.php'); +require_once('../projects.inc.php'); +require_once('curl.inc.php'); user_auth_required('committee', 'admin'); // function get_cwsf_award_winners() @@ -33,7 +33,8 @@ function get_winners($awardid, $fairs_id) global $config, $pdo; /* Mappings of the name we want => to the column name returned in MYSQL */ - $school_fields = array('schoolname' => 'school', + $school_fields = array( + 'schoolname' => 'school', 'schoollang' => 'schoollang', 'schoollevel' => 'schoollevel', 'board' => 'board', @@ -44,13 +45,15 @@ function get_winners($awardid, $fairs_id) 'city' => 'city', 'province_code' => 'province_code', 'postalcode' => 'postalcode', - 'schoolemail' => 'schoolemail'); + 'schoolemail' => 'schoolemail' + ); /* 'principal'=>'principal', 'sciencehead'=>'sciencehead', 'scienceheademail'=>'scienceheademail', 'scienceheadphone'=>'scienceheadphone');*/ - $student_fields = array('firstname' => 'firstname', + $student_fields = array( + 'firstname' => 'firstname', 'lastname' => 'lastname', 'email' => 'email', 'gender' => 'sex', @@ -63,7 +66,8 @@ function get_winners($awardid, $fairs_id) 'postalcode' => 'postalcode', 'phone' => 'phone', 'teachername' => 'teachername', - 'teacheremail' => 'teacheremail'); + 'teacheremail' => 'teacheremail' + ); $awards = array(); if ($awardid == -1) { @@ -100,11 +104,13 @@ function get_winners($awardid, $fairs_id) $divmap = unserialize($fair['divmap']); foreach ($awards as $award) { - $winners = array('id' => $award['id'], + $winners = array( + 'id' => $award['id'], 'award_name' => $award['name'], 'external_identifier' => $award['external_identifier'], 'year' => $config['FAIRYEAR'], - 'prizes' => array()); + 'prizes' => array() + ); if ($fair['type'] != 'sfiab') { /* YSC Compatability */ @@ -146,8 +152,10 @@ function get_winners($awardid, $fairs_id) $school[$k] = $schoolr[$v]; /* Pack up the student data too */ - $student = array('xml_type' => 'student', /* for ysc compatability */ - 'school' => $school); + $student = array( + 'xml_type' => 'student', /* for ysc compatability */ + 'school' => $school + ); foreach ($student_fields as $k => $v) $student[$k] = $s[$v]; @@ -158,7 +166,8 @@ function get_winners($awardid, $fairs_id) $div_id = $divmap[$project['projectdivisions_id']]; /* Save the project info => students */ - $prizewinners[] = array('xml_type' => 'project', /* for ysc compatability */ + $prizewinners[] = array( + 'xml_type' => 'project', /* for ysc compatability */ 'projectid' => $project['id'], 'projectnumber' => $project['projectnumber'], 'title' => $project['title'], @@ -167,7 +176,8 @@ function get_winners($awardid, $fairs_id) 'projectcategories_id' => $cat_id, 'projectdivisions_id' => $div_id, 'client_projectdivisions_id' => $project['projectdivisions_id'], - 'students' => $students); + 'students' => $students + ); } /* Save the prize info => projects */ $winners['prizes'][$prize['prize']] = array( @@ -243,8 +253,10 @@ function load_server_cats_divs($fairs_id) $q->execute(); $fair = $q->fetch(PDO::FETCH_ASSOC); - $req = array('get_categories' => array('year' => $config['FAIRYEAR']), - 'get_divisions' => array('year' => $config['FAIRYEAR'])); + $req = array( + 'get_categories' => array('year' => $config['FAIRYEAR']), + 'get_divisions' => array('year' => $config['FAIRYEAR']) + ); $data = curl_query($fair, $req); /* If selected mappings don't exist, try to discover some */ @@ -397,31 +409,34 @@ switch (get_value_from_array($_GET, 'action')) { $q->execute(); $fair = $q->fetch(PDO::FETCH_ASSOC); -?>

-
+?>

+
-
- + + - - - + + + + + "; - echo "'; - } -?> -
{$div['division']} =>
-
-
-{$div['division']} => "; + echo "'; + } + ?> + + +
+ $d) { + foreach ($_POST['div'] as $key => $d) { $div[intval($key)] = intval($d); } @@ -493,255 +508,269 @@ switch (get_value_from_array($_GET, 'action')) { $division_disabled = false; } -?> -

- -
- - - - + + +
+ '; - if (count($p['projects']) == 0) { - echo i18n('No winners to upload'); - continue; - } - foreach ($p['projects'] as &$pr) { -?> - '; + if (count($p['projects']) == 0) { + echo i18n('No winners to upload'); + continue; } - } -?> - - -
'; - exit; -} - -send_header('Award Upload', - array('Committee Main' => 'committee_main.php', - 'Administration' => 'admin/index.php', - 'Awards Main' => 'admin/awards.php')); -echo '
'; - -?> - + echo '
'; - echo "

{$w['award_name']}

"; - foreach ($w['prizes'] as &$p) { - echo '
'; - echo "

{$p['name']}

"; - echo '
     -
-'; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo i18n('Grade') . ': ' . $s['grade']; - echo '
'; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo i18n('School') . ': ' . $s['school']['schoolname']; - echo '
'; - if ($s['grade'] > $highest_grade) - $highest_grade = $s['grade']; - } - $server_cat = ''; - foreach ($server_cats as $c) { - if ($highest_grade >= $c['mingrade'] && $highest_grade <= $c['maxgrade']) { - $server_cat = $c['id']; + foreach ($winners as &$w) { + echo '
'; + echo "

{$w['award_name']}

"; + foreach ($w['prizes'] as &$p) { + echo '
'; + echo "

{$p['name']}

"; + echo '
- - - - - - - - - - -
:
: - -
: ( - )
-

'; + exit; + } - - + send_header( + 'Award Upload', + array( + 'Committee Main' => 'committee_main.php', + 'Administration' => 'admin/index.php', + 'Awards Main' => 'admin/awards.php' + ) + ); + echo '
'; + + ?> + -/* Fairs first */ + + -$q = $pdo->prepare("SELECT fairs.id, fairs.name, fairs.type, COUNT(award_awards.id) as AWARD_COUNT FROM fairs + + prepare("SELECT fairs.id, fairs.name, fairs.type, COUNT(award_awards.id) as AWARD_COUNT FROM fairs LEFT JOIN award_awards ON award_awards.award_source_fairs_id=fairs.id WHERE award_awards.award_source_fairs_id IS NOT NULL AND award_awards.year='{$config['FAIRYEAR']}' GROUP BY fairs.id ORDER BY fairs.name "); -$q->execute(); -show_pdo_errors_if_any($pdo); + $q->execute(); + show_pdo_errors_if_any($pdo); -?> -

:

+ ?> +

:

- - - - - - - + + + + + + + + + fetch(PDO::FETCH_OBJ)) { - $count = count_winners(-1, $r->id); - ?> - - - - '; -} -?> -
Assigned') ?>
Assigned') ?>
name ?>AWARD_COUNT ?> -type == 'sfiab') - echo "id},-1)\" >" . i18n('Send All') . ''; - else - echo "Not available yet, we're working on it!"; - echo '
-
-
+ while ($r = $q->fetch(PDO::FETCH_OBJ)) { + $count = count_winners(-1, $r->id); + ?> + + name ?> + AWARD_COUNT ?> + + + type == 'sfiab') + echo "id},-1)\" >" . i18n('Send All') . ''; + else + echo "Not available yet, we're working on it!"; + echo ''; + } + ?> + +
+
-prepare("SELECT award_awards.id, award_awards.name AS awardname, + $q = $pdo->prepare("SELECT award_awards.id, award_awards.name AS awardname, \t fairs.name as fairname, award_source_fairs_id, \t fairs.type as fairtype, award_awards.external_additional_materials FROM award_awards @@ -749,50 +778,55 @@ $q = $pdo->prepare("SELECT award_awards.id, award_awards.name AS awardname, WHERE award_awards.award_source_fairs_id IS NOT NULL AND award_awards.year='{$config['FAIRYEAR']}' ORDER BY fairs.name, award_awards.name"); -$q->execute(); -show_pdo_errors_if_any($pdo); + $q->execute(); + show_pdo_errors_if_any($pdo); -?> -

:

+ ?> +

:

- - - - - - - -fetch(PDO::FETCH_OBJ)) { - $count = count_winners($r->id, $r->award_source_fairs_id); - ?> - - - - '; + } + ?> +
Assigned') ?>Info') ?>
awardname ?>fairname ?> - 0) - $onclick = "popup_upload({$r->award_source_fairs_id},{$r->id});return false;"; - else - $onclick = "alert('" . i18n('Assign a winner first') . "');return false;"; - ?> - - + + + + + + + + + + + fetch(PDO::FETCH_OBJ)) { + $count = count_winners($r->id, $r->award_source_fairs_id); + ?> + + + + + + '; -} -?> -
Assigned') ?>Info') ?>
awardname ?>fairname ?> + 0) + $onclick = "popup_upload({$r->award_source_fairs_id},{$r->id});return false;"; + else + $onclick = "alert('" . i18n('Assign a winner first') . "');return false;"; + ?> + + -external_additional_materials) { - echo "id}\" target=\"_blank\">" . i18n('download') . ''; - } - echo '
-
+ external_additional_materials) { + echo "id}\" target=\"_blank\">" . i18n('download') . ''; + } + echo '
+
-
+
-"> */ -send_footer(); -?> + "> */ + send_footer(); + ?> \ No newline at end of file diff --git a/admin/awards.inc.php b/admin/awards.inc.php index d3db41b8..0ad2bac3 100644 --- a/admin/awards.inc.php +++ b/admin/awards.inc.php @@ -2,7 +2,7 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * * Copyright (C) 2010 David Grant * @@ -24,14 +24,15 @@ prepare("SELECT id FROM award_prizes WHERE award_awards_id='$award_awards_id'"); $q->execute(); while (($p = $q->fetch(PDO::FETCH_ASSOC))) { - + $q = $pdo->prepare("DELETE FROM winners WHERE awards_prizes_id='{$p['id']}'"); $q->execute(); } @@ -55,7 +56,8 @@ function award_delete($award_awards_id) } function award_prize_delete($award_prizes_id) -{ global $pdo; +{ + global $pdo; $q = $pdo->prepare("DELETE FROM winners WHERE awards_prizes_id='$award_prizes_id'"); $q->execute(); diff --git a/admin/awards.php b/admin/awards.php index 30eec426..9f39d5e4 100644 --- a/admin/awards.php +++ b/admin/awards.php @@ -2,10 +2,11 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * * Copyright (C) 2005 Sci-Tech Ontario Inc * Copyright (C) 2005 James Grant + * Copyright (C) 2024 AlgoLibre Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -23,16 +24,20 @@ */ ?> 'committee_main.php', - 'Administration' => 'admin/index.php'), - 'awards_management'); +send_header( + 'Awards', + array( + 'Committee Main' => 'committee_main.php', + 'Administration' => 'admin/index.php' + ), + 'awards_management' +); -require_once ('rerollprizes.php'); +require_once('rerollprizes.php'); echo '
'; echo '' . i18n('Awards Management') . '
'; diff --git a/admin/cms.php b/admin/cms.php index 42512b2e..54c06bea 100644 --- a/admin/cms.php +++ b/admin/cms.php @@ -2,9 +2,9 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * - * Copyright (C) 2008 James Grant + * Copyright (C) 2024 AlgoLibre Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -22,41 +22,47 @@ */ ?> 'committee_main.php', - 'Administration' => 'admin/index.php'), - 'website_content_management'); +send_header( + 'Website Content Manager', + array( + 'Committee Main' => 'committee_main.php', + 'Administration' => 'admin/index.php' + ), + 'website_content_management' +); ?>
- + new Editor({ + element: document.querySelector('.element'), + extensions: [ + StarterKit.configure({ + heading: { + levels: [1, 2, 3], + }, + }), + ], + }) + $langname) { + foreach ($config['languages'] as $lang => $langname) { $filename = stripslashes(get_value_from_array($_POST, 'filename', '')); // $filename=ereg_replace("[^A-Za-z0-9\.\_\/]","_",$_POST['filename']); @@ -99,7 +105,7 @@ if (get_value_from_array($_GET, 'filename', '') || get_value_from_array($_GET, ' echo ''; echo '
'; - foreach ($config['languages'] AS $lang => $langname) { + foreach ($config['languages'] as $lang => $langname) { echo ''; echo '\n"; echo ''; echo ''; - foreach ($winners AS $winner) { + foreach ($winners as $winner) { echo 'id'\">\n"; - echo " \n"; - echo " \n"; - echo ' \n"; - echo ' '; - echo ' \n"; - echo ' \n"; - echo " \n"; - echo " "; - echo "\n"; - } -?> - -
'; @@ -140,7 +146,7 @@ if (get_value_from_array($_GET, 'filename', '') || get_value_from_array($_GET, ' echo "
'; - require_once ('../fckeditor/fckeditor.php'); + require_once('../fckeditor/fckeditor.php'); $oFCKeditor = new FCKeditor("text_$lang"); $oFCKeditor->BasePath = '../fckeditor/'; @@ -221,4 +227,4 @@ if (get_value_from_array($_GET, 'filename', '') || get_value_from_array($_GET, ' } send_footer(); -?> +?> \ No newline at end of file diff --git a/admin/committees.php b/admin/committees.php index f62db68b..f6784a56 100644 --- a/admin/committees.php +++ b/admin/committees.php @@ -2,10 +2,11 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * * Copyright (C) 2005 Sci-Tech Ontario Inc * Copyright (C) 2005 James Grant + * Copyright (C) 2024 AlgoLibre Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -23,9 +24,9 @@ */ ?> 'committee_main.php', - 'Administration' => 'admin/index.php'), - 'committee_management'); +send_header( + 'Committee Management', + array( + 'Committee Main' => 'committee_main.php', + 'Administration' => 'admin/index.php' + ), + 'committee_management' +); $_SESSION['last_page'] = 'committee_management'; ?> rowCount()) { } send_footer(); -?> - +?> \ No newline at end of file diff --git a/admin/communication.inc.php b/admin/communication.inc.php index fd098128..d39260c0 100644 --- a/admin/communication.inc.php +++ b/admin/communication.inc.php @@ -4,7 +4,7 @@ $mailqueries = array( 'committee_all' => array('name' => 'Committee members (all)', 'query' => - "SELECT u.firstname, u.lastname, u.organization, u.email, u.deleted, q.year FROM users AS u INNER JOIN (SELECT uid, max(year) AS year FROM users GROUP BY uid) AS q ON u.uid = q.uid AND u.year = q.year WHERE u.types LIKE '%committee%' AND u.deleted='no' GROUP BY `u`.`id` ASC"), + "SELECT u.firstname, u.lastname, u.organization, u.email, u.deleted, q.year FROM users AS u INNER JOIN (SELECT uid, max(year) AS year FROM users GROUP BY uid) AS q ON u.uid = q.uid AND u.year = q.year WHERE u.types LIKE '%committee%' AND u.deleted='no' GROUP BY `u`.`id` ASC"), /* The WHERE clause evaluates which rows to add to the GROUP BY, the HAVING clase evaluates which grouped rows show up. We want to to evaluate 'deleted' AFTER the grouping, so we catch @@ -13,35 +13,35 @@ $mailqueries = array( end up picking up a user active in, say 2007 and 2008, but deleted in 2009. */ 'judges_all' => array('name' => 'Judges from all years (except deleted judges)', 'query' => - "SELECT u.firstname, u.lastname, u.email, u.deleted, q.year FROM users AS u INNER JOIN (SELECT uid, max(year) AS year FROM users GROUP BY uid ) AS q ON u.uid = q.uid AND u.year = q.year WHERE u.types LIKE '%judge%' AND u.deleted='no' ORDER BY `u`.`email` ASC"), + "SELECT u.firstname, u.lastname, u.email, u.deleted, q.year FROM users AS u INNER JOIN (SELECT uid, max(year) AS year FROM users GROUP BY uid ) AS q ON u.uid = q.uid AND u.year = q.year WHERE u.types LIKE '%judge%' AND u.deleted='no' ORDER BY `u`.`email` ASC"), 'judges_active_lastyear' => array('name' => 'Judges (all) active from last year', 'query' => - "SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='" . ($config['FAIRYEAR'] - 1) . "' AND deleted='no' AND users_judge.judge_active='yes' ORDER BY email"), + "SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='" . ($config['FAIRYEAR'] - 1) . "' AND deleted='no' AND users_judge.judge_active='yes' ORDER BY email"), 'judges_active_thisyear' => array('name' => 'Judges (all) active for this year', 'query' => - "SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='{$config['FAIRYEAR']}' AND deleted='no' AND users_judge.judge_active='yes' ORDER BY email"), + "SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='{$config['FAIRYEAR']}' AND deleted='no' AND users_judge.judge_active='yes' ORDER BY email"), 'judges_div_active_thisyear' => array('name' => 'Judges (regular judges only) active for this year', 'query' => - "SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='{$config['FAIRYEAR']}' AND deleted='no' AND users_judge.judge_active='yes' AND (users_judge.special_award_only='no' OR users_judge.special_award_only='' OR users_judge.special_award_only IS NULL) ORDER BY email"), + "SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='{$config['FAIRYEAR']}' AND deleted='no' AND users_judge.judge_active='yes' AND (users_judge.special_award_only='no' OR users_judge.special_award_only='' OR users_judge.special_award_only IS NULL) ORDER BY email"), 'judges_spec_active_thisyear' => array('name' => 'Judges (special award judges only) active for this year', 'query' => - "SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='{$config['FAIRYEAR']}' AND deleted='no' AND users_judge.judge_active='yes' AND users_judge.special_award_only='yes' ORDER BY email"), + "SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='{$config['FAIRYEAR']}' AND deleted='no' AND users_judge.judge_active='yes' AND users_judge.special_award_only='yes' ORDER BY email"), 'judges_inactive' => array('name' => 'Judges (all) not active for this year', 'query' => - "SELECT firstname, lastname, email, judge_active, deleted, MAX(year) + "SELECT firstname, lastname, email, judge_active, deleted, MAX(year) FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' GROUP BY uid HAVING deleted='no' AND ((max(year)='{$config['FAIRYEAR']}' AND judge_active='no') OR max(year)<'{$config['FAIRYEAR']}') ORDER BY email"), 'judges_active_complete_thisyear' => array('name' => 'Judges (all) active for this year and complete', 'query' => - "SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='{$config['FAIRYEAR']}' AND users_judge.judge_complete='yes' AND deleted='no' AND users_judge.judge_active='yes' ORDER BY email"), + "SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='{$config['FAIRYEAR']}' AND users_judge.judge_complete='yes' AND deleted='no' AND users_judge.judge_active='yes' ORDER BY email"), 'judges_active_incomplete_thisyear' => array('name' => 'Judges (all) active for this year but not complete', 'query' => - "SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='{$config['FAIRYEAR']}' AND (users_judge.judge_complete!='yes' OR users_judge.judge_complete IS NULL) AND deleted='no' AND users_judge.judge_active='yes' ORDER BY email"), + "SELECT firstname, lastname, email FROM users LEFT JOIN users_judge ON users_judge.users_id=users.id WHERE types LIKE '%judge%' AND year='{$config['FAIRYEAR']}' AND (users_judge.judge_complete!='yes' OR users_judge.judge_complete IS NULL) AND deleted='no' AND users_judge.judge_active='yes' ORDER BY email"), 'participants_complete_thisyear' => array('name' => 'Participants complete this year', 'query' => - "SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.year='" . $config['FAIRYEAR'] . "' AND ( registrations.status='complete' OR registrations.status='paymentpending') ORDER BY students.email"), + "SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.year='" . $config['FAIRYEAR'] . "' AND ( registrations.status='complete' OR registrations.status='paymentpending') ORDER BY students.email"), 'participants_complete_paymentpending_thisyear' => array('name' => 'Participants complete this year but payment pending', 'query' => - "SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.year='" . $config['FAIRYEAR'] . "' AND registrations.status!='complete' AND registrations.status='paymentpending' ORDER BY students.email"), + "SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.year='" . $config['FAIRYEAR'] . "' AND registrations.status!='complete' AND registrations.status='paymentpending' ORDER BY students.email"), 'participants_notcomplete_thisyear' => array('name' => 'Participants not complete this year', 'query' => - "SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.year='" . $config['FAIRYEAR'] . "' AND registrations.status!='complete' AND registrations.status!='new' ORDER BY students.email"), + "SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.year='" . $config['FAIRYEAR'] . "' AND registrations.status!='complete' AND registrations.status!='new' ORDER BY students.email"), 'participants_complete_lastyear' => array('name' => 'Participants complete last year', 'query' => - "SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.year='" . ($config['FAIRYEAR'] - 1) . "' AND ( registrations.status='complete' OR registrations.status='paymentpending') ORDER BY students.email"), + "SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.year='" . ($config['FAIRYEAR'] - 1) . "' AND ( registrations.status='complete' OR registrations.status='paymentpending') ORDER BY students.email"), 'participants_complete_allyears' => array('name' => 'Participants complete all years', 'query' => - "SELECT DISTINCT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND ( registrations.status='complete' OR registrations.status='paymentpending') ORDER BY students.email"), + "SELECT DISTINCT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND ( registrations.status='complete' OR registrations.status='paymentpending') ORDER BY students.email"), 'participants_cwsf_thisyear' => array('name' => 'CWSF Winners for this year', 'query' => " SELECT DISTINCT students.firstname, students.lastname, students.email FROM award_awards @@ -73,9 +73,9 @@ $mailqueries = array( WHERE award_awards.cwsfaward='1' ORDER BY students.email"), 'sponsors' => array('name' => 'Organization sponsors', 'query' => - "SELECT id, organization, email FROM sponsors WHERE email!='' ORDER BY email"), + "SELECT id, organization, email FROM sponsors WHERE email!='' ORDER BY email"), 'sponsors_primarycontacts' => array('name' => 'Organization sponsors (primary contacts)', 'query' => - "SELECT uid, MAX(users.year) AS year, sponsors.organization, users.firstname, users.lastname, users.email, deleted, users_sponsor.primary + "SELECT uid, MAX(users.year) AS year, sponsors.organization, users.firstname, users.lastname, users.email, deleted, users_sponsor.primary FROM sponsors, users_sponsor, users @@ -89,7 +89,7 @@ $mailqueries = array( ORDER BY users.email "), 'sponsors_allcontacts' => array('name' => 'Organization sponsors (all contacts)', 'query' => - "SELECT DISTINCT(users.email), sponsors.organization, users.firstname, users.lastname, users.email + "SELECT DISTINCT(users.email), sponsors.organization, users.firstname, users.lastname, users.email FROM sponsors, users_sponsor, users @@ -102,7 +102,7 @@ $mailqueries = array( ORDER BY users.email "), 'sponsors_specialawards' => array('name' => 'Organization sponsors for Special Awards', 'query' => - "SELECT DISTINCT sponsors.id, organization, email + "SELECT DISTINCT sponsors.id, organization, email FROM sponsors JOIN award_awards ON sponsors.id=award_awards.sponsors_id WHERE @@ -110,7 +110,7 @@ $mailqueries = array( AND award_awards.award_types_id=2 ORDER BY email"), 'sponsors_primarycontacts_specialawards' => array('name' => 'Organization sponsors for Special Awards (primary contacts)', 'query' => - "SELECT DISTINCT uid, MAX(users.year) AS year, sponsors.organization, users.firstname, users.lastname, users.email, deleted, users_sponsor.primary + "SELECT DISTINCT uid, MAX(users.year) AS year, sponsors.organization, users.firstname, users.lastname, users.email, deleted, users_sponsor.primary FROM sponsors, users_sponsor, users, @@ -127,7 +127,7 @@ $mailqueries = array( ORDER BY users.email "), 'sponsors_allcontacts_specialawards' => array('name' => 'Organization sponsors for Special Awards (all contacts)', 'query' => - "SELECT DISTINCT(users.email), sponsors.organization, users.firstname, users.lastname, users.email + "SELECT DISTINCT(users.email), sponsors.organization, users.firstname, users.lastname, users.email FROM sponsors, users_sponsor, users, @@ -151,28 +151,27 @@ $mailqueries = array( * "SELECT DISTINCT(award_sponsors.id), organization, firstname, lastname, award_contacts.email FROM award_sponsors, award_awards, award_contacts WHERE award_awards.sponsors_id=award_sponsors.id AND award_contacts.award_sponsors_id=award_sponsors.id AND award_awards.award_types_id='2' AND award_contacts.year='".$config['FAIRYEAR']."'"), */ 'school_principals' => array('name' => 'School principals', 'query' => - "SELECT schools.principal_uid AS uid, schools.school, users.firstname AS firstname, users.lastname AS lastname, users.email AS email FROM schools + "SELECT schools.principal_uid AS uid, schools.school, users.firstname AS firstname, users.lastname AS lastname, users.email AS email FROM schools JOIN users ON schools.principal_uid=users.uid AND users.id=(SELECT id FROM users WHERE users.uid=schools.principal_uid ORDER BY `year` DESC LIMIT 1) WHERE schools.year='" . $config['FAIRYEAR'] . "' AND users.email!=''"), 'school_scienceheads' => array('name' => 'School science heads', 'query' => - "SELECT schools.sciencehead_uid AS uid, schools.school, users.firstname AS firstname, users.lastname AS lastname, users.email AS email FROM schools + "SELECT schools.sciencehead_uid AS uid, schools.school, users.firstname AS firstname, users.lastname AS lastname, users.email AS email FROM schools JOIN users ON schools.sciencehead_uid=users.uid AND users.id=(SELECT id FROM users WHERE users.uid=schools.sciencehead_uid ORDER BY `year` DESC LIMIT 1) WHERE schools.year='" . $config['FAIRYEAR'] . "' AND users.email!=''"), 'school_with_project_thisyear' => array('name' => 'Schools with projects this year', 'query' => - 'SELECT DISTINCT(sc.schoolemail) AS email, sc.school AS firstname FROM students AS st LEFT JOIN schools AS sc ON sc.id = st.schools_id WHERE st.year = ' . $config['FAIRYEAR'] . ' AND LENGTH( sc.schoolemail ) !=0 ORDER BY email + 'SELECT DISTINCT(sc.schoolemail) AS email, sc.school AS firstname FROM students AS st LEFT JOIN schools AS sc ON sc.id = st.schools_id WHERE st.year = ' . $config['FAIRYEAR'] . ' AND LENGTH( sc.schoolemail ) !=0 ORDER BY email '), 'school_thisyear' => array('name' => 'Schools this year', 'query' => - "SELECT school AS firstname, schoolemail AS email FROM `schools` WHERE `year` ='" . $config['FAIRYEAR'] . "' GROUP BY schoolemail"), + "SELECT school AS firstname, schoolemail AS email FROM `schools` WHERE `year` ='" . $config['FAIRYEAR'] . "' GROUP BY schoolemail"), 'school_teachers_thisyear' => array('name' => 'Teachers (as entered by students) this year', 'query' => - "SELECT teachername AS firstname, teacheremail AS email FROM students WHERE year = '" . $config['FAIRYEAR'] . "' GROUP BY teacheremail"), + "SELECT teachername AS firstname, teacheremail AS email FROM students WHERE year = '" . $config['FAIRYEAR'] . "' GROUP BY teacheremail"), 'school_teachers_lastyear' => array('name' => 'Teachers (as entered by students) last year', 'query' => - "SELECT teachername AS firstname, teacheremail AS email FROM students WHERE year = '" . ($config['FAIRYEAR'] - 1) . "' GROUP BY teacheremail"), + "SELECT teachername AS firstname, teacheremail AS email FROM students WHERE year = '" . ($config['FAIRYEAR'] - 1) . "' GROUP BY teacheremail"), 'school_teachers_allyears' => array('name' => 'Teachers (as entered by students) all years', 'query' => - 'SELECT teachername AS firstname, teacheremail AS email FROM students GROUP BY teacheremail'), + 'SELECT teachername AS firstname, teacheremail AS email FROM students GROUP BY teacheremail'), /* Volunteers */ 'volunteers_active_complete_thisyear' => array('name' => 'Volunteers active for this year and complete', 'query' => - "SELECT id, firstname, lastname, email FROM users LEFT JOIN users_volunteer ON users_volunteer.users_id=users.id WHERE users.year='{$config['FAIRYEAR']}' AND users_volunteer.volunteer_complete='yes' AND users_volunteer.volunteer_active='yes' AND users.deleted='no' AND types LIKE '%volunteer%' ORDER BY email"), + "SELECT id, firstname, lastname, email FROM users LEFT JOIN users_volunteer ON users_volunteer.users_id=users.id WHERE users.year='{$config['FAIRYEAR']}' AND users_volunteer.volunteer_complete='yes' AND users_volunteer.volunteer_active='yes' AND users.deleted='no' AND types LIKE '%volunteer%' ORDER BY email"), 'volunteers_active_incomplete_thisyear' => array('name' => 'Volunteers active for this year but not complete', 'query' => - "SELECT id, firstname, lastname, email FROM users LEFT JOIN users_volunteer ON users_volunteer.users_id=users.id WHERE users.year='{$config['FAIRYEAR']}' AND users_volunteer.volunteer_complete='no' AND users_volunteer.volunteer_active='yes' AND users.deleted='no' AND users.types LIKE '%volunteer%' ORDER BY email"), + "SELECT id, firstname, lastname, email FROM users LEFT JOIN users_volunteer ON users_volunteer.users_id=users.id WHERE users.year='{$config['FAIRYEAR']}' AND users_volunteer.volunteer_complete='no' AND users_volunteer.volunteer_active='yes' AND users.deleted='no' AND users.types LIKE '%volunteer%' ORDER BY email"), ); -?> diff --git a/admin/communication.php b/admin/communication.php index ab366fb7..fdf1debf 100644 --- a/admin/communication.php +++ b/admin/communication.php @@ -2,10 +2,11 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * * Copyright (C) 2005 Sci-Tech Ontario Inc * Copyright (C) 2005 James Grant + * Copyright (C) 2024 AlgoLibre Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -23,8 +24,8 @@ */ ?> prepare("SELECT * FROM emails WHERE id='$emails_id'"); $q->execute(); $e = $q->fetch(PDO::FETCH_ASSOC); - ?> - - - - -
:
:
:
-
-
+?> + + + + + + + + + + + + + + + + + +
:
:
:
+
+
- - + } + }); + quote(stripslashes($name)); - $description = $pdo->quote(stripslashes($description)); - $from = $pdo->quote(stripslashes($from)); - $subject = $pdo->quote(stripslashes($subject)); - $bodyhtml = $pdo->quote(stripslashes($bodyhtml)); + // Now its safe to escape it for the db query + $name = $pdo->quote(stripslashes($name)); + $description = $pdo->quote(stripslashes($description)); + $from = $pdo->quote(stripslashes($from)); + $subject = $pdo->quote(stripslashes($subject)); + $bodyhtml = $pdo->quote(stripslashes($bodyhtml)); - $type = $pdo->quote($_POST['type']); - $key = $pdo->quote($_POST['key']); - $fcid = $pdo->quote($_POST['fcid']); + $type = $pdo->quote($_POST['type']); + $key = $pdo->quote($_POST['key']); + $fcid = $pdo->quote($_POST['fcid']); - if ($id == 0) { - if ($key && $name) { - $q = $pdo->prepare("INSERT INTO emails(type,val) VALUES('$type','$key')"); - $q->execute(); - show_pdo_errors_if_any($pdo); - $id = $pdo->lastInsertId(); - } else { - error_('Email Key and Name are required'); - exit; + if ($id == 0) { + if ($key && $name) { + $q = $pdo->prepare("INSERT INTO emails(type,val) VALUES('$type','$key')"); + $q->execute(); + show_pdo_errors_if_any($pdo); + $id = $pdo->lastInsertId(); + } else { + error_('Email Key and Name are required'); + exit; + } } - } - /* Allow the fundraising campaigns id to be NULL, it'll never be 0 */ - $fcstr = ($fcid == 0) ? 'NULL' : "'$fcid'"; + /* Allow the fundraising campaigns id to be NULL, it'll never be 0 */ + $fcstr = ($fcid == 0) ? 'NULL' : "'$fcid'"; - $body = getTextFromHtml($bodyhtml); - $q = $pdo->prepare("UPDATE emails SET + $body = getTextFromHtml($bodyhtml); + $q = $pdo->prepare("UPDATE emails SET name='$name', description='$description', `from`='$from', @@ -196,421 +215,441 @@ case 'email_save': bodyhtml='$bodyhtml', fundraising_campaigns_id=$fcstr WHERE id='$id'"); - $q->execute(); - show_pdo_errors_if_any($pdo); - happy_('Email Saved'); - exit; - -case 'dialog_edit': - if (array_key_exists('id', $_GET)) { - $id = intval($_GET['id']); - $cloneid = 0; - } else if (array_key_exists('cloneid', $_GET)) { - $id = intval($_GET['cloneid']); - $clone_id = $id; - } else { - /* new email, set defaults which may be specified */ - $id = 0; - $key = htmlspecialchars($_GET['key']); - if (array_key_exists('fundraising_campaigns_id', $_GET)) { - $fcid = intval($_GET['fundraising_campaigns_id']); - $type = 'fundraising'; - $q = $pdo->prepare("SELECT * FROM fundraising_campaigns WHERE id='$fcid'"); - $q->execute(); - $fc = $q->fetch(PDO::FETCH_OBJ); - $name = i18n('%1 communication for %2', array(ucfirst($key), $fc->name)); - } else { - $fcid = 0; - $type = (array_key_exists('type', $_GET)) ? $_GET['type'] : 'user'; - } - - $from = $_SESSION['name'] . ' <' . $_SESSION['email'] . '>'; - } - if ($id) { - $q = $pdo->prepare("SELECT * FROM emails WHERE id='$id'"); $q->execute(); - if ($q->rowCount() != 1) { - echo 'Ambiguous edit'; - exit; - } - $e = $q->fetch(PDO::FETCH_ASSOC); + show_pdo_errors_if_any($pdo); + happy_('Email Saved'); + exit; - /* + case 'dialog_edit': + if (array_key_exists('id', $_GET)) { + $id = intval($_GET['id']); + $cloneid = 0; + } else if (array_key_exists('cloneid', $_GET)) { + $id = intval($_GET['cloneid']); + $clone_id = $id; + } else { + /* new email, set defaults which may be specified */ + $id = 0; + $key = htmlspecialchars($_GET['key']); + if (array_key_exists('fundraising_campaigns_id', $_GET)) { + $fcid = intval($_GET['fundraising_campaigns_id']); + $type = 'fundraising'; + $q = $pdo->prepare("SELECT * FROM fundraising_campaigns WHERE id='$fcid'"); + $q->execute(); + $fc = $q->fetch(PDO::FETCH_OBJ); + $name = i18n('%1 communication for %2', array(ucfirst($key), $fc->name)); + } else { + $fcid = 0; + $type = (array_key_exists('type', $_GET)) ? $_GET['type'] : 'user'; + } + + $from = $_SESSION['name'] . ' <' . $_SESSION['email'] . '>'; + } + if ($id) { + $q = $pdo->prepare("SELECT * FROM emails WHERE id='$id'"); + $q->execute(); + if ($q->rowCount() != 1) { + echo 'Ambiguous edit'; + exit; + } + $e = $q->fetch(PDO::FETCH_ASSOC); + + /* * If we're supposed to clone it, load it then zero out the * id so we make a new record on save, and override the key */ - if ($clone_id) { - $e['id'] = 0; - $e['val'] = $_GET['key']; - $e['fundraising_campaigns_id'] = $_GET['fundraising_campaigns_id']; + if ($clone_id) { + $e['id'] = 0; + $e['val'] = $_GET['key']; + $e['fundraising_campaigns_id'] = $_GET['fundraising_campaigns_id']; + } + $emails_id = $e['id']; + $name = htmlspecialchars($e['name']); + $key = htmlspecialchars($e['val']); + $description = htmlspecialchars($e['description']); + $from = htmlspecialchars($e['from']); + if (!$from && $config['fairmanageremail']) + $from = 'Fair Manager <' . $config['fairmanageremail'] . '>'; + $subject = htmlspecialchars($e['subject']); + $body = $e['body']; + $bodyhtml = $e['bodyhtml']; + $fcid = intval($e['fundraising_campaigns_id']); + if ($bodyhtml == '') + $bodyhtml = nl2br($body); } - $emails_id = $e['id']; - $name = htmlspecialchars($e['name']); - $key = htmlspecialchars($e['val']); - $description = htmlspecialchars($e['description']); - $from = htmlspecialchars($e['from']); - if (!$from && $config['fairmanageremail']) - $from = 'Fair Manager <' . $config['fairmanageremail'] . '>'; - $subject = htmlspecialchars($e['subject']); - $body = $e['body']; - $bodyhtml = $e['bodyhtml']; - $fcid = intval($e['fundraising_campaigns_id']); - if ($bodyhtml == '') - $bodyhtml = nl2br($body); - } ?> - - - + + var oFCKeditor = new FCKeditor('bodyhtml'); + oFCKeditor.BasePath = "../fckeditor/"; + oFCKeditor.ToolbarSet = 'sfiab'; + oFCKeditor.Width = "100%"; + oFCKeditor.Height = 300; + // $('#fck').html(oFCKeditor.CreateHtml()); + oFCKeditor.ReplaceTextarea(); + - - + } + }); + prepare("SELECT * FROM emails WHERE `val`='" . $_GET['template'] . "'"); - $emailq->execute(); - $e = $emailq->fetch(PDO::FETCH_ASSOC); - } else - $e = null; + if ($_GET['template']) { + $emailq = $pdo->prepare("SELECT * FROM emails WHERE `val`='" . $_GET['template'] . "'"); + $emailq->execute(); + $e = $emailq->fetch(PDO::FETCH_ASSOC); + } else + $e = null; - $from = htmlspecialchars($_SESSION['name'] . ' <' . $_SESSION['email'] . '>'); - $to = htmlspecialchars($u['emailrecipient']); - $subject = htmlspecialchars($e['subject']); + $from = htmlspecialchars($_SESSION['name'] . ' <' . $_SESSION['email'] . '>'); + $to = htmlspecialchars($u['emailrecipient']); + $subject = htmlspecialchars($e['subject']); - // useless but we might as well have it - $name = htmlspecialchars($e['name']); - $key = htmlspecialchars($e['val']); - $description = htmlspecialchars($e['description']); + // useless but we might as well have it + $name = htmlspecialchars($e['name']); + $key = htmlspecialchars($e['val']); + $description = htmlspecialchars($e['description']); - // do the replacements from the template now, so what the person see's is what gets sent. - $body = communication_replace_vars($e['body'], $u); - $bodyhtml = communication_replace_vars($e['bodyhtml'], $u); + // do the replacements from the template now, so what the person see's is what gets sent. + $body = communication_replace_vars($e['body'], $u); + $bodyhtml = communication_replace_vars($e['bodyhtml'], $u); - // if there's no html,. grab the html from the non-html version - if ($bodyhtml == '') - $bodyhtml = nl2br($body); + // if there's no html,. grab the html from the non-html version + if ($bodyhtml == '') + $bodyhtml = nl2br($body); ?> -
' . i18n('Project Division / CWSF Project Division') . '
'; echo ''; echo $winner['projectnumber'] . ' - ' . $winner['title']; echo ''; echo '
'; - foreach ($winner['students'] AS $s) { + foreach ($winner['students'] as $s) { echo ' '; echo ' '; echo ' '; @@ -261,7 +266,7 @@ if ($ok) { echo ' @@ -1388,7 +1388,7 @@ echo '
'; +?> - -'.i18n('Select which statistics to request from the feeder fair').'

'; - } else { - echo '

'.i18n('Not supported for upstream fairs').'

'; - exit; - } +/* Load the user we're editting */ +$u = user_load($_SESSION['embed_edit_id']); +/* Load the fair attached to the user */ +$q = $pdo->prepare("SELECT * FROM fairs WHERE id={$u['fairs_id']}"); +$q->execute(); +$f = $q->fetch(PDO::FETCH_ASSOC); -?> - - -
-$d) { - $ch = in_array($s, $selected_stats) ? 'checked="checked"' : ''; - echo ""; - echo ""; - } ?> -
".i18n($d)."
-
- - - +

+ + ' . i18n('Select which statistics to request from the feeder fair') . '

'; + } else { + echo '

' . i18n('Not supported for upstream fairs') . '

'; + exit; + } + + ?> +
+ + + $d) { + $ch = in_array($s, $selected_stats) ? 'checked="checked"' : ''; + echo ""; + echo ""; + } + ?> + +
" . i18n($d) . "
+
+ +
\ No newline at end of file diff --git a/admin/fix_judges_autocomplete.php b/admin/fix_judges_autocomplete.php index 91a839ac..d3f36bb3 100644 --- a/admin/fix_judges_autocomplete.php +++ b/admin/fix_judges_autocomplete.php @@ -1,7 +1,7 @@ fetch(PDO::FETCH_OBJ)) { $stmt->execute([$id, $config['FAIRYEAR']]); show_pdo_errors_if_any($pdo); } - -?> diff --git a/admin/fundraising.php b/admin/fundraising.php index 6724afd9..6c148d8d 100644 --- a/admin/fundraising.php +++ b/admin/fundraising.php @@ -2,7 +2,7 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * * Copyright (C) 2009 James Grant * @@ -22,113 +22,115 @@ */ ?> -

- + prepare("SELECT * FROM fundraising_goals WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY deadline"); $q->execute(); -?> - - - - - - - - - - - fetch(PDO::FETCH_OBJ)) { - // lookup all donations made towards this goal - $recq = $pdo->prepare("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_goal='$r->goal' AND fiscalyear='{$config['FISCALYEAR']}' AND status='received'"); - $recq->execute(); - show_pdo_errors_if_any($pdo); - $recr = $recq->fetch(PDO::FETCH_OBJ); - $received = $recr->received; - if ($r->budget) - $percent = round($received / $r->budget * 100, 1); - else - $percent = 0; + ?> +
+ + + + + + + + + + fetch(PDO::FETCH_OBJ)) { + // lookup all donations made towards this goal + $recq = $pdo->prepare("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_goal='$r->goal' AND fiscalyear='{$config['FISCALYEAR']}' AND status='received'"); + $recq->execute(); + show_pdo_errors_if_any($pdo); + $recr = $recq->fetch(PDO::FETCH_OBJ); + $received = $recr->received; + if ($r->budget) + $percent = round($received / $r->budget * 100, 1); + else + $percent = 0; - echo ""; - echo ''; - echo ''; - $col = colour_to_percent($percent); - echo ""; - echo '\n"; - } -?> -
$r->name' . format_money($r->budget, false) . '' . format_money($received, false) . '{$percent}%' . format_date($r->deadline) . "
-
- -

- - - - - - - - - - - - - -prepare("SELECT * FROM fundraising_campaigns WHERE fiscalyear='{$config['FISCALYEAR']}'"); - $q->execute(); - - while ($r = $q->fetch(PDO::FETCH_OBJ)) { - $goalq = $pdo->prepare("SELECT * FROM fundraising_goals WHERE goal='{$r->fundraising_goal}' AND fiscalyear='{$config['FISCALYEAR']}'"); - $goalq->execute(); - $goalr = $goalq->fetch(PDO::FETCH_OBJ); - $recq = $pdo->prepare("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_campaigns_id='$r->id' AND fiscalyear='{$config['FISCALYEAR']}' AND status='received'"); - $recq->execute(); - show_pdo_errors_if_any($pdo); - $recr = $recq->fetch(PDO::FETCH_OBJ); - $received = $recr->received; - if ($r->target) - $percent = round($received / $r->target * 100, 1); - else - $percent = 0; - $col = colour_to_percent($percent); - - if (!$goalr) { - $goalr = new stdClass(); - $goalr->name = ''; + echo ""; + echo ''; + echo ''; + $col = colour_to_percent($percent); + echo ""; + echo '\n"; } + ?> +
$r->name' . format_money($r->budget, false) . '' . format_money($received, false) . '{$percent}%' . format_date($r->deadline) . "
+
- echo "
$r->name$r->type' . format_date($r->startdate) . "' . format_date($r->enddate) . '' . format_money($r->target, false) . "' . format_money($received, false) . "{$percent}%$goalr->name
- -
+

+ + + + + + + + + + + + + + prepare("SELECT * FROM fundraising_campaigns WHERE fiscalyear='{$config['FISCALYEAR']}'"); + $q->execute(); - -

-

-prepare("SELECT id,value, thanked, status, sponsors_id, datereceived, + while ($r = $q->fetch(PDO::FETCH_OBJ)) { + $goalq = $pdo->prepare("SELECT * FROM fundraising_goals WHERE goal='{$r->fundraising_goal}' AND fiscalyear='{$config['FISCALYEAR']}'"); + $goalq->execute(); + $goalr = $goalq->fetch(PDO::FETCH_OBJ); + $recq = $pdo->prepare("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_campaigns_id='$r->id' AND fiscalyear='{$config['FISCALYEAR']}' AND status='received'"); + $recq->execute(); + show_pdo_errors_if_any($pdo); + $recr = $recq->fetch(PDO::FETCH_OBJ); + $received = $recr->received; + if ($r->target) + $percent = round($received / $r->target * 100, 1); + else + $percent = 0; + $col = colour_to_percent($percent); + + if (!$goalr) { + $goalr = new stdClass(); + $goalr->name = ''; + } + + echo "id'\">\n"; + echo " \n"; + echo " \n"; + echo ' \n"; + echo ' '; + echo ' \n"; + echo ' \n"; + echo " \n"; + echo " "; + echo "\n"; + } + ?> + +
$r->name$r->type' . format_date($r->startdate) . "' . format_date($r->enddate) . '' . format_money($r->target, false) . "' . format_money($received, false) . "{$percent}%$goalr->name
+ +
+ + +

+

+ prepare("SELECT id,value, thanked, status, sponsors_id, datereceived, \tDATE_ADD(datereceived, INTERVAL 1 MONTH) < NOW() AS onemonth, \tDATE_ADD(datereceived, INTERVAL 2 MONTH) < NOW() AS twomonth FROM fundraising_donations @@ -136,55 +138,55 @@ if (get_value_from_array($_GET, 'action') == 'refresh') { AND fiscalyear='{$config['FISCALYEAR']}' ORDER BY datereceived "); - $q->execute(); - show_pdo_errors_if_any($pdo); + $q->execute(); + show_pdo_errors_if_any($pdo); - if ($q->rowCount()) { - echo ''; - echo '\n"; - echo '\n"; - echo '\n"; - echo '\n"; - echo '\n"; - echo "\n"; + if ($q->rowCount()) { + echo '
' . i18n('Name') . "' . i18n('Date Received') . "' . i18n('Amount') . "' . i18n('Generate Thank You') . "' . i18n('Thanked') . "
'; + echo '\n"; + echo '\n"; + echo '\n"; + echo '\n"; + echo '\n"; + echo "\n"; - while ($r = $q->fetch(PDO::FETCH_OBJ)) { - $dq = $pdo->prepare("SELECT organization AS name FROM sponsors WHERE id='$r->sponsors_id'"); - $dq->execute(); - $dr = $dq->fetch(PDO::FETCH_OBJ); - if ($r->twomonth) - $s = 'style="background-color: ' . colour_to_percent(0) . ';"'; - else if ($r->onemonth) - $s = 'style="background-color: ' . colour_to_percent(50) . ';"'; - else - $s = ''; + while ($r = $q->fetch(PDO::FETCH_OBJ)) { + $dq = $pdo->prepare("SELECT organization AS name FROM sponsors WHERE id='$r->sponsors_id'"); + $dq->execute(); + $dr = $dq->fetch(PDO::FETCH_OBJ); + if ($r->twomonth) + $s = 'style="background-color: ' . colour_to_percent(0) . ';"'; + else if ($r->onemonth) + $s = 'style="background-color: ' . colour_to_percent(50) . ';"'; + else + $s = ''; - $u = getUserForSponsor($r->sponsors_id); + $u = getUserForSponsor($r->sponsors_id); - echo ""; - echo " "; - echo ' '; - echo ' '; - echo ' '; - } else { - echo i18n('No contact'); + echo ""; + echo " "; + echo ' '; + echo ' '; + echo ' '; + } else { + echo i18n('No contact'); + } + echo "\n"; + echo "\n"; } - echo "\n"; - echo "\n"; + echo "
' . i18n('Name') . "' . i18n('Date Received') . "' . i18n('Amount') . "' . i18n('Generate Thank You') . "' . i18n('Thanked') . "
$dr->name' . format_date($r->datereceived) . '' . format_money($r->value) . ''; - if ($u) { - echo "" . i18n('Generate Thank You') . '
$dr->name' . format_date($r->datereceived) . '' . format_money($r->value) . ''; + if ($u) { + echo "" . i18n('Generate Thank You') . 'id\" onclick=\"return thanked($r->id)\">
id\" onclick=\"return thanked($r->id)\">
\n"; + } else { + echo i18n("No Thank You's pending"); + echo "
\n"; } - echo "
\n"; - } else { - echo i18n("No Thank You's pending"); - echo "
\n"; - } -?> - + ?> + -
-

- +

+ prepare("SELECT value, receiptrequired, receiptsent, status, sponsors_id, datereceived, \tDATE_ADD(datereceived, INTERVAL 1 MONTH) < NOW() AS onemonth, \tDATE_ADD(datereceived, INTERVAL 2 MONTH) < NOW() AS twomonth @@ -227,11 +229,11 @@ if (get_value_from_array($_GET, 'action') == 'refresh') { echo i18n('No Receipts pending'); echo "
\n"; } -?> + ?> -
-

- +

+ prepare('SELECT * FROM fundraising_campaigns WHERE followupdate>=NOW() ORDER BY followupdate LIMIT 5'); $q->execute(); show_pdo_errors_if_any($pdo); @@ -251,9 +253,9 @@ if (get_value_from_array($_GET, 'action') == 'refresh') { echo "
\n"; } -?> -
-

Upcoming Proposals

+ ?> +
+

Upcoming Proposals

prepare('SELECT * FROM sponsors WHERE fundingselectiondate>=NOW() OR proposalsubmissiondate>=NOW() ORDER BY fundingselectiondate LIMIT 5'); $q->execute(); @@ -279,45 +281,47 @@ if (get_value_from_array($_GET, 'action') == 'refresh') { exit; } else if (get_value_from_array($_POST, 'thanked')) { - foreach ($_POST['thanked'] AS $t) { + foreach ($_POST['thanked'] as $t) { $stmt = $pdo->prepare("UPDATE fundraising_donations SET thanked='yes' WHERE id='$t'"); $stmt->execute(); } } -send_header('Fundraising', - array('Committee Main' => 'committee_main.php', +send_header( + 'Fundraising', + array( + 'Committee Main' => 'committee_main.php', 'Administration' => 'admin/index.php', - 'Fundraising' => 'admin/fundraising.php'), - 'fundraising'); + 'Fundraising' => 'admin/fundraising.php' + ), + 'fundraising' +); ?>
+?> \ No newline at end of file diff --git a/admin/fundraising_campaigns.php b/admin/fundraising_campaigns.php index c92cc6df..321c2c09 100644 --- a/admin/fundraising_campaigns.php +++ b/admin/fundraising_campaigns.php @@ -2,7 +2,7 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * * Copyright (C) 2009 James Grant * @@ -22,10 +22,10 @@ */ ?> id}\" />\n"; echo "\n"; display_campaign_form($r); - ?> - - -
-
-
- - - + + +
+ + + + + + + -

-
-
- - - - - -
-
-
-
-
- +

+
+
+ + + + + + +
+
+ +
+
+
+ - - - - - - - - - - - - - -prepare("SELECT * FROM fundraising_campaigns WHERE fiscalyear='{$config['FISCALYEAR']}'"); - $q->execute(); - while ($r = $q->fetch(PDO::FETCH_OBJ)) { - $goalq = $pdo->prepare("SELECT * FROM fundraising_goals WHERE goal='{$r->fundraising_goal}' AND fiscalyear='{$config['FISCALYEAR']}'"); - $goalq->execute(); - $goalr = $goalq->fetch(PDO::FETCH_OBJ); - $recq = $pdo->prepare("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_campaigns_id='$r->id' AND fiscalyear='{$config['FISCALYEAR']}' AND status='received'"); - $recq->execute(); - show_pdo_errors_if_any($pdo); - $recr = $recq->fetch(PDO::FETCH_OBJ); - $received = $recr->received; - if ($r->target) - $percent = round($received / $r->target * 100, 1); - else - $percent = 0; - $col = colour_to_percent($percent); +
+ + + + + + + + + + + + + prepare("SELECT * FROM fundraising_campaigns WHERE fiscalyear='{$config['FISCALYEAR']}'"); + $q->execute(); + while ($r = $q->fetch(PDO::FETCH_OBJ)) { + $goalq = $pdo->prepare("SELECT * FROM fundraising_goals WHERE goal='{$r->fundraising_goal}' AND fiscalyear='{$config['FISCALYEAR']}'"); + $goalq->execute(); + $goalr = $goalq->fetch(PDO::FETCH_OBJ); + $recq = $pdo->prepare("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_campaigns_id='$r->id' AND fiscalyear='{$config['FISCALYEAR']}' AND status='received'"); + $recq->execute(); + show_pdo_errors_if_any($pdo); + $recr = $recq->fetch(PDO::FETCH_OBJ); + $received = $recr->received; + if ($r->target) + $percent = round($received / $r->target * 100, 1); + else + $percent = 0; + $col = colour_to_percent($percent); - if (!$goalr) { - $goalr = new stdClass(); - $goalr->name = ''; + if (!$goalr) { + $goalr = new stdClass(); + $goalr->name = ''; + } + + echo "id)\">\n"; + echo " \n"; + echo " \n"; + echo ' \n"; + echo ' '; + echo ' \n"; + echo ' \n"; + echo " \n"; + echo " "; + echo "\n"; } - - echo "id)\">\n"; - echo " \n"; - echo " \n"; - echo ' \n"; - echo ' '; - echo ' \n"; - echo ' \n"; - echo " \n"; - echo " "; - echo "\n"; - } -?> -
$r->name$r->type' . format_date($r->startdate) . "' . format_date($r->enddate) . '' . format_money($r->target, false) . "' . format_money($received, false) . "{$percent}%$goalr->name
$r->name$r->type' . format_date($r->startdate) . "' . format_date($r->enddate) . '' . format_money($r->target, false) . "' . format_money($received, false) . "{$percent}%$goalr->name
- -
- + + +
+ execute(); $campaign = $q->fetch(PDO::FETCH_OBJ); echo "

$campaign->name

\n"; -?> -
-
    -
  • -
  • -
  • -
  • -
-
- overview tab + ?> +
+
    +
  • +
  • +
  • +
  • +
+
+ overview tab +
+
+ donations tab +
+
+ prospects tab +
+
+ communications tab +
-
- donations tab -
-
- prospects tab -
-
- communications tab -
-
-' . i18n('Donor Type') . '' . i18n(ucfirst($params['donortype'])) . "\n"; if (is_array($params['donationhistory'])) { echo '' . i18n('Donation History') . ''; - foreach ($params['donationhistory'] AS $d) { + foreach ($params['donationhistory'] as $d) { echo i18n($donationhistorylist[$d]) . "
\n"; } echo "\n"; @@ -277,20 +283,20 @@ case 'managelist': // echo "\n"; if (is_array($params['emailaddress'])) { echo '' . i18n('Email Address') . ''; - foreach ($params['emailaddress'] AS $e) { + foreach ($params['emailaddress'] as $e) { echo i18n($emailaddresslist[$e]) . "
\n"; } echo "\n"; } if ($params['donortype'] == 'individual' && is_array($params['individual_type'])) { echo '' . i18n('Role') . ''; - foreach ($params['individual_type'] AS $e) { + foreach ($params['individual_type'] as $e) { echo i18n($rolelist[$e]) . "
\n"; } echo "\n"; } else if (is_array($params['contacttype'])) { echo '' . i18n('Role') . ''; - foreach ($params['contacttype'] AS $e) { + foreach ($params['contacttype'] as $e) { echo i18n(ucfirst($e)) . '
'; } echo "\n"; @@ -337,71 +343,91 @@ case 'managelist': // echo "\n"; echo "\n"; } else { - ?> -

-
- - - -
: -
-
-
- +

+ + + + + + + +
: +
+
+
+ - - +
\ No newline at end of file diff --git a/translationseditor.js.php b/translationseditor.js.php index b501e42d..45032ec2 100644 --- a/translationseditor.js.php +++ b/translationseditor.js.php @@ -1,11 +1,11 @@ var currentLang=''; var translateLangs=new Array(); $ln) { +foreach ($config['languages'] as $l => $ln) { if ($l == $_SESSION['lang']) continue; echo "translateLangs[$x]=\"$l\";\n"; @@ -14,53 +14,53 @@ foreach ($config['languages'] AS $l => $ln) { ?> $(document).ready(function() { - //add a link right after any element that has the class "translatable" - $(".translatable").each( function(i) { - $(this).after(" "); - }); +//add a link right after any element that has the class "translatable" +$(".translatable").each( function(i) { +$(this).after(" "); +}); - //add a click handler to the previously added link - $("[href*=\\#translate]").on('click', function() { - popup_translator($(this).prev().val()); - return false; - }); +//add a click handler to the previously added link +$("[href*=\\#translate]").on('click', function() { +popup_translator($(this).prev().val()); +return false; +}); - //initialize the dialog - $("#translation_editor").dialog({ - bgiframe: true, autoOpen: false, - modal: true, resizable: false, - draggable: false - }); +//initialize the dialog +$("#translation_editor").dialog({ +bgiframe: true, autoOpen: false, +modal: true, resizable: false, +draggable: false +}); }); function popup_translator(str) { - var w = (document.documentElement.clientWidth * 0.6); - var h = (document.documentElement.clientHeight * 0.4); +var w = (document.documentElement.clientWidth * 0.6); +var h = (document.documentElement.clientHeight * 0.4); - $('#translation_editor').dialog('option','width',w); - $('#translation_editor').dialog('option','height',h); - $('#translation_editor').dialog('option','buttons',{ "": function() { save_translations(); }, - "": function(){ $(this).dialog("close");}}); - $('#translation_editor').dialog('open'); +$('#translation_editor').dialog('option','width',w); +$('#translation_editor').dialog('option','height',h); +$('#translation_editor').dialog('option','buttons',{ "": function() { save_translations(); }, +"": function(){ $(this).dialog("close");}}); +$('#translation_editor').dialog('open'); - $('#translate_str').html(str); - $('#translate_str_hidden').val(str); +$('#translate_str').html(str); +$('#translate_str_hidden').val(str); - $.getJSON("/admin/gettranslation.php?str="+escape(str),function(json){ - for(var i=0;i/admin/gettranslation.php?str="+escape(str),function(json){ +for(var i=0;i/admin/settranslation.php", $("#translationform").serialize(), function(data) { - $('#translation_editor').dialog('close'); + $('#translation_editor').dialog('close'); }); return false; -} + } \ No newline at end of file diff --git a/user.inc.php b/user.inc.php index 7d7fd8b5..3cee9355 100644 --- a/user.inc.php +++ b/user.inc.php @@ -2,10 +2,11 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * * Copyright (C) 2005 Sci-Tech Ontario Inc * Copyright (C) 2005 James Grant + * Copyright (C) 2024 AlgoLibre Inc. * Copyright (C) 2007 David Grant * * This program is free software; you can redistribute it and/or @@ -24,9 +25,10 @@ */ ?> 'Participant', +$user_what = array( + 'student' => 'Participant', 'judge' => 'Judge', 'committee' => 'Committee Member', 'volunteer' => 'Volunteer', @@ -36,7 +38,8 @@ $user_what = array('student' => 'Participant', 'teacher' => 'Teacher', 'parent' => 'Parent', 'alumni' => 'Alumni', - 'mentor' => 'Mentor'); + 'mentor' => 'Mentor' +); $user_types = array_keys($user_what); function user_valid_type($type) @@ -103,8 +106,12 @@ function user_load_judge(&$u) // $u['highest_psd'] = $u['highest_psd']; /* Sanity check the arrays, make sure they are arrays */ - $should_be_arrays = array('cat_prefs', 'div_prefs', - 'divsub_prefs', 'languages'); + $should_be_arrays = array( + 'cat_prefs', + 'div_prefs', + 'divsub_prefs', + 'languages' + ); foreach ($should_be_arrays as $k) { if (!is_array($u[$k])) $u[$k] = array(); @@ -249,7 +256,7 @@ function user_load($user, $uid = false) $ts = array(); $ret['types'] = $ts; /* Now we can use in_array('judge', $ret['types']) ; */ - + /* Convenience */ $ret['name'] = ($ret['firstname'] ? "{$ret['firstname']} " : '') . $ret['lastname']; @@ -419,8 +426,16 @@ function user_save_volunteer($u) function user_save_committee($u) { - $fields = array('committee_complete', 'committee_active', 'emailprivate', 'ord', 'displayemail', 'access_admin', - 'access_config', 'access_super'); + $fields = array( + 'committee_complete', + 'committee_active', + 'emailprivate', + 'ord', + 'displayemail', + 'access_admin', + 'access_config', + 'access_super' + ); user_save_type_list($u, 'users_committee', $fields); committee_status_update($u); } @@ -428,10 +443,23 @@ function user_save_committee($u) // two new fields added: private_info and flagged_judge function user_save_judge($u) { - $fields = array('judge_active', 'judge_complete', 'years_school', 'years_regional', 'years_national', - 'willing_chair', 'special_award_only', - 'cat_prefs', 'div_prefs', 'divsub_prefs', - 'expertise_other', 'languages', 'highest_psd', 'private_info', 'flagged_judge'); + $fields = array( + 'judge_active', + 'judge_complete', + 'years_school', + 'years_regional', + 'years_national', + 'willing_chair', + 'special_award_only', + 'cat_prefs', + 'div_prefs', + 'divsub_prefs', + 'expertise_other', + 'languages', + 'highest_psd', + 'private_info', + 'flagged_judge' + ); user_save_type_list($u, 'users_judge', $fields); } @@ -478,11 +506,28 @@ function user_save(&$u) $q->execute([$u['id']]); } - $fields = array('salutation', 'firstname', 'lastname', 'username', + $fields = array( + 'salutation', + 'firstname', + 'lastname', + 'username', 'email', - 'phonehome', 'phonework', 'phonecell', 'fax', 'organization', - 'address', 'address2', 'city', 'province', 'postalcode', 'sex', - 'firstaid', 'cpr', 'types', 'lang'); + 'phonehome', + 'phonework', + 'phonecell', + 'fax', + 'organization', + 'address', + 'address2', + 'city', + 'province', + 'postalcode', + 'sex', + 'firstaid', + 'cpr', + 'types', + 'lang' + ); $set = ''; foreach ($fields as $f) { @@ -694,7 +739,7 @@ function user_purge($u, $type = false) function user_dupe_row($table, $key, $val, $newval) { global $config, $pdo; - $nullfields = array('id','sex','deleteddatetime'); /* Fields that can be null */ + $nullfields = array('id', 'sex', 'deleteddatetime'); /* Fields that can be null */ $q = $pdo->prepare("SELECT * FROM $table WHERE $key='$val'"); $q->execute(); if ($q->rowCount() != 1) { @@ -817,7 +862,7 @@ function user_create($type, $username, $u = NULL) $stmt = $pdo->prepare("UPDATE users SET email='$username' WHERE id='$uid'"); $stmt->execute(); } - + $stmt = $pdo->prepare("UPDATE users SET uid='$uid' WHERE id='$uid'"); $stmt->execute(); show_pdo_errors_if_any($pdo); @@ -923,7 +968,7 @@ function user_auth_required($type, $access = '') if ($auth_type == false) { message_push(error(i18n('You do not have permission to view that page'))); header("location: {$config['SFIABDIRECTORY']}/user_login.php?type=$type[0]"); - exit; + exit; } /* Forward to password expired, remember the target URI */ @@ -1020,8 +1065,10 @@ function user_personal_info_status(&$u) { $required = array(); foreach ($u['types'] as $t) { - $required = array_merge($required, - user_personal_required_fields($t)); + $required = array_merge( + $required, + user_personal_required_fields($t) + ); } foreach ($required as $r) { $val = trim($u[$r]); diff --git a/user_activate.php b/user_activate.php index aadfcc45..0893500a 100644 --- a/user_activate.php +++ b/user_activate.php @@ -10,6 +10,7 @@ * Copyright (C) 2005 Sci-Tech Ontario Inc * Copyright (C) 2005 James Grant * Copyright (C) 2024 AlgoLibre Inc. + * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -27,8 +28,8 @@ */ ?> "{$type}_main.php")); + send_header( + 'Role and Account Management', + array("$m Main" => "{$type}_main.php") + ); } ?>
- + -' . i18n("Role: {$user_what[$t]}") . ''; - echo "
"; - if ($u["{$t}_active"] == 'yes') { - echo happy(i18n('Active')); - $a = 'disabled="disabled"'; - $d = ''; - } else { - echo notice(i18n('Deactivated')); - $a = ''; - $d = 'disabled="disabled"'; - } + ' . i18n("Role: {$user_what[$t]}") . ''; + echo "
"; + if ($u["{$t}_active"] == 'yes') { + echo happy(i18n('Active')); + $a = 'disabled="disabled"'; + $d = ''; + } else { + echo notice(i18n('Deactivated')); + $a = ''; + $d = 'disabled="disabled"'; + } ?> -
+
- + +
- onclick="activate('');return false;" type="submit" value=""> - - onclick="deactivate('');return false;" type="submit" value=""> - - onclick="remove('');return false;" type="submit" value=""> + + + + +
+ onclick="activate('');return false;" type="submit" value=""> + + onclick="deactivate('');return false;" type="submit" value=""> + + onclick="remove('');return false;" type="submit" value=""> -
-
-
-'; +
+
+
+ '; -echo '
    '; -echo '
  • ' . i18n('An Active Role indicates you would like to participate in the %1 %2 as that role (Judge, Volunteer, etc.)', array($config['FAIRYEAR'], $config['fairname'])); -echo '
  • ' . i18n('A Deactivated Role indicates you cannot participate in the deactivated roles this year, but would like remain on the mailing lists for future years. You can activate your deactivated role at any time.'); -echo '
  • ' . i18n('The Remove Role button completely deletes the role from your account. You will not receive future emails for the removed role. This action cannot be undone.'); -echo '
  • ' . i18n('The Delete Entire Account button below completely deletes your entire account. You will not receive any future email for any roles. It completely removes you from the system. This action cannot be undone.'); -echo '
'; + echo '
    '; + echo '
  • ' . i18n('An Active Role indicates you would like to participate in the %1 %2 as that role (Judge, Volunteer, etc.)', array($config['FAIRYEAR'], $config['fairname'])); + echo '
  • ' . i18n('A Deactivated Role indicates you cannot participate in the deactivated roles this year, but would like remain on the mailing lists for future years. You can activate your deactivated role at any time.'); + echo '
  • ' . i18n('The Remove Role button completely deletes the role from your account. You will not receive future emails for the removed role. This action cannot be undone.'); + echo '
  • ' . i18n('The Delete Entire Account button below completely deletes your entire account. You will not receive any future email for any roles. It completely removes you from the system. This action cannot be undone.'); + echo '
'; -echo ""; -echo ""; -echo ''; -echo '
'; + echo "
"; + echo ""; + echo ''; + echo '
'; -if (get_value_from_array($_SESSION, 'embed') != true) - send_footer(); -?> + if (get_value_from_array($_SESSION, 'embed') != true) + send_footer(); + ?> \ No newline at end of file diff --git a/user_invite.php b/user_invite.php index d4c0c68f..248263f1 100644 --- a/user_invite.php +++ b/user_invite.php @@ -10,6 +10,7 @@ * Copyright (C) 2005 Sci-Tech Ontario Inc * Copyright (C) 2005 James Grant * Copyright (C) 2024 AlgoLibre Inc. + * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -27,8 +28,8 @@ */ ?> 'committee_main.php', - 'Administration' => 'admin/index.php')); +send_header( + 'Invite Users', + array( + 'Committee Main' => 'committee_main.php', + 'Administration' => 'admin/index.php' + ) +); -require_once ('ajax.inc.php'); +require_once('ajax.inc.php'); ?> - + '; @@ -198,30 +200,43 @@ if (get_value_from_array($_POST, 'action', '') && get_value_from_array($_POST, ' user_save($u); $password = user_set_password($u['id'], NULL); - - email_send("{$type}_new_invite", $u['email'], + + email_send( + "{$type}_new_invite", + $u['email'], array('FAIRNAME' => $config['fairname']), - array('FAIRNAME' => $config['fairname'], + array( + 'FAIRNAME' => $config['fairname'], 'EMAIL' => $u['email'], - 'PASSWORD' => $password)); + 'PASSWORD' => $password + ) + ); echo happy(i18n('%1 has been invited to be a %2', array($u['email'], $user_what[$type]))); echo happy(i18n('An email has been sent to %1', array($u['email']))); break; case 'norole': /* Add role to the existing user */ user_create($type, $u['username'], $u); - email_send("{$type}_add_invite", $u['email'], + email_send( + "{$type}_add_invite", + $u['email'], array('FAIRNAME' => $config['fairname']), - array('FAIRNAME' => $config['fairname'])); + array('FAIRNAME' => $config['fairname']) + ); echo happy(i18n('%1 is now also a %2', array($u['email'], $user_what[$type]))); echo happy(i18n('An email has been sent to %1', array($u['email']))); break; case 'noyear': /* Send a reminder email */ - email_send("{$type}_activate_reminder", $u['email'], + email_send( + "{$type}_activate_reminder", + $u['email'], array('FAIRNAME' => $config['fairname']), - array('FAIRNAME' => $config['fairname'], - 'EMAIL' => $u['email'])); + array( + 'FAIRNAME' => $config['fairname'], + 'EMAIL' => $u['email'] + ) + ); echo happy(i18n('An email has been sent to %1', array($u['email']))); break; } @@ -251,4 +266,4 @@ echo '\n"; send_footer(); -?> +?> \ No newline at end of file diff --git a/user_login.php b/user_login.php index 1f26f850..9053e127 100644 --- a/user_login.php +++ b/user_login.php @@ -10,6 +10,7 @@ * Copyright (C) 2005 Sci-Tech Ontario Inc * Copyright (C) 2005 James Grant * Copyright (C) 2024 AlgoLibre Inc. + * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -27,8 +28,8 @@ */ ?> "user_login.php?type=$type")); + send_header( + "{$user_what[$type]} - Password Recovery", + array("{$user_what[$type]} Login" => "user_login.php?type=$type") + ); $recover_link = "user_login.php?type=$type&action=recover"; - ?> -
-
-
-
- - - - - -
- : -
- : -
- : -
- -
-
-
-
+?> +
+
+
+
+ + + + + + + + + + + + + + + + + +
+ : +
+ : +
+ : +
+ +
+
+
+
-

-

+id, NULL); - + /* volunteer_recover_password, judge_recover_password, student_recover_password, committee_recover_password */ - email_send("{$type}_recover_password", + email_send( + "{$type}_recover_password", $email, array('FAIRNAME' => i18n($config['fairname'])), - array('PASSWORD' => $password, - 'EMAIL' => $email)); + array( + 'PASSWORD' => $password, + 'EMAIL' => $email + ) + ); message_push(notice(i18n('If you credentials match, your new password has been sent to your email address.'))); header("Location: user_login.php?type=$type"); @@ -389,41 +408,59 @@ if (get_value_from_array($_POST, 'action') == 'login') { $recover_link = "user_login.php?type=$type&action=recover"; $new_link = "user_new.php?type=$type"; - ?> -
"> - - - -
- : -
- : -
- /> -
-
+?> +
"> + + + + + + + + + + + + + +
+ : +
+ : +
+ /> +
+

- click here to recover it") ?>.

+ click here to recover it") ?>.

click here.
"); break; case 'closed': - echo i18n('Registration for the %1 %2 is now closed', - array($config['FAIRYEAR'], - $config['fairname']), - array('Fair year', 'Fair name')); + echo i18n( + 'Registration for the %1 %2 is now closed', + array( + $config['FAIRYEAR'], + $config['fairname'] + ), + array('Fair year', 'Fair name') + ); break; case 'notpermitted': default: @@ -432,5 +469,4 @@ if (get_value_from_array($_POST, 'action') == 'login') { } send_footer(); -?> - +?> \ No newline at end of file diff --git a/user_multirole.php b/user_multirole.php index a6b9d09e..bc914865 100644 --- a/user_multirole.php +++ b/user_multirole.php @@ -10,6 +10,7 @@ * Copyright (C) 2005 Sci-Tech Ontario Inc * Copyright (C) 2005 James Grant * Copyright (C) 2024 AlgoLibre Inc. + * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -27,8 +28,8 @@ */ ?> * Copyright (C) 2005 James Grant * Copyright (C) 2024 AlgoLibre Inc. + * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -27,8 +28,8 @@ */ ?> "user_login.php?type=$type")); + send_header( + "{$user_what[$type]} Registration", + array("{$user_what[$type]} Login" => "user_login.php?type=$type") + ); echo i18n("{$user_what[$type]} registration is not open"); echo '
'; send_footer(); @@ -92,8 +95,10 @@ if ($reg_open != 'open') { } if ($reg_mode == 'invite') { - send_header("{$user_what[$type]} Registration", - array("{$user_what[$type]} Login" => "user_login.php?type=$type")); + send_header( + "{$user_what[$type]} Registration", + array("{$user_what[$type]} Login" => "user_login.php?type=$type") + ); output_page_text("register_{$type}_invite"); echo '
'; @@ -139,15 +144,19 @@ switch ($action) { $stmt = $pdo->prepare("UPDATE users SET deleted='no' WHERE id='$r->id'"); $stmt->execute(); message_push(happy(i18n('Your account has been undeleted'))); - message_push(notice(i18n("Use the 'recover password' option on the %1 {$user_what[$type]} login page %2 if you have forgotten your password", - array("", '')))); + message_push(notice(i18n( + "Use the 'recover password' option on the %1 {$user_what[$type]} login page %2 if you have forgotten your password", + array("", '') + ))); header("Location: user_login.php?type=$type"); exit; } else if ($r->deleted == 'no') { if (in_array($type, $types)) { message_push(error(i18n("That email address has an existing {$user_what[$type]} registration"))); - message_push(notice(i18n("Use the 'recover password' option on the %1 {$user_what[$type]} login page %2 if you have forgotten your password", - array("", '')))); + message_push(notice(i18n( + "Use the 'recover password' option on the %1 {$user_what[$type]} login page %2 if you have forgotten your password", + array("", '') + ))); break; /* Don't want to create an account */ } else { /* @@ -215,12 +224,17 @@ switch ($action) { user_save($u); /* Send the email */ - email_send($welcome_email, $data_email, + email_send( + $welcome_email, + $data_email, array('FAIRNAME' => i18n($config['fairname'])), - array('PASSWORD' => $u['password'], + array( + 'PASSWORD' => $u['password'], 'EMAIL' => $data_email, 'FIRSTNAME' => $data_fn, - 'LASTNAME' => $data_ln)); + 'LASTNAME' => $data_ln + ) + ); /* now redirect to the login page */ message_push(happy(i18n('Your new password has been sent to your email address. Please check your email and use the password to login'))); @@ -228,22 +242,36 @@ switch ($action) { exit; } -send_header("{$user_what[$type]} Registration", - array("{$user_what[$type]} Login" => "user_login.php?type=$type")); +send_header( + "{$user_what[$type]} Registration", + array("{$user_what[$type]} Login" => "user_login.php?type=$type") +); ?> -
+ - + ?> +
- : -
- : -
- : -
+ + + + + + + + + + + +
+ : +
+ : +
+ : +

/> -
- +'; - echo i18n("When you click the 'Register' button, your password will be randomly created and emailed to you. When you login for the first time you will be prompted to change your password. It can sometimes take several minutes for the email to send, so be patient."); - echo '
'; - } - send_footer(); - ?> +if (!isset($_SESSION['users_id'])) { + echo '
'; + echo i18n("When you click the 'Register' button, your password will be randomly created and emailed to you. When you login for the first time you will be prompted to change your password. It can sometimes take several minutes for the email to send, so be patient."); + echo '
'; +} +send_footer(); +?> \ No newline at end of file diff --git a/user_page.inc.php b/user_page.inc.php index d8789d66..79001d9e 100644 --- a/user_page.inc.php +++ b/user_page.inc.php @@ -10,6 +10,7 @@ * Copyright (C) 2005 Sci-Tech Ontario Inc * Copyright (C) 2005 James Grant * Copyright (C) 2024 AlgoLibre Inc. + * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public diff --git a/user_password.php b/user_password.php index 66876c5b..8d04ba2e 100644 --- a/user_password.php +++ b/user_password.php @@ -2,10 +2,11 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * * Copyright (C) 2005 Sci-Tech Ontario Inc * Copyright (C) 2005 James Grant + * Copyright (C) 2024 AlgoLibre Inc. * Copyright (C) 2007 David Grant * * This program is free software; you can redistribute it and/or @@ -24,8 +25,8 @@ */ ?> "{$type}_main.php"), - 'change_password'); + 'change_password' +); if (get_value_from_array($_SESSION, 'password_expired') == true) { echo i18n('Your password has expired. You must choose a new password now.'); diff --git a/user_personal.php b/user_personal.php index 24586227..4f3f1d2b 100644 --- a/user_personal.php +++ b/user_personal.php @@ -2,10 +2,11 @@ /* * This file is part of the 'Science Fair In A Box' project - * SFIAB Website: http://www.sfiab.ca + * Science-ation Website: https://science-ation.ca/ * * Copyright (C) 2005 Sci-Tech Ontario Inc * Copyright (C) 2005 James Grant + * Copyright (C) 2024 AlgoLibre Inc. * Copyright (C) 2007 David Grant * * This program is free software; you can redistribute it and/or @@ -24,9 +25,9 @@ */ ?> array('name' => $config['provincestate']), 'organization' => array('name' => 'Organization'), 'sex' => array('name' => 'Gender'), - 'firstaid' => array('name' => 'First Aid Training', - 'type' => 'yesno'), - 'cpr' => array('name' => 'CPR Training', - 'type' => 'yesno'), - 'phonehome' => array('name' => 'Phone (Home)', + 'firstaid' => array( + 'name' => 'First Aid Training', + 'type' => 'yesno' + ), + 'cpr' => array( + 'name' => 'CPR Training', + 'type' => 'yesno' + ), + 'phonehome' => array( + 'name' => 'Phone (Home)', 'regexp' => '/^[1-9][0-9]{2}-?[1-9][0-9]{2}-?[0-9]{4}( x[0-9]{1,5})?$/', - 'format' => "'NNN-NNN-NNNN' or 'NNNNNNNNNN' or 'NNN-NNN-NNNN xEXT'"), - 'phonecell' => array('name' => 'Phone (Cell)', + 'format' => "'NNN-NNN-NNNN' or 'NNNNNNNNNN' or 'NNN-NNN-NNNN xEXT'" + ), + 'phonecell' => array( + 'name' => 'Phone (Cell)', 'regexp' => '/^[1-9][0-9]{2}-?[1-9][0-9]{2}-?[0-9]{4}$/', - 'format' => "'NNN-NNN-NNNN' or 'NNNNNNNNNN'"), - 'phonework' => array('name' => 'Phone (Work)', + 'format' => "'NNN-NNN-NNNN' or 'NNNNNNNNNN'" + ), + 'phonework' => array( + 'name' => 'Phone (Work)', 'regexp' => '/^[1-9][0-9]{2}-?[1-9][0-9]{2}-?[0-9]{4}( x[0-9]{1,5})?$/', - 'format' => "'NNN-NNN-NNNN' or 'NNNNNNNNNN' or 'NNN-NNN-NNNN xEXT'"), - 'fax' => array('name' => 'Fax', + 'format' => "'NNN-NNN-NNNN' or 'NNNNNNNNNN' or 'NNN-NNN-NNNN xEXT'" + ), + 'fax' => array( + 'name' => 'Fax', 'regexp' => '/^[1-9][0-9]{2}-?[1-9][0-9]{2}-?[0-9]{4}$/', - 'format' => "'NNN-NNN-NNNN' OR 'NNNNNNNNNN'"), - 'postalcode' => array('name' => $config['postalzip'], + 'format' => "'NNN-NNN-NNNN' OR 'NNNNNNNNNN'" + ), + 'postalcode' => array( + 'name' => $config['postalzip'], 'regexp' => '/^(([A-Z][0-9][A-Z]( )?[0-9][A-Z][0-9])|([0-9]{5}))$/i', - 'format' => "'ANA NAN' or 'ANANAN' or 'NNNNN'"), + 'format' => "'ANA NAN' or 'ANANAN' or 'NNNNN'" + ), ); /* Sort out who we're editting */ @@ -92,10 +107,14 @@ $fields = array(); $required = array(); $errorfields = array(); foreach ($u['types'] as $t) { - $fields = array_merge($fields, - user_personal_fields($t)); - $required = array_merge($required, - user_personal_required_fields($t)); + $fields = array_merge( + $fields, + user_personal_fields($t) + ); + $required = array_merge( + $required, + user_personal_required_fields($t) + ); } switch (get_value_from_array($_GET, 'action')) { @@ -178,32 +197,32 @@ if (get_value_from_array($_SESSION, 'embed') == true) { echo '

' . i18n('Personal Information') . '

'; echo '
'; } else { - send_header("Personal Information for {$u['firstname']} {$u['lastname']}", + send_header( + "Personal Information for {$u['firstname']} {$u['lastname']}", array($user_what[$type] . ' Registration' => "{$type}_main.php"), - 'edit_profile'); + 'edit_profile' + ); } $newstatus = user_personal_info_status($u); ?> '; @@ -334,7 +353,7 @@ if (in_array('lang', $fields)) { echo ''; echo '