function umc_get_lot_change_form($lot, $form = false)
{
    XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    // get possible options
    $options = umc_get_lot_options($lot, $form);
    // get current option
    $sql = "SELECT choice FROM minecraft_srvr.lot_version WHERE lot='{$lot}'";
    $D = umc_mysql_fetch_all($sql);
    $choice = $D[0]['choice'];
    if ($choice != null) {
        $out = "<strong>Lot action on next server restart:</strong> ";
    } else {
        $out = "<strong>Available Lot actions:</strong> ";
    }
    $selected = array();
    $selected[$choice] = " selected=\"selected\"";
    if (count($options) < 1) {
        return $out . "No actions available";
    } else {
        if (count($options) < 2) {
            $out .= "No actions available";
        } else {
            if ($form) {
                $out .= "<select name=\"lot_action\">";
                foreach ($options as $option => $text) {
                    $sel_str = '';
                    if (isset($selected[$option])) {
                        $sel_str = $selected[$option];
                    }
                    $out .= "<option value=\"{$option}\"{$sel_str}>{$text}</option>\n";
                }
                $out .= "</select> (Resets happen @ next reboot in " . umc_time_until_restart() . ")";
            } else {
                if ($choice == null) {
                    $out .= "<ul>";
                    foreach ($options as $option => $text) {
                        $out .= "<li>{$text}</li>";
                    }
                    $out .= "</ul>";
                } else {
                    $out .= "{$choice} (@ next reboot in " . umc_time_until_restart() . ")";
                }
            }
        }
        return $out;
    }
}
예제 #2
0
function umc_server_status()
{
    global $UMC_DOMAIN;
    XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    $errno = '';
    $errstr = '';
    $fp = @fsockopen('uncovery.me', 25565, $errno, $errstr, 1);
    if (!$fp) {
        echo "{$errstr} ({$errno})<br />\n";
        return "<img src=\"{$UMC_DOMAIN}/admin/img/offline.png\" height=\"50\"><Br>";
    } else {
        global $UMC_USER;
        $out = "<img src=\"{$UMC_DOMAIN}/admin/img/online.png\" height=\"50\"><br>";
        if ($UMC_USER) {
            $uuid = $UMC_USER['uuid'];
            $username = strtolower($UMC_USER['username']);
            $date_new = umc_datetime();
            $now = $date_new->format('Y-m-d H:i');
            $out .= '<strong>Server Address:</strong> uncovery.me<br>' . '<strong>Server Port:</strong> 25565<br>' . "<strong>Server Time:</strong> {$now}<br>" . "<strong>Next reboot in:</strong> " . umc_time_until_restart() . "<br>";
            $result = count_users();
            $out .= '<strong>Registered Users:</strong> ' . $result['total_users'] . '<br>';
            //$rights = umc_read_data('permissions');
            //$users = $rights['permissions']['users'];
            //$result = count($users);
            //$out .= '<strong>Builders:</strong> '.  $result . '<br>';
            $out .= '<strong>Online Users:</strong> ';
            $online_users = umc_read_markers_file('array');
            $no_users = count($online_users);
            if ($no_users > 0 && $online_users != '') {
                $out .= "({$no_users}) ";
                foreach ($online_users as $data) {
                    $out .= "<a href=\"{$UMC_DOMAIN}/users-2/?u={$data['name']}\">{$data['name']}</a>, ";
                }
            } else {
                $out .= "nobody";
            }
            $out = rtrim($out, ", ");
            // $out .= "<br>". umc_donation_stats();
            $dlevel = umc_donation_level($UMC_USER['username']);
            if ($dlevel) {
                $out .= "<br><strong>Your donation lasts</strong>  {$dlevel} more months.";
            }
        } else {
            $out = 'Please login!';
        }
    }
    return $out;
}