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) {
|
if($key && $name) {
|
||||||
$q = $pdo->prepare("INSERT INTO emails(type,val) VALUES('$type','$key')");
|
$q = $pdo->prepare("INSERT INTO emails(type,val) VALUES('$type','$key')");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
$id = lastInsertId();
|
$id = lastInsertId();
|
||||||
} else {
|
} else {
|
||||||
error_("Email Key and Name are required");
|
error_("Email Key and Name are required");
|
||||||
@ -193,7 +193,7 @@ case 'email_save':
|
|||||||
fundraising_campaigns_id=$fcstr
|
fundraising_campaigns_id=$fcstr
|
||||||
WHERE id='$id'");
|
WHERE id='$id'");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
happy_("Email Saved");
|
happy_("Email Saved");
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
@ -213,6 +213,7 @@ case 'dialog_edit':
|
|||||||
$fcid = intval( $_GET['fundraising_campaigns_id']);
|
$fcid = intval( $_GET['fundraising_campaigns_id']);
|
||||||
$type = 'fundraising';
|
$type = 'fundraising';
|
||||||
$q=$pdo->prepare("SELECT * FROM fundraising_campaigns WHERE id='$fcid'");
|
$q=$pdo->prepare("SELECT * FROM fundraising_campaigns WHERE id='$fcid'");
|
||||||
|
$q->execute();
|
||||||
$fc=$q->fetch(PDO::FETCH_OBJ);
|
$fc=$q->fetch(PDO::FETCH_OBJ);
|
||||||
$name=i18n("%1 communication for %2",array(ucfirst($key),$fc->name));
|
$name=i18n("%1 communication for %2",array(ucfirst($key),$fc->name));
|
||||||
} else {
|
} else {
|
||||||
@ -619,7 +620,7 @@ case "email_send":
|
|||||||
case "email_get_list":
|
case "email_get_list":
|
||||||
|
|
||||||
$q = $pdo->prepare("SELECT * FROM emails ORDER BY type,name");
|
$q = $pdo->prepare("SELECT * FROM emails ORDER BY type,name");
|
||||||
|
$q->execute();
|
||||||
echo "<table class=\"tableview\">";
|
echo "<table class=\"tableview\">";
|
||||||
echo "<thead><tr>";
|
echo "<thead><tr>";
|
||||||
echo " <th>".i18n("Name")."</th>";
|
echo " <th>".i18n("Name")."</th>";
|
||||||
@ -688,13 +689,13 @@ case "email_get_list":
|
|||||||
|
|
||||||
|
|
||||||
$emailq = $pdo->prepare("SELECT * FROM emails WHERE id='$emailid'");
|
$emailq = $pdo->prepare("SELECT * FROM emails WHERE id='$emailid'");
|
||||||
$emailq.execute();
|
$emailq->execute();
|
||||||
$email=$emailq.fetch(PDO::FETCH_OBJ);
|
$email=$emailq.fetch(PDO::FETCH_OBJ);
|
||||||
|
|
||||||
$recipq = $pdo->prepare("SELECT * FROM fundraising_campaigns_users_link
|
$recipq = $pdo->prepare("SELECT * FROM fundraising_campaigns_users_link
|
||||||
WHERE fundraising_campaigns_id='$fcid'");
|
WHERE fundraising_campaigns_id='$fcid'");
|
||||||
$recipq.execute();
|
$recipq->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
|
|
||||||
$numtotal=$recipq->rowCount();
|
$numtotal=$recipq->rowCount();
|
||||||
|
|
||||||
@ -714,7 +715,7 @@ case "email_get_list":
|
|||||||
0)");
|
0)");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
$emailqueueid=$pdo->lastInsertId();
|
$emailqueueid=$pdo->lastInsertId();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
|
|
||||||
$urlproto = $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
|
$urlproto = $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
|
||||||
$urlmain = "$urlproto{$_SERVER['HTTP_HOST']}{$config['SFIABDIRECTORY']}";
|
$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')) {
|
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 = $pdo->prepare("SELECT * FROM emails WHERE id='".$_GET['send']."'");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
@ -814,7 +815,7 @@ case "email_get_list":
|
|||||||
|
|
||||||
$tq->execute();
|
$tq->execute();
|
||||||
if($pdo->errorInfo()) {
|
if($pdo->errorInfo()) {
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$num=$tq->rowCount();
|
$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')) {
|
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']);
|
$emailid=intval($_POST['reallysend']);
|
||||||
$emailq=$pdo->prepare("SELECT * FROM emails WHERE id='$emailid'");
|
$emailq=$pdo->prepare("SELECT * FROM emails WHERE id='$emailid'");
|
||||||
|
$emailq->execute();
|
||||||
$email=$emailq->fetch(PDO::FETCH_OBJ);
|
$email=$emailq->fetch(PDO::FETCH_OBJ);
|
||||||
$to=$_POST['to'];
|
$to=$_POST['to'];
|
||||||
|
|
||||||
@ -888,7 +890,7 @@ case "email_get_list":
|
|||||||
0)");
|
0)");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
$emailqueueid=lastInsertId();
|
$emailqueueid=lastInsertId();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
|
|
||||||
$urlproto = $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
|
$urlproto = $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
|
||||||
$urlmain = "$urlproto{$_SERVER['HTTP_HOST']}{$config['SFIABDIRECTORY']}";
|
$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
|
//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=$pdo->prepare("SELECT accesscode FROM schools WHERE (sciencehead_uid='{$u['uid']}' OR principal_uid='{$u['uid']}') AND `year`='{$config['FAIRYEAR']}'");
|
||||||
$acq->execute();
|
$acq->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
$acr=$acq->fetch(PDO::FETCH-OBJ);
|
$acr=$acq->fetch(PDO::FETCH-OBJ);
|
||||||
$accesscode=$acr->accesscode;
|
$accesscode=$acr->accesscode;
|
||||||
|
|
||||||
@ -949,7 +951,7 @@ case "email_get_list":
|
|||||||
'".json_encode($replacements)."',
|
'".json_encode($replacements)."',
|
||||||
NULL)");
|
NULL)");
|
||||||
$q->execute();
|
$q->execute();
|
||||||
echo $pdo->errorInfo();
|
show_pdo_errors_if_any($pdo);
|
||||||
}
|
}
|
||||||
|
|
||||||
$q = $pdo->prepare("UPDATE emails SET lastsent=NOW() WHERE id='$emailid'");
|
$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
|
//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
|
//only id or key are used to lookup which to open
|
||||||
function opencommunicationeditor(key,id,fcid) {
|
function opencommunicationeditor(key,id,fcid) {
|
||||||
|
console.log('yes');
|
||||||
var fcstr="";
|
var fcstr="";
|
||||||
if(fcid)
|
if(fcid)
|
||||||
fcstr="&fundraising_campaigns_id="+fcid;
|
fcstr="&fundraising_campaigns_id="+fcid;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user