Example #1
0
    function mapHTML()
    {
        global $User;
        $mapTurn = $this->phase == 'Pre-game' || $this->phase == 'Diplomacy' ? $this->turn - 1 : $this->turn;
        $smallmapLink = 'map.php?gameID=' . $this->id . '&turn=' . $mapTurn . ($User->options->value['showMoves'] == 'No' ? '&hideMoves' : '');
        $largemapLink = $smallmapLink . '&mapType=large' . ($User->options->value['showMoves'] == 'No' ? '&hideMoves' : '');
        $staticFilename = Game::mapFilename($this->id, $mapTurn, 'small');
        if (file_exists($staticFilename) && $User->options->value['showMoves'] == 'Yes') {
            $smallmapLink = STATICSRV . $staticFilename . '?nocache=' . rand(0, 99999);
        }
        $map = '
		<div id="mapstore">
			<img id="mapImage" src="' . $smallmapLink . '" alt=" " title="' . l_t('The small map for the current phase. If you are starting a new turn this will show the last turn\'s orders') . '" />
			<p class="lightgrey" style="text-align:center">
				<a class="mapnav" href="#" onClick="loadMap(' . $this->id . ',' . $mapTurn . ',-1); return false;">
                      <img id="Start" src="' . l_s('images/historyicons/Start_disabled.png') . '" alt="' . l_t('Start') . '" title="' . l_t('View the map from the first turn') . '" /></a>
				<a class="mapnav" href="#" onClick="loadMapStep(' . $this->id . ',' . $mapTurn . ',-1); return false;"><img id="Backward" src="' . l_s('images/historyicons/Backward_disabled.png') . '" alt="' . l_t('Backward') . '" title="' . l_t('View the map from the previous turn') . '" /></a>
                <!--    The following is the toggle for removing the movement arrows. Uncomment this section if you want the movement arrow toggle.
                <a class="mapnav" href="#" onClick="toggleMoves(' . $this->id . ',' . $mapTurn . '); return false;"><img id="NoMoves" src="images/historyicons/hidemoves.png" alt="NoMoves" title="Toggle movement lines" />
                </a>                 -->
			   <a id="LargeMapLink" class="mapnav" href="' . $largemapLink . '" target="_blank" class="light"><img src="' . l_s('images/historyicons/external.png') . '" alt="' . l_t('Open large map') . '" title="' . l_t('This button will open the large map in a new window. The large map shows all the moves, and is useful when the small map isn\'t clear enough.') . '" /></a></span>
                     
				<a class="mapnav" href="#" onClick="loadMapStep(' . $this->id . ',' . $mapTurn . ',1); return false;"><img id="Forward" src="' . l_s('images/historyicons/Forward_disabled.png') . '" alt="' . l_t('Forward') . '" title="' . l_t('View the map from the next turn') . '" /></a>
				<a class="mapnav" href="#" onClick="loadMap(' . $this->id . ',' . $mapTurn . ',' . $mapTurn . '); return false;"><img id="End" src="' . l_s('images/historyicons/End_disabled.png') . '" alt="' . l_t('End') . '" title="' . l_t('View the map from the most recent turn') . '" /></a>' . ($this->Members->isJoined() ? '<a class="mapnav" href="#" onClick="togglePreview(' . $this->id . ',' . $mapTurn . '); return false;"><img id="Preview" src="images/historyicons/Preview.png" alt="PreviewMoves" title="Show server side stored orders on the map" /></a>' : '') . '
							
			</p>
			<p id="History" class="lightgrey"></p>
		</div>
';
        $this->mapJS($mapTurn);
        return $map;
    }
Example #2
0
 protected function resources()
 {
     if ($this->smallmap) {
         return array('map' => l_s('variants/AncMed/resources/smallmap.png'), 'army' => l_s('contrib/smallarmy.png'), 'fleet' => l_s('contrib/smallfleet.png'), 'names' => l_s('variants/AncMed/resources/smallmapNames.png'), 'standoff' => l_s('images/icons/cross.png'));
     } else {
         return array('map' => l_s('variants/AncMed/resources/map.png'), 'army' => l_s('contrib/army.png'), 'fleet' => l_s('contrib/fleet.png'), 'names' => l_s('variants/AncMed/resources/mapNames.png'), 'standoff' => l_s('images/icons/cross.png'));
     }
 }
Example #3
0
 protected function loadImages()
 {
     parent::loadImages();
     if ($this->smallmap) {
         $this->sc = $this->loadImage(l_s('variants/Colonial/resources/sc_small.png'));
     } else {
         $this->sc = $this->loadImage(l_s('variants/Colonial/resources/sc_large.png'));
     }
 }
Example #4
0
 /**
  * Display a table with the vital members info; who is finalized, who has sent messages etc, each member
  * takes up a short, thin column.
  * @return string
  */
 function membersList()
 {
     global $User;
     // $membersList[$i]=array($nameOrCountryID,$iconOne,$iconTwo,...);
     $membersList = array();
     if ($this->Game->phase == 'Pre-game') {
         $count = count($this->ByID);
         for ($i = 0; $i < $count; $i++) {
             $membersList[] = array($i + 1, '<img src="' . l_s('images/icons/tick.png') . '" alt=" " title="' . l_t('Player joined, spot filled') . '" />');
         }
         for ($i = $count; $i <= count($this->Game->Variant->countries); $i++) {
             $membersList[] = array($i + 1, '');
         }
     } else {
         for ($countryID = 1; $countryID <= count($this->Game->Variant->countries); $countryID++) {
             $Member = $this->ByCountryID[$countryID];
             //if ( $User->id == $this->ByCountryID[$countryID]->userID )
             //	continue;
             //elseif( $Member->status != 'Playing' && $Member->status != 'Left' )
             //	continue;
             $membersList[] = $Member->memberColumn();
         }
     }
     $buf = '<table class="homeMembersTable">';
     $rowsCount = count($membersList[0]);
     $alternate = libHTML::$alternate;
     for ($i = 0; $i < $rowsCount; $i++) {
         $rowBuf = '';
         $dataPresent = false;
         $remainingPlayers = count($this->ByID);
         $remainingWidth = 100;
         foreach ($membersList as $data) {
             if ($data[$i]) {
                 $dataPresent = true;
             }
             if ($remainingPlayers > 1) {
                 $width = floor($remainingWidth / $remainingPlayers);
             } else {
                 $width = $remainingWidth;
             }
             $remainingPlayers--;
             $remainingWidth -= $width;
             $rowBuf .= '<td style="width:' . $width . '%" class="barAlt' . libHTML::alternate() . '">' . $data[$i] . '</td>';
         }
         libHTML::alternate();
         if ($dataPresent) {
             $buf .= '<tr>' . $rowBuf . '</tr>';
         }
         libHTML::$alternate = $alternate;
     }
     libHTML::alternate();
     $buf .= '</table>';
     return $buf;
 }
Example #5
0
 /**
  * Shortened game time remaining info
  * @return string
  */
 function gameTimeRemaining()
 {
     if ($this->processStatus == 'Paused') {
         return l_t('Paused') . ' <img src="' . l_s('images/icons/pause.png') . '" title="' . l_t('Paused') . '" />';
     } elseif ($this->processStatus == 'Crashed') {
         return l_t('Crashed');
     }
     if (!isset($timerCount)) {
         static $timerCount = 0;
     }
     $timerCount++;
     $buf = $this->processTimetxt();
     return $buf;
 }
Example #6
0
 /**
  * None,Saved,Completed,Ready
  * @return unknown_type
  */
 function icon()
 {
     if ($this->None) {
         return '- ';
     } elseif ($this->Ready) {
         return '<img src="' . l_s('images/icons/tick.png') . '" alt="' . l_t('Ready') . '" title="' . l_t('Ready to move to the next turn') . '" /> ';
     } elseif ($this->Completed) {
         return '<img src="' . l_s('images/icons/tick_faded.png') . '" alt="' . l_t('Completed') . '" title="' . l_t('Orders completed, but not ready for next turn') . '" /> ';
     } elseif ($this->Saved) {
         return '<img src="' . l_s('images/icons/alert_minor.png') . '" alt="' . l_t('Saved') . '" title="' . l_t('Orders saved, but not completed!') . '" /> ';
     } else {
         return '<img src="' . l_s('images/icons/alert.png') . '" alt="' . l_t('Not received') . '" title="' . l_t('No orders submitted!') . '" /> ';
     }
 }
