本文整理汇总了PHP中l_r函数的典型用法代码示例。如果您正苦于以下问题:PHP l_r函数的具体用法?PHP l_r怎么用?PHP l_r使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了l_r函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defined
(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;
}
}
示例2: l_r
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']) {
示例3: recalculateRR
public function recalculateRR(array $params)
{
require_once l_r('gamemaster/gamemaster.php');
libGameMaster::updateReliabilityRating(true);
return l_t("Reliability Ratings have been recalculated");
}
示例4: defined
(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();
示例5: gameNotifyBlock
/**
* 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;
}
示例6: Copyright
<?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();
示例7: initialize
/**
* 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;
}
}
示例8: defined
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');
示例9: updateReliabilityStats
/**
* 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)) . ')');
}
示例10: l_r
* 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 */
示例11: l_r
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";
}
}
}
示例12: banUser
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);
}
示例13: l_r
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();
示例14: array
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();
示例15: adminCPTabs
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();