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');
|
happy_('Purpose Saved');
|
||||||
} else {
|
} else {
|
||||||
$goal = strtolower($_POST['name']);
|
$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']}'";
|
echo "SELECT * FROM fundraising_goals WHERE goal='$goal' AND fiscalyear='{$config['FISCALYEAR']}'";
|
||||||
$q = $pdo->prepare("SELECT * FROM fundraising_goals WHERE goal=? AND fiscalyear=?");
|
$q = $pdo->prepare("SELECT * FROM fundraising_goals WHERE goal=? AND fiscalyear=?");
|
||||||
$q->execute([$goal,$config['FISCALYEAR']]);
|
$q->execute([$goal,$config['FISCALYEAR']]);
|
||||||
|
@ -181,8 +181,8 @@ function project_save()
|
|||||||
|
|
||||||
// check if they changed the project number
|
// check if they changed the project number
|
||||||
if ($_POST['projectnumber'] != $projectinfo->projectnumber) {
|
if ($_POST['projectnumber'] != $projectinfo->projectnumber) {
|
||||||
// check if hte new one is available
|
// check if the new one is available
|
||||||
$q = $pdo->prepare("SELECT * FROM projects WHERE year=?' AND projectnumber=?");
|
$q = $pdo->prepare("SELECT * FROM projects WHERE year=? AND projectnumber=?");
|
||||||
$q->execute([$config['FAIRYEAR'], $_POST['projectnumber']]);
|
$q->execute([$config['FAIRYEAR'], $_POST['projectnumber']]);
|
||||||
if ($q->rowCount()) {
|
if ($q->rowCount()) {
|
||||||
error_('Could not change project number. %1 is already in use', array($_POST['projectnumber']));
|
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']}'";
|
$fair = "AND projects.fairs_id='{$_SESSION['fairs_id']}'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$q = $pdo->prepare("
|
$q = $pdo->prepare("SELECT registrations.id AS reg_id,
|
||||||
SELECT
|
registrations.num AS reg_num,
|
||||||
registrations.id AS reg_id,
|
registrations.status,
|
||||||
registrations.num AS reg_num,
|
registrations.email,
|
||||||
registrations.status,
|
projects.title,
|
||||||
registrations.email,
|
projects.projectnumber,
|
||||||
projects.title,
|
projects.projectcategories_id,
|
||||||
projects.projectnumber,
|
projects.projectdivisions_id,
|
||||||
projects.projectcategories_id,
|
projects.feedback,
|
||||||
projects.projectdivisions_id,
|
projects.flagged
|
||||||
projects.feedback,
|
FROM
|
||||||
projects.flagged
|
registrations
|
||||||
FROM
|
left outer join projects on projects.registrations_id=registrations.id
|
||||||
registrations
|
WHERE
|
||||||
LEFT OUTER JOIN projects ON projects.registrations_id = registrations.id
|
1
|
||||||
WHERE
|
AND registrations.year=?
|
||||||
registrations.year = ?
|
$wherestatus
|
||||||
AND registrations.status = ?
|
$reg $fair
|
||||||
AND registrations.num = ?
|
ORDER BY
|
||||||
AND registrations.fair = ?
|
registrations.status DESC, projects.title
|
||||||
ORDER BY
|
");
|
||||||
registrations.status DESC, projects.title ");
|
$q->execute([$year]);
|
||||||
$q->execute([$year, $wherestatus, $reg, $fair]);
|
|
||||||
|
|
||||||
|
|
||||||
// FIXME
|
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
@ -530,17 +530,18 @@ foreach($report_stock as $n=>$v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function report_load_all()
|
function report_load_all()
|
||||||
{ global $pdo;
|
{
|
||||||
|
global $pdo;
|
||||||
$ret = array();
|
$ret = array();
|
||||||
$q = $pdo->prepare("SELECT * FROM reports ORDER BY `name`");
|
$q = $pdo->prepare("SELECT * FROM reports ORDER BY `name`");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
while($r = $q->fetch(PDO::FETCH_ASSOC)) {
|
while($r = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$report = array();
|
$report = array();
|
||||||
$report['name'] = $r['name'];
|
$report['name'] = $r['name'];
|
||||||
$report['id'] = $r['id'];
|
$report['id'] = $r['id'];
|
||||||
$report['desc'] = $r['desc'];
|
$report['desc'] = $r['desc'];
|
||||||
$report['creator'] = $r['creator'];
|
$report['creator'] = $r['creator'];
|
||||||
$report['type'] = $r['type'];
|
$report['type'] = $r['type'];
|
||||||
$ret[] = $report;
|
$ret[] = $report;
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
@ -548,6 +549,7 @@ foreach($report_stock as $n=>$v) {
|
|||||||
|
|
||||||
function report_delete($report_id)
|
function report_delete($report_id)
|
||||||
{
|
{
|
||||||
|
global $pdo;
|
||||||
$r = intval($report_id);
|
$r = intval($report_id);
|
||||||
/* if the report['id'] is not zero, see if this is a
|
/* if the report['id'] is not zero, see if this is a
|
||||||
* systeim report before doing anything. */
|
* systeim report before doing anything. */
|
||||||
@ -566,7 +568,8 @@ foreach($report_stock as $n=>$v) {
|
|||||||
$stmt = $pdo->prepare("DELETE FROM reports WHERE `id`=?");
|
$stmt = $pdo->prepare("DELETE FROM reports WHERE `id`=?");
|
||||||
$stmt->execute([$r]);
|
$stmt->execute([$r]);
|
||||||
$stmt = $pdo->prepare("DELETE FROM reports_items WHERE `reports_id`=?");
|
$stmt = $pdo->prepare("DELETE FROM reports_items WHERE `reports_id`=?");
|
||||||
$stmt->execute([$r]);
|
$stmt->execute([$r]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function report_gen($report)
|
function report_gen($report)
|
||||||
|
@ -197,7 +197,7 @@ function students_save()
|
|||||||
|
|
||||||
// UPDATE existing record
|
// UPDATE existing record
|
||||||
$dob = $_POST['year'][$x] . '-' . $_POST['month'][$x] . '-' . $_POST['day'][$x];
|
$dob = $_POST['year'][$x] . '-' . $_POST['month'][$x] . '-' . $_POST['day'][$x];
|
||||||
$stmt = $pdo->prepare('UPDATE students SET
|
$stmt = $pdo->prepare("UPDATE students SET
|
||||||
firstname=?,
|
firstname=?,
|
||||||
lastname=?,
|
lastname=?,
|
||||||
sex=?,
|
sex=?,
|
||||||
@ -209,13 +209,13 @@ function students_save()
|
|||||||
phone=?,
|
phone=?,
|
||||||
dateofbirth=?,
|
dateofbirth=?,
|
||||||
grade=?,
|
grade=?,
|
||||||
schoolquery=?,
|
$schoolquery
|
||||||
medicalalert=?,
|
medicalalert=?,
|
||||||
foodreq=?,
|
foodreq=?,
|
||||||
teachername=?,
|
teachername=?,
|
||||||
teacheremail=?,
|
teacheremail=?,
|
||||||
tshirt=?
|
tshirt=?
|
||||||
WHERE id=?');
|
WHERE id=?");
|
||||||
|
|
||||||
$stmt->execute([
|
$stmt->execute([
|
||||||
iconv('UTF-8', 'ISO-8859-1//TRANSLIT', stripslashes($_POST['firstname'][$x])),
|
iconv('UTF-8', 'ISO-8859-1//TRANSLIT', stripslashes($_POST['firstname'][$x])),
|
||||||
@ -229,7 +229,6 @@ function students_save()
|
|||||||
stripslashes($_POST['phone'][$x]),
|
stripslashes($_POST['phone'][$x]),
|
||||||
$dob,
|
$dob,
|
||||||
stripslashes($_POST['grade'][$x]),
|
stripslashes($_POST['grade'][$x]),
|
||||||
$schoolquery,
|
|
||||||
stripslashes($_POST['medicalalert'][$x]),
|
stripslashes($_POST['medicalalert'][$x]),
|
||||||
stripslashes($_POST['foodreq'][$x]),
|
stripslashes($_POST['foodreq'][$x]),
|
||||||
iconv('UTF-8', 'ISO-8859-1//TRANSLIT', stripslashes($_POST['teachername'][$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
|
// 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]);
|
$q->execute([$prize_id]);
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
$r = $q->fetch(PDO::FETCH_ASSOC);
|
$r = $q->fetch(PDO::FETCH_ASSOC);
|
||||||
$number = $r['number'];
|
$number = $r['number'];
|
||||||
|
|
||||||
/* Get the award info */
|
/* 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]);
|
$q->execute([$award_awards_id]);
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
$a = $q->fetch(PDO::FETCH_ASSOC);
|
$a = $q->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
/* Get the project */
|
/* 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]);
|
$q->execute([$projects_id]);
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
$p = $q->fetch(PDO::FETCH_ASSOC);
|
$p = $q->fetch(PDO::FETCH_ASSOC);
|
||||||
@ -86,18 +86,18 @@ switch ($action) {
|
|||||||
|
|
||||||
if ($a['per_fair'] == 'yes') {
|
if ($a['per_fair'] == 'yes') {
|
||||||
/* Count is the number of this fair already assigned */
|
/* 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
|
LEFT JOIN projects ON winners.projects_id=projects.id
|
||||||
WHERE
|
WHERE
|
||||||
projects.fairs_id=?
|
projects.fairs_id=?
|
||||||
awards_prizes_id=?");
|
awards_prizes_id=?');
|
||||||
$q->execute([$fairs_id,$prize_id]);
|
$q->execute([$fairs_id, $prize_id]);
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
$r = $q->fetch(PDO::FETCH_ASSOC);
|
$r = $q->fetch(PDO::FETCH_ASSOC);
|
||||||
$count = $r['count'];
|
$count = $r['count'];
|
||||||
} else {
|
} else {
|
||||||
/* Count is the total number assigned */
|
/* 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]);
|
$q->execute([$prize_id]);
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
$r = $q->fetch(PDO::FETCH_ASSOC);
|
$r = $q->fetch(PDO::FETCH_ASSOC);
|
||||||
@ -105,8 +105,8 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($count < $number) {
|
if ($count < $number) {
|
||||||
$stmt = $pdo->prepare("INSERT INTO winners (awards_prizes_id,projects_id,year) VALUES (?,?,?)");
|
$stmt = $pdo->prepare('INSERT INTO winners (awards_prizes_id,projects_id,year) VALUES (?,?,?)');
|
||||||
$stmt->execute([$prize_id,$projects_id,$config['FAIRYEAR']]);
|
$stmt->execute([$prize_id, $projects_id, $config['FAIRYEAR']]);
|
||||||
happy_('Winning project added');
|
happy_('Winning project added');
|
||||||
} else {
|
} else {
|
||||||
error_('This prize cannot accept any more winners. Maximum: %1', $number);
|
error_('This prize cannot accept any more winners. Maximum: %1', $number);
|
||||||
@ -119,8 +119,8 @@ switch ($action) {
|
|||||||
$projects_id = intval($_GET['projects_id']);
|
$projects_id = intval($_GET['projects_id']);
|
||||||
|
|
||||||
if ($prize_id && $projects_id) {
|
if ($prize_id && $projects_id) {
|
||||||
$stmt = $pdo->prepare("DELETE FROM winners WHERE awards_prizes_id=? AND projects_id=?");
|
$stmt = $pdo->prepare('DELETE FROM winners WHERE awards_prizes_id=? AND projects_id=?');
|
||||||
$stmt->execute([$prize_id,$projects_id]);
|
$stmt->execute([$prize_id, $projects_id]);
|
||||||
happy_('Winning project removed');
|
happy_('Winning project removed');
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
@ -145,7 +145,7 @@ switch ($action) {
|
|||||||
AND \taward_types.year=award_awards.year
|
AND \taward_types.year=award_awards.year
|
||||||
AND\taward_awards.id=?
|
AND\taward_awards.id=?
|
||||||
");
|
");
|
||||||
$q->execute([$config['FAIRYEAR'],$award_awards_id]);
|
$q->execute([$config['FAIRYEAR'], $award_awards_id]);
|
||||||
|
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ switch ($action) {
|
|||||||
AND \taward_types.year=award_awards.year
|
AND \taward_types.year=award_awards.year
|
||||||
AND\taward_awards.id=?
|
AND\taward_awards.id=?
|
||||||
");
|
");
|
||||||
$q->execute([$config['FAIRYEAR'],$award_awards_id]);
|
$q->execute([$config['FAIRYEAR'], $award_awards_id]);
|
||||||
|
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
|
|
||||||
@ -218,14 +218,14 @@ switch ($action) {
|
|||||||
|
|
||||||
case 'additional_materials':
|
case 'additional_materials':
|
||||||
$fairs_id = intval($_GET['fairs_id']);
|
$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]);
|
$q->execute([$award_awards_id]);
|
||||||
if ($fairs_id == 0) {
|
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'.";
|
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;
|
exit;
|
||||||
}
|
}
|
||||||
$a = $q->fetch(PDO::FETCH_ASSOC);
|
$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]);
|
$q->execute([$fairs_id]);
|
||||||
$fair = $q->fetch(PDO::FETCH_ASSOC);
|
$fair = $q->fetch(PDO::FETCH_ASSOC);
|
||||||
$pdf = fair_additional_materials($fair, $a, $config['FAIRYEAR']);
|
$pdf = fair_additional_materials($fair, $a, $config['FAIRYEAR']);
|
||||||
@ -412,17 +412,17 @@ $q = $pdo->prepare("SELECT
|
|||||||
award_types.type,
|
award_types.type,
|
||||||
sponsors.organization
|
sponsors.organization
|
||||||
FROM
|
FROM
|
||||||
award_awards ?,
|
award_awards $fair_join,
|
||||||
award_types,
|
award_types,
|
||||||
sponsors
|
sponsors
|
||||||
WHERE
|
WHERE
|
||||||
award_awards.year=?
|
award_awards.year=?
|
||||||
AND\taward_awards.award_types_id=award_types.id
|
AND award_awards.award_types_id=award_types.id
|
||||||
AND\taward_types.year=?
|
AND award_types.year=?
|
||||||
AND\taward_awards.sponsors_id=sponsors.id
|
AND award_awards.sponsors_id=sponsors.id
|
||||||
?
|
$fair_where
|
||||||
ORDER BY awards_order");
|
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);
|
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'];
|
$fairs_id = $_SESSION['fairs_id'];
|
||||||
|
|
||||||
/* Load prizes for this award */
|
/* Load prizes for this award */
|
||||||
$q = $pdo->prepare("SELECT
|
$q = $pdo->prepare('SELECT
|
||||||
award_prizes.prize,
|
award_prizes.prize,
|
||||||
award_prizes.number,
|
award_prizes.number,
|
||||||
award_prizes.id,
|
award_prizes.id,
|
||||||
@ -503,8 +503,8 @@ function print_award(&$r, $fairs_id, $editor = false, $editor_data = array())
|
|||||||
award_awards_id=?
|
award_awards_id=?
|
||||||
AND award_prizes.year=?
|
AND award_prizes.year=?
|
||||||
ORDER BY
|
ORDER BY
|
||||||
`order`");
|
`order`');
|
||||||
$q->execute([$r['id'],$config['FAIRYEAR']]);
|
$q->execute([$r['id'], $config['FAIRYEAR']]);
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
|
|
||||||
echo '<table width="100%"><tr><td>';
|
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 */
|
/* Load winners for this prize */
|
||||||
$cq = $pdo->prepare("SELECT winners.projects_id,
|
$cq = $pdo->prepare('SELECT winners.projects_id,
|
||||||
projects.projectnumber,
|
projects.projectnumber,
|
||||||
projects.title,
|
projects.title,
|
||||||
projects.fairs_id
|
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
|
LEFT JOIN projects ON projects.id=winners.projects_id
|
||||||
WHERE
|
WHERE
|
||||||
winners.awards_prizes_id=?
|
winners.awards_prizes_id=?
|
||||||
? ");
|
? ');
|
||||||
$cq->execute([$pr->id,$fairs_where]);
|
$cq->execute([$pr->id, $fairs_where]);
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
$count = $cq->rowCount();
|
$count = $cq->rowCount();
|
||||||
// echo "winners=$count";
|
// echo "winners=$count";
|
||||||
|
@ -925,7 +925,7 @@ function communication_replace_vars($text, &$u, $otherrep = array())
|
|||||||
|
|
||||||
$rep = array_merge($userrep, $otherrep);
|
$rep = array_merge($userrep, $otherrep);
|
||||||
foreach ($rep as $k => $v) {
|
foreach ($rep as $k => $v) {
|
||||||
$text = preg_replace("\[$k\]", $v, $text);
|
$text = preg_replace("/\[$k\]/", $v, $text);
|
||||||
}
|
}
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
@ -1434,7 +1434,7 @@ function getTextFromHtml($html)
|
|||||||
// next, replace a </div> with </div><br />
|
// next, replace a </div> with </div><br />
|
||||||
$text = str_replace('</div>', '</div><br />', $html);
|
$text = str_replace('</div>', '</div><br />', $html);
|
||||||
// now replace any <br /> with newlines
|
// 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
|
// and strip the rest of the tags
|
||||||
$text = strip_tags($text);
|
$text = strip_tags($text);
|
||||||
|
|
||||||
|
@ -30,25 +30,19 @@ user_auth_required('committee', 'config');
|
|||||||
|
|
||||||
$q = $pdo->prepare("SELECT * FROM config WHERE year='-1'");
|
$q = $pdo->prepare("SELECT * FROM config WHERE year='-1'");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
|
|
||||||
|
/* FIXME Re-incorporate
|
||||||
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
|
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
|
||||||
$q = $pdo->prepare("INSERT INTO config (var,val,category,type,type_values,ord,description,year) VALUES (
|
$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->execute([$r->var,$r->val,$r->category,$r->type,$r->type_values,$r->ord,$r->description,$config['FAIRYEAR']]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for the Special category
|
// for the Special category
|
||||||
if (get_value_from_array($_POST, 'action') == 'save') {
|
if (get_value_from_array($_POST, 'action') == 'save') {
|
||||||
if (get_value_from_array($_POST, 'specialconfig')) {
|
if (get_value_from_array($_POST, 'specialconfig')) {
|
||||||
foreach ($_POST['specialconfig'] as $key => $val) {
|
foreach ($_POST['specialconfig'] as $key => $val) {
|
||||||
$stmt = $pdo->prepare("UPDATE config SET val=? WHERE year='0' AND var=?");
|
$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')));
|
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']) {
|
switch ($config_vars[$k]['type']) {
|
||||||
case 'number':
|
case 'number':
|
||||||
if (preg_match('[0-9]+(\.[0-9]+)?', $val, $regs)) {
|
if (preg_match('/[0-9]+(\.[0-9]+)?/', $val, $regs)) {
|
||||||
$val = $regs[0];
|
$val = $regs[0];
|
||||||
} else {
|
} else {
|
||||||
$val = 0;
|
$val = 0;
|
||||||
|
@ -29,7 +29,7 @@ global $pdo;
|
|||||||
|
|
||||||
function cleanify($in)
|
function cleanify($in)
|
||||||
{
|
{
|
||||||
$in = preg_replace("\r", "\n", $in);
|
$in = preg_replace("/\r/", "\n", $in);
|
||||||
$lines = explode("\n", $in);
|
$lines = explode("\n", $in);
|
||||||
return trim($lines[0]);
|
return trim($lines[0]);
|
||||||
}
|
}
|
||||||
|
2
lcsv.php
2
lcsv.php
@ -140,7 +140,7 @@ class lcsv
|
|||||||
if ($this->csvdata) {
|
if ($this->csvdata) {
|
||||||
print_r($this->page_subheader);
|
print_r($this->page_subheader);
|
||||||
$filename = strtolower(get_value_property_or_default($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: application/csv");
|
||||||
header('Content-type: text/x-csv');
|
header('Content-type: text/x-csv');
|
||||||
header('Content-disposition: inline; filename=sfiab_' . $filename . '.csv');
|
header('Content-disposition: inline; filename=sfiab_' . $filename . '.csv');
|
||||||
|
2
ltxt.php
2
ltxt.php
@ -170,7 +170,7 @@ class ltxt
|
|||||||
{
|
{
|
||||||
if ($this->txtdata) {
|
if ($this->txtdata) {
|
||||||
$filename = strtolower($this->page_subheader);
|
$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: application/csv");
|
||||||
header('Content-type: text/plain');
|
header('Content-type: text/plain');
|
||||||
header('Content-disposition: inline; filename=sfiab_' . $filename . '.txt');
|
header('Content-disposition: inline; filename=sfiab_' . $filename . '.txt');
|
||||||
|
@ -156,7 +156,7 @@ function getSpecialAwardsEligibleForProject($projectid)
|
|||||||
ORDER BY
|
ORDER BY
|
||||||
award_awards.name
|
award_awards.name
|
||||||
");
|
");
|
||||||
$awardsq->execute([$config['FAIRYEAR'], $config['FAIRYEAR'], $config['FAIRYEAR']]);
|
$awardsq->execute([$config['FAIRYEAR'], $projectid, $config['FAIRYEAR'], $config['FAIRYEAR']]);
|
||||||
$awards = array();
|
$awards = array();
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
while ($r = $awardsq->fetch(PDO::FETCH_OBJ)) {
|
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)) {
|
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
|
||||||
$x++;
|
$x++;
|
||||||
$stmt = $pdo->prepare("INSERT INTO questions (id,year,section,db_heading,question,type,required,ord)
|
$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]);
|
$stmt->execute([$year, $r->section, $r->question, $r->type, $r->required, $r->ord]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,10 +336,10 @@ function generateProjectNumber($registration_id)
|
|||||||
projectdivisions
|
projectdivisions
|
||||||
WHERE
|
WHERE
|
||||||
registrations_id=?
|
registrations_id=?
|
||||||
AND\tprojects.projectdivisions_id=projectdivisions.id
|
AND projects.projectdivisions_id=projectdivisions.id
|
||||||
AND\tprojects.projectcategories_id=projectcategories.id
|
AND projects.projectcategories_id=projectcategories.id
|
||||||
AND\tprojectcategories.year=?
|
AND projectcategories.year=?
|
||||||
AND\tprojectdivisions.year=?
|
AND projectdivisions.year=?
|
||||||
");
|
");
|
||||||
$q->execute([$reg_id, $config['FAIRYEAR'], $config['FAIRYEAR']]);
|
$q->execute([$reg_id, $config['FAIRYEAR'], $config['FAIRYEAR']]);
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
@ -349,8 +349,9 @@ function generateProjectNumber($registration_id)
|
|||||||
$p['number']['str'] = $config['project_num_format'];
|
$p['number']['str'] = $config['project_num_format'];
|
||||||
$p['sort']['str'] = trim($config['project_sort_format']);
|
$p['sort']['str'] = trim($config['project_sort_format']);
|
||||||
|
|
||||||
if ($p['sort']['str'] == '')
|
if ($p['sort']['str'] == '') {
|
||||||
$p['sort']['str'] = $p['number']['str'];
|
$p['sort']['str'] = $p['number']['str'];
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Replace each letter with {letter}, so that we can do additional
|
* Replace each letter with {letter}, so that we can do additional
|
||||||
@ -358,12 +359,13 @@ function generateProjectNumber($registration_id)
|
|||||||
* get replaced.
|
* get replaced.
|
||||||
*/
|
*/
|
||||||
foreach (array('number', 'sort') as $x) {
|
foreach (array('number', 'sort') as $x) {
|
||||||
$p[$x]['str'] = preg_replace('[CcDd]', '{\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']);
|
$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
|
* and setup some variables for future queries
|
||||||
*/
|
*/
|
||||||
foreach (array('number', 'sort') as $x) {
|
foreach (array('number', 'sort') as $x) {
|
||||||
@ -375,6 +377,7 @@ function generateProjectNumber($registration_id)
|
|||||||
$p[$x]['x_used'] = array();
|
$p[$x]['x_used'] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build a total list of projects for finding a global number, and
|
* Build a total list of projects for finding a global number, and
|
||||||
* while constructing the list, build a list for the division/cat
|
* 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
|
* one we need and how much to pad it
|
||||||
*/
|
*/
|
||||||
foreach (array('number', 'sort') as $x) {
|
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];
|
$p[$x]['seq_type'] = $regs[1];
|
||||||
if ($regs[2] != '')
|
if ($regs[2] != '')
|
||||||
$p[$x]['seq_pad'] = $regs[2];
|
$p[$x]['seq_pad'] = $regs[2];
|
||||||
@ -441,7 +444,7 @@ function generateProjectNumber($registration_id)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
$r = sprintf("%'0{$p[$x]['seq_pad']}d", $n);
|
$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]['str'] = $str;
|
||||||
$p[$x]['n'] = $n;
|
$p[$x]['n'] = $n;
|
||||||
break;
|
break;
|
||||||
@ -454,12 +457,13 @@ function generateProjectNumber($registration_id)
|
|||||||
*/
|
*/
|
||||||
if ($p['number']['seq_type'] == $p['sort']['seq_type']) {
|
if ($p['number']['seq_type'] == $p['sort']['seq_type']) {
|
||||||
$r = sprintf("%'0{$p['sort']['seq_pad']}d", $n);
|
$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;
|
$p['sort']['n'] = $n;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
$p['number']['str'],
|
$p['number']['str'],
|
||||||
$p['sort']['str'],
|
$p['sort']['str'],
|
||||||
|
@ -304,8 +304,7 @@ if (get_value_from_array($_POST, 'action') == 'login' && (get_value_from_array($
|
|||||||
$schoolidquery = 'null';
|
$schoolidquery = 'null';
|
||||||
|
|
||||||
// actually insert it
|
// actually insert it
|
||||||
$stmt = $pdo->prepare("INSERT INTO registrations (num, email, start, status, schools_id, year)
|
$stmt = $pdo->prepare('INSERT INTO registrations (num, email, start, status, schools_id, year) VALUES (?, ?, NOW(), ?, ?, ?)');
|
||||||
\t\t\t\t\t\t\t\t\tVALUES (?, ?, NOW(), ?, ?, ?)");
|
|
||||||
|
|
||||||
$stmt->execute([
|
$stmt->execute([
|
||||||
$regnum,
|
$regnum,
|
||||||
|
@ -372,7 +372,7 @@ class TableEditor
|
|||||||
$q->execute([$this->table,$f]);
|
$q->execute([$this->table,$f]);
|
||||||
$r = $q->fetch(PDO::FETCH_OBJ);
|
$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]) {
|
switch ($regs[1]) {
|
||||||
case 'varchar':
|
case 'varchar':
|
||||||
$inputtype = 'text';
|
$inputtype = 'text';
|
||||||
@ -410,7 +410,7 @@ class TableEditor
|
|||||||
$inputsize = $regs[2];
|
$inputsize = $regs[2];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (preg_match('([a-z]*)', $r->Type, $regs)) {
|
} else if (preg_match('/([a-z]*)/', $r->Type, $regs)) {
|
||||||
switch ($regs[1]) {
|
switch ($regs[1]) {
|
||||||
case 'tinytext':
|
case 'tinytext':
|
||||||
$inputmaxlen = 255;
|
$inputmaxlen = 255;
|
||||||
@ -430,7 +430,7 @@ class TableEditor
|
|||||||
// an enum is a select box, but we already know what the options should be
|
// 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
|
// so rip out the options right now and add them
|
||||||
$inputtype = 'select';
|
$inputtype = 'select';
|
||||||
$enums = substr(preg_replace("'", '', $r->Type), 5, -1);
|
$enums = substr(preg_replace("/'/", '', $r->Type), 5, -1);
|
||||||
$toks = explode(',', $enums);
|
$toks = explode(',', $enums);
|
||||||
foreach ($toks as $tok) {
|
foreach ($toks as $tok) {
|
||||||
$this->fieldOptions[$f][] = $tok;
|
$this->fieldOptions[$f][] = $tok;
|
||||||
@ -959,7 +959,7 @@ class TableEditor
|
|||||||
global $editdata;
|
global $editdata;
|
||||||
global $pdo;
|
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'))) {
|
if (is_callable(array($this->classname, 'tableEditorGetList'))) {
|
||||||
list($sel, $from, $where) = call_user_func(array($this->classname, 'tableEditorGetList'), $this);
|
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
|
* Find any character that doesn't match the valid username characters
|
||||||
* (^ inverts the matching remember
|
* (^ 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 */
|
/* If x==1, a match was found, and the input is bad */
|
||||||
return ($x == 1) ? false : true;
|
return ($x == 1) ? false : true;
|
||||||
@ -867,7 +867,7 @@ function user_valid_user($user)
|
|||||||
function user_valid_password($pass)
|
function user_valid_password($pass)
|
||||||
{
|
{
|
||||||
/* Same as user, but allow more characters */
|
/* 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, a match was found, and the input is bad */
|
||||||
if ($x == 1)
|
if ($x == 1)
|
||||||
|
@ -201,7 +201,7 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
|
|||||||
if ($studentinfo->webfirst == 'yes')
|
if ($studentinfo->webfirst == 'yes')
|
||||||
$students .= "$studentinfo->firstname ";
|
$students .= "$studentinfo->firstname ";
|
||||||
if ($studentinfo->weblast == 'yes')
|
if ($studentinfo->weblast == 'yes')
|
||||||
$students .= "$studentinfo->lastname ";
|
$students .= "$studentinfo->lastname";
|
||||||
if ($r->studentinfo->webfirst == 'yes' || $studentinfo->weblast == 'yes')
|
if ($r->studentinfo->webfirst == 'yes' || $studentinfo->weblast == 'yes')
|
||||||
$prev = true;
|
$prev = true;
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user