[TEP-COMMIT] [CVS admin] standards updates
anonymous-OfajU3CKLf1/[email protected] 22 Jul 2004 23:02:45 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit in admin/admin/includes on MAIN
application_top.php +73 -108 1.166 -> 1.167
standards updates
use catalog classes where available
----------
admin /admin /includes
application_top.php 1.166 -> 1.167
diff -u -r1.166 -r1.167
--- application_top.php 2004/04/09 02:06:46 1.166
+++ application_top.php 2004/07/22 23:02:43 1.167
@@ -5,34 +5,31 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2003 osCommerce
+ Copyright (c) 2004 osCommerce
Released under the GNU General Public License
*/
-// Start the clock for the page parse time log
+// start the timer for the page parse time log
define('PAGE_PARSE_START_TIME', microtime());
-// Set the level of error reporting
- error_reporting(E_ALL & ~E_NOTICE);
-
-// Check if register_globals is enabled.
-// Since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
- if (function_exists('ini_get')) {
- ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');
- }
-
-// Set the local configuration parameters - mainly for developers
+// set the local configuration parameters - mainly for developers
if (file_exists('includes/local/configure.php')) include('includes/local/configure.php');
-// Include application configuration parameters
+// include server parameters
require('includes/configure.php');
+// set the level of error reporting
+ error_reporting(E_ALL & ~E_NOTICE);
+
// Define the project version
define('PROJECT_VERSION', 'osCommerce 2.2-MS3-CVS');
+// set the type of request (secure or not)
+ $request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'SSL' : 'NONSSL';
+
// set php_self in the local scope
- $PHP_SELF = (isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']);
+ if (!isset($PHP_SELF)) $PHP_SELF = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);
// Used in the "Backup Manager" to compress backups
define('LOCAL_EXE_GZIP', '/usr/bin/gzip');
@@ -40,153 +37,121 @@
define('LOCAL_EXE_ZIP', '/usr/local/bin/zip');
define('LOCAL_EXE_UNZIP', '/usr/local/bin/unzip');
+// compatibility work-around logic for PHP4
+ require('includes/functions/compatibility.php');
+
// include the list of project filenames
- require(DIR_WS_INCLUDES . 'filenames.php');
+ require('includes/filenames.php');
// include the list of project database tables
- require(DIR_WS_INCLUDES . 'database_tables.php');
+ require('includes/database_tables.php');
// customization for the design layout
define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125)
-// Define how do we update currency exchange rates
-// Possible values are 'oanda' 'xe' or ''
- define('CURRENCY_SERVER_PRIMARY', 'oanda');
- define('CURRENCY_SERVER_BACKUP', 'xe');
+// initialize the cache class
+ require('../includes/classes/cache.php');
+ $osC_Cache = new osC_Cache;
// include the database functions
- require(DIR_WS_FUNCTIONS . 'database.php');
+ require('../includes/functions/database.php');
-// make a connection to the database... now
- tep_db_connect() or die('Unable to connect to database server!');
+// include the database class
+ require('../includes/classes/database.php');
+ $osC_Database = osC_Database::connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
+ $osC_Database->selectDatabase(DB_DATABASE);
+
// set application wide parameters
- $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
- while ($configuration = tep_db_fetch_array($configuration_query)) {
- define($configuration['cfgKey'], $configuration['cfgValue']);
+ $Qcfg = $osC_Database->query('select configuration_key as cfgKey, configuration_value as cfgValue from :table_configuration');
+ $Qcfg->bindRaw(':table_configuration', TABLE_CONFIGURATION);
+ $Qcfg->setCache('configuration');
+ $Qcfg->execute();
+
+ while ($Qcfg->next()) {
+ define($Qcfg->value('cfgKey'), $Qcfg->value('cfgValue'));
}
+ $Qcfg->freeResult();
+
// define our general functions used application-wide
- require(DIR_WS_FUNCTIONS . 'general.php');
- require(DIR_WS_FUNCTIONS . 'html_output.php');
+ require('includes/functions/general.php');
+ require('includes/functions/html_output.php');
// initialize the logger class
- require(DIR_WS_CLASSES . 'logger.php');
+ require('includes/classes/logger.php');
// include shopping cart class
- require(DIR_WS_CLASSES . 'shopping_cart.php');
-
-// some code to solve compatibility issues
- require(DIR_WS_FUNCTIONS . 'compatibility.php');
+ require('includes/classes/shopping_cart.php');
-// check to see if php implemented session management functions - if not, include php3/php4 compatible session class
- if (!function_exists('session_start')) {
- define('PHP_SESSION_NAME', 'osCAdminID');
- define('PHP_SESSION_PATH', '/');
- define('PHP_SESSION_SAVE_PATH', DIR_FS_WORK);
-
- include(DIR_WS_CLASSES . 'sessions.php');
+// include session class
+ if (PHP_VERSION < 4.1) {
+ include('../includes/classes/session_compatible.php');
+ } else {
+ include('../includes/classes/session.php');
}
+ $osC_Session = new osC_Session;
+ $osC_Session->setName('osCAdminID');
+ $osC_Session->setSavePath(DIR_FS_WORK);
// define how the session functions will be used
- require(DIR_WS_FUNCTIONS . 'sessions.php');
-
-// set the session name and save path
- tep_session_name('osCAdminID');
- tep_session_save_path(DIR_FS_WORK);
-
-// set the session cookie parameters
- if (function_exists('session_set_cookie_params')) {
- session_set_cookie_params(0, DIR_WS_ADMIN);
- } elseif (function_exists('ini_set')) {
- ini_set('session.cookie_lifetime', '0');
- ini_set('session.cookie_path', DIR_WS_ADMIN);
- }
+ require('includes/functions/sessions.php');
// lets start our session
- tep_session_start();
+ $osC_Session->start();
// set the language
- if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
- if (!tep_session_is_registered('language')) {
- tep_session_register('language');
- tep_session_register('languages_id');
- }
-
- include(DIR_WS_CLASSES . 'language.php');
- $lng = new language();
+ if (($osC_Session->exists('language') == false) || isset($_GET['language'])) {
+ include('../includes/classes/language.php');
+ $lng = new language;
- if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
- $lng->set_language($HTTP_GET_VARS['language']);
+ if (isset($_GET['language']) && tep_not_null($_GET['language'])) {
+ $lng->set_language($_GET['language']);
} else {
$lng->get_browser_language();
}
- $language = $lng->language['directory'];
- $languages_id = $lng->language['id'];
+ $osC_Session->set('language', $lng->language['directory']);
+ $osC_Session->set('languages_id', $lng->language['id']);
}
-// include the language translations
- require(DIR_WS_LANGUAGES . $language . '.php');
+ require('includes/languages/' . $osC_Session->value('language') . '.php');
+
$current_page = basename($PHP_SELF);
- if (file_exists(DIR_WS_LANGUAGES . $language . '/' . $current_page)) {
- include(DIR_WS_LANGUAGES . $language . '/' . $current_page);
+ if (file_exists('includes/languages/' . $osC_Session->value('language') . '/' . $current_page)) {
+ include('includes/languages/' . $osC_Session->value('language') . '/' . $current_page);
}
+ header('Content-Type: text/html; charset=' . CHARSET);
+
+ setlocale(LC_TIME, LANGUAGE_LOCALE);
+
// define our localization functions
- require(DIR_WS_FUNCTIONS . 'localization.php');
+ require('includes/functions/localization.php');
// Include validation functions (right now only email address)
- require(DIR_WS_FUNCTIONS . 'validations.php');
+ require('includes/functions/validations.php');
// setup our boxes
- require(DIR_WS_CLASSES . 'table_block.php');
- require(DIR_WS_CLASSES . 'box.php');
+ require('includes/classes/table_block.php');
+ require('includes/classes/box.php');
// initialize the message stack for output messages
- require(DIR_WS_CLASSES . 'message_stack.php');
+ require('includes/classes/message_stack.php');
$messageStack = new messageStack;
// split-page-results
- require(DIR_WS_CLASSES . 'split_page_results.php');
+ require('includes/classes/split_page_results.php');
// entry/item info classes
- require(DIR_WS_CLASSES . 'object_info.php');
+ require('includes/classes/object_info.php');
// email classes
- require(DIR_WS_CLASSES . 'mime.php');
- require(DIR_WS_CLASSES . 'email.php');
+ require('includes/classes/mime.php');
+ require('includes/classes/email.php');
// file uploading class
- require(DIR_WS_CLASSES . 'upload.php');
-
-// caching class
- require(DIR_FS_CATALOG . 'includes/classes/cache.php');
-
-// calculate category path
- if (isset($HTTP_GET_VARS['cPath'])) {
- $cPath = $HTTP_GET_VARS['cPath'];
- } else {
- $cPath = '';
- }
-
- if (tep_not_null($cPath)) {
- $cPath_array = tep_parse_category_path($cPath);
- $cPath = implode('_', $cPath_array);
- $current_category_id = $cPath_array[(sizeof($cPath_array)-1)];
- } else {
- $current_category_id = 0;
- }
-
-// default open navigation box
- if (!tep_session_is_registered('selected_box')) {
- tep_session_register('selected_box');
- $selected_box = 'configuration';
- }
-
- if (isset($HTTP_GET_VARS['selected_box'])) {
- $selected_box = $HTTP_GET_VARS['selected_box'];
- }
+ require('includes/classes/upload.php');
// the following cache blocks are used in the Tools->Cache section
// ('language' in the filename is automatically replaced by available languages)
CVSspam 0.2.8
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click