Пример #1
0
 public static function linkify($message)
 {
     $message = self::splitWords($message);
     $patterns = array('/gameID[:= _]?([0-9]+)/i', '/userID[:= _]?([0-9]+)/i', '/threadID[:= _]?([0-9]+)/i', '/((?:[^a-z0-9])|(?:^))([0-9]+) ?(?:(?:D)|(?:points))((?:[^a-z])|(?:$))/i');
     $replacements = array('<a href="board.php?gameID=\\1" class="light">gameID=\\1</a>', '<a href="profile.php?userID=\\1" class="light">userID=\\1</a>', '<a href="forum.php?threadID=\\1#\\1" class="light">threadID=\\1</a>', '\\1\\2' . libHTML::points() . '\\3');
     return preg_replace($patterns, $replacements, $message);
 }
Пример #2
0
 /**
  * The messages icon, no text
  * @return string
  */
 function memberMessagesFull()
 {
     if (count($this->newMessagesFrom)) {
         if (count($this->newMessagesFrom) == 1 && in_array('0', $this->newMessagesFrom)) {
             return libHTML::maybeReadMessages('board.php?gameID=' . $this->gameID . '#chatbox');
         } else {
             return libHTML::unreadMessages('board.php?gameID=' . $this->gameID . '#chatbox');
         }
     } else {
         return '';
     }
 }
Пример #3
0
    /**
     * The occupation bar; a bar representing each of the countries current progress as measured by the number of SCs.
     * If called pre-game it goes from red to green as 1 to 7 players join the game.
     *
     * @return string
     */
    function occupationBar()
    {
        if (isset($this->occupationBarCache)) {
            return $this->occupationBarCache;
        }
        libHTML::$first = true;
        if ($this->Game->phase != 'Pre-game') {
            $SCPercents = $this->SCPercents();
            $buf = '';
            foreach ($SCPercents as $countryID => $width) {
                if ($width > 0) {
                    $buf .= '<td class="occupationBar' . $countryID . ' ' . libHTML::first() . '" style="width:' . $width . '%"></td>';
                }
            }
        } else {
            $joinedPercent = ceil(count($this->ByID) * 100.0 / count($this->Game->Variant->countries));
            $buf = '<td class="occupationBarJoined ' . libHTML::first() . '" style="width:' . $joinedPercent . '%"></td>';
            if ($joinedPercent < 99.0) {
                $buf .= '<td class="occupationBarNotJoined" style="width:' . (100 - $joinedPercent) . '%"></td>';
            }
        }
        $this->occupationBarCache = '<table class="occupationBarTable"><tr>
					' . $buf . '
				</tr></table>';
        return $this->occupationBarCache;
    }
Пример #4
0
                $DB->sql_put("COMMIT");
                print l_t('Processed.');
            }
        }
    } catch (Exception $e) {
        if ($e->getMessage() == "Abandoned" || $e->getMessage() == "Cancelled") {
            $DB->sql_put("COMMIT");
            print l_t('Abandoned.');
        } else {
            $DB->sql_put("ROLLBACK");
            print l_t('Crashed: "%s".', $e->getMessage());
        }
    }
    print '<br />';
}
// If it took over 30 secs there may still be games to process
if (time() - $startTime >= 30) {
    /*
     * For when you're developing and just reloaded the DB from a backup,
     * you usually have to refresh a few times before it runs out of games
     * to process
     */
    header('refresh: 4; url=gamemaster.php');
    print '<p class="notice">' . l_t('Timed-out; re-running') . '</p>';
} else {
    // Finished all remaining games with time to spare; update the civil disorder and NMR counts
    //libGameMaster::updateCDNMRCounts();
}
print '</div>';
libHTML::footer();
Пример #5
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.');
/**
 * @package Base
 * @subpackage Static
 */
print libHTML::pageTitle('Intro to webDiplomacy', 'A quick &amp; easy guide to get newcomers to webDiplomacy playing the game.');
print '
<p>
Diplomacy is a game which is easy to learn but impossible to master. The rules are all very intuitive,
lots of people pick them up just by playing, but this document will familiarize you more quickly.
</p>

<div class="hr"></div>';
?>
<p style="text-align:center"><a href="#Objective">Objective</a> - <a href="#Units">Units</a> -
	<a href="#Moves">Moves</a> - <a href="#Rules">Rules</a> - <a href="#Play">Play</a></p>

<div class="hr"></div>

<a name="Objective"></a>
<h3>Objective</h3>
Пример #6
0
 /**
  * Logon as a user with a key. Display a notice and terminate if there is
  * a problem, otherwise return a $User object corresponding to the given
  * key.
  * Will also attempt to use legacy keys
  *
  * @param string $key The auth key (/legacy cookie)
  * @param bool[optional] $session Should the user be logged on only for the session true/false
  *
  * @return User A user object
  */
 public static function key_User($key, $session = false)
 {
     global $DB;
     $userID = self::key_UserID($key);
     if (!$userID) {
         if (isset($_REQUEST['noRefresh'])) {
             // We have been sent back from the logoff script, and clearly not with a wiped key
             // Load some data that will give useful context in the trigger_error errorlog
             // which will occur below.
             if (isset($_COOKIE['wD-Key']) and $_COOKIE['wD-Key']) {
                 $cookieKey = $_COOKIE['wD-Key'];
             }
             $user_agent = $_SERVER['HTTP_USER_AGENT'];
             $allCookies = print_r($_COOKIE, true);
             $success = self::keyWipe();
             // Make sure there's no refresh loop
             trigger_error(l_t("An invalid log-on cookie was given, but it seems an attempt to remove it has failed.") . "<br /><br />" . l_t("This error has been logged, please e-mail %s if the problem persists, or you can't log on.", Config::$modEMail));
         } else {
             self::keyWipe();
             header('refresh: 3; url=logon.php?logoff=on');
             libHTML::error(l_t("You have been logged out. " . "You are being redirected to the log-on page.") . "<br /><br />" . l_t("Inform the moderators at %s if the problem persists, or you can't log on.", Config::$modEMail));
         }
     }
     // This user ID is authenticated
     self::keySet($userID, $session);
     global $User;
     try {
         $User = new User($userID);
     } catch (Exception $e) {
         self::keyWipe();
         header('refresh: 3; url=logon.php?logoff=on');
         libHTML::error(l_t("You are using an invalid log on cookie, which has been wiped. Please try logging on again."));
     }
     $User->logon();
     return $User;
 }
