Esempio n. 1
0
 function after_processing_html($orderID)
 {
     $res = '';
     $order = ordGetOrder($orderID);
     $order_amount = roundf(PaymentModule::_convertCurrency($order['order_amount'], 0, $this->_getSettingValue('CONF_CHRONOPAY_CURCODE')));
     $currency = currGetCurrencyByID($this->_getSettingValue('CONF_CHRONOPAY_CURCODE'));
     $zone_iso2 = $order['billing_state'];
     $countries = cnGetCountries(array('offset' => 0, 'CountRowOnPage' => 1000000), $count_row);
     foreach ($countries as $country) {
         if ($country['country_name'] == $order['billing_country']) {
             $country_iso3 = $country['country_iso_3'];
             $zones = znGetZones($country['countryID']);
             foreach ($zones as $zone) {
                 if ($zone['zone_name'] == $zone_iso2) {
                     $zone_iso2 = $zone['zone_code'];
                     break;
                 }
             }
             break;
         }
     }
     $post_1 = array('product_id' => $this->_getSettingValue('CONF_CHRONOPAY_PRODUCT_ID'), 'product_name' => CONF_SHOP_NAME, 'product_price' => $order_amount, 'product_price_currency' => $currency['currency_iso_3'], 'f_name' => $order['billing_firstname'], 's_name' => $order['billing_lastname'], 'street' => $order['billing_address'], 'city' => $order['billing_city'], 'state' => $zone_iso2, 'country' => $country_iso3, 'email' => $order['customer_email'], 'cb_url' => getTransactionResultURL('success'), 'cb_type' => 'P', 'decline_url' => getTransactionResultURL('failure'));
     $hidden_fields_html = '';
     reset($post_1);
     while (list($k, $v) = each($post_1)) {
         $hidden_fields_html .= '<input type="hidden" name="' . $k . '" value="' . $v . '" />' . "\n";
     }
     $res = '
                             <form method="post" action="' . xHtmlSpecialChars($this->processing_url) . '" style="text-align:center;">
                                     ' . $hidden_fields_html . '
                                     <input type="submit" value="' . CHRONOPAY_TXT_SUBMIT . '" />
                             </form>
                             ';
     return $res;
 }
Esempio n. 2
0
 function after_processing_html($orderID)
 {
     $res = '';
     $order = ordGetOrder($orderID);
     $order_amount = roundf(PaymentModule::_convertCurrency($order['order_amount'], 0, $this->_getSettingValue('CONF_YANDEXCPP_TRANSCURRENCY')));
     $post_1 = array('TargetCurrency' => $this->_getSettingValue('CONF_YANDEXCPP_TARGETCURRENCY'), 'currencyID' => $this->_getSettingValue('CONF_YANDEXCPP_TARGETCURRENCY'), 'wbp_InactivityPeriod' => '2', 'wbp_ShopAddress' => 'wn1.paycash.ru:8828', 'wbp_ShopEncryptionKey' => 'hAAAEicBAHV6wr3pySqE3thhKHbjvyf4XCMxKc2nSj2u8K46i0dMIP8Wd2KJHkZuhGMWZGmYAp6wsb3XqZW5HKVpamQt+t9rwGNsSaVfeZb9DM5aodCpIMHhLA8gGPDIiG4+Q15X/7Zm3MJNGavZ8+eWAnlvS1M7c6eeLTNJ0CKIYd1yHXfU', 'wbp_ShopKeyID' => '4060341894', 'wbp_Version' => '1.0', 'wbp_CorrespondentID' => '8994748E663DE6B3C68D2D9931B079C74789D4B4', 'BankID' => $this->_getSettingValue('CONF_YANDEXCPP_BANKID'), 'TargetBankID' => $this->_getSettingValue('CONF_YANDEXCPP_TARGETBANKID'), 'PaymentTypeCD' => 'PC', 'ShopID' => $this->_getSettingValue('CONF_YANDEXCPP_SHOPID'), 'CustomerNumber' => $orderID, 'Sum' => $order_amount, 'CustName' => $order['shipping_firstname'] . ' ' . $order['shipping_lastname'], 'CustAddr' => '', 'CustEMail' => $order['customer_email'], 'OrderDetails' => '');
     $order_content = ordGetOrderContent($orderID);
     foreach ($order_content as $item) {
         $post_1['OrderDetails'] .= $item['name'] . "\r\n";
     }
     $implAddress = array('shipping_country', 'shipping_state', 'shipping_city', 'shipping_address');
     foreach ($implAddress as $k) {
         if ($order[$k]) {
             $post_1['CustAddr'] .= ', ' . $order[$k];
         }
     }
     $post_1['CustAddr'] = substr($post_1['CustAddr'], 1);
     $hidden_fields_html = '';
     reset($post_1);
     while (list($k, $v) = each($post_1)) {
         $hidden_fields_html .= '<input type="hidden" name="' . $k . '" value="' . $v . '" />' . "\n";
     }
     $processing_url = $this->_getSettingValue('CONF_YANDEXCPP_MODE') == 'test' ? 'http://demomoney.yandex.ru/select-wallet.xml' : 'http://money.yandex.ru/select-wallet.xml';
     $res = '
                             <form method="post" action="' . xHtmlSpecialChars($processing_url) . '" style="text-align:center;" id="payform">
                                     ' . $hidden_fields_html . '
                             </form><table cellspacing="0" cellpadding="0" class="fsttab"><tr><td><table cellspacing="0" cellpadding="0" class="sectb"><tr><td><a href="#" onclick="document.getElementById(\'payform\').submit(); return false">' . STRING_PAY_NOW . '</a></td></tr></table></td></tr></table>';
     return $res;
 }
 public static function _getScrollState()
 {
     $fields = array("Авто" => "auto", "Да" => "yes", "Нет" => "no");
     $res = array();
     foreach ($fields as $field => $val) {
         $res[] = xHtmlSpecialChars($field . ':' . $val);
     }
     return implode(',', $res);
 }
