📄 upgrade_3.php
字号:
<?php
/*
$Id: upgrade_3.php,v 1.1.1.1 2004/10/09 14:29:27 cvsadmin Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
?>
<p class="pageTitle">Upgrade</p>
<?php
$db = array();
$db['DB_SERVER'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER']));
$db['DB_SERVER_USERNAME'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER_USERNAME']));
$db['DB_SERVER_PASSWORD'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER_PASSWORD']));
$db['DB_DATABASE'] = trim(stripslashes($HTTP_POST_VARS['DB_DATABASE']));
osc_db_connect($db['DB_SERVER'], $db['DB_SERVER_USERNAME'], $db['DB_SERVER_PASSWORD']);
osc_db_select_db($db['DB_DATABASE']);
function osc_get_languages() {
$languages_query = osc_db_query("select languages_id, name, code, image, directory from languages order by sort_order");
while ($languages = osc_db_fetch_array($languages_query)) {
$languages_array[] = array('id' => $languages['languages_id'],
'name' => $languages['name'],
'code' => $languages['code'],
'image' => $languages['image'],
'directory' => $languages['directory']
);
}
return $languages_array;
}
function osc_currency_format($number, $calculate_currency_value = true, $currency_code = DEFAULT_CURRENCY, $value = '') {
$currency_query = osc_db_query("select symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from currencies where code = '" . $currency_code . "'");
$currency = osc_db_fetch_array($currency_query);
if ($calculate_currency_value == true) {
if (strlen($currency_code) == 3) {
if ($value) {
$rate = $value;
} else {
$rate = $currency['value'];
}
} else {
$rate = 1;
}
$number2currency = $currency['symbol_left'] . number_format(($number * $rate), $currency['decimal_places'], $currency['decimal_point'], $currency['thousands_point']) . $currency['symbol_right'];
} else {
$number2currency = $currency['symbol_left'] . number_format($number, $currency['decimal_places'], $currency['decimal_point'], $currency['thousands_point']) . $currency['symbol_right'];
}
return $number2currency;
}
osc_set_time_limit(0);
$languages = osc_get_languages();
// send data to the browser, so the flushing works with IE
for ($i=0; $i<300; $i++) print(' ');
print ("\n");
?>
<p><span id="addressBook"><span id="addressBookMarker">-</span> Address Book</span><br>
<span id="banners"><span id="bannersMarker">-</span> Banners</span><br>
<span id="categories"><span id="categoriesMarker">-</span> Categories</span><br>
<span id="configuration"><span id="configurationMarker">-</span> Configuration</span><br>
<span id="currencies"><span id="currenciesMarker">-</span> Currencies</span><br>
<span id="customers"><span id="customersMarker">-</span> Customers</span><br>
<span id="images"><span id="imagesMarker">-</span> Images</span><br>
<span id="languages"><span id="languagesMarker">-</span> Languages</span><br>
<span id="manufacturers"><span id="manufacturersMarker">-</span> Manufacturers</span><br>
<span id="orders"><span id="ordersMarker">-</span> Orders</span><br>
<span id="products"><span id="productsMarker">-</span> Products</span><br>
<span id="reviews"><span id="reviewsMarker">-</span> Reviews</span><br>
<span id="sessions"><span id="sessionsMarker">-</span> Sessions</span><br>
<span id="specials"><span id="specialsMarker">-</span> Specials</span><br>
<span id="taxes"><span id="taxesMarker">-</span> Taxes</span><br>
<span id="whosOnline"><span id="whosOnlineMarker">-</span> Whos Online</span></p>
<p>Status: <span id="statusText">Preparing</span></p>
<?php flush(); ?>
<script language="javascript"><!--
changeStyle('addressBook', 'bold');
changeText('addressBookMarker', '?');
changeText('statusText', 'Updating Address Book');
//--></script>
<?php
flush();
osc_db_query("alter table address_book add customers_id int not null after address_book_id");
osc_db_query("alter table address_book add entry_company varchar(32) after entry_gender");
osc_db_query("alter table customers add customers_default_address_id int(5) not null after customers_email_address");
$entries_query = osc_db_query("select address_book_id, customers_id from address_book_to_customers");
while ($entries = osc_db_fetch_array($entries_query)) {
osc_db_query("update address_book set customers_id = '" . $entries['customers_id'] . "' where address_book_id = '" . $entries['address_book_id'] . "'");
}
$customer_query = osc_db_query("select customers_id, customers_gender, customers_firstname, customers_lastname, customers_street_address, customers_suburb, customers_postcode, customers_city, customers_state, customers_country_id, customers_zone_id from customers");
while ($customer = osc_db_fetch_array($customer_query)) {
osc_db_query("insert into address_book (customers_id, entry_gender, entry_company, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_country_id, entry_zone_id) values ('" . $customer['customers_id'] . "', '" . $customer['customers_gender'] . "', '', '" . addslashes($customer['customers_firstname']) . "', '" . addslashes($customer['customers_lastname']) . "', '" . addslashes($customer['customers_street_address']) . "', '" . addslashes($customer['customers_suburb']) . "', '" . addslashes($customer['customers_postcode']) . "', '" . addslashes($customer['customers_city']) . "', '" . addslashes($customer['customers_state']) . "', '" . $customer['customers_country_id'] . "', '" . $customer['customers_zone_id'] . "')");
$address_book_id = osc_db_insert_id();
osc_db_query("update customers set customers_default_address_id = '" . $address_book_id . "' where customers_id = '" . $customer['customers_id'] . "'");
}
osc_db_query("alter table address_book add index idx_address_book_customers_id (customers_id)");
osc_db_query("drop table address_book_to_customers");
?>
<script language="javascript"><!--
changeStyle('addressBook', 'normal');
changeText('addressBookMarker', '*');
changeText('statusText', 'Updating Address Book .. done!');
changeStyle('banners', 'bold');
changeText('bannersMarker', '?');
changeText('statusText', 'Updating Banners');
//--></script>
<?php
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -