Quick Search:

View

Revision:

Diff

Diff from 1 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/osCommerce/branches/hpdl/oscommerce/admin/includes/application_top.php

Annotated File View

hpdl
1
1 <?php
2 /*
3   $Id: application_top.php,v 1.184 2004/11/29 14:33:43 hpdl Exp $
4
5   osCommerce, Open Source E-Commerce Solutions
6   http://www.oscommerce.com
7
8   Copyright (c) 2004 osCommerce
9
10   Released under the GNU General Public License
11 */
12
13 // start the timer for the page parse time log
14   define('PAGE_PARSE_START_TIME', microtime());
15
16 // set the local configuration parameters - mainly for developers
17   if (file_exists('../includes/local/configure.php')) include('../includes/local/configure.php');
18
19 // include server parameters
20   require('../includes/configure.php');
21
22 // set the level of error reporting
23   error_reporting(E_ALL & ~E_NOTICE);
24
25 // Define the project version
26   define('PROJECT_VERSION', 'osCommerce 2.2-MS3-CVS');
27
28 // set the type of request (secure or not)
29   $request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'SSL' : 'NONSSL';
30
31   if ($request_type == 'NONSSL') {
32     define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
33   } else {
34     define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
35   }
36
37 // set php_self in the local scope
38   if (!isset($PHP_SELF)) $PHP_SELF = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);
39
40 // Used in the "Backup Manager" to compress backups
41   define('LOCAL_EXE_GZIP', '/usr/bin/gzip');
42   define('LOCAL_EXE_GUNZIP', '/usr/bin/gunzip');
43   define('LOCAL_EXE_ZIP', '/usr/local/bin/zip');
44   define('LOCAL_EXE_UNZIP', '/usr/local/bin/unzip');
45
46 // compatibility work-around logic for PHP4
47   require('includes/functions/compatibility.php');
48
49 // include the list of project filenames
50   require('includes/filenames.php');
51
52 // include the list of project database tables
53   require('../includes/database_tables.php');
54
55 // initialize the cache class
56   require('../includes/classes/cache.php');
57   $osC_Cache = new osC_Cache();
58
59 // include the database class
60   require('../includes/classes/database.php');
61
62   $osC_Database = osC_Database::connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
63   $osC_Database->selectDatabase(DB_DATABASE);
64
65 // set application wide parameters
66   $Qcfg = $osC_Database->query('select configuration_key as cfgKey, configuration_value as cfgValue from :table_configuration');
67   $Qcfg->bindTable(':table_configuration', TABLE_CONFIGURATION);
68   $Qcfg->setCache('configuration');
69   $Qcfg->execute();
70
71   while ($Qcfg->next()) {
72     define($Qcfg->value('cfgKey'), $Qcfg->value('cfgValue'));
73   }
74
75   $Qcfg->freeResult();
76
77 // define our general functions used application-wide
78   require('includes/functions/general.php');
79   require('includes/functions/html_output.php');
80
81 // include session class
82   if (PHP_VERSION < 4.1) {
83     include('../includes/classes/session_compatible.php');
84   } else {
85     include('../includes/classes/session.php');
86   }
87   $osC_Session = new osC_Session();
88   $osC_Session->setName('osCAdminID');
89
90 // lets start our session
91   $osC_Session->start();
92
93 // set the language
94   require('includes/classes/language.php');
95   $osC_Language = new osC_Language_Admin();
96
97   if (isset($_GET['language']) && !empty($_GET['language'])) {
98     $osC_Language->set($_GET['language']);
99   }
100
101   require('includes/languages/' . $osC_Session->value('language') . '.php');
102
103   header('Content-Type: text/html; charset=' . CHARSET);
104
105   setlocale(LC_TIME, LANGUAGE_LOCALE);
106
107   $current_page = basename($PHP_SELF);
108   if (file_exists('includes/languages/' . $osC_Session->value('language') . '/' . $current_page)) {
109     include('includes/languages/' . $osC_Session->value('language') . '/' . $current_page);
110   }
111
112 // define our localization functions
113   require('includes/functions/localization.php');
114
115 // Include validation functions (right now only email address)
116   require('includes/functions/validations.php');
117
118 // initialize the message stack for output messages
119   require('../includes/classes/message_stack.php');
120   $osC_MessageStack = new messageStack();
121   $osC_MessageStack->loadFromSession();
122
123 // entry/item info classes
124   require('includes/classes/object_info.php');
125
126 // email classes
127   require('includes/classes/mime.php');
128   require('includes/classes/email.php');
129
130 // file uploading class
131   require('includes/classes/upload.php');
132
133 // check if a default currency is set
134   if (!defined('DEFAULT_CURRENCY')) {
135     $osC_MessageStack->add('header', ERROR_NO_DEFAULT_CURRENCY_DEFINED, 'error');
136   }
137
138 // check if a default language is set
139   if (!defined('DEFAULT_LANGUAGE')) {
140     $osC_MessageStack->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
141   }
142
143   if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {
144     $osC_MessageStack->add('header', WARNING_FILE_UPLOADS_DISABLED, 'warning');
145   }
146 ?>