-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
88 lines (66 loc) · 2.2 KB
/
index.php
File metadata and controls
88 lines (66 loc) · 2.2 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
<?php
define('BASE_PATH', 'C:/Users/Danny/Documents/SCBA/scba_php');
require_once 'public/functions/routing.php';
function getCSSProperty($file)
{
if (file_exists($file)) {
echo '<link href="/' . $file . '" rel=stylesheet>';
}
}
function handleNewsButtons($article)
{
$news_path = 'views/pages/news/';
$prev = (string) (strval($article) - 1);
$leftSide = '« Previous Article';
$next = (string) (strval($article) + 1);
$rightSide = 'Next Article »';
if (file_exists($file = $news_path . $prev . '.php') && $prev != '0') {
$leftSide = '<a href="/news/' . $prev . '">' . $leftSide . '</a>';
}
if (file_exists($file = $news_path . $next. '.php')) {
$rightSide = '<a href="/news/' . $next . '">'. $rightSide . '</a>';
}
echo '<div class="row"><div class="col-md-12">' . $leftSide . ' | ' . $rightSide . '</div></div><hr>';
}
$pageName = getPageName(0);
$article = getPageName(1);
?>
<html>
<head>
<?php
include('views/partials/head.html');
getCSSProperty('public/css/' . $pageName . '.css');
getCSSProperty('public/css/' . $pageName . '/' . $article . '.css');
?>
</head>
<body>
<div class="container drop-shadow">
<?php
include('views/partials/navbar.html')
?>
<div class="container">
<?php
$validNewsArticle = 0;
if (file_exists($file = 'views/pages/' . $pageName . '.php')) {
include $file;
if (($pageName == 'news') && file_exists($file = 'views/pages/' . $pageName . '/' . $article . '.php')) {
include $file;
$validNewsArticle = 1;
}
} else {
echo 'File not found';
}
if (($pageName == 'news') && ($validNewsArticle == 1) && $article != '0') {
handleNewsButtons($article);
}
include('views/partials/footer.html');
if ($pageName == 'contact') {
echo "<script src='/public/js/form.js'></script>";
} else if ($pageName == 'conference') {
echo "<script src='/public/js/conference.js'></script>";
}
?>
</div>
</div>
</body>
</html>