index.php
6.25 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<!DOCTYPE html>
<html lang="en">
<?php $db = new SQLite3('wiki.db'); ?>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Slimspots Wiki</title>
<!-- Bootstrap Core CSS -->
<link href="static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="static/css/slimspots-wiki.css" rel="stylesheet">
<link href="static/css/styles.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<!-- FontAwesome -->
<link rel="stylesheet" href="static/font-awesome/css/font-awesome.min.css">
<script src="static/bootstrap/js/jquery-1.11.0.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="wrapper">
<!----------------------------------------------------- Sidebar ---------------------------------------------------->
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li class="sidebar-brand">
<a href="#">
<img src="static/gfx/logo.svg" class="img-responsive"/>
</a>
</li>
<?php
$page = $db->query("SELECT * FROM page");
$num_pages = count($page);
for ($i=0;$i<$num_pages;$i++)
{
while ($row = $page->fetchArray())
{
echo "<li class='has-sub'><a href='#'>".$row[1]."<i class='fa fa-chevron-right fa pull-right chevron-margin' id='valign-icon'></i></a>";
echo "<ul>";
$sections = $db->query("SELECT * FROM section WHERE page_id = $row[0]"); //$row[0]: page -> id
for ($j=0; $j<count($sections); $j++)
{
while ($row1 = $sections->fetchArray())
{
echo "<li><a href='?".$row[0]."#".$row1[0]."' class='sub-text-padding'>".$row1[2]."</a></li>";
}
}
echo "</ul></li>";
}
}
?>
</ul>
</div>
<!-- /#sidebar-wrapper -->
<!---------------------------------------------------------------------------------------------------------------->
<div class="container-fluid" id="menu-tray">
<div class="col-xs-6">
<a href="#menu-toggle" id="menu-toggle"><i class="fa fa-bars fa-2x icon pull-left"></i></a>
</div>
<div class="col-xs-6" id="search-container">
<form name="#" method="#" action="#" class="form-search">
<input type="text" class="pull-right" name="#" id="search-rounded" placeholder="Suche">
</form>
</div>
</div>
<div id="page-content-wrapper">
<div class="pull-right">
<!-- In this table we display the date and time (desktop devices only) -->
<table id="datetime">
<tr>
<td id="date-container">
<span id="day"></span>
<br>
<span id="datetime-number"> <span id="datum"> </span> </span><span id="month"> </span>
</td>
<td id="time-container">
<span id="hour"> </span> : <span id="minute"> </span>
</td>
</tr>
</table>
</div>
<!-------------------------------------------------------------------->
<?php
$url=$_SERVER['REQUEST_URI'];
if (strpos($url, '?') === false)
{
$current_page=1;
}
else
{
$current_page = explode ('?', $url);
$current_page=$current_page[1];
}
$query = $db->query("SELECT * FROM page WHERE id = $current_page");
while ($row = $query->fetchArray())
{
$page_title = $row[1];
?>
<div id="container2">
<h1 id="container2-header">Slimspots Wiki</h1>
</div>
<article>
<h2><?php echo $row[1]; ?></h2><hr>
<p><?php echo $row[2]; ?></p>
<div class="all-chapters">
<?php
$section = $db->query("SELECT * FROM section WHERE page_id = $current_page");
for ($i=0; $i<count($section); $i++)
{
while ($row1 = $section->fetchArray())
{
$section_id = $row1[0];
$section_title = $row1[2];
$section_text = $row1[3];
$section_subsections = $row1[4];
echo "<h3 id='".$section_id."'>".$section_id.". ".$section_title."</h3><hr>";
echo "<p class='margin-bottom-50px'>".$section_text."</p>";
$subsection = $db->query("SELECT * FROM subsection WHERE page_id = $row[0] AND section_id = $row1[0]");
while ($row2 = $subsection->fetchArray())
{
$subsection_id = $row2[0];
$subsection_title = $row2[3];
$subsection_text = $row2[4];
echo "<h3 id='".$section_id.".".$subsection_id."'> ".$section_id.".".$subsection_id.". ".$subsection_title."</h3><hr>";
echo "<p class='margin-bottom-50px'>".$subsection_text."</p>";
}
}
}
}
?>
</div>
</article>
</div>
<!-- /#page-content-wrapper -->
</div>
<!-- /#wrapper -->
<!-- Bootstrap Core JavaScript -->
<script src="static/bootstrap/js/bootstrap.min.js"></script>
<!-- Update time JavaScript -->
<script src="static/js/main.js"></script>
<script src="static/js/updatetime.js"></script>
<script>
var ToC =
"<nav role='navigation' class='table-of-contents'>" +
"<b><?php echo $page_title; ?></b>" +
"<ul>";
var newLine, el, title, link;
$("article h3").each(function() {
el = $(this);
title = el.text();
link = "#" + el.attr("id");
newLine =
"<li>" +
"<a href='" + link + "'>" +
title +
"</a>" +
"</li>";
ToC += newLine;
});
ToC +=
"</ul>" +
"</nav>";
$(".all-chapters").prepend(ToC);
</script>
</body>
</html>