Advertisement
Guest User

Untitled

a guest
Mar 6th, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.02 KB | None | 0 0
  1.     public function banInfo($user){
  2.                                      echo "<h3>Received Infractions</h3>
  3.                                 <table class='table table-bordered table-striped'>
  4.                                    <thead>
  5.                                       <tr>
  6.                                          <th width='10%'>Issuer</th>
  7.                                          <th width='10%'>Punished</th>
  8.                                          <th width='34%'>Reason</th>
  9.                                          <th width='3%'>Type</th>
  10.                                          <th width='10%'>Status</th>
  11.                                          <th width='9%'>Expires</th>
  12.                                          <th width='15%'>Date</th>
  13.                                       </tr>
  14.                                    </thead>
  15.                                    <tbody>
  16.                                       <tr class=''>";
  17.                                 $stmt = $db->query("SELECT * FROM `infractions` WHERE issuer = '$user'");
  18.                                 $banned_count = $stmt->rowCount();
  19.                                 if($banned_count==0){echo "<h5>$user has not received any punishments.</h5>";}
  20.                                 else {
  21.                                  foreach($db->query("SELECT * FROM `infractions` WHERE receiver = '$user'") as $infraction) {
  22.                                  echo "<td><a href='/profiles/".$infraction['issuer']."' style='color: #F55'>".$infraction['issuer']."</a></td>
  23.                                 <td><a href='/profiles/".$infraction['receiver']."'>".$infraction['receiver']."</a></td>
  24.                                 <td>".$infraction['reason']."</td>
  25.                                 <td style='color:";
  26.                                  if($infraction['type']=="ban"){echo "red";}
  27.                                  elseif($infraction['type']=="tempban"){echo "orange";}
  28.                                  elseif($infraction['type']=="kick"){echo "yellow";}
  29.                                  elseif($infraction['type']=="mute"){echo "blue";}
  30.                                  echo "'>";
  31.                                  if($infraction['type']=="ban"){echo "Ban";}
  32.                                  elseif($infraction['type']=="tempban"){echo "Tempban";}
  33.                                  elseif($infraction['type']=="kick"){echo "Kick";}
  34.                                  elseif($infraction['type']=="mute"){echo "Mute";}
  35.                                  echo "</td><td><span class='label label-";
  36.                                  if($infraction['appstatus']=="0"){echo "default";}
  37.                                  elseif($infraction['appstatus']=="1"){echo "default";}
  38.                                  elseif($infraction['appstatus']=="2"){echo "primary";}
  39.                                  elseif($infraction['appstatus']=="3"){echo "success";}
  40.                                  elseif($infraction['appstatus']=="4"){echo "danger";}
  41.                                  echo "'>";
  42.                                  if($infraction['appstatus']=="0"){echo "N/A";}
  43.                                  elseif($infraction['appstatus']=="1"){echo "Not Appealed";}
  44.                                  elseif($infraction['appstatus']=="2"){echo "Appeal Pending";}
  45.                                  elseif($infraction['appstatus']=="3"){echo "Appeal Rejected";}
  46.                                  elseif($infraction['appstatus']=="4"){echo "Appeal Accepted";}
  47.                                 echo "<td>";
  48.                                 $tlns = $infraction['timeleft'];
  49.                                 $now = new DateTime();
  50.                                 $future_date = new DateTime($tlns);
  51.                                 $interval = $future_date->diff($now);
  52.                                 $fin = $interval->format("%dd %hh %im %ss");
  53.                                 if($infraction['timeleft']==null){echo '<span class="label label-danger">Never</span>';}
  54.                                 if (time() > strtotime($tlns)) {
  55.                                     echo '<span class="label label-success">';
  56.                                     echo 'Expired';
  57.                                     echo '</span>';
  58.                                 } else {
  59.                                     echo '<span class="label label-warning">';
  60.                                     echo $fin;
  61.                                     echo '</span>';
  62.                                 }
  63.                                 echo "</td>";
  64.                               echo "<td>";
  65.                                 $ot = new DateTime(''.$infraction['date'].'');
  66.                                 $id = strtotime('$ot');
  67.                                 $od = strtotime($infraction['date']);
  68.                                 $nowst = strtotime("now");
  69.                                 $rt = time()-$od;
  70.                                 $hd = date_format($ot, 'F d, Y g:iA');
  71.                                 function relativedate($secs) {
  72.                                     $second = 1;
  73.                                     $minute = 60;
  74.                                     $hour = 60*60;
  75.                                     $day = 60*60*24;
  76.                                     $week = 60*60*24*7;
  77.                                     $month = 60*60*24*7*30;
  78.                                     $year = 60*60*24*7*30*365;
  79.                                    
  80.                                     if ($secs <= 0) { $output = "Just now";
  81.                                     }elseif ($secs > $second && $secs < $minute) { $output = round($secs/$second)." second";
  82.                                     }elseif ($secs >= $minute && $secs < $hour) { $output = round($secs/$minute)." minute";
  83.                                     }elseif ($secs >= $hour && $secs < $day) { $output = round($secs/$hour)." hour";
  84.                                     }elseif ($secs >= $day && $secs < $week) { $output = round($secs/$day)." day";
  85.                                     }elseif ($secs >= $week && $secs < $month) { $output = round($secs/$week)." week";
  86.                                     }elseif ($secs >= $month && $secs < $year) { $output = round($secs/$month)." month";
  87.                                     }else{ $output = " over a year ago"; }
  88.                                    
  89.                                     if ($output <> "now"){
  90.                                         $output = (substr($output,0,2)<>"1 ") ? $output."s" : $output;
  91.                                     }
  92.                                     return $output;
  93.                                 }
  94.                             echo "<a href='#' data-toggle='tooltip' class='tip' title='".$hd."'>";
  95.                             echo relativedate($rt);
  96.                             echo " ago";
  97.                             echo "</a>";
  98.                             }
  99.                         }
  100.                                        echo "</tr>
  101.                                    </tbody>
  102.                                 </table>";
  103.                                  echo " <h3>Issued Infractions</h3>
  104.                                 <table class='table table-bordered table-striped'>
  105.                                    <thead>
  106.                                       <tr>
  107.                                          <th width='10%'>Issuer</th>
  108.                                          <th width='10%'>Punished</th>
  109.                                          <th width='34%'>Reason</th>
  110.                                          <th width='3%'>Type</th>
  111.                                          <th width='10%'>Status</th>
  112.                                          <th width='9%'>Expires</th>
  113.                                          <th width='15%'>Date</th>
  114.                                       </tr>
  115.                                    </thead>
  116.                                    <tbody>
  117.                                       <tr class=''>";
  118.                             $stmt = $db->query("SELECT * FROM `infractions` WHERE issuer = '$user'");
  119.                             $banned_count = $stmt->rowCount();
  120.                             if($banned_count==0){echo "<h5>$user has not issued any punishments.</h5>";}
  121.                             else{
  122.                                  foreach($db->query("SELECT * FROM `infractions` WHERE issuer = '$user'") as $infraction) {
  123.                                  echo "<td><a href='/profiles/".$infraction['issuer']."' style='color: #F55'>".$infraction['issuer']."</a></td>
  124.                                 <td><a href='/profiles/".$infraction['receiver']."'>".$infraction['receiver']."</a></td>
  125.                                 <td>".$infraction['reason']."</td>
  126.                                 <td style='color:";
  127.                                  if($infraction['type']=="ban"){echo "red";}
  128.                                  elseif($infraction['type']=="tempban"){echo "orange";}
  129.                                  elseif($infraction['type']=="kick"){echo "yellow";}
  130.                                  elseif($infraction['type']=="mute"){echo "blue";}
  131.                                  echo "'>";
  132.                                  if($infraction['type']=="ban"){echo "Ban";}
  133.                                  elseif($infraction['type']=="tempban"){echo "Tempban";}
  134.                                  elseif($infraction['type']=="kick"){echo "Kick";}
  135.                                  elseif($infraction['type']=="mute"){echo "Mute";}
  136.                                  echo "</td><td><span class='label label-";
  137.                                  if($infraction['appstatus']=="0"){echo "default";}
  138.                                  elseif($infraction['appstatus']=="1"){echo "default";}
  139.                                  elseif($infraction['appstatus']=="2"){echo "primary";}
  140.                                  elseif($infraction['appstatus']=="3"){echo "success";}
  141.                                  elseif($infraction['appstatus']=="4"){echo "danger";}
  142.                                  echo "'>";
  143.                                  if($infraction['appstatus']=="0"){echo "N/A";}
  144.                                  elseif($infraction['appstatus']=="1"){echo "Not Appealed";}
  145.                                  elseif($infraction['appstatus']=="2"){echo "Appeal Pending";}
  146.                                  elseif($infraction['appstatus']=="3"){echo "Appeal Rejected";}
  147.                                  elseif($infraction['appstatus']=="4"){echo "Appeal Accepted";}
  148.                                 echo "<td>";
  149.                                 $tlns = $infraction['timeleft'];
  150.                                 $now = new DateTime();
  151.                                 $future_date = new DateTime($tlns);
  152.                                 $interval = $future_date->diff($now);
  153.                                 $fin = $interval->format("%dd %hh %im %ss");
  154.                                 if($infraction['type'] == "mute" || "temp-ban") {echo '<span class="label label-default">N/A</span>';}
  155.                                 else {
  156.                                     if($infraction['timeleft']==null){echo '<span class="label label-danger">Never</span>';}
  157.                                     else {
  158.                                         if (time() > strtotime($tlns)) {
  159.                                             echo '<span class="label label-success">';
  160.                                             echo 'Expired';
  161.                                             echo '</span>';
  162.                                         } else {
  163.                                             echo '<span class="label label-warning">';
  164.                                             echo $fin;
  165.                                             echo '</span>';
  166.                                             echo "<br>Remaining";
  167.                                         }
  168.                                     }
  169.                                 }  
  170.                                 echo "</td>";
  171.                               echo "<td>";
  172.                                 $ot = new DateTime(''.$infraction['date'].'');
  173.                                 $id = strtotime('$ot');
  174.                                 $od = strtotime($infraction['date']);
  175.                                 $nowst = strtotime("now");
  176.                                 $rt = time()-$od;
  177.                                 $hd = date_format($ot, 'F d, Y g:iA');
  178.                             echo "<a href='#' data-toggle='tooltip' class='tip' title='".$hd."'>";
  179.                             echo relativedate($rt);
  180.                             echo " ago";
  181.                             echo "</a>";
  182.                             }
  183.                         }
  184.                              echo"</td>
  185.                                       </tr>
  186.                                    </tbody>
  187.                                 </table>";
  188.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement