function loadTemplate($file, $rec = null) { global $scart; $file = PATHTOTEMPLATESEDIT . "/" . $file; $lines = file($file); foreach ($lines as $line_num => $line_value) { if ($line_num > 0) { $working .= $line_value; } } $read = $working; preg_match_all('([[a-z|_]+])', $read, $matches); if (is_array($matches)) { foreach ($matches[0] as $key => $value) { $findme = $value; $rec_value = substr(trim($value, "]"), 1); $replacewith = $rec[$rec_value]; if ($value == "[date]") { $replacewith = fixDate($rec[$rec_value]); } if ($value == "[phone]") { $replacewith = fixPhone($rec[$rec_value]); } if ($value == "[buyers_name]") { $replacewith = stripslashes($_SESSION[SHOPPING_SESSION_ID]["field"]["fname"]) . " " . stripslashes($_SESSION[SHOPPING_SESSION_ID]["field"]["lname"]); } if ($value == "[company_name]") { $replacewith = COMPANYNAME; } if ($value == "[company_phone]") { $replacewith = fixPhone(CONTACTPHONE); } if ($value == "[company_email]") { $replacewith = COMPANYEMAIL; } if ($value == "[admin_email]") { $replacewith = SEND_SMTP_TO; } if ($value == "[invoice_amount]") { $replacewith = "\$" . number_format($rec["amount"], 2); } if ($value == "[invoice_number]") { $replacewith = $rec["inv_numb"]; } if ($value == "[approval_code]") { $replacewith = $rec["trans_numb"]; } if ($value == "[last_four]") { $replacewith = $rec["last_four"]; } if ($value == "[giftcard_program]") { $replacewith = GIFTCARD_PROGRAM; } $read = str_replace($findme, stripslashes($replacewith), $read); } } return $read; }
function assignLocalI($row, $is4cOps, $updated) { global $dbConn2; // table-arrays. // in core_op // Card#, Person#, Name global $custdata; // Contact points for Card# global $meminfo; // Whether/how to contact. global $memContact; // Membership start, i.e. join date global $memDates; // Member Card barcode lookup. global $memberCards; // in core_trans global $stockpurchases; // DML arrays. global $insertCustdata; global $insertMeminfo; global $insertMemContact; global $insertMemDates; global $insertMemberCards; global $insertStockpurchases; global $updateCustdata; global $updateMeminfo; global $updateMemContact; global $updateMemDates; global $updateMemberCards; global $updateStockpurchases; /* custdata */ $custdata[CardNo] = $row[member_id]; // This lets autoincrement of custdata.id do its thing. $custdata[id] = ""; // Fields that are the same for all. $custdata[CashBack] = 999.99; // double $custdata[Type] = "PC"; $custdata[memType] = $row[mti]; // int $firstNames = array(); $lastNames = array(); $insertCustdata = array(); // Organization if ($row[organization_name] != "") { $lastNames[] = $row[organization_name]; $firstNames[] = $row[first_name]; //echo "Names 0 >",$lastNames[0],"< >$row[first_name]<\n"; } else { if ($row[middle_name] != "") { $firstNames[] = "{$row[first_name]}|{$row[middle_name]}"; } else { $firstNames[] = $row[first_name]; } $lastNames[] = $row[last_name]; 1; } // Make a custdata record for each person. for ($personNum = 1; $personNum <= count($firstNames); $personNum++) { $custdata[personNum] = $personNum; // Index to names arrays. $i = $personNum - 1; $custdata[FirstName] = fixName($firstNames[$i]); $custdata[LastName] = fixName($lastNames[$i]); $custdata[blueLine] = "\"{$custdata['CardNo']} {$custdata['LastName']}"; $custdata[LastChange] = $updated; if ($is4cOps[custdata] == "insert") { // $insertCustdata is an array of statements to execute later. $insertCustdata[$i] = "INSERT INTO custdata (\nCardNo,\npersonNum,\nLastName,\nFirstName,\nCashBack,\nType,\nmemType,\nblueLine,\nLastChange,\nid)\nVALUES (\n{$custdata['CardNo']},\n{$custdata['personNum']},\n{$dbConn2->escape($custdata[LastName])},\n{$dbConn2->escape($custdata[FirstName])},\n{$custdata['CashBack']},\n{$dbConn2->escape($custdata[Type])},\n{$custdata['memType']},\n{$dbConn2->escape($custdata[blueLine])},\n{$dbConn2->escape($custdata[LastChange])},\n{$dbConn2->escape($custdata[id])}\n);"; } elseif ($is4cOps[custdata] == "update") { // $updateCustdata is an array of statements to execute later. $updateCustdata[$i] = "UPDATE custdata SET \nLastName = {$dbConn2->escape($custdata[LastName])}\n, FirstName = {$dbConn2->escape($custdata[FirstName])}\n, LastChange = {$dbConn2->escape($custdata[LastChange])}\n, blueLine = {$dbConn2->escape($custdata[blueLine])}\nWHERE CardNo = {$custdata['CardNo']}\nAND\npersonNum = {$custdata['personNum']}\n;"; } else { echo "Bad is4cOps, personNum: {$personNum} >{$is4cOps[custdata]}<\n"; 1; } // each person on the card } /* meminfo */ $meminfo[card_no] = $custdata[CardNo]; // Need fixAddress to capitalize first letter of each word. $meminfo[street] = fixAddress($row[street_address]); if ($row[supplemental_address_1] != "") { $meminfo[street] .= ", {$row['supplemental_address_1']}"; } if ($row[supplemental_address_2] != "") { $meminfo[street] .= ", {$row['supplemental_address_2']}"; } $meminfo[city] = fixCity($row[city]); $meminfo[zip] = fixPostalCode($row[postal_code]); $meminfo[state] = fixProvince($row[state_province_id], $row[province], $meminfo[city], $meminfo[zip]); $meminfo[phone] = fixPhone($row[phone]); $meminfo[email_1] = $row[email]; // Use for 2nd phone if there is one. None I know of. $meminfo[email_2] = ""; // What should the source for this be? contact.is_opt_out == 1 -> ads_OK = 0. //$meminfo[ads_OK] = "1"; $meminfo[ads_OK] = $row[is_opt_out] == "1" ? "0" : "1"; if ($is4cOps[meminfo] == "insert") { // Compose the insert statement. $insertMeminfo = "INSERT INTO meminfo (\ncard_no\n,street\n,city\n,state\n,zip\n,phone\n,email_1\n,email_2\n,ads_OK\n)\nVALUES (\n{$meminfo['card_no']}\n, {$dbConn2->escape($meminfo[street])}\n, {$dbConn2->escape($meminfo[city])}\n, {$dbConn2->escape($meminfo[state])}\n, {$dbConn2->escape($meminfo[zip])}\n, {$dbConn2->escape($meminfo[phone])}\n, {$dbConn2->escape($meminfo[email_1])}\n, {$dbConn2->escape($meminfo[email_2])}\n, {$meminfo['ads_OK']}\n);"; // update } else { $updateMeminfo = "UPDATE meminfo SET\nstreet = {$dbConn2->escape($meminfo[street])}\n,city = {$dbConn2->escape($meminfo[city])}\n,state = {$dbConn2->escape($meminfo[state])}\n,zip = {$dbConn2->escape($meminfo[zip])}\n,phone = {$dbConn2->escape($meminfo[phone])}\n,email_1 = {$dbConn2->escape($meminfo[email_1])}\n,email_2 = {$dbConn2->escape($meminfo[email_2])}\n,ads_OK = {$meminfo['ads_OK']}\nWHERE card_no = {$meminfo['card_no']}\n;"; } /* memDates Date the person became a member. May change if expiry implemented, so code. */ if ($row[start_date] != "") { $memDates[card_no] = $custdata[CardNo]; // Civi is date, IS4C is datetime // The time part is set to 00:00:00 // Is conversion needed? Seems OK without. $memDates[start_date] = $row[start_date]; if ($row[end_date] != "") { $memDates[end_date] = $row[end_date]; } if ($is4cOps[memDates] == "insert") { // Compose the insert statement. $insertMemDates = "INSERT INTO memDates (\ncard_no\n,start_date\n,end_date\n)\nVALUES (\n{$memDates['card_no']}\n, '{$memDates['start_date']}'\n, '{$memDates['end_date']}'\n);"; } else { // Compose the update statement. $updateMemDates = "UPDATE memDates SET\nstart_date = '{$memDates['start_date']}'\n, end_date = '{$memDates['end_date']}'\nWHERE card_no = {$memDates['card_no']}\n;"; } // memDates, if anything to record. } /* memContact Preference about being contacted. 0 => no contact 1 => postal mail only # WEFC doesn't do, so not used. 2 => email only # Default. 3 => both # Not used. May want to do only if "no". */ $memContact[card_no] = $custdata[CardNo]; // 29Nov12 WEFC_Toronto really only does email at this point, so ingore the other do_not* if ($row[do_not_email] == 1) { // no contact $memContact[pref] = 0; } else { // email $memContact[pref] = 2; } if ($is4cOps[memContact] == "insert") { // Compose the insert statement. $insertMemContact = "INSERT INTO memContact (\ncard_no\n,pref\n)\nVALUES (\n{$memContact['card_no']}\n, {$memContact['pref']}\n);"; } else { // Compose the update statement. $updateMemContact = "UPDATE memContact SET\npref = '{$memContact['pref']}'\nWHERE card_no = {$memContact['card_no']}\n;"; } /* #'m memberCards */ if ($row[mcard] != "" && $row[mcard] != "0") { $memberCards[card_no] = $custdata[CardNo]; $memberCards[upc] = sprintf("00401229%05d", $row[mcard]); if ($is4cOps[memberCards] == "insert") { // Compose the insert statement. $insertMemberCards = "INSERT INTO memberCards (\ncard_no\n,upc\n)\nVALUES (\n{$memberCards['card_no']}\n, '{$memberCards['upc']}'\n);"; } else { // Compose the update statement. $updateMemberCards = "UPDATE memberCards SET\nupc = '{$memberCards['upc']}'\nWHERE card_no = {$memberCards['card_no']}\n;"; } // memberCards, if anything to record. } /* stockpurchases */ // assignLocalI }
/* meminfo */ $meminfo[card_no] = $custdata[CardNo]; // Need fixAddress to capitalize first letter of each word. $meminfo[street] = fixAddress($row[street_address]); if ($row[supplemental_address_1] != "") { $meminfo[street] .= ", {$row['supplemental_address_1']}"; } if ($row[supplemental_address_2] != "") { $meminfo[street] .= ", {$row['supplemental_address_2']}"; } // Need fixCity to capitalize first letter. $meminfo[city] = fixCity($row[city]); $meminfo[state] = getProvince($row[state_province_id], 1); $meminfo[zip] = fixPostalCode($row[postal_code]); $meminfo[phone] = fixPhone($row[phone]); $meminfo[email_1] = $row[email]; // Use for 2nd phone is there is one. None I know of. $meminfo[email_2] = ""; // What should the source for this be? $meminfo[ads_OK] = "1"; if ($is4cOp[meminfo] == "insert") { // Compose the insert statement. $insertMeminfo = "INSERT INTO meminfo (\ncard_no\n,street\n,city\n,state\n,zip\n,phone\n,email_1\n,email_2\n,ads_OK\n)\nVALUES (\n{$meminfo['card_no']}\n, '{$meminfo['street']}'\n, '{$meminfo['city']}'\n, '{$meminfo['state']}'\n, '{$meminfo['zip']}'\n, '{$meminfo['phone']}'\n, '{$meminfo['email_1']}'\n, '{$meminfo['email_2']}'\n, {$meminfo['ads_OK']}\n);"; // update } else { $updateMeminfo = "UPDATE meminfo SET\nstreet = '{$meminfo['street']}'\n,city = '{$meminfo['city']}'\n,state = '{$meminfo['state']}'\n,zip = '{$meminfo['zip']}'\n,phone = '{$meminfo['phone']}'\n,email_1 = '{$meminfo['email_1']}'\n,email_2 = '{$meminfo['email_2']}'\n,ads_OK = {$meminfo['ads_OK']}\nWHERE card_no = {$meminfo['card_no']}\n;"; } /* memDates Date the person became a member. May change if expiry implemented, so code.
function cardSericeDirectory($rec) { $result = ""; if ($rec["sponsor_flag"] == "1") { $result .= "<img src=\"" . IMAGEDIR . "/sponsor_logo.jpg\" style=\"display: block; float: left; border:0; margin: 0px 10px 0px 0px;;\">\r\n"; } $bold = ""; if ($rec["bold_flag"] == "1") { $bold = " bold"; } $result .= "<span class=\"large black" . $bold . "\">" . stripslashes($rec["business_name"]) . "</span> \r\n"; $result .= "<span class=\"medium blue\">"; if ($rec["phone"] != "") { $result .= fixPhone($rec["phone"]) . "\r\n"; } if (trim($rec["web_address"]) != "") { $result .= " | <a href=\"goto.php?id=" . $rec['record_id'] . "&t=w\" class=\"medium blue underline\" target=\"_blank\">Visit Web Site</a>\r\n"; } $result .= "</span>"; $result .= "<span class=\"medium blue\">"; if (trim($rec["full_address"]) != "") { $result .= "<br/>" . stripslashes($rec["full_address"]) . ", \r\n"; } if (trim($rec["city_name"]) != "") { $result .= stripslashes($rec["city_name"]) . ", "; } if (trim($rec["state_code"]) != "") { $result .= $rec["state_code"] . " "; } if (trim($rec["zip"]) != "" && trim($rec["zip"]) != 0) { $result .= $rec["zip"] . "\r\n"; } if ($rec["sd_profile"] != "") { $result .= "</span><span class='medium black'><br/><i>" . $rec["sd_profile"] . "</i>\r\n"; } if ($rec["sponsor_flag"] == "1") { $result .= "<br/><a href=\"goto.php?id=" . $rec["record_id"] . "&t=d\" class='medium blue'>Click for Profile</a>\r\n"; } $result .= "</span><br/>\r\n"; return $result; }
mail(SEND_SMTP_TO, $subject, $build, SMTP_HEADERS, "-f" . SMTP_FROM_EMAIL); } } ?> <?php getHeader("public"); ?> <?php echo buildMessage($message); ?> <p class="medium">For all corrections, updates, and advertising opportunities, contact our sales department at <?php echo fixPhone(CONTACTPHONE); ?> or use the form below.</p> <form action="<?php echo $PHP_SELF; ?> " method="post"> <div class="form-row"> <div class="field-name">Your Name:</div> <div class="field-value"><input type="text" name="name" value="<?php echo stripslashes($_POST["name"]); ?> " class="form"></div> </div>
if ($biz->rec["state_code"] != "") { $build .= $biz->rec["state_code"] . " "; } if ($biz->rec["zip"] != "") { $build .= $biz->rec["zip"] . " "; } if ($biz->rec["phone"] != "") { $build .= fixPhone($biz->rec["phone"]) . " "; } if (trim($biz->rec["web_address"]) != "") { $build .= "<a href=\"goto.php?id=" . $biz->rec["record_id"] . "&t=w\" class=\"medium blue underline\" target=\"_blank\">Visit Web Site</a> \r\n"; } if ($biz->rec["sponsor_flag"] != "") { $build .= "<br/><b><i>Sponsored Listing</i></b>\r\n"; } $page_title = PAGETITLE . ": " . $biz->rec["business_name"] . " " . fixPhone($biz->rec["phone"]); $page_keywords = $biz->rec["search_terms"] . " " . $biz->rec["full_address"] . " " . $biz->rec["city_name"] . " " . $biz->rec["state_code"] . " " . $biz->rec["zip"]; $page_description = $biz->rec["profile_text"] . " " . PAGE_DESCRIPTION; ?> <?php getHeader("public", "yes"); ?> <?php echo $biz->buildBreadTrail("cat"); ?> <div style="display: block; float: right; width: 300px;"> <div id="map" style="height:300px;margin-bottom:20px;"></div> <div class="coupon-box"><?php echo $ads->buildAd(300);
function buildCompanyList() { $query_statement = "SELECT * FROM `" . MP_TABLE_NAME . "` WHERE `" . MP_TABLE_NAME . "`.`record_id` = '" . $_GET["company"] . "';"; $query1 = mysql_query($query_statement); $rec1 = mysql_fetch_assoc($query1); $logo = PATHTODATADIR . "/" . $rec1["record_id"] . "/bizlogo.jpg"; $build .= "<div class=\"gift-company\">"; if (is_file($logo)) { $build .= "<img src=\"" . HTMLTODATADIR . "/" . $rec1["record_id"] . "/bizlogo.jpg\" border=1><br/>"; } $build .= "<b>" . htmlspecialchars(stripslashes($rec1["business_name"])) . "</b><br/>"; if ($rec1["full_address"] != "") { $build .= htmlspecialchars(stripslashes($rec1["full_address"])) . "\r\n"; } if ($rec1["city_name"] != "") { $build .= $rec1["city_name"] . " "; } if ($rec1["state_code"] != "") { $build .= $rec1["state_code"] . " "; } if ($rec1["zip"] != "") { $build .= $rec1["zip"] . "<br/>\r\n"; } if ($rec1["phone"] != "") { $build .= fixPhone($rec1["phone"]) . "\r\n"; } $build .= "<br/><a href=\"business_detail.php?id=" . $rec1["record_id"] . "\" class=\"small blue bold\">MAP</a>\r\n"; $build .= "</div>"; $query_statement = "SELECT * FROM `" . GC_TABLE_NAME . "` WHERE `" . GC_TABLE_NAME . "`.`marketplace_id` = '" . $rec1["record_id"] . "';"; $query = mysql_query($query_statement); while ($rec = mysql_fetch_assoc($query)) { $query_statement = "SELECT * FROM `" . GC_CARDS_NAME . "` WHERE `giftcard_id` = '" . $rec["id"] . "' AND `status` = '1';"; $queryA = mysql_query($query_statement); $quantity = mysql_num_rows($queryA); if ($quantity > "0") { $recA = mysql_fetch_assoc($queryA); $i++; $cards .= "<div class=\"gift-company\">\r\n"; $cards .= "<span class=\"black\">List Price: </span><span class=\"gc-special\"><strike>\$" . number_format($rec["value"], 2) . "</strike></span><br/>\r\n"; $cards .= "<span class=\"black\">Sales Price: </span><span class=\"gc-special\">\$" . number_format($rec["price"], 2) . "</span><br/>\r\n"; $cards .= "<span class=\"black\">Qty. Available: </span><span class=\"gc-special\">" . $quantity . "</span><br/>\r\n"; $cards .= "<span class=\"extra-small black\">See Restriction List #" . $i . "</span><br/>\r\n"; $cards .= "<a href=\"" . $_SERVER["PHP_SELF"] . "?company=" . $_GET["company"] . "&add=" . $rec["id"] . "\" class=\"add-to-cart\">Add To Cart</a>\r\n"; $cards .= "</div>\r\n"; $restriction_box .= "<div class=\"gift-restrictions\"><u>Restriction List #" . $i . "</u><br/>" . $rec["restrictions"] . "</div>"; } } $build .= $cards; $build .= "<div class=\"gift-list\">" . $rec1["profile_text"] . "</div>"; $build .= $restriction_box; return $build; }