-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.php
93 lines (70 loc) · 2.39 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
<?php
include "markdown.php";
function __autoload($class) {
include "classes/$class.php";
}
if(isset($_GET["members"]))
$page = Page::Members;
elseif(isset($_GET["minutes"]))
$page = Page::Minutes;
elseif(isset($_GET["links"]))
$page = Page::Links;
else // default page
$page = Page::Index;
require_once "html/header.html";
switch($page) {
case Page::Index:
require_once "html/index.html";
foreach(glob("news/*") as $file) {
if(strstr($file, "README.md") || strstr($file, "archived"))
continue;
$news_title = str_replace("news/", "", $file);
$news_item = new NewsItem($news_title,
file_get_contents($file),
filemtime($file));
$template = new Template(Page::NewsItem);
echo $template->parse(array("title" => $news_item->get_title(),
"content" => $news_item->get_content()));
}
break;
case Page::Members:
require_once "html/members.html";
foreach(glob("members/*") as $file) {
if(strstr($file, "README.md"))
continue;
$member_name = str_replace("members/", "", $file);
$file_ptr = fopen($file, "r");
$position = trim(fgets($file_ptr));
$url = trim(fgets($file_ptr));
$members[] = new Member($member_name, $position, $url);
fclose($file_ptr);
}
usort($members, array("Member", "compare"));
foreach($members as $member) {
if(!$member->is_position_valid())
continue;
$template = new Template(Page::Member);
echo $template->parse(array("name" => $member->get_name(),
"position" => $member->get_position(),
"link" => $member->get_link() == "" ? "<br/>" : $member->get_link()));
}
break;
case Page::Minutes:
require_once "html/minutes.html";
foreach(array_reverse(glob("minutes/*")) as $file) {
if(strstr($file, "README.md"))
continue;
$minutes_item = new MinutesItem(str_replace("minutes/", "", $file),
file_get_contents($file),
filemtime($file));
$template = new Template(Page::MinutesItem);
echo $template->parse(array("title" => $minutes_item->get_title(),
"content" => $minutes_item->get_content()));
}
break;
case Page::Links:
require_once "html/links.html";
break;
}
require_once "html/footer.html";
?>