Quick Search:

View

Revision:

Diff

Diff from 1497 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 1497 2007-03-29 13:40:05Z 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
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 // Used in the "Backup Manager" to compress backups
47   define('LOCAL_EXE_GZIP', '/usr/bin/gzip');
48   define('LOCAL_EXE_GUNZIP', '/usr/bin/gunzip');
49   define('LOCAL_EXE_ZIP', '/usr/local/bin/zip');
50   define('LOCAL_EXE_UNZIP', '/usr/local/bin/unzip');
51
52 // compatibility work-around logic for PHP4
hpdl
692
53   require('../includes/functions/compatibility.php');
hpdl
1
54   require('includes/functions/compatibility.php');
55
56 // include the list of project filenames
57   require('includes/filenames.php');
58
59 // include the list of project database tables
60   require('../includes/database_tables.php');
61
62 // initialize the cache class
63   require('../includes/classes/cache.php');
64   $osC_Cache = new osC_Cache();
65
hpdl
1291
66 // include the administrators log class
67   require('includes/classes/administrators_log.php');
68
hpdl
1
69 // include the database class
70   require('../includes/classes/database.php');
71
72   $osC_Database = osC_Database::connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
73   $osC_Database->selectDatabase(DB_DATABASE);
74
75 // set application wide parameters
76   $Qcfg = $osC_Database->query('select configuration_key as cfgKey, configuration_value as cfgValue from :table_configuration');
77   $Qcfg->bindTable(':table_configuration', TABLE_CONFIGURATION);
78   $Qcfg->setCache('configuration');
79   $Qcfg->execute();
80
81   while ($Qcfg->next()) {
82     define($Qcfg->value('cfgKey'), $Qcfg->value('cfgValue'));
83   }
84
85   $Qcfg->freeResult();
86
87 // define our general functions used application-wide
hpdl
735
88   require('../includes/functions/general.php');
hpdl
1
89   require('includes/functions/general.php');
hpdl
735
90
hpdl
692
91   require('../includes/functions/html_output.php');
hpdl
1
92   require('includes/functions/html_output.php');
93
94 // include session class
hpdl
1241
95   include('includes/classes/session.php');
96   $osC_Session = new osC_Session_Admin('osCAdminID');
hpdl
1
97   $osC_Session->start();
98
hpdl
1440
99   if ( !isset($_SESSION['admin']) ) {
100     $redirect = false;
101
102     if ( empty($_GET) ) {
103       $redirect = true;
104     } else {
hpdl
1016
105       $first_array = array_slice($_GET, 0, 1);
106       $_module = osc_sanitize_string(basename(key($first_array)));
107
hpdl
1440
108       if ( $_module != 'login' ) {
109         if ( !isset($_SESSION['redirect_origin']) ) {
hpdl
1451
110           $_SESSION['redirect_origin'] = array('module' => $_module,
hpdl
1440
111                                                'get' => $_GET);
112         }
113
114         $redirect = true;
hpdl
1016
115       }
hpdl
1440
116     }
117
118     if ( $redirect === true ) {
hpdl
1400
119       osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, 'login'));
hpdl
271
120     }
hpdl
1440
121
122     unset($redirect);
hpdl
271
123   }
124
hpdl
1074
125   require('includes/classes/directory_listing.php');
126   require('includes/classes/access.php');
127
hpdl
743
128   require('../includes/classes/address.php');
129   require('../includes/classes/weight.php');
hpdl
387
130   require('../includes/classes/xml.php');
hpdl
735
131   require('../includes/classes/datetime.php');
hpdl
387
132
hpdl
1
133 // set the language
134   require('includes/classes/language.php');
135   $osC_Language = new osC_Language_Admin();
136
137   if (isset($_GET['language']) && !empty($_GET['language'])) {
138     $osC_Language->set($_GET['language']);
139   }
140
hpdl
1475
141   $osC_Language->loadIniFile();
hpdl
1
142
hpdl
653
143   header('Content-Type: text/html; charset=' . $osC_Language->getCharacterSet());
hpdl
1
144
hpdl
653
145   osc_setlocale(LC_TIME, explode(',', $osC_Language->getLocale()));
146
hpdl
473
147 // load general definitions due to the split page results language definitions the database class uses
hpdl
1016
148 //HPDL (quick fix; will be properly fixed in a later alpha release)
hpdl
473
149   $osC_Language->load('general');
150
hpdl
1
151 // define our localization functions
152   require('includes/functions/localization.php');
153
154 // initialize the message stack for output messages
155   require('../includes/classes/message_stack.php');
156   $osC_MessageStack = new messageStack();
157   $osC_MessageStack->loadFromSession();
158
159 // entry/item info classes
160   require('includes/classes/object_info.php');
161
162 // email classes
hpdl
444
163   require('../includes/classes/mime.php');
164   require('../includes/classes/email.php');
hpdl
1
165
166 // file uploading class
167   require('includes/classes/upload.php');
168
169 // check if a default currency is set
170   if (!defined('DEFAULT_CURRENCY')) {
hpdl
1475
171     $osC_MessageStack->add('header', $osC_Language->get('ms_error_no_default_currency'), 'error');
hpdl
1
172   }
173
174 // check if a default language is set
175   if (!defined('DEFAULT_LANGUAGE')) {
176     $osC_MessageStack->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
177   }
178
179   if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {
hpdl
1475
180     $osC_MessageStack->add('header', $osC_Language->get('ms_warning_uploads_disabled'), 'warning');
hpdl
1
181   }
182 ?>