function updateBill($param) { if (!is_object($param)) { return false; } $order_info = fn_get_order_info($param->txn, false, true, true, true); $temp = ''; if (!empty($order_info['payment_method']['processor_params']['passwd']) && !empty($order_info['payment_method']['processor_params']['login'])) { $txn = fn_convert_encoding('utf-8', 'windows-1251', $param->txn); $password = fn_convert_encoding('utf-8', 'windows-1251', $order_info['payment_method']['processor_params']['passwd']); $crc = strtoupper(md5($txn . strtoupper(md5($password)))); if ($param->login == $order_info['payment_method']['processor_params']['login'] && $param->password == $crc) { $pp_response = array(); $status = 'qiwi_order_status_' . $param->status; if ($param->status == 60) { $pp_response['order_status'] = 'P'; } elseif ($param->status >= 50 && $param->status < 60) { $pp_response['order_status'] = 'O'; } else { $pp_response['order_status'] = 'F'; } $pp_response['reason_text'] = __($status); fn_finish_payment($param->txn, $pp_response); $temp = new Response(); $temp->updateBillResult = 0; } } return $temp; }
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); $body = fn_substr($body, 0, $sms_length); if ($unicode) { $data['unicode'] = '1'; $body = fn_convert_encoding('UTF-8', 'UCS-2', $body); $codes = ''; for ($i = 0; $i < strlen($body); $i++) { $codes .= sprintf('%02X', ord($body[$i])); } $body = $codes; $body = urlencode($body); } $data['text'] = $body; fn_http_request('GET', 'http://api.clickatell.com/http/sendmsg', $data); }
function fn_get_csv($pattern, $file, $options) { $max_line_size = 65536; // 64 Кб $result = array(); if ($options['delimiter'] == 'C') { $delimiter = ','; } elseif ($options['delimiter'] == 'T') { $delimiter = "\t"; } else { $delimiter = ';'; } if (!empty($file) && file_exists($file)) { $encoding = fn_detect_encoding($file, 'F', !empty($options['lang_code']) ? $options['lang_code'] : CART_LANGUAGE); if (!empty($encoding)) { $file = fn_convert_encoding($encoding, 'UTF-8', $file, 'F'); } else { fn_set_notification('W', __('warning'), __('text_exim_utf8_file_format')); } $f = false; if ($file !== false) { $f = fopen($file, 'rb'); } if ($f) { // Get import schema $import_schema = fgetcsv($f, $max_line_size, $delimiter); if (empty($import_schema)) { fn_set_notification('E', __('error'), __('error_exim_cant_read_file')); return false; } // Check if we selected correct delimiter // If line was read without delimition, array size will be == 1. if (sizeof($import_schema) == 1) { // we could export one column if it is correct, otherwise show error if (!in_array($import_schema[0], array_keys($pattern['export_fields']))) { fn_set_notification('E', __('error'), __('error_exim_incorrent_delimiter')); return false; } } // Analyze schema - check for required fields if (fn_analyze_schema($import_schema, $pattern) == false) { return false; } // Collect data $schema_size = sizeof($import_schema); $skipped_lines = array(); $line_it = 1; while (($data = fn_fgetcsv($f, $max_line_size, $delimiter)) !== false) { $line_it++; if (fn_is_empty($data)) { continue; } if (sizeof($data) != $schema_size) { $skipped_lines[] = $line_it; continue; } $result[] = array_combine($import_schema, Bootstrap::stripSlashes($data)); } if (!empty($skipped_lines)) { fn_set_notification('W', __('warning'), __('error_exim_incorrect_lines', array('[lines]' => implode(', ', $skipped_lines)))); } return $result; } else { fn_set_notification('E', __('error'), __('error_exim_cant_open_file')); return false; } } else { fn_set_notification('E', __('error'), __('error_exim_file_doesnt_exist')); return false; } }
public function _addDellinCities($url_cities, $post) { $file_dir = fn_get_files_dir_path() . "dellin/"; fn_mkdir($file_dir); @chmod($file_dir, 0777); $file_path = $file_dir . date("Y-m-d", TIME) . '_cities.csv'; if (!file_exists($file_path)) { $response = Http::post($url_cities, json_encode($post), $this->url_params); $result = (array) json_decode($response); file_put_contents($file_path, file_get_contents($result['url'])); if (!empty($result['url'])) { $max_line_size = 65536; // 64 Кб $data_city = array(); $delimiter = ','; $encoding = fn_detect_encoding($result['url'], 'F', CART_LANGUAGE); if (!empty($encoding)) { $result['url'] = fn_convert_encoding($encoding, 'UTF-8', $result['url'], 'F'); } else { fn_set_notification('W', __('warning'), __('text_exim_utf8_file_format')); } $f = false; if ($result['url'] !== false) { $f = fopen($result['url'], 'rb'); } if ($f) { $import_schema = fgetcsv($f, $max_line_size, $delimiter); $schema_size = sizeof($import_schema); $skipped_lines = array(); $line_it = 1; while (($data = fn_fgetcsv($f, $max_line_size, $delimiter)) !== false) { $line_it++; if (fn_is_empty($data)) { continue; } if (sizeof($data) != $schema_size) { $skipped_lines[] = $line_it; continue; } $data = str_replace(array('\\r', '\\n', '\\t', '"'), '', $data); $data_city = array_combine($import_schema, Bootstrap::stripSlashes($data)); if (!empty($data_city)) { $dellin_city = array('number_city' => $data_city['id'], 'code_kladr' => str_replace(' ', '', $data_city['codeKLADR']), 'is_terminal' => $data_city['isTerminal']); $first_pos = strpos($data_city['name'], '('); $end_pos = strpos($data_city['name'], ')') - $first_pos; if (!empty($first_pos)) { $dellin_city['state'] = str_replace(array("(", ")"), "", substr($data_city['name'], $first_pos, $end_pos)); $dellin_city['city'] = str_replace(array('(' . $dellin_city['state'] . ')', '"'), "", $data_city['name']); } else { $dellin_city['state'] = str_replace(array('г.', 'г', 'г. ', 'г '), '', $data_city['name']); $dellin_city['city'] = $data_city['name']; } $dellin_city['city_id'] = db_get_field("SELECT city_id FROM ?:rus_dellin_cities WHERE code_kladr = ?s", $dellin_city['code_kladr']); db_query("REPLACE INTO ?:rus_dellin_cities ?e", $dellin_city); } } } } } }
* * **************************************************************************** * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * ****************************************************************************/ // // $Id: webmoney.php 9009 2009-05-08 18:41:00Z 2tl $ // if (!empty($_REQUEST['resend']) && $_REQUEST['resend'] == 'Y') { define('AREA', 'C'); define('AREA_NAME', 'customer'); require '../prepare.php'; require '../init.php'; define('WM_CHARSET', 'windows-1251'); header("Content-Type: text/html; charset=" . WM_CHARSET); $_REQUEST['LMI_PAYMENT_DESC'] = fn_convert_encoding('UTF-8', 'windows-1251', $_REQUEST['LMI_PAYMENT_DESC']); echo <<<EOT <html> <body onLoad="javascript: document.process.submit();"> <form method="post" action="{$_REQUEST['url']}" name="process"> \t<input type="hidden" name ="LMI_PAYMENT_AMOUNT" value="{$_REQUEST['LMI_PAYMENT_AMOUNT']}" /> \t<input type="hidden" name ="LMI_PAYMENT_DESC" value="{$_REQUEST['LMI_PAYMENT_DESC']}" /> \t<input type="hidden" name ="LMI_PAYMENT_NO" value="{$_REQUEST['LMI_PAYMENT_NO']}" /> \t<input type="hidden" name ="LMI_PAYEE_PURSE" value="{$_REQUEST['LMI_PAYEE_PURSE']}" /> EOT; if (isset($_REQUEST['LMI_SIM_MODE'])) { echo <<<EOT \t<input type="hidden" name ="LMI_SIM_MODE" value="{$_REQUEST['LMI_SIM_MODE']}" /> EOT; } echo <<<EOT
echo "<html><body onLoad=\"javascript: self.location='{$return_url}'\"></body></html>"; } else { if (!defined('BOOTSTRAP')) { die('Access denied'); } $post = array(); $post['merchant_site_id'] = $processor_data['processor_params']['merchant_site_id']; $post['merchant_id'] = $processor_data['processor_params']['merchant_id']; $post['time_stamp'] = gmdate('Y-m-d.H:i:s'); $post['currency'] = $processor_data['processor_params']['currency']; $post['total_amount'] = $order_info['total']; $post['numberofitems'] = 1; $post['invoice_id'] = $order_id; $post['merchant_unique_id'] = $processor_data['processor_params']['order_prefix'] . $order_id . ($order_info['repaid'] ? "_{$order_info['repaid']}" : ''); $post['item_name_1'] = __('order_id') . ': ' . $processor_data['processor_params']['order_prefix'] . $order_id . ($order_info['repaid'] ? "_{$order_info['repaid']}" : ''); $post['item_name_1'] = fn_convert_encoding('UTF-8', 'ISO-8859-1', $post['item_name_1']); $post['item_number_1'] = 1; $post['item_quantity_1'] = 1; $post['item_amount_1'] = $post['total_amount']; $products2checksum = $post['item_name_1'] . $post['item_amount_1'] . $post['item_quantity_1']; $post['first_name'] = $order_info['b_firstname']; $post['last_name'] = $order_info['b_lastname']; $post['email'] = $order_info['email']; $post['phone1'] = $order_info['phone']; $post['address1'] = $order_info['b_address']; $post['address2'] = $order_info['b_address_2']; $post['city'] = $order_info['b_city']; $post['state'] = $order_info['b_state']; $post['zip'] = $order_info['b_zipcode']; $post['country'] = $order_info['b_country']; $post['checksum'] = md5($processor_data['processor_params']['secret_string'] . $post['merchant_id'] . $post['currency'] . $post['total_amount'] . $products2checksum . $post['time_stamp']);
function fn_mailru_write_yml($filename, $mode, &$yml) { $path = fn_get_files_dir_path(); if (!is_dir($path)) { fn_mkdir($path); } $fd = fopen($path . $filename, $mode); if ($fd) { if (!is_array($yml)) { if (Registry::get('addons.rus_tovary_mailru.export_encoding') == 'windows-1251') { $yml = fn_convert_encoding('UTF-8', 'windows-1251', $yml, 'S'); } fwrite($fd, $yml); } else { foreach ($yml as $key => $content) { $content = $content . "\n"; if (Registry::get('addons.rus_tovary_mailru.export_encoding') == 'windows-1251') { $content = fn_convert_encoding('UTF-8', 'windows-1251', $content, 'S'); } fwrite($fd, $content); unset($yml[$key]); } } fclose($fd); @chmod($path . $filename, DEFAULT_FILE_PERMISSIONS); } }
function fn_pp_convert_encoding(&$value, $key, $enc_from = 'windows-1252') { $value = fn_convert_encoding($enc_from, 'UTF-8', $value); }
$page .= "<input type=\"hidden\" name=\"{$name}\" value=\"{$value}\" />\n"; } if ($processor_data['params']['mode'] == 'T') { $page .= <<<EOT <input type="hidden" name="DemoResult" value="{$DemoResult}" /> EOT; } $msg = fn_get_lang_var('text_cc_processor_connection'); $msg = str_replace('[processor]', 'Assist server', $msg); $page .= <<<EOT </form> <p><div align=center>{$msg}</div></p> </body> </html> EOT; $page = fn_convert_encoding('UTF-8', 'cp1251', $page); echo $page; exit; } elseif ($mode == 'return_ok') { $md5_check = md5($order_id . 'key' . $processor_data['params']['secret_key'] . $order_info['total']); $req_md5_chec = !empty($_REQUEST['md5_check']) ? $_REQUEST['md5_check'] : ''; if ($req_md5_chec == $md5_check) { $pp_response['order_status'] = 'P'; $pp_response['reason_text'] = fn_get_lang_var('transaction_approved'); } else { $pp_response['order_status'] = 'F'; $pp_response['reason_text'] = fn_get_lang_var('transaction_declined') . '; ' . fn_get_lang_var('md5_checksum_failed'); } } elseif ($mode == 'return_no') { $pp_response['order_status'] = 'F'; $pp_response['reason_text'] = fn_get_lang_var('transaction_declined');