Esempio n. 4
0
 function getNodeXML($_Level = -1, $Tabbed = false, $disableCDATA = false)
 {
     $_Level++;
     $_attrs = array();
     foreach ($this->Attributes as $_Key => $_Val) {
         $_attrs[] = $_Key . '="' . xHtmlSpecialChars($_Val) . '"';
     }
     $_ChildrenXMLs = array();
     $_ChildNodesNum = count($this->ChildNodes);
     foreach ($this->ChildNodes as $i => $ChildNode) {
         if (!is_a($this->ChildNodes[$i], 'xmlnodex')) {
             continue;
         }
         $_ChildrenXMLs[] = $this->ChildNodes[$i]->getNodeXML($_Level, $Tabbed, $disableCDATA);
     }
     return ($Tabbed ? str_repeat("\n", intval($_Level > 0)) . str_repeat("\t", $_Level) : '') . "<{$this->Name}" . (count($_attrs) ? " " . implode(" ", $_attrs) : '') . ">" . ($this->Data ? $disableCDATA ? $this->Data : "<![CDATA[" . $this->Data . "]]>" : "") . (count($_ChildrenXMLs) ? implode("", $_ChildrenXMLs) . ($Tabbed ? "\n" . str_repeat("\t", $_Level) : '') : '') . "</{$this->Name}>";
 }
Esempio n. 5
0
function xHtmlSpecialChars($_Data, $_Params = array(), $_Key = array())
{
    if (!is_array($_Data)) {
        return htmlspecialchars($_Data, ENT_QUOTES);
    }
    if (!is_array($_Key)) {
        $_Key = array($_Key);
    }
    foreach ($_Data as $__Key => $__Data) {
        if (count($_Key) && !is_array($__Data)) {
            if (in_array($__Key, $_Key)) {
                $_Data[$__Key] = xHtmlSpecialChars($__Data, $_Params, $_Key);
            }
        } else {
            $_Data[$__Key] = xHtmlSpecialChars($__Data, $_Params, $_Key);
        }
    }
    return $_Data;
}
 /**
  * Get item node
  *
  * @param int $itemID - item id
  * @return xmlNodeX - item node
  */
 function &_getItem($itemID)
 {
     @(list($xnItem) = $this->Items->xPath('/items/item[@id="' . xHtmlSpecialChars($itemID) . '"]'));
     return $xnItem;
 }
Esempio n. 7
0
function quickOrderGetBillingAddressStr()
{
    if (!isset($_SESSION["billing_countryID"]) || !isset($_SESSION["billing_first_name"])) {
        return "";
    }
    // countryID, zoneID, state
    $country = cnGetCountryById($_SESSION["billing_countryID"]);
    $country = $country["country_name"];
    if (trim($_SESSION["billing_state"]) == "") {
        $zone = znGetSingleZoneById($_SESSION["billing_zoneID"]);
        $zone = $zone["zone_name"];
    } else {
        $zone = trim($_SESSION["billing_state"]);
    }
    $strAddress = xHtmlSpecialChars($_SESSION["billing_first_name"]);
    if (strlen($_SESSION["billing_address"]) > 0) {
        $strAddress .= "<br>" . xHtmlSpecialChars($_SESSION["billing_address"]);
    }
    if (strlen($_SESSION["billing_city"]) > 0) {
        $strAddress .= "<br>" . xHtmlSpecialChars($_SESSION["billing_city"]);
    }
    if (strlen($zone) > 0) {
        $strAddress .= "<br>" . xHtmlSpecialChars($zone);
    }
    if (strlen($country) > 0) {
        $strAddress .= "<br>" . $country;
    }
    return $strAddress;
}
 function main()
 {
     $Register =& Register::getInstance();
     $smarty =& $Register->get(VAR_SMARTY);
     /*@var $smarty Smarty*/
     // shopping cart
     //iframe cookie security workaround
     if (isset($_GET['check_cookie'])) {
         if ($_GET['check_cookie'] != session_id()) {
             $productID = (int) $_GET['productID'];
             $product_data = GetProduct($productID);
             $product_slug = $product_data && isset($product_data['slug']) ? $product_data['slug'] : '';
             $url = "?ukey=product_widget&productID={$productID}&product_slug={$product_slug}&check_cookie&";
             $widgets = false;
             $Register->set('widgets', $widgets);
             $_SERVER['REQUEST_URI'] = preg_replace('/(^|&)widgets=1/', '', $_SERVER['REQUEST_URI']);
             RedirectSQ($url);
         } else {
             renderURL('check_cookie&productID', '', true);
         }
     }
     if (isset($_GET["make_more_exact_cart_content"])) {
         $smarty->assign("make_more_exact_cart_content", 1);
     }
     if (isset($_GET["remove"]) && $_GET["remove"] > 0) {
         //remove from cart product with productID == $remove
         $cartEntry = new ShoppingCart();
         $cartEntry->loadCurrentCart();
         $cartEntry->setItemQuantity($_GET['remove'], 0);
         $cartEntry->saveCurrentCart();
         if ($cartEntry->isEmpty()) {
             //remove coupon from empty cart
             ClassManager::includeClass('discount_coupon');
             discount_coupon::remove();
         }
         RedirectSQ('remove=');
     }
     $cart_view = $this->_detect_cart_view();
     if (isset($_POST["update"]) || isset($_POST["recalculate"])) {
         //update shopping cart content
         if ($_POST['discount_coupon_code'] != '') {
             $this->_check_and_apply_coupon($_POST['discount_coupon_code']);
         }
         $cartEntry = new ShoppingCart();
         $cartEntry->loadCurrentCart();
         $upd_data = scanArrayKeysForID($_POST, 'count');
         foreach ($upd_data as $_itemID => $_data) {
             $cartEntry->setItemQuantity($_itemID, intval($_data['count']));
         }
         $cartEntry->saveCurrentCart();
         if ($cartEntry->isEmpty()) {
             //remove coupon from empty cart
             ClassManager::includeClass('discount_coupon');
             discount_coupon::remove();
         }
         if (cartCheckMinOrderAmount() && cartCheckMinTotalOrderAmount()) {
             switch ($cart_view) {
                 case CARTVIEW_FRAME:
                     if (isset($_POST['checkout']) && $Register->get('store_mode') == 'facebook') {
                         $store_mode = false;
                         $Register->set('store_mode', $store_mode);
                         $jsgoto = '?ukey=checkout&view=noframe';
                         RedirectSQ($jsgoto ? 'jsgoto=' . base64_encode(set_query($jsgoto)) : '');
                     }
                     RedirectSQ(isset($_POST['checkout']) ? '?ukey=checkout' : (isset($_POST['ppe_checkout_x']) ? 'ppexpresscheckout2=1' : (isset($_POST['google_checkout_x']) ? 'googlecheckout2=1' : '')));
                     break;
                 case CARTVIEW_WIDGET:
                 case CARTVIEW_FADE:
                     $jsgoto = isset($_POST['checkout']) ? '?ukey=checkout&view=noframe' : (isset($_POST['ppe_checkout_x']) ? 'ppexpresscheckout2=1&view=frame' : (isset($_POST['google_checkout_x']) ? 'googlecheckout2=1&view=frame' : ''));
                     RedirectSQ($jsgoto ? 'jsgoto=' . base64_encode(set_query($jsgoto)) : '');
                     break;
             }
         } elseif (isset($_POST['checkout']) || isset($_POST['google_checkout_x']) || isset($_POST['ppe_checkout_x'])) {
             $smarty->assign('cart_error_show', '1');
         }
     }
     if (isset($_GET["clear_cart"])) {
         //completely clear shopping cart
         $cartEntry = new ShoppingCart();
         $cartEntry->loadCurrentCart();
         $cartEntry->cleanCurrentCart('erase');
         //remove coupon from empty cart
         ClassManager::includeClass('discount_coupon');
         discount_coupon::remove();
         RedirectSQ('clear_cart=');
     }
     if (isset($_POST['checkout'])) {
         if (SystemSettings::is_hosted() && file_exists(WBS_DIR . '/kernel/classes/class.metric.php')) {
             include_once WBS_DIR . '/kernel/classes/class.metric.php';
             $DB_KEY = SystemSettings::get('DB_KEY');
             $U_ID = sc_getSessionData('U_ID');
             $metric = metric::getInstance();
             $metric->addAction($DB_KEY, $U_ID, 'SC', 'CHECKOUT', isset($_GET['widgets']) ? 'WIDGET' : 'STOREFRONT', '');
         }
     }
     $resCart = cartGetCartContent();
     $resDiscount = dscGetCartDiscounts($resCart["total_price"], isset($_SESSION["log"]) ? $_SESSION["log"] : "");
     $currencyEntry = Currency::getSelectedCurrencyInstance();
     $cart_discount_show = $resDiscount['other_discounts']['cu'] > 0 ? $currencyEntry->getView($resDiscount['other_discounts']['cu']) : '';
     $coupon_discount_show = $resDiscount['coupon_discount']['cu'] > 0 ? $currencyEntry->getView($resDiscount['coupon_discount']['cu']) : '';
     $smarty->assign("cart_content", xHtmlSpecialChars($resCart["cart_content"], null, 'name'));
     $smarty->assign("cart_amount", $resCart["total_price"] - $resDiscount["discount_standart_unit"]);
     $smarty->assign('cart_min', show_price(CONF_MINIMAL_ORDER_AMOUNT));
     $smarty->assign("cart_total", $currencyEntry->getView($resDiscount['total']['cu']));
     $smarty->assign('cart_discount', $cart_discount_show);
     $smarty->assign('discount_percent', round($resDiscount['discount_percent'], 1));
     $smarty->assign('coupon_discount', $coupon_discount_show);
     $smarty->assign("current_coupon", discount_coupon::getCurrentCoupon());
     if (isset($_SESSION['log'])) {
         $smarty->assign('shippingAddressID', regGetDefaultAddressIDByLogin($_SESSION['log']));
     }
     if (isset($_GET['min_order'])) {
         $smarty->assign('minOrder', 'error');
     }
     if (isset($_GET['jsgoto'])) {
         $smarty->assign('jsgoto', base64_decode($_GET['jsgoto']));
     }
     $smarty->assign('main_content_template', 'shopping_cart.html');
     $smarty->assign('main_body_style', 'style="' . (CONF_SHOPPING_CART_VIEW == 2 || $cart_view == CARTVIEW_FRAME ? '' : 'background:#FFFFFF;') . 'min-width:auto;width:auto;_width:auto;"');
 }