/** * build a SET blah=blahblah list from an array for INSERT queries, smartquoting along the way * @example: db::buildSet(array('alpha'=>'face', 'round'=>'male')) returns "`alpha`='face', `round`='male'". * It's good stuff. */ function buildSet($arr) { foreach ($arr as $key => $value) { $set[] = "`{$key}`=" . db::esc($value); } return implode(', ', $set); }
} else { if ($enrolmentOpen) { db::insertQuery("insert into events (instanceID, courseID, locationID, startDateTime, endDateTime, courseDate, cost, maxparticipants, totalParticipants, totalParticipantsVacancy, enrolmentOpen, updated, processed, active) values('{$instanceID}','{$courseID}','{$locationID}','{$startDateTime}','{$endDateTime}','{$courseData}','{$cost}','{$maxparticipants}','{$totalParticipants}','{$totalParticipantsVacancy}','{$enrolmentOpen}',now(),'1','1')"); db::insertQuery("insert into log (type,message,instanceID) values('sync','Istance Created','{$instanceID}')"); } } $eventTotal++; } //var_dump($courses); //die(); } $mergedata = db::runQuery("select * from locations where mergeWithID != '0'"); if ($mergedata) { foreach ($mergedata as $merge) { $oldLocationID = db::esc($merge['ID']); $newLocationID = db::esc($merge['mergeWithID']); db::insertQuery("update events set locationID = '{$newLocationID}' where locationID = '{$oldLocationID}'"); $locationMerge++; } } dlog("Finalising", "sync"); echo "Total Locations Processed: " . $locationTotal . "<br>\n"; echo "Total Locations Merged: " . $locationMerge . "<br>\n"; echo "Total Events Processed: " . $eventTotal . "<br>\n"; echo "Total Events Closed: " . $closedTotal . "<br>\n"; echo "Completed at: " . date("Y-m-d g:i:s A", strtotime("now")); dlog("############################################", "sync"); dlog("# Total Locations Processed: {$locationTotal}", "sync"); dlog("# Total Locations Merged: {$locationMerge}", "sync"); dlog("# Total Events Processed: {$eventTotal}", "sync"); dlog("# Total Events Closed: {$closedTotal}", "sync");
function loginTemp() { $matchingTemps = $GLOBALS['db']->niceQuery("SELECT * FROM temporaryUser WHERE ip=" . db::esc($_SERVER['REMOTE_ADDR']) . ";"); if (count($matchingTemps) == 0) { //no match -> new temp. $res = $GLOBALS['db']->niceQuery("INSERT INTO temporaryUser SET ip=" . db::esc($_SERVER['REMOTE_ADDR']) . ", lastSeen=NOW(), firstSeen=NOW();"); self::logout(); $_SESSION['user']['username'] = '******'; $_SESSION['user']['type'] = 'temporaryUser'; $_SESSION['user']['id'] = $GLOBALS['db']->whatWasThatInsertId(); } else { if (count($matchingTemps) >= 1) { //there's a match investigate. //that's the guy! $GLOBALS['db']->query("UPDATE temporaryUser SET lastSeen=NOW() WHERE ip=" . db::esc($_SERVER['REMOTE_ADDR']) . ";"); self::logout(); $_SESSION['user']['username'] = '******'; $_SESSION['user']['type'] = 'temporaryUser'; $_SESSION['user']['id'] = $matchingTemps[0]['id']; } else { die("bad, but exaggerated. ERROR 0x05539 -- report to site admin."); } } }
function logBookingDetails($bookingdetails) { //var_dump($bookingdetails); $courseID = db::esc($bookingdetails['courseID']); $instanceID = db::esc($bookingdetails['instanceID']); $learnerID = db::esc($bookingdetails['learnerID']); $invoiceID = db::esc($bookingdetails['invoiceID']); $TXN = db::esc($bookingdetails['Txn']); $USI = db::esc($bookingdetails['USI']); $contactID = db::esc($bookingdetails['contactID']); $paymentMethod = db::esc($bookingdetails['paymentMethod']); $campaignID = db::esc($bookingdetails['campaignID']); $orderID = db::esc($bookingdetails['orderID']); $failed = db::esc($bookingdetails['failed']); $dollorAmount = db::esc($bookingdetails['dollorAmount']); $NABTransData = db::esc($bookingdetails['NABTransData']); $AxTransData = db::esc($bookingdetails['AxTransData']); $userSource = db::esc($bookingdetails['userSource']); $specialNeeds = db::esc($bookingdetails['specialNeeds']); $optInReBook = db::esc($bookingdetails['optInReBook']); if ($failed) { $failed = 1; } else { $failed = 0; } db::insertQuery("insert into bookingDetails (courseID, instanceID, learnerID, invoiceID, TXN, contactID, paymentMethod, couponID, orderID, failed, dollorAmount, AxcelerateTransData, NABTransData, userSource, specialNeeds, optInReBook, USI) values('{$courseID}','{$instanceID}','{$learnerID}','{$invoiceID}','{$TXN}','{$contactID}','{$paymentMethod}','{$campaignID}','{$orderID}','{$failed}','{$dollorAmount}','{$AxTransData}','{$NABTransData}','{$userSource}','{$specialNeeds}','{$optInReBook}','{$USI}')"); $_SESSION['EnrolLocked'] = false; return true; }
function getEmailByHashID($hashid, $emailConfirmation) { $hashid = db::esc($hashid); $emailConfirmation = db::esc($emailConfirmation); $email = db::runQuery("select * from emails where toAddress = '{$emailConfirmation}' and emailKey = '{$hashid}'"); if ($email) { $email = $email[0]; return $email; } else { return false; } }
$enrolVar["email" . $currentuser] = db::esc($postVar["email" . $currentuser]); $enrolVar["address" . $currentuser] = db::esc($postVar["address" . $currentuser]); $enrolVar["suburb" . $currentuser] = db::esc($postVar["suburb" . $currentuser]); $enrolVar["postcode" . $currentuser] = db::esc($postVar["postcode" . $currentuser]); $enrolVar["usi" . $currentuser] = db::esc($postVar["usi" . $currentuser]); $enrolVar["workplace" . $currentuser] = db::esc($postVar["workplace" . $currentuser]); $enrolVar["special_needs" . $currentuser] = db::esc($postVar["special_needs" . $currentuser]); $userData = array('processgroupID' => $groupID, 'eventID' => $eventID, 'firstname' => $enrolVar["fname" . $currentuser], 'lastname' => $enrolVar["lname" . $currentuser], 'mobile' => $enrolVar["mobile" . $currentuser], 'email' => $enrolVar["email" . $currentuser], 'address' => $enrolVar["address" . $currentuser], 'suburb' => $enrolVar["suburb" . $currentuser], 'postcode' => $enrolVar["postcode" . $currentuser], 'usi' => $enrolVar["usi" . $currentuser], 'workplace' => $enrolVar["workplace" . $currentuser], 'additionalinfo' => $enrolVar["special_needs" . $currentuser], 'cost' => $s_costperuser); $lookupData = array('processgroupID' => $groupID, 'eventID' => $eventID, 'firstname' => $enrolVar["fname" . $currentuser], 'lastname' => $enrolVar["lname" . $currentuser]); $insertData = arrtosqltable($userData); $selectData = arrtosqltable_select($lookupData); $updateData = arrtosqltable_update($userData); $contactcheck = db::runQuery("select * from |process_trainee| {$selectData}"); if ($contactcheck) { $fname = db::esc($enrolVar["fname" . $currentuser]); $lname = db::esc($enrolVar["lname" . $currentuser]); db::insertQuery("update |process_trainee| {$updateData} where processgroupID = '{$groupID}' and firstname = '{$fname}' and lastname = '{$lname}'"); } else { db::insertQuery("insert into |process_trainee| {$insertData}"); } $currentuser++; } $enrolVar['source'] = $postVar['source']; //Payment Method $enrolVar['payment'] = $postVar['payment']; $enrolVarp['otherPtype'] = $postVar['otherpaymentselection']; //Fields for Credit Card $enrolVar['cc'] = $postVar['cc']; $enrolVar['expiryM'] = $postVar['expiryM']; $enrolVar['expiryY'] = substr($postVar['expiryY'], -2, 2); $enrolVar['cvv'] = $postVar['cvv'];
<?php include "application.php"; include "db.class.php"; include "functions.php"; include "esmtp.class.php"; //var_dump($_GET); $suburbName = db::esc($_GET['term']); //$ret = db::runQuery("select suburbName, postcode_db.* from |startrack_suburbs| left join postcode_db on postcode_db.postcode = startrack_suburbs.postcode and postcode_db.suburb = startrack_suburbs.suburbName where countryCode = 'AU' and suburbName like '$suburbName%'"); $ret = db::runQuery("select suburbName, startrack_suburbs.postcode, postcode_db.state from |startrack_suburbs| left join postcode_db on startrack_suburbs.postcode like CONCAT('%', postcode_db.postcode ,'%') where countryCode = 'AU' and suburbName like '{$suburbName}%' group by suburbName"); $suburbArr = array(); if ($ret) { foreach ($ret as $retsb => $retsbv) { if ($retsbv['postcode'] == "") { $suburbArr = array_merge($suburbArr, array(array('value' => $retsbv['suburbName'], 'label' => $retsbv['suburbName'] . " " . $retsbv['state'] . " " . $retsbv['postcode']))); } else { $pcode = $retsbv['postcode']; if ($pcode == "4000") { $pcode = "4001"; } $suburbname = $retsbv['suburbName']; $suburbArr = array_merge($suburbArr, array(array('value' => $suburbname . "|" . $retsbv['state'] . "|" . $pcode, 'label' => $retsbv['suburbName'] . " " . $retsbv['state'] . " " . $retsbv['postcode']))); } } $retv = $suburbArr; } else { $retv = false; } echo json_encode($retv);
private static function _check($u = "", $p = "") { //procession the session $dt = time(); $dtS = date("Y-m-d H:i:s", $dt); if (self::$user["id"]) { if ($dt - (0 + self::$config["session-timeout"]) > self::$user["dlast"]) { self::$user["id"] = 0; db::q("UPDATE " . db::tnm(self::$class) . " SET `ses`='' WHERE `dlast`<('" . $dtS . "'-DATE_SUB('" . $dtS . "', INTERVAL " . self::$config["session-timeout"] . " SECOND))", false); } } //processing the cookies if (isset($_COOKIE[self::$class . "-user"])) { $cookie = $_COOKIE[self::$class . "-user"]; } else { $cookie = ""; } if ($cookie) { if (!self::$user["id"]) { //trying to restore previous user session $r = db::q("SELECT `id`,`stat`,`rights`,`dlog`,`dlast`,`dreg`,`name`,`email`,`display` FROM " . db::tnm(self::$class) . " WHERE `stat`=1 AND `ses`='" . db::esc($cookie) . "'", true); $rows = db::rows($r); if ($rows) { if ($rows > 1) { //system integrity error(!): deleting all sessions db::q("UPDATE " . db::tnm(self::$class) . " SET `ses`='' WHERE `ses`='" . db::esc($cookie) . "'", false); $cookie = ""; } else { self::$user = db::fetch($r); self::$user["admn"] = @substr(self::$user["rights"], 0, 1) === "1"; self::$user["id"] = 0 + self::$user["id"]; self::$user["dlast"] = 0 + self::$user["dlast"]; self::$user["dlog"] = 0 + self::$user["dlog"]; self::$user["dreg"] = 0 + self::$user["dreg"]; self::$user["stat"] = 0 + self::$user["stat"]; } } else { $cookie = ""; } } else { //de-authorizing the session on cookies not match if ($cookie != self::$user["cookie"]) { self::$user["id"] = 0; } } } //trying to start new user session $log = false; if ($u || $p) { if (self::$user["id"]) { msgr::add(_t("Ошибка: вход уже выполнен."), MSGR_TYPE_ERR); } else { $r = db::q("SELECT `id`,`stat`,`rights`,`dreg`,`dlog`,`dlast`,`name`,`email`,`display` FROM " . db::tnm(self::$class) . " WHERE `stat`=1 AND `name`='" . db::esc($name) . "' AND `pass`='" . @md5($name . $pass) . "'", true); $row = db::fetch($r); if (!$row) { msgr::add(_t("Неверное имя пользователя или пароль") . "!", MSGR_TYPE_ERR); $cookie = ""; } else { $log = true; self::$user = db::fetch($r); self::$user["id"] = 0 + self::$user["id"]; self::$user["stat"] = 0 + self::$user["stat"]; self::$user["dreg"] = 0 + self::$user["dreg"]; self::$user["dlog"] = 0 + self::$user["dlog"]; self::$user["dlast"] = 0 + self::$user["dlast"]; self::$user["admn"] = @substr(self::$user["rights"], 0, 1) === "1"; $cookie = session_id(); } } } //trying to connect to external user session $srvs = self::$c->services(self::$class, self::$srvFuncs["user"]); if (count($srvs)) { //checking state of each external authorization system //and searching for first which is authorized $euser = false; foreach ($srvs as $mod => $method) { $user = @call_user_func_array(array(__NAMESPACE__ . "\\" . $mod, $method), array(self::$user["id"])); if (!$euser && $user) { $euser = $user; } if (self::$user["id"] && $user && $user["feid"] != self::$user["id"]) { @call_user_func(array(__NAMESPACE__ . "\\" . $mod, self::$srvFuncs["logout"])); if ($euser && $user["id"] == $euser["id"]) { $euser = false; } } } //performing authorization, creating new user record if allowed if ($euser) { if (!self::$user["id"]) { if (!$euser["feid"]) { if (self::$config["external-autoreg"]) { if (self::_insert($euser)) { $id = 0 + db::iid(); if (!@call_user_func(array(__NAMESPACE__ . "\\" . $mod, self::$srvFuncs["register"]), $id)) { self::_delete($id); msgr::errorLog("Can't automatically register external user.", true, self::$class, "_check", __LINE__); } else { $euser["feid"] = $id; } } else { msgr::errorLog("Can't automatically register the user: Error while creating the new record.", true, self::$class, "_check", __LINE__); } } } if ($euser["feid"]) { $r = db::q("SELECT `id`,`stat`,`rights`,`dreg`,`dlog`,`dlast`,`name`,`email`,`display` FROM " . db::tnm(self::$class) . " WHERE `stat`=1 AND `id`='" . $euser["feid"], true); $row = db::fetch($r); if (!$row) { $cookie = ""; } $log = true; self::$user = db::fetch($r); self::$user["id"] = 0 + self::$user["id"]; self::$user["stat"] = 0 + self::$user["stat"]; self::$user["dreg"] = 0 + self::$user["dreg"]; self::$user["dlog"] = 0 + self::$user["dlog"]; self::$user["dlast"] = 0 + self::$user["dlast"]; self::$user["admn"] = @substr(self::$user["rights"], 0, 1) === "1"; $cookie = session_id(); } } } } //saving final data self::_cookie($cookie); if (self::$user["id"]) { if ($log) { self::$user["dlog"] = $dt; } self::$user["dlast"] = $dt; self::$user["cookie"] = $cookie; db::q("UPDATE " . db::tnm(self::$class) . " SET " . ($log ? "`ses`='" . $cookie . "'" : "") . ($u ? "`dtlog`='" . $dtS . "' AND " : "") . "`dtlast`='" . $dtS . "' WHERE `id`=" . self::$user["id"], false); return true; } else { self::_userReset(); return false; } }
public function getresponsereferaltemplateforemail($listingID) { $patientdata = patient::getpatientbyID($listingID); $patientdata = $patientdata[0]; $practdata = Login::gettheuser(); $username = $practdata['email']; $userdata = Login::getuser($patientdata['userID']); if ($userdata['practtype'] == 1) { $practtype = "Doctor"; } else { $practtype = "Nurse"; } /* $emailtemplate = $emailtemplate.'<h1>Practitioners Details</h1>'; $emailtemplate = $emailtemplate.'<p><b>Details about the practitioner who submitted the referral.<br>If serious or life threatening please contact them directly as well.</b></p>'; $emailtemplate = $emailtemplate.'<div><label class="label"><span class="bold">Practitioner:</span> <span>'.$userdata['fullname'].'</span></label></div>'; $emailtemplate = $emailtemplate.'<div><label class="label"><span class="bold">Institution:</span> <span>'.$userdata['institution'].'</span></label></div>'; $emailtemplate = $emailtemplate.'<br>'; $emailtemplate = $emailtemplate.'<div><label class="label"><span class="bold">Practitioner Type:</span> <span>'.$practtype.'</span></label></div>'; $emailtemplate = $emailtemplate.'<div><label class="label"><span class="bold">AHPRA Registration No.:</span> <span>'.$userdata['ahpraregnumber'].'</span></label></div>'; $emailtemplate = $emailtemplate.'<br>'; $emailtemplate = $emailtemplate.'<div><label class="label"><span class="bold">State:</span> <span>'.$userdata['state'].'</span></label></div>'; $emailtemplate = $emailtemplate.'<div><label class="label"><span class="bold">Direct Phone:</span> <span>'.$userdata['directphone'].'</span></label></div>'; $emailtemplate = $emailtemplate.'<div><label class="label"><span class="bold">Mobile (Emergency Only):</span> <span>'.$userdata['mobile'].'</span></label></div>'; $emailtemplate = $emailtemplate.'<div><label class="label"><span class="bold">After Hours Phone:</span> <span>'.$userdata['afterhoursph'].'</span></label></div>'; $emailtemplate = $emailtemplate.''; $emailtemplate = $emailtemplate.'<br>'; $emailtemplate = $emailtemplate.' '; * */ $refresponse = db::runQuery('select * from |patient_responses| where PatientID = ' . db::esc($patientdata['ID']) . ' and active = 1', 0, 99); if ($refresponse) { $refresponse = $refresponse[0]; $response = db::esc($refresponse['Response']); $diagnosisID = db::esc($refresponse['diagnosis_grade']); $diagnosisOther = db::esc($refresponse['Diagnosis']); $telarelated = db::esc($refresponse['telaprevir_related']); $followuprecommendation = db::esc($refresponse['followup_recommendation']); $consultcomplete = db::esc($refresponse['completed']); $additionalresponse = db::esc($refresponse['additional_response']); } $emailtemplate = $emailtemplate . '<div class="referralwrapper">'; $emailtemplate = $emailtemplate . '<h1 class="formheader">Referral Response</h1>'; $emailtemplate = $emailtemplate . ' '; $emailtemplate = $emailtemplate . '<div><label class="label"><span class="bold"><strong>Response:</strong></span> <spane>' . $response . '</spane></label></div>'; $emailtemplate = $emailtemplate . '<div><div class="label"><span class="bold"><strong>Diagnosis:</strong></span> '; $emailtemplate = $emailtemplate . '<span>'; $grade = db::runQuery('select * from |diagnosis_grades| order by ID asc', 0, 99); foreach ($grade as $item) { if ($diagnosisID == $item['ID']) { $checkedoutput = " checked"; $emailtemplate = $emailtemplate . '<div class="formitem radiobutton "><label>' . $item['grade'] . '</label>'; $emailtemplate = $emailtemplate . ' <span class="moreinfo">' . functions::replaceouttemplatetext($item['grade_intro']) . '<br><br>' . functions::replaceouttemplatetext($item['description']) . '</span>'; $emailtemplate = $emailtemplate . '</div>'; } } if ($diagnosisID == "5") { $emailtemplate = $emailtemplate . '<div class="formitem radiobutton "><label>Other</label>'; $emailtemplate = $emailtemplate . ' <span class="moreinfo"><spane>' . $diagnosisOther . '</spane></span>'; $emailtemplate = $emailtemplate . '</div>'; } $emailtemplate = $emailtemplate . '</span>'; $emailtemplate = $emailtemplate . '</div></div>'; $emailtemplate = $emailtemplate . '<div><div class="label"><span class="bold"><strong>Telaprevir Related:</strong></span>'; $emailtemplate = $emailtemplate . '<span>'; $reldetails = functions::gettelaprevirrelatedoptions($telarelated); $emailtemplate = $emailtemplate . '<div class="formitem radiobutton "><label>' . $reldetails['name'] . '</label>'; $emailtemplate = $emailtemplate . ' <span class="moreinfo">' . $reldetails['text'] . '</span>'; $emailtemplate = $emailtemplate . '</div>'; $emailtemplate = $emailtemplate . '</span>'; $emailtemplate = $emailtemplate . '</div></div>'; $emailtemplate = $emailtemplate . '<div><div class="label"><span class="bold"><strong>Management:</strong> <span style="font-weight:normal;"><i>Please read the following attachments</i></span></span> '; $emailtemplate = $emailtemplate . '<span>'; $toattach = db::runQuery('select * from |referral_attachments| order by ID asc', 0, 99); foreach ($toattach as $item) { if (functions::patienthasreferalattachementbyid($patientdata['ID'], $item['ID'])) { $emailtemplate = $emailtemplate . '<div class="formitem checkbox"><label><a href="' . BASEDOMAIN . $item['filelocation'] . $item['filename'] . '" target="_blank">' . $item['fileDescription'] . '</a></label></div>'; } } $emailtemplate = $emailtemplate . '</span>'; $emailtemplate = $emailtemplate . '</div>'; $emailtemplate = $emailtemplate . '<div><label class="label"><span class="bold"><strong>Follow up recommendation: </strong><span style="font-weight:normal;"><i>(blank if not required)</i></span></span> <span>' . $followuprecommendation . '</span></label></div>'; $emailtemplate = $emailtemplate . '<input type="hidden" name="saveonly" id="saveonly" value="false">'; $responsehistory = db::runQuery('select * from |patient_history| where history_type = 5 and patientID = ' . $listingID . ' order by historyID desc'); if ($responsehistory) { $emailtemplate = $emailtemplate . '<h1 class="formheader">Additional Referral Response</h1>'; } if ($responsehistory) { foreach ($responsehistory as $response) { $emailtemplate = $emailtemplate . '<div><b>From ' . functions::replaceouttemplatetext_doctor('Dr Gregory Siller', $response['doctorID']) . ' on ' . $response['history_created'] . '</b>,<br>' . $response['addresponse'] . '</div><br><br>'; } } return $emailtemplate; }
protected static final function qe($s) { return db::esc($s); }
window.alert = function(){}; var defaultCSS = document.getElementById('bootstrap-css'); function changeCSS(css){ if(css) $('head > link').filter(':first').replaceWith('<link rel="stylesheet" href="'+ css +'" type="text/css" />'); else $('head > link').filter(':first').replaceWith(defaultCSS); } </script> </head> <body> <div class="container"> <div class="row"> <div class="col-sm-6 col-md-4 col-md-offset-4"> <br><br> <div class="account-wall"> <form class="form-signin" method="post" action="?k=<?php echo db::esc($emailKey); ?> "> <center><img src="/images/awfa_logo_trans.png"></center> <h1 class="text-center login-title">For security reasons,<br>please confirm your email address.</h1> <?php if ($messageFailed) { ?> <div class="errornotif"><b>Error:</b> Incorrect email or no message found!</div> <?php } ?> <input type="text" name="email" class="form-control" placeholder="Email" required autofocus><br> <button class="btn btn-lg btn-primary btn-block" type="submit"> Confirm Email Address</button> </form>
function sendManualInvoice($processgroupID) { $emailKey = $processgroupID; $html = getEmailTemplate("template_invoicenotification.htm"); $processgroupID = db::esc($processgroupID); $mainData = db::runQuery("select * from process_group left join events on events.instanceID = process_group.eventID left join courses on courses.courseID = events.courseID left join locations on locations.ID = events.locationID left join coupons on coupons.couponCode = process_group.campaign_code where processgroupID = '{$processgroupID}'"); if (!$mainData) { return false; } else { $mData = $mainData[0]; $courseName = $mData['CourseName']; $couponName = $mData['campaignName']; $normalCost = $mData['cost']; $totalTrainees = $mData['total_trainee']; $discountcost = $mData['totalcost']; $costNormalTotal = $normalCost * $totalTrainees; $discountcostPerperson = $discountcost / $totalTrainees; $amountDiscountedTot = $costNormalTotal - $discountcost; $invoiceItems = ""; for ($tr = 0; $tr < $totalTrainees; $tr++) { $subHTML = ""; $subHTML = $subHTML . "\t\t<tr style='font-size:13px;'>"; $subHTML = $subHTML . "\t\t\t<td>" . $courseName . " - " . $couponName . "</td>"; $subHTML = $subHTML . "\t\t\t<td>\$" . number_format($normalCost, 2) . "</td>"; $subHTML = $subHTML . "\t\t\t<td>\$" . number_format($discountcostPerperson, 2) . "</td>"; $subHTML = $subHTML . "\t\t</tr>"; $invoiceItems = $invoiceItems . $subHTML; } $html = varReplace("invoiceItemsRow", $invoiceItems, $html); $html = varReplace("order.totalNormal", number_format($costNormalTotal, 2), $html); $html = varReplace("order.Total", number_format($discountcost, 2), $html); $html = varReplace("order.amountDiscounted", number_format($amountDiscountedTot, 2), $html); $html = varReplace("order.subTotal", number_format($discountcost, 2), $html); if ($mData['payment_status'] == "completed") { $html = varReplace("order.amountPaid", number_format($discountcost, 2), $html); $html = varReplace("order.balanceDue", "0.00", $html); } else { $html = varReplace("order.amountPaid", "0.00", $html); $html = varReplace("order.balanceDue", number_format($discountcost, 2), $html); } $html = varReplace("amountToInvoice", number_format($discountcost, 2), $html); $html = varReplace("eventID", $mData['eventID'], $html); $html = varReplace("courseName", $mData['CourseName'], $html); $html = varReplace("courseDateTime", $mData['startDateTime'], $html); $html = varReplace("courseLocation", $mData['LocationState'] . " " . $mData['LocationName'] . " - " . $mData['StreetAddress'], $html); $html = varReplace("totalTrainees", $mData['total_trainee'], $html); $html = varReplace("courseNormalCost", "\$" . number_format($costNormalTotal, 2), $html); $html = varReplace("couponCode", $mData['campaign_code'], $html); $html = varReplace("couponName", $couponName, $html); if ($mData['discountType'] == "0") { $html = varReplace("couponDiscount", "\$" . $mData['discountAmount'] . " off total", $html); } if ($mData['discountType'] == "1") { $html = varReplace("couponDiscount", $mData['discountAmount'] . "% off total", $html); } if ($mData['discountType'] == "2") { $html = varReplace("couponDiscount", "Custom price for Location", $html); } if ($mData['discountType'] == "3") { $html = varReplace("couponDiscount", "Custom price for Course", $html); } $trainees = db::runQuery("select * from process_trainee where processgroupID = '{$processgroupID}'"); if (!$trainees) { return false; } else { $currentTrainee = 1; $traineehtml = ""; foreach ($trainees as $trainee) { $trhtml = ""; $trhtml = $trhtml . '<b>Trainee ' . $currentTrainee . '</b>'; $trhtml = $trhtml . ' <table style="width:100%; margin-left:70px;">'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Contact ID</th>'; $trhtml = $trhtml . ' <td style="text-align:left;"><a href="https://admin.axcelerate.com.au/management/management2/Contact_View.cfm?ContactID=' . $trainee['contactID'] . '">' . $trainee['contactID'] . '</a></th>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Learner ID</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['leanerID'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Invoice ID</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['invoiceID'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Amount to Invoice</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">$' . number_format($trainee['cost'], 2) . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;"> </th>'; $trhtml = $trhtml . ' <td style="text-align:left;"></td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Name</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['firstname'] . ' ' . $trainee['lastname'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">USI</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['usi'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Email Address</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['email'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Mobile/Phone</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['mobile'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Workplace</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['workplace'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Address</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['address'] . '<br>' . $trainee['suburb'] . ' ' . $trainee['postcode'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' </table><br><br>'; $traineehtml = $traineehtml . $trhtml; $currentTrainee++; } $html = varReplace("traineeDetails", $traineehtml, $html); $remail = $mData['awfaSendInvoiceNotification']; //$remail = "*****@*****.**"; $subject = "MANUAL INVOICE: Please generate a manual invoice for this Discounted Enrolment"; $message = $html; $bookingID = ""; $instanceID = ""; $ccEmail = ""; //$ccEmail = "*****@*****.**"; email::logEmail($remail, $ccEmail, "", $subject, $message, $bookingID, $instanceID, $emailKey); esmtp::sendemail_smtp($remail, $subject, $message, $ccEmail); echo $html; } } }
function arrtosqltable_update($array) { $table = $array; /*$table = array( 'column1' => "My Value 1' \' '\ sdfsdf ", 'column2' => "My Value 2" ); */ $outputString = " set "; $ic = 0; foreach ($table as $tableKey => $tableValue) { //echo "Column: ".$tableKey."<br>"; //echo "---------- Value: ".$tableValue."<br><br>"; if ($ic == 0) { $outputString = $outputString . "" . db::esc($tableKey) . " = '" . db::esc($tableValue) . "'"; } else { $outputString = $outputString . ", " . db::esc($tableKey) . " = '" . db::esc($tableValue) . "'"; } $ic++; } $outputString = $outputString . " "; return $outputString; }
//$eventArray = array_merge(array( date('Y-m-d',strtotime($event['courseDate'])) => $event['instanceID'] ),$eventArray); //$eventArray = array_merge(array(array( "A".$event['instanceID'] => date('Y-m-d',strtotime($event['courseDate']))) ) ,$eventArray); } $data = $eventArray; //array("dates" => $eventArray); } else { $data = array("dates" => false); } echo json_encode($data); die; } else { } } if ($app == "checkInstance") { $instanceID = db::esc($_GET['instanceID']); $couponCode = db::esc($_GET['campaign']); $promoname = ""; $instances = db::runQuery("select * from events left join courses on courses.courseID = events.courseID left join locations on locations.ID = events.locationID where instanceID = '{$instanceID}' and enrolmentOpen = '1' and active = '1'"); if ($instances) { $courseCost = $instances[0]['cost']; $promocodes = db::runQuery("select * from coupons where couponCode = '{$couponCode}'"); if ($promocodes) { $promocodes = $promocodes[0]; $promoname = $promocodes['campaignName']; if ($promocodes['discountType'] == 1) { //Percent Discount //Currently Not an Option } else { //Dollor Amount Discount $courseCost = $courseCost - $promocodes['discountAmount']; }
} if ($app == "vbzaxman_closeInstance") { if (isset($_SESSION['vbz_auth_isadmin'])) { if ($_SESSION['vbz_auth_isadmin']) { $instanceID = db::esc($_GET['instanceID']); $userName = db::esc($_SESSION['vbz_auth_username']); db::insertQuery("insert into eventsClosed (instanceID,user) values('{$instanceID}','{$userName}')"); dlog("Course instance closed ({$instanceID}) by {$userName}", "courseQuickClose"); echo json_encode(true); } else { echo json_encode(false); } } else { echo json_encode(false); } } if ($app == "vbzaxman_openInstance") { if (isset($_SESSION['vbz_auth_isadmin'])) { if ($_SESSION['vbz_auth_isadmin']) { $instanceID = db::esc($_GET['instanceID']); $userName = db::esc($_SESSION['vbz_auth_username']); db::insertQuery("delete from eventsClosed where instanceID = '{$instanceID}' "); dlog("Course instance opened ({$instanceID}) by {$userName}", "courseQuickClose"); echo json_encode(true); } else { echo json_encode(false); } } else { echo json_encode(false); } }
<?php if(isset($_GET['cid'])){ $couponID = $_GET['cid']; } else { die("No ID Found"); } $couponID = db::esc($couponID); $couponData = db::runQuery("select * from coupons where ID = '$couponID'"); if(!$couponData){ die("ID not Found"); } $couponData = $couponData[0]; ?> <div style="min-height:800px;"> <div class="row"> <div class="col-xs-12"> <h2 class="h2small">Edit Coupon/Campaign: <?php echo $couponData['campaignName']; ?></h2> </div> </div> <div class="row"> <div class="col-xs-12"> <br> <div id="couponDetails"> <table width="100%"> <tr height="40"> <th width="200">Campaign Name</th> <td><input id="campaignName" type="text" value="<?php echo $couponData['campaignName']; ?>"></td>