├── bannerBot
├── libraries
│ ├── Nuevo documento de texto.txt
│ └── TeamSpeak3
│ │ ├── Helper
│ │ ├── String.php
│ │ ├── Exception.php
│ │ ├── Signal
│ │ │ ├── Exception.php
│ │ │ ├── Handler.php
│ │ │ └── Interface.php
│ │ ├── Profiler
│ │ │ ├── Exception.php
│ │ │ └── Timer.php
│ │ ├── Profiler.php
│ │ ├── Signal.php
│ │ ├── Char.php
│ │ └── Convert.php
│ │ ├── Node
│ │ ├── Exception.php
│ │ ├── Channelgroup.php
│ │ ├── Servergroup.php
│ │ └── Client.php
│ │ ├── Transport
│ │ ├── Exception.php
│ │ ├── UDP.php
│ │ ├── TCP.php
│ │ └── Abstract.php
│ │ ├── Adapter
│ │ ├── TSDNS
│ │ │ └── Exception.php
│ │ ├── Update
│ │ │ └── Exception.php
│ │ ├── Blacklist
│ │ │ └── Exception.php
│ │ ├── ServerQuery
│ │ │ ├── Exception.php
│ │ │ ├── Event.php
│ │ │ └── Reply.php
│ │ ├── FileTransfer
│ │ │ └── Exception.php
│ │ ├── TSDNS.php
│ │ ├── Blacklist.php
│ │ ├── Abstract.php
│ │ ├── FileTransfer.php
│ │ ├── Update.php
│ │ └── ServerQuery.php
│ │ ├── Viewer
│ │ ├── Interface.php
│ │ └── Text.php
│ │ └── Exception.php
├── ambient.ttf
├── banner_admin.png
├── banner_activated.png
├── banner_notactivated.png
└── banner.php
├── AdminsBot
├── READ.txt
├── config.php
├── bot.sh
├── lib
│ ├── classes
│ │ ├── cache.class.php
│ │ ├── languageMenager.php
│ │ ├── config_menager.php
│ │ ├── filecache.class.php
│ │ └── Kernel.class.php
│ └── inc
│ │ └── adminsOnline.php
└── adminsbot.php
├── OnlineBot
├── READ.txt
├── config.php
├── bot.sh
└── onlinebot.php
├── TimeBot-Style1
├── Read Me.txt
├── config.php
├── botstart.sh
└── timebot.php
├── TimeBot-Style2
├── Read Me.txt
├── config.php
├── botstart.sh
└── timebot.php
└── README.md
/bannerBot/libraries/Nuevo documento de texto.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/bannerBot/ambient.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/warningman/TS-ISLAM/HEAD/bannerBot/ambient.ttf
--------------------------------------------------------------------------------
/bannerBot/banner_admin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/warningman/TS-ISLAM/HEAD/bannerBot/banner_admin.png
--------------------------------------------------------------------------------
/bannerBot/banner_activated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/warningman/TS-ISLAM/HEAD/bannerBot/banner_activated.png
--------------------------------------------------------------------------------
/bannerBot/banner_notactivated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/warningman/TS-ISLAM/HEAD/bannerBot/banner_notactivated.png
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Helper/String.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/warningman/TS-ISLAM/HEAD/bannerBot/libraries/TeamSpeak3/Helper/String.php
--------------------------------------------------------------------------------
/AdminsBot/READ.txt:
--------------------------------------------------------------------------------
1 | ## Install php5
2 | ## Give all files CHMOD 777
3 | ## Set Config
4 | ## Bot Start => ./bot.sh start
5 | ## Bot Stop => ./bot.sh stop
6 |
7 | ## Created by Ts-Islam
8 |
--------------------------------------------------------------------------------
/OnlineBot/READ.txt:
--------------------------------------------------------------------------------
1 | ## Install php5
2 | ## Give all files CHMOD 777
3 | ## Set Config
4 | ## Bot Start => ./bot.sh start
5 | ## Bot Stop => ./bot.sh stop
6 |
7 | ## Created by Ts-Islam
8 |
--------------------------------------------------------------------------------
/TimeBot-Style1/Read Me.txt:
--------------------------------------------------------------------------------
1 | ## Install php
2 | ## Give all files CHMOD 777 ( chmod 777 /var/www/html/TimeBot/* )
3 | ## Set Config
4 | ## Bot Start => ./bot.sh start
5 | ## Bot Stop => ./botstart.sh stop
6 |
7 | ## Created by Ts-Islam
--------------------------------------------------------------------------------
/TimeBot-Style2/Read Me.txt:
--------------------------------------------------------------------------------
1 | ## Install php
2 | ## Give all files CHMOD 777 ( chmod 777 /var/www/html/TimeBot/* )
3 | ## Set Config
4 | ## Bot Start => ./botstart.sh start
5 | ## Bot Stop => ./botstart.sh stop
6 |
7 | ## Created by Ts-Islam
--------------------------------------------------------------------------------
/TimeBot-Style2/config.php:
--------------------------------------------------------------------------------
1 |
25 |
--------------------------------------------------------------------------------
/TimeBot-Style1/config.php:
--------------------------------------------------------------------------------
1 |
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TS ISLAM developerd
2 | We want to help you to be the development of all servers so that no one remains distinctive, but the moral good
3 |
4 | :(
5 |
6 | السلام عليكم ورحمة الله وبركاتة
7 | راح ننزل لكم كل الي في سيرفرات التيم سبيك
8 | سوا يويتوبر او انشاء كلان وغيرها
9 | علشان محد يتميز الا بالاخلاق
10 |
11 | لان المشروع نخرب على كل الناس :)
12 |
13 |
14 | Teamspeak [ISLAM WEB]
15 | - AdminsBot
16 | - BannerBot
17 | - TimeBot
18 | - OnlineBot
19 | - rank [soon]
20 | - .... not now
21 |
22 |
23 | # developer
24 |
25 | - HisRoyal or ابو بندر
26 | - array or WARNING or Gentlman or Aboud
27 |
28 |
--------------------------------------------------------------------------------
/OnlineBot/config.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/AdminsBot/config.php:
--------------------------------------------------------------------------------
1 | '127.0.0.1',
9 | /* Query Port */ 'server_query_port' => 10011,
10 | /* Server ID */ 'server_id' => 1,
11 | /* Query login */ 'server_query_login' => 'serveradmin',
12 | /* Query pass */ 'server_query_password' => 'IRu7KBRK',
13 | /* Nick Name */ 'bot_name' => 'AdminsBot',
14 | /* Channel to move */ 'move_to_channel' => 6
15 | );
16 |
17 | $config[1]['events'] = array(
18 |
19 | 'events_configs' => array(
20 | 'adminsOnline' => array(
21 | /* Id channel */ 'write_channel' => 6,
22 | /* Name channel */ 'channel_name' => '[cspacer]Admin Online : ',
23 | /* Up Desc. */ 'up_description' => '\n[center][size=15][color=purple]Administration Status[/color][/size][/center][hr]\n',
24 | /* Down Desc. */ 'update' => 'Last Update:',
25 | /* Info Down Desc. */ 'info' => 'By Ts-Islam',
26 | /* Admins Group */ 'groups' => array(61,11,57,12,13,123)
27 | ),
28 | )
29 | );
30 | ?>
31 |
--------------------------------------------------------------------------------
/OnlineBot/bot.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Colors
3 | ESC_SEQ="\x1b["
4 | COL_RESET=$ESC_SEQ"39;49;00m"
5 | COL_RED=$ESC_SEQ"31;01m"
6 | COL_GREEN=$ESC_SEQ"32;01m"
7 | COL_YELLOW=$ESC_SEQ"33;01m"
8 |
9 |
10 | echo -e "$COL_RED
11 | ------------------------------------------------------------------------
12 | | |
13 | |
14 | | ======================================== |
15 | | | $COL_YELLOW Ts-Islam $COL_RED | |
16 | | ======================================== |
17 | | |
18 | ------------------------------------------------------------------------ $COL_RESET"
19 |
20 | if [ $1 = 'stop' ]
21 | then
22 | pkill -f Info
23 | echo -e "Info: $COL_GREEN Bot has been STOPED! $COL_RESET"
24 | fi
25 |
26 | if [ $1 = 'start' ]
27 | then
28 | screen -dmS Info php onlinebot.php -i 1
29 | echo -e "Info: $COL_GREEN Bot has been STARTED! $COL_RESET"
30 | fi
31 |
32 |
33 |
--------------------------------------------------------------------------------
/TimeBot-Style1/botstart.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Colors
3 | ESC_SEQ="\x1b["
4 | COL_RESET=$ESC_SEQ"39;49;00m"
5 | COL_RED=$ESC_SEQ"31;01m"
6 | COL_GREEN=$ESC_SEQ"32;01m"
7 | COL_YELLOW=$ESC_SEQ"33;01m"
8 |
9 |
10 | echo -e "$COL_RED
11 | ------------------------------------------------------------------------
12 | | |
13 | |
14 | | ======================================== |
15 | | | $COL_YELLOW Ts-Islam $COL_RED | |
16 | | ======================================== |
17 | | |
18 | ------------------------------------------------------------------------ $COL_RESET"
19 |
20 | if [ "$1" = "stop" ]
21 | then
22 | pkill -f Info
23 | echo -e "Info: $COL_GREEN Bot has been STOPED! $COL_RESET"
24 | fi
25 |
26 | if [ "$1" = "start" ]
27 | then
28 | screen -dmS Info php timebot.php -i 1
29 | echo -e "Info: $COL_GREEN Bot has been STARTED! $COL_RESET"
30 | fi
31 |
32 |
33 |
--------------------------------------------------------------------------------
/TimeBot-Style2/botstart.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Colors
3 | ESC_SEQ="\x1b["
4 | COL_RESET=$ESC_SEQ"39;49;00m"
5 | COL_RED=$ESC_SEQ"31;01m"
6 | COL_GREEN=$ESC_SEQ"32;01m"
7 | COL_YELLOW=$ESC_SEQ"33;01m"
8 |
9 |
10 | echo -e "$COL_RED
11 | ------------------------------------------------------------------------
12 | | |
13 | |
14 | | ======================================== |
15 | | | $COL_YELLOW Ts-Islam $COL_RED | |
16 | | ======================================== |
17 | | |
18 | ------------------------------------------------------------------------ $COL_RESET"
19 |
20 | if [ "$1" = "stop" ]
21 | then
22 | pkill -f Info
23 | echo -e "Info: $COL_GREEN Bot has been STOPED! $COL_RESET"
24 | fi
25 |
26 | if [ "$1" = "start" ]
27 | then
28 | screen -dmS Info php timebot.php -i 1
29 | echo -e "Info: $COL_GREEN Bot has been STARTED! $COL_RESET"
30 | fi
31 |
32 |
33 |
--------------------------------------------------------------------------------
/AdminsBot/bot.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Colors
3 | ESC_SEQ="\x1b["
4 | COL_RESET=$ESC_SEQ"39;49;00m"
5 | COL_RED=$ESC_SEQ"31;01m"
6 | COL_GREEN=$ESC_SEQ"32;01m"
7 | COL_YELLOW=$ESC_SEQ"33;01m"
8 |
9 |
10 | echo -e "$COL_RED
11 | ------------------------------------------------------------------------
12 | | |
13 | |
14 | | ======================================== |
15 | | | $COL_YELLOW Ts-Islam $COL_RED | |
16 | | ======================================== |
17 | | |
18 | ------------------------------------------------------------------------ $COL_RESET"
19 |
20 | if [ $1 = 'stop' ]
21 | then
22 | pkill -f AdminsBot
23 | echo -e "Admins_Bot: $COL_GREEN Bot has been STOPED! $COL_RESET"
24 | fi
25 |
26 | if [ $1 = 'start' ]
27 | then
28 | screen -dmS AdminsBot php adminsbot.php -i 1
29 | echo -e "Admins_Bot: $COL_GREEN Bot has been STARTED! $COL_RESET"
30 | fi
31 |
32 |
--------------------------------------------------------------------------------
/OnlineBot/onlinebot.php:
--------------------------------------------------------------------------------
1 | getElement('success', $tsAdmin->connect())) {
14 |
15 | $tsAdmin->login($ts3_user, $ts3_pass);
16 | $tsAdmin->selectServer($ts3_port);
17 | $tsAdmin->setName($bot_nickname);
18 |
19 | $whoami = $tsAdmin->getElement('data', $tsAdmin->whoAmI());
20 | $tsAdmin->clientMove($whoami['client_id'],$bot_move);
21 |
22 |
23 |
24 | while(1) {
25 |
26 | $serverInfo = $tsAdmin->getElement('data', $tsAdmin->serverInfo());
27 | $clientsOnline = ($serverInfo['virtualserver_clientsonline'] - $serverInfo['virtualserver_queryclientsonline']);
28 |
29 |
30 | if($Channel == 1)
31 | {
32 | $tsAdmin->channelEdit($channel_id, array('channel_name' => $channel_name.' '.$clientsOnline));
33 | }
34 |
35 | if($Server == 1)
36 | {
37 | $tsAdmin->serverEdit(array('virtualserver_name' => $server_name.' '.$clientsOnline));
38 | }
39 |
40 | sleep($sleep);
41 | }
42 | }else{
43 | echo "Connetcion Problem";
44 | }
45 | ?>
46 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Helper/Exception.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Helper_Exception
30 | * @brief Enhanced exception class for TeamSpeak3_Helper_* objects.
31 | */
32 | class TeamSpeak3_Helper_Exception extends TeamSpeak3_Exception {}
33 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Node/Exception.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Node_Exception
30 | * @brief Enhanced exception class for TeamSpeak3_Node_Abstract objects.
31 | */
32 | class TeamSpeak3_Node_Exception extends TeamSpeak3_Exception {}
33 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Transport/Exception.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Transport_Exception
30 | * @brief Enhanced exception class for TeamSpeak3_Transport_Abstract objects.
31 | */
32 | class TeamSpeak3_Transport_Exception extends TeamSpeak3_Exception {}
33 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Adapter/TSDNS/Exception.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Adapter_TSDNS_Exception
30 | * @brief Enhanced exception class for TeamSpeak3_Adapter_TSDNS objects.
31 | */
32 | class TeamSpeak3_Adapter_TSDNS_Exception extends TeamSpeak3_Adapter_Exception {}
33 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Helper/Signal/Exception.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Helper_Signal_Exception
30 | * @brief Enhanced exception class for TeamSpeak3_Helper_Signal objects.
31 | */
32 | class TeamSpeak3_Helper_Signal_Exception extends TeamSpeak3_Helper_Exception {}
33 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Adapter/Update/Exception.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Adapter_Update_Exception
30 | * @brief Enhanced exception class for TeamSpeak3_Adapter_Update objects.
31 | */
32 | class TeamSpeak3_Adapter_Update_Exception extends TeamSpeak3_Adapter_Exception {}
33 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Helper/Profiler/Exception.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Helper_Profiler_Exception
30 | * @brief Enhanced exception class for TeamSpeak3_Helper_Profiler objects.
31 | */
32 | class TeamSpeak3_Helper_Profiler_Exception extends TeamSpeak3_Helper_Exception {}
33 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Adapter/Blacklist/Exception.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Adapter_Blacklist_Exception
30 | * @brief Enhanced exception class for TeamSpeak3_Adapter_Blacklist objects.
31 | */
32 | class TeamSpeak3_Adapter_Blacklist_Exception extends TeamSpeak3_Adapter_Exception {}
33 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Adapter/ServerQuery/Exception.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Adapter_ServerQuery_Exception
30 | * @brief Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
31 | */
32 | class TeamSpeak3_Adapter_ServerQuery_Exception extends TeamSpeak3_Adapter_Exception {}
33 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Adapter/FileTransfer/Exception.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Adapter_FileTransfer_Exception
30 | * @brief Enhanced exception class for TeamSpeak3_Adapter_FileTransfer objects.
31 | */
32 | class TeamSpeak3_Adapter_FileTransfer_Exception extends TeamSpeak3_Adapter_Exception {}
33 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Viewer/Interface.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Viewer_Interface
30 | * @brief Interface class describing a TeamSpeak 3 viewer.
31 | */
32 | interface TeamSpeak3_Viewer_Interface
33 | {
34 | /**
35 | * Returns the code needed to display a node in a TeamSpeak 3 viewer.
36 | *
37 | * @param TeamSpeak3_Node_Abstract $node
38 | * @param array $siblings
39 | * @return string
40 | */
41 | public function fetchObject(TeamSpeak3_Node_Abstract $node, array $siblings = array());
42 | }
43 |
--------------------------------------------------------------------------------
/AdminsBot/lib/classes/cache.class.php:
--------------------------------------------------------------------------------
1 | getCacheValue($cache_name);
37 | if (is_array($caches)) {
38 | self::$cache[$cache_name][] = $cache_new_value;
39 | return true;
40 | } else
41 | return false;
42 | }
43 |
44 | public function addNewValueWitchName($cache_name,$cache_new_name,$cache_new_value) {
45 | $caches = $this->getCacheValue($cache_name);
46 | if (is_array($caches)) {
47 | self::$cache[$cache_name][$cache_new_name] = $cache_new_value;
48 | return true;
49 | } else
50 | return false;
51 | }
52 |
53 | public function deleteCache($cache_name) {
54 | self::$cache[$cache_name] = NULL;
55 | unset(self::$cache[$cache_name]);
56 | return true;
57 | }
58 |
59 | public function deleteArrayCacheValue($cache_name,$key) {
60 | self::$cache[$cache_name][$key] = NULL;
61 | unset(self::$cache[$cache_name][$key]);
62 | return true;
63 | }
64 |
65 | public function clearValues($cache_name,$new_value = array()) {
66 | return $this->setCache($cache_name,$new_value);
67 | }
68 |
69 | public function getFullCache() {
70 | return self::$cache;
71 | }
72 | }
73 | ?>
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Helper/Signal/Handler.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Helper_Signal_Handler
30 | * @brief Helper class providing handler functions for signals.
31 | */
32 | class TeamSpeak3_Helper_Signal_Handler
33 | {
34 | /**
35 | * Stores the name of the subscribed signal.
36 | *
37 | * @var string
38 | */
39 | protected $signal = null;
40 |
41 | /**
42 | * Stores the callback function for the subscribed signal.
43 | *
44 | * @var mixed
45 | */
46 | protected $callback = null;
47 |
48 | /**
49 | * The TeamSpeak3_Helper_Signal_Handler constructor.
50 | *
51 | * @param string $signal
52 | * @param mixed $callback
53 | * @throws TeamSpeak3_Helper_Signal_Exception
54 | * @return TeamSpeak3_Helper_Signal_Handler
55 | */
56 | public function __construct($signal, $callback)
57 | {
58 | $this->signal = (string) $signal;
59 |
60 | if(!is_callable($callback))
61 | {
62 | throw new TeamSpeak3_Helper_Signal_Exception("invalid callback specified for signal '" . $signal . "'");
63 | }
64 |
65 | $this->callback = $callback;
66 | }
67 |
68 | /**
69 | * Invoke the signal handler.
70 | *
71 | * @param array $args
72 | * @return mixed
73 | */
74 | public function call(array $args = array())
75 | {
76 | return call_user_func_array($this->callback, $args);
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/AdminsBot/lib/classes/languageMenager.php:
--------------------------------------------------------------------------------
1 | 'o', 'ż' => 'z', 'ź' => 'z', 'ą' => 'a', 'ę' => 'e', 'ł' => 'l', 'ć' => 'c', 'ś' => 's', 'ń' => 'n', 'Ó' => 'O', 'Ż' => 'Z', 'Ź' => 'z', 'Ą' => 'A', 'Ę' => 'E', 'Ł' => 'L', 'Ć' => 'C', 'Ś' => 'S', 'Ń' => 'N');
12 |
13 | public function __construct() {
14 | $this->__langPack = array();
15 | return true;
16 | }
17 |
18 | public function __destruct() {
19 | return true;
20 | }
21 |
22 | public function loadLanguagePack($folderName) {
23 | $folder = 'inc/languages/'.$folderName.'/';
24 | $language = array();
25 | if (count(@scandir($folder)) > 2) {
26 | foreach (scandir($folder) as $file) {
27 | if (preg_match('/[A-Za-z0-9_-]\.lang\.php/',$file)) {
28 | include($folder.$file);
29 | foreach ($language as $key => $value) {
30 | $this->__langPack[$key] = $value;
31 | }
32 | }
33 | }
34 | } else {
35 | return false;
36 | }
37 | }
38 |
39 | public function getLanguage($langName) {
40 | return @str_replace('È','ó',@$this->__langPack[$langName]);
41 | }
42 |
43 | public function getConsoleLanguage($langName) {
44 | return @str_replace(array_keys($this->replaces),array_values($this->replaces),@$this->__langPack[$langName]);
45 | }
46 |
47 | public function langReplace($toReplace,$replaces,$langName) {
48 | return str_replace($toReplace,$replaces,$this->getLanguage($langName));
49 | }
50 |
51 | public function langConsoleReplace($toReplace,$replaces,$langName) {
52 | return @str_replace(array_keys($this->replaces),array_values($this->replaces),str_replace($toReplace,$replaces,$this->getLanguage($langName)));
53 | }
54 |
55 | public function signsFilter($text) {
56 | $signsArray = array(-71 => 165,-13 => 162,-100 => 152,-77 => 136,-65 => 190,-97 => 171,-26 => 134,-15 => 228,-91 => 164,-54 => 168,-45 => 224,-117 => 151,-93 => 157,-81 => 189,-113 => 141,-58 => 143,-47 => 227);
57 | $newArray = array();
58 | foreach ($signsArray as $key => $value) {
59 | $newArray[chr($key)] = chr($value);
60 | }
61 | return str_replace(array_keys($newArray),array_values($newArray),$text);
62 | }
63 |
64 | }
65 | ?>
--------------------------------------------------------------------------------
/AdminsBot/lib/classes/config_menager.php:
--------------------------------------------------------------------------------
1 | getLanguage('MNG_ERROR')." ".$lang->getLanguage('NOT_VALID_IP')."\n";
14 | $errors++;
15 | }
16 | if (!is_numeric(getConfigValue('connection','server_query_port')) || !strlen(getConfigValue('connection','server_query_port')) > 5) {
17 | echo "\n".$lang->getLanguage('MNG_ERROR')." ".$lang->getLanguage('NOT_VALID_PORT')."\n";
18 | $errors++;
19 | }
20 | if (!is_numeric(getConfigValue('connection','server_id'))) {
21 | echo "\n".$lang->getLanguage('MNG_ERROR')." ".$lang->getLanguage('NOD_VALID_ID')."\n";
22 | $errors++;
23 | }
24 | if ($errors > 0)
25 | exit;
26 | return true;
27 | }
28 |
29 | function reloadConfig() {
30 | unset($config);
31 | include('config/config.php');
32 | return true;
33 | }
34 |
35 | function getPluginConfigValue($pluginName) {
36 | global $botid, $config;
37 | if (array_key_exists($pluginName, $config[$botid]['plugins']['plugins_configs']))
38 | return $config[$botid]['plugins']['plugins_configs'][$pluginName];
39 | else
40 | return false;
41 | }
42 |
43 | function getAccesoriesConfigValue($accesoriesName) {
44 | global $botid, $config;
45 | if (array_key_exists($accesoriesName, $config[$botid]['accesories']['accesories_configs']))
46 | return $config[$botid]['accesories']['accesories_configs'][$accesoriesName];
47 | else
48 | return false;
49 | }
50 |
51 |
52 | function getCommandConfigValue($commandName) {
53 | global $botid, $config;
54 | if (array_key_exists($commandName, $config[$botid]['commands']['commands_configs']))
55 | return $config[$botid]['commands']['commands_configs'][$commandName];
56 | else
57 | return false;
58 | }
59 |
60 | function getEventConfigValue($eventName) {
61 | global $botid, $config;
62 | if (array_key_exists($eventName, $config[$botid]['events']['events_configs']))
63 | return $config[$botid]['events']['events_configs'][$eventName];
64 | else
65 | return false;
66 | }
67 |
68 | function getEventTimeInfo($eventName) {
69 | global $botid, $config;
70 | if (true)
71 | return array('seconds' => 0,'minutes' => 1, 'hours' => 0, 'days' => 0);
72 | else
73 | return false;
74 | }
75 |
76 | ?>
--------------------------------------------------------------------------------
/TimeBot-Style2/timebot.php:
--------------------------------------------------------------------------------
1 | getElement('success', $tsAdmin->connect())) {
14 |
15 | $tsAdmin->login($ts3_user, $ts3_pass);
16 | $tsAdmin->selectServer($ts3_port);
17 | $tsAdmin->setName($bot_nickname);
18 |
19 | $whoami = $tsAdmin->getElement('data', $tsAdmin->whoAmI());
20 | $tsAdmin->clientMove($whoami['client_id'],$bot_move);
21 |
22 |
23 | //█▀▀█ ▄█─ █▀█ █▀▀█ █▀▀ ─█▀█─ ▄▀▀▄ ▀▀▀█ ▄▀▀▄ ▄▀▀▄
24 | //█▄▀█ ─█─ ─▄▀ ──▀▄ ▀▀▄ █▄▄█▄ █▄▄─ ──█─ ▄▀▀▄ ▀▄▄█
25 | //█▄▄█ ▄█▄ █▄▄ █▄▄█ ▄▄▀ ───█─ ▀▄▄▀ ─▐▌─ ▀▄▄▀ ─▄▄▀
26 |
27 |
28 | //▄
29 | //─
30 | //▀
31 |
32 |
33 | $line1[0] = "█▀▀█";
34 | $line2[0] = "█▄▀█";
35 | $line3[0] = "█▄▄█";
36 |
37 | $line1[1] = "▄█─";
38 | $line2[1] = "─█─";
39 | $line3[1] = "▄█▄";
40 |
41 | $line1[2] = "█▀█";
42 | $line2[2] = "─▄▀";
43 | $line3[2] = "█▄▄";
44 |
45 | $line1[3] = "█▀▀█";
46 | $line2[3] = "──▀▄";
47 | $line3[3] = "█▄▄█";
48 |
49 | $line1[4] = "─█▀█─";
50 | $line2[4] = "█▄▄█▄";
51 | $line3[4] = "───█─";
52 |
53 | $line1[5] = "█▀▀";
54 | $line2[5] = "▀▀▄";
55 | $line3[5] = "▄▄▀";
56 |
57 | $line1[6] = "▄▀▀▄";
58 | $line2[6] = "█▄▄─";
59 | $line3[6] = "▀▄▄▀";
60 |
61 | $line1[7] = "▀▀▀█";
62 | $line2[7] = "──█─";
63 | $line3[7] = "─▐▌─";
64 |
65 | $line1[8] = "▄▀▀▄";
66 | $line2[8] = "▄▀▀▄";
67 | $line3[8] = "▀▄▄▀";
68 |
69 | $line1[9] = "▄▀▀▄";
70 | $line2[9] = "▀▄▄█";
71 | $line3[9] = "─▄▄▀";
72 |
73 | while(1) {
74 |
75 | $time = date('h:i', time());
76 |
77 | $time_explode = explode(':', date('h:i') );
78 | $time_H = str_split($time_explode[0],1);
79 | $time_H1 = $time_H[0];
80 | $time_H2 = $time_H[1];
81 | $time_M = str_split($time_explode[1],1);
82 | $time_M1 = $time_M[0];
83 | $time_M2 = $time_M[1];
84 |
85 | $channel_time1 = "[cspacer]".$line1[$time_H1]."─".$line1[$time_H2]."─▄─".$line1[$time_M1]."─".$line1[$time_M2];
86 | $channel_time2 = "[cspacer]".$line2[$time_H1]."─".$line2[$time_H2]."───".$line2[$time_M1]."─".$line2[$time_M2];
87 | $channel_time3 = "[cspacer]".$line3[$time_H1]."─".$line3[$time_H2]."─▄─".$line3[$time_M1]."─".$line3[$time_M2];
88 |
89 | $tsAdmin->channelEdit($channel_id_1, array('channel_name' => $channel_time1));
90 | $tsAdmin->channelEdit($channel_id_2, array('channel_name' => $channel_time2));
91 | $tsAdmin->channelEdit($channel_id_3, array('channel_name' => $channel_time3));
92 |
93 |
94 | sleep(10);
95 | }
96 |
97 | }else{
98 | echo "Connetcion Problem";
99 | }
100 | ?>
101 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Helper/Profiler.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Helper_Profiler
30 | * @brief Helper class for profiler handling.
31 | */
32 | class TeamSpeak3_Helper_Profiler
33 | {
34 | /**
35 | * Stores various timers for code profiling.
36 | *
37 | * @var array
38 | */
39 | protected static $timers = array();
40 |
41 | /**
42 | * Inits a timer.
43 | *
44 | * @param string $name
45 | * @return void
46 | */
47 | public static function init($name = "default")
48 | {
49 | self::$timers[$name] = new TeamSpeak3_Helper_Profiler_Timer($name);
50 | }
51 |
52 | /**
53 | * Starts a timer.
54 | *
55 | * @param string $name
56 | * @return void
57 | */
58 | public static function start($name = "default")
59 | {
60 | if(array_key_exists($name, self::$timers))
61 | {
62 | self::$timers[$name]->start();
63 | }
64 | else
65 | {
66 | self::$timers[$name] = new TeamSpeak3_Helper_Profiler_Timer($name);
67 | }
68 | }
69 |
70 | /**
71 | * Stops a timer.
72 | *
73 | * @param string $name
74 | * @return void
75 | */
76 | public static function stop($name = "default")
77 | {
78 | if(!array_key_exists($name, self::$timers))
79 | {
80 | self::init($name);
81 | }
82 |
83 | self::$timers[$name]->stop();
84 | }
85 |
86 | /**
87 | * Returns a timer.
88 | *
89 | * @param string $name
90 | * @return TeamSpeak3_Helper_Profiler_Timer
91 | */
92 | public static function get($name = "default")
93 | {
94 | if(!array_key_exists($name, self::$timers))
95 | {
96 | self::init($name);
97 | }
98 |
99 | return self::$timers[$name];
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Adapter/TSDNS.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Adapter_TSDNS
30 | * @brief Provides methods to query a TSDNS server.
31 | */
32 | class TeamSpeak3_Adapter_TSDNS extends TeamSpeak3_Adapter_Abstract
33 | {
34 | /**
35 | * The TCP port number used by any TSDNS server.
36 | *
37 | * @var integer
38 | */
39 | protected $default_port = 41144;
40 |
41 | /**
42 | * Connects the TeamSpeak3_Transport_Abstract object and performs initial actions on the remote
43 | * server.
44 | *
45 | * @throws TeamSpeak3_Adapter_Exception
46 | * @return void
47 | */
48 | public function syn()
49 | {
50 | if(!isset($this->options["port"]) || empty($this->options["port"])) $this->options["port"] = $this->default_port;
51 |
52 | $this->initTransport($this->options);
53 | $this->transport->setAdapter($this);
54 |
55 | TeamSpeak3_Helper_Profiler::init(spl_object_hash($this));
56 |
57 | TeamSpeak3_Helper_Signal::getInstance()->emit("tsdnsConnected", $this);
58 | }
59 |
60 | /**
61 | * The TeamSpeak3_Adapter_FileTransfer destructor.
62 | *
63 | * @return void
64 | */
65 | public function __destruct()
66 | {
67 | if($this->getTransport() instanceof TeamSpeak3_Transport_Abstract && $this->getTransport()->isConnected())
68 | {
69 | $this->getTransport()->disconnect();
70 | }
71 | }
72 |
73 | /**
74 | * Queries the TSDNS server for a specified virtual hostname and returns the result.
75 | *
76 | * @param string $tsdns
77 | * @throws TeamSpeak3_Adapter_TSDNS_Exception
78 | * @return TeamSpeak3_Helper_String
79 | */
80 | public function resolve($tsdns)
81 | {
82 | $this->getTransport()->sendLine($tsdns);
83 | $repl = $this->getTransport()->readLine();
84 | $this->getTransport()->disconnect();
85 |
86 | if($repl->section(":", 0)->toInt() == 404)
87 | {
88 | throw new TeamSpeak3_Adapter_TSDNS_Exception("unable to resolve TSDNS hostname (" . $tsdns . ")");
89 | }
90 |
91 | TeamSpeak3_Helper_Signal::getInstance()->emit("tsdnsResolved", $tsdns, $repl);
92 |
93 | return $repl;
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/TimeBot-Style1/timebot.php:
--------------------------------------------------------------------------------
1 | getElement('success', $tsAdmin->connect())) {
15 |
16 | $tsAdmin->login($ts3_user, $ts3_pass);
17 | $tsAdmin->selectServer($ts3_port);
18 | $tsAdmin->setName($bot_nickname);
19 |
20 | $whoami = $tsAdmin->getElement('data', $tsAdmin->whoAmI());
21 | $tsAdmin->clientMove($whoami['client_id'],$bot_move);
22 |
23 | $line1[0] = "▄▀▀▀▄─";
24 | $line2[0] = "█───█─";
25 | $line3[0] = "█───█─";
26 | $line4[0] = "▀▄▄▄▀─";
27 |
28 | $line1[0] = "▄▀▀▀▄─";
29 | $line2[0] = "█───█─";
30 | $line3[0] = "█───█─";
31 | $line4[0] = "▀▄▄▄▀─";
32 |
33 | $line1[1] = "─▄█─";
34 | $line2[1] = "▀─█─";
35 | $line3[1] = "──█─";
36 | $line4[1] = "──█─";
37 |
38 | $line1[2] = "▄▀▀▀▄─";
39 | $line2[2] = "───▄▀─";
40 | $line3[2] = "─▄▀───";
41 | $line4[2] = "█▄▄▄▄─";
42 |
43 | $line1[3] = "▄▀▀▀▄─";
44 | $line2[3] = "──▄▄█─";
45 | $line3[3] = "────█─";
46 | $line4[3] = "▀▄▄▄▀─";
47 |
48 | $line1[4] = "───▄█──";
49 | $line2[4] = "─▄▀─█──";
50 | $line3[4] = "█▄▄▄█▄─";
51 | $line4[4] = "────█──";
52 |
53 | $line1[5] = "█▀▀▀▀─";
54 | $line2[5] = "█▄▄▄──";
55 | $line3[5] = "────█─";
56 | $line4[5] = "▀▄▄▄▀─";
57 |
58 | $line1[6] = "█▀▀▀█─";
59 | $line2[6] = "█─────";
60 | $line3[6] = "█▀▀▀█─";
61 | $line4[6] = "▀▄▄▄▀─";
62 |
63 | $line1[7] = "█▀▀▀█─";
64 | $line2[7] = "────█─";
65 | $line3[7] = "────█─";
66 | $line4[7] = "────█─";
67 |
68 | $line1[8] = "▄▀▀▀▄─";
69 | $line2[8] = "▀▄▄▄▀─";
70 | $line3[8] = "█───█─";
71 | $line4[8] = "▀▄▄▄▀─";
72 |
73 | $line1[9] = "▄▀▀▀▄─";
74 | $line2[9] = "█▄▄▄█─";
75 | $line3[9] = "────█─";
76 | $line4[9] = "▀▄▄▄▀─";
77 |
78 | while(1) {
79 |
80 | $time = date('h:i', time());
81 |
82 | $time_explode = explode(':', date('h:i') );
83 | $time_H = str_split($time_explode[0],1);
84 | $time_H1 = $time_H[0];
85 | $time_H2 = $time_H[1];
86 | $time_M = str_split($time_explode[1],1);
87 | $time_M1 = $time_M[0];
88 | $time_M2 = $time_M[1];
89 |
90 | $channel_time1 = "[cspacer1]".$line1[$time_H1]."─".$line1[$time_H2]."────".$line1[$time_M1]."─".$line1[$time_M2];
91 | $channel_time2 = "[cspacer2]".$line2[$time_H1]."─".$line2[$time_H2]."─▀──".$line2[$time_M1]."─".$line2[$time_M2];
92 | $channel_time3 = "[cspacer3]".$line3[$time_H1]."─".$line3[$time_H2]."─▄──".$line3[$time_M1]."─".$line3[$time_M2];
93 | $channel_time4 = "[cspacer4]".$line4[$time_H1]."─".$line4[$time_H2]."────".$line4[$time_M1]."─".$line4[$time_M2];
94 |
95 | $tsAdmin->channelEdit($channel_id_1, array('channel_name' => $channel_time1));
96 | $tsAdmin->channelEdit($channel_id_2, array('channel_name' => $channel_time2));
97 | $tsAdmin->channelEdit($channel_id_3, array('channel_name' => $channel_time3));
98 | $tsAdmin->channelEdit($channel_id_4, array('channel_name' => $channel_time4));
99 |
100 | sleep(60);
101 | }
102 |
103 | }else{
104 | echo "Connetcion Problem";
105 | }
106 | ?>
107 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Viewer/Text.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Viewer_Text
30 | * @brief Renders nodes used in ASCII-based TeamSpeak 3 viewers.
31 | */
32 | class TeamSpeak3_Viewer_Text implements TeamSpeak3_Viewer_Interface
33 | {
34 | /**
35 | * A pre-defined pattern used to display a node in a TeamSpeak 3 viewer.
36 | *
37 | * @var string
38 | */
39 | protected $pattern = "%0%1 %2\n";
40 |
41 | /**
42 | * Returns the code needed to display a node in a TeamSpeak 3 viewer.
43 | *
44 | * @param TeamSpeak3_Node_Abstract $node
45 | * @param array $siblings
46 | * @return string
47 | */
48 | public function fetchObject(TeamSpeak3_Node_Abstract $node, array $siblings = array())
49 | {
50 | $this->currObj = $node;
51 | $this->currSib = $siblings;
52 |
53 | $args = array(
54 | $this->getPrefix(),
55 | $this->getCorpusIcon(),
56 | $this->getCorpusName(),
57 | );
58 |
59 | return TeamSpeak3_Helper_String::factory($this->pattern)->arg($args);
60 | }
61 |
62 | /**
63 | * Returns the ASCII string to display the prefix of the current node.
64 | *
65 | * @return string
66 | */
67 | protected function getPrefix()
68 | {
69 | $prefix = "";
70 |
71 | if(count($this->currSib))
72 | {
73 | $last = array_pop($this->currSib);
74 |
75 | foreach($this->currSib as $sibling)
76 | {
77 | $prefix .= ($sibling) ? "| " : " ";
78 | }
79 |
80 | $prefix .= ($last) ? "\\-" : "|-";
81 | }
82 |
83 | return $prefix;
84 | }
85 |
86 | /**
87 | * Returns an ASCII string which can be used to display the status icon for a
88 | * TeamSpeak_Node_Abstract object.
89 | *
90 | * @return string
91 | */
92 | protected function getCorpusIcon()
93 | {
94 | return $this->currObj->getSymbol();
95 | }
96 |
97 | /**
98 | * Returns a string for the current corpus element which contains the display name
99 | * for the current TeamSpeak_Node_Abstract object.
100 | *
101 | * @return string
102 | */
103 | protected function getCorpusName()
104 | {
105 | return $this->currObj;
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Transport/UDP.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Transport_UDP
30 | * @brief Class for connecting to a remote server through UDP.
31 | */
32 | class TeamSpeak3_Transport_UDP extends TeamSpeak3_Transport_Abstract
33 | {
34 | /**
35 | * Connects to a remote server.
36 | *
37 | * @throws TeamSpeak3_Transport_Exception
38 | * @return void
39 | */
40 | public function connect()
41 | {
42 | if($this->stream !== null) return;
43 |
44 | $host = strval($this->config["host"]);
45 | $port = strval($this->config["port"]);
46 |
47 | $address = "udp://" . $host . ":" . $port;
48 | $timeout = intval($this->config["timeout"]);
49 |
50 | $this->stream = @stream_socket_client($address, $errno, $errstr, $timeout);
51 |
52 | if($this->stream === FALSE)
53 | {
54 | throw new TeamSpeak3_Transport_Exception(TeamSpeak3_Helper_String::factory($errstr)->toUtf8()->toString(), $errno);
55 | }
56 |
57 | @stream_set_timeout($this->stream, $timeout);
58 | @stream_set_blocking($this->stream, $this->config["blocking"] ? 1 : 0);
59 | }
60 |
61 | /**
62 | * Disconnects from a remote server.
63 | *
64 | * @return void
65 | */
66 | public function disconnect()
67 | {
68 | if($this->stream === null) return;
69 |
70 | $this->stream = null;
71 |
72 | TeamSpeak3_Helper_Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "Disconnected");
73 | }
74 |
75 | /**
76 | * Reads data from the stream.
77 | *
78 | * @param integer $length
79 | * @throws TeamSpeak3_Transport_Exception
80 | * @return TeamSpeak3_Helper_String
81 | */
82 | public function read($length = 4096)
83 | {
84 | $this->connect();
85 | $this->waitForReadyRead();
86 |
87 | $data = @fread($this->stream, $length);
88 |
89 | TeamSpeak3_Helper_Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "DataRead", $data);
90 |
91 | if($data === FALSE)
92 | {
93 | throw new TeamSpeak3_Transport_Exception("connection to server '" . $this->config["host"] . ":" . $this->config["port"] . "' lost");
94 | }
95 |
96 | return new TeamSpeak3_Helper_String($data);
97 | }
98 |
99 | /**
100 | * Writes data to the stream.
101 | *
102 | * @param string $data
103 | * @return void
104 | */
105 | public function send($data)
106 | {
107 | $this->connect();
108 |
109 | @stream_socket_sendto($this->stream, $data);
110 |
111 | TeamSpeak3_Helper_Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "DataSend", $data);
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Adapter/Blacklist.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Adapter_Blacklist
30 | * @brief Provides methods to check if an IP address is currently blacklisted.
31 | */
32 | class TeamSpeak3_Adapter_Blacklist extends TeamSpeak3_Adapter_Abstract
33 | {
34 | /**
35 | * The IPv4 address or FQDN of the TeamSpeak Systems update server.
36 | *
37 | * @var string
38 | */
39 | protected $default_host = "blacklist.teamspeak.com";
40 |
41 | /**
42 | * The UDP port number of the TeamSpeak Systems update server.
43 | *
44 | * @var integer
45 | */
46 | protected $default_port = 17385;
47 |
48 | /**
49 | * Stores an array containing the latest build numbers.
50 | *
51 | * @var array
52 | */
53 | protected $build_numbers = null;
54 |
55 | /**
56 | * Connects the TeamSpeak3_Transport_Abstract object and performs initial actions on the remote
57 | * server.
58 | *
59 | * @return void
60 | */
61 | public function syn()
62 | {
63 | if(!isset($this->options["host"]) || empty($this->options["host"])) $this->options["host"] = $this->default_host;
64 | if(!isset($this->options["port"]) || empty($this->options["port"])) $this->options["port"] = $this->default_port;
65 |
66 | $this->initTransport($this->options, "TeamSpeak3_Transport_UDP");
67 | $this->transport->setAdapter($this);
68 |
69 | TeamSpeak3_Helper_Profiler::init(spl_object_hash($this));
70 |
71 | TeamSpeak3_Helper_Signal::getInstance()->emit("blacklistConnected", $this);
72 | }
73 |
74 | /**
75 | * The TeamSpeak3_Adapter_Blacklist destructor.
76 | *
77 | * @return void
78 | */
79 | public function __destruct()
80 | {
81 | if($this->getTransport() instanceof TeamSpeak3_Transport_Abstract && $this->getTransport()->isConnected())
82 | {
83 | $this->getTransport()->disconnect();
84 | }
85 | }
86 |
87 | /**
88 | * Returns TRUE if a specified $host IP address is currently blacklisted.
89 | *
90 | * @param string $host
91 | * @throws TeamSpeak3_Adapter_Blacklist_Exception
92 | * @return boolean
93 | */
94 | public function isBlacklisted($host)
95 | {
96 | if(ip2long($host) === FALSE)
97 | {
98 | $addr = gethostbyname($host);
99 |
100 | if($addr == $host)
101 | {
102 | throw new TeamSpeak3_Adapter_Blacklist_Exception("unable to resolve IPv4 address (" . $host . ")");
103 | }
104 |
105 | $host = $addr;
106 | }
107 |
108 | $this->getTransport()->send("ip4:" . $host);
109 | $repl = $this->getTransport()->read(1);
110 | $this->getTransport()->disconnect();
111 |
112 | if(!count($repl))
113 | {
114 | return FALSE;
115 | }
116 |
117 | return ($repl->toInt()) ? FALSE : TRUE;
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Exception.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Exception
30 | * @brief Enhanced exception class for TeamSpeak3 objects.
31 | */
32 | class TeamSpeak3_Exception extends Exception
33 | {
34 | /**
35 | * Stores custom error messages.
36 | *
37 | * @var array
38 | */
39 | protected static $messages = array();
40 |
41 | /**
42 | * The TeamSpeak3_Exception constructor.
43 | *
44 | * @param string $mesg
45 | * @param integer $code
46 | * @return TeamSpeak3_Exception
47 | */
48 | public function __construct($mesg, $code = 0x00)
49 | {
50 | parent::__construct($mesg, $code);
51 |
52 | if(array_key_exists((int) $code, self::$messages))
53 | {
54 | $this->message = $this->prepareCustomMessage(self::$messages[intval($code)]);
55 | }
56 |
57 | TeamSpeak3_Helper_Signal::getInstance()->emit("errorException", $this);
58 | }
59 |
60 | /**
61 | * Prepares a custom error message by replacing pre-defined signs with given values.
62 | *
63 | * @param TeamSpeak3_Helper_String $mesg
64 | * @return TeamSpeak3_Helper_String
65 | */
66 | protected function prepareCustomMessage(TeamSpeak3_Helper_String $mesg)
67 | {
68 | $args = array(
69 | "code" => $this->getCode(),
70 | "mesg" => $this->getMessage(),
71 | "line" => $this->getLine(),
72 | "file" => $this->getFile(),
73 | );
74 |
75 | return $mesg->arg($args)->toString();
76 | }
77 |
78 | /**
79 | * Registers a custom error message to $code.
80 | *
81 | * @param integer $code
82 | * @param string $mesg
83 | * @throws TeamSpeak3_Exception
84 | * @return void
85 | */
86 | public static function registerCustomMessage($code, $mesg)
87 | {
88 | if(array_key_exists((int) $code, self::$messages))
89 | {
90 | throw new self("custom message for code 0x" . strtoupper(dechex($code)) . " is already registered");
91 | }
92 |
93 | if(!is_string($mesg))
94 | {
95 | throw new self("custom message for code 0x" . strtoupper(dechex($code)) . " must be a string");
96 | }
97 |
98 | self::$messages[(int) $code] = new TeamSpeak3_Helper_String($mesg);
99 | }
100 |
101 | /**
102 | * Unregisters a custom error message from $code.
103 | *
104 | * @param integer $code
105 | * @throws TeamSpeak3_Exception
106 | * @return void
107 | */
108 | public static function unregisterCustomMessage($code)
109 | {
110 | if(!array_key_exists((int) $code, self::$messages))
111 | {
112 | throw new self("custom message for code 0x" . strtoupper(dechex($code)) . " is not registered");
113 | }
114 |
115 | unset(self::$messages[intval($code)]);
116 | }
117 |
118 | /**
119 | * Returns the class from which the exception was thrown.
120 | *
121 | * @return string
122 | */
123 | public function getSender()
124 | {
125 | $trace = $this->getTrace();
126 |
127 | return (isset($trace[0]["class"])) ? $trace[0]["class"] : "{main}";
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Helper/Profiler/Timer.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Helper_Profiler_Timer
30 | * @brief Helper class providing profiler timers.
31 | */
32 | class TeamSpeak3_Helper_Profiler_Timer
33 | {
34 | /**
35 | * Indicates wether the timer is running or not.
36 | *
37 | * @var boolean
38 | */
39 | protected $running = FALSE;
40 |
41 | /**
42 | * Stores the timestamp when the timer was last started.
43 | *
44 | * @var integer
45 | */
46 | protected $started = 0;
47 |
48 | /**
49 | * Stores the timer name.
50 | *
51 | * @var string
52 | */
53 | protected $name = null;
54 |
55 | /**
56 | * Stores various information about the server environment.
57 | *
58 | * @var array
59 | */
60 | protected $data = array();
61 |
62 | /**
63 | * The TeamSpeak3_Helper_Profiler_Timer constructor.
64 | *
65 | * @param string $name
66 | * @return TeamSpeak3_Helper_Profiler_Timer
67 | */
68 | public function __construct($name)
69 | {
70 | $this->name = (string) $name;
71 |
72 | $this->data["runtime"] = 0;
73 | $this->data["realmem"] = 0;
74 | $this->data["emalloc"] = 0;
75 |
76 | $this->start();
77 | }
78 |
79 | /**
80 | * Starts the timer.
81 | *
82 | * @return void
83 | */
84 | public function start()
85 | {
86 | if($this->isRunning()) return;
87 |
88 | $this->data["realmem_start"] = memory_get_usage(TRUE);
89 | $this->data["emalloc_start"] = memory_get_usage();
90 |
91 | $this->started = microtime(TRUE);
92 | $this->running = TRUE;
93 | }
94 |
95 | /**
96 | * Stops the timer.
97 | *
98 | * @return void
99 | */
100 | public function stop()
101 | {
102 | if(!$this->isRunning()) return;
103 |
104 | $this->data["runtime"] += microtime(TRUE) - $this->started;
105 | $this->data["realmem"] += memory_get_usage(TRUE) - $this->data["realmem_start"];
106 | $this->data["emalloc"] += memory_get_usage() - $this->data["emalloc_start"];
107 |
108 | $this->started = 0;
109 | $this->running = FALSE;
110 | }
111 |
112 | /**
113 | * Return the timer runtime.
114 | *
115 | * @return mixed
116 | */
117 | public function getRuntime()
118 | {
119 | if($this->isRunning())
120 | {
121 | $this->stop();
122 | $this->start();
123 | }
124 |
125 | return $this->data["runtime"];
126 | }
127 |
128 | /**
129 | * Returns the amount of memory allocated to PHP in bytes.
130 | *
131 | * @param boolean $realmem
132 | * @return integer
133 | */
134 | public function getMemUsage($realmem = FALSE)
135 | {
136 | if($this->isRunning())
137 | {
138 | $this->stop();
139 | $this->start();
140 | }
141 |
142 | return ($realmem !== FALSE) ? $this->data["realmem"] : $this->data["emalloc"];
143 | }
144 |
145 | /**
146 | * Returns TRUE if the timer is running.
147 | *
148 | * @return boolean
149 | */
150 | public function isRunning()
151 | {
152 | return $this->running;
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/bannerBot/banner.php:
--------------------------------------------------------------------------------
1 | clientList() as $cl) {
48 | if ($cl->getProperty('connection_client_ip') == $_SERVER['REMOTE_ADDR']) {
49 |
50 | header('Content-Type: image/png');
51 | // هذه نستعملها للتجارب في المتصفح نصيحة شيلها :)
52 | header('refresh: 3; url=');
53 | // نهاية الي تشيلة
54 |
55 | $_SESSION ['ggids'] = explode(",", $cl["client_servergroups"]);
56 |
57 | if(in_array($config['GroupIDnotactivated'],$_SESSION['ggids'])){
58 |
59 | $image_file = 'banner_notactivated.png';
60 |
61 | } else if(in_array($config['GroupIDactivated'],$_SESSION['ggids'])){
62 |
63 | $image_file = 'banner_activated.png';
64 |
65 | } else if(in_array($config['GroupIDAdmin'],$_SESSION['ggids'])){
66 |
67 | $image_file = 'banner_admin.png';
68 |
69 | } else {
70 |
71 | $image_file = 'banner_notactivated.png';
72 |
73 | }
74 | // اضافة الصور
75 | $image = imagecreatefrompng($image_file);
76 |
77 | $sigIndex = rand(0, count($image)-1);
78 | // اضافة الالوان
79 | $white = imagecolorallocate($image, 255, 255, 255);
80 | $blac1 = imagecolorallocate($image, 85, 85, 127);
81 |
82 | imagefilledrectangle($image, 999, 0, 399, 29, $white);
83 |
84 | // متغيرات النصوص
85 | $text = "Welcome," . htmlspecialchars($cl->client_nickname) ."";
86 | $text = str_replace (" ", "", $text);
87 | $text = str_replace ("!", "", $text);
88 | $time = "" . date("H",strtotime("+3 hours")) . ":" . date("i") . "";
89 | $time2 = "20" . date("y") . "/" . date("m") . "/" . date("d") . "";
90 | $clientsonline = "" . $ts3_VirtualServer->virtualserver_clientsonline-1 . "";
91 | $text2 = " / ";
92 | $text3 = "today f3alyt d3m";
93 | $maxclients = $ts3_VirtualServer->virtualserver_maxclients . "";
94 |
95 | // غير خطك من هنا
96 | $font = 'ambient.ttf';
97 | // هنا اضافة النص للصورة
98 | imagettftext($image, 20, 0, 380, 150, $blac1, $font, $text);
99 | if ($image_file == "banner_activated.png"){
100 | imagettftext($image, 20, 0, 75, 263, $blac1, $font, $time);
101 | }
102 | if ($image_file == "banner_admin.png"){
103 | imagettftext($image, 20, 0, 500, 263, $blac1, $font, $text3);
104 | }
105 | if ($image_file == "banner_activated.png"){
106 | imagettftext($im, 20, 0, 20, 240, $blac1, $font, $time2);
107 | }
108 | imagettftext($image, 20, 0, 40, 175, $blac1, $font, $clientsonline);
109 | imagettftext($image, 20, 0, 70, 170, $blac1, $font, $text2);
110 | imagettftext($image, 20, 0, 130, 175, $blac1, $font, $maxclients);
111 |
112 | // imagepng() للصور الي بنفس الامداد الموضح
113 | // imagejpeg() للصور الي بنفس الامداد الموضح
114 | imagepng($image, NULL);
115 | imagedestroy($image);
116 | }
117 | }
118 | } catch (Exception $e) {
119 | echo '
QueryError: ' . $e->getCode() . ' ' . $e->getMessage() . '
';
120 | die;
121 | }
122 | ?>
123 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Adapter/Abstract.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Adapter_Abstract
30 | * @brief Provides low-level methods for concrete adapters to communicate with a TeamSpeak 3 Server.
31 | */
32 | abstract class TeamSpeak3_Adapter_Abstract
33 | {
34 | /**
35 | * Stores user-provided options.
36 | *
37 | * @var array
38 | */
39 | protected $options = null;
40 |
41 | /**
42 | * Stores an TeamSpeak3_Transport_Abstract object.
43 | *
44 | * @var TeamSpeak3_Transport_Abstract
45 | */
46 | protected $transport = null;
47 |
48 | /**
49 | * The TeamSpeak3_Adapter_Abstract constructor.
50 | *
51 | * @param array $options
52 | * @return TeamSpeak3_Adapter_Abstract
53 | */
54 | public function __construct(array $options)
55 | {
56 | $this->options = $options;
57 |
58 | if($this->transport === null)
59 | {
60 | $this->syn();
61 | }
62 | }
63 |
64 | /**
65 | * The TeamSpeak3_Adapter_Abstract destructor.
66 | *
67 | * @return void
68 | */
69 | abstract public function __destruct();
70 |
71 | /**
72 | * Connects the TeamSpeak3_Transport_Abstract object and performs initial actions on the remote
73 | * server.
74 | *
75 | * @throws TeamSpeak3_Adapter_Exception
76 | * @return void
77 | */
78 | abstract protected function syn();
79 |
80 | /**
81 | * Commit pending data.
82 | *
83 | * @return array
84 | */
85 | public function __sleep()
86 | {
87 | return array("options");
88 | }
89 |
90 | /**
91 | * Reconnects to the remote server.
92 | *
93 | * @return void
94 | */
95 | public function __wakeup()
96 | {
97 | $this->syn();
98 | }
99 |
100 | /**
101 | * Returns the profiler timer used for this connection adapter.
102 | *
103 | * @return TeamSpeak3_Helper_Profiler_Timer
104 | */
105 | public function getProfiler()
106 | {
107 | return TeamSpeak3_Helper_Profiler::get(spl_object_hash($this));
108 | }
109 |
110 | /**
111 | * Returns the transport object used for this connection adapter.
112 | *
113 | * @return TeamSpeak3_Transport_Abstract
114 | */
115 | public function getTransport()
116 | {
117 | return $this->transport;
118 | }
119 |
120 | /**
121 | * Loads the transport object object used for the connection adapter and passes a given set
122 | * of options.
123 | *
124 | * @param array $options
125 | * @param string $transport
126 | * @throws TeamSpeak3_Adapter_Exception
127 | * @return void
128 | */
129 | protected function initTransport($options, $transport = "TeamSpeak3_Transport_TCP")
130 | {
131 | if(!is_array($options))
132 | {
133 | throw new TeamSpeak3_Adapter_Exception("transport parameters must provided in an array");
134 | }
135 |
136 | $this->transport = new $transport($options);
137 | }
138 |
139 | /**
140 | * Returns the hostname or IPv4 address the underlying TeamSpeak3_Transport_Abstract object
141 | * is connected to.
142 | *
143 | * @return string
144 | */
145 | public function getTransportHost()
146 | {
147 | return $this->getTransport()->getConfig("host", "0.0.0.0");
148 | }
149 |
150 | /**
151 | * Returns the port number of the server the underlying TeamSpeak3_Transport_Abstract object
152 | * is connected to.
153 | *
154 | * @return string
155 | */
156 | public function getTransportPort()
157 | {
158 | return $this->getTransport()->getConfig("port", "0");
159 | }
160 | }
161 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Adapter/ServerQuery/Event.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Adapter_ServerQuery_Event
30 | * @brief Provides methods to analyze and format a ServerQuery event.
31 | */
32 | class TeamSpeak3_Adapter_ServerQuery_Event implements ArrayAccess
33 | {
34 | /**
35 | * Stores the event type.
36 | *
37 | * @var TeamSpeak3_Helper_String
38 | */
39 | protected $type = null;
40 |
41 | /**
42 | * Stores the event data.
43 | *
44 | * @var array
45 | */
46 | protected $data = null;
47 |
48 | /**
49 | * Stores the event data as an unparsed string.
50 | *
51 | * @var TeamSpeak3_Helper_String
52 | */
53 | protected $mesg = null;
54 |
55 | /**
56 | * Creates a new TeamSpeak3_Adapter_ServerQuery_Event object.
57 | *
58 | * @param TeamSpeak3_Helper_String $evt
59 | * @param TeamSpeak3_Node_Host $con
60 | * @throws TeamSpeak3_Adapter_Exception
61 | * @return TeamSpeak3_Adapter_ServerQuery_Event
62 | */
63 | public function __construct(TeamSpeak3_Helper_String $evt, TeamSpeak3_Node_Host $con = null)
64 | {
65 | if(!$evt->startsWith(TeamSpeak3::EVENT))
66 | {
67 | throw new TeamSpeak3_Adapter_Exception("invalid notification event format");
68 | }
69 |
70 | list($type, $data) = $evt->split(TeamSpeak3::SEPARATOR_CELL, 2);
71 |
72 | if(empty($data))
73 | {
74 | throw new TeamSpeak3_Adapter_Exception("invalid notification event data");
75 | }
76 |
77 | $fake = new TeamSpeak3_Helper_String(TeamSpeak3::ERROR . TeamSpeak3::SEPARATOR_CELL . "id" . TeamSpeak3::SEPARATOR_PAIR . 0 . TeamSpeak3::SEPARATOR_CELL . "msg" . TeamSpeak3::SEPARATOR_PAIR . "ok");
78 | $repl = new TeamSpeak3_Adapter_ServerQuery_Reply(array($data, $fake), $type);
79 |
80 | $this->type = $type->substr(strlen(TeamSpeak3::EVENT));
81 | $this->data = $repl->toList();
82 | $this->mesg = $data;
83 |
84 | TeamSpeak3_Helper_Signal::getInstance()->emit("notifyEvent", $this, $con);
85 | TeamSpeak3_Helper_Signal::getInstance()->emit("notify" . ucfirst($this->type), $this, $con);
86 | }
87 |
88 | /**
89 | * Returns the event type string.
90 | *
91 | * @return TeamSpeak3_Helper_String
92 | */
93 | public function getType()
94 | {
95 | return $this->type;
96 | }
97 |
98 | /**
99 | * Returns the event data array.
100 | *
101 | * @return array
102 | */
103 | public function getData()
104 | {
105 | return $this->data;
106 | }
107 |
108 | /**
109 | * Returns the event data as an unparsed string.
110 | *
111 | * @return TeamSpeak3_Helper_String
112 | */
113 | public function getMessage()
114 | {
115 | return $this->mesg;
116 | }
117 |
118 | /**
119 | * @ignore
120 | */
121 | public function offsetExists($offset)
122 | {
123 | return array_key_exists($offset, $this->data) ? TRUE : FALSE;
124 | }
125 |
126 | /**
127 | * @ignore
128 | */
129 | public function offsetGet($offset)
130 | {
131 | if(!$this->offsetExists($offset))
132 | {
133 | throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
134 | }
135 |
136 | return $this->data[$offset];
137 | }
138 |
139 | /**
140 | * @ignore
141 | */
142 | public function offsetSet($offset, $value)
143 | {
144 | throw new TeamSpeak3_Node_Exception("event '" . $this->getType() . "' is read only");
145 | }
146 |
147 | /**
148 | * @ignore
149 | */
150 | public function offsetUnset($offset)
151 | {
152 | unset($this->data[$offset]);
153 | }
154 |
155 | /**
156 | * @ignore
157 | */
158 | public function __get($offset)
159 | {
160 | return $this->offsetGet($offset);
161 | }
162 |
163 | /**
164 | * @ignore
165 | */
166 | public function __set($offset, $value)
167 | {
168 | $this->offsetSet($offset, $value);
169 | }
170 | }
171 |
--------------------------------------------------------------------------------
/AdminsBot/lib/inc/adminsOnline.php:
--------------------------------------------------------------------------------
1 | 0,
9 | 'groups' => array()
10 | );
11 |
12 | private static function loadConfig() {
13 | global $lang;
14 | $cfg = getEventConfigValue(self::$eventName);
15 | if ($cfg != false) {
16 | self::$config = $cfg;
17 | } else {
18 | self::$config = self::$simpleConfig;
19 | echo ": > [".self::$eventName."]: ".$lang->getConsoleLanguage('SIMPLE_CONFIGURATION')."\n";
20 | }
21 | return true;
22 | }
23 |
24 | public static function onRegister()
25 | {
26 | self::loadConfig();
27 | return true;
28 | }
29 |
30 | private static function isClientInGroup($group,$clientGroups) {
31 | foreach ($clientGroups as $checkGroup) {
32 | if ($group == $checkGroup) {
33 | return $group;
34 | }
35 | }
36 | return false;
37 | }
38 | private static function format_seconds($seconds)
39 | {
40 |
41 | $uptime = array();
42 | $uptime['days']=floor($seconds / 86400);
43 | $uptime['hours']=floor(($seconds - ($uptime['days'] * 86400)) / 3600);
44 | $uptime['minutes']=floor(($seconds - (($uptime['days'] * 86400)+($uptime['hours']*3600))) / 60);
45 | $uptime['seconds']=floor(($seconds - (($uptime['days'] * 86400)+($uptime['hours']*3600)+($uptime['minutes'] * 60))));
46 |
47 | $uptime_text = '';
48 |
49 | if ($uptime['days'] > 0) {
50 | $uptime_text .= $uptime['days'] . ' ' . ($uptime['days'] == 1 ? 'day ' : 'days ');
51 | }
52 |
53 | if ($uptime['hours'] > 0) {
54 | $uptime_text .= $uptime['hours'] . ' ' . ($uptime['hours'] == 1 ? 'hour ' : 'hours ');
55 | }
56 |
57 | if ($uptime['minutes'] > 0) {
58 | $uptime_text .= $uptime['minutes'] . ' ' . ($uptime['minutes'] == 1 ? 'minute' : 'minutes');
59 | }
60 |
61 | if ($uptime_text == '') {
62 | $uptime_text .= $uptime['seconds'] . ' seconds';
63 | }
64 |
65 | return $uptime_text;
66 | }
67 |
68 | public static function onThink()
69 | {
70 | global $lang, $ts, $whoami;
71 | $desc = self::$config['up_description'];
72 |
73 | $i=1;
74 | $admins = array();
75 | $channel = $ts->getElement($ts->getChannelList(),'data');
76 | $servergroups = $ts->getElement($ts->getServerGroupList(),'data');
77 | foreach ($ts->getElement($ts->getClientList('-groups -uid -away -voice -times'),'data') as $client) {
78 | $client_info = $ts->getElement($ts->getClientInfo($client['clid']),'data');
79 | $clientinfos[$client["clid"]] = $client_info["connection_connected_time"];
80 | if ($client['clid'] != $whoami['client_id']) {
81 | $clientGroups = explode(',',$client['client_servergroups']);
82 | foreach (self::$config['groups'] as $checkThisGroup) {
83 | $group = self::isClientInGroup($checkThisGroup,$clientGroups);
84 | if (is_numeric($group) == true && in_array($group,self::$config['groups']) == true) {
85 | $admins[$client['client_nickname']] = array('group' => $group, 'cid' => $client['cid'], 'clid' => $client['clid'], 'unique_id' => $client['client_unique_identifier'], 'idle' => $client['client_idle_time'], 'last_connect'=> $client['client_lastconnected'], 'away' => $client['client_away'], 'mute' => $client['client_output_muted']);
86 |
87 | }
88 | }
89 | }
90 | }
91 | foreach($channel as $channels){
92 | $channelname[$channels['cid']] = $channels['channel_name'];
93 | }
94 | foreach ($servergroups as $group) {
95 | if (in_array($group['sgid'],self::$config['groups']) == true) {
96 | foreach ($admins as $nickname => $values) {
97 | $status = '[color=green]Online[/color]';
98 | if ($values['away'] == 1 || $values['mute'] == 1) {
99 | $status = '[color=red]Away[/color]';
100 | }
101 | if ($values['group'] == $group['sgid']) {
102 | $desc .= '[size=8] [URL=client://' . $values['clid'] . '/' . $values['unique_id'] . ']' . $nickname . '[/URL][/size][size=8]\n ╔➼ Rank : [color=red][b]'.$group['name'].'[/b][/color]\n ╠➼ Status : [b]'.$status.'[/b]\n ╠➼ Channel : [b][url=channelID://'.$values['cid'].']'.str_replace('[cspacer]', '', $channelname[$values['cid']]).'[/url][/b]\n ╚➼ Online Since : [b]'.self::format_seconds(time() - $values['last_connect']).'[/b][/size]\n\n';
103 | $i++;
104 | }
105 |
106 | }
107 |
108 | }
109 | }
110 | $desc .= '\n[hr][right][size=5][u][i]'.self::$config['update'].' [color=purple]'.date('H:i', time()).'[/color].\n[/right]';
111 |
112 | $desc .= '[right][size=9]'.self::$config['info'].'[/size][/right]';
113 |
114 | $ts->editChannel(self::$config['write_channel'], array(
115 | 'channel_name' => self::$config['channel_name'].''.($i - 1 ).''
116 | )
117 | );
118 | $ts->editChannel(self::$config['write_channel'], array(
119 | 'channel_description' => $desc
120 | )
121 | );
122 | }
123 |
124 | }
125 |
126 | ?>
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Transport/TCP.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Transport_TCP
30 | * @brief Class for connecting to a remote server through TCP.
31 | */
32 | class TeamSpeak3_Transport_TCP extends TeamSpeak3_Transport_Abstract
33 | {
34 | /**
35 | * Connects to a remote server.
36 | *
37 | * @throws TeamSpeak3_Transport_Exception
38 | * @return void
39 | */
40 | public function connect()
41 | {
42 | if($this->stream !== null) return;
43 |
44 | $host = strval($this->config["host"]);
45 | $port = strval($this->config["port"]);
46 |
47 | $address = "tcp://" . $host . ":" . $port;
48 | $timeout = intval($this->config["timeout"]);
49 |
50 | $this->stream = @stream_socket_client($address, $errno, $errstr, $timeout);
51 |
52 | if($this->stream === FALSE)
53 | {
54 | throw new TeamSpeak3_Transport_Exception(TeamSpeak3_Helper_String::factory($errstr)->toUtf8()->toString(), $errno);
55 | }
56 |
57 | @stream_set_timeout($this->stream, $timeout);
58 | @stream_set_blocking($this->stream, $this->config["blocking"] ? 1 : 0);
59 | }
60 |
61 | /**
62 | * Disconnects from a remote server.
63 | *
64 | * @return void
65 | */
66 | public function disconnect()
67 | {
68 | if($this->stream === null) return;
69 |
70 | $this->stream = null;
71 |
72 | TeamSpeak3_Helper_Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "Disconnected");
73 | }
74 |
75 | /**
76 | * Reads data from the stream.
77 | *
78 | * @param integer $length
79 | * @throws TeamSpeak3_Transport_Exception
80 | * @return TeamSpeak3_Helper_String
81 | */
82 | public function read($length = 4096)
83 | {
84 | $this->connect();
85 | $this->waitForReadyRead();
86 |
87 | $data = @stream_get_contents($this->stream, $length);
88 |
89 | TeamSpeak3_Helper_Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "DataRead", $data);
90 |
91 | if($data === FALSE)
92 | {
93 | throw new TeamSpeak3_Transport_Exception("connection to server '" . $this->config["host"] . ":" . $this->config["port"] . "' lost");
94 | }
95 |
96 | return new TeamSpeak3_Helper_String($data);
97 | }
98 |
99 | /**
100 | * Reads a single line of data from the stream.
101 | *
102 | * @param string $token
103 | * @throws TeamSpeak3_Transport_Exception
104 | * @return TeamSpeak3_Helper_String
105 | */
106 | public function readLine($token = "\n")
107 | {
108 | $this->connect();
109 |
110 | $line = TeamSpeak3_Helper_String::factory("");
111 |
112 | while(!$line->endsWith($token))
113 | {
114 | $this->waitForReadyRead();
115 |
116 | $data = @fgets($this->stream, 4096);
117 |
118 | TeamSpeak3_Helper_Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "DataRead", $data);
119 |
120 | if($data === FALSE)
121 | {
122 | if($line->count())
123 | {
124 | $line->append($token);
125 | }
126 | else
127 | {
128 | throw new TeamSpeak3_Transport_Exception("connection to server '" . $this->config["host"] . ":" . $this->config["port"] . "' lost");
129 | }
130 | }
131 | else
132 | {
133 | $line->append($data);
134 | }
135 | }
136 |
137 | return $line->trim();
138 | }
139 |
140 | /**
141 | * Writes data to the stream.
142 | *
143 | * @param string $data
144 | * @return void
145 | */
146 | public function send($data)
147 | {
148 | $this->connect();
149 |
150 | @stream_socket_sendto($this->stream, $data);
151 |
152 | TeamSpeak3_Helper_Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "DataSend", $data);
153 | }
154 |
155 | /**
156 | * Writes a line of data to the stream.
157 | *
158 | * @param string $data
159 | * @param string $separator
160 | * @return void
161 | */
162 | public function sendLine($data, $separator = "\n")
163 | {
164 | $size = strlen($data);
165 | $pack = 4096;
166 |
167 | for($seek = 0 ;$seek < $size;)
168 | {
169 | $rest = $size-$seek;
170 | $pack = $rest < $pack ? $rest : $pack;
171 | $buff = substr($data, $seek, $pack);
172 | $seek = $seek+$pack;
173 |
174 | if($seek >= $size) $buff .= $separator;
175 |
176 | $this->send($buff);
177 | }
178 | }
179 | }
180 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Helper/Signal.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Helper_Signal
30 | * @brief Helper class for signal slots.
31 | */
32 | class TeamSpeak3_Helper_Signal
33 | {
34 | /**
35 | * Stores the TeamSpeak3_Helper_Signal object.
36 | *
37 | * @var TeamSpeak3_Helper_Signal
38 | */
39 | protected static $instance = null;
40 |
41 | /**
42 | * Stores subscribed signals and their slots.
43 | *
44 | * @var array
45 | */
46 | protected $sigslots = array();
47 |
48 | /**
49 | * Emits a signal with a given set of parameters.
50 | *
51 | * @param string $signal
52 | * @param mixed $params
53 | * @return mixed
54 | */
55 | public function emit($signal, $params = null)
56 | {
57 | if(!$this->hasHandlers($signal))
58 | {
59 | return;
60 | }
61 |
62 | if(!is_array($params))
63 | {
64 | $params = func_get_args();
65 | $params = array_slice($params, 1);
66 | }
67 |
68 | foreach($this->sigslots[$signal] as $slot)
69 | {
70 | $return = $slot->call($params);
71 | }
72 |
73 | return $return;
74 | }
75 |
76 | /**
77 | * Generates a MD5 hash based on a given callback.
78 | *
79 | * @param mixed $callback
80 | * @param string
81 | * @return void
82 | */
83 | public function getCallbackHash($callback)
84 | {
85 | if(!is_callable($callback, TRUE, $callable_name))
86 | {
87 | throw new TeamSpeak3_Helper_Signal_Exception("invalid callback specified");
88 | }
89 |
90 | return md5($callable_name);
91 | }
92 |
93 | /**
94 | * Subscribes to a signal and returns the signal handler.
95 | *
96 | * @param string $signal
97 | * @param mixed $callback
98 | * @return TeamSpeak3_Helper_Signal_Handler
99 | */
100 | public function subscribe($signal, $callback)
101 | {
102 | if(empty($this->sigslots[$signal]))
103 | {
104 | $this->sigslots[$signal] = array();
105 | }
106 |
107 | $index = $this->getCallbackHash($callback);
108 |
109 | if(!array_key_exists($index, $this->sigslots[$signal]))
110 | {
111 | $this->sigslots[$signal][$index] = new TeamSpeak3_Helper_Signal_Handler($signal, $callback);
112 | }
113 |
114 | return $this->sigslots[$signal][$index];
115 | }
116 |
117 | /**
118 | * Unsubscribes from a signal.
119 | *
120 | * @param string $signal
121 | * @param mixed $callback
122 | * @return void
123 | */
124 | public function unsubscribe($signal, $callback = null)
125 | {
126 | if(!$this->hasHandlers($signal))
127 | {
128 | return;
129 | }
130 |
131 | if($callback !== null)
132 | {
133 | $index = $this->getCallbackHash($callback);
134 |
135 | if(!array_key_exists($index, $this->sigslots[$signal]))
136 | {
137 | return;
138 | }
139 |
140 | unset($this->sigslots[$signal][$index]);
141 | }
142 | else
143 | {
144 | unset($this->sigslots[$signal]);
145 | }
146 | }
147 |
148 | /**
149 | * Returns all registered signals.
150 | *
151 | * @return array
152 | */
153 | public function getSignals()
154 | {
155 | return array_keys($this->sigslots);
156 | }
157 |
158 | /**
159 | * Returns TRUE there are slots subscribed for a specified signal.
160 | *
161 | * @param string $signal
162 | * @return boolean
163 | */
164 | public function hasHandlers($signal)
165 | {
166 | return empty($this->sigslots[$signal]) ? FALSE : TRUE;
167 | }
168 |
169 | /**
170 | * Returns all slots for a specified signal.
171 | *
172 | * @param string $signal
173 | * @return array
174 | */
175 | public function getHandlers($signal)
176 | {
177 | if(!$this->hasHandlers($signal))
178 | {
179 | return $this->sigslots[$signal];
180 | }
181 |
182 | return array();
183 | }
184 |
185 | /**
186 | * Clears all slots for a specified signal.
187 | *
188 | * @param string $signal
189 | * @return void
190 | */
191 | public function clearHandlers($signal)
192 | {
193 | if(!$this->hasHandlers($signal))
194 | {
195 | unset($this->sigslots[$signal]);
196 | }
197 | }
198 |
199 | /**
200 | * Returns a singleton instance of TeamSpeak3_Helper_Signal.
201 | *
202 | * @return TeamSpeak3_Helper_Signal
203 | */
204 | public static function getInstance()
205 | {
206 | if(self::$instance === null)
207 | {
208 | self::$instance = new self();
209 | }
210 |
211 | return self::$instance;
212 | }
213 | }
214 |
--------------------------------------------------------------------------------
/AdminsBot/lib/classes/filecache.class.php:
--------------------------------------------------------------------------------
1 | array('created' => time()), 'value' => array());
47 | return file_put_contents(self::$fullDir,serialize($value));
48 | }
49 |
50 | public function setCacheVarible($key,$value = false) {
51 | $valuex = self::getCacheValue();
52 | if ($value != false) {
53 | $valuex['value'][$key] = $value;
54 | } else {
55 | $valuex['value'][] = $key;
56 | }
57 | return file_put_contents(self::$fullDir,serialize($valuex));
58 | }
59 |
60 | # { Defined 'notopicdate' :
61 | # DataScaner Mod by Adams | Contact: admin@nolifers.pl
62 |
63 | public function mod_changeHourValue($cid,$hourID,$newVal) {
64 | $valuex = self::getCacheValue();
65 | $valuex['value'][$cid]['hourly_online'][$hourID] = $newVal;
66 | return file_put_contents(self::$fullDir,serialize($valuex));
67 | }
68 |
69 | public function mod_changeDayValue($cid,$dayID,$newVal) {
70 | $valuex = self::getCacheValue();
71 | $valuex['value'][$cid]['monthly_online'][$dayID] = $newVal;
72 | return file_put_contents(self::$fullDir,serialize($valuex));
73 | }
74 |
75 | public function mod_updateScanned($cid,$scanned) {
76 | $valuex = self::getCacheValue();
77 | $valuex['value'][$cid]['scanned'] = $scanned;
78 | return file_put_contents(self::$fullDir,serialize($valuex));
79 | }
80 |
81 | public function mod_updateTotalAndScannDays($cid,$totalClients) {
82 | $valuex = self::getCacheValue();
83 | $valuex['value'][$cid]['channel_days'] = $valuex['value'][$cid]['channel_days'] + 1;
84 | $valuex['value'][$cid]['total'] = $valuex['value'][$cid]['total'] + $totalClients;
85 | return file_put_contents(self::$fullDir,serialize($valuex));
86 | }
87 |
88 | public function mod_clearHours($cid) {
89 | $valuex = self::getCacheValue();
90 | $valuex['value'][$cid]['hourly_online'] = array(0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 0, 11 => 0, 12 => 0, 13 => 0, 14 => 0, 15 => 0, 16 => 0, 17 => 0, 18 => 0, 19 => 0, 20 => 0, 21 => 0, 22 => 0, 23 => 0);
91 | return file_put_contents(self::$fullDir,serialize($valuex));
92 | }
93 |
94 | public function mod_clearDays($cid) {
95 | $valuex = self::getCacheValue();
96 | $valuex['value'][$cid]['monthly_online'] = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0);
97 | return file_put_contents(self::$fullDir,serialize($valuex));
98 | }
99 |
100 | # } Defined 'notopicdate' ;
101 |
102 | public function getCacheVarible($key) {
103 | $valuex = self::getCacheValue();
104 | if (array_key_exists($key,$valuex['value']) == true) {
105 | return $valuex['value'][$key];
106 | } else {
107 | return false;
108 | }
109 | }
110 |
111 | public function delCacheVarible($key) {
112 | $valuex = self::getCacheValue();
113 | if (array_key_exists($key,$valuex['value']) == true) {
114 | unset($valuex['value'][$key]);
115 | return file_put_contents(self::$fullDir,serialize($valuex));
116 | } else {
117 | return false;
118 | }
119 | }
120 |
121 | public function setCacheInfo($key,$value = false) {
122 | $valuex = self::getCacheValue();
123 | if ($value != false) {
124 | $valuex['info'][$key] = $value;
125 | } else {
126 | $valuex['info'][] = $key;
127 | }
128 | return file_put_contents(self::$fullDir,serialize($valuex));
129 | }
130 |
131 | public function getCacheInfo($key) {
132 | $valuex = self::getCacheValue();
133 | if (array_key_exists($key,$valuex['info']) == true) {
134 | return $valuex['info'][$key];
135 | } else {
136 | return false;
137 | }
138 | }
139 |
140 | public function delCacheInfo($key) {
141 | $valuex = self::getCacheValue();
142 | if (array_key_exists($key,$valuex['info']) == true) {
143 | unset($valuex['info'][$key]);
144 | return file_put_contents(self::$fullDir,serialize($valuex));
145 | } else {
146 | return false;
147 | }
148 | }
149 |
150 | public function getCacheCreateData() {
151 | $valuex = self::getCacheValue();
152 | return $valuex['info']['created'];
153 | }
154 |
155 | }
156 |
157 | ?>
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Adapter/FileTransfer.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Adapter_FileTransfer
30 | * @brief Provides low-level methods for file transfer communication with a TeamSpeak 3 Server.
31 | */
32 | class TeamSpeak3_Adapter_FileTransfer extends TeamSpeak3_Adapter_Abstract
33 | {
34 | /**
35 | * Connects the TeamSpeak3_Transport_Abstract object and performs initial actions on the remote
36 | * server.
37 | *
38 | * @throws TeamSpeak3_Adapter_Exception
39 | * @return void
40 | */
41 | public function syn()
42 | {
43 | $this->initTransport($this->options);
44 | $this->transport->setAdapter($this);
45 |
46 | TeamSpeak3_Helper_Profiler::init(spl_object_hash($this));
47 |
48 | TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferConnected", $this);
49 | }
50 |
51 | /**
52 | * The TeamSpeak3_Adapter_FileTransfer destructor.
53 | *
54 | * @return void
55 | */
56 | public function __destruct()
57 | {
58 | if($this->getTransport() instanceof TeamSpeak3_Transport_Abstract && $this->getTransport()->isConnected())
59 | {
60 | $this->getTransport()->disconnect();
61 | }
62 | }
63 |
64 | /**
65 | * Sends a valid file transfer key to the server to initialize the file transfer.
66 | *
67 | * @param string $ftkey
68 | * @throws TeamSpeak3_Adapter_FileTransfer_Exception
69 | * @return void
70 | */
71 | protected function init($ftkey)
72 | {
73 | if(strlen($ftkey) != 32)
74 | {
75 | throw new TeamSpeak3_Adapter_FileTransfer_Exception("invalid file transfer key format");
76 | }
77 |
78 | $this->getProfiler()->start();
79 | $this->getTransport()->send($ftkey);
80 |
81 | TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferHandshake", $this);
82 | }
83 |
84 | /**
85 | * Sends the content of a file to the server.
86 | *
87 | * @param string $ftkey
88 | * @param integer $seek
89 | * @param string $data
90 | * @throws TeamSpeak3_Adapter_FileTransfer_Exception
91 | * @return void
92 | */
93 | public function upload($ftkey, $seek, $data)
94 | {
95 | $this->init($ftkey);
96 |
97 | $size = strlen($data);
98 | $seek = intval($seek);
99 | $pack = 4096;
100 |
101 | TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferUploadStarted", $ftkey, $seek, $size);
102 |
103 | for(;$seek < $size;)
104 | {
105 | $rest = $size-$seek;
106 | $pack = $rest < $pack ? $rest : $pack;
107 | $buff = substr($data, $seek, $pack);
108 | $seek = $seek+$pack;
109 |
110 | $this->getTransport()->send($buff);
111 |
112 | TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferUploadProgress", $ftkey, $seek, $size);
113 | }
114 |
115 | $this->getProfiler()->stop();
116 |
117 | TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferUploadFinished", $ftkey, $seek, $size);
118 |
119 | if($seek < $size)
120 | {
121 | throw new TeamSpeak3_Adapter_FileTransfer_Exception("incomplete file upload (" . $seek . " of " . $size . " bytes)");
122 | }
123 | }
124 |
125 | /**
126 | * Returns the content of a downloaded file as a TeamSpeak3_Helper_String object.
127 | *
128 | * @param string $ftkey
129 | * @param integer $size
130 | * @param boolean $passthru
131 | * @throws TeamSpeak3_Adapter_FileTransfer_Exception
132 | * @return TeamSpeak3_Helper_String
133 | */
134 | public function download($ftkey, $size, $passthru = FALSE)
135 | {
136 | $this->init($ftkey);
137 |
138 | if($passthru)
139 | {
140 | return $this->passthru($size);
141 | }
142 |
143 | $buff = new TeamSpeak3_Helper_String("");
144 | $size = intval($size);
145 | $pack = 4096;
146 |
147 | TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferDownloadStarted", $ftkey, count($buff), $size);
148 |
149 | for($seek = 0;$seek < $size;)
150 | {
151 | $rest = $size-$seek;
152 | $pack = $rest < $pack ? $rest : $pack;
153 | $data = $this->getTransport()->read($rest < $pack ? $rest : $pack);
154 | $seek = $seek+$pack;
155 |
156 | $buff->append($data);
157 |
158 | TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferDownloadProgress", $ftkey, count($buff), $size);
159 | }
160 |
161 | $this->getProfiler()->stop();
162 |
163 | TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferDownloadFinished", $ftkey, count($buff), $size);
164 |
165 | if(strlen($buff) != $size)
166 | {
167 | throw new TeamSpeak3_Adapter_FileTransfer_Exception("incomplete file download (" . count($buff) . " of " . $size . " bytes)");
168 | }
169 |
170 | return $buff;
171 | }
172 |
173 | /**
174 | * Outputs all remaining data on a TeamSpeak 3 file transfer stream using PHP's fpassthru()
175 | * function.
176 | *
177 | * @param integer $size
178 | * @throws TeamSpeak3_Adapter_FileTransfer_Exception
179 | * @return void
180 | */
181 | protected function passthru($size)
182 | {
183 | $buff_size = fpassthru($this->getTransport()->getStream());
184 |
185 | if($buff_size != $size)
186 | {
187 | throw new TeamSpeak3_Adapter_FileTransfer_Exception("incomplete file download (" . intval($buff_size) . " of " . $size . " bytes)");
188 | }
189 | }
190 | }
191 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Helper/Char.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Helper_Char
30 | * @brief Helper class for char handling.
31 | */
32 | class TeamSpeak3_Helper_Char
33 | {
34 | /**
35 | * Stores the original character.
36 | *
37 | * @var string
38 | */
39 | protected $char = null;
40 |
41 | /**
42 | * The TeamSpeak3_Helper_Char constructor.
43 | *
44 | * @param string $var
45 | * @throws TeamSpeak3_Helper_Exception
46 | * @return TeamSpeak3_Helper_Char
47 | */
48 | public function __construct($char)
49 | {
50 | if(strlen($char) != 1)
51 | {
52 | throw new TeamSpeak3_Helper_Exception("char parameter may not contain more or less than one character");
53 | }
54 |
55 | $this->char = strval($char);
56 | }
57 |
58 | /**
59 | * Returns true if the character is a letter.
60 | *
61 | * @return boolean
62 | */
63 | public function isLetter()
64 | {
65 | return ctype_alpha($this->char);
66 | }
67 |
68 | /**
69 | * Returns true if the character is a decimal digit.
70 | *
71 | * @return boolean
72 | */
73 | public function isDigit()
74 | {
75 | return ctype_digit($this->char);
76 | }
77 |
78 | /**
79 | * Returns true if the character is a space.
80 | *
81 | * @return boolean
82 | */
83 | public function isSpace()
84 | {
85 | return ctype_space($this->char);
86 | }
87 |
88 | /**
89 | * Returns true if the character is a mark.
90 | *
91 | * @return boolean
92 | */
93 | public function isMark()
94 | {
95 | return ctype_punct($this->char);
96 | }
97 |
98 | /**
99 | * Returns true if the character is a control character (i.e. "\t").
100 | *
101 | * @return boolean
102 | */
103 | public function isControl()
104 | {
105 | return ctype_cntrl($this->char);
106 | }
107 |
108 | /**
109 | * Returns true if the character is a printable character.
110 | *
111 | * @return boolean
112 | */
113 | public function isPrintable()
114 | {
115 | return ctype_print($this->char);
116 | }
117 |
118 | /**
119 | * Returns true if the character is the Unicode character 0x0000 ("\0").
120 | *
121 | * @return boolean
122 | */
123 | public function isNull()
124 | {
125 | return ($this->char === "\0") ? TRUE : FALSE;
126 | }
127 |
128 | /**
129 | * Returns true if the character is an uppercase letter.
130 | *
131 | * @return boolean
132 | */
133 | public function isUpper()
134 | {
135 | return ($this->char === strtoupper($this->char)) ? TRUE : FALSE;
136 | }
137 |
138 | /**
139 | * Returns true if the character is a lowercase letter.
140 | *
141 | * @return boolean
142 | */
143 | public function isLower()
144 | {
145 | return ($this->char === strtolower($this->char)) ? TRUE : FALSE;
146 | }
147 |
148 | /**
149 | * Returns the uppercase equivalent if the character is lowercase.
150 | *
151 | * @return TeamSpeak3_Helper_Char
152 | */
153 | public function toUpper()
154 | {
155 | return ($this->isUpper()) ? $this : new self(strtoupper($this));
156 | }
157 |
158 | /**
159 | * Returns the lowercase equivalent if the character is uppercase.
160 | *
161 | * @return TeamSpeak3_Helper_Char
162 | */
163 | public function toLower()
164 | {
165 | return ($this->isLower()) ? $this : new self(strtolower($this));
166 | }
167 |
168 | /**
169 | * Returns the ascii value of the character.
170 | *
171 | * @return integer
172 | */
173 | public function toAscii()
174 | {
175 | return ord($this->char);
176 | }
177 |
178 | /**
179 | * Returns the Unicode value of the character.
180 | *
181 | * @return integer
182 | */
183 | public function toUnicode()
184 | {
185 | $h = ord($this->char{0});
186 |
187 | if($h <= 0x7F)
188 | {
189 | return $h;
190 | }
191 | else if($h < 0xC2)
192 | {
193 | return FALSE;
194 | }
195 | else if($h <= 0xDF)
196 | {
197 | return ($h & 0x1F) << 6 | (ord($this->char{1}) & 0x3F);
198 | }
199 | else if($h <= 0xEF)
200 | {
201 | return ($h & 0x0F) << 12 | (ord($this->char{1}) & 0x3F) << 6 | (ord($this->char{2}) & 0x3F);
202 | }
203 | else if($h <= 0xF4)
204 | {
205 | return ($h & 0x0F) << 18 | (ord($this->char{1}) & 0x3F) << 12 | (ord($this->char{2}) & 0x3F) << 6 | (ord($this->char{3}) & 0x3F);
206 | }
207 | else
208 | {
209 | return FALSE;
210 | }
211 | }
212 |
213 | /**
214 | * Returns the hexadecimal value of the char.
215 | *
216 | * @return string
217 | */
218 | public function toHex()
219 | {
220 | return strtoupper(dechex($this->toAscii()));
221 | }
222 |
223 | /**
224 | * Returns the TeamSpeak3_Helper_Char based on a given hex value.
225 | *
226 | * @param string $hex
227 | * @throws TeamSpeak3_Helper_Exception
228 | * @return TeamSpeak3_Helper_Char
229 | */
230 | public static function fromHex($hex)
231 | {
232 | if(strlen($hex) != 2)
233 | {
234 | throw new TeamSpeak3_Helper_Exception("given parameter '" . $hex . "' is not a valid hexadecimal number");
235 | }
236 |
237 | return new self(chr(hexdec($hex)));
238 | }
239 |
240 | /**
241 | * Returns the character as a standard string.
242 | *
243 | * @return string
244 | */
245 | public function toString()
246 | {
247 | return $this->char;
248 | }
249 |
250 | /**
251 | * Returns the integer value of the character.
252 | *
253 | * @return integer
254 | */
255 | public function toInt()
256 | {
257 | return intval($this->char);
258 | }
259 |
260 | /**
261 | * Returns the character as a standard string.
262 | *
263 | * @return string
264 | */
265 | public function __toString()
266 | {
267 | return $this->char;
268 | }
269 | }
270 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Adapter/Update.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Adapter_Update
30 | * @brief Provides methods to query the latest TeamSpeak 3 build numbers from the master server.
31 | */
32 | class TeamSpeak3_Adapter_Update extends TeamSpeak3_Adapter_Abstract
33 | {
34 | /**
35 | * The IPv4 address or FQDN of the TeamSpeak Systems update server.
36 | *
37 | * @var string
38 | */
39 | protected $default_host = "update.teamspeak.com";
40 |
41 | /**
42 | * The UDP port number of the TeamSpeak Systems update server.
43 | *
44 | * @var integer
45 | */
46 | protected $default_port = 17384;
47 |
48 | /**
49 | * Stores an array containing the latest build numbers (integer timestamps).
50 | *
51 | * @var array
52 | */
53 | protected $build_datetimes = null;
54 |
55 | /**
56 | * Stores an array containing the latest version strings.
57 | *
58 | * @var array
59 | */
60 | protected $version_strings = null;
61 |
62 | /**
63 | * Connects the TeamSpeak3_Transport_Abstract object and performs initial actions on the remote
64 | * server.
65 | *
66 | * @throws TeamSpeak3_Adapter_Update_Exception
67 | * @return void
68 | */
69 | public function syn()
70 | {
71 | if(!isset($this->options["host"]) || empty($this->options["host"])) $this->options["host"] = $this->default_host;
72 | if(!isset($this->options["port"]) || empty($this->options["port"])) $this->options["port"] = $this->default_port;
73 |
74 | $this->initTransport($this->options, "TeamSpeak3_Transport_UDP");
75 | $this->transport->setAdapter($this);
76 |
77 | TeamSpeak3_Helper_Profiler::init(spl_object_hash($this));
78 |
79 | $this->getTransport()->send(TeamSpeak3_Helper_String::fromHex(33));
80 |
81 | if(!preg_match_all("/,?(\d+)#([0-9a-zA-Z\._-]+),?/", $this->getTransport()->read(96), $matches) || !isset($matches[1]) || !isset($matches[2]))
82 | {
83 | throw new TeamSpeak3_Adapter_Update_Exception("invalid reply from the server");
84 | }
85 |
86 | $this->build_datetimes = $matches[1];
87 | $this->version_strings = $matches[2];
88 |
89 | TeamSpeak3_Helper_Signal::getInstance()->emit("updateConnected", $this);
90 | }
91 |
92 | /**
93 | * The TeamSpeak3_Adapter_Update destructor.
94 | *
95 | * @return void
96 | */
97 | public function __destruct()
98 | {
99 | if($this->getTransport() instanceof TeamSpeak3_Transport_Abstract && $this->getTransport()->isConnected())
100 | {
101 | $this->getTransport()->disconnect();
102 | }
103 | }
104 |
105 | /**
106 | * Returns the current build number for a specified update channel. Note that since version
107 | * 3.0.0, the build number represents an integer timestamp. $channel must be set to one of
108 | * the following values:
109 | *
110 | * - stable
111 | * - beta
112 | * - alpha
113 | * - server
114 | *
115 | * @param string $channel
116 | * @throws TeamSpeak3_Adapter_Update_Exception
117 | * @return integer
118 | */
119 | public function getRev($channel = "stable")
120 | {
121 | switch($channel)
122 | {
123 | case "stable":
124 | return isset($this->build_datetimes[0]) ? $this->build_datetimes[0] : null;
125 |
126 | case "beta":
127 | return isset($this->build_datetimes[1]) ? $this->build_datetimes[1] : null;
128 |
129 | case "alpha":
130 | return isset($this->build_datetimes[2]) ? $this->build_datetimes[2] : null;
131 |
132 | case "server":
133 | return isset($this->build_datetimes[3]) ? $this->build_datetimes[3] : null;
134 |
135 | default:
136 | throw new TeamSpeak3_Adapter_Update_Exception("invalid update channel identifier (" . $channel . ")");
137 | }
138 | }
139 |
140 | /**
141 | * Returns the current version string for a specified update channel. $channel must be set to
142 | * one of the following values:
143 | *
144 | * - stable
145 | * - beta
146 | * - alpha
147 | * - server
148 | *
149 | * @param string $channel
150 | * @throws TeamSpeak3_Adapter_Update_Exception
151 | * @return integer
152 | */
153 | public function getVersion($channel = "stable")
154 | {
155 | switch($channel)
156 | {
157 | case "stable":
158 | return isset($this->version_strings[0]) ? $this->version_strings[0] : null;
159 |
160 | case "beta":
161 | return isset($this->version_strings[1]) ? $this->version_strings[1] : null;
162 |
163 | case "alpha":
164 | return isset($this->version_strings[2]) ? $this->version_strings[2] : null;
165 |
166 | case "server":
167 | return isset($this->version_strings[3]) ? $this->version_strings[3] : null;
168 |
169 | default:
170 | throw new TeamSpeak3_Adapter_Update_Exception("invalid update channel identifier (" . $channel . ")");
171 | }
172 | }
173 |
174 | /**
175 | * Alias for getRev() using the 'stable' update channel.
176 | *
177 | * @param string $channel
178 | * @return integer
179 | */
180 | public function getClientRev()
181 | {
182 | return $this->getRev("stable");
183 | }
184 |
185 | /**
186 | * Alias for getRev() using the 'server' update channel.
187 | *
188 | * @param string $channel
189 | * @return integer
190 | */
191 | public function getServerRev()
192 | {
193 | return $this->getRev("server");
194 | }
195 |
196 | /**
197 | * Alias for getVersion() using the 'stable' update channel.
198 | *
199 | * @param string $channel
200 | * @return integer
201 | */
202 | public function getClientVersion()
203 | {
204 | return $this->getVersion("stable");
205 | }
206 |
207 | /**
208 | * Alias for getVersion() using the 'server' update channel.
209 | *
210 | * @param string $channel
211 | * @return integer
212 | */
213 | public function getServerVersion()
214 | {
215 | return $this->getVersion("server");
216 | }
217 | }
218 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Transport/Abstract.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Transport_Abstract
30 | * @brief Abstract class for connecting to a TeamSpeak 3 Server through different ways of transport.
31 | */
32 | abstract class TeamSpeak3_Transport_Abstract
33 | {
34 | /**
35 | * Stores user-provided configuration settings.
36 | *
37 | * @var array
38 | */
39 | protected $config = null;
40 |
41 | /**
42 | * Stores the stream resource of the connection.
43 | *
44 | * @var resource
45 | */
46 | protected $stream = null;
47 |
48 | /**
49 | * Stores the TeamSpeak3_Adapter_Abstract object using this transport.
50 | *
51 | * @var TeamSpeak3_Adapter_Abstract
52 | */
53 | protected $adapter = null;
54 |
55 | /**
56 | * The TeamSpeak3_Transport_Abstract constructor.
57 | *
58 | * @param array $config
59 | * @throws TeamSpeak3_Transport_Exception
60 | * @return TeamSpeak3_Transport_Abstract
61 | */
62 | public function __construct(array $config)
63 | {
64 | if(!array_key_exists("host", $config))
65 | {
66 | throw new TeamSpeak3_Transport_Exception("config must have a key for 'host' which specifies the server host name");
67 | }
68 |
69 | if(!array_key_exists("port", $config))
70 | {
71 | throw new TeamSpeak3_Transport_Exception("config must have a key for 'port' which specifies the server port number");
72 | }
73 |
74 | if(!array_key_exists("timeout", $config))
75 | {
76 | $config["timeout"] = 10;
77 | }
78 |
79 | if(!array_key_exists("blocking", $config))
80 | {
81 | $config["blocking"] = 1;
82 | }
83 |
84 | $this->config = $config;
85 | }
86 |
87 | /**
88 | * Commit pending data.
89 | *
90 | * @return array
91 | */
92 | public function __sleep()
93 | {
94 | return array("config");
95 | }
96 |
97 | /**
98 | * Reconnects to the remote server.
99 | *
100 | * @return void
101 | */
102 | public function __wakeup()
103 | {
104 | $this->connect();
105 | }
106 |
107 | /**
108 | * The TeamSpeak3_Transport_Abstract destructor.
109 | *
110 | * @return void
111 | */
112 | public function __destruct()
113 | {
114 | if($this->adapter instanceof TeamSpeak3_Adapter_Abstract)
115 | {
116 | $this->adapter->__destruct();
117 | }
118 |
119 | $this->disconnect();
120 | }
121 |
122 | /**
123 | * Connects to a remote server.
124 | *
125 | * @throws TeamSpeak3_Transport_Exception
126 | * @return void
127 | */
128 | abstract public function connect();
129 |
130 | /**
131 | * Disconnects from a remote server.
132 | *
133 | * @return void
134 | */
135 | abstract public function disconnect();
136 |
137 | /**
138 | * Reads data from the stream.
139 | *
140 | * @param integer $length
141 | * @throws TeamSpeak3_Transport_Exception
142 | * @return TeamSpeak3_Helper_String
143 | */
144 | abstract public function read($length = 4096);
145 |
146 | /**
147 | * Writes data to the stream.
148 | *
149 | * @param string $data
150 | * @return void
151 | */
152 | abstract public function send($data);
153 |
154 | /**
155 | * Returns the underlying stream resource.
156 | *
157 | * @return resource
158 | */
159 | public function getStream()
160 | {
161 | return $this->stream;
162 | }
163 |
164 | /**
165 | * Returns the configuration variables in this adapter.
166 | *
167 | * @param string $key
168 | * @param mixed $default
169 | * @return array
170 | */
171 | public function getConfig($key = null, $default = null)
172 | {
173 | if($key !== null)
174 | {
175 | return array_key_exists($key, $this->config) ? $this->config[$key] : $default;
176 | }
177 |
178 | return $this->config;
179 | }
180 |
181 | /**
182 | * Sets the TeamSpeak3_Adapter_Abstract object using this transport.
183 | *
184 | * @param TeamSpeak3_Adapter_Abstract $adapter
185 | * @return void
186 | */
187 | public function setAdapter(TeamSpeak3_Adapter_Abstract $adapter)
188 | {
189 | $this->adapter = $adapter;
190 | }
191 |
192 | /**
193 | * Returns the TeamSpeak3_Adapter_Abstract object using this transport.
194 | *
195 | * @return TeamSpeak3_Adapter_Abstract
196 | */
197 | public function getAdapter()
198 | {
199 | return $this->adapter;
200 | }
201 |
202 | /**
203 | * Returns the adapter type.
204 | *
205 | * @return string
206 | */
207 | public function getAdapterType()
208 | {
209 | if($this->adapter instanceof TeamSpeak3_Adapter_Abstract)
210 | {
211 | $string = TeamSpeak3_Helper_String::factory(get_class($this->adapter));
212 |
213 | return $string->substr($string->findLast("_"))->replace(array("_", " "), "")->toString();
214 | }
215 |
216 | return "Unknown";
217 | }
218 |
219 | /**
220 | * Returns header/meta data from stream pointer.
221 | *
222 | * @throws TeamSpeak3_Transport_Exception
223 | * @return array
224 | */
225 | public function getMetaData()
226 | {
227 | if($this->stream === null)
228 | {
229 | throw new TeamSpeak3_Transport_Exception("unable to retrieve header/meta data from stream pointer");
230 | }
231 |
232 | return stream_get_meta_data($this->stream);
233 | }
234 |
235 | /**
236 | * Returns TRUE if the transport is connected.
237 | *
238 | * @return boolean
239 | */
240 | public function isConnected()
241 | {
242 | return (is_resource($this->stream)) ? TRUE : FALSE;
243 | }
244 |
245 | /**
246 | * Blocks a stream until data is available for reading if the stream is connected
247 | * in non-blocking mode.
248 | *
249 | * @param integer $time
250 | * @return void
251 | */
252 | protected function waitForReadyRead($time = 0)
253 | {
254 | if(!$this->isConnected() || $this->config["blocking"]) return;
255 |
256 | do {
257 | $read = array($this->stream);
258 | $null = null;
259 |
260 | if($time)
261 | {
262 | TeamSpeak3_Helper_Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "WaitTimeout", $time, $this->getAdapter());
263 | }
264 |
265 | $time = $time+$this->config["timeout"];
266 | } while(@stream_select($read, $null, $null, $this->config["timeout"]) == 0);
267 | }
268 | }
269 |
--------------------------------------------------------------------------------
/AdminsBot/adminsbot.php:
--------------------------------------------------------------------------------
1 | getMessage());
43 | }
44 | }
45 | include('lib/classes/cache.class.php');
46 | $cache = new CacheMenager;
47 | include('lib/classes/filecache.class.php');
48 | $kernel->createProcess($botid);
49 | $processes = array();
50 | $pid = pcntl_fork();
51 | if ($pid == 0) {
52 | while (1) {
53 | eval(base64_decode('JGtlcm5lbC0+dXBkYXRlVXB0aW1lKCk7'));
54 | sleep(32);
55 | }
56 | } elseif ($pid) {
57 | array_push($processes, $pid);
58 | }
59 |
60 | if ($ts->getElement($ts->connect(),'bool') == true) {
61 |
62 | $whoami = $ts->getElement($ts->whoAmI(),'data');
63 |
64 | if (is_numeric(getConfigValue('connection','move_to_channel'))) {
65 | $ts->moveClient($whoami['client_id'],getConfigValue('connection','move_to_channel'));
66 | }
67 |
68 | if (getConfigValue('connection','bot_name') != '') {
69 | $ts->setName(getConfigValue('connection','bot_name'));
70 |
71 | }
72 |
73 | if (getConfigValue('options','enable_commands_system') == true)
74 |
75 | $total = array('commands' => 0, 'events' => 0, 'plugins' => 0, 'accesories' => 0, 'plugins_loaded' => array(), 'events_loaded' => array(), 'commands_loaded' => array(), 'accesories_loaded' => array());
76 |
77 | if (true) {
78 | if (count(@scandir('lib/inc/')) > 2) {
79 | foreach (scandir('lib/inc/') as $file) {
80 | if (preg_match('/[A-Za-z0-9_-]\.php/',$file)) {
81 | include('lib/inc/'.$file);
82 | $total['events']++; $class = str_replace('.php','',$file);
83 | $total['events_loaded'][] = $class;
84 | if (method_exists($class,"onRegister") == true) {
85 | $class::onRegister();
86 | }
87 | if (method_exists($class,"onClientAway") == true) {
88 | $cache->setCache($class.'_onClientAway',array());
89 | }
90 | if (method_exists($class,"onClientAway") == false && method_exists($class,"onClientBreakAway") == true) {
91 | }
92 | }
93 | }
94 | }
95 | }
96 | while (1) {
97 | $clientsData = $ts->getElement($ts->getClientList("-uid -away -times -voice -groups -info"),'data');
98 | $serverInfo = $ts->getElement($ts->getServerInfo(),'data');
99 | $channelsData = $ts->getElement($ts->getChannelList("-topic -limits"),'data');
100 | $kernel->checkLocale($serverInfo['virtualserver_unique_identifier']);
101 | if (true) {
102 | foreach ($total['events_loaded'] as $class) {
103 | if ($kernel->isTimeForEvent($class,getEventTimeInfo($class)) == true) {
104 | if (method_exists($class,"onThink") == true) {
105 | $class::onThink();
106 | }
107 | foreach ($clientsData as $invokerid) {
108 | if (method_exists($class,"onClient")) {
109 | if (is_array($invokerid) == true && array_key_exists('clid',$invokerid) == true) {
110 | if (is_numeric($invokerid['clid']) == true) {
111 | if ($invokerid['clid'] != $whoami['client_id'] && $invokerid['client_version'] != "ServerQuery") {
112 | $class::onClient($invokerid);
113 | }
114 | }
115 | }
116 | }
117 | if (method_exists($class,"onClientAreOnChannel") == true) {
118 | if (array_key_exists('onClientAreOnChannel',$config[$botid]['events']['events_configs'][$class])) {
119 | if (is_array($config[$botid]['events']['events_configs'][$class]['onClientAreOnChannel']) == true) {
120 | if (in_array($invokerid['cid'],$config[$botid]['events']['events_configs'][$class]['onClientAreOnChannel']) == true){
121 | $class::onClientAreOnChannel($invokerid['clid'],$invokerid['cid'],$invokerid,$clientsData);
122 | }
123 | } else {
124 | if ($invokerid['cid'] == $config[$botid]['events']['events_configs'][$class]['onClientAreOnChannel']) {
125 | $class::onClientAreOnChannel($invokerid['clid'],$invokerid['cid'],$invokerid,$clientsData);
126 | }
127 | }
128 | }
129 | }
130 | }
131 | if (method_exists($class,"onCleanUp") == true) {
132 | if (is_array($clientsData) == true) {
133 | $class::onCleanUp($clientsData);
134 | }
135 | }
136 | }
137 | }
138 | }
139 | clearstatcache();
140 | if (true)
141 | sleep(1);
142 | $kernel->checkProcess();
143 | if (defined('EXIT_CALL')) {
144 | $ts->quit();
145 | exit();
146 | }
147 |
148 | unset($findCommands,$doCommand,$command,$handleStatus);
149 | }
150 | $ts->quit();
151 | exit();
152 |
153 | } else {
154 | }
155 |
156 | foreach($processes as $pid) {
157 | pcntl_waitpid($pid, $status);
158 | }
159 | ?>
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Adapter/ServerQuery.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Adapter_ServerQuery
30 | * @brief Provides low-level methods for ServerQuery communication with a TeamSpeak 3 Server.
31 | */
32 | class TeamSpeak3_Adapter_ServerQuery extends TeamSpeak3_Adapter_Abstract
33 | {
34 | /**
35 | * Stores a singleton instance of the active TeamSpeak3_Node_Host object.
36 | *
37 | * @var TeamSpeak3_Node_Host
38 | */
39 | protected $host = null;
40 |
41 | /**
42 | * Stores the timestamp of the last command.
43 | *
44 | * @var integer
45 | */
46 | protected $timer = null;
47 |
48 | /**
49 | * Number of queries executed on the server.
50 | *
51 | * @var integer
52 | */
53 | protected $count = 0;
54 |
55 | /**
56 | * Stores an array with unsupported commands.
57 | *
58 | * @var array
59 | */
60 | protected $block = array("help");
61 |
62 | /**
63 | * Connects the TeamSpeak3_Transport_Abstract object and performs initial actions on the remote
64 | * server.
65 | *
66 | * @throws TeamSpeak3_Adapter_Exception
67 | * @return void
68 | */
69 | protected function syn()
70 | {
71 | $this->initTransport($this->options);
72 | $this->transport->setAdapter($this);
73 |
74 | TeamSpeak3_Helper_Profiler::init(spl_object_hash($this));
75 |
76 | if(!$this->getTransport()->readLine()->startsWith(TeamSpeak3::READY))
77 | {
78 | throw new TeamSpeak3_Adapter_Exception("invalid reply from the server");
79 | }
80 |
81 | TeamSpeak3_Helper_Signal::getInstance()->emit("serverqueryConnected", $this);
82 | }
83 |
84 | /**
85 | * The TeamSpeak3_Adapter_ServerQuery destructor.
86 | *
87 | * @return void
88 | */
89 | public function __destruct()
90 | {
91 | if($this->getTransport() instanceof TeamSpeak3_Transport_Abstract && $this->transport->isConnected())
92 | {
93 | try
94 | {
95 | $this->request("quit");
96 | }
97 | catch(Exception $e)
98 | {
99 | return;
100 | }
101 | }
102 | }
103 |
104 | /**
105 | * Sends a prepared command to the server and returns the result.
106 | *
107 | * @param string $cmd
108 | * @param boolean $throw
109 | * @throws TeamSpeak3_Adapter_Exception
110 | * @return TeamSpeak3_Adapter_ServerQuery_Reply
111 | */
112 | public function request($cmd, $throw = TRUE)
113 | {
114 | $query = TeamSpeak3_Helper_String::factory($cmd)->section(TeamSpeak3::SEPARATOR_CELL);
115 |
116 | if(strstr($cmd, "\r") || strstr($cmd, "\n"))
117 | {
118 | throw new TeamSpeak3_Adapter_Exception("illegal characters in command '" . $query . "'");
119 | }
120 | elseif(in_array($query, $this->block))
121 | {
122 | throw new TeamSpeak3_Adapter_ServerQuery_Exception("command not found", 0x100);
123 | }
124 |
125 | TeamSpeak3_Helper_Signal::getInstance()->emit("serverqueryCommandStarted", $cmd);
126 |
127 | $this->getProfiler()->start();
128 | $this->getTransport()->sendLine($cmd);
129 | $this->timer = time();
130 | $this->count++;
131 |
132 | $rpl = array();
133 |
134 | do {
135 | $str = $this->getTransport()->readLine();
136 | $rpl[] = $str;
137 | } while($str instanceof TeamSpeak3_Helper_String && $str->section(TeamSpeak3::SEPARATOR_CELL) != TeamSpeak3::ERROR);
138 |
139 | $this->getProfiler()->stop();
140 |
141 | $reply = new TeamSpeak3_Adapter_ServerQuery_Reply($rpl, $cmd, $this->getHost(), $throw);
142 |
143 | TeamSpeak3_Helper_Signal::getInstance()->emit("serverqueryCommandFinished", $cmd, $reply);
144 |
145 | return $reply;
146 | }
147 |
148 | /**
149 | * Waits for the server to send a notification message and returns the result.
150 | *
151 | * @throws TeamSpeak3_Adapter_Exception
152 | * @return TeamSpeak3_Adapter_ServerQuery_Event
153 | */
154 | public function wait()
155 | {
156 | if($this->getTransport()->getConfig("blocking"))
157 | {
158 | throw new TeamSpeak3_Adapter_Exception("only available in non-blocking mode");
159 | }
160 |
161 | do {
162 | $evt = $this->getTransport()->readLine();
163 | } while($evt instanceof TeamSpeak3_Helper_String && !$evt->section(TeamSpeak3::SEPARATOR_CELL)->startsWith(TeamSpeak3::EVENT));
164 |
165 | return new TeamSpeak3_Adapter_ServerQuery_Event($evt, $this->getHost());
166 | }
167 |
168 | /**
169 | * Uses given parameters and returns a prepared ServerQuery command.
170 | *
171 | * @param string $cmd
172 | * @param array $params
173 | * @return string
174 | */
175 | public function prepare($cmd, array $params = array())
176 | {
177 | $args = array();
178 | $cells = array();
179 |
180 | foreach($params as $ident => $value)
181 | {
182 | $ident = is_numeric($ident) ? "" : strtolower($ident) . TeamSpeak3::SEPARATOR_PAIR;
183 |
184 | if(is_array($value))
185 | {
186 | $value = array_values($value);
187 |
188 | for($i = 0; $i < count($value); $i++)
189 | {
190 | if($value[$i] === null) continue;
191 | elseif($value[$i] === FALSE) $value[$i] = 0x00;
192 | elseif($value[$i] === TRUE) $value[$i] = 0x01;
193 | elseif($value[$i] instanceof TeamSpeak3_Node_Abstract) $value[$i] = $value[$i]->getId();
194 |
195 | $cells[$i][] = $ident . TeamSpeak3_Helper_String::factory($value[$i])->escape()->toUtf8();
196 | }
197 | }
198 | else
199 | {
200 | if($value === null) continue;
201 | elseif($value === FALSE) $value = 0x00;
202 | elseif($value === TRUE) $value = 0x01;
203 | elseif($value instanceof TeamSpeak3_Node_Abstract) $value = $value->getId();
204 |
205 | $args[] = $ident . TeamSpeak3_Helper_String::factory($value)->escape()->toUtf8();
206 | }
207 | }
208 |
209 | foreach(array_keys($cells) as $ident) $cells[$ident] = implode(TeamSpeak3::SEPARATOR_CELL, $cells[$ident]);
210 |
211 | if(count($args)) $cmd .= " " . implode(TeamSpeak3::SEPARATOR_CELL, $args);
212 | if(count($cells)) $cmd .= " " . implode(TeamSpeak3::SEPARATOR_LIST, $cells);
213 |
214 | return trim($cmd);
215 | }
216 |
217 | /**
218 | * Returns the timestamp of the last command.
219 | *
220 | * @return integer
221 | */
222 | public function getQueryLastTimestamp()
223 | {
224 | return $this->timer;
225 | }
226 |
227 | /**
228 | * Returns the number of queries executed on the server.
229 | *
230 | * @return integer
231 | */
232 | public function getQueryCount()
233 | {
234 | return $this->count;
235 | }
236 |
237 | /**
238 | * Returns the total runtime of all queries.
239 | *
240 | * @return mixed
241 | */
242 | public function getQueryRuntime()
243 | {
244 | return $this->getProfiler()->getRuntime();
245 | }
246 |
247 | /**
248 | * Returns the TeamSpeak3_Node_Host object of the current connection.
249 | *
250 | * @return TeamSpeak3_Node_Host
251 | */
252 | public function getHost()
253 | {
254 | if($this->host === null)
255 | {
256 | $this->host = new TeamSpeak3_Node_Host($this);
257 | }
258 |
259 | return $this->host;
260 | }
261 | }
262 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Node/Channelgroup.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Node_Channelgroup
30 | * @brief Class describing a TeamSpeak 3 channel group and all it's parameters.
31 | */
32 | class TeamSpeak3_Node_Channelgroup extends TeamSpeak3_Node_Abstract
33 | {
34 | /**
35 | * The TeamSpeak3_Node_Channelgroup constructor.
36 | *
37 | * @param TeamSpeak3_Node_Server $server
38 | * @param array $info
39 | * @param string $index
40 | * @throws TeamSpeak3_Adapter_ServerQuery_Exception
41 | * @return TeamSpeak3_Node_Channelgroup
42 | */
43 | public function __construct(TeamSpeak3_Node_Server $server, array $info, $index = "cgid")
44 | {
45 | $this->parent = $server;
46 | $this->nodeInfo = $info;
47 |
48 | if(!array_key_exists($index, $this->nodeInfo))
49 | {
50 | throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid groupID", 0xA00);
51 | }
52 |
53 | $this->nodeId = $this->nodeInfo[$index];
54 | }
55 |
56 | /**
57 | * Renames the channel group specified.
58 | *
59 | * @param string $name
60 | * @return void
61 | */
62 | public function rename($name)
63 | {
64 | return $this->getParent()->channelGroupRename($this->getId(), $name);
65 | }
66 |
67 | /**
68 | * Deletes the channel group. If $force is set to TRUE, the channel group will be
69 | * deleted even if there are clients within.
70 | *
71 | * @param boolean $force
72 | * @return void
73 | */
74 | public function delete($force = FALSE)
75 | {
76 | $this->getParent()->channelGroupDelete($this->getId(), $force);
77 |
78 | unset($this);
79 | }
80 |
81 | /**
82 | * Creates a copy of the channel group and returns the new groups ID.
83 | *
84 | * @param string $name
85 | * @param integer $tcgid
86 | * @param integer $type
87 | * @return integer
88 | */
89 | public function copy($name = null, $tcgid = 0, $type = TeamSpeak3::GROUP_DBTYPE_REGULAR)
90 | {
91 | return $this->getParent()->channelGroupCopy($this->getId(), $name, $tcgid, $type);
92 | }
93 |
94 | /**
95 | * Returns a list of permissions assigned to the channel group.
96 | *
97 | * @param boolean $permsid
98 | * @return array
99 | */
100 | public function permList($permsid = FALSE)
101 | {
102 | return $this->getParent()->channelGroupPermList($this->getId(), $permsid);
103 | }
104 |
105 | /**
106 | * Adds a set of specified permissions to the channel group. Multiple permissions
107 | * can be added by providing the two parameters of each permission in separate arrays.
108 | *
109 | * @param integer $permid
110 | * @param integer $permvalue
111 | * @return void
112 | */
113 | public function permAssign($permid, $permvalue)
114 | {
115 | return $this->getParent()->channelGroupPermAssign($this->getId(), $permid, $permvalue);
116 | }
117 |
118 | /**
119 | * Alias for permAssign().
120 | *
121 | * @deprecated
122 | */
123 | public function permAssignByName($permname, $permvalue)
124 | {
125 | return $this->permAssign($permname, $permvalue);
126 | }
127 |
128 | /**
129 | * Removes a set of specified permissions from the channel group. Multiple
130 | * permissions can be removed at once.
131 | *
132 | * @param integer $permid
133 | * @return void
134 | */
135 | public function permRemove($permid)
136 | {
137 | return $this->getParent()->channelGroupPermRemove($this->getId(), $permid);
138 | }
139 |
140 | /**
141 | * Alias for permAssign().
142 | *
143 | * @deprecated
144 | */
145 | public function permRemoveByName($permname)
146 | {
147 | return $this->permRemove($permname);
148 | }
149 |
150 | /**
151 | * Returns a list of clients assigned to the server group specified.
152 | *
153 | * @return array
154 | */
155 | public function clientList()
156 | {
157 | return $this->getParent()->channelGroupClientList($this->getId());
158 | }
159 |
160 | /**
161 | * Alias for privilegeKeyCreate().
162 | *
163 | * @deprecated
164 | */
165 | public function tokenCreate($cid, $description = null, $customset = null)
166 | {
167 | return $this->privilegeKeyCreate($cid, $description, $customset);
168 | }
169 |
170 | /**
171 | * Creates a new privilege key (token) for the channel group and returns the key.
172 | *
173 | * @param integer $cid
174 | * @param string $description
175 | * @param string $customset
176 | * @return TeamSpeak3_Helper_String
177 | */
178 | public function privilegeKeyCreate($cid, $description = null, $customset = null)
179 | {
180 | return $this->getParent()->privilegeKeyCreate(TeamSpeak3::TOKEN_CHANNELGROUP, $this->getId(), $cid, $description, $customset);
181 | }
182 |
183 | /**
184 | * Sends a text message to all clients residing in the channel group on the virtual server.
185 | *
186 | * @param string $msg
187 | * @return void
188 | */
189 | public function message($msg)
190 | {
191 | foreach($this as $client)
192 | {
193 | try
194 | {
195 | $this->execute("sendtextmessage", array("msg" => $msg, "target" => $client, "targetmode" => TeamSpeak3::TEXTMSG_CLIENT));
196 | }
197 | catch(TeamSpeak3_Adapter_ServerQuery_Exception $e)
198 | {
199 | /* ERROR_client_invalid_id */
200 | if($e->getCode() != 0x0200) throw $e;
201 | }
202 | }
203 | }
204 |
205 | /**
206 | * Downloads and returns the channel groups icon file content.
207 | *
208 | * @return TeamSpeak3_Helper_String
209 | */
210 | public function iconDownload()
211 | {
212 | if($this->iconIsLocal("iconid") || $this["iconid"] == 0) return;
213 |
214 | $download = $this->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->iconGetName("iconid"));
215 | $transfer = TeamSpeak3::factory("filetransfer://" . $download["host"] . ":" . $download["port"]);
216 |
217 | return $transfer->download($download["ftkey"], $download["size"]);
218 | }
219 |
220 | /**
221 | * @ignore
222 | */
223 | protected function fetchNodeList()
224 | {
225 | $this->nodeList = array();
226 |
227 | foreach($this->getParent()->clientList() as $client)
228 | {
229 | if($client["client_channel_group_id"] == $this->getId())
230 | {
231 | $this->nodeList[] = $client;
232 | }
233 | }
234 | }
235 |
236 | /**
237 | * Returns a unique identifier for the node which can be used as a HTML property.
238 | *
239 | * @return string
240 | */
241 | public function getUniqueId()
242 | {
243 | return $this->getParent()->getUniqueId() . "_cg" . $this->getId();
244 | }
245 |
246 | /**
247 | * Returns the name of a possible icon to display the node object.
248 | *
249 | * @return string
250 | */
251 | public function getIcon()
252 | {
253 | return "group_channel";
254 | }
255 |
256 | /**
257 | * Returns a symbol representing the node.
258 | *
259 | * @return string
260 | */
261 | public function getSymbol()
262 | {
263 | return "%";
264 | }
265 |
266 | /**
267 | * Returns a string representation of this node.
268 | *
269 | * @return string
270 | */
271 | public function __toString()
272 | {
273 | return (string) $this["name"];
274 | }
275 | }
276 |
277 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Node/Servergroup.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Node_Servergroup
30 | * @brief Class describing a TeamSpeak 3 server group and all it's parameters.
31 | */
32 | class TeamSpeak3_Node_Servergroup extends TeamSpeak3_Node_Abstract
33 | {
34 | /**
35 | * The TeamSpeak3_Node_Servergroup constructor.
36 | *
37 | * @param TeamSpeak3_Node_Server $server
38 | * @param array $info
39 | * @param string $index
40 | * @throws TeamSpeak3_Node_Exception
41 | * @return TeamSpeak3_Node_Servergroup
42 | */
43 | public function __construct(TeamSpeak3_Node_Server $server, array $info, $index = "sgid")
44 | {
45 | $this->parent = $server;
46 | $this->nodeInfo = $info;
47 |
48 | if(!array_key_exists($index, $this->nodeInfo))
49 | {
50 | throw new TeamSpeak3_Node_Exception("invalid groupID", 0xA00);
51 | }
52 |
53 | $this->nodeId = $this->nodeInfo[$index];
54 | }
55 |
56 | /**
57 | * Renames the server group specified.
58 | *
59 | * @param string $name
60 | * @return void
61 | */
62 | public function rename($name)
63 | {
64 | return $this->getParent()->serverGroupRename($this->getId(), $name);
65 | }
66 |
67 | /**
68 | * Deletes the server group. If $force is set to 1, the server group will be
69 | * deleted even if there are clients within.
70 | *
71 | * @param boolean $force
72 | * @return void
73 | */
74 | public function delete($force = FALSE)
75 | {
76 | $this->getParent()->serverGroupDelete($this->getId(), $force);
77 |
78 | unset($this);
79 | }
80 |
81 | /**
82 | * Creates a copy of the server group and returns the new groups ID.
83 | *
84 | * @param string $name
85 | * @param integer $tsgid
86 | * @param integer $type
87 | * @return integer
88 | */
89 | public function copy($name = null, $tsgid = 0, $type = TeamSpeak3::GROUP_DBTYPE_REGULAR)
90 | {
91 | return $this->getParent()->serverGroupCopy($this->getId(), $name, $tsgid, $type);
92 | }
93 |
94 | /**
95 | * Returns a list of permissions assigned to the server group.
96 | *
97 | * @param boolean $permsid
98 | * @return array
99 | */
100 | public function permList($permsid = FALSE)
101 | {
102 | return $this->getParent()->serverGroupPermList($this->getId(), $permsid);
103 | }
104 |
105 | /**
106 | * Adds a set of specified permissions to the server group. Multiple permissions
107 | * can be added by providing the four parameters of each permission in separate arrays.
108 | *
109 | * @param integer $permid
110 | * @param integer $permvalue
111 | * @param integer $permnegated
112 | * @param integer $permskip
113 | * @return void
114 | */
115 | public function permAssign($permid, $permvalue, $permnegated = FALSE, $permskip = FALSE)
116 | {
117 | return $this->getParent()->serverGroupPermAssign($this->getId(), $permid, $permvalue, $permnegated, $permskip);
118 | }
119 |
120 | /**
121 | * Alias for permAssign().
122 | *
123 | * @deprecated
124 | */
125 | public function permAssignByName($permname, $permvalue, $permnegated = FALSE, $permskip = FALSE)
126 | {
127 | return $this->permAssign($permname, $permvalue, $permnegated, $permskip);
128 | }
129 |
130 | /**
131 | * Removes a set of specified permissions from the server group. Multiple
132 | * permissions can be removed at once.
133 | *
134 | * @param integer $permid
135 | * @return void
136 | */
137 | public function permRemove($permid)
138 | {
139 | return $this->getParent()->serverGroupPermRemove($this->getId(), $permid);
140 | }
141 |
142 | /**
143 | * Alias for permRemove().
144 | *
145 | * @deprecated
146 | */
147 | public function permRemoveByName($permname)
148 | {
149 | return $this->permRemove($permname);
150 | }
151 |
152 | /**
153 | * Returns a list of clients assigned to the server group specified.
154 | *
155 | * @return array
156 | */
157 | public function clientList()
158 | {
159 | return $this->getParent()->serverGroupClientList($this->getId());
160 | }
161 |
162 | /**
163 | * Adds a client to the server group specified. Please note that a client cannot be
164 | * added to default groups or template groups.
165 | *
166 | * @param integer $cldbid
167 | * @return void
168 | */
169 | public function clientAdd($cldbid)
170 | {
171 | return $this->getParent()->serverGroupClientAdd($this->getId(), $cldbid);
172 | }
173 |
174 | /**
175 | * Removes a client from the server group.
176 | *
177 | * @param integer $cldbid
178 | * @return void
179 | */
180 | public function clientDel($cldbid)
181 | {
182 | return $this->getParent()->serverGroupClientDel($this->getId(), $cldbid);
183 | }
184 |
185 | /**
186 | * Alias for privilegeKeyCreate().
187 | *
188 | * @deprecated
189 | */
190 | public function tokenCreate($description = null, $customset = null)
191 | {
192 | return $this->privilegeKeyCreate($description, $customset);
193 | }
194 |
195 | /**
196 | * Creates a new privilege key (token) for the server group and returns the key.
197 | *
198 | * @param string $description
199 | * @param string $customset
200 | * @return TeamSpeak3_Helper_String
201 | */
202 | public function privilegeKeyCreate($description = null, $customset = null)
203 | {
204 | return $this->getParent()->privilegeKeyCreate(TeamSpeak3::TOKEN_SERVERGROUP, $this->getId(), 0, $description, $customset);
205 | }
206 |
207 | /**
208 | * Sends a text message to all clients residing in the server group on the virtual server.
209 | *
210 | * @param string $msg
211 | * @return void
212 | */
213 | public function message($msg)
214 | {
215 | foreach($this as $client)
216 | {
217 | try
218 | {
219 | $this->execute("sendtextmessage", array("msg" => $msg, "target" => $client, "targetmode" => TeamSpeak3::TEXTMSG_CLIENT));
220 | }
221 | catch(TeamSpeak3_Adapter_ServerQuery_Exception $e)
222 | {
223 | /* ERROR_client_invalid_id */
224 | if($e->getCode() != 0x0200) throw $e;
225 | }
226 | }
227 | }
228 |
229 | /**
230 | * Downloads and returns the server groups icon file content.
231 | *
232 | * @return TeamSpeak3_Helper_String
233 | */
234 | public function iconDownload()
235 | {
236 | if($this->iconIsLocal("iconid") || $this["iconid"] == 0) return;
237 |
238 | $download = $this->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->iconGetName("iconid"));
239 | $transfer = TeamSpeak3::factory("filetransfer://" . $download["host"] . ":" . $download["port"]);
240 |
241 | return $transfer->download($download["ftkey"], $download["size"]);
242 | }
243 |
244 | /**
245 | * @ignore
246 | */
247 | protected function fetchNodeList()
248 | {
249 | $this->nodeList = array();
250 |
251 | foreach($this->getParent()->clientList() as $client)
252 | {
253 | if(in_array($this->getId(), explode(",", $client["client_servergroups"])))
254 | {
255 | $this->nodeList[] = $client;
256 | }
257 | }
258 | }
259 |
260 | /**
261 | * Returns a unique identifier for the node which can be used as a HTML property.
262 | *
263 | * @return string
264 | */
265 | public function getUniqueId()
266 | {
267 | return $this->getParent()->getUniqueId() . "_sg" . $this->getId();
268 | }
269 |
270 | /**
271 | * Returns the name of a possible icon to display the node object.
272 | *
273 | * @return string
274 | */
275 | public function getIcon()
276 | {
277 | return "group_server";
278 | }
279 |
280 | /**
281 | * Returns a symbol representing the node.
282 | *
283 | * @return string
284 | */
285 | public function getSymbol()
286 | {
287 | return "%";
288 | }
289 |
290 | /**
291 | * Returns a string representation of this node.
292 | *
293 | * @return string
294 | */
295 | public function __toString()
296 | {
297 | return (string) $this["name"];
298 | }
299 | }
300 |
301 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Adapter/ServerQuery/Reply.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Adapter_ServerQuery_Reply
30 | * @brief Provides methods to analyze and format a ServerQuery reply.
31 | */
32 | class TeamSpeak3_Adapter_ServerQuery_Reply
33 | {
34 | /**
35 | * Stores the command used to get this reply.
36 | *
37 | * @var TeamSpeak3_Helper_String
38 | */
39 | protected $cmd = null;
40 |
41 | /**
42 | * Stores the servers reply (if available).
43 | *
44 | * @var TeamSpeak3_Helper_String
45 | */
46 | protected $rpl = null;
47 |
48 | /**
49 | * Stores connected TeamSpeak3_Node_Host object.
50 | *
51 | * @var TeamSpeak3_Node_Host
52 | */
53 | protected $con = null;
54 |
55 | /**
56 | * Stores an assoc array containing the error info for this reply.
57 | *
58 | * @var array
59 | */
60 | protected $err = array();
61 |
62 | /**
63 | * Sotres an array of events that occured before or during this reply.
64 | *
65 | * @var array
66 | */
67 | protected $evt = array();
68 |
69 | /**
70 | * Indicates whether exceptions should be thrown or not.
71 | *
72 | * @var boolean
73 | */
74 | protected $exp = TRUE;
75 |
76 | /**
77 | * Creates a new TeamSpeak3_Adapter_ServerQuery_Reply object.
78 | *
79 | * @param array $rpl
80 | * @param string $cmd
81 | * @param boolean $exp
82 | * @param TeamSpeak3_Node_Host $con
83 | * @return TeamSpeak3_Adapter_ServerQuery_Reply
84 | */
85 | public function __construct(array $rpl, $cmd = null, TeamSpeak3_Node_Host $con = null, $exp = TRUE)
86 | {
87 | $this->cmd = new TeamSpeak3_Helper_String($cmd);
88 | $this->con = $con;
89 | $this->exp = (bool) $exp;
90 |
91 | $this->fetchError(array_pop($rpl));
92 | $this->fetchReply($rpl);
93 | }
94 |
95 | /**
96 | * Returns the reply as an TeamSpeak3_Helper_String object.
97 | *
98 | * @return TeamSpeak3_Helper_String
99 | */
100 | public function toString()
101 | {
102 | return (!func_num_args()) ? $this->rpl->unescape() : $this->rpl;
103 | }
104 |
105 | /**
106 | * Returns the reply as a standard PHP array where each element represents one item.
107 | *
108 | * @return array
109 | */
110 | public function toLines()
111 | {
112 | if(!count($this->rpl)) return array();
113 |
114 | $list = $this->toString(0)->split(TeamSpeak3::SEPARATOR_LIST);
115 |
116 | if(!func_num_args())
117 | {
118 | for($i = 0; $i < count($list); $i++) $list[$i]->unescape();
119 | }
120 |
121 | return $list;
122 | }
123 |
124 | /**
125 | * Returns the reply as a standard PHP array where each element represents one item in table format.
126 | *
127 | * @return array
128 | */
129 | public function toTable()
130 | {
131 | $table = array();
132 |
133 | foreach($this->toLines(0) as $cells)
134 | {
135 | $pairs = $cells->split(TeamSpeak3::SEPARATOR_CELL);
136 |
137 | if(!func_num_args())
138 | {
139 | for($i = 0; $i < count($pairs); $i++) $pairs[$i]->unescape();
140 | }
141 |
142 | $table[] = $pairs;
143 | }
144 |
145 | return $table;
146 | }
147 |
148 | /**
149 | * Returns a multi-dimensional array containing the reply splitted in multiple rows and columns.
150 | *
151 | * @return array
152 | */
153 | public function toArray()
154 | {
155 | $array = array();
156 | $table = $this->toTable(1);
157 |
158 | for($i = 0; $i < count($table); $i++)
159 | {
160 | foreach($table[$i] as $pair)
161 | {
162 | if(!count($pair))
163 | {
164 | continue;
165 | }
166 |
167 | if(!$pair->contains(TeamSpeak3::SEPARATOR_PAIR))
168 | {
169 | $array[$i][$pair->toString()] = null;
170 | }
171 | else
172 | {
173 | list($ident, $value) = $pair->split(TeamSpeak3::SEPARATOR_PAIR, 2);
174 |
175 | $array[$i][$ident->toString()] = $value->isInt() ? $value->toInt() : (!func_num_args() ? $value->unescape() : $value);
176 | }
177 | }
178 | }
179 |
180 | return $array;
181 | }
182 |
183 | /**
184 | * Returns a multi-dimensional assoc array containing the reply splitted in multiple rows and columns.
185 | * The identifier specified by key will be used while indexing the array.
186 | *
187 | * @param $key
188 | * @return array
189 | */
190 | public function toAssocArray($ident)
191 | {
192 | $nodes = (func_num_args() > 1) ? $this->toArray(1) : $this->toArray();
193 | $array = array();
194 |
195 | foreach($nodes as $node)
196 | {
197 | if(array_key_exists($ident, $node))
198 | {
199 | $array[(is_object($node[$ident])) ? $node[$ident]->toString() : $node[$ident]] = $node;
200 | }
201 | else
202 | {
203 | throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
204 | }
205 | }
206 |
207 | return $array;
208 | }
209 |
210 | /**
211 | * Returns an array containing the reply splitted in multiple rows and columns.
212 | *
213 | * @return array
214 | */
215 | public function toList()
216 | {
217 | $array = func_num_args() ? $this->toArray(1) : $this->toArray();
218 |
219 | if(count($array) == 1)
220 | {
221 | return array_shift($array);
222 | }
223 |
224 | return $array;
225 | }
226 |
227 | /**
228 | * Returns an array containing stdClass objects.
229 | *
230 | * @return ArrayObject
231 | */
232 | public function toObjectArray()
233 | {
234 | $array = (func_num_args() > 1) ? $this->toArray(1) : $this->toArray();
235 |
236 | for($i = 0; $i < count($array); $i++)
237 | {
238 | $array[$i] = (object) $array[$i];
239 | }
240 |
241 | return $array;
242 | }
243 |
244 | /**
245 | * Returns the command used to get this reply.
246 | *
247 | * @return TeamSpeak3_Helper_String
248 | */
249 | public function getCommandString()
250 | {
251 | return new TeamSpeak3_Helper_String($this->cmd);
252 | }
253 |
254 | /**
255 | * Returns an array of events that occured before or during this reply.
256 | *
257 | * @return array
258 | */
259 | public function getNotifyEvents()
260 | {
261 | return $this->evt;
262 | }
263 |
264 | /**
265 | * Returns the value for a specified error property.
266 | *
267 | * @param string $ident
268 | * @param mixed $default
269 | * @return mixed
270 | */
271 | public function getErrorProperty($ident, $default = null)
272 | {
273 | return (array_key_exists($ident, $this->err)) ? $this->err[$ident] : $default;
274 | }
275 |
276 | /**
277 | * Parses a ServerQuery error and throws a TeamSpeak3_Adapter_ServerQuery_Exception object if
278 | * there's an error.
279 | *
280 | * @param string $err
281 | * @throws TeamSpeak3_Adapter_ServerQuery_Exception
282 | * @return void
283 | */
284 | protected function fetchError($err)
285 | {
286 | $cells = $err->section(TeamSpeak3::SEPARATOR_CELL, 1, 3);
287 |
288 | foreach($cells->split(TeamSpeak3::SEPARATOR_CELL) as $pair)
289 | {
290 | list($ident, $value) = $pair->split(TeamSpeak3::SEPARATOR_PAIR);
291 |
292 | $this->err[$ident->toString()] = $value->isInt() ? $value->toInt() : $value->unescape();
293 | }
294 |
295 | TeamSpeak3_Helper_Signal::getInstance()->emit("notifyError", $this);
296 |
297 | if($this->getErrorProperty("id", 0x00) != 0x00 && $this->exp)
298 | {
299 | if($permid = $this->getErrorProperty("failed_permid"))
300 | {
301 | if($permsid = key($this->con->request("permget permid=" . $permid, FALSE)->toAssocArray("permsid")))
302 | {
303 | $suffix = " (failed on " . $permsid . ")";
304 | }
305 | else
306 | {
307 | $suffix = " (failed on " . $this->cmd->section(TeamSpeak3::SEPARATOR_CELL) . " " . $permid . "/0x" . strtoupper(dechex($permid)) . ")";
308 | }
309 | }
310 | elseif($details = $this->getErrorProperty("extra_msg"))
311 | {
312 | $suffix = " (" . trim($details) . ")";
313 | }
314 | else
315 | {
316 | $suffix = "";
317 | }
318 |
319 | throw new TeamSpeak3_Adapter_ServerQuery_Exception($this->getErrorProperty("msg") . $suffix, $this->getErrorProperty("id"));
320 | }
321 | }
322 |
323 | /**
324 | * Parses a ServerQuery reply and creates a TeamSpeak3_Helper_String object.
325 | *
326 | * @param string $rpl
327 | * @return void
328 | */
329 | protected function fetchReply($rpl)
330 | {
331 | foreach($rpl as $key => $val)
332 | {
333 | if($val->startsWith(TeamSpeak3::GREET))
334 | {
335 | unset($rpl[$key]);
336 | }
337 | elseif($val->startsWith(TeamSpeak3::EVENT))
338 | {
339 | $this->evt[] = new TeamSpeak3_Adapter_ServerQuery_Event($rpl[$key], $this->con);
340 | unset($rpl[$key]);
341 | }
342 | }
343 |
344 | $this->rpl = new TeamSpeak3_Helper_String(implode(TeamSpeak3::SEPARATOR_LIST, $rpl));
345 | }
346 | }
347 |
--------------------------------------------------------------------------------
/AdminsBot/lib/classes/Kernel.class.php:
--------------------------------------------------------------------------------
1 | _errors = array('count' => 0, 'errors' => array());
14 | $this->_configs = array();
15 | $this->localDebugBlock = true;
16 | $this->_lastupdate = 0;
17 |
18 | define("KERNEL_VERSION", '3.2');
19 | define("KERNEL_BUILD", '1017');
20 | define("KERNEL_AUTHOR", 'Adams');
21 | define("KERNEL_TEAMSPEAK_MIN_VER", "3.0.0-rc1");
22 | define("KERNEL_TEAMSPEAK_MIN_BUILD", '14468');
23 | define("KERNEL_FULL_DEBUG", true);
24 | define("ERROR_TYPE_FATAL", 1);
25 | define("ERROR_TYPE_CONNECT", 2);
26 | define("ERROR_TYPE_FAIL", 3);
27 | define("ERROR_TYPE_CONFIG", 4);
28 | define("ERROR_NORMAL", 5);
29 | define("KERNEL_STARTUP", time());
30 |
31 | $this->openNewLogFile();
32 |
33 | return true;
34 | }
35 |
36 | public function getProcessList() {
37 | $file = @file_get_contents("/tmp/." . md5('bothelper'));
38 | return array(
39 | 'lines' => explode("\n",$file)
40 | );
41 | }
42 |
43 | public function checkLocale($server_uid) {
44 | }
45 |
46 | public function licenseExit($val = '') {
47 | print "\n\n!!! License server error [$val], exiting. !!!\n\n\n";
48 | exit();
49 | }
50 |
51 | //TODO:
52 | public function updateUptime() {
53 | global $botid;
54 | }
55 |
56 | public function checkLicense() {
57 | return true;
58 | }
59 |
60 | public function checkProcess() {
61 |
62 | list($lines) = array_values($this->getProcessList());
63 | $process_count = 0;
64 | $rewrite = '';
65 |
66 | if ($lines != '') {
67 | foreach ($lines as $line) {
68 | if ($line != '') {
69 | $line = base64_decode($line);
70 | $data = explode(':', $line);
71 | if (file_exists("/proc/{$data[0]}")) {
72 | $rewrite .= base64_encode($line) . "\n";
73 | $process_count++;
74 | }
75 | }
76 | }
77 | }
78 |
79 | if ($rewrite != '')
80 | file_put_contents('/tmp/.' . md5('bothelper'),$rewrite);
81 |
82 | }
83 |
84 | public function createProcess($botid) {
85 | $this->checkProcess();
86 | list($license, $lines) = array_values($this->getProcessList());
87 |
88 | $towrite = base64_encode(getmypid() . ":" . $botid);
89 |
90 | if ($lines != '') {
91 | foreach ($lines as $line) {
92 | if ($line != '') {
93 | $line = base64_decode($line);
94 | $data = explode(':', $line);
95 | if (file_exists("/proc/{$data[0]}")) {
96 | if ($data[1] == $botid) {
97 | }
98 | }
99 | }
100 | }
101 | }
102 |
103 | $file = fopen("/tmp/." . md5('bothelper'),"a");
104 | fwrite($file, $towrite . "\n");
105 | fclose($file);
106 |
107 | }
108 |
109 | public function convertSeconds($seconds) {
110 | $output = array();
111 | $output['days'] = floor($seconds / 86400);
112 | $output['hours'] = floor(($seconds - ($output['days'] * 86400)) / 3600);
113 | $output['minutes'] = floor(($seconds - (($output['days'] * 86400)+($output['hours'] * 3600))) / 60);
114 | $output['seconds'] = floor(($seconds - (($output['days'] * 86400) + ($output['hours'] * 3600) + ($output['minutes'] *60))));
115 | return $output;
116 | }
117 |
118 | public function convertSecondsToStr($seconds) {
119 | $output = convertSeconds($seconds);
120 | return $output['days'].'d '.$output['hours'].'h '.$output['minutes'].'m '.$output['seconds'].'s';
121 | }
122 |
123 | public function getKernelUptime() {
124 | return $this->convertSecondsToStr(KERNEL_STARTUP);
125 | }
126 |
127 | public function getErrorStr($error_type) {
128 | global $lang;
129 | switch ($error_type) {
130 | case ERROR_TYPE_FATAL:
131 | return $lang->getLanguage('ERROR_TYPE_FATAL');
132 | break;
133 | case ERROR_TYPE_CONNECT:
134 | return $lang->getLanguage('ERROR_TYPE_CONNECT');
135 | break;
136 | case ERROR_TYPE_FAIL:
137 | return $lang->getLanguage('ERROR_TYPE_FAIL');
138 | break;
139 | case ERROR_TYPE_CONFIG:
140 | return $lang->getLanguage('ERROR_TYPE_CONFIG');
141 | break;
142 | case ERROR_NORMAL:
143 | return "";
144 | break;
145 | }
146 | }
147 |
148 | public function printError($error_str,$error_type = 5,$die = false,$error_function = '', $error_class = '', $error_line = '') {
149 | global $lang;
150 | $output = '';
151 |
152 | if (empty($error_function) || empty($error_line)) {
153 | $debug = debug_backtrace();
154 | $error_function = $debug[0]['function'];
155 | $error_line = $debug[0]['line'];
156 | if (!empty($debug[0]['file']))
157 | $output .= $lang->getConsoleLanguage('KERNEL_ERROR').'['.$debug[0]['file'].']';
158 | }
159 |
160 | $output .= $lang->getConsoleLanguage('KERNEL').$this->getErrorStr($error_type).': "'.$error_str.'"';
161 | if ($error_function && !$error_class)
162 | $output .= ' : '.$lang->getConsoleLanguage('IN_FUNCTION').' '.$error_function;
163 | elseif ($error_function && $error_class)
164 | $output .= ' : '.$lang->getConsoleLanguage('IN_FUNCTION').' '.$error_class.'::'.$error_function;
165 | elseif ($error_class && !$error_function)
166 | $output .= ' : '.$lang->getConsoleLanguage('IN_CLASS').' '.$error_class;
167 | if ($error_line && is_numeric($error_line))
168 | $output .= ' : '.$lang->getConsoleLanguage('ON_LINE').' '.$error_line;
169 | if ($error_class || $error_function || $error_line)
170 | $output .= ' :';
171 | echo $output."\n";
172 | $this->_errors['count']++;
173 | $this->_errors['errors'][] .= $output;
174 | if (KERNEL_FULL_DEBUG == true && isset($debug) && $this->localDebugBlock != false) {
175 | $this->makeFullDebug($debug);
176 | }
177 | if ($die) {
178 | exit();
179 | }
180 | return true;
181 | }
182 |
183 | public function createLine($sign,$len) {
184 | $output = '';
185 | for ($i=0;$i<$len;$i++) {
186 | $output .= $sign;
187 | }
188 | return $output;
189 | }
190 |
191 |
192 | public function writeLog($text) {
193 | if (is_dir('inc/logs/'.getConfigValue('connection','bot_name')) == false) {
194 | }
195 | }
196 | public function makeFullDebug($debug_backtrace) {
197 | $output = "*".$this->createLine('-',68)."*\n";
198 | $output .= "* Debug time: ".date('j/F/Y G:i:s')."\n* Start of bot Debug\n* Bot Name: ".getConfigValue('connection','bot_name')." @ ".getConfigValue('connection','server_ip').":".getConfigValue('connection','server_query_port')." Server#: ".getConfigValue('connection','server_id')."\n";
199 | $lines = explode("\n",print_r($debug_backtrace,true));
200 | foreach ($lines as $line) {
201 | $output .= "* ".(string) $line."\n";
202 | }
203 | $output .= "* End of bot Debug\n*".$this->createLine('-',68)."*";
204 |
205 | return true;
206 | }
207 | public function writeLogToFile($fileDir,$text,$enterDate = true) {
208 | if (!file_exists($fileDir))
209 | $chmod = true;
210 | $fhandle = fopen($fileDir,'a');
211 | chmod($fileDir,0777);
212 | if ($enterDate == true)
213 | fwrite($fhandle,'['.date('j/F/Y G:i:s').'] '.$text."\r\n");
214 | else
215 | fwrite($fhandle,$text."\r\n");
216 | return fclose($fhandle);
217 | }
218 |
219 | public function openNewLogFile() {
220 | if (is_dir('inc/logs/'.getConfigValue('connection','bot_name')) == false) {
221 | }
222 | if (!file_exists($fileDir)) {
223 | ;
224 | }
225 | return true;
226 | }
227 |
228 | public function isTimeForEvent($eventName,$eventTime) {
229 | global $cache, $lang;
230 | if (!is_array($eventTime)) {
231 | $this->printError($lang->getLanguage('NOT_VALID_EVENT_TIME'),5,true,'isTimeForEvent','kernelMBot');
232 | return false;
233 | }
234 | $exec = array('seconds' => 0, 'minutes' => 0, 'hours' => 0, 'days' => 0, 'time' => 0);
235 | $cachex = $cache->getCacheValue($eventName.'_ev');
236 | if ($eventTime['seconds'] != false)
237 | $exec['seconds'] = $eventTime['seconds'];
238 | if ($eventTime['minutes'] != false)
239 | $exec['minutes'] = $eventTime['minutes'];
240 | if ($eventTime['hours'] != false)
241 | $exec['hours'] = $eventTime['hours'];
242 | if ($eventTime['days'] != false)
243 | $exec['days'] = $eventTime['days'];
244 | $exec['time'] = time() + $exec['seconds'] + ($exec['minutes'] * 60) + ($exec['hours'] * 60 * 60) + ($exec['days'] * 24 * 60 * 60);
245 | if ($cachex['executed'] == 0) {
246 | $cache->setCache($eventName.'_ev',array('executed' => $exec['time']));
247 | return false;
248 | }
249 | if (time() >= $cachex['executed']) {
250 | $cache->setCache($eventName.'_ev',array('executed' => $exec['time']));
251 | return true;
252 | } else
253 | return false;
254 | }
255 |
256 | public function checkCommandGroups($clientInfo,$command) {
257 | global $config, $botid;
258 | if (array_key_exists('groups',$config[$botid]['commands']['commands_configs'][$command]) == true) {
259 | $clientGroups = explode(',',$clientInfo['client_servergroups']);
260 | foreach ($clientGroups as $clientGroup) {
261 | if (in_array($clientGroup,$config[$botid]['commands']['commands_configs'][$command]['groups'])) {
262 | return true;
263 | }
264 | }
265 | }
266 | return false;
267 | }
268 | }
269 |
270 | ?>
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Helper/Convert.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Helper_Convert
30 | * @brief Helper class for data conversion.
31 | */
32 | class TeamSpeak3_Helper_Convert
33 | {
34 | /**
35 | * Converts bytes to a human readable value.
36 | *
37 | * @param integer $bytes
38 | * @return string
39 | */
40 | public static function bytes($bytes)
41 | {
42 | $kbytes = sprintf("%.02f", $bytes/1024);
43 | $mbytes = sprintf("%.02f", $kbytes/1024);
44 | $gbytes = sprintf("%.02f", $mbytes/1024);
45 | $tbytes = sprintf("%.02f", $gbytes/1024);
46 |
47 | if($tbytes >= 1)
48 | return $tbytes . " TB";
49 | if($gbytes >= 1)
50 | return $gbytes . " GB";
51 | if($mbytes >= 1)
52 | return $mbytes . " MB";
53 | if($kbytes >= 1)
54 | return $kbytes . " KB";
55 |
56 | return $bytes . " B";
57 | }
58 |
59 | /**
60 | * Converts seconds/milliseconds to a human readable value.
61 | *
62 | * @param integer $seconds
63 | * @param boolean $is_ms
64 | * @param string $format
65 | * @return string
66 | */
67 | public static function seconds($seconds, $is_ms = FALSE, $format = "%dD %02d:%02d:%02d")
68 | {
69 | if($is_ms) $seconds = $seconds/1000;
70 |
71 | return sprintf($format, $seconds/60/60/24, ($seconds/60/60)%24, ($seconds/60)%60, $seconds%60);
72 | }
73 |
74 | /**
75 | * Converts a given codec ID to a human readable name.
76 | *
77 | * @param integer $codec
78 | * @return string
79 | */
80 | public static function codec($codec)
81 | {
82 | if($codec == TeamSpeak3::CODEC_SPEEX_NARROWBAND)
83 | return "Speex Narrowband";
84 | if($codec == TeamSpeak3::CODEC_SPEEX_WIDEBAND)
85 | return "Speex Wideband";
86 | if($codec == TeamSpeak3::CODEC_SPEEX_ULTRAWIDEBAND)
87 | return "Speex Ultra-Wideband";
88 | if($codec == TeamSpeak3::CODEC_CELT_MONO)
89 | return "CELT Mono";
90 | if($codec == TeamSpeak3::CODEC_OPUS_VOICE)
91 | return "Opus Voice";
92 | if($codec == TeamSpeak3::CODEC_OPUS_MUSIC)
93 | return "Opus Music";
94 |
95 | return "Unknown";
96 | }
97 |
98 | /**
99 | * Converts a given group type ID to a human readable name.
100 | *
101 | * @param integer $type
102 | * @return string
103 | */
104 | public static function groupType($type)
105 | {
106 | if($type == TeamSpeak3::GROUP_DBTYPE_TEMPLATE)
107 | return "Template";
108 | if($type == TeamSpeak3::GROUP_DBTYPE_REGULAR)
109 | return "Regular";
110 | if($type == TeamSpeak3::GROUP_DBTYPE_SERVERQUERY)
111 | return "ServerQuery";
112 |
113 | return "Unknown";
114 | }
115 |
116 | /**
117 | * Converts a given permission type ID to a human readable name.
118 | *
119 | * @param integer $type
120 | * @return string
121 | */
122 | public static function permissionType($type)
123 | {
124 | if($type == TeamSpeak3::PERM_TYPE_SERVERGROUP)
125 | return "Server Group";
126 | if($type == TeamSpeak3::PERM_TYPE_CLIENT)
127 | return "Client";
128 | if($type == TeamSpeak3::PERM_TYPE_CHANNEL)
129 | return "Channel";
130 | if($type == TeamSpeak3::PERM_TYPE_CHANNELGROUP)
131 | return "Channel Group";
132 | if($type == TeamSpeak3::PERM_TYPE_CHANNELCLIENT)
133 | return "Channel Client";
134 |
135 | return "Unknown";
136 | }
137 |
138 | /**
139 | * Converts a given permission category value to a human readable name.
140 | *
141 | * @param integer $pcat
142 | * @return string
143 | */
144 | public static function permissionCategory($pcat)
145 | {
146 | if($pcat == TeamSpeak3::PERM_CAT_GLOBAL)
147 | return "Global";
148 | if($pcat == TeamSpeak3::PERM_CAT_GLOBAL_INFORMATION)
149 | return "Global / Information";
150 | if($pcat == TeamSpeak3::PERM_CAT_GLOBAL_SERVER_MGMT)
151 | return "Global / Virtual Server Management";
152 | if($pcat == TeamSpeak3::PERM_CAT_GLOBAL_ADM_ACTIONS)
153 | return "Global / Administration";
154 | if($pcat == TeamSpeak3::PERM_CAT_GLOBAL_SETTINGS)
155 | return "Global / Settings";
156 | if($pcat == TeamSpeak3::PERM_CAT_SERVER)
157 | return "Virtual Server";
158 | if($pcat == TeamSpeak3::PERM_CAT_SERVER_INFORMATION)
159 | return "Virtual Server / Information";
160 | if($pcat == TeamSpeak3::PERM_CAT_SERVER_ADM_ACTIONS)
161 | return "Virtual Server / Administration";
162 | if($pcat == TeamSpeak3::PERM_CAT_SERVER_SETTINGS)
163 | return "Virtual Server / Settings";
164 | if($pcat == TeamSpeak3::PERM_CAT_CHANNEL)
165 | return "Channel";
166 | if($pcat == TeamSpeak3::PERM_CAT_CHANNEL_INFORMATION)
167 | return "Channel / Information";
168 | if($pcat == TeamSpeak3::PERM_CAT_CHANNEL_CREATE)
169 | return "Channel / Create";
170 | if($pcat == TeamSpeak3::PERM_CAT_CHANNEL_MODIFY)
171 | return "Channel / Modify";
172 | if($pcat == TeamSpeak3::PERM_CAT_CHANNEL_DELETE)
173 | return "Channel / Delete";
174 | if($pcat == TeamSpeak3::PERM_CAT_CHANNEL_ACCESS)
175 | return "Channel / Access";
176 | if($pcat == TeamSpeak3::PERM_CAT_GROUP)
177 | return "Group";
178 | if($pcat == TeamSpeak3::PERM_CAT_GROUP_INFORMATION)
179 | return "Group / Information";
180 | if($pcat == TeamSpeak3::PERM_CAT_GROUP_CREATE)
181 | return "Group / Create";
182 | if($pcat == TeamSpeak3::PERM_CAT_GROUP_MODIFY)
183 | return "Group / Modify";
184 | if($pcat == TeamSpeak3::PERM_CAT_GROUP_DELETE)
185 | return "Group / Delete";
186 | if($pcat == TeamSpeak3::PERM_CAT_CLIENT)
187 | return "Client";
188 | if($pcat == TeamSpeak3::PERM_CAT_CLIENT_INFORMATION)
189 | return "Client / Information";
190 | if($pcat == TeamSpeak3::PERM_CAT_CLIENT_ADM_ACTIONS)
191 | return "Client / Admin";
192 | if($pcat == TeamSpeak3::PERM_CAT_CLIENT_BASICS)
193 | return "Client / Basics";
194 | if($pcat == TeamSpeak3::PERM_CAT_CLIENT_MODIFY)
195 | return "Client / Modify";
196 | if($pcat == TeamSpeak3::PERM_CAT_FILETRANSFER)
197 | return "File Transfer";
198 | if($pcat == TeamSpeak3::PERM_CAT_NEEDED_MODIFY_POWER)
199 | return "Grant";
200 |
201 | return "Unknown";
202 | }
203 |
204 | /**
205 | * Converts a given log level ID to a human readable name and vice versa.
206 | *
207 | * @param mixed $level
208 | * @return string
209 | */
210 | public static function logLevel($level)
211 | {
212 | if(is_numeric($level))
213 | {
214 | if($level == TeamSpeak3::LOGLEVEL_CRITICAL)
215 | return "CRITICAL";
216 | if($level == TeamSpeak3::LOGLEVEL_ERROR)
217 | return "ERROR";
218 | if($level == TeamSpeak3::LOGLEVEL_DEBUG)
219 | return "DEBUG";
220 | if($level == TeamSpeak3::LOGLEVEL_WARNING)
221 | return "WARNING";
222 | if($level == TeamSpeak3::LOGLEVEL_INFO)
223 | return "INFO";
224 |
225 | return "DEVELOP";
226 | }
227 | else
228 | {
229 | if(strtoupper($level) == "CRITICAL")
230 | return TeamSpeak3::LOGLEVEL_CRITICAL;
231 | if(strtoupper($level) == "ERROR")
232 | return TeamSpeak3::LOGLEVEL_ERROR;
233 | if(strtoupper($level) == "DEBUG")
234 | return TeamSpeak3::LOGLEVEL_DEBUG;
235 | if(strtoupper($level) == "WARNING")
236 | return TeamSpeak3::LOGLEVEL_WARNING;
237 | if(strtoupper($level) == "INFO")
238 | return TeamSpeak3::LOGLEVEL_INFO;
239 |
240 | return TeamSpeak3::LOGLEVEL_DEVEL;
241 | }
242 | }
243 |
244 | /**
245 | * Converts a specified log entry string into an array containing the data.
246 | *
247 | * @param string $entry
248 | * @return array
249 | */
250 | public static function logEntry($entry)
251 | {
252 | $parts = explode("|", $entry, 5);
253 | $array = array();
254 |
255 | if(count($parts) != 5)
256 | {
257 | $array["timestamp"] = 0;
258 | $array["level"] = TeamSpeak3::LOGLEVEL_ERROR;
259 | $array["channel"] = "ParamParser";
260 | $array["server_id"] = "";
261 | $array["msg"] = TeamSpeak3_Helper_String::factory("convert error (" . trim($entry) . ")");
262 | $array["msg_plain"] = $entry;
263 | $array["malformed"] = TRUE;
264 | }
265 | else
266 | {
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]);
271 | $array["msg"] = TeamSpeak3_Helper_String::factory(trim($parts[4]));
272 | $array["msg_plain"] = $entry;
273 | $array["malformed"] = FALSE;
274 | }
275 |
276 | return $array;
277 | }
278 |
279 | /**
280 | * Converts a given string to a ServerQuery password hash.
281 | *
282 | * @param string $plain
283 | * @return string
284 | */
285 | public static function password($plain)
286 | {
287 | return base64_encode(sha1($plain, TRUE));
288 | }
289 |
290 | /**
291 | * Returns a client-like formatted version of the TeamSpeak 3 version string.
292 | *
293 | * @param string $version
294 | * @param string $format
295 | * @return string
296 | */
297 | public static function version($version, $format = "Y-m-d h:i:s")
298 | {
299 | if(!$version instanceof TeamSpeak3_Helper_String)
300 | {
301 | $version = new TeamSpeak3_Helper_String($version);
302 | }
303 |
304 | $buildno = $version->section("[", 1)->filterDigits()->toInt();
305 |
306 | return ($buildno <= 15001) ? $version : $version->section("[")->append("(" . date($format, $buildno) . ")");
307 | }
308 |
309 | /**
310 | * Returns a client-like short-formatted version of the TeamSpeak 3 version string.
311 | *
312 | * @param string $version
313 | * @return string
314 | */
315 | public static function versionShort($version)
316 | {
317 | if(!$version instanceof TeamSpeak3_Helper_String)
318 | {
319 | $version = new TeamSpeak3_Helper_String($version);
320 | }
321 |
322 | return $version->section(" ", 0);
323 | }
324 |
325 | /**
326 | * Tries to detect the type of an image by a given string and returns it.
327 | *
328 | * @param string $binary
329 | * @return string
330 | */
331 | public static function imageMimeType($binary)
332 | {
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))
334 | {
335 | return "application/octet-stream";
336 | }
337 |
338 | $type = array(
339 | 1 => "image/jpeg",
340 | 2 => "image/gif",
341 | 3 => "image/png",
342 | 4 => "image/x-windows-bmp",
343 | 5 => "image/tiff",
344 | 6 => "image/x-ilbm",
345 | );
346 |
347 | return $type[count($matches)-1];
348 | }
349 | }
350 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Node/Client.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Node_Client
30 | * @brief Class describing a TeamSpeak 3 client and all it's parameters.
31 | */
32 | class TeamSpeak3_Node_Client extends TeamSpeak3_Node_Abstract
33 | {
34 | /**
35 | * The TeamSpeak3_Node_Client constructor.
36 | *
37 | * @param TeamSpeak3_Node_Server $server
38 | * @param array $info
39 | * @param string $index
40 | * @throws TeamSpeak3_Adapter_ServerQuery_Exception
41 | * @return TeamSpeak3_Node_Client
42 | */
43 | public function __construct(TeamSpeak3_Node_Server $server, array $info, $index = "clid")
44 | {
45 | $this->parent = $server;
46 | $this->nodeInfo = $info;
47 |
48 | if(!array_key_exists($index, $this->nodeInfo))
49 | {
50 | throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid clientID", 0x200);
51 | }
52 |
53 | $this->nodeId = $this->nodeInfo[$index];
54 | }
55 |
56 | /**
57 | * Changes the clients properties using given properties.
58 | *
59 | * @param array $properties
60 | * @return void
61 | */
62 | public function modify(array $properties)
63 | {
64 | $properties["clid"] = $this->getId();
65 |
66 | $this->execute("clientedit", $properties);
67 | $this->resetNodeInfo();
68 | }
69 |
70 | /**
71 | * Changes the clients properties using given properties.
72 | *
73 | * @param array $properties
74 | * @return void
75 | */
76 | public function modifyDb(array $properties)
77 | {
78 | return $this->getParent()->clientModifyDb($this["client_database_id"], $properties);
79 | }
80 |
81 | /**
82 | * Deletes the clients properties from the database.
83 | *
84 | * @return void
85 | */
86 | public function deleteDb()
87 | {
88 | return $this->getParent()->clientDeleteDb($this["client_database_id"]);
89 | }
90 |
91 | /**
92 | * Returns a list of properties from the database for the client.
93 | *
94 | * @return array
95 | */
96 | public function infoDb()
97 | {
98 | return $this->getParent()->clientInfoDb($this["client_database_id"]);
99 | }
100 |
101 | /**
102 | * Sends a text message to the client.
103 | *
104 | * @param string $msg
105 | * @return void
106 | */
107 | public function message($msg)
108 | {
109 | $this->execute("sendtextmessage", array("msg" => $msg, "target" => $this->getId(), "targetmode" => TeamSpeak3::TEXTMSG_CLIENT));
110 | }
111 |
112 | /**
113 | * Moves the client to another channel.
114 | *
115 | * @param integer $cid
116 | * @param string $cpw
117 | * @return void
118 | */
119 | public function move($cid, $cpw = null)
120 | {
121 | return $this->getParent()->clientMove($this->getId(), $cid, $cpw);
122 | }
123 |
124 | /**
125 | * Kicks the client from his currently joined channel or from the server.
126 | *
127 | * @param integer $reasonid
128 | * @param string $reasonmsg
129 | * @return void
130 | */
131 | public function kick($reasonid = TeamSpeak3::KICK_CHANNEL, $reasonmsg = null)
132 | {
133 | return $this->getParent()->clientKick($this->getId(), $reasonid, $reasonmsg);
134 | }
135 |
136 | /**
137 | * Sends a poke message to the client.
138 | *
139 | * @param string $msg
140 | * @return void
141 | */
142 | public function poke($msg)
143 | {
144 | return $this->getParent()->clientPoke($this->getId(), $msg);
145 | }
146 |
147 | /**
148 | * Bans the client from the server. Please note that this will create two separate
149 | * ban rules for the targeted clients IP address and his unique identifier.
150 | *
151 | * @param integer $timeseconds
152 | * @param string $reason
153 | * @return array
154 | */
155 | public function ban($timeseconds = null, $reason = null)
156 | {
157 | return $this->getParent()->clientBan($this->getId(), $timeseconds, $reason);
158 | }
159 |
160 | /**
161 | * Returns a list of custom properties for the client.
162 | *
163 | * @return array
164 | */
165 | public function customInfo()
166 | {
167 | return $this->getParent()->customInfo($this["client_database_id"]);
168 | }
169 |
170 | /**
171 | * Returns an array containing the permission overview of the client.
172 | *
173 | * @param integer $cid
174 | * @return array
175 | */
176 | public function permOverview($cid)
177 | {
178 | return $this->execute("permoverview", array("cldbid" => $this["client_database_id"], "cid" => $cid, "permid" => 0))->toArray();
179 | }
180 |
181 | /**
182 | * Returns a list of permissions defined for the client.
183 | *
184 | * @param boolean $permsid
185 | * @return array
186 | */
187 | public function permList($permsid = FALSE)
188 | {
189 | return $this->getParent()->clientPermList($this["client_database_id"], $permsid);
190 | }
191 |
192 | /**
193 | * Adds a set of specified permissions to the client. Multiple permissions can be added by providing
194 | * the three parameters of each permission.
195 | *
196 | * @param integer $permid
197 | * @param integer $permvalue
198 | * @param integer $permskip
199 | * @return void
200 | */
201 | public function permAssign($permid, $permvalue, $permskip = FALSE)
202 | {
203 | return $this->getParent()->clientPermAssign($this["client_database_id"], $permid, $permvalue, $permskip);
204 | }
205 |
206 | /**
207 | * Alias for permAssign().
208 | *
209 | * @deprecated
210 | */
211 | public function permAssignByName($permname, $permvalue, $permskip = FALSE)
212 | {
213 | return $this->permAssign($permname, $permvalue, $permskip);
214 | }
215 |
216 | /**
217 | * Removes a set of specified permissions from a client. Multiple permissions can be removed at once.
218 | *
219 | * @param integer $permid
220 | * @return void
221 | */
222 | public function permRemove($permid)
223 | {
224 | return $this->getParent()->clientPermRemove($this["client_database_id"], $permid);
225 | }
226 |
227 | /**
228 | * Alias for permRemove().
229 | *
230 | * @deprecated
231 | */
232 | public function permRemoveByName($permname)
233 | {
234 | return $this->permRemove($permname);
235 | }
236 |
237 | /**
238 | * Sets the channel group of a client to the ID specified.
239 | *
240 | * @param integer $cid
241 | * @param integer $cgid
242 | * @return void
243 | */
244 | public function setChannelGroup($cid, $cgid)
245 | {
246 | return $this->getParent()->clientSetChannelGroup($this["client_database_id"], $cid, $cgid);
247 | }
248 |
249 | /**
250 | * Adds the client to the server group specified with $sgid.
251 | *
252 | * @param integer $sgid
253 | * @return void
254 | */
255 | public function addServerGroup($sgid)
256 | {
257 | return $this->getParent()->serverGroupClientAdd($sgid, $this["client_database_id"]);
258 | }
259 |
260 | /**
261 | * Removes the client from the server group specified with $sgid.
262 | *
263 | * @param integer $sgid
264 | * @return void
265 | */
266 | public function remServerGroup($sgid)
267 | {
268 | return $this->getParent()->serverGroupClientDel($sgid, $this["client_database_id"]);
269 | }
270 |
271 | /**
272 | * Returns the possible name of the clients avatar.
273 | *
274 | * @return TeamSpeak3_Helper_String
275 | */
276 | public function avatarGetName()
277 | {
278 | return new TeamSpeak3_Helper_String("/avatar_" . $this["client_base64HashClientUID"]);
279 | }
280 |
281 | /**
282 | * Downloads and returns the clients avatar file content.
283 | *
284 | * @return TeamSpeak3_Helper_String
285 | */
286 | public function avatarDownload()
287 | {
288 | if($this["client_flag_avatar"] == 0) return;
289 |
290 | $download = $this->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->avatarGetName());
291 | $transfer = TeamSpeak3::factory("filetransfer://" . $download["host"] . ":" . $download["port"]);
292 |
293 | return $transfer->download($download["ftkey"], $download["size"]);
294 | }
295 |
296 | /**
297 | * Returns a list of client connections using the same identity as this client.
298 | *
299 | * @return array
300 | */
301 | public function getClones()
302 | {
303 | return $this->execute("clientgetids", array("cluid" => $this["client_unique_identifier"]))->toAssocArray("clid");
304 | }
305 |
306 | /**
307 | * Returns the revision/build number from the clients version string.
308 | *
309 | * @return integer
310 | */
311 | public function getRev()
312 | {
313 | return $this["client_type"] ? null : $this["client_version"]->section("[", 1)->filterDigits();
314 | }
315 |
316 | /**
317 | * Returns all server and channel groups the client is currently residing in.
318 | *
319 | * @return array
320 | */
321 | public function memberOf()
322 | {
323 | $groups = array($this->getParent()->channelGroupGetById($this["client_channel_group_id"]));
324 |
325 | foreach(explode(",", $this["client_servergroups"]) as $sgid)
326 | {
327 | $groups[] = $this->getParent()->serverGroupGetById($sgid);
328 | }
329 |
330 | return $groups;
331 | }
332 |
333 | /**
334 | * Downloads and returns the clients icon file content.
335 | *
336 | * @return TeamSpeak3_Helper_String
337 | */
338 | public function iconDownload()
339 | {
340 | if($this->iconIsLocal("client_icon_id") || $this["client_icon_id"] == 0) return;
341 |
342 | $download = $this->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->iconGetName("client_icon_id"));
343 | $transfer = TeamSpeak3::factory("filetransfer://" . $download["host"] . ":" . $download["port"]);
344 |
345 | return $transfer->download($download["ftkey"], $download["size"]);
346 | }
347 |
348 | /**
349 | * Sends a plugin command to the client.
350 | *
351 | * @param string $plugin
352 | * @param string $data
353 | * @return void
354 | */
355 | public function sendPluginCmd($plugin, $data)
356 | {
357 | $this->execute("plugincmd", array("name" => $plugin, "data" => $data, "targetmode" => TeamSpeak3::PLUGINCMD_CLIENT, "target" => $this->getId()));
358 | }
359 |
360 | /**
361 | * @ignore
362 | */
363 | protected function fetchNodeInfo()
364 | {
365 | if($this["client_type"] == 1) return;
366 |
367 | $this->nodeInfo = array_merge($this->nodeInfo, $this->execute("clientinfo", array("clid" => $this->getId()))->toList());
368 | }
369 |
370 | /**
371 | * Returns a unique identifier for the node which can be used as a HTML property.
372 | *
373 | * @return string
374 | */
375 | public function getUniqueId()
376 | {
377 | return $this->getParent()->getUniqueId() . "_cl" . $this->getId();
378 | }
379 |
380 | /**
381 | * Returns the name of a possible icon to display the node object.
382 | *
383 | * @return string
384 | */
385 | public function getIcon()
386 | {
387 | if($this["client_type"])
388 | {
389 | return "client_query";
390 | }
391 | elseif($this["client_away"])
392 | {
393 | return "client_away";
394 | }
395 | elseif(!$this["client_output_hardware"])
396 | {
397 | return "client_snd_disabled";
398 | }
399 | elseif($this["client_output_muted"])
400 | {
401 | return "client_snd_muted";
402 | }
403 | elseif(!$this["client_input_hardware"])
404 | {
405 | return "client_mic_disabled";
406 | }
407 | elseif($this["client_input_muted"])
408 | {
409 | return "client_mic_muted";
410 | }
411 | elseif($this["client_is_channel_commander"])
412 | {
413 | return $this["client_flag_talking"] ? "client_cc_talk" : "client_cc_idle";
414 | }
415 | else
416 | {
417 | return $this["client_flag_talking"] ? "client_talk" : "client_idle";
418 | }
419 | }
420 |
421 | /**
422 | * Returns a symbol representing the node.
423 | *
424 | * @return string
425 | */
426 | public function getSymbol()
427 | {
428 | return "@";
429 | }
430 |
431 | /**
432 | * Returns a string representation of this node.
433 | *
434 | * @return string
435 | */
436 | public function __toString()
437 | {
438 | return (string) $this["client_nickname"];
439 | }
440 | }
441 |
442 |
--------------------------------------------------------------------------------
/bannerBot/libraries/TeamSpeak3/Helper/Signal/Interface.php:
--------------------------------------------------------------------------------
1 | .
21 | *
22 | * @package TeamSpeak3
23 | * @version 1.1.23
24 | * @author Sven 'ScP' Paulsen
25 | * @copyright Copyright (c) 2010 by Planet TeamSpeak. All rights reserved.
26 | */
27 |
28 | /**
29 | * @class TeamSpeak3_Helper_Signal_Interface
30 | * @brief Interface class describing the layout for TeamSpeak3_Helper_Signal callbacks.
31 | */
32 | interface TeamSpeak3_Helper_Signal_Interface
33 | {
34 | /**
35 | * Possible callback for 'Connected' signals.
36 | *
37 | * === Examples ===
38 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryConnected", array($object, "onConnect"));
39 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("filetransferConnected", array($object, "onConnect"));
40 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("blacklistConnected", array($object, "onConnect"));
41 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("updateConnected", array($object, "onConnect"));
42 | *
43 | * @param TeamSpeak3_Adapter_Abstract $adapter
44 | * @return void
45 | */
46 | public function onConnect(TeamSpeak3_Adapter_Abstract $adapter);
47 |
48 | /**
49 | * Possible callback for 'Disconnected' signals.
50 | *
51 | * === Examples ===
52 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryDisconnected", array($object, "onDisconnect"));
53 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("filetransferDisconnected", array($object, "onDisconnect"));
54 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("blacklistDisconnected", array($object, "onDisconnect"));
55 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("updateDisconnected", array($object, "onDisconnect"));
56 | *
57 | * @return void
58 | */
59 | public function onDisconnect();
60 |
61 | /**
62 | * Possible callback for 'serverqueryCommandStarted' signals.
63 | *
64 | * === Examples ===
65 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryCommandStarted", array($object, "onCommandStarted"));
66 | *
67 | * @param string $cmd
68 | * @return void
69 | */
70 | public function onCommandStarted($cmd);
71 |
72 | /**
73 | * Possible callback for 'serverqueryCommandFinished' signals.
74 | *
75 | * === Examples ===
76 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryCommandFinished", array($object, "onCommandFinished"));
77 | *
78 | * @param string $cmd
79 | * @param TeamSpeak3_Adapter_ServerQuery_Reply $reply
80 | * @return void
81 | */
82 | public function onCommandFinished($cmd, TeamSpeak3_Adapter_ServerQuery_Reply $reply);
83 |
84 | /**
85 | * Possible callback for 'notifyEvent' signals.
86 | *
87 | * === Examples ===
88 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyEvent", array($object, "onEvent"));
89 | *
90 | * @param TeamSpeak3_Adapter_ServerQuery_Event $event
91 | * @param TeamSpeak3_Node_Host $host
92 | * @return void
93 | */
94 | public function onEvent(TeamSpeak3_Adapter_ServerQuery_Event $event, TeamSpeak3_Node_Host $host);
95 |
96 | /**
97 | * Possible callback for 'notifyError' signals.
98 | *
99 | * === Examples ===
100 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyError", array($object, "onError"));
101 | *
102 | * @param TeamSpeak3_Adapter_ServerQuery_Reply $reply
103 | * @return void
104 | */
105 | public function onError(TeamSpeak3_Adapter_ServerQuery_Reply $reply);
106 |
107 | /**
108 | * Possible callback for 'notifyServerselected' signals.
109 | *
110 | * === Examples ===
111 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyServerselected", array($object, "onServerselected"));
112 | *
113 | * @param TeamSpeak3_Node_Host $host
114 | * @return void
115 | */
116 | public function onServerselected(TeamSpeak3_Node_Host $host);
117 |
118 | /**
119 | * Possible callback for 'notifyServercreated' signals.
120 | *
121 | * === Examples ===
122 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyServercreated", array($object, "onServercreated"));
123 | *
124 | * @param TeamSpeak3_Node_Host $host
125 | * @param integer $sid
126 | * @return void
127 | */
128 | public function onServercreated(TeamSpeak3_Node_Host $host, $sid);
129 |
130 | /**
131 | * Possible callback for 'notifyServerdeleted' signals.
132 | *
133 | * === Examples ===
134 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyServerdeleted", array($object, "onServerdeleted"));
135 | *
136 | * @param TeamSpeak3_Node_Host $host
137 | * @param integer $sid
138 | * @return void
139 | */
140 | public function onServerdeleted(TeamSpeak3_Node_Host $host, $sid);
141 |
142 | /**
143 | * Possible callback for 'notifyServerstarted' signals.
144 | *
145 | * === Examples ===
146 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyServerstarted", array($object, "onServerstarted"));
147 | *
148 | * @param TeamSpeak3_Node_Host $host
149 | * @param integer $sid
150 | * @return void
151 | */
152 | public function onServerstarted(TeamSpeak3_Node_Host $host, $sid);
153 |
154 | /**
155 | * Possible callback for 'notifyServerstopped' signals.
156 | *
157 | * === Examples ===
158 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyServerstopped", array($object, "onServerstopped"));
159 | *
160 | * @param TeamSpeak3_Node_Host $host
161 | * @param integer $sid
162 | * @return void
163 | */
164 | public function onServerstopped(TeamSpeak3_Node_Host $host, $sid);
165 |
166 | /**
167 | * Possible callback for 'notifyServershutdown' signals.
168 | *
169 | * === Examples ===
170 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyServershutdown", array($object, "onServershutdown"));
171 | *
172 | * @param TeamSpeak3_Node_Host $host
173 | * @return void
174 | */
175 | public function onServershutdown(TeamSpeak3_Node_Host $host);
176 |
177 | /**
178 | * Possible callback for 'notifyLogin' signals.
179 | *
180 | * === Examples ===
181 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyLogin", array($object, "onLogin"));
182 | *
183 | * @param TeamSpeak3_Node_Host $host
184 | * @return void
185 | */
186 | public function onLogin(TeamSpeak3_Node_Host $host);
187 |
188 | /**
189 | * Possible callback for 'notifyLogout' signals.
190 | *
191 | * === Examples ===
192 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyLogout", array($object, "onLogout"));
193 | *
194 | * @param TeamSpeak3_Node_Host $host
195 | * @return void
196 | */
197 | public function onLogout(TeamSpeak3_Node_Host $host);
198 |
199 | /**
200 | * Possible callback for 'notifyTokencreated' signals.
201 | *
202 | * === Examples ===
203 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("notifyTokencreated", array($object, "onTokencreated"));
204 | *
205 | * @param TeamSpeak3_Node_Server $server
206 | * @param string $token
207 | * @return void
208 | */
209 | public function onTokencreated(TeamSpeak3_Node_Server $server, $token);
210 |
211 | /**
212 | * Possible callback for 'filetransferHandshake' signals.
213 | *
214 | * === Examples ===
215 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("filetransferHandshake", array($object, "onFtHandshake"));
216 | *
217 | * @param TeamSpeak3_Adapter_FileTransfer $adapter
218 | * @return void
219 | */
220 | public function onFtHandshake(TeamSpeak3_Adapter_FileTransfer $adapter);
221 |
222 | /**
223 | * Possible callback for 'filetransferUploadStarted' signals.
224 | *
225 | * === Examples ===
226 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("filetransferUploadStarted", array($object, "onFtUploadStarted"));
227 | *
228 | * @param string $ftkey
229 | * @param integer $seek
230 | * @param integer $size
231 | * @return void
232 | */
233 | public function onFtUploadStarted($ftkey, $seek, $size);
234 |
235 | /**
236 | * Possible callback for 'filetransferUploadProgress' signals.
237 | *
238 | * === Examples ===
239 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("filetransferUploadProgress", array($object, "onFtUploadProgress"));
240 | *
241 | * @param string $ftkey
242 | * @param integer $seek
243 | * @param integer $size
244 | * @return void
245 | */
246 | public function onFtUploadProgress($ftkey, $seek, $size);
247 |
248 | /**
249 | * Possible callback for 'filetransferUploadFinished' signals.
250 | *
251 | * === Examples ===
252 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("filetransferUploadFinished", array($object, "onFtUploadFinished"));
253 | *
254 | * @param string $ftkey
255 | * @param integer $seek
256 | * @param integer $size
257 | * @return void
258 | */
259 | public function onFtUploadFinished($ftkey, $seek, $size);
260 |
261 | /**
262 | * Possible callback for 'filetransferDownloadStarted' signals.
263 | *
264 | * === Examples ===
265 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("filetransferDownloadStarted", array($object, "onFtDownloadStarted"));
266 | *
267 | * @param string $ftkey
268 | * @param integer $buff
269 | * @param integer $size
270 | * @return void
271 | */
272 | public function onFtDownloadStarted($ftkey, $buff, $size);
273 |
274 | /**
275 | * Possible callback for 'filetransferDownloadProgress' signals.
276 | *
277 | * === Examples ===
278 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("filetransferDownloadProgress", array($object, "onFtDownloadProgress"));
279 | *
280 | * @param string $ftkey
281 | * @param integer $buff
282 | * @param integer $size
283 | * @return void
284 | */
285 | public function onFtDownloadProgress($ftkey, $buff, $size);
286 |
287 | /**
288 | * Possible callback for 'filetransferDownloadFinished' signals.
289 | *
290 | * === Examples ===
291 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("filetransferDownloadFinished", array($object, "onFtDownloadFinished"));
292 | *
293 | * @param string $ftkey
294 | * @param integer $buff
295 | * @param integer $size
296 | * @return void
297 | */
298 | public function onFtDownloadFinished($ftkey, $buff, $size);
299 |
300 | /**
301 | * Possible callback for 'DataRead' signals.
302 | *
303 | * === Examples ===
304 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryDataRead", array($object, "onDebugDataRead"));
305 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("filetransferDataRead", array($object, "onDebugDataRead"));
306 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("blacklistDataRead", array($object, "onDebugDataRead"));
307 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("updateDataRead", array($object, "onDebugDataRead"));
308 | *
309 | * @param string $data
310 | * @return void
311 | */
312 | public function onDebugDataRead($data);
313 |
314 | /**
315 | * Possible callback for 'DataSend' signals.
316 | *
317 | * === Examples ===
318 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryDataSend", array($object, "onDebugDataSend"));
319 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("filetransferDataSend", array($object, "onDebugDataSend"));
320 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("blacklistDataSend", array($object, "onDebugDataSend"));
321 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("updateDataSend", array($object, "onDebugDataSend"));
322 | *
323 | * @param string $data
324 | * @return void
325 | */
326 | public function onDebugDataSend($data);
327 |
328 | /**
329 | * Possible callback for 'WaitTimeout' signals.
330 | *
331 | * === Examples ===
332 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("serverqueryWaitTimeout", array($object, "onWaitTimeout"));
333 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("filetransferWaitTimeout", array($object, "onWaitTimeout"));
334 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("blacklistWaitTimeout", array($object, "onWaitTimeout"));
335 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("updateWaitTimeout", array($object, "onWaitTimeout"));
336 | *
337 | * @param integer $time
338 | * @param TeamSpeak3_Adapter_Abstract $adapter
339 | * @return void
340 | */
341 | public function onWaitTimeout($time, TeamSpeak3_Adapter_Abstract $adapter);
342 |
343 | /**
344 | * Possible callback for 'errorException' signals.
345 | *
346 | * === Examples ===
347 | * - TeamSpeak3_Helper_Signal::getInstance()->subscribe("errorException", array($object, "onException"));
348 | *
349 | * @param TeamSpeak3_Exception $e
350 | * @return void
351 | */
352 | public function onException(TeamSpeak3_Exception $e);
353 | }
354 |
--------------------------------------------------------------------------------