Example #7
0
    public function Send(array $to, $title, $message)
    {
        if ($this->useDebug) {
            print '<p>' . l_t('Mailed "%s": <b>%s</b> - %s</p>', '<em>&lt;' . implode('&gt;, &lt;', $to) . '&gt;</em>', $title, $message);
            return;
        }
        $title = l_t('webDiplomacy: %s (no reply)', $title);
        $this->PHPMailer->Subject = $title;
        foreach ($to as $email => $name) {
            $wrappedmessage = '
<p>' . l_t('Hello %s,', $name) . '</p>
<p style="color:#222">
' . $message . "\r\n</p>\r\n<p style='color:#555'>" . l_t('Kind regards,') . "<br />\r\n" . Config::$mailerConfig['FromName'] . "</p>\r\n\r\n<p>\r\n<img src='" . l_s('http://webdiplomacy.net/images/webDiplomacy.png') . " alt='" . l_t("webDiplomacy") . "' />\r\n</p>\r\n\r\n<p style='font-size:90%; font-style:italic; color:#555'>\r\n" . l_t("This message was generated by a webDiplomacy server, sent from %s to %s (%s) at %s (GMT+0), on behalf of %s.", Config::$mailerConfig['From'], $email, $name, gmdate("Y-m-d\\TH:i:s\\Z"), htmlentities($_SERVER['REMOTE_ADDR'])) . "<br /><br />\r\n\r\n" . l_t("If this e-mail was unexpected it can be ignored, please don't reply.") . "<br />\r\n" . l_t("If you repeatedly get unexpected / unwanted e-mails from this address please contact the server admin at %s to have the matter investigated.", "<a href='mailto:" . Config::$adminEMail . "'>" . Config::$adminEMail . "</a>") . "\r\n</p>\r\n";
            $this->PHPMailer->Body = $wrappedmessage;
            $this->PHPMailer->AltBody = preg_replace('/<[^>]*>/', '', preg_replace('/<\\/?p>/', "\n\n", preg_replace('/<br ?\\/?>/', "\n", preg_replace("/\n/", "", $wrappedmessage))));
            $this->PHPMailer->AddAddress($email, $name);
            $this->PHPMailer->Send();
            $this->PHPMailer->ClearAddresses();
        }
        if ($this->PHPMailer->IsError()) {
            throw new Exception(l_t("Mailer error: %s", $this->PHPMailer->ErrorInfo));
        }
        $this->Clear();
    }
