TeamSpeak 3 PHP Framework  1.1.23
Copyright © Planet TeamSpeak. All rights reserved.
 All Classes Namespaces Files Functions Variables Pages
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...
 
 request ($cmd, $throw=TRUE)
 Sends a prepared command to the server and returns the result. More...
 
 channelList (array $filter=array())
 Returns an array filled with TeamSpeak3_Node_Channel objects. More...
 
 channelListReset ()
 Resets the list of channels online. 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...
 
 channelMove ($cid, $pid, $order=null)
 Moves the channel specified by $cid to the parent channel specified with $pid. More...
 
 channelIsSpacer (TeamSpeak3_Node_Channel $channel)
 Returns TRUE if the given TeamSpeak3_Node_Channel object is a spacer. 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...
 
 channelSpacerGetType ($cid)
 Returns the possible type of a channel spacer. More...
 
 channelSpacerGetAlign ($cid)
 Returns the possible alignment of a channel spacer. More...
 
 channelPermList ($cid, $permsid=FALSE)
 Returns a list of permissions defined for a specific channel. More...
 
 channelPermAssign ($cid, $permid, $permvalue)
 Adds a set of specified permissions to a channel. More...
 
 channelPermRemove ($cid, $permid)
 Removes a set of specified permissions from a channel. More...
 
 channelClientPermList ($cid, $cldbid, $permsid=FALSE)
 Returns a list of permissions defined for a client in a specific channel. More...
 
 channelClientPermAssign ($cid, $cldbid, $permid, $permvalue)
 Adds a set of specified permissions to 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...
 
 channelFileList ($cid, $cpw="", $path="/", $recursive=FALSE)
 Returns a list of files and directories stored in the specified channels file repository. More...
 
 channelFileInfo ($cid, $cpw="", $name="/")
 Returns detailed information about the specified file stored in a channels file repository. More...
 
 channelFileRename ($cid, $cpw="", $oldname="/", $newname="/", $tcid=null, $tcpw=null)
 Renames a file in a channels file repository. More...
 
 channelFileDelete ($cid, $cpw="", $name="/")
 Deletes one or more files stored in a channels file repository. More...
 
 channelDirCreate ($cid, $cpw="", $dirname="/")
 Creates new directory in a channels file repository. 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...
 
 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...
 
 clientList (array $filter=array())
 Returns an array filled with TeamSpeak3_Node_Client objects. More...
 
 clientListReset ()
 Resets the list of clients online. More...
 
 clientFind ($pattern)
 Returns a list of clients matching a given name pattern. More...
 
 clientListDb ($offset=null, $limit=null)
 Returns a list of client identities known by the virtual server. More...
 
 clientCountDb ()
 Returns the number of client identities known by the virtual server. More...
 
 clientInfoDb ($cldbid)
 Returns a list of properties from the database for the client specified by $cldbid. More...
 
 clientFindDb ($pattern, $uid=FALSE)
 Returns a list of client database IDs matching a given pattern. More...
 
 clientCount ()
 Returns the number of regular clients online. 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...
 
 clientGetByDbid ($dbid)
 Returns the TeamSpeak3_Node_Client object matching the given database ID. 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...
 
 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...
 
 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...
 
 clientMove ($clid, $cid, $cpw=null)
 Moves a client to another channel. More...
 
 clientKick ($clid, $reasonid=TeamSpeak3::KICK_CHANNEL, $reasonmsg=null)
 Kicks one or more clients from their currently joined channel or from the server. More...
 
 clientPoke ($clid, $msg)
 Sends a poke message to a client. More...
 
 clientBan ($clid, $timeseconds=null, $reason=null)
 Bans the client specified with ID $clid from the server. More...
 
 clientModifyDb ($cldbid, array $properties)
 Changes the clients properties using given properties. More...
 
 clientDeleteDb ($cldbid)
 Deletes a clients properties from the database. More...
 
 clientSetChannelGroup ($cldbid, $cid, $cgid)
 Sets the channel group of a client to the ID specified. More...
 
 clientPermList ($cldbid, $permsid=FALSE)
 Returns a list of permissions defined for a client. More...
 
 clientPermAssign ($cldbid, $permid, $permvalue, $permskip=FALSE)
 Adds a set of specified permissions to a client. More...
 
 clientPermRemove ($cldbid, $permid)
 Removes a set of specified permissions from a client. More...
 
 serverGroupList (array $filter=array())
 Returns a list of server groups available. More...
 
 serverGroupListReset ()
 Resets the list of server groups. More...
 
 serverGroupCreate ($name, $type=TeamSpeak3::GROUP_DBTYPE_REGULAR)
 Creates a new server group using the name specified with $name and returns its ID. 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...
 
 serverGroupRename ($sgid, $name)
 Renames the server group specified with $sgid. 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...
 
 serverGroupPermList ($sgid, $permsid=FALSE)
 Returns a list of permissions assigned to the server group specified. More...
 
 serverGroupPermAssign ($sgid, $permid, $permvalue, $permnegated=FALSE, $permskip=FALSE)
 Adds a set of specified permissions to the server group specified. More...
 
 serverGroupPermRemove ($sgid, $permid)
 Removes a set of specified permissions from the server group specified with $sgid. More...
 
 serverGroupClientList ($sgid)
 Returns a list of clients assigned to the server group specified. 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...
 
 serverGroupGetProfiles ()
 Returns an ordered array of regular server groups available based on a pre-defined set of rules. More...
 
 serverGroupIdentify ($mode=TeamSpeak3::GROUP_IDENTIFIY_STRONGEST)
 Tries to identify the post powerful/weakest server group on the virtual server and returns the ID. More...
 
 channelGroupList (array $filter=array())
 Returns a list of channel groups available. More...
 
 channelGroupListReset ()
 Resets the list of channel groups. More...
 
 channelGroupCreate ($name, $type=TeamSpeak3::GROUP_DBTYPE_REGULAR)
 Creates a new channel group using the name specified with $name and returns its ID. 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...
 
 channelGroupRename ($cgid, $name)
 Renames the channel group specified with $cgid. 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...
 
 channelGroupPermList ($cgid, $permsid=FALSE)
 Returns a list of permissions assigned to the channel group specified. More...
 
 channelGroupPermAssign ($cgid, $permid, $permvalue)
 Adds a set of specified permissions to the channel group specified. More...
 
 channelGroupPermRemove ($cgid, $permid)
 Removes a set of specified permissions from the channel group specified with $cgid. More...
 
 channelGroupClientList ($cgid=null, $cid=null, $cldbid=null)
 Returns all the client and/or channel IDs currently assigned to channel groups. More...
 
 permReset ()
 Restores the default permission settings on the virtual server and returns a new initial administrator privilege key. 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...
 
 transferInitUpload ($clientftfid, $cid, $name, $size, $cpw="", $overwrite=FALSE, $resume=FALSE)
 Initializes a file transfer upload. More...
 
 transferInitDownload ($clientftfid, $cid, $name, $cpw="", $seekpos=0)
 Initializes a file transfer download. 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...
 
 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...
 
 modify (array $properties)
 Changes the virtual server configuration using given properties. More...
 
 message ($msg)
 Sends a text message to all clients on the virtual server. More...
 
 messageList ()
 Returns a list of offline messages you've received. 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...
 
 messageRead ($msgid, $flag_read=TRUE)
 Returns an existing offline message with ID $msgid from your inbox. 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...
 
 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...
 
 tokenList ($translate=FALSE)
 Alias for privilegeKeyList(). More...
 
 privilegeKeyList ($resolve=FALSE)
 Returns a list of privilege keys (tokens) available. More...
 
 tokenCreate ($type=TeamSpeak3::TOKEN_SERVERGROUP, $id1, $id2=0, $description=null, $customset=null)
 Alias for privilegeKeyCreate(). More...
 
 privilegeKeyCreate ($type=TeamSpeak3::TOKEN_SERVERGROUP, $id1, $id2=0, $description=null, $customset=null)
 Creates a new privilege key (token) and returns the key. More...
 
 tokenDelete ($token)
 Alias for privilegeKeyDelete(). More...
 
 privilegeKeyDelete ($token)
 Deletes a token specified by key $token. More...
 
 tokenUse ($token)
 Alias for privilegeKeyUse(). More...
 
 privilegeKeyUse ($token)
 Use a token key gain access to a server or channel group. More...
 
 customSearch ($ident, $pattern="%")
 Returns a list of custom client properties specified by $ident. More...
 
 customInfo ($cldbid)
 Returns a list of custom properties for the client specified by $cldbid. More...
 
 banList ()
 Returns a list of active bans on the selected virtual server. More...
 
 banListClear ()
 Deletes all active ban rules from the server. 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...
 
 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...
 
 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...
 
 tempPasswordList ($resolve=FALSE)
 Returns a list of temporary server passwords. 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...
 
 logView ($lines=30, $begin_pos=null, $reverse=null, $instance=null)
 Displays a specified number of entries (1-100) from the servers log. More...
 
 logAdd ($logmsg, $loglevel=TeamSpeak3::LOGLEVEL_INFO)
 Writes a custom entry into the virtual server log. More...
 
 connectionInfo ()
 Returns detailed connection information of the virtual server. More...
 
 delete ()
 Deletes the virtual server. More...
 
 start ()
 Starts the virtual server. More...
 
 stop ()
 Stops the virtual server. More...
 
 sendPluginCmd ($plugin, $data)
 Sends a plugin command to all clients connected to the server. 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...
 
 selfPermOverview ()
 Returns an array containing the permission overview of your own client. More...
 
 isOnline ()
 Returns TRUE if the virtual server is online. More...
 
 isOffline ()
 Returns TRUE if the virtual server is offline. More...
 
 getUniqueId ()
 Returns a unique identifier 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...
 
 getSymbol ()
 Returns a symbol representing the node. More...
 
 __toString ()
 Returns a string representation of this node. More...
 
 prepare ($cmd, array $params=array())
 Uses given parameters and returns a prepared ServerQuery command. More...
 
 execute ($cmd, array $params=array())
 Prepares and executes a ServerQuery command and returns the result. More...
 
 getParent ()
 Returns the parent object of the current node. More...
 
 getId ()
 Returns the primary ID of the current node. More...
 
 iconIsLocal ($key)
 Returns TRUE if the node icon has a local source. More...
 
 iconGetName ($key)
 Returns the internal path of the node icon. More...
 
 getClass ($prefix="ts3_")
 Returns a possible classname 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...
 
 getInfo ($extend=TRUE, $convert=FALSE)
 Returns all information available on this node. More...
 
 getProperty ($property, $default=null)
 Returns the specified property or a pre-defined default value from the node info array. More...
 
 toString ()
 Returns a string representation of this node. More...
 
 toArray ()
 Returns an assoc array filled with current node info properties. More...
 
 __call ($name, array $args)
 Called whenever we're using an unknown method. More...
 
 __sleep ()
 Commit pending data. More...
 
 count ()
 
 current ()
 
 getChildren ()
 
 hasChildren ()
 
 hasNext ()
 
 key ()
 
 valid ()
 
 next ()
 
 rewind ()
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 __get ($offset)
 
 __set ($offset, $value)
 

Protected Member Functions

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

Static Protected Member Functions

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

Protected Attributes

 $channelList = null
 
 $clientList = null
 
 $sgroupList = null
 
 $cgroupList = null
 
 $parent = null
 
 $server = null
 
 $nodeId = 0x00
 
 $nodeList = null
 
 $nodeInfo = array()
 
 $storage = array()
 

Detailed Description

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

Definition at line 32 of file Server.php.

Constructor & Destructor Documentation

TeamSpeak3_Node_Server::__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

Definition at line 63 of file Server.php.

64  {
65  $this->parent = $host;
66  $this->nodeInfo = $info;
67 
68  if(!array_key_exists($index, $this->nodeInfo))
69  {
70  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid serverID", 0x400);
71  }
72 
73  $this->nodeId = $this->nodeInfo[$index];
74  }

Member Function Documentation

TeamSpeak3_Node_Server::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

Definition at line 83 of file Server.php.

References TeamSpeak3_Node_Abstract\getId(), and TeamSpeak3_Node_Abstract\getParent().

Referenced by banList(), banListClear(), channelGroupList(), channelList(), clientList(), connectionInfo(), fetchNodeInfo(), messageList(), notifyUnregister(), permReset(), privilegeKeyList(), serverGroupList(), snapshotCreate(), snapshotDeploy(), tempPasswordList(), and transferList().

84  {
85  if($this->getId() != $this->getParent()->serverSelectedId())
86  {
87  $this->getParent()->serverSelect($this->getId());
88  }
89 
90  return $this->getParent()->request($cmd, $throw);
91  }
TeamSpeak3_Node_Server::channelList ( array  $filter = array())

Returns an array filled with TeamSpeak3_Node_Channel objects.

Parameters
array$filter
Returns
array

Definition at line 99 of file Server.php.

References TeamSpeak3_Node_Abstract\filterList(), request(), and TeamSpeak3_Node_Abstract\resetNodeList().

Referenced by channelGetById(), channelGetByName(), channelListReset(), and fetchNodeList().

100  {
101  if($this->channelList === null)
102  {
103  $channels = $this->request("channellist -topic -flags -voice -limits -icon")->toAssocArray("cid");
104 
105  $this->channelList = array();
106 
107  foreach($channels as $cid => $channel)
108  {
109  $this->channelList[$cid] = new TeamSpeak3_Node_Channel($this, $channel);
110  }
111 
112  $this->resetNodeList();
113  }
114 
115  return $this->filterList($this->channelList, $filter);
116  }
TeamSpeak3_Node_Server::channelListReset ( )

Resets the list of channels online.

Returns
void

Definition at line 123 of file Server.php.

References channelList(), and TeamSpeak3_Node_Abstract\resetNodeList().

Referenced by channelCreate(), channelDelete(), and channelMove().

124  {
125  $this->resetNodeList();
126  $this->channelList = null;
127  }
TeamSpeak3_Node_Server::channelCreate ( array  $properties)

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

