Completed
Push — master ( 7bc45e...0e9340 )
by Jeremy
02:53
created
API/TeamSpeak3.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3293,7 +3293,7 @@  discard block
 block discarded – undo
3293 3293
   * @param		string	$pw				temporary password
3294 3294
   * @param		string	$duration		durations in seconds
3295 3295
   * @param		string	$desc			description [optional]
3296
-  * @param		string	$tcid			cid user enters on connect (0 = Default channel) [optional]
3296
+  * @param		integer	$tcid			cid user enters on connect (0 = Default channel) [optional]
3297 3297
   * @param		string	$tcpw			channelPW
3298 3298
   * @return     boolean success
3299 3299
   */
@@ -3992,7 +3992,7 @@  discard block
 block discarded – undo
3992 3992
   * Sends data to ftHost
3993 3993
   * 
3994 3994
   * @author     Par0noid Solutions
3995
-  * @param		mixed	$data
3995
+  * @param		string	$data
3996 3996
   * @return     none
3997 3997
  */
3998 3998
 	private function ftSendData($data) {
Please login to merge, or discard this patch.
Indentation   +3882 added lines, -3883 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 //*******************************************************************************************
49 49
 
50 50
 /**
51
-  * runtime is an private handle and configuration storage
52
-  *
53
-  * @author     Par0noid Solutions
54
-  */
55
-	private $runtime = array('socket' => '', 'selected' => false, 'host' => '', 'queryport' => '10011', 'timeout' => 2, 'debug' => array(), 'fileSocket' => '');
51
+ * runtime is an private handle and configuration storage
52
+ *
53
+ * @author     Par0noid Solutions
54
+ */
55
+    private $runtime = array('socket' => '', 'selected' => false, 'host' => '', 'queryport' => '10011', 'timeout' => 2, 'debug' => array(), 'fileSocket' => '');
56 56
 
57 57
 
58 58
 //*******************************************************************************************	
@@ -60,3593 +60,3592 @@  discard block
 block discarded – undo
60 60
 //******************************************************************************************
61 61
 
62 62
 /**
63
-  * banAddByIp
64
-  *
65
-  * Adds a new ban rule on the selected virtual server.
66
-  *
67
-  *	<b>Output:</b>
68
-  * <pre>
69
-  * Array
70
-  * {
71
-  *  [banid] => 109
72
-  * }
73
-  * </pre>
74
-  *
75
-  * @author     Par0noid Solutions
76
-  * @param		string	$ip			clientIp
77
-  * @param		integer	$time		bantime in seconds (0=unlimited)
78
-  * @param		string	$banreason	Banreason [optional]
79
-  * @return     array banId
80
-  */
81
-	function banAddByIp($ip, $time, $banreason = NULL) {
82
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
83
-		
84
-		if(!empty($banreason)) { $msg = ' banreason='.$this->escapeText($banreason); } else { $msg = NULL; }
85
-
86
-		return $this->getData('array', 'banadd ip='.$ip.' time='.$time.$msg);
87
-	}
88
-
89
-/**
90
-  * banAddByUid
91
-  *
92
-  *	Adds a new ban rule on the selected virtual server.
93
-  *
94
-  * <b>Output:</b>
95
-  * <pre>
96
-  * Array
97
-  * {
98
-  *  [banid] => 110
99
-  * }
100
-  * </pre>
101
-  *
102
-  * @author     Par0noid Solutions
103
-  * @param		string	$uid		clientUniqueId
104
-  * @param		integer	$time		bantime in seconds (0=unlimited)
105
-  * @param		string	$banreason	Banreason [optional]
106
-  * @return     array banId
107
-  */
108
-	function banAddByUid($uid, $time, $banreason = NULL) {
109
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
110
-		
111
-		if(!empty($banreason)) { $msg = ' banreason='.$this->escapeText($banreason); } else { $msg = NULL; }
112
-		
113
-		return $this->getData('array', 'banadd uid='.$uid.' time='.$time.$msg);
114
-	}
115
-
116
-/**
117
-  * banAddByName
118
-  *
119
-  *	Adds a new ban rule on the selected virtual server.
120
-  *
121
-  * <b>Output:</b>
122
-  * <pre>
123
-  * Array
124
-  * {
125
-  *  [banid] => 111
126
-  * }
127
-  * </pre>
128
-  *
129
-  * @author     Par0noid Solutions
130
-  * @param		string	$name		clientName
131
-  * @param		integer	$time		bantime in seconds (0=unlimited)
132
-  * @param		string	$banreason	Banreason [optional]
133
-  * @return     array banId
134
-  */
135
-	function banAddByName($name, $time, $banreason = NULL) {
136
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
137
-		
138
-		if(!empty($banreason)) { $msg = ' banreason='.$this->escapeText($banreason); } else { $msg = NULL; }
63
+ * banAddByIp
64
+ *
65
+ * Adds a new ban rule on the selected virtual server.
66
+ *
67
+ *	<b>Output:</b>
68
+ * <pre>
69
+ * Array
70
+ * {
71
+ *  [banid] => 109
72
+ * }
73
+ * </pre>
74
+ *
75
+ * @author     Par0noid Solutions
76
+ * @param		string	$ip			clientIp
77
+ * @param		integer	$time		bantime in seconds (0=unlimited)
78
+ * @param		string	$banreason	Banreason [optional]
79
+ * @return     array banId
80
+ */
81
+    function banAddByIp($ip, $time, $banreason = NULL) {
82
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
83
+		
84
+        if(!empty($banreason)) { $msg = ' banreason='.$this->escapeText($banreason); } else { $msg = NULL; }
85
+
86
+        return $this->getData('array', 'banadd ip='.$ip.' time='.$time.$msg);
87
+    }
88
+
89
+/**
90
+ * banAddByUid
91
+ *
92
+ *	Adds a new ban rule on the selected virtual server.
93
+ *
94
+ * <b>Output:</b>
95
+ * <pre>
96
+ * Array
97
+ * {
98
+ *  [banid] => 110
99
+ * }
100
+ * </pre>
101
+ *
102
+ * @author     Par0noid Solutions
103
+ * @param		string	$uid		clientUniqueId
104
+ * @param		integer	$time		bantime in seconds (0=unlimited)
105
+ * @param		string	$banreason	Banreason [optional]
106
+ * @return     array banId
107
+ */
108
+    function banAddByUid($uid, $time, $banreason = NULL) {
109
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
110
+		
111
+        if(!empty($banreason)) { $msg = ' banreason='.$this->escapeText($banreason); } else { $msg = NULL; }
112
+		
113
+        return $this->getData('array', 'banadd uid='.$uid.' time='.$time.$msg);
114
+    }
115
+
116
+/**
117
+ * banAddByName
118
+ *
119
+ *	Adds a new ban rule on the selected virtual server.
120
+ *
121
+ * <b>Output:</b>
122
+ * <pre>
123
+ * Array
124
+ * {
125
+ *  [banid] => 111
126
+ * }
127
+ * </pre>
128
+ *
129
+ * @author     Par0noid Solutions
130
+ * @param		string	$name		clientName
131
+ * @param		integer	$time		bantime in seconds (0=unlimited)
132
+ * @param		string	$banreason	Banreason [optional]
133
+ * @return     array banId
134
+ */
135
+    function banAddByName($name, $time, $banreason = NULL) {
136
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
137
+		
138
+        if(!empty($banreason)) { $msg = ' banreason='.$this->escapeText($banreason); } else { $msg = NULL; }
139 139
 										
140
-		return $this->getData('array', 'banadd name='.$this->escapeText($name).' time='.$time.$msg);
141
-	}
142
-
143
-/**
144
-  * banClient
145
-  * 
146
-  * 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.
147
-  *
148
-  * <b>Output:</b>
149
-  * <pre>
150
-  * Array
151
-  * {
152
-  *  [1] => 129
153
-  *  [2] => 130
154
-  * }
155
-  * </pre>
156
-  *
157
-  * @author     Par0noid Solutions
158
-  * @param		integer $clid		clientId
159
-  * @param		integer $time		bantime in seconds (0=unlimited)
160
-  * @param		string	$banreason	Banreason [optional]
161
-  * @return     array banIds
162
-  */
163
-	function banClient($clid, $time, $banreason = NULL) {
164
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
165
-		
166
-		if(!empty($banreason)) { $msg = ' banreason='.$this->escapeText($banreason); } else { $msg = ''; }
167
-		
168
-		$result = $this->getData('plain', 'banclient clid='.$clid.' time='.$time.$msg);
169
-		
170
-		if($result['success']) {
171
-			return $this->generateOutput(true, $result['errors'], $this->splitBanIds($result['data']));
172
-		}else{
173
-			return $this->generateOutput(false, $result['errors'], false);
174
-		}
175
-	}
176
-
177
-/**
178
-  * banDelete
179
-  * 
180
-  * Deletes the ban rule with ID banid from the server.
181
-  *
182
-  * @author     Par0noid Solutions
183
-  * @param		integer $banID	banID
184
-  * @return     boolean success
185
-  */
186
-	function banDelete($banID) {
187
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
188
-		return $this->getData('boolean', 'bandel banid='.$banID);
189
-	}
190
-
191
-/**
192
-  * banDeleteAll
193
-  * 
194
-  * Deletes all active ban rules from the server.
195
-  *
196
-  * @author     Par0noid Solutions
197
-  * @return     boolean success
198
-  */
199
-	function banDeleteAll() {
200
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
201
-		return $this->getData('boolean', 'bandelall');
202
-	}
203
-
204
-/**
205
-  * banList
206
-  * 
207
-  * Displays a list of active bans on the selected virtual server.
208
-  * 
209
-  * <b>Output:</b>
210
-  * <pre>
211
-  * Array
212
-  * {
213
-  *  [banid] => 131
214
-  *  [ip] => 1.2.3.4
215
-  *  [name] => eugen
216
-  *  [uid] => IYAntAcZHgVC7s3n3DNWmuJB/aM=
217
-  *  [created] => 1286660391
218
-  *  [duration] => 0
219
-  *  [invokername] => Par0noid
220
-  *  [invokercldbid] => 2086
221
-  *  [invokeruid] => nUixbsq/XakrrmbqU8O30R/D8Gc=
222
-  *  [reason] => insult
223
-  *  [enforcements] => 0
224
-  * }
225
-  * </pre>
226
-  *
227
-  * @author     Par0noid Solutions
228
-  * @return     array banlist
229
-  */
230
-	function banList() {
231
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }		
232
-		return $this->getData('multi', 'banlist');
233
-	}
234
-
235
-/**
236
-  * bindingList
237
-  * 
238
-  * Displays a list of IP addresses used by the server instance on multi-homed machines.
239
-  *
240
-  * <b>Output:</b>
241
-  * <pre>
242
-  * Array
243
-  * {
244
-  *  [ip] => 0.0.0.0
245
-  * }
246
-  * </pre>
247
-  *
248
-  * @author     Par0noid Solutions
249
-  * @return     array bindingList
250
-  */
251
-	function bindingList() {
252
-		return $this->getData('multi', 'bindinglist');
253
-	}
254
-
255
-/**
256
-  * channelAddPerm
257
-  * 
258
-  * Adds a set of specified permissions to a channel. Multiple permissions can be added by providing the two parameters of each permission. A permission can be specified by permid or permsid.
259
-  * 
260
-  * <b>Input-Array like this:</b>
261
-  * <pre>
262
-  * $permissions = array();
263
-  * $permissions['permissionID'] = 'permissionValue';
264
-  * //or you could use Permission Name
265
-  * $permissions['permissionName'] = 'permissionValue';
266
-  * </pre>
267
-  *
268
-  * @author     Par0noid Solutions
269
-  * @param		integer	$cid			channelId
270
-  * @param		array	$permissions	permissions
271
-  * @return     boolean success
272
-  */
273
-	function channelAddPerm($cid, $permissions) {
274
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
275
-		
276
-		if(count($permissions) > 0) {
277
-			//Permissions given
140
+        return $this->getData('array', 'banadd name='.$this->escapeText($name).' time='.$time.$msg);
141
+    }
142
+
143
+/**
144
+ * banClient
145
+ * 
146
+ * 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.
147
+ *
148
+ * <b>Output:</b>
149
+ * <pre>
150
+ * Array
151
+ * {
152
+ *  [1] => 129
153
+ *  [2] => 130
154
+ * }
155
+ * </pre>
156
+ *
157
+ * @author     Par0noid Solutions
158
+ * @param		integer $clid		clientId
159
+ * @param		integer $time		bantime in seconds (0=unlimited)
160
+ * @param		string	$banreason	Banreason [optional]
161
+ * @return     array banIds
162
+ */
163
+    function banClient($clid, $time, $banreason = NULL) {
164
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
165
+		
166
+        if(!empty($banreason)) { $msg = ' banreason='.$this->escapeText($banreason); } else { $msg = ''; }
167
+		
168
+        $result = $this->getData('plain', 'banclient clid='.$clid.' time='.$time.$msg);
169
+		
170
+        if($result['success']) {
171
+            return $this->generateOutput(true, $result['errors'], $this->splitBanIds($result['data']));
172
+        }else{
173
+            return $this->generateOutput(false, $result['errors'], false);
174
+        }
175
+    }
176
+
177
+/**
178
+ * banDelete
179
+ * 
180
+ * Deletes the ban rule with ID banid from the server.
181
+ *
182
+ * @author     Par0noid Solutions
183
+ * @param		integer $banID	banID
184
+ * @return     boolean success
185
+ */
186
+    function banDelete($banID) {
187
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
188
+        return $this->getData('boolean', 'bandel banid='.$banID);
189
+    }
190
+
191
+/**
192
+ * banDeleteAll
193
+ * 
194
+ * Deletes all active ban rules from the server.
195
+ *
196
+ * @author     Par0noid Solutions
197
+ * @return     boolean success
198
+ */
199
+    function banDeleteAll() {
200
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
201
+        return $this->getData('boolean', 'bandelall');
202
+    }
203
+
204
+/**
205
+ * banList
206
+ * 
207
+ * Displays a list of active bans on the selected virtual server.
208
+ * 
209
+ * <b>Output:</b>
210
+ * <pre>
211
+ * Array
212
+ * {
213
+ *  [banid] => 131
214
+ *  [ip] => 1.2.3.4
215
+ *  [name] => eugen
216
+ *  [uid] => IYAntAcZHgVC7s3n3DNWmuJB/aM=
217
+ *  [created] => 1286660391
218
+ *  [duration] => 0
219
+ *  [invokername] => Par0noid
220
+ *  [invokercldbid] => 2086
221
+ *  [invokeruid] => nUixbsq/XakrrmbqU8O30R/D8Gc=
222
+ *  [reason] => insult
223
+ *  [enforcements] => 0
224
+ * }
225
+ * </pre>
226
+ *
227
+ * @author     Par0noid Solutions
228
+ * @return     array banlist
229
+ */
230
+    function banList() {
231
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }		
232
+        return $this->getData('multi', 'banlist');
233
+    }
234
+
235
+/**
236
+ * bindingList
237
+ * 
238
+ * Displays a list of IP addresses used by the server instance on multi-homed machines.
239
+ *
240
+ * <b>Output:</b>
241
+ * <pre>
242
+ * Array
243
+ * {
244
+ *  [ip] => 0.0.0.0
245
+ * }
246
+ * </pre>
247
+ *
248
+ * @author     Par0noid Solutions
249
+ * @return     array bindingList
250
+ */
251
+    function bindingList() {
252
+        return $this->getData('multi', 'bindinglist');
253
+    }
254
+
255
+/**
256
+ * channelAddPerm
257
+ * 
258
+ * Adds a set of specified permissions to a channel. Multiple permissions can be added by providing the two parameters of each permission. A permission can be specified by permid or permsid.
259
+ * 
260
+ * <b>Input-Array like this:</b>
261
+ * <pre>
262
+ * $permissions = array();
263
+ * $permissions['permissionID'] = 'permissionValue';
264
+ * //or you could use Permission Name
265
+ * $permissions['permissionName'] = 'permissionValue';
266
+ * </pre>
267
+ *
268
+ * @author     Par0noid Solutions
269
+ * @param		integer	$cid			channelId
270
+ * @param		array	$permissions	permissions
271
+ * @return     boolean success
272
+ */
273
+    function channelAddPerm($cid, $permissions) {
274
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
275
+		
276
+        if(count($permissions) > 0) {
277
+            //Permissions given
278 278
 			
279
-			//Errorcollector
280
-			$errors = array();
279
+            //Errorcollector
280
+            $errors = array();
281 281
 			
282
-			//Split Permissions to prevent query from overload
283
-			$permissions = array_chunk($permissions, 50, true);
282
+            //Split Permissions to prevent query from overload
283
+            $permissions = array_chunk($permissions, 50, true);
284 284
 			
285
-			//Action for each splitted part of permission
286
-			foreach($permissions as $permission_part)
287
-			{
288
-				//Create command_string for each command that we could use implode later
289
-				$command_string = array();
285
+            //Action for each splitted part of permission
286
+            foreach($permissions as $permission_part)
287
+            {
288
+                //Create command_string for each command that we could use implode later
289
+                $command_string = array();
290 290
 				
291
-				foreach($permission_part as $key => $value)
292
-				{
293
-					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value;
294
-				}
291
+                foreach($permission_part as $key => $value)
292
+                {
293
+                    $command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value;
294
+                }
295 295
 				
296
-				$result = $this->getData('boolean', 'channeladdperm cid='.$cid.' '.implode('|', $command_string));
296
+                $result = $this->getData('boolean', 'channeladdperm cid='.$cid.' '.implode('|', $command_string));
297 297
 				
298
-				if(!$result['success'])
299
-				{
300
-					foreach($result['errors'] as $error)
301
-					{
302
-						$errors[] = $error;
303
-					}
304
-				}
305
-			}
298
+                if(!$result['success'])
299
+                {
300
+                    foreach($result['errors'] as $error)
301
+                    {
302
+                        $errors[] = $error;
303
+                    }
304
+                }
305
+            }
306 306
 			
307
-			if(count($errors) == 0)
308
-			{
309
-				return $this->generateOutput(true, array(), true);
310
-			}else{
311
-				return $this->generateOutput(false, $errors, false);
312
-			}
307
+            if(count($errors) == 0)
308
+            {
309
+                return $this->generateOutput(true, array(), true);
310
+            }else{
311
+                return $this->generateOutput(false, $errors, false);
312
+            }
313 313
 			
314
-		}else{
315
-			// No permissions given
316
-			$this->addDebugLog('no permissions given');
317
-			return $this->generateOutput(false, array('Error: no permissions given'), false);
318
-		}
319
-	}
320
-
321
-/**
322
-  * channelClientAddPerm
323
-  * 
324
-  * Adds a set of specified permissions to a client in a specific channel. Multiple permissions can be added by providing the three parameters of each permission. A permission can be specified by permid or permsid.
325
-  * 
326
-  * <b>Input-Array like this:</b>
327
-  * <pre>
328
-  * $permissions = array();
329
-  * $permissions['permissionID'] = 'permissionValue';
330
-  * //or you could use Permission Name
331
-  * $permissions['permissionName'] = 'permissionValue';
332
-  * </pre>
333
-  *
334
-  * @author     Par0noid Solutions
335
-  * @param		integer		$cid			channelID
336
-  * @param		integer		$cldbid			clientDBID
337
-  * @param		array		$permissions	permissions
338
-  * @return     boolean success
339
-  */
340
-	function channelClientAddPerm($cid, $cldbid, $permissions) {
341
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
342
-		
343
-		if(count($permissions) > 0) {
344
-			//Permissions given
314
+        }else{
315
+            // No permissions given
316
+            $this->addDebugLog('no permissions given');
317
+            return $this->generateOutput(false, array('Error: no permissions given'), false);
318
+        }
319
+    }
320
+
321
+/**
322
+ * channelClientAddPerm
323
+ * 
324
+ * Adds a set of specified permissions to a client in a specific channel. Multiple permissions can be added by providing the three parameters of each permission. A permission can be specified by permid or permsid.
325
+ * 
326
+ * <b>Input-Array like this:</b>
327
+ * <pre>
328
+ * $permissions = array();
329
+ * $permissions['permissionID'] = 'permissionValue';
330
+ * //or you could use Permission Name
331
+ * $permissions['permissionName'] = 'permissionValue';
332
+ * </pre>
333
+ *
334
+ * @author     Par0noid Solutions
335
+ * @param		integer		$cid			channelID
336
+ * @param		integer		$cldbid			clientDBID
337
+ * @param		array		$permissions	permissions
338
+ * @return     boolean success
339
+ */
340
+    function channelClientAddPerm($cid, $cldbid, $permissions) {
341
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
342
+		
343
+        if(count($permissions) > 0) {
344
+            //Permissions given
345 345
 				
346
-			//Errorcollector
347
-			$errors = array();
346
+            //Errorcollector
347
+            $errors = array();
348 348
 				
349
-			//Split Permissions to prevent query from overload
350
-			$permissions = array_chunk($permissions, 50, true);
349
+            //Split Permissions to prevent query from overload
350
+            $permissions = array_chunk($permissions, 50, true);
351 351
 				
352
-			//Action for each splitted part of permission
353
-			foreach($permissions as $permission_part)
354
-			{
355
-				//Create command_string for each command that we could use implode later
356
-				$command_string = array();
357
-		
358
-				foreach($permission_part as $key => $value)
359
-				{
360
-					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value;
361
-				}
362
-		
363
-				$result = $this->getData('boolean', 'channelclientaddperm cid='.$cid.' cldbid='.$cldbid.' '.implode('|', $command_string));
364
-		
365
-				if(!$result['success'])
366
-				{
367
-					foreach($result['errors'] as $error)
368
-					{
369
-						$errors[] = $error;
370
-					}
371
-				}
372
-			}
352
+            //Action for each splitted part of permission
353
+            foreach($permissions as $permission_part)
354
+            {
355
+                //Create command_string for each command that we could use implode later
356
+                $command_string = array();
357
+		
358
+                foreach($permission_part as $key => $value)
359
+                {
360
+                    $command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value;
361
+                }
362
+		
363
+                $result = $this->getData('boolean', 'channelclientaddperm cid='.$cid.' cldbid='.$cldbid.' '.implode('|', $command_string));
364
+		
365
+                if(!$result['success'])
366
+                {
367
+                    foreach($result['errors'] as $error)
368
+                    {
369
+                        $errors[] = $error;
370
+                    }
371
+                }
372
+            }
373 373
 				
374
-			if(count($errors) == 0)
375
-			{
376
-				return $this->generateOutput(true, array(), true);
377
-			}else{
378
-				return $this->generateOutput(false, $errors, false);
379
-			}
374
+            if(count($errors) == 0)
375
+            {
376
+                return $this->generateOutput(true, array(), true);
377
+            }else{
378
+                return $this->generateOutput(false, $errors, false);
379
+            }
380 380
 				
381
-		}else{
382
-			// No permissions given
383
-			$this->addDebugLog('no permissions given');
384
-			return $this->generateOutput(false, array('Error: no permissions given'), false);
385
-		}
386
-	}
387
-
388
-/**
389
-  * channelClientDelPerm
390
-  * 
391
-  * Removes a set of specified permissions from a client in a specific channel. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.
392
-  *
393
-  * <b>Input-Array like this:</b>
394
-  * <pre>
395
-  * $permissions = array();
396
-  * $permissions[] = 'permissionID';
397
-  * $permissions[] = 'permissionName';
398
-  * //or
399
-  * $permissions = array('permissionID', 'permissionName', 'permissionID');
400
-  * </pre>
401
-  *
402
-  * @author     Par0noid Solutions
403
-  * @param		integer		$cid				channelID
404
-  * @param		integer		$cldbid				clientDBID
405
-  * @param		array		$permissions		permissions
406
-  * @return     boolean success
407
-  */
408
-	function channelClientDelPerm($cid, $cldbid, $permissions) {
409
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
410
-		$permissionArray = array();
411
-		
412
-		if(count($permissions) > 0) {
413
-			foreach($permissions AS $value) {
414
-				$permissionArray[] = is_numeric($value) ? 'permid='.$value : 'permsid='.$value;
415
-			}
416
-			return $this->getData('boolean', 'channelclientdelperm cid='.$cid.' cldbid='.$cldbid.' '.implode('|', $permissionArray));
417
-		}else{
418
-			$this->addDebugLog('no permissions given');
419
-			return $this->generateOutput(false, array('Error: no permissions given'), false);
420
-		}
421
-	}
422
-
423
-/**
424
-  * channelClientPermList
425
-  * 
426
-  * Displays a list of permissions defined for a client in a specific channel.
427
-  *
428
-  * <b>Output:</b>
429
-  * <pre>
430
-  * Array
431
-  * {
432
-  *  [cid] => 250 (only in first result)
433
-  *  [cldbid] => 2086 (only in first result)
434
-  *  [permid] => 12876 (if permsid = false)
435
-  *  [permsid] => b_client_info_view (if permsid = true)
436
-  *  [permvalue] => 1
437
-  *  [permnegated] => 0
438
-  *  [permskip] => 0
439
-  * }
440
-  * </pre>
441
-  *
442
-  * @author     Par0noid Solutions
443
-  * @param		integer		$cid		channelID
444
-  * @param		integer		$cldbid		clientDBID
445
-  * @param		boolean		$permsid	displays permissionName instead of permissionID
446
-  * @return     array	channelclientpermlist
447
-  */
448
-	function channelClientPermList($cid, $cldbid, $permsid = false) {
449
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }		
450
-		return $this->getData('multi', 'channelclientpermlist cid='.$cid.' cldbid='.$cldbid.($permsid ? ' -permsid' : ''));
451
-	}
452
-
453
-/**
454
-  * channelCreate
455
-  * 
456
-  * Creates a new channel using the given properties and displays its ID. Note that this command accepts multiple properties which means that you're able to specifiy all settings of the new channel at once.
457
-  * 
458
-  * <b style="color:red">Hint:</b> don't forget to set channel_flag_semi_permanent = 1 or channel_flag_permanent = 1
459
-  * 
460
-  * <b style="color:red">Hint:</b> you'll get an error if you want to create a channel without channel_name
461
-  * 
462
-  * <b>Input-Array like this:</b>
463
-  * <pre>
464
-  * $data = array();
465
-  * 
466
-  * $data['setting'] = 'value';
467
-  * $data['setting'] = 'value';
468
-  * </pre>
469
-  * 
470
-  * <b>Output:</b>
471
-  * <pre>
472
-  * Array
473
-  * {
474
-  *  [cid] => 257
475
-  * }
476
-  * </pre>
477
-  *
478
-  * @author     Par0noid Solutions
479
-  * @param		array $data properties
480
-  * @return     array channelInfo
481
-  */
482
-	function channelCreate($data) {
483
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
484
-		
485
-		$propertiesString = '';
486
-		
487
-		foreach($data as $key => $value) {
488
-			$propertiesString .= ' '.$key.'='.$this->escapeText($value);
489
-		}
490
-		
491
-		return $this->getData('array', 'channelcreate '.$propertiesString);
492
-	}
493
-
494
-/**
495
-  * channelDelete
496
-  * 
497
-  * Deletes an existing channel by ID. If force is set to 1, the channel will be deleted even if there are clients within. The clients will be kicked to the default channel with an appropriate reason message.
498
-  *
499
-  * @author     Par0noid Solutions
500
-  * @param		integer $cid channelID
501
-  * @param		integer $force {1|0} (default: 1)
502
-  * @return     boolean success
503
-  */
504
-	function channelDelete($cid, $force = 1) {
505
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
506
-		return $this->getData('boolean', 'channeldelete cid='.$cid.' force='.$force);
507
-	}
508
-
509
-/**
510
-  * channelDelPerm
511
-  * 
512
-  * Removes a set of specified permissions from a channel. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.
513
-  *
514
-  * <b>Input-Array like this:</b>
515
-  * <pre>
516
-  * $permissions = array();
517
-  * $permissions[] = 'permissionID';
518
-  * //or you could use
519
-  * $permissions[] = 'permissionName';
520
-  * </pre>
521
-  *
522
-  * @author     Par0noid Solutions
523
-  * @param		integer		$cid				channelID
524
-  * @param		array		$permissions		permissions
525
-  * @return     boolean	success
526
-  */
527
-	function channelDelPerm($cid, $permissions) {
528
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
529
-		$permissionArray = array();
530
-		
531
-		if(count($permissions) > 0) {
532
-			foreach($permissions AS $value) {
533
-				$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
534
-			}
535
-			return $this->getData('boolean', 'channeldelperm cid='.$cid.' '.implode('|', $permissionArray));
536
-		}else{
537
-			$this->addDebugLog('no permissions given');
538
-			return $this->generateOutput(false, array('Error: no permissions given'), false);
539
-		}
540
-	}
541
-
542
-/**
543
-  * channelEdit
544
-  * 
545
-  * Changes a channels configuration using given properties. Note that this command accepts multiple properties which means that you're able to change all settings of the channel specified with cid at once.
546
-  *
547
-  * <b>Input-Array like this:</b>
381
+        }else{
382
+            // No permissions given
383
+            $this->addDebugLog('no permissions given');
384
+            return $this->generateOutput(false, array('Error: no permissions given'), false);
385
+        }
386
+    }
387
+
388
+/**
389
+ * channelClientDelPerm
390
+ * 
391
+ * Removes a set of specified permissions from a client in a specific channel. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.
392
+ *
393
+ * <b>Input-Array like this:</b>
394
+ * <pre>
395
+ * $permissions = array();
396
+ * $permissions[] = 'permissionID';
397
+ * $permissions[] = 'permissionName';
398
+ * //or
399
+ * $permissions = array('permissionID', 'permissionName', 'permissionID');
400
+ * </pre>
401
+ *
402
+ * @author     Par0noid Solutions
403
+ * @param		integer		$cid				channelID
404
+ * @param		integer		$cldbid				clientDBID
405
+ * @param		array		$permissions		permissions
406
+ * @return     boolean success
407
+ */
408
+    function channelClientDelPerm($cid, $cldbid, $permissions) {
409
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
410
+        $permissionArray = array();
411
+		
412
+        if(count($permissions) > 0) {
413
+            foreach($permissions AS $value) {
414
+                $permissionArray[] = is_numeric($value) ? 'permid='.$value : 'permsid='.$value;
415
+            }
416
+            return $this->getData('boolean', 'channelclientdelperm cid='.$cid.' cldbid='.$cldbid.' '.implode('|', $permissionArray));
417
+        }else{
418
+            $this->addDebugLog('no permissions given');
419
+            return $this->generateOutput(false, array('Error: no permissions given'), false);
420
+        }
421
+    }
422
+
423
+/**
424
+ * channelClientPermList
425
+ * 
426
+ * Displays a list of permissions defined for a client in a specific channel.
427
+ *
428
+ * <b>Output:</b>
429
+ * <pre>
430
+ * Array
431
+ * {
432
+ *  [cid] => 250 (only in first result)
433
+ *  [cldbid] => 2086 (only in first result)
434
+ *  [permid] => 12876 (if permsid = false)
435
+ *  [permsid] => b_client_info_view (if permsid = true)
436
+ *  [permvalue] => 1
437
+ *  [permnegated] => 0
438
+ *  [permskip] => 0
439
+ * }
440
+ * </pre>
441
+ *
442
+ * @author     Par0noid Solutions
443
+ * @param		integer		$cid		channelID
444
+ * @param		integer		$cldbid		clientDBID
445
+ * @param		boolean		$permsid	displays permissionName instead of permissionID
446
+ * @return     array	channelclientpermlist
447
+ */
448
+    function channelClientPermList($cid, $cldbid, $permsid = false) {
449
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }		
450
+        return $this->getData('multi', 'channelclientpermlist cid='.$cid.' cldbid='.$cldbid.($permsid ? ' -permsid' : ''));
451
+    }
452
+
453
+/**
454
+ * channelCreate
455
+ * 
456
+ * Creates a new channel using the given properties and displays its ID. Note that this command accepts multiple properties which means that you're able to specifiy all settings of the new channel at once.
457
+ * 
458
+ * <b style="color:red">Hint:</b> don't forget to set channel_flag_semi_permanent = 1 or channel_flag_permanent = 1
459
+ * 
460
+ * <b style="color:red">Hint:</b> you'll get an error if you want to create a channel without channel_name
461
+ * 
462
+ * <b>Input-Array like this:</b>
463
+ * <pre>
464
+ * $data = array();
465
+ * 
466
+ * $data['setting'] = 'value';
467
+ * $data['setting'] = 'value';
468
+ * </pre>
469
+ * 
470
+ * <b>Output:</b>
471
+ * <pre>
472
+ * Array
473
+ * {
474
+ *  [cid] => 257
475
+ * }
476
+ * </pre>
477
+ *
478
+ * @author     Par0noid Solutions
479
+ * @param		array $data properties
480
+ * @return     array channelInfo
481
+ */
482
+    function channelCreate($data) {
483
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
484
+		
485
+        $propertiesString = '';
486
+		
487
+        foreach($data as $key => $value) {
488
+            $propertiesString .= ' '.$key.'='.$this->escapeText($value);
489
+        }
490
+		
491
+        return $this->getData('array', 'channelcreate '.$propertiesString);
492
+    }
493
+
494
+/**
495
+ * channelDelete
496
+ * 
497
+ * Deletes an existing channel by ID. If force is set to 1, the channel will be deleted even if there are clients within. The clients will be kicked to the default channel with an appropriate reason message.
498
+ *
499
+ * @author     Par0noid Solutions
500
+ * @param		integer $cid channelID
501
+ * @param		integer $force {1|0} (default: 1)
502
+ * @return     boolean success
503
+ */
504
+    function channelDelete($cid, $force = 1) {
505
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
506
+        return $this->getData('boolean', 'channeldelete cid='.$cid.' force='.$force);
507
+    }
508
+
509
+/**
510
+ * channelDelPerm
511
+ * 
512
+ * Removes a set of specified permissions from a channel. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.
513
+ *
514
+ * <b>Input-Array like this:</b>
515
+ * <pre>
516
+ * $permissions = array();
517
+ * $permissions[] = 'permissionID';
518
+ * //or you could use
519
+ * $permissions[] = 'permissionName';
520
+ * </pre>
521
+ *
522
+ * @author     Par0noid Solutions
523
+ * @param		integer		$cid				channelID
524
+ * @param		array		$permissions		permissions
525
+ * @return     boolean	success
526
+ */
527
+    function channelDelPerm($cid, $permissions) {
528
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
529
+        $permissionArray = array();
530
+		
531
+        if(count($permissions) > 0) {
532
+            foreach($permissions AS $value) {
533
+                $permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
534
+            }
535
+            return $this->getData('boolean', 'channeldelperm cid='.$cid.' '.implode('|', $permissionArray));
536
+        }else{
537
+            $this->addDebugLog('no permissions given');
538
+            return $this->generateOutput(false, array('Error: no permissions given'), false);
539
+        }
540
+    }
541
+
542
+/**
543
+ * channelEdit
544
+ * 
545
+ * Changes a channels configuration using given properties. Note that this command accepts multiple properties which means that you're able to change all settings of the channel specified with cid at once.
546
+ *
547
+ * <b>Input-Array like this:</b>
548 548
 	<pre>
549 549
 	$data = array();
550 550
 		
551 551
 	$data['setting'] = 'value';
552 552
 	$data['setting'] = 'value';
553 553
 	</pre>
554
-  *
555
-  * @author     Par0noid Solutions
556
-  * @param		integer	$cid	$channelID
557
-  * @param		array	$data	edited settings
558
-  * @return     boolean success
559
-  */
560
-	function channelEdit($cid, $data) {
561
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
562
-		
563
-		$settingsString = '';
564
-		
565
-		foreach($data as $key => $value) {
566
-			$settingsString .= ' '.$key.'='.$this->escapeText($value);
567
-		}
568
-
569
-		return $this->getData('boolean', 'channeledit cid='.$cid.$settingsString);
570
-	}
571
-
572
-/**
573
-  * channelFind
574
-  * 
575
-  * displays a list of channels matching a given name pattern.
576
-  *
577
-  * <b>Output:</b>
578
-  * <pre>
579
-  * Array
580
-  * {
581
-  *  [cid] => 2
582
-  *  [channel_name] => Lobby
583
-  * }
584
-  * </pre>
585
-  *
586
-  * @author     Par0noid Solutions
587
-  * @param		string	$pattern	channelName
588
-  * @return     array channelList 
589
-  */
590
-	function channelFind($pattern) {
591
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
592
-		return $this->getData('multi', 'channelfind pattern='.$this->escapeText($pattern));
593
-	}
594
-
595
-/**
596
-  * channelGroupAdd
597
-  * 
598
-  * Creates a new channel group using a given name and displays its ID. The optional type parameter can be used to create ServerQuery groups and template groups.
599
-  *
600
-  * <b>groupDbTypes:</b>
601
-  *	<ol start="0">
602
-  *		<li>template group (used for new virtual servers)</li>
603
-  *		<li>regular group (used for regular clients)</li>
604
-  *		<li>global query group (used for ServerQuery clients)</li>
605
-  *	</ol>
606
-  *
607
-  * <b>Output:</b>
608
-  * <pre>
609
-  * Array
610
-  * {
611
-  *  [cgid] => 86
612
-  * }
613
-  * </pre>
614
-  *
615
-  * @author     Par0noid Solutions
616
-  * @param		integer	$name	groupName
617
-  * @param		integer	$type   groupDbType [optional] (default: 1)
618
-  * @return     boolean success
619
-  */
620
-	function channelGroupAdd($name, $type = 1) {
621
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
622
-		return $this->getData('array', 'channelgroupadd name='.$this->escapeText($name).' type='.$type);
623
-	}
624
-
625
-/**
626
-  * channelGroupAddPerm
627
-  * 
628
-  * Adds a set of specified permissions to a channel group. Multiple permissions can be added by providing the two parameters of each permission. A permission can be specified by permid or permsid.
629
-  *
630
-  * <b>Input-Array like this:</b>
631
-  * <pre>
632
-  * $permissions = array();
633
-  * $permissions['permissionID'] = 'permissionValue';
634
-  * //or you could use:
635
-  * $permissions['permissionName'] = 'permissionValue';
636
-  * </pre>
637
-  *
638
-  * @author     Par0noid Solutions
639
-  * @param		integer		$cgid			channelGroupID
640
-  * @param		array		$permissions	permissions
641
-  * @return     boolean success
642
-  */
643
-	function channelGroupAddPerm($cgid, $permissions) {
644
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
645
-		
646
-		if(count($permissions) > 0) {
647
-			//Permissions given
648
-		
649
-			//Errorcollector
650
-			$errors = array();
651
-		
652
-			//Split Permissions to prevent query from overload
653
-			$permissions = array_chunk($permissions, 50, true);
654
-		
655
-			//Action for each splitted part of permission
656
-			foreach($permissions as $permission_part)
657
-			{
658
-				//Create command_string for each command that we could use implode later
659
-				$command_string = array();
660
-		
661
-				foreach($permission_part as $key => $value)
662
-				{
663
-					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value;
664
-				}
665
-		
666
-				$result = $this->getData('boolean', 'channelgroupaddperm cgid='.$cgid.' '.implode('|', $command_string));
667
-		
668
-				if(!$result['success'])
669
-				{
670
-					foreach($result['errors'] as $error)
671
-					{
672
-						$errors[] = $error;
673
-					}
674
-				}
675
-			}
676
-		
677
-			if(count($errors) == 0) {
678
-				return $this->generateOutput(true, array(), true);
679
-			}else{
680
-				return $this->generateOutput(false, $errors, false);
681
-			}
682
-		
683
-		}else{
684
-			// No permissions given
685
-			$this->addDebugLog('no permissions given');
686
-			return $this->generateOutput(false, array('Error: no permissions given'), false);
687
-		}
688
-	}
689
-
690
-/**
691
-  * channelGroupClientList
692
-  * 
693
-  * Displays 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 requirement
694
-  *
695
-  * <b>Output:</b>
696
-  * <pre>
697
-  * Array
698
-  * {
699
-  *  [cid] => 2
700
-  *  [cldbid] => 9
701
-  *  [cgid] => 9
702
-  * }
703
-  * </pre>
704
-  *
705
-  * @author     Par0noid Solutions
706
-  * @param		integer $cid		channelID [optional]
707
-  * @param		integer $cldbid		clientDBID [optional]
708
-  * @param		integer $cgid		channelGroupID [optional]
709
-  * @return     array channelGroupClientList
710
-  */
711
-	function channelGroupClientList($cid = NULL, $cldbid = NULL, $cgid = NULL) {
712
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
713
-		
714
-		return $this->getData('multi', 'channelgroupclientlist'.(!empty($cid) ? ' cid='.$cid : '').(!empty($cldbid) ? ' cldbid='.$cldbid : '').(!empty($cgid) ? ' cgid='.$cgid : ''));
715
-	}
716
-
717
-/**
718
-  * channelGroupCopy
719
-  * 
720
-  * Creates a copy of the channel group specified with scgid. If tcgid is set to 0, the server will create a new group. To overwrite an existing group, simply set tcgid to the ID of a designated target group. If a target group is set, the name parameter will be ignored. The type parameter can be used to create ServerQuery groups and template groups.
721
-  *
722
-  * <b>groupDbTypes:</b>
723
-  *	<ol start="0">
724
-  *		<li>template group (used for new virtual servers)</li>
725
-  *		<li>regular group (used for regular clients)</li>
726
-  *		<li>global query group (used for ServerQuery clients)</li>
727
-  *	</ol>
728
-  *
729
-  * <b>Output:</b>
730
-  * <pre>
731
-  * Array
732
-  * {
733
-  *  [cgid] => 86
734
-  * }
735
-  * </pre>
736
-  *
737
-  * @author     Par0noid Solutions
738
-  * @param		integer	$scgid	sourceChannelGroupID
739
-  * @param		integer	$tcgid	targetChannelGroupID 
740
-  * @param		integer $name	groupName
741
-  * @param		integer	$type	groupDbType
742
-  * @return     array groupId
743
-  */
744
-	function channelGroupCopy($scgid, $tcgid, $name, $type = 1) {
745
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
746
-		return $this->getData('array', 'channelgroupcopy scgid='.$scgid.' tcgid='.$tcgid.' name='.$this->escapeText($name).' type='.$type);
747
-	}
748
-
749
-/**
750
-  * channelGroupDelete
751
-  * 
752
-  * Deletes a channel group by ID. If force is set to 1, the channel group will be deleted even if there are clients within.
753
-  *
754
-  * @author     Par0noid Solutions
755
-  * @param		integer $cgid	channelGroupID
756
-  * @param		integer $force	forces deleting channelGroup (default: 1)
757
-  * @return     boolean success
758
-  */
759
-	function channelGroupDelete($cgid, $force = 1) {
760
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
761
-		return $this->getData('boolean', 'channelgroupdel cgid='.$cgid.' force='.$force);
762
-	}
763
-
764
-/**
765
-  * channelGroupDelPerm
766
-  * 
767
-  * Removes a set of specified permissions from the channel group. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.
768
-  *
769
-  * <b>Input-Array like this:</b>
770
-  * <pre>
771
-  * $permissions = array();
772
-  * $permissions[] = 'permissionID';
773
-  * $permissions[] = 'permissionName';
774
-  * </pre>
775
-  *
776
-  * @author     Par0noid Solutions
777
-  * @param		integer		$cgid				channelGroupID
778
-  * @param		array		$permissions		permissions
779
-  * @return     boolean success
780
-  */
781
-	function channelGroupDelPerm($cgid, $permissions) {
782
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
783
-		$permissionArray = array();
784
-		
785
-		if(count($permissions) > 0) {
786
-			foreach($permissions AS $value) {
787
-				$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
788
-			}
789
-			return $this->getData('boolean', 'channelgroupdelperm cgid='.$cgid.' '.implode('|', $permissionArray));
790
-		}else{
791
-			$this->addDebugLog('no permissions given');
792
-			return $this->generateOutput(false, array('Error: no permissions given'), false);
793
-		}
794
-	}
795
-
796
-/**
797
-  * channelGroupList
798
-  * 
799
-  * Displays a list of channel groups available on the selected virtual server.
800
-  * 
801
-  * <b>Output:</b>
802
-  * <pre>
803
-  * Array
804
-  * {
805
-  *  [cgid] => 3
806
-  *  [name] => Testname
807
-  *  [type] => 0
808
-  *  [iconid] => 100
809
-  *  [savedb] => 1
810
-  *  [sortid] => 0
811
-  *  [namemode] => 0
812
-  *  [n_modifyp] => 75
813
-  *  [n_member_addp] => 50
814
-  *  [n_member_removep] => 50
815
-  * }
816
-  * </pre>
817
-  *
818
-  * @author     Par0noid Solutions
819
-  * @return     array channelGroupList
820
-  */
821
-	function channelGroupList() {
822
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
823
-		
824
-		return $this->getData('multi', 'channelgrouplist');
825
-	}
826
-
827
-/**
828
-  * channelGroupPermList
829
-  * 
830
-  * Displays a list of permissions assigned to the channel group specified with cgid.
831
-  * If the permsid option is specified, the output will contain the permission names instead of the internal IDs.
832
-  * 
833
-  * <b>Output:</b>
834
-  * <pre>
835
-  * Array
836
-  * {
837
-  *  [permid] => 8471 (displayed if permsid is false)
838
-  *  [permsid] => i_channel_create_modify_with_codec_latency_factor_min (displayed if permsid is true)
839
-  *  [permvalue] => 1
840
-  *  [permnegated] => 0
841
-  *  [permskip] => 0
842
-  * }
843
-  * </pre>
844
-  *
845
-  * @author     Par0noid Solutions
846
-  * @param		integer		$cgid		channelGroupID
847
-  * @param		boolean		$permsid	permsid
848
-  * @return		array	channelGroupPermlist
849
-  */
850
-  	function channelGroupPermList($cgid, $permsid = false) {
851
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }		
852
-		return $this->getData('multi', 'channelgrouppermlist cgid='.$cgid.($permsid ? ' -permsid' : ''));
853
-	}
854
-
855
-/**
856
-  * channelGroupRename
857
-  * 
858
-  * Changes the name of a specified channel group.
859
-  *
860
-  * @author     Par0noid Solutions
861
-  * @param		integer $cgid groupID
862
-  * @param		integer $name groupName
863
-  * @return     boolean success
864
-  */
865
-	function channelGroupRename($cgid, $name) {
866
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
867
-		return $this->getData('boolean', 'channelgrouprename cgid='.$cgid.' name='.$this->escapeText($name));
868
-	}
869
-
870
-/**
871
-  * channelInfo
872
-  *
873
-  *	Displays detailed configuration information about a channel including ID, topic, description, etc.
874
-
875
-  * <b>Output:</b>
876
-  * <pre>
877
-  * Array
878
-  * {
879
-  *  [pid] => 0
880
-  *  [channel_name] => Test
881
-  *  [channel_topic] => 
882
-  *  [channel_description] => 
883
-  *  [channel_password] => cc97Pm4oOYq0J9fXDAgiWv/qScQ=
884
-  *  [channel_codec] => 2
885
-  *  [channel_codec_quality] => 7
886
-  *  [channel_maxclients] => -1
887
-  *  [channel_maxfamilyclients] => -1
888
-  *  [channel_order] => 1
889
-  *  [channel_flag_permanent] => 1
890
-  *  [channel_flag_semi_permanent] => 0
891
-  *  [channel_flag_default] => 0
892
-  *  [channel_flag_password] => 0
893
-  *  [channel_codec_latency_factor] => 1
894
-  *  [channel_codec_is_unencrypted] => 1
895
-  *  [channel_flag_maxclients_unlimited] => 1
896
-  *  [channel_flag_maxfamilyclients_unlimited] => 0
897
-  *  [channel_flag_maxfamilyclients_inherited] => 1
898
-  *  [channel_filepath] => files\\virtualserver_1\\channel_2
899
-  *  [channel_needed_talk_power] => 0
900
-  *  [channel_forced_silence] => 0
901
-  *  [channel_name_phonetic] => 
902
-  *  [channel_icon_id] => 0
903
-  *  [seconds_empty] => 61 (If it's a temporary channel with a channel delete delay)
904
-  * }
905
-  * </pre>
906
-  *
907
-  * @author     Par0noid Solutions
908
-  * @param		integer $cid channelID
909
-  * @return     array channelInfo
910
-  */
911
-	function channelInfo($cid) {
912
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
913
-		return $this->getData('array', 'channelinfo cid='.$cid);
914
-	}
915
-
916
-/**
917
-  * channelList
918
-  * 
919
-  * Displays a list of channels created on a virtual server including their ID, order, name, etc. The output can be modified using several command options.
920
-  *
921
-  * <b>Possible parameters:</b> [-topic] [-flags] [-voice] [-limits] [-icon]
922
-  *
923
-  * <b>Output: (without parameters)</b>
924
-  * <pre>
925
-  * Array
926
-  * {
927
-  *  [cid] => 2
928
-  *  [pid] => 0
929
-  *  [channel_order] => 1
930
-  *  [channel_name] => Test
931
-  *  [total_clients] => 0
932
-  *  [channel_needed_subscribe_power] => 0
933
-  * }
934
-  * </pre>
935
-  * <b>Output: (from parameters)</b>
936
-  * <pre>
937
-  * Array
938
-  * {
939
-  *  [-topic] => [channel_topic] => Default Channel has no topic
940
-  *  [-flags] => [channel_flag_default] => 1
941
-  *  [-flags] => [channel_flag_password] => 0
942
-  *  [-flags] => [channel_flag_permanent] => 1
943
-  *  [-flags] => [channel_flag_semi_permanent] => 0
944
-  *  [-voice] => [channel_codec] => 2
945
-  *  [-voice] => [channel_codec_quality] => 7
946
-  *  [-voice] => [channel_needed_talk_power] => 0
947
-  *  [-limits] => [total_clients_family] => 1
948
-  *  [-limits] => [channel_maxclients] => -1
949
-  *  [-limits] => [channel_maxfamilyclients] => -1
950
-  *  [-icon] => [channel_icon_id] => 0
951
-  * }
952
-  * </pre>
953
-  * <b>Usage:</b>
954
-  * <pre>
955
-  * $ts3->channelList(); //No parameters
956
-  * $ts3->channelList("-flags"); //Single parameter
957
-  * $ts3->channelList("-topic -flags -voice -limits -icon"); //Multiple parameters / all
958
-  * </pre>
959
-  *
960
-  * @author     Par0noid Solutions
961
-  * @param		string		$params		additional parameters [optional]
962
-  * @return		array	channelList
963
-  */
964
-	function channelList($params = null) {
965
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
966
-		if(!empty($params)) { $params = ' '.$params; }
967
-		
968
-		return $this->getData('multi', 'channellist'.$params);
969
-	}
970
-
971
-/**
972
-  * channelMove
973
-  * 
974
-  * Moves a channel to a new parent channel with the ID cpid. If order is specified, the channel will be sorted right under the channel with the specified ID. If order is set to 0, the channel will be sorted right below the new parent.
975
-  *
976
-  * @author     Par0noid Solutions
977
-  * @param		integer $cid	channelID
978
-  * @param		integer $cpid	channelParentID
979
-  * @param		integer $order	channelSortOrder
980
-  * @return     boolean success
981
-  */
982
-	function channelMove($cid, $cpid, $order = null) {
983
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }		
984
-		return $this->getData('boolean', 'channelmove cid='.$cid.' cpid='.$cpid.($order != null ? ' order='.$order : ''));
985
-	}
986
-
987
-/**
988
-  * channelPermList
989
-  * 
990
-  * Displays a list of permissions defined for a channel.
991
-  *
992
-  * <b>Output:</b>
993
-  * <pre>
994
-  * Array
995
-  * {
996
-  *  [cid] => 2 (only in first result)
997
-  *  [permid] => 8471 (if permsid = false)
998
-  *  [permsid] => i_channel_needed_delete_power (if permsid = true)
999
-  *  [permvalue] => 1
1000
-  *  [permnegated] => 0
1001
-  *  [permskip] => 0
1002
-  * }
1003
-  * </pre>
1004
-  *
1005
-  * @author     Par0noid Solutions
1006
-  * @param		integer		$cid		channelID
1007
-  * @param		boolean		$permsid	displays permissionName instead of permissionID [optional]
1008
-  * @return     array channelpermlist
1009
-  */
1010
-	function channelPermList($cid, $permsid = false) {
1011
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }	
1012
-		return $this->getData('multi', 'channelpermlist cid='.$cid.($permsid ? ' -permsid' : ''));
1013
-	}
1014
-
1015
-/**
1016
-  * clientAddPerm
1017
-  * 
1018
-  * Adds a set of specified permissions to a client. Multiple permissions can be added by providing the three parameters of each permission. A permission can be specified by permid or permsid.
1019
-  *
1020
-  * <b>Input-Array like this:</b>
1021
-  * <pre>
1022
-  * $permissions = array();
1023
-  * $permissions['permissionID'] = array('permissionValue', 'permskip');
1024
-  * //or you could use Permission Name
1025
-  * $permissions['permissionName'] = array('permissionValue', 'permskip');
1026
-  * </pre>
1027
-  *
1028
-  * @author     Par0noid Solutions
1029
-  * @param		integer	$cldbid			clientDBID
1030
-  * @param		array	$permissions	permissions
1031
-  * @return     boolean success
1032
-  */
1033
-	function clientAddPerm($cldbid, $permissions) {
1034
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1035
-		
1036
-		if(count($permissions) > 0) {
1037
-			//Permissions given
1038
-				
1039
-			//Errorcollector
1040
-			$errors = array();
1041
-				
1042
-			//Split Permissions to prevent query from overload
1043
-			$permissions = array_chunk($permissions, 50, true);
1044
-				
1045
-			//Action for each splitted part of permission
1046
-			foreach($permissions as $permission_part)
1047
-			{
1048
-				//Create command_string for each command that we could use implode later
1049
-				$command_string = array();
1050
-		
1051
-				foreach($permission_part as $key => $value)
1052
-				{
1053
-					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$this->escapeText($value[0]).' permskip='.$this->escapeText($value[1]);
1054
-				}
1055
-		
1056
-				$result = $this->getData('boolean', 'clientaddperm cldbid='.$cldbid.' '.implode('|', $command_string));
1057
-		
1058
-				if(!$result['success'])
1059
-				{
1060
-					foreach($result['errors'] as $error)
1061
-					{
1062
-						$errors[] = $error;
1063
-					}
1064
-				}
1065
-			}
1066
-				
1067
-			if(count($errors) == 0)
1068
-			{
1069
-				return $this->generateOutput(true, array(), true);
1070
-			}else{
1071
-				return $this->generateOutput(false, $errors, false);
1072
-			}
1073
-		}else{
1074
-			// No permissions given
1075
-			$this->addDebugLog('no permissions given');
1076
-			return $this->generateOutput(false, array('Error: no permissions given'), false);
1077
-		}
1078
-	}
554
+ *
555
+ * @author     Par0noid Solutions
556
+ * @param		integer	$cid	$channelID
557
+ * @param		array	$data	edited settings
558
+ * @return     boolean success
559
+ */
560
+    function channelEdit($cid, $data) {
561
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
562
+		
563
+        $settingsString = '';
564
+		
565
+        foreach($data as $key => $value) {
566
+            $settingsString .= ' '.$key.'='.$this->escapeText($value);
567
+        }
568
+
569
+        return $this->getData('boolean', 'channeledit cid='.$cid.$settingsString);
570
+    }
1079 571
 
1080 572
 /**
1081
- * clientAvatar
573
+ * channelFind
574
+ * 
575
+ * displays a list of channels matching a given name pattern.
1082 576
  *
1083
- * Will return the base64 encoded binary of the clients avatar
577
+ * <b>Output:</b>
578
+ * <pre>
579
+ * Array
580
+ * {
581
+ *  [cid] => 2
582
+ *  [channel_name] => Lobby
583
+ * }
584
+ * </pre>
585
+ *
586
+ * @author     Par0noid Solutions
587
+ * @param		string	$pattern	channelName
588
+ * @return     array channelList 
589
+ */
590
+    function channelFind($pattern) {
591
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
592
+        return $this->getData('multi', 'channelfind pattern='.$this->escapeText($pattern));
593
+    }
594
+
595
+/**
596
+ * channelGroupAdd
597
+ * 
598
+ * Creates a new channel group using a given name and displays its ID. The optional type parameter can be used to create ServerQuery groups and template groups.
599
+ *
600
+ * <b>groupDbTypes:</b>
601
+ *	<ol start="0">
602
+ *		<li>template group (used for new virtual servers)</li>
603
+ *		<li>regular group (used for regular clients)</li>
604
+ *		<li>global query group (used for ServerQuery clients)</li>
605
+ *	</ol>
606
+ *
607
+ * <b>Output:</b>
608
+ * <pre>
609
+ * Array
610
+ * {
611
+ *  [cgid] => 86
612
+ * }
613
+ * </pre>
614
+ *
615
+ * @author     Par0noid Solutions
616
+ * @param		integer	$name	groupName
617
+ * @param		integer	$type   groupDbType [optional] (default: 1)
618
+ * @return     boolean success
619
+ */
620
+    function channelGroupAdd($name, $type = 1) {
621
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
622
+        return $this->getData('array', 'channelgroupadd name='.$this->escapeText($name).' type='.$type);
623
+    }
624
+
625
+/**
626
+ * channelGroupAddPerm
627
+ * 
628
+ * Adds a set of specified permissions to a channel group. Multiple permissions can be added by providing the two parameters of each permission. A permission can be specified by permid or permsid.
629
+ *
630
+ * <b>Input-Array like this:</b>
631
+ * <pre>
632
+ * $permissions = array();
633
+ * $permissions['permissionID'] = 'permissionValue';
634
+ * //or you could use:
635
+ * $permissions['permissionName'] = 'permissionValue';
636
+ * </pre>
637
+ *
638
+ * @author     Par0noid Solutions
639
+ * @param		integer		$cgid			channelGroupID
640
+ * @param		array		$permissions	permissions
641
+ * @return     boolean success
642
+ */
643
+    function channelGroupAddPerm($cgid, $permissions) {
644
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
645
+		
646
+        if(count($permissions) > 0) {
647
+            //Permissions given
648
+		
649
+            //Errorcollector
650
+            $errors = array();
651
+		
652
+            //Split Permissions to prevent query from overload
653
+            $permissions = array_chunk($permissions, 50, true);
654
+		
655
+            //Action for each splitted part of permission
656
+            foreach($permissions as $permission_part)
657
+            {
658
+                //Create command_string for each command that we could use implode later
659
+                $command_string = array();
660
+		
661
+                foreach($permission_part as $key => $value)
662
+                {
663
+                    $command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value;
664
+                }
665
+		
666
+                $result = $this->getData('boolean', 'channelgroupaddperm cgid='.$cgid.' '.implode('|', $command_string));
667
+		
668
+                if(!$result['success'])
669
+                {
670
+                    foreach($result['errors'] as $error)
671
+                    {
672
+                        $errors[] = $error;
673
+                    }
674
+                }
675
+            }
676
+		
677
+            if(count($errors) == 0) {
678
+                return $this->generateOutput(true, array(), true);
679
+            }else{
680
+                return $this->generateOutput(false, $errors, false);
681
+            }
682
+		
683
+        }else{
684
+            // No permissions given
685
+            $this->addDebugLog('no permissions given');
686
+            return $this->generateOutput(false, array('Error: no permissions given'), false);
687
+        }
688
+    }
689
+
690
+/**
691
+ * channelGroupClientList
692
+ * 
693
+ * Displays 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 requirement
694
+ *
695
+ * <b>Output:</b>
696
+ * <pre>
697
+ * Array
698
+ * {
699
+ *  [cid] => 2
700
+ *  [cldbid] => 9
701
+ *  [cgid] => 9
702
+ * }
703
+ * </pre>
704
+ *
705
+ * @author     Par0noid Solutions
706
+ * @param		integer $cid		channelID [optional]
707
+ * @param		integer $cldbid		clientDBID [optional]
708
+ * @param		integer $cgid		channelGroupID [optional]
709
+ * @return     array channelGroupClientList
710
+ */
711
+    function channelGroupClientList($cid = NULL, $cldbid = NULL, $cgid = NULL) {
712
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
713
+		
714
+        return $this->getData('multi', 'channelgroupclientlist'.(!empty($cid) ? ' cid='.$cid : '').(!empty($cldbid) ? ' cldbid='.$cldbid : '').(!empty($cgid) ? ' cgid='.$cgid : ''));
715
+    }
716
+
717
+/**
718
+ * channelGroupCopy
719
+ * 
720
+ * Creates a copy of the channel group specified with scgid. If tcgid is set to 0, the server will create a new group. To overwrite an existing group, simply set tcgid to the ID of a designated target group. If a target group is set, the name parameter will be ignored. The type parameter can be used to create ServerQuery groups and template groups.
721
+ *
722
+ * <b>groupDbTypes:</b>
723
+ *	<ol start="0">
724
+ *		<li>template group (used for new virtual servers)</li>
725
+ *		<li>regular group (used for regular clients)</li>
726
+ *		<li>global query group (used for ServerQuery clients)</li>
727
+ *	</ol>
728
+ *
729
+ * <b>Output:</b>
730
+ * <pre>
731
+ * Array
732
+ * {
733
+ *  [cgid] => 86
734
+ * }
735
+ * </pre>
736
+ *
737
+ * @author     Par0noid Solutions
738
+ * @param		integer	$scgid	sourceChannelGroupID
739
+ * @param		integer	$tcgid	targetChannelGroupID 
740
+ * @param		integer $name	groupName
741
+ * @param		integer	$type	groupDbType
742
+ * @return     array groupId
743
+ */
744
+    function channelGroupCopy($scgid, $tcgid, $name, $type = 1) {
745
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
746
+        return $this->getData('array', 'channelgroupcopy scgid='.$scgid.' tcgid='.$tcgid.' name='.$this->escapeText($name).' type='.$type);
747
+    }
748
+
749
+/**
750
+ * channelGroupDelete
751
+ * 
752
+ * Deletes a channel group by ID. If force is set to 1, the channel group will be deleted even if there are clients within.
753
+ *
754
+ * @author     Par0noid Solutions
755
+ * @param		integer $cgid	channelGroupID
756
+ * @param		integer $force	forces deleting channelGroup (default: 1)
757
+ * @return     boolean success
758
+ */
759
+    function channelGroupDelete($cgid, $force = 1) {
760
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
761
+        return $this->getData('boolean', 'channelgroupdel cgid='.$cgid.' force='.$force);
762
+    }
763
+
764
+/**
765
+ * channelGroupDelPerm
766
+ * 
767
+ * Removes a set of specified permissions from the channel group. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.
768
+ *
769
+ * <b>Input-Array like this:</b>
770
+ * <pre>
771
+ * $permissions = array();
772
+ * $permissions[] = 'permissionID';
773
+ * $permissions[] = 'permissionName';
774
+ * </pre>
775
+ *
776
+ * @author     Par0noid Solutions
777
+ * @param		integer		$cgid				channelGroupID
778
+ * @param		array		$permissions		permissions
779
+ * @return     boolean success
780
+ */
781
+    function channelGroupDelPerm($cgid, $permissions) {
782
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
783
+        $permissionArray = array();
784
+		
785
+        if(count($permissions) > 0) {
786
+            foreach($permissions AS $value) {
787
+                $permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
788
+            }
789
+            return $this->getData('boolean', 'channelgroupdelperm cgid='.$cgid.' '.implode('|', $permissionArray));
790
+        }else{
791
+            $this->addDebugLog('no permissions given');
792
+            return $this->generateOutput(false, array('Error: no permissions given'), false);
793
+        }
794
+    }
795
+
796
+/**
797
+ * channelGroupList
798
+ * 
799
+ * Displays a list of channel groups available on the selected virtual server.
800
+ * 
801
+ * <b>Output:</b>
802
+ * <pre>
803
+ * Array
804
+ * {
805
+ *  [cgid] => 3
806
+ *  [name] => Testname
807
+ *  [type] => 0
808
+ *  [iconid] => 100
809
+ *  [savedb] => 1
810
+ *  [sortid] => 0
811
+ *  [namemode] => 0
812
+ *  [n_modifyp] => 75
813
+ *  [n_member_addp] => 50
814
+ *  [n_member_removep] => 50
815
+ * }
816
+ * </pre>
817
+ *
818
+ * @author     Par0noid Solutions
819
+ * @return     array channelGroupList
820
+ */
821
+    function channelGroupList() {
822
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
823
+		
824
+        return $this->getData('multi', 'channelgrouplist');
825
+    }
826
+
827
+/**
828
+ * channelGroupPermList
829
+ * 
830
+ * Displays a list of permissions assigned to the channel group specified with cgid.
831
+ * If the permsid option is specified, the output will contain the permission names instead of the internal IDs.
832
+ * 
833
+ * <b>Output:</b>
834
+ * <pre>
835
+ * Array
836
+ * {
837
+ *  [permid] => 8471 (displayed if permsid is false)
838
+ *  [permsid] => i_channel_create_modify_with_codec_latency_factor_min (displayed if permsid is true)
839
+ *  [permvalue] => 1
840
+ *  [permnegated] => 0
841
+ *  [permskip] => 0
842
+ * }
843
+ * </pre>
844
+ *
845
+ * @author     Par0noid Solutions
846
+ * @param		integer		$cgid		channelGroupID
847
+ * @param		boolean		$permsid	permsid
848
+ * @return		array	channelGroupPermlist
849
+ */
850
+        function channelGroupPermList($cgid, $permsid = false) {
851
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }		
852
+        return $this->getData('multi', 'channelgrouppermlist cgid='.$cgid.($permsid ? ' -permsid' : ''));
853
+    }
854
+
855
+/**
856
+ * channelGroupRename
857
+ * 
858
+ * Changes the name of a specified channel group.
859
+ *
860
+ * @author     Par0noid Solutions
861
+ * @param		integer $cgid groupID
862
+ * @param		integer $name groupName
863
+ * @return     boolean success
864
+ */
865
+    function channelGroupRename($cgid, $name) {
866
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
867
+        return $this->getData('boolean', 'channelgrouprename cgid='.$cgid.' name='.$this->escapeText($name));
868
+    }
869
+
870
+/**
871
+ * channelInfo
872
+ *
873
+ *	Displays detailed configuration information about a channel including ID, topic, description, etc.
874
+ * <b>Output:</b>
875
+ * <pre>
876
+ * Array
877
+ * {
878
+ *  [pid] => 0
879
+ *  [channel_name] => Test
880
+ *  [channel_topic] => 
881
+ *  [channel_description] => 
882
+ *  [channel_password] => cc97Pm4oOYq0J9fXDAgiWv/qScQ=
883
+ *  [channel_codec] => 2
884
+ *  [channel_codec_quality] => 7
885
+ *  [channel_maxclients] => -1
886
+ *  [channel_maxfamilyclients] => -1
887
+ *  [channel_order] => 1
888
+ *  [channel_flag_permanent] => 1
889
+ *  [channel_flag_semi_permanent] => 0
890
+ *  [channel_flag_default] => 0
891
+ *  [channel_flag_password] => 0
892
+ *  [channel_codec_latency_factor] => 1
893
+ *  [channel_codec_is_unencrypted] => 1
894
+ *  [channel_flag_maxclients_unlimited] => 1
895
+ *  [channel_flag_maxfamilyclients_unlimited] => 0
896
+ *  [channel_flag_maxfamilyclients_inherited] => 1
897
+ *  [channel_filepath] => files\\virtualserver_1\\channel_2
898
+ *  [channel_needed_talk_power] => 0
899
+ *  [channel_forced_silence] => 0
900
+ *  [channel_name_phonetic] => 
901
+ *  [channel_icon_id] => 0
902
+ *  [seconds_empty] => 61 (If it's a temporary channel with a channel delete delay)
903
+ * }
904
+ * </pre>
905
+ *
906
+ * @author     Par0noid Solutions
907
+ * @param		integer $cid channelID
908
+ * @return     array channelInfo
909
+ */
910
+    function channelInfo($cid) {
911
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
912
+        return $this->getData('array', 'channelinfo cid='.$cid);
913
+    }
914
+
915
+/**
916
+ * channelList
917
+ * 
918
+ * Displays a list of channels created on a virtual server including their ID, order, name, etc. The output can be modified using several command options.
919
+ *
920
+ * <b>Possible parameters:</b> [-topic] [-flags] [-voice] [-limits] [-icon]
921
+ *
922
+ * <b>Output: (without parameters)</b>
923
+ * <pre>
924
+ * Array
925
+ * {
926
+ *  [cid] => 2
927
+ *  [pid] => 0
928
+ *  [channel_order] => 1
929
+ *  [channel_name] => Test
930
+ *  [total_clients] => 0
931
+ *  [channel_needed_subscribe_power] => 0
932
+ * }
933
+ * </pre>
934
+ * <b>Output: (from parameters)</b>
935
+ * <pre>
936
+ * Array
937
+ * {
938
+ *  [-topic] => [channel_topic] => Default Channel has no topic
939
+ *  [-flags] => [channel_flag_default] => 1
940
+ *  [-flags] => [channel_flag_password] => 0
941
+ *  [-flags] => [channel_flag_permanent] => 1
942
+ *  [-flags] => [channel_flag_semi_permanent] => 0
943
+ *  [-voice] => [channel_codec] => 2
944
+ *  [-voice] => [channel_codec_quality] => 7
945
+ *  [-voice] => [channel_needed_talk_power] => 0
946
+ *  [-limits] => [total_clients_family] => 1
947
+ *  [-limits] => [channel_maxclients] => -1
948
+ *  [-limits] => [channel_maxfamilyclients] => -1
949
+ *  [-icon] => [channel_icon_id] => 0
950
+ * }
951
+ * </pre>
952
+ * <b>Usage:</b>
953
+ * <pre>
954
+ * $ts3->channelList(); //No parameters
955
+ * $ts3->channelList("-flags"); //Single parameter
956
+ * $ts3->channelList("-topic -flags -voice -limits -icon"); //Multiple parameters / all
957
+ * </pre>
958
+ *
959
+ * @author     Par0noid Solutions
960
+ * @param		string		$params		additional parameters [optional]
961
+ * @return		array	channelList
962
+ */
963
+    function channelList($params = null) {
964
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
965
+        if(!empty($params)) { $params = ' '.$params; }
966
+		
967
+        return $this->getData('multi', 'channellist'.$params);
968
+    }
969
+
970
+/**
971
+ * channelMove
972
+ * 
973
+ * Moves a channel to a new parent channel with the ID cpid. If order is specified, the channel will be sorted right under the channel with the specified ID. If order is set to 0, the channel will be sorted right below the new parent.
974
+ *
975
+ * @author     Par0noid Solutions
976
+ * @param		integer $cid	channelID
977
+ * @param		integer $cpid	channelParentID
978
+ * @param		integer $order	channelSortOrder
979
+ * @return     boolean success
980
+ */
981
+    function channelMove($cid, $cpid, $order = null) {
982
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }		
983
+        return $this->getData('boolean', 'channelmove cid='.$cid.' cpid='.$cpid.($order != null ? ' order='.$order : ''));
984
+    }
985
+
986
+/**
987
+ * channelPermList
988
+ * 
989
+ * Displays a list of permissions defined for a channel.
990
+ *
991
+ * <b>Output:</b>
992
+ * <pre>
993
+ * Array
994
+ * {
995
+ *  [cid] => 2 (only in first result)
996
+ *  [permid] => 8471 (if permsid = false)
997
+ *  [permsid] => i_channel_needed_delete_power (if permsid = true)
998
+ *  [permvalue] => 1
999
+ *  [permnegated] => 0
1000
+ *  [permskip] => 0
1001
+ * }
1002
+ * </pre>
1003
+ *
1004
+ * @author     Par0noid Solutions
1005
+ * @param		integer		$cid		channelID
1006
+ * @param		boolean		$permsid	displays permissionName instead of permissionID [optional]
1007
+ * @return     array channelpermlist
1008
+ */
1009
+    function channelPermList($cid, $permsid = false) {
1010
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }	
1011
+        return $this->getData('multi', 'channelpermlist cid='.$cid.($permsid ? ' -permsid' : ''));
1012
+    }
1013
+
1014
+/**
1015
+ * clientAddPerm
1016
+ * 
1017
+ * Adds a set of specified permissions to a client. Multiple permissions can be added by providing the three parameters of each permission. A permission can be specified by permid or permsid.
1018
+ *
1019
+ * <b>Input-Array like this:</b>
1020
+ * <pre>
1021
+ * $permissions = array();
1022
+ * $permissions['permissionID'] = array('permissionValue', 'permskip');
1023
+ * //or you could use Permission Name
1024
+ * $permissions['permissionName'] = array('permissionValue', 'permskip');
1025
+ * </pre>
1026
+ *
1027
+ * @author     Par0noid Solutions
1028
+ * @param		integer	$cldbid			clientDBID
1029
+ * @param		array	$permissions	permissions
1030
+ * @return     boolean success
1031
+ */
1032
+    function clientAddPerm($cldbid, $permissions) {
1033
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1034
+		
1035
+        if(count($permissions) > 0) {
1036
+            //Permissions given
1037
+				
1038
+            //Errorcollector
1039
+            $errors = array();
1040
+				
1041
+            //Split Permissions to prevent query from overload
1042
+            $permissions = array_chunk($permissions, 50, true);
1043
+				
1044
+            //Action for each splitted part of permission
1045
+            foreach($permissions as $permission_part)
1046
+            {
1047
+                //Create command_string for each command that we could use implode later
1048
+                $command_string = array();
1049
+		
1050
+                foreach($permission_part as $key => $value)
1051
+                {
1052
+                    $command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$this->escapeText($value[0]).' permskip='.$this->escapeText($value[1]);
1053
+                }
1054
+		
1055
+                $result = $this->getData('boolean', 'clientaddperm cldbid='.$cldbid.' '.implode('|', $command_string));
1056
+		
1057
+                if(!$result['success'])
1058
+                {
1059
+                    foreach($result['errors'] as $error)
1060
+                    {
1061
+                        $errors[] = $error;
1062
+                    }
1063
+                }
1064
+            }
1065
+				
1066
+            if(count($errors) == 0)
1067
+            {
1068
+                return $this->generateOutput(true, array(), true);
1069
+            }else{
1070
+                return $this->generateOutput(false, $errors, false);
1071
+            }
1072
+        }else{
1073
+            // No permissions given
1074
+            $this->addDebugLog('no permissions given');
1075
+            return $this->generateOutput(false, array('Error: no permissions given'), false);
1076
+        }
1077
+    }
1078
+
1079
+/**
1080
+ * clientAvatar
1081
+ *
1082
+ * Will return the base64 encoded binary of the clients avatar
1083
+ * 
1084
+ * <pre>
1085
+ * $result = $tsAdmin->clientAvatar($uid);
1086
+ * You can display it like: echo '<img src="data:image/png;base64,'.$result["data"].'" />';
1087
+ * </pre>
1088
+ *
1089
+ * @author  Par0noid Solutions
1090
+ * @param  string  $uid  clientUID
1091
+ * @return array  base64 image
1092
+ */
1093
+    function clientAvatar($uid) {
1094
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1095
+
1096
+        if(empty($uid))
1097
+        {
1098
+        return $this->generateOutput(false, array('Error: empty uid'), false);
1099
+        }
1100
+
1101
+        $newChars = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p');
1102
+        $auid = '';
1103
+
1104
+        for ($i = 0; $i <= 19; $i++) {
1105
+                $char = ord(substr(base64_decode($uid), $i, 1));
1106
+                $auid .= $newChars[($char & 0xF0) >> 4];
1107
+                $auid .= $newChars[$char & 0x0F];
1108
+        }
1109
+
1110
+        $init = $this->ftInitDownload('/avatar_'.$auid, 0, '');
1111
+
1112
+        if(!$init["success"])
1113
+        {
1114
+        return $this->generateOutput(false, array('Error: init failed'), false);
1115
+        }
1116
+	  
1117
+        $download = $this->ftDownloadFile($init);
1118
+
1119
+        if(is_array($download))
1120
+        {
1121
+        return $download;
1122
+        }else{
1123
+        return $this->generateOutput(true, false, base64_encode($download));
1124
+        }
1125
+
1126
+    }
1127
+	
1128
+/**
1129
+ * clientDbDelete
1130
+ * 
1131
+ * Deletes a clients properties from the database.
1132
+ *
1133
+ * @author     Par0noid Solutions
1134
+ * @param		integer $cldbid	clientDBID
1135
+ * @return     boolean success
1136
+ */
1137
+    function clientDbDelete($cldbid) {
1138
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1139
+        return $this->getData('boolean', 'clientdbdelete cldbid='.$cldbid);
1140
+    }
1141
+
1142
+/**
1143
+ * clientDbEdit
1144
+ * 
1145
+ * Changes a clients settings using given properties.
1146
+ *
1147
+ * <b>Input-Array like this:</b>
1148
+ * <pre>
1149
+ * $data = array();
1150
+ * 
1151
+ * $data['property'] = 'value';
1152
+ * $data['property'] = 'value';
1153
+ * </pre>
1154
+ *
1155
+ * @author     Par0noid Solutions
1156
+ * @param		integer		$cldbid		clientDBID
1157
+ * @param		array		$data	 	clientProperties
1158
+ * @return     boolean success
1159
+ */
1160
+    function clientDbEdit($cldbid, $data) {
1161
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1162
+		
1163
+        $settingsString = '';
1164
+		
1165
+        foreach($data as $key => $value) {
1166
+            $settingsString .= ' '.$key.'='.$this->escapeText($value);
1167
+        }
1168
+		
1169
+        return $this->getData('boolean', 'clientdbedit cldbid='.$cldbid.$settingsString);
1170
+    }
1171
+
1172
+/**
1173
+ * clientDbFind
1174
+ * 
1175
+ * Displays 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.
1176
+ *
1177
+ * <b>Output:</b>
1178
+ * <pre>
1179
+ * Array
1180
+ * {
1181
+ *  [cldbid] => 2
1182
+ * }
1183
+ *	</pre>
1184
+ *
1185
+ * @author     Par0noid Solutions
1186
+ * @param		string	$pattern	clientName
1187
+ * @param		boolean	$uid		set true to add -uid param [optional]
1188
+ * @return     array clientList 
1189
+ */
1190
+    function clientDbFind($pattern, $uid = false) {
1191
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1192
+        return $this->getData('multi', 'clientdbfind pattern='.$this->escapeText($pattern).($uid ? ' -uid' : ''));
1193
+    }
1194
+
1195
+/**
1196
+ * clientDbInfo
1197
+ *
1198
+ * Displays detailed database information about a client including unique ID, creation date, etc.
1199
+ *
1200
+ * <b>Output:</b>
1201
+ * <pre>
1202
+ * Array
1203
+ * {
1204
+ *  [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1205
+ *  [client_nickname] => par0noid
1206
+ *  [client_database_id] => 2
1207
+ *  [client_created] => 1361027850
1208
+ *  [client_lastconnected] => 1361027850
1209
+ *  [client_totalconnections] => 1
1210
+ *  [client_flag_avatar] => 
1211
+ *  [client_description] => 
1212
+ *  [client_month_bytes_uploaded] => 0
1213
+ *  [client_month_bytes_downloaded] => 0
1214
+ *  [client_total_bytes_uploaded] => 0
1215
+ *  [client_total_bytes_downloaded] => 0
1216
+ *  [client_icon_id] => 0
1217
+ *  [client_base64HashClientUID] => jneilbgomklpfnkjclkoggokfdmdlhnbbpmdpagh
1218
+ *  [client_lastip] => 127.0.0.1
1219
+ * }
1220
+ * </pre>
1221
+ *
1222
+ * @author     Par0noid Solutions
1223
+ * @param		integer		$cldbid		clientDBID
1224
+ * @return     array	clientDbInfo
1225
+ */
1226
+    function clientDbInfo($cldbid) {
1227
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1228
+        return $this->getData('array', 'clientdbinfo cldbid='.$cldbid);
1229
+    }
1230
+
1231
+/**
1232
+ * clientDbList
1233
+ * 
1234
+ * Displays a list of client identities known by the server including their database ID, last nickname, etc.
1235
+ *
1236
+ * <b>Possible params:</b> [start={offset}] [duration={limit}] [-count]
1237
+ *
1238
+ * <b>Output:</b>
1239
+ * <pre>
1240
+ * Array
1241
+ * {
1242
+ *  [count] => 1 (if count parameter is set)
1243
+ *  [cldbid] => 2
1244
+ *  [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1245
+ *  [client_nickname] => par0noid
1246
+ *  [client_created] => 1361027850
1247
+ *  [client_lastconnected] => 1361027850
1248
+ *  [client_totalconnections] => 1
1249
+ *  [client_description] => 
1250
+ *  [client_lastip] => 127.0.0.1
1251
+ * }
1252
+ * </pre>
1253
+ *
1254
+ * @author     Par0noid Solutions
1255
+ * @param		integer	$start		offset [optional] (Default: 0)
1256
+ * @param		integer	$duration	limit [optional] (Default: -1)
1257
+ * @param		boolean	$count		set true to add -count param [optional]
1258
+ * @return     array clientdblist
1259
+ */
1260
+    function clientDbList($start = 0, $duration = -1, $count = false) {
1261
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1262
+        return $this->getData('multi', 'clientdblist start='.$start.' duration='.$duration.($count ? ' -count' : ''));
1263
+    }
1264
+
1265
+/**
1266
+ * clientDelPerm
1267
+ * 
1268
+ * Removes a set of specified permissions from a client. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.
1269
+ *
1270
+ * <b>Input-Array like this:</b>
1271
+ * <pre>
1272
+ * $permissions = array();
1273
+ * $permissions['permissionID'] = 'permissionValue';
1274
+ * //or you could use Permission Name
1275
+ * $permissions['permissionName'] = 'permissionValue';
1276
+ * </pre>
1277
+ *
1278
+ * @author     Par0noid Solutions
1279
+ * @param		integer		$cldbid				clientDBID
1280
+ * @param		array		$permissionIds		permissionIDs
1281
+ * @return     boolean success
1282
+ */
1283
+    function clientDelPerm($cldbid, $permissionIds) {
1284
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1285
+		
1286
+        $permissionArray = array();
1287
+		
1288
+        if(count($permissionIds) > 0) {
1289
+            foreach($permissionIds AS $value) {
1290
+                $permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
1291
+            }
1292
+            return $this->getData('boolean', 'clientdelperm cldbid='.$cldbid.' '.implode('|', $permissionArray));
1293
+        }else{
1294
+            $this->addDebugLog('no permissions given');
1295
+            return $this->generateOutput(false, array('Error: no permissions given'), false);
1296
+        }
1297
+    }
1298
+
1299
+/**
1300
+ * clientEdit
1301
+ * 
1302
+ * Changes a clients settings using given properties.
1303
+ *
1304
+ * <b>Input-Array like this:</b>
1305
+ * <pre>
1306
+ * $data = array();
1307
+ *	
1308
+ * $data['property'] = 'value';
1309
+ * $data['property'] = 'value';
1310
+ * </pre>
1311
+ *
1312
+ * @author     Par0noid Solutions
1313
+ * @param		integer	$clid 			clientID
1314
+ * @param		array	$data			clientProperties
1315
+ * @return     boolean success
1316
+ */
1317
+    function clientEdit($clid, $data) {
1318
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1319
+		
1320
+        $settingsString = '';
1321
+		
1322
+        foreach($data as $key => $value) {
1323
+            $settingsString .= ' '.$key.'='.$this->escapeText($value);
1324
+        }
1325
+		
1326
+        return $this->getData('boolean', 'clientedit clid='.$clid.$settingsString);
1327
+    }
1328
+
1329
+/**
1330
+ * clientFind
1331
+ * 
1332
+ * Displays a list of clients matching a given name pattern.
1333
+ *
1334
+ * <b>Output:</b>
1335
+ * <pre>
1336
+ * Array
1337
+ * {
1338
+ *  [clid] => 18
1339
+ *  [client_nickname] => par0noid
1340
+ * }
1341
+ * </pre>
1342
+ *
1343
+ * @author     Par0noid Solutions
1344
+ * @param		string	$pattern	clientName
1345
+ * @return     array clienList
1346
+ */
1347
+    function clientFind($pattern) {
1348
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1349
+        return $this->getData('multi', 'clientfind pattern='.$this->escapeText($pattern));
1350
+    }
1351
+
1352
+/**
1353
+ * clientGetDbIdFromUid
1354
+ * 
1355
+ * Displays the database ID matching the unique identifier specified by cluid.
1356
+ *
1357
+ *	<b>Output:</b>
1358
+ * <pre>
1359
+ * Array
1360
+ * {
1361
+ *  [cluid] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1362
+ *  [cldbid] => 2
1363
+ * }
1364
+ * </pre>
1365
+ *
1366
+ * @author     Par0noid Solutions
1367
+ * @param		string	$cluid	clientUID
1368
+ * @return     array clientInfo
1369
+ */
1370
+    function clientGetDbIdFromUid($cluid) {
1371
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1372
+        return $this->getData('array', 'clientgetdbidfromuid cluid='.$cluid);
1373
+    }
1374
+
1375
+/**
1376
+ * clientGetIds
1377
+ * 
1378
+ * Displays all client IDs matching the unique identifier specified by cluid.
1379
+ *
1380
+ * <b>Output:</b>
1381
+ * <pre>
1382
+ * Array
1383
+ * {
1384
+ *  [cluid] => nUixbdf/XakrrmsdffO30R/D8Gc=
1385
+ *  [clid] => 7
1386
+ *  [name] => Par0noid
1387
+ * }
1388
+ * </pre>
1389
+ *
1390
+ * @author     Par0noid Solutions
1391
+ * @param		string	$cluid	clientUID
1392
+ * @return     array clientList 
1393
+ */
1394
+    function clientGetIds($cluid) {
1395
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1396
+        return $this->getData('multi', 'clientgetids cluid='.$cluid);
1397
+    }
1398
+
1399
+/**
1400
+ * clientGetNameFromDbid
1401
+ * 
1402
+ * Displays the unique identifier and nickname matching the database ID specified by cldbid.
1403
+ *
1404
+ *	<b>Output:</b>
1405
+ * <pre>
1406
+ * Array
1407
+ * {
1408
+ *  [cluid] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1409
+ *  [cldbid] => 2
1410
+ *  [name] => Par0noid
1411
+ * }
1412
+ * </pre>
1413
+ *
1414
+ * @author     Par0noid Solutions
1415
+ * @param		integer	$cldbid	clientDBID
1416
+ * @return     array clientInfo
1417
+ */
1418
+    function clientGetNameFromDbid($cldbid) {
1419
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1420
+        return $this->getData('array', 'clientgetnamefromdbid cldbid='.$cldbid);
1421
+    }
1422
+	
1423
+/**
1424
+ * clientGetNameFromUid
1425
+ * 
1426
+ * Displays the database ID and nickname matching the unique identifier specified by cluid.
1427
+ *
1428
+ *	<b>Output:</b>
1429
+ * <pre>
1430
+ * Array
1431
+ * {
1432
+ *  [cluid] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1433
+ *  [cldbid] => 2
1434
+ *  [name] => Par0noid
1435
+ * }
1436
+ * </pre>
1437
+ *
1438
+ * @author     Par0noid Solutions
1439
+ * @param		string	$cluid	clientUID
1440
+ * @return     array clientInfo
1441
+ */
1442
+    function clientGetNameFromUid($cluid) {
1443
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1444
+        return $this->getData('array', 'clientgetnamefromuid cluid='.$cluid);
1445
+    }
1446
+
1447
+/**
1448
+ * clientInfo
1449
+ * 
1450
+ * Displays detailed configuration information about a client including unique ID, nickname, client version, etc.
1451
+ *
1452
+ * <b>Output:</b>
1453
+ * <pre>
1454
+ * Array
1455
+ * {
1456
+ *  [cid] => 2
1457
+ *  [client_idle_time] => 4445369
1458
+ *  [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1459
+ *  [client_nickname] => par0noid
1460
+ *  [client_version] => 3.0.9.2 [Build: 1351504843]
1461
+ *  [client_platform] => Windows
1462
+ *  [client_input_muted] => 1
1463
+ *  [client_output_muted] => 1
1464
+ *  [client_outputonly_muted] => 0
1465
+ *  [client_input_hardware] => 1
1466
+ *  [client_output_hardware] => 1
1467
+ *  [client_default_channel] => 
1468
+ *  [client_meta_data] => 
1469
+ *  [client_is_recording] => 0
1470
+ *  [client_login_name] => 
1471
+ *  [client_database_id] => 2
1472
+ *  [client_channel_group_id] => 5
1473
+ *  [client_servergroups] => 6
1474
+ *  [client_created] => 1361027850
1475
+ *  [client_lastconnected] => 1361027850
1476
+ *  [client_totalconnections] => 1
1477
+ *  [client_away] => 0
1478
+ *  [client_away_message] => 
1479
+ *  [client_type] => 0
1480
+ *  [client_flag_avatar] => 
1481
+ *  [client_talk_power] => 75
1482
+ *  [client_talk_request] => 0
1483
+ *  [client_talk_request_msg] => 
1484
+ *  [client_description] => 
1485
+ *  [client_is_talker] => 0
1486
+ *  [client_month_bytes_uploaded] => 0
1487
+ *  [client_month_bytes_downloaded] => 0
1488
+ *  [client_total_bytes_uploaded] => 0
1489
+ *  [client_total_bytes_downloaded] => 0
1490
+ *  [client_is_priority_speaker] => 0
1491
+ *  [client_nickname_phonetic] => 
1492
+ *  [client_needed_serverquery_view_power] => 75
1493
+ *  [client_default_token] => 
1494
+ *  [client_icon_id] => 0
1495
+ *  [client_is_channel_commander] => 0
1496
+ *  [client_country] => 
1497
+ *  [client_channel_group_inherited_channel_id] => 2
1498
+ *  [client_base64HashClientUID] => jneilbgomklpfnkjclkoggokfdmdlhnbbpmdpagh
1499
+ *  [connection_filetransfer_bandwidth_sent] => 0
1500
+ *  [connection_filetransfer_bandwidth_received] => 0
1501
+ *  [connection_packets_sent_total] => 12130
1502
+ *  [connection_bytes_sent_total] => 542353
1503
+ *  [connection_packets_received_total] => 12681
1504
+ *  [connection_bytes_received_total] => 592935
1505
+ *  [connection_bandwidth_sent_last_second_total] => 82
1506
+ *  [connection_bandwidth_sent_last_minute_total] => 92
1507
+ *  [connection_bandwidth_received_last_second_total] => 84
1508
+ *  [connection_bandwidth_received_last_minute_total] => 88
1509
+ *  [connection_connected_time] => 5908749
1510
+ *  [connection_client_ip] => 127.0.0.1
1511
+ * } 
1512
+ * </pre>
1513
+ *
1514
+ * @author     Par0noid Solutions
1515
+ * @param		integer	$clid	clientID
1516
+ * @return     array	clientInformation
1517
+ */
1518
+    function clientInfo($clid) {
1519
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1520
+        return $this->getData('array', 'clientinfo clid='.$clid);
1521
+    }
1522
+
1523
+/**
1524
+ * clientKick
1525
+ * 
1526
+ * Kicks one or more clients specified with clid from their currently joined channel or from the server, depending on reasonid. The reasonmsg parameter specifies a text message sent to the kicked clients. This parameter is optional and may only have a maximum of 40 characters.
1527
+ *
1528
+ * @author     Par0noid Solutions
1529
+ * @param		integer $clid		clientID
1530
+ * @param		string	$kickMode	kickMode (server or channel) (Default: servera)
1531
+ * @param		string	$kickmsg 	kick reason [optional]
1532
+ * @return     boolean success
1533
+ */
1534
+    function clientKick($clid, $kickMode = "server", $kickmsg = "") {
1535
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1536
+		
1537
+        if(in_array($kickMode, array('server', 'channel'))) {
1538
+		
1539
+            if($kickMode == 'server') { $from = '5'; }
1540
+            if($kickMode == 'channel') { $from = '4'; }
1541
+			
1542
+            if(!empty($kickmsg)) { $msg = ' reasonmsg='.$this->escapeText($kickmsg); } else{ $msg = ''; }
1543
+			
1544
+            return $this->getData('boolean', 'clientkick clid='.$clid.' reasonid='.$from.$msg);
1545
+        }else{
1546
+            $this->addDebugLog('invalid kickMode');
1547
+            return $this->generateOutput(false, array('Error: invalid kickMode'), false);
1548
+        }
1549
+    }
1550
+
1551
+/**
1552
+ * clientList
1553
+ * 
1554
+ * Displays a list of clients online on a virtual server including their ID, nickname, status flags, etc. The output can be modified using several command options. Please note that the output will only contain clients which are currently in channels you're able to subscribe to.
1555
+ *
1556
+ * <b>Possible params:</b> [-uid] [-away] [-voice] [-times] [-groups] [-info] [-icon] [-country] [-ip] [-badges]
1557
+ *
1558
+ * <b>Output: (without parameters)</b>
1559
+ * <pre>
1560
+ * Array
1561
+ * {
1562
+ *  [clid] => 1
1563
+ *  [cid] => 1
1564
+ *  [client_database_id] => 2
1565
+ *  [client_nickname] => Par0noid
1566
+ *  [client_type] => 0
1567
+ *  [-uid] => [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1568
+ *  [-away] => [client_away] => 0
1569
+ *  [-away] => [client_away_message] => 
1570
+ *  [-voice] => [client_flag_talking] => 0
1571
+ *  [-voice] => [client_input_muted] => 0
1572
+ *  [-voice] => [client_output_muted] => 0
1573
+ *  [-voice] => [client_input_hardware] => 0
1574
+ *  [-voice] => [client_output_hardware] => 0
1575
+ *  [-voice] => [client_talk_power] => 0
1576
+ *  [-voice] => [client_is_talker] => 0
1577
+ *  [-voice] => [client_is_priority_speaker] => 0
1578
+ *  [-voice] => [client_is_recording] => 0
1579
+ *  [-voice] => [client_is_channel_commander] => 0
1580
+ *  [-times] => [client_idle_time] => 1714
1581
+ *  [-times] => [client_created] => 1361027850
1582
+ *  [-times] => [client_lastconnected] => 1361042955
1583
+ *  [-groups] => [client_servergroups] => 6,7
1584
+ *  [-groups] => [client_channel_group_id] => 8
1585
+ *  [-groups] => [client_channel_group_inherited_channel_id] => 1
1586
+ *  [-info] => [client_version] => 3.0.9.2 [Build: 1351504843]
1587
+ *  [-info] => [client_platform] => Windows
1588
+ *  [-icon] => [client_icon_id] => 0
1589
+ *  [-country] => [client_country] => 
1590
+ *  [-ip] => [connection_client_ip] => 127.0.0.1
1591
+ *  [-badges] => [client_badges] => Overwolf=0
1592
+ * }
1593
+ * 
1594
+ * <b>Usage:</b>
1595
+ * 
1596
+ * $ts3->clientList(); //No parameters
1597
+ * $ts3->clientList("-uid"); //Single parameter
1598
+ * $ts3->clientList("-uid -away -voice -times -groups -info -country -icon -ip -badges"); //Multiple parameters
1599
+ * </pre>
1600
+ *
1601
+ * @author     Par0noid Solutions
1602
+ * @param		string	$params	additional parameters [optional]
1603
+ * @return     array clientList 
1604
+ */
1605
+    function clientList($params = null) {
1606
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1607
+		
1608
+        if(!empty($params)) { $params = ' '.$params; }
1609
+		
1610
+        return $this->getData('multi', 'clientlist'.$params);
1611
+    }
1612
+
1613
+/**
1614
+ * clientMove
1615
+ * 
1616
+ * Moves one or more clients specified with clid to the channel with ID cid. If the target channel has a password, it needs to be specified with cpw. If the channel has no password, the parameter can be omitted.
1617
+ *
1618
+ * @author     Par0noid Solutions
1619
+ * @param		integer $clid	clientID
1620
+ * @param		integer $cid	channelID
1621
+ * @param		string	$cpw	channelPassword [optional]
1622
+ * @return     boolean success
1623
+ */
1624
+    function clientMove($clid, $cid, $cpw = null) {
1625
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1626
+        return $this->getData('boolean', 'clientmove clid='.$clid.' cid='.$cid.(!empty($cpw) ? ' cpw='.$this->escapeText($cpw) : ''));
1627
+    }
1628
+
1629
+/**
1630
+ * clientPermList
1631
+ * 
1632
+ * Displays a list of permissions defined for a client.
1633
+ *
1634
+ * <b>Output:</b>
1635
+ * <pre>
1636
+ * Array
1637
+ * {
1638
+ *  [permid] => 20654 //with permsid = false
1639
+ *  [permsid] => b_client_ignore_bans //with permsid = true
1640
+ *  [permvalue] => 1
1641
+ *  [permnegated] => 0
1642
+ *  [permskip] => 0
1643
+ * }
1644
+ * </pre>
1645
+ *
1646
+ * @author     Par0noid Solutions
1647
+ * @param		intege		$cldbid 	clientDBID
1648
+ * @param		boolean		$permsid	set true to add -permsid param [optional]
1649
+ * @return     array clientPermList
1650
+ */
1651
+    function clientPermList($cldbid, $permsid = false) {
1652
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }		
1653
+        return $this->getData('multi', 'clientpermlist cldbid='.$cldbid.($permsid ? ' -permsid' : ''));
1654
+    }
1655
+
1656
+/**
1657
+ * clientPoke
1658
+ * 
1659
+ * Sends a poke message to the client specified with clid.
1660
+ *
1661
+ * @author     Par0noid Solutions
1662
+ * @param		integer $clid	clientID
1663
+ * @param		string 	$msg 	pokeMessage
1664
+ * @return     boolean success
1665
+ */
1666
+    function clientPoke($clid, $msg) {
1667
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1668
+        return $this->getData('boolean', 'clientpoke clid='.$clid.' msg='.$this->escapeText($msg));
1669
+    }
1670
+
1671
+/**
1672
+ * clientSetServerQueryLogin
1673
+ * 
1674
+ * Updates your own ServerQuery login credentials using a specified username. The password will be auto-generated.
1675
+ * 
1676
+ * <b>Output:</b>
1677
+ * <pre>
1678
+ * Array
1679
+ * {
1680
+ *  [client_login_password] => +r\/TQqvR
1681
+ * }
1682
+ * </pre>
1683
+ *
1684
+ * @author     Par0noid Solutions
1685
+ * @param		string	$username	username
1686
+ * @return     array userInfomation
1687
+ */
1688
+    function clientSetServerQueryLogin($username) {
1689
+        return $this->getData('array', 'clientsetserverquerylogin client_login_name='.$this->escapeText($username));
1690
+    }
1691
+
1692
+/**
1693
+ * clientUpdate
1694
+ * 
1695
+ * Change your ServerQuery clients settings using given properties.
1696
+ * 
1697
+ * <b>Input-Array like this:</b>
1698
+ * <pre>
1699
+ * $data = array();
1700
+ * $data['property'] = 'value';
1701
+ * $data['property'] = 'value';
1702
+ * </pre>
1703
+ *
1704
+ * @author     Par0noid Solutions
1705
+ * @param		array	$data	clientProperties
1706
+ * @return     boolean success
1707
+ */
1708
+    function clientUpdate($data) {
1709
+        $settingsString = '';
1710
+		
1711
+        foreach($data as $key => $value) {
1712
+            $settingsString .= ' '.$key.'='.$this->escapeText($value);
1713
+        }
1714
+		
1715
+        return $this->getData('boolean', 'clientupdate '.$settingsString);
1716
+    }
1717
+
1718
+/**
1719
+ * complainAdd
1720
+ *
1721
+ * Submits a complaint about the client with database ID tcldbid to the server.
1722
+ *
1723
+ * @author     Par0noid Solutions
1724
+ * @param		integer $tcldbid	targetClientDBID
1725
+ * @param		string	$msg		complainMessage
1726
+ * @return     boolean success
1727
+ */
1728
+    function complainAdd($tcldbid, $msg) {
1729
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1730
+        return $this->getData('boolean', 'complainadd tcldbid='.$tcldbid.' message='.$this->escapeText($msg));
1731
+    }
1732
+
1733
+/**
1734
+ * complainDelete
1735
+ * 
1736
+ * Deletes the complaint about the client with ID tcldbid submitted by the client with ID fcldbid from the server.
1737
+ *
1738
+ * @author     Par0noid Solutions
1739
+ * @param		integer $tcldbid targetClientDBID
1740
+ * @param		integer $fcldbid fromClientDBID
1741
+ * @return     boolean success
1742
+ */
1743
+    function complainDelete($tcldbid, $fcldbid) {
1744
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1745
+        return $this->getData('boolean', 'complaindel tcldbid='.$tcldbid.' fcldbid='.$fcldbid);
1746
+    }
1747
+
1748
+/**
1749
+ * complainDeleteAll
1750
+ * 
1751
+ * Deletes all complaints about the client with database ID tcldbid from the server.
1752
+ *
1753
+ * @author     Par0noid Solutions
1754
+ * @param		integer $tcldbid targetClientDBID
1755
+ * @return     boolean success
1756
+ */
1757
+    function complainDeleteAll($tcldbid) {
1758
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1759
+        return $this->getData('boolean', 'complaindelall tcldbid='.$tcldbid);
1760
+    }
1761
+
1762
+/**
1763
+ * complainList
1764
+ * 
1765
+ * Displays a list of complaints on the selected virtual server. If tcldbid is specified, only complaints about the targeted client will be shown.
1766
+ *
1767
+ * <b>Output:</b>
1768
+ * <pre>
1769
+ * Array
1770
+ * {
1771
+ *  [tcldbid] => 2
1772
+ *  [tname] => par0noid
1773
+ *  [fcldbid] => 1
1774
+ *  [fname] => serveradmin from 127.0.0.1:6814
1775
+ *  [message] => Steals crayons
1776
+ *  [timestamp] => 1361044090
1777
+ * }
1778
+ * </pre>
1779
+ *
1780
+ * @author     Par0noid Solutions
1781
+ * @param		string $tcldbid	targetClientDBID [optional]
1782
+ * @return     array complainList
1783
+ */
1784
+    function complainList($tcldbid = null) {
1785
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1786
+        if(!empty($tcldbid)) { $tcldbid = ' tcldbid='.$tcldbid; }
1787
+        return $this->getData('multi', 'complainlist'.$tcldbid);
1788
+    }
1789
+
1790
+/**
1791
+ * execOwnCommand
1792
+ * 
1793
+ * executes a command that isn't defined in class and returns data like your propose
1794
+ * 
1795
+ * <b>Modes:</b>
1796
+ * <ul>
1797
+ * 	<li><b>0:</b> execute -> return boolean</li>
1798
+ * 	<li><b>1:</b> execute -> return normal array</li>
1799
+ * 	<li><b>2:</b> execute -> return multidimensional array</li>
1800
+ * 	<li><b>3:</b> execute -> return plaintext serverquery</li>
1801
+ * </ul>
1802
+ *
1803
+ * @author     Par0noid Solutions
1804
+ * @param		string	$mode		executionMode
1805
+ * @param		string	$command	command
1806
+ * @return     mixed result
1807
+ */
1808
+    function execOwnCommand($mode, $command) {
1809
+        if($mode == '0') {
1810
+            return $this->getData('boolean', $command);
1811
+        }
1812
+        if($mode == '1') {
1813
+            return $this->getData('array', $command);
1814
+        }
1815
+        if($mode == '2') {
1816
+            return $this->getData('multi', $command);
1817
+        }
1818
+        if($mode == '3') {
1819
+            return $this->getData('plain', $command);
1820
+        }
1821
+    }
1822
+
1823
+/**
1824
+ * ftCreateDir
1825
+ * 
1826
+ * Creates new directory in a channels file repository.
1827
+ *
1828
+ * @author     Par0noid Solutions
1829
+ * @param		string	$cid		channelId
1830
+ * @param		string	$cpw		channelPassword (leave blank if not needed)
1831
+ * @param		string	$dirname	dirPath
1832
+ * @return     boolean success
1833
+ */
1834
+    function ftCreateDir($cid, $cpw = null, $dirname) {
1835
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1836
+        return $this->getData('boolean', 'ftcreatedir cid='.$cid.' cpw='.$this->escapeText($cpw).' dirname='.$this->escapeText($dirname));
1837
+    }
1838
+
1839
+/**
1840
+ * ftDeleteFile
1841
+ * 
1842
+ * Deletes one or more files stored in a channels file repository.
1843
+ *
1844
+ * <b>Input-Array like this:</b>
1845
+ * <pre>
1846
+ * $files = array();
1847
+ *	
1848
+ * $files[] = '/pic1.jpg';
1849
+ * $files[] = '/dokumente/test.txt';
1850
+ * $files[] = '/dokumente';
1851
+ * </pre>
1852
+ *
1853
+ * @author     Par0noid Solutions
1854
+ * @param		string	$cid	channelID
1855
+ * @param		string	$cpw	channelPassword (leave blank if not needed)
1856
+ * @param		array	$files	files
1857
+ * @return     boolean success
1858
+ */
1859
+    function ftDeleteFile($cid, $cpw = '', $files) {
1860
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1861
+        $fileArray = array();
1862
+		
1863
+        if(count($files) > 0) {
1864
+            foreach($files AS $file) {
1865
+                $fileArray[] = 'name='.$this->escapeText($file);
1866
+            }
1867
+            return $this->getData('boolean', 'ftdeletefile cid='.$cid.' cpw='.$this->escapeText($cpw).' '.implode('|', $fileArray));
1868
+        }else{
1869
+            $this->addDebugLog('no files given');
1870
+            return $this->generateOutput(false, array('Error: no files given'), false);
1871
+        }
1872
+    }
1873
+
1874
+/**
1875
+ * ftDownloadFile
1876
+ * 
1877
+ * Ddownloads a file and returns its contents
1878
+ *
1879
+ * @author     Par0noid Solutions
1880
+ * @param		array	$data	return of ftInitDownload
1881
+ * @return     array downloadedFile
1882
+ */
1883
+    function ftDownloadFile($data) {
1884
+        $errnum = null;
1885
+        $errstr = null;
1886
+            $this->runtime['fileSocket'] = @fsockopen($this->runtime['host'], $data['data']['port'], $errnum, $errstr, $this->runtime['timeout']);
1887
+            if($this->runtime['fileSocket']) {
1888
+                $this->ftSendKey($data['data']['ftkey']);
1889
+                $content = $this->ftRead($data['data']['size']);
1890
+                @fclose($this->runtime['fileSocket']);
1891
+                $this->runtime['fileSocket'] = '';
1892
+                return $content;
1893
+            }else{
1894
+                $this->addDebugLog('fileSocket returns '.$errnum. ' | '.$errstr);
1895
+                return $this->generateOutput(false, array('Error in fileSocket: '.$errnum. ' | '.$errstr), false);
1896
+            }
1897
+    }
1898
+	
1899
+/**
1900
+ * ftGetFileInfo
1901
+ * 
1902
+ * Displays detailed information about one or more specified files stored in a channels file repository.
1903
+ * 
1904
+ *
1905
+ * @author     Par0noid Solutions
1906
+ * @param		string	$cid	channelID
1907
+ * @param		string	$cpw	channelPassword (leave blank if not needed)
1908
+ * @param		string 	$file	path to file
1909
+ * @return     boolean success
1910
+ */
1911
+    function ftGetFileInfo($cid, $cpw = '', $file) {
1912
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1913
+
1914
+        return $this->getData('multi', 'ftgetfileinfo cid='.$cid.' cpw='.$this->escapeText($cpw).' name='.$this->escapeText($file));
1915
+    }
1916
+
1917
+/**
1918
+ * ftGetFileList
1919
+ *
1920
+ * Displays a list of files and directories stored in the specified channels file repository.
1921
+ *
1922
+ * <b>Output:</b>
1923
+ * <pre>
1924
+ * Array
1925
+ * {
1926
+ *  [cid] => 231
1927
+ *  [path] => /
1928
+ *  [name] => Documents
1929
+ *  [size] => 0
1930
+ *  [datetime] => 1286633633
1931
+ *  [type] => 0
1932
+ * }
1933
+ * </pre>
1934
+ *
1935
+ * @author     Par0noid Solutions
1936
+ * @param		string	$cid	channelID
1937
+ * @param		string	$cpw	channelPassword (leave blank if not needed)
1938
+ * @param		string	$path	filePath
1939
+ * @return     array	fileList
1940
+ */
1941
+    function ftGetFileList($cid, $cpw = '', $path) {
1942
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1943
+        return $this->getData('multi', 'ftgetfilelist cid='.$cid.' cpw='.$this->escapeText($cpw).' path='.$this->escapeText($path));
1944
+    }
1945
+	
1946
+/**
1947
+ * ftInitDownload
1948
+ * 
1949
+ * Initializes a file transfer download. clientftfid is an arbitrary ID to identify the file transfer on client-side. On success, the server generates a new ftkey which is required to start downloading the file through TeamSpeak 3's file transfer interface.
1950
+ *
1951
+ * <b>Output:</b>
1952
+ * <pre>
1953
+ * Array
1954
+ * {
1955
+ *  [clientftfid] => 89
1956
+ *  [serverftfid] => 3
1957
+ *  [ftkey] => jSzWiRmFGdZnoJzW7BSDYJRUWB2WAUhb
1958
+ *  [port] => 30033
1959
+ *  [size] => 94
1960
+ * }
1961
+ * </pre>
1962
+ *
1963
+ * @author     Par0noid Solutions
1964
+ * @param		string	$name			filePath
1965
+ * @param		string	$cid			channelID
1966
+ * @param		string	$cpw			channelPassword (leave blank if not needed)
1967
+ * @param		integer	$seekpos		seekpos (default = 0) [optional]
1968
+ * @return     array	initDownloadFileInfo
1969
+ */	
1970
+    function ftInitDownload($name, $cid, $cpw = '', $seekpos = 0) {
1971
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1972
+        return $this->getData('array', 'ftinitdownload clientftfid='.rand(1,99).' name='.$this->escapeText($name).' cid='.$cid.' cpw='.$this->escapeText($cpw).' seekpos='.$seekpos);
1973
+    }
1974
+
1975
+/**
1976
+ * ftInitUpload
1977
+ * 
1978
+ * Initializes a file transfer upload. clientftfid is an arbitrary ID to identify the file transfer on client-side. On success, the server generates a new ftkey which is required to start uploading the file through TeamSpeak 3's file transfer interface.
1979
+ *
1980
+ * <b>Output:</b>
1981
+ * <pre>
1982
+ * Array
1983
+ * {
1984
+ *  [clientftfid] => 84
1985
+ *  [serverftfid] => 41
1986
+ *  [ftkey] => HCnXpunOdAorqj3dGqfiuLszX18O0PHP
1987
+ *  [port] => 30033
1988
+ *  [seekpos] => 0
1989
+ * }
1990
+ * </pre>
1991
+ *
1992
+ * @author     Par0noid Solutions
1993
+ * @param		string	$filename	filePath
1994
+ * @param		string	$cid		channelID
1995
+ * @param		integer	$size		fileSize in bytes
1996
+ * @param		string	$cpw		channelPassword (leave blank if not needed)
1997
+ * @param		boolean	$overwrite	overwrite	[optional] (default = 0)
1998
+ * @param		boolean	$resume		resume		[optional] (default = 0)
1999
+ * @return     array	initUploadFileInfo
2000
+ */	
2001
+    function ftInitUpload($filename, $cid, $size, $cpw = '', $overwrite = false, $resume = false) {
2002
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2003
+		
2004
+        if($overwrite) { $overwrite = ' overwrite=1'; }else{ $overwrite = ' overwrite=0'; }
2005
+        if($resume) { $resume = ' resume=1'; }else{ $resume = ' resume=0'; }
2006
+		
2007
+        return $this->getData('array', 'ftinitupload clientftfid='.rand(1,99).' name='.$this->escapeText($filename).' cid='.$cid.' cpw='.$this->escapeText($cpw).' size='.($size + 1).$overwrite.$resume);
2008
+    }
2009
+	
2010
+/**
2011
+ * ftList
2012
+ * 
2013
+ * 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
2014
+ *
2015
+ * <b>Output:</b>
2016
+ * <pre>
2017
+ * Array
2018
+ * {
2019
+ *  [clid] => 1
2020
+ *  [cldbid] => 2019
2021
+ *  [path] => files/virtualserver_11/channel_231
2022
+ *  [name] => 1285412348878.png
2023
+ *  [size] => 1161281
2024
+ *  [sizedone] => 275888
2025
+ *  [clientftfid] => 15
2026
+ *  [serverftfid] => 52
2027
+ *  [sender] => 0
2028
+ *  [status] => 1
2029
+ *  [current_speed] => 101037.4453
2030
+ *  [average_speed] => 101037.4453
2031
+ *  [runtime] => 2163
2032
+ * }
2033
+ * </pre>
2034
+ *
2035
+ * @author     Par0noid Solutions
2036
+ * @return     array	fileTransferList
2037
+ */
2038
+    function ftList() {
2039
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2040
+        return $this->getData('multi', 'ftlist');
2041
+    }
2042
+
2043
+/**
2044
+ * ftRenameFile
2045
+ * 
2046
+ * 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.
2047
+ *
2048
+ * @author     Par0noid Solutions
2049
+ * @param		integer	$cid		channelID
2050
+ * @param		string	$cpw		channelPassword (leave blank if not needed)
2051
+ * @param		string	$oldname	oldFilePath
2052
+ * @param		string	$newname	newFilePath
2053
+ * @param		string  $tcid		targetChannelID [optional]
2054
+ * @param		string  $tcpw		targetChannelPassword [optional]
2055
+ * @return     boolean success
2056
+ */
2057
+    function ftRenameFile($cid, $cpw = null, $oldname, $newname, $tcid = null,  $tcpw = null) {
2058
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2059
+        $newTarget = ($tcid != null ? ' tcid='.$tcid.' '.$tcpw : '');
2060
+        return $this->getData('boolean', 'ftrenamefile cid='.$cid.' cpw='.$cpw.' oldname='.$this->escapeText($oldname).' newname='.$this->escapeText($newname).$newTarget);
2061
+    }
2062
+
2063
+/**
2064
+ * ftStop
2065
+ * 
2066
+ * Stops the running file transfer with server-side ID serverftfid.
2067
+ *
2068
+ * @author     Par0noid Solutions
2069
+ * @param		integer	$serverftfid	serverFileTransferID
2070
+ * @param		boolean	$delete			delete incomplete file [optional] (default: true) 
2071
+ * @return     boolean success
2072
+ */
2073
+    function ftStop($serverftfid, $delete = true) {
2074
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }		
2075
+        return $this->getData('boolean', 'ftstop serverftfid='.$serverftfid.' delete='.($delete ? '1' : '0'));
2076
+    }
2077
+
2078
+/**
2079
+ * ftUploadFile
2080
+ * 
2081
+ * Uploads a file to server
2082
+ * To check if upload was successful, you have to search for this file in fileList after
2083
+ *
2084
+ * @author     Par0noid Solutions
2085
+ * @param		array	$data			return of ftInitUpload
2086
+ * @param		string	$uploadData		data which should be uploaded
2087
+ * @return     array response
2088
+ */
2089
+    function ftUploadFile($data, $uploadData) {
2090
+            $this->runtime['fileSocket'] = @fsockopen($this->runtime['host'], $data['data']['port'], $errnum, $errstr, $this->runtime['timeout']);
2091
+            if($this->runtime['fileSocket']) {
2092
+                $this->ftSendKey($data['data']['ftkey'], "\n");
2093
+                $this->ftSendData($uploadData);
2094
+                @fclose($this->runtime['fileSocket']);
2095
+                $this->runtime['fileSocket'] = '';
2096
+                return $this->generateOutput(true, array(), true);
2097
+            }else{
2098
+                $this->addDebugLog('fileSocket returns '.$errnum. ' | '.$errstr);
2099
+                return $this->generateOutput(false, array('Error in fileSocket: '.$errnum. ' | '.$errstr), false);
2100
+            }
2101
+    }
2102
+
2103
+/**
2104
+ * gm
2105
+ * 
2106
+ * Sends a text message to all clients on all virtual servers in the TeamSpeak 3 Server instance.
2107
+ *
2108
+ * @author     Par0noid Solutions
2109
+ * @param		string	$msg	message
2110
+ * @return     boolean success
2111
+ */
2112
+    function gm($msg) {
2113
+        if(empty($msg)) {
2114
+            $this->addDebugLog('empty message given');
2115
+            return $this->generateOutput(false, array('Error: empty message given'), false);
2116
+        }
2117
+        return $this->getData('boolean', 'gm msg='.$this->escapeText($msg));
2118
+    }
2119
+
2120
+/**
2121
+ * hostInfo
2122
+ * 
2123
+ * Displays detailed connection information about the server instance including uptime, number of virtual servers online, traffic information, etc.
2124
+ *
2125
+ * <b>Output:</b>
2126
+ * <pre>
2127
+ * Array
2128
+ * {
2129
+ *  [instance_uptime] => 19038
2130
+ *  [host_timestamp_utc] => 1361046825
2131
+ *  [virtualservers_running_total] => 1
2132
+ *  [virtualservers_total_maxclients] => 32
2133
+ *  [virtualservers_total_clients_online] => 1
2134
+ *  [virtualservers_total_channels_online] => 2
2135
+ *  [connection_filetransfer_bandwidth_sent] => 0
2136
+ *  [connection_filetransfer_bandwidth_received] => 0
2137
+ *  [connection_filetransfer_bytes_sent_total] => 0
2138
+ *  [connection_filetransfer_bytes_received_total] => 0
2139
+ *  [connection_packets_sent_total] => 24853
2140
+ *  [connection_bytes_sent_total] => 1096128
2141
+ *  [connection_packets_received_total] => 25404
2142
+ *  [connection_bytes_received_total] => 1153918
2143
+ *  [connection_bandwidth_sent_last_second_total] => 82
2144
+ *  [connection_bandwidth_sent_last_minute_total] => 81
2145
+ *  [connection_bandwidth_received_last_second_total] => 84
2146
+ *  [connection_bandwidth_received_last_minute_total] => 87
2147
+ * }
2148
+ * </pre>
2149
+ *
2150
+ * @author     Par0noid Solutions
2151
+ * @return     array hostInformation
2152
+ */
2153
+    function hostInfo() {
2154
+        return $this->getData('array', 'hostinfo');
2155
+    }
2156
+
2157
+/**
2158
+ * instanceEdit
2159
+ * 
2160
+ * Changes the server instance configuration using given properties.
2161
+ *
2162
+ * <b>Input-Array like this:</b>
2163
+ * <pre>
2164
+ * $data = array();
2165
+ *	
2166
+ * $data['setting'] = 'value';
2167
+ * $data['setting'] = 'value';
2168
+ * </pre>
2169
+ *
2170
+ * @author     Par0noid Solutions
2171
+ * @param		array	$data	instanceProperties
2172
+ * @return     boolean success
2173
+ */
2174
+    function instanceEdit($data) {
2175
+        if(count($data) > 0) {
2176
+            $settingsString = '';
2177
+			
2178
+            foreach($data as $key => $val) {
2179
+                $settingsString .= ' '.$key.'='.$this->escapeText($val);
2180
+            }
2181
+            return $this->getData('boolean', 'instanceedit '.$settingsString);
2182
+        }else{
2183
+            $this->addDebugLog('empty array entered');
2184
+            return $this->generateOutput(false, array('Error: You can \'t give an empty array'), false);
2185
+        }
2186
+    }
2187
+
2188
+/**
2189
+ * instanceInfo
2190
+ * 
2191
+ * Displays the server instance configuration including database revision number, the file transfer port, default group IDs, etc.
2192
+ *
2193
+ * <b>Output:</b>
2194
+ * <pre>
2195
+ * Array
2196
+ * {
2197
+ *  [serverinstance_database_version] => 20
2198
+ *  [serverinstance_filetransfer_port] => 30033
2199
+ *  [serverinstance_max_download_total_bandwidth] => 18446744073709551615
2200
+ *  [serverinstance_max_upload_total_bandwidth] => 18446744073709551615
2201
+ *  [serverinstance_guest_serverquery_group] => 1
2202
+ *  [serverinstance_serverquery_flood_commands] => 10
2203
+ *  [serverinstance_serverquery_flood_time] => 3
2204
+ *  [serverinstance_serverquery_ban_time] => 600
2205
+ *  [serverinstance_template_serveradmin_group] => 3
2206
+ *  [serverinstance_template_serverdefault_group] => 5
2207
+ *  [serverinstance_template_channeladmin_group] => 1
2208
+ *  [serverinstance_template_channeldefault_group] => 4
2209
+ *  [serverinstance_permissions_version] => 15
2210
+ * }
2211
+ * </pre>
2212
+ *
2213
+ * @author     Par0noid Solutions
2214
+ * @return     array instanceInformation
2215
+ */
2216
+    function instanceInfo() {
2217
+        return $this->getData('array', 'instanceinfo');
2218
+    }
2219
+
2220
+/**
2221
+ * logAdd
2222
+ * 
2223
+ * Writes a custom entry into the servers log. Depending on your permissions, you'll be able to add entries into the server instance log and/or your virtual servers log. The loglevel parameter specifies the type of the entry.
2224
+ *
2225
+ * @author     Par0noid Solutions
2226
+ * @param		integer	$logLevel	loglevel between 1 and 4
2227
+ * @param		string	$logMsg		logMessage
2228
+ * @return     boolean success
2229
+ */
2230
+    function logAdd($logLevel, $logMsg) {
2231
+        if($logLevel >=1 and $logLevel <= 4) { 
2232
+            if(!empty($logMsg)) {
2233
+                return $this->getData('boolean', 'logadd loglevel='.$logLevel.' logmsg='.$this->escapeText($logMsg));
2234
+            }else{
2235
+                $this->addDebugLog('logMessage empty!');
2236
+                return $this->generateOutput(false, array('Error: logMessage empty!'), false);
2237
+            }
2238
+        }else{
2239
+            $this->addDebugLog('invalid logLevel!');
2240
+            return $this->generateOutput(false, array('Error: invalid logLevel!'), false);
2241
+        }
2242
+    }
2243
+
2244
+/**
2245
+ * login
2246
+ * 
2247
+ * Authenticates with the TeamSpeak 3 Server instance using given ServerQuery login credentials.
2248
+ *
2249
+ * @author     Par0noid Solutions
2250
+ * @param		string	$username	username
2251
+ * @param		string	$password	password
2252
+ * @return     boolean success
2253
+ */
2254
+    function login($username, $password) {
2255
+        return $this->getData('boolean', 'login '.$this->escapeText($username).' '.$this->escapeText($password));
2256
+    }
2257
+
2258
+/**
2259
+ * logout
2260
+ * 
2261
+ * Deselects the active virtual server and logs out from the server instance.
2262
+ *
2263
+ * @author     Par0noid Solutions
2264
+ * @return     boolean success
2265
+ */
2266
+    function logout() {
2267
+        $this->runtime['selected'] = false;
2268
+        return $this->getData('boolean', 'logout');
2269
+    }
2270
+
2271
+/**
2272
+ * logView
2273
+ * 
2274
+ * Displays a specified number of entries from the servers log. If instance is set to 1, the server will return lines from the master logfile (ts3server_0.log) instead of the selected virtual server logfile.
2275
+ * 
2276
+ * <b>Output:</b>
2277
+ * <pre>
2278
+ * Array
2279
+ * {
2280
+ *  [last_pos] => 0
2281
+ *  [file_size] => 1085
2282
+ *  [l] => 2012-01-10 20:34:31.379260|INFO    |ServerLibPriv |   | TeamSpeak 3 Server 3.0.1 (2011-11-17 07:34:30)
2283
+ * }
2284
+ * {
2285
+ *  [l] => 2012-01-10 20:34:31.380260|INFO    |DatabaseQuery |   | dbPlugin name:    SQLite3 plugin, Version 2, (c)TeamSpeak Systems GmbH
2286
+ * }
2287
+ * {
2288
+ *  [l] => 2012-01-10 20:34:31.380260|INFO    |DatabaseQuery |   | dbPlugin version: 3.7.3
2289
+ * }
2290
+ * </pre>
2291
+ *
2292
+ * @author     Par0noid Solutions
2293
+ * @param		integer	$lines	between 1 and 100
2294
+ * @param		integer	$reverse	{1|0} [optional]
2295
+ * @param		integer	$instance	{1|0} [optional]
2296
+ * @param		integer	$begin_pos	{1|0} [optional]
2297
+ * @return     multidimensional-array logEntries
2298
+ */
2299
+    function logView($lines, $reverse = 0, $instance = 0, $begin_pos = 0) {		
2300
+        if($lines >=1 and $lines <=100) {
2301
+            return $this->getData('multi', 'logview lines='.$lines.' reverse='.($reverse == 0 ? '0' : '1').' instance='.($instance == 0 ? '0' : '1').' begin_pos='.($begin_pos == 0 ? '0' : $begin_pos));
2302
+        }else{
2303
+            $this->addDebugLog('please choose a limit between 1 and 100');
2304
+            $this->generateOutput(false, array('Error: please choose a limit between 1 and 100'), false);
2305
+        }
2306
+    }
2307
+
2308
+/**
2309
+ * permIdGetByName
2310
+ * 
2311
+ * Displays the database ID of one or more permissions specified by permsid.
2312
+ *
2313
+ * <b>Input-Array like this:</b>
2314
+ * <pre>
2315
+ * $permissions = array();
2316
+ * $permissions[] = 'permissionName';
2317
+ * </pre>
2318
+ * <b>Output:</b>
2319
+ * <pre>
2320
+ * Array
2321
+ * {
2322
+ *  [permsid] => b_serverinstance_help_view
2323
+ *  [permid] => 4353
2324
+ * }
2325
+ * </pre>
2326
+ *
2327
+ * @author     Par0noid Solutions
2328
+ * @param		string	$permsids		permNames
2329
+ * @return     array	permissionList 
2330
+ */
2331
+    function permIdGetByName($permsids) {
2332
+        $permissionArray = array();
2333
+		
2334
+        if(count($permsids) > 0) {
2335
+            foreach($permsids AS $value) {
2336
+                $permissionArray[] = 'permsid='.$value;
2337
+            }
2338
+            return $this->getData('multi', 'permidgetbyname '.$this->escapeText(implode('|', $permissionArray)));
2339
+        }else{
2340
+            $this->addDebugLog('no permissions given');
2341
+            return $this->generateOutput(false, array('Error: no permissions given'), false);
2342
+        }
2343
+		
2344
+    }
2345
+
2346
+
2347
+/**
2348
+ * permissionList
2349
+ * 
2350
+ * Displays a list of permissions available on the server instance including ID, name and description.
2351
+ * If the new parameter is set the permissionlist will return with the new output format.
2352
+ *
2353
+ * <b>Output: (with new parameter)</b>
2354
+ * <pre>
2355
+ * [0] => Array
2356
+ *     (
2357
+ *         [num] => 1
2358
+ *         [group_id_end] => 0
2359
+ *         [pcount] => 0
2360
+ *     )
2361
+ *
2362
+ * [1] => Array
2363
+ *     (
2364
+ *         [num] => 2
2365
+ *         [group_id_end] => 7
2366
+ *         [pcount] => 7
2367
+ *         [permissions] => Array
2368
+ *             (
2369
+ *                 [0] => Array
2370
+ *                     (
2371
+ *                         [permid] => 1
2372
+ *                         [permname] => b_serverinstance_help_view
2373
+ *                         [permdesc] => Retrieve information about ServerQuery commands
2374
+ *                         [grantpermid] => 32769
2375
+ *                     )
2376
+ *
2377
+ *                 [1] => Array
2378
+ *                     (
2379
+ *                         [permid] => 2
2380
+ *                         [permname] => b_serverinstance_version_view
2381
+ *                         [permdesc] => Retrieve global server version (including platform and build number)
2382
+ *                         [grantpermid] => 32770
2383
+ *                     )
2384
+ *
2385
+ *                 [2] => Array
2386
+ *                     (
2387
+ *                         [permid] => 3
2388
+ *                         [permname] => b_serverinstance_info_view
2389
+ *                         [permdesc] => Retrieve global server information
2390
+ *                         [grantpermid] => 32771
2391
+ *                     )
2392
+ *
2393
+ *                 [3] => Array
2394
+ *                     (
2395
+ *                         [permid] => 4
2396
+ *                         [permname] => b_serverinstance_virtualserver_list
2397
+ *                         [permdesc] => List virtual servers stored in the database
2398
+ *                         [grantpermid] => 32772
2399
+ *                     )
2400
+ *
2401
+ *                 [4] => Array
2402
+ *                     (
2403
+ *                         [permid] => 5
2404
+ *                         [permname] => b_serverinstance_binding_list
2405
+ *                         [permdesc] => List active IP bindings on multi-homed machines
2406
+ *                         [grantpermid] => 32773
2407
+ *                     )
2408
+ *
2409
+ *                [5] => Array
2410
+ *                     (
2411
+ *                         [permid] => 6
2412
+ *                         [permname] => b_serverinstance_permission_list
2413
+ *                         [permdesc] => List permissions available available on the server instance
2414
+ *                         [grantpermid] => 32774
2415
+ *                     )
2416
+ *
2417
+ *                 [6] => Array
2418
+ *                     (
2419
+ *                         [permid] => 7
2420
+ *                         [permname] => b_serverinstance_permission_find
2421
+ *                         [permdesc] => Search permission assignments by name or ID
2422
+ *                         [grantpermid] => 32775
2423
+ *                     )
2424
+ *
2425
+ *             )
2426
+ *
2427
+ *     )
2428
+ * </pre>
2429
+ *
2430
+ * @author     Par0noid Solutions
2431
+ * @param		boolean		$new		[optional] add new parameter
2432
+ * @return     array permissionList
2433
+ */
2434
+    function permissionList($new = false) {
2435
+        if($new === true) {
2436
+            $groups = array();
2437
+            $permissions = array();
2438
+			
2439
+            $response = $this->getElement('data', $this->getData('multi', 'permissionlist -new'));
2440
+			
2441
+            $gc = 1;
2442
+			
2443
+            foreach($response as $field) {
2444
+                if(isset($field['group_id_end'])) {
2445
+                    $groups[] = array('num' => $gc, 'group_id_end' => $field['group_id_end']);
2446
+                    $gc++;
2447
+                }else{
2448
+                    $permissions[] = $field;
2449
+                }
2450
+            }
2451
+			
2452
+            $counter = 0;
2453
+			
2454
+            for($i = 0; $i < count($groups); $i++) {
2455
+                $rounds = $groups[$i]['group_id_end'] - $counter;
2456
+                $groups[$i]['pcount'] = $rounds;
2457
+                for($j = 0; $j < $rounds; $j++) {
2458
+                    $groups[$i]['permissions'][] = array('permid' => ($counter + 1), 'permname' => $permissions[$counter]['permname'], 'permdesc' => $permissions[$counter]['permdesc'], 'grantpermid' => ($counter + 32769));
2459
+                    $counter++;
2460
+                }
2461
+            }
2462
+			
2463
+            return $groups;
2464
+			
2465
+        }else{
2466
+            return $this->getData('multi', 'permissionlist');
2467
+        }
2468
+    }
2469
+
2470
+/**
2471
+ * permOverview
2472
+ * 
2473
+ * Displays all permissions assigned to a client for the channel specified with cid. If permid is set to 0, all permissions will be displayed. A permission can be specified by permid or permsid.
2474
+ *
2475
+ * <b>Output:</b>
2476
+ * <pre>
2477
+ * Array
2478
+ * {
2479
+ *  [t] => 0
2480
+ *  [id1] => 2
2481
+ *  [id2] => 0
2482
+ *  [p] => 16777
2483
+ *  [v] => 1
2484
+ *  [n] => 0
2485
+ *  [s] => 0
2486
+ * }
2487
+ * </pre>
2488
+ *
2489
+ * @author     Par0noid Solutions
2490
+ * @param		integer		$cid		cchannelId
2491
+ * @param		integer 	$cldbid		clientDbId
2492
+ * @param		integer 	$permid		permId (Default: 0)
2493
+ * @param		string	 	$permsid	permName
2494
+ * @return     array permOverview
2495
+ */
2496
+    function permOverview($cid, $cldbid, $permid='0', $permsid=false ) { 
2497
+        if(!$this->runtime['selected']) { return $this->checkSelected(); } 
2498
+        if($permsid) { $additional = ' permsid='.$permsid; }else{ $additional = ''; } 
2499
+         
2500
+        return $this->getData('multi', 'permoverview cid='.$cid.' cldbid='.$cldbid.' permid='.$permid.$additional); 
2501
+    }
2502
+ 
2503
+/**
2504
+ * quit closes the connection to host 
2505
+ *
2506
+ * @author     Par0noid Solutions
2507
+ * @return 	none
2508
+ */
2509
+    private function quit() {
2510
+        $this->logout();
2511
+        @fputs($this->runtime['socket'], "quit\n");
2512
+        @fclose($this->runtime['socket']);
2513
+    }
2514
+
2515
+/**
2516
+ * selectServer
2517
+ * 
2518
+ * Selects the virtual server specified with sid or port to allow further interaction. The ServerQuery client will appear on the virtual server and acts like a real TeamSpeak 3 Client, except it's unable to send or receive voice data. If your database contains multiple virtual servers using the same UDP port, use will select a random virtual server using the specified port.
2519
+ *
2520
+ * @author     Par0noid Solutions
2521
+ * @param		integer	$value		Port or ID
2522
+ * @param		string	$type		value type ('port', 'serverId') (default='port')
2523
+ * @param		boolean	$virtual	set true to add -virtual param [optional]
2524
+ * @return     boolean success
2525
+ */
2526
+    function selectServer($value, $type = 'port', $virtual = false) { 
2527
+        if(in_array($type, array('port', 'serverId'))) { 
2528
+            if($type == 'port') { 
2529
+                if($virtual) { $virtual = ' -virtual'; }else{ $virtual = ''; } 
2530
+                $res = $this->getData('boolean', 'use port='.$value.$virtual); 
2531
+                if($res['success']) { 
2532
+                    $this->runtime['selected'] = true; 
2533
+                } 
2534
+                return $res; 
2535
+            }else{ 
2536
+                if($virtual) { $virtual = ' -virtual'; }else{ $virtual = ''; } 
2537
+                $res = $this->getData('boolean', 'use sid='.$value.$virtual); 
2538
+                if($res['success']) { 
2539
+                    $this->runtime['selected'] = true; 
2540
+                } 
2541
+                return $res; 
2542
+            } 
2543
+        }else{ 
2544
+            $this->addDebugLog('wrong value type'); 
2545
+            return $this->generateOutput(false, array('Error: wrong value type'), false); 
2546
+        } 
2547
+    }
2548
+
2549
+/**
2550
+ * sendMessage
2551
+ * 
2552
+ * Sends a text message a specified target. The type of the target is determined by targetmode while target specifies the ID of the recipient, whether it be a virtual server, a channel or a client.
2553
+ * <b>Hint:</b> You can just write to the channel the query client is in. See link in description for details.
2554
+ *
2555
+ * <b>Modes:</b>
2556
+ * <ul>
2557
+ * 	<li><b>1:</b> send to client</li>
2558
+ * 	<li><b>2:</b> send to channel</li>
2559
+ * 	<li><b>3:</b> send to server</li>
2560
+ * </ul>
2561
+ * <b>Targets:</b>
2562
+ * <ul>
2563
+ * 	<li>clientID</li>
2564
+ * 	<li>channelID</li>
2565
+ * 	<li>serverID</li>
2566
+ * </ul>
2567
+ *
2568
+ * @author     Par0noid Solutions
2569
+ * @param		integer $mode
2570
+ * @param		integer $target
2571
+ * @param		string	$msg	Message
2572
+ * @see		http://forum.teamspeak.com/showthread.php/84280-Sendtextmessage-by-query-client http://forum.teamspeak.com/showthread.php/84280-Sendtextmessage-by-query-client
2573
+ * @return     boolean	success
2574
+ */
2575
+    function sendMessage($mode, $target, $msg) {
2576
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2577
+        return $this->getData('boolean', 'sendtextmessage targetmode='.$mode.' target='.$target.' msg='.$this->escapeText($msg));
2578
+    }
2579
+
2580
+/**
2581
+ * serverCreate
2582
+ * 
2583
+ * Creates a new virtual server using the given properties and displays its ID, port and initial administrator privilege key. If virtualserver_port is not specified, the server will test for the first unused UDP port. The first virtual server will be running on UDP port 9987 by default. Subsequently started virtual servers will be running on increasing UDP port numbers.
2584
+ * 
2585
+ * <b>Input-Array like this:</b>
2586
+ * <pre>
2587
+ * $data = array();
2588
+ *	
2589
+ * $data['setting'] = 'value';
2590
+ * $data['setting'] = 'value';
2591
+ * </pre>
2592
+ *
2593
+ * <b>Output:</b>
2594
+ * <pre>
2595
+ * Array
2596
+ * {
2597
+ *  [sid] => 2
2598
+ *  [virtualserver_port] => 9988
2599
+ *  [token] => eKnFZQ9EK7G7MhtuQB6+N2B1PNZZ6OZL3ycDp2OW
2600
+ * }
2601
+ * </pre>
2602
+ *
2603
+ * @author     Par0noid Solutions
2604
+ * @param		array	$data	serverSettings	[optional]
2605
+ * @return     array serverInfo
2606
+ */
2607
+    function serverCreate($data = array()) {
2608
+        $settingsString = '';
2609
+		
2610
+        if(count($data) == 0) {	$data['virtualserver_name'] = 'Teamspeak 3 Server'; }
2611
+		
2612
+		
2613
+        foreach($data as $key => $value) {
2614
+            if(!empty($value)) { $settingsString .= ' '.$key.'='.$this->escapeText($value); }
2615
+        }
2616
+		
2617
+        return $this->getData('array', 'servercreate'.$settingsString);
2618
+    }
2619
+
2620
+/**
2621
+ * serverDelete
2622
+ * 
2623
+ * Deletes the virtual server specified with sid. Please note that only virtual servers in stopped state can be deleted.
2624
+ *
2625
+ * @author     Par0noid Solutions
2626
+ * @param		integer	$sid	serverID
2627
+ * @return     boolean success
2628
+ */
2629
+    function serverDelete($sid) {
2630
+        $this->serverStop($sid);
2631
+        return $this->getdata('boolean', 'serverdelete sid='.$sid);
2632
+    }
2633
+
2634
+/**
2635
+ * serverEdit
2636
+ * 
2637
+ * Changes the selected virtual servers configuration using given properties. Note that this command accepts multiple properties which means that you're able to change all settings of the selected virtual server at once.
2638
+ *
2639
+ * <b>Input-Array like this:</b>
2640
+ * <pre>
2641
+ * $data = array();
2642
+ *	
2643
+ * $data['setting'] = 'value';
2644
+ * $data['setting'] = 'value';
2645
+ * </pre>
2646
+ *
2647
+ * @author     Par0noid Solutions
2648
+ * @param		array	$data	serverSettings
2649
+ * @return     boolean success
2650
+ */
2651
+    function serverEdit($data) {
2652
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2653
+		
2654
+        $settingsString = '';
2655
+		
2656
+        foreach($data as $key => $value) {
2657
+            $settingsString .= ' '.$key.'='.$this->escapeText($value);
2658
+        }
2659
+		
2660
+        return $this->getData('boolean', 'serveredit'.$settingsString);
2661
+    }
2662
+
2663
+/**
2664
+ * serverGroupAdd
2665
+ * 
2666
+ * Creates a new server group using the name specified with name and displays its ID. The optional type parameter can be used to create ServerQuery groups and template groups. For detailed information, see
2667
+ *
2668
+ * <b>Output:</b>
2669
+ * <pre>
2670
+ * Array
2671
+ * {
2672
+ *  [sgid] => 86
2673
+ * }
2674
+ * </pre>
2675
+ *
2676
+ * @author     Par0noid Solutions
2677
+ * @param		integer $name	groupName
2678
+ * @param		integer	$type	groupDbType (0 = template, 1 = normal, 2 = query | Default: 1)
2679
+ * @return     array groupId
2680
+ */
2681
+    function serverGroupAdd($name, $type = 1) {
2682
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2683
+        return $this->getData('array', 'servergroupadd name='.$this->escapeText($name).' type='.$type);
2684
+    }
2685
+
2686
+/**
2687
+ * serverGroupAddClient
2688
+ * 
2689
+ * Adds a client to the server group specified with sgid. Please note that a client cannot be added to default groups or template groups.
2690
+ *
2691
+ * @author     Par0noid Solutions
2692
+ * @param		integer $sgid	serverGroupId
2693
+ * @param		integer $cldbid	clientDBID
2694
+ * @return     boolean success
2695
+ */
2696
+    function serverGroupAddClient($sgid, $cldbid) {
2697
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2698
+        return $this->getData('boolean', 'servergroupaddclient sgid='.$sgid.' cldbid='.$cldbid);
2699
+    }
2700
+
2701
+/**
2702
+ * serverGroupAddPerm
2703
+ * 
2704
+ * Adds a set of specified permissions to the server group specified with sgid. Multiple permissions can be added by providing the four parameters of each permission. A permission can be specified by permid or permsid.
2705
+ *
2706
+ * <b>Input-Array like this:</b>
2707
+ * <pre>
2708
+ * $permissions = array();
2709
+ * $permissions['permissionID'] = array('permissionValue', 'permskip', 'permnegated');
2710
+ * //or you could use
2711
+ * $permissions['permissionName'] = array('permissionValue', 'permskip', 'permnegated');
2712
+ * </pre>
2713
+ * 
2714
+ * @author     Par0noid Solutions
2715
+ * @param		integer $sgid	groupID
2716
+ * @param		array	$permissions	permissions
2717
+ * @return     boolean success
2718
+ */
2719
+    function serverGroupAddPerm($sgid, $permissions) {
2720
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2721
+		
2722
+        if(count($permissions) > 0) {
2723
+            //Permissions given
2724
+				
2725
+            //Errorcollector
2726
+            $errors = array();
2727
+				
2728
+            //Split Permissions to prevent query from overload
2729
+            $permissions = array_chunk($permissions, 50, true);
2730
+				
2731
+            //Action for each splitted part of permission
2732
+            foreach($permissions as $permission_part)
2733
+            {
2734
+                //Create command_string for each command that we could use implode later
2735
+                $command_string = array();
2736
+		
2737
+                foreach($permission_part as $key => $value)
2738
+                {
2739
+                    $command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value[0].' permskip='.$value[1].' permnegated='.$value[2];
2740
+                }
2741
+		
2742
+                $result = $this->getData('boolean', 'servergroupaddperm sgid='.$sgid.' '.implode('|', $command_string));
2743
+		
2744
+                if(!$result['success'])
2745
+                {
2746
+                    foreach($result['errors'] as $error)
2747
+                    {
2748
+                        $errors[] = $error;
2749
+                    }
2750
+                }
2751
+            }
2752
+				
2753
+            if(count($errors) == 0)
2754
+            {
2755
+                return $this->generateOutput(true, array(), true);
2756
+            }else{
2757
+                return $this->generateOutput(false, $errors, false);
2758
+            }
2759
+				
2760
+        }else{
2761
+            // No permissions given
2762
+            $this->addDebugLog('no permissions given');
2763
+            return $this->generateOutput(false, array('Error: no permissions given'), false);
2764
+        }
2765
+        /*
2766
+		old code
2767
+		
2768
+        $error = false;
2769
+        $results = array();
2770
+        
2771
+        if(count($permissions) > 0) {
2772
+     		$new = array();
2773
+ 
2774
+    		$i = 0;
2775
+    		$k = 0;
2776
+    		foreach($permissions as $ke => $va) {
2777
+        		if($i > 149){ $i = 0; $k++; }else{ $i++; }
2778
+        		$new[$k][$ke] = $va;
2779
+    		}
2780
+    		
2781
+    		foreach($new as $perms) {
2782
+    			$permissionArray = array();
2783
+    			foreach($perms as $key => $value) {
2784
+    				$permissionArray[] = 'permid='.$key.' permvalue='.$value[0].' permskip='.$value[1].' permnegated='.$value[2];
2785
+    			}
2786
+				$result = $this->getData('boolean', 'servergroupaddperm sgid='.$sgid.' '.implode('|', $permissionArray));
2787
+				if(!$result['success']) { $error = true; }
2788
+    			$results[] = $result;
2789
+    		}
2790
+    		
2791
+    		if($error) {
2792
+    			$returnErrors = array();
2793
+    			foreach($results as $errorResult) {
2794
+    				if(count($errorResult['errors']) > 0) {
2795
+    					foreach($errorResult['errors'] as $errorResultError) {
2796
+    						$returnErrors[] = $errorResultError;
2797
+    					}
2798
+    				}
2799
+    			}
2800
+    			return $this->generateOutput(false, $returnErrors, false);
2801
+    		}else{
2802
+    			return $this->generateOutput(true, array(), true);
2803
+    		}
2804
+        }else{
2805
+            $this->addDebugLog('no permissions given');
2806
+            return $this->generateOutput(false, array('Error: no permissions given'), false);
2807
+        }*/
2808
+		
2809
+    }
2810
+
2811
+/**
2812
+ * serverGroupClientList
2813
+ * 
2814
+ * Displays the IDs of all clients currently residing in the server group specified with sgid. If you're using the optional -names option, the output will also contain the last known nickname and the unique identifier of the clients.
2815
+ *
2816
+ * <b>Possible params:</b> -names
2817
+ *
2818
+ * <b>Output: (with -names param)</b>
2819
+ * <pre>
2820
+ * Array
2821
+ * {
2822
+ *  [cldbid] => 2017
2823
+ *  [client_nickname] => Par0noid //with -names parameter
2824
+ *  [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
2825
+ * }
2826
+ * </pre>
2827
+ *
2828
+ * @author     Par0noid Solutions
2829
+ * @param		integer	$sgid		groupId
2830
+ * @param		boolean	$names		set true to add -names param [optional]
2831
+ * @return     multidimensional-array	serverGroupClientList
2832
+ */
2833
+    function serverGroupClientList($sgid, $names = false) {
2834
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2835
+        if($names) { $names = ' -names'; }else{ $names = ''; }
2836
+        return $this->getData('multi', 'servergroupclientlist sgid='.$sgid.$names);
2837
+    }
2838
+
2839
+/**
2840
+ * serverGroupCopy
2841
+ * 
2842
+ * Creates a copy of the server group specified with ssgid. If tsgid is set to 0, the server will create a new group. To overwrite an existing group, simply set tsgid to the ID of a designated target group. If a target group is set, the name parameter will be ignored.
2843
+ *
2844
+ * <b>Output:</b>
2845
+ * <pre>
2846
+ * Array
2847
+ * {
2848
+ *  [sgid] => 86
2849
+ * }
2850
+ * </pre>
2851
+ *
2852
+ * @author     Par0noid Solutions
2853
+ * @param		integer	$ssgid	sourceGroupID
2854
+ * @param		integer	$tsgid	targetGroupID
2855
+ * @param		integer $name	groupName
2856
+ * @param		integer	$type	groupDbType (0 = template, 1 = normal, 2 = query | Default: 1)
2857
+ * @return     array groupId
2858
+ */
2859
+    function serverGroupCopy($ssgid, $tsgid, $name, $type = 1) {
2860
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2861
+        return $this->getData('array', 'servergroupcopy ssgid='.$ssgid.' tsgid='.$tsgid.' name='.$this->escapeText($name).' type='.$type);
2862
+    }
2863
+
2864
+/**
2865
+ * serverGroupDelete
2866
+ * 
2867
+ * 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.
2868
+ *
2869
+ * @author     Par0noid Solutions
2870
+ * @param		integer $sgid	serverGroupID
2871
+ * @param		integer $force 	forces deleting group (Default: 1)
2872
+ * @return     boolean success
2873
+ */
2874
+    function serverGroupDelete($sgid, $force = 1) {
2875
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2876
+        return $this->getData('boolean', 'servergroupdel sgid='.$sgid.' force='.$force);
2877
+    }
2878
+
2879
+/**
2880
+ * serverGroupDeleteClient
2881
+ * 
2882
+ * Removes a client specified with cldbid from the server group specified with sgid.
2883
+ *
2884
+ * @author     Par0noid Solutions
2885
+ * @param		integer $sgid	groupID
2886
+ * @param		integer $cldbid	clientDBID
2887
+ * @return     boolean success
2888
+ */
2889
+    function serverGroupDeleteClient($sgid, $cldbid) {
2890
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2891
+        return $this->getData('boolean', 'servergroupdelclient sgid='.$sgid.' cldbid='.$cldbid);
2892
+    }
2893
+
2894
+/**
2895
+ * serverGroupDeletePerm
2896
+ * 
2897
+ * Removes a set of specified permissions from the server group specified with sgid. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.
2898
+ *
2899
+ * <b>Input-Array like this:</b>
2900
+ * <pre>
2901
+ * $permissions = array();
2902
+ * $permissions[] = 'permissionID';
2903
+ * //or you could use
2904
+ * $permissions[] = 'permissionName';
2905
+ * </pre>
2906
+ *
2907
+ * @author     Par0noid Solutions
2908
+ * @param		integer		$sgid				serverGroupID
2909
+ * @param		array		$permissionIds		permissionIds
2910
+ * @return     boolean success
2911
+ */
2912
+    function serverGroupDeletePerm($sgid, $permissionIds) {
2913
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2914
+        $permissionArray = array();
2915
+		
2916
+        if(count($permissionIds) > 0) {
2917
+            foreach($permissionIds AS $value) {
2918
+                $permissionArray[] = is_numeric($value) ? 'permid='.$value : 'permsid='.$this->escapeText($value);
2919
+            }
2920
+            return $this->getData('boolean', 'servergroupdelperm sgid='.$sgid.' '.implode('|', $permissionArray));
2921
+        }else{
2922
+            $this->addDebugLog('no permissions given');
2923
+            return $this->generateOutput(false, array('Error: no permissions given'), false);
2924
+        }
2925
+    }
2926
+
2927
+/**
2928
+ * serverGroupList
2929
+ * 
2930
+ * Displays a list of server groups available. Depending on your permissions, the output may also contain global ServerQuery groups and template groups.
2931
+ *
2932
+ * <b>Output:</b>
2933
+ * <pre>
2934
+ * Array
2935
+ * {
2936
+ *  [sgid] => 1
2937
+ *  [name] => Guest Server Query
2938
+ *  [type] => 2
2939
+ *  [iconid] => 0
2940
+ *  [savedb] => 0
2941
+ * }
2942
+ * </pre>
2943
+ *
2944
+ * @author     Par0noid Solutions
2945
+ * @return     array serverGroupList
2946
+ */
2947
+    function serverGroupList() {
2948
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2949
+        return $this->getData('multi', 'servergrouplist');
2950
+    }
2951
+
2952
+/**
2953
+ * serverGroupPermList
2954
+ * 
2955
+ * Displays a list of permissions assigned to the server group specified with sgid. If the permsid option is specified, the output will contain the permission names instead of the internal IDs.
2956
+ *
2957
+ * <b>Output:</b>
2958
+ * <pre>
2959
+ * Array
2960
+ * {
2961
+ *  [permid] => 12876 (if permsid = false)
2962
+ *  [permsid] => b_client_info_view (if permsid = true)
2963
+ *  [permvalue] => 1
2964
+ *  [permnegated] => 0
2965
+ *  [permskip] => 0
2966
+ * }
2967
+ * </pre>
2968
+ *
2969
+ * @author     Par0noid Solutions
2970
+ * @param		integer	$sgid		serverGroupID
2971
+ * @param		boolean	$permsid	set true to add -permsid param [optional]
2972
+ * @return     array serverGroupPermList
2973
+ */
2974
+    function serverGroupPermList($sgid, $permsid = false) {
2975
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2976
+        if($permsid) { $additional = ' -permsid'; }else{ $additional = ''; }
2977
+        return $this->getData('multi', 'servergrouppermlist sgid='.$sgid.$additional);
2978
+    }
2979
+
2980
+/**
2981
+ * serverGroupRename
2982
+ * 
2983
+ * Changes the name of the server group specified with sgid.
2984
+ *
2985
+ * @author     Par0noid Solutions
2986
+ * @param		integer $sgid	serverGroupID
2987
+ * @param		integer $name	groupName
2988
+ * @return     boolean success
2989
+ */
2990
+    function serverGroupRename($sgid, $name) {
2991
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
2992
+        return $this->getData('boolean', 'servergrouprename sgid='.$sgid.' name='.$this->escapeText($name));
2993
+    }
2994
+
2995
+/**
2996
+ * serverGroupsByClientID
2997
+ * 
2998
+ * Displays all server groups the client specified with cldbid is currently residing in.
2999
+ *
3000
+ * <b>Output:</b>
3001
+ * <pre>
3002
+ * Array
3003
+ * {
3004
+ *  [name] => Guest
3005
+ *  [sgid] => 73
3006
+ *  [cldbid] => 2
3007
+ * }
3008
+ * </pre>
3009
+ *
3010
+ * @author     Par0noid Solutions
3011
+ * @param		integer	$cldbid	clientDBID
3012
+ * @return     array serverGroupsByClientId
3013
+ */
3014
+    function serverGroupsByClientID($cldbid) {
3015
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
3016
+        return $this->getData('multi', 'servergroupsbyclientid cldbid='.$cldbid);
3017
+    }
3018
+
3019
+/**
3020
+ * serverIdGetByPort
3021
+ * 
3022
+ * Displays the database ID of the virtual server running on the UDP port specified by virtualserver_port.
3023
+ * 
3024
+ * <b>Output:</b>
3025
+ * <pre>
3026
+ * Array
3027
+ * {
3028
+ *  [server_id] => 1
3029
+ * }
3030
+ * </pre>
3031
+ *
3032
+ * @author     Par0noid Solutions
3033
+ * @param		integer $port	serverPort
3034
+ * @return     array serverInfo
3035
+ */
3036
+    function serverIdGetByPort($port) {
3037
+        return $this->getData('array', 'serveridgetbyport virtualserver_port='.$port);
3038
+    }
3039
+
3040
+/**
3041
+ * serverInfo
3042
+ * 
3043
+ * Displays detailed configuration information about the selected virtual server including unique ID, number of clients online, configuration, etc.
3044
+ *	
3045
+ * <b>Output:</b>
3046
+ * <pre>
3047
+ * Array
3048
+ * {
3049
+ *  [virtualserver_unique_identifier] => 2T3SRCPoWKojKlNMx6qxV7gOe8A=
3050
+ *  [virtualserver_name] => TeamSpeak ]I[ Server
3051
+ *  [virtualserver_welcomemessage] => Welcome to TeamSpeak
3052
+ *  [virtualserver_platform] => Windows
3053
+ *  [virtualserver_version] => 3.0.6.1 [Build: 1340956745]
3054
+ *  [virtualserver_maxclients] => 32
3055
+ *  [virtualserver_password] => 
3056
+ *  [virtualserver_clientsonline] => 2
3057
+ *  [virtualserver_channelsonline] => 2
3058
+ *  [virtualserver_created] => 1361027787
3059
+ *  [virtualserver_uptime] => 2804
3060
+ *  [virtualserver_codec_encryption_mode] => 0
3061
+ *  [virtualserver_hostmessage] => 
3062
+ *  [virtualserver_hostmessage_mode] => 0
3063
+ *  [virtualserver_filebase] => files\\virtualserver_1
3064
+ *  [virtualserver_default_server_group] => 8
3065
+ *  [virtualserver_default_channel_group] => 8
3066
+ *  [virtualserver_flag_password] => 0
3067
+ *  [virtualserver_default_channel_admin_group] => 5
3068
+ *  [virtualserver_max_download_total_bandwidth] => 18446744073709551615
3069
+ *  [virtualserver_max_upload_total_bandwidth] => 18446744073709551615
3070
+ *  [virtualserver_hostbanner_url] => 
3071
+ *  [virtualserver_hostbanner_gfx_url] => 
3072
+ *  [virtualserver_hostbanner_gfx_interval] => 0
3073
+ *  [virtualserver_complain_autoban_count] => 5
3074
+ *  [virtualserver_complain_autoban_time] => 1200
3075
+ *  [virtualserver_complain_remove_time] => 3600
3076
+ *  [virtualserver_min_clients_in_channel_before_forced_silence] => 100
3077
+ *  [virtualserver_priority_speaker_dimm_modificator] => -18.0000
3078
+ *  [virtualserver_id] => 1
3079
+ *  [virtualserver_antiflood_points_tick_reduce] => 5
3080
+ *  [virtualserver_antiflood_points_needed_command_block] => 150
3081
+ *  [virtualserver_antiflood_points_needed_ip_block] => 250
3082
+ *  [virtualserver_client_connections] => 1
3083
+ *  [virtualserver_query_client_connections] => 6
3084
+ *  [virtualserver_hostbutton_tooltip] => 
3085
+ *  [virtualserver_hostbutton_url] => 
3086
+ *  [virtualserver_hostbutton_gfx_url] => 
3087
+ *  [virtualserver_queryclientsonline] => 1
3088
+ *  [virtualserver_download_quota] => 18446744073709551615
3089
+ *  [virtualserver_upload_quota] => 18446744073709551615
3090
+ *  [virtualserver_month_bytes_downloaded] => 0
3091
+ *  [virtualserver_month_bytes_uploaded] => 0
3092
+ *  [virtualserver_total_bytes_downloaded] => 0
3093
+ *  [virtualserver_total_bytes_uploaded] => 0
3094
+ *  [virtualserver_port] => 9987
3095
+ *  [virtualserver_autostart] => 1
3096
+ *  [virtualserver_machine_id] => 
3097
+ *  [virtualserver_needed_identity_security_level] => 8
3098
+ *  [virtualserver_log_client] => 0
3099
+ *  [virtualserver_log_query] => 0
3100
+ *  [virtualserver_log_channel] => 0
3101
+ *  [virtualserver_log_permissions] => 1
3102
+ *  [virtualserver_log_server] => 0
3103
+ *  [virtualserver_log_filetransfer] => 0
3104
+ *  [virtualserver_min_client_version] => 12369
3105
+ *  [virtualserver_name_phonetic] => 
3106
+ *  [virtualserver_icon_id] => 0
3107
+ *  [virtualserver_reserved_slots] => 0
3108
+ *  [virtualserver_total_packetloss_speech] => 0.0000
3109
+ *  [virtualserver_total_packetloss_keepalive] => 0.0000
3110
+ *  [virtualserver_total_packetloss_control] => 0.0000
3111
+ *  [virtualserver_total_packetloss_total] => 0.0000
3112
+ *  [virtualserver_total_ping] => 0.0000
3113
+ *  [virtualserver_ip] => 
3114
+ *  [virtualserver_weblist_enabled] => 1
3115
+ *  [virtualserver_ask_for_privilegekey] => 0
3116
+ *  [virtualserver_hostbanner_mode] => 0
3117
+ *  [virtualserver_status] => online
3118
+ *  [connection_filetransfer_bandwidth_sent] => 0
3119
+ *  [connection_filetransfer_bandwidth_received] => 0
3120
+ *  [connection_filetransfer_bytes_sent_total] => 0
3121
+ *  [connection_filetransfer_bytes_received_total] => 0
3122
+ *  [connection_packets_sent_speech] => 0
3123
+ *  [connection_bytes_sent_speech] => 0
3124
+ *  [connection_packets_received_speech] => 0
3125
+ *  [connection_bytes_received_speech] => 0
3126
+ *  [connection_packets_sent_keepalive] => 2055
3127
+ *  [connection_bytes_sent_keepalive] => 84255
3128
+ *  [connection_packets_received_keepalive] => 2055
3129
+ *  [connection_bytes_received_keepalive] => 86309
3130
+ *  [connection_packets_sent_control] => 90
3131
+ *  [connection_bytes_sent_control] => 13343
3132
+ *  [connection_packets_received_control] => 90
3133
+ *  [connection_bytes_received_control] => 9176
3134
+ *  [connection_packets_sent_total] => 2145
3135
+ *  [connection_bytes_sent_total] => 97598
3136
+ *  [connection_packets_received_total] => 2145
3137
+ *  [connection_bytes_received_total] => 95485
3138
+ *  [connection_bandwidth_sent_last_second_total] => 82
3139
+ *  [connection_bandwidth_sent_last_minute_total] => 81
3140
+ *  [connection_bandwidth_received_last_second_total] => 84
3141
+ *  [connection_bandwidth_received_last_minute_total] => 87
3142
+ * }
3143
+ * </pre>
3144
+ *
3145
+ * @author     Par0noid Solutions
3146
+ * @return     array serverInformation
3147
+ */
3148
+    function serverInfo() {
3149
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
3150
+        return $this->getData('array', 'serverinfo');
3151
+    }
3152
+
3153
+/**
3154
+ * serverList
3155
+ * 
3156
+ * Displays a list of virtual servers including their ID, status, number of clients online, etc. If you're using the -all option, the server will list all virtual servers stored in the database. This can be useful when multiple server instances with different machine IDs are using the same database. The machine ID is used to identify the server instance a virtual server is associated with. The status of a virtual server can be either online, offline, deploy running, booting up, shutting down and virtual online. While most of them are self-explanatory, virtual online is a bit more complicated. Please note that whenever you select a virtual server which is currently stopped, it will be started in virtual mode which means you are able to change its configuration, create channels or change permissions, but no regular TeamSpeak 3 Client can connect. As soon as the last ServerQuery client deselects the virtual server, its status will be changed back to offline.
3157
+ *
3158
+ * <b>Possible params:</b> [-uid] [-short] [-all] [-onlyoffline]
3159
+ *
3160
+ * <b>Output:</b>
3161
+ * <pre>
3162
+ * Array
3163
+ * {
3164
+ *  [virtualserver_id] => 1 //displayed on -short
3165
+ *  [virtualserver_port] => 9987 //displayed on -short
3166
+ *  [virtualserver_status] => online //displayed on -short
3167
+ *  [virtualserver_clientsonline] => 2
3168
+ *  [virtualserver_queryclientsonline] => 1
3169
+ *  [virtualserver_maxclients] => 32
3170
+ *  [virtualserver_uptime] => 3045
3171
+ *  [virtualserver_name] => TeamSpeak ]I[ Server
3172
+ *  [virtualserver_autostart] => 1
3173
+ *  [virtualserver_machine_id] =>
3174
+ *  [-uid] => [virtualserver_unique_identifier] => bYrybKl/APfKq7xzpIJ1Xb6C06U= 
3175
+ * }
3176
+ * </pre>
3177
+ *
3178
+ * @author     Par0noid Solutions
3179
+ * @param		string		$options		optional parameters
3180
+ * @return     array serverList
3181
+ */
3182
+    function serverList($options = NULL) {
3183
+        return $this->getData('multi', 'serverlist'.(!empty($options) ? ' '.$options : ''));
3184
+    }
3185
+
3186
+/**
3187
+ * serverProcessStop
3188
+ * 
3189
+ * Stops the entire TeamSpeak 3 Server instance by shutting down the process.
3190
+ *
3191
+ * @author     Par0noid Solutions
3192
+ * @return     boolean success
3193
+ */
3194
+    function serverProcessStop() {
3195
+        return $this->getData('boolean', 'serverprocessstop');
3196
+    }
3197
+
3198
+/**
3199
+ * serverRequestConnectionInfo
3200
+ * 
3201
+ * Displays detailed connection information about the selected virtual server including uptime, traffic information, etc.
3202
+ *
3203
+ * <b>Output:</b>
3204
+ * <pre>
3205
+ * Array
3206
+ * {
3207
+ *  [connection_filetransfer_bandwidth_sent] => 0
3208
+ *  [connection_filetransfer_bandwidth_received] => 0
3209
+ *  [connection_filetransfer_bytes_sent_total] => 0
3210
+ *  [connection_filetransfer_bytes_received_total] => 0
3211
+ *  [connection_packets_sent_total] => 3333
3212
+ *  [connection_bytes_sent_total] => 149687
3213
+ *  [connection_packets_received_total] => 3333
3214
+ *  [connection_bytes_received_total] => 147653
3215
+ *  [connection_bandwidth_sent_last_second_total] => 123
3216
+ *  [connection_bandwidth_sent_last_minute_total] => 81
3217
+ *  [connection_bandwidth_received_last_second_total] => 352
3218
+ *  [connection_bandwidth_received_last_minute_total] => 87
3219
+ *  [connection_connected_time] => 3387
3220
+ *  [connection_packetloss_total] => 0.0000
3221
+ *  [connection_ping] => 0.0000
3222
+ * }
3223
+ * </pre>
3224
+ *
3225
+ * @author     Par0noid Solutions
3226
+ * @return     array serverRequestConnectionInfo
3227
+ */
3228
+    function serverRequestConnectionInfo() {
3229
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
3230
+        return $this->getData('array', 'serverrequestconnectioninfo');
3231
+    }
3232
+
3233
+/**
3234
+ * serverSnapshotCreate
3235
+ * 
3236
+ * Displays a snapshot of the selected virtual server containing all settings, groups and known client identities. The data from a server snapshot can be used to restore a virtual servers configuration, channels and permissions using the serversnapshotdeploy command.
3237
+ *
3238
+ * @author     Par0noid Solutions
3239
+ * @return     string snapshot
3240
+ */
3241
+    function serverSnapshotCreate() {
3242
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
3243
+        return $this->getData('plain', 'serversnapshotcreate');
3244
+    }
3245
+
3246
+/**
3247
+ * serverSnapshotDeploy
3248
+ * 
3249
+ * Restores the selected virtual servers configuration using the data from a previously created server snapshot. Please note that the TeamSpeak 3 Server does NOT check for necessary permissions while deploying a snapshot so the command could be abused to gain additional privileges.
3250
+ *
3251
+ * @author     Par0noid Solutions
3252
+ * @param		string	$snapshot	snapshot
3253
+ * @return     boolean success
3254
+ */
3255
+    function serverSnapshotDeploy($snapshot) {
3256
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
3257
+        return $this->getData('boolean', 'serversnapshotdeploy '.$snapshot);
3258
+    }
3259
+	
3260
+/**
3261
+ * serverStart
3262
+ * 
3263
+ * Starts the virtual server specified with sid. Depending on your permissions, you're able to start either your own virtual server only or all virtual servers in the server instance.
3264
+ *
3265
+ * @author     Par0noid Solutions
3266
+ * @param		integer $sid	serverID
3267
+ * @return     boolean success
3268
+ */
3269
+    function serverStart($sid) {
3270
+        return $this->getdata('boolean', 'serverstart sid='.$sid);
3271
+    }	
3272
+
3273
+/**
3274
+ * serverStop
3275
+ * 
3276
+ * Stops the virtual server specified with sid. Depending on your permissions, you're able to stop either your own virtual server only or all virtual servers in the server instance.
3277
+ *
3278
+ * @author     Par0noid Solutions
3279
+ * @param		integer $sid	serverID
3280
+ * @return     boolean success
3281
+ */
3282
+    function serverStop($sid) {
3283
+        return $this->getdata('boolean', 'serverstop sid='.$sid);
3284
+    }
3285
+
3286
+/**
3287
+ * serverTemppasswordAdd
3288
+ * 
3289
+ * Sets a new temporary server password specified with pw. The temporary password will be valid for the number of seconds specified with duration. The client connecting with this password will automatically join the channel specified with tcid. If tcid is set to 0, the client will join the default channel.
3290
+ *
3291
+ * @author     Par0noid Solutions
3292
+ * @param		string	$pw				temporary password
3293
+ * @param		string	$duration		durations in seconds
3294
+ * @param		string	$desc			description [optional]
3295
+ * @param		string	$tcid			cid user enters on connect (0 = Default channel) [optional]
3296
+ * @param		string	$tcpw			channelPW
3297
+ * @return     boolean success
3298
+ */
3299
+    function serverTempPasswordAdd($pw, $duration, $desc = 'none', $tcid = 0, $tcpw = null) {
3300
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
3301
+        return $this->getdata('boolean', 'servertemppasswordadd pw='.$this->escapeText($pw).' desc='.(!empty($desc) ? $this->escapeText($desc) : 'none').' duration='.$duration.' tcid='.$tcid.(!empty($tcpw) ? ' tcpw='.$this->escapeText($tcpw) : ''));
3302
+    }
3303
+
3304
+/**
3305
+ * serverTemppasswordDel
3306
+ * 
3307
+ * Deletes the temporary server password specified with pw.
3308
+ * 
3309
+ * @author     Par0noid Solutions
3310
+ * @param		string	$pw		temporary password
3311
+ * @return     boolean success
3312
+ */	
3313
+    function serverTempPasswordDel($pw) {
3314
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
3315
+        return $this->getdata('boolean', 'servertemppassworddel pw='.$this->escapeText($pw));
3316
+    }
3317
+
3318
+/**
3319
+ * serverTemppasswordList
3320
+ * 
3321
+ * Returns a list of active temporary server passwords. The output contains the clear-text password, the nickname and unique identifier of the creating client.
3322
+ *
3323
+ * <b>Output:</b>
3324
+ * <pre>
3325
+ * Array
3326
+ * {
3327
+ *  [nickname] => serveradmin
3328
+ *  [uid] => 1
3329
+ *  [desc] => none
3330
+ *  [pw_clear] => test
3331
+ *  [start] => 1334996838
3332
+ *  [end] => 1335000438
3333
+ *  [tcid] => 0
3334
+ * }
3335
+ * </pre>
3336
+ *
3337
+ * @author     Par0noid Solutions
3338
+ * @return     array	serverTemppasswordList
3339
+ */
3340
+    function serverTempPasswordList() {
3341
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
3342
+        return $this->getData('multi', 'servertemppasswordlist');
3343
+    }
3344
+	
3345
+
3346
+/**
3347
+ *	setClientChannelGroup
3348
+ *
3349
+ * Sets the channel group of a client to the ID specified with cgid.
3350
+ *
3351
+ * @author     Par0noid Solutions
3352
+ * @param		integer $cgid	groupID
3353
+ * @param		integer $cid	channelID
3354
+ * @param		integer $cldbid	clientDBID
3355
+ * @return     boolean success
3356
+ */
3357
+    function setClientChannelGroup($cgid, $cid, $cldbid) {
3358
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
3359
+        return $this->getData('boolean', 'setclientchannelgroup cgid='.$cgid.' cid='.$cid.' cldbid='.$cldbid);
3360
+    }
3361
+
3362
+/**
3363
+ * setName
3364
+ * 
3365
+ * Sets your nickname in server query
3366
+ *
3367
+ * @author     Par0noid Solutions
3368
+ * @param		string	$newName	new name in server query
3369
+ * @return     boolean success
3370
+ */
3371
+    function setName($newName) {
3372
+        return $this->getData('boolean', 'clientupdate client_nickname='.$this->escapeText($newName));
3373
+    }
3374
+
3375
+/**
3376
+ * tokenAdd
3377
+ * 
3378
+ * Create a new token. If tokentype is set to 0, the ID specified with tokenid1 will be a server group ID. Otherwise, tokenid1 is used as a channel group ID and you need to provide a valid channel ID using tokenid2. The tokencustomset parameter allows you to specify a set of custom client properties. This feature can be used when generating tokens to combine a website account database with a TeamSpeak user. The syntax of the value needs to be escaped using the ServerQuery escape patterns and has to follow the general syntax of:
3379
+ * ident=ident1 value=value1|ident=ident2 value=value2|ident=ident3 value=value3
3380
+ *
3381
+ * <b>Input-Array like this:</b>
3382
+ * <pre>
3383
+ * $customFieldSet = array();
3384
+ *	
3385
+ * $customFieldSet['ident'] = 'value';
3386
+ * $customFieldSet['ident'] = 'value';
3387
+ * </pre>
3388
+ *
3389
+ * @author     Par0noid Solutions
3390
+ * @param		integer	$tokentype				token type
3391
+ * @param		integer	$tokenid1				groupID
3392
+ * @param		integer	$tokenid2				channelID
3393
+ * @param		string	$description			token description [optional]
3394
+ * @param		array	$customFieldSet			customFieldSet [optional]
3395
+ * @return     array	tokenInformation
3396
+ */
3397
+    function tokenAdd($tokentype, $tokenid1, $tokenid2, $description ='', $customFieldSet = array()) {
3398
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
3399
+		
3400
+        if(!empty($description)) { $description = ' tokendescription=' . $this->escapeText($description); }
3401
+
3402
+        if(count($customFieldSet)) {
3403
+            $settingsString = array();
3404
+		
3405
+            foreach($customFieldSet as $key => $value) {
3406
+                $settingsString[] = 'ident='.$this->escapeText($key).'\svalue='.$this->escapeText($value);
3407
+            }
3408
+			
3409
+            $customFieldSet = ' tokencustomset='.implode('|', $settingsString);
3410
+        }else{
3411
+            $customFieldSet = '';
3412
+        }
3413
+		
3414
+        return $this->getData('array', 'privilegekeyadd tokentype='.$tokentype.' tokenid1='.$tokenid1.' tokenid2='.$tokenid2.$description.$customFieldSet);
3415
+    }
3416
+
3417
+/**
3418
+ * tokenDelete
3419
+ * 
3420
+ * Deletes an existing token matching the token key specified with token.
3421
+ *
3422
+ * @author     Par0noid Solutions
3423
+ * @param		string	$token	token
3424
+ * @return     boolean success
3425
+ */
3426
+    function tokenDelete($token) {
3427
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }			
3428
+        return $this->getData('boolean', 'privilegekeydelete token='.$token);
3429
+    }
3430
+
3431
+/**
3432
+ * tokenList
1084 3433
  * 
3434
+ * Displays a list of privilege keys available including their type and group IDs. Tokens can be used to gain access to specified server or channel groups. A privilege key is similar to a client with administrator privileges that adds you to a certain permission group, but without the necessity of a such a client with administrator privileges to actually exist. It is a long (random looking) string that can be used as a ticket into a specific server group.
3435
+ *
3436
+ * <b>Output:</b>
1085 3437
  * <pre>
1086
- * $result = $tsAdmin->clientAvatar($uid);
1087
- * You can display it like: echo '<img src="data:image/png;base64,'.$result["data"].'" />';
3438
+ * Array
3439
+ * {
3440
+ *  [token] => GdqedxSEDle3e9+LtR3o9dO09bURH+vymvF5hOJg
3441
+ *  [token_type] => 0
3442
+ *  [token_id1] => 71
3443
+ *  [token_id2] => 0
3444
+ *  [token_created] => 1286625908
3445
+ *  [token_description] => for you
3446
+ * }
1088 3447
  * </pre>
1089 3448
  *
1090
- * @author  Par0noid Solutions
1091
- * @param  string  $uid  clientUID
1092
- * @return array  base64 image
3449
+ * @author     Par0noid Solutions
3450
+ * @return     array tokenListist 
1093 3451
  */
1094
-	function clientAvatar($uid) {
1095
-	  if(!$this->runtime['selected']) { return $this->checkSelected(); }
3452
+    function tokenList() {
3453
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }
1096 3454
 
1097
-	  if(empty($uid))
1098
-	  {
1099
-		return $this->generateOutput(false, array('Error: empty uid'), false);
1100
-	  }
1101
-
1102
-	  $newChars = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p');
1103
-	  $auid = '';
3455
+        return $this->getData('multi', 'privilegekeylist');
3456
+    }
1104 3457
 
1105
-	  for ($i = 0; $i <= 19; $i++) {
1106
-			  $char = ord(substr(base64_decode($uid), $i, 1));
1107
-			  $auid .= $newChars[($char & 0xF0) >> 4];
1108
-			  $auid .= $newChars[$char & 0x0F];
1109
-	  }
3458
+/**
3459
+ * tokenUse
3460
+ * 
3461
+ * 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.
3462
+ *
3463
+ * @author     Par0noid Solutions
3464
+ * @param		string	$token	token
3465
+ * @return     boolean success
3466
+ */
3467
+    function tokenUse($token) {
3468
+        if(!$this->runtime['selected']) { return $this->checkSelected(); }			
3469
+        return $this->getData('boolean', 'privilegekeyuse token='.$token);
3470
+    }
1110 3471
 
1111
-	  $init = $this->ftInitDownload('/avatar_'.$auid, 0, '');
3472
+/**
3473
+ * version
3474
+ * 
3475
+ * Displays the servers version information including platform and build number.
3476
+ *
3477
+ * <b>Output:</b>
3478
+ * <pre>
3479
+ * Array
3480
+ * {
3481
+ *  [version] => 3.0.6.1
3482
+ *  [build] => 1340956745
3483
+ *  [platform] => Windows
3484
+ * }
3485
+ * </pre>
3486
+ *
3487
+ * @author     Par0noid Solutions
3488
+ * @return     array versionInformation
3489
+ */
3490
+    function version() {
3491
+        return $this->getData('array', 'version');
3492
+    }
1112 3493
 
1113
-	  if(!$init["success"])
1114
-	  {
1115
-		return $this->generateOutput(false, array('Error: init failed'), false);
1116
-	  }
1117
-	  
1118
-	  $download = $this->ftDownloadFile($init);
3494
+/**
3495
+ * whoAmI
3496
+ * 
3497
+ * Displays information about your current ServerQuery connection including your loginname, etc.
3498
+ *
3499
+ * <b>Output:</b>
3500
+ * <pre>
3501
+ * Array
3502
+ * {
3503
+ *  [virtualserver_status] => online
3504
+ *  [virtualserver_id] => 1
3505
+ *  [virtualserver_unique_identifier] => bYrybKl/APfKq7xzpIJ1Xb6C06U=
3506
+ *  [virtualserver_port] => 9987
3507
+ *  [client_id] => 5
3508
+ *  [client_channel_id] => 1
3509
+ *  [client_nickname] => serveradmin from 127.0.0.1:15208
3510
+ *  [client_database_id] => 1
3511
+ *  [client_login_name] => serveradmin
3512
+ *  [client_unique_identifier] => serveradmin
3513
+ *  [client_origin_server_id] => 0
3514
+ * }
3515
+ * </pre>
3516
+ *
3517
+ * @author     Par0noid Solutions
3518
+ * @return     array clientinformation
3519
+ */
3520
+    function whoAmI() {
3521
+        return $this->getData('array', 'whoami');
3522
+    }
1119 3523
 
1120
-	  if(is_array($download))
1121
-	  {
1122
-		return $download;
1123
-	  }else{
1124
-		return $this->generateOutput(true, false, base64_encode($download));
1125
-	  }
3524
+//*******************************************************************************************	
3525
+//************************************ Helper Functions ************************************
3526
+//*******************************************************************************************
1126 3527
 
1127
-	}
1128
-	
1129
-/**
1130
-  * clientDbDelete
1131
-  * 
1132
-  * Deletes a clients properties from the database.
1133
-  *
1134
-  * @author     Par0noid Solutions
1135
-  * @param		integer $cldbid	clientDBID
1136
-  * @return     boolean success
1137
-  */
1138
-	function clientDbDelete($cldbid) {
1139
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1140
-		return $this->getData('boolean', 'clientdbdelete cldbid='.$cldbid);
1141
-	}
1142
-
1143
-/**
1144
-  * clientDbEdit
1145
-  * 
1146
-  * Changes a clients settings using given properties.
1147
-  *
1148
-  * <b>Input-Array like this:</b>
1149
-  * <pre>
1150
-  * $data = array();
1151
-  * 
1152
-  * $data['property'] = 'value';
1153
-  * $data['property'] = 'value';
1154
-  * </pre>
1155
-  *
1156
-  * @author     Par0noid Solutions
1157
-  * @param		integer		$cldbid		clientDBID
1158
-  * @param		array		$data	 	clientProperties
1159
-  * @return     boolean success
1160
-  */
1161
-	function clientDbEdit($cldbid, $data) {
1162
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1163
-		
1164
-		$settingsString = '';
1165
-		
1166
-		foreach($data as $key => $value) {
1167
-			$settingsString .= ' '.$key.'='.$this->escapeText($value);
1168
-		}
1169
-		
1170
-		return $this->getData('boolean', 'clientdbedit cldbid='.$cldbid.$settingsString);
1171
-	}
1172
-
1173
-/**
1174
-  * clientDbFind
1175
-  * 
1176
-  * Displays 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.
1177
-  *
1178
-  * <b>Output:</b>
1179
-  * <pre>
1180
-  * Array
1181
-  * {
1182
-  *  [cldbid] => 2
1183
-  * }
1184
-  *	</pre>
1185
-  *
1186
-  * @author     Par0noid Solutions
1187
-  * @param		string	$pattern	clientName
1188
-  * @param		boolean	$uid		set true to add -uid param [optional]
1189
-  * @return     array clientList 
1190
-  */
1191
-	function clientDbFind($pattern, $uid = false) {
1192
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1193
-		return $this->getData('multi', 'clientdbfind pattern='.$this->escapeText($pattern).($uid ? ' -uid' : ''));
1194
-	}
1195
-
1196
-/**
1197
-  * clientDbInfo
1198
-  *
1199
-  * Displays detailed database information about a client including unique ID, creation date, etc.
1200
-  *
1201
-  * <b>Output:</b>
1202
-  * <pre>
1203
-  * Array
1204
-  * {
1205
-  *  [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1206
-  *  [client_nickname] => par0noid
1207
-  *  [client_database_id] => 2
1208
-  *  [client_created] => 1361027850
1209
-  *  [client_lastconnected] => 1361027850
1210
-  *  [client_totalconnections] => 1
1211
-  *  [client_flag_avatar] => 
1212
-  *  [client_description] => 
1213
-  *  [client_month_bytes_uploaded] => 0
1214
-  *  [client_month_bytes_downloaded] => 0
1215
-  *  [client_total_bytes_uploaded] => 0
1216
-  *  [client_total_bytes_downloaded] => 0
1217
-  *  [client_icon_id] => 0
1218
-  *  [client_base64HashClientUID] => jneilbgomklpfnkjclkoggokfdmdlhnbbpmdpagh
1219
-  *  [client_lastip] => 127.0.0.1
1220
-  * }
1221
-  * </pre>
1222
-  *
1223
-  * @author     Par0noid Solutions
1224
-  * @param		integer		$cldbid		clientDBID
1225
-  * @return     array	clientDbInfo
1226
-  */
1227
-	function clientDbInfo($cldbid) {
1228
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1229
-		return $this->getData('array', 'clientdbinfo cldbid='.$cldbid);
1230
-	}
1231
-
1232
-/**
1233
-  * clientDbList
1234
-  * 
1235
-  * Displays a list of client identities known by the server including their database ID, last nickname, etc.
1236
-  *
1237
-  * <b>Possible params:</b> [start={offset}] [duration={limit}] [-count]
1238
-  *
1239
-  * <b>Output:</b>
1240
-  * <pre>
1241
-  * Array
1242
-  * {
1243
-  *  [count] => 1 (if count parameter is set)
1244
-  *  [cldbid] => 2
1245
-  *  [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1246
-  *  [client_nickname] => par0noid
1247
-  *  [client_created] => 1361027850
1248
-  *  [client_lastconnected] => 1361027850
1249
-  *  [client_totalconnections] => 1
1250
-  *  [client_description] => 
1251
-  *  [client_lastip] => 127.0.0.1
1252
-  * }
1253
-  * </pre>
1254
-  *
1255
-  * @author     Par0noid Solutions
1256
-  * @param		integer	$start		offset [optional] (Default: 0)
1257
-  * @param		integer	$duration	limit [optional] (Default: -1)
1258
-  * @param		boolean	$count		set true to add -count param [optional]
1259
-  * @return     array clientdblist
1260
-  */
1261
-	function clientDbList($start = 0, $duration = -1, $count = false) {
1262
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1263
-		return $this->getData('multi', 'clientdblist start='.$start.' duration='.$duration.($count ? ' -count' : ''));
1264
-	}
1265
-
1266
-/**
1267
-  * clientDelPerm
1268
-  * 
1269
-  * Removes a set of specified permissions from a client. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.
1270
-  *
1271
-  * <b>Input-Array like this:</b>
1272
-  * <pre>
1273
-  * $permissions = array();
1274
-  * $permissions['permissionID'] = 'permissionValue';
1275
-  * //or you could use Permission Name
1276
-  * $permissions['permissionName'] = 'permissionValue';
1277
-  * </pre>
1278
-  *
1279
-  * @author     Par0noid Solutions
1280
-  * @param		integer		$cldbid				clientDBID
1281
-  * @param		array		$permissionIds		permissionIDs
1282
-  * @return     boolean success
1283
-  */
1284
-	function clientDelPerm($cldbid, $permissionIds) {
1285
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1286
-		
1287
-		$permissionArray = array();
1288
-		
1289
-		if(count($permissionIds) > 0) {
1290
-			foreach($permissionIds AS $value) {
1291
-				$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
1292
-			}
1293
-			return $this->getData('boolean', 'clientdelperm cldbid='.$cldbid.' '.implode('|', $permissionArray));
1294
-		}else{
1295
-			$this->addDebugLog('no permissions given');
1296
-			return $this->generateOutput(false, array('Error: no permissions given'), false);
1297
-		}
1298
-	}
1299
-
1300
-/**
1301
-  * clientEdit
1302
-  * 
1303
-  * Changes a clients settings using given properties.
1304
-  *
1305
-  * <b>Input-Array like this:</b>
1306
-  * <pre>
1307
-  * $data = array();
1308
-  *	
1309
-  * $data['property'] = 'value';
1310
-  * $data['property'] = 'value';
1311
-  * </pre>
1312
-  *
1313
-  * @author     Par0noid Solutions
1314
-  * @param		integer	$clid 			clientID
1315
-  * @param		array	$data			clientProperties
1316
-  * @return     boolean success
1317
-  */
1318
-	function clientEdit($clid, $data) {
1319
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1320
-		
1321
-		$settingsString = '';
1322
-		
1323
-		foreach($data as $key => $value) {
1324
-			$settingsString .= ' '.$key.'='.$this->escapeText($value);
1325
-		}
1326
-		
1327
-		return $this->getData('boolean', 'clientedit clid='.$clid.$settingsString);
1328
-	}
1329
-
1330
-/**
1331
-  * clientFind
1332
-  * 
1333
-  * Displays a list of clients matching a given name pattern.
1334
-  *
1335
-  * <b>Output:</b>
1336
-  * <pre>
1337
-  * Array
1338
-  * {
1339
-  *  [clid] => 18
1340
-  *  [client_nickname] => par0noid
1341
-  * }
1342
-  * </pre>
1343
-  *
1344
-  * @author     Par0noid Solutions
1345
-  * @param		string	$pattern	clientName
1346
-  * @return     array clienList
1347
-  */
1348
-	function clientFind($pattern) {
1349
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1350
-		return $this->getData('multi', 'clientfind pattern='.$this->escapeText($pattern));
1351
-	}
1352
-
1353
-/**
1354
-  * clientGetDbIdFromUid
1355
-  * 
1356
-  * Displays the database ID matching the unique identifier specified by cluid.
1357
-  *
1358
-  *	<b>Output:</b>
1359
-  * <pre>
1360
-  * Array
1361
-  * {
1362
-  *  [cluid] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1363
-  *  [cldbid] => 2
1364
-  * }
1365
-  * </pre>
1366
-  *
1367
-  * @author     Par0noid Solutions
1368
-  * @param		string	$cluid	clientUID
1369
-  * @return     array clientInfo
1370
-  */
1371
-	function clientGetDbIdFromUid($cluid) {
1372
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1373
-		return $this->getData('array', 'clientgetdbidfromuid cluid='.$cluid);
1374
-	}
1375
-
1376
-/**
1377
-  * clientGetIds
1378
-  * 
1379
-  * Displays all client IDs matching the unique identifier specified by cluid.
1380
-  *
1381
-  * <b>Output:</b>
1382
-  * <pre>
1383
-  * Array
1384
-  * {
1385
-  *  [cluid] => nUixbdf/XakrrmsdffO30R/D8Gc=
1386
-  *  [clid] => 7
1387
-  *  [name] => Par0noid
1388
-  * }
1389
-  * </pre>
1390
-  *
1391
-  * @author     Par0noid Solutions
1392
-  * @param		string	$cluid	clientUID
1393
-  * @return     array clientList 
1394
-  */
1395
-	function clientGetIds($cluid) {
1396
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1397
-		return $this->getData('multi', 'clientgetids cluid='.$cluid);
1398
-	}
1399
-
1400
-/**
1401
-  * clientGetNameFromDbid
1402
-  * 
1403
-  * Displays the unique identifier and nickname matching the database ID specified by cldbid.
1404
-  *
1405
-  *	<b>Output:</b>
1406
-  * <pre>
1407
-  * Array
1408
-  * {
1409
-  *  [cluid] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1410
-  *  [cldbid] => 2
1411
-  *  [name] => Par0noid
1412
-  * }
1413
-  * </pre>
1414
-  *
1415
-  * @author     Par0noid Solutions
1416
-  * @param		integer	$cldbid	clientDBID
1417
-  * @return     array clientInfo
1418
-  */
1419
-	function clientGetNameFromDbid($cldbid) {
1420
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1421
-		return $this->getData('array', 'clientgetnamefromdbid cldbid='.$cldbid);
1422
-	}
1423
-	
1424
-/**
1425
-  * clientGetNameFromUid
1426
-  * 
1427
-  * Displays the database ID and nickname matching the unique identifier specified by cluid.
1428
-  *
1429
-  *	<b>Output:</b>
1430
-  * <pre>
1431
-  * Array
1432
-  * {
1433
-  *  [cluid] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1434
-  *  [cldbid] => 2
1435
-  *  [name] => Par0noid
1436
-  * }
1437
-  * </pre>
1438
-  *
1439
-  * @author     Par0noid Solutions
1440
-  * @param		string	$cluid	clientUID
1441
-  * @return     array clientInfo
1442
-  */
1443
-	function clientGetNameFromUid($cluid) {
1444
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1445
-		return $this->getData('array', 'clientgetnamefromuid cluid='.$cluid);
1446
-	}
1447
-
1448
-/**
1449
-  * clientInfo
1450
-  * 
1451
-  * Displays detailed configuration information about a client including unique ID, nickname, client version, etc.
1452
-  *
1453
-  * <b>Output:</b>
1454
-  * <pre>
1455
-  * Array
1456
-  * {
1457
-  *  [cid] => 2
1458
-  *  [client_idle_time] => 4445369
1459
-  *  [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1460
-  *  [client_nickname] => par0noid
1461
-  *  [client_version] => 3.0.9.2 [Build: 1351504843]
1462
-  *  [client_platform] => Windows
1463
-  *  [client_input_muted] => 1
1464
-  *  [client_output_muted] => 1
1465
-  *  [client_outputonly_muted] => 0
1466
-  *  [client_input_hardware] => 1
1467
-  *  [client_output_hardware] => 1
1468
-  *  [client_default_channel] => 
1469
-  *  [client_meta_data] => 
1470
-  *  [client_is_recording] => 0
1471
-  *  [client_login_name] => 
1472
-  *  [client_database_id] => 2
1473
-  *  [client_channel_group_id] => 5
1474
-  *  [client_servergroups] => 6
1475
-  *  [client_created] => 1361027850
1476
-  *  [client_lastconnected] => 1361027850
1477
-  *  [client_totalconnections] => 1
1478
-  *  [client_away] => 0
1479
-  *  [client_away_message] => 
1480
-  *  [client_type] => 0
1481
-  *  [client_flag_avatar] => 
1482
-  *  [client_talk_power] => 75
1483
-  *  [client_talk_request] => 0
1484
-  *  [client_talk_request_msg] => 
1485
-  *  [client_description] => 
1486
-  *  [client_is_talker] => 0
1487
-  *  [client_month_bytes_uploaded] => 0
1488
-  *  [client_month_bytes_downloaded] => 0
1489
-  *  [client_total_bytes_uploaded] => 0
1490
-  *  [client_total_bytes_downloaded] => 0
1491
-  *  [client_is_priority_speaker] => 0
1492
-  *  [client_nickname_phonetic] => 
1493
-  *  [client_needed_serverquery_view_power] => 75
1494
-  *  [client_default_token] => 
1495
-  *  [client_icon_id] => 0
1496
-  *  [client_is_channel_commander] => 0
1497
-  *  [client_country] => 
1498
-  *  [client_channel_group_inherited_channel_id] => 2
1499
-  *  [client_base64HashClientUID] => jneilbgomklpfnkjclkoggokfdmdlhnbbpmdpagh
1500
-  *  [connection_filetransfer_bandwidth_sent] => 0
1501
-  *  [connection_filetransfer_bandwidth_received] => 0
1502
-  *  [connection_packets_sent_total] => 12130
1503
-  *  [connection_bytes_sent_total] => 542353
1504
-  *  [connection_packets_received_total] => 12681
1505
-  *  [connection_bytes_received_total] => 592935
1506
-  *  [connection_bandwidth_sent_last_second_total] => 82
1507
-  *  [connection_bandwidth_sent_last_minute_total] => 92
1508
-  *  [connection_bandwidth_received_last_second_total] => 84
1509
-  *  [connection_bandwidth_received_last_minute_total] => 88
1510
-  *  [connection_connected_time] => 5908749
1511
-  *  [connection_client_ip] => 127.0.0.1
1512
-  * } 
1513
-  * </pre>
1514
-  *
1515
-  * @author     Par0noid Solutions
1516
-  * @param		integer	$clid	clientID
1517
-  * @return     array	clientInformation
1518
-  */
1519
-	function clientInfo($clid) {
1520
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1521
-		return $this->getData('array', 'clientinfo clid='.$clid);
1522
-	}
1523
-
1524
-/**
1525
-  * clientKick
1526
-  * 
1527
-  * Kicks one or more clients specified with clid from their currently joined channel or from the server, depending on reasonid. The reasonmsg parameter specifies a text message sent to the kicked clients. This parameter is optional and may only have a maximum of 40 characters.
1528
-  *
1529
-  * @author     Par0noid Solutions
1530
-  * @param		integer $clid		clientID
1531
-  * @param		string	$kickMode	kickMode (server or channel) (Default: servera)
1532
-  * @param		string	$kickmsg 	kick reason [optional]
1533
-  * @return     boolean success
1534
-  */
1535
-	function clientKick($clid, $kickMode = "server", $kickmsg = "") {
1536
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1537
-		
1538
-		if(in_array($kickMode, array('server', 'channel'))) {
1539
-		
1540
-			if($kickMode == 'server') { $from = '5'; }
1541
-			if($kickMode == 'channel') { $from = '4'; }
1542
-			
1543
-			if(!empty($kickmsg)) { $msg = ' reasonmsg='.$this->escapeText($kickmsg); } else{ $msg = ''; }
1544
-			
1545
-			return $this->getData('boolean', 'clientkick clid='.$clid.' reasonid='.$from.$msg);
1546
-		}else{
1547
-			$this->addDebugLog('invalid kickMode');
1548
-			return $this->generateOutput(false, array('Error: invalid kickMode'), false);
1549
-		}
1550
-	}
1551
-
1552
-/**
1553
-  * clientList
1554
-  * 
1555
-  * Displays a list of clients online on a virtual server including their ID, nickname, status flags, etc. The output can be modified using several command options. Please note that the output will only contain clients which are currently in channels you're able to subscribe to.
1556
-  *
1557
-  * <b>Possible params:</b> [-uid] [-away] [-voice] [-times] [-groups] [-info] [-icon] [-country] [-ip] [-badges]
1558
-  *
1559
-  * <b>Output: (without parameters)</b>
1560
-  * <pre>
1561
-  * Array
1562
-  * {
1563
-  *  [clid] => 1
1564
-  *  [cid] => 1
1565
-  *  [client_database_id] => 2
1566
-  *  [client_nickname] => Par0noid
1567
-  *  [client_type] => 0
1568
-  *  [-uid] => [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
1569
-  *  [-away] => [client_away] => 0
1570
-  *  [-away] => [client_away_message] => 
1571
-  *  [-voice] => [client_flag_talking] => 0
1572
-  *  [-voice] => [client_input_muted] => 0
1573
-  *  [-voice] => [client_output_muted] => 0
1574
-  *  [-voice] => [client_input_hardware] => 0
1575
-  *  [-voice] => [client_output_hardware] => 0
1576
-  *  [-voice] => [client_talk_power] => 0
1577
-  *  [-voice] => [client_is_talker] => 0
1578
-  *  [-voice] => [client_is_priority_speaker] => 0
1579
-  *  [-voice] => [client_is_recording] => 0
1580
-  *  [-voice] => [client_is_channel_commander] => 0
1581
-  *  [-times] => [client_idle_time] => 1714
1582
-  *  [-times] => [client_created] => 1361027850
1583
-  *  [-times] => [client_lastconnected] => 1361042955
1584
-  *  [-groups] => [client_servergroups] => 6,7
1585
-  *  [-groups] => [client_channel_group_id] => 8
1586
-  *  [-groups] => [client_channel_group_inherited_channel_id] => 1
1587
-  *  [-info] => [client_version] => 3.0.9.2 [Build: 1351504843]
1588
-  *  [-info] => [client_platform] => Windows
1589
-  *  [-icon] => [client_icon_id] => 0
1590
-  *  [-country] => [client_country] => 
1591
-  *  [-ip] => [connection_client_ip] => 127.0.0.1
1592
-  *  [-badges] => [client_badges] => Overwolf=0
1593
-  * }
1594
-  * 
1595
-  * <b>Usage:</b>
1596
-  * 
1597
-  * $ts3->clientList(); //No parameters
1598
-  * $ts3->clientList("-uid"); //Single parameter
1599
-  * $ts3->clientList("-uid -away -voice -times -groups -info -country -icon -ip -badges"); //Multiple parameters
1600
-  * </pre>
1601
-  *
1602
-  * @author     Par0noid Solutions
1603
-  * @param		string	$params	additional parameters [optional]
1604
-  * @return     array clientList 
1605
-  */
1606
-	function clientList($params = null) {
1607
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1608
-		
1609
-		if(!empty($params)) { $params = ' '.$params; }
1610
-		
1611
-		return $this->getData('multi', 'clientlist'.$params);
1612
-	}
1613
-
1614
-/**
1615
-  * clientMove
1616
-  * 
1617
-  * Moves one or more clients specified with clid to the channel with ID cid. If the target channel has a password, it needs to be specified with cpw. If the channel has no password, the parameter can be omitted.
1618
-  *
1619
-  * @author     Par0noid Solutions
1620
-  * @param		integer $clid	clientID
1621
-  * @param		integer $cid	channelID
1622
-  * @param		string	$cpw	channelPassword [optional]
1623
-  * @return     boolean success
1624
-  */
1625
-	function clientMove($clid, $cid, $cpw = null) {
1626
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1627
-		return $this->getData('boolean', 'clientmove clid='.$clid.' cid='.$cid.(!empty($cpw) ? ' cpw='.$this->escapeText($cpw) : ''));
1628
-	}
1629
-
1630
-/**
1631
-  * clientPermList
1632
-  * 
1633
-  * Displays a list of permissions defined for a client.
1634
-  *
1635
-  * <b>Output:</b>
1636
-  * <pre>
1637
-  * Array
1638
-  * {
1639
-  *  [permid] => 20654 //with permsid = false
1640
-  *  [permsid] => b_client_ignore_bans //with permsid = true
1641
-  *  [permvalue] => 1
1642
-  *  [permnegated] => 0
1643
-  *  [permskip] => 0
1644
-  * }
1645
-  * </pre>
1646
-  *
1647
-  * @author     Par0noid Solutions
1648
-  * @param		intege		$cldbid 	clientDBID
1649
-  * @param		boolean		$permsid	set true to add -permsid param [optional]
1650
-  * @return     array clientPermList
1651
-  */
1652
-	function clientPermList($cldbid, $permsid = false) {
1653
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }		
1654
-		return $this->getData('multi', 'clientpermlist cldbid='.$cldbid.($permsid ? ' -permsid' : ''));
1655
-	}
1656
-
1657
-/**
1658
-  * clientPoke
1659
-  * 
1660
-  * Sends a poke message to the client specified with clid.
1661
-  *
1662
-  * @author     Par0noid Solutions
1663
-  * @param		integer $clid	clientID
1664
-  * @param		string 	$msg 	pokeMessage
1665
-  * @return     boolean success
1666
-  */
1667
-	function clientPoke($clid, $msg) {
1668
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1669
-		return $this->getData('boolean', 'clientpoke clid='.$clid.' msg='.$this->escapeText($msg));
1670
-	}
1671
-
1672
-/**
1673
-  * clientSetServerQueryLogin
1674
-  * 
1675
-  * Updates your own ServerQuery login credentials using a specified username. The password will be auto-generated.
1676
-  * 
1677
-  * <b>Output:</b>
1678
-  * <pre>
1679
-  * Array
1680
-  * {
1681
-  *  [client_login_password] => +r\/TQqvR
1682
-  * }
1683
-  * </pre>
1684
-  *
1685
-  * @author     Par0noid Solutions
1686
-  * @param		string	$username	username
1687
-  * @return     array userInfomation
1688
-  */
1689
-	function clientSetServerQueryLogin($username) {
1690
-		return $this->getData('array', 'clientsetserverquerylogin client_login_name='.$this->escapeText($username));
1691
-	}
1692
-
1693
-/**
1694
-  * clientUpdate
1695
-  * 
1696
-  * Change your ServerQuery clients settings using given properties.
1697
-  * 
1698
-  * <b>Input-Array like this:</b>
1699
-  * <pre>
1700
-  * $data = array();
1701
-  * $data['property'] = 'value';
1702
-  * $data['property'] = 'value';
1703
-  * </pre>
1704
-  *
1705
-  * @author     Par0noid Solutions
1706
-  * @param		array	$data	clientProperties
1707
-  * @return     boolean success
1708
-  */
1709
-	function clientUpdate($data) {
1710
-		$settingsString = '';
1711
-		
1712
-		foreach($data as $key => $value) {
1713
-			$settingsString .= ' '.$key.'='.$this->escapeText($value);
1714
-		}
1715
-		
1716
-		return $this->getData('boolean', 'clientupdate '.$settingsString);
1717
-	}
1718
-
1719
-/**
1720
-  * complainAdd
1721
-  *
1722
-  * Submits a complaint about the client with database ID tcldbid to the server.
1723
-  *
1724
-  * @author     Par0noid Solutions
1725
-  * @param		integer $tcldbid	targetClientDBID
1726
-  * @param		string	$msg		complainMessage
1727
-  * @return     boolean success
1728
-  */
1729
-	function complainAdd($tcldbid, $msg) {
1730
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1731
-		return $this->getData('boolean', 'complainadd tcldbid='.$tcldbid.' message='.$this->escapeText($msg));
1732
-	}
1733
-
1734
-/**
1735
-  * complainDelete
1736
-  * 
1737
-  * Deletes the complaint about the client with ID tcldbid submitted by the client with ID fcldbid from the server.
1738
-  *
1739
-  * @author     Par0noid Solutions
1740
-  * @param		integer $tcldbid targetClientDBID
1741
-  * @param		integer $fcldbid fromClientDBID
1742
-  * @return     boolean success
1743
-  */
1744
-	function complainDelete($tcldbid, $fcldbid) {
1745
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1746
-		return $this->getData('boolean', 'complaindel tcldbid='.$tcldbid.' fcldbid='.$fcldbid);
1747
-	}
1748
-
1749
-/**
1750
-  * complainDeleteAll
1751
-  * 
1752
-  * Deletes all complaints about the client with database ID tcldbid from the server.
1753
-  *
1754
-  * @author     Par0noid Solutions
1755
-  * @param		integer $tcldbid targetClientDBID
1756
-  * @return     boolean success
1757
-  */
1758
-	function complainDeleteAll($tcldbid) {
1759
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1760
-		return $this->getData('boolean', 'complaindelall tcldbid='.$tcldbid);
1761
-	}
1762
-
1763
-/**
1764
-  * complainList
1765
-  * 
1766
-  * Displays a list of complaints on the selected virtual server. If tcldbid is specified, only complaints about the targeted client will be shown.
1767
-  *
1768
-  * <b>Output:</b>
1769
-  * <pre>
1770
-  * Array
1771
-  * {
1772
-  *  [tcldbid] => 2
1773
-  *  [tname] => par0noid
1774
-  *  [fcldbid] => 1
1775
-  *  [fname] => serveradmin from 127.0.0.1:6814
1776
-  *  [message] => Steals crayons
1777
-  *  [timestamp] => 1361044090
1778
-  * }
1779
-  * </pre>
1780
-  *
1781
-  * @author     Par0noid Solutions
1782
-  * @param		string $tcldbid	targetClientDBID [optional]
1783
-  * @return     array complainList
1784
-  */
1785
-	function complainList($tcldbid = null) {
1786
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1787
-		if(!empty($tcldbid)) { $tcldbid = ' tcldbid='.$tcldbid; }
1788
-		return $this->getData('multi', 'complainlist'.$tcldbid);
1789
-	}
1790
-
1791
-/**
1792
-  * execOwnCommand
1793
-  * 
1794
-  * executes a command that isn't defined in class and returns data like your propose
1795
-  * 
1796
-  * <b>Modes:</b>
1797
-  * <ul>
1798
-  * 	<li><b>0:</b> execute -> return boolean</li>
1799
-  * 	<li><b>1:</b> execute -> return normal array</li>
1800
-  * 	<li><b>2:</b> execute -> return multidimensional array</li>
1801
-  * 	<li><b>3:</b> execute -> return plaintext serverquery</li>
1802
-  * </ul>
1803
-  *
1804
-  * @author     Par0noid Solutions
1805
-  * @param		string	$mode		executionMode
1806
-  * @param		string	$command	command
1807
-  * @return     mixed result
1808
-  */
1809
-	function execOwnCommand($mode, $command) {
1810
-		if($mode == '0') {
1811
-			return $this->getData('boolean', $command);
1812
-		}
1813
-		if($mode == '1') {
1814
-			return $this->getData('array', $command);
1815
-		}
1816
-		if($mode == '2') {
1817
-			return $this->getData('multi', $command);
1818
-		}
1819
-		if($mode == '3') {
1820
-			return $this->getData('plain', $command);
1821
-		}
1822
-	}
1823
-
1824
-/**
1825
-  * ftCreateDir
1826
-  * 
1827
-  * Creates new directory in a channels file repository.
1828
-  *
1829
-  * @author     Par0noid Solutions
1830
-  * @param		string	$cid		channelId
1831
-  * @param		string	$cpw		channelPassword (leave blank if not needed)
1832
-  * @param		string	$dirname	dirPath
1833
-  * @return     boolean success
1834
-  */
1835
-	function ftCreateDir($cid, $cpw = null, $dirname) {
1836
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1837
-		return $this->getData('boolean', 'ftcreatedir cid='.$cid.' cpw='.$this->escapeText($cpw).' dirname='.$this->escapeText($dirname));
1838
-	}
1839
-
1840
-/**
1841
-  * ftDeleteFile
1842
-  * 
1843
-  * Deletes one or more files stored in a channels file repository.
1844
-  *
1845
-  * <b>Input-Array like this:</b>
1846
-  * <pre>
1847
-  * $files = array();
1848
-  *	
1849
-  * $files[] = '/pic1.jpg';
1850
-  * $files[] = '/dokumente/test.txt';
1851
-  * $files[] = '/dokumente';
1852
-  * </pre>
1853
-  *
1854
-  * @author     Par0noid Solutions
1855
-  * @param		string	$cid	channelID
1856
-  * @param		string	$cpw	channelPassword (leave blank if not needed)
1857
-  * @param		array	$files	files
1858
-  * @return     boolean success
1859
-  */
1860
-	function ftDeleteFile($cid, $cpw = '', $files) {
1861
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1862
-		$fileArray = array();
1863
-		
1864
-		if(count($files) > 0) {
1865
-			foreach($files AS $file) {
1866
-				$fileArray[] = 'name='.$this->escapeText($file);
1867
-			}
1868
-			return $this->getData('boolean', 'ftdeletefile cid='.$cid.' cpw='.$this->escapeText($cpw).' '.implode('|', $fileArray));
1869
-		}else{
1870
-			$this->addDebugLog('no files given');
1871
-			return $this->generateOutput(false, array('Error: no files given'), false);
1872
-		}
1873
-	}
1874
-
1875
-/**
1876
-  * ftDownloadFile
1877
-  * 
1878
-  * Ddownloads a file and returns its contents
1879
-  *
1880
-  * @author     Par0noid Solutions
1881
-  * @param		array	$data	return of ftInitDownload
1882
-  * @return     array downloadedFile
1883
-  */
1884
-	function ftDownloadFile($data) {
1885
-		$errnum = null;
1886
-		$errstr = null;
1887
-  		$this->runtime['fileSocket'] = @fsockopen($this->runtime['host'], $data['data']['port'], $errnum, $errstr, $this->runtime['timeout']);
1888
-  		if($this->runtime['fileSocket']) {
1889
-  			$this->ftSendKey($data['data']['ftkey']);
1890
-  			$content = $this->ftRead($data['data']['size']);
1891
-  			@fclose($this->runtime['fileSocket']);
1892
-  			$this->runtime['fileSocket'] = '';
1893
-  			return $content;
1894
-  		}else{
1895
-  			$this->addDebugLog('fileSocket returns '.$errnum. ' | '.$errstr);
1896
-  			return $this->generateOutput(false, array('Error in fileSocket: '.$errnum. ' | '.$errstr), false);
1897
-  		}
1898
-	}
1899
-	
1900
-/**
1901
-  * ftGetFileInfo
1902
-  * 
1903
-  * Displays detailed information about one or more specified files stored in a channels file repository.
1904
-  * 
1905
-  *
1906
-  * @author     Par0noid Solutions
1907
-  * @param		string	$cid	channelID
1908
-  * @param		string	$cpw	channelPassword (leave blank if not needed)
1909
-  * @param		string 	$file	path to file
1910
-  * @return     boolean success
1911
-  */
1912
-	function ftGetFileInfo($cid, $cpw = '', $file) {
1913
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1914
-
1915
-		return $this->getData('multi', 'ftgetfileinfo cid='.$cid.' cpw='.$this->escapeText($cpw).' name='.$this->escapeText($file));
1916
-	}
1917
-
1918
-/**
1919
-  * ftGetFileList
1920
-  *
1921
-  * Displays a list of files and directories stored in the specified channels file repository.
1922
-  *
1923
-  * <b>Output:</b>
1924
-  * <pre>
1925
-  * Array
1926
-  * {
1927
-  *  [cid] => 231
1928
-  *  [path] => /
1929
-  *  [name] => Documents
1930
-  *  [size] => 0
1931
-  *  [datetime] => 1286633633
1932
-  *  [type] => 0
1933
-  * }
1934
-  * </pre>
1935
-  *
1936
-  * @author     Par0noid Solutions
1937
-  * @param		string	$cid	channelID
1938
-  * @param		string	$cpw	channelPassword (leave blank if not needed)
1939
-  * @param		string	$path	filePath
1940
-  * @return     array	fileList
1941
-  */
1942
-	function ftGetFileList($cid, $cpw = '', $path) {
1943
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1944
-		return $this->getData('multi', 'ftgetfilelist cid='.$cid.' cpw='.$this->escapeText($cpw).' path='.$this->escapeText($path));
1945
-	}
1946
-	
1947 3528
 /**
1948
-  * ftInitDownload
1949
-  * 
1950
-  * Initializes a file transfer download. clientftfid is an arbitrary ID to identify the file transfer on client-side. On success, the server generates a new ftkey which is required to start downloading the file through TeamSpeak 3's file transfer interface.
1951
-  *
1952
-  * <b>Output:</b>
1953
-  * <pre>
1954
-  * Array
1955
-  * {
1956
-  *  [clientftfid] => 89
1957
-  *  [serverftfid] => 3
1958
-  *  [ftkey] => jSzWiRmFGdZnoJzW7BSDYJRUWB2WAUhb
1959
-  *  [port] => 30033
1960
-  *  [size] => 94
1961
-  * }
1962
-  * </pre>
1963
-  *
1964
-  * @author     Par0noid Solutions
1965
-  * @param		string	$name			filePath
1966
-  * @param		string	$cid			channelID
1967
-  * @param		string	$cpw			channelPassword (leave blank if not needed)
1968
-  * @param		integer	$seekpos		seekpos (default = 0) [optional]
1969
-  * @return     array	initDownloadFileInfo
1970
-  */	
1971
-	function ftInitDownload($name, $cid, $cpw = '', $seekpos = 0) {
1972
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1973
-		return $this->getData('array', 'ftinitdownload clientftfid='.rand(1,99).' name='.$this->escapeText($name).' cid='.$cid.' cpw='.$this->escapeText($cpw).' seekpos='.$seekpos);
1974
-	}
1975
-
1976
-/**
1977
-  * ftInitUpload
1978
-  * 
1979
-  * Initializes a file transfer upload. clientftfid is an arbitrary ID to identify the file transfer on client-side. On success, the server generates a new ftkey which is required to start uploading the file through TeamSpeak 3's file transfer interface.
1980
-  *
1981
-  * <b>Output:</b>
1982
-  * <pre>
1983
-  * Array
1984
-  * {
1985
-  *  [clientftfid] => 84
1986
-  *  [serverftfid] => 41
1987
-  *  [ftkey] => HCnXpunOdAorqj3dGqfiuLszX18O0PHP
1988
-  *  [port] => 30033
1989
-  *  [seekpos] => 0
1990
-  * }
1991
-  * </pre>
1992
-  *
1993
-  * @author     Par0noid Solutions
1994
-  * @param		string	$filename	filePath
1995
-  * @param		string	$cid		channelID
1996
-  * @param		integer	$size		fileSize in bytes
1997
-  * @param		string	$cpw		channelPassword (leave blank if not needed)
1998
-  * @param		boolean	$overwrite	overwrite	[optional] (default = 0)
1999
-  * @param		boolean	$resume		resume		[optional] (default = 0)
2000
-  * @return     array	initUploadFileInfo
2001
-  */	
2002
-	function ftInitUpload($filename, $cid, $size, $cpw = '', $overwrite = false, $resume = false) {
2003
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2004
-		
2005
-		if($overwrite) { $overwrite = ' overwrite=1'; }else{ $overwrite = ' overwrite=0'; }
2006
-		if($resume) { $resume = ' resume=1'; }else{ $resume = ' resume=0'; }
2007
-		
2008
-		return $this->getData('array', 'ftinitupload clientftfid='.rand(1,99).' name='.$this->escapeText($filename).' cid='.$cid.' cpw='.$this->escapeText($cpw).' size='.($size + 1).$overwrite.$resume);
2009
-	}
2010
-	
2011
-/**
2012
-  * ftList
2013
-  * 
2014
-  * 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
2015
-  *
2016
-  * <b>Output:</b>
2017
-  * <pre>
2018
-  * Array
2019
-  * {
2020
-  *  [clid] => 1
2021
-  *  [cldbid] => 2019
2022
-  *  [path] => files/virtualserver_11/channel_231
2023
-  *  [name] => 1285412348878.png
2024
-  *  [size] => 1161281
2025
-  *  [sizedone] => 275888
2026
-  *  [clientftfid] => 15
2027
-  *  [serverftfid] => 52
2028
-  *  [sender] => 0
2029
-  *  [status] => 1
2030
-  *  [current_speed] => 101037.4453
2031
-  *  [average_speed] => 101037.4453
2032
-  *  [runtime] => 2163
2033
-  * }
2034
-  * </pre>
2035
-  *
2036
-  * @author     Par0noid Solutions
2037
-  * @return     array	fileTransferList
2038
-  */
2039
-	function ftList() {
2040
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2041
-		return $this->getData('multi', 'ftlist');
2042
-	}
2043
-
2044
-/**
2045
-  * ftRenameFile
2046
-  * 
2047
-  * 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.
2048
-  *
2049
-  * @author     Par0noid Solutions
2050
-  * @param		integer	$cid		channelID
2051
-  * @param		string	$cpw		channelPassword (leave blank if not needed)
2052
-  * @param		string	$oldname	oldFilePath
2053
-  * @param		string	$newname	newFilePath
2054
-  * @param		string  $tcid		targetChannelID [optional]
2055
-  * @param		string  $tcpw		targetChannelPassword [optional]
2056
-  * @return     boolean success
2057
-  */
2058
-	function ftRenameFile($cid, $cpw = null, $oldname, $newname, $tcid = null,  $tcpw = null) {
2059
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2060
-		$newTarget = ($tcid != null ? ' tcid='.$tcid.' '.$tcpw : '');
2061
-		return $this->getData('boolean', 'ftrenamefile cid='.$cid.' cpw='.$cpw.' oldname='.$this->escapeText($oldname).' newname='.$this->escapeText($newname).$newTarget);
2062
-	}
2063
-
2064
-/**
2065
-  * ftStop
2066
-  * 
2067
-  * Stops the running file transfer with server-side ID serverftfid.
2068
-  *
2069
-  * @author     Par0noid Solutions
2070
-  * @param		integer	$serverftfid	serverFileTransferID
2071
-  * @param		boolean	$delete			delete incomplete file [optional] (default: true) 
2072
-  * @return     boolean success
2073
-  */
2074
-	function ftStop($serverftfid, $delete = true) {
2075
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }		
2076
-		return $this->getData('boolean', 'ftstop serverftfid='.$serverftfid.' delete='.($delete ? '1' : '0'));
2077
-	}
2078
-
2079
-/**
2080
-  * ftUploadFile
2081
-  * 
2082
-  * Uploads a file to server
2083
-  * To check if upload was successful, you have to search for this file in fileList after
2084
-  *
2085
-  * @author     Par0noid Solutions
2086
-  * @param		array	$data			return of ftInitUpload
2087
-  * @param		string	$uploadData		data which should be uploaded
2088
-  * @return     array response
2089
-  */
2090
-	function ftUploadFile($data, $uploadData) {
2091
-  		$this->runtime['fileSocket'] = @fsockopen($this->runtime['host'], $data['data']['port'], $errnum, $errstr, $this->runtime['timeout']);
2092
-  		if($this->runtime['fileSocket']) {
2093
-  			$this->ftSendKey($data['data']['ftkey'], "\n");
2094
-  			$this->ftSendData($uploadData);
2095
-  			@fclose($this->runtime['fileSocket']);
2096
-  			$this->runtime['fileSocket'] = '';
2097
-  			return $this->generateOutput(true, array(), true);
2098
-  		}else{
2099
-  			$this->addDebugLog('fileSocket returns '.$errnum. ' | '.$errstr);
2100
-  			return $this->generateOutput(false, array('Error in fileSocket: '.$errnum. ' | '.$errstr), false);
2101
-  		}
2102
-	}
2103
-
2104
-/**
2105
-  * gm
2106
-  * 
2107
-  * Sends a text message to all clients on all virtual servers in the TeamSpeak 3 Server instance.
2108
-  *
2109
-  * @author     Par0noid Solutions
2110
-  * @param		string	$msg	message
2111
-  * @return     boolean success
2112
-  */
2113
-	function gm($msg) {
2114
-		if(empty($msg)) {
2115
-			$this->addDebugLog('empty message given');
2116
-			return $this->generateOutput(false, array('Error: empty message given'), false);
2117
-		}
2118
-		return $this->getData('boolean', 'gm msg='.$this->escapeText($msg));
2119
-	}
2120
-
2121
-/**
2122
-  * hostInfo
2123
-  * 
2124
-  * Displays detailed connection information about the server instance including uptime, number of virtual servers online, traffic information, etc.
2125
-  *
2126
-  * <b>Output:</b>
2127
-  * <pre>
2128
-  * Array
2129
-  * {
2130
-  *  [instance_uptime] => 19038
2131
-  *  [host_timestamp_utc] => 1361046825
2132
-  *  [virtualservers_running_total] => 1
2133
-  *  [virtualservers_total_maxclients] => 32
2134
-  *  [virtualservers_total_clients_online] => 1
2135
-  *  [virtualservers_total_channels_online] => 2
2136
-  *  [connection_filetransfer_bandwidth_sent] => 0
2137
-  *  [connection_filetransfer_bandwidth_received] => 0
2138
-  *  [connection_filetransfer_bytes_sent_total] => 0
2139
-  *  [connection_filetransfer_bytes_received_total] => 0
2140
-  *  [connection_packets_sent_total] => 24853
2141
-  *  [connection_bytes_sent_total] => 1096128
2142
-  *  [connection_packets_received_total] => 25404
2143
-  *  [connection_bytes_received_total] => 1153918
2144
-  *  [connection_bandwidth_sent_last_second_total] => 82
2145
-  *  [connection_bandwidth_sent_last_minute_total] => 81
2146
-  *  [connection_bandwidth_received_last_second_total] => 84
2147
-  *  [connection_bandwidth_received_last_minute_total] => 87
2148
-  * }
2149
-  * </pre>
2150
-  *
2151
-  * @author     Par0noid Solutions
2152
-  * @return     array hostInformation
2153
-  */
2154
-	function hostInfo() {
2155
-		return $this->getData('array', 'hostinfo');
2156
-	}
2157
-
2158
-/**
2159
-  * instanceEdit
2160
-  * 
2161
-  * Changes the server instance configuration using given properties.
2162
-  *
2163
-  * <b>Input-Array like this:</b>
2164
-  * <pre>
2165
-  * $data = array();
2166
-  *	
2167
-  * $data['setting'] = 'value';
2168
-  * $data['setting'] = 'value';
2169
-  * </pre>
2170
-  *
2171
-  * @author     Par0noid Solutions
2172
-  * @param		array	$data	instanceProperties
2173
-  * @return     boolean success
2174
-  */
2175
-	function instanceEdit($data) {
2176
-		if(count($data) > 0) {
2177
-			$settingsString = '';
2178
-			
2179
-			foreach($data as $key => $val) {
2180
-				$settingsString .= ' '.$key.'='.$this->escapeText($val);
2181
-			}
2182
-			return $this->getData('boolean', 'instanceedit '.$settingsString);
2183
-		}else{
2184
-			$this->addDebugLog('empty array entered');
2185
-			return $this->generateOutput(false, array('Error: You can \'t give an empty array'), false);
2186
-		}
2187
-	}
2188
-
2189
-/**
2190
-  * instanceInfo
2191
-  * 
2192
-  * Displays the server instance configuration including database revision number, the file transfer port, default group IDs, etc.
2193
-  *
2194
-  * <b>Output:</b>
2195
-  * <pre>
2196
-  * Array
2197
-  * {
2198
-  *  [serverinstance_database_version] => 20
2199
-  *  [serverinstance_filetransfer_port] => 30033
2200
-  *  [serverinstance_max_download_total_bandwidth] => 18446744073709551615
2201
-  *  [serverinstance_max_upload_total_bandwidth] => 18446744073709551615
2202
-  *  [serverinstance_guest_serverquery_group] => 1
2203
-  *  [serverinstance_serverquery_flood_commands] => 10
2204
-  *  [serverinstance_serverquery_flood_time] => 3
2205
-  *  [serverinstance_serverquery_ban_time] => 600
2206
-  *  [serverinstance_template_serveradmin_group] => 3
2207
-  *  [serverinstance_template_serverdefault_group] => 5
2208
-  *  [serverinstance_template_channeladmin_group] => 1
2209
-  *  [serverinstance_template_channeldefault_group] => 4
2210
-  *  [serverinstance_permissions_version] => 15
2211
-  * }
2212
-  * </pre>
2213
-  *
2214
-  * @author     Par0noid Solutions
2215
-  * @return     array instanceInformation
2216
-  */
2217
-	function instanceInfo() {
2218
-		return $this->getData('array', 'instanceinfo');
2219
-	}
2220
-
2221
-/**
2222
-  * logAdd
2223
-  * 
2224
-  * Writes a custom entry into the servers log. Depending on your permissions, you'll be able to add entries into the server instance log and/or your virtual servers log. The loglevel parameter specifies the type of the entry.
2225
-  *
2226
-  * @author     Par0noid Solutions
2227
-  * @param		integer	$logLevel	loglevel between 1 and 4
2228
-  * @param		string	$logMsg		logMessage
2229
-  * @return     boolean success
2230
-  */
2231
-	function logAdd($logLevel, $logMsg) {
2232
-		if($logLevel >=1 and $logLevel <= 4) { 
2233
-			if(!empty($logMsg)) {
2234
-				return $this->getData('boolean', 'logadd loglevel='.$logLevel.' logmsg='.$this->escapeText($logMsg));
2235
-			}else{
2236
-				$this->addDebugLog('logMessage empty!');
2237
-				return $this->generateOutput(false, array('Error: logMessage empty!'), false);
2238
-			}
2239
-		}else{
2240
-			$this->addDebugLog('invalid logLevel!');
2241
-			return $this->generateOutput(false, array('Error: invalid logLevel!'), false);
2242
-		}
2243
-	}
2244
-
2245
-/**
2246
-  * login
2247
-  * 
2248
-  * Authenticates with the TeamSpeak 3 Server instance using given ServerQuery login credentials.
2249
-  *
2250
-  * @author     Par0noid Solutions
2251
-  * @param		string	$username	username
2252
-  * @param		string	$password	password
2253
-  * @return     boolean success
2254
-  */
2255
-	function login($username, $password) {
2256
-		return $this->getData('boolean', 'login '.$this->escapeText($username).' '.$this->escapeText($password));
2257
-	}
2258
-
2259
-/**
2260
-  * logout
2261
-  * 
2262
-  * Deselects the active virtual server and logs out from the server instance.
2263
-  *
2264
-  * @author     Par0noid Solutions
2265
-  * @return     boolean success
2266
-  */
2267
-	function logout() {
2268
-		$this->runtime['selected'] = false;
2269
-		return $this->getData('boolean', 'logout');
2270
-	}
2271
-
2272
-/**
2273
-  * logView
2274
-  * 
2275
-  * Displays a specified number of entries from the servers log. If instance is set to 1, the server will return lines from the master logfile (ts3server_0.log) instead of the selected virtual server logfile.
2276
-  * 
2277
-  * <b>Output:</b>
2278
-  * <pre>
2279
-  * Array
2280
-  * {
2281
-  *  [last_pos] => 0
2282
-  *  [file_size] => 1085
2283
-  *  [l] => 2012-01-10 20:34:31.379260|INFO    |ServerLibPriv |   | TeamSpeak 3 Server 3.0.1 (2011-11-17 07:34:30)
2284
-  * }
2285
-  * {
2286
-  *  [l] => 2012-01-10 20:34:31.380260|INFO    |DatabaseQuery |   | dbPlugin name:    SQLite3 plugin, Version 2, (c)TeamSpeak Systems GmbH
2287
-  * }
2288
-  * {
2289
-  *  [l] => 2012-01-10 20:34:31.380260|INFO    |DatabaseQuery |   | dbPlugin version: 3.7.3
2290
-  * }
2291
-  * </pre>
2292
-  *
2293
-  * @author     Par0noid Solutions
2294
-  * @param		integer	$lines	between 1 and 100
2295
-  * @param		integer	$reverse	{1|0} [optional]
2296
-  * @param		integer	$instance	{1|0} [optional]
2297
-  * @param		integer	$begin_pos	{1|0} [optional]
2298
-  * @return     multidimensional-array logEntries
2299
-  */
2300
-	function logView($lines, $reverse = 0, $instance = 0, $begin_pos = 0) {		
2301
-		if($lines >=1 and $lines <=100) {
2302
-			return $this->getData('multi', 'logview lines='.$lines.' reverse='.($reverse == 0 ? '0' : '1').' instance='.($instance == 0 ? '0' : '1').' begin_pos='.($begin_pos == 0 ? '0' : $begin_pos));
2303
-		}else{
2304
-			$this->addDebugLog('please choose a limit between 1 and 100');
2305
-			$this->generateOutput(false, array('Error: please choose a limit between 1 and 100'), false);
2306
-		}
2307
-	}
2308
-
2309
-/**
2310
-  * permIdGetByName
2311
-  * 
2312
-  * Displays the database ID of one or more permissions specified by permsid.
2313
-  *
2314
-  * <b>Input-Array like this:</b>
2315
-  * <pre>
2316
-  * $permissions = array();
2317
-  * $permissions[] = 'permissionName';
2318
-  * </pre>
2319
-  * <b>Output:</b>
2320
-  * <pre>
2321
-  * Array
2322
-  * {
2323
-  *  [permsid] => b_serverinstance_help_view
2324
-  *  [permid] => 4353
2325
-  * }
2326
-  * </pre>
2327
-  *
2328
-  * @author     Par0noid Solutions
2329
-  * @param		string	$permsids		permNames
2330
-  * @return     array	permissionList 
2331
-  */
2332
-	function permIdGetByName($permsids) {
2333
-		$permissionArray = array();
2334
-		
2335
-		if(count($permsids) > 0) {
2336
-			foreach($permsids AS $value) {
2337
-				$permissionArray[] = 'permsid='.$value;
2338
-			}
2339
-			return $this->getData('multi', 'permidgetbyname '.$this->escapeText(implode('|', $permissionArray)));
2340
-		}else{
2341
-			$this->addDebugLog('no permissions given');
2342
-			return $this->generateOutput(false, array('Error: no permissions given'), false);
2343
-		}
2344
-		
2345
-	}
2346
-
2347
-
2348
-/**
2349
-  * permissionList
2350
-  * 
2351
-  * Displays a list of permissions available on the server instance including ID, name and description.
2352
-  * If the new parameter is set the permissionlist will return with the new output format.
2353
-  *
2354
-  * <b>Output: (with new parameter)</b>
2355
-  * <pre>
2356
-  * [0] => Array
2357
-  *     (
2358
-  *         [num] => 1
2359
-  *         [group_id_end] => 0
2360
-  *         [pcount] => 0
2361
-  *     )
2362
-  *
2363
-  * [1] => Array
2364
-  *     (
2365
-  *         [num] => 2
2366
-  *         [group_id_end] => 7
2367
-  *         [pcount] => 7
2368
-  *         [permissions] => Array
2369
-  *             (
2370
-  *                 [0] => Array
2371
-  *                     (
2372
-  *                         [permid] => 1
2373
-  *                         [permname] => b_serverinstance_help_view
2374
-  *                         [permdesc] => Retrieve information about ServerQuery commands
2375
-  *                         [grantpermid] => 32769
2376
-  *                     )
2377
-  *
2378
-  *                 [1] => Array
2379
-  *                     (
2380
-  *                         [permid] => 2
2381
-  *                         [permname] => b_serverinstance_version_view
2382
-  *                         [permdesc] => Retrieve global server version (including platform and build number)
2383
-  *                         [grantpermid] => 32770
2384
-  *                     )
2385
-  *
2386
-  *                 [2] => Array
2387
-  *                     (
2388
-  *                         [permid] => 3
2389
-  *                         [permname] => b_serverinstance_info_view
2390
-  *                         [permdesc] => Retrieve global server information
2391
-  *                         [grantpermid] => 32771
2392
-  *                     )
2393
-  *
2394
-  *                 [3] => Array
2395
-  *                     (
2396
-  *                         [permid] => 4
2397
-  *                         [permname] => b_serverinstance_virtualserver_list
2398
-  *                         [permdesc] => List virtual servers stored in the database
2399
-  *                         [grantpermid] => 32772
2400
-  *                     )
2401
-  *
2402
-  *                 [4] => Array
2403
-  *                     (
2404
-  *                         [permid] => 5
2405
-  *                         [permname] => b_serverinstance_binding_list
2406
-  *                         [permdesc] => List active IP bindings on multi-homed machines
2407
-  *                         [grantpermid] => 32773
2408
-  *                     )
2409
-  *
2410
-  *                [5] => Array
2411
-  *                     (
2412
-  *                         [permid] => 6
2413
-  *                         [permname] => b_serverinstance_permission_list
2414
-  *                         [permdesc] => List permissions available available on the server instance
2415
-  *                         [grantpermid] => 32774
2416
-  *                     )
2417
-  *
2418
-  *                 [6] => Array
2419
-  *                     (
2420
-  *                         [permid] => 7
2421
-  *                         [permname] => b_serverinstance_permission_find
2422
-  *                         [permdesc] => Search permission assignments by name or ID
2423
-  *                         [grantpermid] => 32775
2424
-  *                     )
2425
-  *
2426
-  *             )
2427
-  *
2428
-  *     )
2429
-  * </pre>
2430
-  *
2431
-  * @author     Par0noid Solutions
2432
-  * @param		boolean		$new		[optional] add new parameter
2433
-  * @return     array permissionList
2434
-  */
2435
-	function permissionList($new = false) {
2436
-		if($new === true) {
2437
-			$groups = array();
2438
-			$permissions = array();
2439
-			
2440
-			$response = $this->getElement('data', $this->getData('multi', 'permissionlist -new'));
2441
-			
2442
-			$gc = 1;
2443
-			
2444
-			foreach($response as $field) {
2445
-				if(isset($field['group_id_end'])) {
2446
-					$groups[] = array('num' => $gc, 'group_id_end' => $field['group_id_end']);
2447
-					$gc++;
2448
-				}else{
2449
-					$permissions[] = $field;
2450
-				}
2451
-			}
2452
-			
2453
-			$counter = 0;
2454
-			
2455
-			for($i = 0; $i < count($groups); $i++) {
2456
-				$rounds = $groups[$i]['group_id_end'] - $counter;
2457
-				$groups[$i]['pcount'] = $rounds;
2458
-				for($j = 0; $j < $rounds; $j++) {
2459
-					$groups[$i]['permissions'][] = array('permid' => ($counter + 1), 'permname' => $permissions[$counter]['permname'], 'permdesc' => $permissions[$counter]['permdesc'], 'grantpermid' => ($counter + 32769));
2460
-					$counter++;
2461
-				}
2462
-			}
2463
-			
2464
-			return $groups;
2465
-			
2466
-		}else{
2467
-			return $this->getData('multi', 'permissionlist');
2468
-		}
2469
-	}
2470
-
2471
-/**
2472
-  * permOverview
2473
-  * 
2474
-  * Displays all permissions assigned to a client for the channel specified with cid. If permid is set to 0, all permissions will be displayed. A permission can be specified by permid or permsid.
2475
-  *
2476
-  * <b>Output:</b>
2477
-  * <pre>
2478
-  * Array
2479
-  * {
2480
-  *  [t] => 0
2481
-  *  [id1] => 2
2482
-  *  [id2] => 0
2483
-  *  [p] => 16777
2484
-  *  [v] => 1
2485
-  *  [n] => 0
2486
-  *  [s] => 0
2487
-  * }
2488
-  * </pre>
2489
-  *
2490
-  * @author     Par0noid Solutions
2491
-  * @param		integer		$cid		cchannelId
2492
-  * @param		integer 	$cldbid		clientDbId
2493
-  * @param		integer 	$permid		permId (Default: 0)
2494
-  * @param		string	 	$permsid	permName
2495
-  * @return     array permOverview
2496
-  */
2497
-	function permOverview($cid, $cldbid, $permid='0', $permsid=false ) { 
2498
-        if(!$this->runtime['selected']) { return $this->checkSelected(); } 
2499
-        if($permsid) { $additional = ' permsid='.$permsid; }else{ $additional = ''; } 
2500
-         
2501
-        return $this->getData('multi', 'permoverview cid='.$cid.' cldbid='.$cldbid.' permid='.$permid.$additional); 
3529
+ * checkSelected throws out 2 errors
3530
+ *
3531
+ * <b>Output:</b>
3532
+ * <pre>
3533
+ * Array
3534
+ * {
3535
+ *  [success] => false
3536
+ *  [errors] => Array 
3537
+ *  [data] => false
3538
+ * }
3539
+ * </pre>
3540
+ *
3541
+ * @author     Par0noid Solutions
3542
+ * @return     array error
3543
+ */
3544
+    private function checkSelected() {
3545
+        $backtrace = debug_backtrace();
3546
+        $this->addDebugLog('you can\'t use this function if no server is selected', $backtrace[1]['function'], $backtrace[0]['line']);
3547
+        return $this->generateOutput(false, array('you can\'t use this function if no server is selected'), false);
2502 3548
     }
2503
- 
3549
+
2504 3550
 /**
2505
-  * quit closes the connection to host 
2506
-  *
2507
-  * @author     Par0noid Solutions
2508
-  * @return 	none
2509
-  */
2510
-	private function quit() {
2511
-		$this->logout();
2512
-		@fputs($this->runtime['socket'], "quit\n");
2513
-		@fclose($this->runtime['socket']);
2514
-	}
2515
-
2516
-/**
2517
-  * selectServer
2518
-  * 
2519
-  * Selects the virtual server specified with sid or port to allow further interaction. The ServerQuery client will appear on the virtual server and acts like a real TeamSpeak 3 Client, except it's unable to send or receive voice data. If your database contains multiple virtual servers using the same UDP port, use will select a random virtual server using the specified port.
2520
-  *
2521
-  * @author     Par0noid Solutions
2522
-  * @param		integer	$value		Port or ID
2523
-  * @param		string	$type		value type ('port', 'serverId') (default='port')
2524
-  * @param		boolean	$virtual	set true to add -virtual param [optional]
2525
-  * @return     boolean success
2526
-  */
2527
-	function selectServer($value, $type = 'port', $virtual = false) { 
2528
-        if(in_array($type, array('port', 'serverId'))) { 
2529
-            if($type == 'port') { 
2530
-                if($virtual) { $virtual = ' -virtual'; }else{ $virtual = ''; } 
2531
-                $res = $this->getData('boolean', 'use port='.$value.$virtual); 
2532
-                if($res['success']) { 
2533
-                    $this->runtime['selected'] = true; 
2534
-                } 
2535
-                return $res; 
2536
-            }else{ 
2537
-                if($virtual) { $virtual = ' -virtual'; }else{ $virtual = ''; } 
2538
-                $res = $this->getData('boolean', 'use sid='.$value.$virtual); 
2539
-                if($res['success']) { 
2540
-                    $this->runtime['selected'] = true; 
2541
-                } 
2542
-                return $res; 
2543
-            } 
2544
-        }else{ 
2545
-            $this->addDebugLog('wrong value type'); 
2546
-            return $this->generateOutput(false, array('Error: wrong value type'), false); 
2547
-        } 
3551
+ * convertSecondsToStrTime
3552
+ * 
3553
+ * Converts seconds to a strTime (bsp. 5d 1h 23m 19s)
3554
+ *
3555
+ * @author     Par0noid Solutions
3556
+ * @param		integer	$seconds	time in seconds
3557
+ * @return     string strTime
3558
+ */
3559
+        public function convertSecondsToStrTime($seconds) {
3560
+        $conv_time = $this->convertSecondsToArrayTime($seconds);
3561
+        return $conv_time['days'].'d '.$conv_time['hours'].'h '.$conv_time['minutes'].'m '.$conv_time['seconds'].'s';
2548 3562
     }
2549 3563
 
2550 3564
 /**
2551
-  * sendMessage
2552
-  * 
2553
-  * Sends a text message a specified target. The type of the target is determined by targetmode while target specifies the ID of the recipient, whether it be a virtual server, a channel or a client.
2554
-  * <b>Hint:</b> You can just write to the channel the query client is in. See link in description for details.
2555
-  *
2556
-  * <b>Modes:</b>
2557
-  * <ul>
2558
-  * 	<li><b>1:</b> send to client</li>
2559
-  * 	<li><b>2:</b> send to channel</li>
2560
-  * 	<li><b>3:</b> send to server</li>
2561
-  * </ul>
2562
-  * <b>Targets:</b>
2563
-  * <ul>
2564
-  * 	<li>clientID</li>
2565
-  * 	<li>channelID</li>
2566
-  * 	<li>serverID</li>
2567
-  * </ul>
2568
-  *
2569
-  * @author     Par0noid Solutions
2570
-  * @param		integer $mode
2571
-  * @param		integer $target
2572
-  * @param		string	$msg	Message
2573
-  * @see		http://forum.teamspeak.com/showthread.php/84280-Sendtextmessage-by-query-client http://forum.teamspeak.com/showthread.php/84280-Sendtextmessage-by-query-client
2574
-  * @return     boolean	success
2575
-  */
2576
-	function sendMessage($mode, $target, $msg) {
2577
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2578
-		return $this->getData('boolean', 'sendtextmessage targetmode='.$mode.' target='.$target.' msg='.$this->escapeText($msg));
2579
-	}
2580
-
2581
-/**
2582
-  * serverCreate
2583
-  * 
2584
-  * Creates a new virtual server using the given properties and displays its ID, port and initial administrator privilege key. If virtualserver_port is not specified, the server will test for the first unused UDP port. The first virtual server will be running on UDP port 9987 by default. Subsequently started virtual servers will be running on increasing UDP port numbers.
2585
-  * 
2586
-  * <b>Input-Array like this:</b>
2587
-  * <pre>
2588
-  * $data = array();
2589
-  *	
2590
-  * $data['setting'] = 'value';
2591
-  * $data['setting'] = 'value';
2592
-  * </pre>
2593
-  *
2594
-  * <b>Output:</b>
2595
-  * <pre>
2596
-  * Array
2597
-  * {
2598
-  *  [sid] => 2
2599
-  *  [virtualserver_port] => 9988
2600
-  *  [token] => eKnFZQ9EK7G7MhtuQB6+N2B1PNZZ6OZL3ycDp2OW
2601
-  * }
2602
-  * </pre>
2603
-  *
2604
-  * @author     Par0noid Solutions
2605
-  * @param		array	$data	serverSettings	[optional]
2606
-  * @return     array serverInfo
2607
-  */
2608
-	function serverCreate($data = array()) {
2609
-		$settingsString = '';
2610
-		
2611
-		if(count($data) == 0) {	$data['virtualserver_name'] = 'Teamspeak 3 Server'; }
2612
-		
2613
-		
2614
-		foreach($data as $key => $value) {
2615
-			if(!empty($value)) { $settingsString .= ' '.$key.'='.$this->escapeText($value); }
2616
-		}
2617
-		
2618
-		return $this->getData('array', 'servercreate'.$settingsString);
2619
-	}
2620
-
2621
-/**
2622
-  * serverDelete
2623
-  * 
2624
-  * Deletes the virtual server specified with sid. Please note that only virtual servers in stopped state can be deleted.
2625
-  *
2626
-  * @author     Par0noid Solutions
2627
-  * @param		integer	$sid	serverID
2628
-  * @return     boolean success
2629
-  */
2630
-	function serverDelete($sid) {
2631
-		$this->serverStop($sid);
2632
-		return $this->getdata('boolean', 'serverdelete sid='.$sid);
2633
-	}
2634
-
2635
-/**
2636
-  * serverEdit
2637
-  * 
2638
-  * Changes the selected virtual servers configuration using given properties. Note that this command accepts multiple properties which means that you're able to change all settings of the selected virtual server at once.
2639
-  *
2640
-  * <b>Input-Array like this:</b>
2641
-  * <pre>
2642
-  * $data = array();
2643
-  *	
2644
-  * $data['setting'] = 'value';
2645
-  * $data['setting'] = 'value';
2646
-  * </pre>
2647
-  *
2648
-  * @author     Par0noid Solutions
2649
-  * @param		array	$data	serverSettings
2650
-  * @return     boolean success
2651
-  */
2652
-	function serverEdit($data) {
2653
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2654
-		
2655
-		$settingsString = '';
2656
-		
2657
-		foreach($data as $key => $value) {
2658
-			$settingsString .= ' '.$key.'='.$this->escapeText($value);
2659
-		}
2660
-		
2661
-		return $this->getData('boolean', 'serveredit'.$settingsString);
2662
-	}
2663
-
2664
-/**
2665
-  * serverGroupAdd
2666
-  * 
2667
-  * Creates a new server group using the name specified with name and displays its ID. The optional type parameter can be used to create ServerQuery groups and template groups. For detailed information, see
2668
-  *
2669
-  * <b>Output:</b>
2670
-  * <pre>
2671
-  * Array
2672
-  * {
2673
-  *  [sgid] => 86
2674
-  * }
2675
-  * </pre>
2676
-  *
2677
-  * @author     Par0noid Solutions
2678
-  * @param		integer $name	groupName
2679
-  * @param		integer	$type	groupDbType (0 = template, 1 = normal, 2 = query | Default: 1)
2680
-  * @return     array groupId
2681
-  */
2682
-	function serverGroupAdd($name, $type = 1) {
2683
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2684
-		return $this->getData('array', 'servergroupadd name='.$this->escapeText($name).' type='.$type);
2685
-	}
2686
-
2687
-/**
2688
-  * serverGroupAddClient
2689
-  * 
2690
-  * Adds a client to the server group specified with sgid. Please note that a client cannot be added to default groups or template groups.
2691
-  *
2692
-  * @author     Par0noid Solutions
2693
-  * @param		integer $sgid	serverGroupId
2694
-  * @param		integer $cldbid	clientDBID
2695
-  * @return     boolean success
2696
-  */
2697
-	function serverGroupAddClient($sgid, $cldbid) {
2698
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2699
-		return $this->getData('boolean', 'servergroupaddclient sgid='.$sgid.' cldbid='.$cldbid);
2700
-	}
2701
-
2702
-/**
2703
-  * serverGroupAddPerm
2704
-  * 
2705
-  * Adds a set of specified permissions to the server group specified with sgid. Multiple permissions can be added by providing the four parameters of each permission. A permission can be specified by permid or permsid.
2706
-  *
2707
-  * <b>Input-Array like this:</b>
2708
-  * <pre>
2709
-  * $permissions = array();
2710
-  * $permissions['permissionID'] = array('permissionValue', 'permskip', 'permnegated');
2711
-  * //or you could use
2712
-  * $permissions['permissionName'] = array('permissionValue', 'permskip', 'permnegated');
2713
-  * </pre>
2714
-  * 
2715
-  * @author     Par0noid Solutions
2716
-  * @param		integer $sgid	groupID
2717
-  * @param		array	$permissions	permissions
2718
-  * @return     boolean success
2719
-  */
2720
-	function serverGroupAddPerm($sgid, $permissions) {
2721
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2722
-		
2723
-		if(count($permissions) > 0) {
2724
-			//Permissions given
2725
-				
2726
-			//Errorcollector
2727
-			$errors = array();
2728
-				
2729
-			//Split Permissions to prevent query from overload
2730
-			$permissions = array_chunk($permissions, 50, true);
2731
-				
2732
-			//Action for each splitted part of permission
2733
-			foreach($permissions as $permission_part)
2734
-			{
2735
-				//Create command_string for each command that we could use implode later
2736
-				$command_string = array();
2737
-		
2738
-				foreach($permission_part as $key => $value)
2739
-				{
2740
-					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value[0].' permskip='.$value[1].' permnegated='.$value[2];
2741
-				}
2742
-		
2743
-				$result = $this->getData('boolean', 'servergroupaddperm sgid='.$sgid.' '.implode('|', $command_string));
2744
-		
2745
-				if(!$result['success'])
2746
-				{
2747
-					foreach($result['errors'] as $error)
2748
-					{
2749
-						$errors[] = $error;
2750
-					}
2751
-				}
2752
-			}
2753
-				
2754
-			if(count($errors) == 0)
2755
-			{
2756
-				return $this->generateOutput(true, array(), true);
2757
-			}else{
2758
-				return $this->generateOutput(false, $errors, false);
2759
-			}
2760
-				
2761
-		}else{
2762
-			// No permissions given
2763
-			$this->addDebugLog('no permissions given');
2764
-			return $this->generateOutput(false, array('Error: no permissions given'), false);
2765
-		}
2766
-		/*
2767
-		old code
2768
-		
2769
-        $error = false;
2770
-        $results = array();
2771
-        
2772
-        if(count($permissions) > 0) {
2773
-     		$new = array();
2774
- 
2775
-    		$i = 0;
2776
-    		$k = 0;
2777
-    		foreach($permissions as $ke => $va) {
2778
-        		if($i > 149){ $i = 0; $k++; }else{ $i++; }
2779
-        		$new[$k][$ke] = $va;
2780
-    		}
2781
-    		
2782
-    		foreach($new as $perms) {
2783
-    			$permissionArray = array();
2784
-    			foreach($perms as $key => $value) {
2785
-    				$permissionArray[] = 'permid='.$key.' permvalue='.$value[0].' permskip='.$value[1].' permnegated='.$value[2];
2786
-    			}
2787
-				$result = $this->getData('boolean', 'servergroupaddperm sgid='.$sgid.' '.implode('|', $permissionArray));
2788
-				if(!$result['success']) { $error = true; }
2789
-    			$results[] = $result;
2790
-    		}
2791
-    		
2792
-    		if($error) {
2793
-    			$returnErrors = array();
2794
-    			foreach($results as $errorResult) {
2795
-    				if(count($errorResult['errors']) > 0) {
2796
-    					foreach($errorResult['errors'] as $errorResultError) {
2797
-    						$returnErrors[] = $errorResultError;
2798
-    					}
2799
-    				}
2800
-    			}
2801
-    			return $this->generateOutput(false, $returnErrors, false);
2802
-    		}else{
2803
-    			return $this->generateOutput(true, array(), true);
2804
-    		}
2805
-        }else{
2806
-            $this->addDebugLog('no permissions given');
2807
-            return $this->generateOutput(false, array('Error: no permissions given'), false);
2808
-        }*/
2809
-		
2810
-	}
2811
-
2812
-/**
2813
-  * serverGroupClientList
2814
-  * 
2815
-  * Displays the IDs of all clients currently residing in the server group specified with sgid. If you're using the optional -names option, the output will also contain the last known nickname and the unique identifier of the clients.
2816
-  *
2817
-  * <b>Possible params:</b> -names
2818
-  *
2819
-  * <b>Output: (with -names param)</b>
2820
-  * <pre>
2821
-  * Array
2822
-  * {
2823
-  *  [cldbid] => 2017
2824
-  *  [client_nickname] => Par0noid //with -names parameter
2825
-  *  [client_unique_identifier] => nUixbsq/XakrrmbqU8O30R/D8Gc=
2826
-  * }
2827
-  * </pre>
2828
-  *
2829
-  * @author     Par0noid Solutions
2830
-  * @param		integer	$sgid		groupId
2831
-  * @param		boolean	$names		set true to add -names param [optional]
2832
-  * @return     multidimensional-array	serverGroupClientList
2833
-  */
2834
-	function serverGroupClientList($sgid, $names = false) {
2835
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2836
-		if($names) { $names = ' -names'; }else{ $names = ''; }
2837
-		return $this->getData('multi', 'servergroupclientlist sgid='.$sgid.$names);
2838
-	}
2839
-
2840
-/**
2841
-  * serverGroupCopy
2842
-  * 
2843
-  * Creates a copy of the server group specified with ssgid. If tsgid is set to 0, the server will create a new group. To overwrite an existing group, simply set tsgid to the ID of a designated target group. If a target group is set, the name parameter will be ignored.
2844
-  *
2845
-  * <b>Output:</b>
2846
-  * <pre>
2847
-  * Array
2848
-  * {
2849
-  *  [sgid] => 86
2850
-  * }
2851
-  * </pre>
2852
-  *
2853
-  * @author     Par0noid Solutions
2854
-  * @param		integer	$ssgid	sourceGroupID
2855
-  * @param		integer	$tsgid	targetGroupID
2856
-  * @param		integer $name	groupName
2857
-  * @param		integer	$type	groupDbType (0 = template, 1 = normal, 2 = query | Default: 1)
2858
-  * @return     array groupId
2859
-  */
2860
-	function serverGroupCopy($ssgid, $tsgid, $name, $type = 1) {
2861
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2862
-		return $this->getData('array', 'servergroupcopy ssgid='.$ssgid.' tsgid='.$tsgid.' name='.$this->escapeText($name).' type='.$type);
2863
-	}
2864
-
2865
-/**
2866
-  * serverGroupDelete
2867
-  * 
2868
-  * 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.
2869
-  *
2870
-  * @author     Par0noid Solutions
2871
-  * @param		integer $sgid	serverGroupID
2872
-  * @param		integer $force 	forces deleting group (Default: 1)
2873
-  * @return     boolean success
2874
-  */
2875
-	function serverGroupDelete($sgid, $force = 1) {
2876
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2877
-		return $this->getData('boolean', 'servergroupdel sgid='.$sgid.' force='.$force);
2878
-	}
2879
-
2880
-/**
2881
-  * serverGroupDeleteClient
2882
-  * 
2883
-  * Removes a client specified with cldbid from the server group specified with sgid.
2884
-  *
2885
-  * @author     Par0noid Solutions
2886
-  * @param		integer $sgid	groupID
2887
-  * @param		integer $cldbid	clientDBID
2888
-  * @return     boolean success
2889
-  */
2890
-	function serverGroupDeleteClient($sgid, $cldbid) {
2891
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2892
-		return $this->getData('boolean', 'servergroupdelclient sgid='.$sgid.' cldbid='.$cldbid);
2893
-	}
2894
-
2895
-/**
2896
-  * serverGroupDeletePerm
2897
-  * 
2898
-  * Removes a set of specified permissions from the server group specified with sgid. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.
2899
-  *
2900
-  * <b>Input-Array like this:</b>
2901
-  * <pre>
2902
-  * $permissions = array();
2903
-  * $permissions[] = 'permissionID';
2904
-  * //or you could use
2905
-  * $permissions[] = 'permissionName';
2906
-  * </pre>
2907
-  *
2908
-  * @author     Par0noid Solutions
2909
-  * @param		integer		$sgid				serverGroupID
2910
-  * @param		array		$permissionIds		permissionIds
2911
-  * @return     boolean success
2912
-  */
2913
-	function serverGroupDeletePerm($sgid, $permissionIds) {
2914
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2915
-		$permissionArray = array();
2916
-		
2917
-		if(count($permissionIds) > 0) {
2918
-			foreach($permissionIds AS $value) {
2919
-				$permissionArray[] = is_numeric($value) ? 'permid='.$value : 'permsid='.$this->escapeText($value);
2920
-			}
2921
-			return $this->getData('boolean', 'servergroupdelperm sgid='.$sgid.' '.implode('|', $permissionArray));
2922
-		}else{
2923
-			$this->addDebugLog('no permissions given');
2924
-			return $this->generateOutput(false, array('Error: no permissions given'), false);
2925
-		}
2926
-	}
2927
-
2928
-/**
2929
-  * serverGroupList
2930
-  * 
2931
-  * Displays a list of server groups available. Depending on your permissions, the output may also contain global ServerQuery groups and template groups.
2932
-  *
2933
-  * <b>Output:</b>
2934
-  * <pre>
2935
-  * Array
2936
-  * {
2937
-  *  [sgid] => 1
2938
-  *  [name] => Guest Server Query
2939
-  *  [type] => 2
2940
-  *  [iconid] => 0
2941
-  *  [savedb] => 0
2942
-  * }
2943
-  * </pre>
2944
-  *
2945
-  * @author     Par0noid Solutions
2946
-  * @return     array serverGroupList
2947
-  */
2948
-	function serverGroupList() {
2949
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2950
-		return $this->getData('multi', 'servergrouplist');
2951
-	}
2952
-
2953
-/**
2954
-  * serverGroupPermList
2955
-  * 
2956
-  * Displays a list of permissions assigned to the server group specified with sgid. If the permsid option is specified, the output will contain the permission names instead of the internal IDs.
2957
-  *
2958
-  * <b>Output:</b>
2959
-  * <pre>
2960
-  * Array
2961
-  * {
2962
-  *  [permid] => 12876 (if permsid = false)
2963
-  *  [permsid] => b_client_info_view (if permsid = true)
2964
-  *  [permvalue] => 1
2965
-  *  [permnegated] => 0
2966
-  *  [permskip] => 0
2967
-  * }
2968
-  * </pre>
2969
-  *
2970
-  * @author     Par0noid Solutions
2971
-  * @param		integer	$sgid		serverGroupID
2972
-  * @param		boolean	$permsid	set true to add -permsid param [optional]
2973
-  * @return     array serverGroupPermList
2974
-  */
2975
-	function serverGroupPermList($sgid, $permsid = false) {
2976
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2977
-		if($permsid) { $additional = ' -permsid'; }else{ $additional = ''; }
2978
-		return $this->getData('multi', 'servergrouppermlist sgid='.$sgid.$additional);
2979
-	}
2980
-
2981
-/**
2982
-  * serverGroupRename
2983
-  * 
2984
-  * Changes the name of the server group specified with sgid.
2985
-  *
2986
-  * @author     Par0noid Solutions
2987
-  * @param		integer $sgid	serverGroupID
2988
-  * @param		integer $name	groupName
2989
-  * @return     boolean success
2990
-  */
2991
-	function serverGroupRename($sgid, $name) {
2992
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2993
-		return $this->getData('boolean', 'servergrouprename sgid='.$sgid.' name='.$this->escapeText($name));
2994
-	}
2995
-
2996
-/**
2997
-  * serverGroupsByClientID
2998
-  * 
2999
-  * Displays all server groups the client specified with cldbid is currently residing in.
3000
-  *
3001
-  * <b>Output:</b>
3002
-  * <pre>
3003
-  * Array
3004
-  * {
3005
-  *  [name] => Guest
3006
-  *  [sgid] => 73
3007
-  *  [cldbid] => 2
3008
-  * }
3009
-  * </pre>
3010
-  *
3011
-  * @author     Par0noid Solutions
3012
-  * @param		integer	$cldbid	clientDBID
3013
-  * @return     array serverGroupsByClientId
3014
-  */
3015
-	function serverGroupsByClientID($cldbid) {
3016
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3017
-		return $this->getData('multi', 'servergroupsbyclientid cldbid='.$cldbid);
3018
-	}
3019
-
3020
-/**
3021
-  * serverIdGetByPort
3022
-  * 
3023
-  * Displays the database ID of the virtual server running on the UDP port specified by virtualserver_port.
3024
-  * 
3025
-  * <b>Output:</b>
3026
-  * <pre>
3027
-  * Array
3028
-  * {
3029
-  *  [server_id] => 1
3030
-  * }
3031
-  * </pre>
3032
-  *
3033
-  * @author     Par0noid Solutions
3034
-  * @param		integer $port	serverPort
3035
-  * @return     array serverInfo
3036
-  */
3037
-	function serverIdGetByPort($port) {
3038
-		return $this->getData('array', 'serveridgetbyport virtualserver_port='.$port);
3039
-	}
3040
-
3041
-/**
3042
-  * serverInfo
3043
-  * 
3044
-  * Displays detailed configuration information about the selected virtual server including unique ID, number of clients online, configuration, etc.
3045
-  *	
3046
-  * <b>Output:</b>
3047
-  * <pre>
3048
-  * Array
3049
-  * {
3050
-  *  [virtualserver_unique_identifier] => 2T3SRCPoWKojKlNMx6qxV7gOe8A=
3051
-  *  [virtualserver_name] => TeamSpeak ]I[ Server
3052
-  *  [virtualserver_welcomemessage] => Welcome to TeamSpeak
3053
-  *  [virtualserver_platform] => Windows
3054
-  *  [virtualserver_version] => 3.0.6.1 [Build: 1340956745]
3055
-  *  [virtualserver_maxclients] => 32
3056
-  *  [virtualserver_password] => 
3057
-  *  [virtualserver_clientsonline] => 2
3058
-  *  [virtualserver_channelsonline] => 2
3059
-  *  [virtualserver_created] => 1361027787
3060
-  *  [virtualserver_uptime] => 2804
3061
-  *  [virtualserver_codec_encryption_mode] => 0
3062
-  *  [virtualserver_hostmessage] => 
3063
-  *  [virtualserver_hostmessage_mode] => 0
3064
-  *  [virtualserver_filebase] => files\\virtualserver_1
3065
-  *  [virtualserver_default_server_group] => 8
3066
-  *  [virtualserver_default_channel_group] => 8
3067
-  *  [virtualserver_flag_password] => 0
3068
-  *  [virtualserver_default_channel_admin_group] => 5
3069
-  *  [virtualserver_max_download_total_bandwidth] => 18446744073709551615
3070
-  *  [virtualserver_max_upload_total_bandwidth] => 18446744073709551615
3071
-  *  [virtualserver_hostbanner_url] => 
3072
-  *  [virtualserver_hostbanner_gfx_url] => 
3073
-  *  [virtualserver_hostbanner_gfx_interval] => 0
3074
-  *  [virtualserver_complain_autoban_count] => 5
3075
-  *  [virtualserver_complain_autoban_time] => 1200
3076
-  *  [virtualserver_complain_remove_time] => 3600
3077
-  *  [virtualserver_min_clients_in_channel_before_forced_silence] => 100
3078
-  *  [virtualserver_priority_speaker_dimm_modificator] => -18.0000
3079
-  *  [virtualserver_id] => 1
3080
-  *  [virtualserver_antiflood_points_tick_reduce] => 5
3081
-  *  [virtualserver_antiflood_points_needed_command_block] => 150
3082
-  *  [virtualserver_antiflood_points_needed_ip_block] => 250
3083
-  *  [virtualserver_client_connections] => 1
3084
-  *  [virtualserver_query_client_connections] => 6
3085
-  *  [virtualserver_hostbutton_tooltip] => 
3086
-  *  [virtualserver_hostbutton_url] => 
3087
-  *  [virtualserver_hostbutton_gfx_url] => 
3088
-  *  [virtualserver_queryclientsonline] => 1
3089
-  *  [virtualserver_download_quota] => 18446744073709551615
3090
-  *  [virtualserver_upload_quota] => 18446744073709551615
3091
-  *  [virtualserver_month_bytes_downloaded] => 0
3092
-  *  [virtualserver_month_bytes_uploaded] => 0
3093
-  *  [virtualserver_total_bytes_downloaded] => 0
3094
-  *  [virtualserver_total_bytes_uploaded] => 0
3095
-  *  [virtualserver_port] => 9987
3096
-  *  [virtualserver_autostart] => 1
3097
-  *  [virtualserver_machine_id] => 
3098
-  *  [virtualserver_needed_identity_security_level] => 8
3099
-  *  [virtualserver_log_client] => 0
3100
-  *  [virtualserver_log_query] => 0
3101
-  *  [virtualserver_log_channel] => 0
3102
-  *  [virtualserver_log_permissions] => 1
3103
-  *  [virtualserver_log_server] => 0
3104
-  *  [virtualserver_log_filetransfer] => 0
3105
-  *  [virtualserver_min_client_version] => 12369
3106
-  *  [virtualserver_name_phonetic] => 
3107
-  *  [virtualserver_icon_id] => 0
3108
-  *  [virtualserver_reserved_slots] => 0
3109
-  *  [virtualserver_total_packetloss_speech] => 0.0000
3110
-  *  [virtualserver_total_packetloss_keepalive] => 0.0000
3111
-  *  [virtualserver_total_packetloss_control] => 0.0000
3112
-  *  [virtualserver_total_packetloss_total] => 0.0000
3113
-  *  [virtualserver_total_ping] => 0.0000
3114
-  *  [virtualserver_ip] => 
3115
-  *  [virtualserver_weblist_enabled] => 1
3116
-  *  [virtualserver_ask_for_privilegekey] => 0
3117
-  *  [virtualserver_hostbanner_mode] => 0
3118
-  *  [virtualserver_status] => online
3119
-  *  [connection_filetransfer_bandwidth_sent] => 0
3120
-  *  [connection_filetransfer_bandwidth_received] => 0
3121
-  *  [connection_filetransfer_bytes_sent_total] => 0
3122
-  *  [connection_filetransfer_bytes_received_total] => 0
3123
-  *  [connection_packets_sent_speech] => 0
3124
-  *  [connection_bytes_sent_speech] => 0
3125
-  *  [connection_packets_received_speech] => 0
3126
-  *  [connection_bytes_received_speech] => 0
3127
-  *  [connection_packets_sent_keepalive] => 2055
3128
-  *  [connection_bytes_sent_keepalive] => 84255
3129
-  *  [connection_packets_received_keepalive] => 2055
3130
-  *  [connection_bytes_received_keepalive] => 86309
3131
-  *  [connection_packets_sent_control] => 90
3132
-  *  [connection_bytes_sent_control] => 13343
3133
-  *  [connection_packets_received_control] => 90
3134
-  *  [connection_bytes_received_control] => 9176
3135
-  *  [connection_packets_sent_total] => 2145
3136
-  *  [connection_bytes_sent_total] => 97598
3137
-  *  [connection_packets_received_total] => 2145
3138
-  *  [connection_bytes_received_total] => 95485
3139
-  *  [connection_bandwidth_sent_last_second_total] => 82
3140
-  *  [connection_bandwidth_sent_last_minute_total] => 81
3141
-  *  [connection_bandwidth_received_last_second_total] => 84
3142
-  *  [connection_bandwidth_received_last_minute_total] => 87
3143
-  * }
3144
-  * </pre>
3145
-  *
3146
-  * @author     Par0noid Solutions
3147
-  * @return     array serverInformation
3148
-  */
3149
-	function serverInfo() {
3150
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3151
-		return $this->getData('array', 'serverinfo');
3152
-	}
3153
-
3154
-/**
3155
-  * serverList
3156
-  * 
3157
-  * Displays a list of virtual servers including their ID, status, number of clients online, etc. If you're using the -all option, the server will list all virtual servers stored in the database. This can be useful when multiple server instances with different machine IDs are using the same database. The machine ID is used to identify the server instance a virtual server is associated with. The status of a virtual server can be either online, offline, deploy running, booting up, shutting down and virtual online. While most of them are self-explanatory, virtual online is a bit more complicated. Please note that whenever you select a virtual server which is currently stopped, it will be started in virtual mode which means you are able to change its configuration, create channels or change permissions, but no regular TeamSpeak 3 Client can connect. As soon as the last ServerQuery client deselects the virtual server, its status will be changed back to offline.
3158
-  *
3159
-  * <b>Possible params:</b> [-uid] [-short] [-all] [-onlyoffline]
3160
-  *
3161
-  * <b>Output:</b>
3162
-  * <pre>
3163
-  * Array
3164
-  * {
3165
-  *  [virtualserver_id] => 1 //displayed on -short
3166
-  *  [virtualserver_port] => 9987 //displayed on -short
3167
-  *  [virtualserver_status] => online //displayed on -short
3168
-  *  [virtualserver_clientsonline] => 2
3169
-  *  [virtualserver_queryclientsonline] => 1
3170
-  *  [virtualserver_maxclients] => 32
3171
-  *  [virtualserver_uptime] => 3045
3172
-  *  [virtualserver_name] => TeamSpeak ]I[ Server
3173
-  *  [virtualserver_autostart] => 1
3174
-  *  [virtualserver_machine_id] =>
3175
-  *  [-uid] => [virtualserver_unique_identifier] => bYrybKl/APfKq7xzpIJ1Xb6C06U= 
3176
-  * }
3177
-  * </pre>
3178
-  *
3179
-  * @author     Par0noid Solutions
3180
-  * @param		string		$options		optional parameters
3181
-  * @return     array serverList
3182
-  */
3183
-	function serverList($options = NULL) {
3184
-		return $this->getData('multi', 'serverlist'.(!empty($options) ? ' '.$options : ''));
3185
-	}
3186
-
3187
-/**
3188
-  * serverProcessStop
3189
-  * 
3190
-  * Stops the entire TeamSpeak 3 Server instance by shutting down the process.
3191
-  *
3192
-  * @author     Par0noid Solutions
3193
-  * @return     boolean success
3194
-  */
3195
-	function serverProcessStop() {
3196
-		return $this->getData('boolean', 'serverprocessstop');
3197
-	}
3198
-
3199
-/**
3200
-  * serverRequestConnectionInfo
3201
-  * 
3202
-  * Displays detailed connection information about the selected virtual server including uptime, traffic information, etc.
3203
-  *
3204
-  * <b>Output:</b>
3205
-  * <pre>
3206
-  * Array
3207
-  * {
3208
-  *  [connection_filetransfer_bandwidth_sent] => 0
3209
-  *  [connection_filetransfer_bandwidth_received] => 0
3210
-  *  [connection_filetransfer_bytes_sent_total] => 0
3211
-  *  [connection_filetransfer_bytes_received_total] => 0
3212
-  *  [connection_packets_sent_total] => 3333
3213
-  *  [connection_bytes_sent_total] => 149687
3214
-  *  [connection_packets_received_total] => 3333
3215
-  *  [connection_bytes_received_total] => 147653
3216
-  *  [connection_bandwidth_sent_last_second_total] => 123
3217
-  *  [connection_bandwidth_sent_last_minute_total] => 81
3218
-  *  [connection_bandwidth_received_last_second_total] => 352
3219
-  *  [connection_bandwidth_received_last_minute_total] => 87
3220
-  *  [connection_connected_time] => 3387
3221
-  *  [connection_packetloss_total] => 0.0000
3222
-  *  [connection_ping] => 0.0000
3223
-  * }
3224
-  * </pre>
3225
-  *
3226
-  * @author     Par0noid Solutions
3227
-  * @return     array serverRequestConnectionInfo
3228
-  */
3229
-	function serverRequestConnectionInfo() {
3230
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3231
-		return $this->getData('array', 'serverrequestconnectioninfo');
3232
-	}
3233
-
3234
-/**
3235
-  * serverSnapshotCreate
3236
-  * 
3237
-  * Displays a snapshot of the selected virtual server containing all settings, groups and known client identities. The data from a server snapshot can be used to restore a virtual servers configuration, channels and permissions using the serversnapshotdeploy command.
3238
-  *
3239
-  * @author     Par0noid Solutions
3240
-  * @return     string snapshot
3241
-  */
3242
-	function serverSnapshotCreate() {
3243
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3244
-		return $this->getData('plain', 'serversnapshotcreate');
3245
-	}
3246
-
3247
-/**
3248
-  * serverSnapshotDeploy
3249
-  * 
3250
-  * Restores the selected virtual servers configuration using the data from a previously created server snapshot. Please note that the TeamSpeak 3 Server does NOT check for necessary permissions while deploying a snapshot so the command could be abused to gain additional privileges.
3251
-  *
3252
-  * @author     Par0noid Solutions
3253
-  * @param		string	$snapshot	snapshot
3254
-  * @return     boolean success
3255
-  */
3256
-	function serverSnapshotDeploy($snapshot) {
3257
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3258
-		return $this->getData('boolean', 'serversnapshotdeploy '.$snapshot);
3259
-	}
3260
-	
3261
-/**
3262
-  * serverStart
3263
-  * 
3264
-  * Starts the virtual server specified with sid. Depending on your permissions, you're able to start either your own virtual server only or all virtual servers in the server instance.
3265
-  *
3266
-  * @author     Par0noid Solutions
3267
-  * @param		integer $sid	serverID
3268
-  * @return     boolean success
3269
-  */
3270
-	function serverStart($sid) {
3271
-		return $this->getdata('boolean', 'serverstart sid='.$sid);
3272
-	}	
3273
-
3274
-/**
3275
-  * serverStop
3276
-  * 
3277
-  * Stops the virtual server specified with sid. Depending on your permissions, you're able to stop either your own virtual server only or all virtual servers in the server instance.
3278
-  *
3279
-  * @author     Par0noid Solutions
3280
-  * @param		integer $sid	serverID
3281
-  * @return     boolean success
3282
-  */
3283
-	function serverStop($sid) {
3284
-		return $this->getdata('boolean', 'serverstop sid='.$sid);
3285
-	}
3286
-
3287
-/**
3288
-  * serverTemppasswordAdd
3289
-  * 
3290
-  * Sets a new temporary server password specified with pw. The temporary password will be valid for the number of seconds specified with duration. The client connecting with this password will automatically join the channel specified with tcid. If tcid is set to 0, the client will join the default channel.
3291
-  *
3292
-  * @author     Par0noid Solutions
3293
-  * @param		string	$pw				temporary password
3294
-  * @param		string	$duration		durations in seconds
3295
-  * @param		string	$desc			description [optional]
3296
-  * @param		string	$tcid			cid user enters on connect (0 = Default channel) [optional]
3297
-  * @param		string	$tcpw			channelPW
3298
-  * @return     boolean success
3299
-  */
3300
-	function serverTempPasswordAdd($pw, $duration, $desc = 'none', $tcid = 0, $tcpw = null) {
3301
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3302
-		return $this->getdata('boolean', 'servertemppasswordadd pw='.$this->escapeText($pw).' desc='.(!empty($desc) ? $this->escapeText($desc) : 'none').' duration='.$duration.' tcid='.$tcid.(!empty($tcpw) ? ' tcpw='.$this->escapeText($tcpw) : ''));
3303
-	}
3304
-
3305
-/**
3306
-  * serverTemppasswordDel
3307
-  * 
3308
-  * Deletes the temporary server password specified with pw.
3309
-  * 
3310
-  * @author     Par0noid Solutions
3311
-  * @param		string	$pw		temporary password
3312
-  * @return     boolean success
3313
-  */	
3314
-	function serverTempPasswordDel($pw) {
3315
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3316
-		return $this->getdata('boolean', 'servertemppassworddel pw='.$this->escapeText($pw));
3317
-	}
3318
-
3319
-/**
3320
-  * serverTemppasswordList
3321
-  * 
3322
-  * Returns a list of active temporary server passwords. The output contains the clear-text password, the nickname and unique identifier of the creating client.
3323
-  *
3324
-  * <b>Output:</b>
3325
-  * <pre>
3326
-  * Array
3327
-  * {
3328
-  *  [nickname] => serveradmin
3329
-  *  [uid] => 1
3330
-  *  [desc] => none
3331
-  *  [pw_clear] => test
3332
-  *  [start] => 1334996838
3333
-  *  [end] => 1335000438
3334
-  *  [tcid] => 0
3335
-  * }
3336
-  * </pre>
3337
-  *
3338
-  * @author     Par0noid Solutions
3339
-  * @return     array	serverTemppasswordList
3340
-  */
3341
-	function serverTempPasswordList() {
3342
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3343
-		return $this->getData('multi', 'servertemppasswordlist');
3344
-	}
3345
-	
3565
+ * convertSecondsToArrayTime
3566
+ * 
3567
+ * Converts seconds to a array: time
3568
+ *
3569
+ * <b>Output:</b>
3570
+ * <pre>
3571
+ * Array
3572
+ * {
3573
+ *  [days] => 3
3574
+ *  [hours] => 9
3575
+ *  [minutes] => 45
3576
+ *  [seconds] => 17
3577
+ * }
3578
+ * </pre>
3579
+ *
3580
+ * @author     Par0noid Solutions
3581
+ * @param		integer	$seconds	time in seconds
3582
+ * @return     array time
3583
+ */
3584
+        public function convertSecondsToArrayTime($seconds) {
3585
+        $conv_time = array();
3586
+        $conv_time['days']=floor($seconds / 86400);
3587
+        $conv_time['hours']=floor(($seconds - ($conv_time['days'] * 86400)) / 3600);
3588
+        $conv_time['minutes']=floor(($seconds - (($conv_time['days'] * 86400)+($conv_time['hours']*3600))) / 60);
3589
+        $conv_time['seconds']=floor(($seconds - (($conv_time['days'] * 86400)+($conv_time['hours']*3600)+($conv_time['minutes'] * 60))));
3590
+        return $conv_time;
3591
+    }
3346 3592
 
3347 3593
 /**
3348
-  *	setClientChannelGroup
3349
-  *
3350
-  * Sets the channel group of a client to the ID specified with cgid.
3351
-  *
3352
-  * @author     Par0noid Solutions
3353
-  * @param		integer $cgid	groupID
3354
-  * @param		integer $cid	channelID
3355
-  * @param		integer $cldbid	clientDBID
3356
-  * @return     boolean success
3357
-  */
3358
-	function setClientChannelGroup($cgid, $cid, $cldbid) {
3359
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3360
-		return $this->getData('boolean', 'setclientchannelgroup cgid='.$cgid.' cid='.$cid.' cldbid='.$cldbid);
3361
-	}
3362
-
3363
-/**
3364
-  * setName
3365
-  * 
3366
-  * Sets your nickname in server query
3367
-  *
3368
-  * @author     Par0noid Solutions
3369
-  * @param		string	$newName	new name in server query
3370
-  * @return     boolean success
3371
-  */
3372
-	function setName($newName) {
3373
-		return $this->getData('boolean', 'clientupdate client_nickname='.$this->escapeText($newName));
3374
-	}
3375
-
3376
-/**
3377
-  * tokenAdd
3378
-  * 
3379
-  * Create a new token. If tokentype is set to 0, the ID specified with tokenid1 will be a server group ID. Otherwise, tokenid1 is used as a channel group ID and you need to provide a valid channel ID using tokenid2. The tokencustomset parameter allows you to specify a set of custom client properties. This feature can be used when generating tokens to combine a website account database with a TeamSpeak user. The syntax of the value needs to be escaped using the ServerQuery escape patterns and has to follow the general syntax of:
3380
-  * ident=ident1 value=value1|ident=ident2 value=value2|ident=ident3 value=value3
3381
-  *
3382
-  * <b>Input-Array like this:</b>
3383
-  * <pre>
3384
-  * $customFieldSet = array();
3385
-  *	
3386
-  * $customFieldSet['ident'] = 'value';
3387
-  * $customFieldSet['ident'] = 'value';
3388
-  * </pre>
3389
-  *
3390
-  * @author     Par0noid Solutions
3391
-  * @param		integer	$tokentype				token type
3392
-  * @param		integer	$tokenid1				groupID
3393
-  * @param		integer	$tokenid2				channelID
3394
-  * @param		string	$description			token description [optional]
3395
-  * @param		array	$customFieldSet			customFieldSet [optional]
3396
-  * @return     array	tokenInformation
3397
-  */
3398
-	function tokenAdd($tokentype, $tokenid1, $tokenid2, $description ='', $customFieldSet = array()) {
3399
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3400
-		
3401
-		if(!empty($description)) { $description = ' tokendescription=' . $this->escapeText($description); }
3402
-
3403
-		if(count($customFieldSet)) {
3404
-			$settingsString = array();
3405
-		
3406
-			foreach($customFieldSet as $key => $value) {
3407
-				$settingsString[] = 'ident='.$this->escapeText($key).'\svalue='.$this->escapeText($value);
3408
-			}
3409
-			
3410
-			$customFieldSet = ' tokencustomset='.implode('|', $settingsString);
3411
-		}else{
3412
-			$customFieldSet = '';
3413
-		}
3414
-		
3415
-		return $this->getData('array', 'privilegekeyadd tokentype='.$tokentype.' tokenid1='.$tokenid1.' tokenid2='.$tokenid2.$description.$customFieldSet);
3416
-	}
3417
-
3418
-/**
3419
-  * tokenDelete
3420
-  * 
3421
-  * Deletes an existing token matching the token key specified with token.
3422
-  *
3423
-  * @author     Par0noid Solutions
3424
-  * @param		string	$token	token
3425
-  * @return     boolean success
3426
-  */
3427
-	function tokenDelete($token) {
3428
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }			
3429
-		return $this->getData('boolean', 'privilegekeydelete token='.$token);
3430
-	}
3431
-
3432
-/**
3433
-  * tokenList
3434
-  * 
3435
-  * Displays a list of privilege keys available including their type and group IDs. Tokens can be used to gain access to specified server or channel groups. A privilege key is similar to a client with administrator privileges that adds you to a certain permission group, but without the necessity of a such a client with administrator privileges to actually exist. It is a long (random looking) string that can be used as a ticket into a specific server group.
3436
-  *
3437
-  * <b>Output:</b>
3438
-  * <pre>
3439
-  * Array
3440
-  * {
3441
-  *  [token] => GdqedxSEDle3e9+LtR3o9dO09bURH+vymvF5hOJg
3442
-  *  [token_type] => 0
3443
-  *  [token_id1] => 71
3444
-  *  [token_id2] => 0
3445
-  *  [token_created] => 1286625908
3446
-  *  [token_description] => for you
3447
-  * }
3448
-  * </pre>
3449
-  *
3450
-  * @author     Par0noid Solutions
3451
-  * @return     array tokenListist 
3452
-  */
3453
-	function tokenList() {
3454
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3455
-
3456
-		return $this->getData('multi', 'privilegekeylist');
3457
-	}
3458
-
3459
-/**
3460
-  * tokenUse
3461
-  * 
3462
-  * 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.
3463
-  *
3464
-  * @author     Par0noid Solutions
3465
-  * @param		string	$token	token
3466
-  * @return     boolean success
3467
-  */
3468
-	function tokenUse($token) {
3469
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }			
3470
-		return $this->getData('boolean', 'privilegekeyuse token='.$token);
3471
-	}
3472
-
3473
-/**
3474
-  * version
3475
-  * 
3476
-  * Displays the servers version information including platform and build number.
3477
-  *
3478
-  * <b>Output:</b>
3479
-  * <pre>
3480
-  * Array
3481
-  * {
3482
-  *  [version] => 3.0.6.1
3483
-  *  [build] => 1340956745
3484
-  *  [platform] => Windows
3485
-  * }
3486
-  * </pre>
3487
-  *
3488
-  * @author     Par0noid Solutions
3489
-  * @return     array versionInformation
3490
-  */
3491
-	function version() {
3492
-		return $this->getData('array', 'version');
3493
-	}
3494
-
3495
-/**
3496
-  * whoAmI
3497
-  * 
3498
-  * Displays information about your current ServerQuery connection including your loginname, etc.
3499
-  *
3500
-  * <b>Output:</b>
3501
-  * <pre>
3502
-  * Array
3503
-  * {
3504
-  *  [virtualserver_status] => online
3505
-  *  [virtualserver_id] => 1
3506
-  *  [virtualserver_unique_identifier] => bYrybKl/APfKq7xzpIJ1Xb6C06U=
3507
-  *  [virtualserver_port] => 9987
3508
-  *  [client_id] => 5
3509
-  *  [client_channel_id] => 1
3510
-  *  [client_nickname] => serveradmin from 127.0.0.1:15208
3511
-  *  [client_database_id] => 1
3512
-  *  [client_login_name] => serveradmin
3513
-  *  [client_unique_identifier] => serveradmin
3514
-  *  [client_origin_server_id] => 0
3515
-  * }
3516
-  * </pre>
3517
-  *
3518
-  * @author     Par0noid Solutions
3519
-  * @return     array clientinformation
3520
-  */
3521
-	function whoAmI() {
3522
-		return $this->getData('array', 'whoami');
3523
-	}
3524
-
3525
-//*******************************************************************************************	
3526
-//************************************ Helper Functions ************************************
3527
-//*******************************************************************************************
3594
+ * getElement
3595
+ * 
3596
+ * Returns the given associated element from an array
3597
+ * This can be used to get a result in a one line operation
3598
+ * 
3599
+ * For example you got this array:
3600
+ * <pre>
3601
+ * Array
3602
+ * {
3603
+ *  [success] => false
3604
+ *  [errors] => Array 
3605
+ *  [data] => false
3606
+ * }
3607
+ * </pre>
3608
+ * Now you can grab the element like this:
3609
+ * <pre>
3610
+ * $ts = new ts3admin('***', '***');
3611
+ * 
3612
+ * if($ts->getElement('success', $ts->connect())) {
3613
+ *  //operation
3614
+ * }
3615
+ * </pre>
3616
+ *
3617
+ * @author     Par0noid Solutions
3618
+ * @param		string	$element	key of element
3619
+ * @param		array	$array		array
3620
+ * @return     mixed
3621
+ */
3622
+    public function getElement($element, $array) {
3623
+        return $array[$element];
3624
+    }
3528 3625
 
3529 3626
 /**
3530
-  * checkSelected throws out 2 errors
3531
-  *
3532
-  * <b>Output:</b>
3533
-  * <pre>
3534
-  * Array
3535
-  * {
3536
-  *  [success] => false
3537
-  *  [errors] => Array 
3538
-  *  [data] => false
3539
-  * }
3540
-  * </pre>
3541
-  *
3542
-  * @author     Par0noid Solutions
3543
-  * @return     array error
3544
-  */
3545
-	private function checkSelected() {
3546
-		$backtrace = debug_backtrace();
3547
-		$this->addDebugLog('you can\'t use this function if no server is selected', $backtrace[1]['function'], $backtrace[0]['line']);
3548
-		return $this->generateOutput(false, array('you can\'t use this function if no server is selected'), false);
3549
-	}
3550
-
3551
-/**
3552
-  * convertSecondsToStrTime
3553
-  * 
3554
-  * Converts seconds to a strTime (bsp. 5d 1h 23m 19s)
3555
-  *
3556
-  * @author     Par0noid Solutions
3557
-  * @param		integer	$seconds	time in seconds
3558
-  * @return     string strTime
3559
-  */
3560
- 	public function convertSecondsToStrTime($seconds) {
3561
-		$conv_time = $this->convertSecondsToArrayTime($seconds);
3562
-    	return $conv_time['days'].'d '.$conv_time['hours'].'h '.$conv_time['minutes'].'m '.$conv_time['seconds'].'s';
3563
-	}
3564
-
3565
-/**
3566
-  * convertSecondsToArrayTime
3567
-  * 
3568
-  * Converts seconds to a array: time
3569
-  *
3570
-  * <b>Output:</b>
3571
-  * <pre>
3572
-  * Array
3573
-  * {
3574
-  *  [days] => 3
3575
-  *  [hours] => 9
3576
-  *  [minutes] => 45
3577
-  *  [seconds] => 17
3578
-  * }
3579
-  * </pre>
3580
-  *
3581
-  * @author     Par0noid Solutions
3582
-  * @param		integer	$seconds	time in seconds
3583
-  * @return     array time
3584
-  */
3585
- 	public function convertSecondsToArrayTime($seconds) {
3586
-		$conv_time = array();
3587
-		$conv_time['days']=floor($seconds / 86400);
3588
-		$conv_time['hours']=floor(($seconds - ($conv_time['days'] * 86400)) / 3600);
3589
-		$conv_time['minutes']=floor(($seconds - (($conv_time['days'] * 86400)+($conv_time['hours']*3600))) / 60);
3590
-		$conv_time['seconds']=floor(($seconds - (($conv_time['days'] * 86400)+($conv_time['hours']*3600)+($conv_time['minutes'] * 60))));
3591
-		return $conv_time;
3592
-	}
3593
-
3594
-/**
3595
-  * getElement
3596
-  * 
3597
-  * Returns the given associated element from an array
3598
-  * This can be used to get a result in a one line operation
3599
-  * 
3600
-  * For example you got this array:
3601
-  * <pre>
3602
-  * Array
3603
-  * {
3604
-  *  [success] => false
3605
-  *  [errors] => Array 
3606
-  *  [data] => false
3607
-  * }
3608
-  * </pre>
3609
-  * Now you can grab the element like this:
3610
-  * <pre>
3611
-  * $ts = new ts3admin('***', '***');
3612
-  * 
3613
-  * if($ts->getElement('success', $ts->connect())) {
3614
-  *  //operation
3615
-  * }
3616
-  * </pre>
3617
-  *
3618
-  * @author     Par0noid Solutions
3619
-  * @param		string	$element	key of element
3620
-  * @param		array	$array		array
3621
-  * @return     mixed
3622
-  */
3623
-	public function getElement($element, $array) {
3624
-		return $array[$element];
3625
-	}
3626
-
3627
-/**
3628
-  * succeeded
3629
-  * 
3630
-  * Succeeded will check the success element of a return array
3631
-  * <pre>
3632
-  * $ts = new ts3admin('***', '***');
3633
-  * 
3634
-  * if($ts->succeeded($ts->connect())) {
3635
-  *  //operation
3636
-  * }
3637
-  * </pre>
3638
-  *
3639
-  * @author     Par0noid Solutions
3640
-  * @param		array	$array	result
3641
-  * @return     boolean
3642
-  */
3643
-	public function succeeded($array) {
3644
-		if(isset($array['success'])) {
3645
-			return $array['success'];
3646
-		}else{
3647
-			return false;
3648
-		}
3649
-	}
3627
+ * succeeded
3628
+ * 
3629
+ * Succeeded will check the success element of a return array
3630
+ * <pre>
3631
+ * $ts = new ts3admin('***', '***');
3632
+ * 
3633
+ * if($ts->succeeded($ts->connect())) {
3634
+ *  //operation
3635
+ * }
3636
+ * </pre>
3637
+ *
3638
+ * @author     Par0noid Solutions
3639
+ * @param		array	$array	result
3640
+ * @return     boolean
3641
+ */
3642
+    public function succeeded($array) {
3643
+        if(isset($array['success'])) {
3644
+            return $array['success'];
3645
+        }else{
3646
+            return false;
3647
+        }
3648
+    }
3650 3649
 	
3651 3650
 	
3652 3651
 
@@ -3663,19 +3662,19 @@  discard block
 block discarded – undo
3663 3662
  * @param	integer	$timeout	socket timeout (default = 2) [optional]
3664 3663
  * @return	void
3665 3664
 */
3666
-	function __construct($host, $queryport, $timeout = 2) {
3667
-		if($queryport >= 1 and $queryport <= 65536) {
3668
-			if($timeout >= 1) {
3669
-				$this->runtime['host'] = $host;
3670
-				$this->runtime['queryport'] = $queryport;
3671
-				$this->runtime['timeout'] = $timeout;
3672
-			}else{
3673
-				$this->addDebugLog('invalid timeout value');
3674
-			}
3675
-		}else{
3676
-			$this->addDebugLog('invalid queryport');
3677
-		}
3678
-	}
3665
+    function __construct($host, $queryport, $timeout = 2) {
3666
+        if($queryport >= 1 and $queryport <= 65536) {
3667
+            if($timeout >= 1) {
3668
+                $this->runtime['host'] = $host;
3669
+                $this->runtime['queryport'] = $queryport;
3670
+                $this->runtime['timeout'] = $timeout;
3671
+            }else{
3672
+                $this->addDebugLog('invalid timeout value');
3673
+            }
3674
+        }else{
3675
+            $this->addDebugLog('invalid queryport');
3676
+        }
3677
+    }
3679 3678
 
3680 3679
 /**
3681 3680
  * __destruct
@@ -3683,9 +3682,9 @@  discard block
 block discarded – undo
3683 3682
  * @author	Par0noid Solutions
3684 3683
  * @return	void
3685 3684
 */
3686
-	function __destruct() {
3687
-		$this->quit();
3688
-	}
3685
+    function __destruct() {
3686
+        $this->quit();
3687
+    }
3689 3688
 
3690 3689
 /**
3691 3690
  * __call
@@ -3697,181 +3696,181 @@  discard block
 block discarded – undo
3697 3696
  * @param	array	$args	method arguments
3698 3697
  * @return	void
3699 3698
 */
3700
-	function __call($name, $args) {
3701
-		$this->addDebugLog('Method '.$name.' doesn\'t exist', $name, 0);
3702
-		return $this->generateOutput(false, array('Method '.$name.' doesn\'t exist'), false);
3703
-	}
3704
-
3705
-/**
3706
-  * isConnected
3707
-  * 
3708
-  * Checks if the connection is established
3709
-  *
3710
-  * @author     Par0noid Solutions
3711
-  * @return     boolean connected
3712
-  */
3713
-	private function isConnected() {
3714
-		if(empty($this->runtime['socket'])) {
3715
-			return false;
3716
-		}else{
3717
-			return true;
3718
-		}
3719
-	}
3720
-
3721
-/**
3722
-  * generateOutput
3723
-  * 
3724
-  * Builds a method return as array
3725
-  *
3726
-  * @author     Par0noid Solutions
3727
-  * @param		boolean		$success	true/false
3728
-  * @param		array		$errors		all errors which occured while executing a method
3729
-  * @param		mixed		$data		parsed data from server
3730
-  * @return     array output
3731
-  */
3732
-	private function generateOutput($success, $errors, $data) {
3733
-		return array('success' => $success, 'errors' => $errors, 'data' => $data);
3734
-	}
3735
-
3736
-/**
3737
-  * unEscapeText
3738
-  * 
3739
-  * Turns escaped chars to normals
3740
-  *
3741
-  * @author     Par0noid Solutions
3742
-  * @param		string	$text	text which should be escaped
3743
-  * @return     string	text
3744
-  */
3745
- 	private function unEscapeText($text) {
3746
- 		$escapedChars = array("\t", "\v", "\r", "\n", "\f", "\s", "\p", "\/");
3747
- 		$unEscapedChars = array('', '', '', '', '', ' ', '|', '/');
3748
-		$text = str_replace($escapedChars, $unEscapedChars, $text);
3749
-		return $text;
3750
-	}
3751
-
3752
-/**
3753
-  * escapeText
3754
-  * 
3755
-  * Escapes chars that we can use it in the query
3756
-  *
3757
-  * @author     Par0noid Solutions
3758
-  * @param		string	$text	text which should be escaped
3759
-  * @return     string	text
3760
-  */
3761
- 	private function escapeText($text) {
3762
- 		$text = str_replace("\t", '\t', $text);
3763
-		$text = str_replace("\v", '\v', $text);
3764
-		$text = str_replace("\r", '\r', $text);
3765
-		$text = str_replace("\n", '\n', $text);
3766
-		$text = str_replace("\f", '\f', $text);
3767
-		$text = str_replace(' ', '\s', $text);
3768
-		$text = str_replace('|', '\p', $text);
3769
-		$text = str_replace('/', '\/', $text);
3770
-		return $text;
3771
-	}
3772
-
3773
-/**
3774
-  * splitBanIds
3775
-  * 
3776
-  * Splits banIds to array
3777
-  *
3778
-  * @author     Par0noid Solutions
3779
-  * @param		string	$text	plain text server response
3780
-  * @return     string	text
3781
-  */
3782
- 	private function splitBanIds($text) {
3783
-		$data = array();
3784
-		$text = str_replace(array("\n", "\r"), '', $text);
3785
-		$ids = explode("banid=", $text);
3786
-		unset($ids[0]);
3787
-		return $ids;
3788
-	}
3699
+    function __call($name, $args) {
3700
+        $this->addDebugLog('Method '.$name.' doesn\'t exist', $name, 0);
3701
+        return $this->generateOutput(false, array('Method '.$name.' doesn\'t exist'), false);
3702
+    }
3703
+
3704
+/**
3705
+ * isConnected
3706
+ * 
3707
+ * Checks if the connection is established
3708
+ *
3709
+ * @author     Par0noid Solutions
3710
+ * @return     boolean connected
3711
+ */
3712
+    private function isConnected() {
3713
+        if(empty($this->runtime['socket'])) {
3714
+            return false;
3715
+        }else{
3716
+            return true;
3717
+        }
3718
+    }
3719
+
3720
+/**
3721
+ * generateOutput
3722
+ * 
3723
+ * Builds a method return as array
3724
+ *
3725
+ * @author     Par0noid Solutions
3726
+ * @param		boolean		$success	true/false
3727
+ * @param		array		$errors		all errors which occured while executing a method
3728
+ * @param		mixed		$data		parsed data from server
3729
+ * @return     array output
3730
+ */
3731
+    private function generateOutput($success, $errors, $data) {
3732
+        return array('success' => $success, 'errors' => $errors, 'data' => $data);
3733
+    }
3734
+
3735
+/**
3736
+ * unEscapeText
3737
+ * 
3738
+ * Turns escaped chars to normals
3739
+ *
3740
+ * @author     Par0noid Solutions
3741
+ * @param		string	$text	text which should be escaped
3742
+ * @return     string	text
3743
+ */
3744
+        private function unEscapeText($text) {
3745
+            $escapedChars = array("\t", "\v", "\r", "\n", "\f", "\s", "\p", "\/");
3746
+            $unEscapedChars = array('', '', '', '', '', ' ', '|', '/');
3747
+        $text = str_replace($escapedChars, $unEscapedChars, $text);
3748
+        return $text;
3749
+    }
3750
+
3751
+/**
3752
+ * escapeText
3753
+ * 
3754
+ * Escapes chars that we can use it in the query
3755
+ *
3756
+ * @author     Par0noid Solutions
3757
+ * @param		string	$text	text which should be escaped
3758
+ * @return     string	text
3759
+ */
3760
+        private function escapeText($text) {
3761
+            $text = str_replace("\t", '\t', $text);
3762
+        $text = str_replace("\v", '\v', $text);
3763
+        $text = str_replace("\r", '\r', $text);
3764
+        $text = str_replace("\n", '\n', $text);
3765
+        $text = str_replace("\f", '\f', $text);
3766
+        $text = str_replace(' ', '\s', $text);
3767
+        $text = str_replace('|', '\p', $text);
3768
+        $text = str_replace('/', '\/', $text);
3769
+        return $text;
3770
+    }
3771
+
3772
+/**
3773
+ * splitBanIds
3774
+ * 
3775
+ * Splits banIds to array
3776
+ *
3777
+ * @author     Par0noid Solutions
3778
+ * @param		string	$text	plain text server response
3779
+ * @return     string	text
3780
+ */
3781
+        private function splitBanIds($text) {
3782
+        $data = array();
3783
+        $text = str_replace(array("\n", "\r"), '', $text);
3784
+        $ids = explode("banid=", $text);
3785
+        unset($ids[0]);
3786
+        return $ids;
3787
+    }
3789 3788
 
3790 3789
 //*******************************************************************************************	
3791 3790
 //************************************ Network Functions ************************************
3792 3791
 //*******************************************************************************************
3793 3792
 
3794 3793
 /**
3795
-  * connect
3796
-  * 
3797
-  * Connects to a ts3instance query port
3798
-  *
3799
-  * @author     Par0noid Solutions
3800
-  * @return		boolean success
3801
-  */
3802
-	function connect() {
3803
-		if($this->isConnected()) { 
3804
-			$this->addDebugLog('Error: you are already connected!');
3805
-			return $this->generateOutput(false, array('Error: the script is already connected!'), false);
3806
-		}
3807
-		$socket = @fsockopen($this->runtime['host'], $this->runtime['queryport'], $errnum, $errstr, $this->runtime['timeout']);
3808
-
3809
-		if(!$socket) {
3810
-			$this->addDebugLog('Error: connection failed!');
3811
-			return $this->generateOutput(false, array('Error: connection failed!', 'Server returns: '.$errstr), false);
3812
-		}else{
3813
-			if(strpos(fgets($socket), 'TS3') !== false) {
3814
-				$tmpVar = fgets($socket);
3815
-				$this->runtime['socket'] = $socket;
3816
-				return $this->generateOutput(true, array(), true);
3817
-			}else{
3818
-				$this->addDebugLog('host isn\'t a ts3 instance!');
3819
-				return $this->generateOutput(false, array('Error: host isn\'t a ts3 instance!'), false);
3820
-			}
3821
-		}
3822
-	}
3823
-
3824
-/**
3825
-  * executeCommand
3826
-  * 
3827
-  * Executes a command and fetches the response
3828
-  *
3829
-  * @author     Par0noid Solutions
3830
-  * @param		string	$command	command which should be executed
3831
-  * @param		array	$tracert	array with information from first exec
3832
-  * @return     mixed data
3833
-  */
3834
-	private function executeCommand($command, $tracert) {
3835
-		if(!$this->isConnected()) {
3836
-			$this->addDebugLog('script isn\'t connected to server', $tracert[1]['function'], $tracert[0]['line']);
3837
-			return $this->generateOutput(false, array('Error: script isn\'t connected to server'), false);
3838
-		}
3839
-		
3840
-		$data = '';
3841
-
3842
-		
3843
-		$splittedCommand = str_split($command, 1024);
3844
-		
3845
-		$splittedCommand[(count($splittedCommand) - 1)] .= "\n";
3846
-		
3847
-		foreach($splittedCommand as $commandPart) {
3848
-			fputs($this->runtime['socket'], $commandPart);
3849
-		}
3850
-
3851
-		do {
3852
-			$data .= fgets($this->runtime['socket'], 4096);
3794
+ * connect
3795
+ * 
3796
+ * Connects to a ts3instance query port
3797
+ *
3798
+ * @author     Par0noid Solutions
3799
+ * @return		boolean success
3800
+ */
3801
+    function connect() {
3802
+        if($this->isConnected()) { 
3803
+            $this->addDebugLog('Error: you are already connected!');
3804
+            return $this->generateOutput(false, array('Error: the script is already connected!'), false);
3805
+        }
3806
+        $socket = @fsockopen($this->runtime['host'], $this->runtime['queryport'], $errnum, $errstr, $this->runtime['timeout']);
3807
+
3808
+        if(!$socket) {
3809
+            $this->addDebugLog('Error: connection failed!');
3810
+            return $this->generateOutput(false, array('Error: connection failed!', 'Server returns: '.$errstr), false);
3811
+        }else{
3812
+            if(strpos(fgets($socket), 'TS3') !== false) {
3813
+                $tmpVar = fgets($socket);
3814
+                $this->runtime['socket'] = $socket;
3815
+                return $this->generateOutput(true, array(), true);
3816
+            }else{
3817
+                $this->addDebugLog('host isn\'t a ts3 instance!');
3818
+                return $this->generateOutput(false, array('Error: host isn\'t a ts3 instance!'), false);
3819
+            }
3820
+        }
3821
+    }
3822
+
3823
+/**
3824
+ * executeCommand
3825
+ * 
3826
+ * Executes a command and fetches the response
3827
+ *
3828
+ * @author     Par0noid Solutions
3829
+ * @param		string	$command	command which should be executed
3830
+ * @param		array	$tracert	array with information from first exec
3831
+ * @return     mixed data
3832
+ */
3833
+    private function executeCommand($command, $tracert) {
3834
+        if(!$this->isConnected()) {
3835
+            $this->addDebugLog('script isn\'t connected to server', $tracert[1]['function'], $tracert[0]['line']);
3836
+            return $this->generateOutput(false, array('Error: script isn\'t connected to server'), false);
3837
+        }
3838
+		
3839
+        $data = '';
3840
+
3841
+		
3842
+        $splittedCommand = str_split($command, 1024);
3843
+		
3844
+        $splittedCommand[(count($splittedCommand) - 1)] .= "\n";
3845
+		
3846
+        foreach($splittedCommand as $commandPart) {
3847
+            fputs($this->runtime['socket'], $commandPart);
3848
+        }
3849
+
3850
+        do {
3851
+            $data .= fgets($this->runtime['socket'], 4096);
3853 3852
 			
3854
-			if(strpos($data, 'error id=3329 msg=connection') !== false) {
3855
-				$this->runtime['socket'] = '';
3856
-				$this->addDebugLog('You got banned from server. Socket closed.', $tracert[1]['function'], $tracert[0]['line']);
3857
-				return $this->generateOutput(false, array('You got banned from server. Connection closed.'), false);
3858
-			}
3853
+            if(strpos($data, 'error id=3329 msg=connection') !== false) {
3854
+                $this->runtime['socket'] = '';
3855
+                $this->addDebugLog('You got banned from server. Socket closed.', $tracert[1]['function'], $tracert[0]['line']);
3856
+                return $this->generateOutput(false, array('You got banned from server. Connection closed.'), false);
3857
+            }
3859 3858
 			
3860
-		} while(strpos($data, 'msg=') === false or strpos($data, 'error id=') === false);
3859
+        } while(strpos($data, 'msg=') === false or strpos($data, 'error id=') === false);
3861 3860
 
3862
-		if(strpos($data, 'error id=0 msg=ok') === false) {
3863
-			$splittedResponse = explode('error id=', $data);
3864
-			$chooseEnd = count($splittedResponse) - 1;
3861
+        if(strpos($data, 'error id=0 msg=ok') === false) {
3862
+            $splittedResponse = explode('error id=', $data);
3863
+            $chooseEnd = count($splittedResponse) - 1;
3865 3864
 			
3866
-			$cutIdAndMsg = explode(' msg=', $splittedResponse[$chooseEnd]);
3865
+            $cutIdAndMsg = explode(' msg=', $splittedResponse[$chooseEnd]);
3867 3866
 			
3868
-			$this->addDebugLog('ErrorID: '.$cutIdAndMsg[0].' | Message: '.$this->unEscapeText($cutIdAndMsg[1]), $tracert[1]['function'], $tracert[0]['line']);
3867
+            $this->addDebugLog('ErrorID: '.$cutIdAndMsg[0].' | Message: '.$this->unEscapeText($cutIdAndMsg[1]), $tracert[1]['function'], $tracert[0]['line']);
3869 3868
 			
3870
-			return $this->generateOutput(false, array('ErrorID: '.$cutIdAndMsg[0].' | Message: '.$this->unEscapeText($cutIdAndMsg[1])), false);
3871
-		}else{
3872
-			return $this->generateOutput(true, array(), $data);
3873
-		}
3874
-	}
3869
+            return $this->generateOutput(false, array('ErrorID: '.$cutIdAndMsg[0].' | Message: '.$this->unEscapeText($cutIdAndMsg[1])), false);
3870
+        }else{
3871
+            return $this->generateOutput(true, array(), $data);
3872
+        }
3873
+    }
3875 3874
 
3876 3875
 /**
3877 3876
  * getData
@@ -3884,184 +3883,184 @@  discard block
 block discarded – undo
3884 3883
  * @param		string	$command	command which should be executed
3885 3884
  * @return		mixed data
3886 3885
  */
3887
-	private function getData($mode, $command) {
3886
+    private function getData($mode, $command) {
3888 3887
 	
3889
-		$validModes = array('boolean', 'array', 'multi', 'plain');
3888
+        $validModes = array('boolean', 'array', 'multi', 'plain');
3890 3889
 	
3891
-		if(!in_array($mode, $validModes)) {
3892
-			$this->addDebugLog($mode.' is an invalid mode');
3893
-			return $this->generateOutput(false, array('Error: '.$mode.' is an invalid mode'), false);
3894
-		}
3890
+        if(!in_array($mode, $validModes)) {
3891
+            $this->addDebugLog($mode.' is an invalid mode');
3892
+            return $this->generateOutput(false, array('Error: '.$mode.' is an invalid mode'), false);
3893
+        }
3895 3894
 		
3896
-		if(empty($command)) {
3897
-			$this->addDebugLog('you have to enter a command');
3898
-			return $this->generateOutput(false, array('Error: you have to enter a command'), false);
3899
-		}
3895
+        if(empty($command)) {
3896
+            $this->addDebugLog('you have to enter a command');
3897
+            return $this->generateOutput(false, array('Error: you have to enter a command'), false);
3898
+        }
3900 3899
 		
3901
-		$fetchData = $this->executeCommand($command, debug_backtrace());
3900
+        $fetchData = $this->executeCommand($command, debug_backtrace());
3902 3901
 		
3903 3902
 		
3904
-		$fetchData['data'] = str_replace(array('error id=0 msg=ok', chr('01')), '', $fetchData['data']);
3903
+        $fetchData['data'] = str_replace(array('error id=0 msg=ok', chr('01')), '', $fetchData['data']);
3905 3904
 		
3906 3905
 		
3907
-		if($fetchData['success']) {
3908
-			if($mode == 'boolean') {
3909
-				return $this->generateOutput(true, array(), true);
3910
-			}
3906
+        if($fetchData['success']) {
3907
+            if($mode == 'boolean') {
3908
+                return $this->generateOutput(true, array(), true);
3909
+            }
3911 3910
 			
3912
-			if($mode == 'array') {
3913
-				if(empty($fetchData['data'])) { return $this->generateOutput(true, array(), array()); }
3914
-				$datasets = explode(' ', $fetchData['data']);
3911
+            if($mode == 'array') {
3912
+                if(empty($fetchData['data'])) { return $this->generateOutput(true, array(), array()); }
3913
+                $datasets = explode(' ', $fetchData['data']);
3915 3914
 				
3916
-				$output = array();
3915
+                $output = array();
3917 3916
 				
3918
-				foreach($datasets as $dataset) {
3919
-					$dataset = explode('=', $dataset);
3917
+                foreach($datasets as $dataset) {
3918
+                    $dataset = explode('=', $dataset);
3920 3919
 					
3921
-					if(count($dataset) > 2) {
3922
-						for($i = 2; $i < count($dataset); $i++) {
3923
-							$dataset[1] .= '='.$dataset[$i];
3924
-						}
3925
-						$output[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3926
-					}else{
3927
-						if(count($dataset) == 1) {
3928
-							$output[$this->unEscapeText($dataset[0])] = '';
3929
-						}else{
3930
-							$output[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3931
-						}
3920
+                    if(count($dataset) > 2) {
3921
+                        for($i = 2; $i < count($dataset); $i++) {
3922
+                            $dataset[1] .= '='.$dataset[$i];
3923
+                        }
3924
+                        $output[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3925
+                    }else{
3926
+                        if(count($dataset) == 1) {
3927
+                            $output[$this->unEscapeText($dataset[0])] = '';
3928
+                        }else{
3929
+                            $output[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3930
+                        }
3932 3931
 						
3933
-					}
3934
-				}
3935
-				return $this->generateOutput(true, array(), $output);
3936
-			}
3937
-			if($mode == 'multi') {
3938
-				if(empty($fetchData['data'])) { return $this->generateOutput(true, array(), array()); }
3939
-				$datasets = explode('|', $fetchData['data']);
3932
+                    }
3933
+                }
3934
+                return $this->generateOutput(true, array(), $output);
3935
+            }
3936
+            if($mode == 'multi') {
3937
+                if(empty($fetchData['data'])) { return $this->generateOutput(true, array(), array()); }
3938
+                $datasets = explode('|', $fetchData['data']);
3940 3939
 				
3941
-				$output = array();
3940
+                $output = array();
3942 3941
 				
3943
-				foreach($datasets as $datablock) {
3944
-					$datablock = explode(' ', $datablock);
3942
+                foreach($datasets as $datablock) {
3943
+                    $datablock = explode(' ', $datablock);
3945 3944
 					
3946
-					$tmpArray = array();
3945
+                    $tmpArray = array();
3947 3946
 					
3948
-					foreach($datablock as $dataset) {
3949
-						$dataset = explode('=', $dataset);
3950
-						if(count($dataset) > 2) {
3951
-							for($i = 2; $i < count($dataset); $i++) {
3952
-								$dataset[1] .= '='.$dataset[$i];
3953
-							}
3954
-							$tmpArray[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3955
-						}else{
3956
-							if(count($dataset) == 1) {
3957
-								$tmpArray[$this->unEscapeText($dataset[0])] = '';
3958
-							}else{
3959
-								$tmpArray[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3960
-							}
3961
-						}					
3962
-					}
3963
-					$output[] = $tmpArray;
3964
-				}
3965
-				return $this->generateOutput(true, array(), $output);
3966
-			}
3967
-			if($mode == 'plain') {
3968
-				return $fetchData;
3969
-			}
3970
-		}else{
3971
-			return $this->generateOutput(false, $fetchData['errors'], false);
3972
-		}
3973
-	}
3974
-
3975
-/**
3976
-  * ftSendKey
3977
-  * 
3978
-  * Sends down/upload-key to ftHost
3979
-  * 
3980
-  * @author     Par0noid Solutions
3981
-  * @param		string	$key
3982
-  * @param		string $additional
3983
-  * @return     none
3984
- */
3985
-	private function ftSendKey($key, $additional = NULL) {
3986
-		fputs($this->runtime['fileSocket'], $key.$additional);
3987
-	}
3988
-
3989
-/**
3990
-  * ftSendData
3991
-  * 
3992
-  * Sends data to ftHost
3993
-  * 
3994
-  * @author     Par0noid Solutions
3995
-  * @param		mixed	$data
3996
-  * @return     none
3997
- */
3998
-	private function ftSendData($data) {
3999
-		$data = str_split($data, 4096);
4000
-		foreach($data as $dat) {
4001
-			fputs($this->runtime['fileSocket'], $dat);
4002
-		}
4003
-	}
4004
-
4005
-/**
4006
-  * ftRead
4007
-  * 
4008
-  * Reads data from ftHost
4009
-  * 
4010
-  * @author     Par0noid Solutions
4011
-  * @param		int	$size
4012
-  * @return     string data
4013
- */
4014
-	private function ftRead($size) {
4015
-		$data = '';
4016
-		while(strlen($data) < $size) {		
4017
-			$data .= fgets($this->runtime['fileSocket'], 4096);
4018
-		}
4019
-		return $data;
4020
-	}
3947
+                    foreach($datablock as $dataset) {
3948
+                        $dataset = explode('=', $dataset);
3949
+                        if(count($dataset) > 2) {
3950
+                            for($i = 2; $i < count($dataset); $i++) {
3951
+                                $dataset[1] .= '='.$dataset[$i];
3952
+                            }
3953
+                            $tmpArray[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3954
+                        }else{
3955
+                            if(count($dataset) == 1) {
3956
+                                $tmpArray[$this->unEscapeText($dataset[0])] = '';
3957
+                            }else{
3958
+                                $tmpArray[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3959
+                            }
3960
+                        }					
3961
+                    }
3962
+                    $output[] = $tmpArray;
3963
+                }
3964
+                return $this->generateOutput(true, array(), $output);
3965
+            }
3966
+            if($mode == 'plain') {
3967
+                return $fetchData;
3968
+            }
3969
+        }else{
3970
+            return $this->generateOutput(false, $fetchData['errors'], false);
3971
+        }
3972
+    }
3973
+
3974
+/**
3975
+ * ftSendKey
3976
+ * 
3977
+ * Sends down/upload-key to ftHost
3978
+ * 
3979
+ * @author     Par0noid Solutions
3980
+ * @param		string	$key
3981
+ * @param		string $additional
3982
+ * @return     none
3983
+ */
3984
+    private function ftSendKey($key, $additional = NULL) {
3985
+        fputs($this->runtime['fileSocket'], $key.$additional);
3986
+    }
3987
+
3988
+/**
3989
+ * ftSendData
3990
+ * 
3991
+ * Sends data to ftHost
3992
+ * 
3993
+ * @author     Par0noid Solutions
3994
+ * @param		mixed	$data
3995
+ * @return     none
3996
+ */
3997
+    private function ftSendData($data) {
3998
+        $data = str_split($data, 4096);
3999
+        foreach($data as $dat) {
4000
+            fputs($this->runtime['fileSocket'], $dat);
4001
+        }
4002
+    }
4003
+
4004
+/**
4005
+ * ftRead
4006
+ * 
4007
+ * Reads data from ftHost
4008
+ * 
4009
+ * @author     Par0noid Solutions
4010
+ * @param		int	$size
4011
+ * @return     string data
4012
+ */
4013
+    private function ftRead($size) {
4014
+        $data = '';
4015
+        while(strlen($data) < $size) {		
4016
+            $data .= fgets($this->runtime['fileSocket'], 4096);
4017
+        }
4018
+        return $data;
4019
+    }
4021 4020
 
4022 4021
 //*******************************************************************************************	
4023 4022
 //************************************* Debug Functions *************************************
4024 4023
 //*******************************************************************************************
4025 4024
 
4026 4025
 /**
4027
-  * getDebugLog
4028
-  * 
4029
-  * Returns the debug log
4030
-  *
4031
-  * <b>Output:</b>
4032
-  * <pre>
4033
-  * Array
4034
-  * {
4035
-  *  [0] => Error in login() on line 1908: ErrorID: 520 | Message: invalid loginname or password
4036
-  *  [1] => Error in selectServer() on line 2044: ErrorID: 1540 | Message: convert error
4037
-  * }
4038
-  * </pre>
4039
-  *
4040
-  * @author     Par0noid Solutions
4041
-  * @return     array debugLog
4042
-  */
4043
- 	public function getDebugLog() {
4044
-		return $this->runtime['debug'];
4045
-	}
4046
-
4047
-/**
4048
-  * addDebugLog
4049
-  * 
4050
-  * Adds an entry to debugLog
4051
-  *
4052
-  * @author     Par0noid Solutions
4053
-  * @param		string	$text			text which should added to debugLog
4054
-  * @param		string	$methodName		name of the executed method [optional]
4055
-  * @param		string	$line			line where error triggered [optional]
4056
-  * @return     array debugLog
4057
-  */
4058
-	private function addDebugLog($text, $methodName = '', $line = '') {
4059
-		if(empty($methodName) and empty($line)) {
4060
-			$backtrace = debug_backtrace();
4061
-			$methodName = $backtrace[1]['function'];
4062
-			$line = $backtrace[0]['line'];
4063
-		}
4064
-		$this->runtime['debug'][] = 'Error in '.$methodName.'() on line '.$line.': '.$text;	
4065
-	}
4026
+ * getDebugLog
4027
+ * 
4028
+ * Returns the debug log
4029
+ *
4030
+ * <b>Output:</b>
4031
+ * <pre>
4032
+ * Array
4033
+ * {
4034
+ *  [0] => Error in login() on line 1908: ErrorID: 520 | Message: invalid loginname or password
4035
+ *  [1] => Error in selectServer() on line 2044: ErrorID: 1540 | Message: convert error
4036
+ * }
4037
+ * </pre>
4038
+ *
4039
+ * @author     Par0noid Solutions
4040
+ * @return     array debugLog
4041
+ */
4042
+        public function getDebugLog() {
4043
+        return $this->runtime['debug'];
4044
+    }
4045
+
4046
+/**
4047
+ * addDebugLog
4048
+ * 
4049
+ * Adds an entry to debugLog
4050
+ *
4051
+ * @author     Par0noid Solutions
4052
+ * @param		string	$text			text which should added to debugLog
4053
+ * @param		string	$methodName		name of the executed method [optional]
4054
+ * @param		string	$line			line where error triggered [optional]
4055
+ * @return     array debugLog
4056
+ */
4057
+    private function addDebugLog($text, $methodName = '', $line = '') {
4058
+        if(empty($methodName) and empty($line)) {
4059
+            $backtrace = debug_backtrace();
4060
+            $methodName = $backtrace[1]['function'];
4061
+            $line = $backtrace[0]['line'];
4062
+        }
4063
+        $this->runtime['debug'][] = 'Error in '.$methodName.'() on line '.$line.': '.$text;	
4064
+    }
4066 4065
 }
4067 4066
 ?>
4068 4067
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +405 added lines, -405 removed lines patch added patch discarded remove patch
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
   * @return     array banId
80 80
   */
81 81
 	function banAddByIp($ip, $time, $banreason = NULL) {
82
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
82
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
83 83
 		
84
-		if(!empty($banreason)) { $msg = ' banreason='.$this->escapeText($banreason); } else { $msg = NULL; }
84
+		if (!empty($banreason)) { $msg = ' banreason=' . $this->escapeText($banreason); } else { $msg = NULL; }
85 85
 
86
-		return $this->getData('array', 'banadd ip='.$ip.' time='.$time.$msg);
86
+		return $this->getData('array', 'banadd ip=' . $ip . ' time=' . $time . $msg);
87 87
 	}
88 88
 
89 89
 /**
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
   * @return     array banId
107 107
   */
108 108
 	function banAddByUid($uid, $time, $banreason = NULL) {
109
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
109
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
110 110
 		
111
-		if(!empty($banreason)) { $msg = ' banreason='.$this->escapeText($banreason); } else { $msg = NULL; }
111
+		if (!empty($banreason)) { $msg = ' banreason=' . $this->escapeText($banreason); } else { $msg = NULL; }
112 112
 		
113
-		return $this->getData('array', 'banadd uid='.$uid.' time='.$time.$msg);
113
+		return $this->getData('array', 'banadd uid=' . $uid . ' time=' . $time . $msg);
114 114
 	}
115 115
 
116 116
 /**
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
   * @return     array banId
134 134
   */
135 135
 	function banAddByName($name, $time, $banreason = NULL) {
136
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
136
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
137 137
 		
138
-		if(!empty($banreason)) { $msg = ' banreason='.$this->escapeText($banreason); } else { $msg = NULL; }
138
+		if (!empty($banreason)) { $msg = ' banreason=' . $this->escapeText($banreason); } else { $msg = NULL; }
139 139
 										
140
-		return $this->getData('array', 'banadd name='.$this->escapeText($name).' time='.$time.$msg);
140
+		return $this->getData('array', 'banadd name=' . $this->escapeText($name) . ' time=' . $time . $msg);
141 141
 	}
142 142
 
143 143
 /**
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
   * @return     array banIds
162 162
   */
163 163
 	function banClient($clid, $time, $banreason = NULL) {
164
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
164
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
165 165
 		
166
-		if(!empty($banreason)) { $msg = ' banreason='.$this->escapeText($banreason); } else { $msg = ''; }
166
+		if (!empty($banreason)) { $msg = ' banreason=' . $this->escapeText($banreason); } else { $msg = ''; }
167 167
 		
168
-		$result = $this->getData('plain', 'banclient clid='.$clid.' time='.$time.$msg);
168
+		$result = $this->getData('plain', 'banclient clid=' . $clid . ' time=' . $time . $msg);
169 169
 		
170
-		if($result['success']) {
170
+		if ($result['success']) {
171 171
 			return $this->generateOutput(true, $result['errors'], $this->splitBanIds($result['data']));
172
-		}else{
172
+		} else {
173 173
 			return $this->generateOutput(false, $result['errors'], false);
174 174
 		}
175 175
 	}
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
   * @return     boolean success
185 185
   */
186 186
 	function banDelete($banID) {
187
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
188
-		return $this->getData('boolean', 'bandel banid='.$banID);
187
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
188
+		return $this->getData('boolean', 'bandel banid=' . $banID);
189 189
 	}
190 190
 
191 191
 /**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
   * @return     boolean success
198 198
   */
199 199
 	function banDeleteAll() {
200
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
200
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
201 201
 		return $this->getData('boolean', 'bandelall');
202 202
 	}
203 203
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
   * @return     array banlist
229 229
   */
230 230
 	function banList() {
231
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }		
231
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }		
232 232
 		return $this->getData('multi', 'banlist');
233 233
 	}
234 234
 
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
   * @return     boolean success
272 272
   */
273 273
 	function channelAddPerm($cid, $permissions) {
274
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
274
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
275 275
 		
276
-		if(count($permissions) > 0) {
276
+		if (count($permissions) > 0) {
277 277
 			//Permissions given
278 278
 			
279 279
 			//Errorcollector
@@ -283,35 +283,35 @@  discard block
 block discarded – undo
283 283
 			$permissions = array_chunk($permissions, 50, true);
284 284
 			
285 285
 			//Action for each splitted part of permission
286
-			foreach($permissions as $permission_part)
286
+			foreach ($permissions as $permission_part)
287 287
 			{
288 288
 				//Create command_string for each command that we could use implode later
289 289
 				$command_string = array();
290 290
 				
291
-				foreach($permission_part as $key => $value)
291
+				foreach ($permission_part as $key => $value)
292 292
 				{
293
-					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value;
293
+					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=") . $this->escapeText($key) . ' permvalue=' . $value;
294 294
 				}
295 295
 				
296
-				$result = $this->getData('boolean', 'channeladdperm cid='.$cid.' '.implode('|', $command_string));
296
+				$result = $this->getData('boolean', 'channeladdperm cid=' . $cid . ' ' . implode('|', $command_string));
297 297
 				
298
-				if(!$result['success'])
298
+				if (!$result['success'])
299 299
 				{
300
-					foreach($result['errors'] as $error)
300
+					foreach ($result['errors'] as $error)
301 301
 					{
302 302
 						$errors[] = $error;
303 303
 					}
304 304
 				}
305 305
 			}
306 306
 			
307
-			if(count($errors) == 0)
307
+			if (count($errors) == 0)
308 308
 			{
309 309
 				return $this->generateOutput(true, array(), true);
310
-			}else{
310
+			} else {
311 311
 				return $this->generateOutput(false, $errors, false);
312 312
 			}
313 313
 			
314
-		}else{
314
+		} else {
315 315
 			// No permissions given
316 316
 			$this->addDebugLog('no permissions given');
317 317
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
   * @return     boolean success
339 339
   */
340 340
 	function channelClientAddPerm($cid, $cldbid, $permissions) {
341
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
341
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
342 342
 		
343
-		if(count($permissions) > 0) {
343
+		if (count($permissions) > 0) {
344 344
 			//Permissions given
345 345
 				
346 346
 			//Errorcollector
@@ -350,35 +350,35 @@  discard block
 block discarded – undo
350 350
 			$permissions = array_chunk($permissions, 50, true);
351 351
 				
352 352
 			//Action for each splitted part of permission
353
-			foreach($permissions as $permission_part)
353
+			foreach ($permissions as $permission_part)
354 354
 			{
355 355
 				//Create command_string for each command that we could use implode later
356 356
 				$command_string = array();
357 357
 		
358
-				foreach($permission_part as $key => $value)
358
+				foreach ($permission_part as $key => $value)
359 359
 				{
360
-					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value;
360
+					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=") . $this->escapeText($key) . ' permvalue=' . $value;
361 361
 				}
362 362
 		
363
-				$result = $this->getData('boolean', 'channelclientaddperm cid='.$cid.' cldbid='.$cldbid.' '.implode('|', $command_string));
363
+				$result = $this->getData('boolean', 'channelclientaddperm cid=' . $cid . ' cldbid=' . $cldbid . ' ' . implode('|', $command_string));
364 364
 		
365
-				if(!$result['success'])
365
+				if (!$result['success'])
366 366
 				{
367
-					foreach($result['errors'] as $error)
367
+					foreach ($result['errors'] as $error)
368 368
 					{
369 369
 						$errors[] = $error;
370 370
 					}
371 371
 				}
372 372
 			}
373 373
 				
374
-			if(count($errors) == 0)
374
+			if (count($errors) == 0)
375 375
 			{
376 376
 				return $this->generateOutput(true, array(), true);
377
-			}else{
377
+			} else {
378 378
 				return $this->generateOutput(false, $errors, false);
379 379
 			}
380 380
 				
381
-		}else{
381
+		} else {
382 382
 			// No permissions given
383 383
 			$this->addDebugLog('no permissions given');
384 384
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
@@ -406,15 +406,15 @@  discard block
 block discarded – undo
406 406
   * @return     boolean success
407 407
   */
408 408
 	function channelClientDelPerm($cid, $cldbid, $permissions) {
409
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
409
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
410 410
 		$permissionArray = array();
411 411
 		
412
-		if(count($permissions) > 0) {
413
-			foreach($permissions AS $value) {
414
-				$permissionArray[] = is_numeric($value) ? 'permid='.$value : 'permsid='.$value;
412
+		if (count($permissions) > 0) {
413
+			foreach ($permissions AS $value) {
414
+				$permissionArray[] = is_numeric($value) ? 'permid=' . $value : 'permsid=' . $value;
415 415
 			}
416
-			return $this->getData('boolean', 'channelclientdelperm cid='.$cid.' cldbid='.$cldbid.' '.implode('|', $permissionArray));
417
-		}else{
416
+			return $this->getData('boolean', 'channelclientdelperm cid=' . $cid . ' cldbid=' . $cldbid . ' ' . implode('|', $permissionArray));
417
+		} else {
418 418
 			$this->addDebugLog('no permissions given');
419 419
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
420 420
 		}
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
   * @return     array	channelclientpermlist
447 447
   */
448 448
 	function channelClientPermList($cid, $cldbid, $permsid = false) {
449
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }		
450
-		return $this->getData('multi', 'channelclientpermlist cid='.$cid.' cldbid='.$cldbid.($permsid ? ' -permsid' : ''));
449
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }		
450
+		return $this->getData('multi', 'channelclientpermlist cid=' . $cid . ' cldbid=' . $cldbid . ($permsid ? ' -permsid' : ''));
451 451
 	}
452 452
 
453 453
 /**
@@ -480,15 +480,15 @@  discard block
 block discarded – undo
480 480
   * @return     array channelInfo
481 481
   */
482 482
 	function channelCreate($data) {
483
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
483
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
484 484
 		
485 485
 		$propertiesString = '';
486 486
 		
487
-		foreach($data as $key => $value) {
488
-			$propertiesString .= ' '.$key.'='.$this->escapeText($value);
487
+		foreach ($data as $key => $value) {
488
+			$propertiesString .= ' ' . $key . '=' . $this->escapeText($value);
489 489
 		}
490 490
 		
491
-		return $this->getData('array', 'channelcreate '.$propertiesString);
491
+		return $this->getData('array', 'channelcreate ' . $propertiesString);
492 492
 	}
493 493
 
494 494
 /**
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
   * @return     boolean success
503 503
   */
504 504
 	function channelDelete($cid, $force = 1) {
505
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
506
-		return $this->getData('boolean', 'channeldelete cid='.$cid.' force='.$force);
505
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
506
+		return $this->getData('boolean', 'channeldelete cid=' . $cid . ' force=' . $force);
507 507
 	}
508 508
 
509 509
 /**
@@ -525,15 +525,15 @@  discard block
 block discarded – undo
525 525
   * @return     boolean	success
526 526
   */
527 527
 	function channelDelPerm($cid, $permissions) {
528
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
528
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
529 529
 		$permissionArray = array();
530 530
 		
531
-		if(count($permissions) > 0) {
532
-			foreach($permissions AS $value) {
533
-				$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
531
+		if (count($permissions) > 0) {
532
+			foreach ($permissions AS $value) {
533
+				$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=') . $value;
534 534
 			}
535
-			return $this->getData('boolean', 'channeldelperm cid='.$cid.' '.implode('|', $permissionArray));
536
-		}else{
535
+			return $this->getData('boolean', 'channeldelperm cid=' . $cid . ' ' . implode('|', $permissionArray));
536
+		} else {
537 537
 			$this->addDebugLog('no permissions given');
538 538
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
539 539
 		}
@@ -558,15 +558,15 @@  discard block
 block discarded – undo
558 558
   * @return     boolean success
559 559
   */
560 560
 	function channelEdit($cid, $data) {
561
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
561
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
562 562
 		
563 563
 		$settingsString = '';
564 564
 		
565
-		foreach($data as $key => $value) {
566
-			$settingsString .= ' '.$key.'='.$this->escapeText($value);
565
+		foreach ($data as $key => $value) {
566
+			$settingsString .= ' ' . $key . '=' . $this->escapeText($value);
567 567
 		}
568 568
 
569
-		return $this->getData('boolean', 'channeledit cid='.$cid.$settingsString);
569
+		return $this->getData('boolean', 'channeledit cid=' . $cid . $settingsString);
570 570
 	}
571 571
 
572 572
 /**
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
   * @return     array channelList 
589 589
   */
590 590
 	function channelFind($pattern) {
591
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
592
-		return $this->getData('multi', 'channelfind pattern='.$this->escapeText($pattern));
591
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
592
+		return $this->getData('multi', 'channelfind pattern=' . $this->escapeText($pattern));
593 593
 	}
594 594
 
595 595
 /**
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
   * @return     boolean success
619 619
   */
620 620
 	function channelGroupAdd($name, $type = 1) {
621
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
622
-		return $this->getData('array', 'channelgroupadd name='.$this->escapeText($name).' type='.$type);
621
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
622
+		return $this->getData('array', 'channelgroupadd name=' . $this->escapeText($name) . ' type=' . $type);
623 623
 	}
624 624
 
625 625
 /**
@@ -641,9 +641,9 @@  discard block
 block discarded – undo
641 641
   * @return     boolean success
642 642
   */
643 643
 	function channelGroupAddPerm($cgid, $permissions) {
644
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
644
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
645 645
 		
646
-		if(count($permissions) > 0) {
646
+		if (count($permissions) > 0) {
647 647
 			//Permissions given
648 648
 		
649 649
 			//Errorcollector
@@ -653,34 +653,34 @@  discard block
 block discarded – undo
653 653
 			$permissions = array_chunk($permissions, 50, true);
654 654
 		
655 655
 			//Action for each splitted part of permission
656
-			foreach($permissions as $permission_part)
656
+			foreach ($permissions as $permission_part)
657 657
 			{
658 658
 				//Create command_string for each command that we could use implode later
659 659
 				$command_string = array();
660 660
 		
661
-				foreach($permission_part as $key => $value)
661
+				foreach ($permission_part as $key => $value)
662 662
 				{
663
-					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value;
663
+					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=") . $this->escapeText($key) . ' permvalue=' . $value;
664 664
 				}
665 665
 		
666
-				$result = $this->getData('boolean', 'channelgroupaddperm cgid='.$cgid.' '.implode('|', $command_string));
666
+				$result = $this->getData('boolean', 'channelgroupaddperm cgid=' . $cgid . ' ' . implode('|', $command_string));
667 667
 		
668
-				if(!$result['success'])
668
+				if (!$result['success'])
669 669
 				{
670
-					foreach($result['errors'] as $error)
670
+					foreach ($result['errors'] as $error)
671 671
 					{
672 672
 						$errors[] = $error;
673 673
 					}
674 674
 				}
675 675
 			}
676 676
 		
677
-			if(count($errors) == 0) {
677
+			if (count($errors) == 0) {
678 678
 				return $this->generateOutput(true, array(), true);
679
-			}else{
679
+			} else {
680 680
 				return $this->generateOutput(false, $errors, false);
681 681
 			}
682 682
 		
683
-		}else{
683
+		} else {
684 684
 			// No permissions given
685 685
 			$this->addDebugLog('no permissions given');
686 686
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
@@ -709,9 +709,9 @@  discard block
 block discarded – undo
709 709
   * @return     array channelGroupClientList
710 710
   */
711 711
 	function channelGroupClientList($cid = NULL, $cldbid = NULL, $cgid = NULL) {
712
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
712
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
713 713
 		
714
-		return $this->getData('multi', 'channelgroupclientlist'.(!empty($cid) ? ' cid='.$cid : '').(!empty($cldbid) ? ' cldbid='.$cldbid : '').(!empty($cgid) ? ' cgid='.$cgid : ''));
714
+		return $this->getData('multi', 'channelgroupclientlist' . (!empty($cid) ? ' cid=' . $cid : '') . (!empty($cldbid) ? ' cldbid=' . $cldbid : '') . (!empty($cgid) ? ' cgid=' . $cgid : ''));
715 715
 	}
716 716
 
717 717
 /**
@@ -742,8 +742,8 @@  discard block
 block discarded – undo
742 742
   * @return     array groupId
743 743
   */
744 744
 	function channelGroupCopy($scgid, $tcgid, $name, $type = 1) {
745
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
746
-		return $this->getData('array', 'channelgroupcopy scgid='.$scgid.' tcgid='.$tcgid.' name='.$this->escapeText($name).' type='.$type);
745
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
746
+		return $this->getData('array', 'channelgroupcopy scgid=' . $scgid . ' tcgid=' . $tcgid . ' name=' . $this->escapeText($name) . ' type=' . $type);
747 747
 	}
748 748
 
749 749
 /**
@@ -757,8 +757,8 @@  discard block
 block discarded – undo
757 757
   * @return     boolean success
758 758
   */
759 759
 	function channelGroupDelete($cgid, $force = 1) {
760
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
761
-		return $this->getData('boolean', 'channelgroupdel cgid='.$cgid.' force='.$force);
760
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
761
+		return $this->getData('boolean', 'channelgroupdel cgid=' . $cgid . ' force=' . $force);
762 762
 	}
763 763
 
764 764
 /**
@@ -779,15 +779,15 @@  discard block
 block discarded – undo
779 779
   * @return     boolean success
780 780
   */
781 781
 	function channelGroupDelPerm($cgid, $permissions) {
782
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
782
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
783 783
 		$permissionArray = array();
784 784
 		
785
-		if(count($permissions) > 0) {
786
-			foreach($permissions AS $value) {
787
-				$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
785
+		if (count($permissions) > 0) {
786
+			foreach ($permissions AS $value) {
787
+				$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=') . $value;
788 788
 			}
789
-			return $this->getData('boolean', 'channelgroupdelperm cgid='.$cgid.' '.implode('|', $permissionArray));
790
-		}else{
789
+			return $this->getData('boolean', 'channelgroupdelperm cgid=' . $cgid . ' ' . implode('|', $permissionArray));
790
+		} else {
791 791
 			$this->addDebugLog('no permissions given');
792 792
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
793 793
 		}
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
   * @return     array channelGroupList
820 820
   */
821 821
 	function channelGroupList() {
822
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
822
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
823 823
 		
824 824
 		return $this->getData('multi', 'channelgrouplist');
825 825
 	}
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
   * @return		array	channelGroupPermlist
849 849
   */
850 850
   	function channelGroupPermList($cgid, $permsid = false) {
851
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }		
852
-		return $this->getData('multi', 'channelgrouppermlist cgid='.$cgid.($permsid ? ' -permsid' : ''));
851
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }		
852
+		return $this->getData('multi', 'channelgrouppermlist cgid=' . $cgid . ($permsid ? ' -permsid' : ''));
853 853
 	}
854 854
 
855 855
 /**
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
   * @return     boolean success
864 864
   */
865 865
 	function channelGroupRename($cgid, $name) {
866
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
867
-		return $this->getData('boolean', 'channelgrouprename cgid='.$cgid.' name='.$this->escapeText($name));
866
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
867
+		return $this->getData('boolean', 'channelgrouprename cgid=' . $cgid . ' name=' . $this->escapeText($name));
868 868
 	}
869 869
 
870 870
 /**
@@ -909,8 +909,8 @@  discard block
 block discarded – undo
909 909
   * @return     array channelInfo
910 910
   */
911 911
 	function channelInfo($cid) {
912
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
913
-		return $this->getData('array', 'channelinfo cid='.$cid);
912
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
913
+		return $this->getData('array', 'channelinfo cid=' . $cid);
914 914
 	}
915 915
 
916 916
 /**
@@ -962,10 +962,10 @@  discard block
 block discarded – undo
962 962
   * @return		array	channelList
963 963
   */
964 964
 	function channelList($params = null) {
965
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
966
-		if(!empty($params)) { $params = ' '.$params; }
965
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
966
+		if (!empty($params)) { $params = ' ' . $params; }
967 967
 		
968
-		return $this->getData('multi', 'channellist'.$params);
968
+		return $this->getData('multi', 'channellist' . $params);
969 969
 	}
970 970
 
971 971
 /**
@@ -980,8 +980,8 @@  discard block
 block discarded – undo
980 980
   * @return     boolean success
981 981
   */
982 982
 	function channelMove($cid, $cpid, $order = null) {
983
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }		
984
-		return $this->getData('boolean', 'channelmove cid='.$cid.' cpid='.$cpid.($order != null ? ' order='.$order : ''));
983
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }		
984
+		return $this->getData('boolean', 'channelmove cid=' . $cid . ' cpid=' . $cpid . ($order != null ? ' order=' . $order : ''));
985 985
 	}
986 986
 
987 987
 /**
@@ -1008,8 +1008,8 @@  discard block
 block discarded – undo
1008 1008
   * @return     array channelpermlist
1009 1009
   */
1010 1010
 	function channelPermList($cid, $permsid = false) {
1011
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }	
1012
-		return $this->getData('multi', 'channelpermlist cid='.$cid.($permsid ? ' -permsid' : ''));
1011
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }	
1012
+		return $this->getData('multi', 'channelpermlist cid=' . $cid . ($permsid ? ' -permsid' : ''));
1013 1013
 	}
1014 1014
 
1015 1015
 /**
@@ -1031,9 +1031,9 @@  discard block
 block discarded – undo
1031 1031
   * @return     boolean success
1032 1032
   */
1033 1033
 	function clientAddPerm($cldbid, $permissions) {
1034
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1034
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1035 1035
 		
1036
-		if(count($permissions) > 0) {
1036
+		if (count($permissions) > 0) {
1037 1037
 			//Permissions given
1038 1038
 				
1039 1039
 			//Errorcollector
@@ -1043,34 +1043,34 @@  discard block
 block discarded – undo
1043 1043
 			$permissions = array_chunk($permissions, 50, true);
1044 1044
 				
1045 1045
 			//Action for each splitted part of permission
1046
-			foreach($permissions as $permission_part)
1046
+			foreach ($permissions as $permission_part)
1047 1047
 			{
1048 1048
 				//Create command_string for each command that we could use implode later
1049 1049
 				$command_string = array();
1050 1050
 		
1051
-				foreach($permission_part as $key => $value)
1051
+				foreach ($permission_part as $key => $value)
1052 1052
 				{
1053
-					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$this->escapeText($value[0]).' permskip='.$this->escapeText($value[1]);
1053
+					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=") . $this->escapeText($key) . ' permvalue=' . $this->escapeText($value[0]) . ' permskip=' . $this->escapeText($value[1]);
1054 1054
 				}
1055 1055
 		
1056
-				$result = $this->getData('boolean', 'clientaddperm cldbid='.$cldbid.' '.implode('|', $command_string));
1056
+				$result = $this->getData('boolean', 'clientaddperm cldbid=' . $cldbid . ' ' . implode('|', $command_string));
1057 1057
 		
1058
-				if(!$result['success'])
1058
+				if (!$result['success'])
1059 1059
 				{
1060
-					foreach($result['errors'] as $error)
1060
+					foreach ($result['errors'] as $error)
1061 1061
 					{
1062 1062
 						$errors[] = $error;
1063 1063
 					}
1064 1064
 				}
1065 1065
 			}
1066 1066
 				
1067
-			if(count($errors) == 0)
1067
+			if (count($errors) == 0)
1068 1068
 			{
1069 1069
 				return $this->generateOutput(true, array(), true);
1070
-			}else{
1070
+			} else {
1071 1071
 				return $this->generateOutput(false, $errors, false);
1072 1072
 			}
1073
-		}else{
1073
+		} else {
1074 1074
 			// No permissions given
1075 1075
 			$this->addDebugLog('no permissions given');
1076 1076
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
@@ -1092,9 +1092,9 @@  discard block
 block discarded – undo
1092 1092
  * @return array  base64 image
1093 1093
  */
1094 1094
 	function clientAvatar($uid) {
1095
-	  if(!$this->runtime['selected']) { return $this->checkSelected(); }
1095
+	  if (!$this->runtime['selected']) { return $this->checkSelected(); }
1096 1096
 
1097
-	  if(empty($uid))
1097
+	  if (empty($uid))
1098 1098
 	  {
1099 1099
 		return $this->generateOutput(false, array('Error: empty uid'), false);
1100 1100
 	  }
@@ -1108,19 +1108,19 @@  discard block
 block discarded – undo
1108 1108
 			  $auid .= $newChars[$char & 0x0F];
1109 1109
 	  }
1110 1110
 
1111
-	  $init = $this->ftInitDownload('/avatar_'.$auid, 0, '');
1111
+	  $init = $this->ftInitDownload('/avatar_' . $auid, 0, '');
1112 1112
 
1113
-	  if(!$init["success"])
1113
+	  if (!$init["success"])
1114 1114
 	  {
1115 1115
 		return $this->generateOutput(false, array('Error: init failed'), false);
1116 1116
 	  }
1117 1117
 	  
1118 1118
 	  $download = $this->ftDownloadFile($init);
1119 1119
 
1120
-	  if(is_array($download))
1120
+	  if (is_array($download))
1121 1121
 	  {
1122 1122
 		return $download;
1123
-	  }else{
1123
+	  } else {
1124 1124
 		return $this->generateOutput(true, false, base64_encode($download));
1125 1125
 	  }
1126 1126
 
@@ -1136,8 +1136,8 @@  discard block
 block discarded – undo
1136 1136
   * @return     boolean success
1137 1137
   */
1138 1138
 	function clientDbDelete($cldbid) {
1139
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1140
-		return $this->getData('boolean', 'clientdbdelete cldbid='.$cldbid);
1139
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1140
+		return $this->getData('boolean', 'clientdbdelete cldbid=' . $cldbid);
1141 1141
 	}
1142 1142
 
1143 1143
 /**
@@ -1159,15 +1159,15 @@  discard block
 block discarded – undo
1159 1159
   * @return     boolean success
1160 1160
   */
1161 1161
 	function clientDbEdit($cldbid, $data) {
1162
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1162
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1163 1163
 		
1164 1164
 		$settingsString = '';
1165 1165
 		
1166
-		foreach($data as $key => $value) {
1167
-			$settingsString .= ' '.$key.'='.$this->escapeText($value);
1166
+		foreach ($data as $key => $value) {
1167
+			$settingsString .= ' ' . $key . '=' . $this->escapeText($value);
1168 1168
 		}
1169 1169
 		
1170
-		return $this->getData('boolean', 'clientdbedit cldbid='.$cldbid.$settingsString);
1170
+		return $this->getData('boolean', 'clientdbedit cldbid=' . $cldbid . $settingsString);
1171 1171
 	}
1172 1172
 
1173 1173
 /**
@@ -1189,8 +1189,8 @@  discard block
 block discarded – undo
1189 1189
   * @return     array clientList 
1190 1190
   */
1191 1191
 	function clientDbFind($pattern, $uid = false) {
1192
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1193
-		return $this->getData('multi', 'clientdbfind pattern='.$this->escapeText($pattern).($uid ? ' -uid' : ''));
1192
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1193
+		return $this->getData('multi', 'clientdbfind pattern=' . $this->escapeText($pattern) . ($uid ? ' -uid' : ''));
1194 1194
 	}
1195 1195
 
1196 1196
 /**
@@ -1225,8 +1225,8 @@  discard block
 block discarded – undo
1225 1225
   * @return     array	clientDbInfo
1226 1226
   */
1227 1227
 	function clientDbInfo($cldbid) {
1228
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1229
-		return $this->getData('array', 'clientdbinfo cldbid='.$cldbid);
1228
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1229
+		return $this->getData('array', 'clientdbinfo cldbid=' . $cldbid);
1230 1230
 	}
1231 1231
 
1232 1232
 /**
@@ -1259,8 +1259,8 @@  discard block
 block discarded – undo
1259 1259
   * @return     array clientdblist
1260 1260
   */
1261 1261
 	function clientDbList($start = 0, $duration = -1, $count = false) {
1262
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1263
-		return $this->getData('multi', 'clientdblist start='.$start.' duration='.$duration.($count ? ' -count' : ''));
1262
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1263
+		return $this->getData('multi', 'clientdblist start=' . $start . ' duration=' . $duration . ($count ? ' -count' : ''));
1264 1264
 	}
1265 1265
 
1266 1266
 /**
@@ -1282,16 +1282,16 @@  discard block
 block discarded – undo
1282 1282
   * @return     boolean success
1283 1283
   */
1284 1284
 	function clientDelPerm($cldbid, $permissionIds) {
1285
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1285
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1286 1286
 		
1287 1287
 		$permissionArray = array();
1288 1288
 		
1289
-		if(count($permissionIds) > 0) {
1290
-			foreach($permissionIds AS $value) {
1291
-				$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
1289
+		if (count($permissionIds) > 0) {
1290
+			foreach ($permissionIds AS $value) {
1291
+				$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=') . $value;
1292 1292
 			}
1293
-			return $this->getData('boolean', 'clientdelperm cldbid='.$cldbid.' '.implode('|', $permissionArray));
1294
-		}else{
1293
+			return $this->getData('boolean', 'clientdelperm cldbid=' . $cldbid . ' ' . implode('|', $permissionArray));
1294
+		} else {
1295 1295
 			$this->addDebugLog('no permissions given');
1296 1296
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
1297 1297
 		}
@@ -1316,15 +1316,15 @@  discard block
 block discarded – undo
1316 1316
   * @return     boolean success
1317 1317
   */
1318 1318
 	function clientEdit($clid, $data) {
1319
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1319
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1320 1320
 		
1321 1321
 		$settingsString = '';
1322 1322
 		
1323
-		foreach($data as $key => $value) {
1324
-			$settingsString .= ' '.$key.'='.$this->escapeText($value);
1323
+		foreach ($data as $key => $value) {
1324
+			$settingsString .= ' ' . $key . '=' . $this->escapeText($value);
1325 1325
 		}
1326 1326
 		
1327
-		return $this->getData('boolean', 'clientedit clid='.$clid.$settingsString);
1327
+		return $this->getData('boolean', 'clientedit clid=' . $clid . $settingsString);
1328 1328
 	}
1329 1329
 
1330 1330
 /**
@@ -1346,8 +1346,8 @@  discard block
 block discarded – undo
1346 1346
   * @return     array clienList
1347 1347
   */
1348 1348
 	function clientFind($pattern) {
1349
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1350
-		return $this->getData('multi', 'clientfind pattern='.$this->escapeText($pattern));
1349
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1350
+		return $this->getData('multi', 'clientfind pattern=' . $this->escapeText($pattern));
1351 1351
 	}
1352 1352
 
1353 1353
 /**
@@ -1369,8 +1369,8 @@  discard block
 block discarded – undo
1369 1369
   * @return     array clientInfo
1370 1370
   */
1371 1371
 	function clientGetDbIdFromUid($cluid) {
1372
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1373
-		return $this->getData('array', 'clientgetdbidfromuid cluid='.$cluid);
1372
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1373
+		return $this->getData('array', 'clientgetdbidfromuid cluid=' . $cluid);
1374 1374
 	}
1375 1375
 
1376 1376
 /**
@@ -1393,8 +1393,8 @@  discard block
 block discarded – undo
1393 1393
   * @return     array clientList 
1394 1394
   */
1395 1395
 	function clientGetIds($cluid) {
1396
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1397
-		return $this->getData('multi', 'clientgetids cluid='.$cluid);
1396
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1397
+		return $this->getData('multi', 'clientgetids cluid=' . $cluid);
1398 1398
 	}
1399 1399
 
1400 1400
 /**
@@ -1417,8 +1417,8 @@  discard block
 block discarded – undo
1417 1417
   * @return     array clientInfo
1418 1418
   */
1419 1419
 	function clientGetNameFromDbid($cldbid) {
1420
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1421
-		return $this->getData('array', 'clientgetnamefromdbid cldbid='.$cldbid);
1420
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1421
+		return $this->getData('array', 'clientgetnamefromdbid cldbid=' . $cldbid);
1422 1422
 	}
1423 1423
 	
1424 1424
 /**
@@ -1441,8 +1441,8 @@  discard block
 block discarded – undo
1441 1441
   * @return     array clientInfo
1442 1442
   */
1443 1443
 	function clientGetNameFromUid($cluid) {
1444
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1445
-		return $this->getData('array', 'clientgetnamefromuid cluid='.$cluid);
1444
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1445
+		return $this->getData('array', 'clientgetnamefromuid cluid=' . $cluid);
1446 1446
 	}
1447 1447
 
1448 1448
 /**
@@ -1517,8 +1517,8 @@  discard block
 block discarded – undo
1517 1517
   * @return     array	clientInformation
1518 1518
   */
1519 1519
 	function clientInfo($clid) {
1520
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1521
-		return $this->getData('array', 'clientinfo clid='.$clid);
1520
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1521
+		return $this->getData('array', 'clientinfo clid=' . $clid);
1522 1522
 	}
1523 1523
 
1524 1524
 /**
@@ -1533,17 +1533,17 @@  discard block
 block discarded – undo
1533 1533
   * @return     boolean success
1534 1534
   */
1535 1535
 	function clientKick($clid, $kickMode = "server", $kickmsg = "") {
1536
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1536
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1537 1537
 		
1538
-		if(in_array($kickMode, array('server', 'channel'))) {
1538
+		if (in_array($kickMode, array('server', 'channel'))) {
1539 1539
 		
1540
-			if($kickMode == 'server') { $from = '5'; }
1541
-			if($kickMode == 'channel') { $from = '4'; }
1540
+			if ($kickMode == 'server') { $from = '5'; }
1541
+			if ($kickMode == 'channel') { $from = '4'; }
1542 1542
 			
1543
-			if(!empty($kickmsg)) { $msg = ' reasonmsg='.$this->escapeText($kickmsg); } else{ $msg = ''; }
1543
+			if (!empty($kickmsg)) { $msg = ' reasonmsg=' . $this->escapeText($kickmsg); } else { $msg = ''; }
1544 1544
 			
1545
-			return $this->getData('boolean', 'clientkick clid='.$clid.' reasonid='.$from.$msg);
1546
-		}else{
1545
+			return $this->getData('boolean', 'clientkick clid=' . $clid . ' reasonid=' . $from . $msg);
1546
+		} else {
1547 1547
 			$this->addDebugLog('invalid kickMode');
1548 1548
 			return $this->generateOutput(false, array('Error: invalid kickMode'), false);
1549 1549
 		}
@@ -1604,11 +1604,11 @@  discard block
 block discarded – undo
1604 1604
   * @return     array clientList 
1605 1605
   */
1606 1606
 	function clientList($params = null) {
1607
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1607
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1608 1608
 		
1609
-		if(!empty($params)) { $params = ' '.$params; }
1609
+		if (!empty($params)) { $params = ' ' . $params; }
1610 1610
 		
1611
-		return $this->getData('multi', 'clientlist'.$params);
1611
+		return $this->getData('multi', 'clientlist' . $params);
1612 1612
 	}
1613 1613
 
1614 1614
 /**
@@ -1623,8 +1623,8 @@  discard block
 block discarded – undo
1623 1623
   * @return     boolean success
1624 1624
   */
1625 1625
 	function clientMove($clid, $cid, $cpw = null) {
1626
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1627
-		return $this->getData('boolean', 'clientmove clid='.$clid.' cid='.$cid.(!empty($cpw) ? ' cpw='.$this->escapeText($cpw) : ''));
1626
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1627
+		return $this->getData('boolean', 'clientmove clid=' . $clid . ' cid=' . $cid . (!empty($cpw) ? ' cpw=' . $this->escapeText($cpw) : ''));
1628 1628
 	}
1629 1629
 
1630 1630
 /**
@@ -1650,8 +1650,8 @@  discard block
 block discarded – undo
1650 1650
   * @return     array clientPermList
1651 1651
   */
1652 1652
 	function clientPermList($cldbid, $permsid = false) {
1653
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }		
1654
-		return $this->getData('multi', 'clientpermlist cldbid='.$cldbid.($permsid ? ' -permsid' : ''));
1653
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }		
1654
+		return $this->getData('multi', 'clientpermlist cldbid=' . $cldbid . ($permsid ? ' -permsid' : ''));
1655 1655
 	}
1656 1656
 
1657 1657
 /**
@@ -1665,8 +1665,8 @@  discard block
 block discarded – undo
1665 1665
   * @return     boolean success
1666 1666
   */
1667 1667
 	function clientPoke($clid, $msg) {
1668
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1669
-		return $this->getData('boolean', 'clientpoke clid='.$clid.' msg='.$this->escapeText($msg));
1668
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1669
+		return $this->getData('boolean', 'clientpoke clid=' . $clid . ' msg=' . $this->escapeText($msg));
1670 1670
 	}
1671 1671
 
1672 1672
 /**
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
   * @return     array userInfomation
1688 1688
   */
1689 1689
 	function clientSetServerQueryLogin($username) {
1690
-		return $this->getData('array', 'clientsetserverquerylogin client_login_name='.$this->escapeText($username));
1690
+		return $this->getData('array', 'clientsetserverquerylogin client_login_name=' . $this->escapeText($username));
1691 1691
 	}
1692 1692
 
1693 1693
 /**
@@ -1709,11 +1709,11 @@  discard block
 block discarded – undo
1709 1709
 	function clientUpdate($data) {
1710 1710
 		$settingsString = '';
1711 1711
 		
1712
-		foreach($data as $key => $value) {
1713
-			$settingsString .= ' '.$key.'='.$this->escapeText($value);
1712
+		foreach ($data as $key => $value) {
1713
+			$settingsString .= ' ' . $key . '=' . $this->escapeText($value);
1714 1714
 		}
1715 1715
 		
1716
-		return $this->getData('boolean', 'clientupdate '.$settingsString);
1716
+		return $this->getData('boolean', 'clientupdate ' . $settingsString);
1717 1717
 	}
1718 1718
 
1719 1719
 /**
@@ -1727,8 +1727,8 @@  discard block
 block discarded – undo
1727 1727
   * @return     boolean success
1728 1728
   */
1729 1729
 	function complainAdd($tcldbid, $msg) {
1730
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1731
-		return $this->getData('boolean', 'complainadd tcldbid='.$tcldbid.' message='.$this->escapeText($msg));
1730
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1731
+		return $this->getData('boolean', 'complainadd tcldbid=' . $tcldbid . ' message=' . $this->escapeText($msg));
1732 1732
 	}
1733 1733
 
1734 1734
 /**
@@ -1742,8 +1742,8 @@  discard block
 block discarded – undo
1742 1742
   * @return     boolean success
1743 1743
   */
1744 1744
 	function complainDelete($tcldbid, $fcldbid) {
1745
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1746
-		return $this->getData('boolean', 'complaindel tcldbid='.$tcldbid.' fcldbid='.$fcldbid);
1745
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1746
+		return $this->getData('boolean', 'complaindel tcldbid=' . $tcldbid . ' fcldbid=' . $fcldbid);
1747 1747
 	}
1748 1748
 
1749 1749
 /**
@@ -1756,8 +1756,8 @@  discard block
 block discarded – undo
1756 1756
   * @return     boolean success
1757 1757
   */
1758 1758
 	function complainDeleteAll($tcldbid) {
1759
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1760
-		return $this->getData('boolean', 'complaindelall tcldbid='.$tcldbid);
1759
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1760
+		return $this->getData('boolean', 'complaindelall tcldbid=' . $tcldbid);
1761 1761
 	}
1762 1762
 
1763 1763
 /**
@@ -1783,9 +1783,9 @@  discard block
 block discarded – undo
1783 1783
   * @return     array complainList
1784 1784
   */
1785 1785
 	function complainList($tcldbid = null) {
1786
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1787
-		if(!empty($tcldbid)) { $tcldbid = ' tcldbid='.$tcldbid; }
1788
-		return $this->getData('multi', 'complainlist'.$tcldbid);
1786
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1787
+		if (!empty($tcldbid)) { $tcldbid = ' tcldbid=' . $tcldbid; }
1788
+		return $this->getData('multi', 'complainlist' . $tcldbid);
1789 1789
 	}
1790 1790
 
1791 1791
 /**
@@ -1807,16 +1807,16 @@  discard block
 block discarded – undo
1807 1807
   * @return     mixed result
1808 1808
   */
1809 1809
 	function execOwnCommand($mode, $command) {
1810
-		if($mode == '0') {
1810
+		if ($mode == '0') {
1811 1811
 			return $this->getData('boolean', $command);
1812 1812
 		}
1813
-		if($mode == '1') {
1813
+		if ($mode == '1') {
1814 1814
 			return $this->getData('array', $command);
1815 1815
 		}
1816
-		if($mode == '2') {
1816
+		if ($mode == '2') {
1817 1817
 			return $this->getData('multi', $command);
1818 1818
 		}
1819
-		if($mode == '3') {
1819
+		if ($mode == '3') {
1820 1820
 			return $this->getData('plain', $command);
1821 1821
 		}
1822 1822
 	}
@@ -1833,8 +1833,8 @@  discard block
 block discarded – undo
1833 1833
   * @return     boolean success
1834 1834
   */
1835 1835
 	function ftCreateDir($cid, $cpw = null, $dirname) {
1836
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1837
-		return $this->getData('boolean', 'ftcreatedir cid='.$cid.' cpw='.$this->escapeText($cpw).' dirname='.$this->escapeText($dirname));
1836
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1837
+		return $this->getData('boolean', 'ftcreatedir cid=' . $cid . ' cpw=' . $this->escapeText($cpw) . ' dirname=' . $this->escapeText($dirname));
1838 1838
 	}
1839 1839
 
1840 1840
 /**
@@ -1858,15 +1858,15 @@  discard block
 block discarded – undo
1858 1858
   * @return     boolean success
1859 1859
   */
1860 1860
 	function ftDeleteFile($cid, $cpw = '', $files) {
1861
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1861
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1862 1862
 		$fileArray = array();
1863 1863
 		
1864
-		if(count($files) > 0) {
1865
-			foreach($files AS $file) {
1866
-				$fileArray[] = 'name='.$this->escapeText($file);
1864
+		if (count($files) > 0) {
1865
+			foreach ($files AS $file) {
1866
+				$fileArray[] = 'name=' . $this->escapeText($file);
1867 1867
 			}
1868
-			return $this->getData('boolean', 'ftdeletefile cid='.$cid.' cpw='.$this->escapeText($cpw).' '.implode('|', $fileArray));
1869
-		}else{
1868
+			return $this->getData('boolean', 'ftdeletefile cid=' . $cid . ' cpw=' . $this->escapeText($cpw) . ' ' . implode('|', $fileArray));
1869
+		} else {
1870 1870
 			$this->addDebugLog('no files given');
1871 1871
 			return $this->generateOutput(false, array('Error: no files given'), false);
1872 1872
 		}
@@ -1885,15 +1885,15 @@  discard block
 block discarded – undo
1885 1885
 		$errnum = null;
1886 1886
 		$errstr = null;
1887 1887
   		$this->runtime['fileSocket'] = @fsockopen($this->runtime['host'], $data['data']['port'], $errnum, $errstr, $this->runtime['timeout']);
1888
-  		if($this->runtime['fileSocket']) {
1888
+  		if ($this->runtime['fileSocket']) {
1889 1889
   			$this->ftSendKey($data['data']['ftkey']);
1890 1890
   			$content = $this->ftRead($data['data']['size']);
1891 1891
   			@fclose($this->runtime['fileSocket']);
1892 1892
   			$this->runtime['fileSocket'] = '';
1893 1893
   			return $content;
1894
-  		}else{
1895
-  			$this->addDebugLog('fileSocket returns '.$errnum. ' | '.$errstr);
1896
-  			return $this->generateOutput(false, array('Error in fileSocket: '.$errnum. ' | '.$errstr), false);
1894
+  		} else {
1895
+  			$this->addDebugLog('fileSocket returns ' . $errnum . ' | ' . $errstr);
1896
+  			return $this->generateOutput(false, array('Error in fileSocket: ' . $errnum . ' | ' . $errstr), false);
1897 1897
   		}
1898 1898
 	}
1899 1899
 	
@@ -1910,9 +1910,9 @@  discard block
 block discarded – undo
1910 1910
   * @return     boolean success
1911 1911
   */
1912 1912
 	function ftGetFileInfo($cid, $cpw = '', $file) {
1913
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1913
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1914 1914
 
1915
-		return $this->getData('multi', 'ftgetfileinfo cid='.$cid.' cpw='.$this->escapeText($cpw).' name='.$this->escapeText($file));
1915
+		return $this->getData('multi', 'ftgetfileinfo cid=' . $cid . ' cpw=' . $this->escapeText($cpw) . ' name=' . $this->escapeText($file));
1916 1916
 	}
1917 1917
 
1918 1918
 /**
@@ -1940,8 +1940,8 @@  discard block
 block discarded – undo
1940 1940
   * @return     array	fileList
1941 1941
   */
1942 1942
 	function ftGetFileList($cid, $cpw = '', $path) {
1943
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1944
-		return $this->getData('multi', 'ftgetfilelist cid='.$cid.' cpw='.$this->escapeText($cpw).' path='.$this->escapeText($path));
1943
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1944
+		return $this->getData('multi', 'ftgetfilelist cid=' . $cid . ' cpw=' . $this->escapeText($cpw) . ' path=' . $this->escapeText($path));
1945 1945
 	}
1946 1946
 	
1947 1947
 /**
@@ -1969,8 +1969,8 @@  discard block
 block discarded – undo
1969 1969
   * @return     array	initDownloadFileInfo
1970 1970
   */	
1971 1971
 	function ftInitDownload($name, $cid, $cpw = '', $seekpos = 0) {
1972
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
1973
-		return $this->getData('array', 'ftinitdownload clientftfid='.rand(1,99).' name='.$this->escapeText($name).' cid='.$cid.' cpw='.$this->escapeText($cpw).' seekpos='.$seekpos);
1972
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
1973
+		return $this->getData('array', 'ftinitdownload clientftfid=' . rand(1, 99) . ' name=' . $this->escapeText($name) . ' cid=' . $cid . ' cpw=' . $this->escapeText($cpw) . ' seekpos=' . $seekpos);
1974 1974
 	}
1975 1975
 
1976 1976
 /**
@@ -2000,12 +2000,12 @@  discard block
 block discarded – undo
2000 2000
   * @return     array	initUploadFileInfo
2001 2001
   */	
2002 2002
 	function ftInitUpload($filename, $cid, $size, $cpw = '', $overwrite = false, $resume = false) {
2003
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2003
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2004 2004
 		
2005
-		if($overwrite) { $overwrite = ' overwrite=1'; }else{ $overwrite = ' overwrite=0'; }
2006
-		if($resume) { $resume = ' resume=1'; }else{ $resume = ' resume=0'; }
2005
+		if ($overwrite) { $overwrite = ' overwrite=1'; } else { $overwrite = ' overwrite=0'; }
2006
+		if ($resume) { $resume = ' resume=1'; } else { $resume = ' resume=0'; }
2007 2007
 		
2008
-		return $this->getData('array', 'ftinitupload clientftfid='.rand(1,99).' name='.$this->escapeText($filename).' cid='.$cid.' cpw='.$this->escapeText($cpw).' size='.($size + 1).$overwrite.$resume);
2008
+		return $this->getData('array', 'ftinitupload clientftfid=' . rand(1, 99) . ' name=' . $this->escapeText($filename) . ' cid=' . $cid . ' cpw=' . $this->escapeText($cpw) . ' size=' . ($size + 1) . $overwrite . $resume);
2009 2009
 	}
2010 2010
 	
2011 2011
 /**
@@ -2037,7 +2037,7 @@  discard block
 block discarded – undo
2037 2037
   * @return     array	fileTransferList
2038 2038
   */
2039 2039
 	function ftList() {
2040
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2040
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2041 2041
 		return $this->getData('multi', 'ftlist');
2042 2042
 	}
2043 2043
 
@@ -2055,10 +2055,10 @@  discard block
 block discarded – undo
2055 2055
   * @param		string  $tcpw		targetChannelPassword [optional]
2056 2056
   * @return     boolean success
2057 2057
   */
2058
-	function ftRenameFile($cid, $cpw = null, $oldname, $newname, $tcid = null,  $tcpw = null) {
2059
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2060
-		$newTarget = ($tcid != null ? ' tcid='.$tcid.' '.$tcpw : '');
2061
-		return $this->getData('boolean', 'ftrenamefile cid='.$cid.' cpw='.$cpw.' oldname='.$this->escapeText($oldname).' newname='.$this->escapeText($newname).$newTarget);
2058
+	function ftRenameFile($cid, $cpw = null, $oldname, $newname, $tcid = null, $tcpw = null) {
2059
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2060
+		$newTarget = ($tcid != null ? ' tcid=' . $tcid . ' ' . $tcpw : '');
2061
+		return $this->getData('boolean', 'ftrenamefile cid=' . $cid . ' cpw=' . $cpw . ' oldname=' . $this->escapeText($oldname) . ' newname=' . $this->escapeText($newname) . $newTarget);
2062 2062
 	}
2063 2063
 
2064 2064
 /**
@@ -2072,8 +2072,8 @@  discard block
 block discarded – undo
2072 2072
   * @return     boolean success
2073 2073
   */
2074 2074
 	function ftStop($serverftfid, $delete = true) {
2075
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }		
2076
-		return $this->getData('boolean', 'ftstop serverftfid='.$serverftfid.' delete='.($delete ? '1' : '0'));
2075
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }		
2076
+		return $this->getData('boolean', 'ftstop serverftfid=' . $serverftfid . ' delete=' . ($delete ? '1' : '0'));
2077 2077
 	}
2078 2078
 
2079 2079
 /**
@@ -2089,15 +2089,15 @@  discard block
 block discarded – undo
2089 2089
   */
2090 2090
 	function ftUploadFile($data, $uploadData) {
2091 2091
   		$this->runtime['fileSocket'] = @fsockopen($this->runtime['host'], $data['data']['port'], $errnum, $errstr, $this->runtime['timeout']);
2092
-  		if($this->runtime['fileSocket']) {
2092
+  		if ($this->runtime['fileSocket']) {
2093 2093
   			$this->ftSendKey($data['data']['ftkey'], "\n");
2094 2094
   			$this->ftSendData($uploadData);
2095 2095
   			@fclose($this->runtime['fileSocket']);
2096 2096
   			$this->runtime['fileSocket'] = '';
2097 2097
   			return $this->generateOutput(true, array(), true);
2098
-  		}else{
2099
-  			$this->addDebugLog('fileSocket returns '.$errnum. ' | '.$errstr);
2100
-  			return $this->generateOutput(false, array('Error in fileSocket: '.$errnum. ' | '.$errstr), false);
2098
+  		} else {
2099
+  			$this->addDebugLog('fileSocket returns ' . $errnum . ' | ' . $errstr);
2100
+  			return $this->generateOutput(false, array('Error in fileSocket: ' . $errnum . ' | ' . $errstr), false);
2101 2101
   		}
2102 2102
 	}
2103 2103
 
@@ -2111,11 +2111,11 @@  discard block
 block discarded – undo
2111 2111
   * @return     boolean success
2112 2112
   */
2113 2113
 	function gm($msg) {
2114
-		if(empty($msg)) {
2114
+		if (empty($msg)) {
2115 2115
 			$this->addDebugLog('empty message given');
2116 2116
 			return $this->generateOutput(false, array('Error: empty message given'), false);
2117 2117
 		}
2118
-		return $this->getData('boolean', 'gm msg='.$this->escapeText($msg));
2118
+		return $this->getData('boolean', 'gm msg=' . $this->escapeText($msg));
2119 2119
 	}
2120 2120
 
2121 2121
 /**
@@ -2173,14 +2173,14 @@  discard block
 block discarded – undo
2173 2173
   * @return     boolean success
2174 2174
   */
2175 2175
 	function instanceEdit($data) {
2176
-		if(count($data) > 0) {
2176
+		if (count($data) > 0) {
2177 2177
 			$settingsString = '';
2178 2178
 			
2179
-			foreach($data as $key => $val) {
2180
-				$settingsString .= ' '.$key.'='.$this->escapeText($val);
2179
+			foreach ($data as $key => $val) {
2180
+				$settingsString .= ' ' . $key . '=' . $this->escapeText($val);
2181 2181
 			}
2182
-			return $this->getData('boolean', 'instanceedit '.$settingsString);
2183
-		}else{
2182
+			return $this->getData('boolean', 'instanceedit ' . $settingsString);
2183
+		} else {
2184 2184
 			$this->addDebugLog('empty array entered');
2185 2185
 			return $this->generateOutput(false, array('Error: You can \'t give an empty array'), false);
2186 2186
 		}
@@ -2229,14 +2229,14 @@  discard block
 block discarded – undo
2229 2229
   * @return     boolean success
2230 2230
   */
2231 2231
 	function logAdd($logLevel, $logMsg) {
2232
-		if($logLevel >=1 and $logLevel <= 4) { 
2233
-			if(!empty($logMsg)) {
2234
-				return $this->getData('boolean', 'logadd loglevel='.$logLevel.' logmsg='.$this->escapeText($logMsg));
2235
-			}else{
2232
+		if ($logLevel >= 1 and $logLevel <= 4) { 
2233
+			if (!empty($logMsg)) {
2234
+				return $this->getData('boolean', 'logadd loglevel=' . $logLevel . ' logmsg=' . $this->escapeText($logMsg));
2235
+			} else {
2236 2236
 				$this->addDebugLog('logMessage empty!');
2237 2237
 				return $this->generateOutput(false, array('Error: logMessage empty!'), false);
2238 2238
 			}
2239
-		}else{
2239
+		} else {
2240 2240
 			$this->addDebugLog('invalid logLevel!');
2241 2241
 			return $this->generateOutput(false, array('Error: invalid logLevel!'), false);
2242 2242
 		}
@@ -2253,7 +2253,7 @@  discard block
 block discarded – undo
2253 2253
   * @return     boolean success
2254 2254
   */
2255 2255
 	function login($username, $password) {
2256
-		return $this->getData('boolean', 'login '.$this->escapeText($username).' '.$this->escapeText($password));
2256
+		return $this->getData('boolean', 'login ' . $this->escapeText($username) . ' ' . $this->escapeText($password));
2257 2257
 	}
2258 2258
 
2259 2259
 /**
@@ -2298,9 +2298,9 @@  discard block
 block discarded – undo
2298 2298
   * @return     multidimensional-array logEntries
2299 2299
   */
2300 2300
 	function logView($lines, $reverse = 0, $instance = 0, $begin_pos = 0) {		
2301
-		if($lines >=1 and $lines <=100) {
2302
-			return $this->getData('multi', 'logview lines='.$lines.' reverse='.($reverse == 0 ? '0' : '1').' instance='.($instance == 0 ? '0' : '1').' begin_pos='.($begin_pos == 0 ? '0' : $begin_pos));
2303
-		}else{
2301
+		if ($lines >= 1 and $lines <= 100) {
2302
+			return $this->getData('multi', 'logview lines=' . $lines . ' reverse=' . ($reverse == 0 ? '0' : '1') . ' instance=' . ($instance == 0 ? '0' : '1') . ' begin_pos=' . ($begin_pos == 0 ? '0' : $begin_pos));
2303
+		} else {
2304 2304
 			$this->addDebugLog('please choose a limit between 1 and 100');
2305 2305
 			$this->generateOutput(false, array('Error: please choose a limit between 1 and 100'), false);
2306 2306
 		}
@@ -2332,12 +2332,12 @@  discard block
 block discarded – undo
2332 2332
 	function permIdGetByName($permsids) {
2333 2333
 		$permissionArray = array();
2334 2334
 		
2335
-		if(count($permsids) > 0) {
2336
-			foreach($permsids AS $value) {
2337
-				$permissionArray[] = 'permsid='.$value;
2335
+		if (count($permsids) > 0) {
2336
+			foreach ($permsids AS $value) {
2337
+				$permissionArray[] = 'permsid=' . $value;
2338 2338
 			}
2339
-			return $this->getData('multi', 'permidgetbyname '.$this->escapeText(implode('|', $permissionArray)));
2340
-		}else{
2339
+			return $this->getData('multi', 'permidgetbyname ' . $this->escapeText(implode('|', $permissionArray)));
2340
+		} else {
2341 2341
 			$this->addDebugLog('no permissions given');
2342 2342
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
2343 2343
 		}
@@ -2433,7 +2433,7 @@  discard block
 block discarded – undo
2433 2433
   * @return     array permissionList
2434 2434
   */
2435 2435
 	function permissionList($new = false) {
2436
-		if($new === true) {
2436
+		if ($new === true) {
2437 2437
 			$groups = array();
2438 2438
 			$permissions = array();
2439 2439
 			
@@ -2441,21 +2441,21 @@  discard block
 block discarded – undo
2441 2441
 			
2442 2442
 			$gc = 1;
2443 2443
 			
2444
-			foreach($response as $field) {
2445
-				if(isset($field['group_id_end'])) {
2444
+			foreach ($response as $field) {
2445
+				if (isset($field['group_id_end'])) {
2446 2446
 					$groups[] = array('num' => $gc, 'group_id_end' => $field['group_id_end']);
2447 2447
 					$gc++;
2448
-				}else{
2448
+				} else {
2449 2449
 					$permissions[] = $field;
2450 2450
 				}
2451 2451
 			}
2452 2452
 			
2453 2453
 			$counter = 0;
2454 2454
 			
2455
-			for($i = 0; $i < count($groups); $i++) {
2455
+			for ($i = 0; $i < count($groups); $i++) {
2456 2456
 				$rounds = $groups[$i]['group_id_end'] - $counter;
2457 2457
 				$groups[$i]['pcount'] = $rounds;
2458
-				for($j = 0; $j < $rounds; $j++) {
2458
+				for ($j = 0; $j < $rounds; $j++) {
2459 2459
 					$groups[$i]['permissions'][] = array('permid' => ($counter + 1), 'permname' => $permissions[$counter]['permname'], 'permdesc' => $permissions[$counter]['permdesc'], 'grantpermid' => ($counter + 32769));
2460 2460
 					$counter++;
2461 2461
 				}
@@ -2463,7 +2463,7 @@  discard block
 block discarded – undo
2463 2463
 			
2464 2464
 			return $groups;
2465 2465
 			
2466
-		}else{
2466
+		} else {
2467 2467
 			return $this->getData('multi', 'permissionlist');
2468 2468
 		}
2469 2469
 	}
@@ -2494,11 +2494,11 @@  discard block
 block discarded – undo
2494 2494
   * @param		string	 	$permsid	permName
2495 2495
   * @return     array permOverview
2496 2496
   */
2497
-	function permOverview($cid, $cldbid, $permid='0', $permsid=false ) { 
2498
-        if(!$this->runtime['selected']) { return $this->checkSelected(); } 
2499
-        if($permsid) { $additional = ' permsid='.$permsid; }else{ $additional = ''; } 
2497
+	function permOverview($cid, $cldbid, $permid = '0', $permsid = false) { 
2498
+        if (!$this->runtime['selected']) { return $this->checkSelected(); } 
2499
+        if ($permsid) { $additional = ' permsid=' . $permsid; } else { $additional = ''; } 
2500 2500
          
2501
-        return $this->getData('multi', 'permoverview cid='.$cid.' cldbid='.$cldbid.' permid='.$permid.$additional); 
2501
+        return $this->getData('multi', 'permoverview cid=' . $cid . ' cldbid=' . $cldbid . ' permid=' . $permid . $additional); 
2502 2502
     }
2503 2503
  
2504 2504
 /**
@@ -2525,23 +2525,23 @@  discard block
 block discarded – undo
2525 2525
   * @return     boolean success
2526 2526
   */
2527 2527
 	function selectServer($value, $type = 'port', $virtual = false) { 
2528
-        if(in_array($type, array('port', 'serverId'))) { 
2529
-            if($type == 'port') { 
2530
-                if($virtual) { $virtual = ' -virtual'; }else{ $virtual = ''; } 
2531
-                $res = $this->getData('boolean', 'use port='.$value.$virtual); 
2532
-                if($res['success']) { 
2528
+        if (in_array($type, array('port', 'serverId'))) { 
2529
+            if ($type == 'port') { 
2530
+                if ($virtual) { $virtual = ' -virtual'; } else { $virtual = ''; } 
2531
+                $res = $this->getData('boolean', 'use port=' . $value . $virtual); 
2532
+                if ($res['success']) { 
2533 2533
                     $this->runtime['selected'] = true; 
2534 2534
                 } 
2535 2535
                 return $res; 
2536
-            }else{ 
2537
-                if($virtual) { $virtual = ' -virtual'; }else{ $virtual = ''; } 
2538
-                $res = $this->getData('boolean', 'use sid='.$value.$virtual); 
2539
-                if($res['success']) { 
2536
+            } else { 
2537
+                if ($virtual) { $virtual = ' -virtual'; } else { $virtual = ''; } 
2538
+                $res = $this->getData('boolean', 'use sid=' . $value . $virtual); 
2539
+                if ($res['success']) { 
2540 2540
                     $this->runtime['selected'] = true; 
2541 2541
                 } 
2542 2542
                 return $res; 
2543 2543
             } 
2544
-        }else{ 
2544
+        } else { 
2545 2545
             $this->addDebugLog('wrong value type'); 
2546 2546
             return $this->generateOutput(false, array('Error: wrong value type'), false); 
2547 2547
         } 
@@ -2574,8 +2574,8 @@  discard block
 block discarded – undo
2574 2574
   * @return     boolean	success
2575 2575
   */
2576 2576
 	function sendMessage($mode, $target, $msg) {
2577
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2578
-		return $this->getData('boolean', 'sendtextmessage targetmode='.$mode.' target='.$target.' msg='.$this->escapeText($msg));
2577
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2578
+		return $this->getData('boolean', 'sendtextmessage targetmode=' . $mode . ' target=' . $target . ' msg=' . $this->escapeText($msg));
2579 2579
 	}
2580 2580
 
2581 2581
 /**
@@ -2608,14 +2608,14 @@  discard block
 block discarded – undo
2608 2608
 	function serverCreate($data = array()) {
2609 2609
 		$settingsString = '';
2610 2610
 		
2611
-		if(count($data) == 0) {	$data['virtualserver_name'] = 'Teamspeak 3 Server'; }
2611
+		if (count($data) == 0) {	$data['virtualserver_name'] = 'Teamspeak 3 Server'; }
2612 2612
 		
2613 2613
 		
2614
-		foreach($data as $key => $value) {
2615
-			if(!empty($value)) { $settingsString .= ' '.$key.'='.$this->escapeText($value); }
2614
+		foreach ($data as $key => $value) {
2615
+			if (!empty($value)) { $settingsString .= ' ' . $key . '=' . $this->escapeText($value); }
2616 2616
 		}
2617 2617
 		
2618
-		return $this->getData('array', 'servercreate'.$settingsString);
2618
+		return $this->getData('array', 'servercreate' . $settingsString);
2619 2619
 	}
2620 2620
 
2621 2621
 /**
@@ -2629,7 +2629,7 @@  discard block
 block discarded – undo
2629 2629
   */
2630 2630
 	function serverDelete($sid) {
2631 2631
 		$this->serverStop($sid);
2632
-		return $this->getdata('boolean', 'serverdelete sid='.$sid);
2632
+		return $this->getdata('boolean', 'serverdelete sid=' . $sid);
2633 2633
 	}
2634 2634
 
2635 2635
 /**
@@ -2650,15 +2650,15 @@  discard block
 block discarded – undo
2650 2650
   * @return     boolean success
2651 2651
   */
2652 2652
 	function serverEdit($data) {
2653
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2653
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2654 2654
 		
2655 2655
 		$settingsString = '';
2656 2656
 		
2657
-		foreach($data as $key => $value) {
2658
-			$settingsString .= ' '.$key.'='.$this->escapeText($value);
2657
+		foreach ($data as $key => $value) {
2658
+			$settingsString .= ' ' . $key . '=' . $this->escapeText($value);
2659 2659
 		}
2660 2660
 		
2661
-		return $this->getData('boolean', 'serveredit'.$settingsString);
2661
+		return $this->getData('boolean', 'serveredit' . $settingsString);
2662 2662
 	}
2663 2663
 
2664 2664
 /**
@@ -2680,8 +2680,8 @@  discard block
 block discarded – undo
2680 2680
   * @return     array groupId
2681 2681
   */
2682 2682
 	function serverGroupAdd($name, $type = 1) {
2683
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2684
-		return $this->getData('array', 'servergroupadd name='.$this->escapeText($name).' type='.$type);
2683
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2684
+		return $this->getData('array', 'servergroupadd name=' . $this->escapeText($name) . ' type=' . $type);
2685 2685
 	}
2686 2686
 
2687 2687
 /**
@@ -2695,8 +2695,8 @@  discard block
 block discarded – undo
2695 2695
   * @return     boolean success
2696 2696
   */
2697 2697
 	function serverGroupAddClient($sgid, $cldbid) {
2698
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2699
-		return $this->getData('boolean', 'servergroupaddclient sgid='.$sgid.' cldbid='.$cldbid);
2698
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2699
+		return $this->getData('boolean', 'servergroupaddclient sgid=' . $sgid . ' cldbid=' . $cldbid);
2700 2700
 	}
2701 2701
 
2702 2702
 /**
@@ -2718,9 +2718,9 @@  discard block
 block discarded – undo
2718 2718
   * @return     boolean success
2719 2719
   */
2720 2720
 	function serverGroupAddPerm($sgid, $permissions) {
2721
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2721
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2722 2722
 		
2723
-		if(count($permissions) > 0) {
2723
+		if (count($permissions) > 0) {
2724 2724
 			//Permissions given
2725 2725
 				
2726 2726
 			//Errorcollector
@@ -2730,35 +2730,35 @@  discard block
 block discarded – undo
2730 2730
 			$permissions = array_chunk($permissions, 50, true);
2731 2731
 				
2732 2732
 			//Action for each splitted part of permission
2733
-			foreach($permissions as $permission_part)
2733
+			foreach ($permissions as $permission_part)
2734 2734
 			{
2735 2735
 				//Create command_string for each command that we could use implode later
2736 2736
 				$command_string = array();
2737 2737
 		
2738
-				foreach($permission_part as $key => $value)
2738
+				foreach ($permission_part as $key => $value)
2739 2739
 				{
2740
-					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=").$this->escapeText($key).' permvalue='.$value[0].' permskip='.$value[1].' permnegated='.$value[2];
2740
+					$command_string[] = (is_numeric($key) ? "permid=" : "permsid=") . $this->escapeText($key) . ' permvalue=' . $value[0] . ' permskip=' . $value[1] . ' permnegated=' . $value[2];
2741 2741
 				}
2742 2742
 		
2743
-				$result = $this->getData('boolean', 'servergroupaddperm sgid='.$sgid.' '.implode('|', $command_string));
2743
+				$result = $this->getData('boolean', 'servergroupaddperm sgid=' . $sgid . ' ' . implode('|', $command_string));
2744 2744
 		
2745
-				if(!$result['success'])
2745
+				if (!$result['success'])
2746 2746
 				{
2747
-					foreach($result['errors'] as $error)
2747
+					foreach ($result['errors'] as $error)
2748 2748
 					{
2749 2749
 						$errors[] = $error;
2750 2750
 					}
2751 2751
 				}
2752 2752
 			}
2753 2753
 				
2754
-			if(count($errors) == 0)
2754
+			if (count($errors) == 0)
2755 2755
 			{
2756 2756
 				return $this->generateOutput(true, array(), true);
2757
-			}else{
2757
+			} else {
2758 2758
 				return $this->generateOutput(false, $errors, false);
2759 2759
 			}
2760 2760
 				
2761
-		}else{
2761
+		} else {
2762 2762
 			// No permissions given
2763 2763
 			$this->addDebugLog('no permissions given');
2764 2764
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
@@ -2832,9 +2832,9 @@  discard block
 block discarded – undo
2832 2832
   * @return     multidimensional-array	serverGroupClientList
2833 2833
   */
2834 2834
 	function serverGroupClientList($sgid, $names = false) {
2835
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2836
-		if($names) { $names = ' -names'; }else{ $names = ''; }
2837
-		return $this->getData('multi', 'servergroupclientlist sgid='.$sgid.$names);
2835
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2836
+		if ($names) { $names = ' -names'; } else { $names = ''; }
2837
+		return $this->getData('multi', 'servergroupclientlist sgid=' . $sgid . $names);
2838 2838
 	}
2839 2839
 
2840 2840
 /**
@@ -2858,8 +2858,8 @@  discard block
 block discarded – undo
2858 2858
   * @return     array groupId
2859 2859
   */
2860 2860
 	function serverGroupCopy($ssgid, $tsgid, $name, $type = 1) {
2861
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2862
-		return $this->getData('array', 'servergroupcopy ssgid='.$ssgid.' tsgid='.$tsgid.' name='.$this->escapeText($name).' type='.$type);
2861
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2862
+		return $this->getData('array', 'servergroupcopy ssgid=' . $ssgid . ' tsgid=' . $tsgid . ' name=' . $this->escapeText($name) . ' type=' . $type);
2863 2863
 	}
2864 2864
 
2865 2865
 /**
@@ -2873,8 +2873,8 @@  discard block
 block discarded – undo
2873 2873
   * @return     boolean success
2874 2874
   */
2875 2875
 	function serverGroupDelete($sgid, $force = 1) {
2876
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2877
-		return $this->getData('boolean', 'servergroupdel sgid='.$sgid.' force='.$force);
2876
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2877
+		return $this->getData('boolean', 'servergroupdel sgid=' . $sgid . ' force=' . $force);
2878 2878
 	}
2879 2879
 
2880 2880
 /**
@@ -2888,8 +2888,8 @@  discard block
 block discarded – undo
2888 2888
   * @return     boolean success
2889 2889
   */
2890 2890
 	function serverGroupDeleteClient($sgid, $cldbid) {
2891
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2892
-		return $this->getData('boolean', 'servergroupdelclient sgid='.$sgid.' cldbid='.$cldbid);
2891
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2892
+		return $this->getData('boolean', 'servergroupdelclient sgid=' . $sgid . ' cldbid=' . $cldbid);
2893 2893
 	}
2894 2894
 
2895 2895
 /**
@@ -2911,15 +2911,15 @@  discard block
 block discarded – undo
2911 2911
   * @return     boolean success
2912 2912
   */
2913 2913
 	function serverGroupDeletePerm($sgid, $permissionIds) {
2914
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2914
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2915 2915
 		$permissionArray = array();
2916 2916
 		
2917
-		if(count($permissionIds) > 0) {
2918
-			foreach($permissionIds AS $value) {
2919
-				$permissionArray[] = is_numeric($value) ? 'permid='.$value : 'permsid='.$this->escapeText($value);
2917
+		if (count($permissionIds) > 0) {
2918
+			foreach ($permissionIds AS $value) {
2919
+				$permissionArray[] = is_numeric($value) ? 'permid=' . $value : 'permsid=' . $this->escapeText($value);
2920 2920
 			}
2921
-			return $this->getData('boolean', 'servergroupdelperm sgid='.$sgid.' '.implode('|', $permissionArray));
2922
-		}else{
2921
+			return $this->getData('boolean', 'servergroupdelperm sgid=' . $sgid . ' ' . implode('|', $permissionArray));
2922
+		} else {
2923 2923
 			$this->addDebugLog('no permissions given');
2924 2924
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
2925 2925
 		}
@@ -2946,7 +2946,7 @@  discard block
 block discarded – undo
2946 2946
   * @return     array serverGroupList
2947 2947
   */
2948 2948
 	function serverGroupList() {
2949
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2949
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2950 2950
 		return $this->getData('multi', 'servergrouplist');
2951 2951
 	}
2952 2952
 
@@ -2973,9 +2973,9 @@  discard block
 block discarded – undo
2973 2973
   * @return     array serverGroupPermList
2974 2974
   */
2975 2975
 	function serverGroupPermList($sgid, $permsid = false) {
2976
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2977
-		if($permsid) { $additional = ' -permsid'; }else{ $additional = ''; }
2978
-		return $this->getData('multi', 'servergrouppermlist sgid='.$sgid.$additional);
2976
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2977
+		if ($permsid) { $additional = ' -permsid'; } else { $additional = ''; }
2978
+		return $this->getData('multi', 'servergrouppermlist sgid=' . $sgid . $additional);
2979 2979
 	}
2980 2980
 
2981 2981
 /**
@@ -2989,8 +2989,8 @@  discard block
 block discarded – undo
2989 2989
   * @return     boolean success
2990 2990
   */
2991 2991
 	function serverGroupRename($sgid, $name) {
2992
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2993
-		return $this->getData('boolean', 'servergrouprename sgid='.$sgid.' name='.$this->escapeText($name));
2992
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
2993
+		return $this->getData('boolean', 'servergrouprename sgid=' . $sgid . ' name=' . $this->escapeText($name));
2994 2994
 	}
2995 2995
 
2996 2996
 /**
@@ -3013,8 +3013,8 @@  discard block
 block discarded – undo
3013 3013
   * @return     array serverGroupsByClientId
3014 3014
   */
3015 3015
 	function serverGroupsByClientID($cldbid) {
3016
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3017
-		return $this->getData('multi', 'servergroupsbyclientid cldbid='.$cldbid);
3016
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
3017
+		return $this->getData('multi', 'servergroupsbyclientid cldbid=' . $cldbid);
3018 3018
 	}
3019 3019
 
3020 3020
 /**
@@ -3035,7 +3035,7 @@  discard block
 block discarded – undo
3035 3035
   * @return     array serverInfo
3036 3036
   */
3037 3037
 	function serverIdGetByPort($port) {
3038
-		return $this->getData('array', 'serveridgetbyport virtualserver_port='.$port);
3038
+		return $this->getData('array', 'serveridgetbyport virtualserver_port=' . $port);
3039 3039
 	}
3040 3040
 
3041 3041
 /**
@@ -3147,7 +3147,7 @@  discard block
 block discarded – undo
3147 3147
   * @return     array serverInformation
3148 3148
   */
3149 3149
 	function serverInfo() {
3150
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3150
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
3151 3151
 		return $this->getData('array', 'serverinfo');
3152 3152
 	}
3153 3153
 
@@ -3181,7 +3181,7 @@  discard block
 block discarded – undo
3181 3181
   * @return     array serverList
3182 3182
   */
3183 3183
 	function serverList($options = NULL) {
3184
-		return $this->getData('multi', 'serverlist'.(!empty($options) ? ' '.$options : ''));
3184
+		return $this->getData('multi', 'serverlist' . (!empty($options) ? ' ' . $options : ''));
3185 3185
 	}
3186 3186
 
3187 3187
 /**
@@ -3227,7 +3227,7 @@  discard block
 block discarded – undo
3227 3227
   * @return     array serverRequestConnectionInfo
3228 3228
   */
3229 3229
 	function serverRequestConnectionInfo() {
3230
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3230
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
3231 3231
 		return $this->getData('array', 'serverrequestconnectioninfo');
3232 3232
 	}
3233 3233
 
@@ -3240,7 +3240,7 @@  discard block
 block discarded – undo
3240 3240
   * @return     string snapshot
3241 3241
   */
3242 3242
 	function serverSnapshotCreate() {
3243
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3243
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
3244 3244
 		return $this->getData('plain', 'serversnapshotcreate');
3245 3245
 	}
3246 3246
 
@@ -3254,8 +3254,8 @@  discard block
 block discarded – undo
3254 3254
   * @return     boolean success
3255 3255
   */
3256 3256
 	function serverSnapshotDeploy($snapshot) {
3257
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3258
-		return $this->getData('boolean', 'serversnapshotdeploy '.$snapshot);
3257
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
3258
+		return $this->getData('boolean', 'serversnapshotdeploy ' . $snapshot);
3259 3259
 	}
3260 3260
 	
3261 3261
 /**
@@ -3268,7 +3268,7 @@  discard block
 block discarded – undo
3268 3268
   * @return     boolean success
3269 3269
   */
3270 3270
 	function serverStart($sid) {
3271
-		return $this->getdata('boolean', 'serverstart sid='.$sid);
3271
+		return $this->getdata('boolean', 'serverstart sid=' . $sid);
3272 3272
 	}	
3273 3273
 
3274 3274
 /**
@@ -3281,7 +3281,7 @@  discard block
 block discarded – undo
3281 3281
   * @return     boolean success
3282 3282
   */
3283 3283
 	function serverStop($sid) {
3284
-		return $this->getdata('boolean', 'serverstop sid='.$sid);
3284
+		return $this->getdata('boolean', 'serverstop sid=' . $sid);
3285 3285
 	}
3286 3286
 
3287 3287
 /**
@@ -3298,8 +3298,8 @@  discard block
 block discarded – undo
3298 3298
   * @return     boolean success
3299 3299
   */
3300 3300
 	function serverTempPasswordAdd($pw, $duration, $desc = 'none', $tcid = 0, $tcpw = null) {
3301
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3302
-		return $this->getdata('boolean', 'servertemppasswordadd pw='.$this->escapeText($pw).' desc='.(!empty($desc) ? $this->escapeText($desc) : 'none').' duration='.$duration.' tcid='.$tcid.(!empty($tcpw) ? ' tcpw='.$this->escapeText($tcpw) : ''));
3301
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
3302
+		return $this->getdata('boolean', 'servertemppasswordadd pw=' . $this->escapeText($pw) . ' desc=' . (!empty($desc) ? $this->escapeText($desc) : 'none') . ' duration=' . $duration . ' tcid=' . $tcid . (!empty($tcpw) ? ' tcpw=' . $this->escapeText($tcpw) : ''));
3303 3303
 	}
3304 3304
 
3305 3305
 /**
@@ -3312,8 +3312,8 @@  discard block
 block discarded – undo
3312 3312
   * @return     boolean success
3313 3313
   */	
3314 3314
 	function serverTempPasswordDel($pw) {
3315
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3316
-		return $this->getdata('boolean', 'servertemppassworddel pw='.$this->escapeText($pw));
3315
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
3316
+		return $this->getdata('boolean', 'servertemppassworddel pw=' . $this->escapeText($pw));
3317 3317
 	}
3318 3318
 
3319 3319
 /**
@@ -3339,7 +3339,7 @@  discard block
 block discarded – undo
3339 3339
   * @return     array	serverTemppasswordList
3340 3340
   */
3341 3341
 	function serverTempPasswordList() {
3342
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3342
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
3343 3343
 		return $this->getData('multi', 'servertemppasswordlist');
3344 3344
 	}
3345 3345
 	
@@ -3356,8 +3356,8 @@  discard block
 block discarded – undo
3356 3356
   * @return     boolean success
3357 3357
   */
3358 3358
 	function setClientChannelGroup($cgid, $cid, $cldbid) {
3359
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3360
-		return $this->getData('boolean', 'setclientchannelgroup cgid='.$cgid.' cid='.$cid.' cldbid='.$cldbid);
3359
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
3360
+		return $this->getData('boolean', 'setclientchannelgroup cgid=' . $cgid . ' cid=' . $cid . ' cldbid=' . $cldbid);
3361 3361
 	}
3362 3362
 
3363 3363
 /**
@@ -3370,7 +3370,7 @@  discard block
 block discarded – undo
3370 3370
   * @return     boolean success
3371 3371
   */
3372 3372
 	function setName($newName) {
3373
-		return $this->getData('boolean', 'clientupdate client_nickname='.$this->escapeText($newName));
3373
+		return $this->getData('boolean', 'clientupdate client_nickname=' . $this->escapeText($newName));
3374 3374
 	}
3375 3375
 
3376 3376
 /**
@@ -3395,24 +3395,24 @@  discard block
 block discarded – undo
3395 3395
   * @param		array	$customFieldSet			customFieldSet [optional]
3396 3396
   * @return     array	tokenInformation
3397 3397
   */
3398
-	function tokenAdd($tokentype, $tokenid1, $tokenid2, $description ='', $customFieldSet = array()) {
3399
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3398
+	function tokenAdd($tokentype, $tokenid1, $tokenid2, $description = '', $customFieldSet = array()) {
3399
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
3400 3400
 		
3401
-		if(!empty($description)) { $description = ' tokendescription=' . $this->escapeText($description); }
3401
+		if (!empty($description)) { $description = ' tokendescription=' . $this->escapeText($description); }
3402 3402
 
3403
-		if(count($customFieldSet)) {
3403
+		if (count($customFieldSet)) {
3404 3404
 			$settingsString = array();
3405 3405
 		
3406
-			foreach($customFieldSet as $key => $value) {
3407
-				$settingsString[] = 'ident='.$this->escapeText($key).'\svalue='.$this->escapeText($value);
3406
+			foreach ($customFieldSet as $key => $value) {
3407
+				$settingsString[] = 'ident=' . $this->escapeText($key) . '\svalue=' . $this->escapeText($value);
3408 3408
 			}
3409 3409
 			
3410
-			$customFieldSet = ' tokencustomset='.implode('|', $settingsString);
3411
-		}else{
3410
+			$customFieldSet = ' tokencustomset=' . implode('|', $settingsString);
3411
+		} else {
3412 3412
 			$customFieldSet = '';
3413 3413
 		}
3414 3414
 		
3415
-		return $this->getData('array', 'privilegekeyadd tokentype='.$tokentype.' tokenid1='.$tokenid1.' tokenid2='.$tokenid2.$description.$customFieldSet);
3415
+		return $this->getData('array', 'privilegekeyadd tokentype=' . $tokentype . ' tokenid1=' . $tokenid1 . ' tokenid2=' . $tokenid2 . $description . $customFieldSet);
3416 3416
 	}
3417 3417
 
3418 3418
 /**
@@ -3425,8 +3425,8 @@  discard block
 block discarded – undo
3425 3425
   * @return     boolean success
3426 3426
   */
3427 3427
 	function tokenDelete($token) {
3428
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }			
3429
-		return $this->getData('boolean', 'privilegekeydelete token='.$token);
3428
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }			
3429
+		return $this->getData('boolean', 'privilegekeydelete token=' . $token);
3430 3430
 	}
3431 3431
 
3432 3432
 /**
@@ -3451,7 +3451,7 @@  discard block
 block discarded – undo
3451 3451
   * @return     array tokenListist 
3452 3452
   */
3453 3453
 	function tokenList() {
3454
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }
3454
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }
3455 3455
 
3456 3456
 		return $this->getData('multi', 'privilegekeylist');
3457 3457
 	}
@@ -3466,8 +3466,8 @@  discard block
 block discarded – undo
3466 3466
   * @return     boolean success
3467 3467
   */
3468 3468
 	function tokenUse($token) {
3469
-		if(!$this->runtime['selected']) { return $this->checkSelected(); }			
3470
-		return $this->getData('boolean', 'privilegekeyuse token='.$token);
3469
+		if (!$this->runtime['selected']) { return $this->checkSelected(); }			
3470
+		return $this->getData('boolean', 'privilegekeyuse token=' . $token);
3471 3471
 	}
3472 3472
 
3473 3473
 /**
@@ -3559,7 +3559,7 @@  discard block
 block discarded – undo
3559 3559
   */
3560 3560
  	public function convertSecondsToStrTime($seconds) {
3561 3561
 		$conv_time = $this->convertSecondsToArrayTime($seconds);
3562
-    	return $conv_time['days'].'d '.$conv_time['hours'].'h '.$conv_time['minutes'].'m '.$conv_time['seconds'].'s';
3562
+    	return $conv_time['days'] . 'd ' . $conv_time['hours'] . 'h ' . $conv_time['minutes'] . 'm ' . $conv_time['seconds'] . 's';
3563 3563
 	}
3564 3564
 
3565 3565
 /**
@@ -3584,10 +3584,10 @@  discard block
 block discarded – undo
3584 3584
   */
3585 3585
  	public function convertSecondsToArrayTime($seconds) {
3586 3586
 		$conv_time = array();
3587
-		$conv_time['days']=floor($seconds / 86400);
3588
-		$conv_time['hours']=floor(($seconds - ($conv_time['days'] * 86400)) / 3600);
3589
-		$conv_time['minutes']=floor(($seconds - (($conv_time['days'] * 86400)+($conv_time['hours']*3600))) / 60);
3590
-		$conv_time['seconds']=floor(($seconds - (($conv_time['days'] * 86400)+($conv_time['hours']*3600)+($conv_time['minutes'] * 60))));
3587
+		$conv_time['days'] = floor($seconds / 86400);
3588
+		$conv_time['hours'] = floor(($seconds - ($conv_time['days'] * 86400)) / 3600);
3589
+		$conv_time['minutes'] = floor(($seconds - (($conv_time['days'] * 86400) + ($conv_time['hours'] * 3600))) / 60);
3590
+		$conv_time['seconds'] = floor(($seconds - (($conv_time['days'] * 86400) + ($conv_time['hours'] * 3600) + ($conv_time['minutes'] * 60))));
3591 3591
 		return $conv_time;
3592 3592
 	}
3593 3593
 
@@ -3641,9 +3641,9 @@  discard block
 block discarded – undo
3641 3641
   * @return     boolean
3642 3642
   */
3643 3643
 	public function succeeded($array) {
3644
-		if(isset($array['success'])) {
3644
+		if (isset($array['success'])) {
3645 3645
 			return $array['success'];
3646
-		}else{
3646
+		} else {
3647 3647
 			return false;
3648 3648
 		}
3649 3649
 	}
@@ -3664,15 +3664,15 @@  discard block
 block discarded – undo
3664 3664
  * @return	void
3665 3665
 */
3666 3666
 	function __construct($host, $queryport, $timeout = 2) {
3667
-		if($queryport >= 1 and $queryport <= 65536) {
3668
-			if($timeout >= 1) {
3667
+		if ($queryport >= 1 and $queryport <= 65536) {
3668
+			if ($timeout >= 1) {
3669 3669
 				$this->runtime['host'] = $host;
3670 3670
 				$this->runtime['queryport'] = $queryport;
3671 3671
 				$this->runtime['timeout'] = $timeout;
3672
-			}else{
3672
+			} else {
3673 3673
 				$this->addDebugLog('invalid timeout value');
3674 3674
 			}
3675
-		}else{
3675
+		} else {
3676 3676
 			$this->addDebugLog('invalid queryport');
3677 3677
 		}
3678 3678
 	}
@@ -3698,8 +3698,8 @@  discard block
 block discarded – undo
3698 3698
  * @return	void
3699 3699
 */
3700 3700
 	function __call($name, $args) {
3701
-		$this->addDebugLog('Method '.$name.' doesn\'t exist', $name, 0);
3702
-		return $this->generateOutput(false, array('Method '.$name.' doesn\'t exist'), false);
3701
+		$this->addDebugLog('Method ' . $name . ' doesn\'t exist', $name, 0);
3702
+		return $this->generateOutput(false, array('Method ' . $name . ' doesn\'t exist'), false);
3703 3703
 	}
3704 3704
 
3705 3705
 /**
@@ -3711,9 +3711,9 @@  discard block
 block discarded – undo
3711 3711
   * @return     boolean connected
3712 3712
   */
3713 3713
 	private function isConnected() {
3714
-		if(empty($this->runtime['socket'])) {
3714
+		if (empty($this->runtime['socket'])) {
3715 3715
 			return false;
3716
-		}else{
3716
+		} else {
3717 3717
 			return true;
3718 3718
 		}
3719 3719
 	}
@@ -3800,21 +3800,21 @@  discard block
 block discarded – undo
3800 3800
   * @return		boolean success
3801 3801
   */
3802 3802
 	function connect() {
3803
-		if($this->isConnected()) { 
3803
+		if ($this->isConnected()) { 
3804 3804
 			$this->addDebugLog('Error: you are already connected!');
3805 3805
 			return $this->generateOutput(false, array('Error: the script is already connected!'), false);
3806 3806
 		}
3807 3807
 		$socket = @fsockopen($this->runtime['host'], $this->runtime['queryport'], $errnum, $errstr, $this->runtime['timeout']);
3808 3808
 
3809
-		if(!$socket) {
3809
+		if (!$socket) {
3810 3810
 			$this->addDebugLog('Error: connection failed!');
3811
-			return $this->generateOutput(false, array('Error: connection failed!', 'Server returns: '.$errstr), false);
3812
-		}else{
3813
-			if(strpos(fgets($socket), 'TS3') !== false) {
3811
+			return $this->generateOutput(false, array('Error: connection failed!', 'Server returns: ' . $errstr), false);
3812
+		} else {
3813
+			if (strpos(fgets($socket), 'TS3') !== false) {
3814 3814
 				$tmpVar = fgets($socket);
3815 3815
 				$this->runtime['socket'] = $socket;
3816 3816
 				return $this->generateOutput(true, array(), true);
3817
-			}else{
3817
+			} else {
3818 3818
 				$this->addDebugLog('host isn\'t a ts3 instance!');
3819 3819
 				return $this->generateOutput(false, array('Error: host isn\'t a ts3 instance!'), false);
3820 3820
 			}
@@ -3832,7 +3832,7 @@  discard block
 block discarded – undo
3832 3832
   * @return     mixed data
3833 3833
   */
3834 3834
 	private function executeCommand($command, $tracert) {
3835
-		if(!$this->isConnected()) {
3835
+		if (!$this->isConnected()) {
3836 3836
 			$this->addDebugLog('script isn\'t connected to server', $tracert[1]['function'], $tracert[0]['line']);
3837 3837
 			return $this->generateOutput(false, array('Error: script isn\'t connected to server'), false);
3838 3838
 		}
@@ -3844,31 +3844,31 @@  discard block
 block discarded – undo
3844 3844
 		
3845 3845
 		$splittedCommand[(count($splittedCommand) - 1)] .= "\n";
3846 3846
 		
3847
-		foreach($splittedCommand as $commandPart) {
3847
+		foreach ($splittedCommand as $commandPart) {
3848 3848
 			fputs($this->runtime['socket'], $commandPart);
3849 3849
 		}
3850 3850
 
3851 3851
 		do {
3852 3852
 			$data .= fgets($this->runtime['socket'], 4096);
3853 3853
 			
3854
-			if(strpos($data, 'error id=3329 msg=connection') !== false) {
3854
+			if (strpos($data, 'error id=3329 msg=connection') !== false) {
3855 3855
 				$this->runtime['socket'] = '';
3856 3856
 				$this->addDebugLog('You got banned from server. Socket closed.', $tracert[1]['function'], $tracert[0]['line']);
3857 3857
 				return $this->generateOutput(false, array('You got banned from server. Connection closed.'), false);
3858 3858
 			}
3859 3859
 			
3860
-		} while(strpos($data, 'msg=') === false or strpos($data, 'error id=') === false);
3860
+		} while (strpos($data, 'msg=') === false or strpos($data, 'error id=') === false);
3861 3861
 
3862
-		if(strpos($data, 'error id=0 msg=ok') === false) {
3862
+		if (strpos($data, 'error id=0 msg=ok') === false) {
3863 3863
 			$splittedResponse = explode('error id=', $data);
3864 3864
 			$chooseEnd = count($splittedResponse) - 1;
3865 3865
 			
3866 3866
 			$cutIdAndMsg = explode(' msg=', $splittedResponse[$chooseEnd]);
3867 3867
 			
3868
-			$this->addDebugLog('ErrorID: '.$cutIdAndMsg[0].' | Message: '.$this->unEscapeText($cutIdAndMsg[1]), $tracert[1]['function'], $tracert[0]['line']);
3868
+			$this->addDebugLog('ErrorID: ' . $cutIdAndMsg[0] . ' | Message: ' . $this->unEscapeText($cutIdAndMsg[1]), $tracert[1]['function'], $tracert[0]['line']);
3869 3869
 			
3870
-			return $this->generateOutput(false, array('ErrorID: '.$cutIdAndMsg[0].' | Message: '.$this->unEscapeText($cutIdAndMsg[1])), false);
3871
-		}else{
3870
+			return $this->generateOutput(false, array('ErrorID: ' . $cutIdAndMsg[0] . ' | Message: ' . $this->unEscapeText($cutIdAndMsg[1])), false);
3871
+		} else {
3872 3872
 			return $this->generateOutput(true, array(), $data);
3873 3873
 		}
3874 3874
 	}
@@ -3888,12 +3888,12 @@  discard block
 block discarded – undo
3888 3888
 	
3889 3889
 		$validModes = array('boolean', 'array', 'multi', 'plain');
3890 3890
 	
3891
-		if(!in_array($mode, $validModes)) {
3892
-			$this->addDebugLog($mode.' is an invalid mode');
3893
-			return $this->generateOutput(false, array('Error: '.$mode.' is an invalid mode'), false);
3891
+		if (!in_array($mode, $validModes)) {
3892
+			$this->addDebugLog($mode . ' is an invalid mode');
3893
+			return $this->generateOutput(false, array('Error: ' . $mode . ' is an invalid mode'), false);
3894 3894
 		}
3895 3895
 		
3896
-		if(empty($command)) {
3896
+		if (empty($command)) {
3897 3897
 			$this->addDebugLog('you have to enter a command');
3898 3898
 			return $this->generateOutput(false, array('Error: you have to enter a command'), false);
3899 3899
 		}
@@ -3904,29 +3904,29 @@  discard block
 block discarded – undo
3904 3904
 		$fetchData['data'] = str_replace(array('error id=0 msg=ok', chr('01')), '', $fetchData['data']);
3905 3905
 		
3906 3906
 		
3907
-		if($fetchData['success']) {
3908
-			if($mode == 'boolean') {
3907
+		if ($fetchData['success']) {
3908
+			if ($mode == 'boolean') {
3909 3909
 				return $this->generateOutput(true, array(), true);
3910 3910
 			}
3911 3911
 			
3912
-			if($mode == 'array') {
3913
-				if(empty($fetchData['data'])) { return $this->generateOutput(true, array(), array()); }
3912
+			if ($mode == 'array') {
3913
+				if (empty($fetchData['data'])) { return $this->generateOutput(true, array(), array()); }
3914 3914
 				$datasets = explode(' ', $fetchData['data']);
3915 3915
 				
3916 3916
 				$output = array();
3917 3917
 				
3918
-				foreach($datasets as $dataset) {
3918
+				foreach ($datasets as $dataset) {
3919 3919
 					$dataset = explode('=', $dataset);
3920 3920
 					
3921
-					if(count($dataset) > 2) {
3922
-						for($i = 2; $i < count($dataset); $i++) {
3923
-							$dataset[1] .= '='.$dataset[$i];
3921
+					if (count($dataset) > 2) {
3922
+						for ($i = 2; $i < count($dataset); $i++) {
3923
+							$dataset[1] .= '=' . $dataset[$i];
3924 3924
 						}
3925 3925
 						$output[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3926
-					}else{
3927
-						if(count($dataset) == 1) {
3926
+					} else {
3927
+						if (count($dataset) == 1) {
3928 3928
 							$output[$this->unEscapeText($dataset[0])] = '';
3929
-						}else{
3929
+						} else {
3930 3930
 							$output[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3931 3931
 						}
3932 3932
 						
@@ -3934,28 +3934,28 @@  discard block
 block discarded – undo
3934 3934
 				}
3935 3935
 				return $this->generateOutput(true, array(), $output);
3936 3936
 			}
3937
-			if($mode == 'multi') {
3938
-				if(empty($fetchData['data'])) { return $this->generateOutput(true, array(), array()); }
3937
+			if ($mode == 'multi') {
3938
+				if (empty($fetchData['data'])) { return $this->generateOutput(true, array(), array()); }
3939 3939
 				$datasets = explode('|', $fetchData['data']);
3940 3940
 				
3941 3941
 				$output = array();
3942 3942
 				
3943
-				foreach($datasets as $datablock) {
3943
+				foreach ($datasets as $datablock) {
3944 3944
 					$datablock = explode(' ', $datablock);
3945 3945
 					
3946 3946
 					$tmpArray = array();
3947 3947
 					
3948
-					foreach($datablock as $dataset) {
3948
+					foreach ($datablock as $dataset) {
3949 3949
 						$dataset = explode('=', $dataset);
3950
-						if(count($dataset) > 2) {
3951
-							for($i = 2; $i < count($dataset); $i++) {
3952
-								$dataset[1] .= '='.$dataset[$i];
3950
+						if (count($dataset) > 2) {
3951
+							for ($i = 2; $i < count($dataset); $i++) {
3952
+								$dataset[1] .= '=' . $dataset[$i];
3953 3953
 							}
3954 3954
 							$tmpArray[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3955
-						}else{
3956
-							if(count($dataset) == 1) {
3955
+						} else {
3956
+							if (count($dataset) == 1) {
3957 3957
 								$tmpArray[$this->unEscapeText($dataset[0])] = '';
3958
-							}else{
3958
+							} else {
3959 3959
 								$tmpArray[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3960 3960
 							}
3961 3961
 						}					
@@ -3964,10 +3964,10 @@  discard block
 block discarded – undo
3964 3964
 				}
3965 3965
 				return $this->generateOutput(true, array(), $output);
3966 3966
 			}
3967
-			if($mode == 'plain') {
3967
+			if ($mode == 'plain') {
3968 3968
 				return $fetchData;
3969 3969
 			}
3970
-		}else{
3970
+		} else {
3971 3971
 			return $this->generateOutput(false, $fetchData['errors'], false);
3972 3972
 		}
3973 3973
 	}
@@ -3983,7 +3983,7 @@  discard block
 block discarded – undo
3983 3983
   * @return     none
3984 3984
  */
3985 3985
 	private function ftSendKey($key, $additional = NULL) {
3986
-		fputs($this->runtime['fileSocket'], $key.$additional);
3986
+		fputs($this->runtime['fileSocket'], $key . $additional);
3987 3987
 	}
3988 3988
 
3989 3989
 /**
@@ -3997,7 +3997,7 @@  discard block
 block discarded – undo
3997 3997
  */
3998 3998
 	private function ftSendData($data) {
3999 3999
 		$data = str_split($data, 4096);
4000
-		foreach($data as $dat) {
4000
+		foreach ($data as $dat) {
4001 4001
 			fputs($this->runtime['fileSocket'], $dat);
4002 4002
 		}
4003 4003
 	}
@@ -4013,7 +4013,7 @@  discard block
 block discarded – undo
4013 4013
  */
4014 4014
 	private function ftRead($size) {
4015 4015
 		$data = '';
4016
-		while(strlen($data) < $size) {		
4016
+		while (strlen($data) < $size) {		
4017 4017
 			$data .= fgets($this->runtime['fileSocket'], 4096);
4018 4018
 		}
4019 4019
 		return $data;
@@ -4056,12 +4056,12 @@  discard block
 block discarded – undo
4056 4056
   * @return     array debugLog
4057 4057
   */
4058 4058
 	private function addDebugLog($text, $methodName = '', $line = '') {
4059
-		if(empty($methodName) and empty($line)) {
4059
+		if (empty($methodName) and empty($line)) {
4060 4060
 			$backtrace = debug_backtrace();
4061 4061
 			$methodName = $backtrace[1]['function'];
4062 4062
 			$line = $backtrace[0]['line'];
4063 4063
 		}
4064
-		$this->runtime['debug'][] = 'Error in '.$methodName.'() on line '.$line.': '.$text;	
4064
+		$this->runtime['debug'][] = 'Error in ' . $methodName . '() on line ' . $line . ': ' . $text;	
4065 4065
 	}
4066 4066
 }
4067 4067
 ?>
4068 4068
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 		
170 170
 		if($result['success']) {
171 171
 			return $this->generateOutput(true, $result['errors'], $this->splitBanIds($result['data']));
172
-		}else{
172
+		} else{
173 173
 			return $this->generateOutput(false, $result['errors'], false);
174 174
 		}
175 175
 	}
@@ -307,11 +307,11 @@  discard block
 block discarded – undo
307 307
 			if(count($errors) == 0)
308 308
 			{
309 309
 				return $this->generateOutput(true, array(), true);
310
-			}else{
310
+			} else{
311 311
 				return $this->generateOutput(false, $errors, false);
312 312
 			}
313 313
 			
314
-		}else{
314
+		} else{
315 315
 			// No permissions given
316 316
 			$this->addDebugLog('no permissions given');
317 317
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
 			if(count($errors) == 0)
375 375
 			{
376 376
 				return $this->generateOutput(true, array(), true);
377
-			}else{
377
+			} else{
378 378
 				return $this->generateOutput(false, $errors, false);
379 379
 			}
380 380
 				
381
-		}else{
381
+		} else{
382 382
 			// No permissions given
383 383
 			$this->addDebugLog('no permissions given');
384 384
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 				$permissionArray[] = is_numeric($value) ? 'permid='.$value : 'permsid='.$value;
415 415
 			}
416 416
 			return $this->getData('boolean', 'channelclientdelperm cid='.$cid.' cldbid='.$cldbid.' '.implode('|', $permissionArray));
417
-		}else{
417
+		} else{
418 418
 			$this->addDebugLog('no permissions given');
419 419
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
420 420
 		}
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 				$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
534 534
 			}
535 535
 			return $this->getData('boolean', 'channeldelperm cid='.$cid.' '.implode('|', $permissionArray));
536
-		}else{
536
+		} else{
537 537
 			$this->addDebugLog('no permissions given');
538 538
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
539 539
 		}
@@ -676,11 +676,11 @@  discard block
 block discarded – undo
676 676
 		
677 677
 			if(count($errors) == 0) {
678 678
 				return $this->generateOutput(true, array(), true);
679
-			}else{
679
+			} else{
680 680
 				return $this->generateOutput(false, $errors, false);
681 681
 			}
682 682
 		
683
-		}else{
683
+		} else{
684 684
 			// No permissions given
685 685
 			$this->addDebugLog('no permissions given');
686 686
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 				$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
788 788
 			}
789 789
 			return $this->getData('boolean', 'channelgroupdelperm cgid='.$cgid.' '.implode('|', $permissionArray));
790
-		}else{
790
+		} else{
791 791
 			$this->addDebugLog('no permissions given');
792 792
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
793 793
 		}
@@ -1067,10 +1067,10 @@  discard block
 block discarded – undo
1067 1067
 			if(count($errors) == 0)
1068 1068
 			{
1069 1069
 				return $this->generateOutput(true, array(), true);
1070
-			}else{
1070
+			} else{
1071 1071
 				return $this->generateOutput(false, $errors, false);
1072 1072
 			}
1073
-		}else{
1073
+		} else{
1074 1074
 			// No permissions given
1075 1075
 			$this->addDebugLog('no permissions given');
1076 1076
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 	  if(is_array($download))
1121 1121
 	  {
1122 1122
 		return $download;
1123
-	  }else{
1123
+	  } else{
1124 1124
 		return $this->generateOutput(true, false, base64_encode($download));
1125 1125
 	  }
1126 1126
 
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 				$permissionArray[] = (is_numeric($value) ? 'permid=' : 'permsid=').$value;
1292 1292
 			}
1293 1293
 			return $this->getData('boolean', 'clientdelperm cldbid='.$cldbid.' '.implode('|', $permissionArray));
1294
-		}else{
1294
+		} else{
1295 1295
 			$this->addDebugLog('no permissions given');
1296 1296
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
1297 1297
 		}
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
 			if(!empty($kickmsg)) { $msg = ' reasonmsg='.$this->escapeText($kickmsg); } else{ $msg = ''; }
1544 1544
 			
1545 1545
 			return $this->getData('boolean', 'clientkick clid='.$clid.' reasonid='.$from.$msg);
1546
-		}else{
1546
+		} else{
1547 1547
 			$this->addDebugLog('invalid kickMode');
1548 1548
 			return $this->generateOutput(false, array('Error: invalid kickMode'), false);
1549 1549
 		}
@@ -1866,7 +1866,7 @@  discard block
 block discarded – undo
1866 1866
 				$fileArray[] = 'name='.$this->escapeText($file);
1867 1867
 			}
1868 1868
 			return $this->getData('boolean', 'ftdeletefile cid='.$cid.' cpw='.$this->escapeText($cpw).' '.implode('|', $fileArray));
1869
-		}else{
1869
+		} else{
1870 1870
 			$this->addDebugLog('no files given');
1871 1871
 			return $this->generateOutput(false, array('Error: no files given'), false);
1872 1872
 		}
@@ -1891,7 +1891,7 @@  discard block
 block discarded – undo
1891 1891
   			@fclose($this->runtime['fileSocket']);
1892 1892
   			$this->runtime['fileSocket'] = '';
1893 1893
   			return $content;
1894
-  		}else{
1894
+  		} else{
1895 1895
   			$this->addDebugLog('fileSocket returns '.$errnum. ' | '.$errstr);
1896 1896
   			return $this->generateOutput(false, array('Error in fileSocket: '.$errnum. ' | '.$errstr), false);
1897 1897
   		}
@@ -2002,8 +2002,8 @@  discard block
 block discarded – undo
2002 2002
 	function ftInitUpload($filename, $cid, $size, $cpw = '', $overwrite = false, $resume = false) {
2003 2003
 		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2004 2004
 		
2005
-		if($overwrite) { $overwrite = ' overwrite=1'; }else{ $overwrite = ' overwrite=0'; }
2006
-		if($resume) { $resume = ' resume=1'; }else{ $resume = ' resume=0'; }
2005
+		if($overwrite) { $overwrite = ' overwrite=1'; } else{ $overwrite = ' overwrite=0'; }
2006
+		if($resume) { $resume = ' resume=1'; } else{ $resume = ' resume=0'; }
2007 2007
 		
2008 2008
 		return $this->getData('array', 'ftinitupload clientftfid='.rand(1,99).' name='.$this->escapeText($filename).' cid='.$cid.' cpw='.$this->escapeText($cpw).' size='.($size + 1).$overwrite.$resume);
2009 2009
 	}
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
   			@fclose($this->runtime['fileSocket']);
2096 2096
   			$this->runtime['fileSocket'] = '';
2097 2097
   			return $this->generateOutput(true, array(), true);
2098
-  		}else{
2098
+  		} else{
2099 2099
   			$this->addDebugLog('fileSocket returns '.$errnum. ' | '.$errstr);
2100 2100
   			return $this->generateOutput(false, array('Error in fileSocket: '.$errnum. ' | '.$errstr), false);
2101 2101
   		}
@@ -2180,7 +2180,7 @@  discard block
 block discarded – undo
2180 2180
 				$settingsString .= ' '.$key.'='.$this->escapeText($val);
2181 2181
 			}
2182 2182
 			return $this->getData('boolean', 'instanceedit '.$settingsString);
2183
-		}else{
2183
+		} else{
2184 2184
 			$this->addDebugLog('empty array entered');
2185 2185
 			return $this->generateOutput(false, array('Error: You can \'t give an empty array'), false);
2186 2186
 		}
@@ -2232,11 +2232,11 @@  discard block
 block discarded – undo
2232 2232
 		if($logLevel >=1 and $logLevel <= 4) { 
2233 2233
 			if(!empty($logMsg)) {
2234 2234
 				return $this->getData('boolean', 'logadd loglevel='.$logLevel.' logmsg='.$this->escapeText($logMsg));
2235
-			}else{
2235
+			} else{
2236 2236
 				$this->addDebugLog('logMessage empty!');
2237 2237
 				return $this->generateOutput(false, array('Error: logMessage empty!'), false);
2238 2238
 			}
2239
-		}else{
2239
+		} else{
2240 2240
 			$this->addDebugLog('invalid logLevel!');
2241 2241
 			return $this->generateOutput(false, array('Error: invalid logLevel!'), false);
2242 2242
 		}
@@ -2300,7 +2300,7 @@  discard block
 block discarded – undo
2300 2300
 	function logView($lines, $reverse = 0, $instance = 0, $begin_pos = 0) {		
2301 2301
 		if($lines >=1 and $lines <=100) {
2302 2302
 			return $this->getData('multi', 'logview lines='.$lines.' reverse='.($reverse == 0 ? '0' : '1').' instance='.($instance == 0 ? '0' : '1').' begin_pos='.($begin_pos == 0 ? '0' : $begin_pos));
2303
-		}else{
2303
+		} else{
2304 2304
 			$this->addDebugLog('please choose a limit between 1 and 100');
2305 2305
 			$this->generateOutput(false, array('Error: please choose a limit between 1 and 100'), false);
2306 2306
 		}
@@ -2337,7 +2337,7 @@  discard block
 block discarded – undo
2337 2337
 				$permissionArray[] = 'permsid='.$value;
2338 2338
 			}
2339 2339
 			return $this->getData('multi', 'permidgetbyname '.$this->escapeText(implode('|', $permissionArray)));
2340
-		}else{
2340
+		} else{
2341 2341
 			$this->addDebugLog('no permissions given');
2342 2342
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
2343 2343
 		}
@@ -2445,7 +2445,7 @@  discard block
 block discarded – undo
2445 2445
 				if(isset($field['group_id_end'])) {
2446 2446
 					$groups[] = array('num' => $gc, 'group_id_end' => $field['group_id_end']);
2447 2447
 					$gc++;
2448
-				}else{
2448
+				} else{
2449 2449
 					$permissions[] = $field;
2450 2450
 				}
2451 2451
 			}
@@ -2463,7 +2463,7 @@  discard block
 block discarded – undo
2463 2463
 			
2464 2464
 			return $groups;
2465 2465
 			
2466
-		}else{
2466
+		} else{
2467 2467
 			return $this->getData('multi', 'permissionlist');
2468 2468
 		}
2469 2469
 	}
@@ -2496,7 +2496,7 @@  discard block
 block discarded – undo
2496 2496
   */
2497 2497
 	function permOverview($cid, $cldbid, $permid='0', $permsid=false ) { 
2498 2498
         if(!$this->runtime['selected']) { return $this->checkSelected(); } 
2499
-        if($permsid) { $additional = ' permsid='.$permsid; }else{ $additional = ''; } 
2499
+        if($permsid) { $additional = ' permsid='.$permsid; } else{ $additional = ''; } 
2500 2500
          
2501 2501
         return $this->getData('multi', 'permoverview cid='.$cid.' cldbid='.$cldbid.' permid='.$permid.$additional); 
2502 2502
     }
@@ -2527,21 +2527,21 @@  discard block
 block discarded – undo
2527 2527
 	function selectServer($value, $type = 'port', $virtual = false) { 
2528 2528
         if(in_array($type, array('port', 'serverId'))) { 
2529 2529
             if($type == 'port') { 
2530
-                if($virtual) { $virtual = ' -virtual'; }else{ $virtual = ''; } 
2530
+                if($virtual) { $virtual = ' -virtual'; } else{ $virtual = ''; } 
2531 2531
                 $res = $this->getData('boolean', 'use port='.$value.$virtual); 
2532 2532
                 if($res['success']) { 
2533 2533
                     $this->runtime['selected'] = true; 
2534 2534
                 } 
2535 2535
                 return $res; 
2536
-            }else{ 
2537
-                if($virtual) { $virtual = ' -virtual'; }else{ $virtual = ''; } 
2536
+            } else{ 
2537
+                if($virtual) { $virtual = ' -virtual'; } else{ $virtual = ''; } 
2538 2538
                 $res = $this->getData('boolean', 'use sid='.$value.$virtual); 
2539 2539
                 if($res['success']) { 
2540 2540
                     $this->runtime['selected'] = true; 
2541 2541
                 } 
2542 2542
                 return $res; 
2543 2543
             } 
2544
-        }else{ 
2544
+        } else{ 
2545 2545
             $this->addDebugLog('wrong value type'); 
2546 2546
             return $this->generateOutput(false, array('Error: wrong value type'), false); 
2547 2547
         } 
@@ -2754,11 +2754,11 @@  discard block
 block discarded – undo
2754 2754
 			if(count($errors) == 0)
2755 2755
 			{
2756 2756
 				return $this->generateOutput(true, array(), true);
2757
-			}else{
2757
+			} else{
2758 2758
 				return $this->generateOutput(false, $errors, false);
2759 2759
 			}
2760 2760
 				
2761
-		}else{
2761
+		} else{
2762 2762
 			// No permissions given
2763 2763
 			$this->addDebugLog('no permissions given');
2764 2764
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
@@ -2833,7 +2833,7 @@  discard block
 block discarded – undo
2833 2833
   */
2834 2834
 	function serverGroupClientList($sgid, $names = false) {
2835 2835
 		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2836
-		if($names) { $names = ' -names'; }else{ $names = ''; }
2836
+		if($names) { $names = ' -names'; } else{ $names = ''; }
2837 2837
 		return $this->getData('multi', 'servergroupclientlist sgid='.$sgid.$names);
2838 2838
 	}
2839 2839
 
@@ -2919,7 +2919,7 @@  discard block
 block discarded – undo
2919 2919
 				$permissionArray[] = is_numeric($value) ? 'permid='.$value : 'permsid='.$this->escapeText($value);
2920 2920
 			}
2921 2921
 			return $this->getData('boolean', 'servergroupdelperm sgid='.$sgid.' '.implode('|', $permissionArray));
2922
-		}else{
2922
+		} else{
2923 2923
 			$this->addDebugLog('no permissions given');
2924 2924
 			return $this->generateOutput(false, array('Error: no permissions given'), false);
2925 2925
 		}
@@ -2974,7 +2974,7 @@  discard block
 block discarded – undo
2974 2974
   */
2975 2975
 	function serverGroupPermList($sgid, $permsid = false) {
2976 2976
 		if(!$this->runtime['selected']) { return $this->checkSelected(); }
2977
-		if($permsid) { $additional = ' -permsid'; }else{ $additional = ''; }
2977
+		if($permsid) { $additional = ' -permsid'; } else{ $additional = ''; }
2978 2978
 		return $this->getData('multi', 'servergrouppermlist sgid='.$sgid.$additional);
2979 2979
 	}
2980 2980
 
@@ -3408,7 +3408,7 @@  discard block
 block discarded – undo
3408 3408
 			}
3409 3409
 			
3410 3410
 			$customFieldSet = ' tokencustomset='.implode('|', $settingsString);
3411
-		}else{
3411
+		} else{
3412 3412
 			$customFieldSet = '';
3413 3413
 		}
3414 3414
 		
@@ -3643,7 +3643,7 @@  discard block
 block discarded – undo
3643 3643
 	public function succeeded($array) {
3644 3644
 		if(isset($array['success'])) {
3645 3645
 			return $array['success'];
3646
-		}else{
3646
+		} else{
3647 3647
 			return false;
3648 3648
 		}
3649 3649
 	}
@@ -3669,10 +3669,10 @@  discard block
 block discarded – undo
3669 3669
 				$this->runtime['host'] = $host;
3670 3670
 				$this->runtime['queryport'] = $queryport;
3671 3671
 				$this->runtime['timeout'] = $timeout;
3672
-			}else{
3672
+			} else{
3673 3673
 				$this->addDebugLog('invalid timeout value');
3674 3674
 			}
3675
-		}else{
3675
+		} else{
3676 3676
 			$this->addDebugLog('invalid queryport');
3677 3677
 		}
3678 3678
 	}
@@ -3713,7 +3713,7 @@  discard block
 block discarded – undo
3713 3713
 	private function isConnected() {
3714 3714
 		if(empty($this->runtime['socket'])) {
3715 3715
 			return false;
3716
-		}else{
3716
+		} else{
3717 3717
 			return true;
3718 3718
 		}
3719 3719
 	}
@@ -3809,12 +3809,12 @@  discard block
 block discarded – undo
3809 3809
 		if(!$socket) {
3810 3810
 			$this->addDebugLog('Error: connection failed!');
3811 3811
 			return $this->generateOutput(false, array('Error: connection failed!', 'Server returns: '.$errstr), false);
3812
-		}else{
3812
+		} else{
3813 3813
 			if(strpos(fgets($socket), 'TS3') !== false) {
3814 3814
 				$tmpVar = fgets($socket);
3815 3815
 				$this->runtime['socket'] = $socket;
3816 3816
 				return $this->generateOutput(true, array(), true);
3817
-			}else{
3817
+			} else{
3818 3818
 				$this->addDebugLog('host isn\'t a ts3 instance!');
3819 3819
 				return $this->generateOutput(false, array('Error: host isn\'t a ts3 instance!'), false);
3820 3820
 			}
@@ -3868,7 +3868,7 @@  discard block
 block discarded – undo
3868 3868
 			$this->addDebugLog('ErrorID: '.$cutIdAndMsg[0].' | Message: '.$this->unEscapeText($cutIdAndMsg[1]), $tracert[1]['function'], $tracert[0]['line']);
3869 3869
 			
3870 3870
 			return $this->generateOutput(false, array('ErrorID: '.$cutIdAndMsg[0].' | Message: '.$this->unEscapeText($cutIdAndMsg[1])), false);
3871
-		}else{
3871
+		} else{
3872 3872
 			return $this->generateOutput(true, array(), $data);
3873 3873
 		}
3874 3874
 	}
@@ -3923,10 +3923,10 @@  discard block
 block discarded – undo
3923 3923
 							$dataset[1] .= '='.$dataset[$i];
3924 3924
 						}
3925 3925
 						$output[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3926
-					}else{
3926
+					} else{
3927 3927
 						if(count($dataset) == 1) {
3928 3928
 							$output[$this->unEscapeText($dataset[0])] = '';
3929
-						}else{
3929
+						} else{
3930 3930
 							$output[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3931 3931
 						}
3932 3932
 						
@@ -3952,10 +3952,10 @@  discard block
 block discarded – undo
3952 3952
 								$dataset[1] .= '='.$dataset[$i];
3953 3953
 							}
3954 3954
 							$tmpArray[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3955
-						}else{
3955
+						} else{
3956 3956
 							if(count($dataset) == 1) {
3957 3957
 								$tmpArray[$this->unEscapeText($dataset[0])] = '';
3958
-							}else{
3958
+							} else{
3959 3959
 								$tmpArray[$this->unEscapeText($dataset[0])] = $this->unEscapeText($dataset[1]);
3960 3960
 							}
3961 3961
 						}					
@@ -3967,7 +3967,7 @@  discard block
 block discarded – undo
3967 3967
 			if($mode == 'plain') {
3968 3968
 				return $fetchData;
3969 3969
 			}
3970
-		}else{
3970
+		} else{
3971 3971
 			return $this->generateOutput(false, $fetchData['errors'], false);
3972 3972
 		}
3973 3973
 	}
Please login to merge, or discard this patch.