TeamSpeak 3 PHP Framework  1.1.12
TeamSpeak3_Node_Server Class Reference

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

Inheritance diagram for TeamSpeak3_Node_Server:
TeamSpeak3_Node_Abstract

List of all members.

Public Member Functions

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

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.

  {
    $this->parent = $host;
    $this->nodeInfo = $info;

    if(!array_key_exists($index, $this->nodeInfo))
    {
      throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid serverID", 0x400);
    }

    $this->nodeId = $this->nodeInfo[$index];
  }

Member Function Documentation

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

Parameters:
string$cmd
Returns:
TeamSpeak3_Adapter_ServerQuery_Reply

Reimplemented from TeamSpeak3_Node_Abstract.

Definition at line 82 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(), and transferList().

  {
    if($this->getId() != $this->getParent()->serverSelectedId())
    {
      $this->getParent()->serverSelect($this->getId());
    }

    return $this->getParent()->request($cmd);
  }
TeamSpeak3_Node_Server::channelList ( array $  filter = array())

Returns an array filled with TeamSpeak3_Node_Channel objects.

Parameters:
array$filter
Returns:
array

Definition at line 98 of file Server.php.

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

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

  {
    if($this->channelList === null)
    {
      $channels = $this->request("channellist -topic -flags -voice -limits -icon")->toAssocArray("cid");

      $this->channelList = array();

      foreach($channels as $cid => $channel)
      {
        $this->channelList[$cid] = new TeamSpeak3_Node_Channel($this, $channel);
      }

      $this->resetNodeList();
    }

    return $this->filterList($this->channelList, $filter);
  }

Resets the list of channels online.

Returns:
void

Definition at line 122 of file Server.php.

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

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

  {
    $this->resetNodeList();
    $this->channelList = null;
  }
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 134 of file Server.php.

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

Referenced by channelSpacerCreate().

  {
    $cid = $this->execute("channelcreate", $properties)->toList();
    $this->channelListReset();

    if(!isset($properties["client_flag_permanent"]) && !isset($properties["client_flag_semi_permanent"]))
    {
      $this->getParent()->whoamiSet("client_channel_id", $cid["cid"]);
    }

    return $cid["cid"];
  }
TeamSpeak3_Node_Server::channelDelete ( cid,
force = FALSE 
)

Deletes the channel specified by $cid.

Parameters:
integer$cid
boolean$force
Returns:
void

Definition at line 154 of file Server.php.

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

  {
    $this->execute("channeldelete", array("cid" => $cid, "force" => $force));
    $this->channelListReset();

    if(($cid instanceof TeamSpeak3_Node_Abstract ? $cid->getId() : $cid) == $this->whoamiGet("client_channel_id"))
    {
      $this->getParent()->whoamiReset();
    }
  }
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 173 of file Server.php.

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

  {
    $this->execute("channelmove", array("cid" => $cid, "cpid" => $pid, "order" => $order));
    $this->channelListReset();
  }

Returns TRUE if the given TeamSpeak3_Node_Channel object is a spacer.

Parameters:
TeamSpeak3_Node_Channel$channel
Returns:
boolean

Definition at line 185 of file Server.php.

Referenced by channelSpacerGetAlign(), and channelSpacerGetType().

  {
    return (preg_match("/\[[^\]]*spacer[^\]]*\]/", $channel) && $channel["channel_flag_permanent"] && !$channel["pid"]) ? TRUE : FALSE;
  }

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
Exceptions:
TeamSpeak3_Adapter_ServerQuery_Exception
Returns:
integer

Definition at line 201 of file Server.php.

References channelCreate(), TeamSpeak3\CODEC_SPEEX_NARROWBAND, 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.

  {
    $properties = array(
      "channel_name_phonetic" => "channel spacer",
      "channel_codec" => TeamSpeak3::CODEC_SPEEX_NARROWBAND,
      "channel_codec_quality" => 0x00,
      "channel_flag_permanent" => TRUE,
      "channel_flag_maxclients_unlimited" => FALSE,
      "channel_flag_maxfamilyclients_unlimited" => FALSE,
      "channel_flag_maxfamilyclients_inherited" => FALSE,
      "channel_order" => $order,
    );

    switch($align)
    {
      case TeamSpeak3::SPACER_ALIGN_REPEAT:
        $properties["channel_name"] = "[*spacer" . strval($ident) . "]";
        break;

      case TeamSpeak3::SPACER_ALIGN_LEFT:
        $properties["channel_name"] = "[lspacer" . strval($ident) . "]";
        break;

      case TeamSpeak3::SPACER_ALIGN_RIGHT:
        $properties["channel_name"] = "[rspacer" . strval($ident) . "]";
        break;

      case TeamSpeak3::SPACER_ALIGN_CENTER:
        $properties["channel_name"] = "[cspacer" . strval($ident) . "]";
        break;

      default:
        throw new TeamSpeak3_Adapter_ServerQuery_Exception("missing required parameter", 0x606);
        break;
    }

    switch($type)
    {
      case (string) TeamSpeak3::SPACER_SOLIDLINE:
        $properties["channel_name"] .= "___";
        break;

      case (string) TeamSpeak3::SPACER_DASHLINE:
        $properties["channel_name"] .= "---";
        break;

      case (string) TeamSpeak3::SPACER_DOTLINE:
        $properties["channel_name"] .= "...";
        break;

      case (string) TeamSpeak3::SPACER_DASHDOTLINE:
        $properties["channel_name"] .= "-.-";
        break;

      case (string) TeamSpeak3::SPACER_DASHDOTDOTLINE:
        $properties["channel_name"] .= "-..";
        break;

      default:
        $properties["channel_name"] .= strval($type);
        break;
    }

    return $this->channelCreate($properties);
  }

Returns the possible type of a channel spacer.

Parameters:
integer$cid
Exceptions:
TeamSpeak3_Adapter_ServerQuery_Exception
Returns:
integer

Definition at line 274 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.

  {
    $channel = $this->channelGetById($cid);

    if(!$this->channelIsSpacer($channel))
    {
      throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid channel flags", 0x307);
    }

    switch($channel["channel_name"]->section("]", 1))
    {
      case "___":
        return TeamSpeak3::SPACER_SOLIDLINE;

      case "---":
        return TeamSpeak3::SPACER_DASHLINE;

      case "...":
        return TeamSpeak3::SPACER_DOTLINE;

      case "-.-":
        return TeamSpeak3::SPACER_DASHDOTLINE;

      case "-..":
        return TeamSpeak3::SPACER_DASHDOTDOTLINE;

      default:
        return TeamSpeak3::SPACER_CUSTOM;
    }
  }

Returns the possible alignment of a channel spacer.

Parameters:
integer$cid
Exceptions:
TeamSpeak3_Adapter_ServerQuery_Exception
Returns:
integer

Definition at line 312 of file Server.php.

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

  {
    $channel = $this->channelGetById($cid);

    if(!$this->channelIsSpacer($channel) || !preg_match("/\[(.*)spacer.*\]/", $channel, $matches) || !isset($matches[1]))
    {
      throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid channel flags", 0x307);
    }

    switch($matches[1])
    {
      case "*":
        return TeamSpeak3::SPACER_ALIGN_REPEAT;

      case "c":
        return TeamSpeak3::SPACER_ALIGN_CENTER;

      case "r":
        return TeamSpeak3::SPACER_ALIGN_RIGHT;

      default:
        return TeamSpeak3::SPACER_ALIGN_LEFT;
    }
  }
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 344 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("channelpermlist", array("cid" => $cid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
  }
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 358 of file Server.php.

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

  {
    if(!is_array($permid))
    {
      $permident = (is_numeric($permid)) ? "permid" : "permsid";
    }
    else
    {
      $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
    }

    $this->execute("channeladdperm", array("cid" => $cid, $permident => $permid, "permvalue" => $permvalue));
  }
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 379 of file Server.php.

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

Referenced by permRemoveAny().

  {
    if(!is_array($permid))
    {
      $permident = (is_numeric($permid)) ? "permid" : "permsid";
    }
    else
    {
      $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
    }

    $this->execute("channeldelperm", array("cid" => $cid, $permident => $permid));
  }
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 401 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("channelclientpermlist", array("cid" => $cid, "cldbid" => $cldbid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
  }
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 416 of file Server.php.

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

  {
    if(!is_array($permid))
    {
      $permident = (is_numeric($permid)) ? "permid" : "permsid";
    }
    else
    {
      $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
    }

    $this->execute("channelclientaddperm", array("cid" => $cid, "cldbid" => $cldbid, $permident => $permid, "permvalue" => $permvalue));
  }
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 438 of file Server.php.

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

Referenced by permRemoveAny().

  {
    if(!is_array($permid))
    {
      $permident = (is_numeric($permid)) ? "permid" : "permsid";
    }
    else
    {
      $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
    }

    $this->execute("channelclientdelperm", array("cid" => $cid, "cldbid" => $cldbid, $permident => $permid));
  }
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 461 of file Server.php.

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

  {
    $files = $this->execute("ftgetfilelist", array("cid" => $cid, "cpw" => $cpw, "path" => $path))->toArray();
    $count = count($files);

    for($i = 0; $i < $count; $i++)
    {
      $files[$i]["sid"]  = $this->getId();
      $files[$i]["cid"]  = $files[0]["cid"];
      $files[$i]["path"] = $files[0]["path"];
      $files[$i]["src"]  = new TeamSpeak3_Helper_String($cid ? $files[$i]["path"] : "/");

      if(!$files[$i]["src"]->endsWith("/"))
      {
        $files[$i]["src"]->append("/");
      }

      $files[$i]["src"]->append($files[$i]["name"]);

      if($recursive && $files[$i]["type"] == TeamSpeak3::FILE_TYPE_DIRECTORY)
      {
        $files = array_merge($files, $this->channelFileList($cid, $cpw, $path . $files[$i]["name"], $recursive));
      }
    }

    uasort($files, array(__CLASS__, "sortFileList"));

    return $files;
  }
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 499 of file Server.php.

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

  {
    return array_pop($this->execute("ftgetfileinfo", array("cid" => $cid, "cpw" => $cpw, "name" => $name))->toArray());
  }
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 516 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("ftrenamefile", array("cid" => $cid, "cpw" => $cpw, "oldname" => $oldname, "newname" => $newname, "tcid" => $tcid, "tcpw" => $tcpw));
  }
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 529 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("ftdeletefile", array("cid" => $cid, "cpw" => $cpw, "name" => $name));
  }
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 542 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("ftcreatedir", array("cid" => $cid, "cpw" => $cpw, "dirname" => $dirname));
  }

Returns the level of a channel.

Parameters:
integer$cid
Returns:
integer

Definition at line 553 of file Server.php.

References channelGetById().

  {
    $channel = $this->channelGetById($cid);
    $levelno = 0;

    if($channel["pid"])
    {
      $levelno = $this->channelGetLevel($channel["pid"])+1;
    }

    return $levelno;
  }

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

Parameters:
integer$cid
Returns:
string

Definition at line 572 of file Server.php.

References channelGetById().

  {
    $channel = $this->channelGetById($cid);
    $pathway = $channel["channel_name"];

    if($channel["pid"])
    {
      $pathway = $this->channelGetPathway($channel["pid"]) . "/" . $channel["channel_name"];
    }

    return $pathway;
  }

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 592 of file Server.php.

References channelList().

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

  {
    if(!array_key_exists((string) $cid, $this->channelList()))
    {
      throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid channelID", 0x300);
    }

    return $this->channelList[intval((string) $cid)];
  }

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 609 of file Server.php.

References channelList().

  {
    foreach($this->channelList() as $channel)
    {
      if($channel["channel_name"] == $name) return $channel;
    }

    throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid channelID", 0x300);
  }
TeamSpeak3_Node_Server::clientList ( array $  filter = array())

Returns an array filled with TeamSpeak3_Node_Client objects.

Parameters:
array$filter
Returns:
array

Definition at line 625 of file Server.php.

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

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

  {
    if($this->clientList === null)
    {
      $clients = $this->request("clientlist -uid -away -voice -info -times -groups -icon -country")->toAssocArray("clid");

      $this->clientList = array();

      foreach($clients as $clid => $client)
      {
        if($this->getParent()->getExcludeQueryClients() && $client["client_type"]) continue;

        $this->clientList[$clid] = new TeamSpeak3_Node_Client($this, $client);
      }

      uasort($this->clientList, array(__CLASS__, "sortClientList"));

      $this->resetNodeList();
    }

    return $this->filterList($this->clientList, $filter);
  }

Resets the list of clients online.

Returns:
void

Definition at line 653 of file Server.php.

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

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

  {
    $this->resetNodeList();
    $this->clientList = null;
  }

Returns a list of clients matching a given name pattern.

Parameters:
string$pattern
Returns:
array

Definition at line 665 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("clientfind", array("pattern" => $pattern))->toAssocArray("clid");
  }
TeamSpeak3_Node_Server::clientListDb ( offset = null,
limit = null 
)

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

Parameters:
integer$offset
integer$limit
Returns:
array

Definition at line 677 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("clientdblist -count", array("start" => $offset, "duration" => $limit))->toAssocArray("cldbid");
  }

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

Returns:
integer

Definition at line 687 of file Server.php.

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

  {
    return current($this->execute("clientdblist -count", array("duration" => 1))->toList("count"));
  }

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

Parameters:
integer$cldbid
Returns:
array

Definition at line 698 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("clientdbinfo", array("cldbid" => $cldbid))->toList();
  }
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 711 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

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

Returns the number of regular clients online.

Returns:
integer

Definition at line 721 of file Server.php.

References isOffline().

  {
    if($this->isOffline()) return 0;

    return $this["virtualserver_clientsonline"]-$this["virtualserver_queryclientsonline"];
  }

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 735 of file Server.php.

References clientList().

  {
    if(!array_key_exists((string) $clid, $this->clientList()))
    {
      throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid clientID", 0x200);
    }

    return $this->clientList[intval((string) $clid)];
  }

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 752 of file Server.php.

References clientList().

  {
    foreach($this->clientList() as $client)
    {
      if($client["client_nickname"] == $name) return $client;
    }

    throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid clientID", 0x200);
  }

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 769 of file Server.php.

