Advertisement
talkingnews

Zen 139h admin application_top.php

Dec 3rd, 2011
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.02 KB | None | 0 0
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2010 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 $Id: application_top.php 15766 2010-03-31 20:17:56Z drbyte $
  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.  * @copyright Copyright 2003-2010 Zen Cart Development Team
  17.  * @copyright Portions Copyright 2003 osCommerce
  18.  */
  19. /**
  20.  * boolean if true the autoloader scripts will be parsed and their output shown. For debugging purposes only.
  21.  */
  22. define('DEBUG_AUTOLOAD', true);
  23. /**
  24.  * boolean used to see if we are in the admin script, obviously set to false here.
  25.  * DO NOT REMOVE THE define BELOW. WILL BREAK ADMIN
  26.  */
  27. define('IS_ADMIN_FLAG', true);
  28. /**
  29.  * integer saves the time at which the script started.
  30.  */
  31. // Start the clock for the page parse time log
  32. define('PAGE_PARSE_START_TIME', microtime());
  33. /**
  34.  * set the level of error reporting
  35.  *
  36.  * Note STRICT_ERROR_REPORTING should never be set to true on a production site. <br />
  37.  * It is mainly there to show php warnings during testing/bug fixing phases.<br />
  38.  * note for strict error reporting we also turn on show_errors as this may be disabled<br />
  39.  * in php.ini. Otherwise we respect the php.ini setting
  40.  *
  41.  */
  42.  
  43.  define('STRICT_ERROR_REPORTING', true);
  44.  
  45. if (defined('STRICT_ERROR_REPORTING') && STRICT_ERROR_REPORTING == true) {
  46.   @ini_set('display_errors', TRUE);
  47.   error_reporting(version_compare(PHP_VERSION, 5.3, '>=') ? E_ALL & ~E_DEPRECATED & ~E_NOTICE : version_compare(PHP_VERSION, 6.0, '>=') ? E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT : E_ALL & ~E_NOTICE);
  48. } else {
  49.   error_reporting(0);
  50. }
  51. /*
  52.  * turn off magic-quotes support, for both runtime and sybase, as both will cause problems if enabled
  53.  */
  54. if (function_exists('set_magic_quotes_runtime') && version_compare(PHP_VERSION, 5.3, '<')) set_magic_quotes_runtime(0);
  55. if (@ini_get('magic_quotes_sybase') != 0) @ini_set('magic_quotes_sybase', 0);
  56. // set php_self in the local scope
  57. if (!isset($PHP_SELF)) $PHP_SELF = $_SERVER['PHP_SELF'];
  58.  
  59. /**
  60.  * Set the local configuration parameters - mainly for developers
  61.  */
  62. if (file_exists('includes/local/configure.php')) {
  63.   /**
  64.    * load any local(user created) configure file.
  65.    */
  66.   include('includes/local/configure.php');
  67. }
  68. /**
  69.  * check for and load application configuration parameters
  70.  */
  71. if (file_exists('includes/configure.php')) {
  72.   /**
  73.    * load the main configure file.
  74.    */
  75.   include('includes/configure.php');
  76. }
  77. if (!defined('DIR_FS_CATALOG') || !is_dir(DIR_FS_CATALOG.'/includes/classes') || !defined('DB_TYPE') || DB_TYPE == '') {
  78.   if (file_exists('../includes/templates/template_default/templates/tpl_zc_install_suggested_default.php')) {
  79.     require('../includes/templates/template_default/templates/tpl_zc_install_suggested_default.php');
  80.     exit;
  81.   } elseif (file_exists('../zc_install/index.php')) {
  82.     echo 'ERROR: Admin configure.php not found. Suggest running install? <a href="../zc_install/index.php">Click here for installation</a>';
  83.   } else {
  84.     die('ERROR: admin/includes/configure.php file not found. Suggest running zc_install/index.php?');
  85.   }
  86. }
  87. /**
  88.  * ignore version-check if INI file setting has been set
  89.  */
  90. if (file_exists(DIR_FS_ADMIN . 'includes/local/skip_version_check.ini')) {
  91.   $lines = @file(DIR_FS_ADMIN . 'includes/local/skip_version_check.ini');
  92.   if (is_array($lines)) {
  93.     foreach($lines as $line) {
  94.       if (substr($line,0,14)=='admin_configure_php_check=') $check_cfg=substr(trim(strtolower(str_replace('admin_configure_php_check=','',$line))),0,3);
  95.     }
  96.   }
  97. }
  98. /*
  99. // turned off for now
  100.   if ($check_cfg != 'off') {
  101.     // if the admin/includes/configure.php file doesn't contain admin-related content, throw error
  102.     $zc_pagepath = str_replace(basename($PHP_SELF),'',__FILE__); //remove page name from full path of current page
  103.     $zc_pagepath = str_replace(array('\\','\\\\'),'/',$zc_pagepath); // convert '\' marks to '/'
  104.     $zc_pagepath = str_replace('//','/',$zc_pagepath); //convert doubles to single
  105.     $zc_pagepath = str_replace(strrchr($zc_pagepath,'/'),'',$zc_pagepath); // remove trailing '/'
  106.     $zc_adminpage = str_replace('\\','/',DIR_FS_ADMIN); //convert "\" to '/'
  107.     $zc_adminpage = str_replace('//','/',$zc_adminpage); // remove doubles
  108.     $zc_adminpage = str_replace(strrchr($zc_adminpage,'/'),'',$zc_adminpage); // remove trailing '/'
  109.     if (!defined('DIR_WS_ADMIN') || $zc_pagepath != $zc_adminpage ) {
  110.       echo ('ERROR: The admin/includes/configure.php file has invalid configuration. Please rebuild, or verify specified paths.');
  111.       if (file_exists('../zc_install/index.php')) {
  112.         echo '<br /><a href="../zc_install/index.php">Click here for installation</a>';
  113.       }
  114.       echo '<br /><br /><br /><br />['.$zc_pagepath.']&nbsp;&nbsp;&nbsp;&laquo;&raquo;&nbsp;&nbsp;&nbsp;[' .$zc_adminpage.']<br />';
  115.     }
  116.   }
  117. */
  118. /**
  119.  * include the list of extra configure files
  120.  */
  121. if ($za_dir = @dir(DIR_WS_INCLUDES . 'extra_configures')) {
  122.   while ($zv_file = $za_dir->read()) {
  123.     if (preg_match('/\.php$/', $zv_file) > 0) {
  124.       /**
  125.        * load any user/contribution specific configuration files.
  126.        */
  127.       include(DIR_WS_INCLUDES . 'extra_configures/' . $zv_file);
  128.     }
  129.   }
  130.   $za_dir->close();
  131. }
  132. /**
  133.  * init some vars
  134.  */
  135. $template_dir = '';
  136. define('DIR_WS_TEMPLATES', DIR_WS_INCLUDES . 'templates/');
  137. /**
  138.  * Prepare init-system
  139.  */
  140. unset($loaderPrefix); // admin doesn't need this override
  141. $autoLoadConfig = array();
  142. if (isset($loaderPrefix)) {
  143.  $loaderPrefix = preg_replace('/[a-z_]^/', '', $loaderPrefix);
  144. } else {
  145.   $loaderPrefix = 'config';
  146. }
  147. $loader_file = $loaderPrefix . '.core.php';
  148. require('includes/initsystem.php');
  149. /**
  150.  * load the autoloader interpreter code.
  151.  */
  152.   require(DIR_FS_CATALOG . 'includes/autoload_func.php');
  153.  
  154.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement