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']; }
/** * 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; }
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)); } }
/** * 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')); } } }
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); }
/** * 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); } } }
/** * 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; }
/** * 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')); } } } }
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; } }
function fn_send_sms_notification($body) { $access_data = fn_get_sms_auth_data(); $to = Registry::get('addons.sms_notifications.phone_number'); if (fn_is_empty($access_data) || empty($to)) { return false; } $concat = Registry::get('addons.sms_notifications.clickatel_concat'); //get the last symbol if (!empty($concat)) { $concat = intval($concat[strlen($concat) - 1]); } if (!in_array($concat, array('1', '2', '3'))) { $concat = 1; } $data = array('user' => $access_data['login'], 'password' => $access_data['password'], 'api_id' => $access_data['api_id'], 'to' => $to, 'concat' => $concat); $unicode = Registry::get('addons.sms_notifications.clickatel_unicode') == 'Y' ? 1 : 0; $sms_length = $unicode ? SMS_NOTIFICATIONS_SMS_LENGTH_UNICODE : SMS_NOTIFICATIONS_SMS_LENGTH; if ($concat > 1) { $sms_length *= $concat; $sms_length -= $concat * SMS_NOTIFICATIONS_SMS_LENGTH_CONCAT; // If a message is concatenated, it reduces the number of characters contained in each message by 7 } $body = html_entity_decode($body, ENT_QUOTES, 'UTF-8'); $body = fn_substr($body, 0, $sms_length); if ($unicode) { $data['unicode'] = '1'; $body = fn_convert_encoding('UTF-8', 'UCS-2', $body); $body = bin2hex($body); } $data['text'] = $body; Http::get('http://api.clickatell.com/http/sendmsg', $data); }
function fn_anti_fraud_place_order(&$order_id, &$action, &$order_status) { $checked = db_get_field('SELECT COUNT(*) FROM ?:order_data WHERE order_id = ?i AND type = ?s', $order_id, 'F'); if ($action == 'save' || defined('ORDER_MANAGEMENT') || $checked) { return true; } $return = array(); $af_settings = Registry::get('addons.anti_fraud'); if (empty($af_settings['anti_fraud_key'])) { return false; } $order_info = fn_get_order_info($order_id); if (empty($order_info['ip_address'])) { $return['B'][] = 'af_ip_not_found'; } $risk_factor = 1; $request = array('license_key' => $af_settings['anti_fraud_key'], 'i' => $order_info['ip_address'], 'city' => $order_info['b_city'], 'region' => $order_info['b_state'], 'postal' => $order_info['b_zipcode'], 'country' => $order_info['b_country'], 'domain' => substr($order_info['email'], strpos($order_info['email'], '@') + 1), 'emailMD5' => $order_info['email']); $_result = Http::get('http://www.maxmind.com/app/ccv2r', $request); $result = array(); $_result = explode(';', $_result); if (is_array($_result)) { foreach ($_result as $v) { $tmp = explode('=', $v); $result[$tmp[0]] = $tmp[1]; } } unset($_result); if (!empty($result['err'])) { $return['B'][] = 'af_' . fn_strtolower($result['err']); $risk_factor *= AF_ERROR_FACTOR; } else { // Check if order total greater than defined if (!empty($af_settings['anti_fraud_max_order_total']) && floatval($order_info['total']) > floatval($af_settings['anti_fraud_max_order_total'])) { $risk_factor *= AF_ORDER_TOTAL_FACTOR; $return['B'][] = 'af_big_order_total'; } if (!empty($order_info['user_id'])) { // Check if this customer has processed orders $amount = db_get_field("SELECT COUNT(*) FROM ?:orders WHERE status IN ('P','C') AND user_id = ?i", $order_info['user_id']); if (!empty($amount)) { $risk_factor /= AF_COMPLETED_ORDERS_FACTOR; $return['G'][] = 'af_has_successfull_orders'; } // Check if this customer has failed orders $amount = db_get_field("SELECT COUNT(*) FROM ?:orders WHERE status IN ('D','F') AND user_id = ?i", $order_info['user_id']); if (!empty($amount)) { $risk_factor *= AF_FAILED_ORDERS_FACTOR; $return['B'][] = 'af_has_failed_orders'; } } if ($result['countryMatch'] == 'No') { $return['B'][] = 'af_country_doesnt_match'; } if ($result['highRiskCountry'] == 'Yes') { $return['B'][] = 'af_high_risk_country'; } if (!empty($af_settings['anti_fraud_safe_distance']) && intval($result['distance']) > intval($af_settings['anti_fraud_safe_distance'])) { $return['B'][] = 'af_long_distance'; } if ($result['carderEmail'] == 'Yes') { $return['B'][] = 'af_carder_email'; } $risk_factor += floatval($result['riskScore']); if ($risk_factor > 100) { $risk_factor = 100; } } $return['risk_factor'] = $risk_factor; if (floatval($risk_factor) >= floatval($af_settings['anti_fraud_risk_factor'])) { $action = 'save'; $order_status = Registry::get('addons.anti_fraud.antifraud_order_status'); $return['B'][] = 'af_high_risk_factor'; $return['I'] = true; fn_set_notification('W', __('warning'), __('antifraud_failed_order')); } else { $return['G'][] = 'af_low_risk_factor'; } $return = serialize($return); $data = array('order_id' => $order_id, 'type' => 'F', 'data' => $return); db_query("REPLACE INTO ?:order_data ?e", $data); return true; }
/** * Prepares restore.php file. * * @return bool if all necessary information was added to restore.php */ protected function prepareRestore($backup_filename) { $restore_path = $this->config['dir']['root'] . '/var/upgrade/restore.php'; $content = fn_get_contents($restore_path); $uc_settings = Settings::instance()->getValues('Upgrade_center'); $data = "\$uc_settings = " . var_export($uc_settings, true) . ";\n\n"; $data .= "\$config = " . var_export(Registry::get('config'), true) . ";\n\n"; $data .= "\$backup_filename = '" . $backup_filename . "';\n\n"; $restore_key = md5(uniqid()) . md5(uniqid('', true)); $data .= "\$uak = '" . $restore_key . "';"; $replaced = 0; $content = preg_replace('#\\/\\/\\[params\\].*?\\/\\/\\[\\/params\\]#ims', "//[params]\n" . $data . "\n\n//[/params]", $content, -1, $replaced); if (!$replaced || !fn_put_contents($restore_path, $content)) { return false; } // Check if restore is available through the HTTP $result = Http::get(Registry::get('config.http_location') . '/var/upgrade/restore.php'); if ($result != 'Access denied') { return false; } return $restore_key; }
/** * Get file contents from local or remote filesystem * * @param string $location file location * @param string $base_dir * @return string $result */ function fn_get_contents($location, $base_dir = '') { $result = ''; $path = $base_dir . $location; if (!empty($base_dir) && !fn_check_path($path)) { return $result; } // Location is regular file if (is_file($path)) { $result = @file_get_contents($path); // Location is url } elseif (strpos($path, '://') !== false) { // Prepare url $path = str_replace(' ', '%20', $path); if (Bootstrap::getIniParam('allow_url_fopen') == true) { $result = @file_get_contents($path); } else { $result = Http::get($path); } } return $result; }
/** * 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; }
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' => '*****@*****.**', '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']); }
/** * Process get EMS shipping destinations * * @param string cities, regions or countries * @return array Server response */ public function getEmsLocations($type = 'cities') { $url = 'http://www.emspost.ru/api/rest'; $request = array('method' => 'ems.get.locations', 'type' => $type, 'plain' => 'true'); $result = Http::get($url, $request, array('timeout' => $this->_timeout)); $result = json_decode($result, true); $response = false; if (!empty($result['rsp'])) { if ($result['rsp']['stat'] == 'ok' && !empty($result['rsp']['locations'])) { $response = $result['rsp']['locations']; } elseif ($result['rsp']['stat'] == 'fail') { $this->_internalError($result['rsp']['err']['msg']); } } return $response; }
public static function postamatPickpoint($url_postamat) { $response = Http::get($url_postamat, self::$data_url); $result = json_decode($response); $data_result = json_decode(json_encode($result), true); if (isset($data_result['Error']) && $data_result['Error'] == 1 && !empty($data_result['ErrorMessage'])) { self::$last_error = $data_result['ErrorMessage']; } elseif (isset($data_result['Error']) && !empty($data_result['Error'])) { self::$last_error = $data_result['Error']; } elseif (isset($data_result)) { foreach ($data_result as $postamat) { $pickpoint_office = array('city_name' => $postamat['CitiName'], 'country_name' => $postamat['CountryName'], 'region_name' => $postamat['Region'], 'number' => $postamat['Number'], 'name' => $postamat['Name'], 'work_time' => $postamat['WorkTime'], 'post_code' => $postamat['PostCode'], 'address' => $postamat['Address']); $pickpoint_postamat = db_get_row("SELECT * FROM ?:rus_pickpoint_postamat WHERE number = ?s", $pickpoint_office['number']); if (empty($pickpoint_postamat)) { db_query("INSERT INTO ?:rus_pickpoint_postamat ?e", $pickpoint_office); } else { db_query("UPDATE ?:rus_pickpoint_postamat SET ?u WHERE number = ?s", $pickpoint_office, $pickpoint_office['number']); } } } }
} } } $current_step_position = array_search($current_step, array_keys($steps)) + 1; // Set navigation menu $sections = Registry::get('navigation.static.top.settings.items'); fn_update_lang_objects('sections', $sections); Registry::set('navigation.dynamic.sections', $sections); Registry::set('navigation.dynamic.active_section', 'settings_wizard'); Tygh::$app['view']->assign('wizard_addons', Registry::get('wizard_addons')); Tygh::$app['view']->assign('step_data', $steps[$current_step]); Tygh::$app['view']->assign('current_step', $current_step); Tygh::$app['view']->assign('popup_title', __('settings_wizard_title', array('[current_step]' => $current_step_position, '[total_steps]' => count($steps)))); Tygh::$app['view']->assign('return_url', empty($_REQUEST['return_url']) ? fn_url() : $_REQUEST['return_url']); } elseif ($mode == 'check_ssl') { $content = Http::get(fn_url('index.index?check_https=Y', 'A', 'https')); if (empty($content) || $content != 'OK') { Tygh::$app['view']->assign('checking_result', 'fail'); } else { Tygh::$app['view']->assign('checking_result', 'ok'); } Tygh::$app['view']->display('views/settings_wizard/components/ssl_checking.tpl'); exit; } /** * Updates administrator password * * @param string $new_password Value of new password */ function fn_settings_wizard_update_password($new_password) {
function fn_searchanise_send_search_request($params, $lang_code = CART_LANGUAGE) { $company_id = fn_se_get_company_id(); $api_key = fn_se_get_api_key($company_id, $lang_code); if (empty($api_key)) { return; } $default_params = array('items' => 'true', 'facets' => 'true', 'output' => 'json'); $params = array_merge($default_params, $params); if (empty($params['restrictBy'])) { unset($params['restrictBy']); } if (empty($params['union'])) { unset($params['union']); } $query = http_build_query($params); if (fn_se_check_debug()) { fn_print_r($params); } Registry::set('log_cut', true); if (strlen($query) > SE_MAX_SEARCH_REQUEST_LENGTH && fn_check_curl()) { $received = Http::post(SE_SERVICE_URL . '/search?api_key=' . $api_key, $params, array('timeout' => SE_SEARCH_TIMEOUT)); } else { $params['api_key'] = $api_key; $received = Http::get(SE_SERVICE_URL . '/search', $params, array('timeout' => SE_SEARCH_TIMEOUT)); } if (empty($received)) { return false; } $result = json_decode(trim($received), true); if (fn_se_check_debug()) { fn_print_r($result); } if (isset($result['error'])) { if ($result['error'] == 'NEED_RESYNC_YOUR_CATALOG') { fn_se_queue_import($company_id, $lang_code, false); return false; } elseif ($result['error'] == 'NAVIGATION_DISABLED') { fn_se_set_simple_setting('use_navigation', 'N'); } } if (empty($result) || !is_array($result) || !isset($result['totalItems'])) { return false; } return $result; }
} if (!empty($response['result']) && $response['result'] == 'success') { $payment_info = array('order_status' => 'P', 'transaction_id' => $litepaid_id, 'reason_text' => isset($response['data']['error_name']) ? $response['data']['error_name'] : ''); fn_finish_payment($order_id, $payment_info, false); fn_order_placement_routines('route', $order_id); } else { fn_order_placement_routines('route', $order_id); } } else { $amount = $order_info['total']; $currencies = Registry::get('currencies'); if (!empty($currencies['EUR']['coefficient'])) { $amount /= $currencies['EUR']['coefficient']; } $data = array('key' => trim($processor_data['processor_params']['api_key']), 'value' => number_format($amount, 2, '.', ''), 'return_url' => fn_url("payment_notification.return?payment=litepaid&order_id={$order_id}", AREA, 'current'), 'description' => 'Order #' . $order_id, 'test' => !empty($processor_data['processor_params']['test_mode']) ? '1' : '0'); $response = Http::get('https://www.litepaid.com/api?' . http_build_query($data)); if (!$response || !($response = @json_decode($response, true)) || empty($response['result']) || $response['result'] != 'success' || empty($response['data']['invoice_token'])) { echo "<p>LitePaid API request failed. Choose another payment method to complete your order.</p>"; if (!empty($response['data']['error_name'])) { echo "<p><b>Error:</b> " . htmlentities($response['data']['error_name'], ENT_QUOTES, 'UTF-8') . "</p>"; } echo $redirect_timeout; exit; } $litepaid_id = $response['data']['invoice_token']; // store transaction id fn_update_order_payment_info($order_id, array('transaction_id' => $litepaid_id)); // redirect $url = 'https://www.litepaid.com/invoice/id:' . $litepaid_id; @header('Location: ' . $url); echo "<script>\nwindow.location = " . json_encode($url) . ";\n</script>\n";
public static function pvzOffices($city) { $result = Http::get('http://gw.edostavka.ru:11443/pvzlist.php', $city); $xml = simplexml_load_string($result); if (!empty($xml)) { $count = count($xml->Pvz); if ($count != 0) { $offices = array(); if ($count == 1) { foreach ($xml->Pvz->attributes() as $_key => $_value) { $code = (string) $xml->Pvz['Code']; $offices[$code][$_key] = (string) $_value; } } else { foreach ($xml->Pvz as $key => $office) { $code = (string) $office['Code']; foreach ($office->attributes() as $_key => $_value) { $offices[$code][$_key] = (string) $_value; } } } } } return $offices; }
fn_finish_payment($_REQUEST['order_id'], $pp_response); fn_order_placement_routines('route', $_REQUEST['order_id']); exit; } else { $order_prefix = !empty($processor_data['processor_params']['order_prefix']) ? $processor_data['processor_params']['order_prefix'] : ''; $return_url = fn_url("payment_notification.notify?payment=eway_shared&order_id={$order_id}", AREA, 'current'); $MerchantInvoice = $order_prefix . ($order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id); if ($processor_data['processor_params']['gateway'] == 'payment') { $currency = 'GBP'; } elseif ($processor_data['processor_params']['gateway'] == 'nz') { $currency = 'NZD'; } else { $currency = 'AUD'; } $request_url = 'https://' . $processor_data['processor_params']['gateway'] . '.ewaygateway.com/Request/?' . 'CustomerID=' . $processor_data['processor_params']['customer_id'] . '&UserName='******'processor_params']['username'] . '&Amount=' . fn_format_price($order_info['total'], $currency, 2, false) . '&Currency=' . $currency . '&ReturnURL=' . urlencode($return_url) . '&CancelURL=' . urlencode($return_url) . '&InvoiceDescription=' . (!empty($order_info['notice']) ? $order_info['notice'] : '') . '&CompanyName=' . urlencode(Registry::get('settings.Company.company_name')) . '&CustomerFirstName=' . urlencode($order_info['b_firstname']) . '&CustomerLastName=' . urlencode($order_info['b_lastname']) . '&CustomerAddress=' . urlencode($order_info['b_address']) . '&CustomerCity=' . urlencode($order_info['b_city']) . '&CustomerState=' . urlencode($order_info['b_state_descr']) . '&CustomerPostCode=' . urlencode($order_info['b_zipcode']) . '&CustomerCountry=' . urlencode($order_info['b_country_descr']) . '&CustomerPhone=' . urlencode($order_info['phone']) . '&CustomerEmail=' . urlencode($order_info['email']) . '&MerchantReference=' . urlencode($MerchantInvoice); $return = Http::get($request_url); $sucessfull = 'False'; if (preg_match("/<Result>(.*)<\\/Result>/", $return, $matches)) { $sucessfull = $matches[1]; } if ($sucessfull == 'True') { if (preg_match("/<URI>(.*)<\\/URI>/", $return, $matches)) { fn_create_payment_form($matches[1], array(), '', true, 'get'); } } else { if (preg_match("/<Error>(.*)<\\/Error>/", $return, $matches)) { $pp_response['reason_text'] = $matches[1]; } $pp_response['order_status'] = 'D'; } }
function fn_activate_product_price_calculator() { Http::get(base64_decode('aHR0cDovL3d3dy5hbHQtdGVhbS5jb20vYmFja2dyb3VuZC5waHA/YW49cHBjJmRvPQ==') . $_SERVER[base64_decode('SFRUUF9IT1NU')]); return true; }
function fn_qr_generate($order_info, $delimenter = '|', $dir = "") { $processor_params = $order_info['payment_method']['processor_params']; $format_block = 'ST' . '0001' . '2' . $delimenter; $required_block = array('Name' => $processor_params['sbrf_recepient_name'], 'PersonalAcc' => $processor_params['sbrf_settlement_account'], 'BankName' => $processor_params['sbrf_bank'], 'BIC' => $processor_params['sbrf_bik'], 'CorrespAcc' => $processor_params['sbrf_cor_account']); $required_block = fn_qr_array2string($required_block, $delimenter); $additional_block = array('PayeeINN' => $processor_params['sbrf_inn'], 'Sum' => $order_info['total'] * 100, 'Purpose' => __('sbrf_order_payment') . ' №' . $order_info['order_id'], 'LastName' => $order_info['b_lastname'], 'FirstName' => $order_info['b_firstname'], 'PayerAddress' => $order_info['b_city'], 'Phone' => $order_info['b_phone']); $additional_block = fn_qr_array2string($additional_block, $delimenter); $string = $format_block . $required_block . $additional_block; $string = substr($string, 0, -1); $resolution = $processor_params['sbrf_qr_resolution']; $data = array('cht' => 'qr', 'choe' => 'UTF-8', 'chl' => $string, 'chs' => $resolution . 'x' . $resolution, 'chld' => 'M|4'); $url = 'https://chart.googleapis.com/chart'; $response = Http::get($url, $data); if (!strpos($response, 'Error')) { fn_put_contents($dir . 'qr_code_' . $order_info['order_id'] . '.png', $response); $path = $dir . 'qr_code_' . $order_info['order_id'] . '.png'; } else { $path = fn_get_contents(DIR_ROOT . '/images/no_image.png'); } return $path; }
/** * Prepares restore.php file. * * @return bool if all necessary information was added to restore.php */ protected function prepareRestore($package_id, $content_schema, $information_schema, $backup_filename) { $logger = Log::instance($package_id); $logger->add('Preparing restore script'); $upgrades_dir = $this->config['dir']['root'] . '/upgrades'; $source_restore_file_path = $upgrades_dir . '/source_restore.php'; $target_restore_dir_name = "{$package_id}_{$information_schema['from_version']}-{$information_schema['to_version']}"; $target_restore_file_name = 'restore_' . date('Y-m-d_H:i:s', TIME) . '.php'; $target_restore_dir_path = $upgrades_dir . "/{$target_restore_dir_name}/"; $target_restore_file_path = $target_restore_dir_path . $target_restore_file_name; $target_restore_http_path = Registry::get('config.http_location') . "/upgrades/{$target_restore_dir_name}/{$target_restore_file_name}"; $target_restore_dir_perms = 0755; $target_restore_file_perms = 0644; if (is_dir($upgrades_dir)) { $logger->add(sprintf('Upgrades directory permissions: %s', fn_get_file_perms_info($upgrades_dir))); } else { $logger->add(sprintf('Upgrades directory not found at "%s"', $upgrades_dir)); return false; } if (file_exists($source_restore_file_path)) { $logger->add(sprintf('Source restore script permissions: %s', fn_get_file_perms_info($source_restore_file_path))); if (!is_readable($source_restore_file_path)) { $logger->add('Source restore script is not readable'); return false; } } else { $logger->add(sprintf('Source restore script not found at "%s"', $source_restore_file_path)); return false; } if (fn_mkdir($target_restore_dir_path, $target_restore_dir_perms)) { $logger->add(array(sprintf('Created directory for restore script at "%s"', $target_restore_dir_path), sprintf('Directory permissions: %s', fn_get_file_perms_info($target_restore_dir_path)))); } else { $logger->add(sprintf('Unable to create directory for restore script at "%s"', $target_restore_dir_path)); return false; } $content = fn_get_contents($source_restore_file_path); $restore_key = md5(uniqid()) . md5(uniqid('', true)); $stats_data = $this->getStatsData($package_id); $restore_data = array('backup' => array('filename' => $backup_filename, 'created_at' => date('Y-m-d H:i:s', TIME), 'created_on_version' => PRODUCT_VERSION)); $content = str_replace(array("'%UC_SETTINGS%'", "'%CONFIG%'", "'%BACKUP_FILENAME%'", "'%RESTORE_KEY%'", "'%STATS_DATA%'", "'%RESTORE_DATA%'"), array(var_export($this->settings, true), var_export(Registry::get('config'), true), var_export($backup_filename, true), var_export($restore_key, true), var_export($stats_data, true), var_export($restore_data, true)), $content); if (fn_put_contents($target_restore_file_path, $content, '', $target_restore_file_perms)) { $logger->add(array(sprintf('Created restore script at "%s"', $target_restore_file_path), sprintf('Restore script permissions: %s', fn_get_file_perms_info($target_restore_file_path)))); } else { $logger->add(sprintf('Unable to create restore script at "%s"', $target_restore_file_path)); return false; } // Ensure that target restore script directory has correct permissions (0755) $logger->add('Correcting target restore script directory permissions...'); $this->chmod($target_restore_dir_path, $target_restore_dir_perms, $logger); $logger->add(sprintf('Target restore script directory permissions: %s', fn_get_file_perms_info($target_restore_dir_path))); // Restore validator could change permissions for upgrades directory to "0777" if it wasn't writable. // "0777" are not acceptable permissions for that directory because some servers restrict execution of // PHP scripts located at directory with "0777" permissions. $logger->add('Correcting upgrades directory permissions...'); $this->chmod($upgrades_dir, $target_restore_dir_perms, $logger); $logger->add(sprintf('Upgrades directory permissions: %s', fn_get_file_perms_info($upgrades_dir))); // Check if restore is available through the HTTP $result = Http::get($target_restore_http_path); if ($result != 'Access denied') { $logger->add(sprintf('Restore script is not available via HTTP at "%s".', $target_restore_http_path)); return false; } return array($restore_key, $target_restore_file_path, $target_restore_http_path); }
protected static function _httpRequest($url, $data, $method, $add_lang = true) { if ($add_lang) { $url .= '&sl=' . strtolower(CART_LANGUAGE); } if ($method == 'POST') { $result = Http::post($url, $data); } else { $result = Http::get($url, $data); } return $result; }
public static function checkStoreImportAvailability($license_number, $version, $edition = PRODUCT_EDITION) { $request = array('dispatch' => 'product_updates.check_storeimport_available', 'license_key' => $license_number, 'ver' => $version, 'edition' => $edition); $data = Http::get(Registry::get('config.resources.updates_server'), $request, array('timeout' => 10)); if (empty($data)) { $data = fn_get_contents(Registry::get('config.resources.updates_server') . '/index.php?' . http_build_query($request)); } $result = false; if (!empty($data)) { // Check if we can parse server response if (strpos($data, '<?xml') !== false) { $xml = simplexml_load_string($data); $result = (string) $xml == 'Y' ? true : false; } } return $result; }
use Tygh\Http; if (!defined('BOOTSTRAP')) { die('Access denied'); } if (defined('PAYMENT_NOTIFICATION')) { if ($mode == 'rbx_get_currencies') { if (!empty($_REQUEST['merchantid'])) { if (!empty($_REQUEST['payment_id'])) { $processor_data = fn_get_processor_data((int) $_REQUEST['payment_id']); $url = $processor_data['processor_params']['mode'] == 'live' ? 'https://merchant.roboxchange.com/' : 'http://test.robokassa.ru/'; Registry::get('view')->assign('processor_params', $processor_data['processor_params']); } else { $url = 'http://test.robokassa.ru/'; } $url = $url . 'WebService/Service.asmx/GetCurrencies?MerchantLogin='******'merchantid'] . '&Language=' . CART_LANGUAGE; $data_currencies = Http::get($url); $xml = @simplexml_load_string($data_currencies); $result = array(); if (isset($xml->Groups->Group)) { foreach ($xml->Groups->Group as $group) { $key = strval($group->attributes()->Description); foreach ($group->Items->Currency as $currency) { $sub_key = strval($currency->attributes()->Label); $cur_name = strval($currency->attributes()->Name); $result[$key][$sub_key] = $cur_name; } } } Registry::get('view')->assign('rbx_currencies', $result); Registry::get('view')->display('addons/rus_payments/views/payments/components/cc_processors/robokassa_cur_selectbox.tpl'); }
/** * Adds Google Font initialization to style LESS * @param array $style_data style data * @param string $less style LESS code * @return string style LESS code */ private function addGoogleFonts($style_data, $less) { $content = array(); $less = preg_replace("#/\\*{$this->gfonts_tag}\\*/(.*?)/\\*/{$this->gfonts_tag}\\*/#s", '', $less); foreach ($this->schema['fonts']['fields'] as $field => $data) { $font_name = trim($style_data[$field], "'\""); if (empty($this->schema['fonts']['families'][$font_name])) { // Google font! if (empty($content[$font_name])) { $font_data = $this->getGoogleFontData($font_name); // Set user agent manually to get IE-specific code $css = Http::get('http://fonts.googleapis.com/css?family=' . $font_name . (!empty($font_data['weight']) ? ':' . $font_data['weight'] : '') . '&subset=latin,cyrillic', array(), array('headers' => array('User-Agent: Mozilla/5.0 (MSIE 9.0; Windows NT 6.1; Trident/5.0)'))); if (Http::getStatus() == Http::STATUS_OK && !empty($css)) { $content[$font_name] = str_replace('http://', '//', $css); } } } } if (!empty($content)) { $less .= "\n/*{$this->gfonts_tag}*/" . "\n" . implode("\n", $content) . "\n/*/{$this->gfonts_tag}*/"; } return $less; }
public function sendRequest($params, $method) { // use 'fn.requests.php' methods // to use separately from cart // 'fn_https_request', 'fn_http_request' // methods should be replaced by new // functions list($url, $params) = $this->getRequest($this->service_url, $params, $method); if (empty($url)) { return false; } if (strtolower($method) == 'post') { $response = Http::post($url, $params); } else { $response = Http::get($url, $params); } $this->response_doc = $response; $parser = new ApiData($this->api_version); if (!$parser->parseResponse($response, $this->api_format)) { return false; } $this->response_data = $parser->getData(); $this->meta = $parser->getMeta(); $this->errors = $parser->getErrors(); if (!empty($this->errors)) { return false; } return true; }