getWhere("settings", array("name", "=", "infractions"));
if($infractions[0]->value == "false"){
Redirect::to('/');
die();
}
$infractions = new Infractions();
// Get the plugin in use
$infractions_plugin = $queries->getWhere("settings", array("name", "=", "infractions_plugin"));
$infractions_plugin = $infractions_plugin[0]->value;
if(isset($_GET['p'])){
if(!is_numeric($_GET['p'])){
Redirect::to("/infractions");
} else {
$p = $_GET['p'];
}
} else {
$p = 1;
}
?>
bat_getAllInfractions();
} else if($infractions_plugin == "bm"){
$all_infractions = $infractions->bm_getAllInfractions();
} else if($infractions_plugin == "mb"){
$all_infractions = $infractions->mb_getAllInfractions();
} else if($infractions_plugin == "lb"){
$all_infractions = $infractions->lb_getAllInfractions();
}
$paginate = PaginateArray($p);
$n = $paginate[0];
$f = $paginate[1];
if(count($all_infractions) > $f){
$d = $p * 10;
} else {
$d = count($all_infractions) - $n;
$d = $d + $n;
}
$sn = 1;
$fn = ceil(count($all_infractions) / 10);
if(count($all_infractions)){
?>
|
User |
Staff |
Action |
Reason |
Expires |
&id=">View |
getWhere('users', array('uuid', '=', $infraction["uuid"]));
if(empty($infractions_query)){
$infractions_query = $queries->getWhere('uuid_cache', array('uuid', '=', $infraction["uuid"]));
if(empty($infractions_query)){
require_once('inc/integration/uuid.php');
$profile = ProfileUtils::getProfile($infraction["uuid"]);
if(empty($profile)){
echo 'Could not find that player';
die();
}
$result = $profile->getProfileAsArray();
$mcname = htmlspecialchars($result["username"]);
$uuid = htmlspecialchars($infraction["uuid"]);
try {
$queries->create("uuid_cache", array(
'mcname' => $mcname,
'uuid' => $uuid
));
} catch(Exception $e){
die($e->getMessage());
}
}
$mcname = $queries->getWhere('uuid_cache', array('uuid', '=', $infraction["uuid"]));
echo '' . htmlspecialchars($mcname[0]->mcname) . '';
} else {
$mcname = $queries->getWhere('users', array('uuid', '=', $infraction["uuid"]));
echo '' . htmlspecialchars($mcname[0]->mcname) . '';
}
} else {
echo '' . $mcname . '';
}
?> |
">mb_getUsernameFromName($infraction["staff"]); }?>Console |
|
|
Unbanned'; } else if(isset($infraction["unmuted"])){ echo ' Unmuted'; }?> |
«';
} else {
echo '>
«';
}
while ($sn < ($fn + 1)) {
echo '
' . $sn . '';
$sn++;
}
echo '
»';
} else {
echo' class="disabled">»';
}
echo '
';
} else {
echo '
No infractions';
}
} else {
if(!isset($_GET["type"]) || !isset($_GET["id"])){
if($infractions_plugin != "mb" && !is_numeric($_GET["id"])){
Redirect::to('/infractions');
die();
}
}
if($_GET["type"] !== "ban" && $_GET["type"] !== "kick" && $_GET["type"] !== "mute" && $_GET["type"] !== "temp_ban" && $_GET["type"] !== "warning"){
Redirect::to('/infractions');
die();
}
// The following is different for each infractions plugin.
if($infractions_plugin == "bat"){
// BungeeAdminTools
$infraction = $infractions->bat_getInfraction($_GET["type"], $_GET["id"]);
// Get the username from the UUID - has the user registered on the website?
$infractions_query = $queries->getWhere('users', array('uuid', '=', $infraction[0]->UUID));
if(empty($infractions_query)){
// User hasn't registered on the website, check the cache
$infractions_query = $queries->getWhere('uuid_cache', array('uuid', '=', $infraction[0]->UUID));
if(empty($infractions_query)){
// Not in the cache, get it from Mojang's servers
require_once('inc/integration/uuid.php');
$profile = ProfileUtils::getProfile($infraction[0]->UUID);
if(empty($profile)){
// No return from Mojang's servers
echo 'Could not find that player';
die();
}
$result = $profile->getProfileAsArray();
$mcname = htmlspecialchars($result["username"]);
$uuid = htmlspecialchars($infraction[0]->UUID);
// Input into cache
try {
$queries->create("uuid_cache", array(
'mcname' => $mcname,
'uuid' => $uuid
));
} catch(Exception $e){
die($e->getMessage());
}
} else {
// User is in UUID cache
$mcname = $queries->getWhere('uuid_cache', array('uuid', '=', $infraction[0]->UUID));
$mcname = $mcname[0]->mcname;
}
} else {
// User has registered on the website, use the Minecraft username value
$mcname = $queries->getWhere('users', array('uuid', '=', $infraction[0]->UUID));
$mcname = $mcname[0]->mcname;
}
// Next, get some variables to display on the page. This depends on the type of infraction.
if($_GET["type"] == "ban" || $_GET["type"] == "temp_ban"){
// Ban
// Date of infraction
$start_date = date("jS M Y", strtotime($infraction[0]->ban_begin));
// End of infraction
if($infraction[0]->ban_end !== null){
$end_date = date("jS M Y", strtotime($infraction[0]->ban_end));
} else {
$end_date = 'Never';
}
// Reason
if($infraction[0]->ban_reason !== null){
$reason = htmlspecialchars($infraction[0]->ban_reason);
} else {
$reason = "Not set";
}
// Staff
$issued_by = htmlspecialchars($infraction[0]->ban_staff);
// Revoked?
if($infraction[0]->ban_unbandate !== null){
$revoked = "Yes, by
ban_unbanstaff) . "\">" . htmlspecialchars($infraction[0]->ban_unbanstaff) . " on " . date("jS M Y", strtotime($infraction[0]->ban_unbandate));
} else {
$revoked = "No";
}
} else if($_GET["type"] == "mute"){
// Mute
// Date of infraction
$start_date = date("jS M Y", strtotime($infraction[0]->mute_begin));
// End of infraction
if($infraction[0]->mute_end !== null){
$end_date = date("jS M Y", strtotime($infraction[0]->mute_end));
} else {
$end_date = 'Never';
}
// Reason
if($infraction[0]->mute_reason !== null){
$reason = htmlspecialchars($infraction[0]->mute_reason);
} else {
$reason = "Not set";
}
// Staff
$issued_by = htmlspecialchars($infraction[0]->mute_staff);
// Revoked?
if($infraction[0]->mute_unmutedate !== null){
$revoked = "Yes, by
mute_unmutestaff) . "\">" . htmlspecialchars($infraction[0]->mute_unmutestaff) . " on " . date("jS M Y", strtotime($infraction[0]->mute_unmutedate));
} else {
$revoked = "No";
}
} else if($_GET["type"] == "kick"){
// Kick
// Date of infraction
$start_date = date("jS M Y", strtotime($infraction[0]->kick_date));
// End of infraction
$end_date = 'n/a';
// Reason
if($infraction[0]->kick_reason !== null){
$reason = htmlspecialchars($infraction[0]->kick_reason);
} else {
$reason = 'Not set';
}
// Staff
$issued_by = htmlspecialchars($infraction[0]->kick_staff);
// Revoked?
$revoked = 'n/a';
}
} else if($infractions_plugin == "bm"){
// Ban Management
$infraction = $infractions->bm_getInfraction($_GET["type"], $_GET["id"]);
// First, get the username
$mcname = $infractions->bm_getUsernameFromID($infraction[0]->player_id);
// Date of infraction
$start_date = date("jS M Y", $infraction[0]->created);
// Reason
if($infraction[0]->reason !== null){
$reason = htmlspecialchars($infraction[0]->reason);
} else {
$reason = "Not set";
}
$revoked = "No";
$end_date = "n/a";
// Staff
if(isset($infraction[0]->pastActor_id)){
$issued_by = htmlspecialchars($infractions->bm_getUsernameFromID($infraction[0]->pastActor_id));
} else {
$issued_by = htmlspecialchars($infractions->bm_getUsernameFromID($infraction[0]->actor_id));
}
// Ban and mute specific:
if($_GET['type'] == "ban" || $_GET['type'] == "temp_ban" || $_GET['type'] == "mute"){
// End of infraction
if(isset($infraction[0]->expires)){
// Not expired yet, or is permanent
if($infraction[0]->expires != 0){
// Will expire
$end_date = date("jS M Y", $infraction[0]->expires);
} else {
// Permanent
$end_date = 'Never';
}
} else if(isset($infraction[0]->expired)){
// Expired or unbanned
if($infraction[0]->expired != 0){
// Has expired
$end_date = date("jS M Y", $infraction[0]->expired);
} else {
// Unbanned
$end_date = 'Never';
$revoked = 'Yes, on ' . date("jS M Y", $infraction[0]->created);
}
}
}
} else if($infractions_plugin == "mb"){
// MaxBans
$infraction = $infractions->mb_getInfraction($_GET["type"], $_GET["id"]);
$exploded = explode('.', $_GET["id"]);
$mcname = $exploded[0];
$time = $exploded[1];
if($_GET["type"] == "ban"){
$end_date = 'Never';
} else if($_GET["type"] == "mute" || $_GET["type"] == "temp_ban" || $_GET["type"] == "warning"){
if($infraction->expires != 0){
$end_date = date('jS M Y', $infraction->expires / 1000);
} else {
$end_date = 'Never';
}
}
if(isset($infraction->time)){
$start_date = date('jS M Y', $infraction->time / 1000);
} else {
$start_date = date('jS M Y', strtotime('-3 days', $infraction->expires / 1000));
}
// Reason
if($infraction->reason !== null){
$reason = htmlspecialchars($infraction->reason);
} else {
$reason = "Not set";
}
if($infraction->banner !== "console"){
$issued_by = $infractions->mb_getUsernameFromName($infraction->banner);
} else {
$issued_by = "console";
}
} else if($infractions_plugin == "lb"){
// LiteBans
$infraction = $infractions->lb_getInfraction($_GET["type"], $_GET["id"]);
$mcname = $infraction[1];
$infraction = $infraction[0];
if($_GET["type"] == "ban"){
$end_date = 'Never';
if($infraction->active == 0){
$unbanned = true;
}
} else if($_GET["type"] == "mute" || $_GET["type"] == "temp_ban" || $_GET["type"] == "warning"){
if($infraction->until != '-1'){
$end_date = date('jS M Y', $infraction->until / 1000);
} else {
$end_date = 'Never';
}
if($_GET["type"] == "mute"){
if($infraction->active == 0){
$unbanned = true;
}
}
}
$start_date = date('jS M Y', $infraction->time / 1000);
// Reason
if($infraction->reason !== null){
$reason = htmlspecialchars($infraction->reason);
} else {
$reason = "Not set";
}
if($infraction->banned_by_uuid !== "CONSOLE"){
// Get username of staff from UUID
$staff_uuid = str_replace('-', '', $infraction->banned_by_uuid);
$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));
$issued_by = $staff[0]->mcname;
} else {
$staff = $queries->getWhere('users', array('uuid', '=', $staff_uuid));
$issued_by = $staff[0]->mcname;
}
} else {
$issued_by = "console";
}
}
?>
Back
Player:
Infraction type: -
Revoked
Date of infraction:
Infraction ends:
Reason for infraction:
Issued by:
Console
Infraction revoked: