TeamSpeak 3 PHP Framework
Modern use-at-will framework that provides individual components to manage TeamSpeak 3 Server instances
TeamSpeak3_Node_Server Class Reference

Class describing a TeamSpeak 3 virtual server and all it's parameters. More...

+ Inheritance diagram for TeamSpeak3_Node_Server:

Public Member Functions

 __construct (TeamSpeak3_Node_Host $host, array $info, $index="virtualserver_id")
 The TeamSpeak3_Node_Server constructor. More...
 
 __toString ()
 Returns a string representation of this node. More...
 
 banCreate (array $rules, $timeseconds=null, $reason=null)
 Adds a new ban rule on the selected virtual server. More...
 
 banDelete ($banid)
 Deletes the specified ban rule from the server. More...
 
 banList ()
 Returns a list of active bans on the selected virtual server. More...
 
 banListClear ()
 Deletes all active ban rules from the server. More...
 
 channelClientPermAssign ($cid, $cldbid, $permid, $permvalue)
 Adds a set of specified permissions to a client in a specific channel. More...
 
 channelClientPermList ($cid, $cldbid, $permsid=FALSE)
 Returns a list of permissions defined for a client in a specific channel. More...
 
 channelClientPermRemove ($cid, $cldbid, $permid)
 Removes a set of specified permissions from a client in a specific channel. More...
 
 channelCreate (array $properties)
 Creates a new channel using given properties and returns the new ID. More...
 
 channelDelete ($cid, $force=FALSE)
 Deletes the channel specified by $cid. More...
 
 channelDirCreate ($cid, $cpw="", $dirname="/")
 Creates new directory in a channels file repository. More...
 
 channelFileDelete ($cid, $cpw="", $name="/")
 Deletes one or more files stored in a channels file repository. More...
 
 channelFileInfo ($cid, $cpw="", $name="/")
 Returns detailed information about the specified file stored in a channels file repository. More...
 
 channelFileList ($cid, $cpw="", $path="/", $recursive=FALSE)
 Returns a list of files and directories stored in the specified channels file repository. More...
 
 channelFileRename ($cid, $cpw="", $oldname="/", $newname="/", $tcid=null, $tcpw=null)
 Renames a file in a channels file repository. More...
 
 channelGetById ($cid)
 Returns the TeamSpeak3_Node_Channel object matching the given ID. More...
 
 channelGetByName ($name)
 Returns the TeamSpeak3_Node_Channel object matching the given name. More...
 
 channelGetDefault ()
 Returns the TeamSpeak3_Node_Channel object representing the default channel. More...
 
 channelGetLevel ($cid)
 Returns the level of a channel. More...
 
 channelGetPathway ($cid)
 Returns the pathway of a channel which can be used as a clients default channel. More...
 
 channelGroupClientList ($cgid=null, $cid=null, $cldbid=null, $resolve=FALSE)
 Returns all the client and/or channel IDs currently assigned to channel groups. More...
 
 channelGroupCopy ($scgid, $name=null, $tcgid=0, $type=TeamSpeak3::GROUP_DBTYPE_REGULAR)
 Creates a copy of an existing channel group specified by $scgid and returns the new groups ID. More...
 
 channelGroupCreate ($name, $type=TeamSpeak3::GROUP_DBTYPE_REGULAR)
 Creates a new channel group using the name specified with $name and returns its ID. More...
 
 channelGroupDelete ($cgid, $force=FALSE)
 Deletes the channel group specified with $cgid. More...
 
 channelGroupGetById ($cgid)
 Returns the TeamSpeak3_Node_Channelgroup object matching the given ID. More...
 
 channelGroupGetByName ($name, $type=TeamSpeak3::GROUP_DBTYPE_REGULAR)
 Returns the TeamSpeak3_Node_Channelgroup object matching the given name. More...
 
 channelGroupList (array $filter=array())
 Returns a list of channel groups available. More...
 
 channelGroupListReset ()
 Resets the list of channel groups. More...
 
 channelGroupPermAssign ($cgid, $permid, $permvalue)
 Adds a set of specified permissions to the channel group specified. More...
 
 channelGroupPermList ($cgid, $permsid=FALSE)
 Returns a list of permissions assigned to the channel group specified. More...
 
 channelGroupPermRemove ($cgid, $permid)
 Removes a set of specified permissions from the channel group specified with $cgid. More...
 
 channelGroupRename ($cgid, $name)
 Renames the channel group specified with $cgid. More...
 
 channelIsSpacer (TeamSpeak3_Node_Channel $channel)
 Returns TRUE if the given TeamSpeak3_Node_Channel object is a spacer. More...
 
 channelList (array $filter=array())
 Returns an array filled with TeamSpeak3_Node_Channel objects. More...
 
 channelListReset ()
 Resets the list of channels online. More...
 
 channelMove ($cid, $pid, $order=null)
 Moves the channel specified by $cid to the parent channel specified with $pid. More...
 
 channelPermAssign ($cid, $permid, $permvalue)
 Adds a set of specified permissions to a channel. More...
 
 channelPermList ($cid, $permsid=FALSE)
 Returns a list of permissions defined for a specific channel. More...
 
 channelPermRemove ($cid, $permid)
 Removes a set of specified permissions from a channel. More...
 
 channelSpacerCreate ($ident, $type=TeamSpeak3::SPACER_SOLIDLINE, $align=TeamSpeak3::SPACER_ALIGN_REPEAT, $order=null, $maxclients=0)
 Creates a new channel spacer and returns the new ID. More...
 
 channelSpacerGetAlign ($cid)
 Returns the possible alignment of a channel spacer. More...
 
 channelSpacerGetType ($cid)
 Returns the possible type of a channel spacer. More...
 
 clientBan ($clid, $timeseconds=null, $reason=null)
 Bans the client specified with ID $clid from the server. More...
 
 clientCount ()
 Returns the number of regular clients online. More...
 
 clientCountDb ()
 Returns the number of client identities known by the virtual server. More...
 
 clientDeleteDb ($cldbid)
 Deletes a clients properties from the database. More...
 
 clientFind ($pattern)
 Returns a list of clients matching a given name pattern. More...
 
 clientFindDb ($pattern, $uid=FALSE)
 Returns a list of client database IDs matching a given pattern. More...
 
 clientGetByDbid ($dbid)
 Returns the TeamSpeak3_Node_Client object matching the given database ID. More...
 
 clientGetById ($clid)
 Returns the TeamSpeak3_Node_Client object matching the given ID. More...
 
 clientGetByName ($name)
 Returns the TeamSpeak3_Node_Client object matching the given name. More...
 
 clientGetByUid ($uid)
 Returns the TeamSpeak3_Node_Client object matching the given unique identifier. More...
 
 clientGetIdsByUid ($cluid)
 Returns an array containing a list of active client connections using the unique identifier specified with $cluid. More...
 
 clientGetNameByDbid ($cldbid)
 Returns an array containing the last known nickname and the unique identifier of the client matching the database ID specified with $cldbid. More...
 
 clientGetNameByUid ($cluid)
 Returns an array containing the last known nickname and the database ID of the client matching the unique identifier specified with $cluid. More...
 
 clientGetServerGroupsByDbid ($cldbid)
 Returns an array containing the names and IDs of all server groups the client specified with $cldbid is is currently residing in. More...
 
 clientInfoDb ($cldbid)
 Returns a list of properties from the database for the client specified by $cldbid. More...
 
 clientKick ($clid, $reasonid=TeamSpeak3::KICK_CHANNEL, $reasonmsg=null)
 Kicks one or more clients from their currently joined channel or from the server. More...
 
 clientList (array $filter=array())
 Returns an array filled with TeamSpeak3_Node_Client objects. More...
 
 clientListDb ($offset=null, $limit=null)
 Returns a list of client identities known by the virtual server. More...
 
 clientListReset ()
 Resets the list of clients online. More...
 
 clientModifyDb ($cldbid, array $properties)
 Changes the clients properties using given properties. More...
 
 clientMove ($clid, $cid, $cpw=null)
 Moves a client to another channel. More...
 
 clientPermAssign ($cldbid, $permid, $permvalue, $permskip=FALSE)
 Adds a set of specified permissions to a client. More...
 
 clientPermList ($cldbid, $permsid=FALSE)
 Returns a list of permissions defined for a client. More...
 
 clientPermRemove ($cldbid, $permid)
 Removes a set of specified permissions from a client. More...
 
 clientPoke ($clid, $msg)
 Sends a poke message to a client. More...
 
 clientSetChannelGroup ($cldbid, $cid, $cgid)
 Sets the channel group of a client to the ID specified. More...
 
 complaintCreate ($tcldbid, $message)
 Submits a complaint about the client with database ID $tcldbid to the server. More...
 
 complaintDelete ($tcldbid, $fcldbid)
 Deletes the complaint about the client with ID $tcldbid submitted by the client with ID $fcldbid from the server. More...
 
 complaintList ($tcldbid=null)
 Returns a list of complaints on the selected virtual server. More...
 
 complaintListClear ($tcldbid)
 Deletes all active complaints about the client with database ID $tcldbid from the server. More...
 
 connectionInfo ()
 Returns detailed connection information of the virtual server. More...
 
 customInfo ($cldbid)
 Returns a list of custom properties for the client specified by $cldbid. More...
 
 customSearch ($ident, $pattern="%")
 Returns a list of custom client properties specified by $ident. More...
 
 delete ()
 Deletes the virtual server. More...
 
 getIcon ()
 Returns the name of a possible icon to display the node object. More...
 
 getSymbol ()
 Returns a symbol representing the node. More...
 
 getUniqueId ()
 Returns a unique identifier for the node which can be used as a HTML property. More...
 
 iconDownload ()
 Downloads and returns the servers icon file content. More...
 
 iconUpload ($data)
 Uploads a given icon file content to the server and returns the ID of the icon. More...
 
 isOffline ()
 Returns TRUE if the virtual server is offline. More...
 
 isOnline ()
 Returns TRUE if the virtual server is online. More...
 
 logAdd ($logmsg, $loglevel=TeamSpeak3::LOGLEVEL_INFO)
 Writes a custom entry into the virtual server log. More...
 
 logView ($lines=30, $begin_pos=null, $reverse=null, $instance=null)
 Displays a specified number of entries (1-100) from the servers log. More...
 
 message ($msg)
 Sends a text message to all clients on the virtual server. More...
 
 messageCreate ($cluid, $subject, $message)
 Sends an offline message to the client specified by $cluid. More...
 
 messageDelete ($msgid)
 Deletes an existing offline message with ID $msgid from your inbox. More...
 
 messageList ()
 Returns a list of offline messages you've received. More...
 
 messageRead ($msgid, $flag_read=TRUE)
 Returns an existing offline message with ID $msgid from your inbox. More...
 
 modify (array $properties)
 Changes the virtual server configuration using given properties. More...
 
 notifyRegister ($event, $id=0)
 Registers for a specified category of events on a virtual server to receive notification messages. More...
 
 notifyUnregister ()
 Unregisters all events previously registered with servernotifyregister so you will no longer receive notification messages. More...
 
 permRemoveAny ($permid)
 Removes any assignment of the permission specified with $permid on the selected virtual server and returns the number of removed assignments on success. More...
 
 permReset ()
 Restores the default permission settings on the virtual server and returns a new initial administrator privilege key. More...
 
 privilegeKeyCreate ($type=TeamSpeak3::TOKEN_SERVERGROUP, $id1, $id2=0, $description=null, $customset=null)
 Creates a new privilege key (token) and returns the key. More...
 
 privilegeKeyDelete ($token)
 Deletes a token specified by key $token. More...
 
 privilegeKeyList ($resolve=FALSE)
 Returns a list of privilege keys (tokens) available. More...
 
 privilegeKeyUse ($token)
 Use a token key gain access to a server or channel group. More...
 
 request ($cmd, $throw=TRUE)
 Sends a prepared command to the server and returns the result. More...
 
 selfPermOverview ()
 Returns an array containing the permission overview of your own client. More...
 
 selfUpdate (array $properties)
 Changes the properties of your own client connection. More...
 
 selfUpdateLogin ($username)
 Updates your own ServerQuery login credentials using a specified username. More...
 
 sendPluginCmd ($plugin, $data)
 Sends a plugin command to all clients connected to the server. More...
 
 serverGroupClientAdd ($sgid, $cldbid)
 Adds a client to the server group specified. More...
 
 serverGroupClientDel ($sgid, $cldbid)
 Removes a client from the server group specified. More...
 
 serverGroupClientList ($sgid)
 Returns a list of clients assigned to the server group specified. More...
 
 serverGroupCopy ($ssgid, $name=null, $tsgid=0, $type=TeamSpeak3::GROUP_DBTYPE_REGULAR)
 Creates a copy of an existing server group specified by $ssgid and returns the new groups ID. More...
 
 serverGroupCreate ($name, $type=TeamSpeak3::GROUP_DBTYPE_REGULAR)
 Creates a new server group using the name specified with $name and returns its ID. More...
 
 serverGroupDelete ($sgid, $force=FALSE)
 Deletes the server group specified with $sgid. More...
 
 serverGroupGetById ($sgid)
 Returns the TeamSpeak3_Node_Servergroup object matching the given ID. More...
 
 serverGroupGetByName ($name, $type=TeamSpeak3::GROUP_DBTYPE_REGULAR)
 Returns the TeamSpeak3_Node_Servergroup object matching the given name. More...
 
 serverGroupGetProfiles ($type=TeamSpeak3::GROUP_DBTYPE_REGULAR)
 Returns an ordered array of regular server groups available based on a pre-defined set of rules. More...
 
 serverGroupIdentify ($mode=TeamSpeak3::GROUP_IDENTIFIY_STRONGEST, $type=TeamSpeak3::GROUP_DBTYPE_REGULAR)
 Tries to identify the post powerful/weakest server group on the virtual server and returns the ID. More...
 
 serverGroupList (array $filter=array())
 Returns a list of server groups available. More...
 
 serverGroupListReset ()
 Resets the list of server groups. More...
 
 serverGroupPermAssign ($sgid, $permid, $permvalue, $permnegated=FALSE, $permskip=FALSE)
 Adds a set of specified permissions to the server group specified. More...
 
 serverGroupPermList ($sgid, $permsid=FALSE)
 Returns a list of permissions assigned to the server group specified. More...
 
 serverGroupPermRemove ($sgid, $permid)
 Removes a set of specified permissions from the server group specified with $sgid. More...
 
 serverGroupRename ($sgid, $name)
 Renames the server group specified with $sgid. More...
 
 snapshotCreate ($mode=TeamSpeak3::SNAPSHOT_STRING)
 Creates and returns snapshot data for the selected virtual server. More...
 
 snapshotDeploy ($data, $mode=TeamSpeak3::SNAPSHOT_STRING)
 Deploys snapshot data on the selected virtual server. More...
 
 start ()
 Starts the virtual server. More...
 
 stop ()
 Stops the virtual server. More...
 
 tempPasswordCreate ($pw, $duration, $tcid=0, $tcpw="", $desc="")
 Sets a new temporary server password specified with $pw. More...
 
 tempPasswordDelete ($pw)
 Deletes the temporary server password specified with $pw. More...
 
 tempPasswordList ($resolve=FALSE)
 Returns a list of temporary server passwords. More...
 
 tokenCreate ($type=TeamSpeak3::TOKEN_SERVERGROUP, $id1, $id2=0, $description=null, $customset=null)
 Alias for privilegeKeyCreate(). More...
 
 tokenDelete ($token)
 Alias for privilegeKeyDelete(). More...
 
 tokenList ($translate=FALSE)
 Alias for privilegeKeyList(). More...
 
 tokenUse ($token)
 Alias for privilegeKeyUse(). More...
 
 transferInitDownload ($clientftfid, $cid, $name, $cpw="", $seekpos=0)
 Initializes a file transfer download. More...
 
 transferInitUpload ($clientftfid, $cid, $name, $size, $cpw="", $overwrite=FALSE, $resume=FALSE)
 Initializes a file transfer upload. More...
 
 transferList ()
 Displays a list of running file transfers on the selected virtual server. More...
 
 transferStop ($serverftfid, $delete=FALSE)
 Stops the running file transfer with server-side ID $serverftfid. More...
 
