summaryrefslogtreecommitdiff
path: root/dash/notif.php
blob: 68f0282458d9b0e607113dd94af7436f45439055 (plain)
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
<?php
define('HEIRARCHY', 1);
require('dash_common.php');

$title = 'News / Bulletin';
$extra_head = '    <link rel="stylesheet" type="text/css" href="css/notif.css" />';
require('header.php');
$result = $db->query('SELECT notif.* FROM notif WHERE notif.uid = '.$b_user['id'].' ORDER BY id DESC') or dash_fatal($db->error);
$db->query('UPDATE notif SET notif.seen = 1 WHERE notif.uid = '.$b_user['id']) or dash_fatal($db->error);
?>
      <div class="box cbox">
        <div id="newshead">
          <h3><a href="notif.php">News</a></h3>
          <p>Updates for <?=htmlentities($b_user['name']);?></p>
        </div>
        <div class="hr"></div>
        <div id="newsbody">
<?php
if ($result->num_rows < 1) echo '          <p><em>No updates are available at this time.</em></p>'.PHP_EOL;
else {
  while ($row = $result->fetch_assoc()) {
    echo '          <p class="';
    if ($row['seen']) echo 'seen';
    else echo 'unseen';
    if (!is_null($row['icon'])) echo ' icon icon'.strtolower($row['icon']);
    echo '"><a href="'.$row['link'].'">'.htmlentities($row['text']).'</a></p>'.PHP_EOL;
  }
}
$result->free();
?>
        </div>
      </div>
<?php
require('footer.php');
?>