[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文件
文件大小: 6.74 KiB
MD5: dc3bdcb241c020745fac06439ba0bc86

application_top.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2014 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version GIT: $Id: Author: DrByte  Tue May 21 23:13:29 2013 -0400 Modified in v1.5.3 $
  8.  */
  9. /**
  10.  * File contains just application_top code
  11.  *
  12.  * Initializes common classes & methods. Controlled by an array which describes
  13.  * the elements to be initialised and the order in which that happens.
  14.  *
  15.  * @package admin
  16.  */
  17. /**
  18.  * boolean if true the autoloader scripts will be parsed and their output shown. For debugging purposes only.
  19.  */
  20. define('DEBUG_AUTOLOAD', false);
  21. /**
  22.  * boolean used to see if we are in the admin script, obviously set to false here.
  23.  * DO NOT REMOVE THE define BELOW. WILL BREAK ADMIN
  24.  */
  25. define('IS_ADMIN_FLAG', true);
  26. /**
  27.  * integer saves the time at which the script started.
  28.  */
  29. // Start the clock for the page parse time log
  30. define('PAGE_PARSE_START_TIME', microtime());
  31. /**
  32.  * set the level of error reporting
  33.  *
  34.  * Note STRICT_ERROR_REPORTING should never be set to true on a production site. <br />
  35.  * It is mainly there to show php warnings during testing/bug fixing phases.<br />
  36.  * note for strict error reporting we also turn on show_errors as this may be disabled<br />
  37.  * in php.ini. Otherwise we respect the php.ini setting
  38.  *
  39.  */
  40. if (defined('STRICT_ERROR_REPORTING') && STRICT_ERROR_REPORTING == true) {
  41.   @ini_set('display_errors', TRUE);
  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. } else {
  44. }
  45. /*
  46.  * turn off magic-quotes support, for both runtime and sybase, as both will cause problems if enabled
  47.  */
  48. if (version_compare(PHP_VERSION, 5.3, '<') && function_exists('set_magic_quotes_runtime')) set_magic_quotes_runtime(0);
  49. if (version_compare(PHP_VERSION, 5.4, '<') && @ini_get('magic_quotes_sybase') != 0) @ini_set('magic_quotes_sybase', 0);
  50. // set php_self in the local scope
  51. if (!isset($PHP_SELF)) $PHP_SELF = $_SERVER['PHP_SELF'];
  52. $PHP_SELF = htmlspecialchars($PHP_SELF);
  53. // Suppress html from error messages
  54. @ini_set("html_errors","0");
  55. /*
  56.  * Get time zone info from PHP config
  57. */
  58. if (version_compare(PHP_VERSION, 5.3, '>='))
  59. {
  60.   @date_default_timezone_set(date_default_timezone_get());
  61. }
  62. /**
  63.  * Set the local configuration parameters - mainly for developers
  64.  */
  65. if (file_exists('includes/local/configure.php')) {
  66.   /**
  67.    * load any local(user created) configure file.
  68.    */
  69.   include('includes/local/configure.php');
  70. }
  71. /**
  72.  * check for and load application configuration parameters
  73.  */
  74. if (file_exists('includes/configure.php')) {
  75.   /**
  76.    * load the main configure file.
  77.    */
  78.   include('includes/configure.php');
  79. }
  80. if (!defined('DIR_FS_CATALOG') || !is_dir(DIR_FS_CATALOG.'/includes/classes') || !defined('DB_TYPE') || DB_TYPE == '') {
  81.   if (file_exists('../includes/templates/template_default/templates/tpl_zc_install_suggested_default.php')) {
  82.     require('../includes/templates/template_default/templates/tpl_zc_install_suggested_default.php');
  83.     exit;
  84.   } elseif (file_exists('../zc_install/index.php')) {
  85.     echo 'ERROR: Admin configure.php not found. Suggest running install? <a href="../zc_install/index.php">Click here for installation</a>';
  86.   } else {
  87.     die('ERROR: admin/includes/configure.php file not found. Suggest running zc_install/index.php?');
  88.   }
  89. }
  90. /**
  91.  * ignore version-check if INI file setting has been set
  92.  */
  93. if (file_exists(DIR_FS_ADMIN . 'includes/local/skip_version_check.ini')) {
  94.   $lines = @file(DIR_FS_ADMIN . 'includes/local/skip_version_check.ini');
  95.   if (is_array($lines)) {
  96.     foreach($lines as $line) {
  97.       if (substr($line,0,14)=='admin_configure_php_check=') $check_cfg=substr(trim(strtolower(str_replace('admin_configure_php_check=','',$line))),0,3);
  98.     }
  99.   }
  100. }
  101. /*
  102. // turned off for now
  103.   if ($check_cfg != 'off') {
  104.     // if the admin/includes/configure.php file doesn't contain admin-related content, throw error
  105.     $zc_pagepath = str_replace(basename($PHP_SELF),'',__FILE__); //remove page name from full path of current page
  106.     $zc_pagepath = str_replace(array('\\','\\\\'),'/',$zc_pagepath); // convert '\' marks to '/'
  107.     $zc_pagepath = str_replace('//','/',$zc_pagepath); //convert doubles to single
  108.     $zc_pagepath = str_replace(strrchr($zc_pagepath,'/'),'',$zc_pagepath); // remove trailing '/'
  109.     $zc_adminpage = str_replace('\\','/',DIR_FS_ADMIN); //convert "\" to '/'
  110.     $zc_adminpage = str_replace('//','/',$zc_adminpage); // remove doubles
  111.     $zc_adminpage = str_replace(strrchr($zc_adminpage,'/'),'',$zc_adminpage); // remove trailing '/'
  112.     if (!defined('DIR_WS_ADMIN') || $zc_pagepath != $zc_adminpage ) {
  113.       echo ('ERROR: The admin/includes/configure.php file has invalid configuration. Please rebuild, or verify specified paths.');
  114.       if (file_exists('../zc_install/index.php')) {
  115.         echo '<br /><a href="../zc_install/index.php">Click here for installation</a>';
  116.       }
  117.       echo '<br /><br /><br /><br />['.$zc_pagepath.']&nbsp;&nbsp;&nbsp;&laquo;&raquo;&nbsp;&nbsp;&nbsp;[' .$zc_adminpage.']<br />';
  118.     }
  119.   }
  120. */
  121. /**
  122.  * include the list of extra configure files
  123.  */
  124. if ($za_dir = @dir(DIR_WS_INCLUDES . 'extra_configures')) {
  125.   while ($zv_file = $za_dir->read()) {
  126.     if (preg_match('~^[^\._].*\.php$~i', $zv_file) > 0) {
  127.       /**
  128.        * load any user/contribution specific configuration files.
  129.        */
  130.       include(DIR_WS_INCLUDES . 'extra_configures/' . $zv_file);
  131.     }
  132.   }
  133.   $za_dir->close();
  134. }
  135. /**
  136.  * init some vars
  137.  */
  138. $template_dir = '';
  139. define('DIR_WS_TEMPLATES', DIR_WS_INCLUDES . 'templates/');
  140. /**
  141.  * Prepare init-system
  142.  */
  143. unset($loaderPrefix); // admin doesn't need this override
  144. $autoLoadConfig = array();
  145. if (isset($loaderPrefix)) {
  146.  $loaderPrefix = preg_replace('/[^a-z_]/', '', $loaderPrefix);
  147. } else {
  148.   $loaderPrefix = 'config';
  149. }
  150. $loader_file = $loaderPrefix . '.core.php';
  151. require('includes/initsystem.php');
  152. /**
  153.  * load the autoloader interpreter code.
  154.  */
  155.   require(DIR_FS_CATALOG . 'includes/autoload_func.php');
  156.  
  157.  
  158.  
  159. function zen_parse_url($url, $element = 'array')
  160. {
  161.   // Read the various elements of the URL, to use in auto-detection of admin foldername (basically a simplified parse_url equivalent which automatically supports ports and uncommon TLDs)
  162.   $t1 = array();
  163.   // scheme
  164.   $s1 = explode('://', $url);
  165.   $t1['scheme'] = $s1[0];
  166.   // host
  167.   $s2 = explode('/', trim($s1[1], '/'));
  168.   $t1['host'] = $s2[0];
  169.   array_shift($s2);
  170.   // path/uri
  171.   $t1['path'] = implode('/', $s2);
  172.   $p1 = ($t1['path'] != '') ? '/' . $t1['path'] : '';
  173.  
  174.   switch($element) {
  175.     case 'path':
  176.     case 'host':
  177.     case 'scheme':
  178.       return $t1[$element];
  179.     case '/path':
  180.       return $p1;
  181.     case 'array':
  182.     default:
  183.       return $t1;
  184.   }
  185. }
  186.