web/website/integrations/osticket/appeal.php
unimatrixgit 77cdf19faa Checkpoint Alpha 1.0.0.3 graphical menus and moderation evidence
Preserve the current Alpha source and artwork snapshot. See handoff/alpha-1.0.0.3 for actual deployed hashes, checks, staged follow-ups and the production pause. This checkpoint does not claim every source feature is deployed.
2026-11-02 00:05:34 +01:00

38 lines
9.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
require __DIR__.'/client.inc.php';
if(!$thisclient){header('Location: /dune-sso.php?appeal='.rawurlencode($_GET['banId']??''));exit;}
$identity=dune_ticket_identity();
if(!$identity){header('Location: /dune-sso.php');exit;}
header('Cache-Control: no-store');header("Content-Security-Policy: default-src 'self'; style-src 'self'; script-src 'self'; img-src 'self' data: https://www.dunerealms.com; connect-src 'self' https://www.dunerealms.com https://cp.dunerealms.com; frame-ancestors 'self' https://www.dunerealms.com https://cp.dunerealms.com; base-uri 'none'; form-action 'self'");
function esc($value){return htmlspecialchars((string)$value,ENT_QUOTES,'UTF-8');}
$banId=trim($_POST['banId']??$_GET['banId']??$_GET['ban_id']??'');$ban=null;$evidence=[];$error='';$record=null;
if($banId){$record=dune_bridge('ban',['sessionRef'=>$identity['sessionRef'],'banId'=>$banId,'operation'=>'lookup']);if($record&&isset($record['ban'])){$ban=$record['ban'];$evidence=$record['evidence']??[];}else $error='We could not find or verify that ban ID. Check the full ID in your ban message, or use Appeal on the public ban list.';}
$debugMode=!empty($ban['demo'])&&!empty($record['debugAllowed'])&&($_POST['debug']??$_GET['debug']??'')==='1';
if($_SERVER['REQUEST_METHOD']==='POST'){
$what=trim($_POST['whatHappened']??'');$why=trim($_POST['reviewReason']??'');$link=trim($_POST['evidenceLink']??'');
if(!$ban)$error='Find a valid ban record before submitting your appeal.';
elseif(!empty($ban['demo'])&&!$debugMode)$error='This demonstration record is a preview only. No support ticket or punishment is created.';
elseif(!empty($record['pendingTicketId'])){header('Location: /tickets.php?id='.(int)$record['pendingTicketId']);exit;}
elseif(!$record['live']&&!$debugMode)$error='The game ban list is temporarily unavailable. Your text is kept below; try again shortly.';
elseif(strlen($what)<20||strlen($what)>6000||strlen($why)<20||strlen($why)>6000)$error='Complete both appeal sections using 20–6000 characters each.';
elseif(empty($_POST['acknowledge']))$error='Confirm that you understand the appeal remains under review while the ban stays active.';
elseif($link&&(!filter_var($link,FILTER_VALIDATE_URL)||strtolower(parse_url($link,PHP_URL_SCHEME)??'')!=='https'||strlen($link)>2000||parse_url($link,PHP_URL_USER)))$error='Use a complete HTTPS link without a username or password.';
else{
$files=AttachmentFile::format($_FILES['evidence']??[])?:[];
if(count($files)>5)$error='Attach at most five files.';
foreach($files as$file){$mime=is_uploaded_file($file['tmp_name']??'')?mime_content_type($file['tmp_name']):'';if(($file['error']??0)||($file['size']??0)>5*1024*1024||!in_array($mime,['image/png','image/jpeg','image/webp','text/plain'],true)){$error='Use PNG, JPEG, WebP or plain text logs, up to 5 MB per file.';break;}}
if(!$error){
$summary="BAN APPEAL\nBan ID: ".$ban['id']."\nPlayer: ".$ban['player_name']."\nBanned by: ".$ban['banned_by']."\nScope: ".$ban['scope']."\nIssued: ".$ban['created_text']."\nExpires: ".$ban['expires_text']."\nRecorded reason: ".$ban['reason']."\n\nWHAT HAPPENED\n".$what."\n\nWHY THIS SHOULD BE REVIEWED\n".$why.($link?"\n\nSUPPORTING LINK\n".$link:'');
$message=nl2br(esc($summary));foreach(['BAN APPEAL','WHAT HAPPENED','WHY THIS SHOULD BE REVIEWED','SUPPORTING LINK']as$heading)$message=str_replace($heading,'<h3>'.$heading.'</h3>',$message);
$vars=['uid'=>$thisclient->getId(),'name'=>$identity['username'],'email'=>$identity['id'].'@accounts.dunerealms.invalid','topicId'=>2,'subject'=>($debugMode?'[DEBUG] Ban appeal · ':'Ban appeal · ').$ban['id'].' · '.$ban['player_name'],'message'=>$message,'source'=>'Web','ip'=>$_SERVER['REMOTE_ADDR'],'files'=>$files,'autorespond'=>false];
$createErrors=[];$ticket=Ticket::create($vars,$createErrors,'API',false,false);
if(!$ticket)$error='The appeal could not be saved. Check the information below and try again. Your appeal text has been kept.';
else{
$attached=dune_bridge('ban',['sessionRef'=>$identity['sessionRef'],'banId'=>$ban['id'],'operation'=>'attach','ticketId'=>$ticket->getId(),'debug'=>$debugMode]);
if(!$attached||empty($attached['ok']))$ticket->postNote(['title'=>'Ban association requires review','note'=>'Ban ID '.$ban['id'].' is preserved in the appeal. Automatic association was not confirmed; staff must verify it.'],false);
header('Location: /tickets.php?id='.$ticket->getId());exit;
}
}
}
}
?><!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Appeal a ban · DuneRealms</title><link rel="stylesheet" href="/appeal.css"><link rel="stylesheet" href="/dune-ticket-compose.css?v=3"><script src="/appeal.js" defer></script></head><body><main><?php require_once __DIR__.'/ticket-topic-menu.php'; dune_support_topic_menu('appeal'); ?><div class="title"><div><div class="crumb">Support / Ban appeals</div><h1>Appeal a ban</h1><p>Ask staff to review a ban. A linked Minecraft account is not required.</p></div><div class="steps"><span><b>01</b> Find your ban</span><span><b>02</b> Review the record</span><span><b>03</b> Send your appeal</span></div></div><?php if($error):?><div class="error-example" role="alert"><strong>Unable to continue:</strong> <?=esc($error)?></div><?php endif;?><div class="layout"><section class="card"><h2>Find your ban</h2><form method="get" class="lookup"><label>Ban ID <input name="banId" value="<?=esc($banId)?>" maxlength="36" required placeholder="Paste the full ban ID"></label><button type="submit">Find ban</button></form><p class="hint">Find this ID in your ban message or use “Appeal” on the public ban list.</p><?php if($ban):?><div class="rule"></div><div class="banhead"><div class="avatar" aria-label="Player avatar placeholder"></div><div><span class="banid"><?=esc($ban['id'])?></span><h3><?=esc($ban['player_name'])?></h3></div><span class="badge"><?=!empty($ban['demo'])?'DEMONSTRATION':(!empty($ban['active'])?'ACTIVE BAN':'BAN HISTORY')?></span></div><div class="tabs"><button class="active" type="button" data-tab="details">Ban details</button><button type="button" data-tab="evidence">Evidence · <?=count($evidence)?></button></div><div id="details"><div class="facts"><?php foreach(['Banned by'=>$ban['banned_by'],'Minecraft UUID'=>$ban['minecraft_uuid'],'Scope'=>$ban['scope'],'Issued'=>$ban['created_text'],'Ends'=>$ban['expires_text']]as$label=>$value):?><div class="fact"><small><?=esc($label)?></small><strong><?=esc($value)?></strong></div><?php endforeach;?></div><div class="reason"><b>Recorded reason</b><p><?=esc($ban['reason'])?></p></div><div class="notice">An appeal does not remove the ban while staff review it. Your ban ID and the ban record are attached automatically.</div></div><div id="evidence" class="evidence" hidden><?php foreach($evidence as$item):?><article><strong><?=esc($item['label'])?></strong><p><?=esc($item['kind'])?> · available to authorised staff</p></article><?php endforeach;?><?php if(!$evidence):?><p>No evidence has been shared with this view. Staff can review evidence attached to the same ban record.</p><?php endif;?></div><?php else:?><div class="notice">Enter a ban ID to load the player, reason, staff member, duration and server. No ban information is guessed.</div><?php endif;?></section><section class="card appeal"><h2>Your appeal</h2><p class="intro">Private to you and authorised support staff. Be clear and include the information staff need to review the decision.</p><?php if(!empty($record['pendingTicketId'])):?><div class="notice">You already have an appeal under review. <a href="/tickets.php?id=<?=(int)$record['pendingTicketId']?>">Open your existing appeal</a>.</div><?php else:?><?php if($debugMode):?><div class="notice"><strong>Staff debugging mode:</strong> This creates a private, clearly labelled test appeal for DemoPlayer. It does not change any Minecraft ban.</div><?php endif;?><form method="post" enctype="multipart/form-data"><?php if($debugMode):?><input type="hidden" name="debug" value="1"><?php endif;?><?php csrf_token();?><input type="hidden" name="banId" value="<?=esc($banId)?>"><label>What happened?<textarea name="whatHappened" minlength="20" maxlength="6000" required placeholder="Explain the situation in your own words."><?=esc($_POST['whatHappened']??($debugMode?'Staff-created debug appeal to verify the DemoPlayer ticket and ban association.':''))?></textarea></label><label>Why should this ban be reviewed?<textarea name="reviewReason" minlength="20" maxlength="6000" required placeholder="Describe a mistake, missing context, or why the decision should be reconsidered."><?=esc($_POST['reviewReason']??($debugMode?'Verify that this test ticket appears in the pending appeal register with the correct demonstration ban ID.':''))?></textarea></label><label>Supporting evidence · optional<input name="evidence[]" type="file" accept=".png,.jpg,.jpeg,.webp,.txt,.log" multiple></label><p class="hint">Images and text logs · up to five files, 5 MB each.</p><label>Evidence link · optional<input name="evidenceLink" type="url" maxlength="2000" placeholder="https://" value="<?=esc($_POST['evidenceLink']??'')?>"></label><label class="check"><input name="acknowledge" value="1" type="checkbox" required <?=isset($_POST['acknowledge'])?'checked':''?>>I understand this creates a private appeal linked to the ban above, and that the ban stays in place until staff approve it.</label><div class="actions"><button type="submit" <?=(!$ban||(!empty($ban['demo'])&&!$debugMode))?'disabled':''?>>Submit ban appeal</button><a href="https://www.dunerealms.com/#home-bans">Return to ban list</a></div></form><?php endif;?><p class="privacy">After submission, follow replies and the decision under My tickets. No payment or donation is needed to appeal.</p></section></div></main></body></html>