forked from science-ation/science-ation
Fix formatting and syntax
This commit is contained in:
parent
8c815d8dc0
commit
66aeb66fda
@ -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']]);
|
||||
|
@ -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']));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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])),
|
||||
|
@ -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 '<table width="100%"><tr><td>';
|
||||
@ -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";
|
||||
|
@ -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 </div> with </div><br />
|
||||
$text = str_replace('</div>', '</div><br />', $html);
|
||||
// now replace any <br /> with newlines
|
||||
$text = preg_replace('<br[[:space:]]*/?[[:space:]]*>', chr(13) . chr(10), $text);
|
||||
$text = preg_replace('/<br[[:space:]]*/?[[:space:]]*>/', chr(13) . chr(10), $text);
|
||||
// and strip the rest of the tags
|
||||
$text = strip_tags($text);
|
||||
|
||||
|
@ -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')));
|
||||
|
@ -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;
|
||||
|
@ -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]);
|
||||
}
|
||||
|
2
lcsv.php
2
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');
|
||||
|
2
ltxt.php
2
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');
|
||||
|
@ -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)) {
|
||||
|
@ -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]);
|
||||
}
|
||||
|
||||
|
@ -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'],
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user