示例#1
0
    /*
     * This isn't very secure, it could potentially lead to XSS attacks, but it
     * is the easiest way to un-escape a failed post without having to use a
     * UTF-8 library to replace strings
     */
    $_REQUEST['newmessage'] = '';
    $_REQUEST['newsubject'] = '';
}
$_SESSION['viewthread'] = $viewthread;
if (isset($_REQUEST['reply']) && $_REQUEST['reply'] == 'success') {
    $messageproblem = l_t("Reply posted sucessfully.");
    $new['message'] = "";
    $new['subject'] = "";
    $new['sendtothread'] = $viewthread;
}
libHTML::starthtml();
if ($User->type['Guest']) {
    print libHTML::pageTitle(l_t('Forum'), l_t('A place to discuss topics/games with other webDiplomacy players.'));
} else {
    print '<div class="content">';
}
if (isset($messageproblem) and !$new['sendtothread']) {
    print '<p class="notice"><a name="postbox"></a>' . $messageproblem . '</p>';
    libHTML::pagebreak();
}
print '<div class="forum"><a name="forum"></a>';
print '
	<div id="forumPostbox" style="' . ($postboxopen ? '' : libHTML::$hideStyle) . '" class="thread threadalternate1 threadborder1">
	<div style="margin:0;padding:0">
	<div class="message-head">
		<strong>' . l_t('Start a new discussion in the public forum') . '</strong>
示例#2
0
require_once l_r('gamemaster/misc.php');
if ($Misc->Panic) {
    libHTML::notice(l_t('Game processing disabled'), l_t("Game processing has been temporarily disabled while we take care of an " . "unexpected problem. Please try again later, sorry for the inconvenience."));
}
if (!($User->type['Moderator'] or isset($_REQUEST['gameMasterSecret']) and $_REQUEST['gameMasterSecret'] == Config::$gameMasterSecret or isset($_REQUEST['gameMasterToken']) and libAuth::gamemasterToken_Valid($_REQUEST['gameMasterToken']))) {
    libHTML::notice(l_t('Denied'), l_t('Only the cron script and moderators can run the gamemaster script.'));
}
if (isset($_REQUEST['gameMasterSecret']) && $User->type['User'] && !$User->type['Moderator'] && $Misc->LastProcessTime == 0) {
    // The server has just been installed; make this user the admin now.
    $DB->sql_put("UPDATE wD_Users SET type = CONCAT(type,',Moderator,Admin') WHERE id = " . $User->id);
    $User->type['Moderator'] = $User->type['Admin'] = true;
    $Misc->LastProcessTime = time();
    $Misc->write();
    libHTML::notice(l_t('Admin'), l_t("You have been made admin. Please continue with the install instructions in README.txt."));
}
libHTML::starthtml(l_t('GameMaster'));
print '<div class="content">';
$DB->sql_put("COMMIT");
// Unlock our user row, to prevent deadlocks below
// This means our $User object should only be used for reading from
ini_set('memory_limit', "40M");
ini_set('max_execution_time', '40');
/*
 * - Update session table
 * - Update misc values (if running as admin/mod)
 * - Check last process time, pause processing/save current process time
 * - Check queue and games table for games to process, votes to enact, and system functions to perform
 */
print l_t('Updating session table') . '<br />';
libGameMaster::updateSessionTable();
$statsDir = libCache::dirName('stats');
示例#3
0
 /**
  * Wipe everything done so far, output a notice and end the script. Can be run in
  * the event of errors.
  *
  * @param string $title The title to display
  * @param string $message The message/notice to show
  */
 public static function notice($title, $message)
 {
     ob_clean();
     libHTML::starthtml($title);
     print '<div class="content-notice"><p>' . $message . '</p></div>';
     print '</div>';
     libHTML::footer();
 }
