diff --git a/admin/award_awardcreatedivisional.php b/admin/award_awardcreatedivisional.php index 09c59acc..886a8279 100644 --- a/admin/award_awardcreatedivisional.php +++ b/admin/award_awardcreatedivisional.php @@ -126,7 +126,7 @@ '{$config['FAIRYEAR']}' )"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); $award_awards_id=$pdo->lastInsertId(); diff --git a/admin/award_download.php b/admin/award_download.php index b2e031e6..3d0baf93 100644 --- a/admin/award_download.php +++ b/admin/award_download.php @@ -238,7 +238,7 @@ case 'check': $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); //FIXME: update the translations } diff --git a/admin/award_upload.php b/admin/award_upload.php index 6430fb52..40002282 100644 --- a/admin/award_upload.php +++ b/admin/award_upload.php @@ -446,7 +446,7 @@ case 'catdiv_save': $q = $pdo->prepare("UPDATE fairs SET catmap='$catmap',divmap='$divmap' WHERE id='$fairs_id'"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); happy_("Category/Division mapping information saved"); exit; diff --git a/admin/cwsfregister.php b/admin/cwsfregister.php index cd20df95..f691c849 100644 --- a/admin/cwsfregister.php +++ b/admin/cwsfregister.php @@ -55,7 +55,7 @@ include "xml.inc.php"; winners.year='".$config['FAIRYEAR']."'"); $wq->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); while($project=$wq->fetch(PDO::FETCH_OBJ)) { $sq=$pdo->prepare("SELECT * FROM students WHERE registrations_id='$project->registrations_id' AND year='".$config['FAIRYEAR']."'"); diff --git a/admin/donors.php b/admin/donors.php index ed3b57bc..1bce31d8 100644 --- a/admin/donors.php +++ b/admin/donors.php @@ -144,7 +144,7 @@ switch(get_value_from_array($_GET, 'action')) { AND fundraising_donations.fiscalyear='{$config['FISCALYEAR']}' ORDER BY datereceived DESC"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); if($q->rowCount()) { echo ""; @@ -234,7 +234,7 @@ switch(get_value_from_array($_GET, 'action')) { ORDER BY users_sponsor.primary DESC,lastname,firstname "); $query->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); $uids=array(); while($r=$query->fetch(PDO::FETCH_OBJ)) { $uids[]=$r->uid; @@ -439,7 +439,7 @@ switch(get_value_from_array($_GET, 'action')) { $id=$pdo->lastInsertId(); $logStr=getDonationString($id); save_activityinfo("Added donation/sponsorship: $logStr", $sponsorid, $_SESSION['users_uid'],"System"); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); happy_("Donation/sponsorship added"); } else { @@ -457,7 +457,7 @@ switch(get_value_from_array($_GET, 'action')) { happy_("Donation/sponsorship removed"); $q = $pdo->prepare("DELETE FROM fundraising_donations WHERE id='$id' AND sponsors_id='$sponsorid'"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); } else { error_("Invalid donation/sponsorship to remove"); @@ -630,7 +630,7 @@ function draw_contactsinfo_form($contact = null){ ORDER BY users_sponsor.primary DESC,lastname,firstname "); $query->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); while($contact = $query->fetch()){ // draw a header for this user @@ -841,7 +841,7 @@ function draw_activityinfo_form(){ //echo ""; $q = $pdo->prepare($query); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); if($q->rowCount()) { while($r = $q->fetch()) { echo ""; @@ -874,7 +874,7 @@ function save_activityinfo($comment, $donorId, $userId, $type, $campaign_id=null $cid)"; $q = $pdo->prepare($query); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); } function getDonationString($id) { @@ -887,7 +887,7 @@ function getDonationString($id) { AND fundraising_donations.fiscalyear='{$config['FISCALYEAR']}' "); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); $str=""; if($r=$q->fetch(PDO::FETCH_OBJ)) { $str.=format_date($r->datereceived)." - "; diff --git a/admin/export_checkin.php b/admin/export_checkin.php index ac549a6d..eaaf6873 100644 --- a/admin/export_checkin.php +++ b/admin/export_checkin.php @@ -56,7 +56,7 @@ if($catr=$catq->fetch(PDO::FETCH_OBJ)) projects.title "); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); $table=array(); diff --git a/admin/fair_stats_select.php b/admin/fair_stats_select.php index 2f6d61ba..2cb55b3a 100644 --- a/admin/fair_stats_select.php +++ b/admin/fair_stats_select.php @@ -54,7 +54,7 @@ $s = join(',', $_POST['stats']); $q = $pdo->prepare("UPDATE fairs SET gather_stats='$s' WHERE id='$id'"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); echo "UPDATE fairs SET gather_stats='$s' WHERE id='$id'"; happy_("Saved"); exit; diff --git a/admin/fix_judges_autocomplete.php b/admin/fix_judges_autocomplete.php index 291aa6e2..189a645a 100644 --- a/admin/fix_judges_autocomplete.php +++ b/admin/fix_judges_autocomplete.php @@ -14,13 +14,13 @@ while($i = $q->fetch(PDO::FETCH_OBJ)) { $p = generatePassword(12); $stmt = $pdo->prepare("UPDATE judges SET password='$p',complete='yes'"); $stmt->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); $stmt = $pdo->prepare("DELETE FROM judges_years WHERE judges_id='$id'"); $stmt->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); $stmt = $pdo->prepare("INSERT INTO judges_years (`judges_id`,`year`) VALUES ('$id','{$config['FAIRYEAR']}')"); $stmt->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); } ?> diff --git a/admin/fundraising_campaigns.php b/admin/fundraising_campaigns.php index 007de180..79f3d4fa 100644 --- a/admin/fundraising_campaigns.php +++ b/admin/fundraising_campaigns.php @@ -101,7 +101,7 @@ $q->execute(); $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(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); $recr=$recq->fetch(PDO::FETCH_OBJ); $received=$recr->received; if($r->target) @@ -175,7 +175,7 @@ $q->execute(); $goalr=getGoal($r->fundraising_goal); $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(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); $recr=recq->fetch(PDO::FETCH_OBJ); $received=$recr->received; if($r->target) @@ -472,7 +472,7 @@ $q->execute(); $query="DELETE FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id='$campaignid' AND users_uid IN ($uidlist)"; $stmt = $pdo->prepare($query); $stmt->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); } //if theres nobody left in the list we need to reset the filter params as well $q=$pdo->prepare("SELECT COUNT(*) AS num FROM fundraising_campaigns_users_link WHERE fundraising_campaigns_id='$campaignid'"); diff --git a/admin/fundraising_campaigns_prospecting.php b/admin/fundraising_campaigns_prospecting.php index c8695bd1..3ec52f1b 100644 --- a/admin/fundraising_campaigns_prospecting.php +++ b/admin/fundraising_campaigns_prospecting.php @@ -33,7 +33,7 @@ if($_POST['donortype']=="organization") { $q=$pdo->prepare("SELECT id, organization AS name, address, address2, city, province_code, postalcode FROM sponsors ORDER BY name"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); if(!$_POST['contacttype']) $contacttype=array("primary","secondary"); @@ -62,7 +62,7 @@ if($_POST['donortype']=="organization") { "); $cq->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); while($cr=m$cq->fetch(PDO::FETCH_OBJ)) { if(!$userslist[$cr->uid]) $userslist[$cr->uid]=user_load($cr->users_id); @@ -81,7 +81,7 @@ else if($_POST['donortype']=="individual") { $query="SELECT *,MAX(year) FROM users WHERE types LIKE '%$t%' GROUP BY uid HAVING deleted='no' ORDER BY lastname,firstname"; $q=$pdo->prepare($query); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); while($r=$q->fetch(PDO::FETCH_OBJ)) { if(!$userslist[$r->uid]) $userslist[$r->uid]=user_load_by_uid($r->uid); diff --git a/admin/fundraising_main.inc.php b/admin/fundraising_main.inc.php index 02e192e0..264821ea 100644 --- a/admin/fundraising_main.inc.php +++ b/admin/fundraising_main.inc.php @@ -43,7 +43,7 @@ if($_GET['action']=="fundraisingmain") { ORDER BY status DESC, probability DESC, name "); $sq->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); while($sr=$sq->fetch(PDO::FETCH_OBJ)) { echo "id\" class=\"fundraising{$sr->status}\">"; echo "
" . $query . "
" . $r["dt"] . "
"; diff --git a/admin/fundraising_reports_std.php b/admin/fundraising_reports_std.php index 7e20518b..729e0121 100644 --- a/admin/fundraising_reports_std.php +++ b/admin/fundraising_reports_std.php @@ -53,7 +53,7 @@ $sql.=" ORDER BY name"; $q=$pdo->prepare($sql); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); while($r=$q->fetch(PDO::FETCH_OBJ)) { $rep->heading($r->name); $table=array(); @@ -142,7 +142,7 @@ $sql.=" ORDER BY name"; $q=$pdo->prepare($sql); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); while($r=$q->fetch(PDO::FETCH_OBJ)) { $rep->heading($r->name)." (".$r->budget.")"; diff --git a/admin/fundraising_setup.php b/admin/fundraising_setup.php index a805e93f..52aa8fc4 100644 --- a/admin/fundraising_setup.php +++ b/admin/fundraising_setup.php @@ -271,7 +271,7 @@ $goal=ereg_replace("[^a-z]","",$goal); $q=$pdo->prepare("SELECT * FROM fundraising_goals WHERE goal='$goal' AND fiscalyear='{$config['FISCALYEAR']}'"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); if($q->rowCount()) { error_("The automatically generated purpose key (%1) generated from (%2) is not unique. Please try a different Purpose Name",array($goal,$_POST['name'])); exit; diff --git a/admin/fundraising_sponsorship.php b/admin/fundraising_sponsorship.php index 8530d9e2..471bd943 100644 --- a/admin/fundraising_sponsorship.php +++ b/admin/fundraising_sponsorship.php @@ -72,7 +72,7 @@ function typechange() { $q=$pdo->prepare("SELECT * FROM sponsors ORDER BY organization"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); echo ""; echo ""; echo "\n"; @@ -116,7 +116,7 @@ function typechange() { echo ""; $q=$pdo->prepare("SELECT * FROM fundraising WHERE year='{$config['FAIRYEAR']}' ORDER BY name"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); echo ""; echo ""; diff --git a/admin/reports_acscript.php b/admin/reports_acscript.php index 6f334f21..f72a8a7e 100644 --- a/admin/reports_acscript.php +++ b/admin/reports_acscript.php @@ -79,7 +79,7 @@ if(!$scriptformat) $scriptformat="default"; ORDER BY awards_order"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); // echo "
";
 	if(!$q->rowCount()) {
 		$rep->output();
@@ -113,7 +113,7 @@ if(!$scriptformat) $scriptformat="default";
 						`order`,
 						projects.projectnumber");
 		$pq->execute();
-					echo $pdo->errorInfo();
+					show_pdo_errors_if_any($pdo);
 
 		$r->winners = array();
 		$r->awarded_count = 0;
diff --git a/admin/reports_program_awards.php b/admin/reports_program_awards.php
index caaaf9b4..ad692f1b 100644
--- a/admin/reports_program_awards.php
+++ b/admin/reports_program_awards.php
@@ -42,7 +42,7 @@
 			ORDER BY awards_order");
 	$q->execute();
 
-	echo $pdo->errorInfo();
+	show_pdo_errors_if_any($pdo);
 
 	if($q->rowCCount())
 	{
@@ -53,7 +53,7 @@
 			//get teh age categories
 			$acq=$pdo->prepare("SELECT projectcategories.category FROM projectcategories, award_awards_projectcategories  WHERE projectcategories.year='".$config['FAIRYEAR']."' AND award_awards_projectcategories.year='".$config['FAIRYEAR']."' AND award_awards_projectcategories.award_awards_id='$r->id' AND award_awards_projectcategories.projectcategories_id=projectcategories.id ORDER BY projectcategories.id");
 			$acq->execute();
-			echo $pdo->errorInfo();
+			show_pdo_errors_if_any($pdo);
 			$cats="";
 			while($acr=$acq->fetch(PDO::FETCH_OBJ))
 			{
@@ -77,7 +77,7 @@
 					ORDER BY 
 						`order`");
 			$pq->execute();
-					echo $pdo->errorInfo();
+					show_pdo_errors_if_any($pdo);
 			$prevprizeid=-1;
 			while($pr=$pq->fetch(PDO::FETCH_OBJ))
 			{
diff --git a/admin/reports_projects_details.php b/admin/reports_projects_details.php
index 82e186b5..f3719ed0 100644
--- a/admin/reports_projects_details.php
+++ b/admin/reports_projects_details.php
@@ -77,7 +77,7 @@
 			ORDER BY
 				projects.projectnumber
 			");
-			echo $pdo->errorInfo();
+			show_pdo_errors_if_any($pdo);
 
 	$totalprojects=$projq->rowCount();
 	$projectcount=0;
diff --git a/admin/reports_students.inc.php b/admin/reports_students.inc.php
index 32fa02ee..a7a2625f 100644
--- a/admin/reports_students.inc.php
+++ b/admin/reports_students.inc.php
@@ -102,7 +102,7 @@ function reports_students_award_selfnom_num($report, $field, $text, $n)
 					AND project_specialawards_link.year='$year'
 				LIMIT $n,1");
 	$q->execute();
-	echo $pdo->errorInfo();
+	show_pdo_errors_if_any($pdo);
 	$i = $q->fetch(PDO::FETCH_OBJ);
 	return $i['name'];
 }
@@ -141,7 +141,7 @@ function report_student_regfee_item($report, $field, $text) {
 	$id=intval(substr($field,12));
 	$q=$pdo->prepare("SELECT regfee_items_id FROM regfee_items_link WHERE students_id='$text' AND regfee_items_id='$id'");
 	$q->execute();
-	echo $pdo->errorInfo();
+	show_pdo_errors_if_any($pdo);
 	if($r=$q->fetch(PDO::FETCH_OBJ)) {
 		return i18n("Yes");
 	}
diff --git a/admin/rerollprizes.php b/admin/rerollprizes.php
index 853008cd..692c3ce9 100644
--- a/admin/rerollprizes.php
+++ b/admin/rerollprizes.php
@@ -49,7 +49,7 @@ $stmt->execute();
 		//awards
 		$q=$pdo->prepare("SELECT * FROM award_awards WHERE year='$currentfairyear'");
 		$q->execute();
-		echo $pdo->errorInfo();
+		show_pdo_errors_if_any($pdo);
 		while($r=$q->fetch(PDO::FETCH_OBJ))
 		{
 			$stmt = $pdo->prepare("INSERT INTO award_awards (award_sponsors_id,award_types_id,name,criteria,presenter,`order`,year,excludefromac,cwsfaward) VALUES (
@@ -66,7 +66,7 @@ $stmt->execute();
 			
 			$q2=$pdo->prepare("SELECT * FROM award_awards_projectcategories WHERE year='$currentfairyear' AND award_awards_id='$r->id'");
 			$q2->execute();
-			echo $pdo->errorInfo();
+			show_pdo_errors_if_any($pdo);
 			while($r2=$q2->fetch(PDO::FETCH_OBJ))
 			{
 				$stmt = $pdo->prepare("INSERT INTO award_awards_projectcategories (award_awards_id,projectcategories_id,year) VALUES (
@@ -79,7 +79,7 @@ $stmt->execute();
 
 			$q2=$pdo->prepare("SELECT * FROM award_awards_projectdivisions WHERE year='$currentfairyear' AND award_awards_id='$r->id'");
 			$q2->execute();
-			echo $pdo->errorInfo();
+			show_pdo_errors_if_any($pdo);
 			while($r2=$q2->fetch(PDO::FETCH_OBJ))
 			{
 				$stmt = $pdo->prepare("INSERT INTO award_awards_projectdivisions (award_awards_id,projectdivisions_id,year) VALUES (
@@ -93,7 +93,7 @@ $stmt->execute();
 			echo i18n("  Rolling award prizes")."
"; $q2=$pdo->prepare("SELECT * FROM award_prizes WHERE year='$currentfairyear' AND award_awards_id='$r->id'"); $q2->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); while($r2=$q2->fetch(PDO::FETCH_OBJ)) { $stmt = $pdo->prepare("INSERT INTO award_prizes (award_awards_id,cash,scholarship,`value`,prize,number,`order`,year,excludefromac) VALUES ( @@ -113,7 +113,7 @@ $stmt->execute(); //award contacts $q=$pdo->prepare("SELECT * FROM award_contacts WHERE year='$currentfairyear'"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); while($r=$q->fetch(PDO::FETCH_OBJ)) $stmt = $pdo->prepare("INSERT INTO award_contacts (award_sponsors_id,salutation,firstname,lastname,position,email,phonehome,phonework,phonecell,fax,notes,year) VALUES ( '".$r->award_sponsors_id."', @@ -133,7 +133,7 @@ $stmt->execute(); //award types $q=$pdo->prepare("SELECT * FROM award_types WHERE year='$currentfairyear'"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); while($r=$q->fetch(PDO::FETCH_OBJ)) $stmt = $pdo->prepare("INSERT INTO award_types (id,type,`order`,year) VALUES ( '".$r->id."', diff --git a/admin/schoolsimport.php b/admin/schoolsimport.php index 16b5fa30..53f83e77 100644 --- a/admin/schoolsimport.php +++ b/admin/schoolsimport.php @@ -111,7 +111,7 @@ if(!$pdo->errorInfo()) $loaded++; else - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); } echo happy(i18n("Successfully loaded %1 schools",array($loaded))); echo "".i18n("School Management")."
"; diff --git a/admin/send_emailqueue.php b/admin/send_emailqueue.php index 73d582db..056fe67b 100644 --- a/admin/send_emailqueue.php +++ b/admin/send_emailqueue.php @@ -71,21 +71,21 @@ if(!$config['emailqueue_lock']) { if($result) { $stmt = $pdo->prepare("UPDATE emailqueue_recipients SET sent=NOW(), `result`='ok' WHERE id='$r->id'"); $stmt->execute() - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); $newnumsent=$email->numsent+1; $stmt = $pdo->prepare("UPDATE emailqueue SET numsent=$newnumsent WHERE id='$email->id'"); $stmt->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); echo "ok\n"; } else { $stmt = Spdo->prepare("UPDATE emailqueue_recipients SET `sent`=NOW(), `result`='failed' WHERE id='$r->id'"); $stmt->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); $newnumfailed=$email->numfailed+1; $stmt = $pdo->prepare("UPDATE emailqueue SET numfailed=$newnumfailed WHERE id='$email->id'"); $stmt->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); echo "failed\n"; } //now check if we're done yet diff --git a/admin/sponsor_contacts.php b/admin/sponsor_contacts.php index 17efdaeb..8c3d9d85 100644 --- a/admin/sponsor_contacts.php +++ b/admin/sponsor_contacts.php @@ -180,7 +180,7 @@ AND deleted='no' ORDER BY lastname,firstname"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); if($q->rowCount()) { diff --git a/admin/student_editor.php b/admin/student_editor.php index e8a90bc0..c1de9bd1 100644 --- a/admin/student_editor.php +++ b/admin/student_editor.php @@ -221,7 +221,7 @@ function students_load() registrations_id='$registrations_id' AND year='{$config['FAIRYEAR']}'"); $q->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); $numfound=$q->rowCount(); @@ -573,7 +573,7 @@ function registration_save() WHERE id='$registrations_id'"); $stmt->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); /* And the fairs_id, override anythign specified * if the user is a fair, force their own fairs_id */ @@ -583,7 +583,7 @@ function registration_save() WHERE registrations_id='$registrations_id'"); $stmt->execute(); - echo $pdo->errorInfo(); + show_pdo_errors_if_any($pdo); happy_('Information Saved'); echo "
".i18n("Registration Summary for %1",array($reg_num))."