* Minor TOS change
[specialops2.git] / lib / class.Messagestyle_Frozenoven.php
blob426a90849a8ab329c4a07db17902d168c3d55f4c
1 <?php
2 /**
3 * FO3 style messagelist
5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://../COPYING
7 * @version $Id$
8 */
9 require_once 'lib/iface.Messagestyle.php';
11 class Messagestyle_Frozenoven implements Messagestyle
13 const ID = 3;
14 const Name = 'FrozenOven 3';
16 /* This is pretty useless in threaded mode */
17 public function display($m)
19 global $user;
21 $params = array(
22 'From: '.$user->namelink($m['userid'], $m['alias']),
23 'At: '.$user->fdate($m['mtime']),
24 sprintf('<a href="%s#m%d">#%2$d</a>', HERE, $m['messageid']),
25 'Score: '.$m['score'],
26 '<a href="post?message='.$m['messageid'].'">Quote</a>'
29 if ( $user instanceof User_Authenticated ) {
30 if ( $user->has_priv('moderate') && $user->userid != $m['userid'] ) {
31 $params[3] .=
32 '<form action="detail?'.$m['messageid'].'" method="post" class="msgmod">'."\n".
33 ' <button type="submit" name="action" value="add"><img src="res/plus" alt="Suggest"/></button>'."\n".
34 ' <button type="submit" name="action" value="sub"><img src="res/minus" alt="Mark"/></button>'."\n".
35 '</form>';
37 if ( $m['marks'] ) {
38 $params[3] .= ' <a href="detail?'.$m['messageid'].'"><img src="res/ternary" alt="Message Detail"/></a>';
42 if ( $user->has_priv('admin') ) {
43 $params[] = $m['ip'];
46 echo
47 '<div id="m',$m['messageid'],'" class="message u',$m['userid'],'">',"\n",
48 '<div class="info">',implode(' | ', $params),"</div>\n",
49 '<div class="content">';
50 if ( $m['replyto'] ) {
51 // This bit makes sure it works across multiple pages
52 if ( !isset($messages[$m['replyto']]) ) {
53 global $DB;
54 $messages[$m['replyto']] =
55 $DB->query(
56 'SELECT `messages`.`userid`, `alias`, `mtime`, `mtext`, `replyto`,
57 `score`, `messages`.`messageid`, INET_NTOA(`origin_ip`) AS `ip`
58 FROM `message-data` NATURAL LEFT JOIN `messages` NATURAL LEFT JOIN `users`
59 WHERE `messageid` = '.$m['replyto']
60 )->fetch_assoc();
63 // This makes no sense.
64 echo
65 '<fieldset><legend>Quote ',$user->namelink($messages[$m['replyto']]['userid'], $messages[$m['replyto']]['alias']),
66 '; post <a href="detail?',$m['replyto'],'">#',$m['replyto'],"</a></legend>\n",
67 '<blockquote><div>',$messages[$m['replyto']]['mtext'],"</div></blockquote>\n",
68 "</fieldset>\n";
70 echo $m['mtext'],"</div>\n", //content
71 "</div>\n"; //message