示例#4
0
            }
        }
    } catch (Exception $e) {
        // Couldn't leave/join game
        libHTML::error($e->getMessage());
    }
} else {
    try {
        require_once l_r('objects/game.php');
        require_once l_r('board/chatbox.php');
        require_once l_r('gamepanel/gameboard.php');
        $Variant = libVariant::loadFromGameID($gameID);
        libVariant::setGlobals($Variant);
        $Game = $Variant->panelGameBoard($gameID);
        // If viewing an archive page make that the title, otherwise us the name of the game
        libHTML::starthtml(isset($_REQUEST['viewArchive']) ? $_REQUEST['viewArchive'] : $Game->titleBarName());
        if ($Game->Members->isJoined()) {
            // We are a member, load the extra code that we might need
            require_once l_r('gamemaster/gamemaster.php');
            require_once l_r('board/member.php');
            require_once l_r('board/orders/orderinterface.php');
            global $Member;
            $Game->Members->makeUserMember($User->id);
            $Member = $Game->Members->ByUserID[$User->id];
        }
    } catch (Exception $e) {
        // Couldn't load game
        libHTML::error(l_t("Couldn't load specified game; this probably means this game was cancelled or abandoned.") . " " . ($User->type['User'] ? l_t("Check your <a href='index.php' class='light'>notices</a> for messages regarding this game.") : ''));
    }
}
if (isset($_REQUEST['viewArchive'])) {
示例#5
0
        $PO = $testCase->Variant->processOrderDiplomacy();
        $PO->completeAll();
        $PO->toMoves();
        $adj = $Game->Variant->adjudicatorDiplomacy();
        $standOffTerrs = $adj->adjudicate();
        $testCase->checkResults();
        // Check the adjudication results, saved to wD_Moves
        print l_t('%s has passed!', $testName);
        $passed = true;
        $DB->sql_put("UPDATE wD_DATC SET status = 'Passed' WHERE testID = " . $testID);
    } catch (Exception $e) {
        // Something messed up.
        print $e->getMessage();
        $passed = false;
    }
    // Save the adjudication results in wD_Moves to wD_Units and wD_TerrStatus, and update wD_Games so that map.php will correctly
    // draw the results.
    $testCase->mapPrepare(isset($standOffTerrs) ? $standOffTerrs : array());
    if (isset($_REQUEST['batchTest']) and $passed) {
        // We're batch testing, and we passed, move straight onto the next test.
        header('refresh: 0; url=datc.php?next=on&batchTest=' . rand(0, 999999));
        ob_clean();
        libHTML::starthtml('Batch testing');
        print '<div class="content datc">
			<p class="notice">' . l_t('Passed test %s. Rendering, saving maps, moving onto next test.', $testName) . '</p>';
    }
    print '<div class="hr"></div>
		<p class="notice"><a href="map.php?gameID=' . $testCase->id . '&turn=' . $testID . '&DATC=1&nocache=' . rand(0, 99999) . '"><img alt="' . l_t('Drawing map') . '..." src="map.php?gameID=' . $testCase->id . '&turn=' . $testID . '&DATC=1&nocache=' . rand(0, 99999) . '" /></a></p>';
}
print '</div>';
libHTML::footer();
示例#6
0
*/
/**
 * @package Base
 */
require_once 'header.php';
require_once l_r('lib/message.php');
require_once l_r('objects/game.php');
require_once l_r('gamepanel/gamehome.php');
/*
 * A field
 *
 * add(field, index)
 * compare(field1, field2) -> 1 if aligned, 0 if not
 *
 */
libHTML::starthtml(l_t('Home'));
if (!isset($_SESSION['lastSeenHome']) || $_SESSION['lastSeenHome'] < $User->timeLastSessionEnded) {
    $_SESSION['lastSeenHome'] = $User->timeLastSessionEnded;
}
class libHome
{
    public static function getType($type = false, $limit = 35)
    {
        global $DB, $User;
        $notices = array();
        $tabl = $DB->sql_tabl("SELECT *\r\n\t\t\tFROM wD_Notices WHERE toUserID=" . $User->id . ($type ? " AND type='" . $type . "'" : '') . "\r\n\t\t\tORDER BY timeSent DESC " . ($limit ? 'LIMIT ' . $limit : ''));
        while ($hash = $DB->tabl_hash($tabl)) {
            $notices[] = new notice($hash);
        }
        return $notices;
    }
示例#7
0
<?php

/*
   Copyright (C) 2004-2010 Kestas J. Kuliukas

	This file is part of webDiplomacy.

   webDiplomacy is free software: you can redistribute it and/or modify
   it under the terms of the GNU Affero General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (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/>.
*/
/**
 * @package DATC
 */
require_once 'header.php';
libHTML::starthtml(l_t('DATC Tests'));
print libHTML::pageTitle(l_t('Diplomacy Adjudicator Test Cases'), l_t('The results of a set of automated tests which show the webDiplomacy\'s compliance with the official Diplomacy rules.'));
if ($Misc->Maintenance) {
    require_once l_r('datc/interactive.php');
}
require_once l_r('locales/English/datc.php');