| [ Index ] | osCommerce
Docs :: PHP Cross Reference For osCommerce 2.2 MS2 Provided By OSCdox.com |
1 <?php 2 /* 3 $Id: application_top.php,v 1.162 2003/07/12 09:39:03 hpdl Exp $ 4 5 osCommerce, Open Source E-Commerce Solutions 6 http://www.oscommerce.com 7 8 Copyright (c) 2003 osCommerce 9 10 Released under the GNU General Public License 11 */ 12 13 // Start the clock for the page parse time log 14 define('PAGE_PARSE_START_TIME', microtime()); 15 16 // Set the level of error reporting 17 error_reporting(E_ALL & ~E_NOTICE); 18 19 // Check if register_globals is enabled. 20 // Since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized. 21 if (function_exists('ini_get')) { 22 ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!'); 23 } 24 25 // Set the local configuration parameters - mainly for developers 26 if (file_exists('includes/local/configure.php')) include('includes/local/configure.php'); 27 28 // Include application configuration parameters 29 require ('includes/configure.php'); 30 31 // Define the project version 32 define('PROJECT_VERSION', 'osCommerce 2.2-MS2'); 33 34 // set php_self in the local scope 35 $PHP_SELF = (isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']); 36 37 // Used in the "Backup Manager" to compress backups 38 define('LOCAL_EXE_GZIP', '/usr/bin/gzip'); 39 define('LOCAL_EXE_GUNZIP', '/usr/bin/gunzip'); 40 define('LOCAL_EXE_ZIP', '/usr/local/bin/zip'); 41 define('LOCAL_EXE_UNZIP', '/usr/local/bin/unzip'); 42 43 // include the list of project filenames 44 require (DIR_WS_INCLUDES . 'filenames.php'); 45 46 // include the list of project database tables 47 require (DIR_WS_INCLUDES . 'database_tables.php'); 48 49 // customization for the design layout 50 define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125) 51 52 // Define how do we update currency exchange rates 53 // Possible values are 'oanda' 'xe' or '' 54 define('CURRENCY_SERVER_PRIMARY', 'oanda'); 55 define('CURRENCY_SERVER_BACKUP', 'xe'); 56 57 // include the database functions 58 require (DIR_WS_FUNCTIONS . 'database.php'); 59 60 // make a connection to the database... now 61 tep_db_connect() or die('Unable to connect to database server!'); 62 63 // set application wide parameters 64 $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION); 65 while ($configuration = tep_db_fetch_array($configuration_query)) { 66 define($configuration['cfgKey'], $configuration['cfgValue']); 67 } 68 69 // define our general functions used application-wide 70 require (DIR_WS_FUNCTIONS . 'general.php'); 71 require (DIR_WS_FUNCTIONS . 'html_output.php'); 72 73 // initialize the logger class 74 require(DIR_WS_CLASSES . 'logger.php'); 75 76 // include shopping cart class 77 require (DIR_WS_CLASSES . 'shopping_cart.php'); 78 79 // some code to solve compatibility issues 80 require (DIR_WS_FUNCTIONS . 'compatibility.php'); 81 82 // check to see if php implemented session management functions - if not, include php3/php4 compatible session class 83 if (!function_exists('session_start')) { 84 define('PHP_SESSION_NAME', 'osCAdminID'); 85 define('PHP_SESSION_PATH', '/'); 86 define('PHP_SESSION_SAVE_PATH', SESSION_WRITE_DIRECTORY); 87 88 include (DIR_WS_CLASSES . 'sessions.php'); 89 } 90 91 // define how the session functions will be used 92 require (DIR_WS_FUNCTIONS . 'sessions.php'); 93 94 // set the session name and save path 95 tep_session_name('osCAdminID'); 96 tep_session_save_path(SESSION_WRITE_DIRECTORY); 97 98 // set the session cookie parameters 99 if (function_exists('session_set_cookie_params')) { 100 session_set_cookie_params(0, DIR_WS_ADMIN); 101 } elseif (function_exists('ini_set')) { 102 ini_set('session.cookie_lifetime', '0'); 103 ini_set('session.cookie_path', DIR_WS_ADMIN); 104 } 105 106 // lets start our session 107 tep_session_start(); 108 109 // set the language 110 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) { 111 if (!tep_session_is_registered('language')) { 112 tep_session_register('language'); 113 tep_session_register('languages_id'); 114 } 115 116 include (DIR_WS_CLASSES . 'language.php'); 117 $lng = new language(); 118 119 if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) { 120 $lng->set_language($HTTP_GET_VARS['language']); 121 } else { 122 $lng->get_browser_language(); 123 } 124 125 $language = $lng->language['directory']; 126 $languages_id = $lng->language['id']; 127 } 128 129 // include the language translations 130 require(DIR_WS_LANGUAGES . $language . '.php'); 131 $current_page = basename($PHP_SELF); 132 if (file_exists(DIR_WS_LANGUAGES . $language . '/' . $current_page)) { 133 include(DIR_WS_LANGUAGES . $language . '/' . $current_page); 134 } 135 136 // define our localization functions 137 require(DIR_WS_FUNCTIONS . 'localization.php'); 138 139 // Include validation functions (right now only email address) 140 require (DIR_WS_FUNCTIONS . 'validations.php'); 141 142 // setup our boxes 143 require(DIR_WS_CLASSES . 'table_block.php'); 144 require(DIR_WS_CLASSES . 'box.php'); 145 146 // initialize the message stack for output messages 147 require (DIR_WS_CLASSES . 'message_stack.php'); 148 $messageStack = new messageStack; 149 150 // split-page-results 151 require (DIR_WS_CLASSES . 'split_page_results.php'); 152 153 // entry/item info classes 154 require(DIR_WS_CLASSES . 'object_info.php'); 155 156 // email classes 157 require (DIR_WS_CLASSES . 'mime.php'); 158 require (DIR_WS_CLASSES . 'email.php'); 159 160 // file uploading class 161 require(DIR_WS_CLASSES . 'upload.php'); 162 163 // calculate category path 164 if (isset($HTTP_GET_VARS['cPath'])) { 165 $cPath = $HTTP_GET_VARS['cPath']; 166 } else { 167 $cPath = ''; 168 } 169 170 if (tep_not_null($cPath)) { 171 $cPath_array = tep_parse_category_path($cPath); 172 $cPath = implode('_', $cPath_array); 173 $current_category_id = $cPath_array[(sizeof($cPath_array)-1)]; 174 } else { 175 $current_category_id = 0; 176 } 177 178 // default open navigation box 179 if (!tep_session_is_registered('selected_box')) { 180 tep_session_register('selected_box'); 181 $selected_box = 'configuration'; 182 } 183 184 if (isset($HTTP_GET_VARS['selected_box'])) { 185 $selected_box = $HTTP_GET_VARS['selected_box']; 186 } 187 188 // the following cache blocks are used in the Tools->Cache section 189 // ('language' in the filename is automatically replaced by available languages) 190 $cache_blocks = array(array('title' => TEXT_CACHE_CATEGORIES, 'code' => 'categories', 'file' => 'categories_box-language.cache', 'multiple' => true), 191 array('title' => TEXT_CACHE_MANUFACTURERS, 'code' => 'manufacturers', 'file' => 'manufacturers_box-language.cache', 'multiple' => true), 192 array('title' => TEXT_CACHE_ALSO_PURCHASED, 'code' => 'also_purchased', 'file' => 'also_purchased-language.cache', 'multiple' => true) 193 ); 194 195 // check if a default currency is set 196 if (!defined('DEFAULT_CURRENCY')) { 197 $messageStack->add(ERROR_NO_DEFAULT_CURRENCY_DEFINED, 'error'); 198 } 199 200 // check if a default language is set 201 if (!defined('DEFAULT_LANGUAGE')) { 202 $messageStack->add(ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error'); 203 } 204 205 if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) { 206 $messageStack->add(WARNING_FILE_UPLOADS_DISABLED, 'warning'); 207 } 208 ?>
title
Description
Body
title
Description
Body
| Generated: Tue Nov 4 23:53:39 2003 | Hosted By :: AABox.com |
Cross-referenced by PHPXref 0.4 |