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";
85 return "Speex Wideband";
87 return "Speex Ultra-Wideband";
111 return "ServerQuery";
125 return "Server Group";
131 return "Channel Group";
133 return "Channel Client";
149 return "Global / Information";
151 return "Global / Virtual Server Management";
153 return "Global / Administration";
155 return "Global / Settings";
157 return "Virtual Server";
159 return "Virtual Server / Information";
161 return "Virtual Server / Administration";
163 return "Virtual Server / Settings";
167 return "Channel / Information";
169 return "Channel / Create";
171 return "Channel / Modify";
173 return "Channel / Delete";
175 return "Channel / Access";
179 return "Group / Information";
181 return "Group / Create";
183 return "Group / Modify";
185 return "Group / Delete";
189 return "Client / Information";
191 return "Client / Admin";
193 return "Client / Basics";
195 return "Client / Modify";
197 return "File Transfer";
212 if(is_numeric($level))
229 if(strtoupper($level) ==
"CRITICAL")
231 if(strtoupper($level) ==
"ERROR")
233 if(strtoupper($level) ==
"DEBUG")
235 if(strtoupper($level) ==
"WARNING")
237 if(strtoupper($level) ==
"INFO")
252 $parts = explode(
"|", $entry, 5);
255 if(count($parts) != 5)
257 $array[
"timestamp"] = 0;
259 $array[
"channel"] =
"ParamParser";
260 $array[
"server_id"] =
"";
262 $array[
"msg_plain"] = $entry;
263 $array[
"malformed"] = TRUE;
267 $array[
"timestamp"] = strtotime(trim($parts[0]));
268 $array[
"level"] = self::logLevel(trim($parts[1]));
269 $array[
"channel"] = trim($parts[2]);
270 $array[
"server_id"] = trim($parts[3]);
272 $array[
"msg_plain"] = $entry;
273 $array[
"malformed"] = FALSE;
287 return base64_encode(sha1($plain, TRUE));
297 public static function version($version, $format =
"Y-m-d h:i:s")
301 $version =
new TeamSpeak3_Helper_String($version);
304 $buildno = $version->section(
"[", 1)->filterDigits()->toInt();
306 return ($buildno <= 15001) ? $version : $version->section(
"[")->append(
"(" . date($format, $buildno) .
")");
319 $version =
new TeamSpeak3_Helper_String($version);
322 return $version->section(
" ", 0);
333 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))
335 return "application/octet-stream";
342 4 =>
"image/x-windows-bmp",
347 return $type[count($matches)-1];