- Public Member Functions inherited from TeamSpeak3_Node_Abstract
 __call ($name, array $args)
 Called whenever we're using an unknown method. More...
 
 __get ($offset)
 
 __set ($offset, $value)
 
 __sleep ()
 Commit pending data. More...
 
 __toString ()
 Returns a string representation of this node. More...
 
 count ()
 
 current ()
 
 execute ($cmd, array $params=array())
 Prepares and executes a ServerQuery command and returns the result. More...
 
 getChildren ()
 
 getClass ($prefix="ts3_")
 Returns a possible classname for the node which can be used as a HTML property. More...
 
 getIcon ()
 Returns the name of a possible icon to display the node object. More...
 
 getId ()
 Returns the primary ID of the current node. More...
 
 getInfo ($extend=TRUE, $convert=FALSE)
 Returns all information available on this node. More...
 
 getParent ()
 Returns the parent object of the current node. More...
 
 getProperty ($property, $default=null)
 Returns the specified property or a pre-defined default value from the node info array. More...
 
 getSymbol ()
 Returns a symbol representing the node. More...
 
 getUniqueId ()
 Returns a unique identifier for the node which can be used as a HTML property. More...
 
 getViewer (TeamSpeak3_Viewer_Interface $viewer)
 Returns the HTML code to display a TeamSpeak 3 viewer. More...
 
 hasChildren ()
 
 hasNext ()
 
 iconGetName ($key)
 Returns the internal path of the node icon. More...
 
 iconIsLocal ($key)
 Returns TRUE if the node icon has a local source. More...
 
 key ()
 
 next ()
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 prepare ($cmd, array $params=array())
 Uses given parameters and returns a prepared ServerQuery command. More...
 
 request ($cmd, $throw=TRUE)
 Sends a prepared command to the server and returns the result. More...
 
 rewind ()
 
 toArray ()
 Returns an assoc array filled with current node info properties. More...
 
 toString ()
 Returns a string representation of this node. More...
 
 valid ()
 

Protected Member Functions

 fetchNodeInfo ()
 
 fetchNodeList ()
 
- Protected Member Functions inherited from TeamSpeak3_Node_Abstract
 delStorage ($key)
 Deletes data from the internal storage array. More...
 
 fetchNodeInfo ()
 
 fetchNodeList ()
 
 filterList (array $nodes=array(), array $rules=array())
 Filters given node list array using specified filter rules. More...
 
 getStorage ($key, $default=null)
 Returns data from the internal storage array. More...
 
 resetNodeInfo ()
 
 resetNodeList ()
 
 setStorage ($key, $val)
 Writes data to the internal storage array. More...
 
 verifyNodeList ()
 

Static Protected Member Functions

static sortClientList (TeamSpeak3_Node_Client $a, TeamSpeak3_Node_Client $b)
 Internal callback funtion for sorting of client objects. More...
 
static sortFileList (array $a, array $b)
 Internal callback funtion for sorting of file list items. More...
 
static sortGroupList (TeamSpeak3_Node_Abstract $a, TeamSpeak3_Node_Abstract $b)
 Internal callback funtion for sorting of group objects. More...
 

Protected Attributes

 $cgroupList = null
 
 $channelList = null
 
 $clientList = null
 
 $sgroupList = null
 
- Protected Attributes inherited from TeamSpeak3_Node_Abstract
 $nodeId = 0x00
 
 $nodeInfo = array()
 
 $nodeList = null
 
 $parent = null
 
 $server = null
 
 $storage = array()
 

Detailed Description

Class describing a TeamSpeak 3 virtual server and all it's parameters.

Constructor & Destructor Documentation

◆ __construct()

__construct ( TeamSpeak3_Node_Host  $host,
array  $info,
  $index = "virtualserver_id" 
)

The TeamSpeak3_Node_Server constructor.

Parameters
TeamSpeak3_Node_Host$host
array$info
string$index
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Server
61  {
62  $this->parent = $host;
63  $this->nodeInfo = $info;
64 
65  if(!array_key_exists($index, $this->nodeInfo))
66  {
67  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid serverID", 0x400);
68  }
69 
70  $this->nodeId = $this->nodeInfo[$index];
71  }
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29

Member Function Documentation

◆ __toString()

__toString ( )

Returns a string representation of this node.

Returns
string
2565  {
2566  return (string) $this["virtualserver_name"];
2567  }

◆ banCreate()

banCreate ( array  $rules,
  $timeseconds = null,
  $reason = null 
)

Adds a new ban rule on the selected virtual server.

All parameters are optional but at least one of the following rules must be set: ip, name, or uid.

