Example #1
0
            print '<div class="reply replyborder' . $replyswitch . ' replyalternate' . $replyswitch . '
				' . ($replyNumber ? '' : 'reply-top') . ' userID' . $reply['fromUserID'] . '">';
            $replyNumber++;
            print '<a name="' . $reply['id'] . '"></a>';
            if ($new['id'] == $reply['id']) {
                print '<a name="postbox"></a>';
                $messageAnchor = '';
            } elseif ($User->timeLastSessionEnded < $reply['timeSent']) {
                print $messageAnchor;
                $messageAnchor = '';
            } elseif ($reply['id'] == $maxReplyID) {
                print $messageAnchor;
                $messageAnchor = '';
            }
            print '<div class="message-head replyalternate' . $replyswitch . ' leftRule">';
            print '<strong><a href="profile.php?userID=' . $reply['fromUserID'] . '">' . $reply['fromusername'] . ' ' . libHTML::loggedOn($reply['fromUserID']) . ' (' . $reply['points'] . ' ' . libHTML::points() . User::typeIcon($reply['userType']) . ')</a>' . '</strong><br />';
            print libHTML::forumMessage($message['id'], $reply['id']);
            print '<em>' . libTime::text($reply['timeSent']) . '</em>';
            print '<br />' . $User->likeMessageToggleLink($reply['id'], $reply['fromUserID']) . libHTML::likeCount($reply['likeCount']);
            if ($User->type['Admin'] || $User->type['ForumModerator']) {
                if (Silence::isSilenced($reply)) {
                    $silence = new Silence($reply);
                } else {
                    unset($silence);
                }
                print '<br />';
                if (isset($silence) && $silence->isEnabled()) {
                    print '<a class="light likeMessageToggleLink" href="admincp.php?tab=Control%20Panel&amp;silenceID=' . $silence->id . '#disableSilence">' . l_t('Disable silence') . '</a>';
                } else {
                    print '<a class="light likeMessageToggleLink" href="admincp.php?tab=Control%20Panel&amp;postID=' . $reply['id'] . '&amp;userID=' . $reply['fromUserID'] . '#createUserThreadSilence">' . l_t('Silence user') . '</a>';
                }
Example #2
0
 /**
  * Generate a profile link
  * @return string
  */
 function profile_link()
 {
     if ($this->Game->phase == 'Pre-game') {
         $output = '<a href="profile.php?userID=' . $this->userID . '">' . $this->username;
     } else {
         $output = '<a class="country' . $this->countryID . '" ';
         if ($this->status == 'Defeated') {
             $output .= 'style="text-decoration: line-through" ';
         }
         $output .= 'href="profile.php?userID=' . $this->userID . '">' . $this->username;
     }
     return $output . ' (' . $this->points . User::typeIcon($this->userType) . ')</a>';
 }
Example #3
0
 /**
  * The list of members; just names if pregame, otherwise a full detailed table, ordered by
  * status then relative success in-game.
  *
  * @return string
  */
 function membersList()
 {
     if ($this->Game->phase == 'Pre-game') {
         $membersNames = array();
         foreach ($this->ByUserID as $Member) {
             $membersNames[] = '<span class="memberName">' . $Member->memberName() . '</span>';
         }
         return '<table><tr class="member memberAlternate1 memberPreGameList"><td>' . implode(', ', $membersNames) . '</td></tr></table>';
     }
     libHTML::$alternate = 2;
     $membersList = array();
     foreach (self::$statusOrder as $status) {
         foreach ($this->ByStatus[$status] as $Member) {
             $membersList[] = '<tr class="member memberAlternate' . libHTML::alternate() . '">' . $Member->memberBar() . '</tr>';
         }
     }
     $extras = '';
     if ($this->Game->hasModeratorPowers() && count($this->Game->civilDisorderInfo) != 0) {
         $extras = '<div class="bar titleBar modEyes">Civil Disorders</div><table><tbody>';
         foreach ($this->Game->civilDisorderInfo as $userID => $CD) {
             $cdUser = new User($userID);
             $extras .= '<tr class="member memberAlternate1"><td class="memberLeftSide" style="white-space: nowrap;"><span><a href="profile.php?userID=' . $userID . '">' . $cdUser->username . '</a>' . ' <span class="points">(' . $cdUser->points . libHTML::points() . User::typeIcon($cdUser->type) . ')' . (defined('AdminUserSwitch') ? ' (<a href="board.php?gameID=' . $this->Game->id . '&auid=' . $cdUser->id . '" class="light">+</a>)' : '') . '</span></span></td><td class="memberRightSide">';
             $extras .= '<span class="country' . $CD['countryID'] . '">';
             if ($CD['countryID'] == 0) {
                 $extras .= 'Unassigned';
             } else {
                 $extras .= $this->Game->Variant->countries[$CD['countryID'] - 1];
             }
             $extras .= '</span> (' . $this->Game->datetxt($CD['turn']) . ') with ' . $CD['SCCount'] . ' centres.';
             $extras .= '</td></tr>';
         }
         $extras .= "</tbody></table>";
     }
     return '<table>' . implode('', $membersList) . '</table>' . $extras;
 }
Example #4
0
    /**
     * The name of the user playing as this member, his points, and whether he's logged on
     * @return string
     */
    function memberName()
    {
        if ($this->isNameHidden()) {
            return '(' . l_t('Anonymous') . ')';
        } else {
            return '<a href="profile.php?userID=' . $this->userID . '">' . $this->username . '</a>
				' . libHTML::loggedOn($this->userID) . '
				<span class="points">(' . $this->points . libHTML::points() . User::typeIcon($this->userType) . ')</span>' . (defined('AdminUserSwitch') ? ' (<a href="board.php?gameID=' . $this->gameID . '&auid=' . $this->userID . '" class="light">+</a>)' : '');
        }
    }
Example #5
0
    static function forumNew()
    {
        // Select by id, prints replies and new threads
        global $DB, $Misc;
        $tabl = $DB->sql_tabl("\r\n\t\t\tSELECT m.id as postID, t.id as threadID, m.type, m.timeSent, IF(t.replies IS NULL,m.replies,t.replies) as replies,\r\n\t\t\t\tIF(t.subject IS NULL,m.subject,t.subject) as subject,\r\n\t\t\t\tu.id as userID, u.username, u.points, IF(s.userID IS NULL,0,1) as online, u.type as userType,\r\n\t\t\t\tSUBSTRING(m.message,1,100) as message, m.latestReplySent, t.fromUserID as threadStarterUserID\r\n\t\t\tFROM wD_ForumMessages m\r\n\t\t\tINNER JOIN wD_Users u ON ( m.fromUserID = u.id )\r\n\t\t\tLEFT JOIN wD_Sessions s ON ( m.fromUserID = s.userID )\r\n\t\t\tLEFT JOIN wD_ForumMessages t ON ( m.toID = t.id AND t.type = 'ThreadStart' AND m.type = 'ThreadReply' )\r\n\t\t\tORDER BY m.timeSent DESC\r\n\t\t\tLIMIT 50");
        $oldThreads = 0;
        $threadCount = 0;
        $threadIDs = array();
        $threads = array();
        while (list($postID, $threadID, $type, $timeSent, $replies, $subject, $userID, $username, $points, $online, $userType, $message, $latestReplySent, $threadStarterUserID) = $DB->tabl_row($tabl)) {
            $threadCount++;
            if ($threadID) {
                $iconMessage = libHTML::forumMessage($threadID, $postID);
            } else {
                $iconMessage = libHTML::forumMessage($postID, $postID);
            }
            if ($type == 'ThreadStart') {
                $threadID = $postID;
            }
            if (!isset($threads[$threadID])) {
                if (strlen($subject) > 30) {
                    $subject = substr($subject, 0, 40) . '...';
                }
                $threadIDs[] = $threadID;
                $threads[$threadID] = array('subject' => $subject, 'replies' => $replies, 'posts' => array(), 'threadStarterUserID' => $threadStarterUserID);
            }
            $message = Message::refilterHTML($message);
            if (strlen($message) >= 50) {
                $message = substr($message, 0, 50) . '...';
            }
            $message = '<div class="message-contents threadID' . $threadID . '" fromUserID="' . $userID . '">' . $message . '</div>';
            $threads[$threadID]['posts'][] = array('iconMessage' => $iconMessage, 'userID' => $userID, 'username' => $username, 'message' => $message, 'points' => $points, 'online' => $online, 'userType' => $userType, 'timeSent' => $timeSent);
        }
        $buf = '';
        $threadCount = 0;
        foreach ($threadIDs as $threadID) {
            $data = $threads[$threadID];
            $buf .= '<div class="hr userID' . $threads[$threadID]['threadStarterUserID'] . ' threadID' . $threadID . '"></div>';
            $buf .= '<div class="homeForumGroup homeForumAlt' . ($threadCount % 2 + 1) . ' userID' . $threads[$threadID]['threadStarterUserID'] . ' threadID' . $threadID . '">
				<div class="homeForumSubject homeForumTopBorder">' . libHTML::forumParticipated($threadID) . ' ' . $data['subject'] . '</div> ';
            if (count($data['posts']) < $data['replies']) {
                $buf .= '<div class="homeForumPost homeForumMessage homeForumPostAlt' . libHTML::alternate() . ' ">

				...</div>';
            }
            $data['posts'] = array_reverse($data['posts']);
            foreach ($data['posts'] as $post) {
                $buf .= '<div class="homeForumPost homeForumPostAlt' . libHTML::alternate() . ' userID' . $post['userID'] . '">


					<div class="homeForumPostTime">' . libTime::text($post['timeSent']) . ' ' . $post['iconMessage'] . '</div>
					<a href="profile.php?userID=' . $post['userID'] . '" class="light">' . $post['username'] . '</a>
						' . libHTML::loggedOn($post['userID']) . ' (' . $post['points'] . libHTML::points() . User::typeIcon($post['userType']) . ')

					<div style="clear:both"></div>
					<div class="homeForumMessage">' . $post['message'] . '</div>
					</div>';
            }
            $buf .= '<div class="homeForumLink">
					<div class="homeForumReplies">' . l_t('%s replies', '<strong>' . $data['replies'] . '</strong>') . '</div>
					<a href="forum.php?threadID=' . $threadID . '#' . $threadID . '">' . l_t('Open') . '</a>
					</div>
					</div>';
        }
        if ($buf) {
            return $buf;
        } else {
            return '<div class="homeNoActivity">' . l_t('No forum posts found, why not ' . '<a href="forum.php?postboxopen=1#postbox" class="light">start one</a>?');
        }
    }