References clientList().

  {
    foreach($this->clientList() as $client)
    {
      if($client["client_unique_identifier"] == $uid) return $client;
    }

    throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid clientID", 0x200);
  }

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 786 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("clientgetnamefromuid", array("cluid" => $cluid))->toList();
  }

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 798 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("clientgetids", array("cluid" => $cluid))->toAssocArray("clid");
  }

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 810 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("clientgetnamefromdbid", array("cldbid" => $cldbid))->toList();
  }

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 822 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("servergroupsbyclientid", array("cldbid" => $cldbid))->toAssocArray("sgid");
  }
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 835 of file Server.php.

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

  {
    $this->clientListReset();

    $this->execute("clientmove", array("clid" => $clid, "cid" => $cid, "cpw" => $cpw));

    if($clid instanceof TeamSpeak3_Node_Abstract)
    {
      $clid = $clid->getId();
    }

    if($cid instanceof TeamSpeak3_Node_Abstract)
    {
      $cid = $cid->getId();
    }

    if(!is_array($clid) && $clid == $this->whoamiGet("client_id"))
    {
      $this->getParent()->whoamiSet("client_channel_id", $cid);
    }
  }
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 865 of file Server.php.

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

  {
    $this->clientListReset();

    $this->execute("clientkick", array("clid" => $clid, "reasonid" => $reasonid, "reasonmsg" => $reasonmsg));
  }
TeamSpeak3_Node_Server::clientPoke ( clid,
msg 
)

Sends a poke message to a client.

Parameters:
integer$clid
string$msg
Returns:
void

Definition at line 879 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("clientpoke", array("clid" => $clid, "msg" => $msg));
  }
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 893 of file Server.php.

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

  {
    $this->clientListReset();

    $bans = $this->execute("banclient", array("clid" => $clid, "time" => $timeseconds, "banreason" => $reason))->toAssocArray("banid");

    return array_keys($bans);
  }
TeamSpeak3_Node_Server::clientModifyDb ( cldbid,
array $  properties 
)

Changes the clients properties using given properties.

Parameters:
string$cldbid
array$properties
Returns:
void

Definition at line 909 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $properties["cldbid"] = $cldbid;

    $this->execute("clientdbedit", $properties);
  }

Deletes a clients properties from the database.

Parameters:
string$cldbid
Returns:
void

Definition at line 922 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("clientdbdelete", array("cldbid" => $cldbid));
  }
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 935 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("setclientchannelgroup", array("cldbid" => $cldbid, "cid" => $cid, "cgid" => $cgid));
  }
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 947 of file Server.php.

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

  {
    $this->clientListReset();

    return $this->execute("clientpermlist", array("cldbid" => $cldbid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
  }
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 964 of file Server.php.

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

  {
    if(!is_array($permid))
    {
      $permident = (is_numeric($permid)) ? "permid" : "permsid";
    }
    else
    {
      $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
    }

    $this->execute("clientaddperm", array("cldbid" => $cldbid, $permident => $permid, "permvalue" => $permvalue, "permskip" => $permskip));
  }
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 985 of file Server.php.

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

Referenced by permRemoveAny().

  {
    if(!is_array($permid))
    {
      $permident = (is_numeric($permid)) ? "permid" : "permsid";
    }
    else
    {
      $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
    }

    $this->execute("clientdelperm", array("cldbid" => $cldbid, $permident => $permid));
  }
TeamSpeak3_Node_Server::serverGroupList ( array $  filter = array())

Returns a list of server groups available.

Parameters:
filter$filter
Returns:
array

Definition at line 1005 of file Server.php.

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

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

  {
    if($this->sgroupList === null)
    {
      $this->sgroupList = $this->request("servergrouplist")->toAssocArray("sgid");

      foreach($this->sgroupList as $sgid => $group)
      {
        $this->sgroupList[$sgid] = new TeamSpeak3_Node_Servergroup($this, $group);
      }

      uasort($this->sgroupList, array(__CLASS__, "sortGroupList"));
    }

    return $this->filterList($this->sgroupList, $filter);
  }

Resets the list of server groups.

Returns:
void

Definition at line 1027 of file Server.php.

Referenced by channelGroupCopy(), channelGroupCreate(), channelGroupDelete(), channelGroupRename(), serverGroupCopy(), serverGroupCreate(), serverGroupDelete(), and serverGroupRename().

  {
    $this->sgroupList = null;
  }

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 1039 of file Server.php.

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

  {
    $this->serverGroupListReset();

    $sgid = $this->execute("servergroupadd", array("name" => $name, "type" => $type))->toList();

    return $sgid["sgid"];
  }
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 1057 of file Server.php.

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

  {
    $this->serverGroupListReset();

    $sgid = $this->execute("servergroupcopy", array("ssgid" => $ssgid, "tsgid" => $tsgid, "name" => $name, "type" => $type))->toList();

    if($tsgid && $name)
    {
      $this->serverGroupRename($tsgid, $name);
    }

    return count($sgid) ? $sgid["sgid"] : intval($tsgid);
  }

Renames the server group specified with $sgid.

Parameters:
integer$sgid
string$name
Returns:
void

Definition at line 1078 of file Server.php.

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

Referenced by serverGroupCopy().

  {
    $this->serverGroupListReset();

    $this->execute("servergrouprename", array("sgid" => $sgid, "name" => $name));
  }
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 1093 of file Server.php.

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

  {
    $this->serverGroupListReset();

    $this->execute("servergroupdel", array("sgid" => $sgid, "force" => $force));
  }

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 1107 of file Server.php.

References serverGroupList().

Referenced by serverGroupIdentify().

  {
    if(!array_key_exists((string) $sgid, $this->serverGroupList()))
    {
      throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid groupID", 0xA00);
    }

    return $this->sgroupList[intval((string) $sgid)];
  }

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 1125 of file Server.php.

References serverGroupList().

  {
    foreach($this->serverGroupList() as $group)
    {
      if($group["name"] == $name && $group["type"] == $type) return $group;
    }

    throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid groupID", 0xA00);
  }
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 1142 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

Referenced by serverGroupGetProfiles().

  {
    return $this->execute("servergrouppermlist", array("sgid" => $sgid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
  }
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 1158 of file Server.php.

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

  {
    if(!is_array($permid))
    {
      $permident = (is_numeric($permid)) ? "permid" : "permsid";
    }
    else
    {
      $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
    }

    $this->execute("servergroupaddperm", array("sgid" => $sgid, $permident => $permid, "permvalue" => $permvalue, "permnegated" => $permnegated, "permskip" => $permskip));
  }

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 1180 of file Server.php.

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

Referenced by permRemoveAny().

  {
    if(!is_array($permid))
    {
      $permident = (is_numeric($permid)) ? "permid" : "permsid";
    }
    else
    {
      $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
    }

    $this->execute("servergroupdelperm", array("sgid" => $sgid, $permident => $permid));
  }

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

Parameters:
integer$sgid
Returns:
array

Definition at line 1200 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    if($this["virtualserver_default_server_group"] == $sgid)
    {
      return array();
    }

    return $this->execute("servergroupclientlist", array("sgid" => $sgid,  "-names"))->toAssocArray("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 1218 of file Server.php.

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

  {
    $this->clientListReset();

    $this->execute("servergroupaddclient", array("sgid" => $sgid, "cldbid" => $cldbid));
  }

Removes a client from the server group specified.

Parameters:
integer$sgid
integer$cldbid
Returns:
void

Definition at line 1232 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("servergroupdelclient", array("sgid" => $sgid, "cldbid" => $cldbid));
  }

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

Returns:
array

Definition at line 1243 of file Server.php.

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

Referenced by serverGroupIdentify().

  {
    $profiles = array();

    foreach($this->serverGroupList() as $sgid => $sgroup)
    {
      if($sgroup["type"] != TeamSpeak3::GROUP_DBTYPE_REGULAR) continue;

      $profiles[$sgid] = array(
        "b_permission_modify_power_ignore" => 0,
        "i_group_needed_member_add_power" => 0,
        "i_group_member_add_power" => 0,
        "i_group_needed_member_remove_power" => 0,
        "i_group_member_remove_power" => 0,
        "i_needed_modify_power_count" => 0,
        "i_needed_modify_power_total" => 0,
        "i_permission_modify_power" => 0,
        "i_group_needed_modify_power" => 0,
        "i_group_modify_power" => 0,
        "i_client_needed_modify_power" => 0,
        "i_client_modify_power" => 0,
        "b_virtualserver_servergroup_create" => 0,
        "b_virtualserver_servergroup_delete" => 0,
        "b_client_ignore_bans" => 0,
        "b_client_ignore_antiflood" => 0,
        "b_group_is_permanent" => 0,
        "i_client_needed_ban_power" => 0,
        "i_client_needed_kick_power" => 0,
        "i_client_needed_move_power" => 0,
        "i_client_talk_power" => 0,
        "__sgid" => $sgid,
        "__name" => $sgroup->toString(),
        "__node" => $sgroup,
      );

      try
      {
        $perms = $this->serverGroupPermList($sgid, TRUE);
        $grant = isset($perms["i_permission_modify_power"]) ? $perms["i_permission_modify_power"]["permvalue"] : null;
      }
      catch(TeamSpeak3_Adapter_ServerQuery_Exception $e)
      {
        /* ERROR_database_empty_result */
        if($e->getCode() != 0x501) throw $e;

        $perms = array();
        $grant = null;
      }

      foreach($perms as $permsid => $perm)
      {
        if(in_array($permsid, array_keys($profiles[$sgid])))
        {
          $profiles[$sgid][$permsid] = $perm["permvalue"];
        }
        elseif(TeamSpeak3_Helper_String::factory($permsid)->startsWith("i_needed_modify_power_"))
        {
          if(!$grant || $perm["permvalue"] > $grant) continue;

          $profiles[$sgid]["i_needed_modify_power_total"] = $profiles[$sgid]["i_needed_modify_power_total"]+$perm["permvalue"];
          $profiles[$sgid]["i_needed_modify_power_count"]++;
        }
      }
    }

    array_multisort($profiles, SORT_DESC);

    return $profiles;
  }

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 1320 of file Server.php.

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

  {
    $profiles = $this->serverGroupGetProfiles();

    $best_guess_profile = ($mode == TeamSpeak3::GROUP_IDENTIFIY_STRONGEST) ? array_shift($profiles) : array_pop($profiles);

    return $this->serverGroupGetById($best_guess_profile["__sgid"]);
  }
TeamSpeak3_Node_Server::channelGroupList ( array $  filter = array())

Returns a list of channel groups available.

Parameters:
array$filter
Returns:
array

Definition at line 1335 of file Server.php.

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

Referenced by channelGroupGetById(), and channelGroupGetByName().

  {
    if($this->cgroupList === null)
    {
      $this->cgroupList = $this->request("channelgrouplist")->toAssocArray("cgid");

      foreach($this->cgroupList as $cgid => $group)
      {
        $this->cgroupList[$cgid] = new TeamSpeak3_Node_Channelgroup($this, $group);
      }

      uasort($this->cgroupList, array(__CLASS__, "sortGroupList"));
    }

    return $this->filterList($this->cgroupList, $filter);
  }

Resets the list of channel groups.

Returns:
void

Definition at line 1357 of file Server.php.

  {
    $this->cgroupList = null;
  }

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 1369 of file Server.php.

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

  {
    $this->serverGroupListReset();

    $cgid = $this->execute("channelgroupadd", array("name" => $name, "type" => $type))->toList();

    return $cgid["cgid"];
  }
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 1387 of file Server.php.

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

  {
    $this->serverGroupListReset();

    $cgid = $this->execute("channelgroupcopy", array("scgid" => $scgid, "tcgid" => $tcgid, "name" => $name, "type" => $type))->toList();

    if($tcgid && $name)
    {
      $this->channelGroupRename($tcgid, $name);
    }

    return count($cgid) ? $cgid["cgid"] : intval($tcgid);
  }

Renames the channel group specified with $cgid.

Parameters:
integer$cgid
string$name
Returns:
void

Definition at line 1408 of file Server.php.

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

Referenced by channelGroupCopy().

  {
    $this->serverGroupListReset();

    $this->execute("channelgrouprename", array("cgid" => $cgid, "name" => $name));
  }
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 1423 of file Server.php.

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

  {
    $this->serverGroupListReset();

    $this->execute("channelgroupdel", array("cgid" => $cgid, "force" => $force));
  }

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 1437 of file Server.php.

References channelGroupList().

  {
    if(!array_key_exists((string) $cgid, $this->channelGroupList()))
    {
      throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid groupID", 0xA00);
    }

    return $this->cgroupList[intval((string) $cgid)];
  }

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 1455 of file Server.php.

References channelGroupList().

  {
    foreach($this->channelGroupList() as $group)
    {
      if($group["name"] == $name && $group["type"] == $type) return $group;
    }

    throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid groupID", 0xA00);
  }
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 1472 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("channelgrouppermlist", array("cgid" => $cgid, $permsid ? "-permsid" : null))->toAssocArray($permsid ? "permsid" : "permid");
  }
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 1486 of file Server.php.

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

  {
    if(!is_array($permid))
    {
      $permident = (is_numeric($permid)) ? "permid" : "permsid";
    }
    else
    {
      $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
    }

    $this->execute("channelgroupaddperm", array("cgid" => $cgid, $permident => $permid, "permvalue" => $permvalue));
  }

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 1508 of file Server.php.

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

Referenced by permRemoveAny().

  {
    if(!is_array($permid))
    {
      $permident = (is_numeric($permid)) ? "permid" : "permsid";
    }
    else
    {
      $permident = (is_numeric(current($permid))) ? "permid" : "permsid";
    }

    $this->execute("channelgroupdelperm", array("cgid" => $cgid, $permident => $permid));
  }
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 1532 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    if($this["virtualserver_default_channel_group"] == $cgid)
    {
      return array();
    }

    return $this->execute("channelgroupclientlist", array("cgid" => $cgid, "cid" => $cid, "cldbid" => $cldbid))->toArray();
  }

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

Returns:
TeamSpeak3_Helper_String

Definition at line 1548 of file Server.php.

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

  {
    $token = $this->request("permreset")->toList();

    TeamSpeak3_Helper_Signal::getInstance()->emit("notifyTokencreated", $this, $token["token"]);

    return $token["token"];
  }

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 1564 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().

  {
    $assignments = $this->permissionFind($permid);

    foreach($assignments as $assignment)
    {
      switch($assignment["t"])
      {
        case TeamSpeak3::PERM_TYPE_SERVERGROUP:
                $this->serverGroupPermRemove($assignment["id1"], $assignment["p"]);
                break;

        case TeamSpeak3::PERM_TYPE_CLIENT:
          $this->clientPermRemove($assignment["id2"], $assignment["p"]);
          break;

        case TeamSpeak3::PERM_TYPE_CHANNEL:
          $this->channelPermRemove($assignment["id2"], $assignment["p"]);
          break;

        case TeamSpeak3::PERM_TYPE_CHANNELGROUP:
          $this->channelGroupPermRemove($assignment["id1"], $assignment["p"]);
          break;

        case TeamSpeak3::PERM_TYPE_CHANNELCLIENT:
          $this->channelClientPermRemove($assignment["id2"], $assignment["id1"], $assignment["p"]);
          break;

        default:
          throw new TeamSpeak3_Adapter_ServerQuery_Exception("convert error", 0x604);
      }
    }

    return count($assignments);
  }
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.

Todo:
[SERVER LIMITATION] return real file transfer host address instead of ServerQuery host address
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 1614 of file Server.php.

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

Referenced by iconUpload().

  {
    $upload = $this->execute("ftinitupload", array("clientftfid" => $clientftfid, "cid" => $cid, "name" => $name, "cpw" => $cpw, "size" => $size, "overwrite" => $overwrite, "resume" => $resume))->toList();

    if(array_key_exists("status", $upload) && $upload["status"] != 0x00)
    {
      throw new TeamSpeak3_Adapter_ServerQuery_Exception($upload["msg"], $upload["status"]);
    }

    $upload["cid"]  = $cid;
    $upload["file"] = $name;

    if(!array_key_exists("host", $upload)) $upload["host"] = $this->getParent()->getAdapterHost();

    TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferUploadInit", $upload["ftkey"], $upload);

    return $upload;
  }
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.

Todo:
[SERVER LIMITATION] return real file transfer host address instead of ServerQuery host address
Parameters:
integer$clientftfid
integer$cid
string$name
string$cpw
integer$seekpos
Exceptions:
TeamSpeak3_Adapter_ServerQuery_Exception
Returns:
array

Definition at line 1645 of file Server.php.

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

Referenced by iconDownload().

  {
    $download = $this->execute("ftinitdownload", array("clientftfid" => $clientftfid, "cid" => $cid, "name" => $name, "cpw" => $cpw, "seekpos" => $seekpos))->toList();

    if(array_key_exists("status", $download) && $download["status"] != 0x00)
    {
      throw new TeamSpeak3_Adapter_ServerQuery_Exception($download["msg"], $download["status"]);
    }

    $download["cid"]  = $cid;
    $download["file"] = $name;

    if(!array_key_exists("host", $download)) $download["host"] = $this->getParent()->getAdapterHost();

    TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferDownloadInit", $download["ftkey"], $download);

    return $download;
  }

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 1670 of file Server.php.

References request().

  {
    return $this->request("ftlist")->toAssocArray("serverftfid");
  }
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 1682 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("ftstop", array("serverftfid" => $serverftfid, "delete" => $delete));
  }

Downloads and returns the servers icon file content.

Returns:
TeamSpeak3_Helper_String

Definition at line 1692 of file Server.php.

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

  {
    if($this->iconIsLocal("virtualserver_icon_id") || $this["virtualserver_icon_id"] == 0) return;

    $download = $this->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->iconGetName("virtualserver_icon_id"));
    $transfer = TeamSpeak3::factory("filetransfer://" . $download["host"] . ":" . $download["port"]);

    return $transfer->download($download["ftkey"], $download["size"]);
  }

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

