Esempio n. 1
0
function stop_rtorrent()
{
    if (check_rtorrent()) {
        run("screen -S bt_download -X quit && rm -f ~/.scgi_local");
        status_msg("Rtorrent stopped.");
    } else {
        status_msg("There is no rtorrent to stop.");
    }
}
Esempio n. 2
0
//lock
$gPORT_LOCKER = new PortLocker(17897);
if (!$gPORT_LOCKER->lock()) {
    debug("cron_parse_csv() : an instance still running!");
    exit;
}
debug("cron_parse_csv() : an instance will run now!");
//get settings
$pdata = get_csv_summary();
// found
if ($pdata['exists']) {
    $rdata = $pdata['data'];
    $rdatb = 0;
    foreach ($rdata as $kk => $vv) {
        $rdatb++;
        $csv = sprintf("%s/%s", CSV_DIR, $vv['csv_file']);
        //update 1
        $upd = set_csv_summary(array('id' => $vv['id'], 'status' => 1, 'desc' => 'ongoing parsing'));
        //run
        parse_csv_sheet($csv, $vv['id']);
        debug("cron_parse_csv({$rdatb} # {$upd}) file> {$csv}");
    }
    status_msg(SUCCESS, "Total {$rdatb} pending summary found in db.");
} else {
    status_msg(FAILED, "No pending summary found in db.");
}
//free
$gPORT_LOCKER->unlock();
//free
free_up();
debug("cron_parse_csv() : done!!!!");
Settings::Set('wbce_tag', NEW_WBCE_TAG);
Settings::Set('wb_version', VERSION);
// Legacy: WB-classic
Settings::Set('wb_revision', REVISION);
// Legacy: WB-classic
Settings::Set('wb_sp', SP);
// Legacy: WB-classic
/**********************************************************
 *  - End of upgrade script only some output stuff down here
 */
if (!defined('DEFAULT_THEME')) {
    define('DEFAULT_THEME', $DEFAULT_THEME);
}
if (!defined('THEME_PATH')) {
    define('THEME_PATH', WB_PATH . '/templates/' . DEFAULT_THEME);
}
echo '<p style="font-size:120%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>';
status_msg('<br />Please delete the file <strong>upgrade-script.php</strong> via FTP before proceeding.', 'warning', 'div');
// show buttons to go to the backend or frontend
echo '<br />';
if (defined('WB_URL')) {
    echo '<form action="' . WB_URL . '/">';
    echo '&nbsp;<input type="submit" value="kick me to the Frontend" />';
    echo '</form>';
}
if (defined('ADMIN_URL')) {
    echo '<form action="' . ADMIN_URL . '/">';
    echo '&nbsp;<input type="submit" value="kick me to the Backend" />';
    echo '</form>';
}
echo '<br /><br /></div></body></html>';
Esempio n. 4
0
function status($account, $params = "")
{
    global $player_data;
    global $map_data;
    global $dest;
    if (player_ready($account) == False) {
        return;
    }
    $public = False;
    if (isset($player_data[$account]["flags"]["public_status"]) == True) {
        $public = True;
    }
    if ($params != "") {
        $params = explode(" ", $params);
        if (count($params) != 2) {
            status_msg($account, "syntax: [~civ] status [x y]", $public);
            return;
        }
        $x = $params[0];
        $y = $params[1];
        if (exec_is_integer($x) == False or exec_is_integer($y) == False) {
            status_msg($account, "error: coordinates must be two positive integers", $public);
            return;
        }
        if ($x < 0 or $x >= $map_data["cols"] or $y < 0 or $y >= $map_data["rows"]) {
            status_msg($account, "error: coordinate {$x},{$y} is outside the map", $public);
            return;
        }
        $terrain = $map_data["coords"][map_coord($map_data["cols"], $x, $y)];
        if (is_fogged($account, $x, $y) == True) {
            status_msg($account, "coordinate {$x},{$y} is fogged", $public);
            return;
        }
        $owner = "";
        $units = array();
        foreach ($player_data as $player => $data) {
            for ($i = 0; $i < count($player_data[$player]["units"]); $i++) {
                $unit = $player_data[$player]["units"][$i];
                if ($unit["x"] == $x and $unit["y"] == $y) {
                    if ($owner == "") {
                        $owner = $player;
                    } elseif ($owner != $player) {
                        status_msg($account, "error: multiple players have assets at {$x},{$y}", $public);
                        return;
                    }
                    $units[] = $unit;
                }
            }
        }
        $cities = array();
        foreach ($player_data as $player => $data) {
            for ($i = 0; $i < count($player_data[$player]["cities"]); $i++) {
                $city = $player_data[$player]["cities"][$i];
                if ($city["x"] == $x and $city["y"] == $y) {
                    if ($owner == "") {
                        $owner = $player;
                    } elseif ($owner != $player) {
                        status_msg($account, "error: multiple players have assets at {$x},{$y}", $public);
                        return;
                    }
                    $cities[] = $city;
                }
            }
        }
        if (count($cities) == 0 and count($units) == 0) {
            status_msg($account, "coordinate {$x},{$y} ({$terrain}) is currently unoccupied", $public);
            return;
        }
        if (count($cities) > 1) {
            status_msg($account, "error: multiple cities at {$x},{$y}", $public);
            return;
        }
        status_msg($account, "status for coordinate {$x},{$y} ({$terrain}): occupied by {$owner}", $public);
        if (count($cities) > 0) {
            status_msg($account, "city: " . $cities[0]["name"], $public);
        }
        status_msg($account, "units: " . count($units), $public);
    } else {
        $i = $player_data[$account]["active"];
        $unit = $player_data[$account]["units"][$i];
        $index = $unit["index"];
        $type = $unit["type"];
        $health = $unit["health"];
        $x = $unit["x"];
        $y = $unit["y"];
        $n = count($player_data[$account]["units"]);
        if (isset($player_data[$account]["status_messages"]) == True) {
            $unique_messages = array_count_values($player_data[$account]["status_messages"]);
            foreach ($unique_messages as $msg => $count) {
                if ($count > 1) {
                    $msg = $msg . " (x{$count})";
                }
                status_msg($account, $dest . " {$account} => {$msg}", $public);
            }
            unset($player_data[$account]["status_messages"]);
        }
        status_msg($account, $dest . " {$account} => {$index}/{$n}, {$type}, +{$health}, ({$x},{$y})", $public);
    }
}