function handleCommand($command, $game) { if ($command == 'mv' && $game->status() == 'PRE') { __logAdmin("is making game {$game->name} visible"); sendFifo("READY {$game->name}"); } elseif ($command == 'te' && $game->status() == 'READY' && $game->firstTick() - time() > 24 * 60 * 60 + 30) { __logAdmin("made game {$game->name} start 24h earlier"); sendFifo("START {$game->name} EARLY"); } elseif ($command == 'tl' && $game->status() == 'READY') { __logAdmin("made game {$game->name} start 24h later"); sendFifo("START {$game->name} LATE"); } elseif ($command == 'en' && ($game->status() == 'RUNNING' || $game->status() == "VICTORY")) { __logAdmin("terminated game {$game->name}"); sendFifo("SETEND {$game->name} 0"); } elseif ($command == 'e24' && $game->status() == 'RUNNING') { __logAdmin("set game {$game->name} to end in 24h"); sendFifo("SETEND {$game->name} 24"); } elseif ($command == 'kr' && $game->status() == 'ENDING') { __logAdmin("prevented game {$game->name} from ending"); sendFifo("NOEND {$game->name}"); } elseif ($command == 'ee' && $game->status() == 'ENDING' && $game->lastTick() - time() > 24 * 60 * 60 + 30) { __logAdmin("made game {$game->name} end 24h earlier"); sendFifo("END {$game->name} EARLY"); } elseif ($command == 'el' && $game->status() == 'ENDING') { __logAdmin("made game {$game->name} end 24h later"); sendFifo("END {$game->name} LATE"); } elseif ($command == 'en' && $game->status() == 'ENDING') { __logAdmin("terminated game {$game->name}"); sendFifo("END {$game->name} NOW"); } }
include '../scripts/config.inc'; __logAdmin("put the server out of maintenance mode"); } elseif ($_POST['enable'] != '' && is_null($config['maintenance'])) { $reason = $_POST['reason']; $duration = (int) $_POST['duration']; if (strlen($reason) < 10) { $err = "Reason too short (min 10 characters)."; } elseif ($duration < 5) { $err = "Duration too short (min 5 minutes)."; } else { $maintenance = array("until" => time() + $duration * 60, "reason" => $reason); $f = fopen($config['cachedir'] . '/maintenance.ser', "w"); fwrite($f, serialize($maintenance)); fclose($f); include '../scripts/config.inc'; __logAdmin("put the server in maintenance mode for reason: {$reason}"); } } if (is_null($config['maintenance'])) { ?> <p> Maintenance mode is currently inactive. Please use the form below to activate it. </p> <form method="POST" action="?"> <p> Reason for maintenance: <input type="text" maxlength="100" name="reason" size="40" value="<?php echo htmlentities($reason); ?> " /><br/> Maintenance mode duration: <input type="text" maxlength="3" name="duration" size="4" value="<?php echo $duration;
{ global $aConfig; $fName = $aConfig['ctrlFifo']; if (!file_exists($fName)) { return false; } $fifo = fopen($fName, "w"); fwrite($fifo, "{$cmd}\n"); fclose($fifo); redirect(); } if ($_GET['c'] == 'kb') { __logAdmin("is stopping the IRC bot"); sendCommand("BOTOFF"); } elseif ($_GET['c'] == 'sb') { __logAdmin("is starting the IRC bot"); sendCommand("BOTON"); } $running = file_exists($config['cs_path'] . "/ircbot.pid"); ?> <html> <head> <title>LegacyWorlds Beta 5 > Administration > IRC bot</title> </head> <body> <h1><a href="index.html">LWB5 > Administration</a> > IRC bot</h1> <?php if ($running) { ?> <p> IRC bot is (probably) running. <a href="?c=kb">Kill bot</a>
function stopDetector() { __logAdmin("is stopping the proxy detector"); __sendControl("PCOFF"); redirect(); }
function disableTicks() { global $config; touch($config['cachedir'] . "/stop_ticks"); __logAdmin("is disabling the ticks"); }
<?php set_magic_quotes_runtime(false); session_start(); if (!is_array($_SESSION['lw_new_game']) || !$_SESSION['lw_new_game']['do_it_now'] || $_SESSION['lw_new_game']['started']) { echo "Sorry, can't do that."; exit(0); } $_SESSION['lw_new_game']['started'] = true; include "as_log.inc"; __logAdmin("is creating game {$_SESSION['lw_new_game']['name']}"); $op = array("pc" => 0, "text" => "Initialising ...", "delay" => 1, "to" => "cg_step1.php"); include 'cg_operation.inc';