diff --git a/admin/award_awardcreatedivisional.php b/admin/award_awardcreatedivisional.php
index 62e8c3c8..b131a12d 100644
--- a/admin/award_awardcreatedivisional.php
+++ b/admin/award_awardcreatedivisional.php
@@ -113,11 +113,11 @@ if ($r->num) {
?,
'1',
?-?,
- '" . i18n('Best %1 projects in the %2 division', array($c_category, $d_division)) . "',
+ ?,
?,
?
)");
- $q->execute([$_GET['sponsors_id'],$c_category,$d_division,$ord, $config['FAIRYEAR']]);
+ $q->execute([$_GET['sponsors_id'],$c_category,$d_division,i18n('Best %1 projects in the %2 division', array($c_category, $d_division)),$ord, $config['FAIRYEAR']]);
show_pdo_errors_if_any($pdo);
$award_awards_id = $pdo->lastInsertId();
diff --git a/admin/award_upload.php b/admin/award_upload.php
index 77d62c9f..670fb9d8 100644
--- a/admin/award_upload.php
+++ b/admin/award_upload.php
@@ -69,7 +69,8 @@ function get_winners($awardid, $fairs_id)
if ($awardid == -1) {
/* Get all for this fair */
- $q = $pdo->prepare("SELECT * FROM award_awards WHERE award_source_fairs_id='$fairs_id' AND year='{$config['FAIRYEAR']}'");
+ $q = $pdo->prepare("SELECT * FROM award_awards WHERE award_source_fairs_id=? AND year=?");
+ $q->execute([$fairs_id,$config['FAIRYEAR']]);
if ($q->rowCount() == 0) {
error_("Can't find award id $awardid");
return false;
diff --git a/admin/cms.php b/admin/cms.php
index 57feb0be..555878e8 100644
--- a/admin/cms.php
+++ b/admin/cms.php
@@ -207,8 +207,8 @@ if (get_value_from_array($_GET, 'filename', '') || get_value_from_array($_GET, '
echo '
' . i18n('Filename') . ' | ' . i18n('Last Update') . ' |
';
while ($r = $q->fetch(PDO::FETCH_ASSOC)) {
echo '/web/$r->filename | ";
- $q2 = $pdo->prepare("SELECT dt FROM cms WHERE filename='" . $r->filename . "' ORDER BY dt DESC LIMIT 1");
-
+ $q2 = $pdo->prepare("SELECT dt FROM cms WHERE filename=? ORDER BY dt DESC LIMIT 1");
+ $q->execute($r->filename);
$r2 = $q2->fetch(PDO::FETCH_OBJ);
if ($r2->dt == '0000-00-00 00:00:00')
$dt = 'Never';
diff --git a/admin/communication.php b/admin/communication.php
index 23e746b6..7aa7e8b0 100644
--- a/admin/communication.php
+++ b/admin/communication.php
@@ -668,8 +668,8 @@ case 'dialog_sender':
case 'loadaddresses':
if ($_GET['query'] && array_key_exists($_GET['query'], $mailqueries)) {
- $q = $pdo->prepare($mailqueries[$_GET['query']]['query']);
- $q->execute();
+ $q = $pdo->prepare('?');
+ $q->execute([$mailqueries[$_GET['query']]['query']]);
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
if ($r->organization)
$s = "($r->organization) ";
diff --git a/admin/donors.php b/admin/donors.php
index 80b0e2a7..ee7a7705 100644
--- a/admin/donors.php
+++ b/admin/donors.php
@@ -838,10 +838,10 @@ function draw_activityinfo_form()
\t FROM fundraising_donor_logs AS fdl
\t LEFT JOIN users ON fdl.users_id=users.id
\t LEFT JOIN fundraising_campaigns ON fdl.fundraising_campaigns_id=fundraising_campaigns.id
- \t WHERE sponsors_id=" . $sponsorid . ' ORDER BY dt DESC';
+ \t WHERE sponsors_id=? ORDER BY dt DESC";
// echo "
" . $query . " |
";
$q = $pdo->prepare($query);
- $q->execute();
+ $q->execute([$sponsorid ]);
show_pdo_errors_if_any($pdo);
if ($q->rowCount()) {
while ($r = $q->fetch()) {
@@ -872,14 +872,14 @@ function save_activityinfo($comment, $donorId, $userId, $type, $campaign_id = nu
$cid = 'NULL';
$query = "INSERT INTO fundraising_donor_logs (sponsors_id, dt, users_id, log, `type`, fundraising_campaigns_id)
- VALUES ($donorId,
+ VALUES (?,
NOW(),
- $userId,
- '" . $comment . "',
- '" . $type . "',
- $cid)";
+ ?,
+ ?,
+ ?,
+ ?)";
$q = $pdo->prepare($query);
- $q->execute();
+ $q->execute([$donorId,$userId,$comment,$type,$cid]);
show_pdo_errors_if_any($pdo);
}
diff --git a/admin/donors_search.php b/admin/donors_search.php
index 8d00fa70..401f00e5 100644
--- a/admin/donors_search.php
+++ b/admin/donors_search.php
@@ -42,10 +42,10 @@ if (count(get_value_from_array($_POST, 'donortype', []))) {
}
$sql .= ') ';
}
-$query = "SELECT * FROM sponsors WHERE 1 $sql ORDER BY organization";
+$query = "SELECT * FROM sponsors WHERE 1 ? ORDER BY organization";
// echo "query=$query";
$q = $pdo->prepare($query);
-$q->execute();
+$q->execute([$sql]);
get_value_from_array($_POST, 'donortype');
$thisyear = $config['FISCALYEAR'];
$lastyear = $config['FISCALYEAR'] - 1;
diff --git a/admin/fundraising.php b/admin/fundraising.php
index 6724afd9..9c881115 100644
--- a/admin/fundraising.php
+++ b/admin/fundraising.php
@@ -32,8 +32,8 @@ if (get_value_from_array($_GET, 'action') == 'refresh') {
= i18n('Fundraising Purposes and Progress Year to Date') ?>
- $q = $pdo->prepare("SELECT * FROM fundraising_goals WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY deadline");
- $q->execute();
+ $q = $pdo->prepare("SELECT * FROM fundraising_goals WHERE fiscalyear=? ORDER BY deadline");
+ $q->execute([$config['FISCALYEAR']]);
?>
@@ -48,8 +48,8 @@ if (get_value_from_array($_GET, 'action') == 'refresh') {
while ($r = $q->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();
+ $recq = $pdo->prepare("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_goal=? AND fiscalyear=? AND status='received'");
+ $recq->execute([$r->goal,$config['FISCALYEAR']]);
show_pdo_errors_if_any($pdo);
$recr = $recq->fetch(PDO::FETCH_OBJ);
$received = $recr->received;
@@ -84,15 +84,15 @@ if (get_value_from_array($_GET, 'action') == 'refresh') {
- $q = $pdo->prepare("SELECT * FROM fundraising_campaigns WHERE fiscalyear='{$config['FISCALYEAR']}'");
- $q->execute();
+ $q = $pdo->prepare("SELECT * FROM fundraising_campaigns WHERE fiscalyear=?");
+ $q->execute([$config['FISCALYEAR']]);
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();
+ $goalq = $pdo->prepare("SELECT * FROM fundraising_goals WHERE goal=? AND fiscalyear=?");
+ $goalq->execute([$r->fundraising_goal,$config['FISCALYEAR']]);
$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();
+ $recq = $pdo->prepare("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_campaigns_id=? AND fiscalyear=? AND status='received'");
+ $recq->execute([$r->id,$config['FISCALYEAR']]);
show_pdo_errors_if_any($pdo);
$recr = $recq->fetch(PDO::FETCH_OBJ);
$received = $recr->received;
@@ -133,10 +133,10 @@ if (get_value_from_array($_GET, 'action') == 'refresh') {
\tDATE_ADD(datereceived, INTERVAL 2 MONTH) < NOW() AS twomonth
FROM fundraising_donations
WHERE thanked='no' AND status='received'
- AND fiscalyear='{$config['FISCALYEAR']}'
+ AND fiscalyear=?
ORDER BY datereceived
");
- $q->execute();
+ $q->execute([$config['FISCALYEAR']]);
show_pdo_errors_if_any($pdo);
if ($q->rowCount()) {
@@ -149,8 +149,8 @@ if (get_value_from_array($_GET, 'action') == 'refresh') {
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();
+ $dq = $pdo->prepare("SELECT organization AS name FROM sponsors WHERE id=?");
+ $dq->execute([$r->sponsors_id]);
$dr = $dq->fetch(PDO::FETCH_OBJ);
if ($r->twomonth)
$s = 'style="background-color: ' . colour_to_percent(0) . ';"';
@@ -190,10 +190,10 @@ if (get_value_from_array($_GET, 'action') == 'refresh') {
\tDATE_ADD(datereceived, INTERVAL 2 MONTH) < NOW() AS twomonth
FROM fundraising_donations
WHERE (receiptrequired='yes' AND receiptsent='no') AND status='received'
- AND fiscalyear='{$config['FISCALYEAR']}'
+ AND fiscalyear=?
ORDER BY datereceived
");
- $q->execute();
+ $q->execute([$config['FISCALYEAR']]);
show_pdo_errors_if_any($pdo);
if ($q->rowCount()) {
echo '';
@@ -204,8 +204,8 @@ if (get_value_from_array($_GET, 'action') == 'refresh') {
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();
+ $dq = $pdo->prepare("SELECT organization AS name FROM sponsors WHERE id=?");
+ $dq->execute([$r->sponsors_id]);
$dr = $dq->fetch(PDO::FETCH_OBJ);
if ($r->twomonth)
$s = 'style="background-color: ' . colour_to_percent(0) . ';"';
@@ -280,8 +280,8 @@ if (get_value_from_array($_GET, 'action') == 'refresh') {
exit;
} else if (get_value_from_array($_POST, 'thanked')) {
foreach ($_POST['thanked'] AS $t) {
- $stmt = $pdo->prepare("UPDATE fundraising_donations SET thanked='yes' WHERE id='$t'");
- $stmt->execute();
+ $stmt = $pdo->prepare("UPDATE fundraising_donations SET thanked='yes' WHERE id=?");
+ $stmt->execute([$t]);
}
}
diff --git a/admin/fundraising_campaigns.php b/admin/fundraising_campaigns.php
index abd63cbf..12bcf00b 100644
--- a/admin/fundraising_campaigns.php
+++ b/admin/fundraising_campaigns.php
@@ -465,9 +465,9 @@ case 'managelist':
print_r($_POST);
if (is_array($_POST['prospectremovefromlist'])) {
$uidlist = implode(',', $_POST['prospectremovefromlist']);
- $query = "DELETE FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id='$campaignid' AND users_uid IN ($uidlist)";
+ $query = "DELETE FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id=? AND users_uid IN (?)";
$stmt = $pdo->prepare($query);
- $stmt->execute();
+ $stmt->execute([$campaignid,$uidlist]);
show_pdo_errors_if_any($pdo);
}
// if theres nobody left in the list we need to reset the filter params as well
@@ -523,10 +523,10 @@ function save_campaign_info()
$startdate = $_POST['startdate'];
if (!$_GET['id']) {
- $query = "INSERT INTO fundraising_campaigns (name, fiscalyear) VALUES ('" . stripslashes($_POST['name']) . "','{$config['FISCALYEAR']}')";
+ $query = "INSERT INTO fundraising_campaigns (name, fiscalyear) VALUES (?,?)";
echo $query;
$stmt = $pdo->prepare($query);
- $stmt->execute();
+ $stmt->execute([stripslashes($_POST['name']),$config['FISCALYEAR']]);
$id = $pdo->lastInsertId();
happy_('Appeal Created');
} else {
@@ -534,15 +534,15 @@ function save_campaign_info()
happy_('Appeal Saved');
}
$stmt = $pdo->prepare("UPDATE fundraising_campaigns SET
- name='" . stripslashes($_POST['name']) . "',
- `type`='" . $_POST['type'] . "',
- startdate='" . $startdate . "',
- followupdate='" . $_POST['followupdate'] . "',
- enddate='" . $_POST['enddate'] . "',
- target='" . $_POST['target'] . "',
- fundraising_goal='" . $_POST['fundraising_goal'] . "'
- WHERE id='$id'");
- $stmt->execute();
+ name=?,
+ `type`=?,
+ startdate=?,
+ followupdate=?,
+ enddate=?,
+ target=?,
+ fundraising_goal=?
+ WHERE id=?");
+ $stmt->execute([stripslashes($_POST['name']),$_POST['type'],$startdate,$_POST['followupdate'],$_POST['enddate'],$_POST['target'],$_POST['fundraising_goal'],$id]);
}
send_header('Appeal Management',
diff --git a/admin/fundraising_goals_handler.inc.php b/admin/fundraising_goals_handler.inc.php
index 06c0c9f7..0b38be3c 100644
--- a/admin/fundraising_goals_handler.inc.php
+++ b/admin/fundraising_goals_handler.inc.php
@@ -55,8 +55,8 @@ if ($_POST['action'] == 'fundedit') {
}
if ($_POST['action'] == 'fundadd') {
if ($goal && $type && $name) {
- $stmt = $pdo->prepare("INSERT INTO fundraising_goals (goal,name,description,system,budget,fiscalyear) VALUES ('$goal','$name','$description','no','$budget','{$config['FISCALYEAR']}')");
- $stmt->execute();
+ $stmt = $pdo->prepare("INSERT INTO fundraising_goals (goal,name,description,system,budget,fiscalyear) VALUES (?,?,?,'no',?,?)");
+ $stmt->execute([$goal,$name,$description,$budget,$config['FISCALYEAR']]);
happy_('Added new fund');
} else
error_('Required fields were missing, please try again');
diff --git a/admin/fundraising_main.inc.php b/admin/fundraising_main.inc.php
index f5e775f0..47f93c10 100644
--- a/admin/fundraising_main.inc.php
+++ b/admin/fundraising_main.inc.php
@@ -1,8 +1,8 @@
if ($_GET['action'] == 'fundraisingmain') {
// this table is eventually going to be massive, and probably not in a tableview format, it'll show goals as well as all ongoing fund pledges, probabilities, etc as well as over/under, etc, all prettily colour coded.. basically a good overview of the total fundraising status of the fair.
- $q = $pdo->prepare("SELECT * FROM fundraising_goals WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY system DESC,goal");
- $q->execute();
+ $q = $pdo->prepare("SELECT * FROM fundraising_goals WHERE fiscalyear=? ORDER BY system DESC,goal");
+ $q->execute([$config['FISCALYEAR']]);
echo '';
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
@@ -28,20 +28,20 @@ if ($_GET['action'] == 'fundraisingmain') {
SELECT fundraising_donations.id, sponsors.organization AS name, fundraising_donations.value, fundraising_donations.status, fundraising_donations.probability
\t FROM fundraising_donations
\t JOIN sponsors ON fundraising_donations.sponsors_id=sponsors.id
- \t WHERE (fundraising_donations.fundraising_goal='$r->goal' $orsql)
- \t AND fundraising_donations.fiscalyear='{$config['FISCALYEAR']}'
+ \t WHERE (fundraising_donations.fundraising_goal=? ?)
+ \t AND fundraising_donations.fiscalyear=?
UNION
SELECT fundraising_donations.id, CONCAT(users.firstname,' ',users.lastname) AS name, fundraising_donations.value, fundraising_donations.status, fundraising_donations.probability
\t FROM fundraising_donations
\t JOIN users ON fundraising_donations.users_uid=users.uid
- \t WHERE (fundraising_donations.fundraising_goal='$r->goal' $orsql)
- \t AND fundraising_donations.fiscalyear='{$config['FISCALYEAR']}'
+ \t WHERE (fundraising_donations.fundraising_goal=? ?)
+ \t AND fundraising_donations.fiscalyear=?
\t ORDER BY status DESC, probability DESC, name
");
- $sq->execute();
+ $sq->execute([$r->goal,$orsql,$config['FISCALYEAR'],$r->goal,$orsql,$config['FISCALYEAR']]);
show_pdo_errors_if_any($pdo);
while ($sr = $sq->fetch(PDO::FETCH_OBJ)) {
echo "