* Minor TOS change
[specialops2.git] / lib / class.Messagestyle_Plain.php
blob8e0e1e2d153c20ed66f98b668e4da67a1e8e8ac2
1 <?php
2 /**
3 * Plain messagelist like GF uses
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_Plain implements Messagestyle
13 const ID = 0;
14 const Name = 'Plain';
16 static $lastmsgid;
18 public function display($m)
20 global $user;
22 $params = array(
23 'From: '.$user->namelink($m['userid'], $m['alias']),
24 'At: '.$user->fdate($m['mtime']),
25 sprintf('<a href="%s#m%d">#%2$d</a>', HERE, $m['messageid']),
26 'Score: '.$m['score'],
27 '<a href="post?message='.$m['messageid'].'">Reply to this</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 // Don't bother adding this if the other message is right above this one
43 if ( $m['replyto'] && $m['replyto'] != self::$lastmsgid ) {
44 $params[] = sprintf('Reply to <a href="#m%d">#%1$d</a>', $m['replyto']);
46 if ( $user->has_priv('admin') ) {
47 $params[] = $m['ip'];
50 echo
51 '<div id="m',$m['messageid'],'" class="message u',$m['userid'],'">',"\n",
52 '<div class="info">',implode(' | ', $params),"</div>\n",
53 '<div class="content">',$m['mtext'],"</div>\n",
54 "</div>\n";
56 self::$lastmsgid = $m['messageid'];