Infractions::bu_getInfraction PHP Method

bu_getInfraction() public method

Params: $type (string), either ban or mute; $id (string), UUID of infraction
public bu_getInfraction ( $type, $id )
    public function bu_getInfraction($type, $id)
    {
        if ($type === "ban" || $type === "temp_ban") {
            $results = $this->_db->get('bans', array("Banned", "=", $id))->results();
            if (count($results)) {
                return $results[0];
            }
        } else {
            if ($type === "mute" || $type === "temp_mute") {
                $results = $this->_db->get('mutes', array("Muted", "=", $id))->results();
                if (count($results)) {
                    return $results[0];
                }
            }
        }
        return false;
    }

Usage Example

Example #1
0
             // Get date of infraction
             $created = '<span rel="tooltip" data-placement="top" title="' . date('jS M Y, H:i', strtotime($infraction->time)) . '">' . $timeago->inWords(date('d M Y, H:i', strtotime($infraction->time)), $time_language) . '</span>';
             break;
         case 'mute':
             if ($infraction->time !== null) {
                 $expires = '<span class="label label-danger" rel="tooltip" data-trigger="hover" data-original-title="' . str_replace('{x}', date("jS M Y", strtotime($infraction->time)), $infractions_language['expires_x']) . '">' . $infractions_language['active'] . '</span>';
             } else {
                 $expires = '<span class="label label-danger">' . $infractions_language['permanent'] . '</span>';
             }
             break;
     }
     // Staff
     $staff = htmlspecialchars($infraction->banner);
     break;
 case 'bu':
     $infraction = $infractions->bu_getInfraction($_GET["type"], $_GET["id"]);
     // Get username
     if ($_GET['type'] == 'ban' || $_GET['type'] == 'temp_ban') {
         $uuid = str_replace('-', '', htmlspecialchars($infraction->Banned));
     } else {
         $uuid = str_replace('-', '', htmlspecialchars($infraction->Muted));
     }
     $infractions_query = $queries->getWhere('users', array('uuid', '=', $uuid));
     if (empty($infractions_query)) {
         $infractions_query = $queries->getWhere('uuid_cache', array('uuid', '=', $uuid));
         if (empty($infractions_query)) {
             $profile = ProfileUtils::getProfile($uuid);
             if (empty($profile)) {
                 echo 'Could not find that player';
                 die;
             } else {