Completed
Push — 123 ( d13f38 )
by Vasily
05:11
created
lib/WebSocketServerConnection.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 
44 44
         if (!isset($this->protocol))
45 45
         {
46
-            Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Cannot find session-related websocket protocol for client ' . $this->addr) ;
47
-            return FALSE ;
46
+            Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Cannot find session-related websocket protocol for client ' . $this->addr);
47
+            return FALSE;
48 48
         }
49 49
 
50
-        $this->protocol->sendFrame($data, $type) ;
50
+        $this->protocol->sendFrame($data, $type);
51 51
         if ($cb) {
52 52
         	$this->onWriteOnce($cb);
53 53
         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	public function onHandshake() {
94 94
 		
95 95
 		$e = explode('/', $this->server['DOCUMENT_URI']);
96
-		$routeName = isset($e[1])?$e[1]:'';
96
+		$routeName = isset($e[1]) ? $e[1] : '';
97 97
 
98 98
 		if (!isset($this->pool->routes[$routeName])) {
99 99
 			if (Daemon::$config->logerrors->value) {
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 		}
126 126
 
127 127
         if (!isset($this->protocol)) {
128
-            Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Cannot find session-related websocket protocol for client "' . $this->addr . '"') ;
129
-            return FALSE ;
128
+            Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Cannot find session-related websocket protocol for client "' . $this->addr . '"');
129
+            return FALSE;
130 130
         }
131 131
 
132 132
 		if ($this->protocol->onHandshake() === FALSE) {
133
-			return FALSE ;
133
+			return FALSE;
134 134
 		}		
135 135
 
136 136
 		return TRUE;
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
 	public function handshake($data) {
158 158
 
159 159
 		if (!$this->onHandshake()) {
160
-			Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Cannot handshake session for client "' . $this->addr . '"') ;
160
+			Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Cannot handshake session for client "' . $this->addr . '"');
161 161
 			$this->finish();
162 162
 			return false;
163 163
 		}
164 164
 
165 165
 		if (!isset($this->protocol)) {
166
-			Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Cannot find session-related websocket protocol for client "' . $this->addr . '"') ;
167
-			$this->finish() ;
166
+			Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Cannot find session-related websocket protocol for client "' . $this->addr . '"');
167
+			$this->finish();
168 168
 			return false;
169 169
 		}
170 170
 
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
 		}
177 177
 
178 178
 		if (!$handshake) {
179
-			Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Handshake protocol failure for client "' . $this->addr . '"') ;
180
-			$this->finish() ;
181
-			return false ;
179
+			Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Handshake protocol failure for client "' . $this->addr . '"');
180
+			$this->finish();
181
+			return false;
182 182
 		}
183 183
 		if ($this->write($handshake)) {
184
-			if (is_callable(array($this->upstream, 'onHandshake')))	{
184
+			if (is_callable(array($this->upstream, 'onHandshake'))) {
185 185
 				$this->upstream->onHandshake();
186 186
 			}
187 187
 		}
188 188
 		else {
189
-			Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Handshake send failure for client "' . $this->addr . '"') ;
189
+			Daemon::$process->log(get_class($this) . '::' . __METHOD__ . ' : Handshake send failure for client "' . $this->addr . '"');
190 190
 			$this->finish();
191 191
 			return false;
192 192
 		}
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
 	public function stdin($buf) {
204 204
 		$this->buf .= $buf;
205
-		if ($this->state === self::STATE_ROOT)	{
205
+		if ($this->state === self::STATE_ROOT) {
206 206
 			if (strpos($this->buf, "<policy-file-request/>\x00") !== false) {
207 207
 				$FP = FlashPolicyServer::getInstance();
208 208
 				if ($FP && $FP->policyData) {
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
 					// ----------------------------------------------------------
247 247
 					if (isset($this->server['HTTP_SEC_WEBSOCKET_VERSION'])) { // HYBI
248 248
 						if ($this->server['HTTP_SEC_WEBSOCKET_VERSION'] == '8') { // Version 8 (FF7, Chrome14)
249
-							$this->protocol = new WebSocketProtocolV13($this) ;
249
+							$this->protocol = new WebSocketProtocolV13($this);
250 250
 						}
251 251
 						elseif ($this->server['HTTP_SEC_WEBSOCKET_VERSION'] == '13') { // newest protocol
252 252
 							$this->protocol = new WebSocketProtocolV13($this);
253 253
 						}
254 254
 						else
255 255
 						{
256
-							Daemon::$process->log(get_class($this) . '::' . __METHOD__ . " : Websocket protocol version " . $this->server['HTTP_SEC_WEBSOCKET_VERSION'] . ' is not yet supported for client "' . $this->addr . '"') ;
256
+							Daemon::$process->log(get_class($this) . '::' . __METHOD__ . " : Websocket protocol version " . $this->server['HTTP_SEC_WEBSOCKET_VERSION'] . ' is not yet supported for client "' . $this->addr . '"');
257 257
 
258 258
 							$this->finish();
259 259
 							return;
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 						$this->protocol = new WebSocketProtocolVE($this);
264 264
 					}
265 265
 					else {	// Defaulting to HIXIE (Safari5 and many non-browser clients...)
266
-						$this->protocol = new WebSocketProtocolV0($this) ;
266
+						$this->protocol = new WebSocketProtocolV0($this);
267 267
 					}
268 268
 					// ----------------------------------------------------------
269 269
 					// End of protocol discovery
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 					$this->server['SCRIPT_NAME'] = $this->server['DOCUMENT_URI'] = isset($u['path']) ? $u['path'] : '/';
284 284
 					$this->server['SERVER_PROTOCOL'] = isset($e[2]) ? trim($e[2]) : '';
285 285
 
286
-					list($this->server['REMOTE_ADDR'],$this->server['REMOTE_PORT']) = explode(':', $this->addr);
286
+					list($this->server['REMOTE_ADDR'], $this->server['REMOTE_PORT']) = explode(':', $this->addr);
287 287
 				}
288 288
 				else
289 289
 				{
Please login to merge, or discard this patch.
lib/LockClient.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function job($name, $wait, $onRun, $onSuccess = NULL, $onFailure = NULL) {
37 37
 		$name = $this->prefix . $name;
38
-		$this->getConnectionByName($name, function ($conn) use ($name, $wait, $onRun, $onSuccess, $onFailure) {
38
+		$this->getConnectionByName($name, function($conn) use ($name, $wait, $onRun, $onSuccess, $onFailure) {
39 39
 			if (!$conn->connected) {
40 40
 				return;
41 41
 			}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * @return void
51 51
 	 */
52 52
 	public function done($name) {
53
-		$this->getConnectionByName($name, function ($conn) use ($name) {
53
+		$this->getConnectionByName($name, function($conn) use ($name) {
54 54
 			if (!$conn->connected) {
55 55
 				return;
56 56
 			}
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @return void
65 65
 	 */
66 66
 	public function failed($name) {
67
-		$this->getConnectionByName($name, function ($conn) use ($name) {
67
+		$this->getConnectionByName($name, function($conn) use ($name) {
68 68
 			if (!$conn->connected) {
69 69
 				return;
70 70
 			}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 			&& (($ep = strpos($name, ']')) !== FALSE) 
86 86
 			&& ($ep > $sp)
87 87
 		) {
88
-			$name = substr($name,$sp + 1, $ep - $sp - 1);
88
+			$name = substr($name, $sp + 1, $ep - $sp - 1);
89 89
 		}
90 90
 
91 91
 		srand(crc32($name));
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 					call_user_func($this->pool->jobs[$e[1]][2], $e[0], $e[1], $this->pool);
125 125
 				}
126 126
 			}
127
-			if($this->pool->config->protologging->value) {
127
+			if ($this->pool->config->protologging->value) {
128 128
 				Daemon::log('Lock client <-- Lock server: ' . Debug::exportBytes(implode(' ', $e)) . "\n");
129 129
 			}
130 130
 		}
Please login to merge, or discard this patch.
lib/IPCManager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		foreach ($instancesCount as $name => $num) {
64 64
 			$v = Daemon::$config->{$name}->limitinstances->value - $num;
65 65
 			foreach ($this->pool->workers as $worker) {
66
-					if ($v <= 0) {break;}
67
-					if ((isset($worker->instancesCount[$name])) && ($worker->instancesCount[$name] < $perWorker))	{
66
+					if ($v <= 0) {break; }
67
+					if ((isset($worker->instancesCount[$name])) && ($worker->instancesCount[$name] < $perWorker)) {
68 68
 						continue;
69 69
 					}
70 70
 					if (!isset($worker->instancesCount[$name])) {
@@ -248,11 +248,11 @@  discard block
 block discarded – undo
248 248
 		if ($p['op'] === 'spawnInstance') {
249 249
 			$fullname = $p['appfullname'];
250 250
 			$fullname = str_replace('-', ':', $fullname);
251
-			if (strpos($fullname,':') === false) {
251
+			if (strpos($fullname, ':') === false) {
252 252
 				$fullname .= ':';
253 253
 			}
254 254
 			list($app, $name) = explode(':', $fullname, 2);
255
-			Daemon::$appResolver->appInstantiate($app,$name);
255
+			Daemon::$appResolver->appInstantiate($app, $name);
256 256
 		}
257 257
 		elseif ($p['op'] === 'importFile') {
258 258
 			if (!Daemon::$config->autoreimport->value) {
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
 					runkit_import($path, RUNKIT_IMPORT_FUNCTIONS | RUNKIT_IMPORT_CLASSES | RUNKIT_IMPORT_OVERRIDE);
269 269
 					//Daemon::log('--end runkit_import('.$path.')');
270 270
 				} else {
271
-					$this->appInstance->log('Cannot import \''.$path.'\': runkit_import is not callable.');
271
+					$this->appInstance->log('Cannot import \'' . $path . '\': runkit_import is not callable.');
272 272
 				}
273 273
 				
274 274
 				$event->finish();
275 275
 			}, 5);
276 276
 		}
277 277
 		elseif ($p['op'] === 'call') {
278
-			if (strpos($p['appfullname'],':') === false) {
278
+			if (strpos($p['appfullname'], ':') === false) {
279 279
 				$p['appfullname'] .= ':';
280 280
 			}
281 281
 			list($app, $name) = explode(':', $p['appfullname'], 2);
Please login to merge, or discard this patch.
lib/IRC.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -1,77 +1,77 @@
 block discarded – undo
1 1
 <?php
2 2
 class IRC {
3
-	public static $codes = array (
4
-  		'1' => 'RPL_WELCOME',  2 => 'RPL_YOURHOST',
3
+	public static $codes = array(
4
+  		'1' => 'RPL_WELCOME', 2 => 'RPL_YOURHOST',
5 5
 		3 => 'RPL_CREATED', 4 => 'RPL_MYINFO',
6 6
 		5 => 'RPL_BOUNCE', 200 => 'RPL_TRACELINK',
7
-		201 => 'RPL_TRACECONNECTING',  202 => 'RPL_TRACEHANDSHAKE',
8
-		203 => 'RPL_TRACEUNKNOWN',  204 => 'RPL_TRACEOPERATOR',
9
-		205 => 'RPL_TRACEUSER',  206 => 'RPL_TRACESERVER',
10
-		207 => 'RPL_TRACESERVICE',  208 => 'RPL_TRACENEWTYPE',
11
-		209 => 'RPL_TRACECLASS',  210 => 'RPL_TRACERECONNECT',
12
-		211 => 'RPL_STATSLINKINFO',  212 => 'RPL_STATSCOMMANDS',
13
-		219 => 'RPL_ENDOFSTATS',  221 => 'RPL_UMODEIS',
14
-		234 => 'RPL_SERVLIST',  235 => 'RPL_SERVLISTEND',
15
-		242 => 'RPL_STATSUPTIME',  243 => 'RPL_STATSOLINE',
7
+		201 => 'RPL_TRACECONNECTING', 202 => 'RPL_TRACEHANDSHAKE',
8
+		203 => 'RPL_TRACEUNKNOWN', 204 => 'RPL_TRACEOPERATOR',
9
+		205 => 'RPL_TRACEUSER', 206 => 'RPL_TRACESERVER',
10
+		207 => 'RPL_TRACESERVICE', 208 => 'RPL_TRACENEWTYPE',
11
+		209 => 'RPL_TRACECLASS', 210 => 'RPL_TRACERECONNECT',
12
+		211 => 'RPL_STATSLINKINFO', 212 => 'RPL_STATSCOMMANDS',
13
+		219 => 'RPL_ENDOFSTATS', 221 => 'RPL_UMODEIS',
14
+		234 => 'RPL_SERVLIST', 235 => 'RPL_SERVLISTEND',
15
+		242 => 'RPL_STATSUPTIME', 243 => 'RPL_STATSOLINE',
16 16
 		250 => 'RPL_STATSCONN',
17
-		251 => 'RPL_LUSERCLIENT',  252 => 'RPL_LUSEROP',
18
-		253 => 'RPL_LUSERUNKNOWN',  254 => 'RPL_LUSERCHANNELS',
19
-		255 => 'RPL_LUSERME',  256 => 'RPL_ADMINME',
20
-		257 => 'RPL_ADMINLOC1',  258 => 'RPL_ADMINLOC2',
21
-		259 => 'RPL_ADMINEMAIL',  261 => 'RPL_TRACELOG',
22
-		262 => 'RPL_TRACEEND',  263 => 'RPL_TRYAGAIN',
17
+		251 => 'RPL_LUSERCLIENT', 252 => 'RPL_LUSEROP',
18
+		253 => 'RPL_LUSERUNKNOWN', 254 => 'RPL_LUSERCHANNELS',
19
+		255 => 'RPL_LUSERME', 256 => 'RPL_ADMINME',
20
+		257 => 'RPL_ADMINLOC1', 258 => 'RPL_ADMINLOC2',
21
+		259 => 'RPL_ADMINEMAIL', 261 => 'RPL_TRACELOG',
22
+		262 => 'RPL_TRACEEND', 263 => 'RPL_TRYAGAIN',
23 23
 		265 => 'RRPL_LOCALUSERS', 266 => 'RPL_GLOBALUSERS',
24
-		301 => 'RPL_AWAY',  302 => 'RPL_USERHOST',
25
-		303 => 'RPL_ISON',  305 => 'RPL_UNAWAY',
26
-		306 => 'RPL_NOWAWAY',  311 => 'RPL_WHOISUSER',
27
-		312 => 'RPL_WHOISSERVER',  313 => 'RPL_WHOISOPERATOR',
28
-  		314 => 'RPL_WHOWASUSER',  315 => 'RPL_ENDOFWHO',
29
-  		317 => 'RPL_WHOISIDLE',  318 => 'RPL_ENDOFWHOIS',
30
-  		319 => 'RPL_WHOISCHANNELS',  321 => 'RPL_LISTSTART',
31
-  		322 => 'RPL_LIST',  323 => 'RPL_LISTEND',
32
-  		324 => 'RPL_CHANNELMODEIS',  325 => 'RPL_UNIQOPIS',
24
+		301 => 'RPL_AWAY', 302 => 'RPL_USERHOST',
25
+		303 => 'RPL_ISON', 305 => 'RPL_UNAWAY',
26
+		306 => 'RPL_NOWAWAY', 311 => 'RPL_WHOISUSER',
27
+		312 => 'RPL_WHOISSERVER', 313 => 'RPL_WHOISOPERATOR',
28
+  		314 => 'RPL_WHOWASUSER', 315 => 'RPL_ENDOFWHO',
29
+  		317 => 'RPL_WHOISIDLE', 318 => 'RPL_ENDOFWHOIS',
30
+  		319 => 'RPL_WHOISCHANNELS', 321 => 'RPL_LISTSTART',
31
+  		322 => 'RPL_LIST', 323 => 'RPL_LISTEND',
32
+  		324 => 'RPL_CHANNELMODEIS', 325 => 'RPL_UNIQOPIS',
33 33
       328 => 'RPL_CHANNEL_URL', 329 => 'RPL_CREATIONTIME',
34
-  		331 => 'RPL_NOTOPIC',  332 => 'RPL_TOPIC',  333 => 'RPL_TOPIC_TS',
35
-  		341 => 'RPL_INVITING',  342 => 'RPL_SUMMONING',
36
-  		346 => 'RPL_INVITELIST',  347 => 'RPL_ENDOFINVITELIST',
37
-  		348 => 'RPL_EXCEPTLIST',  349 => 'RPL_ENDOFEXCEPTLIST',
38
-  		351 => 'RPL_VERSION',  352 => 'RPL_WHOREPLY',
39
-  		353 => 'RPL_NAMREPLY',  364 => 'RPL_LINKS',
40
-  		365 => 'RPL_ENDOFLINKS',  366 => 'RPL_ENDOFNAMES',
41
-  		367 => 'RPL_BANLIST',  368 => 'RPL_ENDOFBANLIST',
42
-  		369 => 'RPL_ENDOFWHOWAS',  371 => 'RPL_INFO',
43
-  		372 => 'RPL_MOTD',  374 => 'RPL_ENDOFINFO',
44
-  		375 => 'RPL_MOTDSTART',  376 => 'RPL_ENDOFMOTD',
45
-  		381 => 'RPL_YOUREOPER',  382 => 'RPL_REHASHING',
46
-  		383 => 'RPL_YOURESERVICE',  391 => 'RPL_TIME',
47
-  		392 => 'RPL_USERSSTART',  393 => 'RPL_USERS',
48
-  		394 => 'RPL_ENDOFUSERS',  395 => 'RPL_NOUSERS',
49
-  		401 => 'ERR_NOSUCHNICK',  402 => 'ERR_NOSUCHSERVER',
50
-  		403 => 'ERR_NOSUCHCHANNEL',  404 => 'ERR_CANNOTSENDTOCHAN',
51
-  		405 => 'ERR_TOOMANYCHANNELS',  406 => 'ERR_WASNOSUCHNICK',
52
-  		407 => 'ERR_TOOMANYTARGETS',  408 => 'ERR_NOSUCHSERVICE',
53
-  		409 => 'ERR_NOORIGIN',  411 => 'ERR_NORECIPIENT',
54
-  		412 => 'ERR_NOTEXTTOSEND',  413 => 'ERR_NOTOPLEVEL',
55
-  		414 => 'ERR_WILDTOPLEVEL',  415 => 'ERR_BADMASK',
56
-  		421 => 'ERR_UNKNOWNCOMMAND',  422 => 'ERR_NOMOTD',
57
-  		423 => 'ERR_NOADMININFO',  424 => 'ERR_FILEERROR',
58
-  		431 => 'ERR_NONICKNAMEGIVEN',  432 => 'ERR_ERRONEUSNICKNAME',
59
-  		433 => 'ERR_NICKNAMEINUSE',  436 => 'ERR_NICKCOLLISION',
60
-  		437 => 'ERR_UNAVAILRESOURCE',  441 => 'ERR_USERNOTINCHANNEL',
61
-  		442 => 'ERR_NOTONCHANNEL',  443 => 'ERR_USERONCHANNEL',
62
-  		444 => 'ERR_NOLOGIN',  445 => 'ERR_SUMMONDISABLED',
63
-  		446 => 'ERR_USERSDISABLED',  451 => 'ERR_NOTREGISTERED',
64
-  		461 => 'ERR_NEEDMOREPARAMS',  462 => 'ERR_ALREADYREGISTRED',
65
-		463 => 'ERR_NOPERMFORHOST',  		464 => 'ERR_PASSWDMISMATCH',
66
-  		465 => 'ERR_YOUREBANNEDCREEP',  		466 => 'ERR_YOUWILLBEBANNED',
67
-  		467 => 'ERR_KEYSET',  		471 => 'ERR_CHANNELISFULL',
68
-  		472 => 'ERR_UNKNOWNMODE',  		473 => 'ERR_INVITEONLYCHAN',
69
-  		474 => 'ERR_BANNEDFROMCHAN',  		475 => 'ERR_BADCHANNELKEY',
70
-  		476 => 'ERR_BADCHANMASK',  		477 => 'ERR_NOCHANMODES',
71
-  		478 => 'ERR_BANLISTFULL',  		481 => 'ERR_NOPRIVILEGES',
72
-  		482 => 'ERR_CHANOPRIVSNEEDED',  		483 => 'ERR_CANTKILLSERVER',
73
-  		484 => 'ERR_RESTRICTED',  		485 => 'ERR_UNIQOPPRIVSNEEDED',
74
-  		491 => 'ERR_NOOPERHOST',  		501 => 'ERR_UMODEUNKNOWNFLAG',
34
+  		331 => 'RPL_NOTOPIC', 332 => 'RPL_TOPIC', 333 => 'RPL_TOPIC_TS',
35
+  		341 => 'RPL_INVITING', 342 => 'RPL_SUMMONING',
36
+  		346 => 'RPL_INVITELIST', 347 => 'RPL_ENDOFINVITELIST',
37
+  		348 => 'RPL_EXCEPTLIST', 349 => 'RPL_ENDOFEXCEPTLIST',
38
+  		351 => 'RPL_VERSION', 352 => 'RPL_WHOREPLY',
39
+  		353 => 'RPL_NAMREPLY', 364 => 'RPL_LINKS',
40
+  		365 => 'RPL_ENDOFLINKS', 366 => 'RPL_ENDOFNAMES',
41
+  		367 => 'RPL_BANLIST', 368 => 'RPL_ENDOFBANLIST',
42
+  		369 => 'RPL_ENDOFWHOWAS', 371 => 'RPL_INFO',
43
+  		372 => 'RPL_MOTD', 374 => 'RPL_ENDOFINFO',
44
+  		375 => 'RPL_MOTDSTART', 376 => 'RPL_ENDOFMOTD',
45
+  		381 => 'RPL_YOUREOPER', 382 => 'RPL_REHASHING',
46
+  		383 => 'RPL_YOURESERVICE', 391 => 'RPL_TIME',
47
+  		392 => 'RPL_USERSSTART', 393 => 'RPL_USERS',
48
+  		394 => 'RPL_ENDOFUSERS', 395 => 'RPL_NOUSERS',
49
+  		401 => 'ERR_NOSUCHNICK', 402 => 'ERR_NOSUCHSERVER',
50
+  		403 => 'ERR_NOSUCHCHANNEL', 404 => 'ERR_CANNOTSENDTOCHAN',
51
+  		405 => 'ERR_TOOMANYCHANNELS', 406 => 'ERR_WASNOSUCHNICK',
52
+  		407 => 'ERR_TOOMANYTARGETS', 408 => 'ERR_NOSUCHSERVICE',
53
+  		409 => 'ERR_NOORIGIN', 411 => 'ERR_NORECIPIENT',
54
+  		412 => 'ERR_NOTEXTTOSEND', 413 => 'ERR_NOTOPLEVEL',
55
+  		414 => 'ERR_WILDTOPLEVEL', 415 => 'ERR_BADMASK',
56
+  		421 => 'ERR_UNKNOWNCOMMAND', 422 => 'ERR_NOMOTD',
57
+  		423 => 'ERR_NOADMININFO', 424 => 'ERR_FILEERROR',
58
+  		431 => 'ERR_NONICKNAMEGIVEN', 432 => 'ERR_ERRONEUSNICKNAME',
59
+  		433 => 'ERR_NICKNAMEINUSE', 436 => 'ERR_NICKCOLLISION',
60
+  		437 => 'ERR_UNAVAILRESOURCE', 441 => 'ERR_USERNOTINCHANNEL',
61
+  		442 => 'ERR_NOTONCHANNEL', 443 => 'ERR_USERONCHANNEL',
62
+  		444 => 'ERR_NOLOGIN', 445 => 'ERR_SUMMONDISABLED',
63
+  		446 => 'ERR_USERSDISABLED', 451 => 'ERR_NOTREGISTERED',
64
+  		461 => 'ERR_NEEDMOREPARAMS', 462 => 'ERR_ALREADYREGISTRED',
65
+		463 => 'ERR_NOPERMFORHOST', 464 => 'ERR_PASSWDMISMATCH',
66
+  		465 => 'ERR_YOUREBANNEDCREEP', 466 => 'ERR_YOUWILLBEBANNED',
67
+  		467 => 'ERR_KEYSET', 471 => 'ERR_CHANNELISFULL',
68
+  		472 => 'ERR_UNKNOWNMODE', 473 => 'ERR_INVITEONLYCHAN',
69
+  		474 => 'ERR_BANNEDFROMCHAN', 475 => 'ERR_BADCHANNELKEY',
70
+  		476 => 'ERR_BADCHANMASK', 477 => 'ERR_NOCHANMODES',
71
+  		478 => 'ERR_BANLISTFULL', 481 => 'ERR_NOPRIVILEGES',
72
+  		482 => 'ERR_CHANOPRIVSNEEDED', 483 => 'ERR_CANTKILLSERVER',
73
+  		484 => 'ERR_RESTRICTED', 485 => 'ERR_UNIQOPPRIVSNEEDED',
74
+  		491 => 'ERR_NOOPERHOST', 501 => 'ERR_UMODEUNKNOWNFLAG',
75 75
   		502 => 'ERR_USERSDONTMATCH',
76 76
 	);
77 77
   public static $codesFlip;
Please login to merge, or discard this patch.
lib/IRCClient.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 }
29 29
 
30 30
 class IRCClientConnection extends NetworkClientConnection {
31
-	public $user 			= 'Guest';     // Username
32
-	public $password 		= '';         // Password
33
-	public $EOL				= "\r\n";
31
+	public $user = 'Guest'; // Username
32
+	public $password = ''; // Password
33
+	public $EOL = "\r\n";
34 34
 	public $nick;
35 35
 	public $realname;
36 36
 	public $eventHandlers = array();
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function onReady() {
51 51
 		if ($this->pool->identd) {
52
-			$this->pool->identd->registerPair($this->locPort, $this->port, 'UNIX : '.$this->user);
52
+			$this->pool->identd->registerPair($this->locPort, $this->port, 'UNIX : ' . $this->user);
53 53
 		}
54 54
 		list($this->nick, $this->realname) = explode('/', $this->path . '/John Doe');
55 55
 		$this->command('USER', $this->user, 0, '*', $this->realname);
56 56
 		$this->command('NICK', $this->nick);
57 57
 		if (strlen($this->password)) {
58
-			$this->message('NickServ', 'IDENTIFY '.$this->password);
58
+			$this->message('NickServ', 'IDENTIFY ' . $this->password);
59 59
 		}
60 60
 	}
61 61
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		}
77 77
 		$this->writeln($line);
78 78
 		if ($this->pool->protologging) {
79
-			Daemon::log('->->->-> '.$line);
79
+			Daemon::log('->->->-> ' . $line);
80 80
 		}
81 81
 	}
82 82
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		}
100 100
 		$this->writeln($line);
101 101
 		if ($this->pool->protologging && !in_array($cmd, array('PONG'))) {
102
-			Daemon::log('->->->-> '.$line);
102
+			Daemon::log('->->->-> ' . $line);
103 103
 		}
104 104
 	}
105 105
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
 	public function ping() {
133 133
 		$this->lastPingTS = microtime(true);
134
-		$this->writeln('PING :'.$this->servername);
134
+		$this->writeln('PING :' . $this->servername);
135 135
 	}
136 136
 
137 137
 	public function message($to, $msg) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 			return;
216 216
 		}
217 217
 		elseif ($cmd === 'RPL_ENDOFMOTD') {
218
-			$this->motd .= "\r\n";// . $args[1];
218
+			$this->motd .= "\r\n"; // . $args[1];
219 219
 			$this->event('motd', $this->motd);
220 220
 			return;
221 221
 		}
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 			}
340 340
 		}
341 341
 		elseif ($cmd === 'PING') {
342
-			$this->writeln(isset($args[0]) ? 'PONG :'.$args[0] : 'PONG');
342
+			$this->writeln(isset($args[0]) ? 'PONG :' . $args[0] : 'PONG');
343 343
 		}
344 344
 		elseif ($cmd === 'PONG') {
345 345
 			if ($this->lastPingTS) {
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 			return;
350 350
 		}
351 351
 		if ($this->pool->protologging) {
352
-			Daemon::$process->log('<-<-<-< '.$cmd.': '.json_encode($args). ' ('.json_encode($from['orig']).') (' . json_encode($this->lastLine) . ')');
352
+			Daemon::$process->log('<-<-<-< ' . $cmd . ': ' . json_encode($args) . ' (' . json_encode($from['orig']) . ') (' . json_encode($this->lastLine) . ')');
353 353
 		}
354 354
 	}
355 355
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 		$this->channel->detach($this);
627 627
 	}
628 628
 	public function chanMessage($msg) {
629
-		$this->channel->message($this->nick.': '.$msg);
629
+		$this->channel->message($this->nick . ': ' . $msg);
630 630
 	}
631 631
 }
632 632
 
Please login to merge, or discard this patch.
lib/BoundTCPSocket.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
    					return;
95 95
    				}
96 96
    			}
97
-			$conn->addr = $host.':'.$port;
97
+			$conn->addr = $host . ':' . $port;
98 98
 			$conn->host = $host;
99 99
 			$conn->port = $port;
100 100
 			$conn->parentSocket = $socket;
Please login to merge, or discard this patch.
lib/AppResolver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	
19 19
 		foreach (Daemon::$config as $fullname => $section) {
20 20
 		
21
-			if (!$section instanceof Daemon_ConfigSection)	{
21
+			if (!$section instanceof Daemon_ConfigSection) {
22 22
 				continue;
23 23
 			}
24 24
 			if (isset($section->limitinstances)) {
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 					||
30 30
 					(!isset($section->enable) && !isset($section->disable))
31 31
 			) {
32
-				if (strpos($fullname,':') === false) {
32
+				if (strpos($fullname, ':') === false) {
33 33
 					$fullname .= ':';
34 34
 				}
35 35
 				list($appName, $instance) = explode(':', $fullname, 2);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		else {
122 122
 			$appName = $defaultApp;
123 123
 		}
124
-		if (strpos($appName,'-') === false) {
124
+		if (strpos($appName, '-') === false) {
125 125
 			$appName .= '-';
126 126
 		}
127 127
 		list($app, $instance) = explode('-', $appName, 2);
Please login to merge, or discard this patch.
lib/AsyncStream.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		return $r;
51 51
 	}
52 52
 	
53
-	public function initStream($readFD = NULL,$writeFD = NULL) {
53
+	public function initStream($readFD = NULL, $writeFD = NULL) {
54 54
 		if (is_string($readFD)) {
55 55
 			$u = parse_url($url = $readFD);
56 56
 		
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		}
105 105
 	
106 106
 		if ($readFD !== NULL) {
107
-			$this->setFD($readFD,$writeFD);
107
+			$this->setFD($readFD, $writeFD);
108 108
 		}
109 109
 
110 110
 		return $readFD !== FALSE;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		}
171 171
 
172 172
 		if (!is_resource($this->writeFD)) {
173
-			throw new BadStreamDescriptorException('wrong writeFD',1);
173
+			throw new BadStreamDescriptorException('wrong writeFD', 1);
174 174
 		}
175 175
 
176 176
 		if ($this->writeBuf === NULL) {
Please login to merge, or discard this patch.
lib/Binary.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 			}
25 25
 
26 26
      		$p = substr($data, 1, $l);
27
-     		$domain .= $p.(($l !== 0)?'.':'');
27
+     		$domain .= $p . (($l !== 0) ? '.' : '');
28 28
      		$data = substr($data, $l + 1);
29 29
        		if ($l === 0) {
30 30
      			break;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		return $l . $string;
41 41
 	}
42 42
 	public static function LVnull($string) {
43
-		return self::LV($string."\x00",2,TRUE);
43
+		return self::LV($string . "\x00", 2, TRUE);
44 44
 	}
45 45
 	public static function byte($int) {
46 46
 		return chr($int);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	public static function dword($int) {
58
-		return self::i2b(4,$int);
58
+		return self::i2b(4, $int);
59 59
 	}
60 60
 
61 61
 	public static function dwordl($int) {
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 	}
84 84
 	
85 85
 	public static function getWord(&$p, $l = false) {
86
-		$r = self::bytes2int(binarySubstr($p,0,2),!!$l);
87
-		$p = binarySubstr($p,2);
86
+		$r = self::bytes2int(binarySubstr($p, 0, 2), !!$l);
87
+		$p = binarySubstr($p, 2);
88 88
 		return intval($r);
89 89
 	}
90 90
 
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
 		return $r;
98 98
 	}
99 99
 
100
-	public static function getDWord(&$p,$l = false) {
101
-		$r = self::bytes2int(binarySubstr($p,0,4),!!$l);
102
-		$p = binarySubstr($p,4);
100
+	public static function getDWord(&$p, $l = false) {
101
+		$r = self::bytes2int(binarySubstr($p, 0, 4), !!$l);
102
+		$p = binarySubstr($p, 4);
103 103
 		return intval($r);
104 104
 	}
105 105
 	public static function getQword(&$p, $l = false) {
106
-		$r = self::bytes2int(binarySubstr($p,0,8),!!$l);
107
-		$p = binarySubstr($p,8);
106
+		$r = self::bytes2int(binarySubstr($p, 0, 8), !!$l);
107
+		$p = binarySubstr($p, 8);
108 108
 		return intval($r);
109 109
 	}
110
-	public static function getStrQWord(&$p,$l = false) {
110
+	public static function getStrQWord(&$p, $l = false) {
111 111
 		$r = binarySubstr($p, 0, 8);
112 112
 		if ($l) {
113 113
 			$r = strrev($r);
@@ -116,31 +116,31 @@  discard block
 block discarded – undo
116 116
 		return $r;
117 117
 	}
118 118
 	public static function getString(&$str) {
119
-		$p = strpos($str,"\x00");
119
+		$p = strpos($str, "\x00");
120 120
 		if ($p === FALSE) {
121 121
 			return '';
122 122
 		}
123
- 		$r = substr($str,0,$p);
124
- 		$str = substr($str, $p+1);
123
+ 		$r = substr($str, 0, $p);
124
+ 		$str = substr($str, $p + 1);
125 125
  		return $r;
126 126
 	}
127 127
 	public static function getLV(&$p, $l = 1, $nul = false, $lrev = false) {
128
- 		$s = self::b2i(binarySubstr($p,0,$l),!!$lrev);
128
+ 		$s = self::b2i(binarySubstr($p, 0, $l), !!$lrev);
129 129
  		//Daemon::log('s = '.$s. ' -- '.Debug::exportBytes(binarySubstr($p,0,$l), true));
130
- 		$p = binarySubstr($p,$l);
130
+ 		$p = binarySubstr($p, $l);
131 131
 		if ($s == 0) {
132 132
 			return '';
133 133
 		}
134 134
 		$r = '';
135 135
  		if (strlen($p) < $s) {
136
- 			echo("getLV error: buf length (".strlen($p)."): ".Debug::exportBytes($p).", must be >= string length (".$s.")\n");
136
+ 			echo("getLV error: buf length (" . strlen($p) . "): " . Debug::exportBytes($p) . ", must be >= string length (" . $s . ")\n");
137 137
  		}
138 138
  		elseif ($nul) {
139
-  			if ($p{$s-1} != "\x00") {
140
-  				echo("getLV error: Wrong end of NUL-string (".Debug::exportBytes($p{$s-1})."), len ".$s."\n");
139
+  			if ($p{$s - 1} != "\x00") {
140
+  				echo("getLV error: Wrong end of NUL-string (" . Debug::exportBytes($p{$s - 1}) . "), len " . $s . "\n");
141 141
   			}
142 142
   			else {
143
-  				$d = $s-1;
143
+  				$d = $s - 1;
144 144
   				if ($d < 0) {
145 145
   					$d = 0;
146 146
   				}
@@ -155,30 +155,30 @@  discard block
 block discarded – undo
155 155
  		return $r;
156 156
 	}
157 157
 
158
-	public static function int2bytes($len,$int = 1) {
158
+	public static function int2bytes($len, $int = 1) {
159 159
  		$hexstr = dechex($int);
160 160
  		if ($len === NULL) {
161 161
  			if (strlen($hexstr) % 2) {
162
- 				$hexstr = "0".$hexstr;
162
+ 				$hexstr = "0" . $hexstr;
163 163
  			}
164 164
  		}
165 165
  		else {
166 166
  			$hexstr = str_repeat('0', $len * 2 - strlen($hexstr)) . $hexstr;
167 167
  		}
168
- 		$bytes = strlen($hexstr)/2;
168
+ 		$bytes = strlen($hexstr) / 2;
169 169
  		$bin = '';
170
- 		for($i = 0; $i < $bytes; ++$i) {
171
- 			$bin .= chr(hexdec(binarySubstr($hexstr,$i*2,2)));
170
+ 		for ($i = 0; $i < $bytes; ++$i) {
171
+ 			$bin .= chr(hexdec(binarySubstr($hexstr, $i * 2, 2)));
172 172
  		}
173 173
  		return $bin;
174 174
 	}
175 175
 	
176 176
 	public static function flags2bitarray($flags, $len = 4) {
177 177
 		$ret = 0;
178
-		foreach($flags as $v) {
178
+		foreach ($flags as $v) {
179 179
 			$ret |= $v;
180 180
 		}
181
-		return self::i2b($len,$ret);
181
+		return self::i2b($len, $ret);
182 182
 	}
183 183
 	public static function i2b($bytes, $val = 0) {
184 184
 		return self::int2bytes($bytes, $val);
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
  		}
191 191
  		$dec = 0;
192 192
  		$len = strlen($str);
193
- 		for($i = 0; $i < $len; ++$i) {
194
- 			$dec += ord(binarySubstr($str,$i,1))*pow(256,$len-$i-1);
193
+ 		for ($i = 0; $i < $len; ++$i) {
194
+ 			$dec += ord(binarySubstr($str, $i, 1)) * pow(256, $len - $i - 1);
195 195
  		}
196 196
  		return $dec;
197 197
 	}
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
 
203 203
 	public static function bitmap2bytes($bitmap, $check_len = 0) {
204 204
  		$r = '';
205
- 		$bitmap = str_pad($bitmap,ceil(strlen($bitmap)/8)*8,'0',STR_PAD_LEFT);
206
- 		for ($i = 0, $n = strlen($bitmap)/8; $i < $n; ++$i) {
207
-  			$r .= chr((int) bindec(binarySubstr($bitmap,$i*8,8)));
205
+ 		$bitmap = str_pad($bitmap, ceil(strlen($bitmap) / 8) * 8, '0', STR_PAD_LEFT);
206
+ 		for ($i = 0, $n = strlen($bitmap) / 8; $i < $n; ++$i) {
207
+  			$r .= chr((int) bindec(binarySubstr($bitmap, $i * 8, 8)));
208 208
  		}
209 209
  		if ($check_len && (strlen($r) != $check_len)) {
210 210
  			echo "Warning! Bitmap incorrect.\n";
@@ -212,6 +212,6 @@  discard block
 block discarded – undo
212 212
  		return $r;
213 213
 	}
214 214
 	public static function getbitmap($byte) {
215
- 		return sprintf('%08b',$byte);
215
+ 		return sprintf('%08b', $byte);
216 216
 	}
217 217
 }
Please login to merge, or discard this patch.