Parameters:
string$data
Returns:
integer

Definition at line 1708 of file Server.php.

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

  {
    $crc   = crc32($data);
    $size = strlen($data);

    $upload   = $this->transferInitUpload(rand(0x0000, 0xFFFF), 0, "/icon_" . $crc, $size);
    $transfer = TeamSpeak3::factory("filetransfer://" . $upload["host"] . ":" . $upload["port"]);

    $transfer->upload($upload["ftkey"], $upload["seekpos"], $data);

    return $crc;
  }
TeamSpeak3_Node_Server::modify ( array $  properties)

Changes the virtual server configuration using given properties.

Parameters:
array$properties
Returns:
void

Definition at line 1727 of file Server.php.

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

  {
    $this->execute("serveredit", $properties);
    $this->resetNodeInfo();
  }

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

Parameters:
string$msg
Returns:
void

Definition at line 1739 of file Server.php.

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

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

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 1750 of file Server.php.

References request().

  {
    $this->request("messagelist")->toAssocArray("msgid");
  }
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 1763 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("messageadd", array("cluid" => $cluid, "subject" => $subject, "message" => $message));
  }

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

Parameters:
integer$msgid
Returns:
void

Definition at line 1774 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("messagedel", array("msgid" => $msgid));
  }
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 1786 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $msg = $this->execute("messageget", array("msgid" => $msgid))->toList();

    if($flag_read)
    {
      $this->execute("messageget", array("msgid" => $msgid, "flag" => $flag_read));
    }

    return $msg;
  }

Creates and returns snapshot data for the selected virtual server.

Parameters:
string$mode
Returns:
string

Definition at line 1804 of file Server.php.

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

  {
    $snapshot = $this->request("serversnapshotcreate")->toString(FALSE);

    switch($mode)
    {
      case TeamSpeak3::SNAPSHOT_BASE64:
        return $snapshot->toBase64();
        break;

      case TeamSpeak3::SNAPSHOT_HEXDEC:
        return $snapshot->toHex();
        break;

      default:
        return (string) $snapshot;
        break;
    }
  }

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 1832 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.

  {
    switch($mode)
    {
      case TeamSpeak3::SNAPSHOT_BASE64:
        $data = TeamSpeak3_Helper_String::fromBase64($data);
        break;

      case TeamSpeak3::SNAPSHOT_HEXDEC:
        $data = TeamSpeak3_Helper_String::fromHex($data);
        break;

      default:
        $data = TeamSpeak3_Helper_String::factory($data);
        break;
    }

    $detail = $this->request("serversnapshotdeploy " . $data)->toList();

    if(array_key_exists("sid", $detail))
    {
      TeamSpeak3_Helper_Signal::getInstance()->emit("notifyServercreated", $this->getParent(), $detail["sid"]);
    }

    return $detail;
  }
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 1868 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("servernotifyregister", array("event" => $event, "id" => $id));
  }

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

Returns:
void

Definition at line 1879 of file Server.php.

References request().

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

Alias for privilegeKeyList().

Deprecated:

Definition at line 1889 of file Server.php.

References privilegeKeyList().

  {
    return $this->privilegeKeyList();
  }

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 1902 of file Server.php.

References channelGetById(), and request().

