Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function banInfo($user){
- echo "<h3>Received Infractions</h3>
- <table class='table table-bordered table-striped'>
- <thead>
- <tr>
- <th width='10%'>Issuer</th>
- <th width='10%'>Punished</th>
- <th width='34%'>Reason</th>
- <th width='3%'>Type</th>
- <th width='10%'>Status</th>
- <th width='9%'>Expires</th>
- <th width='15%'>Date</th>
- </tr>
- </thead>
- <tbody>
- <tr class=''>";
- $stmt = $db->query("SELECT * FROM `infractions` WHERE issuer = '$user'");
- $banned_count = $stmt->rowCount();
- if($banned_count==0){echo "<h5>$user has not received any punishments.</h5>";}
- else {
- foreach($db->query("SELECT * FROM `infractions` WHERE receiver = '$user'") as $infraction) {
- echo "<td><a href='/profiles/".$infraction['issuer']."' style='color: #F55'>".$infraction['issuer']."</a></td>
- <td><a href='/profiles/".$infraction['receiver']."'>".$infraction['receiver']."</a></td>
- <td>".$infraction['reason']."</td>
- <td style='color:";
- if($infraction['type']=="ban"){echo "red";}
- elseif($infraction['type']=="tempban"){echo "orange";}
- elseif($infraction['type']=="kick"){echo "yellow";}
- elseif($infraction['type']=="mute"){echo "blue";}
- echo "'>";
- if($infraction['type']=="ban"){echo "Ban";}
- elseif($infraction['type']=="tempban"){echo "Tempban";}
- elseif($infraction['type']=="kick"){echo "Kick";}
- elseif($infraction['type']=="mute"){echo "Mute";}
- echo "</td><td><span class='label label-";
- if($infraction['appstatus']=="0"){echo "default";}
- elseif($infraction['appstatus']=="1"){echo "default";}
- elseif($infraction['appstatus']=="2"){echo "primary";}
- elseif($infraction['appstatus']=="3"){echo "success";}
- elseif($infraction['appstatus']=="4"){echo "danger";}
- echo "'>";
- if($infraction['appstatus']=="0"){echo "N/A";}
- elseif($infraction['appstatus']=="1"){echo "Not Appealed";}
- elseif($infraction['appstatus']=="2"){echo "Appeal Pending";}
- elseif($infraction['appstatus']=="3"){echo "Appeal Rejected";}
- elseif($infraction['appstatus']=="4"){echo "Appeal Accepted";}
- echo "<td>";
- $tlns = $infraction['timeleft'];
- $now = new DateTime();
- $future_date = new DateTime($tlns);
- $interval = $future_date->diff($now);
- $fin = $interval->format("%dd %hh %im %ss");
- if($infraction['timeleft']==null){echo '<span class="label label-danger">Never</span>';}
- if (time() > strtotime($tlns)) {
- echo '<span class="label label-success">';
- echo 'Expired';
- echo '</span>';
- } else {
- echo '<span class="label label-warning">';
- echo $fin;
- echo '</span>';
- }
- echo "</td>";
- echo "<td>";
- $ot = new DateTime(''.$infraction['date'].'');
- $id = strtotime('$ot');
- $od = strtotime($infraction['date']);
- $nowst = strtotime("now");
- $rt = time()-$od;
- $hd = date_format($ot, 'F d, Y g:iA');
- function relativedate($secs) {
- $second = 1;
- $minute = 60;
- $hour = 60*60;
- $day = 60*60*24;
- $week = 60*60*24*7;
- $month = 60*60*24*7*30;
- $year = 60*60*24*7*30*365;
- if ($secs <= 0) { $output = "Just now";
- }elseif ($secs > $second && $secs < $minute) { $output = round($secs/$second)." second";
- }elseif ($secs >= $minute && $secs < $hour) { $output = round($secs/$minute)." minute";
- }elseif ($secs >= $hour && $secs < $day) { $output = round($secs/$hour)." hour";
- }elseif ($secs >= $day && $secs < $week) { $output = round($secs/$day)." day";
- }elseif ($secs >= $week && $secs < $month) { $output = round($secs/$week)." week";
- }elseif ($secs >= $month && $secs < $year) { $output = round($secs/$month)." month";
- }else{ $output = " over a year ago"; }
- if ($output <> "now"){
- $output = (substr($output,0,2)<>"1 ") ? $output."s" : $output;
- }
- return $output;
- }
- echo "<a href='#' data-toggle='tooltip' class='tip' title='".$hd."'>";
- echo relativedate($rt);
- echo " ago";
- echo "</a>";
- }
- }
- echo "</tr>
- </tbody>
- </table>";
- echo " <h3>Issued Infractions</h3>
- <table class='table table-bordered table-striped'>
- <thead>
- <tr>
- <th width='10%'>Issuer</th>
- <th width='10%'>Punished</th>
- <th width='34%'>Reason</th>
- <th width='3%'>Type</th>
- <th width='10%'>Status</th>
- <th width='9%'>Expires</th>
- <th width='15%'>Date</th>
- </tr>
- </thead>
- <tbody>
- <tr class=''>";
- $stmt = $db->query("SELECT * FROM `infractions` WHERE issuer = '$user'");
- $banned_count = $stmt->rowCount();
- if($banned_count==0){echo "<h5>$user has not issued any punishments.</h5>";}
- else{
- foreach($db->query("SELECT * FROM `infractions` WHERE issuer = '$user'") as $infraction) {
- echo "<td><a href='/profiles/".$infraction['issuer']."' style='color: #F55'>".$infraction['issuer']."</a></td>
- <td><a href='/profiles/".$infraction['receiver']."'>".$infraction['receiver']."</a></td>
- <td>".$infraction['reason']."</td>
- <td style='color:";
- if($infraction['type']=="ban"){echo "red";}
- elseif($infraction['type']=="tempban"){echo "orange";}
- elseif($infraction['type']=="kick"){echo "yellow";}
- elseif($infraction['type']=="mute"){echo "blue";}
- echo "'>";
- if($infraction['type']=="ban"){echo "Ban";}
- elseif($infraction['type']=="tempban"){echo "Tempban";}
- elseif($infraction['type']=="kick"){echo "Kick";}
- elseif($infraction['type']=="mute"){echo "Mute";}
- echo "</td><td><span class='label label-";
- if($infraction['appstatus']=="0"){echo "default";}
- elseif($infraction['appstatus']=="1"){echo "default";}
- elseif($infraction['appstatus']=="2"){echo "primary";}
- elseif($infraction['appstatus']=="3"){echo "success";}
- elseif($infraction['appstatus']=="4"){echo "danger";}
- echo "'>";
- if($infraction['appstatus']=="0"){echo "N/A";}
- elseif($infraction['appstatus']=="1"){echo "Not Appealed";}
- elseif($infraction['appstatus']=="2"){echo "Appeal Pending";}
- elseif($infraction['appstatus']=="3"){echo "Appeal Rejected";}
- elseif($infraction['appstatus']=="4"){echo "Appeal Accepted";}
- echo "<td>";
- $tlns = $infraction['timeleft'];
- $now = new DateTime();
- $future_date = new DateTime($tlns);
- $interval = $future_date->diff($now);
- $fin = $interval->format("%dd %hh %im %ss");
- if($infraction['type'] == "mute" || "temp-ban") {echo '<span class="label label-default">N/A</span>';}
- else {
- if($infraction['timeleft']==null){echo '<span class="label label-danger">Never</span>';}
- else {
- if (time() > strtotime($tlns)) {
- echo '<span class="label label-success">';
- echo 'Expired';
- echo '</span>';
- } else {
- echo '<span class="label label-warning">';
- echo $fin;
- echo '</span>';
- echo "<br>Remaining";
- }
- }
- }
- echo "</td>";
- echo "<td>";
- $ot = new DateTime(''.$infraction['date'].'');
- $id = strtotime('$ot');
- $od = strtotime($infraction['date']);
- $nowst = strtotime("now");
- $rt = time()-$od;
- $hd = date_format($ot, 'F d, Y g:iA');
- echo "<a href='#' data-toggle='tooltip' class='tip' title='".$hd."'>";
- echo relativedate($rt);
- echo " ago";
- echo "</a>";
- }
- }
- echo"</td>
- </tr>
- </tbody>
- </table>";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement