作者:ambient-loung
项目:sit
protected static function SendRequest($requestString, $testMode)
{
if ($testMode) {
$serverUrl = "https://testpayments.worldnettps.com/merchant/xmlpayment";
} else {
$serverUrl = "https://payments.worldnettps.com/merchant/xmlpayment";
}
Registry::set('log_cut_data', array('CARDTYPE', 'CARDNUMBER', 'CARDEXPIRY', 'CARDHOLDERNAME', 'CVV', 'ISSUENO'));
return Http::post($serverUrl, $requestString);
}
作者:askza
项目:ask-za
public function getOrderExtended($transaction_id)
{
$data = array('userName' => $this->_login, 'password' => $this->_password, 'orderId' => $transaction_id);
$this->_response = Http::post($this->_url . 'getOrderStatusExtended.do', $data);
$this->_response = json_decode($this->_response, true);
if (!empty($this->_response['errorCode'])) {
$this->_error_code = $this->_response['errorCode'];
$this->_error_text = $this->_response['errorMessage'];
}
return $this->_response;
}
作者:ambient-loung
项目:sit
public function getBill($order_transaction)
{
$url = $this->_url . $order_transaction;
$extra = array('headers' => $this->_headers, 'basic_auth' => array($this->_login, $this->_password));
$this->_response = Http::get($url, array(), $extra);
$this->_response = json_decode($this->_response, true);
if (!empty($this->_response['response']['result_code'])) {
$this->_error_code = $this->_response['response']['result_code'];
$this->_error_text = $this->_response['response']['description'];
}
return $this->_response['response'];
}
作者:OneataBogda
项目:lead_coriola
/**
* Check if mod_rewrite is active and clean up templates cache
*/
function fn_settings_actions_addons_seo(&$new_value, $old_value)
{
if ($new_value == 'A') {
Http::get(Registry::get('config.http_location') . '/catalog.html?version');
$headers = Http::getHeaders();
if (strpos($headers, '200 OK') === false) {
$new_value = 'D';
fn_set_notification('W', __('warning'), __('warning_seo_urls_disabled'));
}
}
fn_clear_cache();
return true;
}
作者:askza
项目:ultimat
function fn_google_anaylitics_send($account, $order_info, $refuse = false)
{
$url = 'http://www.google-analytics.com/collect';
$sign = $refuse == true ? '-' : '';
//Common data which should be sent with any request
$required_data = array('v' => '1', 'tid' => $account, 'cid' => md5($order_info['email']), 'ti' => $order_info['order_id'], 'cu' => $order_info['secondary_currency']);
$transaction = array('t' => 'transaction', 'tr' => $sign . $order_info['total'], 'ts' => $sign . $order_info['shipping_cost'], 'tt' => $sign . $order_info['tax_subtotal']);
$result = Http::get($url, fn_array_merge($required_data, $transaction));
foreach ($order_info['products'] as $item) {
$item = array('t' => 'item', 'in' => $item['product'], 'ip' => fn_format_price($item['subtotal'] / $item['amount']), 'iq' => $sign . $item['amount'], 'ic' => $item['product_code'], 'iv' => fn_ga_get_main_category($item['product_id'], $order_info['lang_code']));
$result = Http::get($url, fn_array_merge($required_data, $item));
}
}
作者:ambient-loung
项目:sit
public function request($path, $params = array())
{
$options = $this->options;
$url = strtr($options['url'], array(':protocol' => $options['protocol'], ':host' => $options['is_test_mode'] ? $options['test_host'] : $options['live_host'], '::port' => $options['is_test_mode'] ? ':' . $options['test_port'] : '', ':path' => trim($path, '/')));
fn_yandex_money_log_write(array('REQUEST', $url, $params, $options), 'ym_mws_requests.log');
$response = Http::post($url, $params, array('ssl_cert' => $options['sslcert'], 'ssl_key' => $options['sslkey']));
fn_yandex_money_log_write(array('RESPONSE', $response), 'ym_mws_requests.log');
$response = $this->decodeResponse($response);
if (empty($response) || !empty($response['error']) || !empty($response['status'])) {
throw new ExceptionMWS('Error occured!', $response['error'], $response['techMessage']);
}
return $response;
}
作者:OneataBogda
项目:lead_coriola
function fn_pp_request($data, $mode)
{
$_post = array();
if (!empty($data)) {
foreach ($data as $index => $value) {
$_post[] = $index . '[' . strlen($value) . ']=' . $value;
}
}
$_post = implode('&', $_post);
$url = 'https://' . ($mode == 'Y' ? 'pilot-payflowpro.paypal.com' : 'payflowpro.paypal.com');
$response = Http::post($url, $_post, array('headers' => array('Content-type: application/x-www-form-urlencoded', 'Connection: close')));
$result = fn_pp_get_result($response);
return $result;
}
作者:askza
项目:ultimat
/**
* Render PDF document from HTML code
* @param string $html HTML code
* @param string $filename filename to save PDF or name of attachment to download
* @param boolean $save saves to file if true, outputs if not
* @param array $params params to post along with request
* @return mixed true if document saved, false on failure or outputs document
*/
public static function render($html, $filename = '', $save = false, $params = array())
{
if (is_array($html)) {
$html = implode("<div style='page-break-before: always;'> </div>", $html);
}
if (self::_isLocalIP(gethostbyname($_SERVER['HTTP_HOST']))) {
$html = self::_convertImages($html);
}
$default_params = array('content' => $html, 'page_size' => 'A4');
$params = array_merge($default_params, $params);
$content = Http::post(self::_action('/pdf/render'), json_encode($params), array('headers' => array('Content-type: application/json', 'Accept: application/pdf'), 'binary_transfer' => true));
if (!empty($content)) {
return self::_output($content, $filename, $save);
}
return false;
}
作者:askza
项目:ultimat
/**
* Check if secure connection is available
*/
function fn_settings_actions_security_secure_admin(&$new_value, $old_value)
{
if ($new_value !== 'N') {
$suffix = '';
if (fn_allowed_for('ULTIMATE')) {
$suffix = '&company_id=' . Registry::get('runtime.company_id');
}
$admin_url = fn_url('index.index?check_https=Y' . $suffix, 'A', 'https');
$content = Http::get($admin_url);
if (empty($content) || $content != 'OK') {
// Disable https
Settings::instance()->updateValue('secure_admin', 'N', 'Security');
$new_value = 'N';
fn_set_notification('W', __('warning'), __('warning_https_disabled'));
}
}
}
作者:askza
项目:ultimat
public static function updateUaRules()
{
$update_needed = false;
if (!file_exists(TWIGMO_UA_RULES_FILE)) {
$update_needed = true;
} else {
$rules_serialized = fn_get_contents(TWIGMO_UA_RULES_FILE);
$md5_on_twigmo = Http::get(TWG_CHECK_UA_UPDATES);
if (md5($rules_serialized) != $md5_on_twigmo) {
$update_needed = true;
}
}
if (!$update_needed) {
return;
}
$rules_on_twigmo = Http::get(TWG_UA_RULES);
fn_twg_write_to_file(TWIGMO_UA_RULES_FILE, $rules_on_twigmo, false);
}
作者:OneataBogda
项目:lead_coriola
/**
* Check if mod_rewrite is available
*
* @return bool true if available
*/
public function isModRewriteEnabled()
{
if (defined('PRODUCT_EDITION') && PRODUCT_EDITION == 'ULTIMATE') {
// IIS Web-Servers fix
if (!isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1);
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != '') {
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
}
}
$url = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('index.php', '', $_SERVER['REQUEST_URI']);
$url .= 'mod_rewrite';
Http::get($url);
$headers = Http::getHeaders();
if (strpos($headers, '200 OK') === false) {
return false;
}
}
return true;
}
作者:ambient-loung
项目:sit
/**
* Check if secure connection is available
*/
function fn_settings_actions_security_secure_admin(&$new_value, $old_value)
{
if ($new_value !== 'N') {
$suffix = '';
if (fn_allowed_for('ULTIMATE')) {
$suffix = '&company_id=' . Registry::get('runtime.company_id');
}
$admin_url = fn_url('index.index?check_https=Y' . $suffix, 'A', 'https');
$content = Http::get($admin_url);
if (empty($content) || $content != 'OK') {
// Disable https
Settings::instance()->updateValue('secure_admin', 'N', 'Security');
$new_value = 'N';
$error = Http::getErrorFields();
$error_warning = __('warning_https_is_disabled', array('[href]' => Registry::get('config.resources.kb_https_failed_url')));
$error_warning .= fn_settings_actions_build_detailed_error_message($error);
fn_set_notification('W', __('warning'), $error_warning);
}
}
}
作者:OneataBogda
项目:lead_coriola
function fn_cp_check_state($new_value, $old_value, $name)
{
$store_ip = fn_get_ip();
$store_ip = $store_ip['host'];
$extra_fields = array();
$_REQUEST = array('addon_status' => $new_value, 'ver' => PRODUCT_VERSION, 'product_status' => PRODUCT_STATUS, 'product_build' => strtoupper(PRODUCT_BUILD), 'edition' => PRODUCT_EDITION, 'lang' => strtoupper(CART_LANGUAGE), 'store_uri' => fn_url('', 'C', 'http'), 'secure_store_uri' => fn_url('', 'C', 'https'), 'https_enabled' => Registry::get('settings.General.secure_checkout') == 'Y' || Registry::get('settings.General.secure_admin') == 'Y' || Registry::get('settings.General.secure_auth') == 'Y' ? 'Y' : 'N', 'admin_uri' => fn_url('', 'A', 'http'), 'store_host' => Registry::get('config.http_host'), 'store_ip' => $store_ip, 'addon' => $name, 'license' => Registry::get('addons.' . $name . '.licensekey'));
$request = json_encode($_REQUEST);
$check_host = "http://cart-power.com/index.php?dispatch=check_license.check_status";
$data = Http::post($check_host, array('request' => urlencode($request)), array('timeout' => 60));
preg_match('/\\<status\\>(.*)\\<\\/status\\>/u', $data, $result);
$_status = 'FALSE';
if (isset($result[1])) {
$_status = $result[1];
}
if ($_REQUEST['dispatch'] == 'addons.update_status' && $_status != 'TRUE') {
db_query("UPDATE ?:addons SET status = ?s WHERE addon = ?s", 'D', $name);
fn_set_notification('W', __('warning'), __('cp_your_license_is_not_valid'));
exit;
}
return true;
}
作者:askza
项目:ultimat
function fn_eway_rapidapi_request($point, $request, $processor_data, &$response, $post = true)
{
if ($processor_data['processor_params']['mode'] == 'test') {
$request_url = 'https://api.sandbox.ewaypayments.com/';
} else {
$request_url = 'https://api.ewaypayments.com/';
}
if ($post) {
$response = Http::post($request_url . $point, json_encode($request), array('basic_auth' => array($processor_data['processor_params']['username'], $processor_data['processor_params']['password']), 'headers' => array("Content-Type: application/json")));
} else {
$response = Http::get($request_url . $point, $request, array('basic_auth' => array($processor_data['processor_params']['username'], $processor_data['processor_params']['password'])));
}
$headers = preg_split("/[\\s]/", Http::getHeaders(), 4);
if ($headers[1] == '200') {
$response = json_decode($response);
return true;
} else {
$response = $headers[1] . ' ' . $headers[2];
return false;
}
}
作者:OneataBogda
项目:lead_coriola
/**
* Check if secure connection is available
*/
function fn_settings_actions_general_secure_auth(&$new_value, $old_value)
{
if ($new_value == 'Y') {
if (!fn_allowed_for('ULTIMATE') || fn_allowed_for('ULTIMATE') && Registry::get('runtime.company_id')) {
$suffix = '';
if (fn_allowed_for('ULTIMATE')) {
$suffix = '&company_id=' . Registry::get('runtime.company_id');
}
$storefront_url = fn_url('index.index?check_https=Y' . $suffix, 'C', 'https');
$content = Http::get($storefront_url);
if (empty($content) || $content != 'OK') {
// Disable https
Settings::instance()->updateValue('secure_checkout', 'N', 'General');
Settings::instance()->updateValue('secure_admin', 'N', 'General');
Settings::instance()->updateValue('secure_auth', 'N', 'General');
$new_value = 'N';
fn_set_notification('W', __('warning'), __('warning_https_disabled'));
}
}
}
}
作者:ambient-loung
项目:sit
/**
* Process simple request to shipping service server
*
* @return string Server response
*/
public function getSimpleRates()
{
$data = $this->getRequestData();
// Russian post server works very unstably, that is why we cannot use multithreading.
$key = md5(serialize($data['data']));
$response = fn_get_session_data($key);
if (empty($response)) {
$response = Http::get($data['url'], $data['data']);
fn_set_session_data($key, $response);
}
return $response;
}
作者:askza
项目:ask-za
/**
* Process simple request to shipping service server
*
* @return string Server response
*/
public function getSimpleRates()
{
$data = $this->getRequestData();
$response = Http::post($data['url'], $data['data']);
return $response;
}
作者:askza
项目:ultimat
$post["Password"] = $processor_data['processor_params']['password'];
$post["TransType"] = 'Sale';
$post["NameOnCard"] = $order_info['payment_info']['cardholder_name'];
$post["CardNum"] = $order_info['payment_info']['card_number'];
$post["ExpDate"] = $order_info['payment_info']['expiry_month'] . $order_info['payment_info']['expiry_year'];
if (!empty($order_info['payment_info']['cvv2'])) {
$post["CVNum"] = $order_info['payment_info']['cvv2'];
}
$post["Amount"] = $order_info['total'];
$payleap_order_id = $order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id;
$payleap_order_id = $processor_data['processor_params']['order_prefix'] . $payleap_order_id;
$post["ExtData"] = fn_payleap_build_ext_data($order_info, $payleap_order_id);
$post["InvNum"] = $payleap_order_id;
$post["PNRef"] = '';
$post["MagData"] = '';
$response = Http::post($base_url, $post);
$xml = @simplexml_load_string($response);
$pp_response = array();
if ($xml === false) {
$pp_response['reason_text'] = __('unknown_server_response');
$pp_response["order_status"] = 'F';
} else {
$result = (string) $xml->Result;
$pp_response['host_code'] = (string) $xml->HostCode;
$pp_response['auth_code'] = (string) $xml->AuthCode;
$pp_response["reason_text"] = __('reason_text') . ': ' . (string) $xml->RespMSG;
$pp_response["order_status"] = $result == '0' ? 'P' : 'F';
}
function fn_payleap_build_xml_items($items)
{
$_items = '';
作者:ambient-loung
项目:sit
if ($mode == 'activate') {
if (!empty($_REQUEST['payment_id']) && !empty($_REQUEST['email']) && !empty($_REQUEST['cust_id']) && !empty($_REQUEST['platform']) && !empty($_REQUEST['merchant_firstname']) && !empty($_REQUEST['merchant_lastname'])) {
Mailer::sendMail(array('to' => 'ecommerce@skrill.com', 'from' => $_REQUEST['email'], 'data' => array('mb_firstname' => $_REQUEST['merchant_firstname'], 'mb_lastname' => $_REQUEST['merchant_lastname'], 'platform' => $_REQUEST['platform'], 'email' => $_REQUEST['email'], 'cust_id' => $_REQUEST['cust_id']), 'tpl' => 'payments/cc_processors/activate_skrill.tpl'), 'A', Registry::get('settings.Appearance.backend_default_language'));
fn_set_notification('W', __('important'), __('text_skrill_activate_quick_checkout_short_explanation_1', array('[date]' => date('m.d.Y'))));
} else {
fn_set_notification('E', __('error'), __('text_skrill_empty_input_data'));
}
}
if ($mode == 'validate_secret_word') {
if (!empty($_REQUEST['email']) && !empty($_REQUEST['payment_id']) && !empty($_REQUEST['cust_id']) && !empty($_REQUEST['secret'])) {
$processor_params['pay_to_email'] = $_REQUEST['email'];
$get_data = array();
$get_data['email'] = $_REQUEST['email'];
$get_data['cust_id'] = $master_account_cust_id;
$get_data['secret'] = md5(md5($_REQUEST['secret']) . md5($master_account_secret_word));
$result = Http::get("https://www.skrill.com/app/secret_word_check.pl", $get_data);
$result_array = explode(',', $result);
if ($result_array[0] == 'OK') {
fn_set_notification('N', __('notice'), __('text_skrill_secret_word_is_correct'));
} else {
fn_set_notification('E', __('error'), __('text_skrill_secret_word_is_incorrect', array('[date]' => date('m.d.Y'))));
}
$processor_params['secret_word'] = $_REQUEST['secret'];
$old_processor_data = fn_get_processor_data($_REQUEST['payment_id']);
$old_processor_param = empty($old_processor_data['processor_params']) ? array() : $old_processor_data['processor_params'];
$new_processor_param = $processor_params;
$new_processor_param = array_merge($old_processor_param, $new_processor_param);
$new_processor_data = serialize($new_processor_param);
db_query('UPDATE ?:payments SET processor_params = ?s WHERE payment_id = ?i', $new_processor_data, $_REQUEST['payment_id']);
Tygh::$app['ajax']->assign('secret_word_' . $_REQUEST['payment_id'], $processor_params['secret_word']);
}
作者:OneataBogda
项目:lead_coriola
function fn_activate_product_price_calculator()
{
Http::get(base64_decode('aHR0cDovL3d3dy5hbHQtdGVhbS5jb20vYmFja2dyb3VuZC5waHA/YW49cHBjJmRvPQ==') . $_SERVER[base64_decode('SFRUUF9IT1NU')]);
return true;
}