- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi.php
More file actions
Latest commit
95 lines (83 loc) · 2.34 KB
/
Copy pathapi.php
File metadata and controls
95 lines (83 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
functionan_runboi($name,$i,$replace_empty_space=false,$max=30,$asci="_"){
$hidden_space = strlen($name);
$after_ascis = $max-$i+strlen($name);
$before_ascis = $i;
$full_length = $after_ascis+$before_ascis;
if($i > $full_length){
$i = $i-(explode(".",$i/$full_length."")[0]*$full_length)-1;
}
if($i < 1){
$i = $i-(explode(".",$i/$full_length."")[0]*$full_length)+$full_length-1;
}
$after_ascis = $max-$i+strlen($name);
$before_ascis = $i;
if($replace_empty_space){
$name = str_replace("", $asci, $name);
}
for ($n=0; $n <= $after_ascis; $n++) {
$name .= $asci;
}
for ($n=0; $n <= $before_ascis; $n++) {
$name = $asci.$name;
}
returnsubstr($name, $hidden_space, $max);
}
functionan_write($pos,$string,$asci="_"){
returnsubstr($string,0,$pos).$asci;
}
functionteamspeak_unescape($str){
returnstr_replace("\\/", "/",str_replace("\\p", "|",str_replace("\\s", "",str_replace("↵", "\n", $str))));
}
functionteamspeak_escape($str){
returnstr_replace("/", "\\/",str_replace("|", "\\p",str_replace("", "\\s",str_replace("\n", "↵", $str))));
}
functionget_teamspeak_param($name,$teamspeakreturn){
if(is_int($name)){
returnexplode("=",explode("",$teamspeakreturn)[$name])[1];
}
if(ctype_alpha($name)){
$value = null;
$args = explode("",$teamspeakreturn);
foreach ($argsas$arg) {
$keyval = explode("=",$arg);
if($keyval[0] == $name){
$value = $keyval[1];
break;
}
}
return$value;
}
else{
returnnull;
}
}
functionget_teamspeak_status($teamspeakreturn){
if(substr($teamspeakreturn, 0,6) == "\rerror"){
returnget_teamspeak_param(1,$teamspeakreturn);
}
else{
returnnull;
}
}
functionteamspeak_socket_init($clientquery_port=25639){
$socket = fsockopen("localhost", $clientquery_port);
echofgets($socket);
echofgets($socket);
echofgets($socket);
return$socket;
}
functionteamspeak_socket_send($socket,$command){
fputs($socket,$command."\n");
returnfgets($socket);
}
functionteamspeak_getname($socket) {
$tmp = teamspeak_socket_send($socket,"whoami");
echofgets($socket);
$clid = get_teamspeak_param(0,$tmp);
$tmp = teamspeak_socket_send($socket, "clientvariable clid=".$clid." client_nickname");
echofgets($socket);
$name = teamspeak_unescape(get_teamspeak_param(1,$tmp));
return$name;
}
?>