Referenced by tokenList().

  {
    $tokens = $this->request("privilegekeylist")->toAssocArray("token");

    if($resolve)
    {
      foreach($tokens as $token => $array)
      {
        $func = $array["token_type"] ? "channelGroupGetById" : "serverGroupGetById";

        try
        {
          $tokens[$token]["token_id1"] = $this->$func($array["token_id1"])->name;
        }
        catch(Exception $e)
        {
          /* ERROR_channel_invalid_id */
          if($e->getCode() != 0xA00) throw $e;
        }

        try
        {
          if($array["token_type"]) $tokens[$token]["token_id2"] = $this->channelGetById($array["token_id2"])->getPathway();
        }
        catch(Exception $e)
        {
          /* ERROR_permission_invalid_group_id */
          if($e->getCode() != 0x300) throw $e;
        }
      }
    }

    return $tokens;
  }
TeamSpeak3_Node_Server::tokenCreate ( type = TeamSpeak3::TOKEN_SERVERGROUP,
id1,
id2 = 0,
description = null,
customset = null 
)

Alias for privilegeKeyCreate().

Deprecated:

Definition at line 1942 of file Server.php.

References privilegeKeyCreate().

  {
    return $this->privilegeKeyCreate($type, $id1, $id2, $description, $customset);
  }
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 1957 of file Server.php.

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

Referenced by tokenCreate().

  {
    $token = $this->execute("privilegekeyadd", array("tokentype" => $type, "tokenid1" => $id1, "tokenid2" => $id2, "tokendescription" => $description, "tokencustomset" => $customset))->toList();

    TeamSpeak3_Helper_Signal::getInstance()->emit("notifyTokencreated", $this, $token["token"]);

    return $token["token"];
  }

Alias for privilegeKeyDelete().

Deprecated:

Definition at line 1971 of file Server.php.

References privilegeKeyDelete().

  {
    $this->privilegeKeyDelete($token);
  }

Deletes a token specified by key $token.

Parameters:
string$token
Returns:
void

Definition at line 1982 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

Referenced by tokenDelete().

  {
    $this->execute("privilegekeydelete", array("token" => $token));
  }

Alias for privilegeKeyUse().

Deprecated:

Definition at line 1992 of file Server.php.

References privilegeKeyUse().

  {
    $this->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 2004 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

Referenced by tokenUse().

  {
    $this->execute("privilegekeyuse", array("token" => $token));
  }
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 2016 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("customsearch", array("ident" => $ident, "pattern" => $pattern))->toArray();
  }

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

Parameters:
integer$cldbid
Returns:
array

Definition at line 2027 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("custominfo", array("cldbid" => $cldbid))->toArray();
  }

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

Returns:
array

Definition at line 2037 of file Server.php.

References request().

  {
    return $this->request("banlist")->toAssocArray("banid");
  }

Deletes all active ban rules from the server.

Returns:
void

Definition at line 2047 of file Server.php.

References request().

  {
    $this->request("bandelall");
  }
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 2061 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $rules["time"] = $timeseconds;
    $rules["banreason"] = $reason;

    $banid = $this->execute("banadd", $rules)->toList();

    return $banid["banid"];
  }

Deletes the specified ban rule from the server.

Parameters:
integer$banid
Returns:
void

Definition at line 2077 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("bandel", array("banid" => $banid));
  }

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 2089 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("complainlist", array("tcldbid" => $tcldbid))->toArray();
  }

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

Parameters:
integer$tcldbid
Returns:
void

Definition at line 2100 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("complaindelall", array("tcldbid" => $tcldbid));
  }
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 2112 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("complainadd", array("tcldbid" => $tcldbid, "message" => $message));
  }
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 2124 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("complaindel", array("tcldbid" => $tcldbid, "fcldbid" => $fcldbid));
  }
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 2138 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("logview", array("lines" => $lines, "begin_pos" => $begin_pos, "instance" => $instance, "reverse" => $reverse))->toArray();
  }

Writes a custom entry into the virtual server log.

Parameters:
string$logmsg
integer$loglevel
Returns:
void

Definition at line 2150 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("logadd", array("logmsg" => $logmsg, "loglevel" => $loglevel));
  }

Returns detailed connection information of the virtual server.

Returns:
array

Definition at line 2160 of file Server.php.

References request().

  {
    return $this->request("serverrequestconnectioninfo")->toList();
  }

Deletes the virtual server.

Returns:
void

Definition at line 2170 of file Server.php.

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

  {
    $this->getParent()->serverDelete($this->getId());

    unset($this);
  }

Starts the virtual server.

Returns:
void

Definition at line 2182 of file Server.php.

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

  {
    $this->getParent()->serverStart($this->getId());
  }

Stops the virtual server.

Returns:
void

Definition at line 2192 of file Server.php.

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

  {
    $this->getParent()->serverStop($this->getId());
  }
TeamSpeak3_Node_Server::selfUpdate ( array $  properties)

Changes the properties of your own client connection.

Parameters:
array$properties
Returns:
void

Definition at line 2203 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $this->execute("clientupdate", $properties);

    foreach($properties as $ident => $value)
    {
      $this->whoamiSet($ident, $value);
    }
  }

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 2220 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    $password = $this->execute("clientsetserverquerylogin", array("client_login_name" => $username))->toList();

    return $password["client_login_password"];
  }

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

Returns:
array

Definition at line 2232 of file Server.php.

References TeamSpeak3_Node_Abstract\execute().

  {
    return $this->execute("permoverview", array("cldbid" => $this->whoamiGet("client_database_id"), "cid" => $this->whoamiGet("client_channel_id"), "permid" => 0))->toArray();
  }

Reimplemented from TeamSpeak3_Node_Abstract.

Definition at line 2240 of file Server.php.

References channelList().

  {
    $this->nodeList = array();

    foreach($this->channelList() as $channel)
    {
      if($channel["pid"] == 0)
      {
        $this->nodeList[] = $channel;
      }
    }
  }

Reimplemented from TeamSpeak3_Node_Abstract.

Definition at line 2256 of file Server.php.

References request().

  {
    $this->nodeInfo = array_merge($this->nodeInfo, $this->request("serverinfo")->toList());
  }

Internal callback funtion for sorting of client objects.

Parameters:
TeamSpeak3_Node_Client$a
TeamSpeak3_Node_Client$b
Returns:
integer

Definition at line 2268 of file Server.php.

References TeamSpeak3_Node_Abstract\getProperty().

  {
    if(get_class($a) != get_class($b))
    {
      return 0;

      /* workaround for PHP bug #50688 */
      throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
    }

    if(!$a instanceof TeamSpeak3_Node_Client)
    {
      return 0;

      /* workaround for PHP bug #50688 */
      throw new TeamSpeak3_Adapter_ServerQuery_Exception("convert error", 0x604);
    }

    if($a->getProperty("client_talk_power", 0) != $b->getProperty("client_talk_power", 0))
    {
      return ($a->getProperty("client_talk_power", 0) > $b->getProperty("client_talk_power", 0)) ? -1 : 1;
    }

    if($a->getProperty("client_is_talker", 0) != $b->getProperty("client_is_talker", 0))
    {
      return ($a->getProperty("client_is_talker", 0) > $b->getProperty("client_is_talker", 0)) ? -1 : 1;
    }

    return strcmp(strtolower($a["client_nickname"]), strtolower($b["client_nickname"]));
  }

