forked from science-ation/science-ation
Resolved the issue of misssing pdo execute statements and replacing echo $pdo->errorInfo() with show_pdo_error_if_any() in communication.php
This commit is contained in:
parent
6c9b2ec063
commit
10ab500ece
@ -171,7 +171,7 @@ case 'email_save':
|
||||
if($key && $name) {
|
||||
$q = $pdo->prepare("INSERT INTO emails(type,val) VALUES('$type','$key')");
|
||||
$q->execute();
|
||||
echo $pdo->errorInfo();
|
||||
show_pdo_errors_if_any($pdo);
|
||||
$id = lastInsertId();
|
||||
} else {
|
||||
error_("Email Key and Name are required");
|
||||
@ -193,7 +193,7 @@ case 'email_save':
|
||||
fundraising_campaigns_id=$fcstr
|
||||
WHERE id='$id'");
|
||||
$q->execute();
|
||||
echo $pdo->errorInfo();
|
||||
show_pdo_errors_if_any($pdo);
|
||||
happy_("Email Saved");
|
||||
exit;
|
||||
|
||||
@ -213,6 +213,7 @@ case 'dialog_edit':
|
||||
$fcid = intval( $_GET['fundraising_campaigns_id']);
|
||||
$type = 'fundraising';
|
||||
$q=$pdo->prepare("SELECT * FROM fundraising_campaigns WHERE id='$fcid'");
|
||||
$q->execute();
|
||||
$fc=$q->fetch(PDO::FETCH_OBJ);
|
||||
$name=i18n("%1 communication for %2",array(ucfirst($key),$fc->name));
|
||||
} else {
|
||||
@ -619,7 +620,7 @@ case "email_send":
|
||||
case "email_get_list":
|
||||
|
||||
$q = $pdo->prepare("SELECT * FROM emails ORDER BY type,name");
|
||||
|
||||
$q->execute();
|
||||
echo "<table class=\"tableview\">";
|
||||
echo "<thead><tr>";
|
||||
echo " <th>".i18n("Name")."</th>";
|
||||
@ -688,13 +689,13 @@ case "email_get_list":
|
||||
|
||||
|
||||
$emailq = $pdo->prepare("SELECT * FROM emails WHERE id='$emailid'");
|
||||
$emailq.execute();
|
||||
$emailq->execute();
|
||||
$email=$emailq.fetch(PDO::FETCH_OBJ);
|
||||
|
||||
$recipq = $pdo->prepare("SELECT * FROM fundraising_campaigns_users_link
|
||||
WHERE fundraising_campaigns_id='$fcid'");
|
||||
$recipq.execute();
|
||||
echo $pdo->errorInfo();
|
||||
$recipq->execute();
|
||||
show_pdo_errors_if_any($pdo);
|
||||
|
||||
$numtotal=$recipq->rowCount();
|
||||
|
||||
@ -714,7 +715,7 @@ case "email_get_list":
|
||||
0)");
|
||||
$q->execute();
|
||||
$emailqueueid=$pdo->lastInsertId();
|
||||
echo $pdo->errorInfo();
|
||||
show_pdo_errors_if_any($pdo);
|
||||
|
||||
$urlproto = $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
|
||||
$urlmain = "$urlproto{$_SERVER['HTTP_HOST']}{$config['SFIABDIRECTORY']}";
|
||||
@ -792,7 +793,7 @@ case "email_get_list":
|
||||
}
|
||||
|
||||
if(get_value_from_array($_GET, 'action') == "send" && get_value_from_array($_GET, 'send')) {
|
||||
echo $pdo->errorInfo();
|
||||
show_pdo_errors_if_any($pdo);
|
||||
|
||||
$q = $pdo->prepare("SELECT * FROM emails WHERE id='".$_GET['send']."'");
|
||||
$q->execute();
|
||||
@ -814,7 +815,7 @@ case "email_get_list":
|
||||
|
||||
$tq->execute();
|
||||
if($pdo->errorInfo()) {
|
||||
echo $pdo->errorInfo();
|
||||
show_pdo_errors_if_any($pdo);
|
||||
exit;
|
||||
}
|
||||
$num=$tq->rowCount();
|
||||
@ -863,6 +864,7 @@ case "email_get_list":
|
||||
else if(get_value_from_array($_POST, 'action') == "reallysend" && get_value_from_array($_POST, 'reallysend') && get_value_from_array($_POST, 'to')) {
|
||||
$emailid=intval($_POST['reallysend']);
|
||||
$emailq=$pdo->prepare("SELECT * FROM emails WHERE id='$emailid'");
|
||||
$emailq->execute();
|
||||
$email=$emailq->fetch(PDO::FETCH_OBJ);
|
||||
$to=$_POST['to'];
|
||||
|
||||
@ -888,7 +890,7 @@ case "email_get_list":
|
||||
0)");
|
||||
$q->execute();
|
||||
$emailqueueid=lastInsertId();
|
||||
echo $pdo->errorInfo();
|
||||
show_pdo_errors_if_any($pdo);
|
||||
|
||||
$urlproto = $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
|
||||
$urlmain = "$urlproto{$_SERVER['HTTP_HOST']}{$config['SFIABDIRECTORY']}";
|
||||
@ -920,7 +922,7 @@ case "email_get_list":
|
||||
//we only send school access codes to science heads or principals
|
||||
$acq=$pdo->prepare("SELECT accesscode FROM schools WHERE (sciencehead_uid='{$u['uid']}' OR principal_uid='{$u['uid']}') AND `year`='{$config['FAIRYEAR']}'");
|
||||
$acq->execute();
|
||||
echo $pdo->errorInfo();
|
||||
show_pdo_errors_if_any($pdo);
|
||||
$acr=$acq->fetch(PDO::FETCH-OBJ);
|
||||
$accesscode=$acr->accesscode;
|
||||
|
||||
@ -949,7 +951,7 @@ case "email_get_list":
|
||||
'".json_encode($replacements)."',
|
||||
NULL)");
|
||||
$q->execute();
|
||||
echo $pdo->errorInfo();
|
||||
show_pdo_errors_if_any($pdo);
|
||||
}
|
||||
|
||||
$q = $pdo->prepare("UPDATE emails SET lastsent=NOW() WHERE id='$emailid'");
|
||||
|
@ -83,6 +83,7 @@ $(document).ready(function()
|
||||
//key is 'val' from emails table, or id is id, fcid simply gets passed in and saved if needed
|
||||
//only id or key are used to lookup which to open
|
||||
function opencommunicationeditor(key,id,fcid) {
|
||||
console.log('yes');
|
||||
var fcstr="";
|
||||
if(fcid)
|
||||
fcstr="&fundraising_campaigns_id="+fcid;
|
||||
|
Loading…
x
Reference in New Issue
Block a user