Quick Search:

View

Revision:

Diff

Diff from 1440 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 1440 2007-03-08 21:39:47Z 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
1440
97   if ( !isset($_SESSION['admin']) ) {
98     $redirect = false;
99
100     if ( empty($_GET) ) {
101       $redirect = true;
102     } else {
hpdl
1016
103       $first_array = array_slice($_GET, 0, 1);
104       $_module = osc_sanitize_string(basename(key($first_array)));
105
hpdl
1440
106       if ( $_module != 'login' ) {
107         if ( !isset($_SESSION['redirect_origin']) ) {
108           $_SESSION['redirect_origin'] = array('module' => $module,
109                                                'get' => $_GET);
110         }
111
112         $redirect = true;
hpdl
1016
113       }
hpdl
1440
114     }
115
116     if ( $redirect === true ) {
hpdl
1400
117       osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, 'login'));
hpdl
271
118     }
hpdl
1440
119
120     unset($redirect);
hpdl
271
121   }
122
hpdl
1074
123   require('includes/classes/directory_listing.php');
124   require('includes/classes/access.php');
125
hpdl
743
126   require('../includes/classes/address.php');
127   require('../includes/classes/weight.php');
hpdl
387
128   require('../includes/classes/xml.php');
hpdl
735
129   require('../includes/classes/datetime.php');
hpdl
387
130
hpdl
1
131 // set the language
132   require('includes/classes/language.php');
133   $osC_Language = new osC_Language_Admin();
134
135   if (isset($_GET['language']) && !empty($_GET['language'])) {
136     $osC_Language->set($_GET['language']);
137   }
138
hpdl
395
139   $osC_Language->loadConstants();
hpdl
1
140
hpdl
653
141   header('Content-Type: text/html; charset=' . $osC_Language->getCharacterSet());
hpdl
1
142
hpdl
653
143   osc_setlocale(LC_TIME, explode(',', $osC_Language->getLocale()));
144
hpdl
473
145 // load general definitions due to the split page results language definitions the database class uses
hpdl
1016
146 //HPDL (quick fix; will be properly fixed in a later alpha release)
hpdl
473
147   $osC_Language->load('general');
148
hpdl
1
149 // define our localization functions
150   require('includes/functions/localization.php');
151
152 // initialize the message stack for output messages
153   require('../includes/classes/message_stack.php');
154   $osC_MessageStack = new messageStack();
155   $osC_MessageStack->loadFromSession();
156
157 // entry/item info classes
158   require('includes/classes/object_info.php');
159
160 // email classes
hpdl
444
161   require('../includes/classes/mime.php');
162   require('../includes/classes/email.php');
hpdl
1
163
164 // file uploading class
165   require('includes/classes/upload.php');
166
167 // check if a default currency is set
168   if (!defined('DEFAULT_CURRENCY')) {
169     $osC_MessageStack->add('header', ERROR_NO_DEFAULT_CURRENCY_DEFINED, 'error');
170   }
171
172 // check if a default language is set
173   if (!defined('DEFAULT_LANGUAGE')) {
174     $osC_MessageStack->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
175   }
176
177   if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {
178     $osC_MessageStack->add('header', WARNING_FILE_UPLOADS_DISABLED, 'warning');
179   }
180 ?>