Passed
Push — patch_1-1-9 ( d927f0...e2616d )
by Spuds
01:06 queued 27s
created
sources/subs/CacheMethod/Apc.php 1 patch
Braces   +27 added lines, -12 removed lines patch added patch discarded remove patch
@@ -58,16 +58,22 @@  discard block
 block discarded – undo
58 58
 		if ($this->apcu)
59 59
 		{
60 60
 			if ($value === null)
61
-				apcu_delete($prefixedKey);
62
-			else
63
-				apcu_store($prefixedKey, $value, $ttl);
61
+			{
62
+							apcu_delete($prefixedKey);
63
+			}
64
+			else {
65
+							apcu_store($prefixedKey, $value, $ttl);
66
+			}
64 67
 		}
65 68
 		else
66 69
 		{
67 70
 			if ($value === null)
68
-				apc_delete($prefixedKey);
69
-			else
70
-				apc_store($prefixedKey, $value, $ttl);
71
+			{
72
+							apc_delete($prefixedKey);
73
+			}
74
+			else {
75
+							apc_store($prefixedKey, $value, $ttl);
76
+			}
71 77
 		}
72 78
 	}
73 79
 
@@ -79,9 +85,12 @@  discard block
 block discarded – undo
79 85
 		$prefixedKey = $this->getprefixedKey($key);
80 86
 		$success = false;
81 87
 		if ($this->apcu)
82
-			$result = apcu_fetch($prefixedKey, $success);
83
-		else
84
-			$result = apc_fetch($prefixedKey, $success);
88
+		{
89
+					$result = apcu_fetch($prefixedKey, $success);
90
+		}
91
+		else {
92
+					$result = apc_fetch($prefixedKey, $success);
93
+		}
85 94
 		$this->is_miss = !$success;
86 95
 
87 96
 		/*
@@ -90,7 +99,9 @@  discard block
 block discarded – undo
90 99
 		 * the specified cache entry.
91 100
 		 */
92 101
 		if ($this->is_miss)
93
-			return;
102
+		{
103
+					return;
104
+		}
94 105
 
95 106
 		return $result;
96 107
 	}
@@ -101,7 +112,9 @@  discard block
 block discarded – undo
101 112
 	public function clean($type = '')
102 113
 	{
103 114
 		if ($this->apcu)
104
-			apcu_clear_cache();
115
+		{
116
+					apcu_clear_cache();
117
+		}
105 118
 		// If passed a type, clear that type out
106 119
 		elseif ($type === '' || $type === 'data')
107 120
 		{
@@ -109,7 +122,9 @@  discard block
 block discarded – undo
109 122
 			apc_clear_cache('system');
110 123
 		}
111 124
 		elseif ($type === 'user')
112
-			apc_clear_cache('user');
125
+		{
126
+					apc_clear_cache('user');
127
+		}
113 128
 	}
114 129
 
115 130
 	/**
Please login to merge, or discard this patch.
sources/subs/UnZip.class.php 1 patch
Braces   +93 added lines, -35 removed lines patch added patch discarded remove patch
@@ -140,7 +140,9 @@  discard block
 block discarded – undo
140 140
 
141 141
 		// This function sorta needs gzinflate!
142 142
 		if (!function_exists('gzinflate'))
143
-			throw new Elk_Exception('package_no_zlib', 'critical');
143
+		{
144
+					throw new Elk_Exception('package_no_zlib', 'critical');
145
+		}
144 146
 
145 147
 		// Make sure we have this loaded.
146 148
 		loadLanguage('Packages');
@@ -151,7 +153,9 @@  discard block
 block discarded – undo
151 153
 		// The destination needs exist and be writable or we are doomed
152 154
 		umask(0);
153 155
 		if ($this->destination !== null && !file_exists($this->destination) && !$this->single_file)
154
-			mktree($this->destination, 0777);
156
+		{
157
+					mktree($this->destination, 0777);
158
+		}
155 159
 	}
156 160
 
157 161
 	/**
@@ -163,7 +167,9 @@  discard block
 block discarded – undo
163 167
 	{
164 168
 		// Make sure we have a zip file
165 169
 		if ($this->check_valid_zip() === false)
166
-			return false;
170
+		{
171
+					return false;
172
+		}
167 173
 
168 174
 		// The overall zip information for this archive
169 175
 		$this->_read_endof_cdr();
@@ -173,23 +179,32 @@  discard block
 block discarded – undo
173 179
 
174 180
 		// Load the file list from the central directory record
175 181
 		if ($this->_load_file_headers() === false)
176
-			return false;
182
+		{
183
+					return false;
184
+		}
177 185
 
178 186
 		// The file records in the CDR point to the files location in the archive
179 187
 		$this->_process_files();
180 188
 
181 189
 		// Looking for a single file and this is it
182 190
 		if ($this->_found && $this->single_file)
183
-			return $this->_crc_check ? $this->_found : false;
191
+		{
192
+					return $this->_crc_check ? $this->_found : false;
193
+		}
184 194
 
185 195
 		// Wanted many files then we need to clean up
186 196
 		if ($this->destination !== null && !$this->single_file)
187
-			package_flush_cache();
197
+		{
198
+					package_flush_cache();
199
+		}
188 200
 
189 201
 		if ($this->single_file)
190
-			return false;
191
-		else
192
-			return $this->return;
202
+		{
203
+					return false;
204
+		}
205
+		else {
206
+					return $this->return;
207
+		}
193 208
 	}
194 209
 
195 210
 	/**
@@ -201,7 +216,9 @@  discard block
 block discarded – undo
201 216
 	{
202 217
 		// No signature?
203 218
 		if (strlen($this->data) < 10)
204
-			return false;
219
+		{
220
+					return false;
221
+		}
205 222
 
206 223
 		// Look for an end of central directory signature 0x06054b50
207 224
 		$check = explode("\x50\x4b\x05\x06", $this->data);
@@ -280,7 +297,9 @@  discard block
 block discarded – undo
280 297
 			// Extract all file standard length information for this record, its the 42 bytes following the signature
281 298
 			$temp = unpack('vversion/vversion_needed/vgeneral_purpose/vcompress_method/vfile_time/vfile_date/Vcrc/Vcompressed_size/Vsize/vfilename_length/vextra_field_length/vcomment_length/vdisk_number_start/vinternal_attributes/vexternal_attributes1/vexternal_attributes2/Vrelative_offset', substr($this->_data_cdr, $pointer + 4, 42));
282 299
 			if ($temp === false)
283
-				return false;
300
+			{
301
+							return false;
302
+			}
284 303
 
285 304
 			// Extract the variable length data, filename, etc
286 305
 			$pointer = $pointer + 46;
@@ -298,7 +317,9 @@  discard block
 block discarded – undo
298 317
 
299 318
 		// Sections and count from the signature must match or the zip file is bad
300 319
 		if ($i !== $this->_zip_info['files'])
301
-			return false;
320
+		{
321
+					return false;
322
+		}
302 323
 	}
303 324
 
304 325
 	/**
@@ -323,10 +344,13 @@  discard block
 block discarded – undo
323 344
 
324 345
 			// Validate we are at a local file header '\x50\x4b\x03\x04'
325 346
 			if (substr($this->_file_info['data'], 0, 4) === "\x50\x4b\x03\x04")
326
-				$this->_read_local_header();
347
+			{
348
+							$this->_read_local_header();
349
+			}
327 350
 			// Something is probably wrong with the archive, like the 70's
328
-			else
329
-				continue;
351
+			else {
352
+							continue;
353
+			}
330 354
 
331 355
 			// Check if the gp flag requires us to make any adjustments
332 356
 			$this->_check_general_purpose_flag();
@@ -335,12 +359,17 @@  discard block
 block discarded – undo
335 359
 			if (!empty($this->_file_info['compress_method']) || ($this->_file_info['compressed_size'] != $this->_file_info['size']))
336 360
 			{
337 361
 				if ($this->_file_info['compress_method'] == 8)
338
-					$this->_file_info['data'] = @gzinflate($this->_file_info['compress_data'], $this->_file_info['size']);
362
+				{
363
+									$this->_file_info['data'] = @gzinflate($this->_file_info['compress_data'], $this->_file_info['size']);
364
+				}
339 365
 				elseif ($this->_file_info['compress_method'] == 12 && function_exists('bzdecompress'))
340
-					$this->_file_info['data'] = bzdecompress($this->_file_info['compress_data']);
366
+				{
367
+									$this->_file_info['data'] = bzdecompress($this->_file_info['compress_data']);
368
+				}
369
+			}
370
+			else {
371
+							$this->_file_info['data'] = $this->_file_info['compress_data'];
341 372
 			}
342
-			else
343
-				$this->_file_info['data'] = $this->_file_info['compress_data'];
344 373
 
345 374
 			// Okay!  We can write this file, looks good from here...
346 375
 			if ($this->_write_this && $this->destination !== null)
@@ -348,10 +377,14 @@  discard block
 block discarded – undo
348 377
 				$this->_write_this_file();
349 378
 
350 379
 				if ($this->_skip)
351
-					continue;
380
+				{
381
+									continue;
382
+				}
352 383
 
353 384
 				if ($this->_found)
354
-					return;
385
+				{
386
+									return;
387
+				}
355 388
 			}
356 389
 
357 390
 			// Not a directory, add it to our results
@@ -411,10 +444,14 @@  discard block
 block discarded – undo
411 444
 	{
412 445
 		// If this is a file, and it doesn't exist.... happy days!
413 446
 		if (substr($this->_filename, -1) !== '/' && !file_exists($this->destination . '/' . $this->_filename))
414
-			$this->_write_this = true;
447
+		{
448
+					$this->_write_this = true;
449
+		}
415 450
 		// If the file exists, we may not want to overwrite it.
416 451
 		elseif (substr($this->_filename, -1) !== '/')
417
-			$this->_write_this = $this->overwrite;
452
+		{
453
+					$this->_write_this = $this->overwrite;
454
+		}
418 455
 		// This is a directory, so we're gonna want to create it. (probably...)
419 456
 		elseif ($this->destination !== null && !$this->single_file)
420 457
 		{
@@ -422,11 +459,14 @@  discard block
 block discarded – undo
422 459
 			$this->_filename = strtr($this->_filename, array('../' => '', '/..' => ''));
423 460
 
424 461
 			if (!file_exists($this->destination . '/' . $this->_filename))
425
-				mktree($this->destination . '/' . $this->_filename, 0777);
462
+			{
463
+							mktree($this->destination . '/' . $this->_filename, 0777);
464
+			}
426 465
 			$this->_write_this = false;
427 466
 		}
428
-		else
429
-			$this->_write_this = false;
467
+		else {
468
+					$this->_write_this = false;
469
+		}
430 470
 	}
431 471
 
432 472
 	/**
@@ -442,26 +482,40 @@  discard block
 block discarded – undo
442 482
 
443 483
 		// A directory may need to be created
444 484
 		if ((strpos($this->_filename, '/') !== false && !$this->single_file) || (!$this->single_file && !is_dir($this->_file_info['dir'])))
445
-			mktree($this->_file_info['dir'], 0777);
485
+		{
486
+					mktree($this->_file_info['dir'], 0777);
487
+		}
446 488
 
447 489
 		// If we're looking for a **specific file**, and this is it... ka-bam, baby.
448 490
 		if ($this->single_file && ($this->destination === $this->_filename || $this->destination === '*/' . basename($this->_filename)))
449
-			$this->_found = $this->_file_info['data'];
491
+		{
492
+					$this->_found = $this->_file_info['data'];
493
+		}
450 494
 		// Oh?  Another file.  Fine.  You don't like this file, do you?  I know how it is.
451 495
 		// Yeah... just go away.  No, don't apologize.  I know this file's just not *good enough* for you.
452 496
 		elseif ($this->single_file)
453
-			$this->_skip = true;
497
+		{
498
+					$this->_skip = true;
499
+		}
454 500
 		// Don't really want this file?
455 501
 		elseif ($this->files_to_extract !== null && !in_array($this->_filename, $this->files_to_extract))
456
-			$this->_skip = true;
502
+		{
503
+					$this->_skip = true;
504
+		}
457 505
 
458 506
 		// Write it out then
459 507
 		if ($this->_skip === true)
460
-			return;
508
+		{
509
+					return;
510
+		}
461 511
 		elseif (!empty($this->_found))
462
-			$this->_check_crc();
512
+		{
513
+					$this->_check_crc();
514
+		}
463 515
 		elseif ($this->_skip === false && $this->_found === false && $this->_check_crc())
464
-			package_put_contents($this->destination . '/' . $this->_filename, $this->_file_info['data']);
516
+		{
517
+					package_put_contents($this->destination . '/' . $this->_filename, $this->_file_info['data']);
518
+		}
465 519
 	}
466 520
 
467 521
 	/**
@@ -487,7 +541,9 @@  discard block
 block discarded – undo
487 541
 	{
488 542
 		// If bit 1 is set the file is encrypted so empty it instead of writing out gibberish
489 543
 		if ($this->_file_info['general_purpose'] & 0x0001)
490
-			$this->_file_info['data'] = '';
544
+		{
545
+					$this->_file_info['data'] = '';
546
+		}
491 547
 
492 548
 		// See if bit 3 is set
493 549
 		if ($this->_file_info['general_purpose'] & 0x0008)
@@ -497,7 +553,9 @@  discard block
 block discarded – undo
497 553
 
498 554
 			// The spec allows for an optional header in the general purpose record
499 555
 			if (substr($general_purpose, 0, 4) === "\x50\x4b\x07\x08")
500
-				$general_purpose = substr($general_purpose, 4);
556
+			{
557
+							$general_purpose = substr($general_purpose, 4);
558
+			}
501 559
 
502 560
 			// These values should be what's in the CDR record per spec
503 561
 			$general_purpose_data = unpack('Vcrc/Vcompressed_size/Vsize', $general_purpose);
Please login to merge, or discard this patch.
sources/subs/UserNotification.integrate.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@
 block discarded – undo
21 21
 		global $modSettings;
22 22
 
23 23
 		if (empty($modSettings['usernotif_favicon_enable']) && empty($modSettings['usernotif_desktop_enable']))
24
-			return array();
24
+		{
25
+					return array();
26
+		}
25 27
 
26 28
 		// $hook, $function, $file
27 29
 		return array(
Please login to merge, or discard this patch.
sources/subs/Poll.subs.php 1 patch
Braces   +43 added lines, -17 removed lines patch added patch discarded remove patch
@@ -144,7 +144,9 @@  discard block
 block discarded – undo
144 144
 		$boardsAllowed = boardsAllowedTo('poll_view');
145 145
 
146 146
 		if (empty($boardsAllowed))
147
-			return false;
147
+		{
148
+					return false;
149
+		}
148 150
 	}
149 151
 
150 152
 	// Read info from the db
@@ -171,7 +173,9 @@  discard block
 block discarded – undo
171 173
 	$db->free_result($request);
172 174
 
173 175
 	if (empty($poll_info))
174
-		return false;
176
+	{
177
+			return false;
178
+	}
175 179
 
176 180
 	$request = $db->query('', '
177 181
 		SELECT COUNT(DISTINCT id_member) AS total
@@ -219,7 +223,9 @@  discard block
 block discarded – undo
219 223
 
220 224
 	// The topic must exist
221 225
 	if ($db->num_rows($request) == 0)
222
-		return false;
226
+	{
227
+			return false;
228
+	}
223 229
 
224 230
 	// Get the poll information.
225 231
 	$pollinfo = $db->fetch_assoc($request);
@@ -254,10 +260,13 @@  discard block
 block discarded – undo
254 260
 
255 261
 	// The topic must exist
256 262
 	if ($db->num_rows($request) == 0)
257
-		$topicID = false;
263
+	{
264
+			$topicID = false;
265
+	}
258 266
 	// Get the poll information.
259
-	else
260
-		list ($topicID, $boardID) = $db->fetch_row($request);
267
+	else {
268
+			list ($topicID, $boardID) = $db->fetch_row($request);
269
+	}
261 270
 
262 271
 	$db->free_result($request);
263 272
 
@@ -368,7 +377,9 @@  discard block
 block discarded – undo
368 377
 	$id_poll = $db->insert_id('{db_prefix}polls', 'id_poll');
369 378
 
370 379
 	if (!empty($options))
371
-		addPollOptions($id_poll, $options);
380
+	{
381
+			addPollOptions($id_poll, $options);
382
+	}
372 383
 
373 384
 	call_integration_hook('integrate_poll_add_edit', array($id_poll, false));
374 385
 
@@ -424,7 +435,9 @@  discard block
 block discarded – undo
424 435
 
425 436
 	$pollOptions = array();
426 437
 	foreach ($options as $i => $option)
427
-		$pollOptions[] = array($id_poll, $i, $option);
438
+	{
439
+			$pollOptions[] = array($id_poll, $i, $option);
440
+	}
428 441
 
429 442
 	$db->insert('insert',
430 443
 		'{db_prefix}poll_choices',
@@ -463,7 +476,8 @@  discard block
 block discarded – undo
463 476
 	$db = database();
464 477
 
465 478
 	foreach ($options as $option)
466
-		$db->query('', '
479
+	{
480
+			$db->query('', '
467 481
 			UPDATE {db_prefix}poll_choices
468 482
 			SET label = {string:option_name}
469 483
 			WHERE id_poll = {int:id_poll}
@@ -474,7 +488,8 @@  discard block
 block discarded – undo
474 488
 				'option_name' => $option[2],
475 489
 			)
476 490
 		);
477
-}
491
+	}
492
+	}
478 493
 
479 494
 /**
480 495
  * Delete a bunch of options from a poll
@@ -531,7 +546,9 @@  discard block
 block discarded – undo
531 546
 	$pollStarters = array();
532 547
 
533 548
 	if ($db->num_rows($request) != 0)
534
-		$pollStarters = $db->fetch_row($request);
549
+	{
550
+			$pollStarters = $db->fetch_row($request);
551
+	}
535 552
 
536 553
 	$db->free_result($request);
537 554
 
@@ -697,7 +714,9 @@  discard block
 block discarded – undo
697 714
 		)
698 715
 	);
699 716
 	while ($choice = $db->fetch_row($request))
700
-		$pollOptions[] = $choice[0];
717
+	{
718
+			$pollOptions[] = $choice[0];
719
+	}
701 720
 	$db->free_result($request);
702 721
 
703 722
 	return $pollOptions;
@@ -811,7 +830,9 @@  discard block
 block discarded – undo
811 830
 		)
812 831
 	);
813 832
 	if ($db->num_rows($request) == 0)
814
-		throw new Elk_Exception('no_board');
833
+	{
834
+			throw new Elk_Exception('no_board');
835
+	}
815 836
 	$bcinfo = $db->fetch_assoc($request);
816 837
 	$db->free_result($request);
817 838
 
@@ -855,7 +876,9 @@  discard block
 block discarded – undo
855 876
 			{
856 877
 				$guestvoted = explode(',', $guestvoted);
857 878
 				if ($guestvoted[0] == $poll_id)
858
-					break;
879
+				{
880
+									break;
881
+				}
859 882
 			}
860 883
 
861 884
 			// Has the poll been reset since guest voted?
@@ -864,9 +887,12 @@  discard block
 block discarded – undo
864 887
 				// Remove the poll info from the cookie to allow guest to vote again
865 888
 				unset($guestinfo[$i]);
866 889
 				if (!empty($guestinfo))
867
-					$_COOKIE['guest_poll_vote'] = ';' . implode(';', $guestinfo);
868
-				else
869
-					unset($_COOKIE['guest_poll_vote']);
890
+				{
891
+									$_COOKIE['guest_poll_vote'] = ';' . implode(';', $guestinfo);
892
+				}
893
+				else {
894
+									unset($_COOKIE['guest_poll_vote']);
895
+				}
870 896
 			}
871 897
 			else
872 898
 			{
Please login to merge, or discard this patch.
sources/subs/Modlog.subs.php 1 patch
Braces   +90 added lines, -34 removed lines patch added patch discarded remove patch
@@ -75,7 +75,9 @@  discard block
 block discarded – undo
75 75
 
76 76
 	// Do a little bit of self protection.
77 77
 	if (!isset($context['hoursdisable']))
78
-		$context['hoursdisable'] = 24;
78
+	{
79
+			$context['hoursdisable'] = 24;
80
+	}
79 81
 
80 82
 	// Can they see the IP address?
81 83
 	$seeIP = allowedTo('moderate_forum');
@@ -120,28 +122,41 @@  discard block
 block discarded – undo
120 122
 		if (!empty($row['id_board']))
121 123
 		{
122 124
 			if ($row['action'] == 'move')
123
-				$row['extra']['board_to'] = $row['id_board'];
124
-			else
125
-				$row['extra']['board'] = $row['id_board'];
125
+			{
126
+							$row['extra']['board_to'] = $row['id_board'];
127
+			}
128
+			else {
129
+							$row['extra']['board'] = $row['id_board'];
130
+			}
126 131
 		}
127 132
 
128 133
 		if (!empty($row['id_topic']))
129
-			$row['extra']['topic'] = $row['id_topic'];
134
+		{
135
+					$row['extra']['topic'] = $row['id_topic'];
136
+		}
130 137
 		if (!empty($row['id_msg']))
131
-			$row['extra']['message'] = $row['id_msg'];
138
+		{
139
+					$row['extra']['message'] = $row['id_msg'];
140
+		}
132 141
 
133 142
 		// Is this associated with a topic?
134 143
 		if (isset($row['extra']['topic']))
135
-			$topics[(int) $row['extra']['topic']][] = $row['id_action'];
144
+		{
145
+					$topics[(int) $row['extra']['topic']][] = $row['id_action'];
146
+		}
136 147
 		if (isset($row['extra']['new_topic']))
137
-			$topics[(int) $row['extra']['new_topic']][] = $row['id_action'];
148
+		{
149
+					$topics[(int) $row['extra']['new_topic']][] = $row['id_action'];
150
+		}
138 151
 
139 152
 		// How about a member?
140 153
 		if (isset($row['extra']['member']))
141 154
 		{
142 155
 			// Guests don't have names!
143 156
 			if (empty($row['extra']['member']))
144
-				$row['extra']['member'] = $txt['modlog_parameter_guest'];
157
+			{
158
+							$row['extra']['member'] = $txt['modlog_parameter_guest'];
159
+			}
145 160
 			else
146 161
 			{
147 162
 				// Try to find it...
@@ -151,40 +166,60 @@  discard block
 block discarded – undo
151 166
 
152 167
 		// Associated with a board?
153 168
 		if (isset($row['extra']['board_to']))
154
-			$boards[(int) $row['extra']['board_to']][] = $row['id_action'];
169
+		{
170
+					$boards[(int) $row['extra']['board_to']][] = $row['id_action'];
171
+		}
155 172
 		if (isset($row['extra']['board_from']))
156
-			$boards[(int) $row['extra']['board_from']][] = $row['id_action'];
173
+		{
174
+					$boards[(int) $row['extra']['board_from']][] = $row['id_action'];
175
+		}
157 176
 		if (isset($row['extra']['board']))
158
-			$boards[(int) $row['extra']['board']][] = $row['id_action'];
177
+		{
178
+					$boards[(int) $row['extra']['board']][] = $row['id_action'];
179
+		}
159 180
 
160 181
 		// A message?
161 182
 		if (isset($row['extra']['message']))
162
-			$messages[(int) $row['extra']['message']][] = $row['id_action'];
183
+		{
184
+					$messages[(int) $row['extra']['message']][] = $row['id_action'];
185
+		}
163 186
 
164 187
 		// IP Info?
165 188
 		if (isset($row['extra']['ip_range']))
166
-			if ($seeIP)
189
+		{
190
+					if ($seeIP)
167 191
 				$row['extra']['ip_range'] = '<a href="' . $scripturl . '?action=trackip;searchip=' . $row['extra']['ip_range'] . '">' . $row['extra']['ip_range'] . '</a>';
168
-			else
169
-				$row['extra']['ip_range'] = $txt['logged'];
192
+		}
193
+			else {
194
+							$row['extra']['ip_range'] = $txt['logged'];
195
+			}
170 196
 
171 197
 		// Email?
172 198
 		if (isset($row['extra']['email']))
173
-			$row['extra']['email'] = '<a href="mailto:' . $row['extra']['email'] . '">' . $row['extra']['email'] . '</a>';
199
+		{
200
+					$row['extra']['email'] = '<a href="mailto:' . $row['extra']['email'] . '">' . $row['extra']['email'] . '</a>';
201
+		}
174 202
 
175 203
 		// Bans are complex.
176 204
 		if ($row['action'] == 'ban')
177 205
 		{
178 206
 			if (!isset($row['extra']['new']) || $row['extra']['new'] == 1)
179
-				$row['action_text'] = $txt['modlog_ac_ban'];
207
+			{
208
+							$row['action_text'] = $txt['modlog_ac_ban'];
209
+			}
180 210
 			elseif ($row['extra']['new'] == 0)
181
-				$row['action_text'] = $txt['modlog_ac_ban_update'];
182
-			else
183
-				$row['action_text'] = $txt['modlog_ac_ban_remove'];
211
+			{
212
+							$row['action_text'] = $txt['modlog_ac_ban_update'];
213
+			}
214
+			else {
215
+							$row['action_text'] = $txt['modlog_ac_ban_remove'];
216
+			}
184 217
 
185 218
 			foreach (array('member', 'email', 'ip_range', 'hostname') as $type)
186
-				if (isset($row['extra'][$type]))
219
+			{
220
+							if (isset($row['extra'][$type]))
187 221
 					$row['action_text'] .= $txt['modlog_ac_ban_trigger_' . $type];
222
+			}
188 223
 		}
189 224
 
190 225
 		// The array to go to the template. Note here that action is set to a "default" value of the action doesn't match anything in the descriptions. Allows easy adding of logging events with basic details.
@@ -215,11 +250,17 @@  discard block
 block discarded – undo
215 250
 			{
216 251
 				// Make the board number into a link - dealing with moving too.
217 252
 				if (isset($entries[$action]['extra']['board_to']) && $entries[$action]['extra']['board_to'] == $row['id_board'])
218
-					$entries[$action]['extra']['board_to'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>';
253
+				{
254
+									$entries[$action]['extra']['board_to'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>';
255
+				}
219 256
 				elseif (isset($entries[$action]['extra']['board_from']) && $entries[$action]['extra']['board_from'] == $row['id_board'])
220
-					$entries[$action]['extra']['board_from'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>';
257
+				{
258
+									$entries[$action]['extra']['board_from'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>';
259
+				}
221 260
 				elseif (isset($entries[$action]['extra']['board']) && $entries[$action]['extra']['board'] == $row['id_board'])
222
-					$entries[$action]['extra']['board'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>';
261
+				{
262
+									$entries[$action]['extra']['board'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>';
263
+				}
223 264
 			}
224 265
 		}
225 266
 	}
@@ -252,9 +293,13 @@  discard block
 block discarded – undo
252 293
 
253 294
 				// Make the topic number into a link - dealing with splitting too.
254 295
 				if (isset($this_action['extra']['topic']) && $this_action['extra']['topic'] == $row['id_topic'])
255
-					$this_action['extra']['topic'] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.' . (isset($this_action['extra']['message']) ? 'msg' . $this_action['extra']['message'] . '#msg' . $this_action['extra']['message'] : '0') . '">' . $row['subject'] . '</a>';
296
+				{
297
+									$this_action['extra']['topic'] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.' . (isset($this_action['extra']['message']) ? 'msg' . $this_action['extra']['message'] . '#msg' . $this_action['extra']['message'] : '0') . '">' . $row['subject'] . '</a>';
298
+				}
256 299
 				elseif (isset($this_action['extra']['new_topic']) && $this_action['extra']['new_topic'] == $row['id_topic'])
257
-					$this_action['extra']['new_topic'] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.' . (isset($this_action['extra']['message']) ? 'msg' . $this_action['extra']['message'] . '#msg' . $this_action['extra']['message'] : '0') . '">' . $row['subject'] . '</a>';
300
+				{
301
+									$this_action['extra']['new_topic'] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.' . (isset($this_action['extra']['message']) ? 'msg' . $this_action['extra']['message'] . '#msg' . $this_action['extra']['message'] : '0') . '">' . $row['subject'] . '</a>';
302
+				}
258 303
 			}
259 304
 		}
260 305
 		$db->free_result($request);
@@ -287,7 +332,9 @@  discard block
 block discarded – undo
287 332
 
288 333
 				// Make the message number into a link.
289 334
 				if (isset($this_action['extra']['message']) && $this_action['extra']['message'] == $row['id_msg'])
290
-					$this_action['extra']['message'] = '<a href="' . $scripturl . '?msg=' . $row['id_msg'] . '">' . $row['subject'] . '</a>';
335
+				{
336
+									$this_action['extra']['message'] = '<a href="' . $scripturl . '?msg=' . $row['id_msg'] . '">' . $row['subject'] . '</a>';
337
+				}
291 338
 			}
292 339
 		}
293 340
 		$db->free_result($request);
@@ -324,15 +371,21 @@  discard block
 block discarded – undo
324 371
 	{
325 372
 		// Make any message info links so its easier to go find that message.
326 373
 		if (isset($entry['extra']['message']) && (empty($entry['message']) || empty($entry['message']['id'])))
327
-			$entries[$k]['extra']['message'] = '<a href="' . $scripturl . '?msg=' . $entry['extra']['message'] . '">' . $entry['extra']['message'] . '</a>';
374
+		{
375
+					$entries[$k]['extra']['message'] = '<a href="' . $scripturl . '?msg=' . $entry['extra']['message'] . '">' . $entry['extra']['message'] . '</a>';
376
+		}
328 377
 
329 378
 		// Mark up any deleted members, topics and boards.
330 379
 		foreach (array('board', 'board_from', 'board_to', 'member', 'topic', 'new_topic') as $type)
331
-			if (!empty($entry['extra'][$type]) && is_numeric($entry['extra'][$type]))
380
+		{
381
+					if (!empty($entry['extra'][$type]) && is_numeric($entry['extra'][$type]))
332 382
 				$entries[$k]['extra'][$type] = sprintf($txt['modlog_id'], $entry['extra'][$type]);
383
+		}
333 384
 
334 385
 		if (empty($entries[$k]['action_text']))
335
-			$entries[$k]['action_text'] = isset($txt['modlog_ac_' . $entry['action']]) ? $txt['modlog_ac_' . $entry['action']] : $entry['action'];
386
+		{
387
+					$entries[$k]['action_text'] = isset($txt['modlog_ac_' . $entry['action']]) ? $txt['modlog_ac_' . $entry['action']] : $entry['action'];
388
+		}
336 389
 
337 390
 		$callback->key = $k;
338 391
 		$entries[$k]['action_text'] = preg_replace_callback('~\{([A-Za-z\d_]+)\}~i', array($callback, 'callback'), $entries[$k]['action_text']);
@@ -361,9 +414,12 @@  discard block
 block discarded – undo
361 414
 	public function callback($matches)
362 415
 	{
363 416
 		if (isset($this->entries[$this->key]['extra'][$matches[1]]))
364
-			return $this->entries[$this->key]['extra'][$matches[1]];
365
-		else
366
-			return '';
417
+		{
418
+					return $this->entries[$this->key]['extra'][$matches[1]];
419
+		}
420
+		else {
421
+					return '';
422
+		}
367 423
 	}
368 424
 }
369 425
 
Please login to merge, or discard this patch.
sources/subs/Errors/Log.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,29 +32,35 @@  discard block
 block discarded – undo
32 32
 	{
33 33
 		// Delete all or just some?
34 34
 		if ($type == 'delall' && empty($filter))
35
-			$this->_db->query('truncate_table', '
35
+		{
36
+					$this->_db->query('truncate_table', '
36 37
 				TRUNCATE {db_prefix}log_errors',
37 38
 				array(
38 39
 				)
39 40
 			);
41
+		}
40 42
 		// Deleting all with a filter?
41 43
 		elseif ($type == 'delall' && !empty($filter))
42
-			$this->_db->query('', '
44
+		{
45
+					$this->_db->query('', '
43 46
 				DELETE FROM {db_prefix}log_errors
44 47
 				WHERE ' . $filter['variable'] . ' LIKE {string:filter}',
45 48
 				array(
46 49
 					'filter' => !empty($filter) ? $filter['value']['sql'] : '',
47 50
 				)
48 51
 			);
52
+		}
49 53
 		// Just specific errors?
50 54
 		elseif ($type == 'delete')
51
-			$this->_db->query('', '
55
+		{
56
+					$this->_db->query('', '
52 57
 				DELETE FROM {db_prefix}log_errors
53 58
 				WHERE id_error IN ({array_int:error_list})',
54 59
 				array(
55 60
 					'error_list' => is_array($error_list) ? array_unique($error_list) : '',
56 61
 				)
57 62
 			);
63
+		}
58 64
 	}
59 65
 
60 66
 	/**
@@ -110,7 +116,9 @@  discard block
 block discarded – undo
110 116
 		{
111 117
 			$search_message = preg_replace('~&lt;span class=&quot;remove&quot;&gt;(.+?)&lt;/span&gt;~', '%', $this->_db->escape_wildcard_string($row['message']));
112 118
 			if (!empty($filter) && $search_message == $filter['value']['sql'])
113
-				$search_message = $this->_db->escape_wildcard_string($row['message']);
119
+			{
120
+							$search_message = $this->_db->escape_wildcard_string($row['message']);
121
+			}
114 122
 			$show_message = strtr(strtr(preg_replace('~&lt;span class=&quot;remove&quot;&gt;(.+?)&lt;/span&gt;~', '$1', $row['message']), array("\r" => '', '<br />' => "\n", '<' => '&lt;', '>' => '&gt;', '"' => '&quot;')), array("\n" => '<br />'));
115 123
 
116 124
 			$log['errors'][$row['id_error']] = array(
Please login to merge, or discard this patch.
sources/subs/Errors/ErrorContext.php 1 patch
Braces   +63 added lines, -25 removed lines patch added patch discarded remove patch
@@ -73,16 +73,21 @@  discard block
 block discarded – undo
73 73
 	private function __construct($id = 'default', $default_severity = null)
74 74
 	{
75 75
 		if (!empty($id))
76
-			$this->_name = $id;
76
+		{
77
+					$this->_name = $id;
78
+		}
77 79
 
78 80
 		// Initialize severity levels... waiting for details!
79 81
 		$this->_severity_levels = array(self::MINOR, self::SERIOUS);
80 82
 
81 83
 		// Initialize default severity (not sure this is needed)
82 84
 		if ($default_severity === null || !in_array($default_severity, $this->_severity_levels))
83
-			$this->_default_severity = self::MINOR;
84
-		else
85
-			$this->_default_severity = $default_severity;
85
+		{
86
+					$this->_default_severity = self::MINOR;
87
+		}
88
+		else {
89
+					$this->_default_severity = $default_severity;
90
+		}
86 91
 
87 92
 		$this->_errors = array();
88 93
 	}
@@ -105,7 +110,9 @@  discard block
 block discarded – undo
105 110
 		}
106 111
 
107 112
 		if (!empty($lang_file) && !isset($this->_language_files[$lang_file]))
108
-			$this->_language_files[$lang_file] = false;
113
+		{
114
+					$this->_language_files[$lang_file] = false;
115
+		}
109 116
 	}
110 117
 
111 118
 	/**
@@ -122,9 +129,13 @@  discard block
 block discarded – undo
122 129
 			foreach ($this->_errors as $severity => $errors)
123 130
 			{
124 131
 				if (array_key_exists($name, $errors))
125
-					unset($this->_errors[$severity][$name]);
132
+				{
133
+									unset($this->_errors[$severity][$name]);
134
+				}
126 135
 				if (empty($this->_errors[$severity]))
127
-					unset($this->_errors[$severity]);
136
+				{
137
+									unset($this->_errors[$severity]);
138
+				}
128 139
 			}
129 140
 		}
130 141
 	}
@@ -194,11 +205,16 @@  discard block
 block discarded – undo
194 205
 	public function getErrors($severity = null)
195 206
 	{
196 207
 		if ($severity !== null && in_array($severity, $this->_severity_levels) && !empty($this->_errors[$severity]))
197
-			return $this->_errors[$severity];
208
+		{
209
+					return $this->_errors[$severity];
210
+		}
198 211
 		elseif ($severity === null && !empty($this->_errors))
199
-			return $this->_errors;
200
-		else
201
-			return false;
212
+		{
213
+					return $this->_errors;
214
+		}
215
+		else {
216
+					return false;
217
+		}
202 218
 	}
203 219
 
204 220
 	/**
@@ -211,9 +227,12 @@  discard block
 block discarded – undo
211 227
 	{
212 228
 		$name = $this->getErrorName($error);
213 229
 		if (isset($this->_errors[$name]))
214
-			return $this->_errors[$name];
215
-		else
216
-			return null;
230
+		{
231
+					return $this->_errors[$name];
232
+		}
233
+		else {
234
+					return null;
235
+		}
217 236
 	}
218 237
 
219 238
 	/**
@@ -225,11 +244,16 @@  discard block
 block discarded – undo
225 244
 	public function hasErrors($severity = null)
226 245
 	{
227 246
 		if ($severity !== null && in_array($severity, $this->_severity_levels))
228
-			return !empty($this->_errors[$severity]);
247
+		{
248
+					return !empty($this->_errors[$severity]);
249
+		}
229 250
 		elseif ($severity === null)
230
-			return !empty($this->_errors);
231
-		else
232
-			return false;
251
+		{
252
+					return !empty($this->_errors);
253
+		}
254
+		else {
255
+					return false;
256
+		}
233 257
 	}
234 258
 
235 259
 	/**
@@ -269,7 +293,9 @@  discard block
 block discarded – undo
269 293
 		foreach ($levels as $level)
270 294
 		{
271 295
 			if (!empty($this->_errors[$level]))
272
-				return $level;
296
+			{
297
+							return $level;
298
+			}
273 299
 		}
274 300
 
275 301
 		return $level;
@@ -287,7 +313,9 @@  discard block
 block discarded – undo
287 313
 		global $txt;
288 314
 
289 315
 		if (empty($this->_errors))
290
-			return array();
316
+		{
317
+					return array();
318
+		}
291 319
 
292 320
 		$this->_loadLang();
293 321
 
@@ -298,10 +326,14 @@  discard block
 block discarded – undo
298 326
 		if ($severity === null)
299 327
 		{
300 328
 			foreach ($this->_errors as $err)
301
-				$errors = array_merge($errors, $err);
329
+			{
330
+							$errors = array_merge($errors, $err);
331
+			}
302 332
 		}
303 333
 		elseif (in_array($severity, $this->_severity_levels) && !empty($this->_errors[$severity]))
304
-			$errors = $this->_errors[$severity];
334
+		{
335
+					$errors = $this->_errors[$severity];
336
+		}
305 337
 
306 338
 		foreach ($errors as $error_val)
307 339
 		{
@@ -338,10 +370,12 @@  discard block
 block discarded – undo
338 370
 
339 371
 		// Any custom one?
340 372
 		if (!empty($this->_language_files))
341
-			foreach ($this->_language_files as $language => $loaded)
373
+		{
374
+					foreach ($this->_language_files as $language => $loaded)
342 375
 				if (!$loaded)
343 376
 				{
344 377
 					loadLanguage($language);
378
+		}
345 379
 
346 380
 					// Remember this file has been loaded already
347 381
 					$this->_language_files[$language] = true;
@@ -359,10 +393,14 @@  discard block
 block discarded – undo
359 393
 	public static function context($id = 'default', $default_severity = null)
360 394
 	{
361 395
 		if (self::$_contexts === null)
362
-			self::$_contexts = array();
396
+		{
397
+					self::$_contexts = array();
398
+		}
363 399
 
364 400
 		if (!array_key_exists($id, self::$_contexts))
365
-			self::$_contexts[$id] = new self($id, $default_severity);
401
+		{
402
+					self::$_contexts[$id] = new self($id, $default_severity);
403
+		}
366 404
 
367 405
 		return self::$_contexts[$id];
368 406
 	}
Please login to merge, or discard this patch.
sources/subs/Errors/ErrorHandler.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -153,18 +153,24 @@  discard block
 block discarded – undo
153 153
 
154 154
 		// Elk_Exception handles its own logging.
155 155
 		if (!$e instanceof Elk_Exception)
156
-			$this->log_error($this->error_name . ': ' . $this->error_string, $error_type, $err_file, $err_line);
156
+		{
157
+					$this->log_error($this->error_name . ': ' . $this->error_string, $error_type, $err_file, $err_line);
158
+		}
157 159
 
158 160
 		// Let's give integrations a chance to output a bit differently
159 161
 		call_integration_hook('integrate_output_error', array($message, $error_type, $this->error_level, $err_file, $err_line));
160 162
 
161 163
 		// Dying on these errors only causes MORE problems (blank pages!)
162 164
 		if ($err_file === 'Unknown')
163
-			return;
165
+		{
166
+					return;
167
+		}
164 168
 
165 169
 		// If this is an E_ERROR, E_USER_ERROR, E_WARNING, or E_USER_WARNING.... die.  Violently so.
166 170
 		if ($this->error_level & $this->fatalErrors || $this->error_level % 255 === E_WARNING || $isException)
167
-			$this->_setup_fatal_ErrorContext($message, $this->error_level);
171
+		{
172
+					$this->_setup_fatal_ErrorContext($message, $this->error_level);
173
+		}
168 174
 		else
169 175
 		{
170 176
 			// Display debug information?
@@ -175,7 +181,9 @@  discard block
 block discarded – undo
175 181
 
176 182
 		// We should NEVER get to this point.  Any fatal error MUST quit, or very bad things can happen.
177 183
 		if ($this->error_level & $this->fatalErrors)
178
-			$this->terminate('Hacking attempt...');
184
+		{
185
+					$this->terminate('Hacking attempt...');
186
+		}
179 187
 	}
180 188
 
181 189
 	/**
@@ -195,7 +203,9 @@  discard block
 block discarded – undo
195 203
 			{
196 204
 				$temporary = ob_get_contents();
197 205
 				if (substr($temporary, -2) === '="')
198
-					echo '"';
206
+				{
207
+									echo '"';
208
+				}
199 209
 			}
200 210
 
201 211
 			// Debugging!  This should look like a PHP error message.
@@ -234,8 +244,9 @@  discard block
 block discarded – undo
234 244
 				$exception->getLine()
235 245
 			);
236 246
 		}
237
-		else
238
-			return $this->error_string;
247
+		else {
248
+					return $this->error_string;
249
+		}
239 250
 	}
240 251
 
241 252
 	/**
Please login to merge, or discard this patch.
sources/subs/Errors/AttachmentErrorContext.php 1 patch
Braces   +36 added lines, -13 removed lines patch added patch discarded remove patch
@@ -61,10 +61,12 @@  discard block
 block discarded – undo
61 61
 		}
62 62
 
63 63
 		if (!isset($this->_attachs[$id]))
64
-			$this->_attachs[$id] = array(
64
+		{
65
+					$this->_attachs[$id] = array(
65 66
 				'name' => $name,
66 67
 				'error' => ErrorContext::context($id, 1),
67 68
 			);
69
+		}
68 70
 
69 71
 		$this->activate($id);
70 72
 
@@ -79,9 +81,12 @@  discard block
 block discarded – undo
79 81
 	public function activate($id = null)
80 82
 	{
81 83
 		if (empty($id) || !isset($this->_attachs[$id]))
82
-			$this->_active_attach = 'generic';
83
-		else
84
-			$this->_active_attach = $id;
84
+		{
85
+					$this->_active_attach = 'generic';
86
+		}
87
+		else {
88
+					$this->_active_attach = $id;
89
+		}
85 90
 
86 91
 		return $this;
87 92
 	}
@@ -95,12 +100,16 @@  discard block
 block discarded – undo
95 100
 	public function addError($error, $lang_file = null)
96 101
 	{
97 102
 		if (empty($error))
98
-			return;
103
+		{
104
+					return;
105
+		}
99 106
 
100 107
 		if ($this->_active_attach == 'generic')
101 108
 		{
102 109
 			if (!isset($this->_attachs[$this->_active_attach]))
103
-				$this->_generic_error = ErrorContext::context('attach_generic_error', 1);
110
+			{
111
+							$this->_generic_error = ErrorContext::context('attach_generic_error', 1);
112
+			}
104 113
 
105 114
 			$this->_generic_error->addError($error, $lang_file);
106 115
 			return;
@@ -117,7 +126,9 @@  discard block
 block discarded – undo
117 126
 	public function removeError($error)
118 127
 	{
119 128
 		if (empty($error))
120
-			return;
129
+		{
130
+					return;
131
+		}
121 132
 
122 133
 		$this->_attachs[$this->_active_attach]['error']->removeError($error);
123 134
 	}
@@ -131,21 +142,27 @@  discard block
 block discarded – undo
131 142
 	public function hasErrors($attachID = null, $severity = null)
132 143
 	{
133 144
 		if ($this->_generic_error !== null)
134
-			if ($this->_generic_error->hasErrors($severity))
145
+		{
146
+					if ($this->_generic_error->hasErrors($severity))
135 147
 				return true;
148
+		}
136 149
 
137 150
 		if (!empty($this->_attachs))
138 151
 		{
139 152
 			if ($attachID !== null)
140 153
 			{
141 154
 				if (isset($this->_attachs[$attachID]))
142
-					return $this->_attachs[$attachID]['error']->hasErrors($severity);
155
+				{
156
+									return $this->_attachs[$attachID]['error']->hasErrors($severity);
157
+				}
143 158
 			}
144 159
 			else
145 160
 			{
146 161
 				foreach ($this->_attachs as $attach)
147
-					if ($attach['error']->hasErrors($severity))
162
+				{
163
+									if ($attach['error']->hasErrors($severity))
148 164
 						return true;
165
+				}
149 166
 			}
150 167
 		}
151 168
 		return false;
@@ -178,7 +195,9 @@  discard block
 block discarded – undo
178 195
 				foreach ($this->_attachs as $attach)
179 196
 				{
180 197
 					if ($attach['error']->hasError($error_code))
181
-						return true;
198
+					{
199
+											return true;
200
+					}
182 201
 				}
183 202
 			}
184 203
 		}
@@ -200,11 +219,13 @@  discard block
 block discarded – undo
200 219
 		$returns = array();
201 220
 
202 221
 		if ($this->_generic_error !== null)
203
-			$returns['attach_generic'] = array(
222
+		{
223
+					$returns['attach_generic'] = array(
204 224
 				'errors' => $this->_generic_error->prepareErrors($severity),
205 225
 				'type' => $this->getErrorType(),
206 226
 				'title' => $txt['attach_error_title'],
207 227
 			);
228
+		}
208 229
 
209 230
 		if (!empty($this->_attachs))
210 231
 		{
@@ -241,7 +262,9 @@  discard block
 block discarded – undo
241 262
 	public static function context()
242 263
 	{
243 264
 		if (self::$_context === null)
244
-			self::$_context = new self();
265
+		{
266
+					self::$_context = new self();
267
+		}
245 268
 
246 269
 		return self::$_context;
247 270
 	}
Please login to merge, or discard this patch.