[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 init_database.php

Zen Cart 源代码 init_database.php




下载文件

文件名: init_database.php
文件类型: PHP文件
文件大小: 2.05 KiB
MD5: b5268304992653b0aecc97d6272cfed7

init_database.php - 关闭高亮
  1. <?php
  2. /**
  3.  * Initialise database driver and connect
  4.  * see {@link  http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials#InitSystem wikitutorials} for more details.
  5.  *
  6.  * @package initSystem
  7.  * @copyright Copyright 2003-2013 Zen Cart Development Team
  8.  * @copyright Portions Copyright 2003 osCommerce
  9.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  10.  * @version GIT: $Id: Author: DrByte  Sat Nov 2 00:02:54 2013 -0400 Modified in v1.5.2 $
  11.  */
  12. if (!defined('IS_ADMIN_FLAG')) {
  13.   die('Illegal Access');
  14. }
  15. /**
  16.  * require the query_factory clsss based on the DB_TYPE
  17.  */
  18. require('includes/classes/db/' .DB_TYPE . '/query_factory.php');
  19. $db = new queryFactory();
  20.  
  21. $down_for_maint_source = 'nddbc.html';
  22.  
  23. if (!$db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, USE_PCONNECT, false)) {
  24.   if (file_exists('zc_install/index.php')) {
  25.     header('location: zc_install/index.php');
  26.     exit;
  27.   } elseif (file_exists($down_for_maint_source)) {
  28.     if (defined('HTTP_SERVER') && defined('DIR_WS_CATALOG')) {
  29.       header('location: ' . HTTP_SERVER . DIR_WS_CATALOG . $down_for_maint_source );
  30.     } else {
  31.       header('location: ' . $down_for_maint_source );
  32. //    header('location: mystoreisdown.html');
  33.     }
  34.     exit;
  35.   } else {
  36.     exit;
  37.   }
  38. }
  39.  
  40. // Do a quick sanity check that system tables exist
  41. if (defined('SQL_CACHE_METHOD') && SQL_CACHE_METHOD == 'database') {
  42.   $sql = "SHOW TABLES LIKE '" . TABLE_DB_CACHE . "'";
  43. } else {
  44.   $sql = "SHOW TABLES LIKE '" . TABLE_PROJECT_VERSION . "'";
  45. }
  46. $db->dieOnErrors = FALSE;
  47. $result = $db->Execute($sql, FALSE, FALSE);
  48. if ($result->RecordCount() == 0) {
  49.   if (defined('ERROR_DATABASE_MAINTENANCE_NEEDED')) die(ERROR_DATABASE_MAINTENANCE_NEEDED);
  50.   die('<a href="http://www.zen-cart.com/content.php?334-ERROR-0071-There-appears-to-be-a-problem-with-the-database-Maintenance-is-required" target="_blank">ERROR 0071: There appears to be a problem with the database. Maintenance is required.</a>');
  51. }
  52. $db->dieOnErrors = TRUE;
  53.  


cron