diff --git a/register_participants.inc.php b/register_participants.inc.php index 9ee15a65..1e7722c1 100644 --- a/register_participants.inc.php +++ b/register_participants.inc.php @@ -161,6 +161,7 @@ function projectStatus($reg_id = '') function mentorStatus($reg_id = '') { global $config, $pdo; + $required_fields = array('firstname', 'lastname', 'phone', 'email', 'organization', 'description'); if ($reg_id) @@ -173,7 +174,8 @@ function mentorStatus($reg_id = '') $q->execute([$rid, $config['FAIRYEAR']]); $r = $q->fetch(PDO::FETCH_OBJ); - if ($r->nummentors === -1 or $r->nummentors == null) { + + if ($r->nummentors === -1 || $r->nummentors === null) { return 'incomplete'; } @@ -181,7 +183,7 @@ function mentorStatus($reg_id = '') $q->execute([$rid, $config['FAIRYEAR']]); // if we dont have the minimum, return incomplete - if ($q->rowCount() < get_value_from_array($config, 'minmentorserproject')) + if ($q->rowCount() < get_value_from_array($config, 'minmentorsperproject')) return 'incomplete'; while ($r = $q->fetch(PDO::FETCH_OBJ)) { @@ -326,7 +328,7 @@ function generateProjectNumber($registration_id) $reg_id = $registration_id; - $q = $pdo->prepare("SELECT projects.projectcategories_id, + $q = $pdo->prepare('SELECT projects.projectcategories_id, projects.projectdivisions_id, projectcategories.category_shortform, projectdivisions.division_shortform @@ -340,7 +342,7 @@ function generateProjectNumber($registration_id) AND projects.projectcategories_id=projectcategories.id AND projectcategories.year=? AND projectdivisions.year=? - "); + '); $q->execute([$reg_id, $config['FAIRYEAR'], $config['FAIRYEAR']]); show_pdo_errors_if_any($pdo); $r = $q->fetch(PDO::FETCH_OBJ); @@ -359,11 +361,10 @@ function generateProjectNumber($registration_id) * get replaced. */ foreach (array('number', 'sort') as $x) { - $p[$x]['str'] = preg_replace('/[CcDd]/', '{\\0}', $p[$x]['str']); - $p[$x]['str'] = preg_replace('/(N|X)([0-9])?/', '{\\0}', $p[$x]['str']); + $p[$x]['str'] = preg_replace('/[CcDd]/', '{\0}', $p[$x]['str']); + $p[$x]['str'] = preg_replace('/(N|X)([0-9])?/', '{\0}', $p[$x]['str']); } - /* * Do some replacements that we don't have to do anything fancy with, * and setup some variables for future queries @@ -377,7 +378,6 @@ function generateProjectNumber($registration_id) $p[$x]['x_used'] = array(); } - /* * Build a total list of projects for finding a global number, and * while constructing the list, build a list for the division/cat @@ -463,7 +463,6 @@ function generateProjectNumber($registration_id) } } - return array( $p['number']['str'], $p['sort']['str'], diff --git a/register_participants_emergencycontact.php b/register_participants_emergencycontact.php index 6d2c1b9d..b6d35cfa 100644 --- a/register_participants_emergencycontact.php +++ b/register_participants_emergencycontact.php @@ -143,6 +143,7 @@ while ($sr = $sq->fetch(PDO::FETCH_OBJ)) { $stmt->execute([ $_SESSION['registration_id'], $sr->id, + $config['FAIRYEAR'] ]); $id = $pdo->lastInsertId(); unset($r); diff --git a/register_participants_mentor.php b/register_participants_mentor.php index 6e2d076f..6ee05b8c 100644 --- a/register_participants_mentor.php +++ b/register_participants_mentor.php @@ -72,37 +72,33 @@ if (get_value_from_array($_POST, 'action') == 'save') { // only insert if we have a name if ($_POST['lastname'][$x]) { // INSERT new record - $stmt = $pdo->prepare('INSERT INTO mentors (registrations_id,firstname,lastname,email,phone,organization,position,description,year) VALUES ( - ?, - ?, - ?, - ?, - ?, - ?, - ?, - ?, - ?)'); - $stmt->execute([$_SESSION['registration_id'],stripslashes($_POST['firstname'][$x]),stripslashes($_POST['lastname'][$x]), - stripslashes($_POST['email'][$x]),stripslashes($_POST['phone'][$x]),stripslashes($_POST['organization'][$x]),stripslashes($_POST['position'][$x]), - stripslashes($_POST['description'][$x]),$config['FAIRYEAR']]); + $stmt = $pdo->prepare('INSERT INTO mentors (registrations_id,firstname,lastname,email,phone,organization,position,description,year) VALUES (' + . "'" . $_SESSION['registration_id'] . "', " + . "'" . stripslashes($_POST['firstname'][$x]) . "', " + . "'" . stripslashes($_POST['lastname'][$x]) . "', " + . "'" . stripslashes($_POST['email'][$x]) . "', " + . "'" . stripslashes($_POST['phone'][$x]) . "', " + . "'" . stripslashes($_POST['organization'][$x]) . "', " + . "'" . stripslashes($_POST['position'][$x]) . "', " + . "'" . stripslashes($_POST['description'][$x]) . "', " + . "'" . $config['FAIRYEAR'] . "')"); + $stmt->execute(); show_pdo_errors_if_any($pdo); echo notice(i18n('%1 %2 successfully added', array($_POST['firstname'][$x], $_POST['lastname'][$x]))); } } else { // UPDATE existing record - $stmt = $pdo->prepare('UPDATE mentors SET - ?, - ?, - ?, - ?, - . "organization=?," - . "position=?", - . "description=?" - . "WHERE id=?"'); - $stmt->execute([stripslashes($_POST['firstname'][$x]),stripslashes($_POST['lastname'][$x]),stripslashes($_POST['email'][$x]), - stripslashes($_POST['phone'][$x]),stripslashes($_POST['organization'][$x]),stripslashes($_POST['position'][$x]), - stripslashes($_POST['description'][$x]),$_POST['id'][$x]]); + $stmt = $pdo->prepare('UPDATE mentors SET ' + . "firstname='" . stripslashes($_POST['firstname'][$x]) . "', " + . "lastname='" . stripslashes($_POST['lastname'][$x]) . "', " + . "email='" . stripslashes($_POST['email'][$x]) . "', " + . "phone='" . stripslashes($_POST['phone'][$x]) . "', " + . "organization='" . stripslashes($_POST['organization'][$x]) . "', " + . "position='" . stripslashes($_POST['position'][$x]) . "', " + . "description='" . stripslashes($_POST['description'][$x]) . "' " + . "WHERE id='" . $_POST['id'][$x] . "'"); + $stmt->execute(); echo notice(i18n('%1 %2 successfully updated', array($_POST['firstname'][$x], $_POST['lastname'][$x]))); } $x++; @@ -147,7 +143,6 @@ if (isset($_GET['nummentors'])) { $numtoshow = $numfound; // output the current status - $newstatus = mentorStatus(); if ($newstatus != 'complete') { diff --git a/register_participants_project_divisionselector.php b/register_participants_project_divisionselector.php index f3e96717..d7938762 100644 --- a/register_participants_project_divisionselector.php +++ b/register_participants_project_divisionselector.php @@ -61,7 +61,7 @@ $authinfo = $q->fetch(PDO::FETCH_OBJ); <?= i18n('Division Selector') ?> -testi-bg.jpg + ';