zen cart -- 自适应配置文件

19 篇文章 0 订阅
13 篇文章 0 订阅

即使你很熟悉zen cart的配置文件,你可能熟悉的连第几行是什么配置都能记得,甚至有点不太在意。但是如果大批量建站,你还是会因为太忙而出错。路径配置错了,域名为了修改了,建一个修改一下,很麻木。为了解放手和大脑,我简单搞了个自适应的配置文件

 

/added by george,only for  converience

$user = explode('/',dirname(__FILE__));

$path = $user[2];$domain = $_SERVER['SERVER_NAME'];

if ( substr($domain,0,4) != 'www.' ) {

$domain = 'www.' . $domain;

}

end of george customization

 

注:

取得路径没得说,只是我把规范了一下,我把数据库资料也通过变量,当然前提是你的数据库名称和数据用户名命名有规则。你可能说会不安全,密码当然不是一样,其实搞成一样的也没什么。mysql的用户通常限制只有本主机可以连接。即使让人知道了也连不上,当然了,如果让用户获取了SHELL权限,那无论你什么配置,所有zen cart站的密码还全是明文的。

很显然,我这个写的比较简单,没有考虑太多情况,只适合我自己的情况。

 

下面就是前台的配置文件,后台的配置文件就不贴了。个人认为zen cart应该把前后台的配置合并,哪怕只通过简单的include也行。也许是不想互相依赖吧。

 

<?php
/**
 * @package Configuration Settings circa 1.3.8
 * @copyright Copyright 2003-2007 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 *
 * author george zheng <xinhaozheng@gmail.com>
 */


/*************** NOTE: This file is similar, but DIFFERENT from the "admin" version of configure.php. ***********/
/***************       The 2 files should be kept separate and not used to overwrite each other.      ***********/


/added by george,only for converience config

$user = explode('/',dirname(__FILE__));
$path = $user[2];
$domain = $_SERVER['SERVER_NAME'];
if ( substr($domain,0,4) != 'www.' ) {
    $domain = 'www.' . $domain;
}

/end of george customization

// Define the webserver and path parameters
  // HTTP_SERVER is your Main webserver: eg-http://www.your_domain.com
  // HTTPS_SERVER is your Secure webserver: eg-https://www.your_domain.com

/altered by george,only for converience config

  define('HTTP_SERVER', 'http://'.$domain);
  define('HTTPS_SERVER', 'https://'.$domain);

/end of george customization

  // Use secure webserver for checkout procedure?
  define('ENABLE_SSL', 'false');

// NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes!
// * DIR_WS_* = Webserver directories (virtual/URL)
  // these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder)
  define('DIR_WS_CATALOG', '/');
  define('DIR_WS_HTTPS_CATALOG', '/');

  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
  define('DIR_WS_DOWNLOAD_PUBLIC', DIR_WS_CATALOG . 'pub/');
  define('DIR_WS_TEMPLATES', DIR_WS_INCLUDES . 'templates/');

  define('DIR_WS_PHPBB', '/');

// * DIR_FS_* = Filesystem directories (local/physical)
  //the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/

/altered by george,only for converience config

  define('DIR_FS_CATALOG', '/home/'.$path.'/public_html/');

/end of george customization


  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');
  define('DIR_WS_UPLOADS', DIR_WS_IMAGES . 'uploads/');
  define('DIR_FS_UPLOADS', DIR_FS_CATALOG . DIR_WS_UPLOADS);
  define('DIR_FS_EMAIL_TEMPLATES', DIR_FS_CATALOG . 'email/');

// define our database connection
  define('DB_TYPE', 'mysql');
  define('DB_PREFIX', '');
  define('DB_SERVER', 'localhost');

  /altered by george,only for converience config
  
  define('DB_SERVER_USERNAME', $path);
  define('DB_SERVER_PASSWORD', 'fsdfG=u78988w?Kd-U9');
  define('DB_DATABASE', $path.'_db');
  
  /end of george customization
  
  define('USE_PCONNECT', 'false');
  define('STORE_SESSIONS', 'db');
  // for STORE_SESSIONS, use 'db' for best support, or '' for file-based storage

  // The next 2 "defines" are for SQL cache support.
  // For SQL_CACHE_METHOD, you can select from:  none, database, or file
  // If you choose "file", then you need to set the DIR_FS_SQL_CACHE to a directory where your apache
  // or webserver user has write privileges (chmod 666 or 777). We recommend using the "cache" folder inside the Zen Cart folder
  // ie: /path/to/your/webspace/public_html/zen/cache   -- leave no trailing slash
  define('SQL_CACHE_METHOD', 'file');

/altered by george,only for converience config

  define('DIR_FS_SQL_CACHE', '/home/'.$path.'/public_html/cache');

/end of george customization
// EOF



 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值