Пример #1
0
<?php

require_once dirname(__FILE__) . '/lib/functions.php';
if (!empty($_POST['note'])) {
    file_put_contents(getenv('ADT_DATA') . "/conf/instances/" . $_POST['product'] . "-" . $_POST['version'] . "." . $_POST['server'] . ".note", $_POST['note']);
} else {
    // Remove any existing value by removing the file
    if (file_exists(getenv('ADT_DATA') . "/conf/instances/" . $_POST['product'] . "-" . $_POST['version'] . "." . $_POST['server'] . ".note")) {
        unlink(getenv('ADT_DATA') . "/conf/instances/" . $_POST['product'] . "-" . $_POST['version'] . "." . $_POST['server'] . ".note");
    }
}
// Flush caches
clearCaches();
header("Location: " . $_POST['from'] . "?clearCaches=true");
/* Redirect browser */
/* Make sure that code below does not get executed when we redirect. */
exit;
Пример #2
0
function checkCaches()
{
    if (array_key_exists('clearCaches', $_GET)) {
        clearCaches();
        header("Location: " . str_replace("?clearCaches=true", "", currentPageURL()));
        /* Redirect browser */
        /* Make sure that code below does not get executed when we redirect. */
        exit;
    }
}
Пример #3
0
function processContainer($container)
{
    global $forwardedContainer, $previousContainer, $player;
    if ($container == $previousContainer && $forwardedContainer['body'] != 'forces_attack.php') {
        debug('We are executing the same container twice?', array('ForwardedContainer' => $forwardedContainer, 'Container' => $container));
        if ($player->hasNewbieTurns() || $player->hasFederalProtection()) {
            // Only throw the exception if we have protection, otherwise let's hope that the NPC will be able to find its way to safety rather than dying in the open.
            throw new Exception('We are executing the same container twice?');
        }
    }
    clearCaches();
    //Clear caches of anything we have used for decision making before processing container and getting lock.
    $previousContainer = $container;
    debug('Executing container', $container);
    //Redefine MICRO_TIME and TIME, the rest of the game expects them to be the single point in time that the script is executing, with it being redefined for each page load - unfortunately NPCs are one consistent script so we have to do a hack and redefine it (or change every instance of the TIME constant.
    runkit_constant_redefine('MICRO_TIME', microtime());
    runkit_constant_redefine('TIME', (int) microtimeSec(MICRO_TIME));
    resetContainer($container);
    do_voodoo();
}