Пример #1
0
        }
    }
    // Replies done, now print the footer
    print '<div class="message-foot threadalternate' . $switch . '">';
    // Now we show the Reply and Close Thread box.
    if ($message['id'] == $viewthread) {
        if ($User->type['User'] && !isset($postLockedReason)) {
            print '<div class="postbox">' . ($new['id'] != -1 ? '' : '<a name="postbox"></a>') . '<form class="safeForm" action="./forum.php?newsendtothread=' . $viewthread . '&amp;viewthread=' . $viewthread . '#postbox" method="post">
				<input type="hidden" name="page" value="1" />
				<p>';
            print '<div class="hrthin"></div>';
            if (isset($messageproblem) and $new['sendtothread']) {
                print '<p class="notice">' . $messageproblem . '</p>';
            }
            print '<TEXTAREA NAME="newmessage" style="margin-bottom:5px;" ROWS="4">' . $_REQUEST['newmessage'] . '</TEXTAREA><br />
					<input type="hidden" value="' . libHTML::formTicket() . '" name="formTicket">
					<input type="hidden" name="page" value="' . $forumPager->pageCount . '" />
					<input type="submit" class="form-submit" value="' . l_t('Post reply') . '" name="' . l_t('Reply') . '"></p></form>
					</div>
					<div class="hrthin"></div>';
        } else {
            print '<br />';
        }
    }
    print '<div class="message-foot-notification threadalternate' . $switch . '">
			<em><strong>' . $message['replies'] . '</strong> ' . ($message['replies'] == 1 ? l_t('reply') : l_t('replies')) . '</em>
			</div>';
    if ($message['id'] == $viewthread) {
        print '<form action="forum.php#' . $message['id'] . '" method="get">
						<input type="hidden" name="viewthread" value="0" />
						<input type="submit" class="form-submit" value="' . l_t('Close') . '" />
Пример #2
0
 /**
  * Returns the actual form, given the votes which can be voted for, and votes which can
  * be cancelled.
  *
  * @param array $vVote Allowed votes
  * @param array $vCancel Votes which can be cancelled
  * @return string
  */
 function showVoteForm($vVote, $vCancel)
 {
     $buf = '<form onsubmit="return confirm(\'' . l_t("Are you sure you want to cast this vote?") . '\');" action="board.php?gameID=' . $this->id . '#votebar" method="post">';
     $buf .= '<input type="hidden" name="formTicket" value="' . libHTML::formTicket() . '" />';
     $buf .= '<div class="memberUserDetail">';
     foreach ($vVote as $vote) {
         if ($vote == 'Pause' && $this->processStatus == 'Paused') {
             $vote = 'Unpause';
         }
         $buf .= '<input type="submit" class="form-submit" name="' . $vote . '" value="' . l_t($vote) . '" /> ';
     }
     $buf .= '</div></form>';
     $buf .= '<form onsubmit="return confirm(\'' . l_t("Are you sure you want to withdraw this vote?") . '\');" action="board.php?gameID=' . $this->id . '#votebar" method="post">';
     $buf .= '<input type="hidden" name="formTicket" value="' . libHTML::formTicket() . '" />';
     if ($vCancel) {
         $buf .= '<div class="memberGameDetail">' . l_t('Cancel:') . ' ';
         foreach ($vCancel as $vote) {
             if ($vote == 'Pause' && $this->processStatus == 'Paused') {
                 $vote = 'Unpause';
             }
             $buf .= '<input type="submit" class="form-submit" name="' . $vote . '" value="' . l_t($vote) . '" /> ';
         }
         $buf .= '</div>';
     }
     $buf .= '</form><div style="clear:both"></div>';
     return $buf;
 }
Пример #3
0
    /**
     * A bar with form buttons letting you join/leave a game
     * @return string
     */
    function joinBar()
    {
        global $User;
        if ($this->Members->isJoined()) {
            if ($this->phase == 'Pre-game') {
                $reason = $this->Members->cantLeaveReason();
                if ($reason) {
                    return l_t("(Can't leave game; %s.)", $reason);
                } else {
                    return '<form onsubmit="return confirm(\'' . l_t('Are you sure you want to leave this game?') . '\');" method="post" action="board.php?gameID=' . $this->id . '"><div>
					<input type="hidden" name="formTicket" value="' . libHTML::formTicket() . '" />
					<input type="submit" name="leave" value="' . l_t('Leave game') . '" class="form-submit" />
					</div></form>';
                }
            } else {
                return '';
            }
        } else {
            $buf = '';
            if ($this->isJoinable()) {
                if ($this->minimumBet <= 100 && !$User->type['User'] && !$this->private) {
                    return l_t('A newly registered account can join this game; ' . '<a href="register.php" class="light">register now</a> to join.');
                }
                $question = l_t('Are you sure you want to join this game?') . '\\n\\n';
                if ($this->isLiveGame()) {
                    $question .= l_t('The game will start at the scheduled time even if all %s players have joined.', count($this->Variant->countries));
                } else {
                    $question .= l_t('The game will start when all %s players have joined.', count($this->Variant->countries));
                }
                if ($this->minimumReliabilityRating > 0) {
                    $buf .= l_t('Minimum Reliability Rating: <span class="%s">%s%%</span>.', $User->reliabilityRating < $this->minimumReliabilityRating ? 'Austria' : 'Italy', $this->minimumReliabilityRating);
                }
                if ($User->reliabilityRating >= $this->minimumReliabilityRating) {
                    $buf .= '<form onsubmit="return confirm(\'' . $question . '\');" method="post" action="board.php?gameID=' . $this->id . '"><div>
						<input type="hidden" name="formTicket" value="' . libHTML::formTicket() . '" />';
                    if ($this->phase == 'Pre-game') {
                        $buf .= l_t('Bet to join: %s: ', '<em>' . $this->minimumBet . libHTML::points() . '</em>');
                    } else {
                        $buf .= $this->Members->selectCivilDisorder();
                    }
                    if ($this->private) {
                        $buf .= '<br />' . self::passwordBox();
                    }
                    $buf .= ' <input type="submit" name="join" value="' . l_t('Join') . '" class="form-submit" />';
                    $buf .= '</div></form>';
                }
            }
            if ($User->type['User'] && $this->phase != 'Finished') {
                $buf .= '<form method="post" action="redirect.php">' . '<input type="hidden" name="gameID" value="' . $this->id . '">';
                if (!$this->watched()) {
                    $buf .= '<input style="margin-top: 0.5em;" type="submit" title="' . l_t('Adds this game to the watched games list on your home page, and subscribes you to game notifications') . '" ' . 'class="form-submit" name="watch" value="' . l_t('Spectate game') . '">';
                } else {
                    $buf .= '<input type="submit" title="' . l_t('Removes this game from the watch list on your home page, and unsubscribes you from game notifications') . '" ' . 'class="form-submit" name="unwatch" value="' . l_t('Stop spectating game') . '">';
                }
                $buf .= '</form>';
            }
        }
        return $buf;
    }
Пример #4
0
    /**
     * For the given task display the form, and run the task if data entered from the corresponding form
     *
     * @param string $actionName The code-name for the desired task
     */
    public function process($actionName)
    {
        global $Misc;
        // TODO: Use late static binding for this instead of INBOARD detection
        extract($this->actionsList[$actionName]);
        print '<li class="formlisttitle">
			<a name="' . $actionName . '"></a>' . l_t($name) . '</li>';
        try {
            if (isset($_REQUEST['actionName']) and $_REQUEST['actionName'] == $actionName) {
                print '<li class="formlistfield">';
                $paramValues = array();
                foreach ($params as $paramName => $paramFullName) {
                    if (isset($_REQUEST[$paramName])) {
                        $paramValues[$paramName] = $_REQUEST[$paramName];
                    }
                }
                if (isset($paramValues['gameID'])) {
                    require_once l_r('objects/game.php');
                    $Variant = libVariant::loadFromGameID((int) $paramValues['gameID']);
                    $Game = $Variant->Game((int) $paramValues['gameID']);
                    print '<p>' . l_t('Game link') . ': <a href="board.php?gameID=' . $Game->id . '">' . $Game->name . '</a></p>';
                }
                if (isset($paramValues['userID'])) {
                    $User = new User((int) $paramValues['userID']);
                    print '<p>' . l_t('User link') . ': ' . $User->profile_link() . '</p>';
                }
                if (isset($paramValues['postID'])) {
                    print '<p>' . l_t('Post link') . ': ' . libHTML::threadLink($paramValues['postID']) . '</p>';
                }
                // If it needs confirming but ( hasn't been confirmed or is being resubmitted ):
                if (!self::isActionDangerous($actionName) && (!isset($_REQUEST['actionConfirm']) || !libHTML::checkTicket())) {
                    print '<strong>' . $this->{$actionName . 'Confirm'}($paramValues) . '</strong>';
                    print '<form action="' . self::$target . '#' . $actionName . '" method="post">
						<input type="hidden" name="actionName" value="' . $actionName . '" />
						<input type="hidden" name="actionConfirm" value="on" />
						<input type="hidden" name="formTicket" value="' . libHTML::formTicket() . '" />';
                    foreach ($paramValues as $name => $value) {
                        print '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
                    }
                    print '</li><li class="formlistfield" style="margin-bottom:20px">
						<input type="submit" class="form-submit" value="Confirm" />

						</form>';
                } else {
                    $details = $this->{$actionName}($paramValues);
                    self::save($name, $paramValues, $details);
                    $description = '<p class="notice">' . $details . '</p>
									<p>' . l_t($description) . '</p>';
                    $Misc->LastModAction = time();
                }
                print '</li>';
            }
        } catch (Exception $e) {
            $description = '<p><strong>' . l_t('Error') . ':</strong> ' . $e->getMessage() . '</p>
							<p>' . l_t($description) . '</p>';
        }
        self::form($actionName, $params, $description);
    }
Пример #5
0
    private function replyBox()
    {
        return '<a name="messagebox"></a>
		<form action="index.php?toUserID=' . $this->fromID . '&notices=on" method="post">
			<input type="hidden" name="formTicket" value="' . libHTML::formTicket() . '" />
			<textarea name="message" style="width:90%" rows="3"></textarea></li>
			<input type="submit" class="form-submit" value="' . l_t('Reply') . '" /></li>
		</form>
		</div>';
    }
Пример #6
0
    /**
     * Output the chatbox HTML; output the tabs, then the information about the player we're talking to,
     * then the correspondance we have with the current msgCountryID at the moment, then the post-box for
     * new messages we want to send
     *
     * @param string $msgCountryID The id of the country/tab which we have open
     * @return string The HTML for the chat-box
     */
    public function output($msgCountryID)
    {
        global $DB, $Game, $User, $Member;
        $chatbox = '<a name="chatboxanchor"></a><a name="chatbox"></a>';
        // Print each user's tab
        if (isset($Member)) {
            $chatbox .= $this->outputTabs($msgCountryID);
        }
        // Create the chatbox
        // Print info on the user we're messaging
        // Are we viewing another user, or the global chatbox?
        $chatbox .= '<DIV class="chatbox ' . (!isset($Member) ? 'chatboxnotabs' : '') . '">
					<TABLE class="chatbox">
					<TR class="barAlt2 membersList">
					<TD>';
        if ($msgCountryID == 0) {
            $memList = array();
            for ($countryID = 1; $countryID <= count($Game->Variant->countries); $countryID++) {
                $memList[] = $Game->Members->ByCountryID[$countryID]->memberNameCountry();
            }
            $chatbox .= '<div class="chatboxMembersList">' . implode(', ', $memList) . '</div>';
        } else {
            if (!isset($Member) || $Member->countryID != $msgCountryID) {
                $chatbox .= $Game->Members->ByCountryID[$msgCountryID]->memberBar();
            }
        }
        $chatbox .= '</TD></TR></TABLE></DIV>';
        // Print the messages in the chatbox
        $chatbox .= '<DIV id="chatboxscroll" class="chatbox"><TABLE class="chatbox">';
        $messages = $this->getMessages($msgCountryID);
        if ($messages == "") {
            $chatbox .= '<TR class="barAlt1"><td class="notice">
					' . l_t('No messages yet posted.') . '</td></TR>';
        } else {
            $chatbox .= $messages;
        }
        $chatbox .= '</TABLE></DIV>';
        if ($User->type['Moderator'] && $msgCountryID == 0 || isset($Member) && ($Game->pressType == 'Regular' || $Member->countryID == $msgCountryID || $msgCountryID == 0 && ($Game->pressType == 'PublicPressOnly' || $Game->pressType == 'NoPress' && $Game->phase == 'Finished'))) {
            $chatbox .= '<DIV class="chatbox"><TABLE>
					<form method="post" class="safeForm" action="board.php?gameID=' . $Game->id . '&amp;msgCountryID=' . $msgCountryID . '">
					<TR class="barAlt2">
						<TD class="left">
						' . ($msgCountryID == 0 ? '' : '
							<a href="#" onclick="document.markUnread.submit(); return false;" tabindex="3">Mark unread</a>
						') . '
						</TD>
						<TD class="right" rowspan="2">
							<TEXTAREA id="sendbox" tabindex="1" NAME="newmessage" style="width:98% !important" width="100%" ROWS="5"></TEXTAREA>
						</TD>
					</TR>
					<TR class="barAlt2">
						<TD class="left send">
							<input type="hidden" name="formTicket" value="' . libHTML::formTicket() . '" />
							<input type="submit" tabindex="2" class="form-submit" value="' . l_t('Send') . '" name="Send" /><br/>
						</TD>
					</TR>
					</form>
					' . ($msgCountryID == 0 ? '' : '
						<form method="post" name="markUnread" class="safeForm" action="board.php?gameID=' . $Game->id . '&amp;msgCountryID=' . $msgCountryID . '#chatboxanchor">
							<input type="hidden" tabindex="2" value="" name="MarkAsUnread" />
						</form>
					') . '
				</TABLE></DIV>';
        }
        libHTML::$footerScript[] = '
			var cbs = $("chatboxscroll");

			cbs.scrollTop = cbs.scrollHeight;
			';
        // Don't focus the chatbox if the user is entering orders
        if (isset($_REQUEST['msgCountryID'])) {
            libHTML::$footerScript[] = '
				var sb = $("sendbox");
				if( sb != null && !Object.isUndefined(sb) ) {
					$("sendbox").focus();
				}
			';
        }
        return $chatbox;
    }