(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.'); /** * @package Base * @subpackage Pager */ require_once l_r('pager/pagerthread.php'); class PagerForum extends Pager { public static $defaultPostsPerPage = 30; public $type = 'forum'; function __construct($itemsTotal) { parent::__construct('forum.php', $itemsTotal, self::$defaultPostsPerPage); } function getCurrentPage($currentPage = 1) { parent::getCurrentPage($this->pageCount); if ($this->currentPage > $this->pageCount) { $this->currentPage = $this->pageCount; } }
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/>. */ require_once l_r('lib/variant.php'); require_once l_r('objects/members.php'); require_once l_r('objects/scoringsystem.php'); /** * Prints data on a game, and loads and manages the collections of members which this game contains. * Most used to display the summary, when not loaded as processGame * * @package Base * @subpackage Game */ class Game { public static function mapType() { if (isset($_REQUEST['largemap'])) { return 'large'; } elseif (isset($_REQUEST['mapType'])) { switch ($_REQUEST['mapType']) {
public function recalculateRR(array $params) { require_once l_r('gamemaster/gamemaster.php'); libGameMaster::updateReliabilityRating(true); return l_t("Reliability Ratings have been recalculated"); }
(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.'); /** * @package Base * @subpackage Pager */ require_once l_r('pager/pager.php'); class PagerGames extends Pager { private $approxPageCount; public $type = 'games'; function __construct($URL, $approxItemCount = null) { if (isset($approxItemCount)) { $this->approxPageCount = ceil($approxItemCount / 10); } parent::__construct($URL, null, 10); } function currentPageNumberOfTotal() { if ($this->currentPage != 1) { return parent::currentPageNumber();
/** * The notification block HTML, containing links to games which need * the user's attention. * * @return string The notification block HTML */ public static function gameNotifyBlock() { global $User, $DB; $tabl = $DB->sql_tabl("SELECT g.id, g.variantID, g.name, g.phase, m.orderStatus, m.countryID, (m.newMessagesFrom+0) as newMessagesFrom, g.processStatus\r\n\t\t\tFROM wD_Members m\r\n\t\t\tINNER JOIN wD_Games g ON ( m.gameID = g.id )\r\n\t\t\tWHERE m.userID = " . $User->id . "\r\n\t\t\t\tAND ( ( NOT m.orderStatus LIKE '%Ready%' AND NOT m.orderStatus LIKE '%None%' AND g.phase != 'Finished' ) OR NOT ( (m.newMessagesFrom+0) = 0 ) ) ORDER BY g.processStatus ASC, g.processTime ASC"); $gameIDs = array(); $notifyGames = array(); while ($game = $DB->tabl_hash($tabl)) { $id = (int) $game['id']; $gameIDs[] = $id; $notifyGames[$id] = $game; } $gameNotifyBlock = ''; if ($User->notifications->PrivateMessage and !isset($_REQUEST['notices'])) { $gameNotifyBlock .= '<span class=""><a href="index.php?notices=on">' . l_t('PM') . ' <img src="' . l_s('images/icons/mail.png') . '" alt="' . l_t('New private messages') . '" title="' . l_t('New private messages!') . '" />' . '</a></span> '; } foreach ($gameIDs as $gameID) { $notifyGame = $notifyGames[$gameID]; require_once l_r('objects/basic/set.php'); // Games that are finished should show as 'no orders' if ($notifyGame['phase'] != 'Finished') { $notifyGame['orderStatus'] = new setMemberOrderStatus($notifyGame['orderStatus']); } else { $notifyGame['orderStatus'] = new setMemberOrderStatus('None'); } // Don't print the game if we're looking at it. if (isset($_REQUEST['gameID']) and $_REQUEST['gameID'] == $gameID) { continue; } $gameNotifyBlock .= '<span class="variant' . Config::$variants[$notifyGame['variantID']] . '">' . '<a gameID="' . $gameID . '" class="country' . $notifyGame['countryID'] . '" href="board.php?gameID=' . $gameID . '">' . $notifyGame['name']; if ($notifyGame['processStatus'] == 'Paused') { $gameNotifyBlock .= '-<img src="' . l_s('images/icons/pause.png') . '" alt="' . l_t('Paused') . '" title="' . l_t('Game paused') . '" />'; } $gameNotifyBlock .= ' '; $gameNotifyBlock .= $notifyGame['orderStatus']->icon(); if ($notifyGame['newMessagesFrom']) { $gameNotifyBlock .= '<img src="' . l_s('images/icons/mail.png') . '" alt="' . l_t('New messages') . '" title="' . l_t('New messages!') . '" />'; } $gameNotifyBlock .= '</a></span> '; } return $gameNotifyBlock; }
<?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 Base * @subpackage Static */ require_once 'header.php'; libHTML::starthtml(); require_once l_r('locales/English/developers.php'); print '</div>'; libHTML::footer();
/** * Saves a datastructure to a PHP file in the cache which makes deCoasting terrIDs fast and * independant of the database. This is run if the deCoasting datastructures aren't detected, * and if run it will end and require the user to refresh the page. */ public function initialize() { global $DB; // This will wipe the variant if it is already present and install it require_once l_r('variants/' . $this->name . '/install.php'); // This only gets called when there's no serialized variant cache available for this // variant, so prepare the data to be serialized & saved now. $tabl = $DB->sql_tabl("SELECT id, coastParentID FROM wD_Territories WHERE mapID=" . $this->mapID . " AND NOT id = coastParentID"); while (list($coastChildID, $coastParentID) = $DB->tabl_row($tabl)) { $this->coastParentIDByChildID[$coastChildID] = $coastParentID; if (!isset($this->coastChildIDsByParentID[$coastParentID])) { $this->coastChildIDsByParentID[$coastParentID] = array(); } $this->coastChildIDsByParentID[$coastParentID][] = $coastChildID; } list($this->supplyCenterCount) = $DB->sql_row("SELECT COUNT(id) FROM wD_Territories WHERE mapID=" . $this->mapID . " AND supply='Yes'"); $this->supplyCenterTarget = round(18.0 / 34.0 * $this->supplyCenterCount); if (isset($this->codeVersion) && $this->codeVersion != null && $this->codeVersion > 0) { $this->cacheVersion = $this->codeVersion; } }
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/>. */ defined('IN_CODE') or die('This script can not be run by itself.'); require_once l_r('gamepanel/game.php'); /** * This class displays the game panel within a board context. It displays more info * and gives different functionality (e.g. voting) * * @package GamePanel */ class panelGameBoard extends panelGame { 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');
/** * Updates the reliability stats for the users in this game. */ function updateReliabilityStats() { global $DB; require_once l_r('gamemaster/gamemaster.php'); $DB->sql_put(libGameMaster::RELIABILITY_QUERY . "WHERE u.id IN (" . implode(",", array_keys($this->ByUserID)) . ')'); }
* Many thanks to Lucas Kruijswijk for his algorithm, which this script implements: * http://web.inter.nl.net/users/L.B.Kruijswijk/#5 */ /* * Load the supporting cast of adjudication objects */ // The move types require_once l_r('gamemaster/adjudicator/diplomacy/dependencyNode.php'); require_once l_r('gamemaster/adjudicator/diplomacy/hold.php'); require_once l_r('gamemaster/adjudicator/diplomacy/support.php'); require_once l_r('gamemaster/adjudicator/diplomacy/move.php'); require_once l_r('gamemaster/adjudicator/diplomacy/convoyMove.php'); // Load convoy chains ready for processing require_once l_r('gamemaster/adjudicator/diplomacy/loadConvoyChains.php'); // Paradox detection and resolution exception code require_once l_r('gamemaster/adjudicator/diplomacy/paradox.php'); class adjudicatorDiplomacy { /** * Adjudicate the diplomacy phase. Assumes moves have been loaded into the moves table. requires * nothing outside of the moves table. * * @return array An array of territories in which standoffs occurred. These cannot be saved within * the moves table */ function adjudicate() { global $DB, $Game; /* Remove invalid support-hold orders */ $DB->sql_put("UPDATE wD_Moves supportHold\r\n\t\t\t\t\tINNER JOIN wD_Moves supportHeld\r\n\t\t\t\t\t\tON ( supportHold.toTerrID = supportHeld.terrID )\r\n\t\t\t\t\tSET supportHold.moveType = 'Hold'\r\n\t\t\t\t\tWHERE supportHold.moveType = 'Support hold' AND supportHeld.moveType = 'Move'\r\n\t\t\t\t\t\tAND supportHold.gameID = " . $GLOBALS['GAMEID'] . " AND supportHeld.gameID = " . $GLOBALS['GAMEID']); /* Remove invalid support-move orders */
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/>. */ require_once 'header.php'; if ((isset($_POST['watch']) || isset($_POST['unwatch'])) && isset($_POST['gameID'])) { require_once l_r('objects/game.php'); require_once l_r('gamepanel/gameboard.php'); $gameID = (int) $_POST['gameID']; // Get the game object, if this fails, then someone has entered some rubbish for the gameID $Variant = libVariant::loadFromGameID($gameID); libVariant::setGlobals($Variant); $Game = $Variant->panelGameBoard($gameID); if (isset($_POST['unwatch'])) { $Game->unwatch(); print "Unwatched"; } else { if (isset($_POST['watch'])) { $Game->watch(); print "Watched"; } } }
public function banUser(array $params) { global $User, $DB, $Game; $userID = (int) $params['userID']; if (!isset($params['reason']) || strlen($params['reason']) == 0) { return l_t('Couldn\'t ban user; no reason was given.'); } $banReason = $DB->msg_escape($params['reason']); $banUser = new User($userID); if ($banUser->type['Banned']) { throw new Exception(l_t("The user is already banned")); } if ($banUser->type['Admin']) { throw new Exception(l_t("Admins can't be banned")); } if ($banUser->type['Moderator'] and !$User->type['Admin']) { throw new Exception(l_t("Moderators can't be banned by non-admins")); } User::banUser($userID, l_t("Banned by a moderator:") . ' ' . $params['reason']); require_once l_r('gamemaster/game.php'); /* * Explain what has happened to the games the banned user was in, and extend the * turn */ $tabl = $DB->sql_tabl("SELECT gameID, status FROM wD_Members\r\n\t\t\t\t\tWHERE userID = " . $userID); while (list($gameID, $status) = $DB->tabl_row($tabl)) { if ($status != 'Playing') { continue; } $Variant = libVariant::loadFromGameID($gameID); $Game = $Variant->processGame($gameID); $banMessage = l_t('%s was banned: %s. ', $banUser->username, $banReason); if ($Game->phase == 'Pre-game') { if (count($Game->Members->ByID) == 1) { processGame::eraseGame($Game->id); } else { $DB->sql_put("DELETE FROM wD_Members WHERE gameID = " . $Game->id . " AND userID = " . $userID); } } elseif ($Game->processStatus != 'Paused' and $Game->phase != 'Finished') { // The game may need a time extension to allow for a new player to be added // Would the time extension would give a difference of more than ten minutes? If not don't bother if (time() + $Game->phaseMinutes * 60 - $Game->processTime > 10 * 60) { // It is worth adding an extension $DB->sql_put("UPDATE wD_Games\r\n\t\t\t\t\t\tSET processTime = " . time() . " + phaseMinutes*60\r\n\t\t\t\t\t\tWHERE id = " . $Game->id); $Game->processTime = time() + $Game->phaseMinutes * 60; $banMessage .= l_t('The time until the next phase has been extended by one phase length ' . 'to give an opportunity to replace the player.') . "\n" . l_t('Remember to finalize your orders if you don\'t want ' . 'to wait, so the game isn\'t held up unnecessarily!'); } } // IF the game is still running first remove the player from the game and reset the minimum bet so other can join. if ($Game->phase != 'Finished' && $Game->phase != 'Pre-game') { $Game->Members->ByUserID[$userID]->setLeft(1); $Game->resetMinimumBet(); } libGameMessage::send('Global', 'GameMaster', $banMessage); $Game->Members->sendToPlaying('No', l_t('%s was banned, see in-game for details.', $banUser->username)); } $DB->sql_put("UPDATE wD_Orders o INNER JOIN wD_Members m ON ( m.gameID = o.gameID AND m.countryID = o.countryID )\r\n\t\t\t\t\tSET o.toTerrID = NULL, o.fromTerrID = NULL\r\n\t\t\t\t\tWHERE m.userID = " . $userID); unset($Game); return l_t('This user was banned, and had their %s points removed and their games set to civil disorder.', $banUser->points); }
require_once l_r('gamemaster/game.php'); $Game = processGame::create($input['variantID'], $input['name'], $input['password'], $input['bet'], $input['potType'], $input['phaseMinutes'], $input['joinPeriod'], $input['anon'], $input['pressType'], $input['missingPlayerPolicy'], $input['drawType'], $input['minimumReliabilityRating']); // Create first Member record & object processMember::create($User->id, $input['bet']); $Game->Members->joinedRedirect(); } catch (Exception $e) { print '<div class="content">'; print '<p class="notice">' . $e->getMessage() . '</p>'; print '</div>'; } } if ($User->points >= 5) { $roundedDefault = round($User->points / 7 / 10) * 10; if ($roundedDefault > 5) { $defaultPoints = $roundedDefault; } else { $defaultPoints = 5; } } else { print l_t("You can't create a new game; you have fewer than 5%s, you only have %s%s. " . "You will always have at least 100 points, including the points that you have bet into active games, so if you want " . "to start a new game just wait until your other games have finished (<a href='points.php#minpoints' class='light'>read more</a>).", libHTML::points(), $User->points, libHTML::points()); print '</div>'; libHTML::footer(); } if (isset($input) && isset($input['points'])) { $formPoints = $input['points']; } else { $formPoints = $defaultPoints; } require_once l_r('locales/English/gamecreate.php'); print '</div>'; libHTML::footer();
if ($User->type['Admin']) { if ($Game->processStatus == 'Crashed') { $modActions[] = libHTML::admincp('unCrashGames', array('excludeGameIDs' => ''), l_t('Un-crash all crashed games')); } $modActions[] = libHTML::admincp('reprocessGame', array('gameID' => $Game->id), l_t('Reprocess game')); } if ($Game->phase != 'Pre-game' && !$Game->isMemberInfoHidden()) { $userIDs = implode('%2C', array_keys($Game->Members->ByUserID)); $modActions[] = '<br />' . l_t('Multi-check:'); foreach ($Game->Members->ByCountryID as $countryID => $Member) { $modActions[] = '<a href="admincp.php?tab=Multi-accounts&aUserID=' . $Member->userID . '&bUserIDs=' . $userIDs . '" class="light">' . $Member->memberCountryName() . '</a>'; } } } if ($modActions) { print '<div class="hr"></div>'; print '<p class="notice">'; print implode(' - ', $modActions); print '</p>'; print '<div class="hr"></div>'; } } // TODO: Have this loaded up when the game object is loaded up list($directorUserID) = $DB->sql_row("SELECT directorUserID FROM wD_Games WHERE id = " . $Game->id); if (isset($directorUserID) && $directorUserID == $User->id) { // This guy is the game director define("INBOARD", true); require_once l_r("admin/adminActionsForms.php"); } print '</div>'; libHTML::footer();
return $tab; } $tab = adminCPTabs(); print '<h3>' . l_t($tab) . '</h3>'; switch ($tab) { case 'Control Panel': require_once l_r('admin/adminActionsForms.php'); break; case 'Mod notes': require_once l_r('lib/modnotes.php'); libModNotes::checkDeleteNote(); libModNotes::checkInsertNote(); print libModNotes::reportsDisplay('All'); break; case 'Status lists': require_once l_r('admin/adminStatusLists.php'); break; case 'Control Panel Logs': require_once l_r('admin/adminLog.php'); break; case 'Multi-accounts': require_once l_r('admin/adminMultiFinder.php'); break; case 'Locales': require_once l_r('admin/adminLocales.php'); break; default: print '<p>' . l_t('No admin panel tab selected') . '</p>'; } print '</div>'; libHTML::footer();
header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); if (defined('FACEBOOKSCRIPT')) { require_once l_r('facebook/facebook-platform/php/facebook.php'); $facebook = new Facebook(Config::$facebookAPIKey, Config::$facebookSecret); $facebook->require_frame(); $fb_user = $facebook->get_loggedin_user(); if (!$fb_user) { if (!isset($_REQUEST['wD_FB_AuthNow'])) { libHTML::notice(l_t('Not authorized'), l_t('To play in webDiplomacy games you need to authorize this application, so that ' . 'it can send you notifications informing you when a game you\'re playing in needs your attention. ' . 'Please <a href="index.php?wD_FB_AuthNow=on">authorize this application</a> to continue.')); } else { $fb_user = $facebook->require_login(); } } } require_once l_r('lib/auth.php'); if (!defined('AJAX')) { if (isset($_REQUEST['logoff'])) { $success = libAuth::keyWipe(); $User = new User(GUESTID); // Give him a guest $User header('refresh: 4; url=logon.php?noRefresh=on'); libHTML::notice(l_t("Logged out"), l_t("You have been logged out, and are being redirected to the logon page.")); } global $User; $User = libAuth::auth(); if ($User->type['Admin']) { Config::$debug = true; if (isset($_REQUEST['auid']) || isset($_SESSION['auid'])) { $User = libAuth::adminUserSwitch($User); } else {
if ($set != '') { $set .= ', '; } $set .= $SQLName . " = '" . $SQLVars[$SQLName] . "'"; $formOutput .= l_t('%s updated successfully.', $name) . ' '; } if ($set != '') { $DB->sql_put("UPDATE wD_Users SET " . $set . " WHERE id = " . $User->id); } if (isset($SQLVars['password'])) { $DB->sql_put("UPDATE wD_Users SET password = "******" WHERE id = " . $User->id); libAuth::keyWipe(); header('refresh: 3; url=logon.php'); $formOutput .= l_t('Password updated successfully; you have been logged out and ' . 'will need to logon with the new password.') . ' '; } } catch (Exception $e) { $formOutput .= $e->getMessage(); } // We may have received no new data if ($formOutput) { $User->load(); // Reload in case of a change print '<div class="content"><p class="notice">' . $formOutput . '</p></div>'; } } print libHTML::pageTitle(l_t('User account settings'), l_t('Alter the settings for your webDiplomacy user account; e.g. change your password/e-mail.')); print '<form method="post"> <ul class="formlist">'; require_once l_r('locales/English/user.php'); print '</div>'; libHTML::footer();
<?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 Base * @subpackage Static */ require_once 'header.php'; libHTML::starthtml(); require_once l_r('locales/English/intro.php'); print '</div>'; libHTML::footer();
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/>. */ require_once l_r('objects/basic/set.php'); /** * An object representing a relationship between a user and a game. Mostly contains * information used for printing the Game->summary(), when not loaded as userMember or * processMember * * @package Base * @subpackage Game */ class Member { /** * The member ID * @var int */ var $id;
<?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 Base * @subpackage Static */ require_once 'header.php'; libHTML::starthtml(); print '<div class="content">'; require_once l_r('locales/English/translating.php'); print '</div>'; libHTML::footer();
<?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 Base * @subpackage Static */ require_once 'header.php'; libHTML::starthtml(); require_once l_r('locales/English/faq.php'); print '</div>'; libHTML::footer();
<?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 Base * @subpackage Static */ require_once 'header.php'; libHTML::starthtml(); print libHTML::pageTitle(l_t('webDiplomacy rulebook'), l_t('The webDiplomacy rules which let moderators and users keep this server fun to play on.')); require_once l_r('locales/English/rules.php'); print '</div>'; libHTML::footer();
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/>. */ defined('IN_CODE') or die('This script can not be run by itself.'); require_once l_r('objects/game.php'); /** * Recalculates and resets the chances each user has of being each country, * based on their past countries. Should only need to be used after updating * from 0.8x to 0.9x * * @package Admin */ print l_t("Country-balance chance generation script, to be run on 0.82-0.90 update.") . l_t("Creating table") . "<br />"; flush(); $DB->sql_put("CREATE TABLE IF NOT EXISTS `Chances` (\r\n\t`id` mediumint(8) unsigned NOT NULL default '0',\r\n\t`ChanceEngland` float NOT NULL,\r\n\t`ChanceFrance` float NOT NULL,\r\n\t`ChanceItaly` float NOT NULL,\r\n\t`ChanceGermany` float NOT NULL,\r\n\t`ChanceAustria` float NOT NULL,\r\n\t`ChanceTurkey` float NOT NULL,\r\n\t`ChanceRussia` float NOT NULL\r\n) ENGINE=MyISAM"); $DB->sql_put("DELETE FROM Chances"); function balanceChances(array $chances) { $sum = 0.0; foreach ($chances as $countryID => $chance) {
<?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 Base * @subpackage Static */ require_once 'header.php'; libHTML::starthtml(); print libHTML::pageTitle(l_t('Recent changes'), l_t("Lists the most recent changes to the webdiplomacy software.")); require_once l_r('locales/English/recentchanges.php'); print '</div>'; libHTML::footer();
(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 Base */ require_once 'header.php'; require_once l_r('pager/pagerforum.php'); require_once l_r('lib/message.php'); /* * The forum page, unfortunately one of the oldest pieces of code and gradually hacked on * without getting packaged up. This has left a mess with quite a few script-wide variables, * but this is the basic flow: * * - Check whether we're viewing the postbox or which topic we're viewing * - Determine the correct page to display given the session data and viewtopic data * - Check for new threads/replies. Check them for problems and post them. * - Post the postbox / pager * - Select the threads for this page * - For each thread check it's selected, if so print the replies to the thread * - Post a reply box if needed * - Once done post the finishing page selector, and save the current time of viewing the forum * so the user can come back after checking a game and see what's new and what was new before * he logged on.
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.'); /** * @package Search */ require_once l_r('searchItems.php'); require_once l_r('searchItemSettings.php'); require_once l_r('searchOptions.php'); class search { protected $searchItems = array('AmMember', 'IsPublic', 'PotType', 'DrawType', 'ChooseVariant', 'PhaseHours', 'Phase', 'IsAnonymous', 'PressType', 'OrderBy'); protected $searchTypes = array('My games', 'New', 'Joinable', 'Active', 'Finished', 'Search', 'Profile'); public function __construct($searchType) { global $User; // If we're a guest (and not browsing a profile) we can't filter games from the guest acconut if (!$User->type['User'] && $searchType != 'Profile') { unset($this->searchItems[array_search('AmMember', $this->searchItems)]); } if (!in_array($searchType, $this->searchTypes)) { throw new Exception(l_t('Invalid game list type:') . ' ' . $searchType); } $searchItems = array();
(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 GameMaster */ require_once 'header.php'; require_once l_r('gamemaster/game.php'); 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'));
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/>. */ defined('IN_CODE') or die('This script can not be run by itself.'); require_once l_r('gamepanel/memberhome.php'); /** * This class displays the members subsection of a game panel in a homepage context. * * @package GamePanel */ class panelMembersHome extends panelMembers { /** * Load a panelMemberHome instead of a panelMember */ protected function loadMember(array $row) { return $this->Game->Variant->panelMemberHome($row); } /**
function sendPM(User $FromUser, $message) { $message = htmlentities($message, ENT_NOQUOTES, 'UTF-8'); require_once l_r('lib/message.php'); $message = message::linkify($message); if ($FromUser->isSilenced()) { notice::send($FromUser->id, $this->id, 'PM', 'No', 'Yes', l_t('Could not deliver message, you are currently silenced.') . '(' . $FromUser->getActiveSilence()->reason . ')', l_t('To:') . ' ' . $this->username, $this->id); return false; } else { if ($this->isUserMuted($FromUser->id)) { notice::send($FromUser->id, $this->id, 'PM', 'No', 'Yes', l_t('Could not deliver message, user has muted you.'), l_t('To:') . ' ' . $this->username, $this->id); return false; } else { notice::send($this->id, $FromUser->id, 'PM', 'Yes', 'Yes', $message, $FromUser->username, $FromUser->id); $this->setNotification('PrivateMessage'); notice::send($FromUser->id, $this->id, 'PM', 'No', 'Yes', l_t('You sent:') . ' <em>' . $message . '</em>', l_t('To:') . ' ' . $this->username, $this->id); return true; } } }
public function cdUser(array $params) { global $DB; require_once l_r('gamemaster/game.php'); $User = new User($params['userID']); $Variant = libVariant::loadFromGameID($this->fixedGameID); $Game = $Variant->processGame($this->fixedGameID); if ($Game->phase == 'Pre-game' || $Game->phase == 'Finished') { throw new Exception(l_t("Invalid phase to set CD")); } $Game->Members->ByUserID[$User->id]->setLeft(1); $Game->resetMinimumBet(); return l_t('This user put into civil-disorder in this game'); }