Пример #7
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.');
/**
 * @package Base
 * @subpackage Static
 */
print libHTML::pageTitle('webDiplomacy Aiuto e Collegamenti', 'Collegamenti alle informazioni, regole, classifica e altro su webDiplomacy.');
?>
<ul class="formlist">

<li><a href="intro.php">Impara a giocare a Diplomacy</a></li>
<li class="formlistdesc">Introduzione per cominciare a giocare su webDiplomacy; dettagli sui tipi di Unità, movimenti e regole.<br /> Le regole usate per giocare online, sono uguali al regolamento del gioco in scatola.</li>

<li><a href="faq.php">Domande frequenti</a></li>
<li class="formlistdesc">Domande degli utenti su webDiplomacy e su come usarlo.</li>

<li><a href="rules.php">Regole del sito</a></li>
<li class="formlistdesc">Regole di comportamento da osservare per giocare su webDiplomacy .</li>

<li><a href="halloffame.php">Classifica</a></li>
<li class="formlistdesc">I migliori 100 del sito.</li>
Пример #8
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;
 }
Пример #9
0
 /**
  * Get a MySQL named lock, will stop the script if the lock cannot be obtained
  *
  * @param string $name The name of the lock
  * @param int[optional] $wait The time to wait before giving up, default is 8 seconds
  */
 public function get_lock($name, $wait = 8)
 {
     list($success) = $this->sql_row("SELECT GET_LOCK('" . $name . "', " . $wait . ")");
     if ($success != 1) {
         libHTML::error(l_t("A database lock (%s) is required to complete this page safely, but it could not be " . "acquired (it's being used by someone else). This usually means the server is running slowly, and " . "taking unusually long to complete tasks.", $name) . "<br /><br />" . l_t("Please wait a few moments and try again. Sorry for the inconvenience."));
     }
 }
Пример #10
0
*/
defined('IN_CODE') or die('This script can not be run by itself.');
/**
 * @package Base
 * @subpackage Static
 */
