/** * Function pay_get **/ function pay_get() { global $gData, $gOptions; $Kaznachey = new Kaznachey(); $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents('php://input'); $hrpd = json_decode($HTTP_RAW_POST_DATA); $order_id = intval($hrpd->MerchantInternalPaymentId); if ($order_id == 0) { if (isset($_GET['show_result'])) { $html = file_get_contents('pay_mod/kaznachey/pay_ok.htm'); print $html; exit; } else { $kaznachey->home_url(); exit; } } if (isset($hrpd->MerchantInternalPaymentId)) { if ($hrpd->ErrorCode == 0) { $gData = data_connect(); $command = "UPDATE " . DB_NICK . "_archive_order SET get_payment=2 WHERE order_id='" . addslashes($hrpd->MerchantInternalPaymentId) . "'"; mysql_query($command); // Set order ok e-mail for admin $tplm = new FastTemplate('./pay_mod/Kaznachey'); $tplm->DefineTemplate(array('mail_message' => 'pay_ok_mail.htm')); $tplm->Assign(array('ORDERCODE' => $hrpd->MerchantInternalPaymentId, 'SUMA' => number_format($arr['amt'] * 1, 2, '.', ''), 'CURR' => $arr['ccy'], 'SHOPNAMES' => $gOptions['attr_shop_name'], 'SHOPURL' => $gOptions['attr_shop_url'], 'DATE' => date('Y-m-d H:i:s', $arr['date']))); $tplm->Parse('MAIL', 'mail_message'); $mailer = new Emailer(MAIL_SERVER); $mailer->SetCharset($gOptions['attr_admin_charset']); $mailer->SetTypeText(); $all_message = iconv(SHOP_CHARSET, $gOptions['attr_admin_charset'], $tplm->Fetch('MAIL')); $subject = substr($all_message, strpos($all_message, 'Message_subject:') + 16, strpos($all_message, 'Message_content:') - 16); $message = substr($all_message, strpos($all_message, 'Message_content:') + 16); $mailer->AddMessage($message); $mailer->BuildMessage(); $mailer->Send($gOptions['attr_admin_email'], $gOptions['attr_shop_email'], ltrim($subject, " ")); } } }
function sendEmailToAdmin($order) { global $gOptions; // Send e-mail for admin $tplm = new FastTemplate('./pay_mod/Fondy'); $tplm->DefineTemplate(array('mail_message' => 'pay_try_mail.htm')); $tplm->Assign(array('ORDER_CODE' => htmlspecialchars($order['code']), 'SUMA' => number_format($order['payment_cost'], 2, ',', "'"), 'CURR' => htmlspecialchars($order['payment_curr']), 'SHOPNAMES' => htmlspecialchars($gOptions['attr_shop_name']), 'SHOPURL' => htmlspecialchars($gOptions['attr_shop_url']))); $tplm->Parse('MAIL', 'mail_message'); $mailer = new Emailer(MAIL_SERVER); $mailer->SetCharset($gOptions['attr_admin_charset']); $mailer->SetTypeText(); $all_message = iconv(SHOP_CHARSET, $gOptions['attr_admin_charset'], $tplm->Fetch('MAIL')); $subject = substr($all_message, strpos($all_message, 'Message_subject:') + 16, strpos($all_message, 'Message_content:') - 16); $message = substr($all_message, strpos($all_message, 'Message_content:') + 16); $mailer->AddMessage($message); $mailer->BuildMessage(); $mailer->Send($gOptions['attr_admin_email'], $gOptions['attr_shop_email'], ltrim($subject, " ")); $content = @implode("", @file('./pay_mod/Fondy/pay_success.htm')); return $content; }