forked from SvenMichaelKlose/dev-coin-online-shop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
121 lines (88 loc) · 4.16 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?
# This is the main file of the public script.
#
# Copyright (c) 2000-2001 dev/consulting GmbH
# Copyright (c) 2011,2014 Sven Michael Klose <pixel@hugbox.org>
# We want it strict.
error_reporting (-1); # "strict-mode-surrogate-extract"
# Set true for excessive verbosity/profiling.
$debug = 0;
# Show overall time needed to create page.
# Note that this options spoils images so they won't be displayed by any browser.
$page_profiler = false;
$PATH_TO_ADMIN = 'admin/';
define ('PATH_TO_ADMIN', 'admin');
if (!file_exists ('./config.php'))
die ('Can\'t find database configuration file config.php - stop.');
include 'config.php';
if (!file_exists ('caroshi-php/index.php'))
die ('Can\'t find caroshi-php/index.php config.php - please download <a href="https://github.com/SvenMichaelKlose/Caroshi-PHP">Caroshi-PHP</a> and extract it here.');
require_once 'caroshi-php/index.php';
# Get current time for profiling.
if ($debug || $page_profiler) {
$t = gettimeofday ();
$__start_time = $t['usec'] + $t['sec'] * 1000000;
}
######################
### External files ###
######################
include PATH_TO_CAROSHI . '/string/strhead.php'; # Get head of strings.
include PATH_TO_CAROSHI . '/string/htmllig2latin.php'; # Convert HTML ligatures to latin characters. E.g. ä => ae
include PATH_TO_CAROSHI . '/text/xml/scanner.class.php'; # scanner.class is the template scanner.
include PATH_TO_CAROSHI . '/proc/panic.class.php'; # Panic and tell the administrator about incidents.
include PATH_TO_CAROSHI . '/proc/debug_dump.php'; # Debug dumps.
include PATH_TO_CAROSHI . '/dbi/dbctrl.class.php'; # Basic database access.
include PATH_TO_CAROSHI . '/dbi/dbdepend.class.php'; # Database table relations.
include PATH_TO_CAROSHI . '/dbi/dbobj.class.php'; # Inheritable objects in the directory.
include PATH_TO_CAROSHI . '/dbi/dbtree.php'; # Directory utilities.
include PATH_TO_CAROSHI . '/dbi/dbsession.class.php'; # Session management.
##############################
### Global initializations ###
##############################
$db =& new DBCtrl ($dbidatabase, $dbiserver, $dbiuser, $dbipwd);
$tmp = $db->select ('COUNT(id)', 'obj_classes');
if (!$db->is_connected () || $db->error ())
die ('Can\'t connect to database. Please invoke the admin script ' .
'- stop.<BR>' .
'Keine Verbindung zur Datenbank moeglich. Bitte versuchen Sie es ' .
'mit dem Administrationsskript - Stop.');
# $dep contains a database description required for the directory management.
# See also dbi/dbdepend.class in Caroshi.
$dep =& new DBDEPEND;
$db->def =& $dep;
# Create an instance of the scanner to process templates.
$scanner =& new XML_SCANNER;
$session =& new DBSESSION ($db);
if (isset ($SESSION_KEY))
$session->read_id ($SESSION_KEY);
###################################
### Inclusion of internal files ###
###################################
require PATH_TO_ADMIN . '/cms-config.php';
require 'attic.php'; # Outdated features scheduled for removal but left in for temporary backwards compatibility.
require 'cms.php'; # Data management system, e.g. context creation and general tag handlers.
require 'document.php'; # Analyses the URL, picks a template and processes it.
require 'directory.php'; # Describes how tables relate to form the directory.
require 'product.php';
require 'cart.php';
require 'ecml.php'; # CMS-independent functions for ECML v1.1 support.
require 'send_order.php';
require 'order.php';
require 'search.php'; # Product search.
###########
### Go! ###
###########
# Process document at $PATH_INFO starting with row of 'categories' where
# id == 1. Use 'l_index' template for index page.
# This function is in file 'document.php'.
document_process ('categories', 1, 'l_index');
##########################
### Optional profiling ###
##########################
# Page profiler: Get current time and print the difference.
if ($debug || $page_profiler) {
$t = gettimeofday ();
echo 'Overall time spent: ' . (($t['usec'] + $t['sec'] * 1000000 - $__start_time) / 1000000) . 's' .
' database queries: ' . $DB_QUERIES;
}
?>