This repository was archived by the owner on Jun 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·140 lines (132 loc) · 4.81 KB
/
index.php
File metadata and controls
executable file
·140 lines (132 loc) · 4.81 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!doctype html>
<?php
include_once 'config/config.php';
require 'vendor/autoload.php';
?>
<html lang="de">
<head>
<title>TicSys</title>
<meta name="description" content="TicSys ist eine Applikation zum Vertrieb von Event-Eintrittskarten.">
<meta name="author" content="Marc Jenzer">
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="/css/normalize.css">
<link rel="stylesheet" type="text/css" href="/css/application.css">
<script src="/js/vendor/jquery-1.8.3.min.js"></script>
<script src="/js/application.js"></script>
<script src="/js/timer.js"></script>
</head>
<body onload="setDateTime()">
<div id="wrap">
<div id="header">
<div id="logo">
<a href="/home"><img src="/images/logo-white.png" alt="TicSys Logo" width="295" height="70" /></a>
</div>
<div id="meta-navigation">
<ul>
<?php
$metaMenu = getMetaMenu();
$metaMenuCount = count($metaMenu);
$counter = 0;
foreach ($metaMenu as $href => $title) {
$counter += 1;
echo "<li><a href=\"$href\">$title</a>";
if ($counter < $metaMenuCount) {
echo "|";
}
echo "</li>\n";
}
?>
</ul>
</div>
<div class="clear"></div>
</div>
<div id="menu">
<ul>
<?php
$currentUri = getCurrentURI();
foreach (getMenu() as $href => $title) {
echo "<li><a href=\"$href\" " . (($href == $currentUri) ? "class=\"selected\" " : "") . ">$title</a></li>\n";
}
?>
</ul>
</div>
<div id="content">
<?php
$controller = null;
switch (getCurrentURI()) {
case URI_EVENTS:
include_once 'controller/EventController.php';
$controller = new EventController();
break;
case URI_FAQ:
include_once 'controller/FAQController.php';
$controller = new FAQController();
break;
case URI_KONTAKT:
include_once 'controller/ContactController.php';
$controller = new ContactController();
break;
case URI_REGISTRATION:
include_once 'controller/RegistrationController.php';
$controller = new RegistrationController();
break;
case URI_LOGIN:
include_once 'controller/LoginController.php';
$controller = new LoginController();
break;
default :
include_once 'controller/HomeController.php';
$controller = new HomeController();
break;
}
if ($controller != null) {
$controller->route();
}
?>
</div>
<div id="footer">
<p>Copyright © 2012 TicSys, <span id="datetime"><?php echo date("d.m.Y H:i:s"); ?></span></p>
</div>
</div>
<a id="feedback" href="<?php echo URI_KONTAKT ?>"><img src="/images/feedback.png" border="0"></a>
</body>
</html>
<?php
/**
* @return array containing all menu items in format [base href] => [title]
*/
function getMenu() {
return array(
URI_HOME => 'Home',
URI_EVENTS => 'Events',
URI_FAQ => 'FAQ',
URI_KONTAKT => 'Kontakt'
);
}
/**
* @return array containing all meta menu items in format [base href] => [title]
*/
function getMetaMenu() {
return array(
URI_LOGIN => 'Login',
URI_REGISTRATION => 'Registration'
);
}
/**
* @return string the requested menu item URI
*/
function getCurrentURI() {
$menu = getMenu();
$metaMenu = getMetaMenu();
if ((array_key_exists($_SERVER['REQUEST_URI'], $menu)) || (array_key_exists($_SERVER['REQUEST_URI'], $metaMenu))) {
return $_SERVER['REQUEST_URI'];
} else {
foreach (array_merge(array_keys($menu), array_keys($metaMenu)) as $href) {
if (preg_match("@^$href@", $_SERVER['REQUEST_URI'])) {
return $href;
}
}
}
return key($menu);
}
?>