Internal callback funtion for sorting of group objects.

Parameters:
TeamSpeak3_Node_Abstract$a
TeamSpeak3_Node_Abstract$b
Returns:
integer

Definition at line 2306 of file Server.php.

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

  {
    if(get_class($a) != get_class($b))
    {
      return 0;

      /* workaround for PHP bug #50688 */
      throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
    }

    if(!$a instanceof TeamSpeak3_Node_Servergroup && !$a instanceof TeamSpeak3_Node_Channelgroup)
    {
      return 0;

      /* workaround for PHP bug #50688 */
      throw new TeamSpeak3_Adapter_ServerQuery_Exception("convert error", 0x604);
    }

    if($a->getProperty("sortid", 0) != $b->getProperty("sortid", 0) && $a->getProperty("sortid", 0) != 0 && $b->getProperty("sortid", 0) != 0)
    {
      return ($a->getProperty("sortid", 0) < $b->getProperty("sortid", 0)) ? -1 : 1;
    }

    return ($a->getId() < $b->getId()) ? -1 : 1;
  }
static TeamSpeak3_Node_Server::sortFileList ( array $  a,
array $  b 
) [static, protected]

Internal callback funtion for sorting of file list items.

Parameters:
array$a
array$b
Returns:
integer

Definition at line 2339 of file Server.php.

  {
    if(!array_key_exists("src", $a) || !array_key_exists("src", $b))
    {
      return 0;

      throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
    }

    return strcmp(strtolower($a["src"]), strtolower($b["src"]));
  }

Returns TRUE if the virtual server is online.

Returns:
boolean

Definition at line 2356 of file Server.php.

  {
    return ($this["virtualserver_status"] == "online") ? TRUE : FALSE;
  }

Returns TRUE if the virtual server is offline.

Returns:
boolean

Definition at line 2366 of file Server.php.

Referenced by clientCount().

  {
    return ($this["virtualserver_status"] == "offline") ? TRUE : FALSE;
  }

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

Returns:
string

Reimplemented from TeamSpeak3_Node_Abstract.

Definition at line 2376 of file Server.php.

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

  {
    return $this->getParent()->getUniqueId() . "_s" . $this->getId();
  }

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

Returns:
string

Reimplemented from TeamSpeak3_Node_Abstract.

Definition at line 2386 of file Server.php.

  {
    if($this["virtualserver_clientsonline"]-$this["virtualserver_queryclientsonline"] >= $this["virtualserver_maxclients"])
    {
      return "server_full";
    }
    elseif($this["virtualserver_flag_password"])
    {
      return "server_pass";
    }
    else
    {
      return "server_open";
    }
  }

Returns a symbol representing the node.

Returns:
string

Reimplemented from TeamSpeak3_Node_Abstract.

Definition at line 2407 of file Server.php.

  {
    return "$";
  }

Returns a string representation of this node.

Returns:
string

Reimplemented from TeamSpeak3_Node_Abstract.

Definition at line 2417 of file Server.php.

  {
    return (string) $this["virtualserver_name"];
  }
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 82 of file Abstract.php.

References TeamSpeak3_Node_Abstract\getParent().

Referenced by TeamSpeak3_Node_Abstract\execute().

  {
    return $this->getParent()->prepare($cmd, $params);
  }
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 94 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_Host\serverCreate(), TeamSpeak3_Node_Host\serverDelete(), serverGroupClientAdd(), serverGroupClientDel(), serverGroupClientList(), serverGroupCopy(), serverGroupCreate(), serverGroupDelete(), serverGroupPermAssign(), 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(), transferInitDownload(), transferInitUpload(), and transferStop().

  {
    return $this->request($this->prepare($cmd, $params));
  }

Returns the parent object of the current node.

Returns:
TeamSpeak3_Adapter_ServerQuery
TeamSpeak3_Node_Abstract

Definition at line 105 of file Abstract.php.

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_Client\setChannelGroup(), snapshotDeploy(), TeamSpeak3_Node_Channel\spacerGetAlign(), TeamSpeak3_Node_Channel\spacerGetType(), start(), stop(), TeamSpeak3_Node_Channel\subChannelList(), transferInitDownload(), and transferInitUpload().

  {
    return $this->parent;
  }

Returns the primary ID of the current node.

Returns:
integer

Definition at line 115 of file Abstract.php.

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_Channelgroup\copy(), TeamSpeak3_Node_Servergroup\copy(), TeamSpeak3_Node_Servergroup\delete(), TeamSpeak3_Node_Channelgroup\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_Servergroup\permList(), TeamSpeak3_Node_Channelgroup\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(), sortGroupList(), TeamSpeak3_Node_Channel\spacerGetAlign(), TeamSpeak3_Node_Channel\spacerGetType(), start(), stop(), and TeamSpeak3_Node_Channel\subChannelList().

  {
    return $this->nodeId;
  }
TeamSpeak3_Node_Abstract::iconIsLocal ( key) [inherited]

Returns TRUE if the node icon has a local source.

Returns:
boolean

Definition at line 125 of file Abstract.php.

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

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

Returns the internal path of the node icon.

Returns:
TeamSpeak3_Helper_String

Definition at line 135 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().

  {
    $iconid = ($this[$key] < 0) ? (pow(2, 32))-($this[$key]*-1) : $this[$key];

    return new TeamSpeak3_Helper_String("/icon_" . $iconid);
  }
TeamSpeak3_Node_Abstract::getClass ( prefix = "ts3_") [inherited]

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

Returns:
string

Definition at line 147 of file Abstract.php.

References TeamSpeak3_Helper_String\factory().

  {
    if($this instanceof TeamSpeak3_Node_Channel && $this->isSpacer())
    {
      return $prefix . "spacer";
    }
    elseif($this instanceof TeamSpeak3_Node_Client && $this["client_type"])
    {
      return $prefix . "query";
    }

    return $prefix . TeamSpeak3_Helper_String::factory(get_class($this))->section("_", 2)->toLower();
  }

Returns the HTML code to display a TeamSpeak 3 viewer.

Parameters:
TeamSpeak3_Viewer_Interface$viewer
Returns:
string

Definition at line 188 of file Abstract.php.

References TeamSpeak3_Viewer_Interface\fetchObject().

  {
    $html = $viewer->fetchObject($this);

    $iterator = new RecursiveIteratorIterator($this, RecursiveIteratorIterator::SELF_FIRST);

    foreach($iterator as $node)
    {
      $siblings = array();

      for($level = 0; $level < $iterator->getDepth(); $level++)
      {
        $siblings[] = ($iterator->getSubIterator($level)->hasNext()) ? 1 : 0;
      }

      $siblings[] = (!$iterator->getSubIterator($level)->hasNext()) ? 1 : 0;

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

    return $html;
  }
TeamSpeak3_Node_Abstract::filterList ( array $  nodes = array(),
array $  rules = array() 
) [protected, inherited]

Filters given node list array using specified filter rules.

Parameters:
array$nodes
array$rules
Returns:
array

Definition at line 218 of file Abstract.php.

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

  {
    if(!empty($rules))
    {
      foreach($nodes as $node)
      {
        if(!$node instanceof TeamSpeak3_Node_Abstract) continue;

        $props = $node->getInfo(FALSE);
        $props = array_intersect_key($props, $rules);
        $match = TRUE;

        foreach($props as $key => $val)
        {
          if($val instanceof TeamSpeak3_Helper_String)
          {
            $match = $val->contains($rules[$key], TRUE);
          }
          else
          {
            $match = $val == $rules[$key];
          }

          if($match === FALSE)
          {
            unset($nodes[$node->getId()]);
          }
        }
      }
    }

    return $nodes;
  }
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 260 of file Abstract.php.

References 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().

  {
    if($extend)
    {
      $this->fetchNodeInfo();
    }

    if($convert)
    {
      $info = $this->nodeInfo;

      foreach($info as $key => $val)
      {
        $key = TeamSpeak3_Helper_String::factory($key);

        if($key->contains("_bytes_"))
        {
          $info[$key->toString()] = TeamSpeak3_Helper_Convert::bytes($val);
        }
        elseif($key->contains("_bandwidth_"))
        {
          $info[$key->toString()] = TeamSpeak3_Helper_Convert::bytes($val) . "/s";
        }
        elseif($key->contains("_packets_"))
        {
          $info[$key->toString()] = number_format($val, null, null, ".");
        }
        elseif($key->contains("_packetloss_"))
        {
          $info[$key->toString()] = sprintf("%01.2f", floatval($val->toString())*100) . "%";
        }
        elseif($key->endsWith("_uptime"))
        {
          $info[$key->toString()] = TeamSpeak3_Helper_Convert::seconds($val);
        }
        elseif($key->endsWith("_version"))
        {
          $info[$key->toString()] = TeamSpeak3_Helper_Convert::version($val);
        }
        elseif($key->endsWith("_icon_id"))
        {
          $info[$key->toString()] = $this->iconGetName($key)->filterDigits();
        }
      }

      return $info;
    }

    return $this->nodeInfo;
  }
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 318 of file Abstract.php.

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

Referenced by sortClientList(), and sortGroupList().

  {
    if(!$this->offsetExists($property))
    {
      $this->fetchNodeInfo();
    }

    if(!$this->offsetExists($property))
    {
      return $default;
    }

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

Returns a string representation of this node.

Returns:
string

Definition at line 348 of file Abstract.php.

References TeamSpeak3_Node_Abstract\__toString().

  {
    return $this->__toString();
  }

Returns an assoc array filled with current node info properties.

Returns:
array

Definition at line 358 of file Abstract.php.

Referenced by channelFileInfo().

  {
    return $this->nodeList;
  }
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 371 of file Abstract.php.

References TeamSpeak3_Node_Abstract\getParent().

  {
    if($this->getParent() instanceof TeamSpeak3_Node_Abstract)
    {
      return call_user_func_array(array($this->getParent(), $name), $args);
    }

    throw new TeamSpeak3_Node_Exception("node method '" . $name . "()' does not exist");
  }
TeamSpeak3_Node_Abstract::setStorage ( key,
val 
) [protected, inherited]
TeamSpeak3_Node_Abstract::getStorage ( key,
default = null 
) [protected, inherited]

Returns data from the internal storage array.

Parameters:
string$key
mixed$default
Returns:
mixed

Definition at line 400 of file Abstract.php.

Referenced by TeamSpeak3_Node_Host\__wakeup().

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

Deletes data from the internal storage array.

Parameters:
string$key
Returns:
void

Definition at line 411 of file Abstract.php.

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

  {
    unset($this->storage[$key]);
  }

Commit pending data.

Returns:
array

Definition at line 421 of file Abstract.php.

  {
    return array("parent", "storage", "nodeId");
  }
TeamSpeak3_Node_Abstract::resetNodeInfo ( ) [protected, inherited]

Definition at line 445 of file Abstract.php.

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

  {
    $this->nodeInfo = array();
  }

Definition at line 492 of file Abstract.php.

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

  {
    $this->verifyNodeList();

    return $this->current();
  }

Definition at line 502 of file Abstract.php.

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

  {
    $this->verifyNodeList();

    return $this->current()->count() > 0;
  }

Definition at line 512 of file Abstract.php.

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

  {
    $this->verifyNodeList();

    return $this->key()+1 < $this->count();
  }

Definition at line 522 of file Abstract.php.

References TeamSpeak3_Node_Abstract\verifyNodeList().

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

  {
    $this->verifyNodeList();

    return key($this->nodeList);
  }

Definition at line 532 of file Abstract.php.

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

  {
    $this->verifyNodeList();

    return $this->key() !== null;
  }

Definition at line 542 of file Abstract.php.

References TeamSpeak3_Node_Abstract\verifyNodeList().

  {
    $this->verifyNodeList();

    return next($this->nodeList);
  }

Definition at line 552 of file Abstract.php.

References TeamSpeak3_Node_Abstract\verifyNodeList().

  {
    $this->verifyNodeList();

    return reset($this->nodeList);
  }
TeamSpeak3_Node_Abstract::offsetExists ( offset) [inherited]

Definition at line 562 of file Abstract.php.

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

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

Definition at line 570 of file Abstract.php.

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

Referenced by TeamSpeak3_Node_Abstract\__get().

  {
    if(!$this->offsetExists($offset))
    {
      $this->fetchNodeInfo();
    }

    if(!$this->offsetExists($offset))
    {
      echo $offset;

      throw new TeamSpeak3_Adapter_ServerQuery_Exception("invalid parameter", 0x602);
    }

    return $this->nodeInfo[(string) $offset];
  }
TeamSpeak3_Node_Abstract::offsetSet ( offset,
value 
) [inherited]

Definition at line 590 of file Abstract.php.

Referenced by TeamSpeak3_Node_Abstract\__set().

  {
    if(method_exists($this, "modify"))
    {
      return $this->modify(array((string) $offset => $value));
    }

    throw new TeamSpeak3_Node_Exception("node '" . get_class($this) . "' is read only");
  }
TeamSpeak3_Node_Abstract::offsetUnset ( offset) [inherited]

Definition at line 603 of file Abstract.php.

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

Definition at line 611 of file Abstract.php.

References TeamSpeak3_Node_Abstract\offsetGet().

  {
    return $this->offsetGet($offset);
  }
TeamSpeak3_Node_Abstract::__set ( offset,
value 
) [inherited]

Definition at line 619 of file Abstract.php.

References TeamSpeak3_Node_Abstract\offsetSet().

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

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 [protected, inherited]

Definition at line 37 of file Abstract.php.

TeamSpeak3_Node_Abstract::$nodeId = 0x00 [protected, inherited]

Definition at line 47 of file Abstract.php.

TeamSpeak3_Node_Abstract::$nodeList = null [protected, inherited]

Definition at line 52 of file Abstract.php.

TeamSpeak3_Node_Abstract::$nodeInfo = array() [protected, inherited]

Definition at line 57 of file Abstract.php.

TeamSpeak3_Node_Abstract::$storage = array() [protected, inherited]

Definition at line 62 of file Abstract.php.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables