<?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); } include "config.inc"; include "as_manager.inc"; include "../scripts/config.inc"; if (__isManagerRunning() && !file_exists($config['cachedir'] . "/ticks_stopped")) { $op = array("pc" => 55, "text" => "Waiting for ticks to stop", "delay" => 1, "to" => "cg_step7.php"); } else { $op = array("pc" => 60, "text" => "Generating configuration", "delay" => 1, "to" => "cg_step8.php"); } include 'cg_operation.inc';
include 'cg_argh.inc'; exit(1); } } } } public static function setConnection($cnx) { self::$cConnection = $cnx; } } $gtData = array("r" => array('round', 'r'), "m" => array('match', 'm'), "c" => array('ctf', 'm')); $gData = $gtData[$_SESSION['lw_new_game']['game_type']]; $substStr = "b5" . $gData[1] . "X"; // Load base match script $fileName = "../sql/beta5/beta5-" . $gData[0] . ".sql"; $baseFile = fopen($fileName, "r"); $base = ""; while (($line = fgets($baseFile)) !== FALSE) { $base .= preg_replace("/{$substStr}/", $_SESSION['lw_new_game']['found_id'], $line); } fclose($baseFile); dbParser::parse($base); dbParser::connect(); dbParser::execute($_SESSION['lw_new_game']['found_id']); if (__isManagerRunning()) { $op = array("pc" => 50, "text" => "Stopping all ticks", "delay" => 1, "to" => "cg_step6.php"); } else { $op = array("pc" => 60, "text" => "Generating configuration", "delay" => 1, "to" => "cg_step8.php"); } include 'cg_operation.inc';
__logAdmin("is enabling the ticks"); } function disableTicks() { global $config; touch($config['cachedir'] . "/stop_ticks"); __logAdmin("is disabling the ticks"); } $statusMessage = ""; // Start / stop manager if ($_GET['c'] == 'sm') { startManager(); } elseif ($_GET['c'] == 'km') { killManager(); } else { $mRunning = __isManagerRunning(); $tActive = $mRunning !== false ? ticksActive() : false; // Run tick manually if ($_GET['c'] == 'rt' && $_GET['g'] != '' && $_GET['t'] != '') { $__runFromAdmin = true; $__adminParams = array($_GET['g'], $_GET['t']); __logAdmin("is running tick " . join("::", $__adminParams)); include "../scripts/ticks.php"; $statusMessage = is_null($argh) ? "Tick <b>" . join("::", $__adminParams) . "</b> run successfully" : "<b>Error while running tick " . join("::", $__adminParams) . ":</b><br/>{$argh}"; } else { // Enable / disable ticks if ($tActive === true && $_GET['c'] == 'dt') { disableTicks(); $tActive = 'pending'; } elseif ($mRunning !== false && $tActive === false && $_GET['c'] == 'et') { enableTicks();