示例#1
0
     $to_validation['g-recaptcha-response'] = array('required' => true);
 }
 if ($custom_usernames == "true") {
     // validate username and Minecraft name
     $to_validation['mcname'] = array('required' => true, 'isvalid' => true, 'min' => 3, 'max' => 20, 'unique' => 'users');
     $to_validation['username'] = array('required' => true, 'min' => 3, 'max' => 20, 'unique' => 'users');
     $mcname = htmlspecialchars(Input::get('mcname'));
 } else {
     // only validate Minecraft name
     $to_validation['username'] = array('required' => true, 'isvalid' => true, 'min' => 3, 'max' => 20, 'unique' => 'users');
     $mcname = htmlspecialchars(Input::get('username'));
 }
 $validation = $validate->check($_POST, $to_validation);
 // Execute validation
 if ($validation->passed()) {
     $profile = ProfileUtils::getProfile($mcname);
     $result = $profile->getProfileAsArray();
     if (isset($result["uuid"]) && !empty($result['uuid'])) {
         $uuid = $result['uuid'];
     } else {
         $uuid = '';
     }
     $user = new User();
     $ip = $user->getIP();
     if (filter_var($ip, FILTER_VALIDATE_IP)) {
         // Valid IP
     } else {
         // TODO: Invalid IP, do something else
     }
     $password = password_hash(Input::get('password'), PASSWORD_BCRYPT, array("cost" => 13));
     // Get current unix time
示例#2
0
 *	Made by Samerton
 *  http://worldscapemc.co.uk
 *
 *  License: MIT
 */
require 'core/integration/uuid.php';
// Are custom usernames enabled?
$custom_usernames = $queries->getWhere('settings', array('name', '=', 'displaynames'));
$custom_usernames = $custom_usernames[0]->value;
if (isset($_GET["uid"])) {
    $individual = $queries->getWhere("users", array("id", "=", $_GET["uid"]));
    if (count($individual)) {
        if ($custom_usernames == 'true') {
            $profile = ProfileUtils::getProfile($individual[0]->mcname);
        } else {
            $profile = ProfileUtils::getProfile($individual[0]->username);
        }
        if (!empty($profile)) {
            $result = $profile->getProfileAsArray();
            $queries->update("users", $individual[0]->id, array("uuid" => $result['uuid']));
        } else {
            Session::flash('adm-users', '<div class="alert alert-danger">  <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span></button>' . $admin_language['unable_to_update_uuid'] . '</div>');
            Redirect::to('/admin/users/?user='******'adm-users', '<div class="alert alert-info">  <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span></button>' . $admin_language['task_successful'] . '</div>');
    Redirect::to('/admin/users/?user=' . $individual[0]->id);
    die;
} else {
    // todo: sync all mcnames for cron job
示例#3
0
 } else {
     // Custom usernames are enabled
     $data['username'] = array('min' => 2, 'max' => 20);
     $data['mcname'] = array('min' => 2, 'max' => 20, 'isvalid' => true);
 }
 $validation = $validate->check($_POST, $data);
 // validate
 if ($validation->passed()) {
     $user = new User();
     // Get Minecraft UUID of user
     if ($allow_mcnames !== "false") {
         $mcname = Input::get('mcname');
         $profile = ProfileUtils::getProfile($mcname);
     } else {
         $mcname = Input::get('username');
         $profile = ProfileUtils::getProfile(Input::get('username'));
     }
     if (!empty($profile)) {
         $uuid = $profile->getProfileAsArray();
         $uuid = $uuid['uuid'];
         if (empty($uuid)) {
             $uuid = '';
         }
     } else {
         $uuid = '';
     }
     if ($uuid == '') {
         // Error getting UUID, display an error asking user to update manually
         $uuid_error = true;
     }
     // Hash password
示例#4
0
/* 
 *	Made by Samerton
 *  http://worldscapemc.co.uk
 *
 *  License: MIT
 */
require 'core/integration/uuid.php';
// Custom usernames?
$displaynames = $queries->getWhere("settings", array("name", "=", "displaynames"));
$displaynames = $displaynames[0]->value;
if (isset($_GET["uid"])) {
    $individual = $queries->getWhere("users", array("id", "=", $_GET["uid"]));
    if (count($individual)) {
        $uuid = $individual[0];
        $uuid = $uuid->uuid;
        $profile = ProfileUtils::getProfile($uuid);
        $result = $profile->getUsername();
        if (!empty($result)) {
            $queries->update("users", $individual[0]->id, array("mcname" => $result));
            if ($displaynames == "false") {
                $queries->update("users", $individual[0]->id, array("username" => $result));
            }
        }
    }
    Session::flash('adm-users', '<div class="alert alert-info">  <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span></button>' . $admin_language['task_successful'] . '</div>');
    Redirect::to('/admin/users/?user=' . $individual[0]->id);
    die;
} else {
    // todo: sync all mcnames for cron job
}
return true;
示例#5
0
         $mcname = htmlspecialchars(Input::get('mcname'));
     } else {
         // only validate Minecraft name
         $to_validation['username'] = array('required' => true, 'min' => 3, 'max' => 20, 'unique' => 'users');
         $mcname = htmlspecialchars(Input::get('username'));
     }
 }
 // Check to see if the Minecraft username was valid
 if (!isset($invalid_mcname)) {
     // Valid, continue with validation
     $validation = $validate->check($_POST, $to_validation);
     // Execute validation
     if ($validation->passed()) {
         if ($uuid_linking == '1') {
             if (!isset($mcname_result)) {
                 $profile = ProfileUtils::getProfile(str_replace(' ', '%20', $mcname));
                 $mcname_result = $profile->getProfileAsArray();
             }
             if (isset($mcname_result["uuid"]) && !empty($mcname_result['uuid'])) {
                 $uuid = $mcname_result['uuid'];
             } else {
                 $uuid = '';
             }
         } else {
             $uuid = '';
         }
         $user = new User();
         $ip = $user->getIP();
         if (filter_var($ip, FILTER_VALIDATE_IP)) {
             // Valid IP
         } else {
示例#6
0
// For UUID stuff
require 'core/includes/htmlpurifier/HTMLPurifier.standalone.php';
// HTMLPurifier
$profile_user = $queries->getWhere("users", array("username", "=", $profile));
// Is it their username?
if (!count($profile_user)) {
    // No..
    $profile_user = $queries->getWhere("users", array("mcname", "=", $profile));
    // Is it their Minecraft username?
    if (!count($profile_user)) {
        // No..
        $exists = false;
        $uuid = $queries->getWhere("uuid_cache", array("mcname", "=", $profile));
        // Get the UUID, maybe they haven't registered yet
        if (!count($uuid)) {
            $profile_utils = ProfileUtils::getProfile($profile);
            if (empty($profile)) {
                // Not a Minecraft user, end the page
                Redirect::to('/404.php');
                die;
            }
            // A valid Minecraft user..
            $result = $profile_utils->getProfileAsArray();
            $uuid = $result["uuid"];
            $mcname = htmlspecialchars($profile);
            // Cache the UUID so we don't have to keep looking it up via Mojang's servers
            try {
                $queries->create("uuid_cache", array('mcname' => $mcname, 'uuid' => $uuid));
            } catch (Exception $e) {
                die($e->getMessage());
            }
示例#7
0
						</tr>
					  </thead>
					  <tbody>
						<?php 
        foreach ($all_infractions as $infraction) {
            if ($infractions_plugin == "lb") {
                // Get username of staff
                if ($infraction["staff"] !== "CONSOLE") {
                    // Get username of staff from UUID
                    $staff_uuid = str_replace('-', '', $infraction["staff"]);
                    $infractions_query = $queries->getWhere('users', array('uuid', '=', htmlspecialchars($staff_uuid)));
                    if (empty($infractions_query)) {
                        $infractions_query = $queries->getWhere('uuid_cache', array('uuid', '=', htmlspecialchars($staff_uuid)));
                        if (empty($infractions_query)) {
                            require_once 'inc/integration/uuid.php';
                            $profile = ProfileUtils::getProfile($staff_uuid);
                            if (empty($profile)) {
                                echo 'Could not find that player';
                                die;
                            }
                            $result = $profile->getProfileAsArray();
                            $staff = htmlspecialchars($result["username"]);
                            $uuid = htmlspecialchars($staff_uuid);
                            try {
                                $queries->create("uuid_cache", array('mcname' => $staff, 'uuid' => $uuid));
                            } catch (Exception $e) {
                                die($e->getMessage());
                            }
                        }
                        $staff = $queries->getWhere('uuid_cache', array('uuid', '=', $staff_uuid));
                        $infraction["staff"] = $staff[0]->mcname;