Quick Search:

View

Revision:

Diff

Diff from 1257 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 /*
hpdl
111
3   $Id: application_top.php 1257 2007-02-23 23:25:59Z hpdl $
hpdl
1
4
5   osCommerce, Open Source E-Commerce Solutions
6   http://www.oscommerce.com
7
hpdl
1257
8   Copyright (c) 2007 osCommerce
hpdl
1
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
hpdl
735
16   define('OSC_IN_ADMIN', true);
17
hpdl
1257
18 // set the level of error reporting to E_ALL except E_NOTICE
19   error_reporting(E_ALL ^ E_NOTICE);
20
hpdl
1
21 // set the local configuration parameters - mainly for developers
hpdl
1257
22   if ( file_exists('../includes/local/configure.php') ) {
23     include('../includes/local/configure.php');
24   }
hpdl
1
25
26 // include server parameters
27   require('../includes/configure.php');
28
hpdl
1257
29 // set the level of error reporting to E_ALL
hpdl
832
30   error_reporting(E_ALL);
hpdl
1
31
32 // Define the project version
hpdl
1016
33   define('PROJECT_VERSION', 'osCommerce 3.0a4pre');
hpdl
1
34
35 // set the type of request (secure or not)
36   $request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'SSL' : 'NONSSL';
37
38   if ($request_type == 'NONSSL') {
39     define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
40   } else {
41     define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
42   }
43
44 // Used in the "Backup Manager" to compress backups
45   define('LOCAL_EXE_GZIP', '/usr/bin/gzip');
46   define('LOCAL_EXE_GUNZIP', '/usr/bin/gunzip');
47   define('LOCAL_EXE_ZIP', '/usr/local/bin/zip');
48   define('LOCAL_EXE_UNZIP', '/usr/local/bin/unzip');
49
50 // compatibility work-around logic for PHP4
hpdl
692
51   require('../includes/functions/compatibility.php');
hpdl
1
52   require('includes/functions/compatibility.php');
53
54 // include the list of project filenames
55   require('includes/filenames.php');
56
57 // include the list of project database tables
58   require('../includes/database_tables.php');
59
60 // initialize the cache class
61   require('../includes/classes/cache.php');
62   $osC_Cache = new osC_Cache();
63
64 // include the database class
65   require('../includes/classes/database.php');
66
67   $osC_Database = osC_Database::connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
68   $osC_Database->selectDatabase(DB_DATABASE);
69
70 // set application wide parameters
71   $Qcfg = $osC_Database->query('select configuration_key as cfgKey, configuration_value as cfgValue from :table_configuration');
72   $Qcfg->bindTable(':table_configuration', TABLE_CONFIGURATION);
73   $Qcfg->setCache('configuration');
74   $Qcfg->execute();
75
76   while ($Qcfg->next()) {
77     define($Qcfg->value('cfgKey'), $Qcfg->value('cfgValue'));
78   }
79
80   $Qcfg->freeResult();
81
82 // define our general functions used application-wide
hpdl
735
83   require('../includes/functions/general.php');
hpdl
1
84   require('includes/functions/general.php');
hpdl
735
85
hpdl
692
86   require('../includes/functions/html_output.php');
hpdl
1
87   require('includes/functions/html_output.php');
88
89 // include session class
hpdl
1241
90   include('includes/classes/session.php');
91   $osC_Session = new osC_Session_Admin('osCAdminID');
hpdl
1
92   $osC_Session->start();
93
hpdl
1016
94   if (!isset($_SESSION['admin'])) {
95     if (!empty($_GET)) {
96       $first_array = array_slice($_GET, 0, 1);
97       $_module = osc_sanitize_string(basename(key($first_array)));
98
99       if ($_module != 'login') {
100         osc_redirect(osc_href_link_admin(FILENAME_DEFAULT, 'login'));
101       }
102     } else {
103       osc_redirect(osc_href_link_admin(FILENAME_DEFAULT, 'login'));
hpdl
271
104     }
105   }
106
hpdl
1074
107   require('includes/classes/directory_listing.php');
108   require('includes/classes/access.php');
109
hpdl
743
110   require('../includes/classes/address.php');
111   require('../includes/classes/weight.php');
hpdl
387
112   require('../includes/classes/xml.php');
hpdl
735
113   require('../includes/classes/datetime.php');
hpdl
387
114
hpdl
1
115 // set the language
116   require('includes/classes/language.php');
117   $osC_Language = new osC_Language_Admin();
118
119   if (isset($_GET['language']) && !empty($_GET['language'])) {
120     $osC_Language->set($_GET['language']);
121   }
122
hpdl
395
123   $osC_Language->loadConstants();
hpdl
1
124
hpdl
653
125   header('Content-Type: text/html; charset=' . $osC_Language->getCharacterSet());
hpdl
1
126
hpdl
653
127   osc_setlocale(LC_TIME, explode(',', $osC_Language->getLocale()));
128
hpdl
473
129 // load general definitions due to the split page results language definitions the database class uses
hpdl
1016
130 //HPDL (quick fix; will be properly fixed in a later alpha release)
hpdl
473
131   $osC_Language->load('general');
132
hpdl
1
133 // define our localization functions
134   require('includes/functions/localization.php');
135
136 // initialize the message stack for output messages
137   require('../includes/classes/message_stack.php');
138   $osC_MessageStack = new messageStack();
139   $osC_MessageStack->loadFromSession();
140
141 // entry/item info classes
142   require('includes/classes/object_info.php');
143
144 // email classes
hpdl
444
145   require('../includes/classes/mime.php');
146   require('../includes/classes/email.php');
hpdl
1
147
148 // file uploading class
149   require('includes/classes/upload.php');
150
151 // check if a default currency is set
152   if (!defined('DEFAULT_CURRENCY')) {
153     $osC_MessageStack->add('header', ERROR_NO_DEFAULT_CURRENCY_DEFINED, 'error');
154   }
155
156 // check if a default language is set
157   if (!defined('DEFAULT_LANGUAGE')) {
158     $osC_MessageStack->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
159   }
160
161   if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {
162     $osC_MessageStack->add('header', WARNING_FILE_UPLOADS_DISABLED, 'warning');
163   }
164 ?>