[ 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/ -> install_7.php (source)

   1  <?php
   2  /*
   3    $Id: install_7.php,v 1.1 2003/07/09 01:11:06 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    $dir_fs_document_root = $HTTP_POST_VARS['DIR_FS_DOCUMENT_ROOT'];
  14    if ((substr($dir_fs_document_root, -1) != '/') && (substr($dir_fs_document_root, -1) != '/')) {
  15      $where = strrpos($dir_fs_document_root, '\\');
  16      if (is_string($where) && !$where) {
  17        $dir_fs_document_root .= '/';
  18      } else {
  19        $dir_fs_document_root .= '\\';
  20      }
  21    }
  22  ?>
  23  
  24  <p class="pageTitle">New Installation</p>
  25  
  26  <p><b>osCommerce Configuration</b></p>
  27  
  28  <?php
  29    $db = array();
  30    $db['DB_SERVER'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER']));
  31    $db['DB_SERVER_USERNAME'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER_USERNAME']));
  32    $db['DB_SERVER_PASSWORD'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER_PASSWORD']));
  33    $db['DB_DATABASE'] = trim(stripslashes($HTTP_POST_VARS['DB_DATABASE']));
  34  
  35    $db_error = false;
  36    osc_db_connect($db['DB_SERVER'], $db['DB_SERVER_USERNAME'], $db['DB_SERVER_PASSWORD']);
  37  
  38    if ($db_error == false) {
  39      osc_db_test_connection($db['DB_DATABASE']);
  40    }
  41  
  42    if ($db_error != false) {
  43  ?>
  44  <form name="install" action="install.php?step=6" method="post">
  45  
  46  <table width="95%" border="0" cellpadding="2" class="formPage">
  47    <tr>
  48      <td>
  49        <p>A test connection made to the database was <b>NOT</b> successful.</p>
  50        <p>The error message returned is:</p>
  51        <p class="boxme"><?php echo $db_error; ?></p>
  52        <p>Please click on the <i>Back</i> button below to review your database server settings.</p>
  53        <p>If you require help with your database server settings, please consult your hosting company.</p>
  54      </td>
  55    </tr>
  56  </table>
  57  
  58  <p>&nbsp;</p>
  59  
  60  <table border="0" width="100%" cellspacing="0" cellpadding="0">
  61    <tr>
  62      <td align="center"><a href="index.php"><img src="images/button_cancel.gif" border="0" alt="Cancel"></a></td>
  63      <td align="center"><input type="image" src="images/button_back.gif" border="0" alt="Back"></td>
  64    </tr>
  65  </table>
  66  
  67  <?php
  68      reset($HTTP_POST_VARS);
  69      while (list($key, $value) = each($HTTP_POST_VARS)) {
  70        if ($key != 'x' && $key != 'y') {
  71          if (is_array($value)) {
  72            for ($i=0; $i<sizeof($value); $i++) {
  73              echo osc_draw_hidden_field($key . '[]', $value[$i]);
  74            }
  75          } else {
  76            echo osc_draw_hidden_field($key, $value);
  77          }
  78        }
  79      }
  80  ?>
  81  
  82  </form>
  83  
  84  <?php
  85    } elseif ( ( (file_exists($dir_fs_document_root . 'includes/configure.php')) && (!is_writeable($dir_fs_document_root . 'includes/configure.php')) ) || ( (file_exists($dir_fs_document_root . '/admin/includes/configure.php')) && (!is_writeable($dir_fs_document_root . '/admin/includes/configure.php')) ) ) {
  86  ?>
  87  <form name="install" action="install.php?step=7" method="post">
  88  
  89  <table width="95%" border="0" cellpadding="2" class="formPage">
  90    <tr>
  91      <td>
  92        <p>The following error has occurred:</p>
  93        <p><div class="boxMe"><b>The configuration files do not exist, or permission levels are not set.</b><br><br>Please perform the following actions:
  94          <ul class="boxMe"><li>cd <?php echo $dir_fs_document_root; ?>includes/</li><li>touch configure.php</li><li>chmod 706 configure.php</li></ul>
  95          <ul class="boxMe"><li>cd <?php echo $dir_fs_document_root; ?>admin/includes/</li><li>touch configure.php</li><li>chmod 706 configure.php</li></ul></div>
  96        </p>
  97        <p class="noteBox">If <i>chmod 706</i> does not work, please try <i>chmod 777</i>.</p>
  98        <p class="noteBox">If you are running this installation procedure under a Microsoft Windows environment, try renaming the existing configuration file so a new file can be created.</p>
  99      </td>
 100    </tr>
 101  </table>
 102  
 103  <p>&nbsp;</p>
 104  
 105  <table border="0" width="100%" cellspacing="0" cellpadding="0">
 106    <tr>
 107      <td align="center"><a href="index.php"><img src="images/button_cancel.gif" border="0" alt="Cancel"></a></td>
 108      <td align="center"><input type="image" src="images/button_retry.gif" border="0" alt="Retry"></td>
 109    </tr>
 110  </table>
 111  
 112  <?php
 113      reset($HTTP_POST_VARS);
 114      while (list($key, $value) = each($HTTP_POST_VARS)) {
 115        if ($key != 'x' && $key != 'y') {
 116          if (is_array($value)) {
 117            for ($i=0; $i<sizeof($value); $i++) {
 118              echo osc_draw_hidden_field($key . '[]', $value[$i]);
 119            }
 120          } else {
 121            echo osc_draw_hidden_field($key, $value);
 122          }
 123        }
 124      }
 125  ?>
 126  
 127  </form>
 128  
 129  <?php
 130    } else {
 131      $http_url = parse_url($HTTP_POST_VARS['HTTP_WWW_ADDRESS']);
 132      $http_server = $http_url['scheme'] . '://' . $http_url['host'];
 133      $http_catalog = $http_url['path'];
 134      if (isset($http_url['port']) && !empty($http_url['port'])) {
 135        $http_server .= ':' . $http_url['port'];
 136      }
 137  
 138      if (substr($http_catalog, -1) != '/') {
 139        $http_catalog .= '/';
 140      }
 141  
 142      $https_server = '';
 143      $https_catalog = '';
 144      if (isset($HTTP_POST_VARS['HTTPS_WWW_ADDRESS']) && !empty($HTTP_POST_VARS['HTTPS_WWW_ADDRESS'])) {
 145        $https_url = parse_url($HTTP_POST_VARS['HTTPS_WWW_ADDRESS']);
 146        $https_server = $https_url['scheme'] . '://' . $https_url['host'];
 147        $https_catalog = $https_url['path'];
 148  
 149        if (isset($https_url['port']) && !empty($https_url['port'])) {
 150          $https_server .= ':' . $https_url['port'];
 151        }
 152  
 153        if (substr($https_catalog, -1) != '/') {
 154          $https_catalog .= '/';
 155        }
 156      }
 157  
 158      $enable_ssl = (isset($HTTP_POST_VARS['ENABLE_SSL']) && ($HTTP_POST_VARS['ENABLE_SSL'] == 'true') ? 'true' : 'false');
 159      $http_cookie_domain = $HTTP_POST_VARS['HTTP_COOKIE_DOMAIN'];
 160      $https_cookie_domain = (isset($HTTP_POST_VARS['HTTPS_COOKIE_DOMAIN']) ? $HTTP_POST_VARS['HTTPS_COOKIE_DOMAIN'] : '');
 161      $http_cookie_path = $HTTP_POST_VARS['HTTP_COOKIE_PATH'];
 162      $https_cookie_path = (isset($HTTP_POST_VARS['HTTPS_COOKIE_PATH']) ? $HTTP_POST_VARS['HTTPS_COOKIE_PATH'] : '');
 163  
 164      $file_contents = '<?php' . "\n" .
 165                       '/*' . "\n" .
 166                       '  osCommerce, Open Source E-Commerce Solutions' . "\n" .
 167                       '  http://www.oscommerce.com' . "\n" .
 168                       '' . "\n" .
 169                       '  Copyright (c) 2003 osCommerce' . "\n" .
 170                       '' . "\n" .
 171                       '  Released under the GNU General Public License' . "\n" .
 172                       '*/' . "\n" .
 173                       '' . "\n" .
 174                       '// Define the webserver and path parameters' . "\n" .
 175                       '// * DIR_FS_* = Filesystem directories (local/physical)' . "\n" .
 176                       '// * DIR_WS_* = Webserver directories (virtual/URL)' . "\n" .
 177                       '  define(\'HTTP_SERVER\', \'' . $http_server . '\'); // eg, http://localhost - should not be empty for productive servers' . "\n" .
 178                       '  define(\'HTTPS_SERVER\', \'' . $https_server . '\'); // eg, https://localhost - should not be empty for productive servers' . "\n" .
 179                       '  define(\'ENABLE_SSL\', ' . $enable_ssl . '); // secure webserver for checkout procedure?' . "\n" .
 180                       '  define(\'HTTP_COOKIE_DOMAIN\', \'' . $http_cookie_domain . '\');' . "\n" .
 181                       '  define(\'HTTPS_COOKIE_DOMAIN\', \'' . $https_cookie_domain . '\');' . "\n" .
 182                       '  define(\'HTTP_COOKIE_PATH\', \'' . $http_cookie_path . '\');' . "\n" .
 183                       '  define(\'HTTPS_COOKIE_PATH\', \'' . $https_cookie_path . '\');' . "\n" .
 184                       '  define(\'DIR_WS_HTTP_CATALOG\', \'' . $http_catalog . '\');' . "\n" .
 185                       '  define(\'DIR_WS_HTTPS_CATALOG\', \'' . $https_catalog . '\');' . "\n" .
 186                       '  define(\'DIR_WS_IMAGES\', \'images/\');' . "\n" .
 187                       '  define(\'DIR_WS_ICONS\', DIR_WS_IMAGES . \'icons/\');' . "\n" .
 188                       '  define(\'DIR_WS_INCLUDES\', \'includes/\');' . "\n" .
 189                       '  define(\'DIR_WS_BOXES\', DIR_WS_INCLUDES . \'boxes/\');' . "\n" .
 190                       '  define(\'DIR_WS_FUNCTIONS\', DIR_WS_INCLUDES . \'functions/\');' . "\n" .
 191                       '  define(\'DIR_WS_CLASSES\', DIR_WS_INCLUDES . \'classes/\');' . "\n" .
 192                       '  define(\'DIR_WS_MODULES\', DIR_WS_INCLUDES . \'modules/\');' . "\n" .
 193                       '  define(\'DIR_WS_LANGUAGES\', DIR_WS_INCLUDES . \'languages/\');' . "\n" .
 194                       '' . "\n" .
 195                       '  define(\'DIR_WS_DOWNLOAD_PUBLIC\', \'pub/\');' . "\n" .
 196                       '  define(\'DIR_FS_CATALOG\', \'' . $dir_fs_document_root . '\');' . "\n" .
 197                       '  define(\'DIR_FS_DOWNLOAD\', DIR_FS_CATALOG . \'download/\');' . "\n" .
 198                       '  define(\'DIR_FS_DOWNLOAD_PUBLIC\', DIR_FS_CATALOG . \'pub/\');' . "\n" .
 199                       '' . "\n" .
 200                       '// define our database connection' . "\n" .
 201                       '  define(\'DB_SERVER\', \'' . $HTTP_POST_VARS['DB_SERVER'] . '\'); // eg, localhost - should not be empty for productive servers' . "\n" .
 202                       '  define(\'DB_SERVER_USERNAME\', \'' . $HTTP_POST_VARS['DB_SERVER_USERNAME'] . '\');' . "\n" .
 203                       '  define(\'DB_SERVER_PASSWORD\', \'' . $HTTP_POST_VARS['DB_SERVER_PASSWORD']. '\');' . "\n" .
 204                       '  define(\'DB_DATABASE\', \'' . $HTTP_POST_VARS['DB_DATABASE']. '\');' . "\n" .
 205                       '  define(\'USE_PCONNECT\', \'' . (($HTTP_POST_VARS['USE_PCONNECT'] == 'true') ? 'true' : 'false') . '\'); // use persistent connections?' . "\n" .
 206                       '  define(\'STORE_SESSIONS\', \'' . (($HTTP_POST_VARS['STORE_SESSIONS'] == 'files') ? '' : 'mysql') . '\'); // leave empty \'\' for default handler or set to \'mysql\'' . "\n" .
 207                       '?>';
 208  
 209      $fp = fopen($dir_fs_document_root . 'includes/configure.php', 'w');
 210      fputs($fp, $file_contents);
 211      fclose($fp);
 212  
 213      $file_contents = '<?php' . "\n" .
 214                       '/*' . "\n" .
 215                       '  osCommerce, Open Source E-Commerce Solutions' . "\n" .
 216                       '  http://www.oscommerce.com' . "\n" .
 217                       '' . "\n" .
 218                       '  Copyright (c) 2003 osCommerce' . "\n" .
 219                       '' . "\n" .
 220                       '  Released under the GNU General Public License' . "\n" .
 221                       '*/' . "\n" .
 222                       '' . "\n" .
 223                       '// Define the webserver and path parameters' . "\n" .
 224                       '// * DIR_FS_* = Filesystem directories (local/physical)' . "\n" .
 225                       '// * DIR_WS_* = Webserver directories (virtual/URL)' . "\n" .
 226                       '  define(\'HTTP_SERVER\', \'' . $http_server . '\'); // eg, http://localhost - should not be empty for productive servers' . "\n" .
 227                       '  define(\'HTTP_CATALOG_SERVER\', \'' . $http_server . '\');' . "\n" .
 228                       '  define(\'HTTPS_CATALOG_SERVER\', \'' . $https_server . '\');' . "\n" .
 229                       '  define(\'ENABLE_SSL_CATALOG\', \'' . $enable_ssl . '\'); // secure webserver for catalog module' . "\n" .
 230                       '  define(\'DIR_FS_DOCUMENT_ROOT\', \'' . $dir_fs_document_root . '\'); // where the pages are located on the server' . "\n" .
 231                       '  define(\'DIR_WS_ADMIN\', \'' . $http_catalog . 'admin/\'); // absolute path required' . "\n" .
 232                       '  define(\'DIR_FS_ADMIN\', \'' . $dir_fs_document_root . 'admin/\'); // absolute pate required' . "\n" .
 233                       '  define(\'DIR_WS_CATALOG\', \'' . $http_catalog . '\'); // absolute path required' . "\n" .
 234                       '  define(\'DIR_FS_CATALOG\', \'' . $dir_fs_document_root . '\'); // absolute path required' . "\n" .
 235                       '  define(\'DIR_WS_IMAGES\', \'images/\');' . "\n" .
 236                       '  define(\'DIR_WS_ICONS\', DIR_WS_IMAGES . \'icons/\');' . "\n" .
 237                       '  define(\'DIR_WS_CATALOG_IMAGES\', DIR_WS_CATALOG . \'images/\');' . "\n" .
 238                       '  define(\'DIR_WS_INCLUDES\', \'includes/\');' . "\n" .
 239                       '  define(\'DIR_WS_BOXES\', DIR_WS_INCLUDES . \'boxes/\');' . "\n" .
 240                       '  define(\'DIR_WS_FUNCTIONS\', DIR_WS_INCLUDES . \'functions/\');' . "\n" .
 241                       '  define(\'DIR_WS_CLASSES\', DIR_WS_INCLUDES . \'classes/\');' . "\n" .
 242                       '  define(\'DIR_WS_MODULES\', DIR_WS_INCLUDES . \'modules/\');' . "\n" .
 243                       '  define(\'DIR_WS_LANGUAGES\', DIR_WS_INCLUDES . \'languages/\');' . "\n" .
 244                       '  define(\'DIR_WS_CATALOG_LANGUAGES\', DIR_WS_CATALOG . \'includes/languages/\');' . "\n" .
 245                       '  define(\'DIR_FS_CATALOG_LANGUAGES\', DIR_FS_CATALOG . \'includes/languages/\');' . "\n" .
 246                       '  define(\'DIR_FS_CATALOG_IMAGES\', DIR_FS_CATALOG . \'images/\');' . "\n" .
 247                       '  define(\'DIR_FS_CATALOG_MODULES\', DIR_FS_CATALOG . \'includes/modules/\');' . "\n" .
 248                       '  define(\'DIR_FS_BACKUP\', DIR_FS_ADMIN . \'backups/\');' . "\n" .
 249                       '' . "\n" .
 250                       '// define our database connection' . "\n" .
 251                       '  define(\'DB_SERVER\', \'' . $HTTP_POST_VARS['DB_SERVER'] . '\'); // eg, localhost - should not be empty for productive servers' . "\n" .
 252                       '  define(\'DB_SERVER_USERNAME\', \'' . $HTTP_POST_VARS['DB_SERVER_USERNAME'] . '\');' . "\n" .
 253                       '  define(\'DB_SERVER_PASSWORD\', \'' . $HTTP_POST_VARS['DB_SERVER_PASSWORD']. '\');' . "\n" .
 254                       '  define(\'DB_DATABASE\', \'' . $HTTP_POST_VARS['DB_DATABASE']. '\');' . "\n" .
 255                       '  define(\'USE_PCONNECT\', \'' . (($HTTP_POST_VARS['USE_PCONNECT'] == 'true') ? 'true' : 'false') . '\'); // use persisstent connections?' . "\n" .
 256                       '  define(\'STORE_SESSIONS\', \'' . (($HTTP_POST_VARS['STORE_SESSIONS'] == 'files') ? '' : 'mysql') . '\'); // leave empty \'\' for default handler or set to \'mysql\'' . "\n" .
 257                       '?>';
 258  
 259      $fp = fopen($dir_fs_document_root . 'admin/includes/configure.php', 'w');
 260      fputs($fp, $file_contents);
 261      fclose($fp);
 262  ?>
 263  
 264  <table width="95%" border="0" cellpadding="2" class="formPage">
 265    <tr>
 266      <td>The configuration was successful!</td>
 267   </tr>
 268  </table>
 269  
 270  <p>&nbsp;</p>
 271  
 272  <table border="0" width="100%" cellspacing="0" cellpadding="0">
 273    <tr>
 274      <td align="center"><a href="<?php echo $http_server . $http_catalog . 'index.php'; ?>" target="_blank"><img src="images/button_catalog.gif" border="0" alt="Catalog"></a></td>
 275      <td align="center"><a href="<?php echo $http_server . $http_catalog . 'admin/index.php'; ?>" target="_blank"><img src="images/button_administration_tool.gif" border="0" alt="Administration Tool"></a></td>
 276    </tr>
 277  </table>
 278  
 279  <?php
 280    }
 281  ?>


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