lrlz.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. /**
  3. * 运行框架
  4. *
  5. *
  6. *
  7. *
  8. */
  9. defined('InShopNC') or exit('Access Invalid!');
  10. if (!@include(BASE_DATA_PATH . '/config/config.ini.php')) exit('config.ini.php isn\'t exists!');
  11. if (file_exists(BASE_PATH . '/config/config.ini.php')) {
  12. include(BASE_PATH . '/config/config.ini.php');
  13. }
  14. @date_default_timezone_set('Asia/Shanghai');
  15. //global $config;
  16. //默认平台店铺id
  17. define('DEFAULT_PLATFORM_STORE_ID', $config['default_store_id']);
  18. define('URL_MODEL', $config['url_model']);
  19. define(SUBDOMAIN_SUFFIX, $config['subdomain_suffix']);
  20. define('BASE_SITE_URL', $config['base_site_url']);
  21. define('CLIENT_SITE_URL', $config['client_site_url']);
  22. define('SHOP_SITE_URL', $config['shop_site_url']);
  23. define('CMS_SITE_URL', $config['cms_site_url']);
  24. define('CIRCLE_SITE_URL', $config['circle_site_url']);
  25. define('MICROSHOP_SITE_URL', $config['microshop_site_url']);
  26. define('ADMIN_SITE_URL', $config['admin_site_url']);
  27. define('MOBILE_SITE_URL', $config['mobile_site_url']);
  28. define('WAP_SITE_URL', $config['wap_site_url']);
  29. define('UPLOAD_SITE_URL', $config['upload_site_url']);
  30. define('RESOURCE_SITE_URL', $config['resource_site_url']);
  31. define('DELIVERY_SITE_URL', $config['delivery_site_url']);
  32. define('BASE_DATA_PATH', BASE_ROOT_PATH . '/data');
  33. define('BASE_UPLOAD_PATH', BASE_DATA_PATH . '/upload');
  34. define('BASE_RESOURCE_PATH', BASE_DATA_PATH . '/resource');
  35. define('CHARSET', $config['db'][1]['dbcharset']);
  36. define('DBDRIVER', $config['dbdriver']);
  37. define('SESSION_EXPIRE', $config['session_expire']);
  38. define('LANG_TYPE', $config['lang_type']);
  39. define('COOKIE_PRE', $config['cookie_pre']);
  40. define('DBPRE', $config['tablepre']);
  41. define('DBNAME', $config['db'][1]['dbname']);
  42. $_GET['act'] = $_GET['act'] ? strtolower($_GET['act']) : ($_POST['act'] ? strtolower($_POST['act']) : null);
  43. $_GET['op'] = $_GET['op'] ? strtolower($_GET['op']) : ($_POST['op'] ? strtolower($_POST['op']) : null);
  44. if (empty($_GET['act'])) {
  45. require_once(BASE_CORE_PATH . '/framework/core/route.php');
  46. new Route($config);
  47. }
  48. //统一ACTION
  49. $_GET['act'] = preg_match('/^[\w]+$/i', $_GET['act']) ? $_GET['act'] : 'index';
  50. $_GET['op'] = preg_match('/^[\w]+$/i', $_GET['op']) ? $_GET['op'] : 'index';
  51. //对GET POST接收内容进行过滤,$ignore内的下标不被过滤
  52. $ignore = array('article_content', 'pgoods_body',
  53. 'doc_content', 'content', 'sn_content', 'g_body', 'store_description', 'p_content',
  54. 'groupbuy_intro', 'remind_content', 'note_content', 'ref_url', 'adv_pic_url', 'adv_word_url', 'adv_slide_url',
  55. 'appcode', 'mail_content');
  56. if (!class_exists('Security')) {
  57. require(BASE_CORE_PATH . '/framework/libraries/security.php');
  58. }
  59. $_GET = !empty($_GET) ? Security::getAddslashesForInput($_GET, $ignore) : array();
  60. $_POST = !empty($_POST) ? Security::getAddslashesForInput($_POST, $ignore) : array();
  61. $_REQUEST = !empty($_REQUEST) ? Security::getAddslashesForInput($_REQUEST, $ignore) : array();
  62. $_SERVER = !empty($_SERVER) ? Security::getAddSlashes($_SERVER) : array();
  63. //启用ZIP压缩
  64. if ($config['gzip'] == 1 && function_exists('ob_gzhandler') && $_GET['inajax'] != 1) {
  65. ob_start('ob_gzhandler');
  66. } else {
  67. ob_start();
  68. }
  69. require_once(BASE_CORE_PATH . '/framework/libraries/queue.php');
  70. require_once(BASE_CORE_PATH . '/framework/function/core.php');
  71. require_once(BASE_CORE_PATH . '/framework/core/base.php');
  72. require_once(BASE_CORE_PATH . '/framework/function/goods.php');
  73. if (function_exists('spl_autoload_register')) {
  74. spl_autoload_register(array('Base', 'autoload'));
  75. }
  76. else
  77. {
  78. function __autoload($class)
  79. {
  80. if (defined('MOBILE_SERVER') && MOBILE_SERVER == true) {
  81. return Base::mobile_autoload($class);
  82. } else {
  83. return Base::autoload($class);
  84. }
  85. }
  86. }
  87. function is_mobile()
  88. {
  89. return (defined('MOBILE_SERVER') && MOBILE_SERVER == true);
  90. }
  91. //是否考虑红包有效期
  92. function isBonusExpiryDate()
  93. {
  94. return (defined('BONUS_EXPIRY_DATE') && BONUS_EXPIRY_DATE == true);
  95. }
  96. function usedBonusRate() {
  97. return (defined('USE_BONUS_RATE') && USE_BONUS_RATE == true);
  98. }
  99. function noBonusRate() {
  100. return (defined('USE_BONUS_RATE') && USE_BONUS_RATE == false);
  101. }
  102. function defaultBonusRate() {
  103. return 30;
  104. }
  105. ?>