[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/zc_install/includes/modules/pages/store_setup/ -> header_php.php (source)

   1  <?php
   2  /**

   3   * @package Installer

   4   * @access private

   5   * @copyright Copyright 2003-2006 Zen Cart Development Team

   6   * @copyright Portions Copyright 2003 osCommerce

   7   * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

   8   * @version $Id: header_php.php 5369 2006-12-23 10:55:52Z drbyte $

   9   */
  10  
  11  if (!isset($_GET['debug'])  && !zen_not_null($_POST['debug']))  define('ZC_UPG_DEBUG',false);
  12  if (!isset($_GET['debug2']) && !zen_not_null($_POST['debug2'])) define('ZC_UPG_DEBUG2',false);
  13  if (!isset($_GET['debug3']) && !zen_not_null($_POST['debug3'])) define('ZC_UPG_DEBUG3',false);
  14  
  15    $zc_install->error = false;
  16  
  17    if (!isset($_POST['store_name'])) $_POST['store_name'] = '';
  18    if (!isset($_POST['store_owner'])) $_POST['store_owner'] = '';
  19    if (!isset($_POST['store_owner_email'])) $_POST['store_owner_email'] = '';
  20    if (!isset($_POST['store_country'])) $_POST['store_country'] = '223';
  21    if (!isset($_POST['store_zone'])) $_POST['store_zone'] = '';
  22    if (!isset($_POST['store_address'])) $_POST['store_address'] = STORE_ADDRESS_DEFAULT_VALUE;
  23    if (!isset($_POST['store_default_language'])) $_POST['store_default_language'] = '';
  24    if (!isset($_POST['store_default_currency'])) $_POST['store_default_currency'] = '';
  25  
  26    require('../includes/configure.php');
  27    if (!defined('DB_TYPE') || DB_TYPE=='') {
  28      echo('Database Type Invalid. Did your configure.php file get written correctly?');
  29      $zc_install->setError('Database Type Invalid', 27);
  30    }
  31  
  32    require('../includes/classes/db/' . DB_TYPE . '/query_factory.php');
  33    $db = new queryFactory;
  34    $db->Connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE) or die("Unable to connect to database");
  35  
  36  
  37    if (isset($_POST['submit'])) {
  38      $store_name = zen_db_prepare_input($_POST['store_name']);
  39      $store_owner = zen_db_prepare_input($_POST['store_owner']);
  40      $store_owner_email = zen_db_prepare_input($_POST['store_owner_email']);
  41      $store_country = zen_db_prepare_input($_POST['store_country']);
  42      $store_zone = zen_db_prepare_input($_POST['store_zone']);
  43      $store_address = zen_db_prepare_input($_POST['store_address']);
  44      $store_default_language = zen_db_prepare_input($_POST['store_default_language']);
  45      $store_default_currency = zen_db_prepare_input($_POST['store_default_currency']);
  46  
  47      $zc_install->isEmpty($store_name, ERROR_TEXT_STORE_NAME_ISEMPTY, ERROR_CODE_STORE_NAME_ISEMPTY);
  48      $zc_install->isEmpty($store_owner, ERROR_TEXT_STORE_OWNER_ISEMPTY, ERROR_CODE_STORE_OWNER_ISEMPTY);
  49      $zc_install->isEmpty($store_owner_email, ERROR_TEXT_STORE_OWNER_EMAIL_ISEMPTY, ERROR_CODE_STORE_OWNER_EMAIL_ISEMPTY);
  50      $zc_install->isEmail($store_owner_email, ERROR_TEXT_STORE_OWNER_EMAIL_NOTEMAIL, ERROR_CODE_STORE_OWNER_EMAIL_NOTEMAIL);
  51      $zc_install->isEmpty($store_address, ERROR_TEXT_STORE_ADDRESS_ISEMPTY, ERROR_CODE_STORE_ADDRESS_ISEMPTY);
  52      if ($_POST['demo_install'] == 'true') {
  53        $zc_install->fileExists('demo/' . DB_TYPE . '_demo.sql', ERROR_TEXT_DEMO_SQL_NOTEXIST, ERROR_CODE_DEMO_SQL_NOTEXIST);
  54      }
  55  
  56      if ($zc_install->error == false) {
  57        if ($_POST['demo_install'] == 'true') {
  58          executeSql('demo/' . DB_TYPE . '_demo.sql', DB_DATABASE, DB_PREFIX);
  59        }
  60  
  61        $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_name) . "' where configuration_key = 'STORE_NAME'";
  62        $db->Execute($sql);
  63        $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_owner) . "' where configuration_key = 'STORE_OWNER'";
  64        $db->Execute($sql);
  65        $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_owner_email) . "' where configuration_key in 
  66               ('STORE_OWNER_EMAIL_ADDRESS', 'EMAIL_FROM', 'SEND_EXTRA_ORDER_EMAILS_TO', 'SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO', 'SEND_EXTRA_LOW_STOCK_EMAILS_TO', 'SEND_EXTRA_GV_CUSTOMER_EMAILS_TO', 'SEND_EXTRA_GV_ADMIN_EMAILS_TO', 'SEND_EXTRA_DISCOUNT_COUPON_ADMIN_EMAILS_TO', 'SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO', 'SEND_EXTRA_TELL_A_FRIEND_EMAILS_TO', 'SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO', 'MODULE_PAYMENT_CC_EMAIL')";
  67        $db->Execute($sql);
  68        $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_country) . "' where configuration_key = 'STORE_COUNTRY'";
  69        $db->Execute($sql);
  70        $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_zone) . "' where configuration_key = 'STORE_ZONE'";
  71        $db->Execute($sql);
  72        $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_address) . "' where configuration_key = 'STORE_NAME_ADDRESS'";
  73        $db->Execute($sql);
  74        $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_default_language) . "' where configuration_key = 'DEFAULT_LANGUAGE'";
  75        $db->Execute($sql);
  76        $sql = "update " . DB_PREFIX . "configuration set configuration_value = '" . $db->prepare_input($store_default_currency) . "' where configuration_key = 'DEFAULT_CURRENCY'";
  77        $db->Execute($sql);
  78        $db->Close();
  79        header('location: index.php?main_page=admin_setup&language=' . $language);
  80        exit;
  81      }
  82    }
  83  
  84  
  85    //if not submit, set some defaults

  86    $sql = "select countries_id, countries_name from " . DB_PREFIX . "countries order by countries_name";
  87    $country = $db->Execute($sql);
  88    $country_string = '';
  89    while (!$country->EOF) {
  90      $country_string .= '<option value="' . $country->fields['countries_id'] . '"' . setSelected($country->fields['countries_id'], $_POST['store_country']) . '>' . $country->fields['countries_name'] . '</option>';
  91      $country->MoveNext();
  92    }
  93    $sql = "select zone_id, zone_name from " . DB_PREFIX . "zones";  // order by zone_country_id, zone_name

  94    $zone = $db->Execute($sql);
  95    $zone_string = '';
  96    while (!$zone->EOF) {
  97      $zone_string .= '<option value="' . $zone->fields['zone_id'] . '"' . setSelected($zone->fields['zone_id'], $_POST['store_zone']) . '>' . $zone->fields['zone_name'] . '</option>';
  98      $zone->MoveNext();
  99    }
 100    $sql = "select code, name from " . DB_PREFIX . "languages";
 101    $store_language = $db->Execute($sql);
 102    $language_string = '';
 103    while (!$store_language->EOF) {
 104      $language_string .= '<option value="' . $store_language->fields['code'] . '"' . setSelected($store_language->fields['code'], $_POST['store_default_language']) . '>' . $store_language->fields['name'] . '</option>';
 105      $store_language->MoveNext();
 106    }
 107    $sql = "select title, code from " . DB_PREFIX . "currencies";
 108    $currency = $db->Execute($sql) or die("error in $sql" . $db->ErrorMsg());
 109    $currency_string = '';
 110    while (!$currency->EOF) {
 111      $currency_string .= '<option value="' . $currency->fields['code'] . '"' . setSelected($currency->fields['code'], $_POST['store_default_currency']) . '>' . $currency->fields['title'] . '</option>';
 112      $currency->MoveNext();
 113    }
 114  
 115    $db->Close();
 116  
 117    if (!isset($_POST['demo_install'])) $_POST['demo_install']=false;
 118  
 119    setInputValue($_POST['store_name'], 'STORE_NAME_VALUE', '');
 120    setInputValue($_POST['store_owner'], 'STORE_OWNER_VALUE', '');
 121    setInputValue($_POST['store_owner_email'], 'STORE_OWNER_EMAIL_VALUE', '');
 122    setInputValue($_POST['store_address'], 'STORE_ADDRESS_VALUE', STORE_ADDRESS_DEFAULT_VALUE);
 123    setRadioChecked($_POST['demo_install'], 'DEMO_INSTALL', 'false');
 124  
 125  // this sets the first field to email address on login - setting in /common/tpl_main_page.php

 126    $zc_first_field= 'onload="document.getElementById(\'store_name\').focus()"';
 127  
 128  ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics