From 66aeb66fda06ec7a915f00d5de21d7bab50209ac Mon Sep 17 00:00:00 2001 From: patrick Date: Mon, 10 Feb 2025 03:39:30 +0000 Subject: [PATCH] Fix formatting and syntax --- admin/fundraising_setup.php | 2 +- admin/project_editor.php | 4 +-- admin/registration_list.php | 47 ++++++++++++++---------------- admin/reports.inc.php | 17 ++++++----- admin/student_editor.php | 7 ++--- admin/winners.php | 54 +++++++++++++++++------------------ common.inc.php | 4 +-- config/variables.php | 18 ++++-------- config_editor.inc.php | 2 +- contact.php | 2 +- lcsv.php | 2 +- ltxt.php | 2 +- projects.inc.php | 2 +- questions.inc.php | 2 +- register_participants.inc.php | 26 ++++++++++------- register_participants.php | 3 +- tableeditor.class.php | 8 +++--- user.inc.php | 4 +-- winners.php | 2 +- 19 files changed, 102 insertions(+), 106 deletions(-) diff --git a/admin/fundraising_setup.php b/admin/fundraising_setup.php index ec50fab8..6db73b45 100644 --- a/admin/fundraising_setup.php +++ b/admin/fundraising_setup.php @@ -271,7 +271,7 @@ switch (get_value_from_array($_GET, 'action')) { happy_('Purpose Saved'); } else { $goal = strtolower($_POST['name']); - $goal = preg_replace('[^a-z]', '', $goal); + $goal = preg_replace('/[^a-z]/', '', $goal); echo "SELECT * FROM fundraising_goals WHERE goal='$goal' AND fiscalyear='{$config['FISCALYEAR']}'"; $q = $pdo->prepare("SELECT * FROM fundraising_goals WHERE goal=? AND fiscalyear=?"); $q->execute([$goal,$config['FISCALYEAR']]); diff --git a/admin/project_editor.php b/admin/project_editor.php index 828b3b68..cf42b24d 100644 --- a/admin/project_editor.php +++ b/admin/project_editor.php @@ -181,8 +181,8 @@ function project_save() // check if they changed the project number if ($_POST['projectnumber'] != $projectinfo->projectnumber) { - // check if hte new one is available - $q = $pdo->prepare("SELECT * FROM projects WHERE year=?' AND projectnumber=?"); + // check if the new one is available + $q = $pdo->prepare("SELECT * FROM projects WHERE year=? AND projectnumber=?"); $q->execute([$config['FAIRYEAR'], $_POST['projectnumber']]); if ($q->rowCount()) { error_('Could not change project number. %1 is already in use', array($_POST['projectnumber'])); diff --git a/admin/registration_list.php b/admin/registration_list.php index 09c54f89..d01ef4e3 100644 --- a/admin/registration_list.php +++ b/admin/registration_list.php @@ -450,32 +450,29 @@ function list_query($year, $wherestatus, $reg_id) $fair = "AND projects.fairs_id='{$_SESSION['fairs_id']}'"; } - $q = $pdo->prepare(" - SELECT - registrations.id AS reg_id, - registrations.num AS reg_num, - registrations.status, - registrations.email, - projects.title, - projects.projectnumber, - projects.projectcategories_id, - projects.projectdivisions_id, - projects.feedback, - projects.flagged - FROM - registrations - LEFT OUTER JOIN projects ON projects.registrations_id = registrations.id - WHERE - registrations.year = ? - AND registrations.status = ? - AND registrations.num = ? - AND registrations.fair = ? - ORDER BY - registrations.status DESC, projects.title "); - $q->execute([$year, $wherestatus, $reg, $fair]); + $q = $pdo->prepare("SELECT registrations.id AS reg_id, + registrations.num AS reg_num, + registrations.status, + registrations.email, + projects.title, + projects.projectnumber, + projects.projectcategories_id, + projects.projectdivisions_id, + projects.feedback, + projects.flagged + FROM + registrations + left outer join projects on projects.registrations_id=registrations.id + WHERE + 1 + AND registrations.year=? + $wherestatus + $reg $fair + ORDER BY + registrations.status DESC, projects.title + "); + $q->execute([$year]); - - // FIXME show_pdo_errors_if_any($pdo); return $q; } diff --git a/admin/reports.inc.php b/admin/reports.inc.php index e1e5e4e0..f13be9b1 100644 --- a/admin/reports.inc.php +++ b/admin/reports.inc.php @@ -530,17 +530,18 @@ foreach($report_stock as $n=>$v) { } function report_load_all() - { global $pdo; + { + global $pdo; $ret = array(); $q = $pdo->prepare("SELECT * FROM reports ORDER BY `name`"); $q->execute(); while($r = $q->fetch(PDO::FETCH_ASSOC)) { $report = array(); - $report['name'] = $r['name']; - $report['id'] = $r['id']; - $report['desc'] = $r['desc']; - $report['creator'] = $r['creator']; - $report['type'] = $r['type']; + $report['name'] = $r['name']; + $report['id'] = $r['id']; + $report['desc'] = $r['desc']; + $report['creator'] = $r['creator']; + $report['type'] = $r['type']; $ret[] = $report; } return $ret; @@ -548,6 +549,7 @@ foreach($report_stock as $n=>$v) { function report_delete($report_id) { + global $pdo; $r = intval($report_id); /* if the report['id'] is not zero, see if this is a * systeim report before doing anything. */ @@ -566,7 +568,8 @@ foreach($report_stock as $n=>$v) { $stmt = $pdo->prepare("DELETE FROM reports WHERE `id`=?"); $stmt->execute([$r]); $stmt = $pdo->prepare("DELETE FROM reports_items WHERE `reports_id`=?"); - $stmt->execute([$r]); + $stmt->execute([$r]); +} function report_gen($report) diff --git a/admin/student_editor.php b/admin/student_editor.php index 3ad3d4dd..894468c5 100644 --- a/admin/student_editor.php +++ b/admin/student_editor.php @@ -197,7 +197,7 @@ function students_save() // UPDATE existing record $dob = $_POST['year'][$x] . '-' . $_POST['month'][$x] . '-' . $_POST['day'][$x]; - $stmt = $pdo->prepare('UPDATE students SET + $stmt = $pdo->prepare("UPDATE students SET firstname=?, lastname=?, sex=?, @@ -209,13 +209,13 @@ function students_save() phone=?, dateofbirth=?, grade=?, - schoolquery=?, + $schoolquery medicalalert=?, foodreq=?, teachername=?, teacheremail=?, tshirt=? - WHERE id=?'); + WHERE id=?"); $stmt->execute([ iconv('UTF-8', 'ISO-8859-1//TRANSLIT', stripslashes($_POST['firstname'][$x])), @@ -229,7 +229,6 @@ function students_save() stripslashes($_POST['phone'][$x]), $dob, stripslashes($_POST['grade'][$x]), - $schoolquery, stripslashes($_POST['medicalalert'][$x]), stripslashes($_POST['foodreq'][$x]), iconv('UTF-8', 'ISO-8859-1//TRANSLIT', stripslashes($_POST['teachername'][$x])), diff --git a/admin/winners.php b/admin/winners.php index 74a858b0..14b98d8b 100644 --- a/admin/winners.php +++ b/admin/winners.php @@ -56,20 +56,20 @@ switch ($action) { } // first check how many we are allowed to have - $q = $pdo->prepare("SELECT number FROM award_prizes WHERE id=?"); + $q = $pdo->prepare('SELECT number FROM award_prizes WHERE id=?'); $q->execute([$prize_id]); show_pdo_errors_if_any($pdo); $r = $q->fetch(PDO::FETCH_ASSOC); $number = $r['number']; /* Get the award info */ - $q = $pdo->prepare("SELECT * FROM award_awards WHERE id=?"); + $q = $pdo->prepare('SELECT * FROM award_awards WHERE id=?'); $q->execute([$award_awards_id]); show_pdo_errors_if_any($pdo); $a = $q->fetch(PDO::FETCH_ASSOC); /* Get the project */ - $q = $pdo->prepare("SELECT fairs_id FROM projects WHERE id=?"); + $q = $pdo->prepare('SELECT fairs_id FROM projects WHERE id=?'); $q->execute([$projects_id]); show_pdo_errors_if_any($pdo); $p = $q->fetch(PDO::FETCH_ASSOC); @@ -86,18 +86,18 @@ switch ($action) { if ($a['per_fair'] == 'yes') { /* Count is the number of this fair already assigned */ - $q = $pdo->prepare("SELECT COUNT(*) AS count FROM winners + $q = $pdo->prepare('SELECT COUNT(*) AS count FROM winners LEFT JOIN projects ON winners.projects_id=projects.id WHERE projects.fairs_id=? - awards_prizes_id=?"); - $q->execute([$fairs_id,$prize_id]); + awards_prizes_id=?'); + $q->execute([$fairs_id, $prize_id]); show_pdo_errors_if_any($pdo); $r = $q->fetch(PDO::FETCH_ASSOC); $count = $r['count']; } else { /* Count is the total number assigned */ - $q = $pdo->prepare("SELECT COUNT(*) AS count FROM winners WHERE awards_prizes_id=?"); + $q = $pdo->prepare('SELECT COUNT(*) AS count FROM winners WHERE awards_prizes_id=?'); $q->execute([$prize_id]); show_pdo_errors_if_any($pdo); $r = $q->fetch(PDO::FETCH_ASSOC); @@ -105,8 +105,8 @@ switch ($action) { } if ($count < $number) { - $stmt = $pdo->prepare("INSERT INTO winners (awards_prizes_id,projects_id,year) VALUES (?,?,?)"); - $stmt->execute([$prize_id,$projects_id,$config['FAIRYEAR']]); + $stmt = $pdo->prepare('INSERT INTO winners (awards_prizes_id,projects_id,year) VALUES (?,?,?)'); + $stmt->execute([$prize_id, $projects_id, $config['FAIRYEAR']]); happy_('Winning project added'); } else { error_('This prize cannot accept any more winners. Maximum: %1', $number); @@ -119,8 +119,8 @@ switch ($action) { $projects_id = intval($_GET['projects_id']); if ($prize_id && $projects_id) { - $stmt = $pdo->prepare("DELETE FROM winners WHERE awards_prizes_id=? AND projects_id=?"); - $stmt->execute([$prize_id,$projects_id]); + $stmt = $pdo->prepare('DELETE FROM winners WHERE awards_prizes_id=? AND projects_id=?'); + $stmt->execute([$prize_id, $projects_id]); happy_('Winning project removed'); } exit; @@ -145,7 +145,7 @@ switch ($action) { AND \taward_types.year=award_awards.year AND\taward_awards.id=? "); - $q->execute([$config['FAIRYEAR'],$award_awards_id]); + $q->execute([$config['FAIRYEAR'], $award_awards_id]); show_pdo_errors_if_any($pdo); @@ -182,7 +182,7 @@ switch ($action) { AND \taward_types.year=award_awards.year AND\taward_awards.id=? "); - $q->execute([$config['FAIRYEAR'],$award_awards_id]); + $q->execute([$config['FAIRYEAR'], $award_awards_id]); show_pdo_errors_if_any($pdo); @@ -218,14 +218,14 @@ switch ($action) { case 'additional_materials': $fairs_id = intval($_GET['fairs_id']); - $q = $pdo->prepare("SELECT * FROM award_awards WHERE id=?"); + $q = $pdo->prepare('SELECT * FROM award_awards WHERE id=?'); $q->execute([$award_awards_id]); if ($fairs_id == 0) { echo "Unsupported Action: Can't get additional materials for fairs_id=0. Edit the project and set it's fair to anything except 'Local/Unspecified'."; exit; } $a = $q->fetch(PDO::FETCH_ASSOC); - $q = $pdo->prepare("SELECT * FROM fairs WHERE id=?"); + $q = $pdo->prepare('SELECT * FROM fairs WHERE id=?'); $q->execute([$fairs_id]); $fair = $q->fetch(PDO::FETCH_ASSOC); $pdf = fair_additional_materials($fair, $a, $config['FAIRYEAR']); @@ -412,17 +412,17 @@ $q = $pdo->prepare("SELECT award_types.type, sponsors.organization FROM - award_awards ?, + award_awards $fair_join, award_types, sponsors WHERE award_awards.year=? - AND\taward_awards.award_types_id=award_types.id - AND\taward_types.year=? - AND\taward_awards.sponsors_id=sponsors.id - ? + AND award_awards.award_types_id=award_types.id + AND award_types.year=? + AND award_awards.sponsors_id=sponsors.id + $fair_where ORDER BY awards_order"); -$q->execute([$fair_join,$config['FAIRYEAR'],$config['FAIRYEAR'],$fair_where]); +$q->execute([$config['FAIRYEAR'], $config['FAIRYEAR']]); show_pdo_errors_if_any($pdo); @@ -491,7 +491,7 @@ function print_award(&$r, $fairs_id, $editor = false, $editor_data = array()) $fairs_id = $_SESSION['fairs_id']; /* Load prizes for this award */ - $q = $pdo->prepare("SELECT + $q = $pdo->prepare('SELECT award_prizes.prize, award_prizes.number, award_prizes.id, @@ -503,8 +503,8 @@ function print_award(&$r, $fairs_id, $editor = false, $editor_data = array()) award_awards_id=? AND award_prizes.year=? ORDER BY - `order`"); - $q->execute([$r['id'],$config['FAIRYEAR']]); + `order`'); + $q->execute([$r['id'], $config['FAIRYEAR']]); show_pdo_errors_if_any($pdo); echo '
'; @@ -527,7 +527,7 @@ function print_award(&$r, $fairs_id, $editor = false, $editor_data = array()) } /* Load winners for this prize */ - $cq = $pdo->prepare("SELECT winners.projects_id, + $cq = $pdo->prepare('SELECT winners.projects_id, projects.projectnumber, projects.title, projects.fairs_id @@ -536,8 +536,8 @@ function print_award(&$r, $fairs_id, $editor = false, $editor_data = array()) LEFT JOIN projects ON projects.id=winners.projects_id WHERE winners.awards_prizes_id=? - ? "); - $cq->execute([$pr->id,$fairs_where]); + ? '); + $cq->execute([$pr->id, $fairs_where]); show_pdo_errors_if_any($pdo); $count = $cq->rowCount(); // echo "winners=$count"; diff --git a/common.inc.php b/common.inc.php index 09ffbf69..605a17db 100644 --- a/common.inc.php +++ b/common.inc.php @@ -925,7 +925,7 @@ function communication_replace_vars($text, &$u, $otherrep = array()) $rep = array_merge($userrep, $otherrep); foreach ($rep as $k => $v) { - $text = preg_replace("\[$k\]", $v, $text); + $text = preg_replace("/\[$k\]/", $v, $text); } return $text; } @@ -1434,7 +1434,7 @@ function getTextFromHtml($html) // next, replace a with
$text = str_replace('', '
', $html); // now replace any
with newlines - $text = preg_replace('', chr(13) . chr(10), $text); + $text = preg_replace('//', chr(13) . chr(10), $text); // and strip the rest of the tags $text = strip_tags($text); diff --git a/config/variables.php b/config/variables.php index ea4deb31..533a642b 100644 --- a/config/variables.php +++ b/config/variables.php @@ -30,25 +30,19 @@ user_auth_required('committee', 'config'); $q = $pdo->prepare("SELECT * FROM config WHERE year='-1'"); $q->execute(); + +/* FIXME Re-incorporate while ($r = $q->fetch(PDO::FETCH_OBJ)) { - $q = $pdo->prepare("INSERT INTO config (var,val,category,type,type_values,ord,description,year) VALUES ( - ?, - ?, - ?, - ?, - ?, - ?, - ?, - ?)"); - $q->execute([$r->var,$r->val,$r->category,$r->type,$r->type_values,$r->ord,$r->description,$config['FAIRYEAR']]); -} + $q = $pdo->prepare('INSERT INTO config (var,val,category,`type`,type_values,ord,`description`,`year`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'); + //$q->execute([$r->var, $r->val, $r->category, $r->type, $r->type_values, $r->ord, $r->description, $config['FAIRYEAR']]); +}*/ // for the Special category if (get_value_from_array($_POST, 'action') == 'save') { if (get_value_from_array($_POST, 'specialconfig')) { foreach ($_POST['specialconfig'] as $key => $val) { $stmt = $pdo->prepare("UPDATE config SET val=? WHERE year='0' AND var=?"); - $stmt->execute([stripslashes($val),$key]); + $stmt->execute([stripslashes($val), $key]); } } message_push(happy(i18n('Configuration successfully saved'))); diff --git a/config_editor.inc.php b/config_editor.inc.php index f5087022..acd8ebed 100644 --- a/config_editor.inc.php +++ b/config_editor.inc.php @@ -161,7 +161,7 @@ function config_editor_handle_actions($category, $year, $array_name) switch ($config_vars[$k]['type']) { case 'number': - if (preg_match('[0-9]+(\.[0-9]+)?', $val, $regs)) { + if (preg_match('/[0-9]+(\.[0-9]+)?/', $val, $regs)) { $val = $regs[0]; } else { $val = 0; diff --git a/contact.php b/contact.php index 56231fb7..8d0fc340 100644 --- a/contact.php +++ b/contact.php @@ -29,7 +29,7 @@ global $pdo; function cleanify($in) { - $in = preg_replace("\r", "\n", $in); + $in = preg_replace("/\r/", "\n", $in); $lines = explode("\n", $in); return trim($lines[0]); } diff --git a/lcsv.php b/lcsv.php index e4c7f177..4159ea7a 100644 --- a/lcsv.php +++ b/lcsv.php @@ -140,7 +140,7 @@ class lcsv if ($this->csvdata) { print_r($this->page_subheader); $filename = strtolower(get_value_property_or_default($this, 'page_subheader', '')); - $filename = preg_replace('[^a-z0-9]', '_', $filename); + $filename = preg_replace('/[^a-z0-9]/', '_', $filename); // header("Content-type: application/csv"); header('Content-type: text/x-csv'); header('Content-disposition: inline; filename=sfiab_' . $filename . '.csv'); diff --git a/ltxt.php b/ltxt.php index f56ef660..427324d2 100644 --- a/ltxt.php +++ b/ltxt.php @@ -170,7 +170,7 @@ class ltxt { if ($this->txtdata) { $filename = strtolower($this->page_subheader); - $filename = preg_replace('[^a-z0-9]', '_', $filename); + $filename = preg_replace('/[^a-z0-9]/', '_', $filename); // header("Content-type: application/csv"); header('Content-type: text/plain'); header('Content-disposition: inline; filename=sfiab_' . $filename . '.txt'); diff --git a/projects.inc.php b/projects.inc.php index 18944d3b..ddbf876d 100644 --- a/projects.inc.php +++ b/projects.inc.php @@ -156,7 +156,7 @@ function getSpecialAwardsEligibleForProject($projectid) ORDER BY award_awards.name "); - $awardsq->execute([$config['FAIRYEAR'], $config['FAIRYEAR'], $config['FAIRYEAR']]); + $awardsq->execute([$config['FAIRYEAR'], $projectid, $config['FAIRYEAR'], $config['FAIRYEAR']]); $awards = array(); show_pdo_errors_if_any($pdo); while ($r = $awardsq->fetch(PDO::FETCH_OBJ)) { diff --git a/questions.inc.php b/questions.inc.php index 49e2785b..7ecd00a8 100644 --- a/questions.inc.php +++ b/questions.inc.php @@ -269,7 +269,7 @@ function questions_editor($section, $year, $array_name, $self) while ($r = $q->fetch(PDO::FETCH_OBJ)) { $x++; $stmt = $pdo->prepare("INSERT INTO questions (id,year,section,db_heading,question,type,required,ord) - \t\t\t\t\t\t\t\tVALUES (?,?,?,?,?,?,?)"); + \t\t\t\t\t\t\t\t\tVALUES (?,?,?,?,?,?,?)"); $stmt->execute([$year, $r->section, $r->question, $r->type, $r->required, $r->ord]); } diff --git a/register_participants.inc.php b/register_participants.inc.php index 10a721d3..60040c79 100644 --- a/register_participants.inc.php +++ b/register_participants.inc.php @@ -336,10 +336,10 @@ function generateProjectNumber($registration_id) projectdivisions WHERE registrations_id=? - AND\tprojects.projectdivisions_id=projectdivisions.id - AND\tprojects.projectcategories_id=projectcategories.id - AND\tprojectcategories.year=? - AND\tprojectdivisions.year=? + AND projects.projectdivisions_id=projectdivisions.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); @@ -349,8 +349,9 @@ function generateProjectNumber($registration_id) $p['number']['str'] = $config['project_num_format']; $p['sort']['str'] = trim($config['project_sort_format']); - if ($p['sort']['str'] == '') + if ($p['sort']['str'] == '') { $p['sort']['str'] = $p['number']['str']; + } /* * Replace each letter with {letter}, so that we can do additional @@ -358,12 +359,13 @@ 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' thave to do anything fancy with, + * Do some replacements that we don't have to do anything fancy with, * and setup some variables for future queries */ foreach (array('number', 'sort') as $x) { @@ -375,6 +377,7 @@ 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 @@ -403,7 +406,7 @@ function generateProjectNumber($registration_id) * one we need and how much to pad it */ foreach (array('number', 'sort') as $x) { - if (preg_match('(N|X)([0-9])?', $p[$x]['str'], $regs)) { + if (preg_match('/(N|X)([0-9])?/', $p[$x]['str'], $regs)) { $p[$x]['seq_type'] = $regs[1]; if ($regs[2] != '') $p[$x]['seq_pad'] = $regs[2]; @@ -441,7 +444,7 @@ function generateProjectNumber($registration_id) continue; $r = sprintf("%'0{$p[$x]['seq_pad']}d", $n); - $str = preg_replace('{(N|X)([0-9])?}', $r, $p[$x]['str']); + $str = preg_replace('/{(N|X)([0-9])?}/', $r, $p[$x]['str']); $p[$x]['str'] = $str; $p[$x]['n'] = $n; break; @@ -454,12 +457,13 @@ function generateProjectNumber($registration_id) */ if ($p['number']['seq_type'] == $p['sort']['seq_type']) { $r = sprintf("%'0{$p['sort']['seq_pad']}d", $n); - $p['sort']['str'] = preg_replace('{(N|X)([0-9])?}', $r, $p['sort']['str']); + $p['sort']['str'] = preg_replace('/{(N|X)([0-9])?}/', $r, $p['sort']['str']); $p['sort']['n'] = $n; break; } } + return array( $p['number']['str'], $p['sort']['str'], diff --git a/register_participants.php b/register_participants.php index 41b47e88..e937f551 100644 --- a/register_participants.php +++ b/register_participants.php @@ -304,8 +304,7 @@ if (get_value_from_array($_POST, 'action') == 'login' && (get_value_from_array($ $schoolidquery = 'null'; // actually insert it - $stmt = $pdo->prepare("INSERT INTO registrations (num, email, start, status, schools_id, year) - \t\t\t\t\t\t\t\t\tVALUES (?, ?, NOW(), ?, ?, ?)"); + $stmt = $pdo->prepare('INSERT INTO registrations (num, email, start, status, schools_id, year) VALUES (?, ?, NOW(), ?, ?, ?)'); $stmt->execute([ $regnum, diff --git a/tableeditor.class.php b/tableeditor.class.php index b185fb08..15b24893 100644 --- a/tableeditor.class.php +++ b/tableeditor.class.php @@ -372,7 +372,7 @@ class TableEditor $q->execute([$this->table,$f]); $r = $q->fetch(PDO::FETCH_OBJ); - if (preg_match('([a-z]*)\(([0-9,]*)\)', $r->Type, $regs)) { + if (preg_match('/([a-z]*)\(([0-9,]*)\)/', $r->Type, $regs)) { switch ($regs[1]) { case 'varchar': $inputtype = 'text'; @@ -410,7 +410,7 @@ class TableEditor $inputsize = $regs[2]; break; } - } else if (preg_match('([a-z]*)', $r->Type, $regs)) { + } else if (preg_match('/([a-z]*)/', $r->Type, $regs)) { switch ($regs[1]) { case 'tinytext': $inputmaxlen = 255; @@ -430,7 +430,7 @@ class TableEditor // an enum is a select box, but we already know what the options should be // so rip out the options right now and add them $inputtype = 'select'; - $enums = substr(preg_replace("'", '', $r->Type), 5, -1); + $enums = substr(preg_replace("/'/", '', $r->Type), 5, -1); $toks = explode(',', $enums); foreach ($toks as $tok) { $this->fieldOptions[$f][] = $tok; @@ -959,7 +959,7 @@ class TableEditor global $editdata; global $pdo; - $query = "SELECT SQL_CALC_FOUND_ROWS {$this->primaryKey}"; + $query = "SELECT SQL_CALC_FOUND_ROWS $this->primaryKey"; if (is_callable(array($this->classname, 'tableEditorGetList'))) { list($sel, $from, $where) = call_user_func(array($this->classname, 'tableEditorGetList'), $this); diff --git a/user.inc.php b/user.inc.php index 3a21be5d..40a59ffd 100644 --- a/user.inc.php +++ b/user.inc.php @@ -858,7 +858,7 @@ function user_valid_user($user) * Find any character that doesn't match the valid username characters * (^ inverts the matching remember */ - $x = preg_match('[^a-zA-Z0-9@.-_]', $user); + $x = preg_match('/[^a-zA-Z0-9@.-_]/', $user); /* If x==1, a match was found, and the input is bad */ return ($x == 1) ? false : true; @@ -867,7 +867,7 @@ function user_valid_user($user) function user_valid_password($pass) { /* Same as user, but allow more characters */ - $x = preg_match('[^a-zA-Z0-9 ~!@#$%^&*()-_=+|;:,<.>/?]', $pass); + $x = preg_match('/[^a-zA-Z0-9 ~!@#$%^&*()-_=+|;:,<.>/?]/', $pass); /* If x==1, a match was found, and the input is bad */ if ($x == 1) diff --git a/winners.php b/winners.php index 6b2bbc06..92ed8db5 100644 --- a/winners.php +++ b/winners.php @@ -201,7 +201,7 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type')) if ($studentinfo->webfirst == 'yes') $students .= "$studentinfo->firstname "; if ($studentinfo->weblast == 'yes') - $students .= "$studentinfo->lastname "; + $students .= "$studentinfo->lastname"; if ($r->studentinfo->webfirst == 'yes' || $studentinfo->weblast == 'yes') $prev = true; else