-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
78 lines (70 loc) · 3.13 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
<?php
if (file_exists("install.php"))
{
header("Location: install.php");
}
include("common.php");
outHtml1("Forum Index");
outHtml2("Forum Index:");
?>
<table class='list' style="margin-top: 10px; margin-bottom: 10px; font-family: Trebuchet MS;">
<tr><td class="listLeft" style="background: url(images/bar.png) repeat-x; color: white;"><u>Forum</u></td><td class='listRight' style="background: url(images/bar.png) repeat-x; color: white;"><u>No. Posts</u></td></tr>
</table>
<?php
$forumArr = array();
$fileC = file("db/forumList.dat",FILE_IGNORE_NEW_LINES);
foreach ($fileC as $line)
{
array_push($forumArr, new Forum($line));
}
echo "<table class='list'>";
foreach ($forumArr as $count => $item)
{
$insertStr = "";
if ($_SESSION['loggedIn'] == true && $_SESSION['user']->getLevel() == 3)
{
if ($count == 0)
{
$insertStr = "<span class='controls'><a href='forumListChange.php?mode=down&forumId=".$item->getForumId()."'>down</a> <a href='forumListEdit.php?forumId=".$item->getForumId()."'>edit</a> <a href='forumListChange.php?mode=delete&forumId=".$item->getForumId()."'>delete</a></span>";
}
else if ($count == sizeOf($forumArr)-1)
{
$insertStr = "<span class='controls'><a href='forumListChange.php?mode=up&forumId=".$item->getForumId()."'>up</a> <a href='forumListEdit.php?forumId=".$item->getForumId()."'>edit</a> <a href='forumListChange.php?mode=delete&forumId=".$item->getForumId()."'>delete</a></span>";
}
else
{
$insertStr = "<span class='controls'><a href='forumListChange.php?mode=up&forumId=".$item->getForumId()."'>up</a> <a href='forumListChange.php?mode=down&forumId=".$item->getForumId()."'>down</a> <a href='forumListEdit.php?forumId=".$item->getForumId()."'>edit</a> <a href='forumListChange.php?mode=delete&forumId=".$item->getForumId()."'>delete</a></span>";
}
}
echo "<tr>
<td class='listleft'><a href='viewTopics.php?forumId=".$item->getForumId()."'>".$item->getForumName()."</a>".$insertStr."<br />".$item->getDescription()."</td>
<td class='listright'>".$item->getTotalPosts()."</td>
</tr>";
}
echo "</table>";
if ($_SESSION['loggedIn'] && $_SESSION['user']->getLevel() == 3)
{
echo '<div style="margin-left: 5%; margin-top: 10px;"><a href="addForum.php">Add Forum</a></div>';
}
?>
<?php
$fileC = file("db/forumStatistics.dat",FILE_IGNORE_NEW_LINES);
?>
<div id="statistics">
Forums: <?php echo $fileC[0]; ?>
Topics: <?php echo $fileC[1]; ?>
Posts: <?php echo $fileC[2]; ?>
<a href="userList.php" id="regUsers">Registered Users:</a> <?php echo $fileC[3]; ?>
Newest User: <?php echo $fileC[4]; ?>
<br />
<?php
purge();
$fileC = file("db/forumOnlineUsers.dat",FILE_IGNORE_NEW_LINES);
echo "Online Users: ".(sizeOf($fileC)/2)." ";
$fileC = file("db/forumOnlineGuests.dat",FILE_IGNORE_NEW_LINES);
echo "Online Guests: ".(sizeOf($fileC)/2)." ";
?>
</div>
<?php
outHtml3();
?>