PDA

View Full Version : [API] TS3 PHP Framework



Pages : [1] 2 3 4

ScP
19-12-2009, 23:50
Current Version: 1.1.23


Addons Page (http://addons.teamspeak.com/directory/tools/integration/TeamSpeak-3-PHP-Framework.html)
Changelog (http://docs.planetteamspeak.com/ts3/php/framework/changelog.txt)
Documentation (http://docs.planetteamspeak.com/ts3/php/framework/)
(http://docs.planetteamspeak.com/ts3/php/framework/)
Website (http://www.planetteamspeak.com/)
Donate (https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=50175)

DOWNLOAD NOW (http://addons.teamspeak.com/directory/tools/integration/TeamSpeak-3-PHP-Framework.html)

What is the TS3 PHP Framework?
Initially released in January 2010, the TeamSpeak 3 PHP Framework is a powerful, open source, object-oriented framework implemented in PHP 5 and licensed under the GNU General Public License. It's based on simplicity and a rigorously tested agile codebase. Extend the functionality of your servers with scripts or create powerful web applications to manage all features of your TeamSpeak 3 Server instances.

Tested. Thoroughly. Enterprise-ready and built with agile methods, the TeamSpeak 3 PHP Framework has been unit-tested from the start to ensure that all code remains stable and easy for you to extend, re-test with your extensions, and further maintain.

Why should I use the TS3 PHP Framework rather than other PHP libraries?
The TS3 PHP Framework is a is a modern use-at-will framework that provides individual components to communicate with the TeamSpeak 3 Server.

There are lots of arguments for the TS3 PHP Framework in comparison with other PHP based libraries. It is the most dynamic and feature-rich piece of software in its class. In addition, it's always up-to-date and 100% compatible to almost any TeamSpeak 3 Server version available.

What are the key features of the TS3 PHP Framework?
Features of the TS3 PHP Framework include:


Fully object-oriented PHP 5 and E_STRICT compliant components
Access to all TeamSpeak 3 Server features via ServerQuery
Integrated full featured and customizable TSViewer interfaces
Full support for file transfers to up- and /or download custom icons and other stuff
Powerful error handling capablities using exceptions and customizable error messages
Query mechanisms for several official services such as the blacklist and auto-update servers
Dynamic signal slots for event based scripting
...

Speed up new development and reduce maintenance costs by using the TS3 PHP Framework!

MichaelP
05-05-2010, 22:21
why was it deleted? :-o

Stefan1200
05-05-2010, 22:33
why was it deleted? :-o

http://forum.teamspeak.com/showpost.php?p=237973&postcount=4

Pimmetje
11-05-2010, 14:12
I want to generate json with this lib. But i can't find a way to make a difference with channels and subchannels. with the factory i make a connection. than i do a channelList() on the object. Somehow i get all channels (including the subchannels). the subChannelList() wont return any data on all those channels.

Anyone can see what i am doing wrong? I can make some example if it is needed. But the code i have at the moment is a little bit big to change to something what points out the problem i have.

kasebone
18-05-2010, 14:20
I like the option of the TS Viewer. But do I need to cache the display? I can imagine that when many users are watching the viewer the ts3 server gehts overloaded when every page impression creates a new serverquery.

Pimmetje
18-05-2010, 14:25
Your webserver gets banned if it loads too much. So there are 2 things u can do whitelist the ip of the webserver or use cache for 30-45 seconds

kasebone
18-05-2010, 14:41
Ok, thanks :-)

ScP
18-05-2010, 19:02
I'll reopen the original thread again soon when the new version is ready. Here's the latest changelog:


================================================== =============================
TS 3 PHP Framework - Changelog
Copyright Planet TeamSpeak
http://www.planetteamspeak.com
================================================== =============================
+ Added feature or noticable improvement
- Bug fix or something removed
* Changed or Information
! Important - Take note!
================================================== =============================

=== Release 1.0.27-dev - ?? May 2010 ===
! upgrading your servers to 3.0.0-beta23 (build >= 11062) is mandatory
+ added TeamSpeak3_Adapter_Update which allows you to query the latest TS3
version numbers from the master server
* TeamSpeak3_Viewer_Html interface now displays custom icons

=== Release 1.0.26-beta - 14 Apr 2010 ===
! codebase converted to Zend Studio 7.1.2 project
+ added TeamSpeak3_Node_Server::channelSpacerCreate()
+ added TeamSpeak3_Node_Server::channelSpacerGetType()
+ added constants for different channel spacer types (WIP)
- fixed unused parameters in TeamSpeak3_Node_Channel::permRemove()
- fixed unused parameters in TeamSpeak3_Node_Server::channelFileRename()
* TeamSpeak3_Helper_String::contains() now supports RegExp patterns and is
case-insensitive
* lists generated by TeamSpeak3_Node_Server::channelFileList() are now sorted
by filenname
* TeamSpeak3_Viewer_Html interface now calculates server uptime correctly
* changed examples to include new features
* internal release only

=== Release 1.0.25-beta - 1 Apr 2010 ===
! upgrading your servers to 3.0.0-beta21 (build >= 10608) is mandatory
+ added TeamSpeak3_Exception::registerCustomMessage()
+ added TeamSpeak3_Exception::unregisterCustomMessage()
+ added TeamSpeak3_Helper_Convert::groupType()
+ added TeamSpeak3_Helper_Convert::permissionType()
+ added TeamSpeak3_Helper_Convert::password()
+ added TeamSpeak3_Helper_String::filterAlnum()
+ added TeamSpeak3_Helper_String::filterAlpha()
+ added TeamSpeak3_Helper_String::filterDigits()
+ added constants for different group auto-update types
- changed invalid variable name in TeamSpeak3_Adapter_ServerQuery::request()
* TeamSpeak3_Adapter_FileTransfer::download() now supports fpassthru() to
write the results to the PHP output buffer which can be very useful when
transferring large files
* TeamSpeak3_Helper_Convert::seconds() now supports custom output format
* internal release only

=== Release 1.0.24-beta - 24 Feb 2010 ===
! upgrading your servers to 3.0.0-beta19 (build >= 10368) is mandatory
+ added TeamSpeak3_Node_Abstract::iconIsLocal()
+ added TeamSpeak3_Node_Abstract::iconGetName()
+ added TeamSpeak3_Node_Server::iconDownload()
+ added TeamSpeak3_Node_Server::iconUpload()
+ added TeamSpeak3_Node_Channel::iconDownload()
+ added TeamSpeak3_Node_Client::iconDownload()
+ added TeamSpeak3_Node_Servergroup::iconDownload()
+ added TeamSpeak3_Node_Channelgroup::iconDownload()
* TeamSpeak3_Transport_TCP methods will now read and write in small steps
of 4096 bytes
* TeamSpeak3_Node_Server snapshot methods now support three different export
formats (SNAPSHOT_STRING, SNAPSHOT_BASE64, SNAPSHOT_HEXDEC)
* internal release only

=== Release 1.0.23-beta - 28 Jan 2010 ===
! upgrading your servers to 3.0.0-beta17 (build >= 10036) is mandatory
+ added TeamSpeak3_Node_Server::customInfo()
+ added TeamSpeak3_Node_Client::customInfo()
+ added priority speaker information to TeamSpeak3_Viewer_Html interface
* changed fetch mode from toAssocArray() to toArray() in several methods
* spl_autoload_register() is only called once even if TeamSpeak3::init() is
called multiple times
- changed invalid variable name in TeamSpeak3_Node_Server::clientGetByUid()
- changed invalid description for TeamSpeak3_Node_Client::remServerGroup()

=== Release 1.0.22-beta - 18 Jan 2010 ===
! library now requires PHP version 5.2.1 or newer
! upgrading your servers to 3.0.0-beta13 (build >= 9802) is mandatory
+ added TeamSpeak3_Adapter_Abstract::getProfiler()
+ added TeamSpeak3_Adapter_ServerQuery::getQueryCount()
+ added TeamSpeak3_Adapter_ServerQuery::getQueryRuntime()
+ added TeamSpeak3_Node_Server::customSearch()
* adapter classes will now start their own timer for profiling
* added "-times" to default clientList() parameters
* added optional command parameters "tokendescription" and "tokencustomset"
to TeamSpeak3_Node_Server::tokenCreate()
- fixed error exception in TeamSpeak3_Adapter_ServerQuery destructor
- removed undefined variable in TeamSpeak3_Node_Server::channelFileRename()

=== Release 1.0.21-beta - 10 Jan 2010 ===
! all thrown TeamSpeak 3 Server error exceptions are now of objects of type
TeamSpeak3_Adapter_ServerQuery_Exception
! TeamSpeak3_Node_Abstract::offsetSet() is now a wrapper for the modify()
method to allow direct modifications of node properties
+ added TeamSpeak3_Helper_Convert::codec()
+ added TeamSpeak3_Node_Abstract::toArray()
+ added TeamSpeak3_Node_Abstract::toString()
+ added TeamSpeak3_Node_Server::clientCount()
+ added TeamSpeak3_Node_Server::clientListDb()
+ added TeamSpeak3_Node_Server::clientFind()
+ added TeamSpeak3_Node_Server::clientFindDb()
+ added TeamSpeak3_Node_Host::setPredefinedQueryName()
+ added TeamSpeak3_Node_Host::setExcludeQueryClients()
+ added optional "timeout" parameter to TeamSpeak3::factory()
+ added optional "nickname" parameter to TeamSpeak3::factory()
* error exception messages thrown by TeamSpeak3_Transport_TCP::connect()
will be UTF-8 encoded
* set some fancy titles in TeamSpeak3_Viewer_Html interface
* tweaked some of the implemented RecursiveIterator methods
* using strtr() instead of str_replace() in TeamSpeak3_Helper_String::arg()
* isset($node) no longer queries node information automatically
- fixed error exception when trying to start profiler timer twice
- fixed invalid node list format after reset

=== Release 1.0.20-beta - 08 Jan 2010 ===
! factory URI now supports #no_query_clients fragment to remove ServerQuery
clients from client lists and viewers
+ added TeamSpeak3_Helper_Profiler
+ added TeamSpeak3_Helper_Convert (WIP)
- fixed unnessesary command requests on empty list caches
- fixed recursion bug on empty virtual servers

=== Release 1.0.19-beta - 07 Jan 2010 ===
+ added TeamSpeak3_Adapter_Abstract::getTransportHost()
+ added TeamSpeak3_Adapter_Abstract::getTransportPort()
+ added TeamSpeak3_Node_Host::getAdapterHost()
+ added TeamSpeak3_Node_Host::getAdapterPort()
+ added TeamSpeak3_Node_Server::snapshotCreate()
+ added TeamSpeak3_Node_Server::snapshotDeploy()
+ added TeamSpeak3_Node_Server::selfPermOverview()
* given parameter strings will be UTF-8 encoded while commands are prepared
* TeamSpeak3_Node_Host::__toString() now returns hostname or IPv4 address
instead of "TeamSpeak 3 Host"
* public beta release

=== Release 1.0.18-beta - 06 Jan 2010 ===
! added code examples
! added online docs (http://docs.planetteamspeak.com/ts3/php/framework/)
+ added TeamSpeak3_Node_Client::avatarGetName()
+ added TeamSpeak3_Node_Client::avatarDownload()
+ added TeamSpeak3_Node_Client::permOverview()
* TeamSpeak3_Viewer_Html constructor now supports custom image paths
* whoami cache will be updated when creating temporary channels
* whoami cache will be updated when moving own client
- fixed "already member of channel" issue when sending two text messages to
the same channel
- ServerQuery adapter no longer tries to quit in desctructor when transport
is not connected
- replaced invalid data types in method descriptions

=== Release 1.0.17-beta - 05 Jan 2010 ===
* internal beta releaseStay tuned!

:D

ginger|HFD
18-05-2010, 20:18
State of Art as always. If you guys want high quality, then you will love the way how ScP does it. :)

Dont forget to donate once its released guys! Cant imagine how many hours are inside of that framework.

Nightwing
18-05-2010, 23:48
Great work, Sven!
Is a release of a sample-viewer also planned?

ToM

ScP
19-05-2010, 14:10
Great work, Sven!
Is a release of a sample-viewer also planned?

ToMA TSViewer script is included in the examples I'll deliver with the new release.

Nightwing
19-05-2010, 14:37
Great news, thanks Sven!

ToM

Pimmetje
25-05-2010, 11:48
I there a way to generate a array or something from the channels and clients (i would like to have JSON) This way i can load the viewer with ajax. At the moment i have one running but it does not see a differents for channel and subchannel
if i do $ts3_vs->channelList() i get all channels AND subchannels but i can't figure out how to see the difference between channel and subchannel. Am i missing something?

ScP
25-05-2010, 13:36
At the moment i have one running but it does not see a differents for channel and subchannel
if i do $ts3_vs->channelList() i get all channels AND subchannels but i can't figure out how to see the difference between channel and subchannel. Am i missing something?Each channel has a property called pid (ID of the parent channel). If the pid is 0, you're dealing with a top-level channel.

I've uploaded an internal test release of the framework (1.0.27-beta). The documentation is not updated yet, but I've fixed several bugs and added a few new features. The final version with updated docs will follow soon.

Note that I've temporary disabled the support for custom icons in the TeamSpeak3_Viewer_Html interface in this release. Current public versions of the TeamSpeak 3 Server do not provide a -icon parameter for channel and clientlists yet so custom icon support would mean one extra command per channel and client which is not very efficient on a large server.

***REMOVED OUTDATED URL***


ScP needs YOU!!!^^


The reason for this pre-release is that I need your feedback on one specific feature. I've added a method called serverGroupIdentify() which can be called on any TeamSpeak3_Node_Server object. This method tries to identify the most powerful server group on a virtual server by a set of rules I defined. An example is included in the package. On my test servers the script always returned the correct group, but I can imagine that there are some complex configurations out there which could cause weird results.

Please try to setup this example script on your servers and tell me if the result was correct. Thank you!

Pimmetje
25-05-2010, 14:21
Whats the use of the methode getSubchannels? when channelList() returns all it channels at ones? I understand that is because of the way TS3 returns all channels at once. But i think it would be nice when the framework would solve the problem of finding the correct channels (subchannels).

Or am i still missing a point?

ScP
25-05-2010, 16:11
The subChannelList() method which can be called on a TeamSpeak3_Node_Channel object is just for convenience.

Glotzkowski
25-05-2010, 20:48
realy good work

THX :D

ScP
28-05-2010, 19:11
Does anyone have any feedback regarding the serverGroupIdentify() method? Read my previous posting for details.

kasebone
28-05-2010, 20:40
works great on my installation, but its very basic like the default set. :-)

theeggman
03-06-2010, 00:52
Works here too, but I also have a pretty standard group setup.

ScP
07-06-2010, 01:23
I'm pleased to announce that the next official update of the TS3 PHP Framework will be released as soon as the upcoming version of the TeamSpeak 3 Server (3.0.0-beta25) is available to the public. At this point I'll also reopen the original forum thread with a detailed project description. As a small preview, I've uploaded the latest version of the included example pages which already contain some of the new features:

http://www.planetteamspeak.com/demos/TS3%20PHP%20Framework/examples/

Here's the latest changelog:


================================================== =============================
TS 3 PHP Framework - Changelog
Copyright Planet TeamSpeak
http://www.planetteamspeak.com
================================================== =============================
+ Added feature or noticable improvement
- Bug fix or something removed
* Changed or Information
! Important - Take note!
================================================== =============================

=== Release 1.0.28-beta - ?? Jun 2010 ===
! upgrading your servers to 3.0.0-beta25 (build >= 11255) is mandatory
+ added TeamSpeak3_Node_Server::isOffline()
* TeamSpeak3_Node_Server::serverGroupCreate() now supports type parameter
* TeamSpeak3_Node_Server::channelGroupCreate() now supports type parameter
* TeamSpeak3_Viewer_Html interface now supports downloading of remote icons
! please keep in mind that the TeamSpeak3_Viewer_Html interface is intended
as a proof of concept application and should be modified to cache remote
icons before beeing used in a production environment
- fixed invalid command name in TeamSpeak3_Node_Server::clientDeleteDb()
- removed check for client_flag_talking in TeamSpeak3_Node_Client::getIcon()

=== Release 1.0.27-beta - 24 May 2010 ===
! upgrading your servers to 3.0.0-beta23 (build >= 11062) is mandatory
! TeamSpeak3_Adapter_Abstract::__construct() now expects an array of options
instead of a TeamSpeak3_Transport_Abstract object
+ added TeamSpeak3_Adapter_Update
+ added TeamSpeak3_Adapter_Blacklist
+ added TeamSpeak3_Transport_UDP
+ added TeamSpeak3_Adapter_Abstract::initTransport()
+ added TeamSpeak3_Node_Abstract::getClass()
+ added TeamSpeak3_Node_Abstract::serverGroupIdentify() (WIP)
- fixed invalid return value in TeamSpeak3_Helper_String::resize()
* TeamSpeak3::autoload() no longer loads libraries without the TeamSpeak3
classname prefix to resolve issues with spl_autoload() implementations from
other frameworks
* TeamSpeak3_Viewer_Html interface now adds custom HTML class properties to
nodes to improve CSS customization options
* TeamSpeak3_Viewer_Html interface now recognizes channel spacers (WIP)
* internal release only

=== Release 1.0.26-beta - 14 Apr 2010 ===
! codebase converted to Zend Studio 7.1.2 project
+ added TeamSpeak3_Node_Server::channelIsSpacer()
+ added TeamSpeak3_Node_Server::channelSpacerCreate()
+ added TeamSpeak3_Node_Server::channelSpacerGetType()
+ added constants for different channel spacer types (WIP)
- fixed unused parameters in TeamSpeak3_Node_Channel::permRemove()
- fixed unused parameters in TeamSpeak3_Node_Server::channelFileRename()
* TeamSpeak3_Helper_String::contains() now supports RegExp patterns and is
case-insensitive
* lists generated by TeamSpeak3_Node_Server::channelFileList() are now sorted
by filename
* TeamSpeak3_Viewer_Html interface now calculates server uptime correctly
* changed examples to include new features
* internal release only

=== Release 1.0.25-beta - 1 Apr 2010 ===
! upgrading your servers to 3.0.0-beta21 (build >= 10608) is mandatory
+ added TeamSpeak3_Exception::registerCustomMessage()
+ added TeamSpeak3_Exception::unregisterCustomMessage()
+ added TeamSpeak3_Helper_Convert::groupType()
+ added TeamSpeak3_Helper_Convert::permissionType()
+ added TeamSpeak3_Helper_Convert::password()
+ added TeamSpeak3_Helper_String::filterAlnum()
+ added TeamSpeak3_Helper_String::filterAlpha()
+ added TeamSpeak3_Helper_String::filterDigits()
+ added constants for different group auto-update types
- changed invalid variable name in TeamSpeak3_Adapter_ServerQuery::request()
* TeamSpeak3_Adapter_FileTransfer::download() now supports fpassthru() to
write the results to the PHP output buffer which can be very useful when
transferring large files
* TeamSpeak3_Helper_Convert::seconds() now supports custom output format
* internal release only

=== Release 1.0.24-beta - 24 Feb 2010 ===
! upgrading your servers to 3.0.0-beta19 (build >= 10368) is mandatory
+ added TeamSpeak3_Node_Abstract::iconIsLocal()
+ added TeamSpeak3_Node_Abstract::iconGetName()
+ added TeamSpeak3_Node_Server::iconDownload()
+ added TeamSpeak3_Node_Server::iconUpload()
+ added TeamSpeak3_Node_Channel::iconDownload()
+ added TeamSpeak3_Node_Client::iconDownload()
+ added TeamSpeak3_Node_Servergroup::iconDownload()
+ added TeamSpeak3_Node_Channelgroup::iconDownload()
* TeamSpeak3_Transport_TCP methods will now read and write in small packets
of 4096 bytes
* TeamSpeak3_Node_Server snapshot methods now support three different export
formats (SNAPSHOT_STRING, SNAPSHOT_BASE64, SNAPSHOT_HEXDEC)
* internal release only

=== Release 1.0.23-beta - 28 Jan 2010 ===
! upgrading your servers to 3.0.0-beta17 (build >= 10036) is mandatory
+ added TeamSpeak3_Node_Server::customInfo()
+ added TeamSpeak3_Node_Client::customInfo()
+ added priority speaker information to TeamSpeak3_Viewer_Html interface
* changed fetch mode from toAssocArray() to toArray() in several methods
* spl_autoload_register() is only called once even if TeamSpeak3::init() is
called multiple times
- changed invalid variable name in TeamSpeak3_Node_Server::clientGetByUid()
- changed invalid description for TeamSpeak3_Node_Client::remServerGroup()

=== Release 1.0.22-beta - 18 Jan 2010 ===
! library now requires PHP version 5.2.1 or newer
! upgrading your servers to 3.0.0-beta13 (build >= 9802) is mandatory
+ added TeamSpeak3_Adapter_Abstract::getProfiler()
+ added TeamSpeak3_Adapter_ServerQuery::getQueryCount()
+ added TeamSpeak3_Adapter_ServerQuery::getQueryRuntime()
+ added TeamSpeak3_Node_Server::customSearch()
* adapter classes will now start their own timer for profiling
* added "-times" to default clientList() parameters
* added optional command parameters "tokendescription" and "tokencustomset"
to TeamSpeak3_Node_Server::tokenCreate()
- fixed error exception in TeamSpeak3_Adapter_ServerQuery destructor
- removed undefined variable in TeamSpeak3_Node_Server::channelFileRename()

=== Release 1.0.21-beta - 10 Jan 2010 ===
! all thrown TeamSpeak 3 Server error exceptions are now of objects of type
TeamSpeak3_Adapter_ServerQuery_Exception
! TeamSpeak3_Node_Abstract::offsetSet() is now a wrapper for the modify()
method to allow direct modifications of node properties
+ added TeamSpeak3_Helper_Convert::codec()
+ added TeamSpeak3_Node_Abstract::toArray()
+ added TeamSpeak3_Node_Abstract::toString()
+ added TeamSpeak3_Node_Server::clientCount()
+ added TeamSpeak3_Node_Server::clientListDb()
+ added TeamSpeak3_Node_Server::clientFind()
+ added TeamSpeak3_Node_Server::clientFindDb()
+ added TeamSpeak3_Node_Host::setPredefinedQueryName()
+ added TeamSpeak3_Node_Host::setExcludeQueryClients()
+ added optional "timeout" parameter to TeamSpeak3::factory()
+ added optional "nickname" parameter to TeamSpeak3::factory()
* error exception messages thrown by TeamSpeak3_Transport_TCP::connect()
will be UTF-8 encoded
* set some fancy titles in TeamSpeak3_Viewer_Html interface
* tweaked some of the implemented RecursiveIterator methods
* using strtr() instead of str_replace() in TeamSpeak3_Helper_String::arg()
* isset($node) no longer queries node information automatically
- fixed error exception when trying to start profiler timer twice
- fixed invalid node list format after reset

=== Release 1.0.20-beta - 08 Jan 2010 ===
! factory URI now supports #no_query_clients fragment to remove ServerQuery
clients from client lists and viewers
+ added TeamSpeak3_Helper_Profiler
+ added TeamSpeak3_Helper_Convert (WIP)
- fixed unnessesary command requests on empty list caches
- fixed recursion bug on empty virtual servers

=== Release 1.0.19-beta - 07 Jan 2010 ===
+ added TeamSpeak3_Adapter_Abstract::getTransportHost()
+ added TeamSpeak3_Adapter_Abstract::getTransportPort()
+ added TeamSpeak3_Node_Host::getAdapterHost()
+ added TeamSpeak3_Node_Host::getAdapterPort()
+ added TeamSpeak3_Node_Server::snapshotCreate()
+ added TeamSpeak3_Node_Server::snapshotDeploy()
+ added TeamSpeak3_Node_Server::selfPermOverview()
* given parameter strings will be UTF-8 encoded while commands are prepared
* TeamSpeak3_Node_Host::__toString() now returns hostname or IPv4 address
instead of "TeamSpeak 3 Host"
* public beta release

=== Release 1.0.18-beta - 06 Jan 2010 ===
! added code examples
! added online docs (http://docs.planetteamspeak.com/ts3/php/framework/)
+ added TeamSpeak3_Node_Client::avatarGetName()
+ added TeamSpeak3_Node_Client::avatarDownload()
+ added TeamSpeak3_Node_Client::permOverview()
* TeamSpeak3_Viewer_Html constructor now supports custom image paths
* whoami cache will be updated when creating temporary channels
* whoami cache will be updated when moving own client
- fixed "already member of channel" issue when sending two text messages to
the same channel
- ServerQuery adapter no longer tries to quit in desctructor when transport
is not connected
- replaced invalid data types in method descriptions

=== Release 1.0.17-beta - 05 Jan 2010 ===
* internal beta releaseAs always, I appreciate your feedback!

;)

theeggman
07-06-2010, 02:31
Got a couple questions about the framework, I think here is the best place to ask them..

first.. Does the Framework require a certain version of php? On my production server I run version 5.2.6 as fast cgi (via ngnix) and on my development environment I'm using 5.3.2 (via mod_php and apache2). Version 1.0.22-beta works fine in both environments, but version 1.0.27-beta (the internal release posted here) does not render the html viewer on my production server. I cannot see any errors either, I'm a tad puzzled as to what is going on.

second... I noticed the tsviewer.com (this site uses your framework) website's scanner registers itself with a name so it does not connect as serveradmin from *****.. I'm wondering how I can do that in my own code... any advice would be great!

lastly - a small bug I noticed, not sure what is happening here either, but I have the examples (1.0.27-beta) working on my production server. I noticed when I looked at the example that views the server's information its reporting my server is on the blacklist, when clearly its not (I verified with a support ticket as well). Reports fine on my development server.. Maybe again has to do with my version of php?

ScP
07-06-2010, 05:58
Does the Framework require a certain version of php?The minimum PHP version required by the framework is 5.2.1.


I noticed the tsviewer.com (this site uses your framework) website's scanner registers itself with a name so it does not connect as serveradmin from *****.. I'm wondering how I can do that in my own code... any advice would be great!Simply. You can either call the setPredefinedQueryName() method on any node object or add the nickname parameter to the factory to set a custom nickname.


$ts3_ServerInstance = TeamSpeak3::factory("serverquery://user:pass@host:port/?nickname=Hello");
lastly - a small bug I noticed, not sure what is happening here either, but I have the examples (1.0.27-beta) working on my production server. I noticed when I looked at the example that views the server's information its reporting my server is on the blacklist, when clearly its not (I verified with a support ticket as well). Reports fine on my development server.. Maybe again has to do with my version of php?I think this is a bug, but I doubt that it's related to your PHP version. What's the IP address of your server? I'd like to reproduce this issue on my end.

theeggman
07-06-2010, 07:12
Thank you for answering my questions.


What's the IP address of your server? I'd like to reproduce this issue on my end.
My server's ip is.. ts3.eggy.cc (67.220.68.53) though if you need query access I'll need to whitelist the ip you plan to test from..

Hrm.. what makes things more strange is if I run my code through my server's php-cli, it outputs the correct html and no php errors. I guess its something strange with ngnix and this new library version :(

ScP
07-06-2010, 08:03
My server's ip is.. ts3.eggy.cc (67.220.68.53) though if you need query access I'll need to whitelist the ip you plan to test from...I tried to reproduce the issue on my end, but the blacklist server is reporting that your IP address is not blacklisted as expected.

I was using this code:


$status = TeamSpeak3::factory("blacklist")->isBlacklisted("ts3.eggy.cc");

TeamSpeak3::dump($status);Please test this on your server and tell me what the result is.

theeggman
07-06-2010, 15:16
I tried to reproduce the issue on my end, but the blacklist server is reporting that your IP address is not blacklisted as expected.

I was using this code:


$status = TeamSpeak3::factory("blacklist")->isBlacklisted("ts3.eggy.cc");

TeamSpeak3::dump($status);Please test this on your server and tell me what the result is.

Heh - On my Development environment, it returns the expected result. But in the (stubborn) production environment.. it returns true... Puzzling, perhaps Debian's build of php-cgi is bugged..

ScP
07-06-2010, 16:12
I guess I've got a slight idea of what could be the problem. Let me run some tests here and I'll send you a snapshot of the library later so you can retry this.

theeggman
08-06-2010, 02:08
I guess I've got a slight idea of what could be the problem. Let me run some tests here and I'll send you a snapshot of the library later so you can retry this.
Sounds good to me :)

empi89
17-06-2010, 15:33
hi scp,

first: your library is really nice! But the performance when you list all virtualservers on a host is bad. I call the Host->serverlist and will receive an array with server-objects. If I want some basic information I have to call the getinfo-method to fetch the nodeinfo. Well getinfo (server->fetchnodeinfo) will call serverinfo and fetch all server-information which is quite slow for hundreds of servers. for a simple serverlist not all the serverinfos are required. serverlist returns some basic information (id, port, status, clients, maxclients, uptime, name, autostart, unique_id) and this information is saved in the server-objects but not accessible via a method. It would help if you can make this properties accessible via an additional public method like getCachedInfo or getBasicInfo which will only return the actual nodeinfo.

I hope you can understand my problem and can add such a method to the public api. We're already using a simple method to return the nodeinfo but it's not very nice to depend on a non-standard-api in case of updates.

ScP
17-06-2010, 15:48
I'm using PHPs ArrayAccess interface to provide access to the simple node properties. Here's an example:


// echo virtualserver_name
echo $server;

// echo virtualserver_maxclients
echo $server['virtualserver_maxclients'];If you're trying to access a property which is currently not "known" by the object (e.g. not requested yet), the library will automatically call the appropriate ServerQuery command automatically to "extend" the information with all the details available.

So basically, as long as you only access properties which are available in the serverlist output, the lib will not query the serverinfo.

Note that when a virtual server is offline, the serverlist output will NOT contain the current number of clients online on this server - the property is missing which will cause the lib to query the serverinfo anyway...

Mannekino
21-06-2010, 12:35
Can somebody please explain how the "tokenCreate" method works?

* integer $type
* integer $id1
* integer $id2
* $description
* $customset

I just want to create a new Admin Token for the selected virtual server.

What is type, id1 and id2 exactly?

Yoshua
30-06-2010, 02:59
Hi,

First thank for TeamSpeak 3 PHP Framework.

I'm trying to create PHP scripts to integrate TS3 with vBulletin, I try to delete a specific client on the server by using this script but I get the error: "Error 1537: invalid parameter count".

"$cldbid = 147" is a Client ID in DB.


include("config.php");
require_once("TeamSpeak3/TeamSpeak3.php");

try
{
$ts3_ServerInstance = TeamSpeak3::factory("serverquery://" . $config["user"] . ":" . $config["pass"] . "@" . $config["host"] . ":" . $config["port"] . "/");
$selected_sid = 1;
$ts3_VirtualServer = $ts3_ServerInstance->serverGetById($selected_sid);
$cldbid = 147;
$param = $ts3_VirtualServer->clientDeleteDb($cldbid);
}
catch(Exception $e)
{
$param = "<b>Error " . $e->getCode() . ":</b> <i>" . $e->getMessage() . "</i>";
}
echo "<p>".$param."</p>";I have tried other methods like POKE or SEND MESSAGE with the same script and work perfectly, for now only this method does not work.

I appreciate any help.

Regards

faralsimbor
30-06-2010, 15:45
Hi,

is it possible to call



servernotifyregister event=textprivate


with the TeamSpeak 3 PHP Framework?

Yoshua
01-07-2010, 00:23
Nobody?

This project is still active?

Although we can download the version 1.0.27 from this thread on the forum, the Planet TeamSpeak website showing the latest available is 1.0.22, the API documentation is for version 1.0.22 (i think) and the Planet TeamSpeak forums do not work for several days, do not know where I can get help for this problem.

I'm no expert on these issues, but I think the method clientDeleteDb() are not properly synchronized.

Thank.

P.D. Ok, I said nothing ... lol
I've read the latest changelog for next version Release 1.0.28-beta - ?? Jun 2010:
"- fixed invalid command name in TeamSpeak3_Node_Server::clientDeleteDb()"
Where can we download the latest 1.0.28 version or when it will be available?

Teris Cooper
01-07-2010, 08:15
Hi,
In this forum you will always find latest version of the! That is also the x.x.28. However, you should wait you yet.

ScP
01-07-2010, 16:35
Here's a link to my internal test release of version 1.0.27-beta:

http://download.planetteamspeak.com/teamspeak3/scripts/php/TS3_PHP_Framework-1.0.27b.zip

Yoshua
01-07-2010, 18:08
Here's a link to my internal test release of version 1.0.27-beta:

http://download.planetteamspeak.com/teamspeak3/scripts/php/TS3_PHP_Framework-1.0.27b.zip

Thank you very much ScP, but this version, 1.0.27 is the one I'm using and which I have the error with the method "clientDeleteDb()". I see in the version 1.0.28 this error is fixed.

On the website of examples I see that are using version 1.0.28:

http://www.planetteamspeak.com/demos/TS3%20PHP%20Framework/examples/
"All of these pages are generated live using version 1.0.28-beta of the TeamSpeak 3 PHP Framework."

...the only question I have is when we have version 1.0.28 or how I can fix the problem with this method on my own or look for other alternatives.

Thank again.

Regards

ScP
01-07-2010, 22:07
Here's the TeamSpeak3/Node/Server.php library from version 1.0.18-beta which should fix your issue:

http://pastebin.planetteamspeak.com/pastebin.php?show=366

Have fun!

Yoshua
01-07-2010, 22:54
Here's the TeamSpeak3/Node/Server.php library from version 1.0.18-beta which should fix your issue:

http://pastebin.planetteamspeak.com/pastebin.php?show=366

Have fun!

Very Very Thank ScP...

Now works properly ....

Once again thank you very much for your help.

Regards.

ScP
03-07-2010, 00:59
Finally, here's version 1.0.29-beta:

http://www.planetteamspeak.com/component/option,com_docman/task,doc_details/Itemid,69/gid,105/

Unfortunately, I was unable to update the online documentation yet so that's still outdated. I will re-create the oringinal forum thread as soon as everything's prepared.

Yoshua
04-07-2010, 18:28
Finally, here's version 1.0.29-beta:

http://www.planetteamspeak.com/component/option,com_docman/task,doc_details/Itemid,69/gid,105/

Unfortunately, I was unable to update the online documentation yet so that's still outdated. I will re-create the oringinal forum thread as soon as everything's prepared.

Thank ScP for new viewer with the custom icons from server.

SmokinShark
04-07-2010, 20:44
Finally, here's version 1.0.29-beta

Nice nice nice to read! This is what i'm waiting for (custom Icons).


Is it possible to create a Viewer who only show the Tree (without the other Things like Banner an so..)?

YouCanCallMeAl
05-07-2010, 21:57
Hi guys. My first post here so a nice and big welcome to everyone.

I've been toying around with this framework for some time now and like it very much, but it seems I've run into an issue I can't quite wrap my head around.

I'm trying to use the clientListDb() function, to get all the clients that were once connected to the server, but it seems that apart from what already is in this database, new users are not registered. Only changed nicks of previously connected users update, but if a completely new user connects there is no record of it in the results of the function. Am I doing something wrong here? Is this not the functionality of this function?

Any help appreciated guys, thanks in advance.

ScP
06-07-2010, 11:54
I'm trying to use the clientListDb() function, to get all the clients that were once connected to the server, but it seems that apart from what already is in this database, new users are not registered. Only changed nicks of previously connected users update, but if a completely new user connects there is no record of it in the results of the function. Am I doing something wrong here? Is this not the functionality of this function?I think yout issue is not caused by the framework, but by the TeamSpeak 3 Server itself... and actually, it's not an issue. If no parameter is specified, the clientdblist command only returns the first 25 entires from the database. Use the duration parameter to specify the number of clients you wish to receive. Here's an example:


// get 250 clients, beginning with an offset of 50
$clientdblist = $virtual_server->clientListDb(50, 250);

YouCanCallMeAl
06-07-2010, 14:44
I think yout issue is not caused by the framework, but by the TeamSpeak 3 Server itself... and actually, it's not an issue. If no parameter is specified, the clientdblist command only returns the first 25 entires from the database. Use the duration parameter to specify the number of clients you wish to receive. Here's an example:


// get 250 clients, beginning with an offset of 50
$clientdblist = $virtual_server->clientListDb(50, 250);

HA! Thank you very much, this works now.

The problem was that here:
http://docs.planetteamspeak.com/ts3/php/framework/
there is no information about the default 25 users returned.

Thanks for helping out, and thanks for the great framework overall :)

ScP
06-07-2010, 19:46
The docs are currently outdated. I'll update them as soon as possible... Anyway, thanks for your good feedback.

:cool:

faralsimbor
10-07-2010, 14:30
Hi ScP,

I've got the following error when i try to put the TeamSpeak3_Node_Host object into a session:

errorCode: 0
errorMessage: timer '00000000655dd3af00000000381a09f7' does not exist

how its possible to put your factory into a session variable?
or is it possible to make the TeamSpeak3 class singleton?

b.t.w
your modifed autoload function works great for me.

keep up the good work.

kedal
10-07-2010, 14:51
Hey.

I worked with my servers with the SID but now, i want to with the port but..
That doesnt work.. What's wrong ?

Error 1035: server got an invalid status for this operation
( Im disconnected from the TS server.. so he's stopped )

(No problem with the factory, i worked with that before...)



$ServerInstance = TeamSpeak3::factory('serverquery://' . self::$ts_config[$instanceID]['user'] . ':' . self::$ts_config[$instanceID]['pass'] . '@' . self::$ts_config[$instanceID]['host'] . ':' . self::$ts_config[$instanceID]['port'] . '/');

$ServerInstance->serverGetByPort($port)->stop();
usleep(1000000);
$ServerInstance->serverGetByPort($port)->delete();

Edit: Start, Stop work. But cant use delete.
Edit: strange... Tried with stop(); then request("serverdelete sid=67") same error message

BUT in telnet
serverstop sid=66
error id=0 msg=ok
serverdelete sid=66
error id=0 msg=ok

Edit: btw, the ID $ServerInstance->serverGetByPort($port)->getId(); is correct. . .

Edit : I finally get the ID .. then used ServerInstance->serverDelete...

ScP
10-07-2010, 15:43
I've got the following error when i try to put the TeamSpeak3_Node_Host object into a session:

errorCode: 0
errorMessage: timer '00000000655dd3af00000000381a09f7' does not exist

how its possible to put your factory into a session variable?
or is it possible to make the TeamSpeak3 class singleton?I'll look into that.

:)

EDIT: Just uploaded version 1.0.30-beta... Happy testing!

theeggman
17-07-2010, 20:10
hey scp..

I finally got around to re-testing blacklisting on the one server. It appears to take a *really* long time to execute the test script. Is there perhaps some kind of time out that causes it to return true?

ScP
18-07-2010, 13:36
What is the exact return value?

theeggman
20-07-2010, 02:13
it always hangs for a bit, then returns false on the debian server (older version of php and its being ran as CGI)..

but on my other linux (ubuntu) server it returns true very quickly.

ScP
20-07-2010, 21:57
Did you replace the method with the code I sent you via PM? I need the debug output...

theeggman
21-07-2010, 05:28
Oh.. yes.. that sorry.
Did that tonight check your PM for the output.

ScP
21-07-2010, 07:03
Thx. The issue will be fixed with the next release.

floeH
21-07-2010, 09:47
Hi!

I love this framework. Everything works fine. Good job ScP!

But...... is it possible to get the type of the group? I wanted to create new tokens and when i list all the groups to get the right id there are also the standard groups. You cant create a token with one of these. I think the type of the group must be 1.

Is there a opportunity to get the type?
I did not found anything :(


Mhhh, my english is very bad. Sorry!

ScP
21-07-2010, 13:07
Thank you for your good feedback. I've defined three class constants for the different group types:


/**
* TeamSpeak 3 permission group database types.
*/
const GROUP_DBTYPE_TEMPLATE = 0x00; // 0: template group (used for new virtual servers)
const GROUP_DBTYPE_REGULAR = 0x01; // 1: regular group (used for regular clients)
const GROUP_DBTYPE_SERVERQUERY = 0x02; // 2: global query group (used for ServerQuery clients)Here's a code snippet to show you how to filter all but regular groups from the servergrouplist output:


// load list of server groups
$servergroups = $server->serverGroupList();

// remove non-regular groups from array
foreach($servergroups as $sgid => $servergroup)
{
if($servergroup["type"] != TeamSpeak3::GROUP_DBTYPE_REGULAR) unset($servergroups [$sgid]);
}For the next release I'll add optional filter parameters to all listing functions to remove unwanted elements.

floeH
21-07-2010, 13:41
Thanks for your quick reply.
It works fine!

Thank you!

ScP
24-07-2010, 12:29
Once again, here's the latest changelog:


=== Release 1.0.31-dev - ?? Jul 2010 ===
+ added some new demo scripts to the example pages
* fixed TeamSpeak3_Adapter_Blacklist::isBlacklisted() invalid return values
when master server is not responding
* several node list methods now support additional regexp filter parameters
- fixed a stristr() warning in TeamSpeak3_Helper_String::contains() when
providing an empty search patternThe new regexp filters are available for serverList(), clientList(), channelList(), subChannelList(), serverGroupList() and channelGroupList() and will work like this:


$filters = array(
"virtualserver_name" => "^TeamSpeak", // find virtual servers starting with "TeamSpeak"
"virtualserver_status" => "online", // find active virtual servers
);

$serverlist = $ts3->serverList($filters);If you have any more ideas or feature requests for the upcoming release, please let me know.

:)

kedal
27-07-2010, 17:23
Hey.

I've again a problem.

MyPHPFile.php
System
|- TeamSpeak2Manager.php
|- TeamSpeak3Manager.php
|- ts2_framework
|- |- The TS2 Framework
|- ts3_framework
|- |- librairies
|- |- |- TeamSpeak3
|- |- |- |- Your Framework

TeamSpeak2Manager.php and TeamSpeak3Manager.php have a static method named createServer which use the frameworks to create servers.

Separated, and called by two differents file ( placed in the same folder as MyPHPFile.php ), the two functions work great ! ( And others too, like removeServer(..) ) I call them by

require('System/TeamSpeak2Manager.php');
TeamSpeak2Manager::createServer($name, $slots);

require('System/TeamSpeak3Manager.php');
TeamSpeak3Manager::createServer($name, $slots);

BUT when I call the both like :

require('System/TeamSpeak2Manager.php');
require('System/TeamSpeak3Manager.php');
TeamSpeak2Manager::createServer($name, $slots);
TeamSpeak3Manager::createServer($name, $slots);

I've this error :
Error 2: Class file /var/www/panel/teamspeak/system/ts2_framework/TeamSpeak3/Helper/Profiler.php was not found.

What's wrong ? I tried to rename one method to another name, same thing. But when I do the inverse :

require('System/TeamSpeak2Manager.php');
require('System/TeamSpeak3Manager.php');
TeamSpeak3Manager::createServer($name, $slots);
TeamSpeak2Manager::createServer($name, $slots);

That works !

But in my soft.. I cant inverse... Do u know what's wrong ? Issue with the class loader ? =S
The class is found when I put a require in TeamSpeak3.php ( framework ) but i'll not write all the requires..
It's Strange

Thanks !

EDIT::TS2 Framework is Absurd and it also use spl autoload ! The methods of autoload of TS2 Framework is in the next page..

kedal
27-07-2010, 19:23
I edited my post at the end of page 4 to notify that the TS2 Framework ( Absurd ) also use spl autoload.

Here the methods of autoload in Absurd TS2



/**
* Initialises Absurdcoding.org Framework
*
* @return void
*/
public static function init()
{
self::$libpath = dirname(__FILE__) . '/';
self::$extension = '.php';
spl_autoload_register(array(__CLASS__, 'autoload'));
}

/**
* Autoloads a class with given name
*
* @param string $class
* @throws Absurd_Exception
* @return void
*/
public static function autoload($class)
{
if (!class_exists($class) && !interface_exists($class)) {
if (!preg_match('/^[A-Za-z0-9_]+$/', $class)) {
throw new Absurd_Exception("Class $class contains invalid characters", 0x01);
} else {
$file = self::$libpath . str_replace('_', '/', $class) . self::$extension;
if (!$fp = @fopen($file, 'r', true)) {
throw new Absurd_Exception("Class file $file was not found", 0x02);
} else {
@fclose($fp);
include_once($file);
if (!class_exists($class) && !interface_exists($class)) {
throw new Absurd_Exception("Class $class was not found in the expected place", 0x03);
}
}
}
}
}

Seems that's the TS2 autoload whitch is used in TS3 ... Cant we reset ? =/
Thanks for help.... This prob is really annoying..

Mail: menthe.alow a t g m a i l d o t c o m

ScP
30-07-2010, 23:33
Here's the latest changelog:


=== Release 1.0.31-dev - ?? Jul 2010 ===
! upgrading your servers to 3.0.0-beta26 (build >= 11927) is mandatory
! removed "16x16_" prefix from viewer images and updated several icons
+ added some new demo scripts to the example pages
* TeamSpeak3_Node_Client::getIcon() now respects channel commander flag
* several node list methods now support additional regexp filter parameters
* exceptions thrown in TeamSpeak3_Adapter_ServerQuery::request() no longer
contain full query command string
* TeamSpeak3_Viewer_Html interface now supports all special channel spacers
by using background images
* TeamSpeak3_Viewer_Html interface now returns empty <div> with invidual CSS
classes for each spacer type instead of <hr> tags
* TeamSpeak3_Helper_Convert::seconds() no longer converts to milliseconds by
default
* TeamSpeak3_Node_Abstract::getInfo() now supports optional auto-conversion
of some properties to human-readable values
- fixed invalid TeamSpeak3_Adapter_Blacklist::isBlacklisted() return values
when master server is not responding
- fixed a stristr() warning in TeamSpeak3_Helper_String::contains() when
providing an empty search pattern:)

faralsimbor
31-07-2010, 11:09
Here's the latest changelog:


=== Release 1.0.31-dev - ?? Jul 2010 ===
! upgrading your servers to 3.0.0-beta26 (build >= 11927) is mandatory
! removed "16x16_" prefix from viewer images and updated several icons
+ added some new demo scripts to the example pages
* TeamSpeak3_Node_Client::getIcon() now respects channel commander flag
* several node list methods now support additional regexp filter parameters
* exceptions thrown in TeamSpeak3_Adapter_ServerQuery::request() no longer
contain full query command string
* TeamSpeak3_Viewer_Html interface now supports all special channel spacers
by using background images
* TeamSpeak3_Viewer_Html interface now returns empty <div> with invidual CSS
classes for each spacer type instead of <hr> tags
* TeamSpeak3_Helper_Convert::seconds() no longer converts to milliseconds by
default
* TeamSpeak3_Node_Abstract::getInfo() now supports optional auto-conversion
of some properties to human-readable values
- fixed invalid TeamSpeak3_Adapter_Blacklist::isBlacklisted() return values
when master server is not responding
- fixed a stristr() warning in TeamSpeak3_Helper_String::contains() when
providing an empty search pattern:)

Nice work as always, but where can i get the 3.0.0-beta26 server ? On your download page is only 3.0.0-beta25 available for download.

kedal
31-07-2010, 21:23
Hey.

Nobody can help me ? =// That's a PHP Problem . . . with SPL autoload ...

faralsimbor
01-08-2010, 20:08
Nice work as always, but where can i get the 3.0.0-beta26 server ? On your download page is only 3.0.0-beta25 available for download.

solved found pre beta26 at 4players.

faralsimbor
08-08-2010, 20:17
Silly Question, is it possible to run your framework in non-blocking mode?

ScP
09-08-2010, 07:18
Silly Question, is it possible to run your framework in non-blocking mode?I'll add an option for that...

:rolleyes:

The new release 1.0.31-beta is out now... Grab it while it's hot!


=== Release 1.0.31-beta - 12 Aug 2010 ===
! upgrading your servers to 3.0.0-beta26 (build >= 11927) is mandatory
! removed "16x16_" prefix from viewer images and updated several icons
+ added some new demo scripts to the example pages
+ added TeamSpeak3_Node_Server::serverGroupGetProfiles()
+ added TeamSpeak3_Node_Server::connectionInfo()
+ added TeamSpeak3_Helper_Convert::logLevel()
* TeamSpeak3_Node_Client::getIcon() now respects channel commander flag
* several node list methods now support additional regexp filter parameters
* exceptions thrown in TeamSpeak3_Adapter_ServerQuery::request() no longer
contain full query command string
* TeamSpeak3::factory() uri now features an optional parameter to enable the
blocking/non-blocking mode on a stream
* TeamSpeak3_Viewer_Html interface now supports all special channel spacers
by using background images
* TeamSpeak3_Viewer_Html interface now returns empty <div> with invidual CSS
classes for each spacer type instead of <hr> tags
* TeamSpeak3_Helper_Convert::seconds() no longer converts to milliseconds by
default
* TeamSpeak3_Node_Abstract::getInfo() now supports optional auto-conversion
of some properties to human-readable values
* TeamSpeak3_Node_Server::serverGroupList() now returns an empty array when
called on a default group
* TeamSpeak3_Node_Server::channelGroupList() now returns an empty array when
called on a default group
- fixed invalid TeamSpeak3_Adapter_Blacklist::isBlacklisted() return values
when master server is not responding
- fixed a stristr() warning in TeamSpeak3_Helper_String::contains() when
providing an empty search pattern;)

sTimulated
19-08-2010, 14:48
Hi
I'm looking for a simple viewer for my website,I've been told about this 'Framework'.
Just need to know who's online.
If a click and connect is available in the viewer then that's great :D but not essential.

I run my own site and servers from my spare pc,which is 3ft away.

I use wamp as my webserver.

My webpage is very simple but someone made it for me.
I can edit the frontpage to 'point' to a viewer but have no idea where in the framework I need to 'point'???:confused:

example.................
.mywebsite.com/TS3_PHP_Framework-1.0.31b/libraries/TeamSpeak3/Viewer/........
I'm sure that address is wrong:(
I presume I will also need to edit a config file somewhere that points to my IP?

Will this framework fill my needs?
If so what do I need to do?

Any help is greatly appreciated and a BIG thanks if this is what I need :)

Baraan
19-08-2010, 14:58
This framework can be used to program your own viewer. Well there is an example viewer included, but it still is no product ready for use.

Search in the Addons&Scripts forum or try one of these:
http://forum.teamspeak.com/showthread.php?t=57127
http://forum.teamspeak.com/showthread.php?t=47888

sTimulated
19-08-2010, 15:03
This framework can be used to program your own viewer. Well there is an example viewer included, but it still is no product ready for use.

Search in the Addons&Scripts forum or try one of these:
http://forum.teamspeak.com/showthread.php?t=57127
http://forum.teamspeak.com/showthread.php?t=47888

Thanks
I've tried resistance-x but get lots of errors.
Just downloaded drak3's,testing now.

Does the example viewer work?
Is this the example viewer,if so that would be ok?
http://www.planetteamspeak.com/demos/TS3%20PHP%20Framework/examples/?page=htmlviewer
I've tried 'pointing' to the location in my server but it didn't work.

faralsimbor
21-08-2010, 18:01
Hey ScP,

I've found 2 errors in your 1.0.31b release.

For the begining one simple error to warmup :D

If i try to connect your Framework with an nickname that contains whitespaces the Framework will crash with error message: "invalid uri". To avoid this simply wrap an urlencode around the nickname variable.

The second is a tricky one.

in your Transport Layer you've wrote


$this->stream = @stream_socket_client($address, $errno, $errstr, $timeout);
...
@stream_set_blocking($this->stream, 1);


But this didn't make sense. stream_socket_client opens the stream in blocking mode, per default. (see http://www.php.net/manual/en/function.stream-socket-client.php) And the line stream_set_blocking($this->stream, 1); sets the stream to blocking mode also (see http://www.php.net/manual/en/function.stream-set-blocking.php).

did you mean


$this->stream = @stream_socket_client($address, $errno, $errstr, $timeout);
...
@stream_set_blocking($this->stream, $this->config["blocking"]);

instead?

But if i replace stream_set_blocking($this->stream, 1); with stream_set_blocking($this->stream, 0); the Framework crashs with "connection lost"

ScP
22-08-2010, 13:37
The second is a tricky one.

in your Transport Layer you've wrote


$this->stream = @stream_socket_client($address, $errno, $errstr, $timeout);
...
@stream_set_blocking($this->stream, 1);
But this didn't make sense. stream_socket_client opens the stream in blocking mode, per default. (see http://www.php.net/manual/en/function.stream-socket-client.php) And the line stream_set_blocking($this->stream, 1); sets the stream to blocking mode also (see http://www.php.net/manual/en/function.stream-set-blocking.php).

did you mean


$this->stream = @stream_socket_client($address, $errno, $errstr, $timeout);
...
@stream_set_blocking($this->stream, $this->config["blocking"]);
instead?

But if i replace stream_set_blocking($this->stream, 1); with stream_set_blocking($this->stream, 0); the Framework crashs with "connection lost"You're right. What I did was indeed nonsense.

:D

Since streams created by stream_socket_client() will by default be opened in blocking mode, the blocking parameter I added did not work at all.

I'll fix this with the next release.

Ethaniel
25-08-2010, 14:22
Hello ScP

Since the updated beta 26, I am unable to retrieve information from a virtual server with the function or serverGetById serverGetByPort but only when switched off. This returns the error 1033 "Server Is Not Running".

What function can I use now to get the information of a virtual server offline? I would like to avoid if possible to list all servers to retrieve the virtual server that I want.

Thank you in advance for your reply :)

ScP
25-08-2010, 19:30
It seems like someone didn't read the changelogs. Check this out:


...

=== Release 1.0.29-beta - 03 Jul 2010 ===
! upgrading your servers to 3.0.0-beta26 (build >= 11624) is mandatory
+ added TeamSpeak3_Node_Server::serverGroupCopy()
+ added TeamSpeak3_Node_Server::channelGroupCopy()
+ added TeamSpeak3_Node_Server::clientInfoDb()
+ added TeamSpeak3_Node_Host::setUseOfflineAsVirtual()
* TeamSpeak3_Node_Server use methods now respect -virtual option
! offline virtual servers will no longer be started in virtual mode by
default while several new methods allow changing this behavior

...;)

Since the release of 3.0.0-beta26 the TeamSpeak 3 Server no longer auto-starts offline servers in virtual mode. You can globally re-enable this functionality in your existing code by calling the setUseOfflineAsVirtual() method on any node object.


$node = TeamSpeak3::factory("...");

$node->setUseOfflineAsVirtual(TRUE);Have fun!

Ethaniel
26-08-2010, 09:19
Thank you, it works great

ScP
31-08-2010, 09:26
=== Release 1.0.32-beta - 25 Aug 2010 ===
+ added TeamSpeak3_Helper_String::isInt()
+ added TeamSpeak3_Node_Host::setLoadClientlistFirst()
* TCP/UDP streams will by default be opened in blocking mode
* factory URI now accepts all flags as options thus supporting multiple flags
at once including both TeamSpeak 3 Client display modes for viewer scripts
- fixed invalid usage of parameter for blocking/non-blocking mode on a stream
- fixed invalid conversion of float values while parsing ServerQuery replies
* internal release onlyHere's the changelog for my latest internal version. I'll prepare version 1.0.33-beta for a public release as soon as I've fully implemented the new non-blocking mode transport libs.

:rolleyes:

As always, I'm excited to hear your feedback...

moppel
08-09-2010, 08:44
I'm new here and I would like to learn from you all ;)

I would like to develop a functionality that allows me to reset all permissions. There is an Query command permreset which allows to do this, but I could not find any information about this in your framework. Maybe someone has an Idea to handle this functionality.

thanks for your help

moppel

faralsimbor
08-09-2010, 10:20
I'm new here and I would like to learn from you all ;)

I would like to develop a functionality that allows me to reset all permissions. There is an Query command permreset which allows to do this, but I could not find any information about this in your framework. Maybe someone has an Idea to handle this functionality.

thanks for your help

moppel

add the following code to your Server Node (TeamSpeak3/Node/server.php).



public function permreset()
{
$this->request("permreset");
}


I Think that could work.

RefleX-mrl
08-09-2010, 22:33
everytime i connect to http://domain.tld/ts3phpframe/examples i get the error "Error 0: php_network_getaddresses: getaddrinfo failed: No address associated with hostname"

Anyone know how to fix this?

ScP
09-09-2010, 21:01
Just implemented the permreset command. Thanks for the hint. I'll release a new public version on the upcoming weekend.

:rolleyes:


everytime i connect to http://domain.tld/ts3phpframe/examples i get the error "Error 0: php_network_getaddresses: getaddrinfo failed: No address associated with hostname"

Anyone know how to fix this?The reason for this is pretty simple... DNS isn't working properly on your machine. Use the IP address instead or configure your system to use a working DNS server.

RefleX-mrl
10-09-2010, 00:07
Thanks for your reply!

Doesn't work with http://xx.xxx.xxx.xxx/ts3phpframe/examples/ too!
index is viewable.. any other function say
Error 0: php_network_getaddresses: getaddrinfo failed: No address associated with hostname

any other ideas?

bad_dud
10-09-2010, 13:50
Thanks for your reply!

Doesn't work with http://xx.xxx.xxx.xxx/ts3phpframe/examples/ too!
index is viewable.. any other function say

any other ideas?

Did you update the config.php in the example folder?

This is the default and you need to point it to your TS3 server:


$config["host"] = "127.0.0.1"; <- Change
$config["port"] = 10011;
$config["user"] = "serveradmin";
$config["pass"] = ""; <- Add

ScP
10-09-2010, 14:21
Thanks for your reply!

Doesn't work with http://xx.xxx.xxx.xxx/ts3phpframe/examples/ too!
index is viewable.. any other function say

any other ideas?I think you misunderstood my reply. The link you're using to open the example pages dont matter. You need to modify the config.php file and set a valid hostname or IP for your TS3 server in there.

RefleX-mrl
11-09-2010, 11:48
I have already done it!

My config seems to be correct. Teamspeakserver is running on Root with DNS Sync to Domain.

IP: 123.45.67.89
DNS should work.. can connect to my Teamspeakserver via domain.tld or the IP..

My Config looks like this:
$config["host"] = "123.45.67.89";
$config["port"] = 10011;
$config["user"] = "serveradmin";
$config["pass"] = "insertpwdhere";

Password is correct, tried host with IP AND Domain AND localhost.. nothing is workin. Same error. Queryport is the right one.. I'm using some other plugins on this Port too.

faralsimbor
11-09-2010, 13:03
I have already done it!

My config seems to be correct. Teamspeakserver is running on Root with DNS Sync to Domain.

IP: 123.45.67.89
DNS should work.. can connect to my Teamspeakserver via domain.tld or the IP..

My Config looks like this:
$config["host"] = "123.45.67.89";
$config["port"] = 10011;
$config["user"] = "serveradmin";
$config["pass"] = "insertpwdhere";

Password is correct, tried host with IP AND Domain AND localhost.. nothing is workin. Same error. Queryport is the right one.. I'm using some other plugins on this Port too.

Do you've open port 10011 in your firewall config?

RefleX-mrl
11-09-2010, 23:21
@faralsimbor: Yepp!

bad_dud
12-09-2010, 03:15
I have already done it!

My config seems to be correct. Teamspeakserver is running on Root with DNS Sync to Domain.

IP: 123.45.67.89
DNS should work.. can connect to my Teamspeakserver via domain.tld or the IP..

My Config looks like this:
$config["host"] = "123.45.67.89";
$config["port"] = 10011;
$config["user"] = "serveradmin";
$config["pass"] = "insertpwdhere";

Password is correct, tried host with IP AND Domain AND localhost.. nothing is workin. Same error. Queryport is the right one.. I'm using some other plugins on this Port too.

When you try to test it is the url http://yourwebsite.com/ts3phpframe/examples pointing to you web server and you have the ts3phpframe/examples folders in your document root of your http server?

RefleX-mrl
12-09-2010, 17:27
correct! The files are located in /var/www/ts3phpframe/examples/
As I said: The index is shown up correct. Only the Functions are not working because I get the error.

Clone1B
16-09-2010, 02:50
I can't seem to get the custominfo working with the tokenCreate() function.

My function is:

tokenCreate(TeamSpeak3::TOKEN_SERVERGROUP,12,0,"Auth Token","ident=name value=Testing")

Am I doing something wrong here?

ScP
16-09-2010, 07:39
I think what you did is correct. Please note that the client does NOT show the custom properties of the token. Instead the ident => value pairs will be PERMANENTLY bound to a client in the database (the person who uses the token) and you can query them later using the customsearch and custominfo commands.

This feature is intended to be used when implementing TS3's auth system into an external login script (e.g. what you're trying to do with the EVE API).

faralsimbor
16-09-2010, 16:22
I can't seem to get the custominfo working with the tokenCreate() function.

My function is:

tokenCreate(TeamSpeak3::TOKEN_SERVERGROUP,12,0,"Auth Token","ident=name value=Testing")

Am I doing something wrong here?

Try it with TeamSpeak3_Helper_String instead of plain strings

ScP
16-09-2010, 19:49
Try it with TeamSpeak3_Helper_String instead of plain stringsThat shouldn't make any difference...

Clone1B
16-09-2010, 21:35
I think what you did is correct. Please note that the client does NOT show the custom properties of the token. Instead the ident => value pairs will be PERMANENTLY bound to a client in the database (the person who uses the token) and you can query them later using the customsearch and custominfo commands.

This feature is intended to be used when implementing TS3's auth system into an external login script (e.g. what you're trying to do with the EVE API).

What I ment was, when I run this command it dosn't error, but when trying to search for someone using the custom info a non-found error is returned.

ScP
19-09-2010, 15:35
The new version is now available for download. Here's the changelog:


=== Release 1.0.33-beta - 19 Sep 2010 ===
! upgrading your servers to 3.0.0-beta29 (build >= 12327) is mandatory
! example pages will no longer support outdated Internet Explorer versions
so please be sure to use a modern browser
+ added TeamSpeak3_Node_Server::permReset()
- fixed "convert error" issues when using a TeamSpeak3_Node_Abstract object
as command parameter
* TeamSpeak3_Node_Client::getIcon() now respects client_flag_talking again
* TeamSpeak3_Viewer_Html interface now supports client country flags

=== Release 1.0.32-beta - 25 Aug 2010 ===
+ added TeamSpeak3_Helper_String::isInt()
+ added TeamSpeak3_Node_Host::setLoadClientlistFirst()
* TCP/UDP streams will by default be opened in blocking mode
* factory URI now accepts all flags as options thus supporting multiple flags
at once including both TeamSpeak 3 Client display modes for viewer scripts
- fixed invalid usage of parameter for blocking/non-blocking mode on a stream
- fixed invalid conversion of float values while parsing ServerQuery replies
* internal release onlyHappy testing!

;)

floeH
19-09-2010, 18:49
Hi!

The Download links to TS3_PHP_Framework-1.0.31b.zip. Not 1.0.33 :(

ScP
19-09-2010, 21:46
Hi!

The Download links to TS3_PHP_Framework-1.0.31b.zip. Not 1.0.33 :(Fixed. Thanks for the hint...

:D

floeH
19-09-2010, 22:18
Thanks for fixing. Great improvements and nice new features!
Still in love with this framework!

But since some days I could not create tokens. There is always a exception "invalid parameter". But when I compare the command with an other webinterface there is no difference (same selected vserver). Is there any change that I have overslept? :/

ScP
19-09-2010, 23:15
But since some days I could not create tokens. There is always a exception "invalid parameter". But when I compare the command with an other webinterface there is no difference (same selected vserver). Is there any change that I have overslept? :/I don't know, but I wanted to re-test the token stuff anyway since Clone1B reported a problem with the customset parameter. If there's an issue I'll fix it asap.

:rolleyes:

Thank you for your feedback!

faralsimbor
21-09-2010, 16:47
Hey ScP,

I've tested the non-blocking mode, but i don't understand why your readline() function appears to run in blocking mode allways?

e.g.
if i connect your factory in non-blocking mode i except that getTransport()->readline() returns immediatly after call if no data available on the stream. But your function waits for incomming data.

ScP
21-09-2010, 20:05
Hey ScP,

I've tested the non-blocking mode, but i don't understand why your readline() function appears to run in blocking mode allways?

e.g.
if i connect your factory in non-blocking mode i except that getTransport()->readline() returns immediatly after call if no data available on the stream. But your function waits for incomming data.Sounds reasonable... but the reason I solved the existing non-blocking mode issue like this is that I'm going to implement another event based ServerQuery adapter class that will also deal with the notification messages sent by the server. The current ServerQuery adapter simply ignores those messages.

;)

I'm currently in the process of implementing signal slots so you'll be able to register for various events (i.e. QUERY_CONNECTED, QUERY_DISCONNECTED, ...) so you can extend the functionality of the libraries without changing the code.

CaMeLiRiS
24-09-2010, 15:44
hi ,


sory for my bad english ..

I'll try to display on the a:hover , the client avatar .. , but it only display the name of the client avatar


$detail .= "Pseudo: " . $node["client_nickname"] . " | Version: " . $node["client_flag_avatar"] . " | Platform: " . $node["client_platform"].


how can i do to display the client flag avatar please ?

ScP
24-09-2010, 17:28
I think you're on the wrong side of the road buddy...

The property called client_flag_avatar only contains the filename of the clients avatar on the server and has no value when no avatar is set.
You cannot display images using the HTML title attribute.
You'll need to download the image through a file transfer connection. Please check the example pages as they contain the code snippets to do this. Also, you need to use a different type of tooltip that can display images.

faralsimbor
27-09-2010, 18:14
Is there an easy way to get the effective client rights ?

ScP
27-09-2010, 21:21
Is there an easy way to get the effective client rights ?Yes. To get a list of your own permissions, simply execute the TeamSpeak3_Node_Server::selfPermOverview() method.

faralsimbor
27-09-2010, 21:57
Yes. To get a list of your own permissions, simply execute the TeamSpeak3_Node_Server::selfPermOverview() method.

yea, but how do i call this within TeamSpeak3_Node_Client ?

found.

TeamSpeak3_Node_Client:: permOverview()

ScP
29-09-2010, 16:35
The new version 1.0.34-beta is available for download. Get it while it's hot!

:rolleyes:

Here's the changelog:


=== Release 1.0.34-beta - 29 Sep 2010 ===
! upgrading your servers to 3.0.0-beta29 (build >= 12463) is mandatory
+ added constants for different codec encryption modes
+ added TeamSpeak3_Helper_Signal
+ added TeamSpeak3_Helper_Signal_Handler
+ added TeamSpeak3_Adapter_ServerQuery_Event
+ added TeamSpeak3_Adapter_ServerQuery_Reply::getCommandSt ring()
+ added TeamSpeak3_Adapter_ServerQuery_Reply::getNotifyEve nts()
+ added TeamSpeak3_Adapter_ServerQuery::wait()
+ added TeamSpeak3_Adapter_ServerQuery::getQueryLastTimest amp()
+ added TeamSpeak3_Node_Server::privilegeKeyList()
+ added TeamSpeak3_Node_Server::privilegeKeyCreate()
+ added TeamSpeak3_Node_Server::privilegeKeyDelete()
+ added TeamSpeak3_Node_Server::privilegeKeyUse()
+ added simple console client script to example pages
! all libraries will now emit signals that you can subscribe to which allows
you to extend the core functionality of the framework with your own code
- fixed regular expressions in TeamSpeak3_Helper_String filter methods
* TeamSpeak3_Node_Host::serverSelect() will not select a virtual server that
is already selected
* new ServerQuery greeting message will now be filtered out of all replies
sent by the server
* TeamSpeak3_Transport_Abstract::getConfig() now accepts a parameter to get
the value of a specified config setting directlyHappy testing!

faralsimbor
02-10-2010, 14:54
The new version 1.0.34-beta is available for download. Get it while it's hot!

:rolleyes:


Your new version works fine for me, even with TeamSpeak3_Helper_Signal.

Is there an signal available that notifys for client_away, client_input_muted, client_output_muted, client_servergroups and client_is_recording changes?

Is it possible to trigger the events notifyCliententerview and notifyClientleftview only once, if i register to server and channel events, or is there a way to make a difference between notifyClient*view (server) and notifyClient*view (channel) notifys?

ScP
02-10-2010, 16:12
Is there an signal available that notifys for client_away, client_input_muted, client_output_muted, client_servergroups and client_is_recording changes?

Is it possible to trigger the events notifyCliententerview and notifyClientleftview only once, if i register to server and channel events, or is there a way to make a difference between notifyClient*view (server) and notifyClient*view (channel) notifys?These are known limitations of the TeamSpeak 3 Server as the ServerQuery does not provide all the events known from the SDKs. All notify* signals are triggered when the ServerQuery interface spits out a notification message so you can only work with the existing server features.

I'm aware that the notifycliententerview and notifyclientleftview signals will be triggered twice when you're subscribed to server and channel events - once when a client is disconnecting AND once when he's disconnecting from your current channel. I've discussed this issue with the dev team and I think a fix has been added to their TODO list but it's not a high priority issue.

Thank you for your feedback.

:)

Clone1B
05-10-2010, 01:22
Any luck getting the custom info to work on the token creation?

ScP
05-10-2010, 21:53
I've just released version 1.0.35-beta which should resolve your problem. Here's the changelog:


=== Release 1.0.35-beta - 05 Oct 2010 ===
- fixed invalid method name in TeamSpeak3_Node_Server::privilegeKeyCreate()
- fixed invalid method name in TeamSpeak3_Node_Server::customSearch()
- fixed invalid method name in TeamSpeak3_Node_Server::customInfo()
- fixed several small issuesIn addition you had a small syntax error in the tokencustomset param value. Here's the correct syntax:


$server->privilegeKeyCreate(TeamSpeak3::TOKEN_SERVERGROUP, 123, 0, "test token", "ident=firstname value=Sven|ident=lastname value=Paulsen");As always... Happy testing!

;)

Burnjack
05-10-2010, 22:03
how am i able to sort the output of the serverlist by udp port instead of the virtualserver id?

PV-Patrick
06-10-2010, 06:12
Any word on when the documentation will be updated? Looking through the library files is quite tedious.... unless I am missing something?

ScP
08-10-2010, 13:28
Any word on when the documentation will be updated? Looking through the library files is quite tedious.... unless I am missing something?I've just updated the online documentation to the latest release version. I also decided to switch from phpDocumentor to Doxygen. The key reason for this is that most of the phpDocumentor templates are really buggy and built on crappy HTML code. The old documentation was based on a custom template that looked pretty nice, but took me hours to fix and since it was packed with JavaScript, you could only read it online.

Doxygen provides a much better interface and generates clean output in several different formats. I'll include an offline documentation with the next release of the framework.

Version 1.0.36-beta is out now! Here's the list of changes:


=== Release 1.0.36-beta - 11 Oct 2010 ===
! upgrading your servers to 3.0.0-beta30 (build >= 12559) is mandatory
! converted online and offline docs to Doxygen 1.7.1
- fixed a possible timeout issue with 3.0.0-beta30-pre servers
- added missing comments for some undocumented class members
+ added TeamSpeak3_Node_Host::serverSelectedPort()
* TeamSpeak3_Node_Host::serverSelectByPort() will not select a virtual server
that is already selectedAs you will se the most things I've changed are related to the documentation...

Happy testing!

:)

... and here's version 1.0.37-beta just one day later!


=== Release 1.0.37-beta - 12 Oct 2010 ===
- fixed broken TeamSpeak3_Node_Host::serverGetByPort() method
* hotfix releaseThanks for reporting this issue...

:rolleyes:

Dacen
13-10-2010, 11:38
Dieses Aufruf


$sServerQuery = "serverquery://xxx:[email protected]:10011/?server_port=9987&timeout=1"
$TS3Server = TeamSpeak3::factory( $sServerQuery );


verursacht ein Warning und meldet dann "invalid server id"

Warning: Missing argument 1 for TeamSpeak3_Node_Host::serverSelectById(), called in ../Node/Host.php on line 244 and defined in ../Node/Host.php


Dieses funktioniert hingegen


$sServerQuery = "serverquery://xxx:[email protected]:10011/
$TS3Host = TeamSpeak3::factory( $sServerQuery );
$TS3Server = $TS3Host->serverGetById( $TS3Host->serverIdGetByPort( 9987 ) );


Alles mit 1.0.37-beta. Mit 1.0.36-beta kam das Warning nicht. Ansonsten alles gleich. Mit 1.0.22-beta oder so hat das oben aber funktioniert.

ScP
13-10-2010, 12:02
I just noticed that my fix with 1.0.37-beta made things worse... Seems like copy & paste is pretty bad...

Search this line in the Host.php file:


return new TeamSpeak3_Node_Server($this, array("virtualserver_id" => $this->serverSelectById()));Replace it with this line:


return new TeamSpeak3_Node_Server($this, array("virtualserver_id" => $this->serverSelectedId()));This should fix the issue.

faralsimbor
13-10-2010, 14:02
Hey ScP,

i think you've an error in your 1.0.37b release. Every time i try to connect i'll get the following php error

[PHP Error] Missing argument 1 for TeamSpeak3_Node_Host::serverSelectById(), called in /ts3phpbot-source/trunk/class/TeamSpeak3/Node/Host.php on line 244 and defined [f:/class/TeamSpeak3/Node/Host.php] [l:152]

The 1.0.35b release works fine.

Dacen
13-10-2010, 17:53
The previous post solved that issue

ScP
13-10-2010, 18:55
I've reverted the changes to that broken method and just uploaded the new 1.0.38-beta release. My apologies for any inconvenience.

http://www.planetteamspeak.com/component/option,com_docman/task,doc_details/Itemid,69/gid,105/

:o

Dacen
14-10-2010, 18:47
Hi ScP,

i got a feature request.

If one would develop a php script using your awesome TS3PHP Framework under nowadays certain usability standards (eg. ajax request and stuff), one would want to use some king of persitent connection.
After this small introduction let me get to the point: Would it be possible to modifiy and restructure the Framework to a certain degree to be able to serialize and unserialize for session persistence it?

The situation at the moment is the following, that I can not save an object of the TeamSpeak3_Node_Host in the current session, because some classes are dynamically loaded (Teamspeak3::loadClass does it, doesn't it?) and so I get of course a number of __PHP_Incomplete_Class_Name-Errors.

I don't know if this would really result in a persistent connection, but i think maybe you have more experience with PHP to come up with a definitive answer. If it works, it would reduce the load for a Teamspeak3-Server regarding serverquerys, because the number of login query would be minimized. I know that this is only a very small portion of traffic in comparison to an audio stream.

Greets
Dacen

ScP
19-10-2010, 23:43
You'll be pleased to hear that I've just implemented PHP's magic __sleep() and __wakeup() methods into several classes of the framework which makes it possible to store a serialized node object into a persistent session variable. This does not mean that the connection is really persistent but, when the object is unserialized from the session variable, the underlying adapter class will automatically connect, login and re-select the previously selected virtual server again.

;)

The next public release will be 1.1.0-beta. I'm currently replacing the example pages with several useful example applications such as a lightweight web administration interface and a simple file browser utility.

What do you think?

faralsimbor
21-10-2010, 00:55
How can i access the client node parameter "client_country" ?
$clientNode["client_country"] allways returns NULL in version 1.0.35b

btw. i think you've an an error in 1.35b in your TeamSpeak3.php line 278ff you've wrote



/* flag to hide ServerQuery clients */
if($uri->getFragment() == "no_query_clients")
{
$node->setExcludeQueryClients(TRUE);
}
elseif($uri->hasQueryVar("no_query_clients"))
{
$node->setUseOfflineAsVirtual($uri->getQueryVar("no_query_clients") ? TRUE : FALSE);
}


did you mean ?



/* flag to hide ServerQuery clients */
if($uri->getFragment() == "no_query_clients")
{
$node->setExcludeQueryClients(TRUE);
}
elseif($uri->hasQueryVar("no_query_clients"))
{
$node->setExcludeQueryClients($uri->getQueryVar("no_query_clients") ? TRUE : FALSE);
}

ScP
21-10-2010, 02:45
Good catch. Fixed with 1.1.0-dev...

Dacen
21-10-2010, 15:08
Nice one.

Will check it out later today.

edit: or more eactly, when you're done wit 1.1.0-beta :).

ScP
21-10-2010, 19:26
I can send you a preview version of the libs if you'd like to test the new version asap. As I already stated I'm currently working on the new example apps. I've attached an early screenshot of the webinterface after ~2.5 hours of development...

Please note that all example applications will not be full featured as they're only examples. So don't expect me to include a 1337 h4x0r app with the new examples. The webinterface will be able to manage virtual servers (start, stop, create, modify, delete and export) and show the logs of your server instance. That's all.

:rolleyes:

Dacen
22-10-2010, 10:10
Check your mail. I think neither me or the project I am working on is suited to be any help to you.

But thanks anyway :D

SmokinShark
22-10-2010, 10:16
I like the Look of this WebInterface. :D

faralsimbor
24-10-2010, 20:37
Hey Scp How can i decode chars like "¿" or "•" from Teamspeak3_Helper_String ?
neither base64_decode nor utf8_decode seems to work.

gnugeek
26-10-2010, 13:10
Hi:
How about some zend framework support?, im trying to use your ts3 classes but i get a :
My code:

$test = new TeamSpeak3_TeamSpeak3();
$ts3_ServerInstance = $test::factory("serverquery://user:pass@host:port/?nickname=Hello");


My error:

Application error
Exception information:

Message: adapter 'serverquery' does not exist


Its probably a conflict with Zend framework since class its already loaded

Teris Cooper
26-10-2010, 20:37
Hi:
How about some zend framework support?, im trying to use your ts3 classes but i get a :
My code:

$test = new TeamSpeak3_TeamSpeak3();
$ts3_ServerInstance = $test::factory("serverquery://user:pass@host:port/?nickname=Hello");


My error:

Application error
Exception information:

Message: adapter 'serverquery' does not exist


Its probably a conflict with Zend framework since class its already loaded

$test = new TeamSpeak3_TeamSpeak3();
$ts3_ServerInstance = $test->factory("serverquery://user:Pass@host:Port/?nickname=Hello");

ScP
26-10-2010, 22:21
$test = new TeamSpeak3_TeamSpeak3();
$ts3_ServerInstance = $test->factory("serverquery://user:Pass@host:Port/?nickname=Hello");You're both wrong. There is no class called TeamSpeak3_TeamSpeak3 and factory() is a static method. So the correct code would be:


$ts3_ServerInstance = TeamSpeak3::factory("serverquery://user:pass@host:port/?nickname=Hello");The framework is 100% compatible with the Zend Framework.

gnugeek
27-10-2010, 18:07
I have the class in library/Teamspeak3/Teamspeak3.php

Since im autoloading classes thats why i have to write Teamspeak3_Teamspeak3 to refer to Teamspeak3/Teamspeak3.php file

$test = new TeamSpeak3_TeamSpeak3();

test is just an instance of the class.

I also renamed the main class to:

class TeamSpeak3_TeamSpeak3

to make autoload work

Btw calling

$ts3_ServerInstance = TeamSpeak3_Teamspeak3::factory("serverquery://user:pass@host:port/?nickname=Hello");

Still gives me same error

Im sure im doing something wrong

ScP
27-10-2010, 22:51
I understand what you're trying to do but thats still nonsense. If you rename the class you break its functionality. The framework comes with its own autoload implementation and you should use it. This is what I usually do in my bootstrapper files:


/* overwrite default include paths */
set_include_path(PATH_TO_YOUR_LIBS . PATH_SEPARATOR . get_include_path());

/* load Zend Framework files */
require_once("Zend/Exception.php");
require_once("Zend/Loader/Autoloader.php");

/* load third party libs */
require_once("TeamSpeak3/TeamSpeak3.php");

/* enable Zend_Loader_Autoloader */
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(TRUE);

gnugeek
28-10-2010, 01:05
Adding:

/* load third party libs */
require_once("TeamSpeak3/TeamSpeak3.php");

To my bootstrap made the trick. Thx a lot!

My Bootstrap:


class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initAutoload()
{



$moduleLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH));
$autoLoader = Zend_Loader_Autoloader::getInstance();
$autoLoader->setFallbackAutoloader(true);
/* load third party libs */
require_once("TeamSpeak3/TeamSpeak3.php");
return $moduleLoader;

}
protected function _initAppAutoload()
{
$autoloader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'App',
'basePath' => dirname(__FILE__),
));
return $autoloader;

}

michixxx93
30-10-2010, 18:37
I have the following problem:
If the Server traffic is higher than 2.00 GB my script always returns 2.00 GB.


foreach($ts3_ServerInstance->getInfo(TRUE,TRUE) as $ident => $value)
{
if($ident == "connection_bytes_sent_total")
{
$gesendet = $value;
}
}
.......
echo "Traffic out: ".$gesendet;

With getInfo(TRUE,FALSE) var_dump($gesendet) returns int(2147483647).
It's the same with


$info = $server->getInfo(true,false);
var_dump($info["connection_bytes_sent_total"]); // int(2147483647)

ScP
31-10-2010, 00:06
If the Server traffic is higher than 2.00 GB my script always returns 2.00 GB.I've already discovered this issue on 32-bit systems and fixed it with 1.1.0-dev. Here's the TeamSpeak3_Helper_String class that resolves the issue:

http://pastebin.planetteamspeak.com/pastebin.php?show=375

michixxx93
31-10-2010, 13:26
I've already discovered this issue on 32-bit systems and fixed it with 1.1.0-dev. Here's the TeamSpeak3_Helper_String class that resolves the issue:

http://pastebin.planetteamspeak.com/pastebin.php?show=375

Thanks, now it works perfectly :)

james grimes
31-10-2010, 15:47
will their ever be a joomla module for TS3 ??

if so when might it appear on site?

ScP
31-10-2010, 19:51
will their ever be a joomla module for TS3 ??

if so when might it appear on site?There's one on our addons page but I've not tested it...

http://addons.teamspeak.com/directory/search/joomla.html

But back to topic... Here's what I changed with 1.1.0-dev so far:


=== Release 1.1.0-beta - ?? Nov 2010 ===
! example pages have been replaced with useful example applications
! implemented __sleep() and __wakeup() methods for TeamSpeak3_Node_Abstract
objects which makes it possible to serialize and store them into persistent
session values
+ added constants for different group name display modes
+ added TeamSpeak3_Helper_Crypt
+ added TeamSpeak3_Exception::prepareCustomMessage()
* custom messages set with TeamSpeak3_Exception::registerCustomMessage() can
now be customized with pre-defined signs %code, %mesg, $file and %line to
provide greater flexibility
+ added TeamSpeak3_Helper_Uri::getUserParam()
+ added TeamSpeak3_Helper_Uri::getHostParam()
+ added TeamSpeak3_Helper_Uri::getSessParam()
+ added TeamSpeak3_Helper_Uri::getHostUri()
+ added TeamSpeak3_Helper_Uri::getBaseUri()
+ added TeamSpeak3_Helper_Uri::stripslashesRecursive()
+ added TeamSpeak3_Adapter_Abstract::syn()
+ added TeamSpeak3_Helper_String::spaceToPercent()
+ added TeamSpeak3_Node_Server::sortGroupList()
* TeamSpeak3_Node_Server::serverGroupList() now respects i_group_sort_id
* TeamSpeak3_Node_Server::channelGroupList() now respects i_group_sort_id
- fixed issue in TeamSpeak3_Helper_String::toInt() where integer overflow did
not cast as floatFor now, I've added the following example apps:


webinterface
tsviewer
filebrowser

I'd appreciate your feedback!

:)

Dacen
01-11-2010, 07:16
on the image attached to the last post its says "Your has been benned" ....

"that's wrong"

:)

otherwise nothing to complain about so far

ScP
01-11-2010, 12:32
on the image attached to the last post its says "Your has been benned" ....Good catch mate!

:)

floeH
15-11-2010, 15:28
Hi!

ScP, is it possible to select vservers who are not running? I always get an exception :( Other webinterfaces can select/edit the server although it is offline.

factory:
TeamSpeak3::factory("serverquery://serveradmin:[email protected]:10011/?server_port=9988#no_query_clients");

exception:
Message: server is not running
Class: TeamSpeak3_Adapter_ServerQuery_Exception
File: ...\lib\vendor\teamspeak3\Adapter\ServerQuery\Repl y.php
Line: 296
Code: 1033
Trace:
#0 ...\lib\vendor\teamspeak3\Adapter\ServerQuery\Repl y.php(82): TeamSpeak3_Adapter_ServerQuery_Reply->fetchError(Object(TeamSpeak3_Helper_String))
#1 ...\lib\vendor\teamspeak3\Adapter\ServerQuery.php( 140): TeamSpeak3_Adapter_ServerQuery_Reply->__construct(Array, 'use port=9988', Object(TeamSpeak3_Node_Host))
#2 ...\lib\vendor\teamspeak3\Node\Abstract.php(67): TeamSpeak3_Adapter_ServerQuery->request('use port=9988')
#3 ...\lib\vendor\teamspeak3\Node\Abstract.php(91): TeamSpeak3_Node_Abstract->request('use port=9988')
#4 ...\lib\vendor\teamspeak3\Node\Host.php(170): TeamSpeak3_Node_Abstract->execute('use', Array)
#5 ...\lib\vendor\teamspeak3\Node\Host.php(242): TeamSpeak3_Node_Host->serverSelectByPort(9988)
#6 ...\lib\vendor\teamspeak3\TeamSpeak3.php(298): TeamSpeak3_Node_Host->serverGetByPort(9988)
#7 ...\apps\frontend\modules\teamspeak\actions\action s.class.php(608): TeamSpeak3::factory('serverquery://s...')
#8 ...\apps\frontend\modules\teamspeak\actions\action s.class.php(143): customerTeamspeakActions->getTeamspeakInstance(1, 2)
......

Ok, reading educates :) Im sorry.
Now im using "use_offline_as_virtual" and it works fine!


/**
* Factory for TeamSpeak3_Adapter_Abstract classes. $uri must be formatted as
* "<adapter>://<user>:<pass>@<host>:<port>/<options>#<flags>". All parameters
* except adapter, host and port are optional.
*
* === Supported Options ===
* - timeout
* - blocking
* - nickname
* - no_query_clients
* - use_offline_as_virtual
* - clients_before_channels
* - server_id|server_uid|server_port|server_name
* - channel_id|channel_name
* - client_id|client_uid|client_name
*
* === Fupported Flags (only one per $uri) ===
* - no_query_clients
* - use_offline_as_virtual
* - clients_before_channels
*
* === URI Examples ===
* - serverquery://127.0.0.1:10011/
* - serverquery://127.0.0.1:10011/?server_port=9987&channel_id=1
* - filetransfer://127.0.0.1:30011/
* - blacklist
* - update
*
* @param string $uri
* @return TeamSpeak3_Adapter_Abstract
* @return TeamSpeak3_Node_Abstract
*/

ScP
15-11-2010, 17:27
Here's a little changelog update:


=== Release 1.1.0-beta - ?? Nov 2010 ===
! upgrading your servers to 3.0.0-beta30 (build >= 12910) is mandatory
! example pages have been replaced with useful example applications
! implemented __sleep() and __wakeup() methods for TeamSpeak3_Node_Abstract
objects which makes it possible to serialize and store them into persistent
session values
+ added constants for different group name display modes
+ added TeamSpeak3_Helper_Crypt
+ added TeamSpeak3_Exception::prepareCustomMessage()
* custom messages set with TeamSpeak3_Exception::registerCustomMessage() can
now be customized with pre-defined signs %code, %mesg, $file and %line to
provide greater flexibility
+ added TeamSpeak3_Helper_Uri::getUserParam()
+ added TeamSpeak3_Helper_Uri::getHostParam()
+ added TeamSpeak3_Helper_Uri::getSessParam()
+ added TeamSpeak3_Helper_Uri::getHostUri()
+ added TeamSpeak3_Helper_Uri::getBaseUri()
+ added TeamSpeak3_Helper_Uri::stripslashesRecursive()
+ added TeamSpeak3_Adapter_Abstract::syn()
+ added TeamSpeak3_Helper_String::spaceToPercent()
+ added TeamSpeak3_Node_Servergroup::privilegeKeyCreate()
+ added TeamSpeak3_Node_Servergroup::tokenCreate()
+ added TeamSpeak3_Node_Channelgroup::privilegeKeyCreate()
+ added TeamSpeak3_Node_Channelgroup::tokenCreate()
+ added TeamSpeak3_Node_Server::sortGroupList()
+ added TeamSpeak3_Node_Host::selfPermCheck()
* TeamSpeak3_Node_Server::serverGroupList() now respects i_group_sort_id
* TeamSpeak3_Node_Server::channelGroupList() now respects i_group_sort_id
* TeamSpeak3_Node_Server::privilegeKeyList() now supports optional resolve
parameter to translate token_id1 and token_id2 into the appropriate group
and/or channel names
- fixed issue in TeamSpeak3_Helper_String::toInt() where integer overflow
did not cast as float:)

faralsimbor
16-11-2010, 15:06
Hey ScP,

If i use your example TS3 Viewer script i'm sometimes missing the custom icons.

Is it because i've put the $TS3VirtualServer->getViewer(new TeamSpeak3_Viewer_Html()) output into shared memory ?

ScP
16-11-2010, 15:57
What do you mean by shared memory? The example is downloading the icons on each request and does not cache anything. If you're trying to cache the output of that example page, the custom icon download will not work as the file transfer keys initially generated by the server will no longer be valid.

faralsimbor
16-11-2010, 16:45
What do you mean by shared memory? The example is downloading the icons on each request and does not cache anything. If you're trying to cache the output of that example page, the custom icon download will not work as the file transfer keys initially generated by the server will no longer be valid.

my code looks like:

master proccess:


private static function write_shm($port, $id, $array) {
$shmHeaderSize = (PHP_INT_SIZE * 4) + 8;
$shmVarSize = (((strlen(serialize($array))+ (4 * PHP_INT_SIZE)) /4 ) * 4 ) + 4;
$memsize = ($shmHeaderSize + $shmVarSize) * 2;
$data = shm_attach($port, $memsize);
shm_put_var($data, $id, $array);
shm_detach($data);
}

public function execute(TeamSpeak3_Node_Host $TS3ServerInstance, TeamSpeak3_Node_Server $TS3VirtualServer, $featureConfig, $daemonConfig, $invokerID = NULL, $event = NULL) {
$dataArray = array('server' => array('name' => $TS3VirtualServer->toString(),
'maxClients' => $TS3VirtualServer['virtualserver_maxclients'],
'clientsOnline' => $TS3VirtualServer['virtualserver_clientsonline'],
'channelsOnline' => $TS3VirtualServer['virtualserver_channelsonline'],
'queryClientsOnline' => $TS3VirtualServer['virtualserver_queryclientsonline'],
),
'data' => $TS3VirtualServer->getViewer(new TeamSpeak3_Viewer_Html($featureConfig[self::getConfigSectionName()]['iconPath'], $featureConfig[self::getConfigSectionName()]['flagPath'], $featureConfig[self::getConfigSectionName()]['file_transfer_script'])),
);
self::write_shm($featureConfig['BOT-CONFIG']['port'], 1, $dataArray);
}


slave proccess:


/* configurable options */
$port = 9987;
/* end configurable options */

$data = @shm_attach($port);
$tmp = @shm_get_var($data, 1);
shm_detach($data);
if ($tmp['server']['name'] != '') {
echo "<h1>Virtual Server Viewer - " . $tmp['server']['name'] . "</h1>\n";
echo utf8_decode($tmp['data']);
} else {
echo "<font color='ff0000;'><b>TS3PHPBot at port " . $port . " seems to be offline</b></font>";
}


filetransfer script:


/* configurable options */
$botDirectory = '/opt/ts3phpbot/trunk';
/* end configurable options */

function get_param($key, $default = null) {
return (array_key_exists($key, $_GET) && !empty($_GET[$key])) ? preg_replace("/[^[:graph:]]/", "", $_GET[$key]) : $default;
}

if (substr($botDirectory, strlen($botDirectory), 1) != DIRECTORY_SEPARATOR) {
$botDirectory .= DIRECTORY_SEPARATOR;
}

require_once($botDirectory . "class/TeamSpeak3/TeamSpeak3.php");

$data = get_param("data");

try {
TeamSpeak3::init();

if(!$data = @unserialize(base64_decode($data))) {
throw new Exception("unable to decode file transfer data");
}

$transfer = TeamSpeak3::factory("filetransfer://" . $data["host"] . ":" . $data["port"]);

echo $transfer->download($data["ftkey"], $data["size"]);
}
catch(Exception $e) {
echo file_get_contents("images/icons/group_icon_0.png");
}

ScP
18-11-2010, 12:12
I've never used PHP's shared memory functions so I have no idea how they work. Please explain shortly what you intend to do.

Version 1.1.1-beta is available. Here's the changelog:


=== Release 1.1.1-beta - 28 Nov 2010 ===
! upgrading your servers to 3.0.0-beta30 (build >= 12910) is mandatory
! example pages have been extended with useful example applications
! implemented __sleep() and __wakeup() methods for TeamSpeak3_Node_Abstract
objects which makes it possible to serialize and store them into persistent
session values
! TeamSpeak3_Viewer_Html interface now returns HTML tables instead of div
elements so please make sure that your existing CSS files get updated too
* updated TeamSpeak3_Viewer_Text and TeamSpeak3_Viewer_Html classes with new
customizable output patterns to provide greater flexibility
* changed visibility of all private class methods and properties to protected
to allow modifications through inherited classes
+ added constants for different group name display modes
+ added TeamSpeak3_Helper_Crypt
+ added TeamSpeak3_Exception::prepareCustomMessage()
* custom messages set with TeamSpeak3_Exception::registerCustomMessage() can
now be customized with pre-defined signs %code, %mesg, $file and %line to
provide greater flexibility
* class properties returned by TeamSpeak3_Node_Abstract::getClass() now
respect channel spacers and ServerQuery clients
+ added TeamSpeak3_Helper_Uri::getUserParam()
+ added TeamSpeak3_Helper_Uri::getHostParam()
+ added TeamSpeak3_Helper_Uri::getSessParam()
+ added TeamSpeak3_Helper_Uri::getHostUri()
+ added TeamSpeak3_Helper_Uri::getBaseUri()
+ added TeamSpeak3_Helper_Uri::stripslashesRecursive()
+ added TeamSpeak3_Adapter_Abstract::syn()
+ added TeamSpeak3_Helper_String::spaceToPercent()
+ added TeamSpeak3_Node_Servergroup::privilegeKeyCreate()
+ added TeamSpeak3_Node_Servergroup::tokenCreate()
+ added TeamSpeak3_Node_Channelgroup::privilegeKeyCreate()
+ added TeamSpeak3_Node_Channelgroup::tokenCreate()
+ added TeamSpeak3_Node_Server::sortGroupList()
+ added TeamSpeak3_Node_Server::isOnline()
+ added TeamSpeak3_Node_Host::selfPermCheck()
* TeamSpeak3_Node_Server::serverGroupList() now respects i_group_sort_id
* TeamSpeak3_Node_Server::channelGroupList() now respects i_group_sort_id
* TeamSpeak3_Node_Server::privilegeKeyList() now supports optional resolve
parameter to translate token_id1 and token_id2 into the appropriate group
and/or channel names
- fixed issue in TeamSpeak3_Helper_String::toInt() where integer overflow
did not cast as float:)

bad_dud
29-11-2010, 07:23
Thx m8, Have been waiting for the custome exeption messages for a while now. Great job scp keep it up. ;)

ginger|HFD
29-11-2010, 10:37
Thank you! What was your motivation to go away from CSS back to tables?

ScP
29-11-2010, 21:14
Thank you! What was your motivation to go away from CSS back to tables?Two simple reasons:


A table layout is 100% compatible to ALL current browsers since you don't need to float anything around (e.g. to get the right icon alignment).
The table layout is fluid and supports the channel spacers without having to be a CSS guru.

:)

As you'll see the new HTML interface can be fully customized with the new pattern system I've implemented. For example:


<table id='%0' class='%1'><tr class='%2'><td class='%3'>%4</td><td class='%5' title='%6'>%7 %8</td><td class='%9'>%10%11</td></tr></table>The placeholders in this pattern will be replaced with dynamic values in a pre-defined order. So you can also go back to the old <div> tag format if you want.

I've prepared another hotfix release:


=== Release 1.1.2-beta - 03 Dec 2010 ===
+ added TeamSpeak3_Node_Servergroup::copy()
+ added TeamSpeak3_Node_Channelgroup::copy()
- fixed invalid method call in TeamSpeak3_Node_Servergroup::rename()
- fixed invalid method call in TeamSpeak3_Node_Servergroup::delete()
- fixed invalid method call in TeamSpeak3_Node_Channelgroup::rename()
- fixed invalid method call in TeamSpeak3_Node_Channelgroup::delete()
- fixed unnecessary error exception when checking a group with no permissions
assigned in TeamSpeak3_Node_Server::serverGroupGetProfiles()
- fixed invalid $_GET parameter name on clientinfo example page
* hotfix releaseHappy testing!

:)

rufi86
08-12-2010, 09:16
How can i install TeamSpeak Web Control Panel ?

Teris Cooper
08-12-2010, 12:10
You Edit the config.php in Exemples.
Save that
uploade all via FTP on yout webspace und well done!

ScP
08-12-2010, 20:10
Actually, you don't need to edit any config file to use the TeamSpeak Web Control Panel example app, but you need to modify several path variables to make it work on its own. I've attached a stand-alone version of the TeamSpeak Web Control Panel example app including the latest TS3 PHP Framework release.

:)

rufi86
09-12-2010, 07:27
ok i will test it :)

What are the differences between http://www.planetteamspeak.com/component/option, com_docman / task, doc_details / Itemid, 69/gid, 105 /
and your Webinterface?

ScP
10-12-2010, 17:08
All features of the TeamSpeak Web Control Panel example app are the same. The only difference is that the archive I've attached contains a stand-alone version while the other one is wrapped into the TS3 PHP Framework example pages.

rufi86
12-12-2010, 21:14
Do I need to integrate this with a database mysql or on sqllite this can work?


There is no data available for your request.
ERROR 1281: database empty result set


connection to server 'x.x.x.x:10015' lost



2010-12-12 21:17:30.922506|ERROR |Query | | sendErrorAndCloseConnection called with an invalid socketID:9
2010-12-12 21:18:11.076596|ERROR |Query | | onRemoveConnection called with an invalid clientSocketID: 9
2010-12-12 21:18:27.744803|ERROR |Query | | sendErrorAndCloseConnection called with an invalid socketID:10



hmm ?

and after tests ...



|Accounting | | virtualserver started too many times in a certain time period

Whats going on ?

ScP
13-12-2010, 11:53
It doesn't matter which database backend you're using for TeamSpeak 3.


There is no data available for your request.
ERROR 1281: database empty result setThis simply means that there is no data available on the server. In the example app this error occurs when you're trying to load a list of tokens on a virtual server where no tokens are created.


|Accounting | | virtualserver started too many times in a certain time periodIf you start/stop a virtual server too often, the TeamSpeak accounting server will block incoming requests from your server due to a possible flooding attempt. You need to wait for ~10 minutes before this error disappears.

The other error messages can be ignored as they will be removed with the next server release.

rufi86
14-12-2010, 09:24
1. How can I generate a token through the panel and a manager?
2. Can I add a different user than the ServerAdmin through the panel,
to have access to the panel manager ?

ScP
14-12-2010, 11:06
1. How can I generate a token through the panel and a manager?Have you tried clicking the "Create" link?


2. Can I add a different user than the ServerAdmin through the panel, to have access to the panel manager ?Not possible, since not supported by the TS3 server software yet.

rufi86
14-12-2010, 11:10
i cant see nothing about "create token"

ScP
14-12-2010, 11:56
i cant see nothing about "create token"Well... The "Create" link is clearly visible so maybe there's something wrong with your eyes. But if you "cant see nothing" everything should be fine...

:D

rufi86
14-12-2010, 12:06
http://img69.imageshack.us/i/32262877.jpg/
http://img213.imageshack.us/i/46147342.jpg/
http://img703.imageshack.us/i/84412145.jpg/

so where is create token ? :)

ScP
14-12-2010, 14:16
How about selecting a virtual server from the list first?

rufi86
14-12-2010, 21:48
How about selecting a virtual server from the list first?

here you go

http://img576.imageshack.us/i/53092568.jpg/

ScP
15-12-2010, 07:05
here you go

http://img576.imageshack.us/i/53092568.jpg/Let's do this step by step:


Login
Click "Virtual Server Management"
Click "Select" on a virtual server of your choice
Click "Privilege Key List"
Click "Create"

:)

rufi86
15-12-2010, 19:40
Let's do this step by step:


Login
Click "Virtual Server Management"
Click "Select" on a virtual server of your choice
Click "Privilege Key List"
Click "Create"

:)


When im clicking SELECT ...


FATAL ERROR 0

[TCP.php:118] connection to server '188.165.35.210:10015' lost
#0 /home/uu/public_html/lol/lib/TeamSpeak3/Adapter/ServerQuery.php(134): TeamSpeak3_Transport_TCP->readLine()
#1 /home/uu/public_html/lol/lib/TeamSpeak3/Node/Abstract.php(72): TeamSpeak3_Adapter_ServerQuery->request('use sid=3 -virt...')
#2 /home/uu/public_html/lol/lib/TeamSpeak3/Node/Abstract.php(96): TeamSpeak3_Node_Abstract->request('use sid=3 -virt...')
#3 /home/uu/public_html/lol/lib/TeamSpeak3/Node/Host.php(134): TeamSpeak3_Node_Abstract->execute('use', Array)
#4 [internal function]: TeamSpeak3_Node_Host->serverSelect('3')
#5 /home/uu/public_html/lol/lib/TeamSpeak3/Node/Host.php(862): call_user_func_array(Array, Array)
#6 [internal function]: TeamSpeak3_Node_Host->__wakeup()
#7 /home/uu/public_html/lol/lib/module.class.php(144): unserialize('O:20:"TeamSpeak...')
#8 /home/uu/public_html/lol/lib/module.class.php(76): TS3WA_Module->getTS3Connection()
#9 /home/uu/public_html/lol/lib/application.class.php(202): TS3WA_Module->__construct(Object(TS3WA_Application))
#10 /home/uu/public_html/lol/inc/bootstrapper.inc.php(51): TS3WA_Application->run()
#11 /home/u/public_html/lol/index.php(34): require_once('/home/uu/public...')
#12 {main}

ScP
16-12-2010, 06:15
Is your server hosted on a virtual guest OS? Does this happen every time or just randomly? This could be an issue related to the new TCP stack that has been implemented to the server recently. Also please try enabling the "logquerycommands" option while starting the server.

Try updating your server to 3.0.0-beta31-pre and add your webservers IP address to the ServerQuery whitelist.

*** EDIT ***
We've identified the issue and it will be resolved with the upcoming server release (3.0.0-beta31). The problem is caused because you're getting flood banned. Add your webservers IP address to the ServerQuery whitelist.

Teris Cooper
16-12-2010, 09:12
I Have a Problem.

Link: http://games-networks.de/?p=ts3

If you click on The-Fallen-Angeles, then the following error occurs when Webviewer.


Web Viewer

Warning: uasort() [function.uasort]: Array was modified by the user comparison function in D:\inetpub\vhosts\games-networks.de\httpdocs\_tools\libraries\TeamSpeak3\N ode\Server.php on line 1224

ERROR 0x602: invalid parameter

How can I fix it?

My source code is as follows:

<?php
require_once("./_tools/config.php");
require_once("./_tools/globals.php");
require_once("./_tools/libraries/TeamSpeak3/TeamSpeak3.php");
TeamSpeak3::init();
?>

<div class="liste">
<?php
try
{
$ts3_ServerInstance = TeamSpeak3::factory("serverquery://".$cfg["host"][1].":10011/");
$ts3_ServerInstance_2 = TeamSpeak3::factory("serverquery://".$cfg["host"][2].":10011/");
echo "<h3>". $ts3_ServerInstance ."</h3>";
?>
<table class="liste">
<tr>
<th>ID</th>
<th>Name</th>
<th>Online</th>
<th>Port</th>
</tr>
<?php foreach($ts3_ServerInstance as $ts3_VirtualServer)
{ ?>
<tr>
<td><?php echo $ts3_VirtualServer->getId()?></td>
<td><a href="?p=ts3&server=<?php echo $ts3_VirtualServer["virtualserver_port"]?>&host=<?php echo $cfg['host'][1]; ?>" onclick="load3()"><?php echo htmlspecialchars($ts3_VirtualServer) ?></a></td>
<td><?php echo ($ts3_VirtualServer->isOffline() ?"- / -" : $ts3_VirtualServer->clientCount()."/".$ts3_VirtualServer["virtualserver_maxclients"]) ?></td>
<td><?php echo $ts3_VirtualServer["virtualserver_port"] ?></td>
</tr>
<?php } ?>
</table>
<?php
echo "<h3>". $ts3_ServerInstance_2 ."</h3>";
?>
<table class="liste">
<tr>
<th>ID</th>
<th>Name</th>
<th>Online</th>
<th>Port</th>
</tr>
<?php foreach($ts3_ServerInstance_2 as $ts3_VirtualServer)
{ ?>
<tr>
<td><?php echo $ts3_VirtualServer->getId()?></td>
<td><a href="?p=ts3&server=<?php echo $ts3_VirtualServer["virtualserver_port"]?>&host=<?php echo $cfg['host'][2]; ?>" onclick="load3()"><?php echo htmlspecialchars($ts3_VirtualServer) ?></a></td>
<td><?php echo ($ts3_VirtualServer->isOffline() ?"- / -" : $ts3_VirtualServer->clientCount()."/".$ts3_VirtualServer["virtualserver_maxclients"]) ?></td>
<td><?php echo $ts3_VirtualServer["virtualserver_port"] ?></td>
</tr>
<?php } ?>
</table>
<?php
}
catch(Exception $e)
{
echo "<span class='error'><b>Error".$e->getCode().":</b>".$e->getMessage()."</span>";
}
?>
</div>
<?php
if($_GET['server'] != NULL):
?>
<div class='viewer'>
<h3>Web Viewer</h3>
<?php
try
{
$ts3 = TeamSpeak3::factory("serverquery://".$_GET["host"].":10011/?server_port=".$_GET["server"]."#no_query_clients");
$ts3->setLoadClientlistFirst(TRUE);
echo $ts3->getViewer(new TeamSpeak3_Viewer_Html("./_tools/images/viewer/", "./_tools/images/flags/", "./_tools/ts3icon.php"));
}
catch(Exception $e)
{
echo "<p><span class=\"error\"><b>ERROR 0x" . dechex($e->getCode()) . "</b>: " . htmlspecialchars($e->getMessage()) . "</span></p>";
}
endif;
?>
</div>

ScP
16-12-2010, 13:03
Which version of PHP is running on your webserver?

rufi86
16-12-2010, 13:33
PHP Version 5.2.6-1+lenny8

Teris Cooper
19-12-2010, 09:00
Can someone help me? Error 0x602. What exactly is a mistake?

The script does not work on any server with just the one.

Please help thank you again!

Is there possibly a bug list? Where are described all errors sorted by number?

ScP
19-12-2010, 10:37
Which version of PHP is running on your webserver?Answer that question please.

rufi86
19-12-2010, 11:15
Answer that question please.

i wrote ...


PHP Version 5.2.6-1+lenny8

ScP
19-12-2010, 12:47
i wrote ...And I didn't mean you... The answer to your question is here:

http://forum.teamspeak.com/showpost.php?p=267544&postcount=174

So Teris Cooper... Which PHP version do YOU use?

floeH
21-12-2010, 04:55
ScP, is there any service to keep informed for updates? This would be great if there is any rss feed or something else?! So, everybody could get the newest framework without checking the addon page every time.

Thanks for your great work! :)

ScP
21-12-2010, 18:32
ScP, is there any service to keep informed for updates? This would be great if there is any rss feed or something else?! So, everybody could get the newest framework without checking the addon page every time.

Thanks for your great work! :)Good suggestion! I'll think of something.

In addition, I have a little request to the community... I'd really like to know how you guys are using the TS3 PHP Framework. If anyone has created an application or script based on it, I'd like to see the results. I'm even more excited to hear some feedback. Do you think the library is easy to work with? How long did it take to build your app? Are you getting any feedback from your customers/users?

All these infos would help me to improve the TS3 PHP Framework or adding new features.

:)

Oh and btw... Here's my current changelog:


=== Release 1.1.3-beta - ?? Dec 2010 ===
+ added additional debugging signals to both TeamSpeak3_Transport_TCP and
TeamSpeak3_Transport_UDP to indicate whenever data has been sent/received
* TeamSpeak3_Adapter_Update::getRev() now supports an additional channel to
query the latest server revision number from the master server
* TeamSpeak3_Node_Host::version() now supports optional parameter to provide
direct access to specific version information such as platform and build
- fixed an issue where flood ban messages sent by 3.0.0-beta30 servers could
could cause timeout exceptionsThank you!

bad_dud
23-12-2010, 06:06
ScP: Feedback.

Ive made a plugin in for the opensource cms community e107 with your framework.

It was simple to get it up and running with only TS3 viewer but i do not have OO skills in php to understand how to call all nice functions in this framework.
On otherhand i will have to digg into that so i can use more function. :rolleyes:

On frontpage it will show one menu (if it selected from e107 admin) and one link to more info about TS3 server's. It will show more the one virtuell server.

In admin page of this plugin:
This part of the plugin will be developed with more features but for now it handle this.

Outdated client's and the admin is allowed to send a poke message.
Check the server log. the moste importent status has different color.
Check permission. (Based on the example)


The feedback from the e107 community is thx for this plugin ;)
The first version has over 1000 downloads.

I wold like to have an example to custome messages you had put into this framework

I love this pice of art ScP so keep up with our work. I love it it, easy to work with even my low OO skills :D

ScP
23-12-2010, 12:10
I wold like to have an example to custome messages you had put into this framework

Thank you for your great feedback! Here's the example you requested:


TeamSpeak3_Exception::registerCustomMessage(0x208, "You have entered an invalid username or password.");
TeamSpeak3_Exception::registerCustomMessage(0xD01, "Your IP address has been banned. Please add your IP address to the ServerQuery whitelist and ensure that you're using the correct login credentials.");Basically, the first parameter is the error code in decimal or hex format (i.e. 1024 or 0x400). The second parameter is your custom error message which also supports four pre-defined placeholders:


%code
%mesg
%file
%line

So basically when you're writing this...


The TeamSpeak 3 Server reported an error (%code): %mesgIt will be turned into this...


The TeamSpeak 3 Server reported an error (1033): server is not runningAgain... Thank you for your feedback and good luck for your future projects.

:)

bad_dud
25-12-2010, 07:57
Again... Thank you for your feedback and good luck for your future projects.
:)

Merry Christmas to you ScP. Hope that santa was at your home yeasteday :p

Thanks for the example.

Question:
Where can i find all error messages. I would like to have those in a language files that is included in my plugin, so it could be reported with for example my language (Swedish) :D

ScP
25-12-2010, 13:18
Where can i find all error messages. I would like to have those in a language files that is included in my plugin, so it could be reported with for example my language (Swedish) :D

You can find most of the error IDs in the header files of the client or plugin SDK. For example:

%ProgrammFiles%\TeamSpeak 3 Client\pluginsdk\include\public_errors.h

The rest is trial and error.

:)

bad_dud
25-12-2010, 14:22
Thank's,

Have a good time the rest of this christmas :D

Happy New Year.

I have a small issue.
When iam using the new way to handle (try) i get timer is already running in second recursive call when the webpage has few information but if iam go to another page with more information it's ok.

The code for this menu item is. (Normal page view work's ok with this code.)


//Show all server / servers
while(list($key, $ts3_info) = each($pref['ts3']))
{


try
{

$text = "";
$name = $ts3_info['tsw_name'];
$ip = $ts3_info['tsw_ip'];
$port = $ts3_info['tsw_port'];
$qport = $ts3_info['tqw_port'];


// connect via serverquery and get virtual server object
$ts3_VirtualServers = TeamSpeak3::factory("serverquery://".$ip.":".$qport."/?server_port=".$port."#no_query_clients");
$text = "<table align='center> class='fborder'><tr><td align='center'>";

if ($ts3_VirtualServers["virtualserver_hostbanner_url"] != "")
{
$text .= "<a href='".$ts3_VirtualServers["virtualserver_hostbanner_url"]."' target='_blank'><img src='".$ts3_VirtualServers["virtualserver_hostbanner_gfx_url"]."' width='150' higth='10' align='middle' alt='".$ts3_VirtualServers["virtualserver_hostbanner_url"]."' /></a><br /><br /><b>".$ts3_VirtualServers["virtualserver_name"]."</b><br /><br /><a href='ts3server://".$ip.":".$port."'>".$ip.":".$port."</a><br /><br />";
}else
{
$text .= "<b>".$ts3_VirtualServers["virtualserver_name"]."</b><br /><br /><a href='ts3server://".$ip.":".$port."'>".$ip.":".$port."</a><br /><br />";
}


/* display virtual server viewer using HTML interface */
$text .= "</td></tr><tr><td>".$ts3_VirtualServers->getViewer(new TeamSpeak3_Viewer_Html(e_PLUGIN."teamspeak3_menu/images/viewer/"));

$text .= "<br /><b>".TS3W_26."</b>&nbsp;&nbsp;&nbsp;".$ts3_VirtualServers["virtualserver_client_connections"]."<br />";
$text .= "<b>".TS3W_23."</b><br />".$ts3_VirtualServers["connection_packets_received_total"]." / ".$ts3_VirtualServers["connection_bytes_received_total"]."<br />";
$text .= "<b>".TS3W_24."</b><br />".$ts3_VirtualServers["connection_packets_sent_total"]." / ".$ts3_VirtualServers["connection_bytes_sent_total"]."<br />
</td></tr></table>";
$ns -> tablerender("<b>".$name."</b>", $text);
}

catch(Exception $e)
{
$text .= "Error (ID " . $e->getCode() . ") <b>" . $e->getMessage() . "</b>
<hr /><img src='".$ec_dir."images/no_response.jpg' />";
$ns -> tablerender("<b>".$name."</b>", $text);
}

}


This is the first step into custum messages for my plugin to e107 cms system. Moved the try into while statment. Was on outside before with no issues :)

ScP
08-01-2011, 23:30
Can you copy & paste the exact error/warning message you get? I tried to reproduce this but everything worked fine on my system.

Also, is there anyone else with some feedback for me?

:confused:

bad_dud
09-01-2011, 09:14
Hi ScP.

Here is the error code = Error (ID 0) timer is already running :confused:
Iam using 1.1.2-beta

ScP
09-01-2011, 10:52
Are you sure that you've replaced all files when you updated to the latest version? There's no sign of that exception message in my code anymore since I removed that part of the code with version 1.0.21-beta.

:(

bad_dud
09-01-2011, 11:49
Strange. I copy the hole directory over the old one and replace all files. However to realy check that everything was replaced i just remove the old library directory and copy library directory (1.1.2-beta) into my plugin structure and have the same result.

Could it be so that iam using wampserver on my local pc when iam working with the new plugin version because i cant reproduce it on my webserver due of main page content has a lof of information and render slower then when iam on my wampserver.

I will give it a try in the evening when iam back home from my country house due of firewall problem now and cant start my ts3 server. (DNS problem) :(

Sorry. I could not reproduce it on my web server. It must be something with wampserver that iam running on my pc.

However to repruduce it i had to update to 1.1.2 and it will not rendering in right way. FF and IE 8
Any clou?

Check here. http://www.baddud.wallin.no-ip.com/news.php

ScP
09-01-2011, 19:39
With version 1.1.x I changed the HTML layout of the TeamSpeak3_Viewer_Html interface back to tables to resolve several display issues. I can only assume that you didn't update your CSS files. Check the stylesheet information in this example:

http://www.planetteamspeak.com/demos/TS3%20PHP%20Framework/examples/apps/viewer/viewer.php

bad_dud
10-01-2011, 16:55
With version 1.1.x I changed the HTML layout of the TeamSpeak3_Viewer_Html interface back to tables to resolve several display issues. I can only assume that you didn't update your CSS files. Check the stylesheet information in this example:

http://www.planetteamspeak.com/demos/TS3%20PHP%20Framework/examples/apps/viewer/viewer.php

Thx. That's why I missed because I thought it was in TeamSpeak 3 framework directory :rolleyes:

It works now so i will update the site now however its strange with the timer error when iam running local but not on my server and it was removed for a while ago.

ScP
15-01-2011, 21:13
Version 1.1.3-beta is now available! Here's the changelog:


=== Release 1.1.3-beta - 15 Jan 2011 ===
! updated online and offline docs to Doxygen 1.7.2
+ added TeamSpeak3_Helper_Signal_Interface which subscribes the layout for
all TeamSpeak3_Helper_Signal callbacks available
+ added TeamSpeak3_Node_Host::permissionGetCategoryById()
+ added TeamSpeak3_Node_Servergroup::message()
+ added TeamSpeak3_Node_Channelgroup::message()
+ added TeamSpeak3_Helper_Convert::permissionCategory()
+ added new notifyError signal to TeamSpeak3_Adapter_ServerQuery_Reply class
to provide powerful code profiling capabilities
+ added additional debugging signals to both TeamSpeak3_Transport_TCP and
TeamSpeak3_Transport_UDP to indicate whenever data has been sent/received
* TeamSpeak3_Adapter_Update::getRev() now supports an additional channel to
query the latest server revision number from the master server
* TeamSpeak3_Node_Host::version() now supports optional parameter to provide
direct access to specific version information such as platform and build
- fixed an issue where flood ban messages sent by 3.0.0-beta30 servers could
could cause timeout exceptions:D

Dacen
16-01-2011, 22:38
A table layout is 100% compatible to ALL current browsers since you don't need to float anything around (e.g. to get the right icon alignment).
The table layout is fluid and supports the channel spacers without having to be a CSS guru.



I beg to differ, mate. Table can get rendered by all browser thats it. A current browser should be almost W3C conform. Thats why everyone, who does anything involving designing a website, goes mental, when in opera, safari and firefox everything looks the same (except radio buttons) and behaves the same javascript wise (some are more "foregiving" than others) and then the stupid and some other not so nice adjectives IE 7 or 8 comes along.

This might seam like the typical rant of some Microsoft hating bloke, but its not. I like the new stuff and I mean they did a lot of good and stupid things as any other software firm.

If you want just a showcase what the TS3 Framework can do, don't get into it. Otherwise I would like you give a box model centered approach another try. Check out jQuery and jQuery ui (or other js "frameworks") for some nice web 2.0 features giving you more freedom to design any display/user interface stuff. Its worth a try.

just my 2cents

but this nice OOP PHP textbook case deserves more

ScP
17-01-2011, 00:22
I beg to differ, mate. Table can get rendered by all browser thats it. A current browser should be almost W3C conform. Thats why everyone, who does anything involving designing a website, goes mental, when in opera, safari and firefox everything looks the same (except radio buttons) and behaves the same javascript wise (some are more "foregiving" than others) and then the stupid and some other not so nice adjectives IE 7 or 8 comes along.I agree and that's why I've implemented the new pattern concept in the HTML and ASCII interfaces which allows you to use any HTML code you want to display a TSViewer without having to dig deep into my code. So if you know what you're doing - and from what you've written I think you do - you do whatever you want.

The main reason I switched from <div> containers back to simple tables is that most of the users were not able to create the required CSS classes on their own so the TSViewer (which - unfortunately - is the only feature of my framework that most people use) looked pretty crappy on their sites.

What I would like to see is people creating their own viewer classes based on my TeamSpeak3_Viewer_Interface.


echo $ts3_VirtualServer->getViewer(new My_1337_Class());

:o

Anyway, thank you for your quality feedback!

Dacen
17-01-2011, 22:22
I did some thinking and stuff and a problem occured to me:

I tried to construct a json string using your HTML Viewer as a basis. It worked fine and i can get a valid result and such, but not with a quick workaround. According to the Documentation the function get Viewer contains this line


$html .= $viewer->fetchObject($node, $siblings);


the problem is, that i have to explode the string, do a json_decode on each item and do then a json_encode to get this valid string. Do you plan to make it optional that this string gets joined (the line above) or maybe a implode parameter can be given?

That would make the generation of a json interpretation a little bit more straight forward.

I post the code, when I tested it some more.



<?php
require_once( EXTERN_LIBARY_DIRECTORY .'TS3Api/Viewer/Interface.php');

class TS3_Viewer_JSON implements TeamSpeak3_Viewer_Interface {

private $_oDatabase;

protected $pattern = '{"containerID":"%0","containerClass":"%1","prefix":%2,"corpusClass":%3,"corpusTitle":"%4","corpusIcon":%5,"corpusName":"%6","suffixClass":"%7","suffixIcon":%8,"suffixFlag":"%9"}';

protected $currObj = null;
protected $currSib = null;
protected $currNum = 0;
protected $iconpath = null;
protected $flagpath = null;
protected $ftclient = null;
protected $cachedIcons = array(100, 200, 300, 400, 500, 600);
protected $remoteIcons = array();

public function __construct(){
$this->iconpath = 'gfx/ts3/viewer/';
$this->flagpath = 'gfx/ts3/flags/';
$this->ftclient = null;
}

public function fetchObject( TeamSpeak3_Node_Abstract $oNode, array $aSiblings = array() ){
$this->currObj = $oNode;
$this->currSib = $aSiblings;

$aArgs = array(
$this->getContainerIdent(),
$this->getContainerClass(),
$this->getPrefix(),
$this->getCorpusClass(),
$this->getCorpusTitle(),
$this->getCorpusIcon(),
$this->getCorpusName(),
$this->getSuffixClass(),
$this->getSuffixIcon(),
$this->getSuffixFlag()
);
return TeamSpeak3_Helper_String::factory($this->pattern)->arg($aArgs);
}

protected function getContainerIdent(){
return $this->currObj->getUniqueId();
}

protected function getContainerClass(){
return $this->currObj->getClass(null);
}

protected function getPrefix(){
$aPrefix = array();

if(count($this->currSib)){
$last = array_pop($this->currSib);

foreach($this->currSib as $sibling){
$aPrefix[] = ($sibling) ? $this->getImage("tree_line.gif") : $this->getImage("tree_blank.png");
}

$aPrefix[] = ($last) ? $this->getImage("tree_end.gif") : $this->getImage("tree_mid.gif");
}

return $this->deflateJSON($aPrefix);
}

protected function getCorpusClass(){
$aExtras = array();

if($this->currObj instanceof TeamSpeak3_Node_Channel && $this->currObj->isSpacer()){
switch($this->currObj->spacerGetType()){
case (string) TeamSpeak3::SPACER_SOLIDLINE:
$aExtras[] = "solidline";
break;

case (string) TeamSpeak3::SPACER_DASHLINE:
$aExtras[] = "dashline";
break;

case (string) TeamSpeak3::SPACER_DASHDOTLINE:
$aExtras[] = "dashdotline";
break;

case (string) TeamSpeak3::SPACER_DASHDOTDOTLINE:
$aExtras[] = "dashdotdotline";
break;

case (string) TeamSpeak3::SPACER_DOTLINE:
$aExtras[] = "dotline";
break;
}

switch($this->currObj->spacerGetAlign()){
case TeamSpeak3::SPACER_ALIGN_CENTER:
$aExtras[] = "center";
break;

case TeamSpeak3::SPACER_ALIGN_RIGHT:
$aExtras[] = "right";
break;

case TeamSpeak3::SPACER_ALIGN_LEFT:
$aExtras[] = "left";
break;
}
}
$aExtras[] = $this->currObj->getClass(null);
return json_encode($aExtras);
}

protected function getCorpusTitle(){
if($this->currObj instanceof TeamSpeak3_Node_Server){
return "ID: " . $this->currObj->getId() . " | Clients: " . $this->currObj->clientCount() . "/" . $this->currObj["virtualserver_maxclients"] . " | Uptime: " . TeamSpeak3_Helper_Convert::seconds($this->currObj["virtualserver_uptime"]);
} elseif($this->currObj instanceof TeamSpeak3_Node_Channel && !$this->currObj->isSpacer()){
return "ID: " . $this->currObj->getId() . " | Codec: " . TeamSpeak3_Helper_Convert::codec($this->currObj["channel_codec"]) . " | Quality: " . $this->currObj["channel_codec_quality"];
} elseif($this->currObj instanceof TeamSpeak3_Node_Client){
return "ID: " . $this->currObj->getId() . " | Version: " . $this->currObj["client_version"] . " | Platform: " . $this->currObj["client_platform"];
} elseif($this->currObj instanceof TeamSpeak3_Node_Servergroup || $this->currObj instanceof TeamSpeak3_Node_Channelgroup){
return "ID: " . $this->currObj->getId() . " | Type: " . TeamSpeak3_Helper_Convert::groupType($this->currObj["type"]) . " (" . ($this->currObj["savedb"] ? "Permanent" : "Temporary") . ")";
}
}

protected function getCorpusIcon(){
if($this->currObj instanceof TeamSpeak3_Node_Channel && $this->currObj->isSpacer()) return;
return $this->getImage($this->currObj->getIcon() . ".png");
}

protected function getCorpusName(){
if($this->currObj instanceof TeamSpeak3_Node_Channel && $this->currObj->isSpacer()){
if($this->currObj->spacerGetType() != TeamSpeak3::SPACER_CUSTOM) return;

$string = $this->currObj["channel_name"]->section("]", 1);

if($this->currObj->spacerGetAlign() == TeamSpeak3::SPACER_ALIGN_REPEAT){
$string->resize(30, $string);
}

return htmlspecialchars($string);
}

if($this->currObj instanceof TeamSpeak3_Node_Client){
$before = array();
$behind = array();

foreach($this->currObj->memberOf() as $group){
if($group["namemode"] == TeamSpeak3::GROUP_NAMEMODE_BEFORE){
$before[] = "[" . htmlspecialchars($group["name"]) . "]";
} elseif($group["namemode"] == TeamSpeak3::GROUP_NAMEMODE_BEHIND) {
$behind[] = "[" . htmlspecialchars($group["name"]) . "]";
}
}
return implode("", $before) . " " . htmlspecialchars($this->currObj) . " " . implode("", $behind);
}

return htmlspecialchars($this->currObj);
}

protected function getSuffixClass(){
return $this->currObj->getClass(null);
}


protected function getSuffixIcon(){
if($this->currObj instanceof TeamSpeak3_Node_Server){
return $this->getSuffixIconServer();
}elseif($this->currObj instanceof TeamSpeak3_Node_Channel){
return $this->getSuffixIconChannel();
}elseif($this->currObj instanceof TeamSpeak3_Node_Client){
return $this->getSuffixIconClient();
}
}

protected function getSuffixIconServer(){
$aIcons = array();

if($this->currObj["virtualserver_icon_id"]){
if(!$this->currObj->iconIsLocal("virtualserver_icon_id") && $this->ftclient){
if(!isset($this->cacheIcon[$this->currObj["virtualserver_icon_id"]])){
$download = $this->currObj->transferInitDownload($this->currObj->getId(), 0, $this->currObj->iconGetName("virtualserver_icon_id"));
$this->cacheIcon[$this->currObj["virtualserver_icon_id"]] = $download;
} else {
$download = $this->cacheIcon[$this->currObj["virtualserver_icon_id"]];
}

$aIcons[] = $this->getImage($this->ftclient . "?ftdata=" . base64_encode(serialize($download)), "Server Icon", null, FALSE);
} elseif(in_array($this->currObj["virtualserver_icon_id"], $this->cachedIcons)){
$aIcons[] = $this->getImage("group_icon_" . $this->currObj["virtualserver_icon_id"] . ".png", "Server Icon");
}
}

return $this->deflateJSON($aIcons);
}


protected function getSuffixIconChannel(){
if($this->currObj instanceof TeamSpeak3_Node_Channel && $this->currObj->isSpacer()) return;

$aIcons[] = array();

if($this->currObj["channel_flag_default"]){
$aIcons[] = $this->getImage("channel_flag_default.png", "Default Channel");
}

if($this->currObj["channel_flag_password"]){
$aIcons[] = $this->getImage("channel_flag_password.png", "Password-protected");
}

if($this->currObj["channel_codec"] == 3){
$aIcons[] = $this->getImage("channel_flag_music.png", "Music Codec");
}

if($this->currObj["channel_needed_talk_power"]){
$aIcons[] = $this->getImage("channel_flag_moderated.png", "Moderated");
}

if($this->currObj["channel_icon_id"]){
if(!$this->currObj->iconIsLocal("channel_icon_id") && $this->ftclient){
if(!isset($this->cacheIcon[$this->currObj["channel_icon_id"]])){
$download = $this->currObj->getParent()->transferInitDownload($this->currObj->getId(), 0, $this->currObj->iconGetName("channel_icon_id"));
$this->cacheIcon[$this->currObj["channel_icon_id"]] = $download;
} else {
$download = $this->cacheIcon[$this->currObj["channel_icon_id"]];
}

$aIcons[] = $this->getImage($this->ftclient . "?ftdata=" . base64_encode(serialize($download)), "Channel Icon", null, FALSE);
} elseif(in_array($this->currObj["channel_icon_id"], $this->cachedIcons)) {
$aIcons[] = $this->getImage("group_icon_" . $this->currObj["channel_icon_id"] . ".png", "Channel Icon");
}
}

return $this->deflateJSON($aIcons);
}

protected function getSuffixIconClient(){
$aIcons = array();

if($this->currObj["client_is_priority_speaker"]){
$aIcons[] = $this->getImage("client_priority.png", "Priority Speaker");
}

if($this->currObj["client_is_channel_commander"]){
$aIcons[] = $this->getImage("client_cc.png", "Channel Commander");
}

if($this->currObj["client_is_talker"]){
$aIcons[] = $this->getImage("client_talker.png", "Talk Power granted");
}

foreach($this->currObj->memberOf() as $group){
if(!$group["iconid"]) continue;

$type = ($group instanceof TeamSpeak3_Node_Servergroup) ? "Server Group" : "Channel Group";

if(!$group->iconIsLocal("iconid") && $this->ftclient){
if(!isset($this->cacheIcon[$group["iconid"]])){
$download = $group->getParent()->transferInitDownload($group->getId(), 0, $group->iconGetName("iconid"));
$this->cacheIcon[$group["iconid"]] = $download;
} else {
$download = $this->cacheIcon[$group["iconid"]];
}

$aIcons[] = $this->getImage($this->ftclient . "?ftdata=" . base64_encode(serialize($download)), $group . " [" . $type . "]", null, FALSE);
} elseif(in_array($group["iconid"], $this->cachedIcons)) {
$aIcons[] = $this->getImage("group_icon_" . $group["iconid"] . ".png", $group . " [" . $type . "]");
}
}

if($this->currObj["client_icon_id"]){
if(!$this->currObj->iconIsLocal("client_icon_id") && $this->ftclient){
if(!isset($this->cacheIcon[$this->currObj["client_icon_id"]])){
$download = $this->currObj->getParent()->transferInitDownload($this->currObj->getId(), 0, $this->currObj->iconGetName("client_icon_id"));
$this->cacheIcon[$this->currObj["client_icon_id"]] = $download;
} else {
$download = $this->cacheIcon[$this->currObj["client_icon_id"]];
}

$aIcons[] = $this->getImage($this->ftclient . "?ftdata=" . base64_encode(serialize($download)), "Client Icon", null, FALSE);
} elseif(in_array($this->currObj["client_icon_id"], $this->cachedIcons)) {
$aIcons[] = $this->getImage("group_icon_" . $this->currObj["client_icon_id"] . ".png", "Client Icon");
}
}

return $this->deflateJSON($aIcons);
}


protected function getSuffixFlag(){
if(!$this->currObj instanceof TeamSpeak3_Node_Client) return;

if($this->flagpath && $this->currObj["client_country"]){
return $this->getImage($this->currObj["client_country"]->toLower() . ".png", $this->currObj["client_country"], null, FALSE, TRUE);
}
}

protected function getImage($name, $text = "", $class = null, $iconpath = TRUE, $flagpath = FALSE){
$aIcon = array('src'=>'','title'=>'');

if($iconpath){
$aIcon['src'] = $this->iconpath;
}
if($flagpath){
$aIcon['src'] = $this->flagpath;
}

$aIcon['src'] .= $name;
$aIcon['title'] = $text;
return json_encode($aIcon);
}

protected function deflateJSON( array $aArray ){
foreach( $aArray as $iKey=>$sValue ){
if( !is_array( $sValue ) ){
$aArray[$iKey] = json_decode($sValue);
}
}
return json_encode($aArray);
}
}
?>


Have fun with this jquery code



viewer = function( url, args){

$.post(url, args, function(data) {
if( data != null && data.server != undefined ){

jQuery.each(data.server, function(i, row) {

var div = document.createElement('div');
var prefix = document.createElement('div');
var corpus = document.createElement('div');
var suffix = document.createElement('div');
jQuery(div).append(prefix).append(corpus).append(s uffix)
.addClass(row.containerClass)
.attr('id', row.containerID)
.append('<div class="clear"></div>');

jQuery(corpus).addClass('left '+row.corpusClass)
.attr('title', row.corpusTitle)
.append('<img class="left image icon" src="'+sServer+row.corpusIcon.src+'" title="'+sServer+row.corpusIcon.title+'" alt=""/>')
.append('<div class="left lineHeight16 leftSpace">'+row.corpusName+'</div><div class="clear"></div>');

addPrefix( prefix, row.prefix );
addSuffix( suffix, row.suffixIcon );

jQuery(prefix).addClass('left '+row.suffixClass).append('<div class="clear"></div>');
jQuery(suffix).addClass('right '+row.suffixClass);
if( row.suffixFlag.src != undefined ){
jQuery(suffix).append('<img class="image icon" src="'+sServer+row.suffixFlag.src+'" title="'+sServer+row.suffixFlag.title+'" alt=""/>')
}
jQuery(suffix).append('<div class="clear"></div>');

jQuery('#insertandidhere').append(div);

});
}
}, 'json');
}

addPrefix = function( prefix, prefixes ) {
jQuery.each(prefixes, function(i, prefixIcon) {
if( prefixIcon.src != undefined ){
jQuery(prefix).append('<img class="image icon" src="'+sServer+prefixIcon.src+'" title="'+sServer+prefixIcon.title+'" alt=""/>');
}
});
}

addSuffix = function( suffix, suffixes ) {
jQuery.each(suffixes, function(i, suffixIcon) {
if( suffixIcon.src != undefined ){
jQuery(suffix).append('<img class="image icon" src="'+sServer+suffixIcon.src+'" title="'+sServer+suffixIcon.title+'" alt=""/>');
}
});
}


some js code is very custom made. you may have to edit it designwise

ScP
18-01-2011, 02:43
Very nice!

:)

pwrdesign
18-01-2011, 07:19
Hi!

We've installed TS3 on our server and it works GREAT!
I've also installed a TS3 viewer module on our Joomla Site, but it doesn't work because we havn't installed the TS3 PHP framework:

http://addons.teamspeak.com/directory/tools/integration/TeamSpeak-3-PHP-Framework.html

Though, we cant find any help on how to install it on our server?
Any help here maybe?

Best Regards Patrik

florian_fr40
18-01-2011, 07:50
Hello

You have several examples in the Framework folder or here :
http://www.planetteamspeak.com/demos/TS3%20PHP%20Framework/examples/

I don't think that your viewer doesn't work because the Framework is on your web server. What error, you get ?

Dacen
18-01-2011, 08:34
Another suggestion:

This getViewer function expects that strings are returned from the fetchObject function of the viewer. Thats unfortunate for everyone, who use a template engine such as Smarty. I would suggest that is maybe for you another reason to think about the getViewer function and its possibilities.

(if the viewer function is not a showcase scenario)

Hello again,

i got a question concerning the file tags you put into each file. How do you generate them? How do you change them?

Greetings
Dacen

pwrdesign
18-01-2011, 09:01
HI!

Thanks for that!

This is our homepage: http://www.swedishhuntingsociety.se/
Im getting:

Error 110:
Connection timed out

Regards Patrik

florian_fr40
18-01-2011, 09:45
Do you add the IP of the web server on the query_ip_whitelist file ?
Do you set up correctly the permission in the Guest Query Group ?
The query port is open on the firewall (if there is one) ?

jujubins
25-01-2011, 02:01
Error 0: connection to server 'hidden:10011' lost

Why I receive this error?

My servers is online, and my script run, but lost connection.

With serveradmin account I received this message:
Error 3331: flood ban

maggy
25-01-2011, 05:04
Is the IP address from which the script is run whitelisted on the server?

jujubins
25-01-2011, 16:59
No... xD

I can only edit in the file? Can I edit the whitelist from teamspeak 3 client?


EDIT:

File edited, and I receive the same message:
Error 3331: flood ban

maggy
26-01-2011, 01:01
What script are you running that produces this error?

mwolf
28-01-2011, 08:12
any chance for joomla 1.6 add on ?

Grinsekatze
29-01-2011, 18:52
Hi ScP,
I want to give your framework a try on my Joomla webpage but I get the same Error Message Teris Cooper got before:

Warning: uasort() [function.uasort]: Array was modified by the user comparison function in C:\xampp\htdocs\ts3fw\libraries\TeamSpeak3\Node\Se rver.php on line 0

ERROR 0x602: invalid parameter
I get the Error on both: My local testing enviroment and my webserver too. On my local computer I use PHP 5.3.1 and on my root server is PHP Version 5.2.6-1+lenny9 running. The TS3 PHP Framework is version 1.1.3 beta.
About my configuration:
The TS3 Server is not on my root server so I entered the IP address in the configuration file. Also it's not password protected so I left the password value empty within the configuration file.

I noticed that the Error is called from "TeamSpeak3_Adapter_ServerQuery_Reply::toAssocArray ($ident)" within "reply.php" but I don't know why and how.

Edit:
I could solve the warning now. Therefore I had to edit "/libraries/TeamSpeak3/Adapter/ServerQuery/Reply.php" and had to edit the function "toAssocArray($ident)".
Original:

public function toAssocArray($ident)
{
$nodes = (func_num_args() > 1) ? $this->toArray(1) : $this->toArray();
$array = array();

foreach($nodes as $node)
{
if(array_key_exists($ident, $node))
{
$array[(is_object($node[$ident])) ? $node[$ident]->toString() : $node[$ident]] = $node;
}
else
{
throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
}
}

return $array;
}
change to:

public function toAssocArray($ident)
{
$nodes = (func_num_args() > 1) ? $this->toArray(1) : $this->toArray();
$array = array();

foreach($nodes as $node)
{
if(property_exists($ident, (string)$node))
{
$array[(is_object($node[$ident])) ? $node[$ident]->toString() : $node[$ident]] = $node;
}
else
{
throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
}
}

return $array;
}
In short words you have to change "array_key_exists" into "property_exists" and afterwards you have to transform the second Parameter "$node" what is an array into a string ("(string)$node").

The Error 0x602 is caused because "array_key_exists" / "property_exists" returns "false". But why?

Edit 2:
Now I also figured out how on earth the Error is caused:
It's caused because of "/libraries/TeamSpeak3/Node/Server.php" and there within "function channelList(array $filter = array())". The function "toAssocArray" (that generates the Error) is called with a value called "cid". But this value is not within "$node" (check the function mentioned earlier above) so "array_key_exists" / "property_exists" returns "false" and the function "toAssocArray" generates the Error.

ScP
30-01-2011, 14:06
Thank you for reporting this. A fix will be included in the next release.

:)

Grinsekatze
30-01-2011, 16:13
Unlikely I still get the Error Message:
ERROR 0x602: invalid parameter

I just figured out that it has to do with the channel listing. When I echo $ident and print_r($node) it says: $ident == 'cid'.
Within the array i get a lot of "cid" 's.
So I don't know why on earth the error is generated.

it's this lines of code I think:

if(array_key_exists($ident, $node))
# if(property_exists($ident, (string)$node))
{
$array[(is_object($node[$ident])) ? $node[$ident]->toString() : $node[$ident]] = $node;
}
else
{
throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
}




Edit:
Ok, seems as if my first trys got me to the wrong direction.
After I checked the whole framework again I noticed that there are several files which can cause an Error 0x602.
The one mentioned before (/libraries/TeamSpeak3/Adapter/ServerQuery/Reply.php), /libraries/TeamSpeak3/Adapter/ServerQuery/Event.php, /libraries/TeamSpeak3/Node/Server.php and /libraries/TeamSpeak3/Node/Abstract.php .
After I added some debug informations I noticed that this 0x602 is caused by /libraries/TeamSpeak3/Node/Abstract.php and thats the coresponding code to it:

/**
* @ignore
*/
public function offsetGet($offset)
{
if(!$this->offsetExists($offset))
{
$this->fetchNodeInfo();
}

if(!$this->offsetExists($offset))
{
throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
}

return $this->nodeInfo[(string) $offset];
}

Unlikely I have no Idea what I can solve here. Someone has an IDea or can point me in the right direction?

R3M__
31-01-2011, 16:51
Hi and thanks for this awesome framework.

I'm using the default viewer script on our clan page, and have noticed that every client has a country flag, but some have none. Now my question, where do the viewer get the flag infos, maybe something like MaxMind GeoIP, or from the TS server itself?

http://i53.tinypic.com/ih5r29.png

In this case "The Skull" should have a Slovenia flag.

And it would be nice, if there could be a default flag, if the origin of the client can't resolved instead of none, like:

http://i55.tinypic.com/2z4lqf8.png

Thanks in advanced and keep up the good work!

ScP
01-02-2011, 10:58
I'm using the default viewer script on our clan page, and have noticed that every client has a country flag, but some have none. Now my question, where do the viewer get the flag infos, maybe something like MaxMind GeoIP, or from the TS server itself?My example viewer interface class is using the client_country property to decide which flag icon needs to be shown - just like the TeamSpeak 3 Client does. I've taken all the country flag images from the TeamSpeak 3 Client install directory, but it's possible that some new flags were added so they're probably just missing in the framework package.

In short... If the correct flag is shown in your TeamSpeak 3 Client, just copy all the flag images out of your install directory onto your webserver.

:)

I'll think about that default flag option.

R3M__
01-02-2011, 12:18
In short... If the correct flag is shown in your TeamSpeak 3 Client, just copy all the flag images out of your install directory onto your webserver.

:)

I'll think about that default flag option.

Ah thanks, the client didn't have a flag in the teamspeak client as well. But with your hint I now understand your code and changed it a bit to make the "NoFlag" flag to show up:

libraries/TeamSpeak3/Viewer/Html.php


/**
* Returns a HTML img tag which can be used to display the country flag for a
* TeamSpeak_Node_Client object.
*
* @return string
*/
protected function getSuffixFlag()
{
if(!$this->currObj instanceof TeamSpeak3_Node_Client) return;

if($this->flagpath && $this->currObj["client_country"])
{
return $this->getImage($this->currObj["client_country"]->toLower() . ".png", $this->currObj["client_country"], null, FALSE, TRUE);
}
else
{
return "<img src='/images/flags/none.png' alt='NOFLAG' title='NOFLAG' />";
}
}

Result: http://i52.tinypic.com/29z6jom.png

Thanks a bunch! much appreciated :)

ScP
01-02-2011, 19:36
Unlikely I have no Idea what I can solve here. Someone has an IDea or can point me in the right direction?I can. Unfortunately, the code changes you've made have nothing to do with the warning message. The issue is caused by a PHP bug when you're using exceptions inside uasort() callbacks like I did.

Anyway, the upcoming version 1.1.4-beta should fix this.

:)

What I don't understand is why there's an exception thrown on your end. Which version of the TeamSpeak 3 Server do you use? Maybe this is a compatibility issue.

Whinis
05-02-2011, 07:06
I would like to know if there is an easy way to turn a client db id into a regular client id. As it stands I have to request the cluid, then from their request the client info on the cluid. explore the array to find the clid before finally ouputting to a kick functions.

The reason I ask this is I have it so that once an hour my script checks for certain conditions. If these conditions fail for a user I clientDeleteDb them, this only works however if they are not logged in. So I then have to go through proccess above to kick before I can clientDeleteDb.

ScP
05-02-2011, 22:03
Version 1.1.4-beta is available now...


=== Release 1.1.4-beta - 05 Feb 2011 ===
! codebase converted to Zend Studio 8.0.0 project
! upgrading your servers to 3.0.0-beta31 (build >= 13537) is mandatory
+ added TeamSpeak3_Node_Server::clientGetNameByUid()
+ added TeamSpeak3_Node_Server::clientGetNameByDbid()
+ added TeamSpeak3_Node_Server::clientGetServerGroupsByDbi d()
+ added TeamSpeak3_Node_Server::permRemoveAny()
- fixed internal convert error exception caused internally when using integer
values with more than 16 bits for clientftfid parameters
* several iconDownload() and iconUpload() methods now use random clientftfid
parameter values instead of node IDs
- fixed bug where using exceptions inside uasort() callbacks caused warnings
* TeamSpeak3_Adapter_ServerQuery_Reply::fetchError() now tries to resolve
the permission name for failed_permid values to generate comprehensible
error messages:rolleyes:

Grinsekatze
06-02-2011, 13:07
Hi ScP,

the TS3 Server is Version 3.0.0.-beta29 [Build: 12437].
I tested the Framework Version 1.1.3 beta and a few seconds ago also Version 1.1.4 beta. Both are giving me back that error.
By luck I noticed together with my TS-Server Admin that we only get that error if the server is not empty. If it is empty everything is displayed fine but when someone has connected with his client we get that error.

I already noticed that the files from my first posting are not responsable for the problem. But the file from my last post (/libraries/TeamSpeak3/Node/Abstract.php), I'm pritty sure, is. When I cange the echo of the error into something else I get that new echo.

Tnaks for your help!

PS: I really love what I saw already (ok it was just the channels on an empty server). Even the custom channel and group icons are visible and it's much faster than the other ts viewers out there.

ScP
06-02-2011, 16:25
the TS3 Server is Version 3.0.0.-beta29 [Build: 12437].That's the issue. Here's a quote from the changelog:


=== Release 1.1.1-beta - 28 Nov 2010 ===
! upgrading your servers to 3.0.0-beta30 (build >= 12910) is mandatory
...If you upgrade your server, the issue should be resolved but I'll look into this again. Are we talking about the "invalid parameter" error message or the uasort() warning?

Grinsekatze
07-02-2011, 01:07
So I'll ask my TS-Admin to update the server.

Are we talking about the "invalid parameter" error message or the uasort() warning?
Yes we do.

ScP
07-02-2011, 05:28
Yes we do.I repeat:

Are we talking about the "invalid parameter" error message OR the uasort() warning?

Grinsekatze
07-02-2011, 18:05
Sorry. Hopefully we talk about the error - at least I do.

ScP
07-02-2011, 18:23
Sorry. Hopefully we talk about the error - at least I do.Ok then. Version 1.1.4-beta should have resolved the uasort() warning while updating your server will fix the "invalid parameter" error message.

DarkTerror
09-02-2011, 23:59
Hi!!!

¿Can someone help me?

I am reading the examples:


// connect to local server, authenticate and quickly spawn an object for the virtual server on port 9987
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://username:[email protected]:10011/?server_port=9987");

// query clientlist from virtual server
$arr_ClientList = $ts3_VirtualServer->clientList();

// kick all clients online with a single command
$ts3_VirtualServer->clientKick($arr_ClientList, TeamSpeak3::KICK_SERVER, "evil kick XD");


And need example for only one client kick, example client with id = 1

How i can to do?

Thx (sorry for my english)

ScP
10-02-2011, 01:56
And need example for only one client kick, example client with id = 1Sure. There are several possibilities to interact with a single client:


// connect to local server, authenticate and quickly spawn an object for the virtual server on port 9987
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://username:[email protected]:10011/?server_port=9987");

// A: kick client with ID 1 using the simple low-level method
$ts3_VirtualServer->clientKick(1, TeamSpeak3::KICK_SERVER, "evil kick XD");

// B: spawn object for the client based on an ID and call the kick method
$ts3_VirtualServer->clientGetById(1)->kick(TeamSpeak3::KICK_SERVER, "evil kick XD");

// C: spawn object for the client based on a nickname and call the kick method
$ts3_VirtualServer->clientGetByName("ScP")->kick(TeamSpeak3::KICK_SERVER, "evil kick XD");

// D: spawn object for the client based on a unique identifier and call the kick method
$ts3_VirtualServer->clientGetByUid("FPMPSC6MXqXq751dX7BKV0JniSo=")->kick(TeamSpeak3::KICK_SERVER, "evil kick XD");Any other questions?

:rolleyes:

DarkTerror
10-02-2011, 07:31
Any other questions?

:rolleyes:

Yea!! I have another question ^^

If I like delete ALL tokens generated by user with guid 1 or named "ScP"

how i can do it?

Thx for your help :)

Grinsekatze
10-02-2011, 10:02
Hi ScP,
it's me again. After We updated the TS3-Server to Version 3.0.0 beta 36 (I think it's the latest version aviable) everythink works fine.

The only things I had to do in addition (but that's because of the used TS3 Joomla module):
- Update the TS3 PHP Framework to Version 1.1.4 beta (the build in one was 1.0 I think).
- Modify the ts3icon.php and ts3file.php files from the Framework (after I used the new ones from the current Framework).
- Modify the helper.php file from the module to be able to use the new features.

The only "bug" I noticed by now (and again it's also not because of the Framework but because of the module itself):
- When you enable caching the Serverside icons (custom channel and group icons) are not displayed. So if you want to show them disable caching inside the module.
- You have to modify the module when you would like to show a public TS3 Server with no password set because the module always uses "password" for the password if the password is empty.


Thank's ScP again for the great work and the good support!

Edit:Btw: For the people that are interessted in the module. I use JoomSimple Teamspeak3 Server Viewer 2.0: http://extensions.joomla.org/extensions/14080

ScP
10-02-2011, 10:56
If I like delete ALL tokens generated by user with guid 1 or named "ScP"

how i can do it?Unfortunately, this is not possible yet. The TeamSpeak 3 Server does not "know" who created a token as this information is currently not stored in the database. I'll forward a feature request to the dev team, but I can't promise anything.

:)

DarkTerror
10-02-2011, 11:39
Unfortunately, this is not possible yet. The TeamSpeak 3 Server does not "know" who created a token as this information is currently not stored in the database. I'll forward a feature request to the dev team, but I can't promise anything.

:)

Let me explain the reason why this should be done

I like generate accounts from TS in vBulletin forum and generate tokens for my users but i dont like they shared tokens with anothers users. They must have rigths for generate one token, and reset if the userd need. NOTE: Reset = Kick user from ts, delete token generated by the user and reset value of associated token user (default user only can have one token by forum account).

Actualy one user can generate token, reset token, generate token, reset token.... and share all the generated tokens.

Finaly i can found in TS3 what token was generated by someone user. ¿why i cant delete that? at worst i can connect with mysql and delete this rows "manualy" but i prefer serverquery.

Thx for support, best regards.

mwebmedia
20-02-2011, 13:54
Hey guys,
I have a little problem with the TeamSpeak 3 PHP Framework. So, in use is the normaly way to connect with it. Then I become the error message:



Fatal error: Uncaught exception 'TeamSpeak3_Adapter_ServerQuery_Exception' with message 'insufficient client permissions (failed on serverlist 4356/0x1104)'


But at my other Server, I dont become any Error message. The "Fail-"Server is on a privat root server, and the "Successfully-"Server is buyed. So what must I do? The rights are defined to the same. Dont know why it fails.

Sorry for my bad english.
Greets

PHP:


$ts3_ServerInstance = TeamSpeak3::factory("serverquery://".$ts3[ip].":".$ts3[query]."/?server_port=".$ts3[port]."");

$selected_sid = $ts3_ServerInstance->serverList();
$ts3_VirtualServer = $ts3_ServerInstance->serverGetById($selected_sid);

$name = $ts3_VirtualServer["virtualserver_name"];


E: So, I think I have the error. The permission "b_serverinstance_virtualserver_list" is at my buyed server on. But I can't change the value on my root. How do I change it? (insufficient permission modify power)

Would be nice if someone can help

Greets

Hey guys,
I got the Error "ERROR 0x803: file not found" at the TS Viewer.
Can you help me?

ScP
22-02-2011, 04:46
Please check your servers permission settings for invalid i_icon_id values. There's probably an orphan entry (icon deleted but permission still set)... With future versions I'll ignore these errors and display a placeholder icon instead.

mwebmedia
22-02-2011, 12:21
Oh, okay. Thank you very much. Now it works!

gnugeek
22-02-2011, 13:14
when i use the TeamSpeak3_Node_Channel modify method im unable to change properties unless 'channel_name' have a different value than the original. I can use the same value in the rest of properties but not in 'channel_name'. Is there any way to force it without cheking if the value is changed?

ScP
22-02-2011, 18:01
when i use the TeamSpeak3_Node_Channel modify method im unable to change properties unless 'channel_name' have a different value than the original. I can use the same value in the rest of properties but not in 'channel_name'. Is there any way to force it without cheking if the value is changed?This is normal behaviour since the server detects that the channel_name property you're trying to set is already in use. I know this error message is confusing as you're trying to modify the channel which IS in fact using that name already, but as I said... the message is coming directly from the server so there's not much I can do about it.

I'll forward your feedback to the devs, but in the meantime I'd suggest that you simply not pass any properties to the modify method which have not been modified.

:)

DarkTerror
23-02-2011, 01:42
I'll forward a feature request to the dev team, but I can't promise anything.


Do you have some info about that? I am very interested, in fact. :D:D

Realy thanx for your help, best regards.

ScP
23-02-2011, 10:14
Do you have some info about that? I am very interested, in fact. :D:DCurrently, the devs intend to polish the existing features first to get the client and server ready for a stable release. Anyway... this will be implemented.

:)

gnugeek
24-02-2011, 19:02
Thx for last answer. Another one:
I finished a web panel for clients so they can manage their teamspeak virtualserver and theres a section where they can edit their server groups(not globals just their groups).The problem is i use the serveradmin ServerQuery login credentials to manage the server and they are able to edit any servergroup privilege, for example the maxslots of the server . Is there any way to login in serverquery with less privileges?
Thx a lot

UPDATE: nevermind, reading http://www.teamspeak.com/?page=faq&cat=ts3athp&rate=266#ts3athp_recommendations saw i shoudl delete that perm.

ScP
25-02-2011, 06:53
I'd recommend that you let the customers use their own ServerQuery login information so they've only the permissions you gave them and only on their virtual server.

gnugeek
25-02-2011, 09:56
But theres no custom server query credentials in virtual servers isnt it? I have 1 teamspeak instance creating hundreds of virtual servers and only a server query credential(serveradmin).

ScP
25-02-2011, 18:36
Each client can create his own ServerQuery account...

Tools -> ServerQuery Login

gnugeek
25-02-2011, 22:37
whats the best approach to develop a web autentification system for ts3 clients?
Right now i have an email/password authentification system that link each client with a host and port and all administration is made using serveradmin credentials. I know maybe its a security problem if theres a security flaw in the panel but thats the best solution i could imagine. In the ts3 framework api couldnt find a way to create user query credentials(thats why i even dint know they could be created by ts3 client).

Any advice?

ScP
25-02-2011, 23:57
In the ts3 framework api couldnt find a way to create user query credentials(thats why i even dint know they could be created by ts3 client).Due to security reasons, each client can only create a ServerQuery login for himself - and the password will always be auto-generated by the server. Use the selfUpdateLogin() method to do this with the framework...

In my opinion there are two approaches to make this work:


Use a combination of ServerQuery credentials and virtual server ID/UDP port to authenticate a user against the TeamSpeak 3 Server. This might be a good solution when you want to develop a light-weight web application without any database backend.
Create an independent account system and provide some kind of bookmark feature to the users. This way every registered user could add his own TeamSpeak 3 Servers from a list of allowed hosts and even share a "bookmark" with others to let them manage his servers using his account.

What do you think?

:)

Btw... Here's the latest changelog:


=== Release 1.1.5-dev - ?? Feb 2011 ===
! updated online and offline docs to Doxygen 1.7.3
* TeamSpeak3_Viewer_Html interface is now backwards compatible to servers
running version 3.0.0-beta29
* TeamSpeak3_Adapter_ServerQuery is now theoretically compatible to the
ClientQuery plugin interface when using available commands
* adjusted exception types in all adapter methods
+ added TeamSpeak3_Adapter_Blacklist_Exception
+ added TeamSpeak3_Adapter_Update_Exception
+ added TeamSpeak3_Adapter_FileTransfer_Exception
+ added TeamSpeak3_Adapter_TSDNS_Exception
+ added TeamSpeak3_Adapter_TSDNS
+ added TeamSpeak3_Helper_String::prepend()
+ added TeamSpeak3_Helper_Uri::getFQDNParts()
+ added TeamSpeak3_Node_Host::serverGetByTSDNS()
* TeamSpeak3::factory() URIs now supports optional server_tsdns parameter to
identify a virtual server without specifying an ID or port number

gnugeek
26-02-2011, 01:37
Will try first option, i think the serverquery credential mess is more clear now for me.
Thx for your time and work!


Best regards

stevegreen
27-02-2011, 12:33
Thank you for you framework, time and dedication. It's a fantastic service you offer the community. I would like to ask for any advice on my problem please...

I am using Joomla 1.6 with the JoomSimple Teamspeak 3 Server Viewer. It came with version 1.0.31b and I replaced the files with the latest version 1.1.4b. I had make some changes (with Grinsekatze's help - thanks!) but I am having problems with custom group/client icons not displaying and only showing broken image links. You can see it in action at http://www.royalbushtigers.com

You said before that caching wont help the file transfer connection, but I would like to use the built-in caching, as I sometimes get ban errors even though the IP has been whitelisted.

So I think the ftdata isnt' working for me (even if I turn off caching) and I wondered if it would be possible to change the ts3icon.php file to say something like:

- if ftdata process failed
- get channel/client icon id
- load local copy of icon_[id].png

Unfortunately I can only "read" little php and I have no idea what would be needed. Can anyone help me please?

Again, thank you for the framework -it's great, at the moment the only feed back I can suggest is that you improve the overview page on the documentation - adding an introduction section for complete idiots like me about the basic workings. All that code can be a bit daunting at first. But once I started to look into it the code became easier to understand.

Kind regards

ScP
27-02-2011, 21:46
You've entered an invalid path (/home/royalbus/public_html/modules/mod_joomsimple-teamspeak3-server-viewer/libs/TeamSpeak3/ts3icon.php) in your config. What you entered is the physical path on your server. You need to enter the URL...

:rolleyes:

stevegreen
28-02-2011, 10:17
Thank you for the tip! I changed the helper.php file from...


dirname(__FILE__).'/libs/TeamSpeak3/ts3icon.php')
to

JURI::base().'modules/mod_joomsimple-teamspeak3-server-viewer/libs/TeamSpeak3/ts3icon.php')

and the custom icons are now showing. Thank you!

gnugeek
01-03-2011, 18:11
Hi:

Right now guestquery perms are bugged(already reported it) so i never have perms to start my own server no matter whats in the guestquery group. But the problem is when i try to start my own server with valid GUEST credentials TeamSpeak3_Node_Server start method isnt returning an exception(becuase of perms) i get a 500 error from apache.


$ts3_ServerInstance = Teamspeak3::factory("serverquery://".$_SESSION['qlogin'].":".$_SESSION['qpassword']."@".$_SESSION['ipv4'].":10011/?server_port=".$_SESSION['port']."&use_offline_as_virtual=1");


if($ts3_ServerInstance["virtualserver_status"]!='online')

try
{
$ts3_ServerInstance->start();
}catch(Exception $e)
{
echo $e;
}


Apache error log


[01/03/2011 18:19:27] Error: Request for C:/Program Files (x86)/Zend/Apache2/htdocs/wts3/public/index.php: Unable to get the response from PHP process
[01/03/2011 18:19:27] Error: PHP process 4424 from the "application/x-httpd-php" pool has exited with status 255.
[01/03/2011 18:21:01] Error: Read data error - unable to get read result. Code 109.
[01/03/2011 18:21:01] Error: Request for C:/Program Files (x86)/Zend/Apache2/htdocs/wts3/public/index.php: Unable to get the response from PHP process
[01/03/2011 18:21:01] Error: PHP process 3860 from the "application/x-httpd-php" pool has exited with status 255.

ScP
02-03-2011, 10:34
Per default, ServerQuery guest clients are not allowed to start virtual servers so you should get an "insufficient permissions" error when you're trying to call the start() method on a TeamSpeak3_Node_Server object. Anyway... Why do you want to start the virtual server? With the first line of your code you're instructing the framework to connect, login and select the virtual server. Since you've also used the use_offline_as_virtual parameter, the virtual server will be started in virtual mode automatically if it's current status is "offline" so I don't understand your additional use of the start method().

About those messages in the logs... Which version of PHP is running on your server and how are you using it (e.g. Apache module or FCGI)?

Giddemore
02-03-2011, 13:38
Are there any restrictions on the format of a privilage key (token) needs to be? I'd like to generate a bunch of them in advance with MySQL and just stick them in the tokens table. I've just been using PHP code to generate a SHA hash based on the date and time to make things unique...

sha1(date('l jS \of F Y h:i:s A'))

That seems to be working fine, but I wanted to make sure there isn't a more acceptable way. I'd love to do it with the TS3 PHP framework but I couldn't figure out how to echo back the auto generated key back to a webpage upon creation.

Also how is the column token_created generated? Is it some format of the date or time? I couldn't deduce the structure so I just use a random string of numbers.

gnugeek
02-03-2011, 13:46
Per default, ServerQuery guest clients are not allowed to start virtual servers so you should get an "insufficient permissions" error when you're trying to call the start() method on a TeamSpeak3_Node_Server object.

My guestquery group have start/stop own server checked, but as i told you its bugged and you are never able to start it with guest credentials thats why it should return an exception because of perms

http://forum.teamspeak.com/showthread.php/62477-guestquery-perms


Why do you want to start the virtual server? With the first line of your code you're instructing the framework to connect, login and select the virtual server. Since you've also used the use_offline_as_virtual parameter, the virtual server will be started in virtual mode automatically if it's current status is "offline" so I don't understand your additional use of the start method().

I want to start it that way because in the web panel, clients can stop it and start it and if i dont use the virtual parameter i get exceptions when i try to start it when the server is stopped.


About those messages in the logs... Which version of PHP is running on your server and how are you using it (e.g. Apache module or FCGI)?

Apache 2.2.15
PHP Apache module
PHP 5.3.2

Mavrik347
11-03-2011, 06:40
Hi, I have a bit of a problem :/

This is me just testing that I can get it working before I build an app out of it.

$ts3_VirtualServer = TeamSpeak3::factory("serverquery://".$tsname.":".$tspass."@".$tshost.":".$tsport."/?server_port=".$tscport);
// set client
$client = "16";
// set poke message
$msg = "Hello";
// poke
$ts3_VirtualServer->clientPoke($client, $msg);


It works... But it uses the clientID, the clientID changes every time a person leaves/joins the server. Is there any way to make functions like these use the Database ID which doesn't change?

The reason being that I am making a registration system that grants people right on TS and puts their details into a SQL database (on the webserver). It then periodically checks (from the details in the SQL database) if their rights are still valid. If not then it removes them from Teamspeak.

I can't see how you can delete someone from the Teamspeak database by using a clientID that changes all the time because you can't fix it to a person like you can Unique IDs and Database IDs. :/

I'm pretty new to this so maybe I have misunderstood. Can anyone clear this up for me?

EDIT: After a little tinkle I found clientGetByUid(), perfect! Except I can't get it to work on one line :(


$ts3_VirtualServer->clientGetByUid("MY UID HERE")->clientPoke($msg);


Warning: Missing argument 2 for TeamSpeak3_Node_Server::clientPoke() in /home/sever/public_html/mav/ts/TeamSpeak3/Node/Server.php on line 818

Fatal error: Uncaught exception 'TeamSpeak3_Adapter_ServerQuery_Exception' with message 'convert error' in /home/sever/public_html/mav/ts/TeamSpeak3/Adapter/ServerQuery/Reply.php:305 Stack trace: #0 /home/sever/public_html/mav/ts/TeamSpeak3/Adapter/ServerQuery/Reply.php(82): TeamSpeak3_Adapter_ServerQuery_Reply->fetchError(Object(TeamSpeak3_Helper_String)) #1 /home/sever/public_html/mav/ts/TeamSpeak3/Adapter/ServerQuery.php(140): TeamSpeak3_Adapter_ServerQuery_Reply->__construct(Array, 'clientpoke clid...', Object(TeamSpeak3_Node_Host)) #2 /home/sever/public_html/mav/ts/TeamSpeak3/Node/Abstract.php(72): TeamSpeak3_Adapter_ServerQuery->request('clientpoke clid...') #3 /home/sever/public_html/mav/ts/TeamSpeak3/Node/Server.php(89): TeamSpeak3_Node_Abstract->request('clientpoke clid...') #4 /home/sever/public_html/mav/ts/TeamSpeak3/Node/Abstract.php(96): TeamSpeak3_Node_Server->request('clientpoke clid...') #5 /home/sever/public_html/mav/ts/TeamSpeak3/Node/Server.php(820): TeamSpeak3_Node_Abstract->execute('clientpoke', Array in /home/sever/public_html/mav/ts/TeamSpeak3/Adapter/ServerQuery/Reply.php on line 305

Is this the only way?

// get clientID
$clientID = $ts3_VirtualServer->clientGetByUid($clientUID);
// poke it
$ts3_VirtualServer->clientPoke($clientID, $msg);

ScP
11-03-2011, 12:35
EDIT: After a little tinkle I found clientGetByUid(), perfect! Except I can't get it to work on one line :(You're on the right way here, but you're using the wrong method to do the poke. This posting might be helpful (it's a kick example but similar to what you're trying to do):

http://forum.teamspeak.com/showthread.php/54132-NOW-AVAILABLE-TS3-PHP-Framework-1.1.4-beta?p=273805#post273805

The clientGetByUid() method returns a TeamSpeak3_Node_Client object. I've built all methods so that you can pass the objects instead of IDs - that's why your code is working. Your only mistake is that you were calling the clientPoke() method on the client object. Since this method does not exist within TeamSpeak3_Node_Client, the framework automatically tries to call that method on the parent TeamSpeak3_Node_Server object.

Sounds weird huh? Anyway... this is the code you need:


$ts3_VirtualServer->clientGetByUid("some cluid")->poke($msg);:)

Mavrik347
11-03-2011, 17:30
That's actually quite clever... Thanks :)

EDIT: Ignore, found it :p lol

Just another question. How do you go about catching exceptions?


try {
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://".$tsname.":".$tspass."@".$tshost.":".$tsport."/?server_port=".$tscport);
$ts3_VirtualServer->clientGetByUid($tsUniqueID)->Kick(TeamSpeak3::KICK_SERVER, "It worked!");
} catch (CATCH EXCEPTION) {
echo "ECHO EXCEPTION";
}

Should a condition be met I want someone to be kicked. Now I tested it on myself and it works if I'm in the server but the person may not always be in the server. If they aren't it throws this at me.

Fatal error: Uncaught exception 'TeamSpeak3_Adapter_ServerQuery_Exception' with message 'invalid client type' in /home/sever/public_html/mav/ts/TeamSpeak3/Adapter/ServerQuery/Reply.php:305 Stack trace: #0 /home/sever/public_html/mav/ts/TeamSpeak3/Adapter/ServerQuery/Reply.php(82): TeamSpeak3_Adapter_ServerQuery_Reply->fetchError(Object(TeamSpeak3_Helper_String)) #1 /home/sever/public_html/mav/ts/TeamSpeak3/Adapter/ServerQuery.php(140): TeamSpeak3_Adapter_ServerQuery_Reply->__construct(Array, 'clientkick clid...', Object(TeamSpeak3_Node_Host)) #2 /home/sever/public_html/mav/ts/TeamSpeak3/Node/Abstract.php(72): TeamSpeak3_Adapter_ServerQuery->request('clientkick clid...') #3 /home/sever/public_html/mav/ts/TeamSpeak3/Node/Server.php(89): TeamSpeak3_Node_Abstract->request('clientkick clid...') #4 /home/sever/public_html/mav/ts/TeamSpeak3/Node/Abstract.php(96): TeamSpeak3_Node_Server->request('clientkick clid...') #5 /home/sever/public_html/mav/ts/TeamSpeak3/Node/Server.php(808): TeamSpeak3_Node_Abstract->execute('clientkick', in /home/sever/public_html/mav/ts/TeamSpeak3/Adapter/ServerQuery/Reply.php on line 305

So I have to use a try statement. If they aren't in the server then its fine and they dont need to be kicked obviously so if it fails like that its ok. But I obviously don't want a fatal error because I have other things to do and other people to check.

Answer:


try {
$ts3_VirtualServer->clientGetByUid($tsUniqueID)->Kick(TeamSpeak3::KICK_SERVER, "Teamspeak Access Revoked. If this is incorrect contact MJ Maverick");
} catch (TeamSpeak3_Exception $e) {
echo "User could not be kicked. Probably wasn't connected in the first place. (Error: ".$e->getMessage().")";
}

maggy
17-03-2011, 00:57
IIRC, you can just say "catch (Exception $e)" since the exceptions defined in the library are extended from the base PHP Exception class. Right?

ScP
17-03-2011, 10:04
IIRC, you can just say "catch (Exception $e)" since the exceptions defined in the library are extended from the base PHP Exception class. Right?That is correct.

:)

Mavrik347
18-03-2011, 22:31
Ah thanks :)

I've hit a problem with my app, I was wondering if you could help.

I need to get a user by their Nickname on TS (they will be on the server), then get that persons Database ID, UniqueID and then add them to a server group.

Example:


$nickname = "BOB Lee";
$DID = $ts3_VirtualServer->getThisClient($nickname)->getDatabaseID;
$UniqueID = $ts3_VirtualServer->getThisClient($nickname)->getUniqueID;

$ts3_VirtualServer->getThisClient($nickname)->addServerGroup($sgid);

// Store other stuff including $DID and $UniqueID in database for cron jobs later (easy)


But I can't find a function that does the job of getThisClient($nickname) or getDatabaseID in docs.

ScP
19-03-2011, 01:03
How about these two methods:


TeamSpeak3_Node_Server::clientGetByName() (http://docs.planetteamspeak.com/ts3/php/framework/class_team_speak3___node___server.html#a3bd7e2be71 de3187099ef1446f1a186b)
TeamSpeak3_Node_Client::addServerGroup() (http://docs.planetteamspeak.com/ts3/php/framework/class_team_speak3___node___client.html#a70f773eefe 1d4f67f5c15974ca609a6d)


$server->clientGetByName("ScP")->addServerGroup(123);