Parameters
array$rules
integer$timeseconds
string$reason
Returns
integer
2133  {
2134  $rules["time"] = $timeseconds;
2135  $rules["banreason"] = $reason;
2136 
2137  $banid = $this->execute("banadd", $rules)->toList();
2138 
2139  return $banid["banid"];
2140  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ banDelete()

banDelete (   $banid)

Deletes the specified ban rule from the server.

Parameters
integer$banid
Returns
void
2149  {
2150  $this->execute("bandel", array("banid" => $banid));
2151  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ banList()

banList ( )

Returns a list of active bans on the selected virtual server.

Returns
array
2109  {
2110  return $this->request("banlist")->toAssocArray("banid");
2111  }
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80

◆ banListClear()

banListClear ( )

Deletes all active ban rules from the server.

Returns
void
2119  {
2120  $this->request("bandelall");
2121  }
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80

◆ channelClientPermAssign()

channelClientPermAssign (   $cid,
  $cldbid,
  $permid,
  $permvalue 
)

Adds a set of specified permissions to a client in a specific channel.

Multiple permissions can be added by providing the two parameters of each permission.

Parameters
integer$cid
integer$cldbid
integer$permid
integer$permvalue
Returns
void
433  {
434  if(!is_array($permid))
435  {
436  $permident = (is_numeric($permid)) ? "permid" : "permsid";
437  }
438  else
439  {
440  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
441  }
442 
443  $this->execute("channelclientaddperm", array("cid" => $cid, "cldbid" => $cldbid, $permident => $permid, "permvalue" => $permvalue));
444  }
current()
Definition: Abstract.php:482
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelClientPermList()

channelClientPermList (   $cid,
  $cldbid,
  $permsid = FALSE 
)

Returns a list of permissions defined for a client in a specific channel.

Parameters
integer$cid
integer$cldbid
boolean$permsid
Returns
array
418  {
419  return $this->execute("channelclientpermlist", array("cid" => $cid, "cldbid" => $cldbid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
420  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelClientPermRemove()

channelClientPermRemove (   $cid,
  $cldbid,
  $permid 
)

Removes a set of specified permissions from a client in a specific channel.

Multiple permissions can be removed at once.

Parameters
integer$cid
integer$cldbid
integer$permid
Returns
void
455  {
456  if(!is_array($permid))
457  {
458  $permident = (is_numeric($permid)) ? "permid" : "permsid";
459  }
460  else
461  {
462  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
463  }
464 
465  $this->execute("channelclientdelperm", array("cid" => $cid, "cldbid" => $cldbid, $permident => $permid));
466  }
current()
Definition: Abstract.php:482
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelCreate()

channelCreate ( array  $properties)

Creates a new channel using given properties and returns the new ID.

Parameters
array$properties
Returns
integer
149  {
150  $cid = $this->execute("channelcreate", $properties)->toList();
151  $this->channelListReset();
152 
153  if(!isset($properties["channel_flag_permanent"]) && !isset($properties["channel_flag_semi_permanent"]))
154  {
155  $this->getParent()->whoamiSet("client_channel_id", $cid["cid"]);
156  }
157 
158  return $cid["cid"];
159  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92
channelListReset()
Resets the list of channels online.
Definition: Server.php:120

◆ channelDelete()

channelDelete (   $cid,
  $force = FALSE 
)

Deletes the channel specified by $cid.

Parameters
integer$cid
boolean$force
Returns
void
169  {
170  $this->execute("channeldelete", array("cid" => $cid, "force" => $force));
171  $this->channelListReset();
172 
173  if(($cid instanceof TeamSpeak3_Node_Abstract ? $cid->getId() : $cid) == $this->whoamiGet("client_channel_id"))
174  {
175  $this->getParent()->whoamiReset();
176  }
177  }
Abstract class describing a TeamSpeak 3 node and all it's parameters.
Definition: Abstract.php:29
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92
channelListReset()
Resets the list of channels online.
Definition: Server.php:120

◆ channelDirCreate()

channelDirCreate (   $cid,
  $cpw = "",
  $dirname = "/" 
)

Creates new directory in a channels file repository.

Parameters
integer$cid
string$cpw
string$dirname
Returns
void
561  {
562  $this->execute("ftcreatedir", array("cid" => $cid, "cpw" => $cpw, "dirname" => $dirname));
563  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelFileDelete()

channelFileDelete (   $cid,
  $cpw = "",
  $name = "/" 
)

Deletes one or more files stored in a channels file repository.

Parameters
integer$cid
string$cpw
string$name
Returns
void
548  {
549  $this->execute("ftdeletefile", array("cid" => $cid, "cpw" => $cpw, "name" => $name));
550  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelFileInfo()

channelFileInfo (   $cid,
  $cpw = "",
  $name = "/" 
)

Returns detailed information about the specified file stored in a channels file repository.

Parameters
integer$cid
string$cpw
string$name
Returns
array
516  {
517  $info = $this->execute("ftgetfileinfo", array("cid" => $cid, "cpw" => $cpw, "name" => $name))->toArray();
518 
519  return array_pop($info);
520  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelFileList()

channelFileList (   $cid,
  $cpw = "",
  $path = "/",
  $recursive = FALSE 
)

Returns a list of files and directories stored in the specified channels file repository.

Parameters
integer$cid
string$cpw
string$path
boolean$recursive
Returns
array
478  {
479  $files = $this->execute("ftgetfilelist", array("cid" => $cid, "cpw" => $cpw, "path" => $path))->toArray();
480  $count = count($files);
481 
482  for($i = 0; $i < $count; $i++)
483  {
484  $files[$i]["sid"] = $this->getId();
485  $files[$i]["cid"] = $files[0]["cid"];
486  $files[$i]["path"] = $files[0]["path"];
487  $files[$i]["src"] = new TeamSpeak3_Helper_String($cid ? $files[$i]["path"] : "/");
488 
489  if(!$files[$i]["src"]->endsWith("/"))
490  {
491  $files[$i]["src"]->append("/");
492  }
493 
494  $files[$i]["src"]->append($files[$i]["name"]);
495 
496  if($recursive && $files[$i]["type"] == TeamSpeak3::FILE_TYPE_DIRECTORY)
497  {
498  $files = array_merge($files, $this->channelFileList($cid, $cpw, $path . $files[$i]["name"], $recursive));
499  }
500  }
501 
502  uasort($files, array(__CLASS__, "sortFileList"));
503 
504  return $files;
505  }
Helper class for string handling.
Definition: String.php:29
const FILE_TYPE_DIRECTORY
0: file is directory
Definition: TeamSpeak3.php:217
count()
Definition: Abstract.php:472
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92
channelFileList($cid, $cpw="", $path="/", $recursive=FALSE)
Returns a list of files and directories stored in the specified channels file repository.
Definition: Server.php:477

◆ channelFileRename()

channelFileRename (   $cid,
  $cpw = "",
  $oldname = "/",
  $newname = "/",
  $tcid = null,
  $tcpw = null 
)

Renames a file in a channels file repository.

If the two parameters $tcid and $tcpw are specified, the file will be moved into another channels file repository.

Parameters
integer$cid
string$cpw
string$oldname
string$newname
integer$tcid
string$tcpw
Returns
void
535  {
536  $this->execute("ftrenamefile", array("cid" => $cid, "cpw" => $cpw, "oldname" => $oldname, "newname" => $newname, "tcid" => $tcid, "tcpw" => $tcpw));
537  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelGetById()

channelGetById (   $cid)

Returns the TeamSpeak3_Node_Channel object matching the given ID.

Parameters
integer$cid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Channel
611  {
612  if(!array_key_exists((string) $cid, $this->channelList()))
613  {
614  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid channelID", 0x300);
615  }
616 
617  return $this->channelList[intval((string) $cid)];
618  }
channelList(array $filter=array())
Returns an array filled with TeamSpeak3_Node_Channel objects.
Definition: Server.php:96
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29

◆ channelGetByName()

channelGetByName (   $name)

Returns the TeamSpeak3_Node_Channel object matching the given name.

Parameters
string$name
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Channel
628  {
629  foreach($this->channelList() as $channel)
630  {
631  if($channel["channel_name"] == $name) return $channel;
632  }
633 
634  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid channelID", 0x300);
635  }
channelList(array $filter=array())
Returns an array filled with TeamSpeak3_Node_Channel objects.
Definition: Server.php:96
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29

◆ channelGetDefault()

channelGetDefault ( )

Returns the TeamSpeak3_Node_Channel object representing the default channel.

Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Channel
133  {
134  foreach($this->channelList() as $channel)
135  {
136  if($channel["channel_flag_default"]) return $channel;
137  }
138 
139  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid channelID", 0x300);
140  }
channelList(array $filter=array())
Returns an array filled with TeamSpeak3_Node_Channel objects.
Definition: Server.php:96
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29

◆ channelGetLevel()

channelGetLevel (   $cid)

Returns the level of a channel.

Parameters
integer$cid
Returns
integer
572  {
573  $channel = $this->channelGetById($cid);
574  $levelno = 0;
575 
576  if($channel["pid"])
577  {
578  $levelno = $this->channelGetLevel($channel["pid"])+1;
579  }
580 
581  return $levelno;
582  }
channelGetLevel($cid)
Returns the level of a channel.
Definition: Server.php:571
channelGetById($cid)
Returns the TeamSpeak3_Node_Channel object matching the given ID.
Definition: Server.php:610

◆ channelGetPathway()

channelGetPathway (   $cid)

Returns the pathway of a channel which can be used as a clients default channel.

Parameters
integer$cid
Returns
string
591  {
592  $channel = $this->channelGetById($cid);
593  $pathway = $channel["channel_name"];
594 
595  if($channel["pid"])
596  {
597  $pathway = $this->channelGetPathway($channel["pid"]) . "/" . $channel["channel_name"];
598  }
599 
600  return $pathway;
601  }
channelGetPathway($cid)
Returns the pathway of a channel which can be used as a clients default channel.
Definition: Server.php:590
channelGetById($cid)
Returns the TeamSpeak3_Node_Channel object matching the given ID.
Definition: Server.php:610

◆ channelGroupClientList()

channelGroupClientList (   $cgid = null,
  $cid = null,
  $cldbid = null,
  $resolve = FALSE 
)

Returns all the client and/or channel IDs currently assigned to channel groups.

All three parameters are optional so you're free to choose the most suitable combination for your requirements.

Parameters
integer$cgid
integer$cid
integer$cldbid
boolean$resolve
Returns
array
1568  {
1569  if($this["virtualserver_default_channel_group"] == $cgid)
1570  {
1571  return array();
1572  }
1573 
1574  try
1575  {
1576  $result = $this->execute("channelgroupclientlist", array("cgid" => $cgid, "cid" => $cid, "cldbid" => $cldbid))->toArray();
1577  }
1579  {
1580  /* ERROR_database_empty_result */
1581  if($e->getCode() != 0x501) throw $e;
1582 
1583  $result = array();
1584  }
1585 
1586  if($resolve)
1587  {
1588  foreach($result as $k => $v)
1589  {
1590  $result[$k] = array_merge($v, $this->clientInfoDb($v["cldbid"]));
1591  }
1592  }
1593 
1594  return $result;
1595  }
clientInfoDb($cldbid)
Returns a list of properties from the database for the client specified by $cldbid.
Definition: Server.php:717
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelGroupCopy()

channelGroupCopy (   $scgid,
  $name = null,
  $tcgid = 0,
  $type = TeamSpeak3::GROUP_DBTYPE_REGULAR 
)

Creates a copy of an existing channel group specified by $scgid and returns the new groups ID.

Parameters
integer$scgid
string$name
integer$tcgid
integer$type
Returns
integer
1422  {
1423  $this->channelGroupListReset();
1424 
1425  $cgid = $this->execute("channelgroupcopy", array("scgid" => $scgid, "tcgid" => $tcgid, "name" => $name, "type" => $type))->toList();
1426 
1427  if($tcgid && $name)
1428  {
1429  $this->channelGroupRename($tcgid, $name);
1430  }
1431 
1432  return count($cgid) ? $cgid["cgid"] : intval($tcgid);
1433  }
channelGroupRename($cgid, $name)
Renames the channel group specified with $cgid.
Definition: Server.php:1442
channelGroupListReset()
Resets the list of channel groups.
Definition: Server.php:1391
count()
Definition: Abstract.php:472
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelGroupCreate()

channelGroupCreate (   $name,
  $type = TeamSpeak3::GROUP_DBTYPE_REGULAR 
)

Creates a new channel group using the name specified with $name and returns its ID.

Parameters
string$name
integer$type
Returns
integer
1404  {
1405  $this->channelGroupListReset();
1406 
1407  $cgid = $this->execute("channelgroupadd", array("name" => $name, "type" => $type))->toList();
1408 
1409  return $cgid["cgid"];
1410  }
channelGroupListReset()
Resets the list of channel groups.
Definition: Server.php:1391
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelGroupDelete()

channelGroupDelete (   $cgid,
  $force = FALSE 
)

Deletes the channel group specified with $cgid.

If $force is set to 1, the channel group will be deleted even if there are clients within.

Parameters
integer$sgid
boolean$force
Returns
void
1458  {
1459  $this->channelGroupListReset();
1460 
1461  $this->execute("channelgroupdel", array("cgid" => $cgid, "force" => $force));
1462  }
channelGroupListReset()
Resets the list of channel groups.
Definition: Server.php:1391
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelGroupGetById()

channelGroupGetById (   $cgid)

Returns the TeamSpeak3_Node_Channelgroup object matching the given ID.

Parameters
integer$cgid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Channelgroup
1472  {
1473  if(!array_key_exists((string) $cgid, $this->channelGroupList()))
1474  {
1475  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid groupID", 0xA00);
1476  }
1477 
1478  return $this->cgroupList[intval((string) $cgid)];
1479  }
channelGroupList(array $filter=array())
Returns a list of channel groups available.
Definition: Server.php:1369
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29

◆ channelGroupGetByName()

channelGroupGetByName (   $name,
  $type = TeamSpeak3::GROUP_DBTYPE_REGULAR 
)

Returns the TeamSpeak3_Node_Channelgroup object matching the given name.

Parameters
string$name
integer$type
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Channelgroup
1490  {
1491  foreach($this->channelGroupList() as $group)
1492  {
1493  if($group["name"] == $name && $group["type"] == $type) return $group;
1494  }
1495 
1496  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid groupID", 0xA00);
1497  }
channelGroupList(array $filter=array())
Returns a list of channel groups available.
Definition: Server.php:1369
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29

◆ channelGroupList()

channelGroupList ( array  $filter = array())

Returns a list of channel groups available.

Parameters
array$filter
Returns
array|TeamSpeak3_Node_Channelgroup[]
1370  {
1371  if($this->cgroupList === null)
1372  {
1373  $this->cgroupList = $this->request("channelgrouplist")->toAssocArray("cgid");
1374 
1375  foreach($this->cgroupList as $cgid => $group)
1376  {
1377  $this->cgroupList[$cgid] = new TeamSpeak3_Node_Channelgroup($this, $group);
1378  }
1379 
1380  uasort($this->cgroupList, array(__CLASS__, "sortGroupList"));
1381  }
1382 
1383  return $this->filterList($this->cgroupList, $filter);
1384  }
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80
Class describing a TeamSpeak 3 channel group and all it&#39;s parameters.
Definition: Channelgroup.php:29
filterList(array $nodes=array(), array $rules=array())
Filters given node list array using specified filter rules.
Definition: Abstract.php:219

◆ channelGroupListReset()

channelGroupListReset ( )

Resets the list of channel groups.

Returns
void
1392  {
1393  $this->cgroupList = null;
1394  }

◆ channelGroupPermAssign()

channelGroupPermAssign (   $cgid,
  $permid,
  $permvalue 
)

Adds a set of specified permissions to the channel group specified.

Multiple permissions can be added by providing the two parameters of each permission in separate arrays.

Parameters
integer$cgid
integer$permid
integer$permvalue
Returns
void
1521  {
1522  if(!is_array($permid))
1523  {
1524  $permident = (is_numeric($permid)) ? "permid" : "permsid";
1525  }
1526  else
1527  {
1528  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
1529  }
1530 
1531  $this->execute("channelgroupaddperm", array("cgid" => $cgid, $permident => $permid, "permvalue" => $permvalue));
1532  }
current()
Definition: Abstract.php:482
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelGroupPermList()

channelGroupPermList (   $cgid,
  $permsid = FALSE 
)

Returns a list of permissions assigned to the channel group specified.

Parameters
integer$cgid
boolean$permsid
Returns
array
1507  {
1508  return $this->execute("channelgrouppermlist", array("cgid" => $cgid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
1509  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelGroupPermRemove()

channelGroupPermRemove (   $cgid,
  $permid 
)

Removes a set of specified permissions from the channel group specified with $cgid.

Multiple permissions can be removed at once.

Parameters
integer$cgid
integer$permid
Returns
void
1543  {
1544  if(!is_array($permid))
1545  {
1546  $permident = (is_numeric($permid)) ? "permid" : "permsid";
1547  }
1548  else
1549  {
1550  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
1551  }
1552 
1553  $this->execute("channelgroupdelperm", array("cgid" => $cgid, $permident => $permid));
1554  }
current()
Definition: Abstract.php:482
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelGroupRename()

channelGroupRename (   $cgid,
  $name 
)

Renames the channel group specified with $cgid.

Parameters
integer$cgid
string$name
Returns
void
1443  {
1444  $this->channelGroupListReset();
1445 
1446  $this->execute("channelgrouprename", array("cgid" => $cgid, "name" => $name));
1447  }
channelGroupListReset()
Resets the list of channel groups.
Definition: Server.php:1391
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelIsSpacer()

channelIsSpacer ( TeamSpeak3_Node_Channel  $channel)

Returns TRUE if the given TeamSpeak3_Node_Channel object is a spacer.

Parameters
TeamSpeak3_Node_Channel$channel
Returns
boolean
200  {
201  return (preg_match("/\[[^\]]*spacer[^\]]*\]/", $channel) && $channel["channel_flag_permanent"] && !$channel["pid"]) ? TRUE : FALSE;
202  }

◆ channelList()

channelList ( array  $filter = array())

Returns an array filled with TeamSpeak3_Node_Channel objects.

Parameters
array$filter
Returns
array|TeamSpeak3_Node_Channel[]
97  {
98  if($this->channelList === null)
99  {
100  $channels = $this->request("channellist -topic -flags -voice -limits -icon")->toAssocArray("cid");
101 
102  $this->channelList = array();
103 
104  foreach($channels as $cid => $channel)
105  {
106  $this->channelList[$cid] = new TeamSpeak3_Node_Channel($this, $channel);
107  }
108 
109  $this->resetNodeList();
110  }
111 
112  return $this->filterList($this->channelList, $filter);
113  }
Class describing a TeamSpeak 3 channel and all it&#39;s parameters.
Definition: Channel.php:29
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80
channelList(array $filter=array())
Returns an array filled with TeamSpeak3_Node_Channel objects.
Definition: Server.php:96
filterList(array $nodes=array(), array $rules=array())
Filters given node list array using specified filter rules.
Definition: Abstract.php:219
resetNodeList()
Definition: Abstract.php:464

◆ channelListReset()

channelListReset ( )

Resets the list of channels online.

Returns
void
121  {
122  $this->resetNodeList();
123  $this->channelList = null;
124  }
channelList(array $filter=array())
Returns an array filled with TeamSpeak3_Node_Channel objects.
Definition: Server.php:96
resetNodeList()
Definition: Abstract.php:464

◆ channelMove()

channelMove (   $cid,
  $pid,
  $order = null 
)

Moves the channel specified by $cid to the parent channel specified with $pid.

Parameters
integer$cid
integer$pid
integer$order
Returns
void
188  {
189  $this->execute("channelmove", array("cid" => $cid, "cpid" => $pid, "order" => $order));
190  $this->channelListReset();
191  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92
channelListReset()
Resets the list of channels online.
Definition: Server.php:120

◆ channelPermAssign()

channelPermAssign (   $cid,
  $permid,
  $permvalue 
)

Adds a set of specified permissions to a channel.

Multiple permissions can be added by providing the two parameters of each permission.

Parameters
integer$cid
integer$permid
integer$permvalue
Returns
void
375  {
376  if(!is_array($permid))
377  {
378  $permident = (is_numeric($permid)) ? "permid" : "permsid";
379  }
380  else
381  {
382  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
383  }
384 
385  $this->execute("channeladdperm", array("cid" => $cid, $permident => $permid, "permvalue" => $permvalue));
386  }
current()
Definition: Abstract.php:482
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelPermList()

channelPermList (   $cid,
  $permsid = FALSE 
)

Returns a list of permissions defined for a specific channel.

Parameters
integer$cid
boolean$permsid
Returns
array
361  {
362  return $this->execute("channelpermlist", array("cid" => $cid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
363  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelPermRemove()

channelPermRemove (   $cid,
  $permid 
)

Removes a set of specified permissions from a channel.

Multiple permissions can be removed at once.

Parameters
integer$cid
integer$permid
Returns
void
396  {
397  if(!is_array($permid))
398  {
399  $permident = (is_numeric($permid)) ? "permid" : "permsid";
400  }
401  else
402  {
403  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
404  }
405 
406  $this->execute("channeldelperm", array("cid" => $cid, $permident => $permid));
407  }
current()
Definition: Abstract.php:482
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ channelSpacerCreate()

channelSpacerCreate (   $ident,
  $type = TeamSpeak3::SPACER_SOLIDLINE,
  $align = TeamSpeak3::SPACER_ALIGN_REPEAT,
  $order = null,
  $maxclients = 0 
)

Creates a new channel spacer and returns the new ID.

The first parameter $ident is used to create a unique spacer name on the virtual server.

Parameters
string$ident
mixed$type
integer$align
integer$order
integer$maxclients
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
integer
217  {
218  $properties = array(
219  "channel_name_phonetic" => "channel spacer",
220  "channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
221  "channel_codec_quality" => 0x00,
222  "channel_flag_permanent" => TRUE,
223  "channel_flag_maxclients_unlimited" => FALSE,
224  "channel_flag_maxfamilyclients_unlimited" => FALSE,
225  "channel_flag_maxfamilyclients_inherited" => FALSE,
226  "channel_maxclients" => $maxclients,
227  "channel_order" => $order,
228  );
229 
230  switch($align)
231  {
233  $properties["channel_name"] = "[*spacer" . strval($ident) . "]";
234  break;
235 
237  $properties["channel_name"] = "[lspacer" . strval($ident) . "]";
238  break;
239 
241  $properties["channel_name"] = "[rspacer" . strval($ident) . "]";
242  break;
243 
245  $properties["channel_name"] = "[cspacer" . strval($ident) . "]";
246  break;
247 
248  default:
249  throw new TeamSpeak3_Adapter_ServerQuery_Exception("missing required parameter", 0x606);
250  break;
251  }
252 
253  switch($type)
254  {
255  case (string) TeamSpeak3::SPACER_SOLIDLINE:
256  $properties["channel_name"] .= "___";
257  break;
258 
259  case (string) TeamSpeak3::SPACER_DASHLINE:
260  $properties["channel_name"] .= "---";
261  break;
262 
263  case (string) TeamSpeak3::SPACER_DOTLINE:
264  $properties["channel_name"] .= "...";
265  break;
266 
267  case (string) TeamSpeak3::SPACER_DASHDOTLINE:
268  $properties["channel_name"] .= "-.-";
269  break;
270 
271  case (string) TeamSpeak3::SPACER_DASHDOTDOTLINE:
272  $properties["channel_name"] .= "-..";
273  break;
274 
275  default:
276  $properties["channel_name"] .= strval($type);
277  break;
278  }
279 
280  return $this->channelCreate($properties);
281  }
const CODEC_OPUS_VOICE
3: opus voice (interactive)
Definition: TeamSpeak3.php:102
const SPACER_ALIGN_REPEAT
3: repeat until the whole line is filled
Definition: TeamSpeak3.php:243
const SPACER_ALIGN_CENTER
2: alignment center
Definition: TeamSpeak3.php:242
const SPACER_ALIGN_RIGHT
1: alignment right
Definition: TeamSpeak3.php:241
const SPACER_DASHDOTDOTLINE
4: dash dot dot line
Definition: TeamSpeak3.php:234
const SPACER_DASHDOTLINE
3: dash dot line
Definition: TeamSpeak3.php:233
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
channelCreate(array $properties)
Creates a new channel using given properties and returns the new ID.
Definition: Server.php:148
const SPACER_ALIGN_LEFT
0: alignment left
Definition: TeamSpeak3.php:240
const SPACER_SOLIDLINE
0: solid line
Definition: TeamSpeak3.php:230
const SPACER_DASHLINE
1: dash line
Definition: TeamSpeak3.php:231
const SPACER_DOTLINE
2: dot line
Definition: TeamSpeak3.php:232

◆ channelSpacerGetAlign()

channelSpacerGetAlign (   $cid)

Returns the possible alignment of a channel spacer.

Parameters
integer$cid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
integer
329  {
330  $channel = $this->channelGetById($cid);
331 
332  if(!$this->channelIsSpacer($channel) || !preg_match("/\[(.*)spacer.*\]/", $channel, $matches) || !isset($matches[1]))
333  {
334  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid channel flags", 0x307);
335  }
336 
337  switch($matches[1])
338  {
339  case "*":
341 
342  case "c":
344 
345  case "r":
347 
348  default:
350  }
351  }
const SPACER_ALIGN_REPEAT
3: repeat until the whole line is filled
Definition: TeamSpeak3.php:243
const SPACER_ALIGN_CENTER
2: alignment center
Definition: TeamSpeak3.php:242
const SPACER_ALIGN_RIGHT
1: alignment right
Definition: TeamSpeak3.php:241
channelIsSpacer(TeamSpeak3_Node_Channel $channel)
Returns TRUE if the given TeamSpeak3_Node_Channel object is a spacer.
Definition: Server.php:199
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
const SPACER_ALIGN_LEFT
0: alignment left
Definition: TeamSpeak3.php:240
channelGetById($cid)
Returns the TeamSpeak3_Node_Channel object matching the given ID.
Definition: Server.php:610

◆ channelSpacerGetType()

channelSpacerGetType (   $cid)

Returns the possible type of a channel spacer.

Parameters
integer$cid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
integer
291  {
292  $channel = $this->channelGetById($cid);
293 
294  if(!$this->channelIsSpacer($channel))
295  {
296  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid channel flags", 0x307);
297  }
298 
299  switch($channel["channel_name"]->section("]", 1))
300  {
301  case "___":
303 
304  case "---":
306 
307  case "...":
309 
310  case "-.-":
312 
313  case "-..":
315 
316  default:
318  }
319  }
const SPACER_DASHDOTDOTLINE
4: dash dot dot line
Definition: TeamSpeak3.php:234
channelIsSpacer(TeamSpeak3_Node_Channel $channel)
Returns TRUE if the given TeamSpeak3_Node_Channel object is a spacer.
Definition: Server.php:199
const SPACER_DASHDOTLINE
3: dash dot line
Definition: TeamSpeak3.php:233
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
const SPACER_SOLIDLINE
0: solid line
Definition: TeamSpeak3.php:230
const SPACER_CUSTOM
5: custom format
Definition: TeamSpeak3.php:235
const SPACER_DASHLINE
1: dash line
Definition: TeamSpeak3.php:231
const SPACER_DOTLINE
2: dot line
Definition: TeamSpeak3.php:232
channelGetById($cid)
Returns the TeamSpeak3_Node_Channel object matching the given ID.
Definition: Server.php:610

◆ clientBan()

clientBan (   $clid,
  $timeseconds = null,
  $reason = null 
)

Bans the client specified with ID $clid from the server.

Please note that this will create two separate ban rules for the targeted clients IP address and his unique identifier.

Parameters
integer$clid
integer$timeseconds
string$reason
Returns
array
930  {
931  $this->clientListReset();
932 
933  $bans = $this->execute("banclient", array("clid" => $clid, "time" => $timeseconds, "banreason" => $reason))->toAssocArray("banid");
934 
935  return array_keys($bans);
936  }
clientListReset()
Resets the list of clients online.
Definition: Server.php:671
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientCount()

clientCount ( )

Returns the number of regular clients online.

Returns
integer
741  {
742  if($this->isOffline()) return 0;
743 
744  return $this["virtualserver_clientsonline"]-$this["virtualserver_queryclientsonline"];
745  }
isOffline()
Returns TRUE if the virtual server is offline.
Definition: Server.php:2513

◆ clientCountDb()

clientCountDb ( )

Returns the number of client identities known by the virtual server.

Returns
integer
707  {
708  return current($this->execute("clientdblist -count", array("duration" => 1))->toList("count"));
709  }
current()
Definition: Abstract.php:482
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientDeleteDb()

clientDeleteDb (   $cldbid)

Deletes a clients properties from the database.

Parameters
string$cldbid
Returns
void
959  {
960  $this->execute("clientdbdelete", array("cldbid" => $cldbid));
961  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientFind()

clientFind (   $pattern)

Returns a list of clients matching a given name pattern.

Parameters
string$pattern
Returns
array
684  {
685  return $this->execute("clientfind", array("pattern" => $pattern))->toAssocArray("clid");
686  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientFindDb()

clientFindDb (   $pattern,
  $uid = FALSE 
)

Returns a list of client database IDs matching a given pattern.

You can either search for a clients last known nickname or his unique identity by using the $uid option.

Parameters
string$pattern
boolean$uid
Returns
array
731  {
732  return array_keys($this->execute("clientdbfind", array("pattern" => $pattern, ($uid) ? "-uid" : null))->toAssocArray("cldbid"));
733  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientGetByDbid()

clientGetByDbid (   $dbid)

Returns the TeamSpeak3_Node_Client object matching the given database ID.

Parameters
integer$dbid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Client
806  {
807  foreach($this->clientList() as $client)
808  {
809  if($client["client_database_id"] == $dbid) return $client;
810  }
811 
812  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid clientID", 0x200);
813  }
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
clientList(array $filter=array())
Returns an array filled with TeamSpeak3_Node_Client objects.
Definition: Server.php:643

◆ clientGetById()

clientGetById (   $clid)

Returns the TeamSpeak3_Node_Client object matching the given ID.

Parameters
integer$clid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Client
755  {
756  if(!array_key_exists((string) $clid, $this->clientList()))
757  {
758  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid clientID", 0x200);
759  }
760 
761  return $this->clientList[intval((string) $clid)];
762  }
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
clientList(array $filter=array())
Returns an array filled with TeamSpeak3_Node_Client objects.
Definition: Server.php:643

◆ clientGetByName()

clientGetByName (   $name)

Returns the TeamSpeak3_Node_Client object matching the given name.

Parameters
string$name
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Client
772  {
773  foreach($this->clientList() as $client)
774  {
775  if($client["client_nickname"] == $name) return $client;
776  }
777 
778  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid clientID", 0x200);
779  }
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
clientList(array $filter=array())
Returns an array filled with TeamSpeak3_Node_Client objects.
Definition: Server.php:643

◆ clientGetByUid()

clientGetByUid (   $uid)

Returns the TeamSpeak3_Node_Client object matching the given unique identifier.

Parameters
string$uid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Client
789  {
790  foreach($this->clientList() as $client)
791  {
792  if($client["client_unique_identifier"] == $uid) return $client;
793  }
794 
795  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid clientID", 0x200);
796  }
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
clientList(array $filter=array())
Returns an array filled with TeamSpeak3_Node_Client objects.
Definition: Server.php:643

◆ clientGetIdsByUid()

clientGetIdsByUid (   $cluid)

Returns an array containing a list of active client connections using the unique identifier specified with $cluid.

Parameters
string$cluid
Returns
array
835  {
836  return $this->execute("clientgetids", array("cluid" => $cluid))->toAssocArray("clid");
837  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientGetNameByDbid()

clientGetNameByDbid (   $cldbid)

Returns an array containing the last known nickname and the unique identifier of the client matching the database ID specified with $cldbid.

Parameters
string$cldbid
Returns
array
847  {
848  return $this->execute("clientgetnamefromdbid", array("cldbid" => $cldbid))->toList();
849  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientGetNameByUid()

clientGetNameByUid (   $cluid)

Returns an array containing the last known nickname and the database ID of the client matching the unique identifier specified with $cluid.

Parameters
string$cluid
Returns
array
823  {
824  return $this->execute("clientgetnamefromuid", array("cluid" => $cluid))->toList();
825  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientGetServerGroupsByDbid()

clientGetServerGroupsByDbid (   $cldbid)

Returns an array containing the names and IDs of all server groups the client specified with $cldbid is is currently residing in.

Parameters
string$cldbid
Returns
array
859  {
860  return $this->execute("servergroupsbyclientid", array("cldbid" => $cldbid))->toAssocArray("sgid");
861  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientInfoDb()

clientInfoDb (   $cldbid)

Returns a list of properties from the database for the client specified by $cldbid.

Parameters
integer$cldbid
Returns
array
718  {
719  return $this->execute("clientdbinfo", array("cldbid" => $cldbid))->toList();
720  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientKick()

clientKick (   $clid,
  $reasonid = TeamSpeak3::KICK_CHANNEL,
  $reasonmsg = null 
)

Kicks one or more clients from their currently joined channel or from the server.

Parameters
integer$clid
integer$reasonid
string$reasonmsg
Returns
void
902  {
903  $this->clientListReset();
904 
905  $this->execute("clientkick", array("clid" => $clid, "reasonid" => $reasonid, "reasonmsg" => $reasonmsg));
906  }
clientListReset()
Resets the list of clients online.
Definition: Server.php:671
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientList()

clientList ( array  $filter = array())

Returns an array filled with TeamSpeak3_Node_Client objects.

Parameters
array$filter
Returns
array|TeamSpeak3_Node_Client[]
644  {
645  if($this->clientList === null)
646  {
647  $clients = $this->request("clientlist -uid -away -badges -voice -info -times -groups -icon -country -ip")->toAssocArray("clid");
648 
649  $this->clientList = array();
650 
651  foreach($clients as $clid => $client)
652  {
653  if($this->getParent()->getExcludeQueryClients() && $client["client_type"]) continue;
654 
655  $this->clientList[$clid] = new TeamSpeak3_Node_Client($this, $client);
656  }
657 
658  uasort($this->clientList, array(__CLASS__, "sortClientList"));
659 
660  $this->resetNodeList();
661  }
662 
663  return $this->filterList($this->clientList, $filter);
664  }
Class describing a TeamSpeak 3 client and all it&#39;s parameters.
Definition: Client.php:29
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80
filterList(array $nodes=array(), array $rules=array())
Filters given node list array using specified filter rules.
Definition: Abstract.php:219
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
clientList(array $filter=array())
Returns an array filled with TeamSpeak3_Node_Client objects.
Definition: Server.php:643
resetNodeList()
Definition: Abstract.php:464

◆ clientListDb()

clientListDb (   $offset = null,
  $limit = null 
)

Returns a list of client identities known by the virtual server.

By default, the server spits out 25 entries at once.

Parameters
integer$offset
integer$limit
Returns
array
697  {
698  return $this->execute("clientdblist -count", array("start" => $offset, "duration" => $limit))->toAssocArray("cldbid");
699  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientListReset()

clientListReset ( )

Resets the list of clients online.

Returns
void
672  {
673  $this->resetNodeList();
674  $this->clientList = null;
675  }
clientList(array $filter=array())
Returns an array filled with TeamSpeak3_Node_Client objects.
Definition: Server.php:643
resetNodeList()
Definition: Abstract.php:464

◆ clientModifyDb()

clientModifyDb (   $cldbid,
array  $properties 
)

Changes the clients properties using given properties.

Parameters
string$cldbid
array$properties
Returns
void
946  {
947  $properties["cldbid"] = $cldbid;
948 
949  $this->execute("clientdbedit", $properties);
950  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientMove()

clientMove (   $clid,
  $cid,
  $cpw = null 
)

Moves a client to another channel.

Parameters
integer$clid
integer$cid
string$cpw
Returns
void
872  {
873  $this->clientListReset();
874 
875  $this->execute("clientmove", array("clid" => $clid, "cid" => $cid, "cpw" => $cpw));
876 
877  if($clid instanceof TeamSpeak3_Node_Abstract)
878  {
879  $clid = $clid->getId();
880  }
881 
882  if($cid instanceof TeamSpeak3_Node_Abstract)
883  {
884  $cid = $cid->getId();
885  }
886 
887  if(!is_array($clid) && $clid == $this->whoamiGet("client_id"))
888  {
889  $this->getParent()->whoamiSet("client_channel_id", $cid);
890  }
891  }
Abstract class describing a TeamSpeak 3 node and all it&#39;s parameters.
Definition: Abstract.php:29
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
clientListReset()
Resets the list of clients online.
Definition: Server.php:671
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientPermAssign()

clientPermAssign (   $cldbid,
  $permid,
  $permvalue,
  $permskip = FALSE 
)

Adds a set of specified permissions to a client.

Multiple permissions can be added by providing the three parameters of each permission.

Parameters
integer$cldbid
integer$permid
integer$permvalue
integer$permskip
Returns
void
1001  {
1002  if(!is_array($permid))
1003  {
1004  $permident = (is_numeric($permid)) ? "permid" : "permsid";
1005  }
1006  else
1007  {
1008  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
1009  }
1010 
1011  $this->execute("clientaddperm", array("cldbid" => $cldbid, $permident => $permid, "permvalue" => $permvalue, "permskip" => $permskip));
1012  }
current()
Definition: Abstract.php:482
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientPermList()

clientPermList (   $cldbid,
  $permsid = FALSE 
)

Returns a list of permissions defined for a client.

Parameters
integer$cldbid
boolean$permsid
Returns
array
984  {
985  $this->clientListReset();
986 
987  return $this->execute("clientpermlist", array("cldbid" => $cldbid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
988  }
clientListReset()
Resets the list of clients online.
Definition: Server.php:671
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientPermRemove()

clientPermRemove (   $cldbid,
  $permid 
)

Removes a set of specified permissions from a client.

Multiple permissions can be removed at once.

Parameters
integer$cldbid
integer$permid
Returns
void
1022  {
1023  if(!is_array($permid))
1024  {
1025  $permident = (is_numeric($permid)) ? "permid" : "permsid";
1026  }
1027  else
1028  {
1029  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
1030  }
1031 
1032  $this->execute("clientdelperm", array("cldbid" => $cldbid, $permident => $permid));
1033  }
current()
Definition: Abstract.php:482
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientPoke()

clientPoke (   $clid,
  $msg 
)

Sends a poke message to a client.

Parameters
integer$clid
string$msg
Returns
void
916  {
917  $this->execute("clientpoke", array("clid" => $clid, "msg" => $msg));
918  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ clientSetChannelGroup()

clientSetChannelGroup (   $cldbid,
  $cid,
  $cgid 
)

Sets the channel group of a client to the ID specified.

Parameters
integer$cldbid
integer$cid
integer$cgid
Returns
void
972  {
973  $this->execute("setclientchannelgroup", array("cldbid" => $cldbid, "cid" => $cid, "cgid" => $cgid));
974  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ complaintCreate()

complaintCreate (   $tcldbid,
  $message 
)

Submits a complaint about the client with database ID $tcldbid to the server.

Parameters
integer$tcldbid
string$message
Returns
void
2184  {
2185  $this->execute("complainadd", array("tcldbid" => $tcldbid, "message" => $message));
2186  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ complaintDelete()

complaintDelete (   $tcldbid,
  $fcldbid 
)

Deletes the complaint about the client with ID $tcldbid submitted by the client with ID $fcldbid from the server.

Parameters
integer$tcldbid
integer$fcldbid
Returns
void
2196  {
2197  $this->execute("complaindel", array("tcldbid" => $tcldbid, "fcldbid" => $fcldbid));
2198  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ complaintList()

complaintList (   $tcldbid = null)

Returns a list of complaints on the selected virtual server.

If $tcldbid is specified, only complaints about the targeted client will be shown.

Parameters
integer$tcldbid
Returns
array
2161  {
2162  return $this->execute("complainlist", array("tcldbid" => $tcldbid))->toArray();
2163  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ complaintListClear()

complaintListClear (   $tcldbid)

Deletes all active complaints about the client with database ID $tcldbid from the server.

Parameters
integer$tcldbid
Returns
void
2172  {
2173  $this->execute("complaindelall", array("tcldbid" => $tcldbid));
2174  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ connectionInfo()

connectionInfo ( )

Returns detailed connection information of the virtual server.

Returns
array
2293  {
2294  return $this->request("serverrequestconnectioninfo")->toList();
2295  }
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80

◆ customInfo()

customInfo (   $cldbid)

Returns a list of custom properties for the client specified by $cldbid.

Parameters
integer$cldbid
Returns
array
2099  {
2100  return $this->execute("custominfo", array("cldbid" => $cldbid))->toArray();
2101  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ customSearch()

customSearch (   $ident,
  $pattern = "%" 
)

Returns a list of custom client properties specified by $ident.

Parameters
string$ident
string$pattern
Returns
array
2088  {
2089  return $this->execute("customsearch", array("ident" => $ident, "pattern" => $pattern))->toArray();
2090  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ delete()

delete ( )

Deletes the virtual server.

Returns
void
2303  {
2304  $this->getParent()->serverDelete($this->getId());
2305  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ getIcon()

getIcon ( )

Returns the name of a possible icon to display the node object.

Returns
string
2534  {
2535  if($this["virtualserver_clientsonline"]-$this["virtualserver_queryclientsonline"] >= $this["virtualserver_maxclients"])
2536  {
2537  return "server_full";
2538  }
2539  elseif($this["virtualserver_flag_password"])
2540  {
2541  return "server_pass";
2542  }
2543  else
2544  {
2545  return "server_open";
2546  }
2547  }

◆ getSymbol()

getSymbol ( )

Returns a symbol representing the node.

Returns
string
2555  {
2556  return "$";
2557  }

◆ getUniqueId()

getUniqueId ( )

Returns a unique identifier for the node which can be used as a HTML property.

Returns
string
2524  {
2525  return $this->getParent()->getUniqueId() . "_s" . $this->getId();
2526  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ iconDownload()

iconDownload ( )

Downloads and returns the servers icon file content.

Returns
TeamSpeak3_Helper_String
1764  {
1765  if($this->iconIsLocal("virtualserver_icon_id") || $this["virtualserver_icon_id"] == 0) return;
1766 
1767  $download = $this->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->iconGetName("virtualserver_icon_id"));
1768  $transfer = TeamSpeak3::factory("filetransfer://" . (strstr($download["host"], ":") !== FALSE ? "[" . $download["host"] . "]" : $download["host"]) . ":" . $download["port"]);
1769 
1770  return $transfer->download($download["ftkey"], $download["size"]);
1771  }
iconGetName($key)
Returns the internal path of the node icon.
Definition: Abstract.php:135
iconIsLocal($key)
Returns TRUE if the node icon has a local source.
Definition: Abstract.php:124
transferInitDownload($clientftfid, $cid, $name, $cpw="", $seekpos=0)
Initializes a file transfer download.
Definition: Server.php:1707
static factory($uri)
Factory for TeamSpeak3_Adapter_Abstract classes.
Definition: TeamSpeak3.php:316

◆ iconUpload()

iconUpload (   $data)

Uploads a given icon file content to the server and returns the ID of the icon.

Parameters
string$data
Returns
integer
1780  {
1781  $crc = crc32($data);
1782  $size = strlen($data);
1783 
1784  $upload = $this->transferInitUpload(rand(0x0000, 0xFFFF), 0, "/icon_" . $crc, $size);
1785  $transfer = TeamSpeak3::factory("filetransfer://" . (strstr($upload["host"], ":") !== FALSE ? "[" . $upload["host"] . "]" : $upload["host"]) . ":" . $upload["port"]);
1786 
1787  $transfer->upload($upload["ftkey"], $upload["seekpos"], $data);
1788 
1789  return $crc;
1790  }
transferInitUpload($clientftfid, $cid, $name, $size, $cpw="", $overwrite=FALSE, $resume=FALSE)
Initializes a file transfer upload.
Definition: Server.php:1668
static factory($uri)
Factory for TeamSpeak3_Adapter_Abstract classes.
Definition: TeamSpeak3.php:316

◆ isOffline()

isOffline ( )

Returns TRUE if the virtual server is offline.

Returns
boolean
2514  {
2515  return ($this["virtualserver_status"] == "offline") ? TRUE : FALSE;
2516  }

◆ isOnline()

isOnline ( )

Returns TRUE if the virtual server is online.

Returns
boolean
2504  {
2505  return ($this["virtualserver_status"] == "online") ? TRUE : FALSE;
2506  }

◆ logAdd()

logAdd (   $logmsg,
  $loglevel = TeamSpeak3::LOGLEVEL_INFO 
)

Writes a custom entry into the virtual server log.

Parameters
string$logmsg
integer$loglevel
Returns
void
2283  {
2284  $this->execute("logadd", array("logmsg" => $logmsg, "loglevel" => $loglevel));
2285  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ logView()

logView (   $lines = 30,
  $begin_pos = null,
  $reverse = null,
  $instance = null 
)

Displays a specified number of entries (1-100) from the servers log.

Parameters
integer$lines
integer$begin_pos
boolean$reverse
boolean$instance
Returns
array
2271  {
2272  return $this->execute("logview", array("lines" => $lines, "begin_pos" => $begin_pos, "instance" => $instance, "reverse" => $reverse))->toArray();
2273  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ message()

message (   $msg)

Sends a text message to all clients on the virtual server.

Parameters
string$msg
Returns
void
1811  {
1812  $this->execute("sendtextmessage", array("msg" => $msg, "target" => $this->getId(), "targetmode" => TeamSpeak3::TEXTMSG_SERVER));
1813  }
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92
const TEXTMSG_SERVER
3: target is a virtual server
Definition: TeamSpeak3.php:123

◆ messageCreate()

messageCreate (   $cluid,
  $subject,
  $message 
)

Sends an offline message to the client specified by $cluid.

Parameters
string$cluid
string$subject
string$message
Returns
void
1835  {
1836  $this->execute("messageadd", array("cluid" => $cluid, "subject" => $subject, "message" => $message));
1837  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ messageDelete()

messageDelete (   $msgid)

Deletes an existing offline message with ID $msgid from your inbox.

Parameters
integer$msgid
Returns
void
1846  {
1847  $this->execute("messagedel", array("msgid" => $msgid));
1848  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ messageList()

messageList ( )

Returns a list of offline messages you've received.

The output contains the senders unique identifier, the messages subject, etc.

Returns
array
1822  {
1823  return $this->request("messagelist")->toAssocArray("msgid");
1824  }
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80

◆ messageRead()

messageRead (   $msgid,
  $flag_read = TRUE 
)

Returns an existing offline message with ID $msgid from your inbox.

Parameters
integer$msgid
boolean$flag_read
Returns
array
1858  {
1859  $msg = $this->execute("messageget", array("msgid" => $msgid))->toList();
1860 
1861  if($flag_read)
1862  {
1863  $this->execute("messageget", array("msgid" => $msgid, "flag" => $flag_read));
1864  }
1865 
1866  return $msg;
1867  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ modify()

modify ( array  $properties)

Changes the virtual server configuration using given properties.

Parameters
array$properties
Returns
void
1799  {
1800  $this->execute("serveredit", $properties);
1801  $this->resetNodeInfo();
1802  }
resetNodeInfo()
Definition: Abstract.php:445
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ notifyRegister()

notifyRegister (   $event,
  $id = 0 
)

Registers for a specified category of events on a virtual server to receive notification messages.

Depending on the notifications you've registered for, the server will send you a message on every event.

Parameters
string$event
integer$id
Returns
void
1940  {
1941  $this->execute("servernotifyregister", array("event" => $event, "id" => $id));
1942  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ notifyUnregister()

notifyUnregister ( )

Unregisters all events previously registered with servernotifyregister so you will no longer receive notification messages.

Returns
void
1951  {
1952  $this->request("servernotifyunregister");
1953  }
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80

◆ permRemoveAny()

permRemoveAny (   $permid)

Removes any assignment of the permission specified with $permid on the selected virtual server and returns the number of removed assignments on success.

Parameters
integer$permid
Returns
integer
1620  {
1621  $assignments = $this->permissionFind($permid);
1622 
1623  foreach($assignments as $assignment)
1624  {
1625  switch($assignment["t"])
1626  {
1628  $this->serverGroupPermRemove($assignment["id1"], $assignment["p"]);
1629  break;
1630 
1632  $this->clientPermRemove($assignment["id2"], $assignment["p"]);
1633  break;
1634 
1636  $this->channelPermRemove($assignment["id2"], $assignment["p"]);
1637  break;
1638 
1640  $this->channelGroupPermRemove($assignment["id1"], $assignment["p"]);
1641  break;
1642 
1644  $this->channelClientPermRemove($assignment["id2"], $assignment["id1"], $assignment["p"]);
1645  break;
1646 
1647  default:
1648  throw new TeamSpeak3_Adapter_ServerQuery_Exception("convert error", 0x604);
1649  }
1650  }
1651 
1652  return count($assignments);
1653  }
const PERM_TYPE_CHANNELCLIENT
4: channel-client specific permission
Definition: TeamSpeak3.php:181
clientPermRemove($cldbid, $permid)
Removes a set of specified permissions from a client.
Definition: Server.php:1021
const PERM_TYPE_CHANNEL
2: channel specific permission
Definition: TeamSpeak3.php:179
const PERM_TYPE_SERVERGROUP
0: server group permission
Definition: TeamSpeak3.php:177
const PERM_TYPE_CHANNELGROUP
3: channel group permission
Definition: TeamSpeak3.php:180
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
count()
Definition: Abstract.php:472
channelGroupPermRemove($cgid, $permid)
Removes a set of specified permissions from the channel group specified with $cgid.
Definition: Server.php:1542
serverGroupPermRemove($sgid, $permid)
Removes a set of specified permissions from the server group specified with $sgid.
Definition: Server.php:1216
channelClientPermRemove($cid, $cldbid, $permid)
Removes a set of specified permissions from a client in a specific channel.
Definition: Server.php:454
const PERM_TYPE_CLIENT
1: client specific permission
Definition: TeamSpeak3.php:178
channelPermRemove($cid, $permid)
Removes a set of specified permissions from a channel.
Definition: Server.php:395

◆ permReset()

permReset ( )

Restores the default permission settings on the virtual server and returns a new initial administrator privilege key.

Returns
TeamSpeak3_Helper_String
1604  {
1605  $token = $this->request("permreset")->toList();
1606 
1607  TeamSpeak3_Helper_Signal::getInstance()->emit("notifyTokencreated", $this, $token["token"]);
1608 
1609  return $token["token"];
1610  }
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80
static getInstance()
Returns a singleton instance of TeamSpeak3_Helper_Signal.
Definition: Signal.php:201

◆ privilegeKeyCreate()

privilegeKeyCreate (   $type = TeamSpeak3::TOKEN_SERVERGROUP,
  $id1,
  $id2 = 0,
  $description = null,
  $customset = null 
)

Creates a new privilege key (token) and returns the key.

Parameters
integer$type
integer$id1
integer$id2
string$description
string$customset
Returns
TeamSpeak3_Helper_String
2029  {
2030  $token = $this->execute("privilegekeyadd", array("tokentype" => $type, "tokenid1" => $id1, "tokenid2" => $id2, "tokendescription" => $description, "tokencustomset" => $customset))->toList();
2031 
2032  TeamSpeak3_Helper_Signal::getInstance()->emit("notifyTokencreated", $this, $token["token"]);
2033 
2034  return $token["token"];
2035  }
static getInstance()
Returns a singleton instance of TeamSpeak3_Helper_Signal.
Definition: Signal.php:201
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ privilegeKeyDelete()

privilegeKeyDelete (   $token)

Deletes a token specified by key $token.

Parameters
string$token
Returns
void
2054  {
2055  $this->execute("privilegekeydelete", array("token" => $token));
2056  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ privilegeKeyList()

privilegeKeyList (   $resolve = FALSE)

Returns a list of privilege keys (tokens) available.

If $resolve is set to TRUE the values of token_id1 and token_id2 will be translated into the appropriate group and/or channel names.

Parameters
boolean$resolve
Returns
array
1974  {
1975  $tokens = $this->request("privilegekeylist")->toAssocArray("token");
1976 
1977  if($resolve)
1978  {
1979  foreach($tokens as $token => $array)
1980  {
1981  $func = $array["token_type"] ? "channelGroupGetById" : "serverGroupGetById";
1982 
1983  try
1984  {
1985  $tokens[$token]["token_id1"] = $this->$func($array["token_id1"])->name;
1986  }
1987  catch(Exception $e)
1988  {
1989  /* ERROR_channel_invalid_id */
1990  if($e->getCode() != 0xA00) throw $e;
1991  }
1992 
1993  try
1994  {
1995  if($array["token_type"]) $tokens[$token]["token_id2"] = $this->channelGetById($array["token_id2"])->getPathway();
1996  }
1997  catch(Exception $e)
1998  {
1999  /* ERROR_permission_invalid_group_id */
2000  if($e->getCode() != 0x300) throw $e;
2001  }
2002  }
2003  }
2004 
2005  return $tokens;
2006  }
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80
channelGetById($cid)
Returns the TeamSpeak3_Node_Channel object matching the given ID.
Definition: Server.php:610

◆ privilegeKeyUse()

privilegeKeyUse (   $token)

Use a token key gain access to a server or channel group.

Please note that the server will automatically delete the token after it has been used.

Parameters
string$token
Returns
void
2076  {
2077  $this->execute("privilegekeyuse", array("token" => $token));
2078  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ request()

request (   $cmd,
  $throw = TRUE 
)

Sends a prepared command to the server and returns the result.

Parameters
string$cmd
boolean$throw
Returns
TeamSpeak3_Adapter_ServerQuery_Reply
81  {
82  if($this->getId() != $this->getParent()->serverSelectedId())
83  {
84  $this->getParent()->serverSelect($this->getId());
85  }
86 
87  return $this->getParent()->request($cmd, $throw);
88  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ selfPermOverview()

selfPermOverview ( )

Returns an array containing the permission overview of your own client.

Returns
array
2375  {
2376  return $this->execute("permoverview", array("cldbid" => $this->whoamiGet("client_database_id"), "cid" => $this->whoamiGet("client_channel_id"), "permid" => 0))->toArray();
2377  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ selfUpdate()

selfUpdate ( array  $properties)

Changes the properties of your own client connection.

Parameters
array$properties
Returns
void
2346  {
2347  $this->execute("clientupdate", $properties);
2348 
2349  foreach($properties as $ident => $value)
2350  {
2351  $this->whoamiSet($ident, $value);
2352  }
2353  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ selfUpdateLogin()

selfUpdateLogin (   $username)

Updates your own ServerQuery login credentials using a specified username.

The password will be auto-generated.

Parameters
string$username
Returns
TeamSpeak3_Helper_String
2363  {
2364  $password = $this->execute("clientsetserverquerylogin", array("client_login_name" => $username))->toList();
2365 
2366  return $password["client_login_password"];
2367  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ sendPluginCmd()

sendPluginCmd (   $plugin,
  $data 
)

Sends a plugin command to all clients connected to the server.

Parameters
string$plugin
string$data
Returns
void
2335  {
2336  $this->execute("plugincmd", array("name" => $plugin, "data" => $data, "targetmode" => TeamSpeak3::PLUGINCMD_SERVER));
2337  }
const PLUGINCMD_SERVER
2: send plugincmd to all clients on server
Definition: TeamSpeak3.php:129
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ serverGroupClientAdd()

serverGroupClientAdd (   $sgid,
  $cldbid 
)

Adds a client to the server group specified.

Please note that a client cannot be added to default groups or template groups.

Parameters
integer$sgid
integer$cldbid
Returns
void
1255  {
1256  $this->clientListReset();
1257 
1258  $this->execute("servergroupaddclient", array("sgid" => $sgid, "cldbid" => $cldbid));
1259  }
clientListReset()
Resets the list of clients online.
Definition: Server.php:671
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ serverGroupClientDel()

serverGroupClientDel (   $sgid,
  $cldbid 
)

Removes a client from the server group specified.

Parameters
integer$sgid
integer$cldbid
Returns
void
1269  {
1270  $this->execute("servergroupdelclient", array("sgid" => $sgid, "cldbid" => $cldbid));
1271  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ serverGroupClientList()

serverGroupClientList (   $sgid)

Returns a list of clients assigned to the server group specified.

Parameters
integer$sgid
Returns
array
1237  {
1238  if($this["virtualserver_default_server_group"] == $sgid)
1239  {
1240  return array();
1241  }
1242 
1243  return $this->execute("servergroupclientlist", array("sgid" => $sgid, "-names"))->toAssocArray("cldbid");
1244  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ serverGroupCopy()

serverGroupCopy (   $ssgid,
  $name = null,
  $tsgid = 0,
  $type = TeamSpeak3::GROUP_DBTYPE_REGULAR 
)

Creates a copy of an existing server group specified by $ssgid and returns the new groups ID.

Parameters
integer$ssgid
string$name
integer$tsgid
integer$type
Returns
integer
1094  {
1095  $this->serverGroupListReset();
1096 
1097  $sgid = $this->execute("servergroupcopy", array("ssgid" => $ssgid, "tsgid" => $tsgid, "name" => $name, "type" => $type))->toList();
1098 
1099  if($tsgid && $name)
1100  {
1101  $this->serverGroupRename($tsgid, $name);
1102  }
1103 
1104  return count($sgid) ? $sgid["sgid"] : intval($tsgid);
1105  }
serverGroupRename($sgid, $name)
Renames the server group specified with $sgid.
Definition: Server.php:1114
count()
Definition: Abstract.php:472
serverGroupListReset()
Resets the list of server groups.
Definition: Server.php:1063
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ serverGroupCreate()

serverGroupCreate (   $name,
  $type = TeamSpeak3::GROUP_DBTYPE_REGULAR 
)

Creates a new server group using the name specified with $name and returns its ID.

Parameters
string$name
integer$type
Returns
integer
1076  {
1077  $this->serverGroupListReset();
1078 
1079  $sgid = $this->execute("servergroupadd", array("name" => $name, "type" => $type))->toList();
1080 
1081  return $sgid["sgid"];
1082  }
serverGroupListReset()
Resets the list of server groups.
Definition: Server.php:1063
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ serverGroupDelete()

serverGroupDelete (   $sgid,
  $force = FALSE 
)

Deletes the server group specified with $sgid.

If $force is set to 1, the server group will be deleted even if there are clients within.

Parameters
integer$sgid
boolean$force
Returns
void
1130  {
1131  $this->serverGroupListReset();
1132 
1133  $this->execute("servergroupdel", array("sgid" => $sgid, "force" => $force));
1134  }
serverGroupListReset()
Resets the list of server groups.
Definition: Server.php:1063
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ serverGroupGetById()

serverGroupGetById (   $sgid)

Returns the TeamSpeak3_Node_Servergroup object matching the given ID.

Parameters
integer$sgid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Servergroup
1144  {
1145  if(!array_key_exists((string) $sgid, $this->serverGroupList()))
1146  {
1147  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid groupID", 0xA00);
1148  }
1149 
1150  return $this->sgroupList[intval((string) $sgid)];
1151  }
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
serverGroupList(array $filter=array())
Returns a list of server groups available.
Definition: Server.php:1041

◆ serverGroupGetByName()

serverGroupGetByName (   $name,
  $type = TeamSpeak3::GROUP_DBTYPE_REGULAR 
)

Returns the TeamSpeak3_Node_Servergroup object matching the given name.

Parameters
string$name
integer$type
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Servergroup
1162  {
1163  foreach($this->serverGroupList() as $group)
1164  {
1165  if($group["name"] == $name && $group["type"] == $type) return $group;
1166  }
1167 
1168  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid groupID", 0xA00);
1169  }
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
serverGroupList(array $filter=array())
Returns a list of server groups available.
Definition: Server.php:1041

◆ serverGroupGetProfiles()

serverGroupGetProfiles (   $type = TeamSpeak3::GROUP_DBTYPE_REGULAR)

Returns an ordered array of regular server groups available based on a pre-defined set of rules.

Parameters
integer$type
Returns
array
1281  {
1282  $profiles = array();
1283 
1284  foreach($this->serverGroupList() as $sgid => $sgroup)
1285  {
1286  if($sgroup["type"] != $type) continue;
1287 
1288  $profiles[$sgid] = array(
1289  "b_permission_modify_power_ignore" => 0,
1290  "i_group_member_add_power" => 0,
1291  "i_group_member_remove_power" => 0,
1292  "i_needed_modify_power_count" => 0,
1293  "i_needed_modify_power_total" => 0,
1294  "i_permission_modify_power" => 0,
1295  "i_group_modify_power" => 0,
1296  "i_client_modify_power" => 0,
1297  "b_virtualserver_servergroup_create" => 0,
1298  "b_virtualserver_servergroup_delete" => 0,
1299  "b_client_ignore_bans" => 0,
1300  "b_client_ignore_antiflood" => 0,
1301  "b_group_is_permanent" => 0,
1302  "i_client_needed_ban_power" => 0,
1303  "i_client_needed_kick_power" => 0,
1304  "i_client_needed_move_power" => 0,
1305  "i_client_talk_power" => 0,
1306  "__sgid" => $sgid,
1307  "__name" => $sgroup->toString(),
1308  "__node" => $sgroup,
1309  );
1310 
1311  try
1312  {
1313  $perms = $this->serverGroupPermList($sgid, TRUE);
1314  $grant = isset($perms["i_permission_modify_power"]) ? $perms["i_permission_modify_power"]["permvalue"] : null;
1315  }
1317  {
1318  /* ERROR_database_empty_result */
1319  if($e->getCode() != 0x501) throw $e;
1320 
1321  $perms = array();
1322  $grant = null;
1323  }
1324 
1325  foreach($perms as $permsid => $perm)
1326  {
1327  if(in_array($permsid, array_keys($profiles[$sgid])))
1328  {
1329  $profiles[$sgid][$permsid] = $perm["permvalue"];
1330  }
1331  elseif(TeamSpeak3_Helper_String::factory($permsid)->startsWith("i_needed_modify_power_"))
1332  {
1333  if(!$grant || $perm["permvalue"] > $grant) continue;
1334 
1335  $profiles[$sgid]["i_needed_modify_power_total"] = $profiles[$sgid]["i_needed_modify_power_total"]+$perm["permvalue"];
1336  $profiles[$sgid]["i_needed_modify_power_count"]++;
1337  }
1338  }
1339  }
1340 
1341  array_multisort($profiles, SORT_DESC);
1342 
1343  return $profiles;
1344  }
serverGroupPermList($sgid, $permsid=FALSE)
Returns a list of permissions assigned to the server group specified.
Definition: Server.php:1178
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
serverGroupList(array $filter=array())
Returns a list of server groups available.
Definition: Server.php:1041
static factory($string)
Returns a TeamSpeak3_Helper_String object for thegiven string.
Definition: String.php:60

◆ serverGroupIdentify()

serverGroupIdentify (   $mode = TeamSpeak3::GROUP_IDENTIFIY_STRONGEST,
  $type = TeamSpeak3::GROUP_DBTYPE_REGULAR 
)

Tries to identify the post powerful/weakest server group on the virtual server and returns the ID.

Parameters
integer$mode
integer$type
Returns
TeamSpeak3_Node_Servergroup
1355  {
1356  $profiles = $this->serverGroupGetProfiles($type);
1357 
1358  $best_guess_profile = ($mode == TeamSpeak3::GROUP_IDENTIFIY_STRONGEST) ? array_shift($profiles) : array_pop($profiles);
1359 
1360  return $this->serverGroupGetById($best_guess_profile["__sgid"]);
1361  }
serverGroupGetProfiles($type=TeamSpeak3::GROUP_DBTYPE_REGULAR)
Returns an ordered array of regular server groups available based on a pre-defined set of rules...
Definition: Server.php:1280
serverGroupGetById($sgid)
Returns the TeamSpeak3_Node_Servergroup object matching the given ID.
Definition: Server.php:1143
const GROUP_IDENTIFIY_STRONGEST
1: identify most powerful group
Definition: TeamSpeak3.php:171

◆ serverGroupList()

serverGroupList ( array  $filter = array())

Returns a list of server groups available.

Parameters
filter$filter
Returns
array|TeamSpeak3_Node_Servergroup[]
1042  {
1043  if($this->sgroupList === null)
1044  {
1045  $this->sgroupList = $this->request("servergrouplist")->toAssocArray("sgid");
1046 
1047  foreach($this->sgroupList as $sgid => $group)
1048  {
1049  $this->sgroupList[$sgid] = new TeamSpeak3_Node_Servergroup($this, $group);
1050  }
1051 
1052  uasort($this->sgroupList, array(__CLASS__, "sortGroupList"));
1053  }
1054 
1055  return $this->filterList($this->sgroupList, $filter);
1056  }
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80
filterList(array $nodes=array(), array $rules=array())
Filters given node list array using specified filter rules.
Definition: Abstract.php:219
Class describing a TeamSpeak 3 server group and all it&#39;s parameters.
Definition: Servergroup.php:29

◆ serverGroupListReset()

serverGroupListReset ( )

Resets the list of server groups.

Returns
void
1064  {
1065  $this->sgroupList = null;
1066  }

◆ serverGroupPermAssign()

serverGroupPermAssign (   $sgid,
  $permid,
  $permvalue,
  $permnegated = FALSE,
  $permskip = FALSE 
)

Adds a set of specified permissions to the server group specified.

Multiple permissions can be added by providing the four parameters of each permission in separate arrays.

Parameters
integer$sgid
integer$permid
integer$permvalue
integer$permnegated
integer$permskip
Returns
void
1195  {
1196  if(!is_array($permid))
1197  {
1198  $permident = (is_numeric($permid)) ? "permid" : "permsid";
1199  }
1200  else
1201  {
1202  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
1203  }
1204 
1205  $this->execute("servergroupaddperm", array("sgid" => $sgid, $permident => $permid, "permvalue" => $permvalue, "permnegated" => $permnegated, "permskip" => $permskip));
1206  }
current()
Definition: Abstract.php:482
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ serverGroupPermList()

serverGroupPermList (   $sgid,
  $permsid = FALSE 
)

Returns a list of permissions assigned to the server group specified.

Parameters
integer$sgid
boolean$permsid
Returns
array
1179  {
1180  return $this->execute("servergrouppermlist", array("sgid" => $sgid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
1181  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ serverGroupPermRemove()

serverGroupPermRemove (   $sgid,
  $permid 
)

Removes a set of specified permissions from the server group specified with $sgid.

Multiple permissions can be removed at once.

Parameters
integer$sgid
integer$permid
Returns
void
1217  {
1218  if(!is_array($permid))
1219  {
1220  $permident = (is_numeric($permid)) ? "permid" : "permsid";
1221  }
1222  else
1223  {
1224  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
1225  }
1226 
1227  $this->execute("servergroupdelperm", array("sgid" => $sgid, $permident => $permid));
1228  }
current()
Definition: Abstract.php:482
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ serverGroupRename()

serverGroupRename (   $sgid,
  $name 
)

Renames the server group specified with $sgid.

Parameters
integer$sgid
string$name
Returns
void
1115  {
1116  $this->serverGroupListReset();
1117 
1118  $this->execute("servergrouprename", array("sgid" => $sgid, "name" => $name));
1119  }
serverGroupListReset()
Resets the list of server groups.
Definition: Server.php:1063
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ snapshotCreate()

snapshotCreate (   $mode = TeamSpeak3::SNAPSHOT_STRING)

Creates and returns snapshot data for the selected virtual server.

Parameters
string$mode
Returns
string
1876  {
1877  $snapshot = $this->request("serversnapshotcreate")->toString(FALSE);
1878 
1879  switch($mode)
1880  {
1882  return $snapshot->toBase64();
1883  break;
1884 
1886  return $snapshot->toHex();
1887  break;
1888 
1889  default:
1890  return (string) $snapshot;
1891  break;
1892  }
1893  }
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80
const SNAPSHOT_BASE64
1: base64 string
Definition: TeamSpeak3.php:224
const SNAPSHOT_HEXDEC
2: hexadecimal string
Definition: TeamSpeak3.php:225

◆ snapshotDeploy()

snapshotDeploy (   $data,
  $mode = TeamSpeak3::SNAPSHOT_STRING 
)

Deploys snapshot data on the selected virtual server.

If no virtual server is selected (ID 0), the data will be used to create a new virtual server from scratch.

Parameters
string$data
string$mode
Returns
array
1904  {
1905  switch($mode)
1906  {
1908  $data = TeamSpeak3_Helper_String::fromBase64($data);
1909  break;
1910 
1912  $data = TeamSpeak3_Helper_String::fromHex($data);
1913  break;
1914 
1915  default:
1916  $data = TeamSpeak3_Helper_String::factory($data);
1917  break;
1918  }
1919 
1920  $detail = $this->request("serversnapshotdeploy " . $data)->toList();
1921 
1922  if(array_key_exists("sid", $detail))
1923  {
1924  TeamSpeak3_Helper_Signal::getInstance()->emit("notifyServercreated", $this->getParent(), $detail["sid"]);
1925  }
1926 
1927  return $detail;
1928  }
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80
const SNAPSHOT_BASE64
1: base64 string
Definition: TeamSpeak3.php:224
static fromBase64($base64)
Decodes the string with MIME base64 and returns the result as an TeamSpeak3_Helper_String.
Definition: String.php:494
static getInstance()
Returns a singleton instance of TeamSpeak3_Helper_Signal.
Definition: Signal.php:201
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
static fromHex($hex)
Returns the TeamSpeak3_Helper_String based on a given hex value.
Definition: String.php:523
static factory($string)
Returns a TeamSpeak3_Helper_String object for thegiven string.
Definition: String.php:60
const SNAPSHOT_HEXDEC
2: hexadecimal string
Definition: TeamSpeak3.php:225

◆ sortClientList()

static sortClientList ( TeamSpeak3_Node_Client  $a,
TeamSpeak3_Node_Client  $b 
)
staticprotected

Internal callback funtion for sorting of client objects.

Parameters
TeamSpeak3_Node_Client$a
TeamSpeak3_Node_Client$b
Returns
integer
2411  {
2412  if(get_class($a) != get_class($b))
2413  {
2414  return 0;
2415 
2416  /* workaround for PHP bug #50688 */
2417  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
2418  }
2419 
2420  if(!$a instanceof TeamSpeak3_Node_Client)
2421  {
2422  return 0;
2423 
2424  /* workaround for PHP bug #50688 */
2425  throw new TeamSpeak3_Adapter_ServerQuery_Exception("convert error", 0x604);
2426  }
2427 
2428  if($a->getProperty("client_talk_power", 0) != $b->getProperty("client_talk_power", 0))
2429  {
2430  return ($a->getProperty("client_talk_power", 0) > $b->getProperty("client_talk_power", 0)) ? -1 : 1;
2431  }
2432 
2433  if($a->getProperty("client_is_talker", 0) != $b->getProperty("client_is_talker", 0))
2434  {
2435  return ($a->getProperty("client_is_talker", 0) > $b->getProperty("client_is_talker", 0)) ? -1 : 1;
2436  }
2437 
2438  return strcmp(strtolower($a["client_nickname"]), strtolower($b["client_nickname"]));
2439  }
Class describing a TeamSpeak 3 client and all it&#39;s parameters.
Definition: Client.php:29
getProperty($property, $default=null)
Returns the specified property or a pre-defined default value from the node info array.
Definition: Abstract.php:318
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29

◆ sortFileList()

static sortFileList ( array  $a,
array  $b 
)
staticprotected

Internal callback funtion for sorting of file list items.

Parameters
array$a
array$b
Returns
integer
2482  {
2483  if(!array_key_exists("src", $a) || !array_key_exists("src", $b) || !array_key_exists("type", $a) || !array_key_exists("type", $b))
2484  {
2485  return 0;
2486 
2487  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
2488  }
2489 
2490  if($a["type"] != $b["type"])
2491  {
2492  return ($a["type"] < $b["type"]) ? -1 : 1;
2493  }
2494 
2495  return strcmp(strtolower($a["src"]), strtolower($b["src"]));
2496  }
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29

◆ sortGroupList()

static sortGroupList ( TeamSpeak3_Node_Abstract  $a,
TeamSpeak3_Node_Abstract  $b 
)
staticprotected

Internal callback funtion for sorting of group objects.

Parameters
TeamSpeak3_Node_Abstract$a
TeamSpeak3_Node_Abstract$b
Returns
integer
2449  {
2450  if(get_class($a) != get_class($b))
2451  {
2452  return 0;
2453 
2454  /* workaround for PHP bug #50688 */
2455  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
2456  }
2457 
2458  if(!$a instanceof TeamSpeak3_Node_Servergroup && !$a instanceof TeamSpeak3_Node_Channelgroup)
2459  {
2460  return 0;
2461 
2462  /* workaround for PHP bug #50688 */
2463  throw new TeamSpeak3_Adapter_ServerQuery_Exception("convert error", 0x604);
2464  }
2465 
2466  if($a->getProperty("sortid", 0) != $b->getProperty("sortid", 0) && $a->getProperty("sortid", 0) != 0 && $b->getProperty("sortid", 0) != 0)
2467  {
2468  return ($a->getProperty("sortid", 0) < $b->getProperty("sortid", 0)) ? -1 : 1;
2469  }
2470 
2471  return ($a->getId() < $b->getId()) ? -1 : 1;
2472  }
Class describing a TeamSpeak 3 channel group and all it&#39;s parameters.
Definition: Channelgroup.php:29
getProperty($property, $default=null)
Returns the specified property or a pre-defined default value from the node info array.
Definition: Abstract.php:318
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
Class describing a TeamSpeak 3 server group and all it&#39;s parameters.
Definition: Servergroup.php:29
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ start()

start ( )

Starts the virtual server.

Returns
void
2313  {
2314  $this->getParent()->serverStart($this->getId());
2315  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ stop()

stop ( )

Stops the virtual server.

Returns
void
2323  {
2324  $this->getParent()->serverStop($this->getId());
2325  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ tempPasswordCreate()

tempPasswordCreate (   $pw,
  $duration,
  $tcid = 0,
  $tcpw = "",
  $desc = "" 
)

Sets a new temporary server password specified with $pw.

The temporary password will be valid for the number of seconds specified with $duration. The client connecting with this password will automatically join the channel specified with $tcid. If tcid is set to 0, the client will join the default channel.

Parameters
string$pw
integer$duration
integer$tcid
string$tcpw
string$desc
Returns
void
2246  {
2247  $this->execute("servertemppasswordadd", array("pw" => $pw, "duration" => $duration, "tcid" => $tcid, "tcpw" => $tcpw, "desc" => $desc));
2248  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ tempPasswordDelete()

tempPasswordDelete (   $pw)

Deletes the temporary server password specified with $pw.

Parameters
string$pw
Returns
void
2257  {
2258  $this->execute("servertemppassworddel", array("pw" => $pw));
2259  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ tempPasswordList()

tempPasswordList (   $resolve = FALSE)

Returns a list of temporary server passwords.

Parameters
boolean$resolve
Returns
array
2207  {
2208  $passwords = $this->request("servertemppasswordlist")->toAssocArray("pw_clear");
2209 
2210  if($resolve)
2211  {
2212  foreach($passwords as $password => $array)
2213  {
2214  try
2215  {
2216  $channel = $this->channelGetById($array["tcid"]);
2217 
2218  $passwords[$password]["tcname"] = $channel->toString();
2219  $passwords[$password]["tcpath"] = $channel->getPathway();
2220  }
2221  catch(Exception $e)
2222  {
2223  /* ERROR_channel_invalid_id */
2224  if($e->getCode() != 0xA00) throw $e;
2225  }
2226  }
2227  }
2228 
2229  return $passwords;
2230  }
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80
channelGetById($cid)
Returns the TeamSpeak3_Node_Channel object matching the given ID.
Definition: Server.php:610

◆ tokenCreate()

tokenCreate (   $type = TeamSpeak3::TOKEN_SERVERGROUP,
  $id1,
  $id2 = 0,
  $description = null,
  $customset = null 
)

Alias for privilegeKeyCreate().

Deprecated:
2014  {
2015  return $this->privilegeKeyCreate($type, $id1, $id2, $description, $customset);
2016  }
privilegeKeyCreate($type=TeamSpeak3::TOKEN_SERVERGROUP, $id1, $id2=0, $description=null, $customset=null)
Creates a new privilege key (token) and returns the key.
Definition: Server.php:2028

◆ tokenDelete()

tokenDelete (   $token)

Alias for privilegeKeyDelete().

Deprecated:
2043  {
2044  $this->privilegeKeyDelete($token);
2045  }
privilegeKeyDelete($token)
Deletes a token specified by key $token.
Definition: Server.php:2053

◆ tokenList()

tokenList (   $translate = FALSE)

Alias for privilegeKeyList().

Deprecated:
1961  {
1962  return $this->privilegeKeyList();
1963  }
privilegeKeyList($resolve=FALSE)
Returns a list of privilege keys (tokens) available.
Definition: Server.php:1973

◆ tokenUse()

tokenUse (   $token)

Alias for privilegeKeyUse().

Deprecated:
2064  {
2065  $this->privilegeKeyUse($token);
2066  }
privilegeKeyUse($token)
Use a token key gain access to a server or channel group.
Definition: Server.php:2075

◆ transferInitDownload()

transferInitDownload (   $clientftfid,
  $cid,
  $name,
  $cpw = "",
  $seekpos = 0 
)

Initializes a file transfer download.

$clientftfid is an arbitrary ID to identify the file transfer on client-side.

Parameters
integer$clientftfid
integer$cid
string$name
string$cpw
integer$seekpos
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
array
1708  {
1709  $download = $this->execute("ftinitdownload", array("clientftfid" => $clientftfid, "cid" => $cid, "name" => $name, "cpw" => $cpw, "seekpos" => $seekpos))->toList();
1710 
1711  if(array_key_exists("status", $download) && $download["status"] != 0x00)
1712  {
1713  throw new TeamSpeak3_Adapter_ServerQuery_Exception($download["msg"], $download["status"]);
1714  }
1715 
1716  $download["cid"] = $cid;
1717  $download["file"] = $name;
1718 
1719  if(!array_key_exists("ip", $download) || $download["ip"]->startsWith("0.0.0.0"))
1720  {
1721  $download["ip"] = $this->getParent()->getAdapterHost();
1722  $download["host"] = $download["ip"];
1723  }
1724  else
1725  {
1726  $download["ip"] = $download["ip"]->section(",");
1727  $download["host"] = $download["ip"];
1728  }
1729 
1730  TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferDownloadInit", $download["ftkey"], $download);
1731 
1732  return $download;
1733  }
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
static getInstance()
Returns a singleton instance of TeamSpeak3_Helper_Signal.
Definition: Signal.php:201
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ transferInitUpload()

transferInitUpload (   $clientftfid,
  $cid,
  $name,
  $size,
  $cpw = "",
  $overwrite = FALSE,
  $resume = FALSE 
)

Initializes a file transfer upload.

$clientftfid is an arbitrary ID to identify the file transfer on client-side.

Parameters
integer$clientftfid
integer$cid
string$name
integer$size
string$cpw
boolean$overwrite
boolean$resume
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
array
1669  {
1670  $upload = $this->execute("ftinitupload", array("clientftfid" => $clientftfid, "cid" => $cid, "name" => $name, "cpw" => $cpw, "size" => $size, "overwrite" => $overwrite, "resume" => $resume))->toList();
1671 
1672  if(array_key_exists("status", $upload) && $upload["status"] != 0x00)
1673  {
1674  throw new TeamSpeak3_Adapter_ServerQuery_Exception($upload["msg"], $upload["status"]);
1675  }
1676 
1677  $upload["cid"] = $cid;
1678  $upload["file"] = $name;
1679 
1680  if(!array_key_exists("ip", $upload) || $upload["ip"]->startsWith("0.0.0.0"))
1681  {
1682  $upload["ip"] = $this->getParent()->getAdapterHost();
1683  $upload["host"] = $upload["ip"];
1684  }
1685  else
1686  {
1687  $upload["ip"] = $upload["ip"]->section(",");
1688  $upload["host"] = $upload["ip"];
1689  }
1690 
1691  TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferUploadInit", $upload["ftkey"], $upload);
1692 
1693  return $upload;
1694  }
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
static getInstance()
Returns a singleton instance of TeamSpeak3_Helper_Signal.
Definition: Signal.php:201
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ transferList()

transferList ( )

Displays a list of running file transfers on the selected virtual server.

The output contains the path to which a file is uploaded to, the current transfer rate in bytes per second, etc.

Returns
array
1742  {
1743  return $this->request("ftlist")->toAssocArray("serverftfid");
1744  }
request($cmd, $throw=TRUE)
Sends a prepared command to the server and returns the result.
Definition: Server.php:80

◆ transferStop()

transferStop (   $serverftfid,
  $delete = FALSE 
)

Stops the running file transfer with server-side ID $serverftfid.

Parameters
integer$serverftfid
boolean$delete
Returns
void
1754  {
1755  $this->execute("ftstop", array("serverftfid" => $serverftfid, "delete" => $delete));
1756  }
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

The documentation for this class was generated from the following file: