Quick Search:

View

Revision:

Diff

Diff from 1865 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/osCommerce/trunk/oscommerce/admin/includes/application_top.php

Annotated File View

hpdl
1
1 <?php
2 /*
hpdl
112
3   $Id: application_top.php 1865 2009-03-08 22:00:36Z hpdl $
hpdl
1
4
5   osCommerce, Open Source E-Commerce Solutions
6   http://www.oscommerce.com
7
hpdl
1863
8   Copyright (c) 2009 osCommerce
hpdl
1
9
hpdl
1498
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
758
18   define('OSC_IN_ADMIN', true);
19
hpdl
1358
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
1358
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
1358
31 // set the level of error reporting to E_ALL
hpdl
833
32   error_reporting(E_ALL);
hpdl
1
33
hpdl
1865
34   ini_set('log_errors', true);
35   ini_set('error_log', DIR_FS_WORK . 'oscommerce_errors.log');
36
hpdl
1
37 // Define the project version
hpdl
1498
38   define('PROJECT_VERSION', 'osCommerce 3.0a4');
hpdl
1
39
40 // set the type of request (secure or not)
41   $request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'SSL' : 'NONSSL';
42
43   if ($request_type == 'NONSSL') {
44     define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
45   } else {
46     define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
47   }
48
49 // compatibility work-around logic for PHP4
hpdl
755
50   require('../includes/functions/compatibility.php');
hpdl
1
51   require('includes/functions/compatibility.php');
52
53 // include the list of project filenames
54   require('includes/filenames.php');
55
56 // include the list of project database tables
57   require('../includes/database_tables.php');
58
59 // initialize the cache class
60   require('../includes/classes/cache.php');
61   $osC_Cache = new osC_Cache();
62
hpdl
1372
63 // include the administrators log class
hpdl
1863
64   if ( file_exists('includes/applications/administrators_log/classes/administrators_log.php') ) {
65     include('includes/applications/administrators_log/classes/administrators_log.php');
66   }
hpdl
1372
67
hpdl
1
68 // include the database class
69   require('../includes/classes/database.php');
70
71   $osC_Database = osC_Database::connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
72   $osC_Database->selectDatabase(DB_DATABASE);
73
74 // set application wide parameters
75   $Qcfg = $osC_Database->query('select configuration_key as cfgKey, configuration_value as cfgValue from :table_configuration');
76   $Qcfg->bindTable(':table_configuration', TABLE_CONFIGURATION);
77   $Qcfg->setCache('configuration');
78   $Qcfg->execute();
79
80   while ($Qcfg->next()) {
81     define($Qcfg->value('cfgKey'), $Qcfg->value('cfgValue'));
82   }
83
84   $Qcfg->freeResult();
85
86 // define our general functions used application-wide
hpdl
758
87   require('../includes/functions/general.php');
hpdl
1
88   require('includes/functions/general.php');
hpdl
758
89
hpdl
755
90   require('../includes/functions/html_output.php');
hpdl
1
91   require('includes/functions/html_output.php');
92
93 // include session class
hpdl
1859
94   require('../includes/classes/session.php');
95   $osC_Session = osC_Session::load('osCAdminID');
hpdl
1
96   $osC_Session->start();
97
hpdl
1863
98   if ( !isset($_SESSION['admin']) && (basename($_SERVER['PHP_SELF']) != FILENAME_RPC) ) {
hpdl
1441
99     $redirect = false;
100
101     if ( empty($_GET) ) {
102       $redirect = true;
103     } else {
hpdl
1076
104       $first_array = array_slice($_GET, 0, 1);
105       $_module = osc_sanitize_string(basename(key($first_array)));
106
hpdl
1441
107       if ( $_module != 'login' ) {
108         if ( !isset($_SESSION['redirect_origin']) ) {
hpdl
1452
109           $_SESSION['redirect_origin'] = array('module' => $_module,
hpdl
1441
110                                                'get' => $_GET);
111         }
112
113         $redirect = true;
hpdl
1076
114       }
hpdl
1441
115     }
116
117     if ( $redirect === true ) {
hpdl
1402
118       osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, 'login'));
hpdl
365
119     }
hpdl
1441
120
121     unset($redirect);
hpdl
365
122   }
123
hpdl
1078
124   require('includes/classes/directory_listing.php');
125   require('includes/classes/access.php');
126
hpdl
758
127   require('../includes/classes/address.php');
128   require('../includes/classes/weight.php');
hpdl
410
129   require('../includes/classes/xml.php');
hpdl
758
130   require('../includes/classes/datetime.php');
hpdl
410
131
hpdl
1
132 // set the language
133   require('includes/classes/language.php');
134   $osC_Language = new osC_Language_Admin();
135
136   if (isset($_GET['language']) && !empty($_GET['language'])) {
137     $osC_Language->set($_GET['language']);
138   }
139
hpdl
1492
140   $osC_Language->loadIniFile();
hpdl
1
141
hpdl
654
142   header('Content-Type: text/html; charset=' . $osC_Language->getCharacterSet());
hpdl
1
143
hpdl
654
144   osc_setlocale(LC_TIME, explode(',', $osC_Language->getLocale()));
145
hpdl
1
146 // define our localization functions
147   require('includes/functions/localization.php');
148
149 // initialize the message stack for output messages
150   require('../includes/classes/message_stack.php');
hpdl
1863
151   $osC_MessageStack = new osC_MessageStack();
hpdl
1
152
153 // entry/item info classes
154   require('includes/classes/object_info.php');
155
hpdl
1533
156 // email class
157   require('../includes/classes/mail.php');
hpdl
1
158
159 // file uploading class
160   require('includes/classes/upload.php');
161
162 // check if a default currency is set
163   if (!defined('DEFAULT_CURRENCY')) {
hpdl
1492
164     $osC_MessageStack->add('header', $osC_Language->get('ms_error_no_default_currency'), 'error');
hpdl
1
165   }
166
167 // check if a default language is set
168   if (!defined('DEFAULT_LANGUAGE')) {
169     $osC_MessageStack->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
170   }
171
172   if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {
hpdl
1492
173     $osC_MessageStack->add('header', $osC_Language->get('ms_warning_uploads_disabled'), 'warning');
hpdl
1
174   }
175 ?>