-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathannouncements.php
51 lines (51 loc) · 1.12 KB
/
announcements.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
<?php
declare(strict_types=1);
/**
* MCCodes v2 by Dabomstew & ColdBlooded
*
* Repository: https://github.com/davemacaulay/mccodesv2
* License: MIT License
*/
global $db, $ir, $userid, $h;
require_once('globals.php');
$ac = $ir['new_announcements'];
$q =
$db->query(
'SELECT `a_text`, `a_time` FROM `announcements` '
. 'ORDER BY `a_time` DESC');
echo '
<table width="80%" cellspacing="1" cellpadding="1" class="table">
<tr>
<th width="30%">Time</th>
<th width="70%">Announcement</th>
</tr>
';
while ($r = $db->fetch_row($q))
{
if ($ac > 0)
{
$ac--;
$new = '<br /><b>New!</b>';
}
else
{
$new = '';
}
$r['a_text'] = nl2br($r['a_text']);
echo '
<tr>
<td valign=top>' . date('F j Y, g:i:s a', (int)$r['a_time']) . $new
. '</td>
<td valign=top>' . $r['a_text'] . '</td>
</tr>
';
}
$db->free_result($q);
echo '</table>';
if ($ir['new_announcements'] > 0)
{
$db->query(
'UPDATE `users` ' . 'SET `new_announcements` = 0 '
. "WHERE `userid` = '{$userid}'");
}
$h->endpage();