[ Index ]
 

Code source de osCommerce 2.2ms2-060817

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/catalog/install/templates/pages/ -> upgrade_3.php (source)

   1  <?php
   2  /*
   3    $Id: upgrade_3.php,v 1.62 2003/07/12 09:00:26 hpdl Exp $
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 2003 osCommerce
   9  
  10    Released under the GNU General Public License
  11  */
  12  ?>
  13  
  14  <p class="pageTitle">Upgrade</p>
  15  
  16  <?php
  17    $db = array();
  18    $db['DB_SERVER'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER']));
  19    $db['DB_SERVER_USERNAME'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER_USERNAME']));
  20    $db['DB_SERVER_PASSWORD'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER_PASSWORD']));
  21    $db['DB_DATABASE'] = trim(stripslashes($HTTP_POST_VARS['DB_DATABASE']));
  22  
  23    osc_db_connect($db['DB_SERVER'], $db['DB_SERVER_USERNAME'], $db['DB_SERVER_PASSWORD']);
  24    osc_db_select_db($db['DB_DATABASE']);
  25  
  26    function osc_get_languages() {
  27      $languages_query = osc_db_query("select languages_id, name, code, image, directory from languages order by sort_order");
  28      while ($languages = osc_db_fetch_array($languages_query)) {
  29        $languages_array[] = array('id' => $languages['languages_id'],
  30                                   'name' => $languages['name'],
  31                                   'code' => $languages['code'],
  32                                   'image' => $languages['image'],
  33                                   'directory' => $languages['directory']
  34                                  );
  35      }
  36  
  37      return $languages_array;
  38    }
  39  
  40    function osc_currency_format($number, $calculate_currency_value = true, $currency_code = DEFAULT_CURRENCY, $value = '') {
  41      $currency_query = osc_db_query("select symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from currencies where code = '" . $currency_code . "'");
  42      $currency = osc_db_fetch_array($currency_query);
  43  
  44      if ($calculate_currency_value == true) {
  45        if (strlen($currency_code) == 3) {
  46          if ($value) {
  47            $rate = $value;
  48          } else {
  49            $rate = $currency['value'];
  50          }
  51        } else {
  52          $rate = 1;
  53        }
  54        $number2currency = $currency['symbol_left'] . number_format(($number * $rate), $currency['decimal_places'], $currency['decimal_point'], $currency['thousands_point']) . $currency['symbol_right'];
  55      } else {
  56        $number2currency = $currency['symbol_left'] . number_format($number, $currency['decimal_places'], $currency['decimal_point'], $currency['thousands_point']) . $currency['symbol_right'];
  57      }
  58  
  59      return $number2currency;
  60    }
  61  
  62    osc_set_time_limit(0);
  63  
  64    $languages = osc_get_languages();
  65  
  66  // send data to the browser, so the flushing works with IE
  67    for ($i=0; $i<300; $i++) print(' ');
  68    print ("\n");
  69  ?>
  70  
  71  <p><span id="addressBook"><span id="addressBookMarker">-</span> Address Book</span><br>
  72  <span id="banners"><span id="bannersMarker">-</span> Banners</span><br>
  73  <span id="categories"><span id="categoriesMarker">-</span> Categories</span><br>
  74  <span id="configuration"><span id="configurationMarker">-</span> Configuration</span><br>
  75  <span id="currencies"><span id="currenciesMarker">-</span> Currencies</span><br>
  76  <span id="customers"><span id="customersMarker">-</span> Customers</span><br>
  77  <span id="images"><span id="imagesMarker">-</span> Images</span><br>
  78  <span id="languages"><span id="languagesMarker">-</span> Languages</span><br>
  79  <span id="manufacturers"><span id="manufacturersMarker">-</span> Manufacturers</span><br>
  80  <span id="orders"><span id="ordersMarker">-</span> Orders</span><br>
  81  <span id="products"><span id="productsMarker">-</span> Products</span><br>
  82  <span id="reviews"><span id="reviewsMarker">-</span> Reviews</span><br>
  83  <span id="sessions"><span id="sessionsMarker">-</span> Sessions</span><br>
  84  <span id="specials"><span id="specialsMarker">-</span> Specials</span><br>
  85  <span id="taxes"><span id="taxesMarker">-</span> Taxes</span><br>
  86  <span id="whosOnline"><span id="whosOnlineMarker">-</span> Whos Online</span></p>
  87  
  88  <p>Status: <span id="statusText">Preparing</span></p>
  89  
  90  <?php flush(); ?>
  91  
  92  <script language="javascript"><!--
  93  changeStyle('addressBook', 'bold');
  94  changeText('addressBookMarker', '?');
  95  changeText('statusText', 'Updating Address Book');
  96  //--></script>
  97  
  98  <?php
  99    flush();
 100  
 101    osc_db_query("alter table address_book add customers_id int not null after address_book_id");
 102    osc_db_query("alter table address_book add entry_company varchar(32) after entry_gender");
 103  
 104    osc_db_query("alter table customers add customers_default_address_id int(5) not null after customers_email_address");
 105  
 106    $entries_query = osc_db_query("select address_book_id, customers_id from address_book_to_customers");
 107    while ($entries = osc_db_fetch_array($entries_query)) {
 108      osc_db_query("update address_book set customers_id = '" . $entries['customers_id'] . "' where address_book_id = '" . $entries['address_book_id'] . "'");
 109    }
 110  
 111    $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");
 112    while ($customer = osc_db_fetch_array($customer_query)) {
 113      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'] . "')");
 114  
 115      $address_book_id = osc_db_insert_id();
 116  
 117      osc_db_query("update customers set customers_default_address_id = '" . $address_book_id . "' where customers_id = '" . $customer['customers_id'] . "'");
 118    }
 119  
 120    osc_db_query("alter table address_book add index idx_address_book_customers_id (customers_id)");
 121  
 122    osc_db_query("drop table address_book_to_customers");
 123  ?>
 124  <script language="javascript"><!--
 125  changeStyle('addressBook', 'normal');
 126  changeText('addressBookMarker', '*');
 127  changeText('statusText', 'Updating Address Book .. done!');
 128  
 129  changeStyle('banners', 'bold');
 130  changeText('bannersMarker', '?');
 131  changeText('statusText', 'Updating Banners');
 132  //--></script>
 133  
 134  <?php
 135    flush();
 136  
 137    osc_db_query("create table banners ( banners_id int(5) not null auto_increment, banners_title varchar(64) not null, banners_url varchar(255) not null, banners_image varchar(64) not null, banners_group varchar(10) not null, banners_html_text text, expires_impressions int(7) default '0', expires_date datetime default null, date_scheduled datetime default null, date_added datetime not null, date_status_change datetime default null, status int(1) default '1' not null, primary key (banners_id) )");
 138    osc_db_query("create table banners_history ( banners_history_id int(5) not null auto_increment, banners_id int(5) not null, banners_shown int(5) not null default '0', banners_clicked int(5) not null default '0', banners_history_date datetime not null, primary key (banners_history_id) )");
 139    osc_db_query("insert into banners values (1, 'osCommerce', 'http://www.oscommerce.com', 'banners/oscommerce.gif', '468x50', '', 0, null, null, now(), null, 1)");
 140  
 141  ?>
 142  <script language="javascript"><!--
 143  changeStyle('banners', 'normal');
 144  changeText('bannersMarker', '*');
 145  changeText('statusText', 'Updating Banners .. done!');
 146  
 147  changeStyle('categories', 'bold');
 148  changeText('categoriesMarker', '?');
 149  changeText('statusText', 'Updating Categories');
 150  //--></script>
 151  
 152  <?php
 153    flush();
 154  
 155    osc_db_query("create table categories_description ( categories_id int(5) default '0' not null, language_id int(5) default '1' not null, categories_name varchar(32) not null, primary key (categories_id, language_id), key idx_categories_name (categories_name) )");
 156  
 157    $categories_query = osc_db_query("select categories_id, categories_name from categories order by categories_id");
 158    while ($categories = osc_db_fetch_array($categories_query)) {
 159      for ($i=0; $i<sizeof($languages); $i++) {
 160        osc_db_query("insert into categories_description (categories_id, language_id, categories_name) values ('" . $categories['categories_id'] . "', '" . $languages[$i]['id'] . "', '" . addslashes($categories['categories_name']) . "')");
 161      }
 162    }
 163  
 164    osc_db_query("alter table categories drop index IDX_CATEGORIES_NAME");
 165    osc_db_query("alter table categories drop categories_name");
 166    osc_db_query("alter table categories change parent_id parent_id int(5) not null default '0'");
 167    osc_db_query("alter table categories add date_added datetime after sort_order");
 168    osc_db_query("alter table categories add last_modified datetime after date_added");
 169    osc_db_query("alter table categories add index idx_categories_parent_id (parent_id)");
 170  ?>
 171  <script language="javascript"><!--
 172  changeStyle('categories', 'normal');
 173  changeText('categoriesMarker', '*');
 174  changeText('statusText', 'Updating Categories .. done!');
 175  
 176  changeStyle('configuration', 'bold');
 177  changeText('configurationMarker', '?');
 178  changeText('statusText', 'Updating Configuration');
 179  //--></script>
 180  
 181  <?php
 182    flush();
 183  
 184    osc_db_query("alter table configuration change last_modified last_modified datetime");
 185    osc_db_query("alter table configuration change date_added date_added datetime not null");
 186    osc_db_query("alter table configuration modify use_function varchar(255)");
 187    osc_db_query("alter table configuration add set_function varchar(255) after use_function");
 188  
 189    osc_db_query("update configuration set configuration_key = 'SHIPPING_ORIGIN_COUNTRY' where configuration_key = 'STORE_ORIGIN_COUNTRY'");
 190    osc_db_query("update configuration set configuration_key = 'SHIPPING_ORIGIN_ZIP' where configuration_key = 'STORE_ORIGIN_ZIP'");
 191    osc_db_query("update configuration set set_function = 'tep_cfg_pull_down_country_list(' where configuration_key = 'STORE_COUNTRY' or configuration_key = 'SHIPPING_ORIGIN_COUNTRY'");
 192    osc_db_query("update configuration set configuration_value = 'desc', configuration_description = 'This is the sort order used in the expected products box.', set_function = 'tep_cfg_select_option(array(\'asc\', \'desc\'), ' where configuration_key = 'EXPECTED_PRODUCTS_SORT'");
 193    osc_db_query("update configuration set configuration_value = 'date_expected', configuration_description = 'The column to sort by in the expected products box.', set_function = 'tep_cfg_select_option(array(\'products_name\', \'date_expected\'), ' where configuration_key = 'EXPECTED_PRODUCTS_FIELD'");
 194    osc_db_query("update configuration set use_function = 'tep_cfg_get_zone_name' where configuration_key = 'STORE_ZONE'");
 195  
 196    $config_query = osc_db_query("select configuration_key, configuration_value from configuration where configuration_key = 'IMAGE_REQUIRED'");
 197    $config_value = osc_db_fetch_array($config_query);
 198    if ($config_value['configuration_value'] == '1') $config_flag = 'true';
 199    else $config_flag = 'false';
 200    osc_db_query("update configuration set configuration_value = '" . $config_flag . "', set_function = 'tep_cfg_select_option(array(\'true\', \'false\'),' where configuration_key = 'IMAGE_REQUIRED'");
 201  
 202    $config_query = osc_db_query("select configuration_key, configuration_value from configuration where configuration_key = 'CONFIG_CALCULATE_IMAGE_SIZE'");
 203    $config_value = osc_db_fetch_array($config_query);
 204    if ($config_value['configuration_value'] == '1') $config_flag = 'true';
 205    else $config_flag = 'false';
 206    osc_db_query("update configuration set configuration_value = '" . $config_flag . "', set_function = 'tep_cfg_select_option(array(\'true\', \'false\'),' where configuration_key = 'CONFIG_CALCULATE_IMAGE_SIZE'");
 207  
 208    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Zone', 'STORE_ZONE', '18', 'The zone my store is located in', '1', '7', 'tep_cfg_get_zone_name', 'tep_cfg_pull_down_zone_list(', now())");
 209    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Switch To Default Currency', 'USE_DEFAULT_LANGUAGE_CURRENCY', 'false', 'Automatically switch to the language\'s currency when it is changed', '1', '10', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 210    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Send Extra Order E-Mails To', 'SEND_EXTRA_ORDER_EMAILS_TO', '', 'Send extra order e-mails to the following e-mail addresses, in this format: Name 1 &lt;email@address1&gt;, Name 2 &lt;email@address2&gt;', '1', '11', now())");
 211    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Use Search-Engine Safe URLs', 'SEARCH_ENGINE_FRIENDLY_URLS', 'false', 'Use search-engine safe urls for all site links', '1', '12', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 212    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Cart After Adding Product', 'DISPLAY_CART', 'true', 'Display the shopping cart after adding a product (or return back to their origin)', '1', '14', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 213    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow Guest To Tell A Friend', 'ALLOW_GUEST_TO_TELL_A_FRIEND', 'false', 'Allow guests to tell a friend about a product', '1', '15', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 214    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Default Search Operator', 'ADVANCED_SEARCH_DEFAULT_OPERATOR', 'and', 'Default search operators', '1', '17', 'tep_cfg_select_option(array(\'and\', \'or\'), ', now())");
 215    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Store Address and Phone', 'STORE_NAME_ADDRESS', '', 'This is the Store Name, Address and Phone used on printable documents and displayed online', '1', '18', 'tep_cfg_textarea(', now())");
 216    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Show Category Counts', 'SHOW_COUNTS', 'true', 'Count recursively how many products are in each category', '1', '19', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 217    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tax Decimal Places', 'TAX_DECIMAL_PLACES', '2', 'Pad the tax value this amount of decimal places', '1', '20', now())");
 218    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Prices with Tax', 'DISPLAY_PRICE_WITH_TAX', 'false', 'Display prices with tax included (true) or add the tax at the end (false)', '1', '21', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 219  
 220    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Company', 'ENTRY_COMPANY_LENGTH', '2', 'Minimum length of company name', '2', '6', now())");
 221    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Best Sellers', 'MIN_DISPLAY_BESTSELLERS', '1', 'Minimum number of best sellers to display', '2', '15', now())");
 222    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Also Purchased', 'MIN_DISPLAY_ALSO_PURCHASED', '1', 'Minimum number of products to display in the \'This Customer Also Purchased\' box', '2', '16', now())");
 223  
 224    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Manufacturers Select Size', 'MAX_MANUFACTURERS_LIST', '1', 'Used in manufacturers box; when this value is \'1\' the classic drop-down list will be used for the manufacturers box. Otherwise, a list-box with the specified number of rows will be displayed.', '3', '7', now())");
 225    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('New Products Listing', 'MAX_DISPLAY_PRODUCTS_NEW', '10', 'Maximum number of new products to display in new products page', '3', '14', now())");
 226    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Best Sellers', 'MAX_DISPLAY_BESTSELLERS', '10', 'Maximum number of best sellers to display', '3', '15', now())");
 227    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Also Purchased', 'MAX_DISPLAY_ALSO_PURCHASED', '5', 'Maximum number of products to display in the \'This Customer Also Purchased\' box', '3', '16', now())");
 228    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Customer Order History Box', 'MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX', '6', 'Maximum number of products to display in the customer order history box', '3', '17', now())");
 229    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Order History', 'MAX_DISPLAY_ORDER_HISTORY', '10', 'Maximum number of orders to display in the order history page', '3', '18', now())");
 230  
 231    osc_db_query("delete from configuration where configuration_group_id = '5'");
 232  
 233    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Gender', 'ACCOUNT_GENDER', 'true', 'Display gender in the customers account', '5', '1', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 234    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Date of Birth', 'ACCOUNT_DOB', 'true', 'Display date of birth in the customers account', '5', '2', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 235    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Company', 'ACCOUNT_COMPANY', 'true', 'Display company in the customers account', '5', '3', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 236    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Suburb', 'ACCOUNT_SUBURB', 'true', 'Display suburb in the customers account', '5', '4', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 237    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('State', 'ACCOUNT_STATE', 'true', 'Display state in the customers account', '5', '5', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 238  
 239    osc_db_query("delete from configuration where configuration_group_id = '6'");
 240  
 241    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Installed Modules', 'MODULE_PAYMENT_INSTALLED', 'cc.php;cod.php', 'List of payment module filenames separated by a semi-colon. This is automatically updated. No need to edit. (Example: cc.php;cod.php;paypal.php)', '6', '0', now())");
 242    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Installed Modules', 'MODULE_SHIPPING_INSTALLED', '', 'List of shipping module filenames separated by a semi-colon. This is automatically updated. No need to edit. (Example: ups.php;flat.php;item.php)', '6', '0', now())");
 243    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Installed Modules', 'MODULE_ORDER_TOTAL_INSTALLED', 'ot_subtotal.php;ot_tax.php;ot_shipping.php;ot_total.php', 'List of order_total module filenames separated by a semi-colon. This is automatically updated. No need to edit. (Example: ot_subtotal.php;ot_tax.php;ot_shipping.php;ot_total.php)', '6', '0', now())");
 244    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Cash On Delivery Module', 'MODULE_PAYMENT_COD_STATUS', 'True', 'Do you want to accept Cash On Delevery payments?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 245    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_COD_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
 246    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_COD_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
 247    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
 248    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Credit Card Module', 'MODULE_PAYMENT_CC_STATUS', 'True', 'Do you want to accept credit card payments?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 249    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Split Credit Card E-Mail Address', 'MODULE_PAYMENT_CC_EMAIL', '', 'If an e-mail address is entered, the middle digits of the credit card number will be sent to the e-mail address (the outside digits are stored in the database with the middle digits censored)', '6', '0', now())");
 250    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_CC_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0' , now())");
 251    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_CC_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
 252    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_CC_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
 253    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Default Currency', 'DEFAULT_CURRENCY', 'USD', 'Default Currency', '6', '0', now())");
 254    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Default Language', 'DEFAULT_LANGUAGE', 'en', 'Default Language', '6', '0', now())");
 255    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Default Order Status For New Orders', 'DEFAULT_ORDERS_STATUS_ID', '1', 'When a new order is created, this order status will be assigned to it.', '6', '0', now())");
 256    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Shipping', 'MODULE_ORDER_TOTAL_SHIPPING_STATUS', 'true', 'Do you want to display the order shipping cost?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 257    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER', '2', 'Sort order of display.', '6', '2', now())");
 258    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow Free Shipping', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING', 'false', 'Do you want to allow free shipping?', '6', '3', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 259    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, date_added) values ('Free Shipping For Orders Over', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER', '50', 'Provide free shipping for orders over the set amount.', '6', '4', 'currencies->format', now())");
 260    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Provide Free Shipping For Orders Made', 'MODULE_ORDER_TOTAL_SHIPPING_DESTINATION', 'national', 'Provide free shipping for orders sent to the set destination.', '6', '5', 'tep_cfg_select_option(array(\'national\', \'international\', \'both\'), ', now())");
 261    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Sub-Total', 'MODULE_ORDER_TOTAL_SUBTOTAL_STATUS', 'true', 'Do you want to display the order sub-total cost?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 262    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_SUBTOTAL_SORT_ORDER', '1', 'Sort order of display.', '6', '2', now())");
 263    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Tax', 'MODULE_ORDER_TOTAL_TAX_STATUS', 'true', 'Do you want to display the order tax value?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 264    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_TAX_SORT_ORDER', '3', 'Sort order of display.', '6', '2', now())");
 265    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Total', 'MODULE_ORDER_TOTAL_TOTAL_STATUS', 'true', 'Do you want to display the total order value?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 266    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_TOTAL_SORT_ORDER', '4', 'Sort order of display.', '6', '2', now())");
 267  
 268    osc_db_query("delete from configuration where configuration_group_id = '7' and configuration_key != 'SHIPPING_BOX_WEIGHT' and configuration_key != 'SHIPPING_BOX_PADDING' and configuration_key != 'SHIPPING_MAX_WEIGHT' and configuration_key != 'SHIPPING_ORIGIN_ZIP' and configuration_key != 'SHIPPING_ORIGIN_COUNTRY'");
 269    osc_db_query("update configuration set sort_order = '5' where sort_order = '2'");
 270    osc_db_query("update configuration set configuration_group_id = '7', sort_order = '1' where configuration_key = 'SHIPPING_ORIGIN_ZIP'");
 271    osc_db_query("update configuration set configuration_group_id = '7', sort_order = '2' where configuration_key = 'SHIPPING_ORIGIN_COUNTRY'");
 272  
 273    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check stock level', 'STOCK_CHECK', 'false', 'Check to see if sufficent stock is available', '9', '1', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 274    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Subtract stock', 'STOCK_LIMITED', 'true', 'Subtract product in stock by product orders', '9', '2', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 275    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow Checkout', 'STOCK_ALLOW_CHECKOUT', 'true', 'Allow customer to checkout even if there is insufficient stock', '9', '3', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 276    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Mark product out of stock', 'STOCK_MARK_PRODUCT_OUT_OF_STOCK', '***', 'Display something on screen so customer can see which product has insufficient stock', '9', '4', now())");
 277    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Stock Re-order level', 'STOCK_REORDER_LEVEL', '5', 'Define when stock needs to be re-ordered', '9', '5', now())");
 278    
 279    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Store Page Parse Time', 'STORE_PAGE_PARSE_TIME', 'false', 'Store the time it takes to parse a page', '10', '1', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 280    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Log Destination', 'STORE_PAGE_PARSE_TIME_LOG', '/var/log/www/tep/page_parse_time.log', 'Directory and filename of the page parse time log', '10', '2', now())");
 281    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Log Date Format', 'STORE_PARSE_DATE_TIME_FORMAT', '%d/%m/%Y %H:%M:%S', 'The date format', '10', '3', now())");
 282    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display The Page Parse Time', 'DISPLAY_PAGE_PARSE_TIME', 'true', 'Display the page parse time (store page parse time must be enabled)', '10', '4', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 283    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Store Database Queries', 'STORE_DB_TRANSACTIONS', 'false', 'Store the database queries in the page parse time log (PHP4 only)', '10', '5', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 284  
 285    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Use Cache', 'USE_CACHE', 'false', 'Use caching features', '11', '1', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 286    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Cache Directory', 'DIR_FS_CACHE', '/tmp/', 'The directory where the cached files are saved', '11', '2', now())");
 287  
 288    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('E-Mail Transport Method', 'EMAIL_TRANSPORT', 'sendmail', 'Defines if this server uses a local connection to sendmail or uses an SMTP connection via TCP/IP. Servers running ong Windows or MacOS should change this setting to SMTP.', '12', '1', 'tep_cfg_select_option(array(\'sendmail\', \'smtp\'), ', now())");
 289    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('E-Mail Linefeeds', 'EMAIL_LINEFEED', 'LF', 'Defines the character sequence used to separate mail headers. When using sendmail use LF, when using smtp use CRLF.', '12', '2', 'tep_cfg_select_option(array(\'LF\', \'CRLF\'), ', now())");
 290    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Use MIME HTML When Sending E-Mails', 'EMAIL_USE_HTML', 'false', 'Send e-mails in HTML format', '12', '3', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 291    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Verfiy E-Mail Addresses Through DNS', 'ENTRY_EMAIL_ADDRESS_CHECK', 'false', 'Verfiy e-mail address through a DNS server', '12', '4', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 292    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Send E-Mails', 'SEND_EMAILS', 'true', 'Send out e-mails', '12', '5', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 293  
 294    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('enable download', 'download_enabled', 'false', 'enable the products download functions.', '13', '1', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 295    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('download by redirect', 'download_by_redirect', 'false', 'use browser redirection for download. disable on non-unix systems.', '13', '2', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 296    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('expiry delay (days)' ,'download_max_days', '7', 'set number of days before the download link expires. 0 means no limit.', '13', '3', '', now())");
 297    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('maximum number of downloads' ,'download_max_count', '5', 'set the maximum number of downloads. 0 means no download authorized.', '13', '4', '', now())");
 298  
 299    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable GZip Compression', 'GZIP_COMPRESSION', 'false', 'Enable HTTP GZip compression.', '14', '1', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
 300    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Compression Level', 'GZIP_LEVEL', '5', 'Use this compression level 0-9 (0 = minimum, 9 = maximum).', '14', '2', now())");
 301  
 302    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Session Directory', 'SESSION_WRITE_DIRECTORY', '/tmp', 'If sessions are file based, store them in this directory.', '15', '1', now())");
 303    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Force Cookie Use', 'SESSION_FORCE_COOKIE_USE', 'False', 'Force the use of sessions when cookies are only enabled.', '15', '2', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 304    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check SSL Session ID', 'SESSION_CHECK_SSL_SESSION_ID', 'False', 'Validate the SSL_SESSION_ID on every secure HTTPS page request.', '15', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 305    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check User Agent', 'SESSION_CHECK_USER_AGENT', 'False', 'Validate the clients browser user agent on every page request.', '15', '4', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 306    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check IP Address', 'SESSION_CHECK_IP_ADDRESS', 'False', 'Validate the clients IP address on every page request.', '15', '5', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 307    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Prevent Spider Sessions', 'SESSION_BLOCK_SPIDERS', 'False', 'Prevent known spiders from starting a session.', '15', '6', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 308    osc_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Recreate Session', 'SESSION_RECREATE', 'False', 'Recreate the session to generate a new session ID when the customer logs on or creates an account (PHP >=4.1 needed).', '15', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 309  
 310    osc_db_query("delete from configuration_group");
 311  
 312    osc_db_query("alter table configuration_group add visible int(1) default '1'");
 313  
 314    osc_db_query("insert into configuration_group values ('1', 'My Store', 'General information about my store', '1', '1')");
 315    osc_db_query("insert into configuration_group values ('2', 'Minimum Values', 'The minimum values for functions / data', '2', '1')");
 316    osc_db_query("insert into configuration_group values ('3', 'Maximum Values', 'The maximum values for functions / data', '3', '1')");
 317    osc_db_query("insert into configuration_group values ('4', 'Images', 'Image parameters', '4', '1')");
 318    osc_db_query("insert into configuration_group values ('6', 'Module Options', 'Hidden from configuration', '6', '0')");
 319    osc_db_query("insert into configuration_group values ('5', 'Customer Details', 'Customer account configuration', '5', '1')");
 320    osc_db_query("insert into configuration_group values ('7', 'Shipping/Packaging', 'Shipping options available at my store', '7', '1')");
 321    osc_db_query("insert into configuration_group values ('8', 'Product Listing', 'Product Listing    configuration options', '8', '1')");
 322    osc_db_query("insert into configuration_group values ('9', 'Stock', 'Stock configuration options', '9', '1')");
 323    osc_db_query("insert into configuration_group values ('10', 'Logging', 'Logging configuration options', '10', '1')");
 324    osc_db_query("insert into configuration_group values ('11', 'Cache', 'Caching configuration options', '11', '1')");
 325    osc_db_query("insert into configuration_group values ('12', 'E-Mail Options', 'General setting for E-Mail transport and HTML E-Mails', '12', '1')");
 326    osc_db_query("insert into configuration_group values ('13', 'Download', 'Downloadable products options', '13', '1')");
 327    osc_db_query("insert into configuration_group values ('14', 'GZip Compression', 'GZip compression options', '14', '1')");
 328    osc_db_query("insert into configuration_group values ('15', 'Sessions', 'Session options', '15', '1')");
 329  
 330  ?>
 331  
 332  <script language="javascript"><!--
 333  changeStyle('configuration', 'normal');
 334  changeText('configurationMarker', '*');
 335  changeText('statusText', 'Updating Configuration .. done!');
 336  
 337  changeStyle('currencies', 'bold');
 338  changeText('currenciesMarker', '?');
 339  changeText('statusText', 'Updating Currencies');
 340  //--></script>
 341  
 342  <?php
 343    flush();
 344  
 345    osc_db_query("alter table currencies add value float(13,8)");
 346    osc_db_query("alter table currencies add last_updated datetime");
 347  
 348    osc_db_query("update currencies set value = '1'");
 349  ?>
 350  
 351  <script language="javascript"><!--
 352  changeStyle('currencies', 'normal');
 353  changeText('currenciesMarker', '*');
 354  changeText('statusText', 'Updating Currencies .. done!');
 355  
 356  changeStyle('customers', 'bold');
 357  changeText('customersMarker', '?');
 358  changeText('statusText', 'Updating Customers');
 359  //--></script>
 360  
 361  <?php
 362    flush();
 363  
 364    osc_db_query("alter table customers drop customers_street_address");
 365    osc_db_query("alter table customers drop customers_suburb");
 366    osc_db_query("alter table customers drop customers_postcode");
 367    osc_db_query("alter table customers drop customers_city");
 368    osc_db_query("alter table customers drop customers_state");
 369    osc_db_query("alter table customers drop customers_zone_id");
 370    osc_db_query("alter table customers drop customers_country_id");
 371    osc_db_query("alter table customers change customers_dob customers_dob datetime not null default '0000-00-00 00:00:00'");
 372    osc_db_query("alter table customers add customers_newsletter char(1)");
 373  
 374    osc_db_query("alter table customers_basket change products_id products_id tinytext not null");
 375    osc_db_query("alter table customers_basket change customers_basket_date_added customers_basket_date_added varchar(8)");
 376    osc_db_query("alter table customers_basket change final_price final_price decimal(15,4) not null");
 377  
 378    osc_db_query("alter table customers_basket_attributes change products_id products_id tinytext not null");
 379  
 380    osc_db_query("alter table customers_info change customers_info_date_account_created customers_info_date_account_created datetime");
 381    osc_db_query("alter table customers_info change customers_info_date_of_last_logon customers_info_date_of_last_logon datetime");
 382    osc_db_query("alter table customers_info change customers_info_date_account_last_modified customers_info_date_account_last_modified datetime");
 383    osc_db_query("alter table customers_info add global_product_notifications int(1) default '0'");
 384  
 385    osc_db_query("create table newsletters ( newsletters_id int(5) not null auto_increment, title varchar(255) not null, content text not null, module varchar(255) not null, date_added datetime not null, date_sent datetime, status int(1), locked int(1) default '0', primary key (newsletters_id))");
 386  ?>
 387  
 388  <script language="javascript"><!--
 389  changeStyle('customers', 'normal');
 390  changeText('customersMarker', '*');
 391  changeText('statusText', 'Updating Customers .. done!');
 392  
 393  changeStyle('images', 'bold');
 394  changeText('imagesMarker', '?');
 395  changeText('statusText', 'Updating Images');
 396  //--></script>
 397  
 398  <?php
 399    flush();
 400  
 401  // categories
 402    $categories_query = osc_db_query("select categories_id, categories_image from categories where left(categories_image, 7) = 'images/'");
 403    while ($categories = osc_db_fetch_array($categories_query)) {
 404      osc_db_query("update categories set categories_image = substring('" . $categories['categories_image'] . "', 8) where categories_id = '" . $categories['categories_id'] . "'");
 405    }
 406  
 407  // manufacturers
 408    $manufacturers_query = osc_db_query("select manufacturers_id, manufacturers_image from manufacturers where left(manufacturers_image, 7) = 'images/'");
 409    while ($manufacturers = osc_db_fetch_array($manufacturers_query)) {
 410      osc_db_query("update manufacturers set manufacturers_image = substring('" . $manufacturers['manufacturers_image'] . "', 8) where manufacturers_id = '" . $manufacturers['manufacturers_id'] . "'");
 411    }
 412  
 413  // products
 414    $products_query = osc_db_query("select products_id, products_image from products where left(products_image, 7) = 'images/'");
 415    while ($products = osc_db_fetch_array($products_query)) {
 416      osc_db_query("update products set products_image = substring('" . $products['products_image'] . "', 8) where products_id = '" . $products['products_id'] . "'");
 417    }
 418  ?>
 419  
 420  <script language="javascript"><!--
 421  changeStyle('images', 'normal');
 422  changeText('imagesMarker', '*');
 423  changeText('statusText', 'Updating Images .. done!');
 424  
 425  changeStyle('languages', 'bold');
 426  changeText('languagesMarker', '?');
 427  changeText('statusText', 'Updating Languages');
 428  //--></script>
 429  
 430  <?php
 431    flush();
 432  
 433    osc_db_query("update languages set image = 'icon.gif'");
 434  ?>
 435  
 436  <script language="javascript"><!--
 437  changeStyle('languages', 'normal');
 438  changeText('languagesMarker', '*');
 439  changeText('statusText', 'Updating Languages .. done!');
 440  
 441  changeStyle('manufacturers', 'bold');
 442  changeText('manufacturersMarker', '?');
 443  changeText('statusText', 'Updating Manufacturers');
 444  //--></script>
 445  
 446  <?php
 447    flush();
 448  
 449    osc_db_query("alter table manufacturers add date_added datetime null after manufacturers_image, add last_modified datetime null after date_added");
 450    osc_db_query("create table manufacturers_info (manufacturers_id int(5) not null, languages_id int(5) not null, manufacturers_url varchar(255) not null, url_clicked int(5) not null default '0', date_last_click datetime, primary key (manufacturers_id, languages_id))");
 451  ?>
 452  
 453  <script language="javascript"><!--
 454  changeStyle('manufacturers', 'normal');
 455  changeText('manufacturersMarker', '*');
 456  changeText('statusText', 'Updating Manufacturers .. done!');
 457  
 458  changeStyle('orders', 'bold');
 459  changeText('ordersMarker', '?');
 460  changeText('statusText', 'Updating Orders');
 461  //--></script>
 462  
 463  <?php
 464    flush();
 465  
 466    osc_db_query("alter table orders add customers_company varchar(32) after customers_name");
 467    osc_db_query("alter table orders add delivery_company varchar(32) after delivery_name");
 468    osc_db_query("alter table orders add billing_name varchar(64) not null after delivery_address_format_id");
 469    osc_db_query("alter table orders add billing_company varchar(32) after billing_name");
 470    osc_db_query("alter table orders add billing_street_address varchar(64) not null after billing_company");
 471    osc_db_query("alter table orders add billing_suburb varchar(32) after billing_street_address");
 472    osc_db_query("alter table orders add billing_city varchar(32) not null after billing_suburb");
 473    osc_db_query("alter table orders add billing_postcode varchar(10) not null after billing_city");
 474    osc_db_query("alter table orders add billing_state varchar(32) after billing_postcode");
 475    osc_db_query("alter table orders add billing_country varchar(32) not null after billing_state");
 476    osc_db_query("alter table orders add billing_address_format_id int(5) not null after billing_country");
 477    osc_db_query("alter table orders change payment_method payment_method varchar(32) not null");
 478    osc_db_query("alter table orders change date_purchased date_purchased datetime");
 479    osc_db_query("alter table orders change last_modified last_modified datetime");
 480    osc_db_query("alter table orders change orders_date_finished orders_date_finished datetime");
 481    osc_db_query("alter table orders_products add column products_model varchar(12)");
 482    osc_db_query("alter table orders_products change products_price products_price decimal(15,4) not null");
 483    osc_db_query("alter table orders_products change final_price final_price decimal(15,4) not null");
 484    osc_db_query("alter table orders_products_attributes change options_values_price options_values_price decimal(15,4) not null");
 485  
 486    osc_db_query("create table orders_status ( orders_status_id int(5) default '0' not null, language_id int(5) default '1' not null, orders_status_name varchar(32) not null, primary key (orders_status_id, language_id), key idx_orders_status_name (orders_status_name))");
 487  
 488    for ($i=0; $i<sizeof($languages); $i++) {
 489      osc_db_query("insert into orders_status values ('1', '" . $languages[$i]['id'] . "', 'Pending')");
 490      osc_db_query("insert into orders_status values ('2', '" . $languages[$i]['id'] . "', 'Processing')");
 491      osc_db_query("insert into orders_status values ('3', '" . $languages[$i]['id'] . "', 'Delivered')");
 492    }
 493  
 494    osc_db_query("update orders set orders_status = '1' where orders_status = 'Pending'");
 495    osc_db_query("update orders set orders_status = '2' where orders_status = 'Processing'");
 496    osc_db_query("update orders set orders_status = '3' where orders_status = 'Delivered'");
 497  
 498    $status = array();
 499    $orders_status_query = osc_db_query("select distinct orders_status from orders where orders_status not in ('1', '2', '3')");
 500    while ($orders_status = osc_db_fetch_array($orders_status_query)) {
 501      $status[] = array('text' => $orders_status['orders_status']);
 502    }
 503  
 504    $orders_status_id = 4;
 505    for ($i=0; $i<sizeof($status); $i++) {
 506      for ($j=0; $j<sizeof($languages); $j++) {
 507        osc_db_query("insert into orders_status values ('" . $orders_status_id . "', '" . $languages[$j]['id'] . "', '" . $status[$i]['text'] . "')");
 508      }
 509      osc_db_query("update orders set orders_status = '" . $orders_status_id . "' where orders_status = '" . $status[$i]['text'] . "'");
 510      $orders_status_id++;
 511    }
 512  
 513    osc_db_query("alter table orders change orders_status orders_status int(5) not null");
 514  
 515    osc_db_query("create table orders_status_history ( orders_status_history_id int(5) not null auto_increment, orders_id int(5) not null, orders_status_id int(5) not null, date_added datetime not null, customer_notified int(1) default '0', comments text, primary key (orders_status_history_id))");
 516  
 517    $orders_query = osc_db_query("select orders_id, date_purchased, comments from orders where comments <> ''");
 518    while ($order = osc_db_fetch_array($orders_query)) {
 519      osc_db_query("insert into orders_status_history (orders_id, orders_status_id, date_added, comments) values ('" . $order['orders_id'] . "', '1', '" . $order['date_purchased'] . "', '" . $order['comments'] . "')");
 520    }
 521    osc_db_query("alter table orders drop comments");
 522  
 523    $orders_products_query = osc_db_query("select op.orders_products_id, opa.orders_products_attributes_id, op.products_id from orders_products op, orders_products_attributes opa where op.orders_id = opa.orders_id");
 524    while ($orders_products = osc_db_fetch_array($orders_products_query)) {
 525      osc_db_query("update orders_products_attributes set orders_products_id = '" . $orders_products['orders_products_id'] . "' where orders_products_attributes_id = '" . $orders_products['orders_products_attributes_id'] . "' and orders_products_id = '" . $orders_products['products_id'] . "'");
 526    }
 527  
 528    osc_db_query("create table orders_products_download ( orders_products_download_id int(5) not null auto_increment, orders_id int(5) not null default '0', orders_products_id int(5) not null default '0', orders_products_filename varchar(255) not null, download_maxdays int(2) not null default '0', download_count int(2) not null default '0', primary key (orders_products_download_id))");
 529  
 530    osc_db_query("create table orders_total ( orders_total_id int unsigned not null auto_increment, orders_id int not null, title varchar(255) not null, text varchar(255) not null, value decimal(15,4) not null, class varchar(32) not null, sort_order int not null, primary key (orders_total_id), key idx_orders_total_orders_id (orders_id))");
 531  
 532    $i = 0;
 533    $orders_query = osc_db_query("select orders_id, shipping_method, shipping_cost, currency, currency_value from orders");
 534    while ($orders = osc_db_fetch_array($orders_query)) {
 535      $o = array();
 536      $total_cost = 0;
 537  
 538      $o['id'] = $orders['orders_id'];
 539      $o['shipping_method'] = $orders['shipping_method'];
 540      $o['shipping_cost'] = $orders['shipping_cost'];
 541      $o['currency'] = $orders['currency'];
 542      $o['currency_value'] = $orders['currency_value'];
 543      $o['tax'] = 0;
 544  
 545      $orders_products_query = osc_db_query("select final_price, products_tax, products_quantity from orders_products where orders_id = '" . $orders['orders_id'] . "'");
 546      while ($orders_products = osc_db_fetch_array($orders_products_query)) {
 547        $o['products'][$i]['final_price'] = $orders_products['final_price'];
 548        $o['products'][$i]['qty'] = $orders_products['products_quantity'];
 549  
 550        $o['products'][$i]['tax_groups']["{$orders_products['products_tax']}"] += $orders_products['products_tax']/100 * ($orders_products['final_price'] * $orders_products['products_quantity']);
 551        $o['tax'] += $orders_products['products_tax']/100 * ($orders_products['final_price'] * $orders_products['products_quantity']);
 552  
 553        $total_cost += ($o['products'][$i]['final_price'] * $o['products'][$i]['qty']);
 554      }
 555  
 556      $subtotal_text = osc_currency_format($total_cost, true, $o['currency'], $o['currency_value']);
 557      $subtotal_value = $total_cost;
 558  
 559      osc_db_query("insert into orders_total (orders_total_id, orders_id, title, text, value, class, sort_order) values ('', '" . $o['id'] . "', 'Sub-Total:', '" . $subtotal_text . "', '" . $subtotal_value . "', 'ot_subtotal', '1')");
 560  
 561      $tax_text = osc_currency_format($o['tax'], true, $o['currency'], $o['currency_value']);
 562      $tax_value = $o['tax'];
 563      osc_db_query("insert into orders_total (orders_total_id, orders_id, title, text, value, class, sort_order) values ('', '" . $o['id'] . "', 'Tax:', '" . $tax_text . "', '" . $tax_value . "', 'ot_tax', '2')");
 564  
 565      if (strlen($o['shipping_method']) < 1) {
 566        $o['shipping_method'] = 'Shipping:';
 567      } else {
 568        $o['shipping_method'] .= ':';
 569      }
 570  
 571      if ($o['shipping_cost'] > 0) {
 572        $shipping_text = osc_currency_format($o['shipping_cost'], true, $o['currency'], $o['currency_value']);
 573        $shipping_value = $o['shipping_cost'];
 574        osc_db_query("insert into orders_total (orders_total_id, orders_id, title, text, value, class, sort_order) values ('', '" . $o['id'] . "', '" . $o['shipping_method'] . "', '" . $shipping_text . "', '" . $shipping_value . "', 'ot_shipping', '3')");
 575      }
 576  
 577      $total_text = osc_currency_format($total_cost + $o['tax'] + $o['shipping_cost'], true, $o['currency'], $o['currency_value']);
 578      $total_value = $total_cost + $o['tax'] + $o['shipping_cost'];
 579      osc_db_query("insert into orders_total (orders_total_id, orders_id, title, text, value, class, sort_order) values ('', '" . $o['id'] . "', 'Total:', '" . $total_text . "', '" . $total_value . "', 'ot_total', '4')");
 580  
 581      $i++;
 582    }
 583  
 584    osc_db_query("alter table orders drop shipping_method");
 585    osc_db_query("alter table orders drop shipping_cost");
 586  ?>
 587  
 588  <script language="javascript"><!--
 589  changeStyle('orders', 'normal');
 590  changeText('ordersMarker', '*');
 591  changeText('statusText', 'Updating Orders .. done!');
 592  
 593  changeStyle('products', 'bold');
 594  changeText('productsMarker', '?');
 595  changeText('statusText', 'Updating Products');
 596  //--></script>
 597  
 598  <?php
 599    flush();
 600  
 601    osc_db_query("create table products_description ( products_id int(5) not null auto_increment, language_id int(5) not null default '1', products_name varchar(64) not null default '',  products_description text, products_url varchar(255), products_viewed int(5) default '0', primary key (products_id, language_id), key products_name (products_name))");
 602  
 603    $products_query = osc_db_query("select products_id, products_name, products_description, products_url, products_viewed from products order by products_id");
 604    while ($products = osc_db_fetch_array($products_query)) {
 605      for ($i=0; $i<sizeof($languages); $i++) {
 606        osc_db_query("insert into products_description (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . $products['products_id'] . "', '" . $languages[$i]['id'] . "', '" . addslashes($products['products_name']) . "', '" . addslashes($products['products_description']) . "', '" . addslashes($products['products_url']) . "', '" . $products['products_viewed'] . "')");
 607      }
 608    }
 609  
 610    osc_db_query("update products set products_date_added = now() where products_date_added is null");
 611    osc_db_query("alter table products change products_date_added products_date_added datetime not null");
 612    osc_db_query("alter table products change products_price products_price decimal(15,4) not null");
 613    osc_db_query("alter table products add index idx_products_date_added (products_date_added)");
 614  
 615    osc_db_query("alter table products drop index products_name");
 616  
 617    osc_db_query("alter table products drop products_url");
 618    osc_db_query("alter table products drop products_name");
 619    osc_db_query("alter table products drop products_description");
 620    osc_db_query("alter table products drop products_viewed");
 621  
 622    osc_db_query("alter table products add products_date_available datetime");
 623    osc_db_query("alter table products add products_last_modified datetime");
 624  
 625    osc_db_query("alter table products add products_ordered int default '0' not null");
 626  
 627    $products_query = osc_db_query("select products_id, sum(products_quantity) as products_ordered from orders_products group by products_id");
 628    while ($products = osc_db_fetch_array($products_query)) {
 629      osc_db_query("update products set products_ordered = '" . $products['products_ordered'] . "' where products_id = '" . $products['products_id'] . "'");
 630    }
 631  
 632    osc_db_query("drop table products_expected");
 633  
 634    osc_db_query("alter table products_attributes change options_values_price options_values_price decimal(15,4) not null");
 635  
 636    osc_db_query("alter table products_options change products_options_id products_options_id int(5) not null default '0'");
 637    osc_db_query("alter table products_options add language_id int(5) not null default '1' after products_options_id");
 638    osc_db_query("alter table products_options drop primary key");
 639    osc_db_query("alter table products_options add primary key (products_options_id, language_id)");
 640  
 641    $products_query = osc_db_query("select products_options_id, language_id, products_options_name from products_options order by products_options_id");
 642    while ($products = osc_db_fetch_array($products_query)) {
 643      for ($i=0; $i<sizeof($languages); $i++) {
 644        osc_db_query("replace into products_options (products_options_id, language_id, products_options_name) values ('" . $products['products_options_id'] . "', '" . $languages[$i]['id'] . "', '" . addslashes($products['products_options_name']) . "')");
 645      }
 646    }
 647  
 648    osc_db_query("alter table products_options_values change products_options_values_id products_options_values_id int(5) not null default '0'");
 649    osc_db_query("alter table products_options_values add language_id int(5) not null default '1' after products_options_values_id");
 650    osc_db_query("alter table products_options_values drop primary key");
 651    osc_db_query("alter table products_options_values add primary key (products_options_values_id, language_id)");
 652  
 653    $products_query = osc_db_query("select products_options_values_id, language_id, products_options_values_name from products_options_values order by products_options_values_id");
 654    while ($products = osc_db_fetch_array($products_query)) {
 655      for ($i=0; $i<sizeof($languages); $i++) {
 656        osc_db_query("replace into products_options_values (products_options_values_id, language_id, products_options_values_name) values ('" . $products['products_options_values_id'] . "', '" . $languages[$i]['id'] . "', '" . addslashes($products['products_options_values_name']) . "')");
 657      }
 658    }
 659  
 660    osc_db_query("alter table products_to_categories change products_id products_id int(5) not null");
 661  
 662    osc_db_query("create table products_attributes_download ( products_attributes_id int(5) not null, products_attributes_filename varchar(255) not null, products_attributes_maxdays int(2) default '0', products_attributes_maxcount int(2) default '0', primary key (products_attributes_id))");
 663  
 664    osc_db_query("create table products_notifications ( products_id int(5) not null, customers_id int(5) not null, date_added datetime not null, primary key (products_id, customers_id))");
 665  ?>
 666  
 667  <script language="javascript"><!--
 668  changeStyle('products', 'normal');
 669  changeText('productsMarker', '*');
 670  changeText('statusText', 'Updating Products .. done!');
 671  
 672  changeStyle('reviews', 'bold');
 673  changeText('reviewsMarker', '?');
 674  changeText('statusText', 'Updating Reviews');
 675  //--></script>
 676  
 677  <?php
 678    flush();
 679  
 680    osc_db_query("create table reviews_description ( reviews_id int(5) not null, languages_id int(5) not null, reviews_text text not null, primary key (reviews_id, languages_id))");
 681  
 682    osc_db_query("alter table reviews add products_id int(5) not null default '0' after reviews_id");
 683    osc_db_query("alter table reviews add customers_id int(5) after products_id");
 684    osc_db_query("alter table reviews add customers_name varchar(64) not null default '' after customers_id");
 685    osc_db_query("alter table reviews add date_added datetime after reviews_rating");
 686    osc_db_query("alter table reviews add last_modified datetime after date_added");
 687    osc_db_query("alter table reviews add reviews_read int(5) not null default '0'");
 688  
 689    $reviews_query = osc_db_query("select r.reviews_id, re.products_id, re.customers_id, r.reviews_rating, re.date_added, re.reviews_read, r.reviews_text from reviews r, reviews_extra re where r.reviews_id = re.reviews_id order by r.reviews_id");
 690    while ($reviews = osc_db_fetch_array($reviews_query)) {
 691      $customer_query = osc_db_query("select customers_firstname, customers_lastname from customers where customers_id = '" . $reviews['customers_id'] . "'");
 692      if (osc_db_num_rows($customer_query)) {
 693        $customer = osc_db_fetch_array($customer_query);
 694        $customers_name = $customer['customers_firstname'] . ' ' . $customer['customers_lastname'];
 695      } else {
 696        $customers_name = '';
 697      }
 698  
 699      osc_db_query("update reviews set products_id = '" . $reviews['products_id'] . "', customers_id = '" . $reviews['customers_id'] . "', customers_name = '" . addslashes($customers_name) . "', date_added = '" . $reviews['date_added'] . "', last_modified = '', reviews_read = '" . $reviews['reviews_read'] . "' where reviews_id = '" . $reviews['reviews_id'] . "'");
 700      osc_db_query("insert into reviews_description (reviews_id, languages_id, reviews_text) values ('" . $reviews['reviews_id'] . "', '" . $languages[0]['id'] . "', '" . addslashes($reviews['reviews_text']) . "')");
 701    }
 702  
 703    osc_db_query("alter table reviews drop reviews_text");
 704  
 705    osc_db_query("drop table reviews_extra");
 706  ?>
 707  
 708  <script language="javascript"><!--
 709  changeStyle('reviews', 'normal');
 710  changeText('reviewsMarker', '*');
 711  changeText('statusText', 'Updating Reviews .. done!');
 712  
 713  changeStyle('sessions', 'bold');
 714  changeText('sessionsMarker', '?');
 715  changeText('statusText', 'Updating Sessions');
 716  //--></script>
 717  
 718  <?php
 719    flush();
 720  
 721    osc_db_query("create table sessions (sesskey varchar(32) not null, expiry int(11) unsigned not null, value text not null, primary key (sesskey))");
 722  ?>
 723  
 724  <script language="javascript"><!--
 725  changeStyle('sessions', 'normal');
 726  changeText('sessionsMarker', '*');
 727  changeText('statusText', 'Updating Sessions .. done!');
 728  
 729  changeStyle('specials', 'bold');
 730  changeText('specialsMarker', '?');
 731  changeText('statusText', 'Updating Specials');
 732  //--></script>
 733  
 734  <?php
 735    flush();
 736  
 737    osc_db_query("alter table specials change specials_date_added specials_date_added datetime");
 738    osc_db_query("alter table specials change specials_new_products_price specials_new_products_price decimal(15,4) not null");
 739  
 740    osc_db_query("alter table specials add specials_last_modified datetime");
 741    osc_db_query("alter table specials add expires_date datetime");
 742    osc_db_query("alter table specials add date_status_change datetime");
 743    osc_db_query("alter table specials add status int(1) NOT NuLL default '1'");
 744  ?>
 745  
 746  <script language="javascript"><!--
 747  changeStyle('specials', 'normal');
 748  changeText('specialsMarker', '*');
 749  changeText('statusText', 'Updating Specials .. done!');
 750  
 751  changeStyle('taxes', 'bold');
 752  changeText('taxesMarker', '?');
 753  changeText('statusText', 'Updating Taxes');
 754  //--></script>
 755  
 756  <?php
 757    flush();
 758  
 759    osc_db_query("alter table tax_class change date_added date_added datetime not null");
 760    osc_db_query("alter table tax_class change last_modified last_modified datetime");
 761  
 762    osc_db_query("alter table tax_rates change date_added date_added datetime not null");
 763    osc_db_query("alter table tax_rates change last_modified last_modified datetime");
 764  
 765    osc_db_query("alter table tax_rates add tax_priority int(5) default '1' after tax_class_id");
 766  
 767    osc_db_query("create table geo_zones (geo_zone_id int(5) not null auto_increment, geo_zone_name varchar(32) not null, geo_zone_description varchar(255) not null, last_modified datetime, date_added datetime not null, primary key (geo_zone_id))");
 768    osc_db_query("create table zones_to_geo_zones (association_id int(5) not null auto_increment, zone_country_id int(5) not null, zone_id int(5), geo_zone_id int(5), last_modified datetime, date_added datetime not null, primary key (association_id))");
 769  
 770    osc_db_query("alter table zones change zone_code zone_code varchar(32) not null");
 771  
 772    osc_db_query("INSERT INTO geo_zones (geo_zone_id,geo_zone_name,geo_zone_description,last_modified,date_added) SELECT tr.tax_zone_id,zone_name,zone_name,NULL,now() from tax_rates tr,zones z,countries c WHERE tr.tax_zone_id=z.zone_id AND c.countries_id=z.zone_country_id GROUP BY tr.tax_zone_id");
 773  
 774    osc_db_query("INSERT INTO zones_to_geo_zones (zone_country_id,zone_id,geo_zone_id,date_added) SELECT z.zone_country_id, z.zone_id,tr.tax_zone_id,now() FROM tax_rates tr, zones z WHERE z.zone_id=tr.tax_zone_id GROUP BY tr.tax_zone_id");
 775  ?>
 776  
 777  <script language="javascript"><!--
 778  changeStyle('taxes', 'normal');
 779  changeText('taxesMarker', '*');
 780  changeText('statusText', 'Updating Taxes .. done!');
 781  
 782  changeStyle('whosOnline', 'bold');
 783  changeText('whosOnlineMarker', '?');
 784  changeText('statusText', 'Updating Whos Online');
 785  //--></script>
 786  
 787  <?php
 788    flush();
 789  
 790    osc_db_query("create table whos_online (customer_id int(5),  full_name varchar(64) not null, session_id varchar(128) not null, ip_address varchar(15) not null, time_entry varchar(14) not null, time_last_click varchar(14) not null, last_page_url varchar(64) not null)");
 791  ?>
 792  
 793  <script language="javascript"><!--
 794  changeStyle('whosOnline', 'normal');
 795  changeText('whosOnlineMarker', '*');
 796  changeText('statusText', 'Updating Whos Online .. done!');
 797  
 798  changeStyle('statusText', 'bold');
 799  changeText('statusText', 'Update Complete!');
 800  //--></script>
 801  
 802  <?php flush(); ?>
 803  
 804  <p>The database upgrade procedure was successful!</p>


Généré le : Mon Nov 26 19:48:25 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics