Пример #1
0
<?php

/*	if ($_SERVER['USE_DEBUG_CONFIGURATION'] != 1)
	{
		require('../includes/configure.php');
	}
	else
	{
		require('../includes/configure_debug.php');
	}

	include(DIR_WS_FUNCTIONS . 'locks.php');*/
function tep_get_memory()
{
    foreach (file('/proc/meminfo') as $ri) {
        $m[strtok($ri, ':')] = strtok('');
        //echo $ri . ': ' . strtok('') . '<br/>';
    }
    return 'Percent:  ' . round($m['MemFree'] / $m['MemTotal'] * 100) . '\\r\\n' . 'MemFree:  ' . $m['MemFree'] . '\\r\\n' . 'Buffers:  ' . $m['Buffers'] . '\\r\\n' . 'Cached:   ' . $m['Cached'] . '\\r\\n' . 'MemTotal: ' . $m['MemTotal'] . '\\r\\n';
}
echo str_replace('\\r\\n', '<br/>', tep_get_memory());
Пример #2
0
    while (list($i) = each($order_totals)) {
        if ($order_totals[$i]['code'] == 'ot_shipping') {
            $order_totals[$i]['title'] = 'Самовывоз';
            $order_totals[$i]['text'] = $currencies->format(0);
            $order_totals[$i]['value'] = '0';
        }
    }
    $shipping = array('id' => 'slf_0', 'title' => 'Самовывоз', 'cost' => 0);
}
// load the before_process function from the payment modules
$payment_modules->before_process();
$sql_data_array = array('orders_code' => $order->info['code'], 'customers_id' => $customer_id, 'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'], 'customers_company' => $order->customer['company'], 'customers_company_full_name' => $order->customer['company_full'], 'customers_company_name' => $order->customer['company'], 'customers_company_inn' => $order->customer['company_inn'], 'customers_company_kpp' => $order->customer['company_kpp'], 'customers_company_ogrn' => $order->customer['company_ogrn'], 'customers_company_okpo' => $order->customer['company_okpo'], 'customers_company_okogu' => $order->customer['company_okogu'], 'customers_company_okato' => $order->customer['company_okato'], 'customers_company_okved' => $order->customer['company_okved'], 'customers_company_okfs' => $order->customer['company_okfs'], 'customers_company_okopf' => $order->customer['company_okopf'], 'customers_company_address_corporate' => $order->customer['company_address_corporate'], 'customers_company_address_post' => $order->customer['company_address_post'], 'customers_company_telephone' => $order->customer['company_telephone'], 'customers_company_fax' => $order->customer['company_fax'], 'customers_company_bank' => $order->customer['company_bank'], 'customers_company_rs' => $order->customer['company_rs'], 'customers_company_ks' => $order->customer['company_ks'], 'customers_company_bik' => $order->customer['company_bik'], 'customers_company_general' => $order->customer['company_general'], 'customers_company_financial' => $order->customer['company_financial'], 'customers_street_address' => $order->customer['street_address'], 'customers_suburb' => $order->customer['suburb'], 'customers_city' => $order->customer['city'], 'customers_postcode' => $order->customer['postcode'], 'customers_state' => $order->customer['state'], 'customers_country' => $order->customer['country']['title'], 'customers_telephone' => $order->customer['telephone'], 'customers_email_address' => $order->customer['email_address'], 'customers_address_format_id' => $order->customer['format_id'], 'customers_ip' => tep_get_ip_address(), 'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 'delivery_company' => $order->delivery['company'], 'delivery_street_address' => $order->delivery['street_address'], 'delivery_suburb' => $order->delivery['suburb'], 'delivery_city' => $order->delivery['city'], 'delivery_postcode' => $order->delivery['postcode'], 'delivery_state' => $order->delivery['state'], 'delivery_country' => $order->delivery['country']['title'], 'delivery_telephone' => $order->delivery['telephone'], 'delivery_address_format_id' => $order->delivery['format_id'], 'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 'billing_company' => $order->billing['company'], 'billing_street_address' => $order->billing['street_address'], 'billing_suburb' => $order->billing['suburb'], 'billing_city' => $order->billing['city'], 'billing_postcode' => $order->billing['postcode'], 'billing_state' => $order->billing['state'], 'billing_country' => $order->billing['country']['title'], 'billing_telephone' => $order->billing['telephone'], 'billing_address_format_id' => $order->billing['format_id'], 'payment_method' => strpos($order->info['payment_method'], '(') !== false ? trim(substr($order->info['payment_method'], 0, strpos($order->info['payment_method'], '('))) : $order->info['payment_method'], 'cc_type' => $order->info['cc_type'], 'cc_owner' => $order->info['cc_owner'], 'cc_number' => tep_not_null($order->info['cc_number']) ? substr($order->info['cc_number'], 0, 4) . str_repeat('X', strlen($order->info['cc_number']) - 8) . substr($order->info['cc_number'], -4) : '', 'cc_expires' => $order->info['cc_expires'], 'check_account_type' => $order->info['check_account_type'], 'check_bank_name' => $order->info['check_bank_name'], 'check_routing_number' => $order->info['check_routing_number'], 'check_account_number' => $order->info['check_account_number'], 'date_purchased' => 'now()', 'orders_status' => $order->info['order_status'], 'currency' => $order->info['currency'], 'currency_value' => $order->info['currency_value'], 'orders_is_paid' => $order->info['is_paid'], 'delivery_transfer' => tep_calculate_date_available($order->info['delivery_transfer']), 'orders_ssl_enabled' => ENABLE_SSL == true ? '1' : '0', 'shops_id' => (int) SHOP_ID);
tep_db_perform(TABLE_ORDERS, $sql_data_array);
$insert_id = tep_db_insert_id();
tep_order_log($insert_id, '*** Order #' . $insert_id . ' created (pid=' . getmypid() . ', memory_peak=' . memory_get_peak_usage(true) . ')');
tep_order_log($insert_id, tep_get_memory());
$order_delivery_transfer = $order->info['delivery_transfer'];
$order_delivery_country_code = $order->delivery['country']['iso_code_2'];
$order_products_sum = 0;
for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
    $total_title = $order_totals[$i]['title'];
    if ($order_totals[$i]['code'] != 'ot_discount' && strpos($order_totals[$i]['code'], 'tax') === false) {
        list($total_title) = explode('(', $order_totals[$i]['title']);
    }
    //	if (preg_match('/^([^\(]+)\(.*$/i', $total_title, $regs)) $total_title = $regs[1];
    $total_title = trim($total_title);
    tep_db_query("insert into " . TABLE_ORDERS_TOTAL . " (orders_id, title, text, value, class, sort_order) values ('" . (int) $insert_id . "', '" . tep_db_input($total_title) . "', '" . tep_db_input($order_totals[$i]['text']) . "', '" . str_replace(',', '.', tep_db_input($order_totals[$i]['value'])) . "', '" . tep_db_input($order_totals[$i]['code']) . "', '" . tep_db_input($order_totals[$i]['sort_order']) . "')");
    if ($order_totals[$i]['code'] == 'ot_subtotal') {
        $order_products_sum = $order_totals[$i]['value'];
    }
    if ($order_totals[$i]['code'] == 'ot_total') {