'year', 2592000 => 'month', 604800 => 'week', 86400 => 'day', 3600 => 'hour', 60 => 'minute', ]; foreach ($timeunits as $unit => $text) { if ($time < $unit) continue; $numunits = floor($time / $unit); return ' '.$numunits.' '.$text.(($numunits > 1) ? 's' : ''); } } function humanfilesize($size, $unit="") { if ((!$unit && $size >= 1 << 30) || $unit == "GB") return number_format($size / (1 << 30),2)."GB"; if ((!$unit && $size >= 1 << 20) || $unit == "MB") return number_format($size / (1 << 20),2)."MB"; if ((!$unit && $size >= 1 << 10) || $unit == "KB") return number_format($size / (1 << 10),2)."KB"; return number_format($size)." bytes"; } function toupperpurity($str) { if ($str == "sfw") return strtoupper($str); if ($str == "sketchy") return ucfirst($str); if ($str == "nsfw") return strtoupper($str); return $str; } ?>