Example #8
0
    private static function footerScripts()
    {
        global $User, $Locale;
        $jsVersion = 4;
        // increment this to force clients to reload their JS files
        $buf = '';
        // onlineUsers, for the online icons
        $statsDir = libCache::dirName('stats');
        $onlineFile = l_s($statsDir . '/onlineUsers.json');
        if (file_exists($onlineFile)) {
            $buf .= '<script type="text/javascript" src="' . STATICSRV . $onlineFile . '"></script>';
        } else {
            $buf .= '<script type="text/javascript">onlineUsers = $A([ ]);</script>';
        }
        if (!is_object($User)) {
            return $buf;
        } elseif ($User->type['User']) {
            // Muted users
            $gameMutePairs = array();
            foreach ($User->getMuteCountries() as $gameMutePair) {
                $gameMutePairs[] = '[' . $gameMutePair[0] . ',' . $gameMutePair[1] . ']';
            }
            $buf .= '
			<script type="text/javascript">
			muteUsers = $A([' . implode(',', $User->getMuteUsers()) . ']);
			muteCountries = $A([' . implode(',', $gameMutePairs) . ']);
			muteThreads = $A([' . implode(',', $User->getMuteThreads()) . ']);
			</script>';
            unset($gameMutePairs);
            self::$footerIncludes[] = l_j('mute.js');
            self::$footerScript[] = l_jf('muteAll') . '();';
            // Participated threads
            $cacheUserParticipatedThreadIDsFilename = libCache::dirID('users', $User->id) . '/readThreads.js';
            if (file_exists($cacheUserParticipatedThreadIDsFilename)) {
                $buf .= '<script type="text/javascript" src="' . STATICSRV . $cacheUserParticipatedThreadIDsFilename . '?nocache=' . rand(0, 999999) . '"></script>';
                libHTML::$footerScript[] = l_jf('setForumParticipatedIcons') . '();';
            }
        }
        if (is_object($Locale)) {
            $Locale->onFinish();
        }
        // Add the javascript includes:
        $footerIncludes = array();
        $footerIncludes[] = l_j('../locales/layer.js');
        $footerIncludes[] = l_j('../locales/English/layer.js');
        $footerIncludes[] = l_j('contrib/sprintf.js');
        $footerIncludes[] = l_j('utility.js');
        $footerIncludes[] = l_j('cacheUpdate.js');
        $footerIncludes[] = l_j('timeHandler.js');
        $footerIncludes[] = l_j('forum.js');
        $footerIncludes[] = l_j('Color.Vision.Daltonize.js');
        // Don't localize all the footer includes here, as some of them may be dynamically generated
        foreach (array_merge($footerIncludes, self::$footerIncludes) as $includeJS) {
            // Add on the dynamically added includes
            $buf .= '<script type="text/javascript" src="' . STATICSRV . JSDIR . '/' . $includeJS . '?ver=' . $jsVersion . '"></script>';
        }
        // Utility (error detection, message protection), HTML post-processing,
        // time handling functions. Only logged-in users need to run these
        $buf .= '
		<script type="text/javascript">
			var UserClass = function () {
				this.id=' . $User->id . ';
				this.username="******";
				this.points=' . $User->points . '
				this.lastMessageIDViewed=' . $User->lastMessageIDViewed . ';
				this.timeLastSessionEnded=' . $User->timeLastSessionEnded . ';
				this.token="' . md5(Config::$secret . $User->id . 'Array') . '";
			}
			User = new UserClass();
			
			WEBDIP_DEBUG=' . (Config::$debug ? 'true' : 'false') . ';

			document.observe("dom:loaded", function() {
			
				try {
					' . l_jf('Locale.onLoad') . '();
					
					' . l_jf('onlineUsers.push') . '(User.id);
	
					' . l_jf('setUserOnlineIcons') . '();
					' . l_jf('setForumMessageIcons') . '();
					' . l_jf('setPostsItalicized') . '();
					' . l_jf('updateTimestamps') . '();
					' . l_jf('updateUTCOffset') . '();
					' . l_jf('updateTimers') . '();
	
					' . implode("\n", self::$footerScript) . '
					
					' . l_jf('Locale.afterLoad') . '();
				}
				catch( e ) {
				' . (Config::$debug ? 'alert(e);' : '') . '
				}
			}, this);
		</script>
		';
        if (Config::$debug) {
            $buf .= '<br /><strong>JavaScript localization lookup failures:</strong><br /><span id="jsLocalizationDebug"></span>';
        }
        return $buf;
    }
Example #9
0
   (at your option) any later version.

   webDiplomacy is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU Affero General Public License
   along with webDiplomacy.  If not, see <http://www.gnu.org/licenses/>.
*/
defined('IN_CODE') or die('This script can not be run by itself.');
/**
 * Return all the maps for this game. May use a lot of resources if the maps aren't
 * already cached.
 *
 * @package Board
 */
print '<h3>' . l_t('Maps') . '</h3>';
for ($i = $Game->turn; $i >= 0; $i--) {
    if ($i < $Game->turn && $i % 2 != 0) {
        print '<div class="hr"></div>';
    }
    print '<h4>' . $Game->datetxt($i) . '</h4>';
    print '<p style="text-align:center">
		<img src="map.php?gameID=' . $Game->id . '&turn=' . $i . '" title="' . l_t('Small map for this turn') . '" /><br />
		' . l_t('Large map:') . ' <a href="map.php?gameID=' . $Game->id . '&largemap=on&turn=' . $i . '">
					<img src="' . l_s('images/historyicons/external.png') . '" alt="' . l_t('Large map') . '"
						title="' . l_t('This button will open the large map in a new window. The large map shows all the moves, and is useful when the small map isn\'t clear enough') . '."
					/></a>
		</p>';
}
Example #10
0
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU Affero General Public License
   along with webDiplomacy.  If not, see <http://www.gnu.org/licenses/>.
*/
/**
 * Hall of fame; the top 100 webDip scorers
 *
 * @package Base
 * @subpackage Game
 */
require_once 'header.php';
libHTML::starthtml();
print libHTML::pageTitle(l_t('Hall of fame'), l_t('The webDiplomacy hall of fame; the 100 highest ranking players on this server.'));
print '<p align="center"><img src="' . l_s('images/points/stack.png') . '" alt=" "
			title="' . l_t('webDiplomacy ranking points; who are the most skilled at gathering them from their foes?') . '" /></p>';
print '<p></p>';
if ($User->type['User'] && $User->points > 100) {
    list($position) = $DB->sql_row("SELECT COUNT(id)+1 FROM wD_Users WHERE points > " . $User->points);
    $players = $Misc->RankingPlayers;
    print '<p>' . l_t('You are ranked %s out of %s ranking players (players with >100%s)', '<a href="#me" class="light">#' . $position . '</a>', $players, libHTML::points()) . l_t('For more stats on your ranking visit <a class="light" href="profile.php?userID=' . $User->id . '">your profile</a>.') . '</p>';
}
print '<table class="credits">';
$alternate = false;
$i = 1;
$crashed = $DB->sql_tabl("SELECT id, username, points FROM wD_Users\r\n\t\t\t\t\t\torder BY points DESC LIMIT 100 ");
while (list($id, $username, $points) = $DB->tabl_row($crashed)) {
    $alternate = !$alternate;
    print '
	<tr class="replyalternate' . ($alternate ? '1' : '2') . '">
Example #11
0
 protected function jsLoadBoard()
 {
     libHTML::$footerIncludes[] = l_j('board/model.js');
     libHTML::$footerIncludes[] = l_j('board/load.js');
     libHTML::$footerIncludes[] = l_j('orders/order.js');
     libHTML::$footerIncludes[] = l_j('orders/phase' . $this->phase . '.js');
     libHTML::$footerIncludes[] = l_s('../' . libVariant::$Variant->territoriesJSONFile());
     foreach (array('loadTerritories', 'loadBoardTurnData', 'loadModel', 'loadBoard', 'loadOrdersModel', 'loadOrdersForm', 'loadOrdersPhase') as $jf) {
         libHTML::$footerScript[] = l_jf($jf) . '();';
     }
 }
Example #12
0
    static function forumBlock()
    {
        $buf = '<div class="homeHeader">' . l_t('Forum') . '</div>';
        $forumNew = libHome::forumNew();
        $buf .= '<table><tr><td>' . implode('</td></tr><tr><td>', $forumNew) . '</td></tr></table>';
        return $buf;
    }
}
if (!$User->type['User']) {
    print '<div class="content-notice" style="text-align:center">' . libHome::globalInfo() . '</div>';
    print libHTML::pageTitle(l_t('Welcome to webDiplomacy!'), l_t('A multiplayer web implementation of the popular turn-based strategy game Diplomacy.'));
    //print '<div class="content">';
    ?>
	<p style="text-align: center;"><img
	src="<?php 
    print l_s('images/startmap.png');
    ?>
" alt="<?php 
    print l_t('The map');
    ?>
"
	title="<?php 
    print l_t('A webDiplomacy map');
    ?>
" /></p>
<p class="welcome"><?php 
    print l_t('<em> "Luck plays no part in Diplomacy. Cunning and
cleverness, honesty and perfectly-timed betrayal are the tools needed to
outwit your fellow players. The most skillful negotiator will climb to
victory over the backs of both enemies and friends.<br />
<br />
    /**
     * Compares this class' aUser with one of its bUsers, and the data returned from the comparison
     * makes it easy to tell if the two users are being played by the same player.
     *
     * @param User $bUser The user to compare aUser with
     */
    public function compare(User $bUser)
    {
        global $DB;
        print '<ul>';
        print '<li><a href="profile.php?userID=' . $bUser->id . '">' . $bUser->username . '</a> (' . $bUser->points . ' ' . libHTML::points() . ')
				' . ($bUser->type['Banned'] ? '<img src="' . l_s('images/icons/cross.png') . '" alt="X" title="' . l_t('Banned') . '" />' : '') . '
				RR: ' . $bUser->reliabilityRating . '
			(<a href="?aUserID=' . $bUser->id . '#viewMultiFinder" class="light">' . l_t('check userID=%s', $bUser->id) . '</a>)
				<ul><li><strong>email:</strong> ' . $bUser->email . '</li>';
        list($bUserTotal) = $DB->sql_row("SELECT COUNT(ip) FROM wD_AccessLog WHERE userID = " . $bUser->id);
        $this->compareIPData($bUser->id, $bUserTotal);
        $this->compareCookieCodeData($bUser->id, $bUserTotal);
        $this->compareUserAgentData($bUser->id, $bUserTotal);
        if (count($this->aLogsData['fullGameIDs']) > 0) {
            $this->compareGames('All games', $bUser->id, $this->aLogsData['fullGameIDs']);
        }
        if (count($this->aLogsData['activeGameIDs']) > 0) {
            $this->compareGames('Active games', $bUser->id, $this->aLogsData['activeGameIDs']);
        }
        print '</ul></li></ul>';
    }
Example #14
0
    }
    print '" alt=" " title="' . l_t('The map for the %s Variant', $Variant->name) . '" /></div><br />';
    print '<strong>' . l_t('Variant Parameters') . '';
    if (isset($Variant->version)) {
        print ' ' . l_t('(Version: %s)', $Variant->version) . '';
    }
    print ':</strong>';
    print '<ul>';
    if (isset($Variant->homepage)) {
        print '<li><a href="' . $Variant->homepage . '">' . l_t('Variant homepage') . '</a></li>';
    }
    if (isset($Variant->author)) {
        print '<li> ' . l_t('Created by: %s', $Variant->author) . '</li>';
    }
    if (isset($Variant->adapter)) {
        print '<li> ' . l_t('Adapted for webDiplomacy by: %s', $Variant->adapter) . '</li>';
    }
    print '<li> ' . l_t('SCs required for solo win: %s', $Variant->supplyCenterTarget) . '</li>';
    if (!file_exists(l_s('variants/' . $Variant->name . '/rules.html'))) {
        print '<li>' . l_t('Standard Diplomacy Rules Apply') . '</li>';
    }
    print '</ul>';
    if (file_exists(l_s('variants/' . $Variant->name . '/rules.html'))) {
        print '<p><strong>' . l_t('Special rules/information:') . '</strong></p>';
        print '<div>' . file_get_contents(l_s('variants/' . $Variant->name . '/rules.html')) . '</div>';
    }
    print '<div><a href="#top" class="light">' . l_t('Back to top') . '</a></div>';
    print '<div class="hr"></div>';
}
print '</div>';
libHTML::footer();
Example #15
0
 function button($args, $anchor, $number, $icon, $which, $extra = '')
 {
     $image = '<img src="' . l_s('images/historyicons/' . $icon) . '" alt="' . l_t($which) . '" title="' . l_t($which . ' page' . $extra) . '" />';
     if ($number == '') {
         return $image;
     }
     return '<a href="' . $this->URL . '?' . $args . 'page-' . $this->type . '=' . $number . '#' . $anchor . '">' . $image . '</a>';
 }