$faq = array("Sono nuovo qui!" => "Sub-section", "Di che cosa parla questo sito?" => "La maniera più semplice per capirlo è di dare un occhio a\r\n\t<a href='http://webdiplomacy.net/doc/0.90-screenshot.png' class='light'>una immagine del gioco</a>. Se il concetto non è ancora ben chiaro guarda <a href='intro.php' class='light'>l'introduzione a webDiplomacy</a>.", "Come faccio a giocare?" => "Le regole sono abbastanza semplici da capire, ma se dovessi essere in dubbio riguardo a qualcosa leggi\r\n\t<a href='intro.php' class='light'>l'introduzione a webDiplomacy</a>, e sentiti libero di chiedere per aiuto o spiegazioni nel <a href='http://forum.webdiplomacy.it/' class='light'>forum pubblico</a>.", "Qual è la licenza del programma?" => "La <a href='AGPL.txt' class='light'>GNU Affero General License</a>\r\n\t(<a href='http://www.opensource.org/licenses/agpl-v3.html' class='light'>Open Source Initiative</a> approved),\r\n\tche in sostanza spiega che puoi scaricare e modificare il codice come piace a te e metterlo nel tuo sito ma che non puoi rivendicare di averlo scritto tu e che devi riferire di ogni modifica alla community.<br /><br />\r\n\tVedi <a href='credits.php' class='light'>riferimenti</a> per informazioni in merito ai dettagli che sono ricadono sotto licenze differenti.", "Questo programma ha qualcosa a che fare con phpDiplomacy?" => "Questo programma era solito essere chiamato phpDiplomacy sino alla versione 0.9.\r\n\tCi spiace per la confusione, anche noi odiamo i cambiamenti di nome, ma per il nostro user-base il vecchio prefisso 'php' non si è rivelato essere l'etichetta immediatamente riconoscibile che doveva essere nelle nostre intenzioni iniziali.", "L'interfaccia" => "Sub-section", "Cosa sono quei cerchi verdi accanto al nome della persona?" => "L'icona verde appare quando un giocatore è on-line sul server. Questo significa che se il giocatore ha avuto accesso al server negli ultimi ~10-15 minuti questi avranni l'icona verde accanto al loro nome.", "E questo cosa sarebbe? (<img src='images/icons/online.png' />, <img src='images/icons/mail.png' />, etc)" => "Se vedi un/una icona/bottone/immagine che non sai cosa significhi prova a passarci sopra il mouse, potrebbe uscire una nota con una breve spiegazione.\r\nSe non dovesse succedere, sentiti libero di chiedere sul <a href='http://forum.webdiplomacy.it/' class='light'>forum</a>.", "Perchè i miei ordini cambiano colore da verde a rosso?" => "Gli ordini in rosso sono ancora da salvare; se vedi molti ordini in rosso dovresti salvare, altrimenti potresti dimenticartene e perderli chiudendo la finstra del browser o chattando con qualcuno.", "Cosa significano 'Salva' e 'Pronto' (Save e Ready)?" => "'Salva' salva i tuoi ordini; i tuoi ordini non ancora salvati, in rosso, diventeranno verdi non appena saranno salvati definitivamente. 'Pronto' significa che hai finito di inserire i tuoi ordini e che sei pronto per continuare con il turno successivo. Se ognuno è 'Pronto' il gioco prosegue proprio in quell'istante, velocizzando la partita.", "Cosa sono i codici che possono aggiungere HTML nei messaggi del forum? (icone, collegamenti a partite, ecc)" => "Spesso nei forum le persone discutono o vogliono aggiungere collegamenti a partite/account di utenti/altre discussioni nel forum. Per rendere questo più semplice alcuni codici sono riconosciuti automaticamente e rimpiazzati con il corretto link/simbolo:\r\n\t<ul><li><strong>'<em>[number]</em> punti'</strong>/<strong>'<em>[number]</em> D'</strong> risulterà in\r\n\t<strong>'punti'</strong> / <strong>'D'</strong> venendo rimpiazzati con il simbolo dei punti (" . libHTML::points() . ").</li>\r\n\t<li><strong>'gameID=<em>[number]</em>'</strong> / <strong>'threadID=<em>[number]</em>'</strong> / <strong>'userID=<em>[number]</em>'</strong> avranno un link appropriato con il/la partita/discussione/profilo sostituiti nel messaggio.</li></ul>", "Perchè alcune cose sembrano cambiare non appena la pagina si è caricata?" => "Dopo che la pagina si è caricata parte JavaScript, andando a fare alcune modifiche\r\n\t(per esempio mettendo l'orario GMT/UTC nel tuo computer, rendendo in grassetto i tuoi interventi, ecc) che implementano la pagina.", "Regole del gioco" => "Sub-section", "Voglio imparare le basi del gioco" => "Vedi la <a href='intro.php' class='light'>pagina introduttiva</a>.", "Voglio imparare le regole avanzate del gioco" => "Vedi <a href='http://www.wizards.com/avalonhill/rules/diplomacy.pdf' class='light'>il regolamento di Avalon Hill</a>.", "Voglio imparare i dettagli sulle regole del gioco" => "Noi usiamo il DATC per risolvere esattamente ogni sorta di situazioni intricate, nei casi in cui c'è ambiguità nel regolamento. (Questo tipo di cose generalmente non capitano spesso in una partita, comunque.)<br />\r\n\tVedi la nostra pagina DATC <a href='datc.php' class='light'>here</a>.", "Se qualcuno deve distruggere una unità ma non ha inserito gli ordini su quale unità distruggere, quale unità è distrutta?" => "Si risolve come raccomanda DATC:\r\n\tL'unità più lontana dai tuoi Centri di rifornimento di partenza.La distanza è definita come il minor numero di mosse necessario per arrivare alla posizione dell'unità partendo dai Centri di partenza. Quando si calcola il minor numero di mosse, le armate si considerano come se si potessero muovere attraversando i mari, le flotte invece si considerano soltanto secondo il loro naturale movimento attraverso i mari e le coste. Se ci dovessero essere due unità con la medesima distanza da un Centro di partenza, si rimuove l'unità che giace sul territorio che viene prima secondo l'ordine alfabetico.", "Se un convoglio è attaccato, il convoglio fallisce?" => "No; perchè un ordine di convoglio non abbia successo è necessario che la flotta che convoglia venga costretta a ritirarsi, e non ci devono essere altri convogli grazie al quale l'armata riesca comunque a essere convogliata.", "Cosa succede se ordino di costruire/distruggere due unità nello stesso territorio?" => "Il primo ordine di costruzione sarà accettato, il secondo no", "Cosa succede se due unità ritirano nello stesso territorio?" => "Entrambe le unità saranno distrutte", "Posso attaccare e costringere a ritirarsi le mie unità?" => "No; non puoi costringere al ritiro le tue stesse unità nè supportare un attacco verso le tue stesse unità.", "Ci sono altre regole che dovrei tenere a mente?" => "C'è una lista completa delle regole sulla pagina delle <a href='rules.php' class='light'>regole</a>,\r\n\tche elenca alcune altre regole che dovrai seguire per aiutarci a mantenere il sito divertente per chiunque.", "Punti" => "Sub-section", "What happens when I run out?" => "You can't run out: Your total number of points include the number of points which you have 'bet' into games you're currently playing in,\r\n\tas well as the points you have in your account. Your total number of points never falls below 100; whenever it does\r\n\tyou're given your points back.<br /><br />\r\n\tTo put it another way; any player who isn't currently playing in any games will always have at least 100 points, so\r\n\tyou won't run out!", "How are the points split in a draw?" => "In a draw the points are split evenly among all the survivors still in the game,\r\n\tregardless of the number of supply centers each player has.<br/>\r\n\tRead <a href='points.php' class='light'>the points guide</a> for more info about the points system.", "I have an idea for a better system" => "We constantly get new ideas for the points system, but usually they're either missing\r\n\tout in some aspect (the points system serves multiple functions), or they improve in one area but are worse in another.<br /><br />\r\n\tThe points system does the job fine, so it's unlikely to be replaced.\r\n\t(See <a href='http://forum.webdiplomacy.net/viewtopic.php?p=288#p288' class='light'>this page</a> for an\r\n\texplanation regarding the role of the existing system, and what a replacement would have to do.)<br /><br />\r\n\tThere's no real way to express how good a player really is in a single number, the points system as it is is\r\n\tprobably good enough for now, and there's definitely no agreement on what would replace it.", "Can you draw the game, but give 2/3rds of the points to this player and ..." => "Draws can only be given one way; an even split to\r\n\tall survivors.", "Bugs" => "Sub-section", "My game has crashed!" => "Sometimes (usually only shortly after code updates) a software bug or server error may occur while a\r\n\tgame is being processed.\r\n\tWhen this happens the problem is detected, all changes are undone, and the game is marked as crashed.<br /><br />\r\n\tAdmins will see a message whenever a game crashes, and information about the crash is saved so that the problem that caused it can be fixed quickly.\r\n\tOnce a mod or admin has marked the game as OK the game will continue where it left off again.<br /><br />\r\n\r\n\tIf your game has been crashed for a long time try asking about it in the forum.", "The phase ends \"Now\"? \"Processing has been paused\"?" => "When the server detects that no games have processed for a while\r\n\t(over 30 minutes or so), or a moderator/admin sees a problem and his the panic button, all game processing is disabled until\r\n\tthe problem is resolved.<br />\r\n\tAfter the all-clear is given games will usually be given time to make up for any during which orders couldn't be entered, and\r\n\tprocessing will resume. Until that point if a game says it will be processed 'Now' that means it would process now, except\r\n\tprocessing is disabled.<br /><br />\r\n\r\n\tYou may also see it if you a games timer counted down to 0 while you were viewing the page, in which\r\n\tcase you should refresh the page to view the newly processed game.", "I didn't enter those orders!" => "Occasionally we get this complaint, but every time we have checked the\r\n\tinput logs to see what order was actually entered it turns out to be the mistaken order.\r\n\tAlso the mistaken orders are often the 'Bulgaria'/'Budapest' sort of mistake which are easier to\r\n\timagine human error than a bug.<br /><br />\r\n\tTry finalizing your orders and then checking them over, so you can be sure of what you entered.", "Someone says their orders messed up, and I'm paying the price!" => "\r\n\tUnfortunately it does seem that sometimes people will claim that their orders came out wrong to cover up the intention of\r\n\ttheir actions. (e.g. \"I was going to stab you, then read your message and changed my orders so I wasn't going to stab you,\r\n\tbut my old orders came out instead of the new ones! Oh so sorry about that!\")<br /><br />\r\n\r\n\tThis is against <a href='rules.php' class='light'>the rules</a>, as it makes work for admins over made up bugs. When someone\r\n\ttells you a bug caused a mistake in their orders you should reserve some skepticism, and remember that the official server alone\r\n\treceives and processes over 20,000 orders per day (as of Feb 2010) without mistake every minute of every day for years on\r\n\tend, so sudden bugs which change whole order-sets around simply don't seem to genuinely happen ever, despite checking every\r\n\tsingle report.\r\n", "My orders gave the wrong results!" => "Before reporting this as a bug double check that you entered your orders correctly and you're\r\n\tnot misunderstanding the rules. 99.999% of the time \"adjudicator bugs\" turn out to be a misunderstanding.<br />\r\n\tIf you're still positive there's a problem let us know in the <a class='light' href='http://forum.webdiplomacy.it/'>forum</a>.", "A part of the site looks wrong in an alternative browser" => "webDiplomacy isn't currently completely web standards compliant,\r\n\tso there may be glitches. We would like to get webDiplomacy working on everything (within reason) but we need users\r\n\tof alternative browsers to let us know what's wrong and tell us how to make it look right in that browser.", "This site seems to slow my computer down" => "See Help > What is Plura? for a likely cause and fix.", "Feature Requests" => "Sub-section", "Better forum" => "A better forum would be good, but getting it to fit in and appear as part of webDiplomacy, rather than just\r\n\ta separate site, is difficult, and would likely use more server resources than our efficient but lightweight built-in forum.<br />\r\n\tAt the moment we are trying to improve our existing forum in small incrememnts.", "A point and click interactive map" => "This is being worked on, but progress is slow. If you know JavaScript and SVG/Canvas why not\r\n\tcarry on the work on the <a href='http://forum.webdiplomacy.net/' class='light'>development forum</a>?", "Translations" => "Eventually translations will be supported, but it is a long process and not a top priority.", "New variants" => "If a variant has lasting appeal, is well balanced, isn't gimmicky, has been tried and tested on another server, and was\r\n\tcreated by a reputable developer, then it's up for consideration to be included in the standard release.<br />\r\n\tYou can discuss this in the variants section of the webDiplomacy\r\n\t<a href='http://forum.webdiplomacy.net/' class='light'>developers forum</a>.<br /><br />\r\n\r\n\tAlso creating your own variants or porting\r\n\texisting variants to the webDiplomacy variants system is easier than ever, from simple map-change variants all the\r\n\tway to strange rule-changing variants, the system is flexible enough to accomadate your varaint ideas.\r\n\t", "Can I suggest a feature?" => "Feature suggestions are best made in the <a class='light' href='http://forum.webdiplomacy.net/'>developer forums</a>,\r\n\telsewhere they're likely to be missed. Remember that unless you can back-up your suggestion with code even good ideas may not get far.", "Helping out" => "Sub-section", "Can I help develop the software?" => "You sure can: if you're an HTML/CSS/JavaScript/PHP 5/MySQL/SVG/Canvas developer,\r\n\tgraphics/icon artist, or want to learn, check out the <a class='light' href='http://webdiplomacy.net/developers.php'>dev info</a>,\r\n\tand if you get lost you can get help/discuss ideas in the <a class='light' href='http://forum.webdiplomacy.net/'>developer forums</a>.", "Can I donate?" => "If you enjoy the site and want to help out, but can't code, you can donate to the project via\r\nPayPal, and this is student-ware so all donations are appreciated. :-)\r\n<div style='text-align:center'>\r\n<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>\r\n<input type='hidden' name='cmd' value='_s-xclick'>\r\n<input type='image' src='https://www.paypal.com/en_US/i/btn/x-click-but21.gif' border='0' name='submit' alt='Make payments with PayPal - it's fast, free and secure!'>\r\n<img alt='' border='0' src='https://www.paypal.com/en_AU/i/scr/pixel.gif' width='1' height='1'>\r\n<input type='hidden' name='encrypted' value='-----BEGIN PKCS7-----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-----END PKCS7-----\r\n'>\r\n</form></div>A big thanks to all the past donors who helped make all '07-'08 server fees community paid!", "How else can I help?" => "Tell your friends about webDiplomacy, put links on your website, help new players out in the forums,\r\n\tand give helpful feedback to developers. Thanks!", "Map" => "Sub-section", "Why are some orders missing from the map?" => "Not all orders are drawn on the small map. Below the small map there is a set of icons;\r\n\tthe one in the middle (<img src='images/historyicons/external.png' alt='example' />) opens up the large map, which contains all orders.<br/>\r\n\tAlso at the bottom of the board page is a link to open up a textual list of all the orders entered in the game, if you can't see\r\n\tsomething in the large map.", "I can't tell the difference between Germany and Austria" => "Color-blind people may have trouble distinguishing Germany and Austria's\r\n\tcolors. We hope to fix this problem in the future.");
if (isset(Config::$faq) && is_array(Config::$faq) && count(Config::$faq)) {
    $faq["Server-specific"] = "Sub-section";
    $faq["What is this section?"] = "webDiplomacy is free, open-source software, and there are several servers running webDiplomacy code.\r\n\t\t\tThis section is for questions which may be specific to this particular installation, whereas the rest of it applies to all\r\n\t\t\tinstallations. (e.g. This section may contain Q&amp;A regarding who runs and pays for this server, or relate to the features\r\n\t\t\twhich set this server apart from the official installation if any.)";
    foreach (Config::$faq as $Q => $A) {
        $faq[$Q] = $A;
    }
}
$i = 1;
print libHTML::pageTitle('Frequently Asked Questions', 'Answers to the questions people often ask in the forums; click on a question to expand the answer.');
$sections = array();
$section = 0;
foreach ($faq as $q => $a) {
    if ($a == "Sub-section") {
        $sections[] = '<a href="#faq_' . $section++ . '" class="light">' . $q . '</a>';
    }
}
print '<div style="text-align:center; font-weight:bold"><strong>Sections:</strong> ' . implode(' - ', $sections) . '</div>
	<div class="hr"></div>';
$section = 0;
foreach ($faq as $q => $a) {
    if ($a == "Sub-section") {
        if ($section) {
            print '</ul></div>';
        }
Пример #11
0
print $User->points . libHTML::points();
?>
)
	</li>
	<li class="formlistfield">
		<input type="text" name="newGame[bet]" size="7" value="<?php 
print $formPoints;
?>
" />
	</li>
	<li class="formlistdesc">
		The bet required to join this game. This is the amount of points that all players, including you,
		must put into the game's "pot" (<a href="points.php" class="light">read more</a>).<br /><br />

		<strong>Default:</strong> <?php 
print $defaultPoints . libHTML::points();
?>
	</li>
</ul>

<div class="hr"></div>

<div id="AdvancedSettingsButton">
<ul class="formlist">
	<li class="formlisttitle">
		<a href="#" onclick="$('AdvancedSettings').show(); $('AdvancedSettingsButton').hide(); return false;">
		Open Advanced Settings
		</a>
	</li>
	<li class="formlistdesc">
		Advanced settings allowing extra customization of games for seasoned players, allowing
Пример #12
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;
    }
Пример #13
0
 public static function printActionShortcuts()
 {
     global $User;
     $modActions = array();
     $modActions[] = '<a href="gamemaster.php" class="light">' . l_t('Run gamemaster') . '</a><br />';
     $modActions[] = libHTML::admincp('panic', null, l_t('Toggle panic-mode'));
     if ($User->type['Admin']) {
         $modActions[] = libHTML::admincp('notice', null, l_t('Toggle the site-wide notice'));
         $modActions[] = libHTML::admincp('maintenance', null, l_t('Toggle maintenance-mode')) . '<br />';
         $modActions[] = libHTML::admincp('clearErrorLogs', null, l_t('Clear error-logs'));
         $modActions[] = libHTML::admincp('clearOrderLogs', null, l_t('Clear order-logs'));
         $modActions[] = libHTML::admincp('clearAccessLogs', null, l_t('Clear access-logs'));
         $modActions[] = libHTML::admincp('clearAdminLogs', null, l_t('Clear admin-logs')) . '<br />';
         $modActions[] = libHTML::admincp('unCrashGames', array('excludeGameIDs' => ''), l_t('Un-crash any crashed games'));
     }
     if ($modActions) {
         print '<p class="notice">';
         print implode(' - ', $modActions);
         print '</p>';
         print '<div class="hr"></div>';
     }
 }
Пример #14
0
 public function fromLink()
 {
     $linkName = $this->linkName;
     if (strlen($linkName) > 35) {
         $linkName = substr($linkName, 0, 35) . '...';
     }
     if ($this->linkURL) {
         $buf = '<a href="' . $this->linkURL . '" ' . ($this->type == 'Game' ? 'gameID="' . $this->linkID . '"' : '') . '>' . $linkName . '</a>';
     } else {
         $buf = $linkName;
     }
     if (($this->type == 'PM' || $this->type == 'User') && isset($this->linkID) && $this->linkID) {
         $buf .= ' ' . libHTML::loggedOn($this->linkID);
     }
     return $buf;
 }
Пример #15
0
   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.');
/**
 * Display the error logs and other lists useful for admins
 *
 * @package Admin
 */
if ($User->type['Admin']) {
    //There may be sensitive info that would allow privilege escalation in these error logs
    print '<p><strong>' . l_t('Error logs:') . '</strong> ' . libError::stats() . ' (' . libHTML::admincp('clearErrorLogs', null, 'Clear') . ')</p>';
    $dir = libError::directory();
    $errorlogs = libError::errorTimes();
    $alternate = false;
    print '<TABLE class="credits">';
    foreach ($errorlogs as $errorlog) {
        $alternate = !$alternate;
        print '<tr class="replyalternate' . ($alternate ? '1' : '2') . '">';
        print '<td class="left time">' . libTime::text($errorlog) . '</td>';
        print '<td class="right message"><a class="light" href="admincp.php?viewErrorLog=' . $errorlog . '">Open</a></td>';
        print '</tr>';
    }
    print '</TABLE>';
}
/**
 * Fill a named table from a single column query
Пример #16
0
    }
    unset($tablMutedThreads);
    if (count($mutedThreads) > 0) {
        print '<li class="formlisttitle"><a name="threadmutes"></a>Muted threads:</li>';
        print '<li class="formlistdesc">The threads which you muted.</li>';
        $unmuteThreadID = 0;
        if (isset($_GET['unmuteThreadID'])) {
            $unmuteThreadID = (int) $_GET['unmuteThreadID'];
            $User->toggleThreadMute($unmuteThreadID);
            print '<li class="formlistfield"><strong>Thread <a class="light" href="forum.php?threadID=' . $unmuteThreadID . '#' . $unmuteThreadID . '">#' . $unmuteThreadID . '</a> unmuted.</strong></li>';
        }
        print '<li class="formlistfield"><ul>';
        foreach ($mutedThreads as $mutedThread) {
            if ($unmuteThreadID == $mutedThread['muteThreadID']) {
                continue;
            }
            print '<li>' . '<a class="light" href="forum.php?threadID=' . $mutedThread['muteThreadID'] . '#' . $mutedThread['muteThreadID'] . '">' . $mutedThread['subject'] . '</a> ' . libHTML::muted('usercp.php?unmuteThreadID=' . $mutedThread['muteThreadID'] . '#threadmutes') . '<br />' . $mutedThread['username'] . ' (' . $mutedThread['replies'] . ' replies)<br />' . '</li>';
        }
        print '</ul></li>';
    }
}
/*
 * This is done in PHP because Eclipse complains about HTML syntax errors otherwise
 * because the starting <form><ul> is elsewhere
 */
print '</ul>

<div class="hr"></div>

<input type="submit" class="form-submit notice" value="Update">
</form>';
Пример #17
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.');
/**
 * @package Base
 * @subpackage Static
 */
print libHTML::pageTitle('webDiplomacy Help and Links', 'Links to pages with more information about webDiplomacy and this installation.');
?>
<ul class="formlist">

<li><a href="intro.php">The intro to Diplomacy</a></li>
<li class="formlistdesc">An introduction to playing webDiplomacy; gives details on unit types, move types,
and the rules of webDiplomacy.</li>

<li><a href="faq.php">FAQ</a></li>
<li class="formlistdesc">The webDiplomacy FAQ.</li>

<li><a href="rules.php">Rulebook/Contacting the Mods</a></li>
<li class="formlistdesc">The webDiplomacy rulebook.</li>

<li><a href="recentchanges.php">Recent changes</a></li>
<li class="formlistdesc">Recent changes to the webDiplomacy software.</li>
Пример #18
0
 public function givePoints(array $params)
 {
     global $DB;
     $userID = (int) $params['userID'];
     $points = (int) $params['points'];
     $giveUser = new User($userID);
     if ($points > 0) {
         User::pointsTransfer($giveUser->id, 'Supplement', $points);
     } else {
         $points = -1 * $points;
         $DB->sql_put("UPDATE wD_Users SET points = points - " . $points . " WHERE id=" . $userID);
     }
     return l_t('This user was transferred %s %s.', $points, libHTML::points());
 }
Пример #19
0
 private function muteIcon()
 {
     global $User;
     $buf = '';
     if ($User->type['User'] && $this->userID != $User->id) {
         $isMuted = $User->isCountryMuted($this->gameID, $this->countryID);
         if (isset($_REQUEST['toggleMute']) && $_REQUEST['toggleMute'] == $this->countryID) {
             $this->muteMember();
             $isMuted = !$isMuted;
         }
         $toggleMuteURL = 'board.php?gameID=' . $this->gameID . '&toggleMute=' . $this->countryID . '&rand=' . rand(1, 99999) . '#chatboxanchor';
         $buf .= '<br />' . ($isMuted ? libHTML::muted($toggleMuteURL) : libHTML::unmuted($toggleMuteURL));
     }
     return $buf;
 }
Пример #20
0
 static function checkDeleteNote()
 {
     global $User, $DB;
     if (!$User->type['Moderator'] || !isset($_REQUEST['modNoteDelete'])) {
         return;
     }
     $params = explode('_', $_REQUEST['modNoteDelete']);
     if (count($params) != 3 || $params[0] != 'User' && $params[0] != 'Game') {
         throw new Exception("Invalid mod-note deletion command given");
     }
     list($linkIDType, $linkID, $timeSent) = $params;
     $linkID = (int) $linkID;
     $timeSent = (int) $timeSent;
     $DB->sql_put("DELETE FROM wD_ModeratorNotes WHERE linkIDType='" . $linkIDType . "' AND linkID=" . $linkID . " AND timeSent=" . $timeSent);
     libHTML::notice('Deleted', 'Moderator note successfully deleted.');
 }
Пример #21
0
    /**
     * A modified header, which will also print the info about the member which has joined if applicable,
     * for use at the top of a game board.
     * @return string
     */
    function header()
    {
        global $User;
        libHTML::$alternate = 2;
        $buf = '<div class="titleBar barAlt' . libHTML::alternate() . '">
				' . $this->titleBar() . '
			</div>';
        $noticeBar = $this->gameNoticeBar();
        if ($noticeBar) {
            $buf .= '
				<div class="bar gameNoticeBar barAlt' . libHTML::alternate() . '">
					' . $noticeBar . '
				</div>';
        }
        if ($this->Members->isJoined() && $this->phase != 'Pre-game') {
            $buf .= '<div class="membersList">' . $this->Members->ByUserID[$User->id]->memberHeaderBar() . '</div>';
        }
        return $buf;
    }
Пример #22
0
 /**
  * Redirect to a game after joining it. Script ends here.
  */
 function joinedRedirect()
 {
     // We have successfully joined, now give a message to tell the user so
     header('refresh: 4; url=board.php?gameID=' . $this->Game->id);
     $message = '<p class="notice">' . l_t('You are being redirected to %s. Good luck!', '<a href="board.php?gameID=' . $this->Game->id . '">' . $this->Game->name . '</a>') . '</p>';
     libHTML::notice(l_t("Joined %s", $this->Game->name), $message);
 }
Пример #23
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.');
/**
 * @package Base
 * @subpackage Static
 */
print libHTML::pageTitle('Developer/webmaster info', 'If you want to fix/improve/install webDiplomacy all the info you need to make it happen is here.');
?>

<h4>Links</h4>

<p><a href="http://forum.webdiplomacy.net" class="light">forum.webdiplomacy.net</a> - The forum for developers.</p>

<p><a href="http://sourceforge.net/projects/phpdiplomacy" class="light">forum.webdiplomacy.net</a> - The sourceforge.net project page.</p>

<p><a href="https://github.com/kestasjk/webDiplomacy" class="light">github.com/kestasjk/webDiplomacy</a> - The github .</p>

<div class="hr"></div>

<h4>Webmasters</h4>

<p><a href="http://webdiplomacy.net/README.txt" class="light">README.txt</a> - Installation data for webmasters</p>
Пример #24
0
        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 {
            define('AdminUserSwitch', $User->id);
        }
    } elseif ($Misc->Maintenance) {
        unset($DB);
        // This lets libHTML know there's a problem
        libHTML::error(Config::$serverMessages['Maintenance']);
    }
}
// This gets called by libHTML::footer
function close()
{
    global $DB, $Misc;
    // This isn't put into the database destructor in case of dieing due to an error
    if (is_object($DB)) {
        $Misc->write();
        if (!defined('ERROR')) {
            $DB->sql_put("COMMIT");
        }
        unset($DB);
    }
    ob_end_flush();
Пример #25
0
    /**
     * Print the HTML which comes before the main content; title, menu, notification bar.
     *
     * @param string|bool[optional] $title If a string is given it will be used as the page title
     */
    public static function starthtml($title = false)
    {
        global $User;
        self::$scriptname = $scriptname = basename($_SERVER['PHP_SELF']);
        $pages = libHTML::pages();
        if (isset($User) and !isset($pages[$scriptname])) {
            die(l_t('Access to this page denied for your account type.'));
        }
        print libHTML::prebody($title === FALSE ? l_t($pages[$scriptname]['name']) : $title) . '<body>' . libHTML::menu($pages, $scriptname);
        if (defined('FACEBOOKSCRIPT')) {
            ?>
			<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/javascript"></script>
			<script type="text/javascript">
			FB.init("b24f8dc93cdbf2ff1ee7db508ae14c6d");
			FB_RequireFeatures(["CanvasUtil"], function(){
				FB.XdComm.Server.init("xd_receiver.htm");
				FB.CanvasClient.startTimerToSizeToContent();
			});
			</script>
			<div id="FB_HiddenIFrameContainer" style="display:none; position:absolute; left:-100px; top:-100px; width:0px; height: 0px;"></div>
			<?php 
        }
        print '<noscript><div class="content-notice">
					<p class="notice">' . l_t('You do not have JavaScript enabled. It is required to use webDiplomacy fully.') . '</p>
				</div></noscript>';
        print self::globalNotices();
        if (is_object($User) && $User->type['User']) {
            $gameNotifyBlock = libHTML::gameNotifyBlock();
            if ($gameNotifyBlock) {
                print '<div class="content-notice"><div class="gamelistings-tabs">' . $gameNotifyBlock . '</div></div>';
            }
        }
    }
Пример #26
0
    /**
     * Links to the game and game archives
     * @return string
     */
    function links()
    {
        $watchString = '';
        if ($this->watched()) {
            $watchString = '- <a href="board.php?gameID=' . $this->id . '&unwatch">' . l_t('Stop spectating') . '</a>';
        }
        if ($this->phase == 'Pre-game') {
            return '<div class="bar homeGameLinks barAlt' . libHTML::alternate() . '">
				<a href="board.php?gameID=' . $this->id . '">' . l_t('Open') . '</a>
				' . $watchString . '</div>';
        } else {
            return '<div class="bar homeGameLinks barAlt' . libHTML::alternate() . '">
				<a href="board.php?gameID=' . $this->id . '#gamePanel">' . l_t('Open') . '</a> 
				' . $watchString . '</div>';
        }
    }
Пример #27
0
 /**
  * Reload the variables which are stored within this object specificially, ie everything
  * except aggregates
  */
 function load()
 {
     global $DB;
     $row = $DB->sql_hash("SELECT\r\n\t\t\tg.id,\r\n\t\t\tg.variantID,\r\n\t\t\tLOWER(HEX(g.password)) as password,\r\n\t\t\tg.turn,\r\n\t\t\tg.phase,\r\n\t\t\tg.processTime,\r\n\t\t\tg.name,\r\n\t\t\tg.gameOver,\r\n\t\t\tg.attempts,\r\n\t\t\tg.pot,\r\n\t\t\tg.potType,\r\n\t\t\tg.phaseMinutes,\r\n\t\t\tg.processStatus,\r\n\t\t\tg.pauseTimeRemaining,\r\n\t\t\tg.minimumBet,\r\n\t\t\tg.anon,\r\n\t\t\tg.pressType,\r\n\t\t\tg.missingPlayerPolicy,\r\n\t\t\tg.drawType,\r\n\t\t\tg.minimumReliabilityRating\r\n\t\t\tFROM wD_Games g\r\n\t\t\tWHERE g.id=" . $this->id . ' ' . $this->lockMode);
     if (!isset($row['id']) or !$row['id']) {
         libHTML::error(l_t("Game not found; ensure a valid game ID has been given. Check that this game hasn't been canceled, you may have received a message about it on your <a href='index.php' class='light'>home page</a>."));
     }
     $this->loadRow($row);
 }
Пример #28
0
    /**
     * 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>';
    }
Пример #29
0
 /**
  * Log-on, create/update a session record, and take information for user access logging for meta-gamers
  */
 function logon()
 {
     global $DB;
     session_name('wD_Sess_User-' . $this->id);
     /*if( $this->type['User'] )
     			session_cache_limiter('private_no_expire');
     		else
     			session_cache_limiter('public');*/
     session_start();
     // Non-users can't get banned
     if ($this->type['Guest']) {
         return;
     }
     if (isset($_SERVER['HTTP_USER_AGENT'])) {
         $userAgentHash = substr(md5($_SERVER['HTTP_USER_AGENT']), 0, 4);
     } else {
         $userAgentHash = '0000';
     }
     if (!isset($_COOKIE['wD_Code']) or intval($_COOKIE['wD_Code']) == 0 or intval($_COOKIE['wD_Code']) == 1) {
         // Making this larger than 2^31 makes it negative..
         $cookieCode = rand(2, 2000000000);
         setcookie('wD_Code', $cookieCode, time() + 365 * 7 * 24 * 60 * 60);
     } else {
         $cookieCode = (int) $_COOKIE['wD_Code'];
     }
     if ($this->type['Banned']) {
         libHTML::notice(l_t('Banned'), l_t('You have been banned from this server. If you think there has been a mistake contact the moderator team at %s , and if you still aren\'t satisfied contact the admin at %s (with details of what happened).', Config::$modEMail, Config::$adminEMail));
     }
     /*
     		$bans=array();
     		$tabl = $DB->sql_tabl("SELECT numberType, number, userID FROM wD_BannedNumbers
     			WHERE ( number = INET_ATON('".$_SERVER['REMOTE_ADDR']."') AND numberType='IP')
     				OR ( number = ".$cookieCode." AND numberType='CookieCode')
     				OR ( userID=".$this->id.")");
     		while(list($banType,$banNum)=$DB->tabl_row($tabl))
     			$bans[$banType]=$banNum;
     
     		if($this->type['Banned'])
     		{
     			//if( isset($bans['IP']) and $cookieCode!=$bans['CookieCode'] )
     				//setcookie('wD_Code', $bans['CookieCode'],time()+365*7*24*60*60);
     
     			if(!isset($bans['IP']) || ip2long($_SERVER['REMOTE_ADDR'])!=$bans['IP'])
     				self::banIP(ip2long($_SERVER['REMOTE_ADDR']), $this->id);
     
     			libHTML::notice('Banned', 'You have been banned from this server. If you think there has been
     					a mistake contact '.Config::$adminEMail.' .');
     		}
     		elseif( isset($bans['IP']) )
     		{
     			self::banUser($this->id,"You share an IP with a banned user account.", $_SERVER['REMOTE_ADDR']);
     			libHTML::notice('Banned', 'You have been banned from this server. If you think there has been
     				a mistake contact '.Config::$adminEMail.' .');
     		}*/
     $DB->sql_put("INSERT INTO wD_Sessions (userID, lastRequest, hits, ip, userAgent, cookieCode)\r\n\t\t\t\t\tVALUES (" . $this->id . ",CURRENT_TIMESTAMP,1, INET_ATON('" . $_SERVER['REMOTE_ADDR'] . "'),\r\n\t\t\t\t\t\t\tUNHEX('" . $userAgentHash . "'), " . $cookieCode . " )\r\n\t\t\t\t\tON DUPLICATE KEY UPDATE hits=hits+1");
     $this->online = true;
 }
Пример #30
0
 /**
  * Output the tabs which go on top of the chat-box, along with online notifications and message notifications
  * where applicable
  * @param string $msgCountryID The name of the countryID/tab which we have open
  * @return string The HTML for the chat-box tabs
  */
 protected function outputTabs($msgCountryID)
 {
     global $Member, $Game;
     $tabs = '<div id="chatboxtabs" class="gamelistings-tabs">';
     for ($countryID = 0; $countryID <= count($Game->Variant->countries); $countryID++) {
         // Do not allow country specific tabs for restricted press games.
         if ($Game->pressType != 'Regular' && $countryID != 0 && $countryID != $Member->countryID) {
             continue;
         }
         $tabs .= ' <a href="./board.php?gameID=' . $Game->id . '&amp;msgCountryID=' . $countryID . '&amp;rand=' . rand(1, 100000) . '#chatboxanchor" ' . 'class="country' . $countryID . ' ' . ($msgCountryID == $countryID ? 'current"' : '" title="' . l_t('Open %s chatbox tab"', $countryID == 0 ? 'the global' : $this->countryName($countryID) . "'s")) . '>';
         if ($countryID == $Member->countryID) {
             $tabs .= l_t('Notes');
         } elseif (isset($Game->Members->ByCountryID[$countryID])) {
             $tabs .= $Game->Members->ByCountryID[$countryID]->memberCountryName();
             if ($Game->Members->ByCountryID[$countryID]->online && !$Game->Members->ByCountryID[$countryID]->isNameHidden()) {
                 $tabs .= ' ' . libHTML::loggedOn($Game->Members->ByCountryID[$countryID]->userID);
             }
         } else {
             $tabs .= l_t('Global');
         }
         if ($msgCountryID != $countryID and in_array($countryID, $Member->newMessagesFrom)) {
             // This isn't the tab I am currently viewing, and it has sent me new messages
             $tabs .= ' ' . libHTML::unreadMessages();
         }
         // Mark as unread patch!
         if ($msgCountryID == $countryID and isset($_REQUEST['MarkAsUnread'])) {
             $tabs .= ' ' . libHTML::unreadMessages();
         }
         $tabs .= '</a>';
     }
     $tabs .= '</div>';
     return $tabs;
 }