Quick Search:

View

Revision:

Diff

Diff from 1400 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 1400 2007-03-07 00:05:32Z 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
hpdl
1291
64 // include the administrators log class
65   require('includes/classes/administrators_log.php');
66
hpdl
1
67 // include the database class
68   require('../includes/classes/database.php');
69
70   $osC_Database = osC_Database::connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
71   $osC_Database->selectDatabase(DB_DATABASE);
72
73 // set application wide parameters
74   $Qcfg = $osC_Database->query('select configuration_key as cfgKey, configuration_value as cfgValue from :table_configuration');
75   $Qcfg->bindTable(':table_configuration', TABLE_CONFIGURATION);
76   $Qcfg->setCache('configuration');
77   $Qcfg->execute();
78
79   while ($Qcfg->next()) {
80     define($Qcfg->value('cfgKey'), $Qcfg->value('cfgValue'));
81   }
82
83   $Qcfg->freeResult();
84
85 // define our general functions used application-wide
hpdl
735
86   require('../includes/functions/general.php');
hpdl
1
87   require('includes/functions/general.php');
hpdl
735
88
hpdl
692
89   require('../includes/functions/html_output.php');
hpdl
1
90   require('includes/functions/html_output.php');
91
92 // include session class
hpdl
1241
93   include('includes/classes/session.php');
94   $osC_Session = new osC_Session_Admin('osCAdminID');
hpdl
1
95   $osC_Session->start();
96
hpdl
1016
97   if (!isset($_SESSION['admin'])) {
98     if (!empty($_GET)) {
99       $first_array = array_slice($_GET, 0, 1);
100       $_module = osc_sanitize_string(basename(key($first_array)));
101
102       if ($_module != 'login') {
hpdl
1400
103         osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, 'login'));
hpdl
1016
104       }
105     } else {
hpdl
1400
106       osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, 'login'));
hpdl
271
107     }
108   }
109
hpdl
1074
110   require('includes/classes/directory_listing.php');
111   require('includes/classes/access.php');
112
hpdl
743
113   require('../includes/classes/address.php');
114   require('../includes/classes/weight.php');
hpdl
387
115   require('../includes/classes/xml.php');
hpdl
735
116   require('../includes/classes/datetime.php');
hpdl
387
117
hpdl
1
118 // set the language
119   require('includes/classes/language.php');
120   $osC_Language = new osC_Language_Admin();
121
122   if (isset($_GET['language']) && !empty($_GET['language'])) {
123     $osC_Language->set($_GET['language']);
124   }
125
hpdl
395
126   $osC_Language->loadConstants();
hpdl
1
127
hpdl
653
128   header('Content-Type: text/html; charset=' . $osC_Language->getCharacterSet());
hpdl
1
129
hpdl
653
130   osc_setlocale(LC_TIME, explode(',', $osC_Language->getLocale()));
131
hpdl
473
132 // load general definitions due to the split page results language definitions the database class uses
hpdl
1016
133 //HPDL (quick fix; will be properly fixed in a later alpha release)
hpdl
473
134   $osC_Language->load('general');
135
hpdl
1
136 // define our localization functions
137   require('includes/functions/localization.php');
138
139 // initialize the message stack for output messages
140   require('../includes/classes/message_stack.php');
141   $osC_MessageStack = new messageStack();
142   $osC_MessageStack->loadFromSession();
143
144 // entry/item info classes
145   require('includes/classes/object_info.php');
146
147 // email classes
hpdl
444
148   require('../includes/classes/mime.php');
149   require('../includes/classes/email.php');
hpdl
1
150
151 // file uploading class
152   require('includes/classes/upload.php');
153
154 // check if a default currency is set
155   if (!defined('DEFAULT_CURRENCY')) {
156     $osC_MessageStack->add('header', ERROR_NO_DEFAULT_CURRENCY_DEFINED, 'error');
157   }
158
159 // check if a default language is set
160   if (!defined('DEFAULT_LANGUAGE')) {
161     $osC_MessageStack->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
162   }
163
164   if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {
165     $osC_MessageStack->add('header', WARNING_FILE_UPLOADS_DISABLED, 'warning');
166   }
167 ?>