/**
 * Get all variables of the current user from Wordpress and add it to $UMC_USER
 */
function umc_wp_get_vars()
{
    XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    global $UMC_USERS, $UMC_USER, $UMC_ENV, $user_email, $user_login;
    if ($UMC_ENV !== 'wordpress') {
        XMPP_ERROR_trigger("Tried to get wordpress vars, but environment did not match: " . var_export($UMC_ENV, true));
        die('umc_wp_get_vars');
    }
    get_currentuserinfo();
    if (!isset($user_login) || $user_login == '' || $user_email == '') {
        $UMC_USER = false;
    } else {
        if (!function_exists('umc_get_uuid_level')) {
            XMPP_ERROR_send_msg("Could not get uuid_level, Env = {$UMC_ENV}");
            require_once '/home/minecraft/server/bin/core_include.php';
        }
        $uuid = umc_wp_get_uuid_for_currentuser();
        $UMC_USER['ip'] = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_FLAG_IPV4);
        if (!$uuid) {
            // we have a guest who is trying to register
            $UMC_USER['username'] = $user_login;
            $UMC_USER['email'] = $user_email;
            $uuid = umc_user2uuid($user_login);
            $UMC_USER['uuid'] = $uuid;
            $UMC_USER['userlevel'] = 'Guest';
        } else {
            // there is a logged-in user
            umc_uuid_check_usernamechange($uuid);
            $UMC_USER['email'] = $user_email;
            $UMC_USER['username'] = umc_uuid_getone($uuid, 'username');
            $UMC_USER['uuid'] = $uuid;
            $UMC_USER['userlevel'] = umc_get_uuid_level($uuid);
            if (strstr($UMC_USER['userlevel'], 'DonatorPlus')) {
                $UMC_USER['donator'] = 'DonatorPlus';
            } else {
                if (strstr($UMC_USER['userlevel'], 'Donator')) {
                    $UMC_USER['donator'] = 'Donator';
                } else {
                    $UMC_USER['donator'] = false;
                }
            }
        }
        // if we did not get any UUID
        if (!$uuid) {
            $UMC_USER['username'] = $user_login;
            $UMC_USER['uuid'] = false;
            $UMC_USER['userlevel'] = 'Guest';
        }
    }
    //$UMC_USERS[$uuid] = new UMC_User($uuid);
    //$UMC_USERS[$uuid]->set_username($username);
    //$UMC_USERS[$uuid]->set_userlevel($userlevel);
}
Exemplo n.º 2
0
function umc_wp_fingerprint_call()
{
    XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    require_once '/home/minecraft/server/bin/index_wp.php';
    $uuid = umc_wp_get_uuid_for_currentuser();
    if ($uuid) {
        $out = '
    <script>
        jQuery(document).ready(function(jQuery) {
            var fp = new Fingerprint2();
            fp.get(function(result) {
                var fingerprint_url = "http://uncovery.me/admin/index.php?function=web_set_fingerprint&uuid=' . $uuid . '&id=" + result;
                jQuery.ajax(fingerprint_url);
            });
        });
    </script>';
        echo $out;
    }
}