forked from RetroAchievements/RAWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
forum.php
162 lines (130 loc) · 4.42 KB
/
forum.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
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
<?php
require_once('db.inc.php');
$requestedCategoryID = seekGET( 'c' );
settype( $requestedCategoryID, "integer" );
$forumList = getForumList( $requestedCategoryID );
RA_ReadCookieCredentials( $user, $points, $truePoints, $unreadMessageCount, $permissions );
$numUnofficialLinks = 0;
if( $permissions >= Permissions::Developer )
{
$unofficialLinks = getUnauthorisedForumLinks();
$numUnofficialLinks = count( $unofficialLinks );
}
$pageTitle = "Forum Index";
$requestedCategory = "";
if( $requestedCategoryID !== 0 && count( $forumList ) > 0 )
{
$requestedCategory = $forumList[0]['CategoryName']; // Fetch any elements data
$pageTitle .= ": " . $requestedCategory;
}
$errorCode = seekGET('e');
RenderDocType();
?>
<head>
<?php RenderSharedHeader( $user ); ?>
<?php RenderTitleTag( $pageTitle, $user ); ?>
<?php RenderGoogleTracking(); ?>
</head>
<body>
<?php RenderTitleBar( $user, $points, $truePoints, $unreadMessageCount, $errorCode ); ?>
<?php RenderToolbar( $user, $permissions ); ?>
<div id="mainpage">
<div id='leftcontainer'>
<?php RenderErrorCodeWarning( 'left', $errorCode ); ?>
<div id="forums" class="left">
<?php
echo "<div class='navpath'>";
if( $requestedCategory == "" )
{
echo "<b>Forum Index</b>";
}
else
{
echo "<a href='/forum.php'>Forum Index</a>";
echo " » <b>$requestedCategory</b></a>";
}
echo "</div>";
// Output all forums fetched, by category
if( $numUnofficialLinks > 0 )
{
echo "</br><a href='/viewforum.php?f=0'><b>Developer Notice:</b> $numUnofficialLinks unofficial posts need authorising: please verify them!</a></br>";
}
$lastCategory = "_init";
$forumIter = 0;
foreach( (array)$forumList as $forumData )
{
$nextCategory = $forumData['CategoryName'];
$nextCategoryID = $forumData['CategoryID'];
if( $nextCategory != $lastCategory )
{
if( $lastCategory !== "_init" )
{
// We are starting another table, but we need to close the last one!
echo "</tbody>";
echo "</table>";
echo "<br/>";
echo "<br/>";
$forumIter = 0;
}
echo "<h2>Forum: $nextCategory</h2>";
echo $forumData['CategoryDescription'] . "<br/>";
echo "<table>";
echo "<tbody>";
echo "<tr>";
echo "<th colspan='2'>Forum</th>";
echo "<th>Topics</th>";
echo "<th>Posts</th>";
echo "<th>Last Post</th>";
echo "</tr>";
$lastCategory = $nextCategory;
}
// Output one forum, then loop
$nextForumID = $forumData['ID'];
$nextForumTitle = $forumData['Title'];
$nextForumDesc = $forumData['Description'];
$nextForumNumTopics = $forumData['NumTopics'];
$nextForumNumPosts = $forumData['NumPosts'];
$nextForumLastPostCreated = $forumData['LastPostCreated'];
if( $nextForumLastPostCreated !== NULL )
$nextForumCreatedNiceDate = date( "d M, Y H:i", strtotime( $nextForumLastPostCreated ) );
else
$nextForumCreatedNiceDate = "None";
$nextForumLastPostAuthor = $forumData['LastPostAuthor'];
$nextForumLastPostTopicName = $forumData['LastPostTopicName'];
$nextForumLastPostTopicID = $forumData['LastPostTopicID'];
$nextForumLastPostID = $forumData['LastPostID'];
echo "<tr>";
echo "<td class='unreadicon'><img title='$nextForumTitle' alt='$nextForumTitle' src='http://i.retroachievements.org/Images/ForumTopicUnread32.gif' width='32' height='32'></img></td>";
echo "<td class='forumtitle'><a href='/viewforum.php?f=$nextForumID'>$nextForumTitle</a><br/>";
echo "$nextForumDesc</td>";
echo "<td class='topiccount'>$nextForumNumTopics</td>";
echo "<td class='postcount'>$nextForumNumPosts</td>";
echo "<td class='lastpost'>";
echo "<div class='lastpost'>";
echo "<span class='smalldate'>$nextForumCreatedNiceDate</span><br/>";
if( isset( $nextForumLastPostAuthor ) && strlen( $nextForumLastPostAuthor ) > 1 )
{
echo GetUserAndTooltipDiv( $nextForumLastPostAuthor, NULL, NULL, NULL, NULL, TRUE );
//echo "<a href='/User/$nextForumLastPostAuthor'>$nextForumLastPostAuthor</a>";
echo " <a href='/viewtopic.php?t=$nextForumLastPostTopicID&c=$nextForumLastPostID'>[View]</a>";
}
echo "</div>";
echo "</td>";
echo "</tr>";
}
echo "</tbody></table>";
?>
<br/>
</div>
</div>
<div id='rightcontainer'>
<?php
if( $user !== NULL )
RenderScoreLeaderboardComponent( $user, $points, TRUE );
RenderRecentForumPostsComponent( 8 );
?>
</div>
</div>
<?php RenderFooter(); ?>
</body>
</html>