Quick Search:

View

Revision:

Diff

Diff from 1241 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 1241 2007-02-06 03:20:58Z hpdl $
hpdl
1
4
5   osCommerce, Open Source E-Commerce Solutions
6   http://www.oscommerce.com
7
hpdl
470
8   Copyright (c) 2006 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
1
18 // set the local configuration parameters - mainly for developers
19   if (file_exists('../includes/local/configure.php')) include('../includes/local/configure.php');
20
21 // include server parameters
22   require('../includes/configure.php');
23
24 // set the level of error reporting
hpdl
832
25   error_reporting(E_ALL);
hpdl
1
26
27 // Define the project version
hpdl
1016
28   define('PROJECT_VERSION', 'osCommerce 3.0a4pre');
hpdl
1
29
30 // set the type of request (secure or not)
31   $request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'SSL' : 'NONSSL';
32
33   if ($request_type == 'NONSSL') {
34     define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
35   } else {
36     define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
37   }
38
39 // Used in the "Backup Manager" to compress backups
40   define('LOCAL_EXE_GZIP', '/usr/bin/gzip');
41   define('LOCAL_EXE_GUNZIP', '/usr/bin/gunzip');
42   define('LOCAL_EXE_ZIP', '/usr/local/bin/zip');
43   define('LOCAL_EXE_UNZIP', '/usr/local/bin/unzip');
44
45 // compatibility work-around logic for PHP4
hpdl
692
46   require('../includes/functions/compatibility.php');
hpdl
1
47   require('includes/functions/compatibility.php');
48
49 // include the list of project filenames
50   require('includes/filenames.php');
51
52 // include the list of project database tables
53   require('../includes/database_tables.php');
54
55 // initialize the cache class
56   require('../includes/classes/cache.php');
57   $osC_Cache = new osC_Cache();
58
59 // include the database class
60   require('../includes/classes/database.php');
61
62   $osC_Database = osC_Database::connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
63   $osC_Database->selectDatabase(DB_DATABASE);
64
65 // set application wide parameters
66   $Qcfg = $osC_Database->query('select configuration_key as cfgKey, configuration_value as cfgValue from :table_configuration');
67   $Qcfg->bindTable(':table_configuration', TABLE_CONFIGURATION);
68   $Qcfg->setCache('configuration');
69   $Qcfg->execute();
70
71   while ($Qcfg->next()) {
72     define($Qcfg->value('cfgKey'), $Qcfg->value('cfgValue'));
73   }
74
75   $Qcfg->freeResult();
76
77 // define our general functions used application-wide
hpdl
735
78   require('../includes/functions/general.php');
hpdl
1
79   require('includes/functions/general.php');
hpdl
735
80
hpdl
692
81   require('../includes/functions/html_output.php');
hpdl
1
82   require('includes/functions/html_output.php');
83
84 // include session class
hpdl
1241
85   include('includes/classes/session.php');
86   $osC_Session = new osC_Session_Admin('osCAdminID');
hpdl
1
87   $osC_Session->start();
88
hpdl
1016
89   if (!isset($_SESSION['admin'])) {
90     if (!empty($_GET)) {
91       $first_array = array_slice($_GET, 0, 1);
92       $_module = osc_sanitize_string(basename(key($first_array)));
93
94       if ($_module != 'login') {
95         osc_redirect(osc_href_link_admin(FILENAME_DEFAULT, 'login'));
96       }
97     } else {
98       osc_redirect(osc_href_link_admin(FILENAME_DEFAULT, 'login'));
hpdl
271
99     }
100   }
101
hpdl
1074
102   require('includes/classes/directory_listing.php');
103   require('includes/classes/access.php');
104
hpdl
743
105   require('../includes/classes/address.php');
106   require('../includes/classes/weight.php');
hpdl
387
107   require('../includes/classes/xml.php');
hpdl
735
108   require('../includes/classes/datetime.php');
hpdl
387
109
hpdl
1
110 // set the language
111   require('includes/classes/language.php');
112   $osC_Language = new osC_Language_Admin();
113
114   if (isset($_GET['language']) && !empty($_GET['language'])) {
115     $osC_Language->set($_GET['language']);
116   }
117
hpdl
395
118   $osC_Language->loadConstants();
hpdl
1
119
hpdl
653
120   header('Content-Type: text/html; charset=' . $osC_Language->getCharacterSet());
hpdl
1
121
hpdl
653
122   osc_setlocale(LC_TIME, explode(',', $osC_Language->getLocale()));
123
hpdl
473
124 // load general definitions due to the split page results language definitions the database class uses
hpdl
1016
125 //HPDL (quick fix; will be properly fixed in a later alpha release)
hpdl
473
126   $osC_Language->load('general');
127
hpdl
1
128 // define our localization functions
129   require('includes/functions/localization.php');
130
131 // initialize the message stack for output messages
132   require('../includes/classes/message_stack.php');
133   $osC_MessageStack = new messageStack();
134   $osC_MessageStack->loadFromSession();
135
136 // entry/item info classes
137   require('includes/classes/object_info.php');
138
139 // email classes
hpdl
444
140   require('../includes/classes/mime.php');
141   require('../includes/classes/email.php');
hpdl
1
142
143 // file uploading class
144   require('includes/classes/upload.php');
145
146 // check if a default currency is set
147   if (!defined('DEFAULT_CURRENCY')) {
148     $osC_MessageStack->add('header', ERROR_NO_DEFAULT_CURRENCY_DEFINED, 'error');
149   }
150
151 // check if a default language is set
152   if (!defined('DEFAULT_LANGUAGE')) {
153     $osC_MessageStack->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
154   }
155
156   if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {
157     $osC_MessageStack->add('header', WARNING_FILE_UPLOADS_DISABLED, 'warning');
158   }
159 ?>