40 public static function bytes($bytes)
42 $kbytes = sprintf(
"%.02f", $bytes/1024);
43 $mbytes = sprintf(
"%.02f", $kbytes/1024);
44 $gbytes = sprintf(
"%.02f", $mbytes/1024);
45 $tbytes = sprintf(
"%.02f", $gbytes/1024);
48 return $tbytes .
" TB";
50 return $gbytes .
" GB";
52 return $mbytes .
" MB";
54 return $kbytes .
" KB";
67 public static function seconds($seconds, $is_ms = FALSE, $format =
"%dD %02d:%02d:%02d")
69 if($is_ms) $seconds = $seconds/1000;
71 return sprintf($format, $seconds/60/60/24, ($seconds/60/60)%24, ($seconds/60)%60, $seconds%60);
80 public static function codec($codec)
83 return "Speex Narrowband (8 kHz)";
85 return "Speex Wideband (16 kHz)";
87 return "Speex Ultra-Wideband (32 kHz)";
89 return "CELT Mono (48 kHz)";
107 return "ServerQuery";
121 return "Server Group";
127 return "Channel Group";
129 return "Channel Client";
145 return "Global / Information";
147 return "Global / Virtual Server Management";
149 return "Global / Administration";
151 return "Global / Settings";
153 return "Virtual Server";
155 return "Virtual Server / Information";
157 return "Virtual Server / Administration";
159 return "Virtual Server / Settings";
163 return "Channel / Information";
165 return "Channel / Create";
167 return "Channel / Modify";
169 return "Channel / Delete";
171 return "Channel / Access";
175 return "Group / Information";
177 return "Group / Create";
179 return "Group / Modify";
181 return "Group / Delete";
185 return "Client / Information";
187 return "Client / Admin";
189 return "Client / Basics";
191 return "Client / Modify";
193 return "File Transfer";
208 if(is_numeric($level))
225 if(strtoupper($level) ==
"CRITICAL")
227 if(strtoupper($level) ==
"ERROR")
229 if(strtoupper($level) ==
"DEBUG")
231 if(strtoupper($level) ==
"WARNING")
233 if(strtoupper($level) ==
"INFO")
248 $parts = explode(
"|", $entry, 5);
251 if(count($parts) != 5)
253 $array[
"timestamp"] = 0;
255 $array[
"channel"] =
"ParamParser";
256 $array[
"server_id"] =
"";
258 $array[
"msg_plain"] = $entry;
259 $array[
"malformed"] = TRUE;
263 $array[
"timestamp"] = strtotime(trim($parts[0]));
264 $array[
"level"] = self::logLevel(trim($parts[1]));
265 $array[
"channel"] = trim($parts[2]);
266 $array[
"server_id"] = trim($parts[3]);
268 $array[
"msg_plain"] = $entry;
269 $array[
"malformed"] = FALSE;
283 return base64_encode(sha1($plain, TRUE));
293 public static function version($version, $format =
"Y-m-d h:i:s")
297 $version =
new TeamSpeak3_Helper_String($version);
300 $buildno = $version->section(
"[", 1)->filterDigits()->toInt();
302 return ($buildno <= 15001) ? $version : $version->section(
"[")->append(
"(" . date($format, $buildno) .
")");
313 if(!preg_match(
'/\A(?:(\xff\xd8\xff)|(GIF8[79]a)|(\x89PNG\x0d\x0a)|(BM)|(\x49\x49(\x2a\x00|\x00\x4a))|(FORM.{4}ILBM))/', $binary, $matches))
315 return "application/octet-stream";
322 4 =>
"image/x-windows-bmp",
327 return $type[count($matches)-1];