Quick Search:

View

Revision:

Diff

Diff from 1848 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 1848 2009-02-28 02:21:10Z 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
61   require('includes/classes/administrators_log.php');
62
hpdl
1
63 // include the database class
64   require('../includes/classes/database.php');
65
66   $osC_Database = osC_Database::connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
67   $osC_Database->selectDatabase(DB_DATABASE);
68
69 // set application wide parameters
70   $Qcfg = $osC_Database->query('select configuration_key as cfgKey, configuration_value as cfgValue from :table_configuration');
71   $Qcfg->bindTable(':table_configuration', TABLE_CONFIGURATION);
72   $Qcfg->setCache('configuration');
73   $Qcfg->execute();
74
75   while ($Qcfg->next()) {
76     define($Qcfg->value('cfgKey'), $Qcfg->value('cfgValue'));
77   }
78
79   $Qcfg->freeResult();
80
81 // define our general functions used application-wide
hpdl
735
82   require('../includes/functions/general.php');
hpdl
1
83   require('includes/functions/general.php');
hpdl
735
84
hpdl
692
85   require('../includes/functions/html_output.php');
hpdl
1
86   require('includes/functions/html_output.php');
87
88 // include session class
hpdl
1667
89   require('../includes/classes/session.php');
90   $osC_Session = osC_Session::load('osCAdminID');
hpdl
1
91   $osC_Session->start();
92
hpdl
1848
93   if ( !isset($_SESSION['admin']) && (basename($_SERVER['PHP_SELF']) != FILENAME_RPC) ) {
hpdl
1440
94     $redirect = false;
95
96     if ( empty($_GET) ) {
97       $redirect = true;
98     } else {
hpdl
1016
99       $first_array = array_slice($_GET, 0, 1);
100       $_module = osc_sanitize_string(basename(key($first_array)));
101
hpdl
1440
102       if ( $_module != 'login' ) {
103         if ( !isset($_SESSION['redirect_origin']) ) {
hpdl
1451
104           $_SESSION['redirect_origin'] = array('module' => $_module,
hpdl
1440
105                                                'get' => $_GET);
106         }
107
108         $redirect = true;
hpdl
1016
109       }
hpdl
1440
110     }
111
112     if ( $redirect === true ) {
hpdl
1400
113       osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, 'login'));
hpdl
271
114     }
hpdl
1440
115
116     unset($redirect);
hpdl
271
117   }
118
hpdl
1074
119   require('includes/classes/directory_listing.php');
120   require('includes/classes/access.php');
121
hpdl
743
122   require('../includes/classes/address.php');
123   require('../includes/classes/weight.php');
hpdl
387
124   require('../includes/classes/xml.php');
hpdl
735
125   require('../includes/classes/datetime.php');
hpdl
387
126
hpdl
1
127 // set the language
128   require('includes/classes/language.php');
129   $osC_Language = new osC_Language_Admin();
130
131   if (isset($_GET['language']) && !empty($_GET['language'])) {
132     $osC_Language->set($_GET['language']);
133   }
134
hpdl
1475
135   $osC_Language->loadIniFile();
hpdl
1
136
hpdl
653
137   header('Content-Type: text/html; charset=' . $osC_Language->getCharacterSet());
hpdl
1
138
hpdl
653
139   osc_setlocale(LC_TIME, explode(',', $osC_Language->getLocale()));
140
hpdl
1
141 // define our localization functions
142   require('includes/functions/localization.php');
143
144 // initialize the message stack for output messages
145   require('../includes/classes/message_stack.php');
hpdl
1845
146   $osC_MessageStack = new osC_MessageStack();
hpdl
1
147
148 // entry/item info classes
149   require('includes/classes/object_info.php');
150
hpdl
1518
151 // email class
152   require('../includes/classes/mail.php');
hpdl
1
153
154 // file uploading class
155   require('includes/classes/upload.php');
156
157 // check if a default currency is set
158   if (!defined('DEFAULT_CURRENCY')) {
hpdl
1475
159     $osC_MessageStack->add('header', $osC_Language->get('ms_error_no_default_currency'), 'error');
hpdl
1
160   }
161
162 // check if a default language is set
163   if (!defined('DEFAULT_LANGUAGE')) {
164     $osC_MessageStack->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
165   }
166
167   if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {
hpdl
1475
168     $osC_MessageStack->add('header', $osC_Language->get('ms_warning_uploads_disabled'), 'warning');
hpdl
1
169   }
170 ?>