Example #16
0
			<strong><em>' . libTime::text($message['timeSent']) . '</em></strong>' . $muteLink . '<br />
			' . $User->likeMessageToggleLink($message['id'], $message['fromUserID']) . libHTML::likeCount($message['likeCount']) . '</div>';
    print '<div class="message-subject">';
    print libHTML::forumMessage($message['id'], $message['latestReplySent']);
    print libHTML::forumParticipated($message['id']);
    if ($message['latestReplySent'] < $Misc->ThreadAliveThreshold) {
        $postLockedReason = l_t("Thread is too old to reply to");
    } elseif (isset($silence) && $silence->isEnabled()) {
        $postLockedReason = l_t("This thread has been locked; ") . $silence->reason;
    } elseif ($User->isSilenced()) {
        $postLockedReason = l_t("This account has been silenced; ") . $User->getActiveSilence()->reason;
    } else {
        unset($postLockedReason);
    }
    if (isset($postLockedReason)) {
        print '<img src="' . l_s('images/icons/lock.png') . '" title="' . $postLockedReason . '" /> ';
    }
    print '<strong>' . $message['subject'] . '</strong>';
    print '</div>
		
		<div class="message-body threadalternate' . $switch . '">
			<div class="message-contents" fromUserID="' . $message['fromUserID'] . '">
				' . $message['message'] . '
			</div>
		</div>
	<div style="clear:both;"></div>';
    if ($message['id'] == $viewthread) {
        $replyToID = $message['id'];
        // If there are no replies this will ensure the thread is still marked as read
        $replyID = $message['id'];
        if ($message['replies'] > 50) {
Example #17
0
 /**
  * Icons for the game, e.g. private padlock and featured star
  * @return string
  */
 function gameIcons()
 {
     global $Misc;
     $buf = '';
     if ($this->pot > $Misc->GameFeaturedThreshold) {
         $buf .= '<img src="' . l_s('images/icons/star.png') . '" alt="' . l_t('Featured') . '" title="' . l_t('This is a featured game, one of the highest stakes games on the server!') . '" /> ';
     }
     if ($this->private) {
         $buf .= '<img src="' . l_s('images/icons/lock.png') . '" alt="' . l_t('Private') . '" title="' . l_t('This is a private game; password needed!') . '" /> ';
     }
     return $buf;
 }
Example #18
0
 static function typeIcon($type)
 {
     // This must take either a list as it comes from a SQL query, or a built-in $this->type['Admin'] style array
     if (is_array($type)) {
         $types = array();
         foreach ($type as $n => $v) {
             if ($v) {
                 $types[] = $n;
             }
         }
         $type = implode(',', $types);
     }
     $buf = '';
     if (strstr($type, 'Moderator')) {
         $buf .= ' <img src="' . l_s('images/icons/mod.png') . '" alt="' . l_t('Mod') . '" title="' . l_t('Moderator/Admin') . '" />';
     } elseif (strstr($type, 'Banned')) {
         $buf .= ' <img src="' . l_s('images/icons/cross.png') . '" alt="X" title="' . l_t('Banned') . '" />';
     }
     if (strstr($type, 'DonatorPlatinum')) {
         $buf .= libHTML::platinum();
     } elseif (strstr($type, 'DonatorGold')) {
         $buf .= libHTML::gold();
     } elseif (strstr($type, 'DonatorSilver')) {
         $buf .= libHTML::silver();
     } elseif (strstr($type, 'DonatorBronze')) {
         $buf .= libHTML::bronze();
     }
     return $buf;
 }
Example #19
0
                $DB->sql_put("COMMIT");
                require_once l_r('gamemaster/game.php');
                $Game = libVariant::$Variant->processGame($Game->id);
                $Game->crashed();
                $DB->sql_put("COMMIT");
            } elseif ($Game->needsProcess()) {
                $DB->sql_put("UPDATE wD_Games SET attempts=attempts+1 WHERE id=" . $Game->id);
                $DB->sql_put("COMMIT");
                $results['process'] = 'Attempted';
                require_once l_r('gamemaster/game.php');
                $Game = libVariant::$Variant->processGame($O->gameID);
                if ($Game->needsProcess()) {
                    $Game->process();
                    $DB->sql_put("UPDATE wD_Games SET attempts=0 WHERE id=" . $Game->id);
                    $DB->sql_put("COMMIT");
                    $results['process'] = 'Success';
                    $results['notice'] = l_t('Game processed, click <a href="%s">here</a> to refresh..', 'board.php?gameID=' . $Game->id . '&nocache=' . rand(0, 1000));
                }
            }
        }
    } catch (Exception $e) {
        if ($e->getMessage() == "Abandoned" || $e->getMessage() == "Cancelled") {
            $DB->sql_put("COMMIT");
        } else {
            $DB->sql_put("ROLLBACK");
        }
        $results = array('invalid' => true, 'statusIcon' => '<img src="' . l_s('images/icons/alert.png') . '" alt="' . l_t('Error') . '" title="' . l_t('Error alert') . '" />', 'statusText' => '', 'notice' => l_t('Exception: ') . $e->getMessage(), 'orders' => array());
    }
}
header('X-JSON: (' . json_encode($results) . ')');
close();