[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 源代码 application_top.php

Zen Cart 源代码 application_top.php




下载文件

文件名: application_top.php
文件类型: PHP文件
文件大小: 7.72 KiB
MD5: 614badc8efe1320b234e3e50a0294493

application_top.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package Installer
  4.  * @access private
  5.  * @copyright Copyright 2003-2014 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 GIT: $Id: Author: DrByte  Tue Apr 15 14:38:57 2014 -0400 Modified in v1.5.3 $
  9.  */
  10. /**
  11.  * ensure odd settings are disabled and set required defaults
  12.  */
  13. //@ini_set("session.auto_start","0");
  14. //@ini_set("session.use_trans_sid","0");
  15.  
  16. @ini_set("arg_separator.output","&");
  17.  
  18. // Check PHP version
  19. if (version_compare(PHP_VERSION, '5.2.10', '<'))
  20. {
  21.   require('includes/templates/template_default/templates/tpl_php_version_problem.php');
  22.   die('');
  23. }
  24.  
  25.  
  26. /**
  27.  * Set the local configuration parameters - mainly for developers
  28.  */
  29. if (file_exists('includes/local/configure.php')) {
  30.   /**
  31.    * load any local(user created) configure file.
  32.    */
  33.   include('includes/local/configure.php');
  34. }
  35. /**
  36.  * Set the installer configuration parameters
  37.  */
  38. include('includes/installer_params.php');
  39. /**
  40.  * set the level of error reporting
  41.  */
  42. error_reporting(version_compare(PHP_VERSION, 5.3, '>=') ? E_ALL & ~E_DEPRECATED & ~E_NOTICE : version_compare(PHP_VERSION, 5.4, '>=') ? E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT : E_ALL & ~E_NOTICE);
  43. $debug_logfile_path = DEBUG_LOG_FOLDER . '/zcInstallDEBUG-' . time() . '-' . mt_rand(1000,999999) . '.log';
  44. @ini_set('log_errors', 1);
  45. @ini_set('log_errors_max_len', 0);
  46. @ini_set('error_log', $debug_logfile_path);
  47. if (defined('STRICT_ERROR_REPORTING') && STRICT_ERROR_REPORTING == true) {
  48.   @ini_set('display_errors', 1);  // to screen
  49. } else {
  50.   @ini_set('display_errors', 0);
  51. }
  52. /**
  53.  * Timezone problem detection
  54.  */
  55. if (PHP_VERSION >= '5.3' && ini_get('date.timezone') == '' && @date_default_timezone_get() == '')
  56. {
  57.   include ('../includes/extra_configures/set_time_zone.php');
  58. } elseif (PHP_VERSION >= '5.1') {
  59.   $baseTZ = date_default_timezone_get();
  60.   date_default_timezone_set($baseTZ);
  61.   unset($baseTZ);
  62. }
  63. // re-test
  64. if (ini_get('date.timezone') == '' && @date_default_timezone_get() == '')
  65. {
  66.   die('ERROR: date.timezone is not set in php.ini. You have two options: 1-Edit /includes/extra_configures/set_time_zone.php to set the $TZ variable manually, or 2-Contact your hosting company to set the timezone correctly in the server PHP configuration before continuing.');
  67. } else
  68. {
  69.   @date_default_timezone_set(date_default_timezone_get());
  70. }
  71.  
  72. /*
  73.  * check settings for, and then turn off magic-quotes support, for both runtime and sybase, as both will cause problems if enabled
  74.  */
  75. if (version_compare(PHP_VERSION, 5.4, '<')) {
  76.   $php_magic_quotes_runtime = (@get_magic_quotes_runtime() > 0) ? 'ON' : 'OFF';
  77.   if (version_compare(PHP_VERSION, 5.3, '<') && function_exists('set_magic_quotes_runtime')) set_magic_quotes_runtime(0);
  78.   $val = @ini_get('magic_quotes_sybase');
  79.   if (is_string($val) && strtolower($val) == 'on') $val = 1;
  80.   $php_magic_quotes_sybase = ((int)$val > 0) ? 'ON' :'OFF';
  81.   if ((int)$val != 0) @ini_set('magic_quotes_sybase', 0);
  82.   unset($val);
  83. }
  84. /**
  85.  * boolean used to see if we are in the admin script, obviously set to false here.
  86.  */
  87. if (!defined('IS_ADMIN_FLAG')) define('IS_ADMIN_FLAG', false);
  88.  
  89. // define the project version
  90. require('version.php');
  91.  
  92. // set php_self in the local scope
  93. if (!isset($PHP_SELF)) $PHP_SELF = $_SERVER['PHP_SELF'];
  94. require('../includes/classes/class.base.php');
  95. require('../includes/classes/class.notifier.php');
  96. require('includes/functions/general.php');
  97. $sanitGets = array('action', 'adv', 'configfile', 'debug', 'debug2', 'debug3', 'error_code', 'ignorefatal', 'ignorephpver', 'language', 'main_page', 'nogrants', 'overrideconfig', 'reset');
  98. foreach ($sanitGets as $key)
  99. {
  100.   if (isset($_GET[$key]))
  101.   {
  102.     $_GET[$key] = preg_replace('/[^0-9a-zA-Z_:@.-]/', '', $_GET[$key]);
  103.   }
  104. }
  105. /**
  106.  * set the type of request (secure or not)
  107.  */
  108. $request_type = (((isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on' || $_SERVER['HTTPS'] == '1'))) ||
  109.                  (isset($_SERVER['HTTP_X_FORWARDED_BY']) && strpos(strtoupper($_SERVER['HTTP_X_FORWARDED_BY']), 'SSL') !== false) ||
  110.                  (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && (strpos(strtoupper($_SERVER['HTTP_X_FORWARDED_HOST']), 'SSL') !== false || strpos(strtoupper($_SERVER['HTTP_X_FORWARDED_HOST']), str_replace('https://', '', HTTPS_SERVER)) !== false)) ||
  111.                  (isset($_SERVER['SCRIPT_URI']) && strtolower(substr($_SERVER['SCRIPT_URI'], 0, 6)) == 'https:') ||
  112.                  (isset($_SERVER['HTTP_X_FORWARDED_SSL']) && ($_SERVER['HTTP_X_FORWARDED_SSL'] == '1' || strtolower($_SERVER['HTTP_X_FORWARDED_SSL']) == 'on')) ||
  113.                  (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && (strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'ssl' || strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https')) ||
  114.                  (isset($_SERVER['HTTP_SSLSESSIONID']) && $_SERVER['HTTP_SSLSESSIONID'] != '') ||
  115.                  (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443')) ? 'SSL' : 'NONSSL';
  116.  
  117. /**
  118.  * require the session handling functions
  119.  */
  120. if (!defined('STORE_SESSIONS')) define('STORE_SESSIONS', 'file');
  121. require('includes/functions/sessions.php');
  122. /**
  123.  * set the session name and save path
  124.  */
  125. zen_session_name('zenInstallId');
  126. zen_session_save_path(SESSION_WRITE_DIRECTORY);
  127. /**
  128.  * set the session cookie parameters
  129.  */
  130. /**
  131.  * set the session ID if it exists
  132.  */
  133. if (isset($_POST[zen_session_name()])) {
  134.   zen_session_id($_POST[zen_session_name()]);
  135. } elseif ( ($request_type == 'SSL') && isset($_GET[zen_session_name()]) ) {
  136.   zen_session_id($_GET[zen_session_name()]);
  137. }
  138. zen_session_start();
  139. $session_started = true;
  140.  
  141. /*
  142.  * initialize the message stack for message alerts
  143.  */
  144. require('includes/classes/message_stack.php');
  145. $messageStack = new messageStack;
  146. /*
  147.  * activate installer
  148.  */
  149. require('includes/classes/installer.php');
  150. $zc_install = new installer;
  151.  
  152. $zc_install->error = false;
  153. $zc_install->fatal_error = false;
  154. $zc_install->error_list = array();
  155.  
  156. if ((!isset($_GET['main_page']) || $_GET['main_page'] == 'index') || (isset($_GET['reset']) && $_GET['reset'] == 1)) $zc_install->resetConfigKeys();
  157.  
  158. /*
  159.  * check validity of session data
  160.  */
  161. if (isset($_GET['main_page']) && !in_array($_GET['main_page'], array('', 'index', 'license', 'inspect', 'time_out', 'store_setup', 'admin_setup', 'finished')) ) {
  162.   if (!isset($_SESSION['installerConfigKeys']) || sizeof($_SESSION['installerConfigKeys']) < 1 || !isset($_SESSION['installerConfigKeys']['DIR_FS_SQL_CACHE'])) {
  163.     header('location: index.php?main_page=time_out' . zcInstallAddSID() );
  164.   }
  165. }
  166.  
  167. /*
  168.  * language determination
  169.  */
  170. $language = (isset($_GET['language']) && $_GET['language'] != '') ? preg_replace('/[^a-zA-Z_]/', '', $_GET['language']) : $zc_install->getConfigKey('language');
  171. if ($language == '') $language = 'english';
  172. if (!file_exists('includes/languages/' . $language . '.php')) {
  173.   $zc_install->throwException('Specified language file not found. Defaulting to english. (' . 'includes/languages/' . $language . '.php)');
  174.   $language = 'english';
  175. }
  176. $zc_install->setConfigKey('language', $language);
  177. /*
  178.  * template determination
  179.  */
  180. define('DIR_WS_INSTALL_TEMPLATE', 'includes/templates/template_default/');
  181.  
  182. define('ZC_UPG_DEBUG',  (!isset($_GET['debug'])  && !isset($_POST['debug'])  || (isset($_POST['debug'])  && $_POST['debug'] == '')) ? false : true);
  183. define('ZC_UPG_DEBUG2', (!isset($_GET['debug2']) && !isset($_POST['debug2']) || (isset($_POST['debug2']) && $_POST['debug2'] == '')) ? false : true);
  184. define('ZC_UPG_DEBUG3', (!isset($_GET['debug3']) && !isset($_POST['debug3']) || (isset($_POST['debug3']) && $_POST['debug3'] == '')) ? false : true);
  185.  
  186.  
  187.