| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983 |
- <?php
- /**
- * ts3remote.class.php <br />
- * ------------------- <br />
- * begin : Sunday, Dec 22, 2009 <br />
- * copyright : (C) 2009-2010 RK Programming <br />
- * email : [email protected] <br />
- * version : 0.9.1 <br />
- * last modified : Tuesday, Dec 29, 2009 <br />
- *
- * @author RK Programming <[email protected]>
- * @copyright Copyright (c) 2009-2010, Robin K.
- * @version 0.9.1
-
-
- TS3remote and TS3lib is free software. You can redistribute it and/or
- modify it under the terms of the GNU General Public License as published
- by the Free Software Foundation, version 1.3.
-
- **/
- define('TS3REMOTE_VERSION', '0.9.0');
- require_once('ts3lib.class.php');
- class TS3remote extends TS3lib
- {
- protected $loggedin;
-
- function __construct($ip, $port)
- {
- parent::__construct($ip, $port);
-
- $this->loggedin = false;
- }
-
- function __destruct()
- {
- parent::__destruct();
- }
-
- public function r_login($user, $password)
- {
- $user = $this->escape($user);
- $password = $this->escape($password);
-
- if( $this->performResultless("login client_login_name=$user client_login_password=$password") )
- {
- $this->loggedin = true;
- return true;
- }
- else
- {
- return false;
- }
- }
-
- public function r_logout()
- {
- $this->loggedin = false;
-
- return $this->performResultless('logout');
- }
-
- public function r_version($parse=TS3_PARSED) // or TS3_RAW
- {
- return $this->perform('version', $parse);
- }
-
- public function r_hostinfo($parse=TS3_PARSED)
- {
- return $this->perform('hostinfo', $parse);
- }
-
- public function r_instanceinfo($parse=TS3_PARSED)
- {
- return $this->perform('instanceinfo', $parse);
- }
-
- public function r_instanceedeit($var, $value)
- {
- $var = $this->escape($var);
- $value = $this->escape($value);
-
- return $this->performResultless("instanceedit $var=$value");
- }
-
- public function r_bindinglist($parse=TS3_PARSED)
- {
- return $this->perform('bindinglist', $parse);
- }
-
- public function r_use($sid, $port=0)
- {
- $sid = $this->escape($sid);
-
- $this->vserver = $sid;
-
- if( $port > 0 )
- {
- $port = $this->escape($port);
-
- return $this->performResultless("use sid=$sid port=$port");
- }
- else
- {
- return $this->performResultless("use sid=$sid");
- }
- }
-
- public function r_serverlist($all=true, $parse=TS3_PARSED)
- {
- if( $all ) $all = ' -all';
- else $all = '';
-
- return $this->perform("serverlist$all", $parse);
- }
-
- public function r_serveridgetbyport($sid, $parse=TS3_PARSED)
- {
- $sid = $this->escape($sid);
-
- return $this->perform("serveridgetbyport virtualserver_port=$sid", $parse);
- }
-
- public function r_serverdelete($sid)
- {
- $sid = $this->escape($sid);
-
- return $this->performResultless("serverdelete sid=$sid");
- }
-
- public function r_servercreate($vServerName, $props, $parse=TS3_PARSED)
- {
- $vServerName = $this->escape($vServerName);
-
- $countProps = count($props);
- for($i=0; $i<$countProps; $i++)
- {
- $props[$i] = $this->escape($props[$i][0]).'='.$this->escape($props[$i][1]);
- }
- $propString = implode(' ', $props);
-
- return $this->perform("servercreate virtualserver_name=$vServerName $propString", $parse);
- }
-
- public function r_serverstart($sid)
- {
- $sid = $this->escape($sid);
-
- return $this->performResultless("serverstart sid=$sid");
- }
-
- public function r_serverstop($sid)
- {
- $sid = $this->escape($sid);
-
- return $this->performResultless("serverstop sid=$sid");
- }
-
- /*
- serverprocessstop
- */
-
- public function r_serverinfo($parse=TS3_PARSED)
- {
- return $this->perform('serverinfo', $parse);
- }
-
- public function r_serverrequestconnectioninfo($parse=TS3_PARSED)
- {
- return $this->perform('serverrequestconnectioninfo', $parse);
- }
-
- public function r_serveredit($props)
- {
- //print_r($props);
- //$props = $this->escape($props);
- //print_r($props);
-
- $countProps = count($props);
- for($i=0; $i<$countProps; $i++)
- {
- $props[$i] = $this->escape($props[$i][0]).'='.$this->escape($props[$i][1]);
- }
- $propString = implode(' ', $props);
-
- //echo $propString;
-
- return $this->performResultless("serveredit $propString");
- }
-
- public function r_servergrouplist($parse=TS3_PARSED)
- {
- if( $this->vserver > 0 )
- return $this->perform('servergrouplist', $parse);
- else
- return false;
- }
-
- public function r_servergroupadd($grpName, $parse=TS3_PARSED)
- {
- $grpName = $this->escape($grpName);
-
- return $this->perform("servergroupadd name=$grpName", $parse);
- }
-
- public function r_servergroupdel($sgid, $force=1)
- {
- $sgid = $this->escape($sgid);
- if( $force != 0 ) $force = 1;
-
- return $this->performResultless("servergroupdel sgid=$sgid force=$force");
- }
-
- public function r_servergrouprename($sgid, $newName)
- {
- $sgid = $this->escape($sgid);
- $newName = $this->escape($newName);
-
- return $this->performResultless("servergrouprename sgid=$sgid name=$newName");
- }
-
- public function r_servergrouppermlist($sgid, $parse=TS3_PARSED)
- {
- $sgid = $this->escape($sgid);
-
- return $this->perform("servergrouppermlist sgid=$sgid", $parse);
- }
-
- public function r_servergroupaddperm($sgid, $permid, $value, $negated, $skip)
- {
- $sgid = $this->escape($sgid);
- $permid = $this->escape($permid);
- $value = $this->escape($value);
- $negated = $this->escape($negated);
- $skip = $this->escape($skip);
-
- return $this->performResultless("servergroupaddperm sgid=$sgid permid=$permid permvalue=$value permnegated=$negated permskip=$skip");
- }
-
- public function r_servergroupdelperm($sgid, $permid)
- {
- $sgid = $this->escape($sgid);
- $permid = $this->escape($permid);
-
- return $this->performResultless("servergroupdelperm sgid=$sgid permid=$permid");
- }
-
- public function r_servergroupaddclient($sgid, $clientdbid)
- {
- $sgid = $this->escape($sgid);
- $clientdbid = $this->escape($clientdbid);
-
- return $this->performResultless("servergroupaddclient sgid=$sgid cldbid=$clientdbid");
- }
-
- public function r_servergroupdelclient($sgid, $clientdbid)
- {
- $sgid = $this->escape($sgid);
- $clientdbid = $this->escape($clientdbid);
-
- return $this->performResultless("servergroupdelclient sgid=$sgid cldbid=$clientdbid");
- }
-
- public function r_servergroupclientlist($sgid, $names=true, $parse=TS3_PARSED)
- {
- if( $names ) $names = ' -names';
- else $names = '';
-
- return $this->perform("servergroupclientlist sgid=$sgid$names", $parse);
- }
-
- public function r_servergroupsbyclientid($clientdbid, $parse=TS3_PARSED)
- {
- $sgid = $this->escape($sgid);
-
- return $this->perform("servergroupsbyclientid cldbid=$clientdbid", $parse);
- }
-
- public function r_serversnapshotcreate($parse=TS3_PARSED)
- {
- return $this->perform("serversnapshotcreate", $parse);
- }
-
- /*
- * serversnapshotdeploy
- * servernotifyregister
- * servernotifyunregister
- */
-
- public function r_gm($msg)
- {
- $msg = $this->escape($msg);
-
- return $this->performResultless("gm msg=$msg");
- }
-
- public function r_sendtextmessage($targetmode, $target, $msg)
- {
- $targetmode = $this->escape($targetmode);
- $target = $this->escape($target);
- $msg = $this->escape($msg);
-
- return $this->performResultless("sendtextmessage targetmode=$targetmode target=$target msg=$msg");
- }
-
- public function r_logview($limit=50, $parse=TS3_PARSED)
- {
- $limit = $this->escape($limit);
-
- return $this->perform("logview limitcount=$limit", $parse);
- }
-
- public function r_logadd($level, $msg)
- {
- $level = $this->escape($level);
- $msg = $this->escape($msg);
-
- return $this->performResultless("logadd loglevel=$level logmsg=$msg");
- }
-
- public function r_channellist($topic='', $flags='', $voice='', $limits='', $parse=TS3_PARSED)
- {
- if( $topic !== '' ) $topic = ' -topic';
- if( $flags !== '' ) $flags = ' -flags';
- if( $voice !== '' ) $voice = ' -voice';
- if( $limits !== '' ) $limits = ' -limits';
-
- return $this->perform("channellist$topic$flags$voice$limits", $parse);
- }
-
- public function r_channelinfo($cid, $parse=TS3_PARSED)
- {
- $cid = $this->escape($cid);
-
- return $this->perform("channelinfo cid=$cid", $parse);
- }
-
- /*
- channelfind (page 16 pdf)
- ...
- ...
- */
-
- public function r_channelfind($pattern, $parse=TS3_PARSED)
- {
- $pattern = $this->escape($pattern);
-
- return $this->perform("channelfind pattern=$cid", $parse);
- }
-
- public function r_channelmove($cid, $newParentid, $sortorder='')
- {
- $cid = $this->escape($cid);
- $newParentid = $this->escape($newParentid);
- if( $sortorder !== '' ) $sortorder = ' order='.$this->escape($sortorder);
-
- //echo "channelmove cid=$cid cpid=$newParentid$sortorder\n";
- return $this->performResultless("channelmove cid=$cid cpid=$newParentid$sortorder");
- }
-
- public function r_channelcreate($name, $props, $parse=TS3_PARSED, $escape=true)
- {
- if( !is_array($props) ) return false;
-
- if( $escape )
- {
- $name = $this->escape($name);
- $props = $this->escape($props);
- }
-
- $countProps = count($props);
- for($i=0; $i<$countProps; $i++)
- {
- $props[$i] = $props[$i][0].'='.$props[$i][1];
- }
- $propString = implode(' ', $props);
-
- return $this->perform("channelcreate channel_name=$name $propString", $parse);
- }
-
- public function r_channeledit($cid, $props)
- {
- if( !is_array($props) ) return false;
-
- $cid = $this->escape($cid);
- $props = $this->escape($props);
-
- $countProps = count($props);
- for($i=0; $i<$countProps; $i++)
- {
- $props[$i] = $props[$i][0].'='.$props[$i][1];
- }
- $propString = implode(' ', $props);
-
- return $this->performResultless("channeledit cid=$cid $propString");
- }
-
- public function r_channeldelete($cid, $force=1)
- {
- $cid = $this->escape($cid);
- if( $force != 0 ) $force = 1;
-
- return $this->performResultless("channeldelete cid=$cid force=$force");
- }
-
- public function r_channelpermlist($cid, $parse=TS3_PARSED)
- {
- $cid = $this->escape($cid);
-
- return $this->perform("channelpermlist cid=$cid", $parse);
- }
-
- public function r_channeladdperm($cid, $perms)
- {
- $cid = $this->escape($cid);
- $perms = $this->escape($perms);
-
- $countPerms = count($perms);
- for($i=0; $i<$countPerms; $i++)
- {
- $perms[$i] = $perms[$i][0].'='.$perms[$i][1].' '.$perms[$i][2].'='.$perms[$i][3];
- }
- $permString = implode('|', $perms);
-
- return $this->performResultless("channeladdperm cid=$cid $permString");
- }
-
- public function r_channeldelperm($cid, $perms)
- {
- $cid = $this->escape($cid);
- $perms = $this->escape($perms);
-
- $countPerms = count($perms);
- for($i=0; $i<$countPerms; $i++)
- {
- $perms[$i] = $perms[$i][0].'='.$perms[$i][1];
- }
- $permString = implode('|', $perms);
-
- return $this->performResultless("channeldelperm cid=$cid $permString");
- }
-
- public function r_channelgrouplist($parse=TS3_PARSED)
- {
- return $this->perform("channelgrouplist", $parse);
- }
-
- public function r_channelgroupadd($name, $parse=TS3_PARSED)
- {
- $name = $this->escape($name);
-
- return $this->perform("channelgroupadd name=$name", $parse);
- }
-
- public function r_channelgroupdel($cgid, $force=1)
- {
- $cgid = $this->escape($cgid);
- if( $force != 0 ) $force = 1;
-
- return $this->performResultless("channelgroupdel cgid=$cgid force=$force");
- }
-
- public function r_channelgrouprename($cgid, $name)
- {
- $cgid = $this->escape($cgid);
- $name = $this->escape($name);
-
- return $this->performResultless("channelgrouprename cgid=$cgid name=$name");
- }
-
- public function r_channelgroupaddperm($cgid, $perms)
- {
- $cgid = $this->escape($cgid);
- $perms = $this->escape($perms);
-
- $countPerms = count($perms);
- for($i=0; $i<$countPerms; $i++)
- {
- $perms[$i] = $perms[$i][0].'='.$perms[$i][1].' '.$perms[$i][2].'='.$perms[$i][3];
- }
- $permString = implode('|', $perms);
-
- return $this->performResultless("channelgroupaddperm cid=$cgid $permString");
- }
-
- public function r_channelgroupdelperm($cgid, $perms)
- {
- $cgid = $this->escape($cgid);
- $perms = $this->escape($perms);
-
- $countPerms = count($perms);
- for($i=0; $i<$countPerms; $i++)
- {
- $perms[$i] = $perms[$i][0].'='.$perms[$i][1];
- }
- $permString = implode('|', $perms);
-
- return $this->performResultless("channelgroupdelperm cid=$cgid $permString");
- }
-
- public function r_channelgrouppermlist($cgid, $parse=TS3_PARSED)
- {
- $cgid = $this->escape($cgid);
-
- return $this->perform("channelgrouppermlist cgid=$cgid", $parse);
- }
-
- public function r_channelgroupclientlist($cid=0, $clid=0, $cgid=0, $parse=TS3_PARSED)
- {
- if( $cid != 0 && $cid != false ) $cid = ' cid='.$this->escape($cid);
- if( $clid != 0 && $clid != false ) $clid = ' clid='.$this->escape($clid);
- if( $cgid != 0 && $cgid != false ) $cgid = ' cgid='.$this->escape($cgid);
-
- return $this->perform("channelgroupclientlist$cid$clid$cgid", $parse);
- }
-
- public function r_setclientchannelgroup($cgid, $cid, $cldbid)
- {
- $cgid = $this->escape($cgid);
- $cid = $this->escape($cid);
- $cldbid = $this->escape($cldbid);
-
- return $this->performResultless("setclientchannelgroup cgid=$cgid cid=$cid cldbid=$cldbid");
- }
-
- public function r_clientlist($uid='', $away='', $voice='', $groups='', $info='', $parse=TS3_PARSED)
- {
- if( $uid != '' ) $uid = ' -uid';
- if( $away != '' ) $away = ' -away';
- if( $voice != '' ) $voice = ' -voice';
- if( $groups != '' ) $groups = ' -groups';
- if( $info != '' ) $info = ' -info';
-
- return $this->perform("clientlist$uid$away$voice$groups$info", $parse);
- }
-
- public function r_clientinfo($clid, $parse=TS3_PARSED)
- {
- $clid = $this->escape($clid);
-
- return $this->perform("clientinfo clid=$clid", $parse);
- }
-
- public function r_clientfind($namePattern, $parse=TS3_PARSED)
- {
- $namePattern = $this->escape($namePattern);
-
- return $this->perform("clientfind pattern=$namePattern", $parse);
- }
-
- public function r_clientedit($clid, $props)
- {
- $clid = $this->escape($clid);
- $props = $this->escape($props);
-
- $countProps = count($props);
- for($i=0; $i<$countProps; $i++)
- {
- $props[$i] = $props[$i][0].'='.$props[$i][1];
- }
- $propString = implode(' ', $props);
-
- return $this->performResultless("clientedit clid=$clid $propString");
- }
-
- public function r_clientdblist($parse=TS3_PARSED)
- {
- return $this->perform("clientdblist", $parse);
- }
-
- public function r_clientdbfind($clPattern, $uid='', $parse=TS3_PARSED)
- {
- $clPattern = $this->escape($clPattern);
- if( $uid != '' ) $uid = ' -uid';
-
- return $this->perform("clientdbfind pattern=$clPattern$uid", $parse);
- }
-
- public function r_clientdbedit($cldbid, $props)
- {
- $cldbid = $this->escape($cldbid);
-
- $countProps = count($props);
- for($i=0; $i<$countProps; $i++)
- {
- $props[$i] = $props[$i][0].'='.$props[$i][1];
- }
- $propString = implode(' ', $props);
-
- return $this->performResultless("clientdbedit cldbid=$cldbid $propString");
- }
-
- public function r_clientdbdelete($cldbid)
- {
- $cldbid = $this->escape($cldbid);
-
- return $this->performResultless("clientdbdelete cldbid=$cldbid");
- }
-
- public function r_clientgetids($cluid, $parse=TS3_PARSED)
- {
- $cluid = $this->escape($cluid);
-
- return $this->perform("clientgetids cluid=$cluid", $parse);
- }
-
- public function r_clientgetdbidfromuid($cluid, $parse=TS3_PARSED)
- {
- $cluid = $this->escape($cluid);
-
- return $this->perform("clientgetdbidfromuid cluid=$cluid", $parse);
- }
-
- public function r_clientgetnamefromuid($cluid, $parse=TS3_PARSED)
- {
- $cluid = $this->escape($cluid);
-
- return $this->perform("clientgetnamefromuid cluid=$cluid", $parse);
- }
-
- public function r_clientgetnamefromdbid($cldbid, $parse=TS3_PARSED)
- {
- $cldbid = $this->escape($cldbid);
-
- return $this->perform("clientgetnamefromdbid cldbid=$cldbid", $parse);
- }
-
- public function r_clientsetserverquerylogin($name, $parse=TS3_PARSED)
- {
- $name = $this->escape($name);
-
- return $this->perform("clientsetserverquerylogin client_login_name=$name", $parse);
- }
-
- public function r_clientupdate($props)
- {
- $countProps = count($props);
- for($i=0; $i<$countProps; $i++)
- {
- $props[$i] = $this->escape($props[$i][0]).'='.$this->escape($props[$i][1]);
- }
- $propString = implode(' ', $props);
-
- return $this->performResultless("clientupdate $propString");
- }
-
- public function r_clientmove($clid, $cid, $cpw='')
- {
- $clid = $this->escape($clid);
- $cid = $this->escape($cid);
- if( $cpw != '' ) $cpw = ' cpw='.$this->escape($cpw);
-
- if( is_array($clid) )
- {
- $countClid = count($clid);
- for($i=0; $i<$countClid; $i++)
- {
- $clid[$i] = $clid[$i][0].'='.$clid[$i][1];
- }
- $clidString = implode('|', $clid);
- }
- else
- {
- $clidString = ' clid='.$clid;
- }
-
- return $this->performResultless("clientmove $clidString cid=$cid$cpw");
- }
-
- public function r_clientkick($clid, $reasonid=5, $reasonmsg='')
- {
- $clid = $this->escape($clid);
- $reasonid = $this->escape($reasonid);
- if( $reasonmsg != '' ) $reasonmsg = ' reasonmsg='.$this->escape($reasonmsg);
-
- if( is_array($clid) )
- {
- $countClid = count($clid);
- for($i=0; $i<$countClid; $i++)
- {
- $clid[$i] = $clid[$i][0].'='.$clid[$i][1];
- }
- $clidString = implode('|', $clid);
- }
- else
- {
- $clidString = ' clid='.$clid;
- }
-
- return $this->performResultless("clientkick $clidString reasonid=$reasonid$reasonmsg");
- }
-
- public function r_clientpoke($clid, $msg)
- {
- $clid = $this->escape($clid);
- $msg = $this->escape($msg);
-
- if( is_array($clid) )
- {
- $countClid = count($clid);
- for($i=0; $i<$countClid; $i++)
- {
- $clid[$i] = $clid[$i][0].'='.$clid[$i][1];
- }
- $clidString = implode('|', $clid);
- }
- else
- {
- $clidString = ' clid='.$clid;
- }
-
- return $this->performResultless("clientpoke $clidString msg=$msg");
- }
-
- public function r_clientpermlist($cldbid, $parse=TS3_PARSED)
- {
- $cldbid = $this->escape($cldbid);
-
- return $this->perform("clientpermlist cldbid=$cldbid", $parse);
- }
-
- public function r_clientaddperm($cldbid, $perms)
- {
- $cldbid = $this->escape($cldbid);
- $perms = $this->escape($perms);
-
- $countPerms = count($perms);
- for($i=0; $i<$countPerms; $i++)
- {
- $perms[$i] = $perms[$i][0].'='.$perms[$i][1].' '.$perms[$i][2].'='.$perms[$i][3].' '.$perms[$i][4].'='.$perms[$i][5];
- }
- $permString = implode('|', $perms);
-
- return $this->performResultless("clientaddperm cldbid=$cldbid $permString");
- }
-
- public function r_clientdelperm($cldbid, $perms)
- {
- $cldbid = $this->escape($cldbid);
- $perms = $this->escape($perms);
-
- $countPerms = count($perms);
- for($i=0; $i<$countPerms; $i++)
- {
- $perms[$i] = $perms[$i][0].'='.$perms[$i][1];
- }
- $permString = implode('|', $perms);
-
- return $this->performResultless("clientdelperm cldbid=$cldbid $permString");
- }
-
- public function r_channelclientpermlist($cid, $cldbid, $parse=TS3_PARSED)
- {
- $cid = $this->escape($cid);
- $cldbid = $this->escape($cldbid);
-
- return $this->perform("channelclientpermlist cid=$cid cldbid=$cldbid", $parse);
- }
-
- public function r_channelclientaddperm($cid, $cldbid, $perms)
- {
- $cid = $this->escape($cid);
- $cldbid = $this->escape($cldbid);
- $perms = $this->escape($perms);
-
- $countPerms = count($perms);
- for($i=0; $i<$countPerms; $i++)
- {
- $perms[$i] = $perms[$i][0].'='.$perms[$i][1].' '.$perms[$i][2].'='.$perms[$i][3];
- }
- $permString = implode('|', $perms);
-
- return $this->performResultless("channelclientaddperm cid=$cid cldbid=$cldbid $permString");
- }
-
- public function r_channelclientdelperm($cid, $cldbid, $perms)
- {
- $cid = $this->escape($cid);
- $cldbid = $this->escape($cldbid);
- $perms = $this->escape($perms);
-
- $countPerms = count($perms);
- for($i=0; $i<$countPerms; $i++)
- {
- $perms[$i] = $perms[$i][0].'='.$perms[$i][1];
- }
- $permString = implode('|', $perms);
-
- return $this->performResultless("channelclientdelperm cid=$cid cldbid=$cldbid $permString");
- }
-
- public function r_permissionlist($parse=TS3_PARSED)
- {
- return $this->perform("permissionlist", $parse);
- }
-
- public function r_permoverview($cid, $cldbid, $permid=0, $parse=TS3_PARSED)
- {
- $cid = $this->escape($cid);
- $cldbid = $this->escape($cldbid);
- $permid = $this->escape($permid);
-
- return $this->perform("permoverview cid=$cid cldbid=$cldbid permid=$permid", $parse);
- }
-
- public function r_permfind($permid, $parse=TS3_PARSED)
- {
- $permid = $this->escape($permid);
-
- return $this->perform("permfind permid=$permid", $parse);
- }
-
- public function r_tokenlist($parse=TS3_PARSED)
- {
- return $this->perform("tokenlist", $parse);
- }
-
- public function r_tokenadd($tokentype, $tokenid1, $tokenid2=0, $parse=TS3_PARSED)
- {
- $tokentype = $this->escape($tokentype);
- $tokenid1 = $this->escape($tokenid1);
- $tokenid2 = $this->escape($tokenid2);
-
- return $this->perform("tokenadd tokentype=$tokentype tokenid1=$tokenid1 tokenid2=$tokenid2", $parse);
- }
-
- public function r_tokendelete($tokenkey)
- {
- $tokenkey = $this->escape($tokenkey);
-
- return $this->performResultless("tokendelete token=$tokenkey");
- }
-
- public function r_tokenuse($tokenkey)
- {
- $tokenkey = $this->escape($tokenkey);
-
- return $this->performResultless("tokenuse token=$tokenkey");
- }
-
- public function r_messagelist($parse=TS3_PARSED)
- {
- return $this->perform("messagelist", $parse);
- }
-
- public function r_messageadd($cluid, $subject, $msg)
- {
- $cluid = $this->escape($cluid);
- $subject = $this->escape($subject);
- $msg = $this->escape($msg);
-
- return $this->performResultless("messageadd cluid=$cluid subject=$subject message=$msg");
- }
-
- public function r_messageget($msgid, $parse=TS3_PARSED)
- {
- $msgid = $this->escape($msgid);
-
- return $this->perform("messageget msgid=$msgid", $parse);
- }
-
- public function r_messageupdateflag($msgid, $readflag)
- {
- $msgid = $this->escape($msgid);
- if( $readflag != 0 ) $readflag = 1;
-
- return $this->performResultless("messageupdateflag msgid=$msgid flag=$readflag");
- }
-
- public function r_messagedel($msgid)
- {
- $msgid = $this->escape($msgid);
-
- return $this->performResultless("messagedel msgid=$msgid");
- }
-
- public function r_complainlist($targetcldbid="", $parse=TS3_PARSED)
- {
- if( $targetcldbid != "" ) $targetcldbid = ' tcldbid='.$this->escape($targetcldbid);
-
- return $this->perform("complainlist$targetcldbid", $parse);
- }
-
- public function r_complainadd($targetcldbid, $msg, $parse=TS3_PARSED)
- {
- $targetcldbid = $this->escape($targetcldbid);
- $msg = $this->escape($msg);
-
- return $this->perform("complainadd tcldbid=$targetcldbid message=$msg", $parse);
- }
-
- // 2. from id = client who complained about the target
- public function r_complaindel($targetcldbid, $fromcldbid)
- {
- $targetcldbid = $this->escape($targetcldbid);
- $fromcldbid = $this->escape($fromcldbid);
-
- return $this->performResultless("complaindel tcldbid=$targetcldbid fcldbid=$fromcldbid");
- }
-
- public function r_complaindelall($targetcldbid)
- {
- $targetcldbid = $this->escape($targetcldbid);
-
- return $this->performResultless("complaindelall tcldbid=$targetcldbid");
- }
-
- public function r_banclient($clid, $time=0, $reason="", $parse=TS3_PARSED)
- {
- $clid = $this->escape($clid);
- if( $time != 0 ) $time = ' time='.$this->escape($time);
- else $time = '';
- if( $reason != '' ) $reason = ' banreason='.$this->escape($reason);
-
- return $this->perform("banclient clid=$clid$time$reason", $parse);
- }
-
- public function r_banlist($parse=TS3_PARSED)
- {
- return $this->perform("banlist", $parse);
- }
-
- public function r_banadd($ip='', $name='', $uid='', $time=0, $reason="", $parse=TS3_PARSED)
- {
- if( $ip != '' ) $ip = ' ip='.$this->escape($ip);
- if( $name != '' ) $name = ' name='.$this->escape($name);
- if( $uid != '' ) $uid = ' uid='.$this->escape($uid);
-
- if( $ip == '' && $name == '' && $uid == '' ) return false;
-
- if( $time != 0 ) $time = ' time='.$this->escape($time);
- else $time = '';
- if( $reason != '' ) $reason = ' banreason='.$this->escape($reason);
-
- return $this->perform("banadd$ip$name$uid$time$reason", $parse);
- }
-
- public function r_bandel($banid)
- {
- $banid = $this->escape($banid);
-
- return $this->performResultless("bandel banid=$banid");
- }
-
- public function r_bandelall()
- {
- return $this->performResultless("bandelall");
- }
-
- /*
- * ALL FILETRANSFER COMMANDS ARE STILL MISSING
- */
-
- public function r_whoami($parse=TS3_PARSED)
- {
- return $this->perform("whoami", $parse);
- }
-
-
- /*
- public function r_($parse=TS3_PARSED)
- {
- return $this->perform("", $parse);
- }
- public function r_()
- {
- return $this->performResultless("");
- }
- */
- }
- //$remote = new TS3remote('xxx.xxx.xxx.xxx', 10011);
- //var_dump($remote->r_login('admin', 'xxxxxxxx'));
- //var_dump($remote->r_use(8));
- //var_dump($remote->r_sendtextmessage(1, 2, 'Hi!'));
- //var_dump($remote->r_clientpoke(2, 'p0k3d!'));
- //var_dump($remote->r_serveredit('virtualserver_name','TS3 Server'));
- ?>
|