Example #1
0
function umc_display_guestinfo()
{
    global $UMC_USER, $UMC_DOMAIN;
    XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    if ($UMC_USER) {
        $uuid = $UMC_USER['uuid'];
        $userlevel = $UMC_USER['userlevel'];
        $username = $UMC_USER['username'];
    }
    $latest_settlers = implode(", ", umc_get_latest_settlers(5));
    $notice = '';
    $content = "";
    # If not logged in
    if (!$UMC_USER) {
        $title = 'Welcome, stranger!';
        $content = "Please feel free to look around! In order to start building with us, please <a href=\"{$UMC_DOMAIN}/wp-login.php\">whitelist yourself</a>. " . "To know more about how to join us, please <a href=\"{$UMC_DOMAIN}/server-access/whitelist/\">continue here</a>.<br>" . "If you are a member already, don\\'t be a stranger and <a href=\"{$UMC_DOMAIN}/wp-login.php\">login</a>!<br><br>" . 'If you want to see what awaits you inside, watch our trailer!<br>' . '<iframe width="550" height="315" src="//www.youtube.com/embed/RjfZaDpGCLA" allowfullscreen></iframe><br><br>';
    } else {
        if ($userlevel == 'Guest') {
            $title = "Welcome, {$username}!";
            $content = "Thanks for white-listing on our server.<br>We would love to see you building with us. " . "<a href=\"{$UMC_DOMAIN}/server-access/buildingrights/\">Get builder rights now</a>!";
        } else {
            $content = "<ul>\n";
            $title = "Welcome, <span class='" . strtolower($userlevel) . "'>{$username}</span>";
            if (strpos($userlevel, 'Donator')) {
                $title .= "<span class='pluscolor'>+</span>";
            }
            if (strpos($userlevel, 'Plus')) {
                $title .= "<span class='pluscolor'>+</span>";
            }
            $votables = umc_vote_get_votable($username, true);
            // Teamspeak information
            $content .= "<li><strong>Join us</strong> on <a href=\"{$UMC_DOMAIN}/communication/teamspeak/\">Teamspeak</a>!</li>";
            // Elder/Owner information
            if (strstr($userlevel, 'Elder') || $userlevel == 'Owner') {
                // elders only content
                $ban_arr = umc_get_recent_bans(3);
                $content .= "<li><strong>Logs:</strong> <a href=\"{$UMC_DOMAIN}/kills-logfile/\">Kills Logs</a>, <a href=\"{$UMC_DOMAIN}/logblock-logfile/\">Block Logs</a></li>\n" . "<li><strong>Recent Bans:</strong> ";
                foreach ($ban_arr as $ban => $reason) {
                    $reason = trim($reason);
                    $content .= "{$ban} ({$reason}), ";
                }
                $content = rtrim($content, ", ");
                $content .= "</li>\n";
            }
            // Latest settlers
            $content .= "<li><strong>Please welcome our latest settlers:</strong> {$latest_settlers}</li>\n";
            // Voting information
            if ($votables) {
                $content .= "<li>{$votables}</li>\n";
            }
            // Group information
            $content .= '<li><strong>Your stats:</strong> Your level is <strong>' . $UMC_USER['userlevel'] . '</strong>';
            // Online time information
            $online_time = umc_get_lot_owner_age('days', $uuid);
            if ($online_time) {
                $days = $online_time[$uuid]['firstlogin']['days'];
                $content .= ", you are on the server since <strong> {$days} days</strong>";
                $online_hours = umc_get_online_hours($uuid);
                $content .= " and have been online for <strong> {$online_hours} hours</strong>";
                if ($online_hours < 60) {
                    $remaining = 60 - $online_hours;
                    $content .= " but you need <strong>{$remaining}</strong> more hours online until Citizen status";
                }
            }
            $content .= "!</li>\n";
            // Deposit information
            $deposit = umc_show_depotlist(true, $username, true);
            if (is_array($deposit) && count($deposit) > 0) {
                $content .= "<li><strong><a href=\"http://uncovery.me/server-access/shop-manager/?page=deposit\">Your Deposit:</a></strong><ul>";
                foreach ($deposit as $depot_content) {
                    $content .= "<li>" . $depot_content['item'] . "</li>";
                }
                $content .= "</ul></li>";
            }
            $content .= "</ul>\n";
        }
    }
    echo "<div class=\"welcome-block\"><h1 class=\"entry-title\">{$title}</h1>{$notice}\n{$content}\n</div>\n";
}
Example #2
0
/**
 * promotes a user to Citizen if applicable
 *
 * @param type $user_login
 * @param type $userlevel
 * @return type
 */
function umc_promote_citizen($username, $userlevel = false)
{
    XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    if (!$userlevel) {
        $userlevel = umc_get_userlevel($username);
    }
    $lower_username = strtolower($username);
    $settlers = array('Settler', 'SettlerDonator', 'SettlerDonatorPlus');
    if (in_array($userlevel, $settlers)) {
        /*
        $age = umc_get_lot_owner_age('array', $lower_login);
        if (!$age) {
            return;
        }
        $age_days = $age[$lower_login]['firstlogin']['days'];
        if ($age_days >= 90) {
        *
        */
        $online_hours = umc_get_online_hours($lower_username);
        if ($online_hours >= 60) {
            //user should be Citizen
            $uuid = umc_user2uuid($lower_username);
            if ($userlevel == 'Settler') {
                // pex user <user> group set <group>
                umc_exec_command("pex user {$uuid} group set Citizen");
                umc_log("users", "promotion", "User {$username} ({$uuid}) was promoted from {$userlevel} to Citizen (online hours: {$online_hours})");
            } else {
                if ($userlevel == 'SettlerDonator') {
                    umc_exec_command("pex user {$uuid} group set CitizenDonator");
                    umc_log("users", "promotion", "User {$username} ({$uuid}) was promoted from {$userlevel} to CitizenDonator (online: {$online_hours})");
                } else {
                    if ($userlevel == 'SettlerDonatorPlus') {
                        umc_exec_command("pex user {$uuid} group set CitizenDonatorPlus");
                        umc_log("users", "promotion", "User {$username} ({$uuid}) was promoted from {$userlevel} to CitizenDonatorPlus (online: {$online_hours})");
                    } else {
                        XMPP_ERROR_trigger("{$username} / {$uuid} has level {$userlevel} and could not be promoted to Citizen! Please report to admin!");
                    }
                }
            }
        }
    }
}