Esempio n. 1
0
 /**
  * A column of data in an array, with the countryID&online icon, then finalized icon, then sent-messages icon.
  * Returned as an array so only as many columns as required are added, keeping length down.
  * panelMembersHome makes this into a string of pure HTML.
  *
  * @return array array($countryID,$finalized,$sentMessages);
  */
 function memberColumn()
 {
     global $User;
     $buf = array();
     $buf[] = '<span class="country' . $this->countryID . ' ' . ($User->id == $this->userID ? 'memberYourCountry' : '') . ' memberStatus' . $this->status . '">' . substr($this->country, 0, 3) . ($this->online && !$this->isNameHidden() ? ' ' . libHTML::loggedOn($this->userID) : '') . '</span>';
     $buf[] = $this->memberFinalized();
     $buf[] = $this->memberSentMessages();
     return $buf;
 }
Esempio n. 2
0
 /**
  * Return a profile link for this user
  * @param bool[optional] $welcome If true this profile link is tweaked to be used as the Welcome link
  * @return string Profile link HTML
  */
 function profile_link($welcome = false)
 {
     $buffer = '';
     if ($this->type['User']) {
         $buffer .= '<a href="./profile.php?userID=' . $this->id . '"';
         $buffer .= '>' . $this->username;
         if (!$welcome and $this->online) {
             $buffer .= libHTML::loggedOn($this->id);
         }
         $buffer .= ' (' . $this->points . libHTML::points() . $this->typeIcon($this->type) . ')</a>';
     } else {
         $buffer .= '<em>' . $this->username . '</em>';
     }
     return $buffer;
 }
Esempio n. 3
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>';
                }
Esempio n. 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>)' : '');
        }
    }
Esempio n. 5
0
 public function fromLink()
 {
     $linkName = $this->linkName;
     if (strlen($linkName) > 35) {
         $linkName = substr($linkName, 0, 35) . '...';
     }
     if ($this->linkURL) {
         $buf = '<a href="' . $this->linkURL . '" ' . ($this->type == 'Game' ? 'gameID="' . $this->linkID . '"' : '') . '>' . $linkName . '</a>';
     } else {
         $buf = $linkName;
     }
     if (($this->type == 'PM' || $this->type == 'User') && isset($this->linkID) && $this->linkID) {
         $buf .= ' ' . libHTML::loggedOn($this->linkID);
     }
     return $buf;
 }
Esempio n. 6
0
print '</h2>';
// Regular user info starts here:
print '<div class="leftHalf" style="width:50%">';
if ($UserProfile->type['Banned']) {
    print '<p><strong>' . l_t('Banned') . '</strong></p>';
}
if ($UserProfile->comment) {
    print '<p class="profileComment">"' . $UserProfile->comment . '"</p>';
}
print '<p><ul class="formlist">';
if ($UserProfile->type['Moderator'] || $UserProfile->type['ForumModerator'] || $UserProfile->type['Admin']) {
    print '<li><strong>' . l_t('Mod/Admin team') . '</strong></li>';
    print '<li>&nbsp;</li>';
}
if ($UserProfile->online) {
    print '<li><strong>' . l_t('Currently logged in.') . '</strong> (' . libHTML::loggedOn($UserProfile->id) . ')</li>';
} else {
    print '<li><strong>' . l_t('Last visited:') . '</strong> ' . libTime::text($UserProfile->timeLastSessionEnded) . '</li>';
}
list($posts) = $DB->sql_row("SELECT (\r\n\t\tSELECT COUNT(fromUserID) FROM `wD_ForumMessages` WHERE type='ThreadStart' AND fromUserID = " . $UserProfile->id . "\r\n\t\t) + (\r\n\t\tSELECT COUNT(fromUserID) FROM `wD_ForumMessages` WHERE type='ThreadReply' AND fromUserID = " . $UserProfile->id . "\r\n\t\t)");
// Doing the query this way makes MySQL use the type, fromUserID index
if (is_null($posts)) {
    $posts = 0;
}
list($likes) = $DB->sql_row("SELECT COUNT(*) FROM wD_LikePost WHERE userID=" . $UserProfile->id);
list($liked) = $DB->sql_row("SELECT COUNT(*) FROM wD_ForumMessages fm \r\n\tINNER JOIN wD_LikePost lp ON lp.likeMessageID = fm.id \r\n\tWHERE fm.fromUserID=" . $UserProfile->id);
$likes = $likes ? '<strong>' . l_t('Likes:') . '</strong> ' . $likes : '';
$liked = $liked ? '<strong>' . l_t('Liked:') . '</strong> ' . $liked : '';
print '<li><strong>' . l_t('Forum posts:') . '</strong> ' . $posts . '<br />';
//<strong>'.l_t('View:').'</strong> <a class="light" href="profile.php?detail=threads&userID='.$UserProfile->id.'">'.l_t('Threads').'</a>,
//	<a class="light" href="profile.php?detail=replies&userID='.$UserProfile->id.'">'.l_t('replies').'</a>';
Esempio n. 7
0
 /**
  * Output the tabs which go on top of the chat-box, along with online notifications and message notifications
  * where applicable
  * @param string $msgCountryID The name of the countryID/tab which we have open
  * @return string The HTML for the chat-box tabs
  */
 protected function outputTabs($msgCountryID)
 {
     global $Member, $Game;
     $tabs = '<div id="chatboxtabs" class="gamelistings-tabs">';
     for ($countryID = 0; $countryID <= count($Game->Variant->countries); $countryID++) {
         // Do not allow country specific tabs for restricted press games.
         if ($Game->pressType != 'Regular' && $countryID != 0 && $countryID != $Member->countryID) {
             continue;
         }
         $tabs .= ' <a href="./board.php?gameID=' . $Game->id . '&amp;msgCountryID=' . $countryID . '&amp;rand=' . rand(1, 100000) . '#chatboxanchor" ' . 'class="country' . $countryID . ' ' . ($msgCountryID == $countryID ? 'current"' : '" title="' . l_t('Open %s chatbox tab"', $countryID == 0 ? 'the global' : $this->countryName($countryID) . "'s")) . '>';
         if ($countryID == $Member->countryID) {
             $tabs .= l_t('Notes');
         } elseif (isset($Game->Members->ByCountryID[$countryID])) {
             $tabs .= $Game->Members->ByCountryID[$countryID]->memberCountryName();
             if ($Game->Members->ByCountryID[$countryID]->online && !$Game->Members->ByCountryID[$countryID]->isNameHidden()) {
                 $tabs .= ' ' . libHTML::loggedOn($Game->Members->ByCountryID[$countryID]->userID);
             }
         } else {
             $tabs .= l_t('Global');
         }
         if ($msgCountryID != $countryID and in_array($countryID, $Member->newMessagesFrom)) {
             // This isn't the tab I am currently viewing, and it has sent me new messages
             $tabs .= ' ' . libHTML::unreadMessages();
         }
         // Mark as unread patch!
         if ($msgCountryID == $countryID and isset($_REQUEST['MarkAsUnread'])) {
             $tabs .= ' ' . libHTML::unreadMessages();
         }
         $tabs .= '</a>';
     }
     $tabs .= '</div>';
     return $tabs;
 }
Esempio n. 8
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>?');
        }
    }