hpdl
|
1
|
1
|
<?php
|
|
2
|
/*
|
hpdl
|
111
|
3
|
$Id: application_top.php 1857 2009-03-01 02:41:14Z hpdl $
|
hpdl
|
1
|
4
|
|
|
5
|
osCommerce, Open Source E-Commerce Solutions
|
|
6
|
http://www.oscommerce.com
|
|
7
|
|
hpdl
|
1848
|
8
|
Copyright (c) 2009 osCommerce
|
hpdl
|
1
|
9
|
|
hpdl
|
1497
|
10
|
This program is free software; you can redistribute it and/or modify
|
|
11
|
it under the terms of the GNU General Public License v2 (1991)
|
|
12
|
as published by the Free Software Foundation.
|
hpdl
|
1
|
13
|
*/
|
|
14
|
|
|
15
|
// start the timer for the page parse time log
|
|
16
|
define('PAGE_PARSE_START_TIME', microtime());
|
|
17
|
|
hpdl
|
735
|
18
|
define('OSC_IN_ADMIN', true);
|
|
19
|
|
hpdl
|
1257
|
20
|
// set the level of error reporting to E_ALL except E_NOTICE
|
|
21
|
error_reporting(E_ALL ^ E_NOTICE);
|
|
22
|
|
hpdl
|
1
|
23
|
// set the local configuration parameters - mainly for developers
|
hpdl
|
1257
|
24
|
if ( file_exists('../includes/local/configure.php') ) {
|
|
25
|
include('../includes/local/configure.php');
|
|
26
|
}
|
hpdl
|
1
|
27
|
|
|
28
|
// include server parameters
|
|
29
|
require('../includes/configure.php');
|
|
30
|
|
hpdl
|
1257
|
31
|
// set the level of error reporting to E_ALL
|
hpdl
|
832
|
32
|
error_reporting(E_ALL);
|
hpdl
|
1
|
33
|
|
|
34
|
// Define the project version
|
hpdl
|
1497
|
35
|
define('PROJECT_VERSION', 'osCommerce 3.0a4');
|
hpdl
|
1
|
36
|
|
|
37
|
// set the type of request (secure or not)
|
|
38
|
$request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'SSL' : 'NONSSL';
|
|
39
|
|
|
40
|
if ($request_type == 'NONSSL') {
|
|
41
|
define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
|
|
42
|
} else {
|
|
43
|
define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
|
|
44
|
}
|
|
45
|
|
|
46
|
// compatibility work-around logic for PHP4
|
hpdl
|
692
|
47
|
require('../includes/functions/compatibility.php');
|
hpdl
|
1
|
48
|
require('includes/functions/compatibility.php');
|
|
49
|
|
|
50
|
// include the list of project filenames
|
|
51
|
require('includes/filenames.php');
|
|
52
|
|
|
53
|
// include the list of project database tables
|
|
54
|
require('../includes/database_tables.php');
|
|
55
|
|
|
56
|
// initialize the cache class
|
|
57
|
require('../includes/classes/cache.php');
|
|
58
|
$osC_Cache = new osC_Cache();
|
|
59
|
|
hpdl
|
1291
|
60
|
// include the administrators log class
|
hpdl
|
1857
|
61
|
if ( file_exists('includes/applications/administrators_log/classes/administrators_log.php') ) {
|
|
62
|
include('includes/applications/administrators_log/classes/administrators_log.php');
|
|
63
|
}
|
hpdl
|
1291
|
64
|
|
hpdl
|
1
|
65
|
// include the database class
|
|
66
|
require('../includes/classes/database.php');
|
|
67
|
|
|
68
|
$osC_Database = osC_Database::connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
|
|
69
|
$osC_Database->selectDatabase(DB_DATABASE);
|
|
70
|
|
|
71
|
// set application wide parameters
|
|
72
|
$Qcfg = $osC_Database->query('select configuration_key as cfgKey, configuration_value as cfgValue from :table_configuration');
|
|
73
|
$Qcfg->bindTable(':table_configuration', TABLE_CONFIGURATION);
|
|
74
|
$Qcfg->setCache('configuration');
|
|
75
|
$Qcfg->execute();
|
|
76
|
|
|
77
|
while ($Qcfg->next()) {
|
|
78
|
define($Qcfg->value('cfgKey'), $Qcfg->value('cfgValue'));
|
|
79
|
}
|
|
80
|
|
|
81
|
$Qcfg->freeResult();
|
|
82
|
|
|
83
|
// define our general functions used application-wide
|
hpdl
|
735
|
84
|
require('../includes/functions/general.php');
|
hpdl
|
1
|
85
|
require('includes/functions/general.php');
|
hpdl
|
735
|
86
|
|
hpdl
|
692
|
87
|
require('../includes/functions/html_output.php');
|
hpdl
|
1
|
88
|
require('includes/functions/html_output.php');
|
|
89
|
|
|
90
|
// include session class
|
hpdl
|
1667
|
91
|
require('../includes/classes/session.php');
|
|
92
|
$osC_Session = osC_Session::load('osCAdminID');
|
hpdl
|
1
|
93
|
$osC_Session->start();
|
|
94
|
|
hpdl
|
1848
|
95
|
if ( !isset($_SESSION['admin']) && (basename($_SERVER['PHP_SELF']) != FILENAME_RPC) ) {
|
hpdl
|
1440
|
96
|
$redirect = false;
|
|
97
|
|
|
98
|
if ( empty($_GET) ) {
|
|
99
|
$redirect = true;
|
|
100
|
} else {
|
hpdl
|
1016
|
101
|
$first_array = array_slice($_GET, 0, 1);
|
|
102
|
$_module = osc_sanitize_string(basename(key($first_array)));
|
|
103
|
|
hpdl
|
1440
|
104
|
if ( $_module != 'login' ) {
|
|
105
|
if ( !isset($_SESSION['redirect_origin']) ) {
|
hpdl
|
1451
|
106
|
$_SESSION['redirect_origin'] = array('module' => $_module,
|
hpdl
|
1440
|
107
|
'get' => $_GET);
|
|
108
|
}
|
|
109
|
|
|
110
|
$redirect = true;
|
hpdl
|
1016
|
111
|
}
|
hpdl
|
1440
|
112
|
}
|
|
113
|
|
|
114
|
if ( $redirect === true ) {
|
hpdl
|
1400
|
115
|
osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, 'login'));
|
hpdl
|
271
|
116
|
}
|
hpdl
|
1440
|
117
|
|
|
118
|
unset($redirect);
|
hpdl
|
271
|
119
|
}
|
|
120
|
|
hpdl
|
1074
|
121
|
require('includes/classes/directory_listing.php');
|
|
122
|
require('includes/classes/access.php');
|
|
123
|
|
hpdl
|
743
|
124
|
require('../includes/classes/address.php');
|
|
125
|
require('../includes/classes/weight.php');
|
hpdl
|
387
|
126
|
require('../includes/classes/xml.php');
|
hpdl
|
735
|
127
|
require('../includes/classes/datetime.php');
|
hpdl
|
387
|
128
|
|
hpdl
|
1
|
129
|
// set the language
|
|
130
|
require('includes/classes/language.php');
|
|
131
|
$osC_Language = new osC_Language_Admin();
|
|
132
|
|
|
133
|
if (isset($_GET['language']) && !empty($_GET['language'])) {
|
|
134
|
$osC_Language->set($_GET['language']);
|
|
135
|
}
|
|
136
|
|
hpdl
|
1475
|
137
|
$osC_Language->loadIniFile();
|
hpdl
|
1
|
138
|
|
hpdl
|
653
|
139
|
header('Content-Type: text/html; charset=' . $osC_Language->getCharacterSet());
|
hpdl
|
1
|
140
|
|
hpdl
|
653
|
141
|
osc_setlocale(LC_TIME, explode(',', $osC_Language->getLocale()));
|
|
142
|
|
hpdl
|
1
|
143
|
// define our localization functions
|
|
144
|
require('includes/functions/localization.php');
|
|
145
|
|
|
146
|
// initialize the message stack for output messages
|
|
147
|
require('../includes/classes/message_stack.php');
|
hpdl
|
1845
|
148
|
$osC_MessageStack = new osC_MessageStack();
|
hpdl
|
1
|
149
|
|
|
150
|
// entry/item info classes
|
|
151
|
require('includes/classes/object_info.php');
|
|
152
|
|
hpdl
|
1518
|
153
|
// email class
|
|
154
|
require('../includes/classes/mail.php');
|
hpdl
|
1
|
155
|
|
|
156
|
// file uploading class
|
|
157
|
require('includes/classes/upload.php');
|
|
158
|
|
|
159
|
// check if a default currency is set
|
|
160
|
if (!defined('DEFAULT_CURRENCY')) {
|
hpdl
|
1475
|
161
|
$osC_MessageStack->add('header', $osC_Language->get('ms_error_no_default_currency'), 'error');
|
hpdl
|
1
|
162
|
}
|
|
163
|
|
|
164
|
// check if a default language is set
|
|
165
|
if (!defined('DEFAULT_LANGUAGE')) {
|
|
166
|
$osC_MessageStack->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
|
|
167
|
}
|
|
168
|
|
|
169
|
if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {
|
hpdl
|
1475
|
170
|
$osC_MessageStack->add('header', $osC_Language->get('ms_warning_uploads_disabled'), 'warning');
|
hpdl
|
1
|
171
|
}
|
|
172
|
?>
|