Parameters
array$properties
Returns
integer

Definition at line 135 of file Server.php.

References channelListReset(), TeamSpeak3_Node_Abstract\execute(), and TeamSpeak3_Node_Abstract\getParent().

Referenced by channelSpacerCreate().

136  {
137  $cid = $this->execute("channelcreate", $properties)->toList();
138  $this->channelListReset();
139 
140  if(!isset($properties["client_flag_permanent"]) && !isset($properties["client_flag_semi_permanent"]))
141  {
142  $this->getParent()->whoamiSet("client_channel_id", $cid["cid"]);
143  }
144 
145  return $cid["cid"];
146  }
TeamSpeak3_Node_Server::channelDelete (   $cid,
  $force = FALSE 
)

Deletes the channel specified by $cid.

Parameters
integer$cid
boolean$force
Returns
void

Definition at line 155 of file Server.php.

References channelListReset(), TeamSpeak3_Node_Abstract\execute(), TeamSpeak3_Node_Abstract\getId(), and TeamSpeak3_Node_Abstract\getParent().

156  {
157  $this->execute("channeldelete", array("cid" => $cid, "force" => $force));
158  $this->channelListReset();
159 
160  if(($cid instanceof TeamSpeak3_Node_Abstract ? $cid->getId() : $cid) == $this->whoamiGet("client_channel_id"))
161  {
162  $this->getParent()->whoamiReset();
163  }
164  }
TeamSpeak3_Node_Server::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

Definition at line 174 of file Server.php.

References channelListReset(), and TeamSpeak3_Node_Abstract\execute().

175  {
176  $this->execute("channelmove", array("cid" => $cid, "cpid" => $pid, "order" => $order));
177  $this->channelListReset();
178  }
TeamSpeak3_Node_Server::channelIsSpacer ( TeamSpeak3_Node_Channel  $channel)

Returns TRUE if the given TeamSpeak3_Node_Channel object is a spacer.

Parameters
TeamSpeak3_Node_Channel$channel
Returns
boolean

Definition at line 186 of file Server.php.

Referenced by channelSpacerGetAlign(), and channelSpacerGetType().

187  {
188  return (preg_match("/\[[^\]]*spacer[^\]]*\]/", $channel) && $channel["channel_flag_permanent"] && !$channel["pid"]) ? TRUE : FALSE;
189  }
TeamSpeak3_Node_Server::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

Definition at line 203 of file Server.php.

References channelCreate(), TeamSpeak3\CODEC_OPUS_VOICE, TeamSpeak3\SPACER_ALIGN_CENTER, TeamSpeak3\SPACER_ALIGN_LEFT, TeamSpeak3\SPACER_ALIGN_REPEAT, TeamSpeak3\SPACER_ALIGN_RIGHT, TeamSpeak3\SPACER_DASHDOTDOTLINE, TeamSpeak3\SPACER_DASHDOTLINE, TeamSpeak3\SPACER_DASHLINE, TeamSpeak3\SPACER_DOTLINE, and TeamSpeak3\SPACER_SOLIDLINE.

204  {
205  $properties = array(
206  "channel_name_phonetic" => "channel spacer",
207  "channel_codec" => TeamSpeak3::CODEC_OPUS_VOICE,
208  "channel_codec_quality" => 0x00,
209  "channel_flag_permanent" => TRUE,
210  "channel_flag_maxclients_unlimited" => FALSE,
211  "channel_flag_maxfamilyclients_unlimited" => FALSE,
212  "channel_flag_maxfamilyclients_inherited" => FALSE,
213  "channel_maxclients" => $maxclients,
214  "channel_order" => $order,
215  );
216 
217  switch($align)
218  {
220  $properties["channel_name"] = "[*spacer" . strval($ident) . "]";
221  break;
222 
224  $properties["channel_name"] = "[lspacer" . strval($ident) . "]";
225  break;
226 
228  $properties["channel_name"] = "[rspacer" . strval($ident) . "]";
229  break;
230 
232  $properties["channel_name"] = "[cspacer" . strval($ident) . "]";
233  break;
234 
235  default:
236  throw new TeamSpeak3_Adapter_ServerQuery_Exception("missing required parameter", 0x606);
237  break;
238  }
239 
240  switch($type)
241  {
242  case (string) TeamSpeak3::SPACER_SOLIDLINE:
243  $properties["channel_name"] .= "___";
244  break;
245 
246  case (string) TeamSpeak3::SPACER_DASHLINE:
247  $properties["channel_name"] .= "---";
248  break;
249 
250  case (string) TeamSpeak3::SPACER_DOTLINE:
251  $properties["channel_name"] .= "...";
252  break;
253 
254  case (string) TeamSpeak3::SPACER_DASHDOTLINE:
255  $properties["channel_name"] .= "-.-";
256  break;
257 
258  case (string) TeamSpeak3::SPACER_DASHDOTDOTLINE:
259  $properties["channel_name"] .= "-..";
260  break;
261 
262  default:
263  $properties["channel_name"] .= strval($type);
264  break;
265  }
266 
267  return $this->channelCreate($properties);
268  }
TeamSpeak3_Node_Server::channelSpacerGetType (   $cid)

Returns the possible type of a channel spacer.

Parameters
integer$cid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
integer

Definition at line 277 of file Server.php.

References channelGetById(), channelIsSpacer(), TeamSpeak3\SPACER_CUSTOM, TeamSpeak3\SPACER_DASHDOTDOTLINE, TeamSpeak3\SPACER_DASHDOTLINE, TeamSpeak3\SPACER_DASHLINE, TeamSpeak3\SPACER_DOTLINE, and TeamSpeak3\SPACER_SOLIDLINE.

278  {
279  $channel = $this->channelGetById($cid);
280 
281  if(!$this->channelIsSpacer($channel))
282  {
283  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid channel flags", 0x307);
284  }
285 
286  switch($channel["channel_name"]->section("]", 1))
287  {
288  case "___":
290 
291  case "---":
293 
294  case "...":
296 
297  case "-.-":
299 
300  case "-..":
302 
303  default:
305  }
306  }
TeamSpeak3_Node_Server::channelSpacerGetAlign (   $cid)

Returns the possible alignment of a channel spacer.

Parameters
integer$cid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
integer

Definition at line 315 of file Server.php.

References channelGetById(), channelIsSpacer(), TeamSpeak3\SPACER_ALIGN_CENTER, TeamSpeak3\SPACER_ALIGN_LEFT, TeamSpeak3\SPACER_ALIGN_REPEAT, and TeamSpeak3\SPACER_ALIGN_RIGHT.

316  {
317  $channel = $this->channelGetById($cid);
318 
319  if(!$this->channelIsSpacer($channel) || !preg_match("/\[(.*)spacer.*\]/", $channel, $matches) || !isset($matches[1]))
320  {
321  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid channel flags", 0x307);
322  }
323 
324  switch($matches[1])
325  {
326  case "*":
328 
329  case "c":
331 
332  case "r":
334 
335  default:
337  }
338  }
TeamSpeak3_Node_Server::channelPermList (   $cid,
  $permsid = FALSE 
)

Returns a list of permissions defined for a specific channel.

Parameters
integer$cid
boolean$permsid
Returns
array

Definition at line 347 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

348  {
349  return $this->execute("channelpermlist", array("cid" => $cid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
350  }
TeamSpeak3_Node_Server::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

Definition at line 361 of file Server.php.

References TeamSpeak3_Node_Abstract\current(), and TeamSpeak3_Node_Abstract\execute().

362  {
363  if(!is_array($permid))
364  {
365  $permident = (is_numeric($permid)) ? "permid" : "permsid";
366  }
367  else
368  {
369  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
370  }
371 
372  $this->execute("channeladdperm", array("cid" => $cid, $permident => $permid, "permvalue" => $permvalue));
373  }
TeamSpeak3_Node_Server::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

Definition at line 382 of file Server.php.

References TeamSpeak3_Node_Abstract\current(), and TeamSpeak3_Node_Abstract\execute().

Referenced by permRemoveAny().

383  {
384  if(!is_array($permid))
385  {
386  $permident = (is_numeric($permid)) ? "permid" : "permsid";
387  }
388  else
389  {
390  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
391  }
392 
393  $this->execute("channeldelperm", array("cid" => $cid, $permident => $permid));
394  }
TeamSpeak3_Node_Server::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

Definition at line 404 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

405  {
406  return $this->execute("channelclientpermlist", array("cid" => $cid, "cldbid" => $cldbid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
407  }
TeamSpeak3_Node_Server::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

Definition at line 419 of file Server.php.

References TeamSpeak3_Node_Abstract\current(), and TeamSpeak3_Node_Abstract\execute().

420  {
421  if(!is_array($permid))
422  {
423  $permident = (is_numeric($permid)) ? "permid" : "permsid";
424  }
425  else
426  {
427  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
428  }
429 
430  $this->execute("channelclientaddperm", array("cid" => $cid, "cldbid" => $cldbid, $permident => $permid, "permvalue" => $permvalue));
431  }
TeamSpeak3_Node_Server::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

Definition at line 441 of file Server.php.

References TeamSpeak3_Node_Abstract\current(), and TeamSpeak3_Node_Abstract\execute().

Referenced by permRemoveAny().

442  {
443  if(!is_array($permid))
444  {
445  $permident = (is_numeric($permid)) ? "permid" : "permsid";
446  }
447  else
448  {
449  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
450  }
451 
452  $this->execute("channelclientdelperm", array("cid" => $cid, "cldbid" => $cldbid, $permident => $permid));
453  }
TeamSpeak3_Node_Server::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

Definition at line 464 of file Server.php.

References TeamSpeak3_Node_Abstract\count(), TeamSpeak3_Node_Abstract\execute(), TeamSpeak3\FILE_TYPE_DIRECTORY, and TeamSpeak3_Node_Abstract\getId().

465  {
466  $files = $this->execute("ftgetfilelist", array("cid" => $cid, "cpw" => $cpw, "path" => $path))->toArray();
467  $count = count($files);
468 
469  for($i = 0; $i < $count; $i++)
470  {
471  $files[$i]["sid"] = $this->getId();
472  $files[$i]["cid"] = $files[0]["cid"];
473  $files[$i]["path"] = $files[0]["path"];
474  $files[$i]["src"] = new TeamSpeak3_Helper_String($cid ? $files[$i]["path"] : "/");
475 
476  if(!$files[$i]["src"]->endsWith("/"))
477  {
478  $files[$i]["src"]->append("/");
479  }
480 
481  $files[$i]["src"]->append($files[$i]["name"]);
482 
483  if($recursive && $files[$i]["type"] == TeamSpeak3::FILE_TYPE_DIRECTORY)
484  {
485  $files = array_merge($files, $this->channelFileList($cid, $cpw, $path . $files[$i]["name"], $recursive));
486  }
487  }
488 
489  uasort($files, array(__CLASS__, "sortFileList"));
490 
491  return $files;
492  }
TeamSpeak3_Node_Server::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

Definition at line 502 of file Server.php.

References TeamSpeak3_Node_Abstract\execute(), and TeamSpeak3_Node_Abstract\toArray().

503  {
504  return array_pop($this->execute("ftgetfileinfo", array("cid" => $cid, "cpw" => $cpw, "name" => $name))->toArray());
505  }
TeamSpeak3_Node_Server::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

Definition at line 519 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

520  {
521  $this->execute("ftrenamefile", array("cid" => $cid, "cpw" => $cpw, "oldname" => $oldname, "newname" => $newname, "tcid" => $tcid, "tcpw" => $tcpw));
522  }
TeamSpeak3_Node_Server::channelFileDelete (   $cid,
  $cpw = "",
  $name = "/" 
)

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

Parameters
integer$cid
string$cpw
string$name
Returns
void

Definition at line 532 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

533  {
534  $this->execute("ftdeletefile", array("cid" => $cid, "cpw" => $cpw, "name" => $name));
535  }
TeamSpeak3_Node_Server::channelDirCreate (   $cid,
  $cpw = "",
  $dirname = "/" 
)

Creates new directory in a channels file repository.

Parameters
integer$cid
string$cpw
string$dirname
Returns
void

Definition at line 545 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

546  {
547  $this->execute("ftcreatedir", array("cid" => $cid, "cpw" => $cpw, "dirname" => $dirname));
548  }
TeamSpeak3_Node_Server::channelGetLevel (   $cid)

Returns the level of a channel.

Parameters
integer$cid
Returns
integer

Definition at line 556 of file Server.php.

References channelGetById().

557  {
558  $channel = $this->channelGetById($cid);
559  $levelno = 0;
560 
561  if($channel["pid"])
562  {
563  $levelno = $this->channelGetLevel($channel["pid"])+1;
564  }
565 
566  return $levelno;
567  }
TeamSpeak3_Node_Server::channelGetPathway (   $cid)

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

Parameters
integer$cid
Returns
string

Definition at line 575 of file Server.php.

References channelGetById().

576  {
577  $channel = $this->channelGetById($cid);
578  $pathway = $channel["channel_name"];
579 
580  if($channel["pid"])
581  {
582  $pathway = $this->channelGetPathway($channel["pid"]) . "/" . $channel["channel_name"];
583  }
584 
585  return $pathway;
586  }
TeamSpeak3_Node_Server::channelGetById (   $cid)

Returns the TeamSpeak3_Node_Channel object matching the given ID.

Parameters
integer$cid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Channel

Definition at line 595 of file Server.php.

References channelList().

Referenced by channelGetLevel(), channelGetPathway(), channelSpacerGetAlign(), channelSpacerGetType(), privilegeKeyList(), and tempPasswordList().

596  {
597  if(!array_key_exists((string) $cid, $this->channelList()))
598  {
599  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid channelID", 0x300);
600  }
601 
602  return $this->channelList[intval((string) $cid)];
603  }
TeamSpeak3_Node_Server::channelGetByName (   $name)

Returns the TeamSpeak3_Node_Channel object matching the given name.

Parameters
string$name
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Channel

Definition at line 612 of file Server.php.

References channelList().

613  {
614  foreach($this->channelList() as $channel)
615  {
616  if($channel["channel_name"] == $name) return $channel;
617  }
618 
619  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid channelID", 0x300);
620  }
TeamSpeak3_Node_Server::clientList ( array  $filter = array())

Returns an array filled with TeamSpeak3_Node_Client objects.

Parameters
array$filter
Returns
array

Definition at line 628 of file Server.php.

References TeamSpeak3_Node_Abstract\filterList(), TeamSpeak3_Node_Abstract\getParent(), request(), and TeamSpeak3_Node_Abstract\resetNodeList().

Referenced by clientGetByDbid(), clientGetById(), clientGetByName(), clientGetByUid(), and clientListReset().

629  {
630  if($this->clientList === null)
631  {
632  $clients = $this->request("clientlist -uid -away -badges -voice -info -times -groups -icon -country -ip")->toAssocArray("clid");
633 
634  $this->clientList = array();
635 
636  foreach($clients as $clid => $client)
637  {
638  if($this->getParent()->getExcludeQueryClients() && $client["client_type"]) continue;
639 
640  $this->clientList[$clid] = new TeamSpeak3_Node_Client($this, $client);
641  }
642 
643  uasort($this->clientList, array(__CLASS__, "sortClientList"));
644 
645  $this->resetNodeList();
646  }
647 
648  return $this->filterList($this->clientList, $filter);
649  }
TeamSpeak3_Node_Server::clientListReset ( )

Resets the list of clients online.

Returns
void

Definition at line 656 of file Server.php.

References clientList(), and TeamSpeak3_Node_Abstract\resetNodeList().

Referenced by clientBan(), clientKick(), clientMove(), clientPermList(), and serverGroupClientAdd().

657  {
658  $this->resetNodeList();
659  $this->clientList = null;
660  }
TeamSpeak3_Node_Server::clientFind (   $pattern)

Returns a list of clients matching a given name pattern.

Parameters
string$pattern
Returns
array

Definition at line 668 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

669  {
670  return $this->execute("clientfind", array("pattern" => $pattern))->toAssocArray("clid");
671  }
TeamSpeak3_Node_Server::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

Definition at line 681 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

682  {
683  return $this->execute("clientdblist -count", array("start" => $offset, "duration" => $limit))->toAssocArray("cldbid");
684  }
TeamSpeak3_Node_Server::clientCountDb ( )

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

Returns
integer

Definition at line 691 of file Server.php.

References TeamSpeak3_Node_Abstract\current(), and TeamSpeak3_Node_Abstract\execute().

692  {
693  return current($this->execute("clientdblist -count", array("duration" => 1))->toList("count"));
694  }
TeamSpeak3_Node_Server::clientInfoDb (   $cldbid)

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

Parameters
integer$cldbid
Returns
array

Definition at line 702 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

703  {
704  return $this->execute("clientdbinfo", array("cldbid" => $cldbid))->toList();
705  }
TeamSpeak3_Node_Server::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

Definition at line 715 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

716  {
717  return array_keys($this->execute("clientdbfind", array("pattern" => $pattern, ($uid) ? "-uid" : null))->toAssocArray("cldbid"));
718  }
TeamSpeak3_Node_Server::clientCount ( )

Returns the number of regular clients online.

Returns
integer

Definition at line 725 of file Server.php.

References isOffline().

726  {
727  if($this->isOffline()) return 0;
728 
729  return $this["virtualserver_clientsonline"]-$this["virtualserver_queryclientsonline"];
730  }
TeamSpeak3_Node_Server::clientGetById (   $clid)

Returns the TeamSpeak3_Node_Client object matching the given ID.

Parameters
integer$clid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Client

Definition at line 739 of file Server.php.

References clientList().

740  {
741  if(!array_key_exists((string) $clid, $this->clientList()))
742  {
743  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid clientID", 0x200);
744  }
745 
746  return $this->clientList[intval((string) $clid)];
747  }
TeamSpeak3_Node_Server::clientGetByName (   $name)

Returns the TeamSpeak3_Node_Client object matching the given name.

Parameters
string$name
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Client

Definition at line 756 of file Server.php.

References clientList().

757  {
758  foreach($this->clientList() as $client)
759  {
760  if($client["client_nickname"] == $name) return $client;
761  }
762 
763  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid clientID", 0x200);
764  }
TeamSpeak3_Node_Server::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

Definition at line 773 of file Server.php.

References clientList().

774  {
775  foreach($this->clientList() as $client)
776  {
777  if($client["client_unique_identifier"] == $uid) return $client;
778  }
779 
780  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid clientID", 0x200);
781  }
TeamSpeak3_Node_Server::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

Definition at line 790 of file Server.php.

References clientList().

791  {
792  foreach($this->clientList() as $client)
793  {
794  if($client["client_database_id"] == $dbid) return $client;
795  }
796 
797  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid clientID", 0x200);
798  }
TeamSpeak3_Node_Server::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

Definition at line 807 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

808  {
809  return $this->execute("clientgetnamefromuid", array("cluid" => $cluid))->toList();
810  }
TeamSpeak3_Node_Server::clientGetIdsByUid (   $cluid)

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

Parameters
string$cluid
Returns
array

Definition at line 819 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

820  {
821  return $this->execute("clientgetids", array("cluid" => $cluid))->toAssocArray("clid");
822  }
TeamSpeak3_Node_Server::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

Definition at line 831 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

832  {
833  return $this->execute("clientgetnamefromdbid", array("cldbid" => $cldbid))->toList();
834  }
TeamSpeak3_Node_Server::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

Definition at line 843 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

844  {
845  return $this->execute("servergroupsbyclientid", array("cldbid" => $cldbid))->toAssocArray("sgid");
846  }
TeamSpeak3_Node_Server::clientMove (   $clid,
  $cid,
  $cpw = null 
)

Moves a client to another channel.

Parameters
integer$clid
integer$cid
string$cpw
Returns
void

Definition at line 856 of file Server.php.

References clientListReset(), TeamSpeak3_Node_Abstract\execute(), and TeamSpeak3_Node_Abstract\getParent().

857  {
858  $this->clientListReset();
859 
860  $this->execute("clientmove", array("clid" => $clid, "cid" => $cid, "cpw" => $cpw));
861 
862  if($clid instanceof TeamSpeak3_Node_Abstract)
863  {
864  $clid = $clid->getId();
865  }
866 
867  if($cid instanceof TeamSpeak3_Node_Abstract)
868  {
869  $cid = $cid->getId();
870  }
871 
872  if(!is_array($clid) && $clid == $this->whoamiGet("client_id"))
873  {
874  $this->getParent()->whoamiSet("client_channel_id", $cid);
875  }
876  }
TeamSpeak3_Node_Server::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

Definition at line 886 of file Server.php.

References clientListReset(), and TeamSpeak3_Node_Abstract\execute().

887  {
888  $this->clientListReset();
889 
890  $this->execute("clientkick", array("clid" => $clid, "reasonid" => $reasonid, "reasonmsg" => $reasonmsg));
891  }
TeamSpeak3_Node_Server::clientPoke (   $clid,
  $msg 
)

Sends a poke message to a client.

Parameters
integer$clid
string$msg
Returns
void

Definition at line 900 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

901  {
902  $this->execute("clientpoke", array("clid" => $clid, "msg" => $msg));
903  }
TeamSpeak3_Node_Server::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

Definition at line 914 of file Server.php.

References clientListReset(), and TeamSpeak3_Node_Abstract\execute().

915  {
916  $this->clientListReset();
917 
918  $bans = $this->execute("banclient", array("clid" => $clid, "time" => $timeseconds, "banreason" => $reason))->toAssocArray("banid");
919 
920  return array_keys($bans);
921  }
TeamSpeak3_Node_Server::clientModifyDb (   $cldbid,
array  $properties 
)

Changes the clients properties using given properties.

Parameters
string$cldbid
array$properties
Returns
void

Definition at line 930 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

931  {
932  $properties["cldbid"] = $cldbid;
933 
934  $this->execute("clientdbedit", $properties);
935  }
TeamSpeak3_Node_Server::clientDeleteDb (   $cldbid)

Deletes a clients properties from the database.

Parameters
string$cldbid
Returns
void

Definition at line 943 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

944  {
945  $this->execute("clientdbdelete", array("cldbid" => $cldbid));
946  }
TeamSpeak3_Node_Server::clientSetChannelGroup (   $cldbid,
  $cid,
  $cgid 
)

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

Parameters
integer$cldbid
integer$cid
integer$cgid
Returns
void

Definition at line 956 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

957  {
958  $this->execute("setclientchannelgroup", array("cldbid" => $cldbid, "cid" => $cid, "cgid" => $cgid));
959  }
TeamSpeak3_Node_Server::clientPermList (   $cldbid,
  $permsid = FALSE 
)

Returns a list of permissions defined for a client.

Parameters
integer$cldbid
boolean$permsid
Returns
array

Definition at line 968 of file Server.php.

References clientListReset(), and TeamSpeak3_Node_Abstract\execute().

969  {
970  $this->clientListReset();
971 
972  return $this->execute("clientpermlist", array("cldbid" => $cldbid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
973  }
TeamSpeak3_Node_Server::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

Definition at line 985 of file Server.php.

References TeamSpeak3_Node_Abstract\current(), and TeamSpeak3_Node_Abstract\execute().

986  {
987  if(!is_array($permid))
988  {
989  $permident = (is_numeric($permid)) ? "permid" : "permsid";
990  }
991  else
992  {
993  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
994  }
995 
996  $this->execute("clientaddperm", array("cldbid" => $cldbid, $permident => $permid, "permvalue" => $permvalue, "permskip" => $permskip));
997  }
TeamSpeak3_Node_Server::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

Definition at line 1006 of file Server.php.

References TeamSpeak3_Node_Abstract\current(), and TeamSpeak3_Node_Abstract\execute().

Referenced by permRemoveAny().

1007  {
1008  if(!is_array($permid))
1009  {
1010  $permident = (is_numeric($permid)) ? "permid" : "permsid";
1011  }
1012  else
1013  {
1014  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
1015  }
1016 
1017  $this->execute("clientdelperm", array("cldbid" => $cldbid, $permident => $permid));
1018  }
TeamSpeak3_Node_Server::serverGroupList ( array  $filter = array())

Returns a list of server groups available.

Parameters
filter$filter
Returns
array

Definition at line 1026 of file Server.php.

References TeamSpeak3_Node_Abstract\filterList(), and request().

Referenced by serverGroupGetById(), serverGroupGetByName(), and serverGroupGetProfiles().

1027  {
1028  if($this->sgroupList === null)
1029  {
1030  $this->sgroupList = $this->request("servergrouplist")->toAssocArray("sgid");
1031 
1032  foreach($this->sgroupList as $sgid => $group)
1033  {
1034  $this->sgroupList[$sgid] = new TeamSpeak3_Node_Servergroup($this, $group);
1035  }
1036 
1037  uasort($this->sgroupList, array(__CLASS__, "sortGroupList"));
1038  }
1039 
1040  return $this->filterList($this->sgroupList, $filter);
1041  }
TeamSpeak3_Node_Server::serverGroupListReset ( )

Resets the list of server groups.

Returns
void

Definition at line 1048 of file Server.php.

Referenced by serverGroupCopy(), serverGroupCreate(), serverGroupDelete(), and serverGroupRename().

1049  {
1050  $this->sgroupList = null;
1051  }
TeamSpeak3_Node_Server::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

Definition at line 1060 of file Server.php.

References TeamSpeak3_Node_Abstract\execute(), and serverGroupListReset().

1061  {
1062  $this->serverGroupListReset();
1063 
1064  $sgid = $this->execute("servergroupadd", array("name" => $name, "type" => $type))->toList();
1065 
1066  return $sgid["sgid"];
1067  }
TeamSpeak3_Node_Server::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

Definition at line 1078 of file Server.php.

References TeamSpeak3_Node_Abstract\count(), TeamSpeak3_Node_Abstract\execute(), serverGroupListReset(), and serverGroupRename().

1079  {
1080  $this->serverGroupListReset();
1081 
1082  $sgid = $this->execute("servergroupcopy", array("ssgid" => $ssgid, "tsgid" => $tsgid, "name" => $name, "type" => $type))->toList();
1083 
1084  if($tsgid && $name)
1085  {
1086  $this->serverGroupRename($tsgid, $name);
1087  }
1088 
1089  return count($sgid) ? $sgid["sgid"] : intval($tsgid);
1090  }
TeamSpeak3_Node_Server::serverGroupRename (   $sgid,
  $name 
)

Renames the server group specified with $sgid.

Parameters
integer$sgid
string$name
Returns
void

Definition at line 1099 of file Server.php.

References TeamSpeak3_Node_Abstract\execute(), and serverGroupListReset().

Referenced by serverGroupCopy().

1100  {
1101  $this->serverGroupListReset();
1102 
1103  $this->execute("servergrouprename", array("sgid" => $sgid, "name" => $name));
1104  }
TeamSpeak3_Node_Server::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

Definition at line 1114 of file Server.php.

References TeamSpeak3_Node_Abstract\execute(), and serverGroupListReset().

1115  {
1116  $this->serverGroupListReset();
1117 
1118  $this->execute("servergroupdel", array("sgid" => $sgid, "force" => $force));
1119  }
TeamSpeak3_Node_Server::serverGroupGetById (   $sgid)

Returns the TeamSpeak3_Node_Servergroup object matching the given ID.

Parameters
integer$sgid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Servergroup

Definition at line 1128 of file Server.php.

References serverGroupList().

Referenced by serverGroupIdentify().

1129  {
1130  if(!array_key_exists((string) $sgid, $this->serverGroupList()))
1131  {
1132  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid groupID", 0xA00);
1133  }
1134 
1135  return $this->sgroupList[intval((string) $sgid)];
1136  }
TeamSpeak3_Node_Server::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

Definition at line 1146 of file Server.php.

References serverGroupList().

1147  {
1148  foreach($this->serverGroupList() as $group)
1149  {
1150  if($group["name"] == $name && $group["type"] == $type) return $group;
1151  }
1152 
1153  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid groupID", 0xA00);
1154  }
TeamSpeak3_Node_Server::serverGroupPermList (   $sgid,
  $permsid = FALSE 
)

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

Parameters
integer$sgid
boolean$permsid
Returns
array

Definition at line 1163 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

Referenced by serverGroupGetProfiles().

1164  {
1165  return $this->execute("servergrouppermlist", array("sgid" => $sgid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
1166  }
TeamSpeak3_Node_Server::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

Definition at line 1179 of file Server.php.

References TeamSpeak3_Node_Abstract\current(), and TeamSpeak3_Node_Abstract\execute().

1180  {
1181  if(!is_array($permid))
1182  {
1183  $permident = (is_numeric($permid)) ? "permid" : "permsid";
1184  }
1185  else
1186  {
1187  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
1188  }
1189 
1190  $this->execute("servergroupaddperm", array("sgid" => $sgid, $permident => $permid, "permvalue" => $permvalue, "permnegated" => $permnegated, "permskip" => $permskip));
1191  }
TeamSpeak3_Node_Server::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

Definition at line 1201 of file Server.php.

References TeamSpeak3_Node_Abstract\current(), and TeamSpeak3_Node_Abstract\execute().

Referenced by permRemoveAny().

1202  {
1203  if(!is_array($permid))
1204  {
1205  $permident = (is_numeric($permid)) ? "permid" : "permsid";
1206  }
1207  else
1208  {
1209  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
1210  }
1211 
1212  $this->execute("servergroupdelperm", array("sgid" => $sgid, $permident => $permid));
1213  }
TeamSpeak3_Node_Server::serverGroupClientList (   $sgid)

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

Parameters
integer$sgid
Returns
array

Definition at line 1221 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

1222  {
1223  if($this["virtualserver_default_server_group"] == $sgid)
1224  {
1225  return array();
1226  }
1227 
1228  return $this->execute("servergroupclientlist", array("sgid" => $sgid, "-names"))->toAssocArray("cldbid");
1229  }
TeamSpeak3_Node_Server::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

Definition at line 1239 of file Server.php.

References clientListReset(), and TeamSpeak3_Node_Abstract\execute().

1240  {
1241  $this->clientListReset();
1242 
1243  $this->execute("servergroupaddclient", array("sgid" => $sgid, "cldbid" => $cldbid));
1244  }
TeamSpeak3_Node_Server::serverGroupClientDel (   $sgid,
  $cldbid 
)

Removes a client from the server group specified.

Parameters
integer$sgid
integer$cldbid
Returns
void

Definition at line 1253 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

1254  {
1255  $this->execute("servergroupdelclient", array("sgid" => $sgid, "cldbid" => $cldbid));
1256  }
TeamSpeak3_Node_Server::serverGroupGetProfiles ( )

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

Returns
array

Definition at line 1264 of file Server.php.

References TeamSpeak3_Helper_String\factory(), TeamSpeak3\GROUP_DBTYPE_REGULAR, serverGroupList(), and serverGroupPermList().

Referenced by serverGroupIdentify().

1265  {
1266  $profiles = array();
1267 
1268  foreach($this->serverGroupList() as $sgid => $sgroup)
1269  {
1270  if($sgroup["type"] != TeamSpeak3::GROUP_DBTYPE_REGULAR) continue;
1271 
1272  $profiles[$sgid] = array(
1273  "b_permission_modify_power_ignore" => 0,
1274  "i_group_needed_member_add_power" => 0,
1275  "i_group_member_add_power" => 0,
1276  "i_group_needed_member_remove_power" => 0,
1277  "i_group_member_remove_power" => 0,
1278  "i_needed_modify_power_count" => 0,
1279  "i_needed_modify_power_total" => 0,
1280  "i_permission_modify_power" => 0,
1281  "i_group_needed_modify_power" => 0,
1282  "i_group_modify_power" => 0,
1283  "i_client_needed_modify_power" => 0,
1284  "i_client_modify_power" => 0,
1285  "b_virtualserver_servergroup_create" => 0,
1286  "b_virtualserver_servergroup_delete" => 0,
1287  "b_client_ignore_bans" => 0,
1288  "b_client_ignore_antiflood" => 0,
1289  "b_group_is_permanent" => 0,
1290  "i_client_needed_ban_power" => 0,
1291  "i_client_needed_kick_power" => 0,
1292  "i_client_needed_move_power" => 0,
1293  "i_client_talk_power" => 0,
1294  "__sgid" => $sgid,
1295  "__name" => $sgroup->toString(),
1296  "__node" => $sgroup,
1297  );
1298 
1299  try
1300  {
1301  $perms = $this->serverGroupPermList($sgid, TRUE);
1302  $grant = isset($perms["i_permission_modify_power"]) ? $perms["i_permission_modify_power"]["permvalue"] : null;
1303  }
1305  {
1306  /* ERROR_database_empty_result */
1307  if($e->getCode() != 0x501) throw $e;
1308 
1309  $perms = array();
1310  $grant = null;
1311  }
1312 
1313  foreach($perms as $permsid => $perm)
1314  {
1315  if(in_array($permsid, array_keys($profiles[$sgid])))
1316  {
1317  $profiles[$sgid][$permsid] = $perm["permvalue"];
1318  }
1319  elseif(TeamSpeak3_Helper_String::factory($permsid)->startsWith("i_needed_modify_power_"))
1320  {
1321  if(!$grant || $perm["permvalue"] > $grant) continue;
1322 
1323  $profiles[$sgid]["i_needed_modify_power_total"] = $profiles[$sgid]["i_needed_modify_power_total"]+$perm["permvalue"];
1324  $profiles[$sgid]["i_needed_modify_power_count"]++;
1325  }
1326  }
1327  }
1328 
1329  array_multisort($profiles, SORT_DESC);
1330 
1331  return $profiles;
1332  }
TeamSpeak3_Node_Server::serverGroupIdentify (   $mode = TeamSpeak3::GROUP_IDENTIFIY_STRONGEST)

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

Parameters
integer$mode
Returns
TeamSpeak3_Node_Servergroup

Definition at line 1341 of file Server.php.

References TeamSpeak3\GROUP_IDENTIFIY_STRONGEST, serverGroupGetById(), and serverGroupGetProfiles().

1342  {
1343  $profiles = $this->serverGroupGetProfiles();
1344 
1345  $best_guess_profile = ($mode == TeamSpeak3::GROUP_IDENTIFIY_STRONGEST) ? array_shift($profiles) : array_pop($profiles);
1346 
1347  return $this->serverGroupGetById($best_guess_profile["__sgid"]);
1348  }
TeamSpeak3_Node_Server::channelGroupList ( array  $filter = array())

Returns a list of channel groups available.

Parameters
array$filter
Returns
array

Definition at line 1356 of file Server.php.

References TeamSpeak3_Node_Abstract\filterList(), and request().

Referenced by channelGroupGetById(), and channelGroupGetByName().

1357  {
1358  if($this->cgroupList === null)
1359  {
1360  $this->cgroupList = $this->request("channelgrouplist")->toAssocArray("cgid");
1361 
1362  foreach($this->cgroupList as $cgid => $group)
1363  {
1364  $this->cgroupList[$cgid] = new TeamSpeak3_Node_Channelgroup($this, $group);
1365  }
1366 
1367  uasort($this->cgroupList, array(__CLASS__, "sortGroupList"));
1368  }
1369 
1370  return $this->filterList($this->cgroupList, $filter);
1371  }
TeamSpeak3_Node_Server::channelGroupListReset ( )

Resets the list of channel groups.

Returns
void

Definition at line 1378 of file Server.php.

Referenced by channelGroupCopy(), channelGroupCreate(), channelGroupDelete(), and channelGroupRename().

1379  {
1380  $this->cgroupList = null;
1381  }
TeamSpeak3_Node_Server::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

Definition at line 1390 of file Server.php.

References channelGroupListReset(), and TeamSpeak3_Node_Abstract\execute().

1391  {
1392  $this->channelGroupListReset();
1393 
1394  $cgid = $this->execute("channelgroupadd", array("name" => $name, "type" => $type))->toList();
1395 
1396  return $cgid["cgid"];
1397  }
TeamSpeak3_Node_Server::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

Definition at line 1408 of file Server.php.

References channelGroupListReset(), channelGroupRename(), TeamSpeak3_Node_Abstract\count(), and TeamSpeak3_Node_Abstract\execute().

1409  {
1410  $this->channelGroupListReset();
1411 
1412  $cgid = $this->execute("channelgroupcopy", array("scgid" => $scgid, "tcgid" => $tcgid, "name" => $name, "type" => $type))->toList();
1413 
1414  if($tcgid && $name)
1415  {
1416  $this->channelGroupRename($tcgid, $name);
1417  }
1418 
1419  return count($cgid) ? $cgid["cgid"] : intval($tcgid);
1420  }
TeamSpeak3_Node_Server::channelGroupRename (   $cgid,
  $name 
)

Renames the channel group specified with $cgid.

Parameters
integer$cgid
string$name
Returns
void

Definition at line 1429 of file Server.php.

References channelGroupListReset(), and TeamSpeak3_Node_Abstract\execute().

Referenced by channelGroupCopy().

1430  {
1431  $this->channelGroupListReset();
1432 
1433  $this->execute("channelgrouprename", array("cgid" => $cgid, "name" => $name));
1434  }
TeamSpeak3_Node_Server::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

Definition at line 1444 of file Server.php.

References channelGroupListReset(), and TeamSpeak3_Node_Abstract\execute().

1445  {
1446  $this->channelGroupListReset();
1447 
1448  $this->execute("channelgroupdel", array("cgid" => $cgid, "force" => $force));
1449  }
TeamSpeak3_Node_Server::channelGroupGetById (   $cgid)

Returns the TeamSpeak3_Node_Channelgroup object matching the given ID.

Parameters
integer$cgid
Exceptions
TeamSpeak3_Adapter_ServerQuery_Exception
Returns
TeamSpeak3_Node_Channelgroup

Definition at line 1458 of file Server.php.

References channelGroupList().

1459  {
1460  if(!array_key_exists((string) $cgid, $this->channelGroupList()))
1461  {
1462  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid groupID", 0xA00);
1463  }
1464 
1465  return $this->cgroupList[intval((string) $cgid)];
1466  }
TeamSpeak3_Node_Server::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

Definition at line 1476 of file Server.php.

References channelGroupList().

1477  {
1478  foreach($this->channelGroupList() as $group)
1479  {
1480  if($group["name"] == $name && $group["type"] == $type) return $group;
1481  }
1482 
1483  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid groupID", 0xA00);
1484  }
TeamSpeak3_Node_Server::channelGroupPermList (   $cgid,
  $permsid = FALSE 
)

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

Parameters
integer$cgid
boolean$permsid
Returns
array

Definition at line 1493 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

1494  {
1495  return $this->execute("channelgrouppermlist", array("cgid" => $cgid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
1496  }
TeamSpeak3_Node_Server::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

Definition at line 1507 of file Server.php.

References TeamSpeak3_Node_Abstract\current(), and TeamSpeak3_Node_Abstract\execute().

1508  {
1509  if(!is_array($permid))
1510  {
1511  $permident = (is_numeric($permid)) ? "permid" : "permsid";
1512  }
1513  else
1514  {
1515  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
1516  }
1517 
1518  $this->execute("channelgroupaddperm", array("cgid" => $cgid, $permident => $permid, "permvalue" => $permvalue));
1519  }
TeamSpeak3_Node_Server::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

Definition at line 1529 of file Server.php.

References TeamSpeak3_Node_Abstract\current(), and TeamSpeak3_Node_Abstract\execute().

Referenced by permRemoveAny().

1530  {
1531  if(!is_array($permid))
1532  {
1533  $permident = (is_numeric($permid)) ? "permid" : "permsid";
1534  }
1535  else
1536  {
1537  $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
1538  }
1539 
1540  $this->execute("channelgroupdelperm", array("cgid" => $cgid, $permident => $permid));
1541  }
TeamSpeak3_Node_Server::channelGroupClientList (   $cgid = null,
  $cid = null,
  $cldbid = null 
)

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
Returns
array

Definition at line 1553 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

1554  {
1555  if($this["virtualserver_default_channel_group"] == $cgid)
1556  {
1557  return array();
1558  }
1559 
1560  return $this->execute("channelgroupclientlist", array("cgid" => $cgid, "cid" => $cid, "cldbid" => $cldbid))->toArray();
1561  }
TeamSpeak3_Node_Server::permReset ( )

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

Returns
TeamSpeak3_Helper_String

Definition at line 1569 of file Server.php.

References TeamSpeak3_Helper_Signal\getInstance(), and request().

1570  {
1571  $token = $this->request("permreset")->toList();
1572 
1573  TeamSpeak3_Helper_Signal::getInstance()->emit("notifyTokencreated", $this, $token["token"]);
1574 
1575  return $token["token"];
1576  }
TeamSpeak3_Node_Server::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

Definition at line 1585 of file Server.php.

References channelClientPermRemove(), channelGroupPermRemove(), channelPermRemove(), clientPermRemove(), TeamSpeak3_Node_Abstract\count(), TeamSpeak3\PERM_TYPE_CHANNEL, TeamSpeak3\PERM_TYPE_CHANNELCLIENT, TeamSpeak3\PERM_TYPE_CHANNELGROUP, TeamSpeak3\PERM_TYPE_CLIENT, TeamSpeak3\PERM_TYPE_SERVERGROUP, and serverGroupPermRemove().

1586  {
1587  $assignments = $this->permissionFind($permid);
1588 
1589  foreach($assignments as $assignment)
1590  {
1591  switch($assignment["t"])
1592  {
1594  $this->serverGroupPermRemove($assignment["id1"], $assignment["p"]);
1595  break;
1596 
1598  $this->clientPermRemove($assignment["id2"], $assignment["p"]);
1599  break;
1600 
1602  $this->channelPermRemove($assignment["id2"], $assignment["p"]);
1603  break;
1604 
1606  $this->channelGroupPermRemove($assignment["id1"], $assignment["p"]);
1607  break;
1608 
1610  $this->channelClientPermRemove($assignment["id2"], $assignment["id1"], $assignment["p"]);
1611  break;
1612 
1613  default:
1614  throw new TeamSpeak3_Adapter_ServerQuery_Exception("convert error", 0x604);
1615  }
1616  }
1617 
1618  return count($assignments);
1619  }
TeamSpeak3_Node_Server::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

Definition at line 1634 of file Server.php.

References TeamSpeak3_Node_Abstract\execute(), TeamSpeak3_Helper_Signal\getInstance(), and TeamSpeak3_Node_Abstract\getParent().

Referenced by iconUpload().

1635  {
1636  $upload = $this->execute("ftinitupload", array("clientftfid" => $clientftfid, "cid" => $cid, "name" => $name, "cpw" => $cpw, "size" => $size, "overwrite" => $overwrite, "resume" => $resume))->toList();
1637 
1638  if(array_key_exists("status", $upload) && $upload["status"] != 0x00)
1639  {
1640  throw new TeamSpeak3_Adapter_ServerQuery_Exception($upload["msg"], $upload["status"]);
1641  }
1642 
1643  $upload["cid"] = $cid;
1644  $upload["file"] = $name;
1645 
1646  if(!array_key_exists("ip", $upload) || $upload["ip"]->startsWith("0.0.0.0"))
1647  {
1648  $upload["ip"] = $this->getParent()->getAdapterHost();
1649  $upload["host"] = $upload["ip"];
1650  }
1651  else
1652  {
1653  $upload["ip"] = $upload["ip"]->section(",");
1654  $upload["host"] = $upload["ip"];
1655  }
1656 
1657  TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferUploadInit", $upload["ftkey"], $upload);
1658 
1659  return $upload;
1660  }
TeamSpeak3_Node_Server::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

Definition at line 1673 of file Server.php.

References TeamSpeak3_Node_Abstract\execute(), TeamSpeak3_Helper_Signal\getInstance(), and TeamSpeak3_Node_Abstract\getParent().

Referenced by iconDownload().

1674  {
1675  $download = $this->execute("ftinitdownload", array("clientftfid" => $clientftfid, "cid" => $cid, "name" => $name, "cpw" => $cpw, "seekpos" => $seekpos))->toList();
1676 
1677  if(array_key_exists("status", $download) && $download["status"] != 0x00)
1678  {
1679  throw new TeamSpeak3_Adapter_ServerQuery_Exception($download["msg"], $download["status"]);
1680  }
1681 
1682  $download["cid"] = $cid;
1683  $download["file"] = $name;
1684 
1685  if(!array_key_exists("ip", $download) || $download["ip"]->startsWith("0.0.0.0"))
1686  {
1687  $download["ip"] = $this->getParent()->getAdapterHost();
1688  $download["host"] = $download["ip"];
1689  }
1690  else
1691  {
1692  $download["ip"] = $download["ip"]->section(",");
1693  $download["host"] = $download["ip"];
1694  }
1695 
1696  TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferDownloadInit", $download["ftkey"], $download);
1697 
1698  return $download;
1699  }
TeamSpeak3_Node_Server::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

Definition at line 1707 of file Server.php.

References request().

1708  {
1709  return $this->request("ftlist")->toAssocArray("serverftfid");
1710  }
TeamSpeak3_Node_Server::transferStop (   $serverftfid,
  $delete = FALSE 
)

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

Parameters
integer$serverftfid
boolean$delete
Returns
void

Definition at line 1719 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

1720  {
1721  $this->execute("ftstop", array("serverftfid" => $serverftfid, "delete" => $delete));
1722  }
TeamSpeak3_Node_Server::iconDownload ( )

Downloads and returns the servers icon file content.

Returns
TeamSpeak3_Helper_String

Definition at line 1729 of file Server.php.

References TeamSpeak3\factory(), TeamSpeak3_Node_Abstract\iconGetName(), TeamSpeak3_Node_Abstract\iconIsLocal(), and transferInitDownload().

1730  {
1731  if($this->iconIsLocal("virtualserver_icon_id") || $this["virtualserver_icon_id"] == 0) return;
1732 
1733  $download = $this->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->iconGetName("virtualserver_icon_id"));
1734  $transfer = TeamSpeak3::factory("filetransfer://" . $download["host"] . ":" . $download["port"]);
1735 
1736  return $transfer->download($download["ftkey"], $download["size"]);
1737  }
TeamSpeak3_Node_Server::iconUpload (   $data)

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

Parameters
string$data
Returns
integer

Definition at line 1745 of file Server.php.

References TeamSpeak3\factory(), and transferInitUpload().

1746  {
1747  $crc = crc32($data);
1748  $size = strlen($data);
1749 
1750  $upload = $this->transferInitUpload(rand(0x0000, 0xFFFF), 0, "/icon_" . $crc, $size);
1751  $transfer = TeamSpeak3::factory("filetransfer://" . $upload["host"] . ":" . $upload["port"]);
1752 
1753  $transfer->upload($upload["ftkey"], $upload["seekpos"], $data);
1754 
1755  return $crc;
1756  }
TeamSpeak3_Node_Server::modify ( array  $properties)

Changes the virtual server configuration using given properties.

Parameters
array$properties
Returns
void

Definition at line 1764 of file Server.php.

References TeamSpeak3_Node_Abstract\execute(), and TeamSpeak3_Node_Abstract\resetNodeInfo().

1765  {
1766  $this->execute("serveredit", $properties);
1767  $this->resetNodeInfo();
1768  }
TeamSpeak3_Node_Server::message (   $msg)

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

Parameters
string$msg
Returns
void

Definition at line 1776 of file Server.php.

References TeamSpeak3_Node_Abstract\execute(), TeamSpeak3_Node_Abstract\getId(), and TeamSpeak3\TEXTMSG_SERVER.

1777  {
1778  $this->execute("sendtextmessage", array("msg" => $msg, "target" => $this->getId(), "targetmode" => TeamSpeak3::TEXTMSG_SERVER));
1779  }
TeamSpeak3_Node_Server::messageList ( )

Returns a list of offline messages you've received.

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

Returns
array

Definition at line 1787 of file Server.php.

References request().

1788  {
1789  return $this->request("messagelist")->toAssocArray("msgid");
1790  }
TeamSpeak3_Node_Server::messageCreate (   $cluid,
  $subject,
  $message 
)

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

Parameters
string$cluid
string$subject
string$message
Returns
void

Definition at line 1800 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

1801  {
1802  $this->execute("messageadd", array("cluid" => $cluid, "subject" => $subject, "message" => $message));
1803  }
TeamSpeak3_Node_Server::messageDelete (   $msgid)

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

Parameters
integer$msgid
Returns
void

Definition at line 1811 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

1812  {
1813  $this->execute("messagedel", array("msgid" => $msgid));
1814  }
TeamSpeak3_Node_Server::messageRead (   $msgid,
  $flag_read = TRUE 
)

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

Parameters
integer$msgid
boolean$flag_read
Returns
array

Definition at line 1823 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

1824  {
1825  $msg = $this->execute("messageget", array("msgid" => $msgid))->toList();
1826 
1827  if($flag_read)
1828  {
1829  $this->execute("messageget", array("msgid" => $msgid, "flag" => $flag_read));
1830  }
1831 
1832  return $msg;
1833  }
TeamSpeak3_Node_Server::snapshotCreate (   $mode = TeamSpeak3::SNAPSHOT_STRING)

Creates and returns snapshot data for the selected virtual server.

Parameters
string$mode
Returns
string

Definition at line 1841 of file Server.php.

References request(), TeamSpeak3\SNAPSHOT_BASE64, and TeamSpeak3\SNAPSHOT_HEXDEC.

1842  {
1843  $snapshot = $this->request("serversnapshotcreate")->toString(FALSE);
1844 
1845  switch($mode)
1846  {
1848  return $snapshot->toBase64();
1849  break;
1850 
1852  return $snapshot->toHex();
1853  break;
1854 
1855  default:
1856  return (string) $snapshot;
1857  break;
1858  }
1859  }
TeamSpeak3_Node_Server::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

Definition at line 1869 of file Server.php.

References TeamSpeak3_Helper_String\factory(), TeamSpeak3_Helper_String\fromBase64(), TeamSpeak3_Helper_String\fromHex(), TeamSpeak3_Helper_Signal\getInstance(), TeamSpeak3_Node_Abstract\getParent(), request(), TeamSpeak3\SNAPSHOT_BASE64, and TeamSpeak3\SNAPSHOT_HEXDEC.

1870  {
1871  switch($mode)
1872  {
1874  $data = TeamSpeak3_Helper_String::fromBase64($data);
1875  break;
1876 
1878  $data = TeamSpeak3_Helper_String::fromHex($data);
1879  break;
1880 
1881  default:
1882  $data = TeamSpeak3_Helper_String::factory($data);
1883  break;
1884  }
1885 
1886  $detail = $this->request("serversnapshotdeploy " . $data)->toList();
1887 
1888  if(array_key_exists("sid", $detail))
1889  {
1890  TeamSpeak3_Helper_Signal::getInstance()->emit("notifyServercreated", $this->getParent(), $detail["sid"]);
1891  }
1892 
1893  return $detail;
1894  }
TeamSpeak3_Node_Server::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

Definition at line 1905 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

1906  {
1907  $this->execute("servernotifyregister", array("event" => $event, "id" => $id));
1908  }
TeamSpeak3_Node_Server::notifyUnregister ( )

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

Returns
void

Definition at line 1916 of file Server.php.

References request().

1917  {
1918  $this->request("servernotifyunregister");
1919  }
TeamSpeak3_Node_Server::tokenList (   $translate = FALSE)

Alias for privilegeKeyList().

Deprecated:

Definition at line 1926 of file Server.php.

References privilegeKeyList().

1927  {
1928  return $this->privilegeKeyList();
1929  }
TeamSpeak3_Node_Server::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

Definition at line 1939 of file Server.php.

References channelGetById(), and request().

Referenced by tokenList().

1940  {
1941  $tokens = $this->request("privilegekeylist")->toAssocArray("token");
1942 
1943  if($resolve)
1944  {
1945  foreach($tokens as $token => $array)
1946  {
1947  $func = $array["token_type"] ? "channelGroupGetById" : "serverGroupGetById";
1948 
1949  try
1950  {
1951  $tokens[$token]["token_id1"] = $this->$func($array["token_id1"])->name;
1952  }
1953  catch(Exception $e)
1954  {
1955  /* ERROR_channel_invalid_id */
1956  if($e->getCode() != 0xA00) throw $e;
1957  }
1958 
1959  try
1960  {
1961  if($array["token_type"]) $tokens[$token]["token_id2"] = $this->channelGetById($array["token_id2"])->getPathway();
1962  }
1963  catch(Exception $e)
1964  {
1965  /* ERROR_permission_invalid_group_id */
1966  if($e->getCode() != 0x300) throw $e;
1967  }
1968  }
1969  }
1970 
1971  return $tokens;
1972  }
TeamSpeak3_Node_Server::tokenCreate (   $type = TeamSpeak3::TOKEN_SERVERGROUP,
  $id1,
  $id2 = 0,
  $description = null,
  $customset = null 
)

Alias for privilegeKeyCreate().

Deprecated:

Definition at line 1979 of file Server.php.

References privilegeKeyCreate().

1980  {
1981  return $this->privilegeKeyCreate($type, $id1, $id2, $description, $customset);
1982  }
TeamSpeak3_Node_Server::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

Definition at line 1994 of file Server.php.

References TeamSpeak3_Node_Abstract\execute(), and TeamSpeak3_Helper_Signal\getInstance().

Referenced by tokenCreate().

1995  {
1996  $token = $this->execute("privilegekeyadd", array("tokentype" => $type, "tokenid1" => $id1, "tokenid2" => $id2, "tokendescription" => $description, "tokencustomset" => $customset))->toList();
1997 
1998  TeamSpeak3_Helper_Signal::getInstance()->emit("notifyTokencreated", $this, $token["token"]);
1999 
2000  return $token["token"];
2001  }
TeamSpeak3_Node_Server::tokenDelete (   $token)

Alias for privilegeKeyDelete().

Deprecated:

Definition at line 2008 of file Server.php.

References privilegeKeyDelete().

2009  {
2010  $this->privilegeKeyDelete($token);
2011  }
TeamSpeak3_Node_Server::privilegeKeyDelete (   $token)

Deletes a token specified by key $token.

Parameters
string$token
Returns
void

Definition at line 2019 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

Referenced by tokenDelete().

2020  {
2021  $this->execute("privilegekeydelete", array("token" => $token));
2022  }
TeamSpeak3_Node_Server::tokenUse (   $token)

Alias for privilegeKeyUse().

Deprecated:

Definition at line 2029 of file Server.php.

References privilegeKeyUse().

2030  {
2031  $this->privilegeKeyUse($token);
2032  }
TeamSpeak3_Node_Server::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

Definition at line 2041 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

Referenced by tokenUse().

2042  {
2043  $this->execute("privilegekeyuse", array("token" => $token));
2044  }
TeamSpeak3_Node_Server::customSearch (   $ident,
  $pattern = "%" 
)

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

Parameters
string$ident
string$pattern
Returns
array

Definition at line 2053 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2054  {
2055  return $this->execute("customsearch", array("ident" => $ident, "pattern" => $pattern))->toArray();
2056  }
TeamSpeak3_Node_Server::customInfo (   $cldbid)

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

Parameters
integer$cldbid
Returns
array

Definition at line 2064 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2065  {
2066  return $this->execute("custominfo", array("cldbid" => $cldbid))->toArray();
2067  }
TeamSpeak3_Node_Server::banList ( )

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

Returns
array

Definition at line 2074 of file Server.php.

References request().

2075  {
2076  return $this->request("banlist")->toAssocArray("banid");
2077  }
TeamSpeak3_Node_Server::banListClear ( )

Deletes all active ban rules from the server.

Returns
void

Definition at line 2084 of file Server.php.

References request().

2085  {
2086  $this->request("bandelall");
2087  }
TeamSpeak3_Node_Server::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

Definition at line 2098 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2099  {
2100  $rules["time"] = $timeseconds;
2101  $rules["banreason"] = $reason;
2102 
2103  $banid = $this->execute("banadd", $rules)->toList();
2104 
2105  return $banid["banid"];
2106  }
TeamSpeak3_Node_Server::banDelete (   $banid)

Deletes the specified ban rule from the server.

Parameters
integer$banid
Returns
void

Definition at line 2114 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2115  {
2116  $this->execute("bandel", array("banid" => $banid));
2117  }
TeamSpeak3_Node_Server::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

Definition at line 2126 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2127  {
2128  return $this->execute("complainlist", array("tcldbid" => $tcldbid))->toArray();
2129  }
TeamSpeak3_Node_Server::complaintListClear (   $tcldbid)

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

Parameters
integer$tcldbid
Returns
void

Definition at line 2137 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2138  {
2139  $this->execute("complaindelall", array("tcldbid" => $tcldbid));
2140  }
TeamSpeak3_Node_Server::complaintCreate (   $tcldbid,
  $message 
)

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

Parameters
integer$tcldbid
string$message
Returns
void

Definition at line 2149 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2150  {
2151  $this->execute("complainadd", array("tcldbid" => $tcldbid, "message" => $message));
2152  }
TeamSpeak3_Node_Server::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

Definition at line 2161 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2162  {
2163  $this->execute("complaindel", array("tcldbid" => $tcldbid, "fcldbid" => $fcldbid));
2164  }
TeamSpeak3_Node_Server::tempPasswordList (   $resolve = FALSE)

Returns a list of temporary server passwords.

Parameters
boolean$resolve
Returns
array

Definition at line 2172 of file Server.php.

References channelGetById(), and request().

2173  {
2174  $passwords = $this->request("servertemppasswordlist")->toAssocArray("pw_clear");
2175 
2176  if($resolve)
2177  {
2178  foreach($passwords as $password => $array)
2179  {
2180  try
2181  {
2182  $channel = $this->channelGetById($array["tcid"]);
2183 
2184  $passwords[$password]["tcname"] = $channel->toString();
2185  $passwords[$password]["tcpath"] = $channel->getPathway();
2186  }
2187  catch(Exception $e)
2188  {
2189  /* ERROR_channel_invalid_id */
2190  if($e->getCode() != 0xA00) throw $e;
2191  }
2192  }
2193  }
2194 
2195  return $passwords;
2196  }
TeamSpeak3_Node_Server::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

Definition at line 2211 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2212  {
2213  $this->execute("servertemppasswordadd", array("pw" => $pw, "duration" => $duration, "tcid" => $tcid, "tcpw" => $tcpw, "desc" => $desc));
2214  }
TeamSpeak3_Node_Server::tempPasswordDelete (   $pw)

Deletes the temporary server password specified with $pw.

Parameters
string$pw
Returns
void

Definition at line 2222 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2223  {
2224  $this->execute("servertemppassworddel", array("pw" => $pw));
2225  }
TeamSpeak3_Node_Server::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

Definition at line 2236 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2237  {
2238  return $this->execute("logview", array("lines" => $lines, "begin_pos" => $begin_pos, "instance" => $instance, "reverse" => $reverse))->toArray();
2239  }
TeamSpeak3_Node_Server::logAdd (   $logmsg,
  $loglevel = TeamSpeak3::LOGLEVEL_INFO 
)

Writes a custom entry into the virtual server log.

Parameters
string$logmsg
integer$loglevel
Returns
void

Definition at line 2248 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2249  {
2250  $this->execute("logadd", array("logmsg" => $logmsg, "loglevel" => $loglevel));
2251  }
TeamSpeak3_Node_Server::connectionInfo ( )

Returns detailed connection information of the virtual server.

Returns
array

Definition at line 2258 of file Server.php.

References request().

2259  {
2260  return $this->request("serverrequestconnectioninfo")->toList();
2261  }
TeamSpeak3_Node_Server::delete ( )

Deletes the virtual server.

Returns
void

Definition at line 2268 of file Server.php.

References TeamSpeak3_Node_Abstract\getId(), and TeamSpeak3_Node_Abstract\getParent().

2269  {
2270  $this->getParent()->serverDelete($this->getId());
2271 
2272  unset($this);
2273  }
TeamSpeak3_Node_Server::start ( )

Starts the virtual server.

Returns
void

Definition at line 2280 of file Server.php.

References TeamSpeak3_Node_Abstract\getId(), and TeamSpeak3_Node_Abstract\getParent().

2281  {
2282  $this->getParent()->serverStart($this->getId());
2283  }
TeamSpeak3_Node_Server::stop ( )

Stops the virtual server.

Returns
void

Definition at line 2290 of file Server.php.

References TeamSpeak3_Node_Abstract\getId(), and TeamSpeak3_Node_Abstract\getParent().

2291  {
2292  $this->getParent()->serverStop($this->getId());
2293  }
TeamSpeak3_Node_Server::sendPluginCmd (   $plugin,
  $data 
)

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

Parameters
string$plugin
string$data
Returns
void

Definition at line 2302 of file Server.php.

References TeamSpeak3_Node_Abstract\execute(), and TeamSpeak3\PLUGINCMD_SERVER.

2303  {
2304  $this->execute("plugincmd", array("name" => $plugin, "data" => $data, "targetmode" => TeamSpeak3::PLUGINCMD_SERVER));
2305  }
TeamSpeak3_Node_Server::selfUpdate ( array  $properties)

Changes the properties of your own client connection.

Parameters
array$properties
Returns
void

Definition at line 2313 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2314  {
2315  $this->execute("clientupdate", $properties);
2316 
2317  foreach($properties as $ident => $value)
2318  {
2319  $this->whoamiSet($ident, $value);
2320  }
2321  }
TeamSpeak3_Node_Server::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

Definition at line 2330 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2331  {
2332  $password = $this->execute("clientsetserverquerylogin", array("client_login_name" => $username))->toList();
2333 
2334  return $password["client_login_password"];
2335  }
TeamSpeak3_Node_Server::selfPermOverview ( )

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

Returns
array

Definition at line 2342 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

2343  {
2344  return $this->execute("permoverview", array("cldbid" => $this->whoamiGet("client_database_id"), "cid" => $this->whoamiGet("client_channel_id"), "permid" => 0))->toArray();
2345  }
TeamSpeak3_Node_Server::fetchNodeList ( )
protected

Definition at line 2350 of file Server.php.

References channelList().

2351  {
2352  $this->nodeList = array();
2353 
2354  foreach($this->channelList() as $channel)
2355  {
2356  if($channel["pid"] == 0)
2357  {
2358  $this->nodeList[] = $channel;
2359  }
2360  }
2361  }
TeamSpeak3_Node_Server::fetchNodeInfo ( )
protected

Definition at line 2366 of file Server.php.

References request().

2367  {
2368  $this->nodeInfo = array_merge($this->nodeInfo, $this->request("serverinfo")->toList());
2369  }
static TeamSpeak3_Node_Server::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

Definition at line 2378 of file Server.php.

References TeamSpeak3_Node_Abstract\getProperty().

2379  {
2380  if(get_class($a) != get_class($b))
2381  {
2382  return 0;
2383 
2384  /* workaround for PHP bug #50688 */
2385  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
2386  }
2387 
2388  if(!$a instanceof TeamSpeak3_Node_Client)
2389  {
2390  return 0;
2391 
2392  /* workaround for PHP bug #50688 */
2393  throw new TeamSpeak3_Adapter_ServerQuery_Exception("convert error", 0x604);
2394  }
2395 
2396  if($a->getProperty("client_talk_power", 0) != $b->getProperty("client_talk_power", 0))
2397  {
2398  return ($a->getProperty("client_talk_power", 0) > $b->getProperty("client_talk_power", 0)) ? -1 : 1;
2399  }
2400 
2401  if($a->getProperty("client_is_talker", 0) != $b->getProperty("client_is_talker", 0))
2402  {
2403  return ($a->getProperty("client_is_talker", 0) > $b->getProperty("client_is_talker", 0)) ? -1 : 1;
2404  }
2405 
2406  return strcmp(strtolower($a["client_nickname"]), strtolower($b["client_nickname"]));
2407  }
static TeamSpeak3_Node_Server::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

Definition at line 2416 of file Server.php.

References TeamSpeak3_Node_Abstract\getId(), and TeamSpeak3_Node_Abstract\getProperty().

2417  {
2418  if(get_class($a) != get_class($b))
2419  {
2420  return 0;
2421 
2422  /* workaround for PHP bug #50688 */
2423  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
2424  }
2425 
2426  if(!$a instanceof TeamSpeak3_Node_Servergroup && !$a instanceof TeamSpeak3_Node_Channelgroup)
2427  {
2428  return 0;
2429 
2430  /* workaround for PHP bug #50688 */
2431  throw new TeamSpeak3_Adapter_ServerQuery_Exception("convert error", 0x604);
2432  }
2433 
2434  if($a->getProperty("sortid", 0) != $b->getProperty("sortid", 0) && $a->getProperty("sortid", 0) != 0 && $b->getProperty("sortid", 0) != 0)
2435  {
2436  return ($a->getProperty("sortid", 0) < $b->getProperty("sortid", 0)) ? -1 : 1;
2437  }
2438 
2439  return ($a->getId() < $b->getId()) ? -1 : 1;
2440  }
static TeamSpeak3_Node_Server::sortFileList ( array  $a,
array  $b 
)
staticprotected

Internal callback funtion for sorting of file list items.

Parameters
array$a
array$b
Returns
integer

Definition at line 2449 of file Server.php.

2450  {
2451  if(!array_key_exists("src", $a) || !array_key_exists("src", $b) || !array_key_exists("type", $a) || !array_key_exists("type", $b))
2452  {
2453  return 0;
2454 
2455  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
2456  }
2457 
2458  if($a["type"] != $b["type"])
2459  {
2460  return ($a["type"] < $b["type"]) ? -1 : 1;
2461  }
2462 
2463  return strcmp(strtolower($a["src"]), strtolower($b["src"]));
2464  }
TeamSpeak3_Node_Server::isOnline ( )

Returns TRUE if the virtual server is online.

Returns
boolean

Definition at line 2471 of file Server.php.

2472  {
2473  return ($this["virtualserver_status"] == "online") ? TRUE : FALSE;
2474  }
TeamSpeak3_Node_Server::isOffline ( )

Returns TRUE if the virtual server is offline.

Returns
boolean

Definition at line 2481 of file Server.php.

Referenced by clientCount().

2482  {
2483  return ($this["virtualserver_status"] == "offline") ? TRUE : FALSE;
2484  }
TeamSpeak3_Node_Server::getUniqueId ( )

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

Returns
string

Definition at line 2491 of file Server.php.

References TeamSpeak3_Node_Abstract\getId(), and TeamSpeak3_Node_Abstract\getParent().

2492  {
2493  return $this->getParent()->getUniqueId() . "_s" . $this->getId();
2494  }
TeamSpeak3_Node_Server::getIcon ( )

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

Returns
string

Definition at line 2501 of file Server.php.

2502  {
2503  if($this["virtualserver_clientsonline"]-$this["virtualserver_queryclientsonline"] >= $this["virtualserver_maxclients"])
2504  {
2505  return "server_full";
2506  }
2507  elseif($this["virtualserver_flag_password"])
2508  {
2509  return "server_pass";
2510  }
2511  else
2512  {
2513  return "server_open";
2514  }
2515  }
TeamSpeak3_Node_Server::getSymbol ( )

Returns a symbol representing the node.

Returns
string

Definition at line 2522 of file Server.php.

2523  {
2524  return "$";
2525  }
TeamSpeak3_Node_Server::__toString ( )

Returns a string representation of this node.

Returns
string

Definition at line 2532 of file Server.php.

2533  {
2534  return (string) $this["virtualserver_name"];
2535  }
TeamSpeak3_Node_Abstract::prepare (   $cmd,
array  $params = array() 
)
inherited

Uses given parameters and returns a prepared ServerQuery command.

Parameters
string$cmd
array$params
Returns
TeamSpeak3_Helper_String

Definition at line 83 of file Abstract.php.

References TeamSpeak3_Node_Abstract\getParent().

Referenced by TeamSpeak3_Node_Abstract\execute().

84  {
85  return $this->getParent()->prepare($cmd, $params);
86  }
TeamSpeak3_Node_Abstract::execute (   $cmd,
array  $params = array() 
)
inherited

Prepares and executes a ServerQuery command and returns the result.

Parameters
string$cmd
array$params
Returns
TeamSpeak3_Adapter_ServerQuery_Reply

Definition at line 95 of file Abstract.php.

References TeamSpeak3_Node_Abstract\prepare(), and TeamSpeak3_Node_Abstract\request().

Referenced by banCreate(), banDelete(), channelClientPermAssign(), channelClientPermList(), channelClientPermRemove(), channelCreate(), channelDelete(), channelDirCreate(), channelFileDelete(), channelFileInfo(), channelFileList(), channelFileRename(), channelGroupClientList(), channelGroupCopy(), channelGroupCreate(), channelGroupDelete(), channelGroupPermAssign(), channelGroupPermList(), channelGroupPermRemove(), channelGroupRename(), channelMove(), channelPermAssign(), channelPermList(), channelPermRemove(), clientBan(), clientCountDb(), clientDeleteDb(), clientFind(), clientFindDb(), clientGetIdsByUid(), clientGetNameByDbid(), clientGetNameByUid(), clientGetServerGroupsByDbid(), clientInfoDb(), clientKick(), clientListDb(), clientModifyDb(), clientMove(), clientPermAssign(), clientPermList(), clientPermRemove(), clientPoke(), clientSetChannelGroup(), complaintCreate(), complaintDelete(), complaintList(), complaintListClear(), customInfo(), customSearch(), TeamSpeak3_Node_Client\fetchNodeInfo(), TeamSpeak3_Node_Channel\fetchNodeInfo(), TeamSpeak3_Node_Client\getClones(), TeamSpeak3_Node_Host\logAdd(), logAdd(), TeamSpeak3_Node_Host\login(), TeamSpeak3_Node_Host\logView(), logView(), TeamSpeak3_Node_Client\message(), TeamSpeak3_Node_Channelgroup\message(), TeamSpeak3_Node_Servergroup\message(), TeamSpeak3_Node_Channel\message(), TeamSpeak3_Node_Host\message(), message(), messageCreate(), messageDelete(), messageRead(), TeamSpeak3_Node_Client\modify(), TeamSpeak3_Node_Channel\modify(), TeamSpeak3_Node_Host\modify(), modify(), notifyRegister(), TeamSpeak3_Node_Host\permissionFind(), TeamSpeak3_Node_Client\permOverview(), privilegeKeyCreate(), privilegeKeyDelete(), privilegeKeyUse(), TeamSpeak3_Node_Host\selfPermCheck(), selfPermOverview(), selfUpdate(), selfUpdateLogin(), TeamSpeak3_Node_Client\sendPluginCmd(), TeamSpeak3_Node_Channel\sendPluginCmd(), sendPluginCmd(), TeamSpeak3_Node_Host\serverCreate(), TeamSpeak3_Node_Host\serverDelete(), serverGroupClientAdd(), serverGroupClientDel(), serverGroupClientList(), serverGroupCopy(), serverGroupCreate(), serverGroupDelete(), serverGroupPermAssign(), TeamSpeak3_Node_Host\serverGroupPermAutoAssign(), TeamSpeak3_Node_Host\serverGroupPermAutoRemove(), serverGroupPermList(), serverGroupPermRemove(), serverGroupRename(), TeamSpeak3_Node_Host\serverIdGetByPort(), TeamSpeak3_Node_Host\serverSelect(), TeamSpeak3_Node_Host\serverSelectByPort(), TeamSpeak3_Node_Host\serverStart(), TeamSpeak3_Node_Host\serverStop(), TeamSpeak3_Node_Host\serverStopProcess(), tempPasswordCreate(), tempPasswordDelete(), transferInitDownload(), transferInitUpload(), and transferStop().

96  {
97  return $this->request($this->prepare($cmd, $params));
98  }
TeamSpeak3_Node_Abstract::getParent ( )
inherited

Returns the parent object of the current node.

Returns
TeamSpeak3_Adapter_ServerQuery
TeamSpeak3_Node_Abstract

Definition at line 106 of file Abstract.php.

References TeamSpeak3_Node_Abstract\$parent.

Referenced by TeamSpeak3_Node_Abstract\__call(), TeamSpeak3_Node_Client\addServerGroup(), TeamSpeak3_Node_Client\avatarDownload(), TeamSpeak3_Node_Client\ban(), channelCreate(), channelDelete(), TeamSpeak3_Node_Servergroup\clientAdd(), TeamSpeak3_Node_Servergroup\clientDel(), TeamSpeak3_Node_Channel\clientList(), TeamSpeak3_Node_Channelgroup\clientList(), TeamSpeak3_Node_Servergroup\clientList(), clientList(), clientMove(), TeamSpeak3_Node_Channel\clientPermAssign(), TeamSpeak3_Node_Channel\clientPermList(), TeamSpeak3_Node_Channel\clientPermRemove(), TeamSpeak3_Node_Servergroup\copy(), TeamSpeak3_Node_Channelgroup\copy(), TeamSpeak3_Node_Client\customInfo(), TeamSpeak3_Node_Servergroup\delete(), TeamSpeak3_Node_Channelgroup\delete(), TeamSpeak3_Node_Channel\delete(), delete(), TeamSpeak3_Node_Client\deleteDb(), TeamSpeak3_Node_Channel\dirCreate(), TeamSpeak3_Node_Channelgroup\fetchNodeList(), TeamSpeak3_Node_Servergroup\fetchNodeList(), TeamSpeak3_Node_Channel\fetchNodeList(), TeamSpeak3_Node_Channel\fileDelete(), TeamSpeak3_Node_Channel\fileInfo(), TeamSpeak3_Node_Channel\fileList(), TeamSpeak3_Node_Channel\fileRename(), TeamSpeak3_Node_Host\getAdapter(), TeamSpeak3_Node_Host\getAdapterHost(), TeamSpeak3_Node_Host\getAdapterPort(), TeamSpeak3_Node_Channel\getLevel(), TeamSpeak3_Node_Channel\getPathway(), TeamSpeak3_Node_Channelgroup\getUniqueId(), TeamSpeak3_Node_Servergroup\getUniqueId(), TeamSpeak3_Node_Client\getUniqueId(), TeamSpeak3_Node_Channel\getUniqueId(), getUniqueId(), TeamSpeak3_Node_Channelgroup\iconDownload(), TeamSpeak3_Node_Servergroup\iconDownload(), TeamSpeak3_Node_Client\iconDownload(), TeamSpeak3_Node_Channel\iconDownload(), TeamSpeak3_Node_Client\infoDb(), TeamSpeak3_Node_Channel\isSpacer(), TeamSpeak3_Node_Client\kick(), TeamSpeak3_Node_Client\memberOf(), TeamSpeak3_Node_Channel\message(), TeamSpeak3_Node_Client\modifyDb(), TeamSpeak3_Node_Client\move(), TeamSpeak3_Node_Channel\move(), TeamSpeak3_Node_Channelgroup\permAssign(), TeamSpeak3_Node_Servergroup\permAssign(), TeamSpeak3_Node_Client\permAssign(), TeamSpeak3_Node_Channel\permAssign(), TeamSpeak3_Node_Servergroup\permList(), TeamSpeak3_Node_Channelgroup\permList(), TeamSpeak3_Node_Client\permList(), TeamSpeak3_Node_Channel\permList(), TeamSpeak3_Node_Channelgroup\permRemove(), TeamSpeak3_Node_Servergroup\permRemove(), TeamSpeak3_Node_Client\permRemove(), TeamSpeak3_Node_Channel\permRemove(), TeamSpeak3_Node_Client\poke(), TeamSpeak3_Node_Abstract\prepare(), TeamSpeak3_Node_Channelgroup\privilegeKeyCreate(), TeamSpeak3_Node_Servergroup\privilegeKeyCreate(), TeamSpeak3_Node_Client\remServerGroup(), TeamSpeak3_Node_Channelgroup\rename(), TeamSpeak3_Node_Servergroup\rename(), TeamSpeak3_Node_Abstract\request(), request(), TeamSpeak3_Node_Channel\sendPluginCmd(), TeamSpeak3_Node_Client\setChannelGroup(), snapshotDeploy(), TeamSpeak3_Node_Channel\spacerGetAlign(), TeamSpeak3_Node_Channel\spacerGetType(), start(), stop(), TeamSpeak3_Node_Channel\subChannelList(), transferInitDownload(), and transferInitUpload().

107  {
108  return $this->parent;
109  }
TeamSpeak3_Node_Abstract::getId ( )
inherited

Returns the primary ID of the current node.

Returns
integer

Definition at line 116 of file Abstract.php.

References TeamSpeak3_Node_Abstract\$nodeId.

Referenced by TeamSpeak3_Node_Client\ban(), channelDelete(), channelFileList(), TeamSpeak3_Node_Servergroup\clientAdd(), TeamSpeak3_Node_Servergroup\clientDel(), TeamSpeak3_Node_Channel\clientList(), TeamSpeak3_Node_Channelgroup\clientList(), TeamSpeak3_Node_Servergroup\clientList(), TeamSpeak3_Node_Channel\clientPermAssign(), TeamSpeak3_Node_Channel\clientPermList(), TeamSpeak3_Node_Channel\clientPermRemove(), TeamSpeak3_Node_Servergroup\copy(), TeamSpeak3_Node_Channelgroup\copy(), TeamSpeak3_Node_Channelgroup\delete(), TeamSpeak3_Node_Servergroup\delete(), TeamSpeak3_Node_Channel\delete(), delete(), TeamSpeak3_Node_Channel\dirCreate(), TeamSpeak3_Node_Client\fetchNodeInfo(), TeamSpeak3_Node_Channel\fetchNodeInfo(), TeamSpeak3_Node_Channelgroup\fetchNodeList(), TeamSpeak3_Node_Servergroup\fetchNodeList(), TeamSpeak3_Node_Channel\fetchNodeList(), TeamSpeak3_Node_Channel\fileDelete(), TeamSpeak3_Node_Channel\fileInfo(), TeamSpeak3_Node_Channel\fileList(), TeamSpeak3_Node_Channel\fileRename(), TeamSpeak3_Node_Channel\getLevel(), TeamSpeak3_Node_Channel\getPathway(), TeamSpeak3_Node_Channelgroup\getUniqueId(), TeamSpeak3_Node_Servergroup\getUniqueId(), TeamSpeak3_Node_Client\getUniqueId(), TeamSpeak3_Node_Channel\getUniqueId(), getUniqueId(), TeamSpeak3_Node_Client\kick(), TeamSpeak3_Node_Client\message(), TeamSpeak3_Node_Channel\message(), message(), TeamSpeak3_Node_Client\modify(), TeamSpeak3_Node_Channel\modify(), TeamSpeak3_Node_Client\move(), TeamSpeak3_Node_Channel\move(), TeamSpeak3_Node_Channelgroup\permAssign(), TeamSpeak3_Node_Servergroup\permAssign(), TeamSpeak3_Node_Channel\permAssign(), TeamSpeak3_Node_Channelgroup\permList(), TeamSpeak3_Node_Servergroup\permList(), TeamSpeak3_Node_Channel\permList(), TeamSpeak3_Node_Channelgroup\permRemove(), TeamSpeak3_Node_Servergroup\permRemove(), TeamSpeak3_Node_Channel\permRemove(), TeamSpeak3_Node_Client\poke(), TeamSpeak3_Node_Channelgroup\privilegeKeyCreate(), TeamSpeak3_Node_Servergroup\privilegeKeyCreate(), TeamSpeak3_Node_Channelgroup\rename(), TeamSpeak3_Node_Servergroup\rename(), request(), TeamSpeak3_Node_Client\sendPluginCmd(), TeamSpeak3_Node_Channel\sendPluginCmd(), sortGroupList(), TeamSpeak3_Node_Channel\spacerGetAlign(), TeamSpeak3_Node_Channel\spacerGetType(), start(), stop(), and TeamSpeak3_Node_Channel\subChannelList().

117  {
118  return $this->nodeId;
119  }
TeamSpeak3_Node_Abstract::iconIsLocal (   $key)
inherited

Returns TRUE if the node icon has a local source.

Parameters
string$key
Returns
boolean

Definition at line 127 of file Abstract.php.

Referenced by TeamSpeak3_Node_Channelgroup\iconDownload(), TeamSpeak3_Node_Servergroup\iconDownload(), TeamSpeak3_Node_Client\iconDownload(), TeamSpeak3_Node_Channel\iconDownload(), and iconDownload().

128  {
129  return ($this[$key] > 0 && $this[$key] < 1000) ? TRUE : FALSE;
130  }
TeamSpeak3_Node_Abstract::iconGetName (   $key)
inherited

Returns the internal path of the node icon.

Parameters
string$key
Returns
TeamSpeak3_Helper_String

Definition at line 138 of file Abstract.php.

Referenced by TeamSpeak3_Node_Abstract\getInfo(), TeamSpeak3_Node_Channelgroup\iconDownload(), TeamSpeak3_Node_Servergroup\iconDownload(), TeamSpeak3_Node_Client\iconDownload(), TeamSpeak3_Node_Channel\iconDownload(), and iconDownload().

139  {
140  $iconid = ($this[$key] < 0) ? (pow(2, 32))-($this[$key]*-1) : $this[$key];
141 
142  return new TeamSpeak3_Helper_String("/icon_" . $iconid);
143  }
TeamSpeak3_Node_Abstract::getClass (   $prefix = "ts3_")
inherited

Returns a possible classname for the node which can be used as a HTML property.

Parameters
string$prefix
Returns
string

Definition at line 151 of file Abstract.php.

References TeamSpeak3_Helper_String\factory().

152  {
153  if($this instanceof TeamSpeak3_Node_Channel && $this->isSpacer())
154  {
155  return $prefix . "spacer";
156  }
157  elseif($this instanceof TeamSpeak3_Node_Client && $this["client_type"])
158  {
159  return $prefix . "query";
160  }
161 
162  return $prefix . TeamSpeak3_Helper_String::factory(get_class($this))->section("_", 2)->toLower();
163  }
TeamSpeak3_Node_Abstract::getViewer ( TeamSpeak3_Viewer_Interface  $viewer)
inherited

Returns the HTML code to display a TeamSpeak 3 viewer.

Parameters
TeamSpeak3_Viewer_Interface$viewer
Returns
string

Definition at line 192 of file Abstract.php.

References TeamSpeak3_Viewer_Interface\fetchObject().

193  {
194  $html = $viewer->fetchObject($this);
195 
196  $iterator = new RecursiveIteratorIterator($this, RecursiveIteratorIterator::SELF_FIRST);
197 
198  foreach($iterator as $node)
199  {
200  $siblings = array();
201 
202  for($level = 0; $level < $iterator->getDepth(); $level++)
203  {
204  $siblings[] = ($iterator->getSubIterator($level)->hasNext()) ? 1 : 0;
205  }
206 
207  $siblings[] = (!$iterator->getSubIterator($level)->hasNext()) ? 1 : 0;
208 
209  $html .= $viewer->fetchObject($node, $siblings);
210  }
211 
212  return $html;
213  }
TeamSpeak3_Node_Abstract::filterList ( array  $nodes = array(),
array  $rules = array() 
)
protectedinherited

Filters given node list array using specified filter rules.

Parameters
array$nodes
array$rules
Returns
array

Definition at line 222 of file Abstract.php.

Referenced by channelGroupList(), channelList(), TeamSpeak3_Node_Channel\clientList(), clientList(), serverGroupList(), TeamSpeak3_Node_Host\serverList(), and TeamSpeak3_Node_Channel\subChannelList().

223  {
224  if(!empty($rules))
225  {
226  foreach($nodes as $node)
227  {
228  if(!$node instanceof TeamSpeak3_Node_Abstract) continue;
229 
230  $props = $node->getInfo(FALSE);
231  $props = array_intersect_key($props, $rules);
232  $match = TRUE;
233 
234  foreach($props as $key => $val)
235  {
236  if($val instanceof TeamSpeak3_Helper_String)
237  {
238  $match = $val->contains($rules[$key], TRUE);
239  }
240  else
241  {
242  $match = $val == $rules[$key];
243  }
244 
245  if($match === FALSE)
246  {
247  unset($nodes[$node->getId()]);
248  }
249  }
250  }
251  }
252 
253  return $nodes;
254  }
TeamSpeak3_Node_Abstract::getInfo (   $extend = TRUE,
  $convert = FALSE 
)
inherited

Returns all information available on this node.

If $convert is enabled, some property values will be converted to human-readable values.

Parameters
boolean$extend
boolean$convert
Returns
array

Definition at line 264 of file Abstract.php.

References TeamSpeak3_Node_Abstract\$nodeInfo, TeamSpeak3_Helper_Convert\bytes(), TeamSpeak3_Helper_String\factory(), TeamSpeak3_Node_Abstract\fetchNodeInfo(), TeamSpeak3_Node_Abstract\iconGetName(), TeamSpeak3_Helper_Convert\seconds(), and TeamSpeak3_Helper_Convert\version().

265  {
266  if($extend)
267  {
268  $this->fetchNodeInfo();
269  }
270 
271  if($convert)
272  {
273  $info = $this->nodeInfo;
274 
275  foreach($info as $key => $val)
276  {
278 
279  if($key->contains("_bytes_"))
280  {
281  $info[$key->toString()] = TeamSpeak3_Helper_Convert::bytes($val);
282  }
283  elseif($key->contains("_bandwidth_"))
284  {
285  $info[$key->toString()] = TeamSpeak3_Helper_Convert::bytes($val) . "/s";
286  }
287  elseif($key->contains("_packets_"))
288  {
289  $info[$key->toString()] = number_format($val, null, null, ".");
290  }
291  elseif($key->contains("_packetloss_"))
292  {
293  $info[$key->toString()] = sprintf("%01.2f", floatval($val->toString())*100) . "%";
294  }
295  elseif($key->endsWith("_uptime"))
296  {
297  $info[$key->toString()] = TeamSpeak3_Helper_Convert::seconds($val);
298  }
299  elseif($key->endsWith("_version"))
300  {
301  $info[$key->toString()] = TeamSpeak3_Helper_Convert::version($val);
302  }
303  elseif($key->endsWith("_icon_id"))
304  {
305  $info[$key->toString()] = $this->iconGetName($key)->filterDigits();
306  }
307  }
308 
309  return $info;
310  }
311 
312  return $this->nodeInfo;
313  }
TeamSpeak3_Node_Abstract::getProperty (   $property,
  $default = null 
)
inherited

Returns the specified property or a pre-defined default value from the node info array.

Parameters
string$property
mixed$default
Returns
mixed

Definition at line 322 of file Abstract.php.

References TeamSpeak3_Node_Abstract\fetchNodeInfo(), and TeamSpeak3_Node_Abstract\offsetExists().

Referenced by sortClientList(), and sortGroupList().

323  {
324  if(!$this->offsetExists($property))
325  {
326  $this->fetchNodeInfo();
327  }
328 
329  if(!$this->offsetExists($property))
330  {
331  return $default;
332  }
333 
334  return $this->nodeInfo[(string) $property];
335  }
TeamSpeak3_Node_Abstract::toString ( )
inherited

Returns a string representation of this node.

Returns
string

Definition at line 352 of file Abstract.php.

References TeamSpeak3_Node_Abstract\__toString().

353  {
354  return $this->__toString();
355  }
TeamSpeak3_Node_Abstract::toArray ( )
inherited

Returns an assoc array filled with current node info properties.

Returns
array

Definition at line 362 of file Abstract.php.

References TeamSpeak3_Node_Abstract\$nodeList.

Referenced by channelFileInfo().

363  {
364  return $this->nodeList;
365  }
TeamSpeak3_Node_Abstract::__call (   $name,
array  $args 
)
inherited

Called whenever we're using an unknown method.

Parameters
string$name
array$args
Exceptions
TeamSpeak3_Node_Exception
Returns
mixed

Definition at line 375 of file Abstract.php.

References TeamSpeak3_Node_Abstract\getParent().

376  {
377  if($this->getParent() instanceof TeamSpeak3_Node_Abstract)
378  {
379  return call_user_func_array(array($this->getParent(), $name), $args);
380  }
381 
382  throw new TeamSpeak3_Node_Exception("node method '" . $name . "()' does not exist");
383  }
TeamSpeak3_Node_Abstract::setStorage (   $key,
  $val 
)
protectedinherited

Writes data to the internal storage array.

Parameters
string$key
mixed$val
Returns
void

Definition at line 392 of file Abstract.php.

Referenced by TeamSpeak3_Node_Host\login(), TeamSpeak3_Node_Host\serverSelect(), TeamSpeak3_Node_Host\serverSelectByPort(), TeamSpeak3_Node_Host\setExcludeQueryClients(), TeamSpeak3_Node_Host\setLoadClientlistFirst(), TeamSpeak3_Node_Host\setPredefinedQueryName(), and TeamSpeak3_Node_Host\setUseOfflineAsVirtual().

393  {
394  $this->storage[$key] = $val;
395  }
TeamSpeak3_Node_Abstract::getStorage (   $key,
  $default = null 
)
protectedinherited

Returns data from the internal storage array.

Parameters
string$key
mixed$default
Returns
mixed

Definition at line 404 of file Abstract.php.

Referenced by TeamSpeak3_Node_Host\__wakeup().

405  {
406  return (array_key_exists($key, $this->storage) && !empty($this->storage[$key])) ? $this->storage[$key] : $default;
407  }
TeamSpeak3_Node_Abstract::delStorage (   $key)
protectedinherited

Deletes data from the internal storage array.

Parameters
string$key
Returns
void

Definition at line 415 of file Abstract.php.

Referenced by TeamSpeak3_Node_Host\logout(), and TeamSpeak3_Node_Host\serverDeselect().

416  {
417  unset($this->storage[$key]);
418  }
TeamSpeak3_Node_Abstract::__sleep ( )
inherited

Commit pending data.

Returns
array

Definition at line 425 of file Abstract.php.

426  {
427  return array("parent", "storage", "nodeId");
428  }
TeamSpeak3_Node_Abstract::resetNodeInfo ( )
protectedinherited

Definition at line 449 of file Abstract.php.

Referenced by TeamSpeak3_Node_Client\modify(), TeamSpeak3_Node_Channel\modify(), TeamSpeak3_Node_Host\modify(), and modify().

450  {
451  $this->nodeInfo = array();
452  }
TeamSpeak3_Node_Abstract::resetNodeList ( )
protectedinherited

Definition at line 468 of file Abstract.php.

Referenced by channelList(), channelListReset(), clientList(), clientListReset(), TeamSpeak3_Node_Host\serverList(), and TeamSpeak3_Node_Host\serverListReset().

469  {
470  $this->nodeList = null;
471  }
TeamSpeak3_Node_Abstract::count ( )
inherited

Definition at line 476 of file Abstract.php.

References TeamSpeak3_Node_Abstract\verifyNodeList().

Referenced by channelFileList(), channelGroupCopy(), TeamSpeak3_Node_Abstract\hasNext(), permRemoveAny(), and serverGroupCopy().

477  {
478  $this->verifyNodeList();
479 
480  return count($this->nodeList);
481  }
TeamSpeak3_Node_Abstract::getChildren ( )
inherited

Definition at line 496 of file Abstract.php.

References TeamSpeak3_Node_Abstract\current(), and TeamSpeak3_Node_Abstract\verifyNodeList().

497  {
498  $this->verifyNodeList();
499 
500  return $this->current();
501  }
TeamSpeak3_Node_Abstract::hasChildren ( )
inherited

Definition at line 506 of file Abstract.php.

References TeamSpeak3_Node_Abstract\current(), and TeamSpeak3_Node_Abstract\verifyNodeList().

507  {
508  $this->verifyNodeList();
509 
510  return $this->current()->count() > 0;
511  }
TeamSpeak3_Node_Abstract::hasNext ( )
inherited

Definition at line 516 of file Abstract.php.

References TeamSpeak3_Node_Abstract\count(), TeamSpeak3_Node_Abstract\key(), and TeamSpeak3_Node_Abstract\verifyNodeList().

517  {
518  $this->verifyNodeList();
519 
520  return $this->key()+1 < $this->count();
521  }
TeamSpeak3_Node_Abstract::key ( )
inherited

Definition at line 526 of file Abstract.php.

References TeamSpeak3_Node_Abstract\verifyNodeList().

Referenced by TeamSpeak3_Node_Abstract\hasNext(), and TeamSpeak3_Node_Abstract\valid().

527  {
528  $this->verifyNodeList();
529 
530  return key($this->nodeList);
531  }
TeamSpeak3_Node_Abstract::valid ( )
inherited

Definition at line 536 of file Abstract.php.

References TeamSpeak3_Node_Abstract\key(), and TeamSpeak3_Node_Abstract\verifyNodeList().

537  {
538  $this->verifyNodeList();
539 
540  return $this->key() !== null;
541  }
TeamSpeak3_Node_Abstract::next ( )
inherited

Definition at line 546 of file Abstract.php.

References TeamSpeak3_Node_Abstract\verifyNodeList().

547  {
548  $this->verifyNodeList();
549 
550  return next($this->nodeList);
551  }
TeamSpeak3_Node_Abstract::rewind ( )
inherited

Definition at line 556 of file Abstract.php.

References TeamSpeak3_Node_Abstract\verifyNodeList().

557  {
558  $this->verifyNodeList();
559 
560  return reset($this->nodeList);
561  }
TeamSpeak3_Node_Abstract::offsetExists (   $offset)
inherited

Definition at line 566 of file Abstract.php.

Referenced by TeamSpeak3_Node_Abstract\getProperty(), and TeamSpeak3_Node_Abstract\offsetGet().

567  {
568  return array_key_exists((string) $offset, $this->nodeInfo) ? TRUE : FALSE;
569  }
TeamSpeak3_Node_Abstract::offsetGet (   $offset)
inherited

Definition at line 574 of file Abstract.php.

References TeamSpeak3_Node_Abstract\fetchNodeInfo(), and TeamSpeak3_Node_Abstract\offsetExists().

Referenced by TeamSpeak3_Node_Abstract\__get().

575  {
576  if(!$this->offsetExists($offset))
577  {
578  $this->fetchNodeInfo();
579  }
580 
581  if(!$this->offsetExists($offset))
582  {
583  throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
584  }
585 
586  return $this->nodeInfo[(string) $offset];
587  }
TeamSpeak3_Node_Abstract::offsetSet (   $offset,
  $value 
)
inherited

Definition at line 592 of file Abstract.php.

Referenced by TeamSpeak3_Node_Abstract\__set().

593  {
594  if(method_exists($this, "modify"))
595  {
596  return $this->modify(array((string) $offset => $value));
597  }
598 
599  throw new TeamSpeak3_Node_Exception("node '" . get_class($this) . "' is read only");
600  }
TeamSpeak3_Node_Abstract::offsetUnset (   $offset)
inherited

Definition at line 605 of file Abstract.php.

606  {
607  unset($this->nodeInfo[(string) $offset]);
608  }
TeamSpeak3_Node_Abstract::__get (   $offset)
inherited

Definition at line 613 of file Abstract.php.

References TeamSpeak3_Node_Abstract\offsetGet().

614  {
615  return $this->offsetGet($offset);
616  }
TeamSpeak3_Node_Abstract::__set (   $offset,
  $value 
)
inherited

Definition at line 621 of file Abstract.php.

References TeamSpeak3_Node_Abstract\offsetSet().

622  {
623  $this->offsetSet($offset, $value);
624  }

Member Data Documentation

TeamSpeak3_Node_Server::$channelList = null
protected

Definition at line 37 of file Server.php.

TeamSpeak3_Node_Server::$clientList = null
protected

Definition at line 42 of file Server.php.

TeamSpeak3_Node_Server::$sgroupList = null
protected

Definition at line 47 of file Server.php.

TeamSpeak3_Node_Server::$cgroupList = null
protected

Definition at line 52 of file Server.php.

TeamSpeak3_Node_Abstract::$parent = null
protectedinherited

Definition at line 37 of file Abstract.php.

Referenced by TeamSpeak3_Node_Abstract\getParent().

TeamSpeak3_Node_Abstract::$nodeId = 0x00
protectedinherited

Definition at line 47 of file Abstract.php.

Referenced by TeamSpeak3_Node_Abstract\getId().

TeamSpeak3_Node_Abstract::$nodeList = null
protectedinherited

Definition at line 52 of file Abstract.php.

Referenced by TeamSpeak3_Node_Abstract\toArray().

TeamSpeak3_Node_Abstract::$nodeInfo = array()
protectedinherited

Definition at line 57 of file Abstract.php.

Referenced by TeamSpeak3_Node_Abstract\getInfo().

TeamSpeak3_Node_Abstract::$storage = array()
protectedinherited

Definition at line 62 of file Abstract.php.


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