Completed
Push — release-2.1 ( 6f6d35...abeae7 )
by Mathias
08:46
created
Sources/Profile-View.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2605,7 +2605,7 @@
 block discarded – undo
2605 2605
  * @param int $start Which item to start with (for pagination purposes)
2606 2606
  * @param int $items_per_page How many items to show on each page
2607 2607
  * @param string $sort A string indicating how to sort the results
2608
- * @param int $memID The ID of the member
2608
+ * @param string $memID The ID of the member
2609 2609
  * @return array An array of information about the user's group requests
2610 2610
  */
2611 2611
 function list_getGroupRequests($start, $items_per_page, $sort, $memID)
Please login to merge, or discard this patch.
Braces   +297 added lines, -216 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@  discard block
 block discarded – undo
11 11
  * @version 2.1 Beta 4
12 12
  */
13 13
 
14
-if (!defined('SMF'))
14
+if (!defined('SMF')) {
15 15
 	die('No direct access...');
16
+}
16 17
 
17 18
 /**
18 19
  * View a summary.
@@ -23,8 +24,9 @@  discard block
 block discarded – undo
23 24
 	global $context, $memberContext, $txt, $modSettings, $user_profile, $sourcedir, $scripturl, $smcFunc;
24 25
 
25 26
 	// Attempt to load the member's profile data.
26
-	if (!loadMemberContext($memID) || !isset($memberContext[$memID]))
27
-		fatal_lang_error('not_a_user', false, 404);
27
+	if (!loadMemberContext($memID) || !isset($memberContext[$memID])) {
28
+			fatal_lang_error('not_a_user', false, 404);
29
+	}
28 30
 
29 31
 	// Set up the stuff and load the user.
30 32
 	$context += array(
@@ -49,19 +51,21 @@  discard block
 block discarded – undo
49 51
 
50 52
 	// See if they have broken any warning levels...
51 53
 	list ($modSettings['warning_enable'], $modSettings['user_limit']) = explode(',', $modSettings['warning_settings']);
52
-	if (!empty($modSettings['warning_mute']) && $modSettings['warning_mute'] <= $context['member']['warning'])
53
-		$context['warning_status'] = $txt['profile_warning_is_muted'];
54
-	elseif (!empty($modSettings['warning_moderate']) && $modSettings['warning_moderate'] <= $context['member']['warning'])
55
-		$context['warning_status'] = $txt['profile_warning_is_moderation'];
56
-	elseif (!empty($modSettings['warning_watch']) && $modSettings['warning_watch'] <= $context['member']['warning'])
57
-		$context['warning_status'] = $txt['profile_warning_is_watch'];
54
+	if (!empty($modSettings['warning_mute']) && $modSettings['warning_mute'] <= $context['member']['warning']) {
55
+			$context['warning_status'] = $txt['profile_warning_is_muted'];
56
+	} elseif (!empty($modSettings['warning_moderate']) && $modSettings['warning_moderate'] <= $context['member']['warning']) {
57
+			$context['warning_status'] = $txt['profile_warning_is_moderation'];
58
+	} elseif (!empty($modSettings['warning_watch']) && $modSettings['warning_watch'] <= $context['member']['warning']) {
59
+			$context['warning_status'] = $txt['profile_warning_is_watch'];
60
+	}
58 61
 
59 62
 	// They haven't even been registered for a full day!?
60 63
 	$days_registered = (int) ((time() - $user_profile[$memID]['date_registered']) / (3600 * 24));
61
-	if (empty($user_profile[$memID]['date_registered']) || $days_registered < 1)
62
-		$context['member']['posts_per_day'] = $txt['not_applicable'];
63
-	else
64
-		$context['member']['posts_per_day'] = comma_format($context['member']['real_posts'] / $days_registered, 3);
64
+	if (empty($user_profile[$memID]['date_registered']) || $days_registered < 1) {
65
+			$context['member']['posts_per_day'] = $txt['not_applicable'];
66
+	} else {
67
+			$context['member']['posts_per_day'] = comma_format($context['member']['real_posts'] / $days_registered, 3);
68
+	}
65 69
 
66 70
 	// Set the age...
67 71
 	if (empty($context['member']['birth_date']) || substr($context['member']['birth_date'], 0, 4) < 1002)
@@ -70,8 +74,7 @@  discard block
 block discarded – undo
70 74
 			'age' => $txt['not_applicable'],
71 75
 			'today_is_birthday' => false
72 76
 		);
73
-	}
74
-	else
77
+	} else
75 78
 	{
76 79
 		list ($birth_year, $birth_month, $birth_day) = sscanf($context['member']['birth_date'], '%d-%d-%d');
77 80
 		$datearray = getdate(forum_time());
@@ -84,15 +87,16 @@  discard block
 block discarded – undo
84 87
 	if (allowedTo('moderate_forum'))
85 88
 	{
86 89
 		// Make sure it's a valid ip address; otherwise, don't bother...
87
-		if (preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $memberContext[$memID]['ip']) == 1 && empty($modSettings['disableHostnameLookup']))
88
-			$context['member']['hostname'] = host_from_ip($memberContext[$memID]['ip']);
89
-		else
90
-			$context['member']['hostname'] = '';
90
+		if (preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $memberContext[$memID]['ip']) == 1 && empty($modSettings['disableHostnameLookup'])) {
91
+					$context['member']['hostname'] = host_from_ip($memberContext[$memID]['ip']);
92
+		} else {
93
+					$context['member']['hostname'] = '';
94
+		}
91 95
 
92 96
 		$context['can_see_ip'] = true;
97
+	} else {
98
+			$context['can_see_ip'] = false;
93 99
 	}
94
-	else
95
-		$context['can_see_ip'] = false;
96 100
 
97 101
 	// Are they hidden?
98 102
 	$context['member']['is_hidden'] = empty($user_profile[$memID]['show_online']);
@@ -103,8 +107,9 @@  discard block
 block discarded – undo
103 107
 		include_once($sourcedir . '/Who.php');
104 108
 		$action = determineActions($user_profile[$memID]['url']);
105 109
 
106
-		if ($action !== false)
107
-			$context['member']['action'] = $action;
110
+		if ($action !== false) {
111
+					$context['member']['action'] = $action;
112
+		}
108 113
 	}
109 114
 
110 115
 	// If the user is awaiting activation, and the viewer has permission - setup some activation context messages.
@@ -167,13 +172,15 @@  discard block
 block discarded – undo
167 172
 		{
168 173
 			// Work out what restrictions we actually have.
169 174
 			$ban_restrictions = array();
170
-			foreach (array('access', 'login', 'post') as $type)
171
-				if ($row['cannot_' . $type])
175
+			foreach (array('access', 'login', 'post') as $type) {
176
+							if ($row['cannot_' . $type])
172 177
 					$ban_restrictions[] = $txt['ban_type_' . $type];
178
+			}
173 179
 
174 180
 			// No actual ban in place?
175
-			if (empty($ban_restrictions))
176
-				continue;
181
+			if (empty($ban_restrictions)) {
182
+							continue;
183
+			}
177 184
 
178 185
 			// Prepare the link for context.
179 186
 			$ban_explanation = sprintf($txt['user_cannot_due_to'], implode(', ', $ban_restrictions), '<a href="' . $scripturl . '?action=admin;area=ban;sa=edit;bg=' . $row['id_ban_group'] . '">' . $row['name'] . '</a>');
@@ -195,9 +202,10 @@  discard block
 block discarded – undo
195 202
 	$context['print_custom_fields'] = array();
196 203
 
197 204
 	// Any custom profile fields?
198
-	if (!empty($context['custom_fields']))
199
-		foreach ($context['custom_fields'] as $custom)
205
+	if (!empty($context['custom_fields'])) {
206
+			foreach ($context['custom_fields'] as $custom)
200 207
 			$context['print_custom_fields'][$context['cust_profile_fields_placement'][$custom['placement']]][] = $custom;
208
+	}
201 209
 
202 210
 }
203 211
 
@@ -241,14 +249,16 @@  discard block
 block discarded – undo
241 249
 		$row['extra'] = !empty($row['extra']) ? $smcFunc['json_decode']($row['extra'], true) : array();
242 250
 		$alerts[$id_alert] = $row;
243 251
 
244
-		if (!empty($row['sender_id']))
245
-			$senders[] = $row['sender_id'];
252
+		if (!empty($row['sender_id'])) {
253
+					$senders[] = $row['sender_id'];
254
+		}
246 255
 	}
247 256
 	$smcFunc['db_free_result']($request);
248 257
 
249 258
 	$senders = loadMemberData($senders);
250
-	foreach ($senders as $member)
251
-		loadMemberContext($member);
259
+	foreach ($senders as $member) {
260
+			loadMemberContext($member);
261
+	}
252 262
 
253 263
 	// Now go through and actually make with the text.
254 264
 	loadLanguage('Alerts');
@@ -262,12 +272,15 @@  discard block
 block discarded – undo
262 272
 	$msgs = array();
263 273
 	foreach ($alerts as $id_alert => $alert)
264 274
 	{
265
-		if (isset($alert['extra']['board']))
266
-			$boards[$alert['extra']['board']] = $txt['board_na'];
267
-		if (isset($alert['extra']['topic']))
268
-			$topics[$alert['extra']['topic']] = $txt['topic_na'];
269
-		if ($alert['content_type'] == 'msg')
270
-			$msgs[$alert['content_id']] = $txt['topic_na'];
275
+		if (isset($alert['extra']['board'])) {
276
+					$boards[$alert['extra']['board']] = $txt['board_na'];
277
+		}
278
+		if (isset($alert['extra']['topic'])) {
279
+					$topics[$alert['extra']['topic']] = $txt['topic_na'];
280
+		}
281
+		if ($alert['content_type'] == 'msg') {
282
+					$msgs[$alert['content_id']] = $txt['topic_na'];
283
+		}
271 284
 	}
272 285
 
273 286
 	// Having figured out what boards etc. there are, let's now get the names of them if we can see them. If not, there's already a fallback set up.
@@ -282,8 +295,9 @@  discard block
 block discarded – undo
282 295
 				'boards' => array_keys($boards),
283 296
 			)
284 297
 		);
285
-		while ($row = $smcFunc['db_fetch_assoc']($request))
286
-			$boards[$row['id_board']] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>';
298
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
299
+					$boards[$row['id_board']] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>';
300
+		}
287 301
 	}
288 302
 	if (!empty($topics))
289 303
 	{
@@ -298,8 +312,9 @@  discard block
 block discarded – undo
298 312
 				'topics' => array_keys($topics),
299 313
 			)
300 314
 		);
301
-		while ($row = $smcFunc['db_fetch_assoc']($request))
302
-			$topics[$row['id_topic']] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['subject'] . '</a>';
315
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
316
+					$topics[$row['id_topic']] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['subject'] . '</a>';
317
+		}
303 318
 	}
304 319
 	if (!empty($msgs))
305 320
 	{
@@ -314,26 +329,33 @@  discard block
 block discarded – undo
314 329
 				'msgs' => array_keys($msgs),
315 330
 			)
316 331
 		);
317
-		while ($row = $smcFunc['db_fetch_assoc']($request))
318
-			$msgs[$row['id_msg']] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>';
332
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
333
+					$msgs[$row['id_msg']] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>';
334
+		}
319 335
 	}
320 336
 
321 337
 	// Now to go back through the alerts, reattach this extra information and then try to build the string out of it (if a hook didn't already)
322 338
 	foreach ($alerts as $id_alert => $alert)
323 339
 	{
324
-		if (!empty($alert['text']))
325
-			continue;
326
-		if (isset($alert['extra']['board']))
327
-			$alerts[$id_alert]['extra']['board_msg'] = $boards[$alert['extra']['board']];
328
-		if (isset($alert['extra']['topic']))
329
-			$alerts[$id_alert]['extra']['topic_msg'] = $topics[$alert['extra']['topic']];
330
-		if ($alert['content_type'] == 'msg')
331
-			$alerts[$id_alert]['extra']['msg_msg'] = $msgs[$alert['content_id']];
332
-		if ($alert['content_type'] == 'profile')
333
-			$alerts[$id_alert]['extra']['profile_msg'] = '<a href="' . $scripturl . '?action=profile;u=' . $alerts[$id_alert]['content_id'] . '">' . $alerts[$id_alert]['extra']['user_name'] . '</a>';
334
-
335
-		if (!empty($memberContext[$alert['sender_id']]))
336
-			$alerts[$id_alert]['sender'] = &$memberContext[$alert['sender_id']];
340
+		if (!empty($alert['text'])) {
341
+					continue;
342
+		}
343
+		if (isset($alert['extra']['board'])) {
344
+					$alerts[$id_alert]['extra']['board_msg'] = $boards[$alert['extra']['board']];
345
+		}
346
+		if (isset($alert['extra']['topic'])) {
347
+					$alerts[$id_alert]['extra']['topic_msg'] = $topics[$alert['extra']['topic']];
348
+		}
349
+		if ($alert['content_type'] == 'msg') {
350
+					$alerts[$id_alert]['extra']['msg_msg'] = $msgs[$alert['content_id']];
351
+		}
352
+		if ($alert['content_type'] == 'profile') {
353
+					$alerts[$id_alert]['extra']['profile_msg'] = '<a href="' . $scripturl . '?action=profile;u=' . $alerts[$id_alert]['content_id'] . '">' . $alerts[$id_alert]['extra']['user_name'] . '</a>';
354
+		}
355
+
356
+		if (!empty($memberContext[$alert['sender_id']])) {
357
+					$alerts[$id_alert]['sender'] = &$memberContext[$alert['sender_id']];
358
+		}
337 359
 
338 360
 		$string = 'alert_' . $alert['content_type'] . '_' . $alert['content_action'];
339 361
 		if (isset($txt[$string]))
@@ -421,11 +443,11 @@  discard block
 block discarded – undo
421 443
 		checkSession('request');
422 444
 
423 445
 		// Call it!
424
-		if ($action == 'remove')
425
-			alert_delete($toMark, $memID);
426
-
427
-		else
428
-			alert_mark($memID, $toMark, $action == 'read' ? 1 : 0);
446
+		if ($action == 'remove') {
447
+					alert_delete($toMark, $memID);
448
+		} else {
449
+					alert_mark($memID, $toMark, $action == 'read' ? 1 : 0);
450
+		}
429 451
 
430 452
 		// Set a nice update message.
431 453
 		$_SESSION['update_message'] = true;
@@ -475,23 +497,27 @@  discard block
 block discarded – undo
475 497
 	);
476 498
 
477 499
 	// Set the page title
478
-	if (isset($_GET['sa']) && array_key_exists($_GET['sa'], $title))
479
-		$context['page_title'] = $txt['show' . $title[$_GET['sa']]];
480
-	else
481
-		$context['page_title'] = $txt['showPosts'];
500
+	if (isset($_GET['sa']) && array_key_exists($_GET['sa'], $title)) {
501
+			$context['page_title'] = $txt['show' . $title[$_GET['sa']]];
502
+	} else {
503
+			$context['page_title'] = $txt['showPosts'];
504
+	}
482 505
 
483 506
 	$context['page_title'] .= ' - ' . $user_profile[$memID]['real_name'];
484 507
 
485 508
 	// Is the load average too high to allow searching just now?
486
-	if (!empty($context['load_average']) && !empty($modSettings['loadavg_show_posts']) && $context['load_average'] >= $modSettings['loadavg_show_posts'])
487
-		fatal_lang_error('loadavg_show_posts_disabled', false);
509
+	if (!empty($context['load_average']) && !empty($modSettings['loadavg_show_posts']) && $context['load_average'] >= $modSettings['loadavg_show_posts']) {
510
+			fatal_lang_error('loadavg_show_posts_disabled', false);
511
+	}
488 512
 
489 513
 	// If we're specifically dealing with attachments use that function!
490
-	if (isset($_GET['sa']) && $_GET['sa'] == 'attach')
491
-		return showAttachments($memID);
514
+	if (isset($_GET['sa']) && $_GET['sa'] == 'attach') {
515
+			return showAttachments($memID);
516
+	}
492 517
 	// Instead, if we're dealing with unwatched topics (and the feature is enabled) use that other function.
493
-	elseif (isset($_GET['sa']) && $_GET['sa'] == 'unwatchedtopics')
494
-		return showUnwatched($memID);
518
+	elseif (isset($_GET['sa']) && $_GET['sa'] == 'unwatchedtopics') {
519
+			return showUnwatched($memID);
520
+	}
495 521
 
496 522
 	// Are we just viewing topics?
497 523
 	$context['is_topics'] = isset($_GET['sa']) && $_GET['sa'] == 'topics' ? true : false;
@@ -514,27 +540,30 @@  discard block
 block discarded – undo
514 540
 		$smcFunc['db_free_result']($request);
515 541
 
516 542
 		// Trying to remove a message that doesn't exist.
517
-		if (empty($info))
518
-			redirectexit('action=profile;u=' . $memID . ';area=showposts;start=' . $_GET['start']);
543
+		if (empty($info)) {
544
+					redirectexit('action=profile;u=' . $memID . ';area=showposts;start=' . $_GET['start']);
545
+		}
519 546
 
520 547
 		// We can be lazy, since removeMessage() will check the permissions for us.
521 548
 		require_once($sourcedir . '/RemoveTopic.php');
522 549
 		removeMessage((int) $_GET['delete']);
523 550
 
524 551
 		// Add it to the mod log.
525
-		if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id']))
526
-			logAction('delete', array('topic' => $info[2], 'subject' => $info[0], 'member' => $info[1], 'board' => $info[3]));
552
+		if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id'])) {
553
+					logAction('delete', array('topic' => $info[2], 'subject' => $info[0], 'member' => $info[1], 'board' => $info[3]));
554
+		}
527 555
 
528 556
 		// Back to... where we are now ;).
529 557
 		redirectexit('action=profile;u=' . $memID . ';area=showposts;start=' . $_GET['start']);
530 558
 	}
531 559
 
532 560
 	// Default to 10.
533
-	if (empty($_REQUEST['viewscount']) || !is_numeric($_REQUEST['viewscount']))
534
-		$_REQUEST['viewscount'] = '10';
561
+	if (empty($_REQUEST['viewscount']) || !is_numeric($_REQUEST['viewscount'])) {
562
+			$_REQUEST['viewscount'] = '10';
563
+	}
535 564
 
536
-	if ($context['is_topics'])
537
-		$request = $smcFunc['db_query']('', '
565
+	if ($context['is_topics']) {
566
+			$request = $smcFunc['db_query']('', '
538 567
 			SELECT COUNT(*)
539 568
 			FROM {db_prefix}topics AS t' . ($user_info['query_see_board'] == '1=1' ? '' : '
540 569
 				INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board AND {query_see_board})') . '
@@ -547,8 +576,8 @@  discard block
 block discarded – undo
547 576
 				'board' => $board,
548 577
 			)
549 578
 		);
550
-	else
551
-		$request = $smcFunc['db_query']('', '
579
+	} else {
580
+			$request = $smcFunc['db_query']('', '
552 581
 			SELECT COUNT(*)
553 582
 			FROM {db_prefix}messages AS m' . ($user_info['query_see_board'] == '1=1' ? '' : '
554 583
 				INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board AND {query_see_board})') . '
@@ -561,6 +590,7 @@  discard block
 block discarded – undo
561 590
 				'board' => $board,
562 591
 			)
563 592
 		);
593
+	}
564 594
 	list ($msgCount) = $smcFunc['db_fetch_row']($request);
565 595
 	$smcFunc['db_free_result']($request);
566 596
 
@@ -581,10 +611,11 @@  discard block
 block discarded – undo
581 611
 
582 612
 	$range_limit = '';
583 613
 
584
-	if ($context['is_topics'])
585
-		$maxPerPage = empty($modSettings['disableCustomPerPage']) && !empty($options['topics_per_page']) ? $options['topics_per_page'] : $modSettings['defaultMaxTopics'];
586
-	else
587
-		$maxPerPage = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) ? $options['messages_per_page'] : $modSettings['defaultMaxMessages'];
614
+	if ($context['is_topics']) {
615
+			$maxPerPage = empty($modSettings['disableCustomPerPage']) && !empty($options['topics_per_page']) ? $options['topics_per_page'] : $modSettings['defaultMaxTopics'];
616
+	} else {
617
+			$maxPerPage = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) ? $options['messages_per_page'] : $modSettings['defaultMaxMessages'];
618
+	}
588 619
 
589 620
 	$maxIndex = $maxPerPage;
590 621
 
@@ -610,9 +641,9 @@  discard block
 block discarded – undo
610 641
 		{
611 642
 			$margin *= 5;
612 643
 			$range_limit = $reverse ? 't.id_first_msg < ' . ($min_msg_member + $margin) : 't.id_first_msg > ' . ($max_msg_member - $margin);
644
+		} else {
645
+					$range_limit = $reverse ? 'm.id_msg < ' . ($min_msg_member + $margin) : 'm.id_msg > ' . ($max_msg_member - $margin);
613 646
 		}
614
-		else
615
-			$range_limit = $reverse ? 'm.id_msg < ' . ($min_msg_member + $margin) : 'm.id_msg > ' . ($max_msg_member - $margin);
616 647
 	}
617 648
 
618 649
 	// Find this user's posts.  The left join on categories somehow makes this faster, weird as it looks.
@@ -644,8 +675,7 @@  discard block
 block discarded – undo
644 675
 					'max' => $maxIndex,
645 676
 				)
646 677
 			);
647
-		}
648
-		else
678
+		} else
649 679
 		{
650 680
 			$request = $smcFunc['db_query']('', '
651 681
 				SELECT
@@ -674,8 +704,9 @@  discard block
 block discarded – undo
674 704
 		}
675 705
 
676 706
 		// Make sure we quit this loop.
677
-		if ($smcFunc['db_num_rows']($request) === $maxIndex || $looped)
678
-			break;
707
+		if ($smcFunc['db_num_rows']($request) === $maxIndex || $looped) {
708
+					break;
709
+		}
679 710
 		$looped = true;
680 711
 		$range_limit = '';
681 712
 	}
@@ -719,19 +750,21 @@  discard block
 block discarded – undo
719 750
 			'css_class' => $row['approved'] ? 'windowbg' : 'approvebg',
720 751
 		);
721 752
 
722
-		if ($user_info['id'] == $row['id_member_started'])
723
-			$board_ids['own'][$row['id_board']][] = $counter;
753
+		if ($user_info['id'] == $row['id_member_started']) {
754
+					$board_ids['own'][$row['id_board']][] = $counter;
755
+		}
724 756
 		$board_ids['any'][$row['id_board']][] = $counter;
725 757
 	}
726 758
 	$smcFunc['db_free_result']($request);
727 759
 
728 760
 	// All posts were retrieved in reverse order, get them right again.
729
-	if ($reverse)
730
-		$context['posts'] = array_reverse($context['posts'], true);
761
+	if ($reverse) {
762
+			$context['posts'] = array_reverse($context['posts'], true);
763
+	}
731 764
 
732 765
 	// These are all the permissions that are different from board to board..
733
-	if ($context['is_topics'])
734
-		$permissions = array(
766
+	if ($context['is_topics']) {
767
+			$permissions = array(
735 768
 			'own' => array(
736 769
 				'post_reply_own' => 'can_reply',
737 770
 			),
@@ -739,8 +772,8 @@  discard block
 block discarded – undo
739 772
 				'post_reply_any' => 'can_reply',
740 773
 			)
741 774
 		);
742
-	else
743
-		$permissions = array(
775
+	} else {
776
+			$permissions = array(
744 777
 			'own' => array(
745 778
 				'post_reply_own' => 'can_reply',
746 779
 				'delete_own' => 'can_delete',
@@ -750,6 +783,7 @@  discard block
 block discarded – undo
750 783
 				'delete_any' => 'can_delete',
751 784
 			)
752 785
 		);
786
+	}
753 787
 
754 788
 	// For every permission in the own/any lists...
755 789
 	foreach ($permissions as $type => $list)
@@ -760,19 +794,22 @@  discard block
 block discarded – undo
760 794
 			$boards = boardsAllowedTo($permission);
761 795
 
762 796
 			// Hmm, they can do it on all boards, can they?
763
-			if (!empty($boards) && $boards[0] == 0)
764
-				$boards = array_keys($board_ids[$type]);
797
+			if (!empty($boards) && $boards[0] == 0) {
798
+							$boards = array_keys($board_ids[$type]);
799
+			}
765 800
 
766 801
 			// Now go through each board they can do the permission on.
767 802
 			foreach ($boards as $board_id)
768 803
 			{
769 804
 				// There aren't any posts displayed from this board.
770
-				if (!isset($board_ids[$type][$board_id]))
771
-					continue;
805
+				if (!isset($board_ids[$type][$board_id])) {
806
+									continue;
807
+				}
772 808
 
773 809
 				// Set the permission to true ;).
774
-				foreach ($board_ids[$type][$board_id] as $counter)
775
-					$context['posts'][$counter][$allowed] = true;
810
+				foreach ($board_ids[$type][$board_id] as $counter) {
811
+									$context['posts'][$counter][$allowed] = true;
812
+				}
776 813
 			}
777 814
 		}
778 815
 	}
@@ -803,8 +840,9 @@  discard block
 block discarded – undo
803 840
 	$boardsAllowed = boardsAllowedTo('view_attachments');
804 841
 
805 842
 	// Make sure we can't actually see anything...
806
-	if (empty($boardsAllowed))
807
-		$boardsAllowed = array(-1);
843
+	if (empty($boardsAllowed)) {
844
+			$boardsAllowed = array(-1);
845
+	}
808 846
 
809 847
 	require_once($sourcedir . '/Subs-List.php');
810 848
 
@@ -955,8 +993,8 @@  discard block
 block discarded – undo
955 993
 		)
956 994
 	);
957 995
 	$attachments = array();
958
-	while ($row = $smcFunc['db_fetch_assoc']($request))
959
-		$attachments[] = array(
996
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
997
+			$attachments[] = array(
960 998
 			'id' => $row['id_attach'],
961 999
 			'filename' => $row['filename'],
962 1000
 			'downloads' => $row['downloads'],
@@ -968,6 +1006,7 @@  discard block
 block discarded – undo
968 1006
 			'board_name' => $row['name'],
969 1007
 			'approved' => $row['approved'],
970 1008
 		);
1009
+	}
971 1010
 
972 1011
 	$smcFunc['db_free_result']($request);
973 1012
 
@@ -1022,8 +1061,9 @@  discard block
 block discarded – undo
1022 1061
 	global $txt, $user_info, $scripturl, $modSettings, $context, $sourcedir;
1023 1062
 
1024 1063
 	// Only the owner can see the list (if the function is enabled of course)
1025
-	if ($user_info['id'] != $memID)
1026
-		return;
1064
+	if ($user_info['id'] != $memID) {
1065
+			return;
1066
+	}
1027 1067
 
1028 1068
 	require_once($sourcedir . '/Subs-List.php');
1029 1069
 
@@ -1169,8 +1209,9 @@  discard block
 block discarded – undo
1169 1209
 	);
1170 1210
 
1171 1211
 	$topics = array();
1172
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1173
-		$topics[] = $row['id_topic'];
1212
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1213
+			$topics[] = $row['id_topic'];
1214
+	}
1174 1215
 
1175 1216
 	$smcFunc['db_free_result']($request);
1176 1217
 
@@ -1190,8 +1231,9 @@  discard block
 block discarded – undo
1190 1231
 				'topics' => $topics,
1191 1232
 			)
1192 1233
 		);
1193
-		while ($row = $smcFunc['db_fetch_assoc']($request))
1194
-			$topicsInfo[] = $row;
1234
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1235
+					$topicsInfo[] = $row;
1236
+		}
1195 1237
 		$smcFunc['db_free_result']($request);
1196 1238
 	}
1197 1239
 
@@ -1239,8 +1281,9 @@  discard block
 block discarded – undo
1239 1281
 	$context['page_title'] = $txt['statPanel_showStats'] . ' ' . $user_profile[$memID]['real_name'];
1240 1282
 
1241 1283
 	// Is the load average too high to allow searching just now?
1242
-	if (!empty($context['load_average']) && !empty($modSettings['loadavg_userstats']) && $context['load_average'] >= $modSettings['loadavg_userstats'])
1243
-		fatal_lang_error('loadavg_userstats_disabled', false);
1284
+	if (!empty($context['load_average']) && !empty($modSettings['loadavg_userstats']) && $context['load_average'] >= $modSettings['loadavg_userstats']) {
1285
+			fatal_lang_error('loadavg_userstats_disabled', false);
1286
+	}
1244 1287
 
1245 1288
 	// General user statistics.
1246 1289
 	$timeDays = floor($user_profile[$memID]['total_time_logged_in'] / 86400);
@@ -1398,11 +1441,13 @@  discard block
 block discarded – undo
1398 1441
 	}
1399 1442
 	$smcFunc['db_free_result']($result);
1400 1443
 
1401
-	if ($maxPosts > 0)
1402
-		for ($hour = 0; $hour < 24; $hour++)
1444
+	if ($maxPosts > 0) {
1445
+			for ($hour = 0;
1446
+	}
1447
+	$hour < 24; $hour++)
1403 1448
 		{
1404
-			if (!isset($context['posts_by_time'][$hour]))
1405
-				$context['posts_by_time'][$hour] = array(
1449
+			if (!isset($context['posts_by_time'][$hour])) {
1450
+							$context['posts_by_time'][$hour] = array(
1406 1451
 					'hour' => $hour,
1407 1452
 					'hour_format' => stripos($user_info['time_format'], '%p') === false ? $hour : date('g a', mktime($hour)),
1408 1453
 					'posts' => 0,
@@ -1410,7 +1455,7 @@  discard block
 block discarded – undo
1410 1455
 					'relative_percent' => 0,
1411 1456
 					'is_last' => $hour == 23,
1412 1457
 				);
1413
-			else
1458
+			} else
1414 1459
 			{
1415 1460
 				$context['posts_by_time'][$hour]['posts_percent'] = round(($context['posts_by_time'][$hour]['posts'] * 100) / $realPosts);
1416 1461
 				$context['posts_by_time'][$hour]['relative_percent'] = round(($context['posts_by_time'][$hour]['posts'] * 100) / $maxPosts);
@@ -1443,8 +1488,9 @@  discard block
 block discarded – undo
1443 1488
 
1444 1489
 	foreach ($subActions as $sa => $action)
1445 1490
 	{
1446
-		if (!allowedTo($action[2]))
1447
-			unset($subActions[$sa]);
1491
+		if (!allowedTo($action[2])) {
1492
+					unset($subActions[$sa]);
1493
+		}
1448 1494
 	}
1449 1495
 
1450 1496
 	// Create the tabs for the template.
@@ -1462,15 +1508,18 @@  discard block
 block discarded – undo
1462 1508
 	);
1463 1509
 
1464 1510
 	// Moderation must be on to track edits.
1465
-	if (empty($modSettings['userlog_enabled']))
1466
-		unset($context[$context['profile_menu_name']]['tab_data']['edits'], $subActions['edits']);
1511
+	if (empty($modSettings['userlog_enabled'])) {
1512
+			unset($context[$context['profile_menu_name']]['tab_data']['edits'], $subActions['edits']);
1513
+	}
1467 1514
 
1468 1515
 	// Group requests must be active to show it...
1469
-	if (empty($modSettings['show_group_membership']))
1470
-		unset($context[$context['profile_menu_name']]['tab_data']['groupreq'], $subActions['groupreq']);
1516
+	if (empty($modSettings['show_group_membership'])) {
1517
+			unset($context[$context['profile_menu_name']]['tab_data']['groupreq'], $subActions['groupreq']);
1518
+	}
1471 1519
 
1472
-	if (empty($subActions))
1473
-		fatal_lang_error('no_access', false);
1520
+	if (empty($subActions)) {
1521
+			fatal_lang_error('no_access', false);
1522
+	}
1474 1523
 
1475 1524
 	$keys = array_keys($subActions);
1476 1525
 	$default = array_shift($keys);
@@ -1483,9 +1532,10 @@  discard block
 block discarded – undo
1483 1532
 	$context['sub_template'] = $subActions[$context['tracking_area']][0];
1484 1533
 	$call = call_helper($subActions[$context['tracking_area']][0], true);
1485 1534
 
1486
-	if (!empty($call))
1487
-		call_user_func($call, $memID);
1488
-}
1535
+	if (!empty($call)) {
1536
+			call_user_func($call, $memID);
1537
+	}
1538
+	}
1489 1539
 
1490 1540
 /**
1491 1541
  * Handles tracking a user's activity
@@ -1501,8 +1551,9 @@  discard block
 block discarded – undo
1501 1551
 	isAllowedTo('moderate_forum');
1502 1552
 
1503 1553
 	$context['last_ip'] = $user_profile[$memID]['member_ip'];
1504
-	if ($context['last_ip'] != $user_profile[$memID]['member_ip2'])
1505
-		$context['last_ip2'] = $user_profile[$memID]['member_ip2'];
1554
+	if ($context['last_ip'] != $user_profile[$memID]['member_ip2']) {
1555
+			$context['last_ip2'] = $user_profile[$memID]['member_ip2'];
1556
+	}
1506 1557
 	$context['member']['name'] = $user_profile[$memID]['real_name'];
1507 1558
 
1508 1559
 	// Set the options for the list component.
@@ -1668,8 +1719,9 @@  discard block
 block discarded – undo
1668 1719
 			)
1669 1720
 		);
1670 1721
 		$message_members = array();
1671
-		while ($row = $smcFunc['db_fetch_assoc']($request))
1672
-			$message_members[] = $row['id_member'];
1722
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1723
+					$message_members[] = $row['id_member'];
1724
+		}
1673 1725
 		$smcFunc['db_free_result']($request);
1674 1726
 
1675 1727
 		// Fetch their names, cause of the GROUP BY doesn't like giving us that normally.
@@ -1684,8 +1736,9 @@  discard block
 block discarded – undo
1684 1736
 					'ip_list' => $ips,
1685 1737
 				)
1686 1738
 			);
1687
-			while ($row = $smcFunc['db_fetch_assoc']($request))
1688
-				$context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
1739
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
1740
+							$context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
1741
+			}
1689 1742
 			$smcFunc['db_free_result']($request);
1690 1743
 		}
1691 1744
 
@@ -1699,8 +1752,9 @@  discard block
 block discarded – undo
1699 1752
 				'ip_list' => $ips,
1700 1753
 			)
1701 1754
 		);
1702
-		while ($row = $smcFunc['db_fetch_assoc']($request))
1703
-			$context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
1755
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1756
+					$context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
1757
+		}
1704 1758
 		$smcFunc['db_free_result']($request);
1705 1759
 	}
1706 1760
 }
@@ -1760,8 +1814,8 @@  discard block
 block discarded – undo
1760 1814
 		))
1761 1815
 	);
1762 1816
 	$error_messages = array();
1763
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1764
-		$error_messages[] = array(
1817
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1818
+			$error_messages[] = array(
1765 1819
 			'ip' => inet_dtop($row['ip']),
1766 1820
 			'member_link' => $row['id_member'] > 0 ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['display_name'] . '</a>' : $row['display_name'],
1767 1821
 			'message' => strtr($row['message'], array('&lt;span class=&quot;remove&quot;&gt;' => '', '&lt;/span&gt;' => '')),
@@ -1769,6 +1823,7 @@  discard block
 block discarded – undo
1769 1823
 			'time' => timeformat($row['log_time']),
1770 1824
 			'timestamp' => forum_time(true, $row['log_time']),
1771 1825
 		);
1826
+	}
1772 1827
 	$smcFunc['db_free_result']($request);
1773 1828
 
1774 1829
 	return $error_messages;
@@ -1831,8 +1886,8 @@  discard block
 block discarded – undo
1831 1886
 		))
1832 1887
 	);
1833 1888
 	$messages = array();
1834
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1835
-		$messages[] = array(
1889
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1890
+			$messages[] = array(
1836 1891
 			'ip' => inet_dtop($row['poster_ip']),
1837 1892
 			'member_link' => empty($row['id_member']) ? $row['display_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['display_name'] . '</a>',
1838 1893
 			'board' => array(
@@ -1845,6 +1900,7 @@  discard block
 block discarded – undo
1845 1900
 			'time' => timeformat($row['poster_time']),
1846 1901
 			'timestamp' => forum_time(true, $row['poster_time'])
1847 1902
 		);
1903
+	}
1848 1904
 	$smcFunc['db_free_result']($request);
1849 1905
 
1850 1906
 	return $messages;
@@ -1871,19 +1927,20 @@  discard block
 block discarded – undo
1871 1927
 		$context['sub_template'] = 'trackIP';
1872 1928
 		$context['page_title'] = $txt['profile'];
1873 1929
 		$context['base_url'] = $scripturl . '?action=trackip';
1874
-	}
1875
-	else
1930
+	} else
1876 1931
 	{
1877 1932
 		$context['ip'] = $user_profile[$memID]['member_ip'];
1878 1933
 		$context['base_url'] = $scripturl . '?action=profile;area=tracking;sa=ip;u=' . $memID;
1879 1934
 	}
1880 1935
 
1881 1936
 	// Searching?
1882
-	if (isset($_REQUEST['searchip']))
1883
-		$context['ip'] = trim($_REQUEST['searchip']);
1937
+	if (isset($_REQUEST['searchip'])) {
1938
+			$context['ip'] = trim($_REQUEST['searchip']);
1939
+	}
1884 1940
 
1885
-	if (isValidIP($context['ip']) === false)
1886
-		fatal_lang_error('invalid_tracking_ip', false);
1941
+	if (isValidIP($context['ip']) === false) {
1942
+			fatal_lang_error('invalid_tracking_ip', false);
1943
+	}
1887 1944
 
1888 1945
 	//mysql didn't support like search with varbinary
1889 1946
 	//$ip_var = str_replace('*', '%', $context['ip']);
@@ -1891,8 +1948,9 @@  discard block
 block discarded – undo
1891 1948
 	$ip_var = $context['ip'];
1892 1949
 	$ip_string = '= {inet:ip_address}';
1893 1950
 
1894
-	if (empty($context['tracking_area']))
1895
-		$context['page_title'] = $txt['trackIP'] . ' - ' . $context['ip'];
1951
+	if (empty($context['tracking_area'])) {
1952
+			$context['page_title'] = $txt['trackIP'] . ' - ' . $context['ip'];
1953
+	}
1896 1954
 
1897 1955
 	$request = $smcFunc['db_query']('', '
1898 1956
 		SELECT id_member, real_name AS display_name, member_ip
@@ -1903,8 +1961,9 @@  discard block
 block discarded – undo
1903 1961
 		)
1904 1962
 	);
1905 1963
 	$context['ips'] = array();
1906
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1907
-		$context['ips'][inet_dtop($row['member_ip'])][] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['display_name'] . '</a>';
1964
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1965
+			$context['ips'][inet_dtop($row['member_ip'])][] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['display_name'] . '</a>';
1966
+	}
1908 1967
 	$smcFunc['db_free_result']($request);
1909 1968
 
1910 1969
 	ksort($context['ips']);
@@ -2133,8 +2192,9 @@  discard block
 block discarded – undo
2133 2192
 		foreach ($context['whois_servers'] as $whois)
2134 2193
 		{
2135 2194
 			// Strip off the "decimal point" and anything following...
2136
-			if (in_array((int) $context['ip'], $whois['range']))
2137
-				$context['auto_whois_server'] = $whois;
2195
+			if (in_array((int) $context['ip'], $whois['range'])) {
2196
+							$context['auto_whois_server'] = $whois;
2197
+			}
2138 2198
 		}
2139 2199
 	}
2140 2200
 }
@@ -2151,10 +2211,11 @@  discard block
 block discarded – undo
2151 2211
 	// Gonna want this for the list.
2152 2212
 	require_once($sourcedir . '/Subs-List.php');
2153 2213
 
2154
-	if ($memID == 0)
2155
-		$context['base_url'] = $scripturl . '?action=trackip';
2156
-	else
2157
-		$context['base_url'] = $scripturl . '?action=profile;area=tracking;sa=ip;u=' . $memID;
2214
+	if ($memID == 0) {
2215
+			$context['base_url'] = $scripturl . '?action=trackip';
2216
+	} else {
2217
+			$context['base_url'] = $scripturl . '?action=profile;area=tracking;sa=ip;u=' . $memID;
2218
+	}
2158 2219
 
2159 2220
 	// Start with the user messages.
2160 2221
 	$listOptions = array(
@@ -2264,12 +2325,13 @@  discard block
 block discarded – undo
2264 2325
 		)
2265 2326
 	);
2266 2327
 	$logins = array();
2267
-	while ($row = $smcFunc['db_fetch_assoc']($request))
2268
-		$logins[] = array(
2328
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
2329
+			$logins[] = array(
2269 2330
 			'time' => timeformat($row['time']),
2270 2331
 			'ip' => inet_dtop($row['ip']),
2271 2332
 			'ip2' => inet_dtop($row['ip2']),
2272 2333
 		);
2334
+	}
2273 2335
 	$smcFunc['db_free_result']($request);
2274 2336
 
2275 2337
 	return $logins;
@@ -2294,11 +2356,12 @@  discard block
 block discarded – undo
2294 2356
 		)
2295 2357
 	);
2296 2358
 	$context['custom_field_titles'] = array();
2297
-	while ($row = $smcFunc['db_fetch_assoc']($request))
2298
-		$context['custom_field_titles']['customfield_' . $row['col_name']] = array(
2359
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
2360
+			$context['custom_field_titles']['customfield_' . $row['col_name']] = array(
2299 2361
 			'title' => $row['field_name'],
2300 2362
 			'parse_bbc' => $row['bbc'],
2301 2363
 		);
2364
+	}
2302 2365
 	$smcFunc['db_free_result']($request);
2303 2366
 
2304 2367
 	// Set the options for the error lists.
@@ -2437,19 +2500,22 @@  discard block
 block discarded – undo
2437 2500
 	while ($row = $smcFunc['db_fetch_assoc']($request))
2438 2501
 	{
2439 2502
 		$extra = $smcFunc['json_decode']($row['extra'], true);
2440
-		if (!empty($extra['applicator']))
2441
-			$members[] = $extra['applicator'];
2503
+		if (!empty($extra['applicator'])) {
2504
+					$members[] = $extra['applicator'];
2505
+		}
2442 2506
 
2443 2507
 		// Work out what the name of the action is.
2444
-		if (isset($txt['trackEdit_action_' . $row['action']]))
2445
-			$action_text = $txt['trackEdit_action_' . $row['action']];
2446
-		elseif (isset($txt[$row['action']]))
2447
-			$action_text = $txt[$row['action']];
2508
+		if (isset($txt['trackEdit_action_' . $row['action']])) {
2509
+					$action_text = $txt['trackEdit_action_' . $row['action']];
2510
+		} elseif (isset($txt[$row['action']])) {
2511
+					$action_text = $txt[$row['action']];
2512
+		}
2448 2513
 		// Custom field?
2449
-		elseif (isset($context['custom_field_titles'][$row['action']]))
2450
-			$action_text = $context['custom_field_titles'][$row['action']]['title'];
2451
-		else
2452
-			$action_text = $row['action'];
2514
+		elseif (isset($context['custom_field_titles'][$row['action']])) {
2515
+					$action_text = $context['custom_field_titles'][$row['action']]['title'];
2516
+		} else {
2517
+					$action_text = $row['action'];
2518
+		}
2453 2519
 
2454 2520
 		// Parse BBC?
2455 2521
 		$parse_bbc = isset($context['custom_field_titles'][$row['action']]) && $context['custom_field_titles'][$row['action']]['parse_bbc'] ? true : false;
@@ -2481,13 +2547,15 @@  discard block
 block discarded – undo
2481 2547
 			)
2482 2548
 		);
2483 2549
 		$members = array();
2484
-		while ($row = $smcFunc['db_fetch_assoc']($request))
2485
-			$members[$row['id_member']] = $row['real_name'];
2550
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
2551
+					$members[$row['id_member']] = $row['real_name'];
2552
+		}
2486 2553
 		$smcFunc['db_free_result']($request);
2487 2554
 
2488
-		foreach ($edits as $key => $value)
2489
-			if (isset($members[$value['id_member']]))
2555
+		foreach ($edits as $key => $value) {
2556
+					if (isset($members[$value['id_member']]))
2490 2557
 				$edits[$key]['member_link'] = '<a href="' . $scripturl . '?action=profile;u=' . $value['id_member'] . '">' . $members[$value['id_member']] . '</a>';
2558
+		}
2491 2559
 	}
2492 2560
 
2493 2561
 	return $edits;
@@ -2688,10 +2756,11 @@  discard block
 block discarded – undo
2688 2756
 	$context['board'] = $board;
2689 2757
 
2690 2758
 	// Determine which groups this user is in.
2691
-	if (empty($user_profile[$memID]['additional_groups']))
2692
-		$curGroups = array();
2693
-	else
2694
-		$curGroups = explode(',', $user_profile[$memID]['additional_groups']);
2759
+	if (empty($user_profile[$memID]['additional_groups'])) {
2760
+			$curGroups = array();
2761
+	} else {
2762
+			$curGroups = explode(',', $user_profile[$memID]['additional_groups']);
2763
+	}
2695 2764
 	$curGroups[] = $user_profile[$memID]['id_group'];
2696 2765
 	$curGroups[] = $user_profile[$memID]['id_post_group'];
2697 2766
 
@@ -2711,28 +2780,30 @@  discard block
 block discarded – undo
2711 2780
 	$context['no_access_boards'] = array();
2712 2781
 	while ($row = $smcFunc['db_fetch_assoc']($request))
2713 2782
 	{
2714
-		if (count(array_intersect($curGroups, explode(',', $row['member_groups']))) === 0 && !$row['is_mod'])
2715
-			$context['no_access_boards'][] = array(
2783
+		if (count(array_intersect($curGroups, explode(',', $row['member_groups']))) === 0 && !$row['is_mod']) {
2784
+					$context['no_access_boards'][] = array(
2716 2785
 				'id' => $row['id_board'],
2717 2786
 				'name' => $row['name'],
2718 2787
 				'is_last' => false,
2719 2788
 			);
2720
-		elseif ($row['id_profile'] != 1 || $row['is_mod'])
2721
-			$context['boards'][$row['id_board']] = array(
2789
+		} elseif ($row['id_profile'] != 1 || $row['is_mod']) {
2790
+					$context['boards'][$row['id_board']] = array(
2722 2791
 				'id' => $row['id_board'],
2723 2792
 				'name' => $row['name'],
2724 2793
 				'selected' => $board == $row['id_board'],
2725 2794
 				'profile' => $row['id_profile'],
2726 2795
 				'profile_name' => $context['profiles'][$row['id_profile']]['name'],
2727 2796
 			);
2797
+		}
2728 2798
 	}
2729 2799
 	$smcFunc['db_free_result']($request);
2730 2800
 
2731 2801
 	require_once($sourcedir . '/Subs-Boards.php');
2732 2802
 	sortBoards($context['boards']);
2733 2803
 
2734
-	if (!empty($context['no_access_boards']))
2735
-		$context['no_access_boards'][count($context['no_access_boards']) - 1]['is_last'] = true;
2804
+	if (!empty($context['no_access_boards'])) {
2805
+			$context['no_access_boards'][count($context['no_access_boards']) - 1]['is_last'] = true;
2806
+	}
2736 2807
 
2737 2808
 	$context['member']['permissions'] = array(
2738 2809
 		'general' => array(),
@@ -2741,8 +2812,9 @@  discard block
 block discarded – undo
2741 2812
 
2742 2813
 	// If you're an admin we know you can do everything, we might as well leave.
2743 2814
 	$context['member']['has_all_permissions'] = in_array(1, $curGroups);
2744
-	if ($context['member']['has_all_permissions'])
2745
-		return;
2815
+	if ($context['member']['has_all_permissions']) {
2816
+			return;
2817
+	}
2746 2818
 
2747 2819
 	$denied = array();
2748 2820
 
@@ -2761,21 +2833,24 @@  discard block
 block discarded – undo
2761 2833
 	while ($row = $smcFunc['db_fetch_assoc']($result))
2762 2834
 	{
2763 2835
 		// We don't know about this permission, it doesn't exist :P.
2764
-		if (!isset($txt['permissionname_' . $row['permission']]))
2765
-			continue;
2836
+		if (!isset($txt['permissionname_' . $row['permission']])) {
2837
+					continue;
2838
+		}
2766 2839
 
2767
-		if (empty($row['add_deny']))
2768
-			$denied[] = $row['permission'];
2840
+		if (empty($row['add_deny'])) {
2841
+					$denied[] = $row['permission'];
2842
+		}
2769 2843
 
2770 2844
 		// Permissions that end with _own or _any consist of two parts.
2771
-		if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)]))
2772
-			$name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']];
2773
-		else
2774
-			$name = $txt['permissionname_' . $row['permission']];
2845
+		if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)])) {
2846
+					$name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']];
2847
+		} else {
2848
+					$name = $txt['permissionname_' . $row['permission']];
2849
+		}
2775 2850
 
2776 2851
 		// Add this permission if it doesn't exist yet.
2777
-		if (!isset($context['member']['permissions']['general'][$row['permission']]))
2778
-			$context['member']['permissions']['general'][$row['permission']] = array(
2852
+		if (!isset($context['member']['permissions']['general'][$row['permission']])) {
2853
+					$context['member']['permissions']['general'][$row['permission']] = array(
2779 2854
 				'id' => $row['permission'],
2780 2855
 				'groups' => array(
2781 2856
 					'allowed' => array(),
@@ -2785,6 +2860,7 @@  discard block
 block discarded – undo
2785 2860
 				'is_denied' => false,
2786 2861
 				'is_global' => true,
2787 2862
 			);
2863
+		}
2788 2864
 
2789 2865
 		// Add the membergroup to either the denied or the allowed groups.
2790 2866
 		$context['member']['permissions']['general'][$row['permission']]['groups'][empty($row['add_deny']) ? 'denied' : 'allowed'][] = $row['id_group'] == 0 ? $txt['membergroups_members'] : $row['group_name'];
@@ -2818,18 +2894,20 @@  discard block
 block discarded – undo
2818 2894
 	while ($row = $smcFunc['db_fetch_assoc']($request))
2819 2895
 	{
2820 2896
 		// We don't know about this permission, it doesn't exist :P.
2821
-		if (!isset($txt['permissionname_' . $row['permission']]))
2822
-			continue;
2897
+		if (!isset($txt['permissionname_' . $row['permission']])) {
2898
+					continue;
2899
+		}
2823 2900
 
2824 2901
 		// The name of the permission using the format 'permission name' - 'own/any topic/event/etc.'.
2825
-		if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)]))
2826
-			$name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']];
2827
-		else
2828
-			$name = $txt['permissionname_' . $row['permission']];
2902
+		if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)])) {
2903
+					$name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']];
2904
+		} else {
2905
+					$name = $txt['permissionname_' . $row['permission']];
2906
+		}
2829 2907
 
2830 2908
 		// Create the structure for this permission.
2831
-		if (!isset($context['member']['permissions']['board'][$row['permission']]))
2832
-			$context['member']['permissions']['board'][$row['permission']] = array(
2909
+		if (!isset($context['member']['permissions']['board'][$row['permission']])) {
2910
+					$context['member']['permissions']['board'][$row['permission']] = array(
2833 2911
 				'id' => $row['permission'],
2834 2912
 				'groups' => array(
2835 2913
 					'allowed' => array(),
@@ -2839,6 +2917,7 @@  discard block
 block discarded – undo
2839 2917
 				'is_denied' => false,
2840 2918
 				'is_global' => empty($board),
2841 2919
 			);
2920
+		}
2842 2921
 
2843 2922
 		$context['member']['permissions']['board'][$row['permission']]['groups'][empty($row['add_deny']) ? 'denied' : 'allowed'][$row['id_group']] = $row['id_group'] == 0 ? $txt['membergroups_members'] : $row['group_name'];
2844 2923
 
@@ -2857,8 +2936,9 @@  discard block
 block discarded – undo
2857 2936
 	global $modSettings, $context, $sourcedir, $txt, $scripturl;
2858 2937
 
2859 2938
 	// Firstly, can we actually even be here?
2860
-	if (!($context['user']['is_owner'] && allowedTo('view_warning_own')) && !allowedTo('view_warning_any') && !allowedTo('issue_warning') && !allowedTo('moderate_forum'))
2861
-		fatal_lang_error('no_access', false);
2939
+	if (!($context['user']['is_owner'] && allowedTo('view_warning_own')) && !allowedTo('view_warning_any') && !allowedTo('issue_warning') && !allowedTo('moderate_forum')) {
2940
+			fatal_lang_error('no_access', false);
2941
+	}
2862 2942
 
2863 2943
 	// Make sure things which are disabled stay disabled.
2864 2944
 	$modSettings['warning_watch'] = !empty($modSettings['warning_watch']) ? $modSettings['warning_watch'] : 110;
@@ -2945,9 +3025,10 @@  discard block
 block discarded – undo
2945 3025
 		$modSettings['warning_mute'] => $txt['profile_warning_effect_own_muted'],
2946 3026
 	);
2947 3027
 	$context['current_level'] = 0;
2948
-	foreach ($context['level_effects'] as $limit => $dummy)
2949
-		if ($context['member']['warning'] >= $limit)
3028
+	foreach ($context['level_effects'] as $limit => $dummy) {
3029
+			if ($context['member']['warning'] >= $limit)
2950 3030
 			$context['current_level'] = $limit;
2951
-}
3031
+	}
3032
+	}
2952 3033
 
2953 3034
 ?>
2954 3035
\ No newline at end of file
Please login to merge, or discard this patch.
Sources/Subs.php 4 patches
Indentation   -2 removed lines patch added patch discarded remove patch
@@ -5370,7 +5370,6 @@  discard block
 block discarded – undo
5370 5370
 
5371 5371
 /**
5372 5372
  * Tries different modes to make file/dirs writable. Wrapper function for chmod()
5373
-
5374 5373
  * @param string $file The file/dir full path.
5375 5374
  * @param int $value Not needed, added for legacy reasons.
5376 5375
  * @return boolean  true if the file/dir is already writable or the function was able to make it writable, false if the function couldn't make the file/dir writable.
@@ -5410,7 +5409,6 @@  discard block
 block discarded – undo
5410 5409
 
5411 5410
 /**
5412 5411
  * Wrapper function for json_decode() with error handling.
5413
-
5414 5412
  * @param string $json The string to decode.
5415 5413
  * @param bool $returnAsArray To return the decoded string as an array or an object, SMF only uses Arrays but to keep on compatibility with json_decode its set to false as default.
5416 5414
  * @param bool $logIt To specify if the error will be logged if theres any.
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
  * - caches the formatting data from the setting for optimization.
677 677
  *
678 678
  * @param float $number A number
679
- * @param bool|int $override_decimal_count If set, will use the specified number of decimal places. Otherwise it's automatically determined
679
+ * @param integer $override_decimal_count If set, will use the specified number of decimal places. Otherwise it's automatically determined
680 680
  * @return string A formatted number
681 681
  */
682 682
 function comma_format($number, $override_decimal_count = false)
@@ -5527,7 +5527,7 @@  discard block
 block discarded – undo
5527 5527
  * It assumes the data is already a string.
5528 5528
  * @param string $data The data to print
5529 5529
  * @param string $type The content type. Defaults to Json.
5530
- * @return void
5530
+ * @return false|null
5531 5531
  */
5532 5532
 function smf_serverResponse($data = '', $type = 'Content-Type: application/json')
5533 5533
 {
Please login to merge, or discard this patch.
Spacing   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 			$unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400);
801 801
 		if (empty($unsupportedFormats))
802 802
 		{
803
-			foreach($strftimeFormatSubstitutions as $format => $substitution)
803
+			foreach ($strftimeFormatSubstitutions as $format => $substitution)
804 804
 			{
805 805
 				$value = @strftime('%' . $format);
806 806
 
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
 					'height' => array('optional' => true, 'match' => '(\d+)'),
1166 1166
 				),
1167 1167
 				'content' => '$1',
1168
-				'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1168
+				'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1169 1169
 				{
1170 1170
 					$returnContext = '';
1171 1171
 
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 						}
1201 1201
 
1202 1202
 						if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}']))
1203
-							$returnContext .= '<a href="'. $currentAttachment['href']. ';image" id="link_'. $currentAttachment['id']. '" onclick="'. $currentAttachment['thumbnail']['javascript']. '"><img src="'. $currentAttachment['thumbnail']['href']. '"' . $alt . $title . ' id="thumb_'. $currentAttachment['id']. '" class="atc_img"></a>';
1203
+							$returnContext .= '<a href="' . $currentAttachment['href'] . ';image" id="link_' . $currentAttachment['id'] . '" onclick="' . $currentAttachment['thumbnail']['javascript'] . '"><img src="' . $currentAttachment['thumbnail']['href'] . '"' . $alt . $title . ' id="thumb_' . $currentAttachment['id'] . '" class="atc_img"></a>';
1204 1204
 						else
1205 1205
 							$returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>';
1206 1206
 					}
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 				'type' => 'unparsed_content',
1230 1230
 				'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>',
1231 1231
 				// @todo Maybe this can be simplified?
1232
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1232
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1233 1233
 				{
1234 1234
 					if (!isset($disabled['code']))
1235 1235
 					{
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
 				'type' => 'unparsed_equals_content',
1267 1267
 				'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> ($2) <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>',
1268 1268
 				// @todo Maybe this can be simplified?
1269
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1269
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1270 1270
 				{
1271 1271
 					if (!isset($disabled['code']))
1272 1272
 					{
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 				'type' => 'unparsed_content',
1311 1311
 				'content' => '<a href="mailto:$1" class="bbc_email">$1</a>',
1312 1312
 				// @todo Should this respect guest_hideContacts?
1313
-				'validate' => function (&$tag, &$data, $disabled)
1313
+				'validate' => function(&$tag, &$data, $disabled)
1314 1314
 				{
1315 1315
 					$data = strtr($data, array('<br>' => ''));
1316 1316
 				},
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
 				'type' => 'unparsed_commas_content',
1330 1330
 				'test' => '\d+,\d+\]',
1331 1331
 				'content' => '<embed type="application/x-shockwave-flash" src="$1" width="$2" height="$3" play="true" loop="true" quality="high" AllowScriptAccess="never">',
1332
-				'validate' => function (&$tag, &$data, $disabled)
1332
+				'validate' => function(&$tag, &$data, $disabled)
1333 1333
 				{
1334 1334
 					if (isset($disabled['url']))
1335 1335
 						$tag['content'] = '$1';
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
 				'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]',
1346 1346
 				'before' => '<div $1>',
1347 1347
 				'after' => '</div>',
1348
-				'validate' => function (&$tag, &$data, $disabled)
1348
+				'validate' => function(&$tag, &$data, $disabled)
1349 1349
 				{
1350 1350
 					$class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"';
1351 1351
 
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
 					'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
1395 1395
 				),
1396 1396
 				'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">',
1397
-				'validate' => function (&$tag, &$data, $disabled)
1397
+				'validate' => function(&$tag, &$data, $disabled)
1398 1398
 				{
1399 1399
 					global $image_proxy_enabled, $image_proxy_secret, $boardurl;
1400 1400
 
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 				'tag' => 'img',
1418 1418
 				'type' => 'unparsed_content',
1419 1419
 				'content' => '<img src="$1" alt="" class="bbc_img">',
1420
-				'validate' => function (&$tag, &$data, $disabled)
1420
+				'validate' => function(&$tag, &$data, $disabled)
1421 1421
 				{
1422 1422
 					global $image_proxy_enabled, $image_proxy_secret, $boardurl;
1423 1423
 
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 				'tag' => 'iurl',
1441 1441
 				'type' => 'unparsed_content',
1442 1442
 				'content' => '<a href="$1" class="bbc_link">$1</a>',
1443
-				'validate' => function (&$tag, &$data, $disabled)
1443
+				'validate' => function(&$tag, &$data, $disabled)
1444 1444
 				{
1445 1445
 					$data = strtr($data, array('<br>' => ''));
1446 1446
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 				'quoted' => 'optional',
1455 1455
 				'before' => '<a href="$1" class="bbc_link">',
1456 1456
 				'after' => '</a>',
1457
-				'validate' => function (&$tag, &$data, $disabled)
1457
+				'validate' => function(&$tag, &$data, $disabled)
1458 1458
 				{
1459 1459
 					if (substr($data, 0, 1) == '#')
1460 1460
 						$data = '#post_' . substr($data, 1);
@@ -1534,7 +1534,7 @@  discard block
 block discarded – undo
1534 1534
 				'tag' => 'php',
1535 1535
 				'type' => 'unparsed_content',
1536 1536
 				'content' => '<span class="phpcode">$1</span>',
1537
-				'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled)
1537
+				'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled)
1538 1538
 				{
1539 1539
 					if (!isset($disabled['php']))
1540 1540
 					{
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
 				'test' => '[1-7]\]',
1633 1633
 				'before' => '<span style="font-size: $1;" class="bbc_size">',
1634 1634
 				'after' => '</span>',
1635
-				'validate' => function (&$tag, &$data, $disabled)
1635
+				'validate' => function(&$tag, &$data, $disabled)
1636 1636
 				{
1637 1637
 					$sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95);
1638 1638
 					$data = $sizes[$data] . 'em';
@@ -1670,7 +1670,7 @@  discard block
 block discarded – undo
1670 1670
 				'tag' => 'time',
1671 1671
 				'type' => 'unparsed_content',
1672 1672
 				'content' => '$1',
1673
-				'validate' => function (&$tag, &$data, $disabled)
1673
+				'validate' => function(&$tag, &$data, $disabled)
1674 1674
 				{
1675 1675
 					if (is_numeric($data))
1676 1676
 						$data = timeformat($data);
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
 				'tag' => 'url',
1699 1699
 				'type' => 'unparsed_content',
1700 1700
 				'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>',
1701
-				'validate' => function (&$tag, &$data, $disabled)
1701
+				'validate' => function(&$tag, &$data, $disabled)
1702 1702
 				{
1703 1703
 					$data = strtr($data, array('<br>' => ''));
1704 1704
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
 				'quoted' => 'optional',
1713 1713
 				'before' => '<a href="$1" class="bbc_link" target="_blank">',
1714 1714
 				'after' => '</a>',
1715
-				'validate' => function (&$tag, &$data, $disabled)
1715
+				'validate' => function(&$tag, &$data, $disabled)
1716 1716
 				{
1717 1717
 					$scheme = parse_url($data, PHP_URL_SCHEME);
1718 1718
 					if (empty($scheme))
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
 		{
1739 1739
 			if (isset($temp_bbc))
1740 1740
 				$bbc_codes = $temp_bbc;
1741
-			usort($codes, function ($a, $b) {
1741
+			usort($codes, function($a, $b) {
1742 1742
 				return strcmp($a['tag'], $b['tag']);
1743 1743
 			});
1744 1744
 			return $codes;
@@ -1975,7 +1975,7 @@  discard block
 block discarded – undo
1975 1975
 										# a run of Unicode domain name characters and a dot
1976 1976
 										[\p{L}\p{M}\p{N}\-.:@]+\.
1977 1977
 										# and then a TLD valid in the DNS or the reserved "local" TLD
1978
-										(?:'. $modSettings['tld_regex'] .'|local)
1978
+										(?:'. $modSettings['tld_regex'] . '|local)
1979 1979
 									)
1980 1980
 									# followed by a non-domain character or end of line
1981 1981
 									(?=[^\p{L}\p{N}\-.]|$)
@@ -2043,7 +2043,7 @@  discard block
 block discarded – undo
2043 2043
 						)?
2044 2044
 						';
2045 2045
 
2046
-						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) {
2046
+						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) {
2047 2047
 							$url = array_shift($matches);
2048 2048
 
2049 2049
 							$scheme = parse_url($url, PHP_URL_SCHEME);
@@ -2780,7 +2780,7 @@  discard block
 block discarded – undo
2780 2780
 		for ($i = 0, $n = count($smileysfrom); $i < $n; $i++)
2781 2781
 		{
2782 2782
 			$specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES);
2783
-			$smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')) . '" class="smiley">';
2783
+			$smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')) . '" class="smiley">';
2784 2784
 
2785 2785
 			$smileyPregReplacements[$smileysfrom[$i]] = $smileyCode;
2786 2786
 
@@ -2797,7 +2797,7 @@  discard block
 block discarded – undo
2797 2797
 
2798 2798
 	// Replace away!
2799 2799
 	$message = preg_replace_callback($smileyPregSearch,
2800
-		function ($matches) use ($smileyPregReplacements)
2800
+		function($matches) use ($smileyPregReplacements)
2801 2801
 		{
2802 2802
 			return $smileyPregReplacements[$matches[1]];
2803 2803
 		}, $message);
@@ -2863,13 +2863,13 @@  discard block
 block discarded – undo
2863 2863
 	{
2864 2864
 		if (defined('SID') && SID != '')
2865 2865
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#]+?)(#[^"]*?)?$~',
2866
-				function ($m) use ($scripturl)
2866
+				function($m) use ($scripturl)
2867 2867
 				{
2868
-					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : "");
2868
+					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : "");
2869 2869
 				}, $setLocation);
2870 2870
 		else
2871 2871
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~',
2872
-				function ($m) use ($scripturl)
2872
+				function($m) use ($scripturl)
2873 2873
 				{
2874 2874
 					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : "");
2875 2875
 				}, $setLocation);
@@ -3192,7 +3192,7 @@  discard block
 block discarded – undo
3192 3192
 
3193 3193
 	// Add a generic "Are you sure?" confirmation message.
3194 3194
 	addInlineJavaScript('
3195
-	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';');
3195
+	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';');
3196 3196
 
3197 3197
 	// Now add the capping code for avatars.
3198 3198
 	if (!empty($modSettings['avatar_max_width_external']) && !empty($modSettings['avatar_max_height_external']) && !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_css_resize')
@@ -3553,7 +3553,7 @@  discard block
 block discarded – undo
3553 3553
 
3554 3554
 		else
3555 3555
 			echo '
3556
-	<script src="', $settings['theme_url'] ,'/scripts/minified', ($do_deferred ? '_deferred' : '') ,'.js', $minSeed ,'"></script>';
3556
+	<script src="', $settings['theme_url'], '/scripts/minified', ($do_deferred ? '_deferred' : ''), '.js', $minSeed, '"></script>';
3557 3557
 	}
3558 3558
 
3559 3559
 	// Inline JavaScript - Actually useful some times!
@@ -3631,14 +3631,14 @@  discard block
 block discarded – undo
3631 3631
 
3632 3632
 		else
3633 3633
 			echo '
3634
-	<link rel="stylesheet" href="', $settings['theme_url'] ,'/css/minified.css', $minSeed ,'">';
3634
+	<link rel="stylesheet" href="', $settings['theme_url'], '/css/minified.css', $minSeed, '">';
3635 3635
 	}
3636 3636
 
3637 3637
 	// Print the rest after the minified files.
3638 3638
 	if (!empty($normal))
3639 3639
 		foreach ($normal as $nf)
3640 3640
 			echo '
3641
-	<link rel="stylesheet" href="', $nf ,'">';
3641
+	<link rel="stylesheet" href="', $nf, '">';
3642 3642
 
3643 3643
 	if ($db_show_debug === true)
3644 3644
 	{
@@ -3654,7 +3654,7 @@  discard block
 block discarded – undo
3654 3654
 	<style>';
3655 3655
 
3656 3656
 		foreach ($context['css_header'] as $css)
3657
-			echo $css .'
3657
+			echo $css . '
3658 3658
 	';
3659 3659
 
3660 3660
 		echo'
@@ -3683,27 +3683,27 @@  discard block
 block discarded – undo
3683 3683
 		return false;
3684 3684
 
3685 3685
 	// Did we already did this?
3686
-	$toCache = cache_get_data('minimized_'. $settings['theme_id'] .'_'. $type, 86400);
3686
+	$toCache = cache_get_data('minimized_' . $settings['theme_id'] . '_' . $type, 86400);
3687 3687
 
3688 3688
 	// Already done?
3689 3689
 	if (!empty($toCache))
3690 3690
 		return true;
3691 3691
 
3692 3692
 	// No namespaces, sorry!
3693
-	$classType = 'MatthiasMullie\\Minify\\'. strtoupper($type);
3693
+	$classType = 'MatthiasMullie\\Minify\\' . strtoupper($type);
3694 3694
 
3695 3695
 	// Temp path.
3696
-	$cTempPath = $settings['theme_dir'] .'/'. ($type == 'css' ? 'css' : 'scripts') .'/';
3696
+	$cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/';
3697 3697
 
3698 3698
 	// What kind of file are we going to create?
3699
-	$toCreate = $cTempPath .'minified'. ($do_deferred ? '_deferred' : '') .'.'. $type;
3699
+	$toCreate = $cTempPath . 'minified' . ($do_deferred ? '_deferred' : '') . '.' . $type;
3700 3700
 
3701 3701
 	// File has to exists, if it isn't try to create it.
3702 3702
 	if ((!file_exists($toCreate) && @fopen($toCreate, 'w') === false) || !smf_chmod($toCreate))
3703 3703
 	{
3704 3704
 		loadLanguage('Errors');
3705 3705
 		log_error(sprintf($txt['file_not_created'], $toCreate), 'general');
3706
-		cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null);
3706
+		cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null);
3707 3707
 
3708 3708
 		// The process failed so roll back to print each individual file.
3709 3709
 		return $data;
@@ -3738,14 +3738,14 @@  discard block
 block discarded – undo
3738 3738
 	{
3739 3739
 		loadLanguage('Errors');
3740 3740
 		log_error(sprintf($txt['file_not_created'], $toCreate), 'general');
3741
-		cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null);
3741
+		cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null);
3742 3742
 
3743 3743
 		// The process failed so roll back to print each individual file.
3744 3744
 		return $data;
3745 3745
 	}
3746 3746
 
3747 3747
 	// And create a long lived cache entry.
3748
-	cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, $toCreate, 86400);
3748
+	cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, $toCreate, 86400);
3749 3749
 
3750 3750
 	return true;
3751 3751
 }
@@ -3805,7 +3805,7 @@  discard block
 block discarded – undo
3805 3805
 	else
3806 3806
 		$path = $modSettings['attachmentUploadDir'];
3807 3807
 
3808
-	return $path . '/' . $attachment_id . '_' . $file_hash .'.dat';
3808
+	return $path . '/' . $attachment_id . '_' . $file_hash . '.dat';
3809 3809
 }
3810 3810
 
3811 3811
 /**
@@ -3849,10 +3849,10 @@  discard block
 block discarded – undo
3849 3849
 		$valid_low = isValidIP($ip_parts[0]);
3850 3850
 		$valid_high = isValidIP($ip_parts[1]);
3851 3851
 		$count = 0;
3852
-		$mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.');
3852
+		$mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.');
3853 3853
 		$max = ($mode == ':' ? 'ffff' : '255');
3854 3854
 		$min = 0;
3855
-		if(!$valid_low)
3855
+		if (!$valid_low)
3856 3856
 		{
3857 3857
 			$ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]);
3858 3858
 			$valid_low = isValidIP($ip_parts[0]);
@@ -3866,7 +3866,7 @@  discard block
 block discarded – undo
3866 3866
 		}
3867 3867
 
3868 3868
 		$count = 0;
3869
-		if(!$valid_high)
3869
+		if (!$valid_high)
3870 3870
 		{
3871 3871
 			$ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]);
3872 3872
 			$valid_high = isValidIP($ip_parts[1]);
@@ -3879,7 +3879,7 @@  discard block
 block discarded – undo
3879 3879
 			}
3880 3880
 		}
3881 3881
 
3882
-		if($valid_high && $valid_low)
3882
+		if ($valid_high && $valid_low)
3883 3883
 		{
3884 3884
 			$ip_array['low'] = $ip_parts[0];
3885 3885
 			$ip_array['high'] = $ip_parts[1];
@@ -4061,7 +4061,7 @@  discard block
 block discarded – undo
4061 4061
 		addInlineJavaScript('
4062 4062
 	var user_menus = new smc_PopupMenu();
4063 4063
 	user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup");
4064
-	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true);
4064
+	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true);
4065 4065
 		if ($context['allow_pm'])
4066 4066
 			addInlineJavaScript('
4067 4067
 	user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true);
@@ -4681,7 +4681,7 @@  discard block
 block discarded – undo
4681 4681
 		// No? try a fallback to $sourcedir
4682 4682
 		else
4683 4683
 		{
4684
-			$absPath = $sourcedir .'/'. $file;
4684
+			$absPath = $sourcedir . '/' . $file;
4685 4685
 
4686 4686
 			if (file_exists($absPath))
4687 4687
 				require_once($absPath);
@@ -4762,15 +4762,15 @@  discard block
 block discarded – undo
4762 4762
 
4763 4763
 	// UTF-8 occurences of MS special characters
4764 4764
 	$findchars_utf8 = array(
4765
-		"\xe2\x80\x9a",	// single low-9 quotation mark
4766
-		"\xe2\x80\x9e",	// double low-9 quotation mark
4767
-		"\xe2\x80\xa6",	// horizontal ellipsis
4768
-		"\xe2\x80\x98",	// left single curly quote
4769
-		"\xe2\x80\x99",	// right single curly quote
4770
-		"\xe2\x80\x9c",	// left double curly quote
4771
-		"\xe2\x80\x9d",	// right double curly quote
4772
-		"\xe2\x80\x93",	// en dash
4773
-		"\xe2\x80\x94",	// em dash
4765
+		"\xe2\x80\x9a", // single low-9 quotation mark
4766
+		"\xe2\x80\x9e", // double low-9 quotation mark
4767
+		"\xe2\x80\xa6", // horizontal ellipsis
4768
+		"\xe2\x80\x98", // left single curly quote
4769
+		"\xe2\x80\x99", // right single curly quote
4770
+		"\xe2\x80\x9c", // left double curly quote
4771
+		"\xe2\x80\x9d", // right double curly quote
4772
+		"\xe2\x80\x93", // en dash
4773
+		"\xe2\x80\x94", // em dash
4774 4774
 	);
4775 4775
 
4776 4776
 	// windows 1252 / iso equivalents
@@ -4788,15 +4788,15 @@  discard block
 block discarded – undo
4788 4788
 
4789 4789
 	// safe replacements
4790 4790
 	$replacechars = array(
4791
-		',',	// &sbquo;
4792
-		',,',	// &bdquo;
4793
-		'...',	// &hellip;
4794
-		"'",	// &lsquo;
4795
-		"'",	// &rsquo;
4796
-		'"',	// &ldquo;
4797
-		'"',	// &rdquo;
4798
-		'-',	// &ndash;
4799
-		'--',	// &mdash;
4791
+		',', // &sbquo;
4792
+		',,', // &bdquo;
4793
+		'...', // &hellip;
4794
+		"'", // &lsquo;
4795
+		"'", // &rsquo;
4796
+		'"', // &ldquo;
4797
+		'"', // &rdquo;
4798
+		'-', // &ndash;
4799
+		'--', // &mdash;
4800 4800
 	);
4801 4801
 
4802 4802
 	if ($context['utf8'])
@@ -5215,7 +5215,7 @@  discard block
 block discarded – undo
5215 5215
  */
5216 5216
 function inet_dtop($bin)
5217 5217
 {
5218
-	if(empty($bin))
5218
+	if (empty($bin))
5219 5219
 		return '';
5220 5220
 
5221 5221
 	global $db_type;
@@ -5246,28 +5246,28 @@  discard block
 block discarded – undo
5246 5246
  */
5247 5247
 function _safe_serialize($value)
5248 5248
 {
5249
-	if(is_null($value))
5249
+	if (is_null($value))
5250 5250
 		return 'N;';
5251 5251
 
5252
-	if(is_bool($value))
5253
-		return 'b:'. (int) $value .';';
5252
+	if (is_bool($value))
5253
+		return 'b:' . (int) $value . ';';
5254 5254
 
5255
-	if(is_int($value))
5256
-		return 'i:'. $value .';';
5255
+	if (is_int($value))
5256
+		return 'i:' . $value . ';';
5257 5257
 
5258
-	if(is_float($value))
5259
-		return 'd:'. str_replace(',', '.', $value) .';';
5258
+	if (is_float($value))
5259
+		return 'd:' . str_replace(',', '.', $value) . ';';
5260 5260
 
5261
-	if(is_string($value))
5262
-		return 's:'. strlen($value) .':"'. $value .'";';
5261
+	if (is_string($value))
5262
+		return 's:' . strlen($value) . ':"' . $value . '";';
5263 5263
 
5264
-	if(is_array($value))
5264
+	if (is_array($value))
5265 5265
 	{
5266 5266
 		$out = '';
5267
-		foreach($value as $k => $v)
5267
+		foreach ($value as $k => $v)
5268 5268
 			$out .= _safe_serialize($k) . _safe_serialize($v);
5269 5269
 
5270
-		return 'a:'. count($value) .':{'. $out .'}';
5270
+		return 'a:' . count($value) . ':{' . $out . '}';
5271 5271
 	}
5272 5272
 
5273 5273
 	// safe_serialize cannot serialize resources or objects.
@@ -5309,7 +5309,7 @@  discard block
 block discarded – undo
5309 5309
 function _safe_unserialize($str)
5310 5310
 {
5311 5311
 	// Input  is not a string.
5312
-	if(empty($str) || !is_string($str))
5312
+	if (empty($str) || !is_string($str))
5313 5313
 		return false;
5314 5314
 
5315 5315
 	$stack = array();
@@ -5323,40 +5323,40 @@  discard block
 block discarded – undo
5323 5323
 	 *   3 - in array, expecting value or another array
5324 5324
 	 */
5325 5325
 	$state = 0;
5326
-	while($state != 1)
5326
+	while ($state != 1)
5327 5327
 	{
5328 5328
 		$type = isset($str[0]) ? $str[0] : '';
5329
-		if($type == '}')
5329
+		if ($type == '}')
5330 5330
 			$str = substr($str, 1);
5331 5331
 
5332
-		else if($type == 'N' && $str[1] == ';')
5332
+		else if ($type == 'N' && $str[1] == ';')
5333 5333
 		{
5334 5334
 			$value = null;
5335 5335
 			$str = substr($str, 2);
5336 5336
 		}
5337
-		else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5337
+		else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5338 5338
 		{
5339 5339
 			$value = $matches[1] == '1' ? true : false;
5340 5340
 			$str = substr($str, 4);
5341 5341
 		}
5342
-		else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5342
+		else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5343 5343
 		{
5344
-			$value = (int)$matches[1];
5344
+			$value = (int) $matches[1];
5345 5345
 			$str = $matches[2];
5346 5346
 		}
5347
-		else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5347
+		else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5348 5348
 		{
5349
-			$value = (float)$matches[1];
5349
+			$value = (float) $matches[1];
5350 5350
 			$str = $matches[3];
5351 5351
 		}
5352
-		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
5352
+		else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";')
5353 5353
 		{
5354
-			$value = substr($matches[2], 0, (int)$matches[1]);
5355
-			$str = substr($matches[2], (int)$matches[1] + 2);
5354
+			$value = substr($matches[2], 0, (int) $matches[1]);
5355
+			$str = substr($matches[2], (int) $matches[1] + 2);
5356 5356
 		}
5357
-		else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5357
+		else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5358 5358
 		{
5359
-			$expectedLength = (int)$matches[1];
5359
+			$expectedLength = (int) $matches[1];
5360 5360
 			$str = $matches[2];
5361 5361
 		}
5362 5362
 
@@ -5364,10 +5364,10 @@  discard block
 block discarded – undo
5364 5364
 		else
5365 5365
 			return false;
5366 5366
 
5367
-		switch($state)
5367
+		switch ($state)
5368 5368
 		{
5369 5369
 			case 3: // In array, expecting value or another array.
5370
-				if($type == 'a')
5370
+				if ($type == 'a')
5371 5371
 				{
5372 5372
 					$stack[] = &$list;
5373 5373
 					$list[$key] = array();
@@ -5376,7 +5376,7 @@  discard block
 block discarded – undo
5376 5376
 					$state = 2;
5377 5377
 					break;
5378 5378
 				}
5379
-				if($type != '}')
5379
+				if ($type != '}')
5380 5380
 				{
5381 5381
 					$list[$key] = $value;
5382 5382
 					$state = 2;
@@ -5387,29 +5387,29 @@  discard block
 block discarded – undo
5387 5387
 				return false;
5388 5388
 
5389 5389
 			case 2: // in array, expecting end of array or a key
5390
-				if($type == '}')
5390
+				if ($type == '}')
5391 5391
 				{
5392 5392
 					// Array size is less than expected.
5393
-					if(count($list) < end($expected))
5393
+					if (count($list) < end($expected))
5394 5394
 						return false;
5395 5395
 
5396 5396
 					unset($list);
5397
-					$list = &$stack[count($stack)-1];
5397
+					$list = &$stack[count($stack) - 1];
5398 5398
 					array_pop($stack);
5399 5399
 
5400 5400
 					// Go to terminal state if we're at the end of the root array.
5401 5401
 					array_pop($expected);
5402 5402
 
5403
-					if(count($expected) == 0)
5403
+					if (count($expected) == 0)
5404 5404
 						$state = 1;
5405 5405
 
5406 5406
 					break;
5407 5407
 				}
5408 5408
 
5409
-				if($type == 'i' || $type == 's')
5409
+				if ($type == 'i' || $type == 's')
5410 5410
 				{
5411 5411
 					// Array size exceeds expected length.
5412
-					if(count($list) >= end($expected))
5412
+					if (count($list) >= end($expected))
5413 5413
 						return false;
5414 5414
 
5415 5415
 					$key = $value;
@@ -5422,7 +5422,7 @@  discard block
 block discarded – undo
5422 5422
 
5423 5423
 			// Expecting array or value.
5424 5424
 			case 0:
5425
-				if($type == 'a')
5425
+				if ($type == 'a')
5426 5426
 				{
5427 5427
 					$data = array();
5428 5428
 					$list = &$data;
@@ -5431,7 +5431,7 @@  discard block
 block discarded – undo
5431 5431
 					break;
5432 5432
 				}
5433 5433
 
5434
-				if($type != '}')
5434
+				if ($type != '}')
5435 5435
 				{
5436 5436
 					$data = $value;
5437 5437
 					$state = 1;
@@ -5444,7 +5444,7 @@  discard block
 block discarded – undo
5444 5444
 	}
5445 5445
 
5446 5446
 	// Trailing data in input.
5447
-	if(!empty($str))
5447
+	if (!empty($str))
5448 5448
 		return false;
5449 5449
 
5450 5450
 	return $data;
@@ -5498,7 +5498,7 @@  discard block
 block discarded – undo
5498 5498
 	// Set different modes.
5499 5499
 	$chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666);
5500 5500
 
5501
-	foreach($chmodValues as $val)
5501
+	foreach ($chmodValues as $val)
5502 5502
 	{
5503 5503
 		// If it's writable, break out of the loop.
5504 5504
 		if (is_writable($file))
@@ -5533,13 +5533,13 @@  discard block
 block discarded – undo
5533 5533
 	$returnArray = @json_decode($json, $returnAsArray);
5534 5534
 
5535 5535
 	// PHP 5.3 so no json_last_error_msg()
5536
-	switch(json_last_error())
5536
+	switch (json_last_error())
5537 5537
 	{
5538 5538
 		case JSON_ERROR_NONE:
5539 5539
 			$jsonError = false;
5540 5540
 			break;
5541 5541
 		case JSON_ERROR_DEPTH:
5542
-			$jsonError =  'JSON_ERROR_DEPTH';
5542
+			$jsonError = 'JSON_ERROR_DEPTH';
5543 5543
 			break;
5544 5544
 		case JSON_ERROR_STATE_MISMATCH:
5545 5545
 			$jsonError = 'JSON_ERROR_STATE_MISMATCH';
@@ -5567,10 +5567,10 @@  discard block
 block discarded – undo
5567 5567
 		loadLanguage('Errors');
5568 5568
 
5569 5569
 		if (!empty($jsonDebug))
5570
-			log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5570
+			log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5571 5571
 
5572 5572
 		else
5573
-			log_error($txt['json_'. $jsonError], 'critical');
5573
+			log_error($txt['json_' . $jsonError], 'critical');
5574 5574
 
5575 5575
 		// Everyone expects an array.
5576 5576
 		return array();
@@ -5682,7 +5682,7 @@  discard block
 block discarded – undo
5682 5682
 		});
5683 5683
 
5684 5684
 		// Convert Punycode to Unicode
5685
-		$tlds = array_map(function ($input) {
5685
+		$tlds = array_map(function($input) {
5686 5686
 			$prefix = 'xn--';
5687 5687
 			$safe_char = 0xFFFC;
5688 5688
 			$base = 36;
@@ -5698,7 +5698,7 @@  discard block
 block discarded – undo
5698 5698
 
5699 5699
 			foreach ($enco_parts as $encoded)
5700 5700
 			{
5701
-				if (strpos($encoded,$prefix) !== 0 || strlen(trim(str_replace($prefix,'',$encoded))) == 0)
5701
+				if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0)
5702 5702
 				{
5703 5703
 					$output_parts[] = $encoded;
5704 5704
 					continue;
@@ -5709,7 +5709,7 @@  discard block
 block discarded – undo
5709 5709
 				$idx = 0;
5710 5710
 				$char = 0x80;
5711 5711
 				$decoded = array();
5712
-				$output='';
5712
+				$output = '';
5713 5713
 				$delim_pos = strrpos($encoded, '-');
5714 5714
 
5715 5715
 				if ($delim_pos > strlen($prefix))
@@ -5725,7 +5725,7 @@  discard block
 block discarded – undo
5725 5725
 
5726 5726
 				for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len)
5727 5727
 				{
5728
-					for ($old_idx = $idx, $w = 1, $k = $base; 1 ; $k += $base)
5728
+					for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base)
5729 5729
 					{
5730 5730
 						$cp = ord($encoded{$enco_idx++});
5731 5731
 						$digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base));
@@ -5766,15 +5766,15 @@  discard block
 block discarded – undo
5766 5766
 
5767 5767
 					// 2 bytes
5768 5768
 					elseif ($v < (1 << 11))
5769
-						$output .= chr(192+($v >> 6)) . chr(128+($v & 63));
5769
+						$output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63));
5770 5770
 
5771 5771
 					// 3 bytes
5772 5772
 					elseif ($v < (1 << 16))
5773
-						$output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
5773
+						$output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
5774 5774
 
5775 5775
 					// 4 bytes
5776 5776
 					elseif ($v < (1 << 21))
5777
-						$output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
5777
+						$output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
5778 5778
 
5779 5779
 					//  'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k
5780 5780
 					else
@@ -5879,7 +5879,7 @@  discard block
 block discarded – undo
5879 5879
 	}
5880 5880
 
5881 5881
 	// This recursive function creates the index array from the strings
5882
-	$add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
5882
+	$add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
5883 5883
 	{
5884 5884
 		static $depth = 0;
5885 5885
 		$depth++;
@@ -5906,7 +5906,7 @@  discard block
 block discarded – undo
5906 5906
 	};
5907 5907
 
5908 5908
 	// This recursive function turns the index array into a regular expression
5909
-	$index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex)
5909
+	$index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex)
5910 5910
 	{
5911 5911
 		static $depth = 0;
5912 5912
 		$depth++;
@@ -5930,11 +5930,11 @@  discard block
 block discarded – undo
5930 5930
 
5931 5931
 				if (count(array_keys($value)) == 1)
5932 5932
 				{
5933
-					$new_key_array = explode('(?'.'>', $sub_regex);
5933
+					$new_key_array = explode('(?' . '>', $sub_regex);
5934 5934
 					$new_key .= $new_key_array[0];
5935 5935
 				}
5936 5936
 				else
5937
-					$sub_regex = '(?'.'>' . $sub_regex . ')';
5937
+					$sub_regex = '(?' . '>' . $sub_regex . ')';
5938 5938
 			}
5939 5939
 
5940 5940
 			if ($depth > 1)
@@ -5977,10 +5977,10 @@  discard block
 block discarded – undo
5977 5977
 	{
5978 5978
 		$regex = array();
5979 5979
 		while (!empty($index))
5980
-			$regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')';
5980
+			$regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')';
5981 5981
 	}
5982 5982
 	else
5983
-		$regex = '(?'.'>' . $index_to_regex($index, $delim) . ')';
5983
+		$regex = '(?' . '>' . $index_to_regex($index, $delim) . ')';
5984 5984
 
5985 5985
 	// Restore PHP's internal character encoding to whatever it was originally
5986 5986
 	if (!empty($current_encoding))
Please login to merge, or discard this patch.
Braces   +1310 added lines, -973 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 4
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * Update some basic statistics.
@@ -122,10 +123,11 @@  discard block
 block discarded – undo
122 123
 						$smcFunc['db_free_result']($result);
123 124
 
124 125
 						// Add this to the number of unapproved members
125
-						if (!empty($changes['unapprovedMembers']))
126
-							$changes['unapprovedMembers'] += $coppa_approvals;
127
-						else
128
-							$changes['unapprovedMembers'] = $coppa_approvals;
126
+						if (!empty($changes['unapprovedMembers'])) {
127
+													$changes['unapprovedMembers'] += $coppa_approvals;
128
+						} else {
129
+													$changes['unapprovedMembers'] = $coppa_approvals;
130
+						}
129 131
 					}
130 132
 				}
131 133
 			}
@@ -133,9 +135,9 @@  discard block
 block discarded – undo
133 135
 			break;
134 136
 
135 137
 		case 'message':
136
-			if ($parameter1 === true && $parameter2 !== null)
137
-				updateSettings(array('totalMessages' => true, 'maxMsgID' => $parameter2), true);
138
-			else
138
+			if ($parameter1 === true && $parameter2 !== null) {
139
+							updateSettings(array('totalMessages' => true, 'maxMsgID' => $parameter2), true);
140
+			} else
139 141
 			{
140 142
 				// SUM and MAX on a smaller table is better for InnoDB tables.
141 143
 				$result = $smcFunc['db_query']('', '
@@ -175,23 +177,25 @@  discard block
 block discarded – undo
175 177
 				$parameter2 = text2words($parameter2);
176 178
 
177 179
 				$inserts = array();
178
-				foreach ($parameter2 as $word)
179
-					$inserts[] = array($word, $parameter1);
180
+				foreach ($parameter2 as $word) {
181
+									$inserts[] = array($word, $parameter1);
182
+				}
180 183
 
181
-				if (!empty($inserts))
182
-					$smcFunc['db_insert']('ignore',
184
+				if (!empty($inserts)) {
185
+									$smcFunc['db_insert']('ignore',
183 186
 						'{db_prefix}log_search_subjects',
184 187
 						array('word' => 'string', 'id_topic' => 'int'),
185 188
 						$inserts,
186 189
 						array('word', 'id_topic')
187 190
 					);
191
+				}
188 192
 			}
189 193
 			break;
190 194
 
191 195
 		case 'topic':
192
-			if ($parameter1 === true)
193
-				updateSettings(array('totalTopics' => true), true);
194
-			else
196
+			if ($parameter1 === true) {
197
+							updateSettings(array('totalTopics' => true), true);
198
+			} else
195 199
 			{
196 200
 				// Get the number of topics - a SUM is better for InnoDB tables.
197 201
 				// We also ignore the recycle bin here because there will probably be a bunch of one-post topics there.
@@ -212,8 +216,9 @@  discard block
 block discarded – undo
212 216
 
213 217
 		case 'postgroups':
214 218
 			// Parameter two is the updated columns: we should check to see if we base groups off any of these.
215
-			if ($parameter2 !== null && !in_array('posts', $parameter2))
216
-				return;
219
+			if ($parameter2 !== null && !in_array('posts', $parameter2)) {
220
+							return;
221
+			}
217 222
 
218 223
 			$postgroups = cache_get_data('updateStats:postgroups', 360);
219 224
 			if ($postgroups == null || $parameter1 == null)
@@ -228,8 +233,9 @@  discard block
 block discarded – undo
228 233
 					)
229 234
 				);
230 235
 				$postgroups = array();
231
-				while ($row = $smcFunc['db_fetch_assoc']($request))
232
-					$postgroups[$row['id_group']] = $row['min_posts'];
236
+				while ($row = $smcFunc['db_fetch_assoc']($request)) {
237
+									$postgroups[$row['id_group']] = $row['min_posts'];
238
+				}
233 239
 				$smcFunc['db_free_result']($request);
234 240
 
235 241
 				// Sort them this way because if it's done with MySQL it causes a filesort :(.
@@ -239,8 +245,9 @@  discard block
 block discarded – undo
239 245
 			}
240 246
 
241 247
 			// Oh great, they've screwed their post groups.
242
-			if (empty($postgroups))
243
-				return;
248
+			if (empty($postgroups)) {
249
+							return;
250
+			}
244 251
 
245 252
 			// Set all membergroups from most posts to least posts.
246 253
 			$conditions = '';
@@ -298,10 +305,9 @@  discard block
 block discarded – undo
298 305
 	{
299 306
 		$condition = 'id_member IN ({array_int:members})';
300 307
 		$parameters['members'] = $members;
301
-	}
302
-	elseif ($members === null)
303
-		$condition = '1=1';
304
-	else
308
+	} elseif ($members === null) {
309
+			$condition = '1=1';
310
+	} else
305 311
 	{
306 312
 		$condition = 'id_member = {int:member}';
307 313
 		$parameters['member'] = $members;
@@ -341,9 +347,9 @@  discard block
 block discarded – undo
341 347
 		if (count($vars_to_integrate) != 0)
342 348
 		{
343 349
 			// Fetch a list of member_names if necessary
344
-			if ((!is_array($members) && $members === $user_info['id']) || (is_array($members) && count($members) == 1 && in_array($user_info['id'], $members)))
345
-				$member_names = array($user_info['username']);
346
-			else
350
+			if ((!is_array($members) && $members === $user_info['id']) || (is_array($members) && count($members) == 1 && in_array($user_info['id'], $members))) {
351
+							$member_names = array($user_info['username']);
352
+			} else
347 353
 			{
348 354
 				$member_names = array();
349 355
 				$request = $smcFunc['db_query']('', '
@@ -352,14 +358,16 @@  discard block
 block discarded – undo
352 358
 					WHERE ' . $condition,
353 359
 					$parameters
354 360
 				);
355
-				while ($row = $smcFunc['db_fetch_assoc']($request))
356
-					$member_names[] = $row['member_name'];
361
+				while ($row = $smcFunc['db_fetch_assoc']($request)) {
362
+									$member_names[] = $row['member_name'];
363
+				}
357 364
 				$smcFunc['db_free_result']($request);
358 365
 			}
359 366
 
360
-			if (!empty($member_names))
361
-				foreach ($vars_to_integrate as $var)
367
+			if (!empty($member_names)) {
368
+							foreach ($vars_to_integrate as $var)
362 369
 					call_integration_hook('integrate_change_member_data', array($member_names, $var, &$data[$var], &$knownInts, &$knownFloats));
370
+			}
363 371
 		}
364 372
 	}
365 373
 
@@ -367,16 +375,17 @@  discard block
 block discarded – undo
367 375
 	foreach ($data as $var => $val)
368 376
 	{
369 377
 		$type = 'string';
370
-		if (in_array($var, $knownInts))
371
-			$type = 'int';
372
-		elseif (in_array($var, $knownFloats))
373
-			$type = 'float';
374
-		elseif ($var == 'birthdate')
375
-			$type = 'date';
376
-		elseif ($var == 'member_ip')
377
-			$type = 'inet';
378
-		elseif ($var == 'member_ip2')
379
-			$type = 'inet';
378
+		if (in_array($var, $knownInts)) {
379
+					$type = 'int';
380
+		} elseif (in_array($var, $knownFloats)) {
381
+					$type = 'float';
382
+		} elseif ($var == 'birthdate') {
383
+					$type = 'date';
384
+		} elseif ($var == 'member_ip') {
385
+					$type = 'inet';
386
+		} elseif ($var == 'member_ip2') {
387
+					$type = 'inet';
388
+		}
380 389
 
381 390
 		// Doing an increment?
382 391
 		if ($type == 'int' && ($val === '+' || $val === '-'))
@@ -390,8 +399,9 @@  discard block
 block discarded – undo
390 399
 		{
391 400
 			if (preg_match('~^' . $var . ' (\+ |- |\+ -)([\d]+)~', $val, $match))
392 401
 			{
393
-				if ($match[1] != '+ ')
394
-					$val = 'CASE WHEN ' . $var . ' <= ' . abs($match[2]) . ' THEN 0 ELSE ' . $val . ' END';
402
+				if ($match[1] != '+ ') {
403
+									$val = 'CASE WHEN ' . $var . ' <= ' . abs($match[2]) . ' THEN 0 ELSE ' . $val . ' END';
404
+				}
395 405
 				$type = 'raw';
396 406
 			}
397 407
 		}
@@ -412,8 +422,9 @@  discard block
 block discarded – undo
412 422
 	// Clear any caching?
413 423
 	if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2 && !empty($members))
414 424
 	{
415
-		if (!is_array($members))
416
-			$members = array($members);
425
+		if (!is_array($members)) {
426
+					$members = array($members);
427
+		}
417 428
 
418 429
 		foreach ($members as $member)
419 430
 		{
@@ -446,29 +457,32 @@  discard block
 block discarded – undo
446 457
 {
447 458
 	global $modSettings, $smcFunc;
448 459
 
449
-	if (empty($changeArray) || !is_array($changeArray))
450
-		return;
460
+	if (empty($changeArray) || !is_array($changeArray)) {
461
+			return;
462
+	}
451 463
 
452 464
 	$toRemove = array();
453 465
 
454 466
 	// Go check if there is any setting to be removed.
455
-	foreach ($changeArray as $k => $v)
456
-		if ($v === null)
467
+	foreach ($changeArray as $k => $v) {
468
+			if ($v === null)
457 469
 		{
458 470
 			// Found some, remove them from the original array and add them to ours.
459 471
 			unset($changeArray[$k]);
472
+	}
460 473
 			$toRemove[] = $k;
461 474
 		}
462 475
 
463 476
 	// Proceed with the deletion.
464
-	if (!empty($toRemove))
465
-		$smcFunc['db_query']('', '
477
+	if (!empty($toRemove)) {
478
+			$smcFunc['db_query']('', '
466 479
 			DELETE FROM {db_prefix}settings
467 480
 			WHERE variable IN ({array_string:remove})',
468 481
 			array(
469 482
 				'remove' => $toRemove,
470 483
 			)
471 484
 		);
485
+	}
472 486
 
473 487
 	// In some cases, this may be better and faster, but for large sets we don't want so many UPDATEs.
474 488
 	if ($update)
@@ -497,19 +511,22 @@  discard block
 block discarded – undo
497 511
 	foreach ($changeArray as $variable => $value)
498 512
 	{
499 513
 		// Don't bother if it's already like that ;).
500
-		if (isset($modSettings[$variable]) && $modSettings[$variable] == $value)
501
-			continue;
514
+		if (isset($modSettings[$variable]) && $modSettings[$variable] == $value) {
515
+					continue;
516
+		}
502 517
 		// If the variable isn't set, but would only be set to nothing'ness, then don't bother setting it.
503
-		elseif (!isset($modSettings[$variable]) && empty($value))
504
-			continue;
518
+		elseif (!isset($modSettings[$variable]) && empty($value)) {
519
+					continue;
520
+		}
505 521
 
506 522
 		$replaceArray[] = array($variable, $value);
507 523
 
508 524
 		$modSettings[$variable] = $value;
509 525
 	}
510 526
 
511
-	if (empty($replaceArray))
512
-		return;
527
+	if (empty($replaceArray)) {
528
+			return;
529
+	}
513 530
 
514 531
 	$smcFunc['db_insert']('replace',
515 532
 		'{db_prefix}settings',
@@ -555,14 +572,17 @@  discard block
 block discarded – undo
555 572
 	$start_invalid = $start < 0;
556 573
 
557 574
 	// Make sure $start is a proper variable - not less than 0.
558
-	if ($start_invalid)
559
-		$start = 0;
575
+	if ($start_invalid) {
576
+			$start = 0;
577
+	}
560 578
 	// Not greater than the upper bound.
561
-	elseif ($start >= $max_value)
562
-		$start = max(0, (int) $max_value - (((int) $max_value % (int) $num_per_page) == 0 ? $num_per_page : ((int) $max_value % (int) $num_per_page)));
579
+	elseif ($start >= $max_value) {
580
+			$start = max(0, (int) $max_value - (((int) $max_value % (int) $num_per_page) == 0 ? $num_per_page : ((int) $max_value % (int) $num_per_page)));
581
+	}
563 582
 	// And it has to be a multiple of $num_per_page!
564
-	else
565
-		$start = max(0, (int) $start - ((int) $start % (int) $num_per_page));
583
+	else {
584
+			$start = max(0, (int) $start - ((int) $start % (int) $num_per_page));
585
+	}
566 586
 
567 587
 	$context['current_page'] = $start / $num_per_page;
568 588
 
@@ -592,77 +612,87 @@  discard block
 block discarded – undo
592 612
 
593 613
 		// Show all the pages.
594 614
 		$display_page = 1;
595
-		for ($counter = 0; $counter < $max_value; $counter += $num_per_page)
596
-			$pageindex .= $start == $counter && !$start_invalid ? sprintf($settings['page_index']['current_page'], $display_page++) : sprintf($base_link, $counter, $display_page++);
615
+		for ($counter = 0; $counter < $max_value; $counter += $num_per_page) {
616
+					$pageindex .= $start == $counter && !$start_invalid ? sprintf($settings['page_index']['current_page'], $display_page++) : sprintf($base_link, $counter, $display_page++);
617
+		}
597 618
 
598 619
 		// Show the right arrow.
599 620
 		$display_page = ($start + $num_per_page) > $max_value ? $max_value : ($start + $num_per_page);
600
-		if ($start != $counter - $max_value && !$start_invalid)
601
-			$pageindex .= $display_page > $counter - $num_per_page ? ' ' : sprintf($base_link, $display_page, $settings['page_index']['next_page']);
602
-	}
603
-	else
621
+		if ($start != $counter - $max_value && !$start_invalid) {
622
+					$pageindex .= $display_page > $counter - $num_per_page ? ' ' : sprintf($base_link, $display_page, $settings['page_index']['next_page']);
623
+		}
624
+	} else
604 625
 	{
605 626
 		// If they didn't enter an odd value, pretend they did.
606 627
 		$PageContiguous = (int) ($modSettings['compactTopicPagesContiguous'] - ($modSettings['compactTopicPagesContiguous'] % 2)) / 2;
607 628
 
608 629
 		// Show the "prev page" link. (>prev page< 1 ... 6 7 [8] 9 10 ... 15 next page)
609
-		if (!empty($start) && $show_prevnext)
610
-			$pageindex .= sprintf($base_link, $start - $num_per_page, $settings['page_index']['previous_page']);
611
-		else
612
-			$pageindex .= '';
630
+		if (!empty($start) && $show_prevnext) {
631
+					$pageindex .= sprintf($base_link, $start - $num_per_page, $settings['page_index']['previous_page']);
632
+		} else {
633
+					$pageindex .= '';
634
+		}
613 635
 
614 636
 		// Show the first page. (prev page >1< ... 6 7 [8] 9 10 ... 15)
615
-		if ($start > $num_per_page * $PageContiguous)
616
-			$pageindex .= sprintf($base_link, 0, '1');
637
+		if ($start > $num_per_page * $PageContiguous) {
638
+					$pageindex .= sprintf($base_link, 0, '1');
639
+		}
617 640
 
618 641
 		// Show the ... after the first page.  (prev page 1 >...< 6 7 [8] 9 10 ... 15 next page)
619
-		if ($start > $num_per_page * ($PageContiguous + 1))
620
-			$pageindex .= strtr($settings['page_index']['expand_pages'], array(
642
+		if ($start > $num_per_page * ($PageContiguous + 1)) {
643
+					$pageindex .= strtr($settings['page_index']['expand_pages'], array(
621 644
 				'{LINK}' => JavaScriptEscape($smcFunc['htmlspecialchars']($base_link)),
622 645
 				'{FIRST_PAGE}' => $num_per_page,
623 646
 				'{LAST_PAGE}' => $start - $num_per_page * $PageContiguous,
624 647
 				'{PER_PAGE}' => $num_per_page,
625 648
 			));
649
+		}
626 650
 
627 651
 		// Show the pages before the current one. (prev page 1 ... >6 7< [8] 9 10 ... 15 next page)
628
-		for ($nCont = $PageContiguous; $nCont >= 1; $nCont--)
629
-			if ($start >= $num_per_page * $nCont)
652
+		for ($nCont = $PageContiguous; $nCont >= 1; $nCont--) {
653
+					if ($start >= $num_per_page * $nCont)
630 654
 			{
631 655
 				$tmpStart = $start - $num_per_page * $nCont;
656
+		}
632 657
 				$pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
633 658
 			}
634 659
 
635 660
 		// Show the current page. (prev page 1 ... 6 7 >[8]< 9 10 ... 15 next page)
636
-		if (!$start_invalid)
637
-			$pageindex .= sprintf($settings['page_index']['current_page'], $start / $num_per_page + 1);
638
-		else
639
-			$pageindex .= sprintf($base_link, $start, $start / $num_per_page + 1);
661
+		if (!$start_invalid) {
662
+					$pageindex .= sprintf($settings['page_index']['current_page'], $start / $num_per_page + 1);
663
+		} else {
664
+					$pageindex .= sprintf($base_link, $start, $start / $num_per_page + 1);
665
+		}
640 666
 
641 667
 		// Show the pages after the current one... (prev page 1 ... 6 7 [8] >9 10< ... 15 next page)
642 668
 		$tmpMaxPages = (int) (($max_value - 1) / $num_per_page) * $num_per_page;
643
-		for ($nCont = 1; $nCont <= $PageContiguous; $nCont++)
644
-			if ($start + $num_per_page * $nCont <= $tmpMaxPages)
669
+		for ($nCont = 1; $nCont <= $PageContiguous; $nCont++) {
670
+					if ($start + $num_per_page * $nCont <= $tmpMaxPages)
645 671
 			{
646 672
 				$tmpStart = $start + $num_per_page * $nCont;
673
+		}
647 674
 				$pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
648 675
 			}
649 676
 
650 677
 		// Show the '...' part near the end. (prev page 1 ... 6 7 [8] 9 10 >...< 15 next page)
651
-		if ($start + $num_per_page * ($PageContiguous + 1) < $tmpMaxPages)
652
-			$pageindex .= strtr($settings['page_index']['expand_pages'], array(
678
+		if ($start + $num_per_page * ($PageContiguous + 1) < $tmpMaxPages) {
679
+					$pageindex .= strtr($settings['page_index']['expand_pages'], array(
653 680
 				'{LINK}' => JavaScriptEscape($smcFunc['htmlspecialchars']($base_link)),
654 681
 				'{FIRST_PAGE}' => $start + $num_per_page * ($PageContiguous + 1),
655 682
 				'{LAST_PAGE}' => $tmpMaxPages,
656 683
 				'{PER_PAGE}' => $num_per_page,
657 684
 			));
685
+		}
658 686
 
659 687
 		// Show the last number in the list. (prev page 1 ... 6 7 [8] 9 10 ... >15<  next page)
660
-		if ($start + $num_per_page * $PageContiguous < $tmpMaxPages)
661
-			$pageindex .= sprintf($base_link, $tmpMaxPages, $tmpMaxPages / $num_per_page + 1);
688
+		if ($start + $num_per_page * $PageContiguous < $tmpMaxPages) {
689
+					$pageindex .= sprintf($base_link, $tmpMaxPages, $tmpMaxPages / $num_per_page + 1);
690
+		}
662 691
 
663 692
 		// Show the "next page" link. (prev page 1 ... 6 7 [8] 9 10 ... 15 >next page<)
664
-		if ($start != $tmpMaxPages && $show_prevnext)
665
-			$pageindex .= sprintf($base_link, $start + $num_per_page, $settings['page_index']['next_page']);
693
+		if ($start != $tmpMaxPages && $show_prevnext) {
694
+					$pageindex .= sprintf($base_link, $start + $num_per_page, $settings['page_index']['next_page']);
695
+		}
666 696
 	}
667 697
 	$pageindex .= $settings['page_index']['extra_after'];
668 698
 
@@ -688,8 +718,9 @@  discard block
 block discarded – undo
688 718
 	if ($decimal_separator === null)
689 719
 	{
690 720
 		// Not set for whatever reason?
691
-		if (empty($txt['number_format']) || preg_match('~^1([^\d]*)?234([^\d]*)(0*?)$~', $txt['number_format'], $matches) != 1)
692
-			return $number;
721
+		if (empty($txt['number_format']) || preg_match('~^1([^\d]*)?234([^\d]*)(0*?)$~', $txt['number_format'], $matches) != 1) {
722
+					return $number;
723
+		}
693 724
 
694 725
 		// Cache these each load...
695 726
 		$thousands_separator = $matches[1];
@@ -723,17 +754,20 @@  discard block
 block discarded – undo
723 754
 	static $unsupportedFormats, $finalizedFormats;
724 755
 
725 756
 	// Offset the time.
726
-	if (!$offset_type)
727
-		$time = $log_time + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600;
757
+	if (!$offset_type) {
758
+			$time = $log_time + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600;
759
+	}
728 760
 	// Just the forum offset?
729
-	elseif ($offset_type == 'forum')
730
-		$time = $log_time + $modSettings['time_offset'] * 3600;
731
-	else
732
-		$time = $log_time;
761
+	elseif ($offset_type == 'forum') {
762
+			$time = $log_time + $modSettings['time_offset'] * 3600;
763
+	} else {
764
+			$time = $log_time;
765
+	}
733 766
 
734 767
 	// We can't have a negative date (on Windows, at least.)
735
-	if ($log_time < 0)
736
-		$log_time = 0;
768
+	if ($log_time < 0) {
769
+			$log_time = 0;
770
+	}
737 771
 
738 772
 	// Today and Yesterday?
739 773
 	if ($modSettings['todayMod'] >= 1 && $show_today === true)
@@ -750,24 +784,27 @@  discard block
 block discarded – undo
750 784
 		{
751 785
 			$h = strpos($user_info['time_format'], '%l') === false ? '%I' : '%l';
752 786
 			$today_fmt = $h . ':%M' . $s . ' %p';
787
+		} else {
788
+					$today_fmt = '%H:%M' . $s;
753 789
 		}
754
-		else
755
-			$today_fmt = '%H:%M' . $s;
756 790
 
757 791
 		// Same day of the year, same year.... Today!
758
-		if ($then['yday'] == $now['yday'] && $then['year'] == $now['year'])
759
-			return $txt['today'] . timeformat($log_time, $today_fmt, $offset_type);
792
+		if ($then['yday'] == $now['yday'] && $then['year'] == $now['year']) {
793
+					return $txt['today'] . timeformat($log_time, $today_fmt, $offset_type);
794
+		}
760 795
 
761 796
 		// Day-of-year is one less and same year, or it's the first of the year and that's the last of the year...
762
-		if ($modSettings['todayMod'] == '2' && (($then['yday'] == $now['yday'] - 1 && $then['year'] == $now['year']) || ($now['yday'] == 0 && $then['year'] == $now['year'] - 1) && $then['mon'] == 12 && $then['mday'] == 31))
763
-			return $txt['yesterday'] . timeformat($log_time, $today_fmt, $offset_type);
797
+		if ($modSettings['todayMod'] == '2' && (($then['yday'] == $now['yday'] - 1 && $then['year'] == $now['year']) || ($now['yday'] == 0 && $then['year'] == $now['year'] - 1) && $then['mon'] == 12 && $then['mday'] == 31)) {
798
+					return $txt['yesterday'] . timeformat($log_time, $today_fmt, $offset_type);
799
+		}
764 800
 	}
765 801
 
766 802
 	$str = !is_bool($show_today) ? $show_today : $user_info['time_format'];
767 803
 
768 804
 	// Use the cached formats if available
769
-	if (is_null($finalizedFormats))
770
-		$finalizedFormats = (array) cache_get_data('timeformatstrings', 86400);
805
+	if (is_null($finalizedFormats)) {
806
+			$finalizedFormats = (array) cache_get_data('timeformatstrings', 86400);
807
+	}
771 808
 
772 809
 	// Make a supported version for this format if we don't already have one
773 810
 	if (empty($finalizedFormats[$str]))
@@ -796,8 +833,9 @@  discard block
 block discarded – undo
796 833
 		);
797 834
 
798 835
 		// No need to do this part again if we already did it once
799
-		if (is_null($unsupportedFormats))
800
-			$unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400);
836
+		if (is_null($unsupportedFormats)) {
837
+					$unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400);
838
+		}
801 839
 		if (empty($unsupportedFormats))
802 840
 		{
803 841
 			foreach($strftimeFormatSubstitutions as $format => $substitution)
@@ -806,20 +844,23 @@  discard block
 block discarded – undo
806 844
 
807 845
 				// Windows will return false for unsupported formats
808 846
 				// Other operating systems return the format string as a literal
809
-				if ($value === false || $value === $format)
810
-					$unsupportedFormats[] = $format;
847
+				if ($value === false || $value === $format) {
848
+									$unsupportedFormats[] = $format;
849
+				}
811 850
 			}
812 851
 			cache_put_data('unsupportedtimeformats', $unsupportedFormats, 86400);
813 852
 		}
814 853
 
815 854
 		// Windows needs extra help if $timeformat contains something completely invalid, e.g. '%Q'
816
-		if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')
817
-			$timeformat = preg_replace('~%(?!' . implode('|', array_keys($strftimeFormatSubstitutions)) . ')~', '&#37;', $timeformat);
855
+		if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
856
+					$timeformat = preg_replace('~%(?!' . implode('|', array_keys($strftimeFormatSubstitutions)) . ')~', '&#37;', $timeformat);
857
+		}
818 858
 
819 859
 		// Substitute unsupported formats with supported ones
820
-		if (!empty($unsupportedFormats))
821
-			while (preg_match('~%(' . implode('|', $unsupportedFormats) . ')~', $timeformat, $matches))
860
+		if (!empty($unsupportedFormats)) {
861
+					while (preg_match('~%(' . implode('|', $unsupportedFormats) . ')~', $timeformat, $matches))
822 862
 				$timeformat = str_replace($matches[0], $strftimeFormatSubstitutions[$matches[1]], $timeformat);
863
+		}
823 864
 
824 865
 		// Remember this so we don't need to do it again
825 866
 		$finalizedFormats[$str] = $timeformat;
@@ -828,33 +869,39 @@  discard block
 block discarded – undo
828 869
 
829 870
 	$str = $finalizedFormats[$str];
830 871
 
831
-	if (!isset($locale_cache))
832
-		$locale_cache = setlocale(LC_TIME, $txt['lang_locale']);
872
+	if (!isset($locale_cache)) {
873
+			$locale_cache = setlocale(LC_TIME, $txt['lang_locale']);
874
+	}
833 875
 
834 876
 	if ($locale_cache !== false)
835 877
 	{
836 878
 		// Check if another process changed the locale
837
-		if ($process_safe === true && setlocale(LC_TIME, '0') != $locale_cache)
838
-			setlocale(LC_TIME, $txt['lang_locale']);
879
+		if ($process_safe === true && setlocale(LC_TIME, '0') != $locale_cache) {
880
+					setlocale(LC_TIME, $txt['lang_locale']);
881
+		}
839 882
 
840
-		if (!isset($non_twelve_hour))
841
-			$non_twelve_hour = trim(strftime('%p')) === '';
842
-		if ($non_twelve_hour && strpos($str, '%p') !== false)
843
-			$str = str_replace('%p', (strftime('%H', $time) < 12 ? $txt['time_am'] : $txt['time_pm']), $str);
883
+		if (!isset($non_twelve_hour)) {
884
+					$non_twelve_hour = trim(strftime('%p')) === '';
885
+		}
886
+		if ($non_twelve_hour && strpos($str, '%p') !== false) {
887
+					$str = str_replace('%p', (strftime('%H', $time) < 12 ? $txt['time_am'] : $txt['time_pm']), $str);
888
+		}
844 889
 
845
-		foreach (array('%a', '%A', '%b', '%B') as $token)
846
-			if (strpos($str, $token) !== false)
890
+		foreach (array('%a', '%A', '%b', '%B') as $token) {
891
+					if (strpos($str, $token) !== false)
847 892
 				$str = str_replace($token, strftime($token, $time), $str);
848
-	}
849
-	else
893
+		}
894
+	} else
850 895
 	{
851 896
 		// Do-it-yourself time localization.  Fun.
852
-		foreach (array('%a' => 'days_short', '%A' => 'days', '%b' => 'months_short', '%B' => 'months') as $token => $text_label)
853
-			if (strpos($str, $token) !== false)
897
+		foreach (array('%a' => 'days_short', '%A' => 'days', '%b' => 'months_short', '%B' => 'months') as $token => $text_label) {
898
+					if (strpos($str, $token) !== false)
854 899
 				$str = str_replace($token, $txt[$text_label][(int) strftime($token === '%a' || $token === '%A' ? '%w' : '%m', $time)], $str);
900
+		}
855 901
 
856
-		if (strpos($str, '%p') !== false)
857
-			$str = str_replace('%p', (strftime('%H', $time) < 12 ? $txt['time_am'] : $txt['time_pm']), $str);
902
+		if (strpos($str, '%p') !== false) {
903
+					$str = str_replace('%p', (strftime('%H', $time) < 12 ? $txt['time_am'] : $txt['time_pm']), $str);
904
+		}
858 905
 	}
859 906
 
860 907
 	// Format the time and then restore any literal percent characters
@@ -877,16 +924,19 @@  discard block
 block discarded – undo
877 924
 	static $translation = array();
878 925
 
879 926
 	// Determine the character set... Default to UTF-8
880
-	if (empty($context['character_set']))
881
-		$charset = 'UTF-8';
927
+	if (empty($context['character_set'])) {
928
+			$charset = 'UTF-8';
929
+	}
882 930
 	// Use ISO-8859-1 in place of non-supported ISO-8859 charsets...
883
-	elseif (strpos($context['character_set'], 'ISO-8859-') !== false && !in_array($context['character_set'], array('ISO-8859-5', 'ISO-8859-15')))
884
-		$charset = 'ISO-8859-1';
885
-	else
886
-		$charset = $context['character_set'];
931
+	elseif (strpos($context['character_set'], 'ISO-8859-') !== false && !in_array($context['character_set'], array('ISO-8859-5', 'ISO-8859-15'))) {
932
+			$charset = 'ISO-8859-1';
933
+	} else {
934
+			$charset = $context['character_set'];
935
+	}
887 936
 
888
-	if (empty($translation))
889
-		$translation = array_flip(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES, $charset)) + array('&#039;' => '\'', '&#39;' => '\'', '&nbsp;' => ' ');
937
+	if (empty($translation)) {
938
+			$translation = array_flip(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES, $charset)) + array('&#039;' => '\'', '&#39;' => '\'', '&nbsp;' => ' ');
939
+	}
890 940
 
891 941
 	return strtr($string, $translation);
892 942
 }
@@ -908,8 +958,9 @@  discard block
 block discarded – undo
908 958
 	global $smcFunc;
909 959
 
910 960
 	// It was already short enough!
911
-	if ($smcFunc['strlen']($subject) <= $len)
912
-		return $subject;
961
+	if ($smcFunc['strlen']($subject) <= $len) {
962
+			return $subject;
963
+	}
913 964
 
914 965
 	// Shorten it by the length it was too long, and strip off junk from the end.
915 966
 	return $smcFunc['substr']($subject, 0, $len) . '...';
@@ -928,10 +979,11 @@  discard block
 block discarded – undo
928 979
 {
929 980
 	global $user_info, $modSettings;
930 981
 
931
-	if ($timestamp === null)
932
-		$timestamp = time();
933
-	elseif ($timestamp == 0)
934
-		return 0;
982
+	if ($timestamp === null) {
983
+			$timestamp = time();
984
+	} elseif ($timestamp == 0) {
985
+			return 0;
986
+	}
935 987
 
936 988
 	return $timestamp + ($modSettings['time_offset'] + ($use_user_offset ? $user_info['time_offset'] : 0)) * 3600;
937 989
 }
@@ -960,8 +1012,9 @@  discard block
 block discarded – undo
960 1012
 		$array[$i] = $array[$j];
961 1013
 		$array[$j] = $temp;
962 1014
 
963
-		for ($i = 1; $p[$i] == 0; $i++)
964
-			$p[$i] = 1;
1015
+		for ($i = 1; $p[$i] == 0; $i++) {
1016
+					$p[$i] = 1;
1017
+		}
965 1018
 
966 1019
 		$orders[] = $array;
967 1020
 	}
@@ -993,12 +1046,14 @@  discard block
 block discarded – undo
993 1046
 	static $disabled;
994 1047
 
995 1048
 	// Don't waste cycles
996
-	if ($message === '')
997
-		return '';
1049
+	if ($message === '') {
1050
+			return '';
1051
+	}
998 1052
 
999 1053
 	// Just in case it wasn't determined yet whether UTF-8 is enabled.
1000
-	if (!isset($context['utf8']))
1001
-		$context['utf8'] = (empty($modSettings['global_character_set']) ? $txt['lang_character_set'] : $modSettings['global_character_set']) === 'UTF-8';
1054
+	if (!isset($context['utf8'])) {
1055
+			$context['utf8'] = (empty($modSettings['global_character_set']) ? $txt['lang_character_set'] : $modSettings['global_character_set']) === 'UTF-8';
1056
+	}
1002 1057
 
1003 1058
 	// Clean up any cut/paste issues we may have
1004 1059
 	$message = sanitizeMSCutPaste($message);
@@ -1010,13 +1065,15 @@  discard block
 block discarded – undo
1010 1065
 		return $message;
1011 1066
 	}
1012 1067
 
1013
-	if ($smileys !== null && ($smileys == '1' || $smileys == '0'))
1014
-		$smileys = (bool) $smileys;
1068
+	if ($smileys !== null && ($smileys == '1' || $smileys == '0')) {
1069
+			$smileys = (bool) $smileys;
1070
+	}
1015 1071
 
1016 1072
 	if (empty($modSettings['enableBBC']) && $message !== false)
1017 1073
 	{
1018
-		if ($smileys === true)
1019
-			parsesmileys($message);
1074
+		if ($smileys === true) {
1075
+					parsesmileys($message);
1076
+		}
1020 1077
 
1021 1078
 		return $message;
1022 1079
 	}
@@ -1029,8 +1086,9 @@  discard block
 block discarded – undo
1029 1086
 	}
1030 1087
 
1031 1088
 	// Ensure $modSettings['tld_regex'] contains a valid regex for the autolinker
1032
-	if (!empty($modSettings['autoLinkUrls']))
1033
-		set_tld_regex();
1089
+	if (!empty($modSettings['autoLinkUrls'])) {
1090
+			set_tld_regex();
1091
+	}
1034 1092
 
1035 1093
 	// Allow mods access before entering the main parse_bbc loop
1036 1094
 	call_integration_hook('integrate_pre_parsebbc', array(&$message, &$smileys, &$cache_id, &$parse_tags));
@@ -1044,12 +1102,14 @@  discard block
 block discarded – undo
1044 1102
 
1045 1103
 			$temp = explode(',', strtolower($modSettings['disabledBBC']));
1046 1104
 
1047
-			foreach ($temp as $tag)
1048
-				$disabled[trim($tag)] = true;
1105
+			foreach ($temp as $tag) {
1106
+							$disabled[trim($tag)] = true;
1107
+			}
1049 1108
 		}
1050 1109
 
1051
-		if (empty($modSettings['enableEmbeddedFlash']))
1052
-			$disabled['flash'] = true;
1110
+		if (empty($modSettings['enableEmbeddedFlash'])) {
1111
+					$disabled['flash'] = true;
1112
+		}
1053 1113
 
1054 1114
 		/* The following bbc are formatted as an array, with keys as follows:
1055 1115
 
@@ -1170,8 +1230,9 @@  discard block
 block discarded – undo
1170 1230
 					$returnContext = '';
1171 1231
 
1172 1232
 					// BBC or the entire attachments feature is disabled
1173
-					if (empty($modSettings['attachmentEnable']) || !empty($disabled['attach']))
1174
-						return $data;
1233
+					if (empty($modSettings['attachmentEnable']) || !empty($disabled['attach'])) {
1234
+											return $data;
1235
+					}
1175 1236
 
1176 1237
 					// Save the attach ID.
1177 1238
 					$attachID = $data;
@@ -1182,8 +1243,9 @@  discard block
 block discarded – undo
1182 1243
 					$currentAttachment = parseAttachBBC($attachID);
1183 1244
 
1184 1245
 					// parseAttachBBC will return a string ($txt key) rather than diying with a fatal_error. Up to you to decide what to do.
1185
-					if (is_string($currentAttachment))
1186
-						return $data = !empty($txt[$currentAttachment]) ? $txt[$currentAttachment] : $currentAttachment;
1246
+					if (is_string($currentAttachment)) {
1247
+											return $data = !empty($txt[$currentAttachment]) ? $txt[$currentAttachment] : $currentAttachment;
1248
+					}
1187 1249
 
1188 1250
 					if (!empty($currentAttachment['is_image']))
1189 1251
 					{
@@ -1199,15 +1261,17 @@  discard block
 block discarded – undo
1199 1261
 							$height = ' height="' . $currentAttachment['height'] . '"';
1200 1262
 						}
1201 1263
 
1202
-						if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}']))
1203
-							$returnContext .= '<a href="'. $currentAttachment['href']. ';image" id="link_'. $currentAttachment['id']. '" onclick="'. $currentAttachment['thumbnail']['javascript']. '"><img src="'. $currentAttachment['thumbnail']['href']. '"' . $alt . $title . ' id="thumb_'. $currentAttachment['id']. '" class="atc_img"></a>';
1204
-						else
1205
-							$returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>';
1264
+						if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}'])) {
1265
+													$returnContext .= '<a href="'. $currentAttachment['href']. ';image" id="link_'. $currentAttachment['id']. '" onclick="'. $currentAttachment['thumbnail']['javascript']. '"><img src="'. $currentAttachment['thumbnail']['href']. '"' . $alt . $title . ' id="thumb_'. $currentAttachment['id']. '" class="atc_img"></a>';
1266
+						} else {
1267
+													$returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>';
1268
+						}
1206 1269
 					}
1207 1270
 
1208 1271
 					// No image. Show a link.
1209
-					else
1210
-						$returnContext .= $currentAttachment['link'];
1272
+					else {
1273
+											$returnContext .= $currentAttachment['link'];
1274
+					}
1211 1275
 
1212 1276
 					// Gotta append what we just did.
1213 1277
 					$data = $returnContext;
@@ -1238,8 +1302,9 @@  discard block
 block discarded – undo
1238 1302
 						for ($php_i = 0, $php_n = count($php_parts); $php_i < $php_n; $php_i++)
1239 1303
 						{
1240 1304
 							// Do PHP code coloring?
1241
-							if ($php_parts[$php_i] != '&lt;?php')
1242
-								continue;
1305
+							if ($php_parts[$php_i] != '&lt;?php') {
1306
+															continue;
1307
+							}
1243 1308
 
1244 1309
 							$php_string = '';
1245 1310
 							while ($php_i + 1 < count($php_parts) && $php_parts[$php_i] != '?&gt;')
@@ -1255,8 +1320,9 @@  discard block
 block discarded – undo
1255 1320
 						$data = str_replace("\t", "<span style=\"white-space: pre;\">\t</span>", $data);
1256 1321
 
1257 1322
 						// Recent Opera bug requiring temporary fix. &nsbp; is needed before </code> to avoid broken selection.
1258
-						if ($context['browser']['is_opera'])
1259
-							$data .= '&nbsp;';
1323
+						if ($context['browser']['is_opera']) {
1324
+													$data .= '&nbsp;';
1325
+						}
1260 1326
 					}
1261 1327
 				},
1262 1328
 				'block_level' => true,
@@ -1275,8 +1341,9 @@  discard block
 block discarded – undo
1275 1341
 						for ($php_i = 0, $php_n = count($php_parts); $php_i < $php_n; $php_i++)
1276 1342
 						{
1277 1343
 							// Do PHP code coloring?
1278
-							if ($php_parts[$php_i] != '&lt;?php')
1279
-								continue;
1344
+							if ($php_parts[$php_i] != '&lt;?php') {
1345
+															continue;
1346
+							}
1280 1347
 
1281 1348
 							$php_string = '';
1282 1349
 							while ($php_i + 1 < count($php_parts) && $php_parts[$php_i] != '?&gt;')
@@ -1292,8 +1359,9 @@  discard block
 block discarded – undo
1292 1359
 						$data[0] = str_replace("\t", "<span style=\"white-space: pre;\">\t</span>", $data[0]);
1293 1360
 
1294 1361
 						// Recent Opera bug requiring temporary fix. &nsbp; is needed before </code> to avoid broken selection.
1295
-						if ($context['browser']['is_opera'])
1296
-							$data[0] .= '&nbsp;';
1362
+						if ($context['browser']['is_opera']) {
1363
+													$data[0] .= '&nbsp;';
1364
+						}
1297 1365
 					}
1298 1366
 				},
1299 1367
 				'block_level' => true,
@@ -1331,11 +1399,13 @@  discard block
 block discarded – undo
1331 1399
 				'content' => '<embed type="application/x-shockwave-flash" src="$1" width="$2" height="$3" play="true" loop="true" quality="high" AllowScriptAccess="never">',
1332 1400
 				'validate' => function (&$tag, &$data, $disabled)
1333 1401
 				{
1334
-					if (isset($disabled['url']))
1335
-						$tag['content'] = '$1';
1402
+					if (isset($disabled['url'])) {
1403
+											$tag['content'] = '$1';
1404
+					}
1336 1405
 					$scheme = parse_url($data[0], PHP_URL_SCHEME);
1337
-					if (empty($scheme))
1338
-						$data[0] = '//' . ltrim($data[0], ':/');
1406
+					if (empty($scheme)) {
1407
+											$data[0] = '//' . ltrim($data[0], ':/');
1408
+					}
1339 1409
 				},
1340 1410
 				'disabled_content' => '<a href="$1" target="_blank" class="new_win">$1</a>',
1341 1411
 			),
@@ -1349,10 +1419,11 @@  discard block
 block discarded – undo
1349 1419
 				{
1350 1420
 					$class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"';
1351 1421
 
1352
-					if (preg_match('~\bmax=(\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)~', $data, $matches))
1353
-						$css = ' style="max-width:' . $matches[1] . (is_numeric($matches[1]) ? 'px' : '') . '"';
1354
-					else
1355
-						$css = '';
1422
+					if (preg_match('~\bmax=(\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)~', $data, $matches)) {
1423
+											$css = ' style="max-width:' . $matches[1] . (is_numeric($matches[1]) ? 'px' : '') . '"';
1424
+					} else {
1425
+											$css = '';
1426
+					}
1356 1427
 
1357 1428
 					$data = $class . $css;
1358 1429
 				},
@@ -1402,14 +1473,16 @@  discard block
 block discarded – undo
1402 1473
 					$scheme = parse_url($data, PHP_URL_SCHEME);
1403 1474
 					if ($image_proxy_enabled)
1404 1475
 					{
1405
-						if (empty($scheme))
1406
-							$data = 'http://' . ltrim($data, ':/');
1476
+						if (empty($scheme)) {
1477
+													$data = 'http://' . ltrim($data, ':/');
1478
+						}
1407 1479
 
1408
-						if ($scheme != 'https')
1409
-							$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
1480
+						if ($scheme != 'https') {
1481
+													$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
1482
+						}
1483
+					} elseif (empty($scheme)) {
1484
+											$data = '//' . ltrim($data, ':/');
1410 1485
 					}
1411
-					elseif (empty($scheme))
1412
-						$data = '//' . ltrim($data, ':/');
1413 1486
 				},
1414 1487
 				'disabled_content' => '($1)',
1415 1488
 			),
@@ -1425,14 +1498,16 @@  discard block
 block discarded – undo
1425 1498
 					$scheme = parse_url($data, PHP_URL_SCHEME);
1426 1499
 					if ($image_proxy_enabled)
1427 1500
 					{
1428
-						if (empty($scheme))
1429
-							$data = 'http://' . ltrim($data, ':/');
1501
+						if (empty($scheme)) {
1502
+													$data = 'http://' . ltrim($data, ':/');
1503
+						}
1430 1504
 
1431
-						if ($scheme != 'https')
1432
-							$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
1505
+						if ($scheme != 'https') {
1506
+													$data = $boardurl . '/proxy.php?request=' . urlencode($data) . '&hash=' . md5($data . $image_proxy_secret);
1507
+						}
1508
+					} elseif (empty($scheme)) {
1509
+											$data = '//' . ltrim($data, ':/');
1433 1510
 					}
1434
-					elseif (empty($scheme))
1435
-						$data = '//' . ltrim($data, ':/');
1436 1511
 				},
1437 1512
 				'disabled_content' => '($1)',
1438 1513
 			),
@@ -1444,8 +1519,9 @@  discard block
 block discarded – undo
1444 1519
 				{
1445 1520
 					$data = strtr($data, array('<br>' => ''));
1446 1521
 					$scheme = parse_url($data, PHP_URL_SCHEME);
1447
-					if (empty($scheme))
1448
-						$data = '//' . ltrim($data, ':/');
1522
+					if (empty($scheme)) {
1523
+											$data = '//' . ltrim($data, ':/');
1524
+					}
1449 1525
 				},
1450 1526
 			),
1451 1527
 			array(
@@ -1456,13 +1532,14 @@  discard block
 block discarded – undo
1456 1532
 				'after' => '</a>',
1457 1533
 				'validate' => function (&$tag, &$data, $disabled)
1458 1534
 				{
1459
-					if (substr($data, 0, 1) == '#')
1460
-						$data = '#post_' . substr($data, 1);
1461
-					else
1535
+					if (substr($data, 0, 1) == '#') {
1536
+											$data = '#post_' . substr($data, 1);
1537
+					} else
1462 1538
 					{
1463 1539
 						$scheme = parse_url($data, PHP_URL_SCHEME);
1464
-						if (empty($scheme))
1465
-							$data = '//' . ltrim($data, ':/');
1540
+						if (empty($scheme)) {
1541
+													$data = '//' . ltrim($data, ':/');
1542
+						}
1466 1543
 					}
1467 1544
 				},
1468 1545
 				'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
@@ -1540,8 +1617,9 @@  discard block
 block discarded – undo
1540 1617
 					{
1541 1618
 						$add_begin = substr(trim($data), 0, 5) != '&lt;?';
1542 1619
 						$data = highlight_php_code($add_begin ? '&lt;?php ' . $data . '?&gt;' : $data);
1543
-						if ($add_begin)
1544
-							$data = preg_replace(array('~^(.+?)&lt;\?.{0,40}?php(?:&nbsp;|\s)~', '~\?&gt;((?:</(font|span)>)*)$~'), '$1', $data, 2);
1620
+						if ($add_begin) {
1621
+													$data = preg_replace(array('~^(.+?)&lt;\?.{0,40}?php(?:&nbsp;|\s)~', '~\?&gt;((?:</(font|span)>)*)$~'), '$1', $data, 2);
1622
+						}
1545 1623
 					}
1546 1624
 				},
1547 1625
 				'block_level' => false,
@@ -1672,10 +1750,11 @@  discard block
 block discarded – undo
1672 1750
 				'content' => '$1',
1673 1751
 				'validate' => function (&$tag, &$data, $disabled)
1674 1752
 				{
1675
-					if (is_numeric($data))
1676
-						$data = timeformat($data);
1677
-					else
1678
-						$tag['content'] = '[time]$1[/time]';
1753
+					if (is_numeric($data)) {
1754
+											$data = timeformat($data);
1755
+					} else {
1756
+											$tag['content'] = '[time]$1[/time]';
1757
+					}
1679 1758
 				},
1680 1759
 			),
1681 1760
 			array(
@@ -1702,8 +1781,9 @@  discard block
 block discarded – undo
1702 1781
 				{
1703 1782
 					$data = strtr($data, array('<br>' => ''));
1704 1783
 					$scheme = parse_url($data, PHP_URL_SCHEME);
1705
-					if (empty($scheme))
1706
-						$data = '//' . ltrim($data, ':/');
1784
+					if (empty($scheme)) {
1785
+											$data = '//' . ltrim($data, ':/');
1786
+					}
1707 1787
 				},
1708 1788
 			),
1709 1789
 			array(
@@ -1715,8 +1795,9 @@  discard block
 block discarded – undo
1715 1795
 				'validate' => function (&$tag, &$data, $disabled)
1716 1796
 				{
1717 1797
 					$scheme = parse_url($data, PHP_URL_SCHEME);
1718
-					if (empty($scheme))
1719
-						$data = '//' . ltrim($data, ':/');
1798
+					if (empty($scheme)) {
1799
+											$data = '//' . ltrim($data, ':/');
1800
+					}
1720 1801
 				},
1721 1802
 				'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
1722 1803
 				'disabled_after' => ' ($1)',
@@ -1736,8 +1817,9 @@  discard block
 block discarded – undo
1736 1817
 		// This is mainly for the bbc manager, so it's easy to add tags above.  Custom BBC should be added above this line.
1737 1818
 		if ($message === false)
1738 1819
 		{
1739
-			if (isset($temp_bbc))
1740
-				$bbc_codes = $temp_bbc;
1820
+			if (isset($temp_bbc)) {
1821
+							$bbc_codes = $temp_bbc;
1822
+			}
1741 1823
 			usort($codes, function ($a, $b) {
1742 1824
 				return strcmp($a['tag'], $b['tag']);
1743 1825
 			});
@@ -1757,8 +1839,9 @@  discard block
 block discarded – undo
1757 1839
 		);
1758 1840
 		if (!isset($disabled['li']) && !isset($disabled['list']))
1759 1841
 		{
1760
-			foreach ($itemcodes as $c => $dummy)
1761
-				$bbc_codes[$c] = array();
1842
+			foreach ($itemcodes as $c => $dummy) {
1843
+							$bbc_codes[$c] = array();
1844
+			}
1762 1845
 		}
1763 1846
 
1764 1847
 		// Shhhh!
@@ -1779,12 +1862,14 @@  discard block
 block discarded – undo
1779 1862
 		foreach ($codes as $code)
1780 1863
 		{
1781 1864
 			// Make it easier to process parameters later
1782
-			if (!empty($code['parameters']))
1783
-				ksort($code['parameters'], SORT_STRING);
1865
+			if (!empty($code['parameters'])) {
1866
+							ksort($code['parameters'], SORT_STRING);
1867
+			}
1784 1868
 
1785 1869
 			// If we are not doing every tag only do ones we are interested in.
1786
-			if (empty($parse_tags) || in_array($code['tag'], $parse_tags))
1787
-				$bbc_codes[substr($code['tag'], 0, 1)][] = $code;
1870
+			if (empty($parse_tags) || in_array($code['tag'], $parse_tags)) {
1871
+							$bbc_codes[substr($code['tag'], 0, 1)][] = $code;
1872
+			}
1788 1873
 		}
1789 1874
 		$codes = null;
1790 1875
 	}
@@ -1795,8 +1880,9 @@  discard block
 block discarded – undo
1795 1880
 		// It's likely this will change if the message is modified.
1796 1881
 		$cache_key = 'parse:' . $cache_id . '-' . md5(md5($message) . '-' . $smileys . (empty($disabled) ? '' : implode(',', array_keys($disabled))) . $smcFunc['json_encode']($context['browser']) . $txt['lang_locale'] . $user_info['time_offset'] . $user_info['time_format']);
1797 1882
 
1798
-		if (($temp = cache_get_data($cache_key, 240)) != null)
1799
-			return $temp;
1883
+		if (($temp = cache_get_data($cache_key, 240)) != null) {
1884
+					return $temp;
1885
+		}
1800 1886
 
1801 1887
 		$cache_t = microtime();
1802 1888
 	}
@@ -1828,8 +1914,9 @@  discard block
 block discarded – undo
1828 1914
 		$disabled['flash'] = true;
1829 1915
 
1830 1916
 		// @todo Change maybe?
1831
-		if (!isset($_GET['images']))
1832
-			$disabled['img'] = true;
1917
+		if (!isset($_GET['images'])) {
1918
+					$disabled['img'] = true;
1919
+		}
1833 1920
 
1834 1921
 		// @todo Interface/setting to add more?
1835 1922
 	}
@@ -1853,8 +1940,9 @@  discard block
 block discarded – undo
1853 1940
 		$pos = isset($matches[0][1]) ? $matches[0][1] : false;
1854 1941
 
1855 1942
 		// Failsafe.
1856
-		if ($pos === false || $last_pos > $pos)
1857
-			$pos = strlen($message) + 1;
1943
+		if ($pos === false || $last_pos > $pos) {
1944
+					$pos = strlen($message) + 1;
1945
+		}
1858 1946
 
1859 1947
 		// Can't have a one letter smiley, URL, or email! (sorry.)
1860 1948
 		if ($last_pos < $pos - 1)
@@ -1872,8 +1960,9 @@  discard block
 block discarded – undo
1872 1960
 				
1873 1961
 				// <br> should be empty.
1874 1962
 				$empty_tags = array('br', 'hr');
1875
-				foreach ($empty_tags as $tag)
1876
-					$data = str_replace(array('&lt;' . $tag . '&gt;', '&lt;' . $tag . '/&gt;', '&lt;' . $tag . ' /&gt;'), '<' . $tag . '>', $data);
1963
+				foreach ($empty_tags as $tag) {
1964
+									$data = str_replace(array('&lt;' . $tag . '&gt;', '&lt;' . $tag . '/&gt;', '&lt;' . $tag . ' /&gt;'), '<' . $tag . '>', $data);
1965
+				}
1877 1966
 
1878 1967
 				// b, u, i, s, pre... basic tags.
1879 1968
 				$closable_tags = array('b', 'u', 'i', 's', 'em', 'ins', 'del', 'pre', 'blockquote', 'strong');
@@ -1882,8 +1971,9 @@  discard block
 block discarded – undo
1882 1971
 					$diff = substr_count($data, '&lt;' . $tag . '&gt;') - substr_count($data, '&lt;/' . $tag . '&gt;');
1883 1972
 					$data = strtr($data, array('&lt;' . $tag . '&gt;' => '<' . $tag . '>', '&lt;/' . $tag . '&gt;' => '</' . $tag . '>'));
1884 1973
 
1885
-					if ($diff > 0)
1886
-						$data = substr($data, 0, -1) . str_repeat('</' . $tag . '>', $diff) . substr($data, -1);
1974
+					if ($diff > 0) {
1975
+											$data = substr($data, 0, -1) . str_repeat('</' . $tag . '>', $diff) . substr($data, -1);
1976
+					}
1887 1977
 				}
1888 1978
 
1889 1979
 				// Do <img ...> - with security... action= -> action-.
@@ -1896,8 +1986,9 @@  discard block
 block discarded – undo
1896 1986
 						$alt = empty($matches[3][$match]) ? '' : ' alt=' . preg_replace('~^&quot;|&quot;$~', '', $matches[3][$match]);
1897 1987
 
1898 1988
 						// Remove action= from the URL - no funny business, now.
1899
-						if (preg_match('~action(=|%3d)(?!dlattach)~i', $imgtag) != 0)
1900
-							$imgtag = preg_replace('~action(?:=|%3d)(?!dlattach)~i', 'action-', $imgtag);
1989
+						if (preg_match('~action(=|%3d)(?!dlattach)~i', $imgtag) != 0) {
1990
+													$imgtag = preg_replace('~action(?:=|%3d)(?!dlattach)~i', 'action-', $imgtag);
1991
+						}
1901 1992
 
1902 1993
 						// Check if the image is larger than allowed.
1903 1994
 						if (!empty($modSettings['max_image_width']) && !empty($modSettings['max_image_height']))
@@ -1918,9 +2009,9 @@  discard block
 block discarded – undo
1918 2009
 
1919 2010
 							// Set the new image tag.
1920 2011
 							$replaces[$matches[0][$match]] = '[img width=' . $width . ' height=' . $height . $alt . ']' . $imgtag . '[/img]';
2012
+						} else {
2013
+													$replaces[$matches[0][$match]] = '[img' . $alt . ']' . $imgtag . '[/img]';
1921 2014
 						}
1922
-						else
1923
-							$replaces[$matches[0][$match]] = '[img' . $alt . ']' . $imgtag . '[/img]';
1924 2015
 					}
1925 2016
 
1926 2017
 					$data = strtr($data, $replaces);
@@ -1933,16 +2024,18 @@  discard block
 block discarded – undo
1933 2024
 				$no_autolink_area = false;
1934 2025
 				if (!empty($open_tags))
1935 2026
 				{
1936
-					foreach ($open_tags as $open_tag)
1937
-						if (in_array($open_tag['tag'], $no_autolink_tags))
2027
+					foreach ($open_tags as $open_tag) {
2028
+											if (in_array($open_tag['tag'], $no_autolink_tags))
1938 2029
 							$no_autolink_area = true;
2030
+					}
1939 2031
 				}
1940 2032
 
1941 2033
 				// Don't go backwards.
1942 2034
 				// @todo Don't think is the real solution....
1943 2035
 				$lastAutoPos = isset($lastAutoPos) ? $lastAutoPos : 0;
1944
-				if ($pos < $lastAutoPos)
1945
-					$no_autolink_area = true;
2036
+				if ($pos < $lastAutoPos) {
2037
+									$no_autolink_area = true;
2038
+				}
1946 2039
 				$lastAutoPos = $pos;
1947 2040
 
1948 2041
 				if (!$no_autolink_area)
@@ -2051,17 +2144,19 @@  discard block
 block discarded – undo
2051 2144
 							if ($scheme == 'mailto')
2052 2145
 							{
2053 2146
 								$email_address = str_replace('mailto:', '', $url);
2054
-								if (!isset($disabled['email']) && filter_var($email_address, FILTER_VALIDATE_EMAIL) !== false)
2055
-									return '[email=' . $email_address . ']' . $url . '[/email]';
2056
-								else
2057
-									return $url;
2147
+								if (!isset($disabled['email']) && filter_var($email_address, FILTER_VALIDATE_EMAIL) !== false) {
2148
+																	return '[email=' . $email_address . ']' . $url . '[/email]';
2149
+								} else {
2150
+																	return $url;
2151
+								}
2058 2152
 							}
2059 2153
 
2060 2154
 							// Are we linking a schemeless URL or naked domain name (e.g. "example.com")?
2061
-							if (empty($scheme))
2062
-								$fullUrl = '//' . ltrim($url, ':/');
2063
-							else
2064
-								$fullUrl = $url;
2155
+							if (empty($scheme)) {
2156
+															$fullUrl = '//' . ltrim($url, ':/');
2157
+							} else {
2158
+															$fullUrl = $url;
2159
+							}
2065 2160
 
2066 2161
 							return '[url=&quot;' . str_replace(array('[', ']'), array('&#91;', '&#93;'), $fullUrl) . '&quot;]' . $url . '[/url]';
2067 2162
 						}, $data);
@@ -2110,16 +2205,18 @@  discard block
 block discarded – undo
2110 2205
 		}
2111 2206
 
2112 2207
 		// Are we there yet?  Are we there yet?
2113
-		if ($pos >= strlen($message) - 1)
2114
-			break;
2208
+		if ($pos >= strlen($message) - 1) {
2209
+					break;
2210
+		}
2115 2211
 
2116 2212
 		$tags = strtolower($message[$pos + 1]);
2117 2213
 
2118 2214
 		if ($tags == '/' && !empty($open_tags))
2119 2215
 		{
2120 2216
 			$pos2 = strpos($message, ']', $pos + 1);
2121
-			if ($pos2 == $pos + 2)
2122
-				continue;
2217
+			if ($pos2 == $pos + 2) {
2218
+							continue;
2219
+			}
2123 2220
 
2124 2221
 			$look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2));
2125 2222
 
@@ -2129,8 +2226,9 @@  discard block
 block discarded – undo
2129 2226
 			do
2130 2227
 			{
2131 2228
 				$tag = array_pop($open_tags);
2132
-				if (!$tag)
2133
-					break;
2229
+				if (!$tag) {
2230
+									break;
2231
+				}
2134 2232
 
2135 2233
 				if (!empty($tag['block_level']))
2136 2234
 				{
@@ -2144,10 +2242,11 @@  discard block
 block discarded – undo
2144 2242
 					// The idea is, if we are LOOKING for a block level tag, we can close them on the way.
2145 2243
 					if (strlen($look_for) > 0 && isset($bbc_codes[$look_for[0]]))
2146 2244
 					{
2147
-						foreach ($bbc_codes[$look_for[0]] as $temp)
2148
-							if ($temp['tag'] == $look_for)
2245
+						foreach ($bbc_codes[$look_for[0]] as $temp) {
2246
+													if ($temp['tag'] == $look_for)
2149 2247
 							{
2150 2248
 								$block_level = !empty($temp['block_level']);
2249
+						}
2151 2250
 								break;
2152 2251
 							}
2153 2252
 					}
@@ -2169,15 +2268,15 @@  discard block
 block discarded – undo
2169 2268
 			{
2170 2269
 				$open_tags = $to_close;
2171 2270
 				continue;
2172
-			}
2173
-			elseif (!empty($to_close) && $tag['tag'] != $look_for)
2271
+			} elseif (!empty($to_close) && $tag['tag'] != $look_for)
2174 2272
 			{
2175 2273
 				if ($block_level === null && isset($look_for[0], $bbc_codes[$look_for[0]]))
2176 2274
 				{
2177
-					foreach ($bbc_codes[$look_for[0]] as $temp)
2178
-						if ($temp['tag'] == $look_for)
2275
+					foreach ($bbc_codes[$look_for[0]] as $temp) {
2276
+											if ($temp['tag'] == $look_for)
2179 2277
 						{
2180 2278
 							$block_level = !empty($temp['block_level']);
2279
+					}
2181 2280
 							break;
2182 2281
 						}
2183 2282
 				}
@@ -2185,8 +2284,9 @@  discard block
 block discarded – undo
2185 2284
 				// We're not looking for a block level tag (or maybe even a tag that exists...)
2186 2285
 				if (!$block_level)
2187 2286
 				{
2188
-					foreach ($to_close as $tag)
2189
-						array_push($open_tags, $tag);
2287
+					foreach ($to_close as $tag) {
2288
+											array_push($open_tags, $tag);
2289
+					}
2190 2290
 					continue;
2191 2291
 				}
2192 2292
 			}
@@ -2199,14 +2299,17 @@  discard block
 block discarded – undo
2199 2299
 
2200 2300
 				// See the comment at the end of the big loop - just eating whitespace ;).
2201 2301
 				$whitespace_regex = '';
2202
-				if (!empty($tag['block_level']))
2203
-					$whitespace_regex .= '(&nbsp;|\s)*(<br>)?';
2302
+				if (!empty($tag['block_level'])) {
2303
+									$whitespace_regex .= '(&nbsp;|\s)*(<br>)?';
2304
+				}
2204 2305
 				// Trim one line of whitespace after unnested tags, but all of it after nested ones
2205
-				if (!empty($tag['trim']) && $tag['trim'] != 'inside')
2206
-					$whitespace_regex .= empty($tag['require_parents']) ? '(&nbsp;|\s)*' : '(<br>|&nbsp;|\s)*';
2306
+				if (!empty($tag['trim']) && $tag['trim'] != 'inside') {
2307
+									$whitespace_regex .= empty($tag['require_parents']) ? '(&nbsp;|\s)*' : '(<br>|&nbsp;|\s)*';
2308
+				}
2207 2309
 
2208
-				if (!empty($whitespace_regex) && preg_match('~' . $whitespace_regex . '~', substr($message, $pos), $matches) != 0)
2209
-					$message = substr($message, 0, $pos) . substr($message, $pos + strlen($matches[0]));
2310
+				if (!empty($whitespace_regex) && preg_match('~' . $whitespace_regex . '~', substr($message, $pos), $matches) != 0) {
2311
+									$message = substr($message, 0, $pos) . substr($message, $pos + strlen($matches[0]));
2312
+				}
2210 2313
 			}
2211 2314
 
2212 2315
 			if (!empty($to_close))
@@ -2219,8 +2322,9 @@  discard block
 block discarded – undo
2219 2322
 		}
2220 2323
 
2221 2324
 		// No tags for this character, so just keep going (fastest possible course.)
2222
-		if (!isset($bbc_codes[$tags]))
2223
-			continue;
2325
+		if (!isset($bbc_codes[$tags])) {
2326
+					continue;
2327
+		}
2224 2328
 
2225 2329
 		$inside = empty($open_tags) ? null : $open_tags[count($open_tags) - 1];
2226 2330
 		$tag = null;
@@ -2229,44 +2333,52 @@  discard block
 block discarded – undo
2229 2333
 			$pt_strlen = strlen($possible['tag']);
2230 2334
 
2231 2335
 			// Not a match?
2232
-			if (strtolower(substr($message, $pos + 1, $pt_strlen)) != $possible['tag'])
2233
-				continue;
2336
+			if (strtolower(substr($message, $pos + 1, $pt_strlen)) != $possible['tag']) {
2337
+							continue;
2338
+			}
2234 2339
 
2235 2340
 			$next_c = $message[$pos + 1 + $pt_strlen];
2236 2341
 
2237 2342
 			// A test validation?
2238
-			if (isset($possible['test']) && preg_match('~^' . $possible['test'] . '~', substr($message, $pos + 1 + $pt_strlen + 1)) === 0)
2239
-				continue;
2343
+			if (isset($possible['test']) && preg_match('~^' . $possible['test'] . '~', substr($message, $pos + 1 + $pt_strlen + 1)) === 0) {
2344
+							continue;
2345
+			}
2240 2346
 			// Do we want parameters?
2241 2347
 			elseif (!empty($possible['parameters']))
2242 2348
 			{
2243
-				if ($next_c != ' ')
2244
-					continue;
2245
-			}
2246
-			elseif (isset($possible['type']))
2349
+				if ($next_c != ' ') {
2350
+									continue;
2351
+				}
2352
+			} elseif (isset($possible['type']))
2247 2353
 			{
2248 2354
 				// Do we need an equal sign?
2249
-				if (in_array($possible['type'], array('unparsed_equals', 'unparsed_commas', 'unparsed_commas_content', 'unparsed_equals_content', 'parsed_equals')) && $next_c != '=')
2250
-					continue;
2355
+				if (in_array($possible['type'], array('unparsed_equals', 'unparsed_commas', 'unparsed_commas_content', 'unparsed_equals_content', 'parsed_equals')) && $next_c != '=') {
2356
+									continue;
2357
+				}
2251 2358
 				// Maybe we just want a /...
2252
-				if ($possible['type'] == 'closed' && $next_c != ']' && substr($message, $pos + 1 + $pt_strlen, 2) != '/]' && substr($message, $pos + 1 + $pt_strlen, 3) != ' /]')
2253
-					continue;
2359
+				if ($possible['type'] == 'closed' && $next_c != ']' && substr($message, $pos + 1 + $pt_strlen, 2) != '/]' && substr($message, $pos + 1 + $pt_strlen, 3) != ' /]') {
2360
+									continue;
2361
+				}
2254 2362
 				// An immediate ]?
2255
-				if ($possible['type'] == 'unparsed_content' && $next_c != ']')
2256
-					continue;
2363
+				if ($possible['type'] == 'unparsed_content' && $next_c != ']') {
2364
+									continue;
2365
+				}
2257 2366
 			}
2258 2367
 			// No type means 'parsed_content', which demands an immediate ] without parameters!
2259
-			elseif ($next_c != ']')
2260
-				continue;
2368
+			elseif ($next_c != ']') {
2369
+							continue;
2370
+			}
2261 2371
 
2262 2372
 			// Check allowed tree?
2263
-			if (isset($possible['require_parents']) && ($inside === null || !in_array($inside['tag'], $possible['require_parents'])))
2264
-				continue;
2265
-			elseif (isset($inside['require_children']) && !in_array($possible['tag'], $inside['require_children']))
2266
-				continue;
2373
+			if (isset($possible['require_parents']) && ($inside === null || !in_array($inside['tag'], $possible['require_parents']))) {
2374
+							continue;
2375
+			} elseif (isset($inside['require_children']) && !in_array($possible['tag'], $inside['require_children'])) {
2376
+							continue;
2377
+			}
2267 2378
 			// If this is in the list of disallowed child tags, don't parse it.
2268
-			elseif (isset($inside['disallow_children']) && in_array($possible['tag'], $inside['disallow_children']))
2269
-				continue;
2379
+			elseif (isset($inside['disallow_children']) && in_array($possible['tag'], $inside['disallow_children'])) {
2380
+							continue;
2381
+			}
2270 2382
 
2271 2383
 			$pos1 = $pos + 1 + $pt_strlen + 1;
2272 2384
 
@@ -2278,8 +2390,9 @@  discard block
 block discarded – undo
2278 2390
 				foreach ($open_tags as $open_quote)
2279 2391
 				{
2280 2392
 					// Every parent quote this quote has flips the styling
2281
-					if ($open_quote['tag'] == 'quote')
2282
-						$quote_alt = !$quote_alt;
2393
+					if ($open_quote['tag'] == 'quote') {
2394
+											$quote_alt = !$quote_alt;
2395
+					}
2283 2396
 				}
2284 2397
 				// Add a class to the quote to style alternating blockquotes
2285 2398
 				$possible['before'] = strtr($possible['before'], array('<blockquote>' => '<blockquote class="bbc_' . ($quote_alt ? 'alternate' : 'standard') . '_quote">'));
@@ -2290,8 +2403,9 @@  discard block
 block discarded – undo
2290 2403
 			{
2291 2404
 				// Build a regular expression for each parameter for the current tag.
2292 2405
 				$preg = array();
2293
-				foreach ($possible['parameters'] as $p => $info)
2294
-					$preg[] = '(\s+' . $p . '=' . (empty($info['quoted']) ? '' : '&quot;') . (isset($info['match']) ? $info['match'] : '(.+?)') . (empty($info['quoted']) ? '' : '&quot;') . '\s*)' . (empty($info['optional']) ? '' : '?');
2406
+				foreach ($possible['parameters'] as $p => $info) {
2407
+									$preg[] = '(\s+' . $p . '=' . (empty($info['quoted']) ? '' : '&quot;') . (isset($info['match']) ? $info['match'] : '(.+?)') . (empty($info['quoted']) ? '' : '&quot;') . '\s*)' . (empty($info['optional']) ? '' : '?');
2408
+				}
2295 2409
 
2296 2410
 				// Extract the string that potentially holds our parameters.
2297 2411
 				$blob = preg_split('~\[/?(?:' . $alltags_regex . ')~i', substr($message, $pos));
@@ -2311,24 +2425,27 @@  discard block
 block discarded – undo
2311 2425
 
2312 2426
 					$match = preg_match('~^' . implode('', $preg) . '$~i', implode(' ', $given_params), $matches) !== 0;
2313 2427
 
2314
-					if ($match)
2315
-						$blob_counter = count($blobs) + 1;
2428
+					if ($match) {
2429
+											$blob_counter = count($blobs) + 1;
2430
+					}
2316 2431
 				}
2317 2432
 
2318 2433
 				// Didn't match our parameter list, try the next possible.
2319
-				if (!$match)
2320
-					continue;
2434
+				if (!$match) {
2435
+									continue;
2436
+				}
2321 2437
 
2322 2438
 				$params = array();
2323 2439
 				for ($i = 1, $n = count($matches); $i < $n; $i += 2)
2324 2440
 				{
2325 2441
 					$key = strtok(ltrim($matches[$i]), '=');
2326
-					if (isset($possible['parameters'][$key]['value']))
2327
-						$params['{' . $key . '}'] = strtr($possible['parameters'][$key]['value'], array('$1' => $matches[$i + 1]));
2328
-					elseif (isset($possible['parameters'][$key]['validate']))
2329
-						$params['{' . $key . '}'] = $possible['parameters'][$key]['validate']($matches[$i + 1]);
2330
-					else
2331
-						$params['{' . $key . '}'] = $matches[$i + 1];
2442
+					if (isset($possible['parameters'][$key]['value'])) {
2443
+											$params['{' . $key . '}'] = strtr($possible['parameters'][$key]['value'], array('$1' => $matches[$i + 1]));
2444
+					} elseif (isset($possible['parameters'][$key]['validate'])) {
2445
+											$params['{' . $key . '}'] = $possible['parameters'][$key]['validate']($matches[$i + 1]);
2446
+					} else {
2447
+											$params['{' . $key . '}'] = $matches[$i + 1];
2448
+					}
2332 2449
 
2333 2450
 					// Just to make sure: replace any $ or { so they can't interpolate wrongly.
2334 2451
 					$params['{' . $key . '}'] = strtr($params['{' . $key . '}'], array('$' => '&#036;', '{' => '&#123;'));
@@ -2336,23 +2453,26 @@  discard block
 block discarded – undo
2336 2453
 
2337 2454
 				foreach ($possible['parameters'] as $p => $info)
2338 2455
 				{
2339
-					if (!isset($params['{' . $p . '}']))
2340
-						$params['{' . $p . '}'] = '';
2456
+					if (!isset($params['{' . $p . '}'])) {
2457
+											$params['{' . $p . '}'] = '';
2458
+					}
2341 2459
 				}
2342 2460
 
2343 2461
 				$tag = $possible;
2344 2462
 
2345 2463
 				// Put the parameters into the string.
2346
-				if (isset($tag['before']))
2347
-					$tag['before'] = strtr($tag['before'], $params);
2348
-				if (isset($tag['after']))
2349
-					$tag['after'] = strtr($tag['after'], $params);
2350
-				if (isset($tag['content']))
2351
-					$tag['content'] = strtr($tag['content'], $params);
2464
+				if (isset($tag['before'])) {
2465
+									$tag['before'] = strtr($tag['before'], $params);
2466
+				}
2467
+				if (isset($tag['after'])) {
2468
+									$tag['after'] = strtr($tag['after'], $params);
2469
+				}
2470
+				if (isset($tag['content'])) {
2471
+									$tag['content'] = strtr($tag['content'], $params);
2472
+				}
2352 2473
 
2353 2474
 				$pos1 += strlen($given_param_string);
2354
-			}
2355
-			else
2475
+			} else
2356 2476
 			{
2357 2477
 				$tag = $possible;
2358 2478
 				$params = array();
@@ -2363,8 +2483,9 @@  discard block
 block discarded – undo
2363 2483
 		// Item codes are complicated buggers... they are implicit [li]s and can make [list]s!
2364 2484
 		if ($smileys !== false && $tag === null && isset($itemcodes[$message[$pos + 1]]) && $message[$pos + 2] == ']' && !isset($disabled['list']) && !isset($disabled['li']))
2365 2485
 		{
2366
-			if ($message[$pos + 1] == '0' && !in_array($message[$pos - 1], array(';', ' ', "\t", "\n", '>')))
2367
-				continue;
2486
+			if ($message[$pos + 1] == '0' && !in_array($message[$pos - 1], array(';', ' ', "\t", "\n", '>'))) {
2487
+							continue;
2488
+			}
2368 2489
 
2369 2490
 			$tag = $itemcodes[$message[$pos + 1]];
2370 2491
 
@@ -2385,9 +2506,9 @@  discard block
 block discarded – undo
2385 2506
 			{
2386 2507
 				array_pop($open_tags);
2387 2508
 				$code = '</li>';
2509
+			} else {
2510
+							$code = '';
2388 2511
 			}
2389
-			else
2390
-				$code = '';
2391 2512
 
2392 2513
 			// Now we open a new tag.
2393 2514
 			$open_tags[] = array(
@@ -2434,12 +2555,14 @@  discard block
 block discarded – undo
2434 2555
 		}
2435 2556
 
2436 2557
 		// No tag?  Keep looking, then.  Silly people using brackets without actual tags.
2437
-		if ($tag === null)
2438
-			continue;
2558
+		if ($tag === null) {
2559
+					continue;
2560
+		}
2439 2561
 
2440 2562
 		// Propagate the list to the child (so wrapping the disallowed tag won't work either.)
2441
-		if (isset($inside['disallow_children']))
2442
-			$tag['disallow_children'] = isset($tag['disallow_children']) ? array_unique(array_merge($tag['disallow_children'], $inside['disallow_children'])) : $inside['disallow_children'];
2563
+		if (isset($inside['disallow_children'])) {
2564
+					$tag['disallow_children'] = isset($tag['disallow_children']) ? array_unique(array_merge($tag['disallow_children'], $inside['disallow_children'])) : $inside['disallow_children'];
2565
+		}
2443 2566
 
2444 2567
 		// Is this tag disabled?
2445 2568
 		if (isset($disabled[$tag['tag']]))
@@ -2449,14 +2572,13 @@  discard block
 block discarded – undo
2449 2572
 				$tag['before'] = !empty($tag['block_level']) ? '<div>' : '';
2450 2573
 				$tag['after'] = !empty($tag['block_level']) ? '</div>' : '';
2451 2574
 				$tag['content'] = isset($tag['type']) && $tag['type'] == 'closed' ? '' : (!empty($tag['block_level']) ? '<div>$1</div>' : '$1');
2452
-			}
2453
-			elseif (isset($tag['disabled_before']) || isset($tag['disabled_after']))
2575
+			} elseif (isset($tag['disabled_before']) || isset($tag['disabled_after']))
2454 2576
 			{
2455 2577
 				$tag['before'] = isset($tag['disabled_before']) ? $tag['disabled_before'] : (!empty($tag['block_level']) ? '<div>' : '');
2456 2578
 				$tag['after'] = isset($tag['disabled_after']) ? $tag['disabled_after'] : (!empty($tag['block_level']) ? '</div>' : '');
2579
+			} else {
2580
+							$tag['content'] = $tag['disabled_content'];
2457 2581
 			}
2458
-			else
2459
-				$tag['content'] = $tag['disabled_content'];
2460 2582
 		}
2461 2583
 
2462 2584
 		// we use this a lot
@@ -2466,8 +2588,9 @@  discard block
 block discarded – undo
2466 2588
 		if (!empty($tag['block_level']) && $tag['tag'] != 'html' && empty($inside['block_level']))
2467 2589
 		{
2468 2590
 			$n = count($open_tags) - 1;
2469
-			while (empty($open_tags[$n]['block_level']) && $n >= 0)
2470
-				$n--;
2591
+			while (empty($open_tags[$n]['block_level']) && $n >= 0) {
2592
+							$n--;
2593
+			}
2471 2594
 
2472 2595
 			// Close all the non block level tags so this tag isn't surrounded by them.
2473 2596
 			for ($i = count($open_tags) - 1; $i > $n; $i--)
@@ -2479,12 +2602,15 @@  discard block
 block discarded – undo
2479 2602
 
2480 2603
 				// Trim or eat trailing stuff... see comment at the end of the big loop.
2481 2604
 				$whitespace_regex = '';
2482
-				if (!empty($tag['block_level']))
2483
-					$whitespace_regex .= '(&nbsp;|\s)*(<br>)?';
2484
-				if (!empty($tag['trim']) && $tag['trim'] != 'inside')
2485
-					$whitespace_regex .= empty($tag['require_parents']) ? '(&nbsp;|\s)*' : '(<br>|&nbsp;|\s)*';
2486
-				if (!empty($whitespace_regex) && preg_match('~' . $whitespace_regex . '~', substr($message, $pos), $matches) != 0)
2487
-					$message = substr($message, 0, $pos) . substr($message, $pos + strlen($matches[0]));
2605
+				if (!empty($tag['block_level'])) {
2606
+									$whitespace_regex .= '(&nbsp;|\s)*(<br>)?';
2607
+				}
2608
+				if (!empty($tag['trim']) && $tag['trim'] != 'inside') {
2609
+									$whitespace_regex .= empty($tag['require_parents']) ? '(&nbsp;|\s)*' : '(<br>|&nbsp;|\s)*';
2610
+				}
2611
+				if (!empty($whitespace_regex) && preg_match('~' . $whitespace_regex . '~', substr($message, $pos), $matches) != 0) {
2612
+									$message = substr($message, 0, $pos) . substr($message, $pos + strlen($matches[0]));
2613
+				}
2488 2614
 
2489 2615
 				array_pop($open_tags);
2490 2616
 			}
@@ -2502,16 +2628,19 @@  discard block
 block discarded – undo
2502 2628
 		elseif ($tag['type'] == 'unparsed_content')
2503 2629
 		{
2504 2630
 			$pos2 = stripos($message, '[/' . substr($message, $pos + 1, $tag_strlen) . ']', $pos1);
2505
-			if ($pos2 === false)
2506
-				continue;
2631
+			if ($pos2 === false) {
2632
+							continue;
2633
+			}
2507 2634
 
2508 2635
 			$data = substr($message, $pos1, $pos2 - $pos1);
2509 2636
 
2510
-			if (!empty($tag['block_level']) && substr($data, 0, 4) == '<br>')
2511
-				$data = substr($data, 4);
2637
+			if (!empty($tag['block_level']) && substr($data, 0, 4) == '<br>') {
2638
+							$data = substr($data, 4);
2639
+			}
2512 2640
 
2513
-			if (isset($tag['validate']))
2514
-				$tag['validate']($tag, $data, $disabled, $params);
2641
+			if (isset($tag['validate'])) {
2642
+							$tag['validate']($tag, $data, $disabled, $params);
2643
+			}
2515 2644
 
2516 2645
 			$code = strtr($tag['content'], array('$1' => $data));
2517 2646
 			$message = substr($message, 0, $pos) . "\n" . $code . "\n" . substr($message, $pos2 + 3 + $tag_strlen);
@@ -2527,34 +2656,40 @@  discard block
 block discarded – undo
2527 2656
 			if (isset($tag['quoted']))
2528 2657
 			{
2529 2658
 				$quoted = substr($message, $pos1, 6) == '&quot;';
2530
-				if ($tag['quoted'] != 'optional' && !$quoted)
2531
-					continue;
2659
+				if ($tag['quoted'] != 'optional' && !$quoted) {
2660
+									continue;
2661
+				}
2532 2662
 
2533
-				if ($quoted)
2534
-					$pos1 += 6;
2663
+				if ($quoted) {
2664
+									$pos1 += 6;
2665
+				}
2666
+			} else {
2667
+							$quoted = false;
2535 2668
 			}
2536
-			else
2537
-				$quoted = false;
2538 2669
 
2539 2670
 			$pos2 = strpos($message, $quoted == false ? ']' : '&quot;]', $pos1);
2540
-			if ($pos2 === false)
2541
-				continue;
2671
+			if ($pos2 === false) {
2672
+							continue;
2673
+			}
2542 2674
 
2543 2675
 			$pos3 = stripos($message, '[/' . substr($message, $pos + 1, $tag_strlen) . ']', $pos2);
2544
-			if ($pos3 === false)
2545
-				continue;
2676
+			if ($pos3 === false) {
2677
+							continue;
2678
+			}
2546 2679
 
2547 2680
 			$data = array(
2548 2681
 				substr($message, $pos2 + ($quoted == false ? 1 : 7), $pos3 - ($pos2 + ($quoted == false ? 1 : 7))),
2549 2682
 				substr($message, $pos1, $pos2 - $pos1)
2550 2683
 			);
2551 2684
 
2552
-			if (!empty($tag['block_level']) && substr($data[0], 0, 4) == '<br>')
2553
-				$data[0] = substr($data[0], 4);
2685
+			if (!empty($tag['block_level']) && substr($data[0], 0, 4) == '<br>') {
2686
+							$data[0] = substr($data[0], 4);
2687
+			}
2554 2688
 
2555 2689
 			// Validation for my parking, please!
2556
-			if (isset($tag['validate']))
2557
-				$tag['validate']($tag, $data, $disabled, $params);
2690
+			if (isset($tag['validate'])) {
2691
+							$tag['validate']($tag, $data, $disabled, $params);
2692
+			}
2558 2693
 
2559 2694
 			$code = strtr($tag['content'], array('$1' => $data[0], '$2' => $data[1]));
2560 2695
 			$message = substr($message, 0, $pos) . "\n" . $code . "\n" . substr($message, $pos3 + 3 + $tag_strlen);
@@ -2571,23 +2706,27 @@  discard block
 block discarded – undo
2571 2706
 		elseif ($tag['type'] == 'unparsed_commas_content')
2572 2707
 		{
2573 2708
 			$pos2 = strpos($message, ']', $pos1);
2574
-			if ($pos2 === false)
2575
-				continue;
2709
+			if ($pos2 === false) {
2710
+							continue;
2711
+			}
2576 2712
 
2577 2713
 			$pos3 = stripos($message, '[/' . substr($message, $pos + 1, $tag_strlen) . ']', $pos2);
2578
-			if ($pos3 === false)
2579
-				continue;
2714
+			if ($pos3 === false) {
2715
+							continue;
2716
+			}
2580 2717
 
2581 2718
 			// We want $1 to be the content, and the rest to be csv.
2582 2719
 			$data = explode(',', ',' . substr($message, $pos1, $pos2 - $pos1));
2583 2720
 			$data[0] = substr($message, $pos2 + 1, $pos3 - $pos2 - 1);
2584 2721
 
2585
-			if (isset($tag['validate']))
2586
-				$tag['validate']($tag, $data, $disabled, $params);
2722
+			if (isset($tag['validate'])) {
2723
+							$tag['validate']($tag, $data, $disabled, $params);
2724
+			}
2587 2725
 
2588 2726
 			$code = $tag['content'];
2589
-			foreach ($data as $k => $d)
2590
-				$code = strtr($code, array('$' . ($k + 1) => trim($d)));
2727
+			foreach ($data as $k => $d) {
2728
+							$code = strtr($code, array('$' . ($k + 1) => trim($d)));
2729
+			}
2591 2730
 			$message = substr($message, 0, $pos) . "\n" . $code . "\n" . substr($message, $pos3 + 3 + $tag_strlen);
2592 2731
 			$pos += strlen($code) - 1 + 2;
2593 2732
 		}
@@ -2595,24 +2734,28 @@  discard block
 block discarded – undo
2595 2734
 		elseif ($tag['type'] == 'unparsed_commas')
2596 2735
 		{
2597 2736
 			$pos2 = strpos($message, ']', $pos1);
2598
-			if ($pos2 === false)
2599
-				continue;
2737
+			if ($pos2 === false) {
2738
+							continue;
2739
+			}
2600 2740
 
2601 2741
 			$data = explode(',', substr($message, $pos1, $pos2 - $pos1));
2602 2742
 
2603
-			if (isset($tag['validate']))
2604
-				$tag['validate']($tag, $data, $disabled, $params);
2743
+			if (isset($tag['validate'])) {
2744
+							$tag['validate']($tag, $data, $disabled, $params);
2745
+			}
2605 2746
 
2606 2747
 			// Fix after, for disabled code mainly.
2607
-			foreach ($data as $k => $d)
2608
-				$tag['after'] = strtr($tag['after'], array('$' . ($k + 1) => trim($d)));
2748
+			foreach ($data as $k => $d) {
2749
+							$tag['after'] = strtr($tag['after'], array('$' . ($k + 1) => trim($d)));
2750
+			}
2609 2751
 
2610 2752
 			$open_tags[] = $tag;
2611 2753
 
2612 2754
 			// Replace them out, $1, $2, $3, $4, etc.
2613 2755
 			$code = $tag['before'];
2614
-			foreach ($data as $k => $d)
2615
-				$code = strtr($code, array('$' . ($k + 1) => trim($d)));
2756
+			foreach ($data as $k => $d) {
2757
+							$code = strtr($code, array('$' . ($k + 1) => trim($d)));
2758
+			}
2616 2759
 			$message = substr($message, 0, $pos) . "\n" . $code . "\n" . substr($message, $pos2 + 1);
2617 2760
 			$pos += strlen($code) - 1 + 2;
2618 2761
 		}
@@ -2623,28 +2766,33 @@  discard block
 block discarded – undo
2623 2766
 			if (isset($tag['quoted']))
2624 2767
 			{
2625 2768
 				$quoted = substr($message, $pos1, 6) == '&quot;';
2626
-				if ($tag['quoted'] != 'optional' && !$quoted)
2627
-					continue;
2769
+				if ($tag['quoted'] != 'optional' && !$quoted) {
2770
+									continue;
2771
+				}
2628 2772
 
2629
-				if ($quoted)
2630
-					$pos1 += 6;
2773
+				if ($quoted) {
2774
+									$pos1 += 6;
2775
+				}
2776
+			} else {
2777
+							$quoted = false;
2631 2778
 			}
2632
-			else
2633
-				$quoted = false;
2634 2779
 
2635 2780
 			$pos2 = strpos($message, $quoted == false ? ']' : '&quot;]', $pos1);
2636
-			if ($pos2 === false)
2637
-				continue;
2781
+			if ($pos2 === false) {
2782
+							continue;
2783
+			}
2638 2784
 
2639 2785
 			$data = substr($message, $pos1, $pos2 - $pos1);
2640 2786
 
2641 2787
 			// Validation for my parking, please!
2642
-			if (isset($tag['validate']))
2643
-				$tag['validate']($tag, $data, $disabled, $params);
2788
+			if (isset($tag['validate'])) {
2789
+							$tag['validate']($tag, $data, $disabled, $params);
2790
+			}
2644 2791
 
2645 2792
 			// For parsed content, we must recurse to avoid security problems.
2646
-			if ($tag['type'] != 'unparsed_equals')
2647
-				$data = parse_bbc($data, !empty($tag['parsed_tags_allowed']) ? false : true, '', !empty($tag['parsed_tags_allowed']) ? $tag['parsed_tags_allowed'] : array());
2793
+			if ($tag['type'] != 'unparsed_equals') {
2794
+							$data = parse_bbc($data, !empty($tag['parsed_tags_allowed']) ? false : true, '', !empty($tag['parsed_tags_allowed']) ? $tag['parsed_tags_allowed'] : array());
2795
+			}
2648 2796
 
2649 2797
 			$tag['after'] = strtr($tag['after'], array('$1' => $data));
2650 2798
 
@@ -2656,34 +2804,40 @@  discard block
 block discarded – undo
2656 2804
 		}
2657 2805
 
2658 2806
 		// If this is block level, eat any breaks after it.
2659
-		if (!empty($tag['block_level']) && substr($message, $pos + 1, 4) == '<br>')
2660
-			$message = substr($message, 0, $pos + 1) . substr($message, $pos + 5);
2807
+		if (!empty($tag['block_level']) && substr($message, $pos + 1, 4) == '<br>') {
2808
+					$message = substr($message, 0, $pos + 1) . substr($message, $pos + 5);
2809
+		}
2661 2810
 
2662 2811
 		// Are we trimming outside this tag?
2663
-		if (!empty($tag['trim']) && $tag['trim'] != 'outside' && preg_match('~(<br>|&nbsp;|\s)*~', substr($message, $pos + 1), $matches) != 0)
2664
-			$message = substr($message, 0, $pos + 1) . substr($message, $pos + 1 + strlen($matches[0]));
2812
+		if (!empty($tag['trim']) && $tag['trim'] != 'outside' && preg_match('~(<br>|&nbsp;|\s)*~', substr($message, $pos + 1), $matches) != 0) {
2813
+					$message = substr($message, 0, $pos + 1) . substr($message, $pos + 1 + strlen($matches[0]));
2814
+		}
2665 2815
 	}
2666 2816
 
2667 2817
 	// Close any remaining tags.
2668
-	while ($tag = array_pop($open_tags))
2669
-		$message .= "\n" . $tag['after'] . "\n";
2818
+	while ($tag = array_pop($open_tags)) {
2819
+			$message .= "\n" . $tag['after'] . "\n";
2820
+	}
2670 2821
 
2671 2822
 	// Parse the smileys within the parts where it can be done safely.
2672 2823
 	if ($smileys === true)
2673 2824
 	{
2674 2825
 		$message_parts = explode("\n", $message);
2675
-		for ($i = 0, $n = count($message_parts); $i < $n; $i += 2)
2676
-			parsesmileys($message_parts[$i]);
2826
+		for ($i = 0, $n = count($message_parts); $i < $n; $i += 2) {
2827
+					parsesmileys($message_parts[$i]);
2828
+		}
2677 2829
 
2678 2830
 		$message = implode('', $message_parts);
2679 2831
 	}
2680 2832
 
2681 2833
 	// No smileys, just get rid of the markers.
2682
-	else
2683
-		$message = strtr($message, array("\n" => ''));
2834
+	else {
2835
+			$message = strtr($message, array("\n" => ''));
2836
+	}
2684 2837
 
2685
-	if ($message !== '' && $message[0] === ' ')
2686
-		$message = '&nbsp;' . substr($message, 1);
2838
+	if ($message !== '' && $message[0] === ' ') {
2839
+			$message = '&nbsp;' . substr($message, 1);
2840
+	}
2687 2841
 
2688 2842
 	// Cleanup whitespace.
2689 2843
 	$message = strtr($message, array('  ' => ' &nbsp;', "\r" => '', "\n" => '<br>', '<br> ' => '<br>&nbsp;', '&#13;' => "\n"));
@@ -2692,15 +2846,16 @@  discard block
 block discarded – undo
2692 2846
 	call_integration_hook('integrate_post_parsebbc', array(&$message, &$smileys, &$cache_id, &$parse_tags));
2693 2847
 
2694 2848
 	// Cache the output if it took some time...
2695
-	if (isset($cache_key, $cache_t) && array_sum(explode(' ', microtime())) - array_sum(explode(' ', $cache_t)) > 0.05)
2696
-		cache_put_data($cache_key, $message, 240);
2849
+	if (isset($cache_key, $cache_t) && array_sum(explode(' ', microtime())) - array_sum(explode(' ', $cache_t)) > 0.05) {
2850
+			cache_put_data($cache_key, $message, 240);
2851
+	}
2697 2852
 
2698 2853
 	// If this was a force parse revert if needed.
2699 2854
 	if (!empty($parse_tags))
2700 2855
 	{
2701
-		if (empty($temp_bbc))
2702
-			$bbc_codes = array();
2703
-		else
2856
+		if (empty($temp_bbc)) {
2857
+					$bbc_codes = array();
2858
+		} else
2704 2859
 		{
2705 2860
 			$bbc_codes = $temp_bbc;
2706 2861
 			unset($temp_bbc);
@@ -2727,8 +2882,9 @@  discard block
 block discarded – undo
2727 2882
 	static $smileyPregSearch = null, $smileyPregReplacements = array();
2728 2883
 
2729 2884
 	// No smiley set at all?!
2730
-	if ($user_info['smiley_set'] == 'none' || trim($message) == '')
2731
-		return;
2885
+	if ($user_info['smiley_set'] == 'none' || trim($message) == '') {
2886
+			return;
2887
+	}
2732 2888
 
2733 2889
 	// If smileyPregSearch hasn't been set, do it now.
2734 2890
 	if (empty($smileyPregSearch))
@@ -2739,8 +2895,7 @@  discard block
 block discarded – undo
2739 2895
 			$smileysfrom = array('>:D', ':D', '::)', '>:(', ':))', ':)', ';)', ';D', ':(', ':o', '8)', ':P', '???', ':-[', ':-X', ':-*', ':\'(', ':-\\', '^-^', 'O0', 'C:-)', '0:)');
2740 2896
 			$smileysto = array('evil.gif', 'cheesy.gif', 'rolleyes.gif', 'angry.gif', 'laugh.gif', 'smiley.gif', 'wink.gif', 'grin.gif', 'sad.gif', 'shocked.gif', 'cool.gif', 'tongue.gif', 'huh.gif', 'embarrassed.gif', 'lipsrsealed.gif', 'kiss.gif', 'cry.gif', 'undecided.gif', 'azn.gif', 'afro.gif', 'police.gif', 'angel.gif');
2741 2897
 			$smileysdescs = array('', $txt['icon_cheesy'], $txt['icon_rolleyes'], $txt['icon_angry'], '', $txt['icon_smiley'], $txt['icon_wink'], $txt['icon_grin'], $txt['icon_sad'], $txt['icon_shocked'], $txt['icon_cool'], $txt['icon_tongue'], $txt['icon_huh'], $txt['icon_embarrassed'], $txt['icon_lips'], $txt['icon_kiss'], $txt['icon_cry'], $txt['icon_undecided'], '', '', '', '');
2742
-		}
2743
-		else
2898
+		} else
2744 2899
 		{
2745 2900
 			// Load the smileys in reverse order by length so they don't get parsed wrong.
2746 2901
 			if (($temp = cache_get_data('parsing_smileys', 480)) == null)
@@ -2764,9 +2919,9 @@  discard block
 block discarded – undo
2764 2919
 				$smcFunc['db_free_result']($result);
2765 2920
 
2766 2921
 				cache_put_data('parsing_smileys', array($smileysfrom, $smileysto, $smileysdescs), 480);
2922
+			} else {
2923
+							list ($smileysfrom, $smileysto, $smileysdescs) = $temp;
2767 2924
 			}
2768
-			else
2769
-				list ($smileysfrom, $smileysto, $smileysdescs) = $temp;
2770 2925
 		}
2771 2926
 
2772 2927
 		// The non-breaking-space is a complex thing...
@@ -2843,35 +2998,41 @@  discard block
 block discarded – undo
2843 2998
 	global $scripturl, $context, $modSettings, $db_show_debug, $db_cache;
2844 2999
 
2845 3000
 	// In case we have mail to send, better do that - as obExit doesn't always quite make it...
2846
-	if (!empty($context['flush_mail']))
2847
-		// @todo this relies on 'flush_mail' being only set in AddMailQueue itself... :\
3001
+	if (!empty($context['flush_mail'])) {
3002
+			// @todo this relies on 'flush_mail' being only set in AddMailQueue itself... :\
2848 3003
 		AddMailQueue(true);
3004
+	}
2849 3005
 
2850 3006
 	$add = preg_match('~^(ftp|http)[s]?://~', $setLocation) == 0 && substr($setLocation, 0, 6) != 'about:';
2851 3007
 
2852
-	if ($add)
2853
-		$setLocation = $scripturl . ($setLocation != '' ? '?' . $setLocation : '');
3008
+	if ($add) {
3009
+			$setLocation = $scripturl . ($setLocation != '' ? '?' . $setLocation : '');
3010
+	}
2854 3011
 
2855 3012
 	// Put the session ID in.
2856
-	if (defined('SID') && SID != '')
2857
-		$setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '(?!\?' . preg_quote(SID, '/') . ')\\??/', $scripturl . '?' . SID . ';', $setLocation);
3013
+	if (defined('SID') && SID != '') {
3014
+			$setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '(?!\?' . preg_quote(SID, '/') . ')\\??/', $scripturl . '?' . SID . ';', $setLocation);
3015
+	}
2858 3016
 	// Keep that debug in their for template debugging!
2859
-	elseif (isset($_GET['debug']))
2860
-		$setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '\\??/', $scripturl . '?debug;', $setLocation);
3017
+	elseif (isset($_GET['debug'])) {
3018
+			$setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '\\??/', $scripturl . '?debug;', $setLocation);
3019
+	}
2861 3020
 
2862 3021
 	if (!empty($modSettings['queryless_urls']) && (empty($context['server']['is_cgi']) || ini_get('cgi.fix_pathinfo') == 1 || @get_cfg_var('cgi.fix_pathinfo') == 1) && (!empty($context['server']['is_apache']) || !empty($context['server']['is_lighttpd']) || !empty($context['server']['is_litespeed'])))
2863 3022
 	{
2864
-		if (defined('SID') && SID != '')
2865
-			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#]+?)(#[^"]*?)?$~',
3023
+		if (defined('SID') && SID != '') {
3024
+					$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#]+?)(#[^"]*?)?$~',
2866 3025
 				function ($m) use ($scripturl)
2867 3026
 				{
2868 3027
 					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : "");
3028
+		}
2869 3029
 				}, $setLocation);
2870
-		else
2871
-			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~',
3030
+		else {
3031
+					$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~',
2872 3032
 				function ($m) use ($scripturl)
2873 3033
 				{
2874 3034
 					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : "");
3035
+		}
2875 3036
 				}, $setLocation);
2876 3037
 	}
2877 3038
 
@@ -2882,8 +3043,9 @@  discard block
 block discarded – undo
2882 3043
 	header('Location: ' . str_replace(' ', '%20', $setLocation), true, $permanent ? 301 : 302);
2883 3044
 
2884 3045
 	// Debugging.
2885
-	if (isset($db_show_debug) && $db_show_debug === true)
2886
-		$_SESSION['debug_redirect'] = $db_cache;
3046
+	if (isset($db_show_debug) && $db_show_debug === true) {
3047
+			$_SESSION['debug_redirect'] = $db_cache;
3048
+	}
2887 3049
 
2888 3050
 	obExit(false);
2889 3051
 }
@@ -2902,51 +3064,60 @@  discard block
 block discarded – undo
2902 3064
 
2903 3065
 	// Attempt to prevent a recursive loop.
2904 3066
 	++$level;
2905
-	if ($level > 1 && !$from_fatal_error && !$has_fatal_error)
2906
-		exit;
2907
-	if ($from_fatal_error)
2908
-		$has_fatal_error = true;
3067
+	if ($level > 1 && !$from_fatal_error && !$has_fatal_error) {
3068
+			exit;
3069
+	}
3070
+	if ($from_fatal_error) {
3071
+			$has_fatal_error = true;
3072
+	}
2909 3073
 
2910 3074
 	// Clear out the stat cache.
2911 3075
 	trackStats();
2912 3076
 
2913 3077
 	// If we have mail to send, send it.
2914
-	if (!empty($context['flush_mail']))
2915
-		// @todo this relies on 'flush_mail' being only set in AddMailQueue itself... :\
3078
+	if (!empty($context['flush_mail'])) {
3079
+			// @todo this relies on 'flush_mail' being only set in AddMailQueue itself... :\
2916 3080
 		AddMailQueue(true);
3081
+	}
2917 3082
 
2918 3083
 	$do_header = $header === null ? !$header_done : $header;
2919
-	if ($do_footer === null)
2920
-		$do_footer = $do_header;
3084
+	if ($do_footer === null) {
3085
+			$do_footer = $do_header;
3086
+	}
2921 3087
 
2922 3088
 	// Has the template/header been done yet?
2923 3089
 	if ($do_header)
2924 3090
 	{
2925 3091
 		// Was the page title set last minute? Also update the HTML safe one.
2926
-		if (!empty($context['page_title']) && empty($context['page_title_html_safe']))
2927
-			$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title'])) . (!empty($context['current_page']) ? ' - ' . $txt['page'] . ' ' . ($context['current_page'] + 1) : '');
3092
+		if (!empty($context['page_title']) && empty($context['page_title_html_safe'])) {
3093
+					$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title'])) . (!empty($context['current_page']) ? ' - ' . $txt['page'] . ' ' . ($context['current_page'] + 1) : '');
3094
+		}
2928 3095
 
2929 3096
 		// Start up the session URL fixer.
2930 3097
 		ob_start('ob_sessrewrite');
2931 3098
 
2932
-		if (!empty($settings['output_buffers']) && is_string($settings['output_buffers']))
2933
-			$buffers = explode(',', $settings['output_buffers']);
2934
-		elseif (!empty($settings['output_buffers']))
2935
-			$buffers = $settings['output_buffers'];
2936
-		else
2937
-			$buffers = array();
3099
+		if (!empty($settings['output_buffers']) && is_string($settings['output_buffers'])) {
3100
+					$buffers = explode(',', $settings['output_buffers']);
3101
+		} elseif (!empty($settings['output_buffers'])) {
3102
+					$buffers = $settings['output_buffers'];
3103
+		} else {
3104
+					$buffers = array();
3105
+		}
2938 3106
 
2939
-		if (isset($modSettings['integrate_buffer']))
2940
-			$buffers = array_merge(explode(',', $modSettings['integrate_buffer']), $buffers);
3107
+		if (isset($modSettings['integrate_buffer'])) {
3108
+					$buffers = array_merge(explode(',', $modSettings['integrate_buffer']), $buffers);
3109
+		}
2941 3110
 
2942
-		if (!empty($buffers))
2943
-			foreach ($buffers as $function)
3111
+		if (!empty($buffers)) {
3112
+					foreach ($buffers as $function)
2944 3113
 			{
2945 3114
 				$call = call_helper($function, true);
3115
+		}
2946 3116
 
2947 3117
 				// Is it valid?
2948
-				if (!empty($call))
2949
-					ob_start($call);
3118
+				if (!empty($call)) {
3119
+									ob_start($call);
3120
+				}
2950 3121
 			}
2951 3122
 
2952 3123
 		// Display the screen in the logical order.
@@ -2958,8 +3129,9 @@  discard block
 block discarded – undo
2958 3129
 		loadSubTemplate(isset($context['sub_template']) ? $context['sub_template'] : 'main');
2959 3130
 
2960 3131
 		// Anything special to put out?
2961
-		if (!empty($context['insert_after_template']) && !isset($_REQUEST['xml']))
2962
-			echo $context['insert_after_template'];
3132
+		if (!empty($context['insert_after_template']) && !isset($_REQUEST['xml'])) {
3133
+					echo $context['insert_after_template'];
3134
+		}
2963 3135
 
2964 3136
 		// Just so we don't get caught in an endless loop of errors from the footer...
2965 3137
 		if (!$footer_done)
@@ -2968,14 +3140,16 @@  discard block
 block discarded – undo
2968 3140
 			template_footer();
2969 3141
 
2970 3142
 			// (since this is just debugging... it's okay that it's after </html>.)
2971
-			if (!isset($_REQUEST['xml']))
2972
-				displayDebug();
3143
+			if (!isset($_REQUEST['xml'])) {
3144
+							displayDebug();
3145
+			}
2973 3146
 		}
2974 3147
 	}
2975 3148
 
2976 3149
 	// Remember this URL in case someone doesn't like sending HTTP_REFERER.
2977
-	if (strpos($_SERVER['REQUEST_URL'], 'action=dlattach') === false && strpos($_SERVER['REQUEST_URL'], 'action=viewsmfile') === false)
2978
-		$_SESSION['old_url'] = $_SERVER['REQUEST_URL'];
3150
+	if (strpos($_SERVER['REQUEST_URL'], 'action=dlattach') === false && strpos($_SERVER['REQUEST_URL'], 'action=viewsmfile') === false) {
3151
+			$_SESSION['old_url'] = $_SERVER['REQUEST_URL'];
3152
+	}
2979 3153
 
2980 3154
 	// For session check verification.... don't switch browsers...
2981 3155
 	$_SESSION['USER_AGENT'] = empty($_SERVER['HTTP_USER_AGENT']) ? '' : $_SERVER['HTTP_USER_AGENT'];
@@ -2984,9 +3158,10 @@  discard block
 block discarded – undo
2984 3158
 	call_integration_hook('integrate_exit', array($do_footer));
2985 3159
 
2986 3160
 	// Don't exit if we're coming from index.php; that will pass through normally.
2987
-	if (!$from_index)
2988
-		exit;
2989
-}
3161
+	if (!$from_index) {
3162
+			exit;
3163
+	}
3164
+	}
2990 3165
 
2991 3166
 /**
2992 3167
  * Get the size of a specified image with better error handling.
@@ -3005,8 +3180,9 @@  discard block
 block discarded – undo
3005 3180
 	$url = str_replace(' ', '%20', $url);
3006 3181
 
3007 3182
 	// Can we pull this from the cache... please please?
3008
-	if (($temp = cache_get_data('url_image_size-' . md5($url), 240)) !== null)
3009
-		return $temp;
3183
+	if (($temp = cache_get_data('url_image_size-' . md5($url), 240)) !== null) {
3184
+			return $temp;
3185
+	}
3010 3186
 	$t = microtime();
3011 3187
 
3012 3188
 	// Get the host to pester...
@@ -3016,12 +3192,10 @@  discard block
 block discarded – undo
3016 3192
 	if ($url == '' || $url == 'http://' || $url == 'https://')
3017 3193
 	{
3018 3194
 		return false;
3019
-	}
3020
-	elseif (!isset($match[1]))
3195
+	} elseif (!isset($match[1]))
3021 3196
 	{
3022 3197
 		$size = @getimagesize($url);
3023
-	}
3024
-	else
3198
+	} else
3025 3199
 	{
3026 3200
 		// Try to connect to the server... give it half a second.
3027 3201
 		$temp = 0;
@@ -3060,12 +3234,14 @@  discard block
 block discarded – undo
3060 3234
 	}
3061 3235
 
3062 3236
 	// If we didn't get it, we failed.
3063
-	if (!isset($size))
3064
-		$size = false;
3237
+	if (!isset($size)) {
3238
+			$size = false;
3239
+	}
3065 3240
 
3066 3241
 	// If this took a long time, we may never have to do it again, but then again we might...
3067
-	if (array_sum(explode(' ', microtime())) - array_sum(explode(' ', $t)) > 0.8)
3068
-		cache_put_data('url_image_size-' . md5($url), $size, 240);
3242
+	if (array_sum(explode(' ', microtime())) - array_sum(explode(' ', $t)) > 0.8) {
3243
+			cache_put_data('url_image_size-' . md5($url), $size, 240);
3244
+	}
3069 3245
 
3070 3246
 	// Didn't work.
3071 3247
 	return $size;
@@ -3083,8 +3259,9 @@  discard block
 block discarded – undo
3083 3259
 
3084 3260
 	// Under SSI this function can be called more then once.  That can cause some problems.
3085 3261
 	//   So only run the function once unless we are forced to run it again.
3086
-	if ($loaded && !$forceload)
3087
-		return;
3262
+	if ($loaded && !$forceload) {
3263
+			return;
3264
+	}
3088 3265
 
3089 3266
 	$loaded = true;
3090 3267
 
@@ -3096,14 +3273,16 @@  discard block
 block discarded – undo
3096 3273
 	$context['news_lines'] = array_filter(explode("\n", str_replace("\r", '', trim(addslashes($modSettings['news'])))));
3097 3274
 	for ($i = 0, $n = count($context['news_lines']); $i < $n; $i++)
3098 3275
 	{
3099
-		if (trim($context['news_lines'][$i]) == '')
3100
-			continue;
3276
+		if (trim($context['news_lines'][$i]) == '') {
3277
+					continue;
3278
+		}
3101 3279
 
3102 3280
 		// Clean it up for presentation ;).
3103 3281
 		$context['news_lines'][$i] = parse_bbc(stripslashes(trim($context['news_lines'][$i])), true, 'news' . $i);
3104 3282
 	}
3105
-	if (!empty($context['news_lines']))
3106
-		$context['random_news_line'] = $context['news_lines'][mt_rand(0, count($context['news_lines']) - 1)];
3283
+	if (!empty($context['news_lines'])) {
3284
+			$context['random_news_line'] = $context['news_lines'][mt_rand(0, count($context['news_lines']) - 1)];
3285
+	}
3107 3286
 
3108 3287
 	if (!$user_info['is_guest'])
3109 3288
 	{
@@ -3112,40 +3291,48 @@  discard block
 block discarded – undo
3112 3291
 		$context['user']['alerts'] = &$user_info['alerts'];
3113 3292
 
3114 3293
 		// Personal message popup...
3115
-		if ($user_info['unread_messages'] > (isset($_SESSION['unread_messages']) ? $_SESSION['unread_messages'] : 0))
3116
-			$context['user']['popup_messages'] = true;
3117
-		else
3118
-			$context['user']['popup_messages'] = false;
3294
+		if ($user_info['unread_messages'] > (isset($_SESSION['unread_messages']) ? $_SESSION['unread_messages'] : 0)) {
3295
+					$context['user']['popup_messages'] = true;
3296
+		} else {
3297
+					$context['user']['popup_messages'] = false;
3298
+		}
3119 3299
 		$_SESSION['unread_messages'] = $user_info['unread_messages'];
3120 3300
 
3121
-		if (allowedTo('moderate_forum'))
3122
-			$context['unapproved_members'] = (!empty($modSettings['registration_method']) && ($modSettings['registration_method'] == 2 || (!empty($modSettings['coppaType']) && $modSettings['coppaType'] == 2))) || !empty($modSettings['approveAccountDeletion']) ? $modSettings['unapprovedMembers'] : 0;
3301
+		if (allowedTo('moderate_forum')) {
3302
+					$context['unapproved_members'] = (!empty($modSettings['registration_method']) && ($modSettings['registration_method'] == 2 || (!empty($modSettings['coppaType']) && $modSettings['coppaType'] == 2))) || !empty($modSettings['approveAccountDeletion']) ? $modSettings['unapprovedMembers'] : 0;
3303
+		}
3123 3304
 
3124 3305
 		$context['user']['avatar'] = array();
3125 3306
 
3126 3307
 		// Check for gravatar first since we might be forcing them...
3127 3308
 		if (($modSettings['gravatarEnabled'] && substr($user_info['avatar']['url'], 0, 11) == 'gravatar://') || !empty($modSettings['gravatarOverride']))
3128 3309
 		{
3129
-			if (!empty($modSettings['gravatarAllowExtraEmail']) && stristr($user_info['avatar']['url'], 'gravatar://') && strlen($user_info['avatar']['url']) > 11)
3130
-				$context['user']['avatar']['href'] = get_gravatar_url($smcFunc['substr']($user_info['avatar']['url'], 11));
3131
-			else
3132
-				$context['user']['avatar']['href'] = get_gravatar_url($user_info['email']);
3310
+			if (!empty($modSettings['gravatarAllowExtraEmail']) && stristr($user_info['avatar']['url'], 'gravatar://') && strlen($user_info['avatar']['url']) > 11) {
3311
+							$context['user']['avatar']['href'] = get_gravatar_url($smcFunc['substr']($user_info['avatar']['url'], 11));
3312
+			} else {
3313
+							$context['user']['avatar']['href'] = get_gravatar_url($user_info['email']);
3314
+			}
3133 3315
 		}
3134 3316
 		// Uploaded?
3135
-		elseif ($user_info['avatar']['url'] == '' && !empty($user_info['avatar']['id_attach']))
3136
-			$context['user']['avatar']['href'] = $user_info['avatar']['custom_dir'] ? $modSettings['custom_avatar_url'] . '/' . $user_info['avatar']['filename'] : $scripturl . '?action=dlattach;attach=' . $user_info['avatar']['id_attach'] . ';type=avatar';
3317
+		elseif ($user_info['avatar']['url'] == '' && !empty($user_info['avatar']['id_attach'])) {
3318
+					$context['user']['avatar']['href'] = $user_info['avatar']['custom_dir'] ? $modSettings['custom_avatar_url'] . '/' . $user_info['avatar']['filename'] : $scripturl . '?action=dlattach;attach=' . $user_info['avatar']['id_attach'] . ';type=avatar';
3319
+		}
3137 3320
 		// Full URL?
3138
-		elseif (strpos($user_info['avatar']['url'], 'http://') === 0 || strpos($user_info['avatar']['url'], 'https://') === 0)
3139
-			$context['user']['avatar']['href'] = $user_info['avatar']['url'];
3321
+		elseif (strpos($user_info['avatar']['url'], 'http://') === 0 || strpos($user_info['avatar']['url'], 'https://') === 0) {
3322
+					$context['user']['avatar']['href'] = $user_info['avatar']['url'];
3323
+		}
3140 3324
 		// Otherwise we assume it's server stored.
3141
-		elseif ($user_info['avatar']['url'] != '')
3142
-			$context['user']['avatar']['href'] = $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($user_info['avatar']['url']);
3325
+		elseif ($user_info['avatar']['url'] != '') {
3326
+					$context['user']['avatar']['href'] = $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($user_info['avatar']['url']);
3327
+		}
3143 3328
 		// No avatar at all? Fine, we have a big fat default avatar ;)
3144
-		else
3145
-			$context['user']['avatar']['href'] = $modSettings['avatar_url'] . '/default.png';
3329
+		else {
3330
+					$context['user']['avatar']['href'] = $modSettings['avatar_url'] . '/default.png';
3331
+		}
3146 3332
 
3147
-		if (!empty($context['user']['avatar']))
3148
-			$context['user']['avatar']['image'] = '<img src="' . $context['user']['avatar']['href'] . '" alt="" class="avatar">';
3333
+		if (!empty($context['user']['avatar'])) {
3334
+					$context['user']['avatar']['image'] = '<img src="' . $context['user']['avatar']['href'] . '" alt="" class="avatar">';
3335
+		}
3149 3336
 
3150 3337
 		// Figure out how long they've been logged in.
3151 3338
 		$context['user']['total_time_logged_in'] = array(
@@ -3153,8 +3340,7 @@  discard block
 block discarded – undo
3153 3340
 			'hours' => floor(($user_info['total_time_logged_in'] % 86400) / 3600),
3154 3341
 			'minutes' => floor(($user_info['total_time_logged_in'] % 3600) / 60)
3155 3342
 		);
3156
-	}
3157
-	else
3343
+	} else
3158 3344
 	{
3159 3345
 		$context['user']['messages'] = 0;
3160 3346
 		$context['user']['unread_messages'] = 0;
@@ -3162,12 +3348,14 @@  discard block
 block discarded – undo
3162 3348
 		$context['user']['total_time_logged_in'] = array('days' => 0, 'hours' => 0, 'minutes' => 0);
3163 3349
 		$context['user']['popup_messages'] = false;
3164 3350
 
3165
-		if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1)
3166
-			$txt['welcome_guest'] .= $txt['welcome_guest_activate'];
3351
+		if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1) {
3352
+					$txt['welcome_guest'] .= $txt['welcome_guest_activate'];
3353
+		}
3167 3354
 
3168 3355
 		// If we've upgraded recently, go easy on the passwords.
3169
-		if (!empty($modSettings['disableHashTime']) && ($modSettings['disableHashTime'] == 1 || time() < $modSettings['disableHashTime']))
3170
-			$context['disable_login_hashing'] = true;
3356
+		if (!empty($modSettings['disableHashTime']) && ($modSettings['disableHashTime'] == 1 || time() < $modSettings['disableHashTime'])) {
3357
+					$context['disable_login_hashing'] = true;
3358
+		}
3171 3359
 	}
3172 3360
 
3173 3361
 	// Setup the main menu items.
@@ -3180,8 +3368,8 @@  discard block
 block discarded – undo
3180 3368
 	$context['show_pm_popup'] = $context['user']['popup_messages'] && !empty($options['popup_messages']) && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'pm');
3181 3369
 
3182 3370
 	// 2.1+: Add the PM popup here instead. Theme authors can still override it simply by editing/removing the 'fPmPopup' in the array.
3183
-	if ($context['show_pm_popup'])
3184
-		addInlineJavaScript('
3371
+	if ($context['show_pm_popup']) {
3372
+			addInlineJavaScript('
3185 3373
 		jQuery(document).ready(function($) {
3186 3374
 			new smc_Popup({
3187 3375
 				heading: ' . JavaScriptEscape($txt['show_personal_messages_heading']) . ',
@@ -3189,15 +3377,17 @@  discard block
 block discarded – undo
3189 3377
 				icon_class: \'generic_icons mail_new\'
3190 3378
 			});
3191 3379
 		});');
3380
+	}
3192 3381
 
3193 3382
 	// Add a generic "Are you sure?" confirmation message.
3194 3383
 	addInlineJavaScript('
3195 3384
 	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';');
3196 3385
 
3197 3386
 	// Now add the capping code for avatars.
3198
-	if (!empty($modSettings['avatar_max_width_external']) && !empty($modSettings['avatar_max_height_external']) && !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_css_resize')
3199
-		addInlineCss('
3387
+	if (!empty($modSettings['avatar_max_width_external']) && !empty($modSettings['avatar_max_height_external']) && !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_css_resize') {
3388
+			addInlineCss('
3200 3389
 img.avatar { max-width: ' . $modSettings['avatar_max_width_external'] . 'px; max-height: ' . $modSettings['avatar_max_height_external'] . 'px; }');
3390
+	}
3201 3391
 
3202 3392
 	// This looks weird, but it's because BoardIndex.php references the variable.
3203 3393
 	$context['common_stats']['latest_member'] = array(
@@ -3214,11 +3404,13 @@  discard block
 block discarded – undo
3214 3404
 	);
3215 3405
 	$context['common_stats']['boardindex_total_posts'] = sprintf($txt['boardindex_total_posts'], $context['common_stats']['total_posts'], $context['common_stats']['total_topics'], $context['common_stats']['total_members']);
3216 3406
 
3217
-	if (empty($settings['theme_version']))
3218
-		addJavaScriptVar('smf_scripturl', $scripturl);
3407
+	if (empty($settings['theme_version'])) {
3408
+			addJavaScriptVar('smf_scripturl', $scripturl);
3409
+	}
3219 3410
 
3220
-	if (!isset($context['page_title']))
3221
-		$context['page_title'] = '';
3411
+	if (!isset($context['page_title'])) {
3412
+			$context['page_title'] = '';
3413
+	}
3222 3414
 
3223 3415
 	// Set some specific vars.
3224 3416
 	$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title'])) . (!empty($context['current_page']) ? ' - ' . $txt['page'] . ' ' . ($context['current_page'] + 1) : '');
@@ -3228,21 +3420,23 @@  discard block
 block discarded – undo
3228 3420
 	$context['meta_tags'][] = array('property' => 'og:site_name', 'content' => $context['forum_name']);
3229 3421
 	$context['meta_tags'][] = array('property' => 'og:title', 'content' => $context['page_title_html_safe']);
3230 3422
 
3231
-	if (!empty($context['meta_keywords']))
3232
-		$context['meta_tags'][] = array('name' => 'keywords', 'content' => $context['meta_keywords']);
3423
+	if (!empty($context['meta_keywords'])) {
3424
+			$context['meta_tags'][] = array('name' => 'keywords', 'content' => $context['meta_keywords']);
3425
+	}
3233 3426
 
3234
-	if (!empty($context['canonical_url']))
3235
-		$context['meta_tags'][] = array('property' => 'og:url', 'content' => $context['canonical_url']);
3427
+	if (!empty($context['canonical_url'])) {
3428
+			$context['meta_tags'][] = array('property' => 'og:url', 'content' => $context['canonical_url']);
3429
+	}
3236 3430
 
3237
-	if (!empty($settings['og_image']))
3238
-		$context['meta_tags'][] = array('property' => 'og:image', 'content' => $settings['og_image']);
3431
+	if (!empty($settings['og_image'])) {
3432
+			$context['meta_tags'][] = array('property' => 'og:image', 'content' => $settings['og_image']);
3433
+	}
3239 3434
 
3240 3435
 	if (!empty($context['meta_description']))
3241 3436
 	{
3242 3437
 		$context['meta_tags'][] = array('property' => 'og:description', 'content' => $context['meta_description']);
3243 3438
 		$context['meta_tags'][] = array('name' => 'description', 'content' => $context['meta_description']);
3244
-	}
3245
-	else
3439
+	} else
3246 3440
 	{
3247 3441
 		$context['meta_tags'][] = array('property' => 'og:description', 'content' => $context['page_title_html_safe']);
3248 3442
 		$context['meta_tags'][] = array('name' => 'description', 'content' => $context['page_title_html_safe']);
@@ -3267,8 +3461,9 @@  discard block
 block discarded – undo
3267 3461
 	$memory_needed = memoryReturnBytes($needed);
3268 3462
 
3269 3463
 	// should we account for how much is currently being used?
3270
-	if ($in_use)
3271
-		$memory_needed += function_exists('memory_get_usage') ? memory_get_usage() : (2 * 1048576);
3464
+	if ($in_use) {
3465
+			$memory_needed += function_exists('memory_get_usage') ? memory_get_usage() : (2 * 1048576);
3466
+	}
3272 3467
 
3273 3468
 	// if more is needed, request it
3274 3469
 	if ($memory_current < $memory_needed)
@@ -3291,8 +3486,9 @@  discard block
 block discarded – undo
3291 3486
  */
3292 3487
 function memoryReturnBytes($val)
3293 3488
 {
3294
-	if (is_integer($val))
3295
-		return $val;
3489
+	if (is_integer($val)) {
3490
+			return $val;
3491
+	}
3296 3492
 
3297 3493
 	// Separate the number from the designator
3298 3494
 	$val = trim($val);
@@ -3328,10 +3524,11 @@  discard block
 block discarded – undo
3328 3524
 		header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
3329 3525
 
3330 3526
 		// Are we debugging the template/html content?
3331
-		if (!isset($_REQUEST['xml']) && isset($_GET['debug']) && !isBrowser('ie'))
3332
-			header('Content-Type: application/xhtml+xml');
3333
-		elseif (!isset($_REQUEST['xml']))
3334
-			header('Content-Type: text/html; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
3527
+		if (!isset($_REQUEST['xml']) && isset($_GET['debug']) && !isBrowser('ie')) {
3528
+					header('Content-Type: application/xhtml+xml');
3529
+		} elseif (!isset($_REQUEST['xml'])) {
3530
+					header('Content-Type: text/html; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
3531
+		}
3335 3532
 	}
3336 3533
 
3337 3534
 	header('Content-Type: text/' . (isset($_REQUEST['xml']) ? 'xml' : 'html') . '; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
@@ -3340,8 +3537,9 @@  discard block
 block discarded – undo
3340 3537
 	if ($context['in_maintenance'] && $context['user']['is_admin'])
3341 3538
 	{
3342 3539
 		$position = array_search('body', $context['template_layers']);
3343
-		if ($position === false)
3344
-			$position = array_search('main', $context['template_layers']);
3540
+		if ($position === false) {
3541
+					$position = array_search('main', $context['template_layers']);
3542
+		}
3345 3543
 
3346 3544
 		if ($position !== false)
3347 3545
 		{
@@ -3369,23 +3567,25 @@  discard block
 block discarded – undo
3369 3567
 
3370 3568
 			foreach ($securityFiles as $i => $securityFile)
3371 3569
 			{
3372
-				if (!file_exists($boarddir . '/' . $securityFile))
3373
-					unset($securityFiles[$i]);
3570
+				if (!file_exists($boarddir . '/' . $securityFile)) {
3571
+									unset($securityFiles[$i]);
3572
+				}
3374 3573
 			}
3375 3574
 
3376 3575
 			// We are already checking so many files...just few more doesn't make any difference! :P
3377
-			if (!empty($modSettings['currentAttachmentUploadDir']))
3378
-				$path = $modSettings['attachmentUploadDir'][$modSettings['currentAttachmentUploadDir']];
3379
-
3380
-			else
3381
-				$path = $modSettings['attachmentUploadDir'];
3576
+			if (!empty($modSettings['currentAttachmentUploadDir'])) {
3577
+							$path = $modSettings['attachmentUploadDir'][$modSettings['currentAttachmentUploadDir']];
3578
+			} else {
3579
+							$path = $modSettings['attachmentUploadDir'];
3580
+			}
3382 3581
 
3383 3582
 			secureDirectory($path, true);
3384 3583
 			secureDirectory($cachedir);
3385 3584
 
3386 3585
 			// If agreement is enabled, at least the english version shall exists
3387
-			if ($modSettings['requireAgreement'])
3388
-				$agreement = !file_exists($boarddir . '/agreement.txt');
3586
+			if ($modSettings['requireAgreement']) {
3587
+							$agreement = !file_exists($boarddir . '/agreement.txt');
3588
+			}
3389 3589
 
3390 3590
 			if (!empty($securityFiles) || (!empty($modSettings['cache_enable']) && !is_writable($cachedir)) || !empty($agreement))
3391 3591
 			{
@@ -3400,18 +3600,21 @@  discard block
 block discarded – undo
3400 3600
 					echo '
3401 3601
 				', $txt['not_removed'], '<strong>', $securityFile, '</strong>!<br>';
3402 3602
 
3403
-					if ($securityFile == 'Settings.php~' || $securityFile == 'Settings_bak.php~')
3404
-						echo '
3603
+					if ($securityFile == 'Settings.php~' || $securityFile == 'Settings_bak.php~') {
3604
+											echo '
3405 3605
 				', sprintf($txt['not_removed_extra'], $securityFile, substr($securityFile, 0, -1)), '<br>';
3606
+					}
3406 3607
 				}
3407 3608
 
3408
-				if (!empty($modSettings['cache_enable']) && !is_writable($cachedir))
3409
-					echo '
3609
+				if (!empty($modSettings['cache_enable']) && !is_writable($cachedir)) {
3610
+									echo '
3410 3611
 				<strong>', $txt['cache_writable'], '</strong><br>';
3612
+				}
3411 3613
 
3412
-				if (!empty($agreement))
3413
-					echo '
3614
+				if (!empty($agreement)) {
3615
+									echo '
3414 3616
 				<strong>', $txt['agreement_missing'], '</strong><br>';
3617
+				}
3415 3618
 
3416 3619
 				echo '
3417 3620
 			</p>
@@ -3426,16 +3629,18 @@  discard block
 block discarded – undo
3426 3629
 				<div class="windowbg alert" style="margin: 2ex; padding: 2ex; border: 2px dashed red;">
3427 3630
 					', sprintf($txt['you_are_post_banned'], $user_info['is_guest'] ? $txt['guest_title'] : $user_info['name']);
3428 3631
 
3429
-			if (!empty($_SESSION['ban']['cannot_post']['reason']))
3430
-				echo '
3632
+			if (!empty($_SESSION['ban']['cannot_post']['reason'])) {
3633
+							echo '
3431 3634
 					<div style="padding-left: 4ex; padding-top: 1ex;">', $_SESSION['ban']['cannot_post']['reason'], '</div>';
3635
+			}
3432 3636
 
3433
-			if (!empty($_SESSION['ban']['expire_time']))
3434
-				echo '
3637
+			if (!empty($_SESSION['ban']['expire_time'])) {
3638
+							echo '
3435 3639
 					<div>', sprintf($txt['your_ban_expires'], timeformat($_SESSION['ban']['expire_time'], false)), '</div>';
3436
-			else
3437
-				echo '
3640
+			} else {
3641
+							echo '
3438 3642
 					<div>', $txt['your_ban_expires_never'], '</div>';
3643
+			}
3439 3644
 
3440 3645
 			echo '
3441 3646
 				</div>';
@@ -3451,8 +3656,9 @@  discard block
 block discarded – undo
3451 3656
 	global $forum_copyright, $software_year, $forum_version;
3452 3657
 
3453 3658
 	// Don't display copyright for things like SSI.
3454
-	if (!isset($forum_version) || !isset($software_year))
3455
-		return;
3659
+	if (!isset($forum_version) || !isset($software_year)) {
3660
+			return;
3661
+	}
3456 3662
 
3457 3663
 	// Put in the version...
3458 3664
 	printf($forum_copyright, $forum_version, $software_year);
@@ -3470,9 +3676,10 @@  discard block
 block discarded – undo
3470 3676
 	$context['load_time'] = comma_format(round(array_sum(explode(' ', microtime())) - array_sum(explode(' ', $time_start)), 3));
3471 3677
 	$context['load_queries'] = $db_count;
3472 3678
 
3473
-	foreach (array_reverse($context['template_layers']) as $layer)
3474
-		loadSubTemplate($layer . '_below', true);
3475
-}
3679
+	foreach (array_reverse($context['template_layers']) as $layer) {
3680
+			loadSubTemplate($layer . '_below', true);
3681
+	}
3682
+	}
3476 3683
 
3477 3684
 /**
3478 3685
  * Output the Javascript files
@@ -3503,8 +3710,7 @@  discard block
 block discarded – undo
3503 3710
 			{
3504 3711
 				echo '
3505 3712
 		var ', $key, ';';
3506
-			}
3507
-			else
3713
+			} else
3508 3714
 			{
3509 3715
 				echo '
3510 3716
 		var ', $key, ' = ', $value, ';';
@@ -3519,26 +3725,27 @@  discard block
 block discarded – undo
3519 3725
 	foreach ($context['javascript_files'] as $id => $js_file)
3520 3726
 	{
3521 3727
 		// Last minute call! allow theme authors to disable single files.
3522
-		if (!empty($settings['disable_files']) && in_array($id, $settings['disable_files']))
3523
-			continue;
3728
+		if (!empty($settings['disable_files']) && in_array($id, $settings['disable_files'])) {
3729
+					continue;
3730
+		}
3524 3731
 
3525 3732
 		// By default all files don't get minimized unless the file explicitly says so!
3526 3733
 		if (!empty($js_file['options']['minimize']) && !empty($modSettings['minimize_files']))
3527 3734
 		{
3528
-			if ($do_deferred && !empty($js_file['options']['defer']))
3529
-				$toMinifyDefer[] = $js_file;
3530
-
3531
-			elseif (!$do_deferred && empty($js_file['options']['defer']))
3532
-				$toMinify[] = $js_file;
3735
+			if ($do_deferred && !empty($js_file['options']['defer'])) {
3736
+							$toMinifyDefer[] = $js_file;
3737
+			} elseif (!$do_deferred && empty($js_file['options']['defer'])) {
3738
+							$toMinify[] = $js_file;
3739
+			}
3533 3740
 
3534 3741
 			// Grab a random seed.
3535
-			if (!isset($minSeed))
3536
-				$minSeed = $js_file['options']['seed'];
3537
-		}
3538
-
3539
-		elseif ((!$do_deferred && empty($js_file['options']['defer'])) || ($do_deferred && !empty($js_file['options']['defer'])))
3540
-			echo '
3742
+			if (!isset($minSeed)) {
3743
+							$minSeed = $js_file['options']['seed'];
3744
+			}
3745
+		} elseif ((!$do_deferred && empty($js_file['options']['defer'])) || ($do_deferred && !empty($js_file['options']['defer']))) {
3746
+					echo '
3541 3747
 	<script src="', $js_file['fileUrl'], '"', !empty($js_file['options']['async']) ? ' async="async"' : '', '></script>';
3748
+		}
3542 3749
 	}
3543 3750
 
3544 3751
 	if ((!$do_deferred && !empty($toMinify)) || ($do_deferred && !empty($toMinifyDefer)))
@@ -3546,14 +3753,14 @@  discard block
 block discarded – undo
3546 3753
 		$result = custMinify(($do_deferred ? $toMinifyDefer : $toMinify), 'js', $do_deferred);
3547 3754
 
3548 3755
 		// Minify process couldn't work, print each individual files.
3549
-		if (!empty($result) && is_array($result))
3550
-			foreach ($result as $minFailedFile)
3756
+		if (!empty($result) && is_array($result)) {
3757
+					foreach ($result as $minFailedFile)
3551 3758
 				echo '
3552 3759
 	<script src="', $minFailedFile['fileUrl'], '"', !empty($minFailedFile['options']['async']) ? ' async="async"' : '', '></script>';
3553
-
3554
-		else
3555
-			echo '
3760
+		} else {
3761
+					echo '
3556 3762
 	<script src="', $settings['theme_url'] ,'/scripts/minified', ($do_deferred ? '_deferred' : '') ,'.js', $minSeed ,'"></script>';
3763
+		}
3557 3764
 	}
3558 3765
 
3559 3766
 	// Inline JavaScript - Actually useful some times!
@@ -3564,8 +3771,9 @@  discard block
 block discarded – undo
3564 3771
 			echo '
3565 3772
 <script>';
3566 3773
 
3567
-			foreach ($context['javascript_inline']['defer'] as $js_code)
3568
-				echo $js_code;
3774
+			foreach ($context['javascript_inline']['defer'] as $js_code) {
3775
+							echo $js_code;
3776
+			}
3569 3777
 
3570 3778
 			echo '
3571 3779
 </script>';
@@ -3576,8 +3784,9 @@  discard block
 block discarded – undo
3576 3784
 			echo '
3577 3785
 	<script>';
3578 3786
 
3579
-			foreach ($context['javascript_inline']['standard'] as $js_code)
3580
-				echo $js_code;
3787
+			foreach ($context['javascript_inline']['standard'] as $js_code) {
3788
+							echo $js_code;
3789
+			}
3581 3790
 
3582 3791
 			echo '
3583 3792
 	</script>';
@@ -3602,8 +3811,9 @@  discard block
 block discarded – undo
3602 3811
 	foreach ($context['css_files'] as $id => $file)
3603 3812
 	{
3604 3813
 		// Last minute call! allow theme authors to disable single files.
3605
-		if (!empty($settings['disable_files']) && in_array($id, $settings['disable_files']))
3606
-			continue;
3814
+		if (!empty($settings['disable_files']) && in_array($id, $settings['disable_files'])) {
3815
+					continue;
3816
+		}
3607 3817
 
3608 3818
 		// By default all files don't get minimized unless the file explicitly says so!
3609 3819
 		if (!empty($file['options']['minimize']) && !empty($modSettings['minimize_files']))
@@ -3611,12 +3821,12 @@  discard block
 block discarded – undo
3611 3821
 			$toMinify[] = $file;
3612 3822
 
3613 3823
 			// Grab a random seed.
3614
-			if (!isset($minSeed))
3615
-				$minSeed = $file['options']['seed'];
3824
+			if (!isset($minSeed)) {
3825
+							$minSeed = $file['options']['seed'];
3826
+			}
3827
+		} else {
3828
+					$normal[] = $file['fileUrl'];
3616 3829
 		}
3617
-
3618
-		else
3619
-			$normal[] = $file['fileUrl'];
3620 3830
 	}
3621 3831
 
3622 3832
 	if (!empty($toMinify))
@@ -3624,28 +3834,30 @@  discard block
 block discarded – undo
3624 3834
 		$result = custMinify($toMinify, 'css');
3625 3835
 
3626 3836
 		// Minify process couldn't work, print each individual files.
3627
-		if (!empty($result) && is_array($result))
3628
-			foreach ($result as $minFailedFile)
3837
+		if (!empty($result) && is_array($result)) {
3838
+					foreach ($result as $minFailedFile)
3629 3839
 				echo '
3630 3840
 	<link rel="stylesheet" href="', $minFailedFile['fileUrl'], '">';
3631
-
3632
-		else
3633
-			echo '
3841
+		} else {
3842
+					echo '
3634 3843
 	<link rel="stylesheet" href="', $settings['theme_url'] ,'/css/minified.css', $minSeed ,'">';
3844
+		}
3635 3845
 	}
3636 3846
 
3637 3847
 	// Print the rest after the minified files.
3638
-	if (!empty($normal))
3639
-		foreach ($normal as $nf)
3848
+	if (!empty($normal)) {
3849
+			foreach ($normal as $nf)
3640 3850
 			echo '
3641 3851
 	<link rel="stylesheet" href="', $nf ,'">';
3852
+	}
3642 3853
 
3643 3854
 	if ($db_show_debug === true)
3644 3855
 	{
3645 3856
 		// Try to keep only what's useful.
3646 3857
 		$repl = array($boardurl . '/Themes/' => '', $boardurl . '/' => '');
3647
-		foreach ($context['css_files'] as $file)
3648
-			$context['debug']['sheets'][] = strtr($file['fileName'], $repl);
3858
+		foreach ($context['css_files'] as $file) {
3859
+					$context['debug']['sheets'][] = strtr($file['fileName'], $repl);
3860
+		}
3649 3861
 	}
3650 3862
 
3651 3863
 	if (!empty($context['css_header']))
@@ -3653,9 +3865,10 @@  discard block
 block discarded – undo
3653 3865
 		echo '
3654 3866
 	<style>';
3655 3867
 
3656
-		foreach ($context['css_header'] as $css)
3657
-			echo $css .'
3868
+		foreach ($context['css_header'] as $css) {
3869
+					echo $css .'
3658 3870
 	';
3871
+		}
3659 3872
 
3660 3873
 		echo'
3661 3874
 	</style>';
@@ -3679,15 +3892,17 @@  discard block
 block discarded – undo
3679 3892
 	$type = !empty($type) && in_array($type, $types) ? $type : false;
3680 3893
 	$data = !empty($data) ? $data : false;
3681 3894
 
3682
-	if (empty($type) || empty($data))
3683
-		return false;
3895
+	if (empty($type) || empty($data)) {
3896
+			return false;
3897
+	}
3684 3898
 
3685 3899
 	// Did we already did this?
3686 3900
 	$toCache = cache_get_data('minimized_'. $settings['theme_id'] .'_'. $type, 86400);
3687 3901
 
3688 3902
 	// Already done?
3689
-	if (!empty($toCache))
3690
-		return true;
3903
+	if (!empty($toCache)) {
3904
+			return true;
3905
+	}
3691 3906
 
3692 3907
 	// No namespaces, sorry!
3693 3908
 	$classType = 'MatthiasMullie\\Minify\\'. strtoupper($type);
@@ -3769,8 +3984,9 @@  discard block
 block discarded – undo
3769 3984
 	global $modSettings, $smcFunc;
3770 3985
 
3771 3986
 	// Just make up a nice hash...
3772
-	if ($new)
3773
-		return sha1(md5($filename . time()) . mt_rand());
3987
+	if ($new) {
3988
+			return sha1(md5($filename . time()) . mt_rand());
3989
+	}
3774 3990
 
3775 3991
 	// Just make sure that attachment id is only a int
3776 3992
 	$attachment_id = (int) $attachment_id;
@@ -3787,23 +4003,25 @@  discard block
 block discarded – undo
3787 4003
 				'id_attach' => $attachment_id,
3788 4004
 			));
3789 4005
 
3790
-		if ($smcFunc['db_num_rows']($request) === 0)
3791
-			return false;
4006
+		if ($smcFunc['db_num_rows']($request) === 0) {
4007
+					return false;
4008
+		}
3792 4009
 
3793 4010
 		list ($file_hash) = $smcFunc['db_fetch_row']($request);
3794 4011
 		$smcFunc['db_free_result']($request);
3795 4012
 	}
3796 4013
 
3797 4014
 	// Still no hash? mmm...
3798
-	if (empty($file_hash))
3799
-		$file_hash = sha1(md5($filename . time()) . mt_rand());
4015
+	if (empty($file_hash)) {
4016
+			$file_hash = sha1(md5($filename . time()) . mt_rand());
4017
+	}
3800 4018
 
3801 4019
 	// Are we using multiple directories?
3802
-	if (is_array($modSettings['attachmentUploadDir']))
3803
-		$path = $modSettings['attachmentUploadDir'][$dir];
3804
-
3805
-	else
3806
-		$path = $modSettings['attachmentUploadDir'];
4020
+	if (is_array($modSettings['attachmentUploadDir'])) {
4021
+			$path = $modSettings['attachmentUploadDir'][$dir];
4022
+	} else {
4023
+			$path = $modSettings['attachmentUploadDir'];
4024
+	}
3807 4025
 
3808 4026
 	return $path . '/' . $attachment_id . '_' . $file_hash .'.dat';
3809 4027
 }
@@ -3818,8 +4036,9 @@  discard block
 block discarded – undo
3818 4036
 function ip2range($fullip)
3819 4037
 {
3820 4038
 	// Pretend that 'unknown' is 255.255.255.255. (since that can't be an IP anyway.)
3821
-	if ($fullip == 'unknown')
3822
-		$fullip = '255.255.255.255';
4039
+	if ($fullip == 'unknown') {
4040
+			$fullip = '255.255.255.255';
4041
+	}
3823 4042
 
3824 4043
 	$ip_parts = explode('-', $fullip);
3825 4044
 	$ip_array = array();
@@ -3843,10 +4062,11 @@  discard block
 block discarded – undo
3843 4062
 		$ip_array['low'] = $ip_parts[0];
3844 4063
 		$ip_array['high'] = $ip_parts[1];
3845 4064
 		return $ip_array;
3846
-	}
3847
-	elseif (count($ip_parts) == 2) // if ip 22.22.*-22.22.*
4065
+	} elseif (count($ip_parts) == 2) {
4066
+		// if ip 22.22.*-22.22.*
3848 4067
 	{
3849 4068
 		$valid_low = isValidIP($ip_parts[0]);
4069
+	}
3850 4070
 		$valid_high = isValidIP($ip_parts[1]);
3851 4071
 		$count = 0;
3852 4072
 		$mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.');
@@ -3861,7 +4081,9 @@  discard block
 block discarded – undo
3861 4081
 				$ip_parts[0] .= $mode . $min;
3862 4082
 				$valid_low = isValidIP($ip_parts[0]);
3863 4083
 				$count++;
3864
-				if ($count > 9) break;
4084
+				if ($count > 9) {
4085
+					break;
4086
+				}
3865 4087
 			}
3866 4088
 		}
3867 4089
 
@@ -3875,7 +4097,9 @@  discard block
 block discarded – undo
3875 4097
 				$ip_parts[1] .= $mode . $max;
3876 4098
 				$valid_high = isValidIP($ip_parts[1]);
3877 4099
 				$count++;
3878
-				if ($count > 9) break;
4100
+				if ($count > 9) {
4101
+					break;
4102
+				}
3879 4103
 			}
3880 4104
 		}
3881 4105
 
@@ -3900,46 +4124,54 @@  discard block
 block discarded – undo
3900 4124
 {
3901 4125
 	global $modSettings;
3902 4126
 
3903
-	if (($host = cache_get_data('hostlookup-' . $ip, 600)) !== null)
3904
-		return $host;
4127
+	if (($host = cache_get_data('hostlookup-' . $ip, 600)) !== null) {
4128
+			return $host;
4129
+	}
3905 4130
 	$t = microtime();
3906 4131
 
3907 4132
 	// Try the Linux host command, perhaps?
3908 4133
 	if (!isset($host) && (strpos(strtolower(PHP_OS), 'win') === false || strpos(strtolower(PHP_OS), 'darwin') !== false) && mt_rand(0, 1) == 1)
3909 4134
 	{
3910
-		if (!isset($modSettings['host_to_dis']))
3911
-			$test = @shell_exec('host -W 1 ' . @escapeshellarg($ip));
3912
-		else
3913
-			$test = @shell_exec('host ' . @escapeshellarg($ip));
4135
+		if (!isset($modSettings['host_to_dis'])) {
4136
+					$test = @shell_exec('host -W 1 ' . @escapeshellarg($ip));
4137
+		} else {
4138
+					$test = @shell_exec('host ' . @escapeshellarg($ip));
4139
+		}
3914 4140
 
3915 4141
 		// Did host say it didn't find anything?
3916
-		if (strpos($test, 'not found') !== false)
3917
-			$host = '';
4142
+		if (strpos($test, 'not found') !== false) {
4143
+					$host = '';
4144
+		}
3918 4145
 		// Invalid server option?
3919
-		elseif ((strpos($test, 'invalid option') || strpos($test, 'Invalid query name 1')) && !isset($modSettings['host_to_dis']))
3920
-			updateSettings(array('host_to_dis' => 1));
4146
+		elseif ((strpos($test, 'invalid option') || strpos($test, 'Invalid query name 1')) && !isset($modSettings['host_to_dis'])) {
4147
+					updateSettings(array('host_to_dis' => 1));
4148
+		}
3921 4149
 		// Maybe it found something, after all?
3922
-		elseif (preg_match('~\s([^\s]+?)\.\s~', $test, $match) == 1)
3923
-			$host = $match[1];
4150
+		elseif (preg_match('~\s([^\s]+?)\.\s~', $test, $match) == 1) {
4151
+					$host = $match[1];
4152
+		}
3924 4153
 	}
3925 4154
 
3926 4155
 	// This is nslookup; usually only Windows, but possibly some Unix?
3927 4156
 	if (!isset($host) && stripos(PHP_OS, 'win') !== false && strpos(strtolower(PHP_OS), 'darwin') === false && mt_rand(0, 1) == 1)
3928 4157
 	{
3929 4158
 		$test = @shell_exec('nslookup -timeout=1 ' . @escapeshellarg($ip));
3930
-		if (strpos($test, 'Non-existent domain') !== false)
3931
-			$host = '';
3932
-		elseif (preg_match('~Name:\s+([^\s]+)~', $test, $match) == 1)
3933
-			$host = $match[1];
4159
+		if (strpos($test, 'Non-existent domain') !== false) {
4160
+					$host = '';
4161
+		} elseif (preg_match('~Name:\s+([^\s]+)~', $test, $match) == 1) {
4162
+					$host = $match[1];
4163
+		}
3934 4164
 	}
3935 4165
 
3936 4166
 	// This is the last try :/.
3937
-	if (!isset($host) || $host === false)
3938
-		$host = @gethostbyaddr($ip);
4167
+	if (!isset($host) || $host === false) {
4168
+			$host = @gethostbyaddr($ip);
4169
+	}
3939 4170
 
3940 4171
 	// It took a long time, so let's cache it!
3941
-	if (array_sum(explode(' ', microtime())) - array_sum(explode(' ', $t)) > 0.5)
3942
-		cache_put_data('hostlookup-' . $ip, $host, 600);
4172
+	if (array_sum(explode(' ', microtime())) - array_sum(explode(' ', $t)) > 0.5) {
4173
+			cache_put_data('hostlookup-' . $ip, $host, 600);
4174
+	}
3943 4175
 
3944 4176
 	return $host;
3945 4177
 }
@@ -3975,20 +4207,21 @@  discard block
 block discarded – undo
3975 4207
 			{
3976 4208
 				$encrypted = substr(crypt($word, 'uk'), 2, $max_chars);
3977 4209
 				$total = 0;
3978
-				for ($i = 0; $i < $max_chars; $i++)
3979
-					$total += $possible_chars[ord($encrypted{$i})] * pow(63, $i);
4210
+				for ($i = 0; $i < $max_chars; $i++) {
4211
+									$total += $possible_chars[ord($encrypted{$i})] * pow(63, $i);
4212
+				}
3980 4213
 				$returned_ints[] = $max_chars == 4 ? min($total, 16777215) : $total;
3981 4214
 			}
3982 4215
 		}
3983 4216
 		return array_unique($returned_ints);
3984
-	}
3985
-	else
4217
+	} else
3986 4218
 	{
3987 4219
 		// Trim characters before and after and add slashes for database insertion.
3988 4220
 		$returned_words = array();
3989
-		foreach ($words as $word)
3990
-			if (($word = trim($word, '-_\'')) !== '')
4221
+		foreach ($words as $word) {
4222
+					if (($word = trim($word, '-_\'')) !== '')
3991 4223
 				$returned_words[] = $max_chars === null ? $word : substr($word, 0, $max_chars);
4224
+		}
3992 4225
 
3993 4226
 		// Filter out all words that occur more than once.
3994 4227
 		return array_unique($returned_words);
@@ -4010,16 +4243,18 @@  discard block
 block discarded – undo
4010 4243
 	global $settings, $txt;
4011 4244
 
4012 4245
 	// Does the current loaded theme have this and we are not forcing the usage of this function?
4013
-	if (function_exists('template_create_button') && !$force_use)
4014
-		return template_create_button($name, $alt, $label = '', $custom = '');
4246
+	if (function_exists('template_create_button') && !$force_use) {
4247
+			return template_create_button($name, $alt, $label = '', $custom = '');
4248
+	}
4015 4249
 
4016
-	if (!$settings['use_image_buttons'])
4017
-		return $txt[$alt];
4018
-	elseif (!empty($settings['use_buttons']))
4019
-		return '<span class="generic_icons ' . $name . '" alt="' . $txt[$alt] . '"></span>' . ($label != '' ? '&nbsp;<strong>' . $txt[$label] . '</strong>' : '');
4020
-	else
4021
-		return '<img src="' . $settings['lang_images_url'] . '/' . $name . '" alt="' . $txt[$alt] . '" ' . $custom . '>';
4022
-}
4250
+	if (!$settings['use_image_buttons']) {
4251
+			return $txt[$alt];
4252
+	} elseif (!empty($settings['use_buttons'])) {
4253
+			return '<span class="generic_icons ' . $name . '" alt="' . $txt[$alt] . '"></span>' . ($label != '' ? '&nbsp;<strong>' . $txt[$label] . '</strong>' : '');
4254
+	} else {
4255
+			return '<img src="' . $settings['lang_images_url'] . '/' . $name . '" alt="' . $txt[$alt] . '" ' . $custom . '>';
4256
+	}
4257
+	}
4023 4258
 
4024 4259
 /**
4025 4260
  * Sets up all of the top menu buttons
@@ -4062,9 +4297,10 @@  discard block
 block discarded – undo
4062 4297
 	var user_menus = new smc_PopupMenu();
4063 4298
 	user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup");
4064 4299
 	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true);
4065
-		if ($context['allow_pm'])
4066
-			addInlineJavaScript('
4300
+		if ($context['allow_pm']) {
4301
+					addInlineJavaScript('
4067 4302
 	user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true);
4303
+		}
4068 4304
 
4069 4305
 		if (!empty($modSettings['enable_ajax_alerts']))
4070 4306
 		{
@@ -4224,88 +4460,96 @@  discard block
 block discarded – undo
4224 4460
 
4225 4461
 		// Now we put the buttons in the context so the theme can use them.
4226 4462
 		$menu_buttons = array();
4227
-		foreach ($buttons as $act => $button)
4228
-			if (!empty($button['show']))
4463
+		foreach ($buttons as $act => $button) {
4464
+					if (!empty($button['show']))
4229 4465
 			{
4230 4466
 				$button['active_button'] = false;
4467
+		}
4231 4468
 
4232 4469
 				// This button needs some action.
4233
-				if (isset($button['action_hook']))
4234
-					$needs_action_hook = true;
4470
+				if (isset($button['action_hook'])) {
4471
+									$needs_action_hook = true;
4472
+				}
4235 4473
 
4236 4474
 				// Make sure the last button truly is the last button.
4237 4475
 				if (!empty($button['is_last']))
4238 4476
 				{
4239
-					if (isset($last_button))
4240
-						unset($menu_buttons[$last_button]['is_last']);
4477
+					if (isset($last_button)) {
4478
+											unset($menu_buttons[$last_button]['is_last']);
4479
+					}
4241 4480
 					$last_button = $act;
4242 4481
 				}
4243 4482
 
4244 4483
 				// Go through the sub buttons if there are any.
4245
-				if (!empty($button['sub_buttons']))
4246
-					foreach ($button['sub_buttons'] as $key => $subbutton)
4484
+				if (!empty($button['sub_buttons'])) {
4485
+									foreach ($button['sub_buttons'] as $key => $subbutton)
4247 4486
 					{
4248 4487
 						if (empty($subbutton['show']))
4249 4488
 							unset($button['sub_buttons'][$key]);
4489
+				}
4250 4490
 
4251 4491
 						// 2nd level sub buttons next...
4252 4492
 						if (!empty($subbutton['sub_buttons']))
4253 4493
 						{
4254 4494
 							foreach ($subbutton['sub_buttons'] as $key2 => $sub_button2)
4255 4495
 							{
4256
-								if (empty($sub_button2['show']))
4257
-									unset($button['sub_buttons'][$key]['sub_buttons'][$key2]);
4496
+								if (empty($sub_button2['show'])) {
4497
+																	unset($button['sub_buttons'][$key]['sub_buttons'][$key2]);
4498
+								}
4258 4499
 							}
4259 4500
 						}
4260 4501
 					}
4261 4502
 
4262 4503
 				// Does this button have its own icon?
4263
-				if (isset($button['icon']) && file_exists($settings['theme_dir'] . '/images/' . $button['icon']))
4264
-					$button['icon'] = '<img src="' . $settings['images_url'] . '/' . $button['icon'] . '" alt="">';
4265
-				elseif (isset($button['icon']) && file_exists($settings['default_theme_dir'] . '/images/' . $button['icon']))
4266
-					$button['icon'] = '<img src="' . $settings['default_images_url'] . '/' . $button['icon'] . '" alt="">';
4267
-				elseif (isset($button['icon']))
4268
-					$button['icon'] = '<span class="generic_icons ' . $button['icon'] . '"></span>';
4269
-				else
4270
-					$button['icon'] = '<span class="generic_icons ' . $act . '"></span>';
4504
+				if (isset($button['icon']) && file_exists($settings['theme_dir'] . '/images/' . $button['icon'])) {
4505
+									$button['icon'] = '<img src="' . $settings['images_url'] . '/' . $button['icon'] . '" alt="">';
4506
+				} elseif (isset($button['icon']) && file_exists($settings['default_theme_dir'] . '/images/' . $button['icon'])) {
4507
+									$button['icon'] = '<img src="' . $settings['default_images_url'] . '/' . $button['icon'] . '" alt="">';
4508
+				} elseif (isset($button['icon'])) {
4509
+									$button['icon'] = '<span class="generic_icons ' . $button['icon'] . '"></span>';
4510
+				} else {
4511
+									$button['icon'] = '<span class="generic_icons ' . $act . '"></span>';
4512
+				}
4271 4513
 
4272 4514
 				$menu_buttons[$act] = $button;
4273 4515
 			}
4274 4516
 
4275
-		if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2)
4276
-			cache_put_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $menu_buttons, $cacheTime);
4517
+		if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) {
4518
+					cache_put_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $menu_buttons, $cacheTime);
4519
+		}
4277 4520
 	}
4278 4521
 
4279 4522
 	$context['menu_buttons'] = $menu_buttons;
4280 4523
 
4281 4524
 	// Logging out requires the session id in the url.
4282
-	if (isset($context['menu_buttons']['logout']))
4283
-		$context['menu_buttons']['logout']['href'] = sprintf($context['menu_buttons']['logout']['href'], $context['session_var'], $context['session_id']);
4525
+	if (isset($context['menu_buttons']['logout'])) {
4526
+			$context['menu_buttons']['logout']['href'] = sprintf($context['menu_buttons']['logout']['href'], $context['session_var'], $context['session_id']);
4527
+	}
4284 4528
 
4285 4529
 	// Figure out which action we are doing so we can set the active tab.
4286 4530
 	// Default to home.
4287 4531
 	$current_action = 'home';
4288 4532
 
4289
-	if (isset($context['menu_buttons'][$context['current_action']]))
4290
-		$current_action = $context['current_action'];
4291
-	elseif ($context['current_action'] == 'search2')
4292
-		$current_action = 'search';
4293
-	elseif ($context['current_action'] == 'theme')
4294
-		$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
4295
-	elseif ($context['current_action'] == 'register2')
4296
-		$current_action = 'register';
4297
-	elseif ($context['current_action'] == 'login2' || ($user_info['is_guest'] && $context['current_action'] == 'reminder'))
4298
-		$current_action = 'login';
4299
-	elseif ($context['current_action'] == 'groups' && $context['allow_moderation_center'])
4300
-		$current_action = 'moderate';
4533
+	if (isset($context['menu_buttons'][$context['current_action']])) {
4534
+			$current_action = $context['current_action'];
4535
+	} elseif ($context['current_action'] == 'search2') {
4536
+			$current_action = 'search';
4537
+	} elseif ($context['current_action'] == 'theme') {
4538
+			$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
4539
+	} elseif ($context['current_action'] == 'register2') {
4540
+			$current_action = 'register';
4541
+	} elseif ($context['current_action'] == 'login2' || ($user_info['is_guest'] && $context['current_action'] == 'reminder')) {
4542
+			$current_action = 'login';
4543
+	} elseif ($context['current_action'] == 'groups' && $context['allow_moderation_center']) {
4544
+			$current_action = 'moderate';
4545
+	}
4301 4546
 
4302 4547
 	// There are certain exceptions to the above where we don't want anything on the menu highlighted.
4303 4548
 	if ($context['current_action'] == 'profile' && !empty($context['user']['is_owner']))
4304 4549
 	{
4305 4550
 		$current_action = !empty($_GET['area']) && $_GET['area'] == 'showalerts' ? 'self_alerts' : 'self_profile';
4306 4551
 		$context[$current_action] = true;
4307
-	}
4308
-	elseif ($context['current_action'] == 'pm')
4552
+	} elseif ($context['current_action'] == 'pm')
4309 4553
 	{
4310 4554
 		$current_action = 'self_pm';
4311 4555
 		$context['self_pm'] = true;
@@ -4346,12 +4590,14 @@  discard block
 block discarded – undo
4346 4590
 	}
4347 4591
 
4348 4592
 	// Not all actions are simple.
4349
-	if (!empty($needs_action_hook))
4350
-		call_integration_hook('integrate_current_action', array(&$current_action));
4593
+	if (!empty($needs_action_hook)) {
4594
+			call_integration_hook('integrate_current_action', array(&$current_action));
4595
+	}
4351 4596
 
4352
-	if (isset($context['menu_buttons'][$current_action]))
4353
-		$context['menu_buttons'][$current_action]['active_button'] = true;
4354
-}
4597
+	if (isset($context['menu_buttons'][$current_action])) {
4598
+			$context['menu_buttons'][$current_action]['active_button'] = true;
4599
+	}
4600
+	}
4355 4601
 
4356 4602
 /**
4357 4603
  * Generate a random seed and ensure it's stored in settings.
@@ -4375,30 +4621,35 @@  discard block
 block discarded – undo
4375 4621
 	global $modSettings, $settings, $boarddir, $sourcedir, $db_show_debug;
4376 4622
 	global $context, $txt;
4377 4623
 
4378
-	if ($db_show_debug === true)
4379
-		$context['debug']['hooks'][] = $hook;
4624
+	if ($db_show_debug === true) {
4625
+			$context['debug']['hooks'][] = $hook;
4626
+	}
4380 4627
 
4381 4628
 	// Need to have some control.
4382
-	if (!isset($context['instances']))
4383
-		$context['instances'] = array();
4629
+	if (!isset($context['instances'])) {
4630
+			$context['instances'] = array();
4631
+	}
4384 4632
 
4385 4633
 	$results = array();
4386
-	if (empty($modSettings[$hook]))
4387
-		return $results;
4634
+	if (empty($modSettings[$hook])) {
4635
+			return $results;
4636
+	}
4388 4637
 
4389 4638
 	$functions = explode(',', $modSettings[$hook]);
4390 4639
 	// Loop through each function.
4391 4640
 	foreach ($functions as $function)
4392 4641
 	{
4393 4642
 		// Hook has been marked as "disabled". Skip it!
4394
-		if (strpos($function, '!') !== false)
4395
-			continue;
4643
+		if (strpos($function, '!') !== false) {
4644
+					continue;
4645
+		}
4396 4646
 
4397 4647
 		$call = call_helper($function, true);
4398 4648
 
4399 4649
 		// Is it valid?
4400
-		if (!empty($call))
4401
-			$results[$function] = call_user_func_array($call, $parameters);
4650
+		if (!empty($call)) {
4651
+					$results[$function] = call_user_func_array($call, $parameters);
4652
+		}
4402 4653
 
4403 4654
 		// Whatever it was suppose to call, it failed :(
4404 4655
 		elseif (!empty($function))
@@ -4414,8 +4665,9 @@  discard block
 block discarded – undo
4414 4665
 			}
4415 4666
 
4416 4667
 			// "Assume" the file resides on $boarddir somewhere...
4417
-			else
4418
-				log_error(sprintf($txt['hook_fail_call_to'], $function, $boarddir), 'general');
4668
+			else {
4669
+							log_error(sprintf($txt['hook_fail_call_to'], $function, $boarddir), 'general');
4670
+			}
4419 4671
 		}
4420 4672
 	}
4421 4673
 
@@ -4437,12 +4689,14 @@  discard block
 block discarded – undo
4437 4689
 	global $smcFunc, $modSettings;
4438 4690
 
4439 4691
 	// Any objects?
4440
-	if ($object)
4441
-		$function = $function . '#';
4692
+	if ($object) {
4693
+			$function = $function . '#';
4694
+	}
4442 4695
 
4443 4696
 	// Any files  to load?
4444
-	if (!empty($file) && is_string($file))
4445
-		$function = $file . (!empty($function) ? '|' . $function : '');
4697
+	if (!empty($file) && is_string($file)) {
4698
+			$function = $file . (!empty($function) ? '|' . $function : '');
4699
+	}
4446 4700
 
4447 4701
 	// Get the correct string.
4448 4702
 	$integration_call = $function;
@@ -4464,13 +4718,14 @@  discard block
 block discarded – undo
4464 4718
 		if (!empty($current_functions))
4465 4719
 		{
4466 4720
 			$current_functions = explode(',', $current_functions);
4467
-			if (in_array($integration_call, $current_functions))
4468
-				return;
4721
+			if (in_array($integration_call, $current_functions)) {
4722
+							return;
4723
+			}
4469 4724
 
4470 4725
 			$permanent_functions = array_merge($current_functions, array($integration_call));
4726
+		} else {
4727
+					$permanent_functions = array($integration_call);
4471 4728
 		}
4472
-		else
4473
-			$permanent_functions = array($integration_call);
4474 4729
 
4475 4730
 		updateSettings(array($hook => implode(',', $permanent_functions)));
4476 4731
 	}
@@ -4479,8 +4734,9 @@  discard block
 block discarded – undo
4479 4734
 	$functions = empty($modSettings[$hook]) ? array() : explode(',', $modSettings[$hook]);
4480 4735
 
4481 4736
 	// Do nothing, if it's already there.
4482
-	if (in_array($integration_call, $functions))
4483
-		return;
4737
+	if (in_array($integration_call, $functions)) {
4738
+			return;
4739
+	}
4484 4740
 
4485 4741
 	$functions[] = $integration_call;
4486 4742
 	$modSettings[$hook] = implode(',', $functions);
@@ -4503,12 +4759,14 @@  discard block
 block discarded – undo
4503 4759
 	global $smcFunc, $modSettings;
4504 4760
 
4505 4761
 	// Any objects?
4506
-	if ($object)
4507
-		$function = $function . '#';
4762
+	if ($object) {
4763
+			$function = $function . '#';
4764
+	}
4508 4765
 
4509 4766
 	// Any files  to load?
4510
-	if (!empty($file) && is_string($file))
4511
-		$function = $file . '|' . $function;
4767
+	if (!empty($file) && is_string($file)) {
4768
+			$function = $file . '|' . $function;
4769
+	}
4512 4770
 
4513 4771
 	// Get the correct string.
4514 4772
 	$integration_call = $function;
@@ -4529,16 +4787,18 @@  discard block
 block discarded – undo
4529 4787
 	{
4530 4788
 		$current_functions = explode(',', $current_functions);
4531 4789
 
4532
-		if (in_array($integration_call, $current_functions))
4533
-			updateSettings(array($hook => implode(',', array_diff($current_functions, array($integration_call)))));
4790
+		if (in_array($integration_call, $current_functions)) {
4791
+					updateSettings(array($hook => implode(',', array_diff($current_functions, array($integration_call)))));
4792
+		}
4534 4793
 	}
4535 4794
 
4536 4795
 	// Turn the function list into something usable.
4537 4796
 	$functions = empty($modSettings[$hook]) ? array() : explode(',', $modSettings[$hook]);
4538 4797
 
4539 4798
 	// You can only remove it if it's available.
4540
-	if (!in_array($integration_call, $functions))
4541
-		return;
4799
+	if (!in_array($integration_call, $functions)) {
4800
+			return;
4801
+	}
4542 4802
 
4543 4803
 	$functions = array_diff($functions, array($integration_call));
4544 4804
 	$modSettings[$hook] = implode(',', $functions);
@@ -4559,17 +4819,20 @@  discard block
 block discarded – undo
4559 4819
 	global $context, $smcFunc, $txt, $db_show_debug;
4560 4820
 
4561 4821
 	// Really?
4562
-	if (empty($string))
4563
-		return false;
4822
+	if (empty($string)) {
4823
+			return false;
4824
+	}
4564 4825
 
4565 4826
 	// An array? should be a "callable" array IE array(object/class, valid_callable).
4566 4827
 	// A closure? should be a callable one.
4567
-	if (is_array($string) || $string instanceof Closure)
4568
-		return $return ? $string : (is_callable($string) ? call_user_func($string) : false);
4828
+	if (is_array($string) || $string instanceof Closure) {
4829
+			return $return ? $string : (is_callable($string) ? call_user_func($string) : false);
4830
+	}
4569 4831
 
4570 4832
 	// No full objects, sorry! pass a method or a property instead!
4571
-	if (is_object($string))
4572
-		return false;
4833
+	if (is_object($string)) {
4834
+			return false;
4835
+	}
4573 4836
 
4574 4837
 	// Stay vitaminized my friends...
4575 4838
 	$string = $smcFunc['htmlspecialchars']($smcFunc['htmltrim']($string));
@@ -4578,8 +4841,9 @@  discard block
 block discarded – undo
4578 4841
 	$string = load_file($string);
4579 4842
 
4580 4843
 	// Loaded file failed
4581
-	if (empty($string))
4582
-		return false;
4844
+	if (empty($string)) {
4845
+			return false;
4846
+	}
4583 4847
 
4584 4848
 	// Found a method.
4585 4849
 	if (strpos($string, '::') !== false)
@@ -4600,8 +4864,9 @@  discard block
 block discarded – undo
4600 4864
 				// Add another one to the list.
4601 4865
 				if ($db_show_debug === true)
4602 4866
 				{
4603
-					if (!isset($context['debug']['instances']))
4604
-						$context['debug']['instances'] = array();
4867
+					if (!isset($context['debug']['instances'])) {
4868
+											$context['debug']['instances'] = array();
4869
+					}
4605 4870
 
4606 4871
 					$context['debug']['instances'][$class] = $class;
4607 4872
 				}
@@ -4611,13 +4876,15 @@  discard block
 block discarded – undo
4611 4876
 		}
4612 4877
 
4613 4878
 		// Right then. This is a call to a static method.
4614
-		else
4615
-			$func = array($class, $method);
4879
+		else {
4880
+					$func = array($class, $method);
4881
+		}
4616 4882
 	}
4617 4883
 
4618 4884
 	// Nope! just a plain regular function.
4619
-	else
4620
-		$func = $string;
4885
+	else {
4886
+			$func = $string;
4887
+	}
4621 4888
 
4622 4889
 	// Right, we got what we need, time to do some checks.
4623 4890
 	if (!is_callable($func, false, $callable_name))
@@ -4633,17 +4900,18 @@  discard block
 block discarded – undo
4633 4900
 	else
4634 4901
 	{
4635 4902
 		// What are we gonna do about it?
4636
-		if ($return)
4637
-			return $func;
4903
+		if ($return) {
4904
+					return $func;
4905
+		}
4638 4906
 
4639 4907
 		// If this is a plain function, avoid the heat of calling call_user_func().
4640 4908
 		else
4641 4909
 		{
4642
-			if (is_array($func))
4643
-				call_user_func($func);
4644
-
4645
-			else
4646
-				$func();
4910
+			if (is_array($func)) {
4911
+							call_user_func($func);
4912
+			} else {
4913
+							$func();
4914
+			}
4647 4915
 		}
4648 4916
 	}
4649 4917
 }
@@ -4660,31 +4928,34 @@  discard block
 block discarded – undo
4660 4928
 {
4661 4929
 	global $sourcedir, $txt, $boarddir, $settings;
4662 4930
 
4663
-	if (empty($string))
4664
-		return false;
4931
+	if (empty($string)) {
4932
+			return false;
4933
+	}
4665 4934
 
4666 4935
 	if (strpos($string, '|') !== false)
4667 4936
 	{
4668 4937
 		list ($file, $string) = explode('|', $string);
4669 4938
 
4670 4939
 		// Match the wildcards to their regular vars.
4671
-		if (empty($settings['theme_dir']))
4672
-			$absPath = strtr(trim($file), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir));
4673
-
4674
-		else
4675
-			$absPath = strtr(trim($file), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir']));
4940
+		if (empty($settings['theme_dir'])) {
4941
+					$absPath = strtr(trim($file), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir));
4942
+		} else {
4943
+					$absPath = strtr(trim($file), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir']));
4944
+		}
4676 4945
 
4677 4946
 		// Load the file if it can be loaded.
4678
-		if (file_exists($absPath))
4679
-			require_once($absPath);
4947
+		if (file_exists($absPath)) {
4948
+					require_once($absPath);
4949
+		}
4680 4950
 
4681 4951
 		// No? try a fallback to $sourcedir
4682 4952
 		else
4683 4953
 		{
4684 4954
 			$absPath = $sourcedir .'/'. $file;
4685 4955
 
4686
-			if (file_exists($absPath))
4687
-				require_once($absPath);
4956
+			if (file_exists($absPath)) {
4957
+							require_once($absPath);
4958
+			}
4688 4959
 
4689 4960
 			// Sorry, can't do much for you at this point.
4690 4961
 			else
@@ -4711,8 +4982,9 @@  discard block
 block discarded – undo
4711 4982
 	global $user_info, $smcFunc;
4712 4983
 
4713 4984
 	// Make sure we have something to work with.
4714
-	if (empty($topic))
4715
-		return array();
4985
+	if (empty($topic)) {
4986
+			return array();
4987
+	}
4716 4988
 
4717 4989
 
4718 4990
 	// We already know the number of likes per message, we just want to know whether the current user liked it or not.
@@ -4735,8 +5007,9 @@  discard block
 block discarded – undo
4735 5007
 				'topic' => $topic,
4736 5008
 			)
4737 5009
 		);
4738
-		while ($row = $smcFunc['db_fetch_assoc']($request))
4739
-			$temp[] = (int) $row['content_id'];
5010
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
5011
+					$temp[] = (int) $row['content_id'];
5012
+		}
4740 5013
 
4741 5014
 		cache_put_data($cache_key, $temp, $ttl);
4742 5015
 	}
@@ -4757,8 +5030,9 @@  discard block
 block discarded – undo
4757 5030
 {
4758 5031
 	global $context;
4759 5032
 
4760
-	if (empty($string))
4761
-		return $string;
5033
+	if (empty($string)) {
5034
+			return $string;
5035
+	}
4762 5036
 
4763 5037
 	// UTF-8 occurences of MS special characters
4764 5038
 	$findchars_utf8 = array(
@@ -4799,10 +5073,11 @@  discard block
 block discarded – undo
4799 5073
 		'--',	// &mdash;
4800 5074
 	);
4801 5075
 
4802
-	if ($context['utf8'])
4803
-		$string = str_replace($findchars_utf8, $replacechars, $string);
4804
-	else
4805
-		$string = str_replace($findchars_iso, $replacechars, $string);
5076
+	if ($context['utf8']) {
5077
+			$string = str_replace($findchars_utf8, $replacechars, $string);
5078
+	} else {
5079
+			$string = str_replace($findchars_iso, $replacechars, $string);
5080
+	}
4806 5081
 
4807 5082
 	return $string;
4808 5083
 }
@@ -4821,49 +5096,59 @@  discard block
 block discarded – undo
4821 5096
 {
4822 5097
 	global $context;
4823 5098
 
4824
-	if (!isset($matches[2]))
4825
-		return '';
5099
+	if (!isset($matches[2])) {
5100
+			return '';
5101
+	}
4826 5102
 
4827 5103
 	$num = $matches[2][0] === 'x' ? hexdec(substr($matches[2], 1)) : (int) $matches[2];
4828 5104
 
4829 5105
 	// remove left to right / right to left overrides
4830
-	if ($num === 0x202D || $num === 0x202E)
4831
-		return '';
5106
+	if ($num === 0x202D || $num === 0x202E) {
5107
+			return '';
5108
+	}
4832 5109
 
4833 5110
 	// Quote, Ampersand, Apostrophe, Less/Greater Than get html replaced
4834
-	if (in_array($num, array(0x22, 0x26, 0x27, 0x3C, 0x3E)))
4835
-		return '&#' . $num . ';';
5111
+	if (in_array($num, array(0x22, 0x26, 0x27, 0x3C, 0x3E))) {
5112
+			return '&#' . $num . ';';
5113
+	}
4836 5114
 
4837 5115
 	if (empty($context['utf8']))
4838 5116
 	{
4839 5117
 		// no control characters
4840
-		if ($num < 0x20)
4841
-			return '';
5118
+		if ($num < 0x20) {
5119
+					return '';
5120
+		}
4842 5121
 		// text is text
4843
-		elseif ($num < 0x80)
4844
-			return chr($num);
5122
+		elseif ($num < 0x80) {
5123
+					return chr($num);
5124
+		}
4845 5125
 		// all others get html-ised
4846
-		else
4847
-			return '&#' . $matches[2] . ';';
4848
-	}
4849
-	else
5126
+		else {
5127
+					return '&#' . $matches[2] . ';';
5128
+		}
5129
+	} else
4850 5130
 	{
4851 5131
 		// <0x20 are control characters, 0x20 is a space, > 0x10FFFF is past the end of the utf8 character set
4852 5132
 		// 0xD800 >= $num <= 0xDFFF are surrogate markers (not valid for utf8 text)
4853
-		if ($num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF))
4854
-			return '';
5133
+		if ($num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF)) {
5134
+					return '';
5135
+		}
4855 5136
 		// <0x80 (or less than 128) are standard ascii characters a-z A-Z 0-9 and punctuation
4856
-		elseif ($num < 0x80)
4857
-			return chr($num);
5137
+		elseif ($num < 0x80) {
5138
+					return chr($num);
5139
+		}
4858 5140
 		// <0x800 (2048)
4859
-		elseif ($num < 0x800)
4860
-			return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
5141
+		elseif ($num < 0x800) {
5142
+					return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
5143
+		}
4861 5144
 		// < 0x10000 (65536)
4862
-		elseif ($num < 0x10000)
4863
-			return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
5145
+		elseif ($num < 0x10000) {
5146
+					return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
5147
+		}
4864 5148
 		// <= 0x10FFFF (1114111)
4865
-		else
4866
-			return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
5149
+		else {
5150
+					return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
5151
+		}
4867 5152
 	}
4868 5153
 }
4869 5154
 
@@ -4879,28 +5164,34 @@  discard block
 block discarded – undo
4879 5164
  */
4880 5165
 function fixchar__callback($matches)
4881 5166
 {
4882
-	if (!isset($matches[1]))
4883
-		return '';
5167
+	if (!isset($matches[1])) {
5168
+			return '';
5169
+	}
4884 5170
 
4885 5171
 	$num = $matches[1][0] === 'x' ? hexdec(substr($matches[1], 1)) : (int) $matches[1];
4886 5172
 
4887 5173
 	// <0x20 are control characters, > 0x10FFFF is past the end of the utf8 character set
4888 5174
 	// 0xD800 >= $num <= 0xDFFF are surrogate markers (not valid for utf8 text), 0x202D-E are left to right overrides
4889
-	if ($num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num === 0x202D || $num === 0x202E)
4890
-		return '';
5175
+	if ($num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num === 0x202D || $num === 0x202E) {
5176
+			return '';
5177
+	}
4891 5178
 	// <0x80 (or less than 128) are standard ascii characters a-z A-Z 0-9 and punctuation
4892
-	elseif ($num < 0x80)
4893
-		return chr($num);
5179
+	elseif ($num < 0x80) {
5180
+			return chr($num);
5181
+	}
4894 5182
 	// <0x800 (2048)
4895
-	elseif ($num < 0x800)
4896
-		return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
5183
+	elseif ($num < 0x800) {
5184
+			return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
5185
+	}
4897 5186
 	// < 0x10000 (65536)
4898
-	elseif ($num < 0x10000)
4899
-		return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
5187
+	elseif ($num < 0x10000) {
5188
+			return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
5189
+	}
4900 5190
 	// <= 0x10FFFF (1114111)
4901
-	else
4902
-		return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
4903
-}
5191
+	else {
5192
+			return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
5193
+	}
5194
+	}
4904 5195
 
4905 5196
 /**
4906 5197
  * Strips out invalid html entities, replaces others with html style &#123; codes
@@ -4913,17 +5204,19 @@  discard block
 block discarded – undo
4913 5204
  */
4914 5205
 function entity_fix__callback($matches)
4915 5206
 {
4916
-	if (!isset($matches[2]))
4917
-		return '';
5207
+	if (!isset($matches[2])) {
5208
+			return '';
5209
+	}
4918 5210
 
4919 5211
 	$num = $matches[2][0] === 'x' ? hexdec(substr($matches[2], 1)) : (int) $matches[2];
4920 5212
 
4921 5213
 	// we don't allow control characters, characters out of range, byte markers, etc
4922
-	if ($num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num == 0x202D || $num == 0x202E)
4923
-		return '';
4924
-	else
4925
-		return '&#' . $num . ';';
4926
-}
5214
+	if ($num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num == 0x202D || $num == 0x202E) {
5215
+			return '';
5216
+	} else {
5217
+			return '&#' . $num . ';';
5218
+	}
5219
+	}
4927 5220
 
4928 5221
 /**
4929 5222
  * Return a Gravatar URL based on
@@ -4947,18 +5240,23 @@  discard block
 block discarded – undo
4947 5240
 		$ratings = array('G', 'PG', 'R', 'X');
4948 5241
 		$defaults = array('mm', 'identicon', 'monsterid', 'wavatar', 'retro', 'blank');
4949 5242
 		$url_params = array();
4950
-		if (!empty($modSettings['gravatarMaxRating']) && in_array($modSettings['gravatarMaxRating'], $ratings))
4951
-			$url_params[] = 'rating=' . $modSettings['gravatarMaxRating'];
4952
-		if (!empty($modSettings['gravatarDefault']) && in_array($modSettings['gravatarDefault'], $defaults))
4953
-			$url_params[] = 'default=' . $modSettings['gravatarDefault'];
4954
-		if (!empty($modSettings['avatar_max_width_external']))
4955
-			$size_string = (int) $modSettings['avatar_max_width_external'];
4956
-		if (!empty($modSettings['avatar_max_height_external']) && !empty($size_string))
4957
-			if ((int) $modSettings['avatar_max_height_external'] < $size_string)
5243
+		if (!empty($modSettings['gravatarMaxRating']) && in_array($modSettings['gravatarMaxRating'], $ratings)) {
5244
+					$url_params[] = 'rating=' . $modSettings['gravatarMaxRating'];
5245
+		}
5246
+		if (!empty($modSettings['gravatarDefault']) && in_array($modSettings['gravatarDefault'], $defaults)) {
5247
+					$url_params[] = 'default=' . $modSettings['gravatarDefault'];
5248
+		}
5249
+		if (!empty($modSettings['avatar_max_width_external'])) {
5250
+					$size_string = (int) $modSettings['avatar_max_width_external'];
5251
+		}
5252
+		if (!empty($modSettings['avatar_max_height_external']) && !empty($size_string)) {
5253
+					if ((int) $modSettings['avatar_max_height_external'] < $size_string)
4958 5254
 				$size_string = $modSettings['avatar_max_height_external'];
5255
+		}
4959 5256
 
4960
-		if (!empty($size_string))
4961
-			$url_params[] = 's=' . $size_string;
5257
+		if (!empty($size_string)) {
5258
+					$url_params[] = 's=' . $size_string;
5259
+		}
4962 5260
 	}
4963 5261
 	$http_method = !empty($modSettings['force_ssl']) && $modSettings['force_ssl'] == 2 ? 'https://secure' : 'http://www';
4964 5262
 
@@ -4977,22 +5275,26 @@  discard block
 block discarded – undo
4977 5275
 	static $timezones = null, $lastwhen = null;
4978 5276
 
4979 5277
 	// No point doing this over if we already did it once
4980
-	if (!empty($timezones) && $when == $lastwhen)
4981
-		return $timezones;
4982
-	else
4983
-		$lastwhen = $when;
5278
+	if (!empty($timezones) && $when == $lastwhen) {
5279
+			return $timezones;
5280
+	} else {
5281
+			$lastwhen = $when;
5282
+	}
4984 5283
 
4985 5284
 	// Parseable datetime string?
4986
-	if (is_int($timestamp = strtotime($when)))
4987
-		$when = $timestamp;
5285
+	if (is_int($timestamp = strtotime($when))) {
5286
+			$when = $timestamp;
5287
+	}
4988 5288
 
4989 5289
 	// A Unix timestamp?
4990
-	elseif (is_numeric($when))
4991
-		$when = intval($when);
5290
+	elseif (is_numeric($when)) {
5291
+			$when = intval($when);
5292
+	}
4992 5293
 
4993 5294
 	// Invalid value? Just get current Unix timestamp.
4994
-	else
4995
-		$when = time();
5295
+	else {
5296
+			$when = time();
5297
+	}
4996 5298
 
4997 5299
 	// We'll need these too
4998 5300
 	$date_when = date_create('@' . $when);
@@ -5056,8 +5358,9 @@  discard block
 block discarded – undo
5056 5358
 	foreach ($priority_countries as $country)
5057 5359
 	{
5058 5360
 		$country_tzids = @timezone_identifiers_list(DateTimeZone::PER_COUNTRY, strtoupper(trim($country)));
5059
-		if (!empty($country_tzids))
5060
-			$priority_tzids = array_merge($priority_tzids, $country_tzids);
5361
+		if (!empty($country_tzids)) {
5362
+					$priority_tzids = array_merge($priority_tzids, $country_tzids);
5363
+		}
5061 5364
 	}
5062 5365
 
5063 5366
 	// Process the preferred timezones first, then the rest.
@@ -5067,8 +5370,9 @@  discard block
 block discarded – undo
5067 5370
 	foreach ($tzids as $tzid)
5068 5371
 	{
5069 5372
 		// We don't want UTC right now
5070
-		if ($tzid == 'UTC')
5071
-			continue;
5373
+		if ($tzid == 'UTC') {
5374
+					continue;
5375
+		}
5072 5376
 
5073 5377
 		$tz = timezone_open($tzid);
5074 5378
 
@@ -5083,12 +5387,14 @@  discard block
 block discarded – undo
5083 5387
 		$tzgeo = timezone_location_get($tz);
5084 5388
 
5085 5389
 		// Don't overwrite our preferred tzids
5086
-		if (empty($zones[$tzkey]['tzid']))
5087
-			$zones[$tzkey]['tzid'] = $tzid;
5390
+		if (empty($zones[$tzkey]['tzid'])) {
5391
+					$zones[$tzkey]['tzid'] = $tzid;
5392
+		}
5088 5393
 
5089 5394
 		// A time zone from a prioritized country?
5090
-		if (in_array($tzid, $priority_tzids))
5091
-			$priority_zones[$tzkey] = true;
5395
+		if (in_array($tzid, $priority_tzids)) {
5396
+					$priority_zones[$tzkey] = true;
5397
+		}
5092 5398
 
5093 5399
 		// Keep track of the location and offset for this tzid
5094 5400
 		$tzid_parts = explode('/', $tzid);
@@ -5110,15 +5416,17 @@  discard block
 block discarded – undo
5110 5416
 
5111 5417
 		date_timezone_set($date_when, timezone_open($tzvalue['tzid']));
5112 5418
 
5113
-		if (!empty($timezone_descriptions[$tzvalue['tzid']]))
5114
-			$desc = $timezone_descriptions[$tzvalue['tzid']];
5115
-		else
5116
-			$desc = implode(', ', array_unique($tzvalue['locations']));
5419
+		if (!empty($timezone_descriptions[$tzvalue['tzid']])) {
5420
+					$desc = $timezone_descriptions[$tzvalue['tzid']];
5421
+		} else {
5422
+					$desc = implode(', ', array_unique($tzvalue['locations']));
5423
+		}
5117 5424
 
5118
-		if (isset($priority_zones[$tzkey]))
5119
-			$priority_timezones[$tzvalue['tzid']] = $tzinfo[0]['abbr'] . ' - ' . $desc . ' [UTC' . date_format($date_when, 'P') . ']';
5120
-		else
5121
-			$timezones[$tzvalue['tzid']] = $tzinfo[0]['abbr'] . ' - ' . $desc . ' [UTC' . date_format($date_when, 'P') . ']';
5425
+		if (isset($priority_zones[$tzkey])) {
5426
+					$priority_timezones[$tzvalue['tzid']] = $tzinfo[0]['abbr'] . ' - ' . $desc . ' [UTC' . date_format($date_when, 'P') . ']';
5427
+		} else {
5428
+					$timezones[$tzvalue['tzid']] = $tzinfo[0]['abbr'] . ' - ' . $desc . ' [UTC' . date_format($date_when, 'P') . ']';
5429
+		}
5122 5430
 	}
5123 5431
 
5124 5432
 	$timezones = array_merge(
@@ -5172,9 +5480,9 @@  discard block
 block discarded – undo
5172 5480
 			'Indian/Kerguelen' => 'TFT',
5173 5481
 		);
5174 5482
 
5175
-		if (!empty($missing_tz_abbrs[$tzid]))
5176
-			$tz_abbrev = $missing_tz_abbrs[$tzid];
5177
-		else
5483
+		if (!empty($missing_tz_abbrs[$tzid])) {
5484
+					$tz_abbrev = $missing_tz_abbrs[$tzid];
5485
+		} else
5178 5486
 		{
5179 5487
 			// Russia likes to experiment with time zones often, and names them as offsets from Moscow
5180 5488
 			$tz_location = timezone_location_get(timezone_open($tzid));
@@ -5202,8 +5510,9 @@  discard block
 block discarded – undo
5202 5510
  */
5203 5511
 function inet_ptod($ip_address)
5204 5512
 {
5205
-	if (!isValidIP($ip_address))
5206
-		return $ip_address;
5513
+	if (!isValidIP($ip_address)) {
5514
+			return $ip_address;
5515
+	}
5207 5516
 
5208 5517
 	$bin = inet_pton($ip_address);
5209 5518
 	return $bin;
@@ -5215,13 +5524,15 @@  discard block
 block discarded – undo
5215 5524
  */
5216 5525
 function inet_dtop($bin)
5217 5526
 {
5218
-	if(empty($bin))
5219
-		return '';
5527
+	if(empty($bin)) {
5528
+			return '';
5529
+	}
5220 5530
 
5221 5531
 	global $db_type;
5222 5532
 
5223
-	if ($db_type == 'postgresql')
5224
-		return $bin;
5533
+	if ($db_type == 'postgresql') {
5534
+			return $bin;
5535
+	}
5225 5536
 
5226 5537
 	$ip_address = inet_ntop($bin);
5227 5538
 
@@ -5246,26 +5557,32 @@  discard block
 block discarded – undo
5246 5557
  */
5247 5558
 function _safe_serialize($value)
5248 5559
 {
5249
-	if(is_null($value))
5250
-		return 'N;';
5560
+	if(is_null($value)) {
5561
+			return 'N;';
5562
+	}
5251 5563
 
5252
-	if(is_bool($value))
5253
-		return 'b:'. (int) $value .';';
5564
+	if(is_bool($value)) {
5565
+			return 'b:'. (int) $value .';';
5566
+	}
5254 5567
 
5255
-	if(is_int($value))
5256
-		return 'i:'. $value .';';
5568
+	if(is_int($value)) {
5569
+			return 'i:'. $value .';';
5570
+	}
5257 5571
 
5258
-	if(is_float($value))
5259
-		return 'd:'. str_replace(',', '.', $value) .';';
5572
+	if(is_float($value)) {
5573
+			return 'd:'. str_replace(',', '.', $value) .';';
5574
+	}
5260 5575
 
5261
-	if(is_string($value))
5262
-		return 's:'. strlen($value) .':"'. $value .'";';
5576
+	if(is_string($value)) {
5577
+			return 's:'. strlen($value) .':"'. $value .'";';
5578
+	}
5263 5579
 
5264 5580
 	if(is_array($value))
5265 5581
 	{
5266 5582
 		$out = '';
5267
-		foreach($value as $k => $v)
5268
-			$out .= _safe_serialize($k) . _safe_serialize($v);
5583
+		foreach($value as $k => $v) {
5584
+					$out .= _safe_serialize($k) . _safe_serialize($v);
5585
+		}
5269 5586
 
5270 5587
 		return 'a:'. count($value) .':{'. $out .'}';
5271 5588
 	}
@@ -5291,8 +5608,9 @@  discard block
 block discarded – undo
5291 5608
 
5292 5609
 	$out = _safe_serialize($value);
5293 5610
 
5294
-	if (isset($mbIntEnc))
5295
-		mb_internal_encoding($mbIntEnc);
5611
+	if (isset($mbIntEnc)) {
5612
+			mb_internal_encoding($mbIntEnc);
5613
+	}
5296 5614
 
5297 5615
 	return $out;
5298 5616
 }
@@ -5309,8 +5627,9 @@  discard block
 block discarded – undo
5309 5627
 function _safe_unserialize($str)
5310 5628
 {
5311 5629
 	// Input  is not a string.
5312
-	if(empty($str) || !is_string($str))
5313
-		return false;
5630
+	if(empty($str) || !is_string($str)) {
5631
+			return false;
5632
+	}
5314 5633
 
5315 5634
 	$stack = array();
5316 5635
 	$expected = array();
@@ -5326,43 +5645,38 @@  discard block
 block discarded – undo
5326 5645
 	while($state != 1)
5327 5646
 	{
5328 5647
 		$type = isset($str[0]) ? $str[0] : '';
5329
-		if($type == '}')
5330
-			$str = substr($str, 1);
5331
-
5332
-		else if($type == 'N' && $str[1] == ';')
5648
+		if($type == '}') {
5649
+					$str = substr($str, 1);
5650
+		} else if($type == 'N' && $str[1] == ';')
5333 5651
 		{
5334 5652
 			$value = null;
5335 5653
 			$str = substr($str, 2);
5336
-		}
5337
-		else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5654
+		} else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5338 5655
 		{
5339 5656
 			$value = $matches[1] == '1' ? true : false;
5340 5657
 			$str = substr($str, 4);
5341
-		}
5342
-		else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5658
+		} else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5343 5659
 		{
5344 5660
 			$value = (int)$matches[1];
5345 5661
 			$str = $matches[2];
5346
-		}
5347
-		else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5662
+		} else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5348 5663
 		{
5349 5664
 			$value = (float)$matches[1];
5350 5665
 			$str = $matches[3];
5351
-		}
5352
-		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
5666
+		} else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
5353 5667
 		{
5354 5668
 			$value = substr($matches[2], 0, (int)$matches[1]);
5355 5669
 			$str = substr($matches[2], (int)$matches[1] + 2);
5356
-		}
5357
-		else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5670
+		} else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5358 5671
 		{
5359 5672
 			$expectedLength = (int)$matches[1];
5360 5673
 			$str = $matches[2];
5361 5674
 		}
5362 5675
 
5363 5676
 		// Object or unknown/malformed type.
5364
-		else
5365
-			return false;
5677
+		else {
5678
+					return false;
5679
+		}
5366 5680
 
5367 5681
 		switch($state)
5368 5682
 		{
@@ -5390,8 +5704,9 @@  discard block
 block discarded – undo
5390 5704
 				if($type == '}')
5391 5705
 				{
5392 5706
 					// Array size is less than expected.
5393
-					if(count($list) < end($expected))
5394
-						return false;
5707
+					if(count($list) < end($expected)) {
5708
+											return false;
5709
+					}
5395 5710
 
5396 5711
 					unset($list);
5397 5712
 					$list = &$stack[count($stack)-1];
@@ -5400,8 +5715,9 @@  discard block
 block discarded – undo
5400 5715
 					// Go to terminal state if we're at the end of the root array.
5401 5716
 					array_pop($expected);
5402 5717
 
5403
-					if(count($expected) == 0)
5404
-						$state = 1;
5718
+					if(count($expected) == 0) {
5719
+											$state = 1;
5720
+					}
5405 5721
 
5406 5722
 					break;
5407 5723
 				}
@@ -5409,8 +5725,9 @@  discard block
 block discarded – undo
5409 5725
 				if($type == 'i' || $type == 's')
5410 5726
 				{
5411 5727
 					// Array size exceeds expected length.
5412
-					if(count($list) >= end($expected))
5413
-						return false;
5728
+					if(count($list) >= end($expected)) {
5729
+											return false;
5730
+					}
5414 5731
 
5415 5732
 					$key = $value;
5416 5733
 					$state = 3;
@@ -5444,8 +5761,9 @@  discard block
 block discarded – undo
5444 5761
 	}
5445 5762
 
5446 5763
 	// Trailing data in input.
5447
-	if(!empty($str))
5448
-		return false;
5764
+	if(!empty($str)) {
5765
+			return false;
5766
+	}
5449 5767
 
5450 5768
 	return $data;
5451 5769
 }
@@ -5468,8 +5786,9 @@  discard block
 block discarded – undo
5468 5786
 
5469 5787
 	$out = _safe_unserialize($str);
5470 5788
 
5471
-	if (isset($mbIntEnc))
5472
-		mb_internal_encoding($mbIntEnc);
5789
+	if (isset($mbIntEnc)) {
5790
+			mb_internal_encoding($mbIntEnc);
5791
+	}
5473 5792
 
5474 5793
 	return $out;
5475 5794
 }
@@ -5484,12 +5803,14 @@  discard block
 block discarded – undo
5484 5803
 function smf_chmod($file, $value = 0)
5485 5804
 {
5486 5805
 	// No file? no checks!
5487
-	if (empty($file))
5488
-		return false;
5806
+	if (empty($file)) {
5807
+			return false;
5808
+	}
5489 5809
 
5490 5810
 	// Already writable?
5491
-	if (is_writable($file))
5492
-		return true;
5811
+	if (is_writable($file)) {
5812
+			return true;
5813
+	}
5493 5814
 
5494 5815
 	// Do we have a file or a dir?
5495 5816
 	$isDir = is_dir($file);
@@ -5505,10 +5826,9 @@  discard block
 block discarded – undo
5505 5826
 		{
5506 5827
 			$isWritable = true;
5507 5828
 			break;
5829
+		} else {
5830
+					@chmod($file, $val);
5508 5831
 		}
5509
-
5510
-		else
5511
-			@chmod($file, $val);
5512 5832
 	}
5513 5833
 
5514 5834
 	return $isWritable;
@@ -5527,8 +5847,9 @@  discard block
 block discarded – undo
5527 5847
 	global $txt;
5528 5848
 
5529 5849
 	// Come on...
5530
-	if (empty($json) || !is_string($json))
5531
-		return array();
5850
+	if (empty($json) || !is_string($json)) {
5851
+			return array();
5852
+	}
5532 5853
 
5533 5854
 	$returnArray = @json_decode($json, $returnAsArray);
5534 5855
 
@@ -5566,11 +5887,11 @@  discard block
 block discarded – undo
5566 5887
 		$jsonDebug = $jsonDebug[0];
5567 5888
 		loadLanguage('Errors');
5568 5889
 
5569
-		if (!empty($jsonDebug))
5570
-			log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5571
-
5572
-		else
5573
-			log_error($txt['json_'. $jsonError], 'critical');
5890
+		if (!empty($jsonDebug)) {
5891
+					log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5892
+		} else {
5893
+					log_error($txt['json_'. $jsonError], 'critical');
5894
+		}
5574 5895
 
5575 5896
 		// Everyone expects an array.
5576 5897
 		return array();
@@ -5604,8 +5925,9 @@  discard block
 block discarded – undo
5604 5925
 	global $db_show_debug, $modSettings;
5605 5926
 
5606 5927
 	// Defensive programming anyone?
5607
-	if (empty($data))
5608
-		return false;
5928
+	if (empty($data)) {
5929
+			return false;
5930
+	}
5609 5931
 
5610 5932
 	// Don't need extra stuff...
5611 5933
 	$db_show_debug = false;
@@ -5613,11 +5935,11 @@  discard block
 block discarded – undo
5613 5935
 	// Kill anything else.
5614 5936
 	ob_end_clean();
5615 5937
 
5616
-	if (!empty($modSettings['CompressedOutput']))
5617
-		@ob_start('ob_gzhandler');
5618
-
5619
-	else
5620
-		ob_start();
5938
+	if (!empty($modSettings['CompressedOutput'])) {
5939
+			@ob_start('ob_gzhandler');
5940
+	} else {
5941
+			ob_start();
5942
+	}
5621 5943
 
5622 5944
 	// Set the header.
5623 5945
 	header($type);
@@ -5649,8 +5971,9 @@  discard block
 block discarded – undo
5649 5971
 	static $done = false;
5650 5972
 
5651 5973
 	// If we don't need to do anything, don't
5652
-	if (!$update && $done)
5653
-		return;
5974
+	if (!$update && $done) {
5975
+			return;
5976
+	}
5654 5977
 
5655 5978
 	// Should we get a new copy of the official list of TLDs?
5656 5979
 	if ($update)
@@ -5659,8 +5982,9 @@  discard block
 block discarded – undo
5659 5982
 		$tlds = fetch_web_data('https://data.iana.org/TLD/tlds-alpha-by-domain.txt');
5660 5983
 
5661 5984
 		// If the Internet Assigned Numbers Authority can't be reached, the Internet is gone. We're probably running on a server hidden in a bunker deep underground to protect it from marauding bandits roaming on the surface. We don't want to waste precious electricity on pointlessly repeating background tasks, so we'll wait until the next regularly scheduled update to see if civilization has been restored.
5662
-		if ($tlds === false)
5663
-			$postapocalypticNightmare = true;
5985
+		if ($tlds === false) {
5986
+					$postapocalypticNightmare = true;
5987
+		}
5664 5988
 	}
5665 5989
 	// If we aren't updating and the regex is valid, we're done
5666 5990
 	elseif (!empty($modSettings['tld_regex']) && @preg_match('~' . $modSettings['tld_regex'] . '~', null) !== false)
@@ -5675,10 +5999,11 @@  discard block
 block discarded – undo
5675 5999
 		// Clean $tlds and convert it to an array
5676 6000
 		$tlds = array_filter(explode("\n", strtolower($tlds)), function($line) {
5677 6001
 			$line = trim($line);
5678
-			if (empty($line) || strpos($line, '#') !== false || strpos($line, ' ') !== false)
5679
-				return false;
5680
-			else
5681
-				return true;
6002
+			if (empty($line) || strpos($line, '#') !== false || strpos($line, ' ') !== false) {
6003
+							return false;
6004
+			} else {
6005
+							return true;
6006
+			}
5682 6007
 		});
5683 6008
 
5684 6009
 		// Convert Punycode to Unicode
@@ -5732,8 +6057,9 @@  discard block
 block discarded – undo
5732 6057
 						$idx += $digit * $w;
5733 6058
 						$t = ($k <= $bias) ? $tmin : (($k >= $bias + $tmax) ? $tmax : ($k - $bias));
5734 6059
 
5735
-						if ($digit < $t)
5736
-							break;
6060
+						if ($digit < $t) {
6061
+													break;
6062
+						}
5737 6063
 
5738 6064
 						$w = (int) ($w * ($base - $t));
5739 6065
 					}
@@ -5742,8 +6068,9 @@  discard block
 block discarded – undo
5742 6068
 					$delta = intval($is_first ? ($delta / $damp) : ($delta / 2));
5743 6069
 					$delta += intval($delta / ($deco_len + 1));
5744 6070
 
5745
-					for ($k = 0; $delta > (($base - $tmin) * $tmax) / 2; $k += $base)
5746
-						$delta = intval($delta / ($base - $tmin));
6071
+					for ($k = 0; $delta > (($base - $tmin) * $tmax) / 2; $k += $base) {
6072
+											$delta = intval($delta / ($base - $tmin));
6073
+					}
5747 6074
 
5748 6075
 					$bias = intval($k + ($base - $tmin + 1) * $delta / ($delta + $skew));
5749 6076
 					$is_first = false;
@@ -5752,8 +6079,9 @@  discard block
 block discarded – undo
5752 6079
 
5753 6080
 					if ($deco_len > 0)
5754 6081
 					{
5755
-						for ($i = $deco_len; $i > $idx; $i--)
5756
-							$decoded[$i] = $decoded[($i - 1)];
6082
+						for ($i = $deco_len; $i > $idx; $i--) {
6083
+													$decoded[$i] = $decoded[($i - 1)];
6084
+						}
5757 6085
 					}
5758 6086
 					$decoded[$idx++] = $char;
5759 6087
 				}
@@ -5761,24 +6089,29 @@  discard block
 block discarded – undo
5761 6089
 				foreach ($decoded as $k => $v)
5762 6090
 				{
5763 6091
 					// 7bit are transferred literally
5764
-					if ($v < 128)
5765
-						$output .= chr($v);
6092
+					if ($v < 128) {
6093
+											$output .= chr($v);
6094
+					}
5766 6095
 
5767 6096
 					// 2 bytes
5768
-					elseif ($v < (1 << 11))
5769
-						$output .= chr(192+($v >> 6)) . chr(128+($v & 63));
6097
+					elseif ($v < (1 << 11)) {
6098
+											$output .= chr(192+($v >> 6)) . chr(128+($v & 63));
6099
+					}
5770 6100
 
5771 6101
 					// 3 bytes
5772
-					elseif ($v < (1 << 16))
5773
-						$output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
6102
+					elseif ($v < (1 << 16)) {
6103
+											$output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
6104
+					}
5774 6105
 
5775 6106
 					// 4 bytes
5776
-					elseif ($v < (1 << 21))
5777
-						$output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
6107
+					elseif ($v < (1 << 21)) {
6108
+											$output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
6109
+					}
5778 6110
 
5779 6111
 					//  'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k
5780
-					else
5781
-						$output .= $safe_char;
6112
+					else {
6113
+											$output .= $safe_char;
6114
+					}
5782 6115
 				}
5783 6116
 
5784 6117
 				$output_parts[] = $output;
@@ -5871,8 +6204,7 @@  discard block
 block discarded – undo
5871 6204
 
5872 6205
 		$strlen = 'mb_strlen';
5873 6206
 		$substr = 'mb_substr';
5874
-	}
5875
-	else
6207
+	} else
5876 6208
 	{
5877 6209
 		$strlen = $smcFunc['strlen'];
5878 6210
 		$substr = $smcFunc['substr'];
@@ -5886,20 +6218,21 @@  discard block
 block discarded – undo
5886 6218
 
5887 6219
 		$first = $substr($string, 0, 1);
5888 6220
 
5889
-		if (empty($index[$first]))
5890
-			$index[$first] = array();
6221
+		if (empty($index[$first])) {
6222
+					$index[$first] = array();
6223
+		}
5891 6224
 
5892 6225
 		if ($strlen($string) > 1)
5893 6226
 		{
5894 6227
 			// Sanity check on recursion
5895
-			if ($depth > 99)
5896
-				$index[$first][$substr($string, 1)] = '';
5897
-
5898
-			else
5899
-				$index[$first] = $add_string_to_index($substr($string, 1), $index[$first]);
6228
+			if ($depth > 99) {
6229
+							$index[$first][$substr($string, 1)] = '';
6230
+			} else {
6231
+							$index[$first] = $add_string_to_index($substr($string, 1), $index[$first]);
6232
+			}
6233
+		} else {
6234
+					$index[$first][''] = '';
5900 6235
 		}
5901
-		else
5902
-			$index[$first][''] = '';
5903 6236
 
5904 6237
 		$depth--;
5905 6238
 		return $index;
@@ -5922,9 +6255,9 @@  discard block
 block discarded – undo
5922 6255
 			$key_regex = preg_quote($key, $delim);
5923 6256
 			$new_key = $key;
5924 6257
 
5925
-			if (empty($value))
5926
-				$sub_regex = '';
5927
-			else
6258
+			if (empty($value)) {
6259
+							$sub_regex = '';
6260
+			} else
5928 6261
 			{
5929 6262
 				$sub_regex = $index_to_regex($value, $delim);
5930 6263
 
@@ -5932,22 +6265,22 @@  discard block
 block discarded – undo
5932 6265
 				{
5933 6266
 					$new_key_array = explode('(?'.'>', $sub_regex);
5934 6267
 					$new_key .= $new_key_array[0];
6268
+				} else {
6269
+									$sub_regex = '(?'.'>' . $sub_regex . ')';
5935 6270
 				}
5936
-				else
5937
-					$sub_regex = '(?'.'>' . $sub_regex . ')';
5938 6271
 			}
5939 6272
 
5940
-			if ($depth > 1)
5941
-				$regex[$new_key] = $key_regex . $sub_regex;
5942
-			else
6273
+			if ($depth > 1) {
6274
+							$regex[$new_key] = $key_regex . $sub_regex;
6275
+			} else
5943 6276
 			{
5944 6277
 				if (($length += strlen($key_regex) + 1) < $max_length || empty($regex))
5945 6278
 				{
5946 6279
 					$regex[$new_key] = $key_regex . $sub_regex;
5947 6280
 					unset($index[$key]);
6281
+				} else {
6282
+									break;
5948 6283
 				}
5949
-				else
5950
-					break;
5951 6284
 			}
5952 6285
 		}
5953 6286
 
@@ -5956,10 +6289,11 @@  discard block
 block discarded – undo
5956 6289
 			$l1 = $strlen($k1);
5957 6290
 			$l2 = $strlen($k2);
5958 6291
 
5959
-			if ($l1 == $l2)
5960
-				return strcmp($k1, $k2) > 0 ? 1 : -1;
5961
-			else
5962
-				return $l1 > $l2 ? -1 : 1;
6292
+			if ($l1 == $l2) {
6293
+							return strcmp($k1, $k2) > 0 ? 1 : -1;
6294
+			} else {
6295
+							return $l1 > $l2 ? -1 : 1;
6296
+			}
5963 6297
 		});
5964 6298
 
5965 6299
 		$depth--;
@@ -5970,21 +6304,24 @@  discard block
 block discarded – undo
5970 6304
 	$index = array();
5971 6305
 	$regex = '';
5972 6306
 
5973
-	foreach ($strings as $string)
5974
-		$index = $add_string_to_index($string, $index);
6307
+	foreach ($strings as $string) {
6308
+			$index = $add_string_to_index($string, $index);
6309
+	}
5975 6310
 
5976 6311
 	if ($returnArray === true)
5977 6312
 	{
5978 6313
 		$regex = array();
5979
-		while (!empty($index))
5980
-			$regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')';
6314
+		while (!empty($index)) {
6315
+					$regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')';
6316
+		}
6317
+	} else {
6318
+			$regex = '(?'.'>' . $index_to_regex($index, $delim) . ')';
5981 6319
 	}
5982
-	else
5983
-		$regex = '(?'.'>' . $index_to_regex($index, $delim) . ')';
5984 6320
 
5985 6321
 	// Restore PHP's internal character encoding to whatever it was originally
5986
-	if (!empty($current_encoding))
5987
-		mb_internal_encoding($current_encoding);
6322
+	if (!empty($current_encoding)) {
6323
+			mb_internal_encoding($current_encoding);
6324
+	}
5988 6325
 
5989 6326
 	return $regex;
5990 6327
 }
Please login to merge, or discard this patch.
Sources/ManageMaintenance.php 2 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -694,7 +694,6 @@
 block discarded – undo
694 694
  * It shows as the maintain_forum admin area.
695 695
  * It is accessed from ?action=admin;area=maintain;sa=database;activity=optimize.
696 696
  * It also updates the optimize scheduled task such that the tables are not automatically optimized again too soon.
697
-
698 697
  * @uses the optimize sub template
699 698
  */
700 699
 function OptimizeTables()
Please login to merge, or discard this patch.
Braces   +266 added lines, -197 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 4
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * Main dispatcher, the maintenance access point.
@@ -96,14 +97,16 @@  discard block
 block discarded – undo
96 97
 	call_integration_hook('integrate_manage_maintenance', array(&$subActions));
97 98
 
98 99
 	// Yep, sub-action time!
99
-	if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]))
100
-		$subAction = $_REQUEST['sa'];
101
-	else
102
-		$subAction = 'routine';
100
+	if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) {
101
+			$subAction = $_REQUEST['sa'];
102
+	} else {
103
+			$subAction = 'routine';
104
+	}
103 105
 
104 106
 	// Doing something special?
105
-	if (isset($_REQUEST['activity']) && isset($subActions[$subAction]['activities'][$_REQUEST['activity']]))
106
-		$activity = $_REQUEST['activity'];
107
+	if (isset($_REQUEST['activity']) && isset($subActions[$subAction]['activities'][$_REQUEST['activity']])) {
108
+			$activity = $_REQUEST['activity'];
109
+	}
107 110
 
108 111
 	// Set a few things.
109 112
 	$context['page_title'] = $txt['maintain_title'];
@@ -114,12 +117,14 @@  discard block
 block discarded – undo
114 117
 	call_helper($subActions[$subAction]['function']);
115 118
 
116 119
 	// Any special activity?
117
-	if (isset($activity))
118
-		call_helper($subActions[$subAction]['activities'][$activity]);
120
+	if (isset($activity)) {
121
+			call_helper($subActions[$subAction]['activities'][$activity]);
122
+	}
119 123
 
120 124
 	//converted to UTF-8? show a small maintenance info
121
-	if (isset($_GET['done']) && $_GET['done'] == 'convertutf8')
122
-		$context['maintenance_finished'] = $txt['utf8_title'];
125
+	if (isset($_GET['done']) && $_GET['done'] == 'convertutf8') {
126
+			$context['maintenance_finished'] = $txt['utf8_title'];
127
+	}
123 128
 
124 129
 	// Create a maintenance token.  Kinda hard to do it any other way.
125 130
 	createToken('admin-maint');
@@ -141,19 +146,22 @@  discard block
 block discarded – undo
141 146
 		db_extend('packages');
142 147
 
143 148
 		$colData = $smcFunc['db_list_columns']('{db_prefix}messages', true);
144
-		foreach ($colData as $column)
145
-			if ($column['name'] == 'body')
149
+		foreach ($colData as $column) {
150
+					if ($column['name'] == 'body')
146 151
 				$body_type = $column['type'];
152
+		}
147 153
 
148 154
 		$context['convert_to'] = $body_type == 'text' ? 'mediumtext' : 'text';
149 155
 		$context['convert_to_suggest'] = ($body_type != 'text' && !empty($modSettings['max_messageLength']) && $modSettings['max_messageLength'] < 65536);
150 156
 	}
151 157
 
152
-	if (isset($_GET['done']) && $_GET['done'] == 'convertutf8')
153
-		$context['maintenance_finished'] = $txt['utf8_title'];
154
-	if (isset($_GET['done']) && $_GET['done'] == 'convertentities')
155
-		$context['maintenance_finished'] = $txt['entity_convert_title'];
156
-}
158
+	if (isset($_GET['done']) && $_GET['done'] == 'convertutf8') {
159
+			$context['maintenance_finished'] = $txt['utf8_title'];
160
+	}
161
+	if (isset($_GET['done']) && $_GET['done'] == 'convertentities') {
162
+			$context['maintenance_finished'] = $txt['entity_convert_title'];
163
+	}
164
+	}
157 165
 
158 166
 /**
159 167
  * Supporting function for the routine maintenance area.
@@ -162,9 +170,10 @@  discard block
 block discarded – undo
162 170
 {
163 171
 	global $context, $txt;
164 172
 
165
-	if (isset($_GET['done']) && $_GET['done'] == 'recount')
166
-		$context['maintenance_finished'] = $txt['maintain_recount'];
167
-}
173
+	if (isset($_GET['done']) && $_GET['done'] == 'recount') {
174
+			$context['maintenance_finished'] = $txt['maintain_recount'];
175
+	}
176
+	}
168 177
 
169 178
 /**
170 179
  * Supporting function for the members maintenance area.
@@ -195,8 +204,9 @@  discard block
 block discarded – undo
195 204
 	}
196 205
 	$smcFunc['db_free_result']($result);
197 206
 
198
-	if (isset($_GET['done']) && $_GET['done'] == 'recountposts')
199
-		$context['maintenance_finished'] = $txt['maintain_recountposts'];
207
+	if (isset($_GET['done']) && $_GET['done'] == 'recountposts') {
208
+			$context['maintenance_finished'] = $txt['maintain_recountposts'];
209
+	}
200 210
 
201 211
 	loadJavaScriptFile('suggest.js', array('defer' => false), 'smf_suggest');
202 212
 }
@@ -222,11 +232,12 @@  discard block
 block discarded – undo
222 232
 	$context['categories'] = array();
223 233
 	while ($row = $smcFunc['db_fetch_assoc']($result))
224 234
 	{
225
-		if (!isset($context['categories'][$row['id_cat']]))
226
-			$context['categories'][$row['id_cat']] = array(
235
+		if (!isset($context['categories'][$row['id_cat']])) {
236
+					$context['categories'][$row['id_cat']] = array(
227 237
 				'name' => $row['cat_name'],
228 238
 				'boards' => array()
229 239
 			);
240
+		}
230 241
 
231 242
 		$context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array(
232 243
 			'id' => $row['id_board'],
@@ -239,11 +250,12 @@  discard block
 block discarded – undo
239 250
 	require_once($sourcedir . '/Subs-Boards.php');
240 251
 	sortCategories($context['categories']);
241 252
 
242
-	if (isset($_GET['done']) && $_GET['done'] == 'purgeold')
243
-		$context['maintenance_finished'] = $txt['maintain_old'];
244
-	elseif (isset($_GET['done']) && $_GET['done'] == 'massmove')
245
-		$context['maintenance_finished'] = $txt['move_topics_maintenance'];
246
-}
253
+	if (isset($_GET['done']) && $_GET['done'] == 'purgeold') {
254
+			$context['maintenance_finished'] = $txt['maintain_old'];
255
+	} elseif (isset($_GET['done']) && $_GET['done'] == 'massmove') {
256
+			$context['maintenance_finished'] = $txt['move_topics_maintenance'];
257
+	}
258
+	}
247 259
 
248 260
 /**
249 261
  * Find and fix all errors on the forum.
@@ -351,15 +363,17 @@  discard block
 block discarded – undo
351 363
 	// Show me your badge!
352 364
 	isAllowedTo('admin_forum');
353 365
 
354
-	if ($db_type != 'mysql')
355
-		return;
366
+	if ($db_type != 'mysql') {
367
+			return;
368
+	}
356 369
 
357 370
 	db_extend('packages');
358 371
 
359 372
 	$colData = $smcFunc['db_list_columns']('{db_prefix}messages', true);
360
-	foreach ($colData as $column)
361
-		if ($column['name'] == 'body')
373
+	foreach ($colData as $column) {
374
+			if ($column['name'] == 'body')
362 375
 			$body_type = $column['type'];
376
+	}
363 377
 
364 378
 	$context['convert_to'] = $body_type == 'text' ? 'mediumtext' : 'text';
365 379
 
@@ -369,33 +383,36 @@  discard block
 block discarded – undo
369 383
 		validateToken('admin-maint');
370 384
 
371 385
 		// Make it longer so we can do their limit.
372
-		if ($body_type == 'text')
373
-			$smcFunc['db_change_column']('{db_prefix}messages', 'body', array('type' => 'mediumtext'));
386
+		if ($body_type == 'text') {
387
+					$smcFunc['db_change_column']('{db_prefix}messages', 'body', array('type' => 'mediumtext'));
388
+		}
374 389
 		// Shorten the column so we can have a bit (literally per record) less space occupied
375
-		else
376
-			$smcFunc['db_change_column']('{db_prefix}messages', 'body', array('type' => 'text'));
390
+		else {
391
+					$smcFunc['db_change_column']('{db_prefix}messages', 'body', array('type' => 'text'));
392
+		}
377 393
 
378 394
 		// 3rd party integrations may be interested in knowning about this.
379 395
 		call_integration_hook('integrate_convert_msgbody', array($body_type));
380 396
 
381 397
 		$colData = $smcFunc['db_list_columns']('{db_prefix}messages', true);
382
-		foreach ($colData as $column)
383
-			if ($column['name'] == 'body')
398
+		foreach ($colData as $column) {
399
+					if ($column['name'] == 'body')
384 400
 				$body_type = $column['type'];
401
+		}
385 402
 
386 403
 		$context['maintenance_finished'] = $txt[$context['convert_to'] . '_title'];
387 404
 		$context['convert_to'] = $body_type == 'text' ? 'mediumtext' : 'text';
388 405
 		$context['convert_to_suggest'] = ($body_type != 'text' && !empty($modSettings['max_messageLength']) && $modSettings['max_messageLength'] < 65536);
389 406
 
390 407
 		return;
391
-	}
392
-	elseif ($body_type != 'text' && (!isset($_POST['do_conversion']) || isset($_POST['cont'])))
408
+	} elseif ($body_type != 'text' && (!isset($_POST['do_conversion']) || isset($_POST['cont'])))
393 409
 	{
394 410
 		checkSession();
395
-		if (empty($_REQUEST['start']))
396
-			validateToken('admin-maint');
397
-		else
398
-			validateToken('admin-convertMsg');
411
+		if (empty($_REQUEST['start'])) {
412
+					validateToken('admin-maint');
413
+		} else {
414
+					validateToken('admin-convertMsg');
415
+		}
399 416
 
400 417
 		$context['page_title'] = $txt['not_done_title'];
401 418
 		$context['continue_post_data'] = '';
@@ -427,8 +444,9 @@  discard block
 block discarded – undo
427 444
 					'increment' => $increment - 1,
428 445
 				)
429 446
 			);
430
-			while ($row = $smcFunc['db_fetch_assoc']($request))
431
-				$id_msg_exceeding[] = $row['id_msg'];
447
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
448
+							$id_msg_exceeding[] = $row['id_msg'];
449
+			}
432 450
 			$smcFunc['db_free_result']($request);
433 451
 
434 452
 			$_REQUEST['start'] += $increment;
@@ -457,9 +475,9 @@  discard block
 block discarded – undo
457 475
 			{
458 476
 				$query_msg = array_slice($id_msg_exceeding, 0, 100);
459 477
 				$context['exceeding_messages_morethan'] = sprintf($txt['exceeding_messages_morethan'], count($id_msg_exceeding));
478
+			} else {
479
+							$query_msg = $id_msg_exceeding;
460 480
 			}
461
-			else
462
-				$query_msg = $id_msg_exceeding;
463 481
 
464 482
 			$context['exceeding_messages'] = array();
465 483
 			$request = $smcFunc['db_query']('', '
@@ -470,8 +488,9 @@  discard block
 block discarded – undo
470 488
 					'messages' => $query_msg,
471 489
 				)
472 490
 			);
473
-			while ($row = $smcFunc['db_fetch_assoc']($request))
474
-				$context['exceeding_messages'][] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>';
491
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
492
+							$context['exceeding_messages'][] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>';
493
+			}
475 494
 			$smcFunc['db_free_result']($request);
476 495
 		}
477 496
 	}
@@ -495,8 +514,9 @@  discard block
 block discarded – undo
495 514
 	isAllowedTo('admin_forum');
496 515
 
497 516
 	// Check to see if UTF-8 is currently the default character set.
498
-	if ($modSettings['global_character_set'] !== 'UTF-8' || !isset($db_character_set) || $db_character_set !== 'utf8')
499
-		fatal_lang_error('entity_convert_only_utf8');
517
+	if ($modSettings['global_character_set'] !== 'UTF-8' || !isset($db_character_set) || $db_character_set !== 'utf8') {
518
+			fatal_lang_error('entity_convert_only_utf8');
519
+	}
500 520
 
501 521
 	// Some starting values.
502 522
 	$context['table'] = empty($_REQUEST['table']) ? 0 : (int) $_REQUEST['table'];
@@ -558,8 +578,9 @@  discard block
 block discarded – undo
558 578
 		// Make sure we keep stuff unique!
559 579
 		$primary_keys = array();
560 580
 
561
-		if (function_exists('apache_reset_timeout'))
562
-			@apache_reset_timeout();
581
+		if (function_exists('apache_reset_timeout')) {
582
+					@apache_reset_timeout();
583
+		}
563 584
 
564 585
 		// Get a list of text columns.
565 586
 		$columns = array();
@@ -570,9 +591,10 @@  discard block
 block discarded – undo
570 591
 				'cur_table' => $cur_table,
571 592
 			)
572 593
 		);
573
-		while ($column_info = $smcFunc['db_fetch_assoc']($request))
574
-			if (strpos($column_info['Type'], 'text') !== false || strpos($column_info['Type'], 'char') !== false)
594
+		while ($column_info = $smcFunc['db_fetch_assoc']($request)) {
595
+					if (strpos($column_info['Type'], 'text') !== false || strpos($column_info['Type'], 'char') !== false)
575 596
 				$columns[] = strtolower($column_info['Field']);
597
+		}
576 598
 
577 599
 		// Get the column with the (first) primary key.
578 600
 		$request = $smcFunc['db_query']('', '
@@ -586,8 +608,9 @@  discard block
 block discarded – undo
586 608
 		{
587 609
 			if ($row['Key_name'] === 'PRIMARY')
588 610
 			{
589
-				if (empty($primary_key) || ($row['Seq_in_index'] == 1 && !in_array(strtolower($row['Column_name']), $columns)))
590
-					$primary_key = $row['Column_name'];
611
+				if (empty($primary_key) || ($row['Seq_in_index'] == 1 && !in_array(strtolower($row['Column_name']), $columns))) {
612
+									$primary_key = $row['Column_name'];
613
+				}
591 614
 
592 615
 				$primary_keys[] = $row['Column_name'];
593 616
 			}
@@ -596,8 +619,9 @@  discard block
 block discarded – undo
596 619
 
597 620
 		// No primary key, no glory.
598 621
 		// Same for columns. Just to be sure we've work to do!
599
-		if (empty($primary_key) || empty($columns))
600
-			continue;
622
+		if (empty($primary_key) || empty($columns)) {
623
+					continue;
624
+		}
601 625
 
602 626
 		// Get the maximum value for the primary key.
603 627
 		$request = $smcFunc['db_query']('', '
@@ -611,8 +635,9 @@  discard block
 block discarded – undo
611 635
 		list($max_value) = $smcFunc['db_fetch_row']($request);
612 636
 		$smcFunc['db_free_result']($request);
613 637
 
614
-		if (empty($max_value))
615
-			continue;
638
+		if (empty($max_value)) {
639
+					continue;
640
+		}
616 641
 
617 642
 		while ($context['start'] <= $max_value)
618 643
 		{
@@ -636,10 +661,11 @@  discard block
 block discarded – undo
636 661
 			{
637 662
 				$insertion_variables = array();
638 663
 				$changes = array();
639
-				foreach ($row as $column_name => $column_value)
640
-					if ($column_name !== $primary_key && strpos($column_value, '&#') !== false)
664
+				foreach ($row as $column_name => $column_value) {
665
+									if ($column_name !== $primary_key && strpos($column_value, '&#') !== false)
641 666
 					{
642 667
 						$changes[] = $column_name . ' = {string:changes_' . $column_name . '}';
668
+				}
643 669
 						$insertion_variables['changes_' . $column_name] = preg_replace_callback('~&#(\d{1,7}|x[0-9a-fA-F]{1,6});~', 'fixchar__callback', $column_value);
644 670
 					}
645 671
 
@@ -651,8 +677,8 @@  discard block
 block discarded – undo
651 677
 				}
652 678
 
653 679
 				// Update the row.
654
-				if (!empty($changes))
655
-					$smcFunc['db_query']('', '
680
+				if (!empty($changes)) {
681
+									$smcFunc['db_query']('', '
656 682
 						UPDATE {db_prefix}' . $cur_table . '
657 683
 						SET
658 684
 							' . implode(',
@@ -660,6 +686,7 @@  discard block
 block discarded – undo
660 686
 						WHERE ' . implode(' AND ', $where),
661 687
 						$insertion_variables
662 688
 					);
689
+				}
663 690
 			}
664 691
 			$smcFunc['db_free_result']($request);
665 692
 			$context['start'] += 500;
@@ -704,10 +731,11 @@  discard block
 block discarded – undo
704 731
 
705 732
 	checkSession('request');
706 733
 
707
-	if (!isset($_SESSION['optimized_tables']))
708
-		validateToken('admin-maint');
709
-	else
710
-		validateToken('admin-optimize', 'post', false);
734
+	if (!isset($_SESSION['optimized_tables'])) {
735
+			validateToken('admin-maint');
736
+	} else {
737
+			validateToken('admin-optimize', 'post', false);
738
+	}
711 739
 
712 740
 	ignore_user_abort(true);
713 741
 	db_extend();
@@ -723,13 +751,15 @@  discard block
 block discarded – undo
723 751
 	// Get a list of tables, as well as how many there are.
724 752
 	$temp_tables = $smcFunc['db_list_tables'](false, $real_prefix . '%');
725 753
 	$tables = array();
726
-	foreach ($temp_tables as $table)
727
-		$tables[] = array('table_name' => $table);
754
+	foreach ($temp_tables as $table) {
755
+			$tables[] = array('table_name' => $table);
756
+	}
728 757
 
729 758
 	// If there aren't any tables then I believe that would mean the world has exploded...
730 759
 	$context['num_tables'] = count($tables);
731
-	if ($context['num_tables'] == 0)
732
-		fatal_error('You appear to be running SMF in a flat file mode... fantastic!', false);
760
+	if ($context['num_tables'] == 0) {
761
+			fatal_error('You appear to be running SMF in a flat file mode... fantastic!', false);
762
+	}
733 763
 
734 764
 	$_REQUEST['start'] = empty($_REQUEST['start']) ? 0 : (int) $_REQUEST['start'];
735 765
 
@@ -740,8 +770,9 @@  discard block
 block discarded – undo
740 770
 	$_SESSION['optimized_tables'] = !empty($_SESSION['optimized_tables']) ? $_SESSION['optimized_tables'] : array();
741 771
 	for ($key = $_REQUEST['start']; $context['num_tables'] - 1; $key++)
742 772
 	{
743
-		if (empty($tables[$key]))
744
-			break;
773
+		if (empty($tables[$key])) {
774
+					break;
775
+		}
745 776
 
746 777
 		// Continue?
747 778
 		if (array_sum(explode(' ', microtime())) - array_sum(explode(' ', $time_start)) > 10)
@@ -755,8 +786,9 @@  discard block
 block discarded – undo
755 786
 			createToken('admin-optimize');
756 787
 			$context['continue_post_data'] = '<input type="hidden" name="' . $context['admin-optimize_token_var'] . '" value="' . $context['admin-optimize_token'] . '">';
757 788
 
758
-			if (function_exists('apache_reset_timeout'))
759
-				apache_reset_timeout();
789
+			if (function_exists('apache_reset_timeout')) {
790
+							apache_reset_timeout();
791
+			}
760 792
 
761 793
 			return;
762 794
 		}
@@ -764,11 +796,12 @@  discard block
 block discarded – undo
764 796
 		// Optimize the table!  We use backticks here because it might be a custom table.
765 797
 		$data_freed = $smcFunc['db_optimize_table']($tables[$key]['table_name']);
766 798
 
767
-		if ($data_freed > 0)
768
-			$_SESSION['optimized_tables'][] = array(
799
+		if ($data_freed > 0) {
800
+					$_SESSION['optimized_tables'][] = array(
769 801
 				'name' => $tables[$key]['table_name'],
770 802
 				'data_freed' => $data_freed,
771 803
 			);
804
+		}
772 805
 	}
773 806
 
774 807
 	// Number of tables, etc...
@@ -803,10 +836,11 @@  discard block
 block discarded – undo
803 836
 	checkSession('request');
804 837
 
805 838
 	// validate the request or the loop
806
-	if (!isset($_REQUEST['step']))
807
-		validateToken('admin-maint');
808
-	else
809
-		validateToken('admin-boardrecount');
839
+	if (!isset($_REQUEST['step'])) {
840
+			validateToken('admin-maint');
841
+	} else {
842
+			validateToken('admin-boardrecount');
843
+	}
810 844
 
811 845
 	$context['page_title'] = $txt['not_done_title'];
812 846
 	$context['continue_post_data'] = '';
@@ -827,8 +861,9 @@  discard block
 block discarded – undo
827 861
 	$smcFunc['db_free_result']($request);
828 862
 
829 863
 	$increment = min(max(50, ceil($max_topics / 4)), 2000);
830
-	if (empty($_REQUEST['start']))
831
-		$_REQUEST['start'] = 0;
864
+	if (empty($_REQUEST['start'])) {
865
+			$_REQUEST['start'] = 0;
866
+	}
832 867
 
833 868
 	$total_steps = 8;
834 869
 
@@ -855,8 +890,8 @@  discard block
 block discarded – undo
855 890
 					'max_id' => $_REQUEST['start'] + $increment,
856 891
 				)
857 892
 			);
858
-			while ($row = $smcFunc['db_fetch_assoc']($request))
859
-				$smcFunc['db_query']('', '
893
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
894
+							$smcFunc['db_query']('', '
860 895
 					UPDATE {db_prefix}topics
861 896
 					SET num_replies = {int:num_replies}
862 897
 					WHERE id_topic = {int:id_topic}',
@@ -865,6 +900,7 @@  discard block
 block discarded – undo
865 900
 						'id_topic' => $row['id_topic'],
866 901
 					)
867 902
 				);
903
+			}
868 904
 			$smcFunc['db_free_result']($request);
869 905
 
870 906
 			// Recount unapproved messages
@@ -883,8 +919,8 @@  discard block
 block discarded – undo
883 919
 					'max_id' => $_REQUEST['start'] + $increment,
884 920
 				)
885 921
 			);
886
-			while ($row = $smcFunc['db_fetch_assoc']($request))
887
-				$smcFunc['db_query']('', '
922
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
923
+							$smcFunc['db_query']('', '
888 924
 					UPDATE {db_prefix}topics
889 925
 					SET unapproved_posts = {int:unapproved_posts}
890 926
 					WHERE id_topic = {int:id_topic}',
@@ -893,6 +929,7 @@  discard block
 block discarded – undo
893 929
 						'id_topic' => $row['id_topic'],
894 930
 					)
895 931
 				);
932
+			}
896 933
 			$smcFunc['db_free_result']($request);
897 934
 
898 935
 			$_REQUEST['start'] += $increment;
@@ -915,8 +952,8 @@  discard block
 block discarded – undo
915 952
 	// Update the post count of each board.
916 953
 	if ($_REQUEST['step'] <= 1)
917 954
 	{
918
-		if (empty($_REQUEST['start']))
919
-			$smcFunc['db_query']('', '
955
+		if (empty($_REQUEST['start'])) {
956
+					$smcFunc['db_query']('', '
920 957
 				UPDATE {db_prefix}boards
921 958
 				SET num_posts = {int:num_posts}
922 959
 				WHERE redirect = {string:redirect}',
@@ -925,6 +962,7 @@  discard block
 block discarded – undo
925 962
 					'redirect' => '',
926 963
 				)
927 964
 			);
965
+		}
928 966
 
929 967
 		while ($_REQUEST['start'] < $max_topics)
930 968
 		{
@@ -941,8 +979,8 @@  discard block
 block discarded – undo
941 979
 					'is_approved' => 1,
942 980
 				)
943 981
 			);
944
-			while ($row = $smcFunc['db_fetch_assoc']($request))
945
-				$smcFunc['db_query']('', '
982
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
983
+							$smcFunc['db_query']('', '
946 984
 					UPDATE {db_prefix}boards
947 985
 					SET num_posts = num_posts + {int:real_num_posts}
948 986
 					WHERE id_board = {int:id_board}',
@@ -951,6 +989,7 @@  discard block
 block discarded – undo
951 989
 						'real_num_posts' => $row['real_num_posts'],
952 990
 					)
953 991
 				);
992
+			}
954 993
 			$smcFunc['db_free_result']($request);
955 994
 
956 995
 			$_REQUEST['start'] += $increment;
@@ -973,14 +1012,15 @@  discard block
 block discarded – undo
973 1012
 	// Update the topic count of each board.
974 1013
 	if ($_REQUEST['step'] <= 2)
975 1014
 	{
976
-		if (empty($_REQUEST['start']))
977
-			$smcFunc['db_query']('', '
1015
+		if (empty($_REQUEST['start'])) {
1016
+					$smcFunc['db_query']('', '
978 1017
 				UPDATE {db_prefix}boards
979 1018
 				SET num_topics = {int:num_topics}',
980 1019
 				array(
981 1020
 					'num_topics' => 0,
982 1021
 				)
983 1022
 			);
1023
+		}
984 1024
 
985 1025
 		while ($_REQUEST['start'] < $max_topics)
986 1026
 		{
@@ -997,8 +1037,8 @@  discard block
 block discarded – undo
997 1037
 					'id_topic_max' => $_REQUEST['start'] + $increment,
998 1038
 				)
999 1039
 			);
1000
-			while ($row = $smcFunc['db_fetch_assoc']($request))
1001
-				$smcFunc['db_query']('', '
1040
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
1041
+							$smcFunc['db_query']('', '
1002 1042
 					UPDATE {db_prefix}boards
1003 1043
 					SET num_topics = num_topics + {int:real_num_topics}
1004 1044
 					WHERE id_board = {int:id_board}',
@@ -1007,6 +1047,7 @@  discard block
 block discarded – undo
1007 1047
 						'real_num_topics' => $row['real_num_topics'],
1008 1048
 					)
1009 1049
 				);
1050
+			}
1010 1051
 			$smcFunc['db_free_result']($request);
1011 1052
 
1012 1053
 			$_REQUEST['start'] += $increment;
@@ -1029,14 +1070,15 @@  discard block
 block discarded – undo
1029 1070
 	// Update the unapproved post count of each board.
1030 1071
 	if ($_REQUEST['step'] <= 3)
1031 1072
 	{
1032
-		if (empty($_REQUEST['start']))
1033
-			$smcFunc['db_query']('', '
1073
+		if (empty($_REQUEST['start'])) {
1074
+					$smcFunc['db_query']('', '
1034 1075
 				UPDATE {db_prefix}boards
1035 1076
 				SET unapproved_posts = {int:unapproved_posts}',
1036 1077
 				array(
1037 1078
 					'unapproved_posts' => 0,
1038 1079
 				)
1039 1080
 			);
1081
+		}
1040 1082
 
1041 1083
 		while ($_REQUEST['start'] < $max_topics)
1042 1084
 		{
@@ -1053,8 +1095,8 @@  discard block
 block discarded – undo
1053 1095
 					'is_approved' => 0,
1054 1096
 				)
1055 1097
 			);
1056
-			while ($row = $smcFunc['db_fetch_assoc']($request))
1057
-				$smcFunc['db_query']('', '
1098
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
1099
+							$smcFunc['db_query']('', '
1058 1100
 					UPDATE {db_prefix}boards
1059 1101
 					SET unapproved_posts = unapproved_posts + {int:unapproved_posts}
1060 1102
 					WHERE id_board = {int:id_board}',
@@ -1063,6 +1105,7 @@  discard block
 block discarded – undo
1063 1105
 						'unapproved_posts' => $row['real_unapproved_posts'],
1064 1106
 					)
1065 1107
 				);
1108
+			}
1066 1109
 			$smcFunc['db_free_result']($request);
1067 1110
 
1068 1111
 			$_REQUEST['start'] += $increment;
@@ -1085,14 +1128,15 @@  discard block
 block discarded – undo
1085 1128
 	// Update the unapproved topic count of each board.
1086 1129
 	if ($_REQUEST['step'] <= 4)
1087 1130
 	{
1088
-		if (empty($_REQUEST['start']))
1089
-			$smcFunc['db_query']('', '
1131
+		if (empty($_REQUEST['start'])) {
1132
+					$smcFunc['db_query']('', '
1090 1133
 				UPDATE {db_prefix}boards
1091 1134
 				SET unapproved_topics = {int:unapproved_topics}',
1092 1135
 				array(
1093 1136
 					'unapproved_topics' => 0,
1094 1137
 				)
1095 1138
 			);
1139
+		}
1096 1140
 
1097 1141
 		while ($_REQUEST['start'] < $max_topics)
1098 1142
 		{
@@ -1109,8 +1153,8 @@  discard block
 block discarded – undo
1109 1153
 					'id_topic_max' => $_REQUEST['start'] + $increment,
1110 1154
 				)
1111 1155
 			);
1112
-			while ($row = $smcFunc['db_fetch_assoc']($request))
1113
-				$smcFunc['db_query']('', '
1156
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
1157
+							$smcFunc['db_query']('', '
1114 1158
 					UPDATE {db_prefix}boards
1115 1159
 					SET unapproved_topics = unapproved_topics + {int:real_unapproved_topics}
1116 1160
 					WHERE id_board = {int:id_board}',
@@ -1119,6 +1163,7 @@  discard block
 block discarded – undo
1119 1163
 						'real_unapproved_topics' => $row['real_unapproved_topics'],
1120 1164
 					)
1121 1165
 				);
1166
+			}
1122 1167
 			$smcFunc['db_free_result']($request);
1123 1168
 
1124 1169
 			$_REQUEST['start'] += $increment;
@@ -1152,8 +1197,9 @@  discard block
 block discarded – undo
1152 1197
 				'is_not_deleted' => 0,
1153 1198
 			)
1154 1199
 		);
1155
-		while ($row = $smcFunc['db_fetch_assoc']($request))
1156
-			updateMemberData($row['id_member'], array('instant_messages' => $row['real_num']));
1200
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1201
+					updateMemberData($row['id_member'], array('instant_messages' => $row['real_num']));
1202
+		}
1157 1203
 		$smcFunc['db_free_result']($request);
1158 1204
 
1159 1205
 		$request = $smcFunc['db_query']('', '
@@ -1168,8 +1214,9 @@  discard block
 block discarded – undo
1168 1214
 				'is_not_read' => 0,
1169 1215
 			)
1170 1216
 		);
1171
-		while ($row = $smcFunc['db_fetch_assoc']($request))
1172
-			updateMemberData($row['id_member'], array('unread_messages' => $row['real_num']));
1217
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1218
+					updateMemberData($row['id_member'], array('unread_messages' => $row['real_num']));
1219
+		}
1173 1220
 		$smcFunc['db_free_result']($request);
1174 1221
 
1175 1222
 		if (array_sum(explode(' ', microtime())) - array_sum(explode(' ', $time_start)) > 3)
@@ -1201,12 +1248,13 @@  discard block
 block discarded – undo
1201 1248
 				)
1202 1249
 			);
1203 1250
 			$boards = array();
1204
-			while ($row = $smcFunc['db_fetch_assoc']($request))
1205
-				$boards[$row['id_board']][] = $row['id_msg'];
1251
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
1252
+							$boards[$row['id_board']][] = $row['id_msg'];
1253
+			}
1206 1254
 			$smcFunc['db_free_result']($request);
1207 1255
 
1208
-			foreach ($boards as $board_id => $messages)
1209
-				$smcFunc['db_query']('', '
1256
+			foreach ($boards as $board_id => $messages) {
1257
+							$smcFunc['db_query']('', '
1210 1258
 					UPDATE {db_prefix}messages
1211 1259
 					SET id_board = {int:id_board}
1212 1260
 					WHERE id_msg IN ({array_int:id_msg_array})',
@@ -1215,6 +1263,7 @@  discard block
 block discarded – undo
1215 1263
 						'id_board' => $board_id,
1216 1264
 					)
1217 1265
 				);
1266
+			}
1218 1267
 
1219 1268
 			$_REQUEST['start'] += $increment;
1220 1269
 
@@ -1244,8 +1293,9 @@  discard block
 block discarded – undo
1244 1293
 		)
1245 1294
 	);
1246 1295
 	$realBoardCounts = array();
1247
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1248
-		$realBoardCounts[$row['id_board']] = $row['local_last_msg'];
1296
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1297
+			$realBoardCounts[$row['id_board']] = $row['local_last_msg'];
1298
+	}
1249 1299
 	$smcFunc['db_free_result']($request);
1250 1300
 
1251 1301
 	$request = $smcFunc['db_query']('', '
@@ -1265,18 +1315,20 @@  discard block
 block discarded – undo
1265 1315
 	krsort($resort_me);
1266 1316
 
1267 1317
 	$lastModifiedMsg = array();
1268
-	foreach ($resort_me as $rows)
1269
-		foreach ($rows as $row)
1318
+	foreach ($resort_me as $rows) {
1319
+			foreach ($rows as $row)
1270 1320
 		{
1271 1321
 			// The latest message is the latest of the current board and its children.
1272 1322
 			if (isset($lastModifiedMsg[$row['id_board']]))
1273 1323
 				$curLastModifiedMsg = max($row['local_last_msg'], $lastModifiedMsg[$row['id_board']]);
1274
-			else
1275
-				$curLastModifiedMsg = $row['local_last_msg'];
1324
+	}
1325
+			else {
1326
+							$curLastModifiedMsg = $row['local_last_msg'];
1327
+			}
1276 1328
 
1277 1329
 			// If what is and what should be the latest message differ, an update is necessary.
1278
-			if ($row['local_last_msg'] != $row['id_last_msg'] || $curLastModifiedMsg != $row['id_msg_updated'])
1279
-				$smcFunc['db_query']('', '
1330
+			if ($row['local_last_msg'] != $row['id_last_msg'] || $curLastModifiedMsg != $row['id_msg_updated']) {
1331
+							$smcFunc['db_query']('', '
1280 1332
 					UPDATE {db_prefix}boards
1281 1333
 					SET id_last_msg = {int:id_last_msg}, id_msg_updated = {int:id_msg_updated}
1282 1334
 					WHERE id_board = {int:id_board}',
@@ -1286,12 +1338,14 @@  discard block
 block discarded – undo
1286 1338
 						'id_board' => $row['id_board'],
1287 1339
 					)
1288 1340
 				);
1341
+			}
1289 1342
 
1290 1343
 			// Parent boards inherit the latest modified message of their children.
1291
-			if (isset($lastModifiedMsg[$row['id_parent']]))
1292
-				$lastModifiedMsg[$row['id_parent']] = max($row['local_last_msg'], $lastModifiedMsg[$row['id_parent']]);
1293
-			else
1294
-				$lastModifiedMsg[$row['id_parent']] = $row['local_last_msg'];
1344
+			if (isset($lastModifiedMsg[$row['id_parent']])) {
1345
+							$lastModifiedMsg[$row['id_parent']] = max($row['local_last_msg'], $lastModifiedMsg[$row['id_parent']]);
1346
+			} else {
1347
+							$lastModifiedMsg[$row['id_parent']] = $row['local_last_msg'];
1348
+			}
1295 1349
 		}
1296 1350
 
1297 1351
 	// Update all the basic statistics.
@@ -1363,8 +1417,9 @@  discard block
 block discarded – undo
1363 1417
 	require_once($sourcedir . '/Subs-Auth.php');
1364 1418
 	$members = findMembers($_POST['to']);
1365 1419
 
1366
-	if (empty($members))
1367
-		fatal_lang_error('reattribute_cannot_find_member');
1420
+	if (empty($members)) {
1421
+			fatal_lang_error('reattribute_cannot_find_member');
1422
+	}
1368 1423
 
1369 1424
 	$memID = array_shift($members);
1370 1425
 	$memID = $memID['id'];
@@ -1394,8 +1449,9 @@  discard block
 block discarded – undo
1394 1449
 		validateToken('admin-maint');
1395 1450
 
1396 1451
 		$groups = array();
1397
-		foreach ($_POST['groups'] as $id => $dummy)
1398
-			$groups[] = (int) $id;
1452
+		foreach ($_POST['groups'] as $id => $dummy) {
1453
+					$groups[] = (int) $id;
1454
+		}
1399 1455
 		$time_limit = (time() - ($_POST['maxdays'] * 24 * 3600));
1400 1456
 		$where_vars = array(
1401 1457
 			'time_limit' => $time_limit,
@@ -1404,9 +1460,9 @@  discard block
 block discarded – undo
1404 1460
 		{
1405 1461
 			$where = 'mem.date_registered < {int:time_limit} AND mem.is_activated = {int:is_activated}';
1406 1462
 			$where_vars['is_activated'] = 0;
1463
+		} else {
1464
+					$where = 'mem.last_login < {int:time_limit} AND (mem.last_login != 0 OR mem.date_registered < {int:time_limit})';
1407 1465
 		}
1408
-		else
1409
-			$where = 'mem.last_login < {int:time_limit} AND (mem.last_login != 0 OR mem.date_registered < {int:time_limit})';
1410 1466
 
1411 1467
 		// Need to get *all* groups then work out which (if any) we avoid.
1412 1468
 		$request = $smcFunc['db_query']('', '
@@ -1425,8 +1481,7 @@  discard block
 block discarded – undo
1425 1481
 				{
1426 1482
 					$where .= ' AND mem.id_post_group != {int:id_post_group_' . $row['id_group'] . '}';
1427 1483
 					$where_vars['id_post_group_' . $row['id_group']] = $row['id_group'];
1428
-				}
1429
-				else
1484
+				} else
1430 1485
 				{
1431 1486
 					$where .= ' AND mem.id_group != {int:id_group_' . $row['id_group'] . '} AND FIND_IN_SET({int:id_group_' . $row['id_group'] . '}, mem.additional_groups) = 0';
1432 1487
 					$where_vars['id_group_' . $row['id_group']] = $row['id_group'];
@@ -1453,8 +1508,9 @@  discard block
 block discarded – undo
1453 1508
 		$members = array();
1454 1509
 		while ($row = $smcFunc['db_fetch_assoc']($request))
1455 1510
 		{
1456
-			if (!$row['is_mod'] || !in_array(3, $groups))
1457
-				$members[] = $row['id_member'];
1511
+			if (!$row['is_mod'] || !in_array(3, $groups)) {
1512
+							$members[] = $row['id_member'];
1513
+			}
1458 1514
 		}
1459 1515
 		$smcFunc['db_free_result']($request);
1460 1516
 
@@ -1501,8 +1557,9 @@  discard block
 block discarded – undo
1501 1557
 		)
1502 1558
 	);
1503 1559
 
1504
-	while ($row = $smcFunc['db_fetch_row']($request))
1505
-		$drafts[] = (int) $row[0];
1560
+	while ($row = $smcFunc['db_fetch_row']($request)) {
1561
+			$drafts[] = (int) $row[0];
1562
+	}
1506 1563
 	$smcFunc['db_free_result']($request);
1507 1564
 
1508 1565
 	// If we have old drafts, remove them
@@ -1545,8 +1602,9 @@  discard block
 block discarded – undo
1545 1602
 	$sticky = isset($_POST['move_type_sticky']) || isset($_GET['sticky']);
1546 1603
 
1547 1604
 	// No boards then this is your stop.
1548
-	if (empty($id_board_from) || empty($id_board_to))
1549
-		return;
1605
+	if (empty($id_board_from) || empty($id_board_to)) {
1606
+			return;
1607
+	}
1550 1608
 
1551 1609
 	// The big WHERE clause
1552 1610
 	$conditions = 'WHERE t.id_board = {int:id_board_from}
@@ -1594,18 +1652,20 @@  discard block
 block discarded – undo
1594 1652
 		);
1595 1653
 		list ($total_topics) = $smcFunc['db_fetch_row']($request);
1596 1654
 		$smcFunc['db_free_result']($request);
1655
+	} else {
1656
+			$total_topics = (int) $_REQUEST['totaltopics'];
1597 1657
 	}
1598
-	else
1599
-		$total_topics = (int) $_REQUEST['totaltopics'];
1600 1658
 
1601 1659
 	// Seems like we need this here.
1602 1660
 	$context['continue_get_data'] = '?action=admin;area=maintain;sa=topics;activity=massmove;id_board_from=' . $id_board_from . ';id_board_to=' . $id_board_to . ';totaltopics=' . $total_topics . ';max_days=' . $max_days;
1603 1661
 
1604
-	if ($locked)
1605
-		$context['continue_get_data'] .= ';locked';
1662
+	if ($locked) {
1663
+			$context['continue_get_data'] .= ';locked';
1664
+	}
1606 1665
 
1607
-	if ($sticky)
1608
-		$context['continue_get_data'] .= ';sticky';
1666
+	if ($sticky) {
1667
+			$context['continue_get_data'] .= ';sticky';
1668
+	}
1609 1669
 
1610 1670
 	$context['continue_get_data'] .= ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'];
1611 1671
 
@@ -1626,8 +1686,9 @@  discard block
 block discarded – undo
1626 1686
 
1627 1687
 			// Get the ids.
1628 1688
 			$topics = array();
1629
-			while ($row = $smcFunc['db_fetch_assoc']($request))
1630
-				$topics[] = $row['id_topic'];
1689
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
1690
+							$topics[] = $row['id_topic'];
1691
+			}
1631 1692
 
1632 1693
 			// Just return if we don't have any topics left to move.
1633 1694
 			if (empty($topics))
@@ -1718,9 +1779,9 @@  discard block
 block discarded – undo
1718 1779
 		// save it so we don't do this again for this task
1719 1780
 		list ($_SESSION['total_members']) = $smcFunc['db_fetch_row']($request);
1720 1781
 		$smcFunc['db_free_result']($request);
1782
+	} else {
1783
+			validateToken('admin-recountposts');
1721 1784
 	}
1722
-	else
1723
-		validateToken('admin-recountposts');
1724 1785
 
1725 1786
 	// Lets get a group of members and determine their post count (from the boards that have post count enabled of course).
1726 1787
 	$request = $smcFunc['db_query']('', '
@@ -1766,8 +1827,9 @@  discard block
 block discarded – undo
1766 1827
 		createToken('admin-recountposts');
1767 1828
 		$context['continue_post_data'] = '<input type="hidden" name="' . $context['admin-recountposts_token_var'] . '" value="' . $context['admin-recountposts_token'] . '">';
1768 1829
 
1769
-		if (function_exists('apache_reset_timeout'))
1770
-			apache_reset_timeout();
1830
+		if (function_exists('apache_reset_timeout')) {
1831
+					apache_reset_timeout();
1832
+		}
1771 1833
 		return;
1772 1834
 	}
1773 1835
 
@@ -1853,10 +1915,9 @@  discard block
 block discarded – undo
1853 1915
 		checkSession('request');
1854 1916
 		validateToken('admin-hook', 'request');
1855 1917
 
1856
-		if ($_REQUEST['do'] == 'remove')
1857
-			remove_integration_function($_REQUEST['hook'], urldecode($_REQUEST['function']));
1858
-
1859
-		else
1918
+		if ($_REQUEST['do'] == 'remove') {
1919
+					remove_integration_function($_REQUEST['hook'], urldecode($_REQUEST['function']));
1920
+		} else
1860 1921
 		{
1861 1922
 			$function_remove = urldecode($_REQUEST['function']) . (($_REQUEST['do'] == 'disable') ? '' : '!');
1862 1923
 			$function_add = urldecode($_REQUEST['function']) . (($_REQUEST['do'] == 'disable') ? '!' : '');
@@ -1906,11 +1967,11 @@  discard block
 block discarded – undo
1906 1967
 						// Show a nice icon to indicate this is an instance.
1907 1968
 						$instance = (!empty($data['instance']) ? '<span class="generic_icons news" title="' . $txt['hooks_field_function_method'] . '"></span> ' : '');
1908 1969
 
1909
-						if (!empty($data['included_file']))
1910
-							return $instance . $txt['hooks_field_function'] . ': ' . $data['real_function'] . '<br>' . $txt['hooks_field_included_file'] . ': ' . $data['included_file'];
1911
-
1912
-						else
1913
-							return $instance . $data['real_function'];
1970
+						if (!empty($data['included_file'])) {
1971
+													return $instance . $txt['hooks_field_function'] . ': ' . $data['real_function'] . '<br>' . $txt['hooks_field_included_file'] . ': ' . $data['included_file'];
1972
+						} else {
1973
+													return $instance . $data['real_function'];
1974
+						}
1914 1975
 					},
1915 1976
 				),
1916 1977
 				'sort' =>  array(
@@ -1975,11 +2036,12 @@  discard block
 block discarded – undo
1975 2036
 		'data' => array(
1976 2037
 			'function' => function($data) use ($txt, $scripturl, $context)
1977 2038
 			{
1978
-				if (!$data['hook_exists'])
1979
-					return '
2039
+				if (!$data['hook_exists']) {
2040
+									return '
1980 2041
 					<a href="' . $scripturl . '?action=admin;area=maintain;sa=hooks;do=remove;hook=' . $data['hook_name'] . ';function=' . urlencode($data['function_name']) . $context['filter_url'] . ';' . $context['admin-hook_token_var'] . '=' . $context['admin-hook_token'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" data-confirm="' . $txt['quickmod_confirm'] . '" class="you_sure">
1981 2042
 						<span class="generic_icons delete" title="' . $txt['hooks_button_remove'] . '"></span>
1982 2043
 					</a>';
2044
+				}
1983 2045
 			},
1984 2046
 			'class' => 'centertext',
1985 2047
 		),
@@ -2014,10 +2076,11 @@  discard block
 block discarded – undo
2014 2076
 		{
2015 2077
 			if ($file != '.' && $file != '..')
2016 2078
 			{
2017
-				if (is_dir($dir_path . '/' . $file))
2018
-					$files = array_merge($files, get_files_recursive($dir_path . '/' . $file));
2019
-				else
2020
-					$files[] = array('dir' => $dir_path, 'name' => $file);
2079
+				if (is_dir($dir_path . '/' . $file)) {
2080
+									$files = array_merge($files, get_files_recursive($dir_path . '/' . $file));
2081
+				} else {
2082
+									$files[] = array('dir' => $dir_path, 'name' => $file);
2083
+				}
2021 2084
 			}
2022 2085
 		}
2023 2086
 	}
@@ -2066,16 +2129,16 @@  discard block
 block discarded – undo
2066 2129
 							// I need to know if there is at least one function called in this file.
2067 2130
 							$temp_data['include'][$hookParsedData['pureFunc']] = array('hook' => $hook, 'function' => $hookParsedData['pureFunc']);
2068 2131
 							unset($temp_hooks[$hook][$rawFunc]);
2069
-						}
2070
-						elseif (strpos(str_replace(' (', '(', $fc), 'function ' . trim($hookParsedData['pureFunc']) . '(') !== false)
2132
+						} elseif (strpos(str_replace(' (', '(', $fc), 'function ' . trim($hookParsedData['pureFunc']) . '(') !== false)
2071 2133
 						{
2072 2134
 							$hook_status[$hook][$hookParsedData['pureFunc']] = $hookParsedData;
2073 2135
 							$hook_status[$hook][$hookParsedData['pureFunc']]['exists'] = true;
2074 2136
 							$hook_status[$hook][$hookParsedData['pureFunc']]['in_file'] = (!empty($file['name']) ? $file['name'] : (!empty($hookParsedData['hookFile']) ? $hookParsedData['hookFile'] : ''));
2075 2137
 
2076 2138
 							// Does the hook has its own file?
2077
-							if (!empty($hookParsedData['hookFile']))
2078
-								$temp_data['include'][$hookParsedData['pureFunc']] = array('hook' => $hook, 'function' => $hookParsedData['pureFunc']);
2139
+							if (!empty($hookParsedData['hookFile'])) {
2140
+															$temp_data['include'][$hookParsedData['pureFunc']] = array('hook' => $hook, 'function' => $hookParsedData['pureFunc']);
2141
+							}
2079 2142
 
2080 2143
 							// I want to remember all the functions called within this file (to check later if they are enabled or disabled and decide if the integrare_*_include of that file can be disabled too)
2081 2144
 							$temp_data['function'][$file['name']][$hookParsedData['pureFunc']] = $hookParsedData['enabled'];
@@ -2102,15 +2165,17 @@  discard block
 block discarded – undo
2102 2165
 	$sort = array();
2103 2166
 	$hooks_filters = array();
2104 2167
 
2105
-	foreach ($hooks as $hook => $functions)
2106
-		$hooks_filters[] = '<option' . ($context['current_filter'] == $hook ? ' selected ' : '') . ' value="' . $hook . '">' . $hook . '</option>';
2168
+	foreach ($hooks as $hook => $functions) {
2169
+			$hooks_filters[] = '<option' . ($context['current_filter'] == $hook ? ' selected ' : '') . ' value="' . $hook . '">' . $hook . '</option>';
2170
+	}
2107 2171
 
2108
-	if (!empty($hooks_filters))
2109
-		$context['insert_after_template'] .= '
2172
+	if (!empty($hooks_filters)) {
2173
+			$context['insert_after_template'] .= '
2110 2174
 		<script>
2111 2175
 			var hook_name_header = document.getElementById(\'header_list_integration_hooks_hook_name\');
2112 2176
 			hook_name_header.innerHTML += ' . JavaScriptEscape('<select style="margin-left:15px;" onchange="window.location=(\'' . $scripturl . '?action=admin;area=maintain;sa=hooks\' + (this.value ? \';filter=\' + this.value : \'\'));"><option value="">' . $txt['hooks_reset_filter'] . '</option>' . implode('', $hooks_filters) . '</select>') . ';
2113 2177
 		</script>';
2178
+	}
2114 2179
 
2115 2180
 	$temp_data = array();
2116 2181
 	$id = 0;
@@ -2152,10 +2217,11 @@  discard block
 block discarded – undo
2152 2217
 
2153 2218
 	foreach ($temp_data as $data)
2154 2219
 	{
2155
-		if (++$counter < $start)
2156
-			continue;
2157
-		elseif ($counter == $start + $per_page)
2158
-			break;
2220
+		if (++$counter < $start) {
2221
+					continue;
2222
+		} elseif ($counter == $start + $per_page) {
2223
+					break;
2224
+		}
2159 2225
 
2160 2226
 		$hooks_data[] = $data;
2161 2227
 	}
@@ -2177,13 +2243,15 @@  discard block
 block discarded – undo
2177 2243
 	$hooks_count = 0;
2178 2244
 
2179 2245
 	$context['filter'] = false;
2180
-	if (isset($_GET['filter']))
2181
-		$context['filter'] = $_GET['filter'];
2246
+	if (isset($_GET['filter'])) {
2247
+			$context['filter'] = $_GET['filter'];
2248
+	}
2182 2249
 
2183 2250
 	foreach ($hooks as $hook => $functions)
2184 2251
 	{
2185
-		if (empty($context['filter']) || (!empty($context['filter']) && $context['filter'] == $hook))
2186
-			$hooks_count += count($functions);
2252
+		if (empty($context['filter']) || (!empty($context['filter']) && $context['filter'] == $hook)) {
2253
+					$hooks_count += count($functions);
2254
+		}
2187 2255
 	}
2188 2256
 
2189 2257
 	return $hooks_count;
@@ -2204,8 +2272,9 @@  discard block
 block discarded – undo
2204 2272
 		$integration_hooks = array();
2205 2273
 		foreach ($modSettings as $key => $value)
2206 2274
 		{
2207
-			if (!empty($value) && substr($key, 0, 10) === 'integrate_')
2208
-				$integration_hooks[$key] = explode(',', $value);
2275
+			if (!empty($value) && substr($key, 0, 10) === 'integrate_') {
2276
+							$integration_hooks[$key] = explode(',', $value);
2277
+			}
2209 2278
 		}
2210 2279
 	}
2211 2280
 
@@ -2236,8 +2305,9 @@  discard block
 block discarded – undo
2236 2305
 	);
2237 2306
 
2238 2307
 	// Meh...
2239
-	if (empty($rawData))
2240
-		return $hookData;
2308
+	if (empty($rawData)) {
2309
+			return $hookData;
2310
+	}
2241 2311
 
2242 2312
 	// For convenience purposes only!
2243 2313
 	$modFunc = $rawData;
@@ -2248,11 +2318,11 @@  discard block
 block discarded – undo
2248 2318
 		list ($hookData['hookFile'], $modFunc) = explode('|', $modFunc);
2249 2319
 
2250 2320
 		// Does the file exists? who knows!
2251
-		if (empty($settings['theme_dir']))
2252
-			$hookData['absPath'] = strtr(trim($hookData['hookFile']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir));
2253
-
2254
-		else
2255
-			$hookData['absPath'] = strtr(trim($hookData['hookFile']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir']));
2321
+		if (empty($settings['theme_dir'])) {
2322
+					$hookData['absPath'] = strtr(trim($hookData['hookFile']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir));
2323
+		} else {
2324
+					$hookData['absPath'] = strtr(trim($hookData['hookFile']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir']));
2325
+		}
2256 2326
 
2257 2327
 		$hookData['fileExists'] = file_exists($hookData['absPath']);
2258 2328
 		$hookData['hookFile'] = basename($hookData['hookFile']);
@@ -2277,11 +2347,10 @@  discard block
 block discarded – undo
2277 2347
 	{
2278 2348
 		list ($hookData['class'], $hookData['method']) = explode('::', $modFunc);
2279 2349
 		$hookData['pureFunc'] = $hookData['method'];
2350
+	} else {
2351
+			$hookData['pureFunc'] = $modFunc;
2280 2352
 	}
2281 2353
 
2282
-	else
2283
-		$hookData['pureFunc'] = $modFunc;
2284
-
2285 2354
 	return $hookData;
2286 2355
 }
2287 2356
 
Please login to merge, or discard this patch.
Sources/Subs-Charset.php 2 patches
Spacing   +506 added lines, -506 removed lines patch added patch discarded remove patch
@@ -24,259 +24,259 @@  discard block
 block discarded – undo
24 24
 function utf8_strtolower($string)
25 25
 {
26 26
 	static $case_folding = array(
27
-		'A' => 'a',		'B' => 'b',		'C' => 'c',		'D' => 'd',
28
-		'E' => 'e',		'F' => 'f',		'G' => 'g',		'H' => 'h',
29
-		'I' => 'i',		'J' => 'j',		'K' => 'k',		'L' => 'l',
30
-		'M' => 'm',		'N' => 'n',		'O' => 'o',		'P' => 'p',
31
-		'Q' => 'q',		'R' => 'r',		'S' => 's',		'T' => 't',
32
-		'U' => 'u',		'V' => 'v',		'W' => 'w',		'X' => 'x',
33
-		'Y' => 'y',		'Z' => 'z',		"\xc2\xb5" => "\xce\xbc",		"\xc3\x80" => "\xc3\xa0",
34
-		"\xc3\x81" => "\xc3\xa1",		"\xc3\x82" => "\xc3\xa2",		"\xc3\x83" => "\xc3\xa3",		"\xc3\x84" => "\xc3\xa4",
35
-		"\xc3\x85" => "\xc3\xa5",		"\xc3\x86" => "\xc3\xa6",		"\xc3\x87" => "\xc3\xa7",		"\xc3\x88" => "\xc3\xa8",
36
-		"\xc3\x89" => "\xc3\xa9",		"\xc3\x8a" => "\xc3\xaa",		"\xc3\x8b" => "\xc3\xab",		"\xc3\x8c" => "\xc3\xac",
37
-		"\xc3\x8d" => "\xc3\xad",		"\xc3\x8e" => "\xc3\xae",		"\xc3\x8f" => "\xc3\xaf",		"\xc3\x90" => "\xc3\xb0",
38
-		"\xc3\x91" => "\xc3\xb1",		"\xc3\x92" => "\xc3\xb2",		"\xc3\x93" => "\xc3\xb3",		"\xc3\x94" => "\xc3\xb4",
39
-		"\xc3\x95" => "\xc3\xb5",		"\xc3\x96" => "\xc3\xb6",		"\xc3\x98" => "\xc3\xb8",		"\xc3\x99" => "\xc3\xb9",
40
-		"\xc3\x9a" => "\xc3\xba",		"\xc3\x9b" => "\xc3\xbb",		"\xc3\x9c" => "\xc3\xbc",		"\xc3\x9d" => "\xc3\xbd",
41
-		"\xc3\x9e" => "\xc3\xbe",		"\xc3\x9f" => "ss",	"\xc4\x80" => "\xc4\x81",		"\xc4\x82" => "\xc4\x83",
42
-		"\xc4\x84" => "\xc4\x85",		"\xc4\x86" => "\xc4\x87",		"\xc4\x88" => "\xc4\x89",		"\xc4\x8a" => "\xc4\x8b",
43
-		"\xc4\x8c" => "\xc4\x8d",		"\xc4\x8e" => "\xc4\x8f",		"\xc4\x90" => "\xc4\x91",		"\xc4\x92" => "\xc4\x93",
44
-		"\xc4\x94" => "\xc4\x95",		"\xc4\x96" => "\xc4\x97",		"\xc4\x98" => "\xc4\x99",		"\xc4\x9a" => "\xc4\x9b",
45
-		"\xc4\x9c" => "\xc4\x9d",		"\xc4\x9e" => "\xc4\x9f",		"\xc4\xa0" => "\xc4\xa1",		"\xc4\xa2" => "\xc4\xa3",
46
-		"\xc4\xa4" => "\xc4\xa5",		"\xc4\xa6" => "\xc4\xa7",		"\xc4\xa8" => "\xc4\xa9",		"\xc4\xaa" => "\xc4\xab",
47
-		"\xc4\xac" => "\xc4\xad",		"\xc4\xae" => "\xc4\xaf",		"\xc4\xb0" => "i\xcc\x87",		"\xc4\xb2" => "\xc4\xb3",
48
-		"\xc4\xb4" => "\xc4\xb5",		"\xc4\xb6" => "\xc4\xb7",		"\xc4\xb9" => "\xc4\xba",		"\xc4\xbb" => "\xc4\xbc",
49
-		"\xc4\xbd" => "\xc4\xbe",		"\xc4\xbf" => "\xc5\x80",		"\xc5\x81" => "\xc5\x82",		"\xc5\x83" => "\xc5\x84",
50
-		"\xc5\x85" => "\xc5\x86",		"\xc5\x87" => "\xc5\x88",		"\xc5\x89" => "\xca\xbcn",	"\xc5\x8a" => "\xc5\x8b",
51
-		"\xc5\x8c" => "\xc5\x8d",		"\xc5\x8e" => "\xc5\x8f",		"\xc5\x90" => "\xc5\x91",		"\xc5\x92" => "\xc5\x93",
52
-		"\xc5\x94" => "\xc5\x95",		"\xc5\x96" => "\xc5\x97",		"\xc5\x98" => "\xc5\x99",		"\xc5\x9a" => "\xc5\x9b",
53
-		"\xc5\x9c" => "\xc5\x9d",		"\xc5\x9e" => "\xc5\x9f",		"\xc5\xa0" => "\xc5\xa1",		"\xc5\xa2" => "\xc5\xa3",
54
-		"\xc5\xa4" => "\xc5\xa5",		"\xc5\xa6" => "\xc5\xa7",		"\xc5\xa8" => "\xc5\xa9",		"\xc5\xaa" => "\xc5\xab",
55
-		"\xc5\xac" => "\xc5\xad",		"\xc5\xae" => "\xc5\xaf",		"\xc5\xb0" => "\xc5\xb1",		"\xc5\xb2" => "\xc5\xb3",
56
-		"\xc5\xb4" => "\xc5\xb5",		"\xc5\xb6" => "\xc5\xb7",		"\xc5\xb8" => "\xc3\xbf",		"\xc5\xb9" => "\xc5\xba",
57
-		"\xc5\xbb" => "\xc5\xbc",		"\xc5\xbd" => "\xc5\xbe",		"\xc5\xbf" => "s",		"\xc6\x81" => "\xc9\x93",
58
-		"\xc6\x82" => "\xc6\x83",		"\xc6\x84" => "\xc6\x85",		"\xc6\x86" => "\xc9\x94",		"\xc6\x87" => "\xc6\x88",
59
-		"\xc6\x89" => "\xc9\x96",		"\xc6\x8a" => "\xc9\x97",		"\xc6\x8b" => "\xc6\x8c",		"\xc6\x8e" => "\xc7\x9d",
60
-		"\xc6\x8f" => "\xc9\x99",		"\xc6\x90" => "\xc9\x9b",		"\xc6\x91" => "\xc6\x92",		"\xc6\x93" => "\xc9\xa0",
61
-		"\xc6\x94" => "\xc9\xa3",		"\xc6\x96" => "\xc9\xa9",		"\xc6\x97" => "\xc9\xa8",		"\xc6\x98" => "\xc6\x99",
62
-		"\xc6\x9c" => "\xc9\xaf",		"\xc6\x9d" => "\xc9\xb2",		"\xc6\x9f" => "\xc9\xb5",		"\xc6\xa0" => "\xc6\xa1",
63
-		"\xc6\xa2" => "\xc6\xa3",		"\xc6\xa4" => "\xc6\xa5",		"\xc6\xa6" => "\xca\x80",		"\xc6\xa7" => "\xc6\xa8",
64
-		"\xc6\xa9" => "\xca\x83",		"\xc6\xac" => "\xc6\xad",		"\xc6\xae" => "\xca\x88",		"\xc6\xaf" => "\xc6\xb0",
65
-		"\xc6\xb1" => "\xca\x8a",		"\xc6\xb2" => "\xca\x8b",		"\xc6\xb3" => "\xc6\xb4",		"\xc6\xb5" => "\xc6\xb6",
66
-		"\xc6\xb7" => "\xca\x92",		"\xc6\xb8" => "\xc6\xb9",		"\xc6\xbc" => "\xc6\xbd",		"\xc7\x84" => "\xc7\x86",
67
-		"\xc7\x85" => "\xc7\x86",		"\xc7\x87" => "\xc7\x89",		"\xc7\x88" => "\xc7\x89",		"\xc7\x8a" => "\xc7\x8c",
68
-		"\xc7\x8b" => "\xc7\x8c",		"\xc7\x8d" => "\xc7\x8e",		"\xc7\x8f" => "\xc7\x90",		"\xc7\x91" => "\xc7\x92",
69
-		"\xc7\x93" => "\xc7\x94",		"\xc7\x95" => "\xc7\x96",		"\xc7\x97" => "\xc7\x98",		"\xc7\x99" => "\xc7\x9a",
70
-		"\xc7\x9b" => "\xc7\x9c",		"\xc7\x9e" => "\xc7\x9f",		"\xc7\xa0" => "\xc7\xa1",		"\xc7\xa2" => "\xc7\xa3",
71
-		"\xc7\xa4" => "\xc7\xa5",		"\xc7\xa6" => "\xc7\xa7",		"\xc7\xa8" => "\xc7\xa9",		"\xc7\xaa" => "\xc7\xab",
72
-		"\xc7\xac" => "\xc7\xad",		"\xc7\xae" => "\xc7\xaf",		"\xc7\xb0" => "j\xcc\x8c",		"\xc7\xb1" => "\xc7\xb3",
73
-		"\xc7\xb2" => "\xc7\xb3",		"\xc7\xb4" => "\xc7\xb5",		"\xc7\xb6" => "\xc6\x95",		"\xc7\xb7" => "\xc6\xbf",
74
-		"\xc7\xb8" => "\xc7\xb9",		"\xc7\xba" => "\xc7\xbb",		"\xc7\xbc" => "\xc7\xbd",		"\xc7\xbe" => "\xc7\xbf",
75
-		"\xc8\x80" => "\xc8\x81",		"\xc8\x82" => "\xc8\x83",		"\xc8\x84" => "\xc8\x85",		"\xc8\x86" => "\xc8\x87",
76
-		"\xc8\x88" => "\xc8\x89",		"\xc8\x8a" => "\xc8\x8b",		"\xc8\x8c" => "\xc8\x8d",		"\xc8\x8e" => "\xc8\x8f",
77
-		"\xc8\x90" => "\xc8\x91",		"\xc8\x92" => "\xc8\x93",		"\xc8\x94" => "\xc8\x95",		"\xc8\x96" => "\xc8\x97",
78
-		"\xc8\x98" => "\xc8\x99",		"\xc8\x9a" => "\xc8\x9b",		"\xc8\x9c" => "\xc8\x9d",		"\xc8\x9e" => "\xc8\x9f",
79
-		"\xc8\xa0" => "\xc6\x9e",		"\xc8\xa2" => "\xc8\xa3",		"\xc8\xa4" => "\xc8\xa5",		"\xc8\xa6" => "\xc8\xa7",
80
-		"\xc8\xa8" => "\xc8\xa9",		"\xc8\xaa" => "\xc8\xab",		"\xc8\xac" => "\xc8\xad",		"\xc8\xae" => "\xc8\xaf",
81
-		"\xc8\xb0" => "\xc8\xb1",		"\xc8\xb2" => "\xc8\xb3",		"\xc8\xba" => "\xe2\xb1\xa5",		"\xc8\xbb" => "\xc8\xbc",
82
-		"\xc8\xbd" => "\xc6\x9a",		"\xc8\xbe" => "\xe2\xb1\xa6",		"\xc9\x81" => "\xc9\x82",		"\xc9\x83" => "\xc6\x80",
83
-		"\xc9\x84" => "\xca\x89",		"\xc9\x85" => "\xca\x8c",		"\xc9\x86" => "\xc9\x87",		"\xc9\x88" => "\xc9\x89",
84
-		"\xc9\x8a" => "\xc9\x8b",		"\xc9\x8c" => "\xc9\x8d",		"\xc9\x8e" => "\xc9\x8f",		"\xcd\x85" => "\xce\xb9",
85
-		"\xce\x86" => "\xce\xac",		"\xce\x88" => "\xce\xad",		"\xce\x89" => "\xce\xae",		"\xce\x8a" => "\xce\xaf",
86
-		"\xce\x8c" => "\xcf\x8c",		"\xce\x8e" => "\xcf\x8d",		"\xce\x8f" => "\xcf\x8e",		"\xce\x90" => "\xce\xb9\xcc\x88\xcc\x81",
87
-		"\xce\x91" => "\xce\xb1",		"\xce\x92" => "\xce\xb2",		"\xce\x93" => "\xce\xb3",		"\xce\x94" => "\xce\xb4",
88
-		"\xce\x95" => "\xce\xb5",		"\xce\x96" => "\xce\xb6",		"\xce\x97" => "\xce\xb7",		"\xce\x98" => "\xce\xb8",
89
-		"\xce\x99" => "\xce\xb9",		"\xce\x9a" => "\xce\xba",		"\xce\x9b" => "\xce\xbb",		"\xce\x9c" => "\xce\xbc",
90
-		"\xce\x9d" => "\xce\xbd",		"\xce\x9e" => "\xce\xbe",		"\xce\x9f" => "\xce\xbf",		"\xce\xa0" => "\xcf\x80",
91
-		"\xce\xa1" => "\xcf\x81",		"\xce\xa3" => "\xcf\x83",		"\xce\xa4" => "\xcf\x84",		"\xce\xa5" => "\xcf\x85",
92
-		"\xce\xa6" => "\xcf\x86",		"\xce\xa7" => "\xcf\x87",		"\xce\xa8" => "\xcf\x88",		"\xce\xa9" => "\xcf\x89",
93
-		"\xce\xaa" => "\xcf\x8a",		"\xce\xab" => "\xcf\x8b",		"\xce\xb0" => "\xcf\x85\xcc\x88\xcc\x81",	"\xcf\x82" => "\xcf\x83",
94
-		"\xcf\x90" => "\xce\xb2",		"\xcf\x91" => "\xce\xb8",		"\xcf\x95" => "\xcf\x86",		"\xcf\x96" => "\xcf\x80",
95
-		"\xcf\x98" => "\xcf\x99",		"\xcf\x9a" => "\xcf\x9b",		"\xcf\x9c" => "\xcf\x9d",		"\xcf\x9e" => "\xcf\x9f",
96
-		"\xcf\xa0" => "\xcf\xa1",		"\xcf\xa2" => "\xcf\xa3",		"\xcf\xa4" => "\xcf\xa5",		"\xcf\xa6" => "\xcf\xa7",
97
-		"\xcf\xa8" => "\xcf\xa9",		"\xcf\xaa" => "\xcf\xab",		"\xcf\xac" => "\xcf\xad",		"\xcf\xae" => "\xcf\xaf",
98
-		"\xcf\xb0" => "\xce\xba",		"\xcf\xb1" => "\xcf\x81",		"\xcf\xb4" => "\xce\xb8",		"\xcf\xb5" => "\xce\xb5",
99
-		"\xcf\xb7" => "\xcf\xb8",		"\xcf\xb9" => "\xcf\xb2",		"\xcf\xba" => "\xcf\xbb",		"\xcf\xbd" => "\xcd\xbb",
100
-		"\xcf\xbe" => "\xcd\xbc",		"\xcf\xbf" => "\xcd\xbd",		"\xd0\x80" => "\xd1\x90",		"\xd0\x81" => "\xd1\x91",
101
-		"\xd0\x82" => "\xd1\x92",		"\xd0\x83" => "\xd1\x93",		"\xd0\x84" => "\xd1\x94",		"\xd0\x85" => "\xd1\x95",
102
-		"\xd0\x86" => "\xd1\x96",		"\xd0\x87" => "\xd1\x97",		"\xd0\x88" => "\xd1\x98",		"\xd0\x89" => "\xd1\x99",
103
-		"\xd0\x8a" => "\xd1\x9a",		"\xd0\x8b" => "\xd1\x9b",		"\xd0\x8c" => "\xd1\x9c",		"\xd0\x8d" => "\xd1\x9d",
104
-		"\xd0\x8e" => "\xd1\x9e",		"\xd0\x8f" => "\xd1\x9f",		"\xd0\x90" => "\xd0\xb0",		"\xd0\x91" => "\xd0\xb1",
105
-		"\xd0\x92" => "\xd0\xb2",		"\xd0\x93" => "\xd0\xb3",		"\xd0\x94" => "\xd0\xb4",		"\xd0\x95" => "\xd0\xb5",
106
-		"\xd0\x96" => "\xd0\xb6",		"\xd0\x97" => "\xd0\xb7",		"\xd0\x98" => "\xd0\xb8",		"\xd0\x99" => "\xd0\xb9",
107
-		"\xd0\x9a" => "\xd0\xba",		"\xd0\x9b" => "\xd0\xbb",		"\xd0\x9c" => "\xd0\xbc",		"\xd0\x9d" => "\xd0\xbd",
108
-		"\xd0\x9e" => "\xd0\xbe",		"\xd0\x9f" => "\xd0\xbf",		"\xd0\xa0" => "\xd1\x80",		"\xd0\xa1" => "\xd1\x81",
109
-		"\xd0\xa2" => "\xd1\x82",		"\xd0\xa3" => "\xd1\x83",		"\xd0\xa4" => "\xd1\x84",		"\xd0\xa5" => "\xd1\x85",
110
-		"\xd0\xa6" => "\xd1\x86",		"\xd0\xa7" => "\xd1\x87",		"\xd0\xa8" => "\xd1\x88",		"\xd0\xa9" => "\xd1\x89",
111
-		"\xd0\xaa" => "\xd1\x8a",		"\xd0\xab" => "\xd1\x8b",		"\xd0\xac" => "\xd1\x8c",		"\xd0\xad" => "\xd1\x8d",
112
-		"\xd0\xae" => "\xd1\x8e",		"\xd0\xaf" => "\xd1\x8f",		"\xd1\xa0" => "\xd1\xa1",		"\xd1\xa2" => "\xd1\xa3",
113
-		"\xd1\xa4" => "\xd1\xa5",		"\xd1\xa6" => "\xd1\xa7",		"\xd1\xa8" => "\xd1\xa9",		"\xd1\xaa" => "\xd1\xab",
114
-		"\xd1\xac" => "\xd1\xad",		"\xd1\xae" => "\xd1\xaf",		"\xd1\xb0" => "\xd1\xb1",		"\xd1\xb2" => "\xd1\xb3",
115
-		"\xd1\xb4" => "\xd1\xb5",		"\xd1\xb6" => "\xd1\xb7",		"\xd1\xb8" => "\xd1\xb9",		"\xd1\xba" => "\xd1\xbb",
116
-		"\xd1\xbc" => "\xd1\xbd",		"\xd1\xbe" => "\xd1\xbf",		"\xd2\x80" => "\xd2\x81",		"\xd2\x8a" => "\xd2\x8b",
117
-		"\xd2\x8c" => "\xd2\x8d",		"\xd2\x8e" => "\xd2\x8f",		"\xd2\x90" => "\xd2\x91",		"\xd2\x92" => "\xd2\x93",
118
-		"\xd2\x94" => "\xd2\x95",		"\xd2\x96" => "\xd2\x97",		"\xd2\x98" => "\xd2\x99",		"\xd2\x9a" => "\xd2\x9b",
119
-		"\xd2\x9c" => "\xd2\x9d",		"\xd2\x9e" => "\xd2\x9f",		"\xd2\xa0" => "\xd2\xa1",		"\xd2\xa2" => "\xd2\xa3",
120
-		"\xd2\xa4" => "\xd2\xa5",		"\xd2\xa6" => "\xd2\xa7",		"\xd2\xa8" => "\xd2\xa9",		"\xd2\xaa" => "\xd2\xab",
121
-		"\xd2\xac" => "\xd2\xad",		"\xd2\xae" => "\xd2\xaf",		"\xd2\xb0" => "\xd2\xb1",		"\xd2\xb2" => "\xd2\xb3",
122
-		"\xd2\xb4" => "\xd2\xb5",		"\xd2\xb6" => "\xd2\xb7",		"\xd2\xb8" => "\xd2\xb9",		"\xd2\xba" => "\xd2\xbb",
123
-		"\xd2\xbc" => "\xd2\xbd",		"\xd2\xbe" => "\xd2\xbf",		"\xd3\x80" => "\xd3\x8f",		"\xd3\x81" => "\xd3\x82",
124
-		"\xd3\x83" => "\xd3\x84",		"\xd3\x85" => "\xd3\x86",		"\xd3\x87" => "\xd3\x88",		"\xd3\x89" => "\xd3\x8a",
125
-		"\xd3\x8b" => "\xd3\x8c",		"\xd3\x8d" => "\xd3\x8e",		"\xd3\x90" => "\xd3\x91",		"\xd3\x92" => "\xd3\x93",
126
-		"\xd3\x94" => "\xd3\x95",		"\xd3\x96" => "\xd3\x97",		"\xd3\x98" => "\xd3\x99",		"\xd3\x9a" => "\xd3\x9b",
127
-		"\xd3\x9c" => "\xd3\x9d",		"\xd3\x9e" => "\xd3\x9f",		"\xd3\xa0" => "\xd3\xa1",		"\xd3\xa2" => "\xd3\xa3",
128
-		"\xd3\xa4" => "\xd3\xa5",		"\xd3\xa6" => "\xd3\xa7",		"\xd3\xa8" => "\xd3\xa9",		"\xd3\xaa" => "\xd3\xab",
129
-		"\xd3\xac" => "\xd3\xad",		"\xd3\xae" => "\xd3\xaf",		"\xd3\xb0" => "\xd3\xb1",		"\xd3\xb2" => "\xd3\xb3",
130
-		"\xd3\xb4" => "\xd3\xb5",		"\xd3\xb6" => "\xd3\xb7",		"\xd3\xb8" => "\xd3\xb9",		"\xd3\xba" => "\xd3\xbb",
131
-		"\xd3\xbc" => "\xd3\xbd",		"\xd3\xbe" => "\xd3\xbf",		"\xd4\x80" => "\xd4\x81",		"\xd4\x82" => "\xd4\x83",
132
-		"\xd4\x84" => "\xd4\x85",		"\xd4\x86" => "\xd4\x87",		"\xd4\x88" => "\xd4\x89",		"\xd4\x8a" => "\xd4\x8b",
133
-		"\xd4\x8c" => "\xd4\x8d",		"\xd4\x8e" => "\xd4\x8f",		"\xd4\x90" => "\xd4\x91",		"\xd4\x92" => "\xd4\x93",
134
-		"\xd4\xb1" => "\xd5\xa1",		"\xd4\xb2" => "\xd5\xa2",		"\xd4\xb3" => "\xd5\xa3",		"\xd4\xb4" => "\xd5\xa4",
135
-		"\xd4\xb5" => "\xd5\xa5",		"\xd4\xb6" => "\xd5\xa6",		"\xd4\xb7" => "\xd5\xa7",		"\xd4\xb8" => "\xd5\xa8",
136
-		"\xd4\xb9" => "\xd5\xa9",		"\xd4\xba" => "\xd5\xaa",		"\xd4\xbb" => "\xd5\xab",		"\xd4\xbc" => "\xd5\xac",
137
-		"\xd4\xbd" => "\xd5\xad",		"\xd4\xbe" => "\xd5\xae",		"\xd4\xbf" => "\xd5\xaf",		"\xd5\x80" => "\xd5\xb0",
138
-		"\xd5\x81" => "\xd5\xb1",		"\xd5\x82" => "\xd5\xb2",		"\xd5\x83" => "\xd5\xb3",		"\xd5\x84" => "\xd5\xb4",
139
-		"\xd5\x85" => "\xd5\xb5",		"\xd5\x86" => "\xd5\xb6",		"\xd5\x87" => "\xd5\xb7",		"\xd5\x88" => "\xd5\xb8",
140
-		"\xd5\x89" => "\xd5\xb9",		"\xd5\x8a" => "\xd5\xba",		"\xd5\x8b" => "\xd5\xbb",		"\xd5\x8c" => "\xd5\xbc",
141
-		"\xd5\x8d" => "\xd5\xbd",		"\xd5\x8e" => "\xd5\xbe",		"\xd5\x8f" => "\xd5\xbf",		"\xd5\x90" => "\xd6\x80",
142
-		"\xd5\x91" => "\xd6\x81",		"\xd5\x92" => "\xd6\x82",		"\xd5\x93" => "\xd6\x83",		"\xd5\x94" => "\xd6\x84",
143
-		"\xd5\x95" => "\xd6\x85",		"\xd5\x96" => "\xd6\x86",		"\xd6\x87" => "\xd5\xa5\xd6\x82",		"\xe1\x82\xa0" => "\xe2\xb4\x80",
144
-		"\xe1\x82\xa1" => "\xe2\xb4\x81",		"\xe1\x82\xa2" => "\xe2\xb4\x82",		"\xe1\x82\xa3" => "\xe2\xb4\x83",		"\xe1\x82\xa4" => "\xe2\xb4\x84",
145
-		"\xe1\x82\xa5" => "\xe2\xb4\x85",		"\xe1\x82\xa6" => "\xe2\xb4\x86",		"\xe1\x82\xa7" => "\xe2\xb4\x87",		"\xe1\x82\xa8" => "\xe2\xb4\x88",
146
-		"\xe1\x82\xa9" => "\xe2\xb4\x89",		"\xe1\x82\xaa" => "\xe2\xb4\x8a",		"\xe1\x82\xab" => "\xe2\xb4\x8b",		"\xe1\x82\xac" => "\xe2\xb4\x8c",
147
-		"\xe1\x82\xad" => "\xe2\xb4\x8d",		"\xe1\x82\xae" => "\xe2\xb4\x8e",		"\xe1\x82\xaf" => "\xe2\xb4\x8f",		"\xe1\x82\xb0" => "\xe2\xb4\x90",
148
-		"\xe1\x82\xb1" => "\xe2\xb4\x91",		"\xe1\x82\xb2" => "\xe2\xb4\x92",		"\xe1\x82\xb3" => "\xe2\xb4\x93",		"\xe1\x82\xb4" => "\xe2\xb4\x94",
149
-		"\xe1\x82\xb5" => "\xe2\xb4\x95",		"\xe1\x82\xb6" => "\xe2\xb4\x96",		"\xe1\x82\xb7" => "\xe2\xb4\x97",		"\xe1\x82\xb8" => "\xe2\xb4\x98",
150
-		"\xe1\x82\xb9" => "\xe2\xb4\x99",		"\xe1\x82\xba" => "\xe2\xb4\x9a",		"\xe1\x82\xbb" => "\xe2\xb4\x9b",		"\xe1\x82\xbc" => "\xe2\xb4\x9c",
151
-		"\xe1\x82\xbd" => "\xe2\xb4\x9d",		"\xe1\x82\xbe" => "\xe2\xb4\x9e",		"\xe1\x82\xbf" => "\xe2\xb4\x9f",		"\xe1\x83\x80" => "\xe2\xb4\xa0",
152
-		"\xe1\x83\x81" => "\xe2\xb4\xa1",		"\xe1\x83\x82" => "\xe2\xb4\xa2",		"\xe1\x83\x83" => "\xe2\xb4\xa3",		"\xe1\x83\x84" => "\xe2\xb4\xa4",
153
-		"\xe1\x83\x85" => "\xe2\xb4\xa5",		"\xe1\xb8\x80" => "\xe1\xb8\x81",		"\xe1\xb8\x82" => "\xe1\xb8\x83",		"\xe1\xb8\x84" => "\xe1\xb8\x85",
154
-		"\xe1\xb8\x86" => "\xe1\xb8\x87",		"\xe1\xb8\x88" => "\xe1\xb8\x89",		"\xe1\xb8\x8a" => "\xe1\xb8\x8b",		"\xe1\xb8\x8c" => "\xe1\xb8\x8d",
155
-		"\xe1\xb8\x8e" => "\xe1\xb8\x8f",		"\xe1\xb8\x90" => "\xe1\xb8\x91",		"\xe1\xb8\x92" => "\xe1\xb8\x93",		"\xe1\xb8\x94" => "\xe1\xb8\x95",
156
-		"\xe1\xb8\x96" => "\xe1\xb8\x97",		"\xe1\xb8\x98" => "\xe1\xb8\x99",		"\xe1\xb8\x9a" => "\xe1\xb8\x9b",		"\xe1\xb8\x9c" => "\xe1\xb8\x9d",
157
-		"\xe1\xb8\x9e" => "\xe1\xb8\x9f",		"\xe1\xb8\xa0" => "\xe1\xb8\xa1",		"\xe1\xb8\xa2" => "\xe1\xb8\xa3",		"\xe1\xb8\xa4" => "\xe1\xb8\xa5",
158
-		"\xe1\xb8\xa6" => "\xe1\xb8\xa7",		"\xe1\xb8\xa8" => "\xe1\xb8\xa9",		"\xe1\xb8\xaa" => "\xe1\xb8\xab",		"\xe1\xb8\xac" => "\xe1\xb8\xad",
159
-		"\xe1\xb8\xae" => "\xe1\xb8\xaf",		"\xe1\xb8\xb0" => "\xe1\xb8\xb1",		"\xe1\xb8\xb2" => "\xe1\xb8\xb3",		"\xe1\xb8\xb4" => "\xe1\xb8\xb5",
160
-		"\xe1\xb8\xb6" => "\xe1\xb8\xb7",		"\xe1\xb8\xb8" => "\xe1\xb8\xb9",		"\xe1\xb8\xba" => "\xe1\xb8\xbb",		"\xe1\xb8\xbc" => "\xe1\xb8\xbd",
161
-		"\xe1\xb8\xbe" => "\xe1\xb8\xbf",		"\xe1\xb9\x80" => "\xe1\xb9\x81",		"\xe1\xb9\x82" => "\xe1\xb9\x83",		"\xe1\xb9\x84" => "\xe1\xb9\x85",
162
-		"\xe1\xb9\x86" => "\xe1\xb9\x87",		"\xe1\xb9\x88" => "\xe1\xb9\x89",		"\xe1\xb9\x8a" => "\xe1\xb9\x8b",		"\xe1\xb9\x8c" => "\xe1\xb9\x8d",
163
-		"\xe1\xb9\x8e" => "\xe1\xb9\x8f",		"\xe1\xb9\x90" => "\xe1\xb9\x91",		"\xe1\xb9\x92" => "\xe1\xb9\x93",		"\xe1\xb9\x94" => "\xe1\xb9\x95",
164
-		"\xe1\xb9\x96" => "\xe1\xb9\x97",		"\xe1\xb9\x98" => "\xe1\xb9\x99",		"\xe1\xb9\x9a" => "\xe1\xb9\x9b",		"\xe1\xb9\x9c" => "\xe1\xb9\x9d",
165
-		"\xe1\xb9\x9e" => "\xe1\xb9\x9f",		"\xe1\xb9\xa0" => "\xe1\xb9\xa1",		"\xe1\xb9\xa2" => "\xe1\xb9\xa3",		"\xe1\xb9\xa4" => "\xe1\xb9\xa5",
166
-		"\xe1\xb9\xa6" => "\xe1\xb9\xa7",		"\xe1\xb9\xa8" => "\xe1\xb9\xa9",		"\xe1\xb9\xaa" => "\xe1\xb9\xab",		"\xe1\xb9\xac" => "\xe1\xb9\xad",
167
-		"\xe1\xb9\xae" => "\xe1\xb9\xaf",		"\xe1\xb9\xb0" => "\xe1\xb9\xb1",		"\xe1\xb9\xb2" => "\xe1\xb9\xb3",		"\xe1\xb9\xb4" => "\xe1\xb9\xb5",
168
-		"\xe1\xb9\xb6" => "\xe1\xb9\xb7",		"\xe1\xb9\xb8" => "\xe1\xb9\xb9",		"\xe1\xb9\xba" => "\xe1\xb9\xbb",		"\xe1\xb9\xbc" => "\xe1\xb9\xbd",
169
-		"\xe1\xb9\xbe" => "\xe1\xb9\xbf",		"\xe1\xba\x80" => "\xe1\xba\x81",		"\xe1\xba\x82" => "\xe1\xba\x83",		"\xe1\xba\x84" => "\xe1\xba\x85",
170
-		"\xe1\xba\x86" => "\xe1\xba\x87",		"\xe1\xba\x88" => "\xe1\xba\x89",		"\xe1\xba\x8a" => "\xe1\xba\x8b",		"\xe1\xba\x8c" => "\xe1\xba\x8d",
171
-		"\xe1\xba\x8e" => "\xe1\xba\x8f",		"\xe1\xba\x90" => "\xe1\xba\x91",		"\xe1\xba\x92" => "\xe1\xba\x93",		"\xe1\xba\x94" => "\xe1\xba\x95",
172
-		"\xe1\xba\x96" => "h\xcc\xb1",		"\xe1\xba\x97" => "t\xcc\x88",		"\xe1\xba\x98" => "w\xcc\x8a",		"\xe1\xba\x99" => "y\xcc\x8a",
173
-		"\xe1\xba\x9a" => "a\xca\xbe",	"\xe1\xba\x9b" => "\xe1\xb9\xa1",		"\xe1\xba\xa0" => "\xe1\xba\xa1",		"\xe1\xba\xa2" => "\xe1\xba\xa3",
174
-		"\xe1\xba\xa4" => "\xe1\xba\xa5",		"\xe1\xba\xa6" => "\xe1\xba\xa7",		"\xe1\xba\xa8" => "\xe1\xba\xa9",		"\xe1\xba\xaa" => "\xe1\xba\xab",
175
-		"\xe1\xba\xac" => "\xe1\xba\xad",		"\xe1\xba\xae" => "\xe1\xba\xaf",		"\xe1\xba\xb0" => "\xe1\xba\xb1",		"\xe1\xba\xb2" => "\xe1\xba\xb3",
176
-		"\xe1\xba\xb4" => "\xe1\xba\xb5",		"\xe1\xba\xb6" => "\xe1\xba\xb7",		"\xe1\xba\xb8" => "\xe1\xba\xb9",		"\xe1\xba\xba" => "\xe1\xba\xbb",
177
-		"\xe1\xba\xbc" => "\xe1\xba\xbd",		"\xe1\xba\xbe" => "\xe1\xba\xbf",		"\xe1\xbb\x80" => "\xe1\xbb\x81",		"\xe1\xbb\x82" => "\xe1\xbb\x83",
178
-		"\xe1\xbb\x84" => "\xe1\xbb\x85",		"\xe1\xbb\x86" => "\xe1\xbb\x87",		"\xe1\xbb\x88" => "\xe1\xbb\x89",		"\xe1\xbb\x8a" => "\xe1\xbb\x8b",
179
-		"\xe1\xbb\x8c" => "\xe1\xbb\x8d",		"\xe1\xbb\x8e" => "\xe1\xbb\x8f",		"\xe1\xbb\x90" => "\xe1\xbb\x91",		"\xe1\xbb\x92" => "\xe1\xbb\x93",
180
-		"\xe1\xbb\x94" => "\xe1\xbb\x95",		"\xe1\xbb\x96" => "\xe1\xbb\x97",		"\xe1\xbb\x98" => "\xe1\xbb\x99",		"\xe1\xbb\x9a" => "\xe1\xbb\x9b",
181
-		"\xe1\xbb\x9c" => "\xe1\xbb\x9d",		"\xe1\xbb\x9e" => "\xe1\xbb\x9f",		"\xe1\xbb\xa0" => "\xe1\xbb\xa1",		"\xe1\xbb\xa2" => "\xe1\xbb\xa3",
182
-		"\xe1\xbb\xa4" => "\xe1\xbb\xa5",		"\xe1\xbb\xa6" => "\xe1\xbb\xa7",		"\xe1\xbb\xa8" => "\xe1\xbb\xa9",		"\xe1\xbb\xaa" => "\xe1\xbb\xab",
183
-		"\xe1\xbb\xac" => "\xe1\xbb\xad",		"\xe1\xbb\xae" => "\xe1\xbb\xaf",		"\xe1\xbb\xb0" => "\xe1\xbb\xb1",		"\xe1\xbb\xb2" => "\xe1\xbb\xb3",
184
-		"\xe1\xbb\xb4" => "\xe1\xbb\xb5",		"\xe1\xbb\xb6" => "\xe1\xbb\xb7",		"\xe1\xbb\xb8" => "\xe1\xbb\xb9",		"\xe1\xbc\x88" => "\xe1\xbc\x80",
185
-		"\xe1\xbc\x89" => "\xe1\xbc\x81",		"\xe1\xbc\x8a" => "\xe1\xbc\x82",		"\xe1\xbc\x8b" => "\xe1\xbc\x83",		"\xe1\xbc\x8c" => "\xe1\xbc\x84",
186
-		"\xe1\xbc\x8d" => "\xe1\xbc\x85",		"\xe1\xbc\x8e" => "\xe1\xbc\x86",		"\xe1\xbc\x8f" => "\xe1\xbc\x87",		"\xe1\xbc\x98" => "\xe1\xbc\x90",
187
-		"\xe1\xbc\x99" => "\xe1\xbc\x91",		"\xe1\xbc\x9a" => "\xe1\xbc\x92",		"\xe1\xbc\x9b" => "\xe1\xbc\x93",		"\xe1\xbc\x9c" => "\xe1\xbc\x94",
188
-		"\xe1\xbc\x9d" => "\xe1\xbc\x95",		"\xe1\xbc\xa8" => "\xe1\xbc\xa0",		"\xe1\xbc\xa9" => "\xe1\xbc\xa1",		"\xe1\xbc\xaa" => "\xe1\xbc\xa2",
189
-		"\xe1\xbc\xab" => "\xe1\xbc\xa3",		"\xe1\xbc\xac" => "\xe1\xbc\xa4",		"\xe1\xbc\xad" => "\xe1\xbc\xa5",		"\xe1\xbc\xae" => "\xe1\xbc\xa6",
190
-		"\xe1\xbc\xaf" => "\xe1\xbc\xa7",		"\xe1\xbc\xb8" => "\xe1\xbc\xb0",		"\xe1\xbc\xb9" => "\xe1\xbc\xb1",		"\xe1\xbc\xba" => "\xe1\xbc\xb2",
191
-		"\xe1\xbc\xbb" => "\xe1\xbc\xb3",		"\xe1\xbc\xbc" => "\xe1\xbc\xb4",		"\xe1\xbc\xbd" => "\xe1\xbc\xb5",		"\xe1\xbc\xbe" => "\xe1\xbc\xb6",
192
-		"\xe1\xbc\xbf" => "\xe1\xbc\xb7",		"\xe1\xbd\x88" => "\xe1\xbd\x80",		"\xe1\xbd\x89" => "\xe1\xbd\x81",		"\xe1\xbd\x8a" => "\xe1\xbd\x82",
193
-		"\xe1\xbd\x8b" => "\xe1\xbd\x83",		"\xe1\xbd\x8c" => "\xe1\xbd\x84",		"\xe1\xbd\x8d" => "\xe1\xbd\x85",		"\xe1\xbd\x90" => "\xcf\x85\xcc\x93",
194
-		"\xe1\xbd\x92" => "\xcf\x85\xcc\x93\xcc\x80",	"\xe1\xbd\x94" => "\xcf\x85\xcc\x93\xcc\x81",	"\xe1\xbd\x96" => "\xcf\x85\xcc\x93\xcd\x82",		"\xe1\xbd\x99" => "\xe1\xbd\x91",
195
-		"\xe1\xbd\x9b" => "\xe1\xbd\x93",		"\xe1\xbd\x9d" => "\xe1\xbd\x95",		"\xe1\xbd\x9f" => "\xe1\xbd\x97",		"\xe1\xbd\xa8" => "\xe1\xbd\xa0",
196
-		"\xe1\xbd\xa9" => "\xe1\xbd\xa1",		"\xe1\xbd\xaa" => "\xe1\xbd\xa2",		"\xe1\xbd\xab" => "\xe1\xbd\xa3",		"\xe1\xbd\xac" => "\xe1\xbd\xa4",
197
-		"\xe1\xbd\xad" => "\xe1\xbd\xa5",		"\xe1\xbd\xae" => "\xe1\xbd\xa6",		"\xe1\xbd\xaf" => "\xe1\xbd\xa7",		"\xe1\xbe\x80" => "\xe1\xbc\x80\xce\xb9",
198
-		"\xe1\xbe\x81" => "\xe1\xbc\x81\xce\xb9",	"\xe1\xbe\x82" => "\xe1\xbc\x82\xce\xb9",	"\xe1\xbe\x83" => "\xe1\xbc\x83\xce\xb9",	"\xe1\xbe\x84" => "\xe1\xbc\x84\xce\xb9",
199
-		"\xe1\xbe\x85" => "\xe1\xbc\x85\xce\xb9",	"\xe1\xbe\x86" => "\xe1\xbc\x86\xce\xb9",	"\xe1\xbe\x87" => "\xe1\xbc\x87\xce\xb9",	"\xe1\xbe\x88" => "\xe1\xbe\x80",
200
-		"\xe1\xbe\x89" => "\xe1\xbe\x81",		"\xe1\xbe\x8a" => "\xe1\xbe\x82",		"\xe1\xbe\x8b" => "\xe1\xbe\x83",		"\xe1\xbe\x8c" => "\xe1\xbe\x84",
201
-		"\xe1\xbe\x8d" => "\xe1\xbe\x85",		"\xe1\xbe\x8e" => "\xe1\xbe\x86",		"\xe1\xbe\x8f" => "\xe1\xbe\x87",		"\xe1\xbe\x90" => "\xe1\xbc\xa0\xce\xb9",
202
-		"\xe1\xbe\x91" => "\xe1\xbc\xa1\xce\xb9",	"\xe1\xbe\x92" => "\xe1\xbc\xa2\xce\xb9",	"\xe1\xbe\x93" => "\xe1\xbc\xa3\xce\xb9",	"\xe1\xbe\x94" => "\xe1\xbc\xa4\xce\xb9",
203
-		"\xe1\xbe\x95" => "\xe1\xbc\xa5\xce\xb9",	"\xe1\xbe\x96" => "\xe1\xbc\xa6\xce\xb9",	"\xe1\xbe\x97" => "\xe1\xbc\xa7\xce\xb9",	"\xe1\xbe\x98" => "\xe1\xbe\x90",
204
-		"\xe1\xbe\x99" => "\xe1\xbe\x91",		"\xe1\xbe\x9a" => "\xe1\xbe\x92",		"\xe1\xbe\x9b" => "\xe1\xbe\x93",		"\xe1\xbe\x9c" => "\xe1\xbe\x94",
205
-		"\xe1\xbe\x9d" => "\xe1\xbe\x95",		"\xe1\xbe\x9e" => "\xe1\xbe\x96",		"\xe1\xbe\x9f" => "\xe1\xbe\x97",		"\xe1\xbe\xa0" => "\xe1\xbd\xa0\xce\xb9",
206
-		"\xe1\xbe\xa1" => "\xe1\xbd\xa1\xce\xb9",	"\xe1\xbe\xa2" => "\xe1\xbd\xa2\xce\xb9",	"\xe1\xbe\xa3" => "\xe1\xbd\xa3\xce\xb9",	"\xe1\xbe\xa4" => "\xe1\xbd\xa4\xce\xb9",
207
-		"\xe1\xbe\xa5" => "\xe1\xbd\xa5\xce\xb9",	"\xe1\xbe\xa6" => "\xe1\xbd\xa6\xce\xb9",	"\xe1\xbe\xa7" => "\xe1\xbd\xa7\xce\xb9",	"\xe1\xbe\xa8" => "\xe1\xbe\xa0",
208
-		"\xe1\xbe\xa9" => "\xe1\xbe\xa1",		"\xe1\xbe\xaa" => "\xe1\xbe\xa2",		"\xe1\xbe\xab" => "\xe1\xbe\xa3",		"\xe1\xbe\xac" => "\xe1\xbe\xa4",
209
-		"\xe1\xbe\xad" => "\xe1\xbe\xa5",		"\xe1\xbe\xae" => "\xe1\xbe\xa6",		"\xe1\xbe\xaf" => "\xe1\xbe\xa7",		"\xe1\xbe\xb2" => "\xe1\xbd\xb0\xce\xb9",
210
-		"\xe1\xbe\xb3" => "\xce\xb1\xce\xb9",	"\xe1\xbe\xb4" => "\xce\xac\xce\xb9",	"\xe1\xbe\xb6" => "\xce\xb1\xcd\x82",		"\xe1\xbe\xb7" => "\xce\xb1\xcd\x82\xce\xb9",
211
-		"\xe1\xbe\xb8" => "\xe1\xbe\xb0",		"\xe1\xbe\xb9" => "\xe1\xbe\xb1",		"\xe1\xbe\xba" => "\xe1\xbd\xb0",		"\xe1\xbe\xbb" => "\xe1\xbd\xb1",
212
-		"\xe1\xbe\xbc" => "\xe1\xbe\xb3",		"\xe1\xbe\xbe" => "\xce\xb9",		"\xe1\xbf\x82" => "\xe1\xbd\xb4\xce\xb9",	"\xe1\xbf\x83" => "\xce\xb7\xce\xb9",
213
-		"\xe1\xbf\x84" => "\xce\xae\xce\xb9",	"\xe1\xbf\x86" => "\xce\xb7\xcd\x82",		"\xe1\xbf\x87" => "\xce\xb7\xcd\x82\xce\xb9",	"\xe1\xbf\x88" => "\xe1\xbd\xb2",
214
-		"\xe1\xbf\x89" => "\xe1\xbd\xb3",		"\xe1\xbf\x8a" => "\xe1\xbd\xb4",		"\xe1\xbf\x8b" => "\xe1\xbd\xb5",		"\xe1\xbf\x8c" => "\xe1\xbf\x83",
215
-		"\xe1\xbf\x92" => "\xce\xb9\xcc\x88\xcc\x80",	"\xe1\xbf\x93" => "\xce\xb9\xcc\x88\xcc\x81",	"\xe1\xbf\x96" => "\xce\xb9\xcd\x82",		"\xe1\xbf\x97" => "\xce\xb9\xcc\x88\xcd\x82",
216
-		"\xe1\xbf\x98" => "\xe1\xbf\x90",		"\xe1\xbf\x99" => "\xe1\xbf\x91",		"\xe1\xbf\x9a" => "\xe1\xbd\xb6",		"\xe1\xbf\x9b" => "\xe1\xbd\xb7",
217
-		"\xe1\xbf\xa2" => "\xcf\x85\xcc\x88\xcc\x80",	"\xe1\xbf\xa3" => "\xcf\x85\xcc\x88\xcc\x81",	"\xe1\xbf\xa4" => "\xcf\x81\xcc\x93",		"\xe1\xbf\xa6" => "\xcf\x85\xcd\x82",
218
-		"\xe1\xbf\xa7" => "\xcf\x85\xcc\x88\xcd\x82",		"\xe1\xbf\xa8" => "\xe1\xbf\xa0",		"\xe1\xbf\xa9" => "\xe1\xbf\xa1",		"\xe1\xbf\xaa" => "\xe1\xbd\xba",
219
-		"\xe1\xbf\xab" => "\xe1\xbd\xbb",		"\xe1\xbf\xac" => "\xe1\xbf\xa5",		"\xe1\xbf\xb2" => "\xe1\xbd\xbc\xce\xb9",	"\xe1\xbf\xb3" => "\xcf\x89\xce\xb9",
220
-		"\xe1\xbf\xb4" => "\xcf\x8e\xce\xb9",	"\xe1\xbf\xb6" => "\xcf\x89\xcd\x82",		"\xe1\xbf\xb7" => "\xcf\x89\xcd\x82\xce\xb9",	"\xe1\xbf\xb8" => "\xe1\xbd\xb8",
221
-		"\xe1\xbf\xb9" => "\xe1\xbd\xb9",		"\xe1\xbf\xba" => "\xe1\xbd\xbc",		"\xe1\xbf\xbb" => "\xe1\xbd\xbd",		"\xe1\xbf\xbc" => "\xe1\xbf\xb3",
222
-		"\xe2\x84\xa6" => "\xcf\x89",		"\xe2\x84\xaa" => "k",		"\xe2\x84\xab" => "\xc3\xa5",		"\xe2\x84\xb2" => "\xe2\x85\x8e",
223
-		"\xe2\x85\xa0" => "\xe2\x85\xb0",		"\xe2\x85\xa1" => "\xe2\x85\xb1",		"\xe2\x85\xa2" => "\xe2\x85\xb2",		"\xe2\x85\xa3" => "\xe2\x85\xb3",
224
-		"\xe2\x85\xa4" => "\xe2\x85\xb4",		"\xe2\x85\xa5" => "\xe2\x85\xb5",		"\xe2\x85\xa6" => "\xe2\x85\xb6",		"\xe2\x85\xa7" => "\xe2\x85\xb7",
225
-		"\xe2\x85\xa8" => "\xe2\x85\xb8",		"\xe2\x85\xa9" => "\xe2\x85\xb9",		"\xe2\x85\xaa" => "\xe2\x85\xba",		"\xe2\x85\xab" => "\xe2\x85\xbb",
226
-		"\xe2\x85\xac" => "\xe2\x85\xbc",		"\xe2\x85\xad" => "\xe2\x85\xbd",		"\xe2\x85\xae" => "\xe2\x85\xbe",		"\xe2\x85\xaf" => "\xe2\x85\xbf",
227
-		"\xe2\x86\x83" => "\xe2\x86\x84",		"\xe2\x92\xb6" => "\xe2\x93\x90",		"\xe2\x92\xb7" => "\xe2\x93\x91",		"\xe2\x92\xb8" => "\xe2\x93\x92",
228
-		"\xe2\x92\xb9" => "\xe2\x93\x93",		"\xe2\x92\xba" => "\xe2\x93\x94",		"\xe2\x92\xbb" => "\xe2\x93\x95",		"\xe2\x92\xbc" => "\xe2\x93\x96",
229
-		"\xe2\x92\xbd" => "\xe2\x93\x97",		"\xe2\x92\xbe" => "\xe2\x93\x98",		"\xe2\x92\xbf" => "\xe2\x93\x99",		"\xe2\x93\x80" => "\xe2\x93\x9a",
230
-		"\xe2\x93\x81" => "\xe2\x93\x9b",		"\xe2\x93\x82" => "\xe2\x93\x9c",		"\xe2\x93\x83" => "\xe2\x93\x9d",		"\xe2\x93\x84" => "\xe2\x93\x9e",
231
-		"\xe2\x93\x85" => "\xe2\x93\x9f",		"\xe2\x93\x86" => "\xe2\x93\xa0",		"\xe2\x93\x87" => "\xe2\x93\xa1",		"\xe2\x93\x88" => "\xe2\x93\xa2",
232
-		"\xe2\x93\x89" => "\xe2\x93\xa3",		"\xe2\x93\x8a" => "\xe2\x93\xa4",		"\xe2\x93\x8b" => "\xe2\x93\xa5",		"\xe2\x93\x8c" => "\xe2\x93\xa6",
233
-		"\xe2\x93\x8d" => "\xe2\x93\xa7",		"\xe2\x93\x8e" => "\xe2\x93\xa8",		"\xe2\x93\x8f" => "\xe2\x93\xa9",		"\xe2\xb0\x80" => "\xe2\xb0\xb0",
234
-		"\xe2\xb0\x81" => "\xe2\xb0\xb1",		"\xe2\xb0\x82" => "\xe2\xb0\xb2",		"\xe2\xb0\x83" => "\xe2\xb0\xb3",		"\xe2\xb0\x84" => "\xe2\xb0\xb4",
235
-		"\xe2\xb0\x85" => "\xe2\xb0\xb5",		"\xe2\xb0\x86" => "\xe2\xb0\xb6",		"\xe2\xb0\x87" => "\xe2\xb0\xb7",		"\xe2\xb0\x88" => "\xe2\xb0\xb8",
236
-		"\xe2\xb0\x89" => "\xe2\xb0\xb9",		"\xe2\xb0\x8a" => "\xe2\xb0\xba",		"\xe2\xb0\x8b" => "\xe2\xb0\xbb",		"\xe2\xb0\x8c" => "\xe2\xb0\xbc",
237
-		"\xe2\xb0\x8d" => "\xe2\xb0\xbd",		"\xe2\xb0\x8e" => "\xe2\xb0\xbe",		"\xe2\xb0\x8f" => "\xe2\xb0\xbf",		"\xe2\xb0\x90" => "\xe2\xb1\x80",
238
-		"\xe2\xb0\x91" => "\xe2\xb1\x81",		"\xe2\xb0\x92" => "\xe2\xb1\x82",		"\xe2\xb0\x93" => "\xe2\xb1\x83",		"\xe2\xb0\x94" => "\xe2\xb1\x84",
239
-		"\xe2\xb0\x95" => "\xe2\xb1\x85",		"\xe2\xb0\x96" => "\xe2\xb1\x86",		"\xe2\xb0\x97" => "\xe2\xb1\x87",		"\xe2\xb0\x98" => "\xe2\xb1\x88",
240
-		"\xe2\xb0\x99" => "\xe2\xb1\x89",		"\xe2\xb0\x9a" => "\xe2\xb1\x8a",		"\xe2\xb0\x9b" => "\xe2\xb1\x8b",		"\xe2\xb0\x9c" => "\xe2\xb1\x8c",
241
-		"\xe2\xb0\x9d" => "\xe2\xb1\x8d",		"\xe2\xb0\x9e" => "\xe2\xb1\x8e",		"\xe2\xb0\x9f" => "\xe2\xb1\x8f",		"\xe2\xb0\xa0" => "\xe2\xb1\x90",
242
-		"\xe2\xb0\xa1" => "\xe2\xb1\x91",		"\xe2\xb0\xa2" => "\xe2\xb1\x92",		"\xe2\xb0\xa3" => "\xe2\xb1\x93",		"\xe2\xb0\xa4" => "\xe2\xb1\x94",
243
-		"\xe2\xb0\xa5" => "\xe2\xb1\x95",		"\xe2\xb0\xa6" => "\xe2\xb1\x96",		"\xe2\xb0\xa7" => "\xe2\xb1\x97",		"\xe2\xb0\xa8" => "\xe2\xb1\x98",
244
-		"\xe2\xb0\xa9" => "\xe2\xb1\x99",		"\xe2\xb0\xaa" => "\xe2\xb1\x9a",		"\xe2\xb0\xab" => "\xe2\xb1\x9b",		"\xe2\xb0\xac" => "\xe2\xb1\x9c",
245
-		"\xe2\xb0\xad" => "\xe2\xb1\x9d",		"\xe2\xb0\xae" => "\xe2\xb1\x9e",		"\xe2\xb1\xa0" => "\xe2\xb1\xa1",		"\xe2\xb1\xa2" => "\xc9\xab",
246
-		"\xe2\xb1\xa3" => "\xe1\xb5\xbd",		"\xe2\xb1\xa4" => "\xc9\xbd",		"\xe2\xb1\xa7" => "\xe2\xb1\xa8",		"\xe2\xb1\xa9" => "\xe2\xb1\xaa",
247
-		"\xe2\xb1\xab" => "\xe2\xb1\xac",		"\xe2\xb1\xb5" => "\xe2\xb1\xb6",		"\xe2\xb2\x80" => "\xe2\xb2\x81",		"\xe2\xb2\x82" => "\xe2\xb2\x83",
248
-		"\xe2\xb2\x84" => "\xe2\xb2\x85",		"\xe2\xb2\x86" => "\xe2\xb2\x87",		"\xe2\xb2\x88" => "\xe2\xb2\x89",		"\xe2\xb2\x8a" => "\xe2\xb2\x8b",
249
-		"\xe2\xb2\x8c" => "\xe2\xb2\x8d",		"\xe2\xb2\x8e" => "\xe2\xb2\x8f",		"\xe2\xb2\x90" => "\xe2\xb2\x91",		"\xe2\xb2\x92" => "\xe2\xb2\x93",
250
-		"\xe2\xb2\x94" => "\xe2\xb2\x95",		"\xe2\xb2\x96" => "\xe2\xb2\x97",		"\xe2\xb2\x98" => "\xe2\xb2\x99",		"\xe2\xb2\x9a" => "\xe2\xb2\x9b",
251
-		"\xe2\xb2\x9c" => "\xe2\xb2\x9d",		"\xe2\xb2\x9e" => "\xe2\xb2\x9f",		"\xe2\xb2\xa0" => "\xe2\xb2\xa1",		"\xe2\xb2\xa2" => "\xe2\xb2\xa3",
252
-		"\xe2\xb2\xa4" => "\xe2\xb2\xa5",		"\xe2\xb2\xa6" => "\xe2\xb2\xa7",		"\xe2\xb2\xa8" => "\xe2\xb2\xa9",		"\xe2\xb2\xaa" => "\xe2\xb2\xab",
253
-		"\xe2\xb2\xac" => "\xe2\xb2\xad",		"\xe2\xb2\xae" => "\xe2\xb2\xaf",		"\xe2\xb2\xb0" => "\xe2\xb2\xb1",		"\xe2\xb2\xb2" => "\xe2\xb2\xb3",
254
-		"\xe2\xb2\xb4" => "\xe2\xb2\xb5",		"\xe2\xb2\xb6" => "\xe2\xb2\xb7",		"\xe2\xb2\xb8" => "\xe2\xb2\xb9",		"\xe2\xb2\xba" => "\xe2\xb2\xbb",
255
-		"\xe2\xb2\xbc" => "\xe2\xb2\xbd",		"\xe2\xb2\xbe" => "\xe2\xb2\xbf",		"\xe2\xb3\x80" => "\xe2\xb3\x81",		"\xe2\xb3\x82" => "\xe2\xb3\x83",
256
-		"\xe2\xb3\x84" => "\xe2\xb3\x85",		"\xe2\xb3\x86" => "\xe2\xb3\x87",		"\xe2\xb3\x88" => "\xe2\xb3\x89",		"\xe2\xb3\x8a" => "\xe2\xb3\x8b",
257
-		"\xe2\xb3\x8c" => "\xe2\xb3\x8d",		"\xe2\xb3\x8e" => "\xe2\xb3\x8f",		"\xe2\xb3\x90" => "\xe2\xb3\x91",		"\xe2\xb3\x92" => "\xe2\xb3\x93",
258
-		"\xe2\xb3\x94" => "\xe2\xb3\x95",		"\xe2\xb3\x96" => "\xe2\xb3\x97",		"\xe2\xb3\x98" => "\xe2\xb3\x99",		"\xe2\xb3\x9a" => "\xe2\xb3\x9b",
259
-		"\xe2\xb3\x9c" => "\xe2\xb3\x9d",		"\xe2\xb3\x9e" => "\xe2\xb3\x9f",		"\xe2\xb3\xa0" => "\xe2\xb3\xa1",		"\xe2\xb3\xa2" => "\xe2\xb3\xa3",
260
-		"\xef\xac\x80" => "ff",	"\xef\xac\x81" => "fi",	"\xef\xac\x82" => "fl",	"\xef\xac\x83" => "ffi",
261
-		"\xef\xac\x84" => "ffl",	"\xef\xac\x85" => "st",	"\xef\xac\x86" => "st",	"\xef\xac\x93" => "\xd5\xb4\xd5\xb6",
262
-		"\xef\xac\x94" => "\xd5\xb4\xd5\xa5",	"\xef\xac\x95" => "\xd5\xb4\xd5\xab",	"\xef\xac\x96" => "\xd5\xbe\xd5\xb6",	"\xef\xac\x97" => "\xd5\xb4\xd5\xad",
263
-		"\xef\xbc\xa1" => "\xef\xbd\x81",		"\xef\xbc\xa2" => "\xef\xbd\x82",		"\xef\xbc\xa3" => "\xef\xbd\x83",		"\xef\xbc\xa4" => "\xef\xbd\x84",
264
-		"\xef\xbc\xa5" => "\xef\xbd\x85",		"\xef\xbc\xa6" => "\xef\xbd\x86",		"\xef\xbc\xa7" => "\xef\xbd\x87",		"\xef\xbc\xa8" => "\xef\xbd\x88",
265
-		"\xef\xbc\xa9" => "\xef\xbd\x89",		"\xef\xbc\xaa" => "\xef\xbd\x8a",		"\xef\xbc\xab" => "\xef\xbd\x8b",		"\xef\xbc\xac" => "\xef\xbd\x8c",
266
-		"\xef\xbc\xad" => "\xef\xbd\x8d",	"\xef\xbc\xae" => "\xef\xbd\x8e",		"\xef\xbc\xaf" => "\xef\xbd\x8f",		"\xef\xbc\xb0" => "\xef\xbd\x90",
267
-		"\xef\xbc\xb1" => "\xef\xbd\x91",		"\xef\xbc\xb2" => "\xef\xbd\x92",		"\xef\xbc\xb3" => "\xef\xbd\x93",		"\xef\xbc\xb4" => "\xef\xbd\x94",
268
-		"\xef\xbc\xb5" => "\xef\xbd\x95",		"\xef\xbc\xb6" => "\xef\xbd\x96",		"\xef\xbc\xb7" => "\xef\xbd\x97",	"\xef\xbc\xb8" => "\xef\xbd\x98",
269
-		"\xef\xbc\xb9" => "\xef\xbd\x99",		"\xef\xbc\xba" => "\xef\xbd\x9a",		"\xf0\x90\x90\x80" => "\xf0\x90\x90\xa8",	"\xf0\x90\x90\x81" => "\xf0\x90\x90\xa9",
270
-		"\xf0\x90\x90\x82" => "\xf0\x90\x90\xaa",	"\xf0\x90\x90\x83" => "\xf0\x90\x90\xab",	"\xf0\x90\x90\x84" => "\xf0\x90\x90\xac",	"\xf0\x90\x90\x85" => "\xf0\x90\x90\xad",
271
-		"\xf0\x90\x90\x86" => "\xf0\x90\x90\xae",	"\xf0\x90\x90\x87" => "\xf0\x90\x90\xaf",	"\xf0\x90\x90\x88" => "\xf0\x90\x90\xb0",	"\xf0\x90\x90\x89" => "\xf0\x90\x90\xb1",
272
-		"\xf0\x90\x90\x8a" => "\xf0\x90\x90\xb2",	"\xf0\x90\x90\x8b" => "\xf0\x90\x90\xb3",	"\xf0\x90\x90\x8c" => "\xf0\x90\x90\xb4",	"\xf0\x90\x90\x8d" => "\xf0\x90\x90\xb5",
273
-		"\xf0\x90\x90\x8e" => "\xf0\x90\x90\xb6",	"\xf0\x90\x90\x8f" => "\xf0\x90\x90\xb7",	"\xf0\x90\x90\x90" => "\xf0\x90\x90\xb8",	"\xf0\x90\x90\x91" => "\xf0\x90\x90\xb9",
274
-		"\xf0\x90\x90\x92" => "\xf0\x90\x90\xba",	"\xf0\x90\x90\x93" => "\xf0\x90\x90\xbb",	"\xf0\x90\x90\x94" => "\xf0\x90\x90\xbc",	"\xf0\x90\x90\x95" => "\xf0\x90\x90\xbd",
275
-		"\xf0\x90\x90\x96" => "\xf0\x90\x90\xbe",	"\xf0\x90\x90\x97" => "\xf0\x90\x90\xbf",	"\xf0\x90\x90\x98" => "\xf0\x90\x91\x80",	"\xf0\x90\x90\x99" => "\xf0\x90\x91\x81",
276
-		"\xf0\x90\x90\x9a" => "\xf0\x90\x91\x82",	"\xf0\x90\x90\x9b" => "\xf0\x90\x91\x83",	"\xf0\x90\x90\x9c" => "\xf0\x90\x91\x84",	"\xf0\x90\x90\x9d" => "\xf0\x90\x91\x85",
277
-		"\xf0\x90\x90\x9e" => "\xf0\x90\x91\x86",	"\xf0\x90\x90\x9f" => "\xf0\x90\x91\x87",	"\xf0\x90\x90\xa0" => "\xf0\x90\x91\x88",	"\xf0\x90\x90\xa1" => "\xf0\x90\x91\x89",
278
-		"\xf0\x90\x90\xa2" => "\xf0\x90\x91\x8a",	"\xf0\x90\x90\xa3" => "\xf0\x90\x91\x8b",	"\xf0\x90\x90\xa4" => "\xf0\x90\x91\x8c",	"\xf0\x90\x90\xa5" => "\xf0\x90\x91\x8d",
279
-		"\xf0\x90\x91\x8e" => "\xf0\x90\x90\xa6",	"\xf0\x90\x91\x8f" => "\xf0\x90\x90\xa7",
27
+		'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd',
28
+		'E' => 'e', 'F' => 'f', 'G' => 'g', 'H' => 'h',
29
+		'I' => 'i', 'J' => 'j', 'K' => 'k', 'L' => 'l',
30
+		'M' => 'm', 'N' => 'n', 'O' => 'o', 'P' => 'p',
31
+		'Q' => 'q', 'R' => 'r', 'S' => 's', 'T' => 't',
32
+		'U' => 'u', 'V' => 'v', 'W' => 'w', 'X' => 'x',
33
+		'Y' => 'y', 'Z' => 'z', "\xc2\xb5" => "\xce\xbc", "\xc3\x80" => "\xc3\xa0",
34
+		"\xc3\x81" => "\xc3\xa1", "\xc3\x82" => "\xc3\xa2", "\xc3\x83" => "\xc3\xa3", "\xc3\x84" => "\xc3\xa4",
35
+		"\xc3\x85" => "\xc3\xa5", "\xc3\x86" => "\xc3\xa6", "\xc3\x87" => "\xc3\xa7", "\xc3\x88" => "\xc3\xa8",
36
+		"\xc3\x89" => "\xc3\xa9", "\xc3\x8a" => "\xc3\xaa", "\xc3\x8b" => "\xc3\xab", "\xc3\x8c" => "\xc3\xac",
37
+		"\xc3\x8d" => "\xc3\xad", "\xc3\x8e" => "\xc3\xae", "\xc3\x8f" => "\xc3\xaf", "\xc3\x90" => "\xc3\xb0",
38
+		"\xc3\x91" => "\xc3\xb1", "\xc3\x92" => "\xc3\xb2", "\xc3\x93" => "\xc3\xb3", "\xc3\x94" => "\xc3\xb4",
39
+		"\xc3\x95" => "\xc3\xb5", "\xc3\x96" => "\xc3\xb6", "\xc3\x98" => "\xc3\xb8", "\xc3\x99" => "\xc3\xb9",
40
+		"\xc3\x9a" => "\xc3\xba", "\xc3\x9b" => "\xc3\xbb", "\xc3\x9c" => "\xc3\xbc", "\xc3\x9d" => "\xc3\xbd",
41
+		"\xc3\x9e" => "\xc3\xbe", "\xc3\x9f" => "ss", "\xc4\x80" => "\xc4\x81", "\xc4\x82" => "\xc4\x83",
42
+		"\xc4\x84" => "\xc4\x85", "\xc4\x86" => "\xc4\x87", "\xc4\x88" => "\xc4\x89", "\xc4\x8a" => "\xc4\x8b",
43
+		"\xc4\x8c" => "\xc4\x8d", "\xc4\x8e" => "\xc4\x8f", "\xc4\x90" => "\xc4\x91", "\xc4\x92" => "\xc4\x93",
44
+		"\xc4\x94" => "\xc4\x95", "\xc4\x96" => "\xc4\x97", "\xc4\x98" => "\xc4\x99", "\xc4\x9a" => "\xc4\x9b",
45
+		"\xc4\x9c" => "\xc4\x9d", "\xc4\x9e" => "\xc4\x9f", "\xc4\xa0" => "\xc4\xa1", "\xc4\xa2" => "\xc4\xa3",
46
+		"\xc4\xa4" => "\xc4\xa5", "\xc4\xa6" => "\xc4\xa7", "\xc4\xa8" => "\xc4\xa9", "\xc4\xaa" => "\xc4\xab",
47
+		"\xc4\xac" => "\xc4\xad", "\xc4\xae" => "\xc4\xaf", "\xc4\xb0" => "i\xcc\x87", "\xc4\xb2" => "\xc4\xb3",
48
+		"\xc4\xb4" => "\xc4\xb5", "\xc4\xb6" => "\xc4\xb7", "\xc4\xb9" => "\xc4\xba", "\xc4\xbb" => "\xc4\xbc",
49
+		"\xc4\xbd" => "\xc4\xbe", "\xc4\xbf" => "\xc5\x80", "\xc5\x81" => "\xc5\x82", "\xc5\x83" => "\xc5\x84",
50
+		"\xc5\x85" => "\xc5\x86", "\xc5\x87" => "\xc5\x88", "\xc5\x89" => "\xca\xbcn", "\xc5\x8a" => "\xc5\x8b",
51
+		"\xc5\x8c" => "\xc5\x8d", "\xc5\x8e" => "\xc5\x8f", "\xc5\x90" => "\xc5\x91", "\xc5\x92" => "\xc5\x93",
52
+		"\xc5\x94" => "\xc5\x95", "\xc5\x96" => "\xc5\x97", "\xc5\x98" => "\xc5\x99", "\xc5\x9a" => "\xc5\x9b",
53
+		"\xc5\x9c" => "\xc5\x9d", "\xc5\x9e" => "\xc5\x9f", "\xc5\xa0" => "\xc5\xa1", "\xc5\xa2" => "\xc5\xa3",
54
+		"\xc5\xa4" => "\xc5\xa5", "\xc5\xa6" => "\xc5\xa7", "\xc5\xa8" => "\xc5\xa9", "\xc5\xaa" => "\xc5\xab",
55
+		"\xc5\xac" => "\xc5\xad", "\xc5\xae" => "\xc5\xaf", "\xc5\xb0" => "\xc5\xb1", "\xc5\xb2" => "\xc5\xb3",
56
+		"\xc5\xb4" => "\xc5\xb5", "\xc5\xb6" => "\xc5\xb7", "\xc5\xb8" => "\xc3\xbf", "\xc5\xb9" => "\xc5\xba",
57
+		"\xc5\xbb" => "\xc5\xbc", "\xc5\xbd" => "\xc5\xbe", "\xc5\xbf" => "s", "\xc6\x81" => "\xc9\x93",
58
+		"\xc6\x82" => "\xc6\x83", "\xc6\x84" => "\xc6\x85", "\xc6\x86" => "\xc9\x94", "\xc6\x87" => "\xc6\x88",
59
+		"\xc6\x89" => "\xc9\x96", "\xc6\x8a" => "\xc9\x97", "\xc6\x8b" => "\xc6\x8c", "\xc6\x8e" => "\xc7\x9d",
60
+		"\xc6\x8f" => "\xc9\x99", "\xc6\x90" => "\xc9\x9b", "\xc6\x91" => "\xc6\x92", "\xc6\x93" => "\xc9\xa0",
61
+		"\xc6\x94" => "\xc9\xa3", "\xc6\x96" => "\xc9\xa9", "\xc6\x97" => "\xc9\xa8", "\xc6\x98" => "\xc6\x99",
62
+		"\xc6\x9c" => "\xc9\xaf", "\xc6\x9d" => "\xc9\xb2", "\xc6\x9f" => "\xc9\xb5", "\xc6\xa0" => "\xc6\xa1",
63
+		"\xc6\xa2" => "\xc6\xa3", "\xc6\xa4" => "\xc6\xa5", "\xc6\xa6" => "\xca\x80", "\xc6\xa7" => "\xc6\xa8",
64
+		"\xc6\xa9" => "\xca\x83", "\xc6\xac" => "\xc6\xad", "\xc6\xae" => "\xca\x88", "\xc6\xaf" => "\xc6\xb0",
65
+		"\xc6\xb1" => "\xca\x8a", "\xc6\xb2" => "\xca\x8b", "\xc6\xb3" => "\xc6\xb4", "\xc6\xb5" => "\xc6\xb6",
66
+		"\xc6\xb7" => "\xca\x92", "\xc6\xb8" => "\xc6\xb9", "\xc6\xbc" => "\xc6\xbd", "\xc7\x84" => "\xc7\x86",
67
+		"\xc7\x85" => "\xc7\x86", "\xc7\x87" => "\xc7\x89", "\xc7\x88" => "\xc7\x89", "\xc7\x8a" => "\xc7\x8c",
68
+		"\xc7\x8b" => "\xc7\x8c", "\xc7\x8d" => "\xc7\x8e", "\xc7\x8f" => "\xc7\x90", "\xc7\x91" => "\xc7\x92",
69
+		"\xc7\x93" => "\xc7\x94", "\xc7\x95" => "\xc7\x96", "\xc7\x97" => "\xc7\x98", "\xc7\x99" => "\xc7\x9a",
70
+		"\xc7\x9b" => "\xc7\x9c", "\xc7\x9e" => "\xc7\x9f", "\xc7\xa0" => "\xc7\xa1", "\xc7\xa2" => "\xc7\xa3",
71
+		"\xc7\xa4" => "\xc7\xa5", "\xc7\xa6" => "\xc7\xa7", "\xc7\xa8" => "\xc7\xa9", "\xc7\xaa" => "\xc7\xab",
72
+		"\xc7\xac" => "\xc7\xad", "\xc7\xae" => "\xc7\xaf", "\xc7\xb0" => "j\xcc\x8c", "\xc7\xb1" => "\xc7\xb3",
73
+		"\xc7\xb2" => "\xc7\xb3", "\xc7\xb4" => "\xc7\xb5", "\xc7\xb6" => "\xc6\x95", "\xc7\xb7" => "\xc6\xbf",
74
+		"\xc7\xb8" => "\xc7\xb9", "\xc7\xba" => "\xc7\xbb", "\xc7\xbc" => "\xc7\xbd", "\xc7\xbe" => "\xc7\xbf",
75
+		"\xc8\x80" => "\xc8\x81", "\xc8\x82" => "\xc8\x83", "\xc8\x84" => "\xc8\x85", "\xc8\x86" => "\xc8\x87",
76
+		"\xc8\x88" => "\xc8\x89", "\xc8\x8a" => "\xc8\x8b", "\xc8\x8c" => "\xc8\x8d", "\xc8\x8e" => "\xc8\x8f",
77
+		"\xc8\x90" => "\xc8\x91", "\xc8\x92" => "\xc8\x93", "\xc8\x94" => "\xc8\x95", "\xc8\x96" => "\xc8\x97",
78
+		"\xc8\x98" => "\xc8\x99", "\xc8\x9a" => "\xc8\x9b", "\xc8\x9c" => "\xc8\x9d", "\xc8\x9e" => "\xc8\x9f",
79
+		"\xc8\xa0" => "\xc6\x9e", "\xc8\xa2" => "\xc8\xa3", "\xc8\xa4" => "\xc8\xa5", "\xc8\xa6" => "\xc8\xa7",
80
+		"\xc8\xa8" => "\xc8\xa9", "\xc8\xaa" => "\xc8\xab", "\xc8\xac" => "\xc8\xad", "\xc8\xae" => "\xc8\xaf",
81
+		"\xc8\xb0" => "\xc8\xb1", "\xc8\xb2" => "\xc8\xb3", "\xc8\xba" => "\xe2\xb1\xa5", "\xc8\xbb" => "\xc8\xbc",
82
+		"\xc8\xbd" => "\xc6\x9a", "\xc8\xbe" => "\xe2\xb1\xa6", "\xc9\x81" => "\xc9\x82", "\xc9\x83" => "\xc6\x80",
83
+		"\xc9\x84" => "\xca\x89", "\xc9\x85" => "\xca\x8c", "\xc9\x86" => "\xc9\x87", "\xc9\x88" => "\xc9\x89",
84
+		"\xc9\x8a" => "\xc9\x8b", "\xc9\x8c" => "\xc9\x8d", "\xc9\x8e" => "\xc9\x8f", "\xcd\x85" => "\xce\xb9",
85
+		"\xce\x86" => "\xce\xac", "\xce\x88" => "\xce\xad", "\xce\x89" => "\xce\xae", "\xce\x8a" => "\xce\xaf",
86
+		"\xce\x8c" => "\xcf\x8c", "\xce\x8e" => "\xcf\x8d", "\xce\x8f" => "\xcf\x8e", "\xce\x90" => "\xce\xb9\xcc\x88\xcc\x81",
87
+		"\xce\x91" => "\xce\xb1", "\xce\x92" => "\xce\xb2", "\xce\x93" => "\xce\xb3", "\xce\x94" => "\xce\xb4",
88
+		"\xce\x95" => "\xce\xb5", "\xce\x96" => "\xce\xb6", "\xce\x97" => "\xce\xb7", "\xce\x98" => "\xce\xb8",
89
+		"\xce\x99" => "\xce\xb9", "\xce\x9a" => "\xce\xba", "\xce\x9b" => "\xce\xbb", "\xce\x9c" => "\xce\xbc",
90
+		"\xce\x9d" => "\xce\xbd", "\xce\x9e" => "\xce\xbe", "\xce\x9f" => "\xce\xbf", "\xce\xa0" => "\xcf\x80",
91
+		"\xce\xa1" => "\xcf\x81", "\xce\xa3" => "\xcf\x83", "\xce\xa4" => "\xcf\x84", "\xce\xa5" => "\xcf\x85",
92
+		"\xce\xa6" => "\xcf\x86", "\xce\xa7" => "\xcf\x87", "\xce\xa8" => "\xcf\x88", "\xce\xa9" => "\xcf\x89",
93
+		"\xce\xaa" => "\xcf\x8a", "\xce\xab" => "\xcf\x8b", "\xce\xb0" => "\xcf\x85\xcc\x88\xcc\x81", "\xcf\x82" => "\xcf\x83",
94
+		"\xcf\x90" => "\xce\xb2", "\xcf\x91" => "\xce\xb8", "\xcf\x95" => "\xcf\x86", "\xcf\x96" => "\xcf\x80",
95
+		"\xcf\x98" => "\xcf\x99", "\xcf\x9a" => "\xcf\x9b", "\xcf\x9c" => "\xcf\x9d", "\xcf\x9e" => "\xcf\x9f",
96
+		"\xcf\xa0" => "\xcf\xa1", "\xcf\xa2" => "\xcf\xa3", "\xcf\xa4" => "\xcf\xa5", "\xcf\xa6" => "\xcf\xa7",
97
+		"\xcf\xa8" => "\xcf\xa9", "\xcf\xaa" => "\xcf\xab", "\xcf\xac" => "\xcf\xad", "\xcf\xae" => "\xcf\xaf",
98
+		"\xcf\xb0" => "\xce\xba", "\xcf\xb1" => "\xcf\x81", "\xcf\xb4" => "\xce\xb8", "\xcf\xb5" => "\xce\xb5",
99
+		"\xcf\xb7" => "\xcf\xb8", "\xcf\xb9" => "\xcf\xb2", "\xcf\xba" => "\xcf\xbb", "\xcf\xbd" => "\xcd\xbb",
100
+		"\xcf\xbe" => "\xcd\xbc", "\xcf\xbf" => "\xcd\xbd", "\xd0\x80" => "\xd1\x90", "\xd0\x81" => "\xd1\x91",
101
+		"\xd0\x82" => "\xd1\x92", "\xd0\x83" => "\xd1\x93", "\xd0\x84" => "\xd1\x94", "\xd0\x85" => "\xd1\x95",
102
+		"\xd0\x86" => "\xd1\x96", "\xd0\x87" => "\xd1\x97", "\xd0\x88" => "\xd1\x98", "\xd0\x89" => "\xd1\x99",
103
+		"\xd0\x8a" => "\xd1\x9a", "\xd0\x8b" => "\xd1\x9b", "\xd0\x8c" => "\xd1\x9c", "\xd0\x8d" => "\xd1\x9d",
104
+		"\xd0\x8e" => "\xd1\x9e", "\xd0\x8f" => "\xd1\x9f", "\xd0\x90" => "\xd0\xb0", "\xd0\x91" => "\xd0\xb1",
105
+		"\xd0\x92" => "\xd0\xb2", "\xd0\x93" => "\xd0\xb3", "\xd0\x94" => "\xd0\xb4", "\xd0\x95" => "\xd0\xb5",
106
+		"\xd0\x96" => "\xd0\xb6", "\xd0\x97" => "\xd0\xb7", "\xd0\x98" => "\xd0\xb8", "\xd0\x99" => "\xd0\xb9",
107
+		"\xd0\x9a" => "\xd0\xba", "\xd0\x9b" => "\xd0\xbb", "\xd0\x9c" => "\xd0\xbc", "\xd0\x9d" => "\xd0\xbd",
108
+		"\xd0\x9e" => "\xd0\xbe", "\xd0\x9f" => "\xd0\xbf", "\xd0\xa0" => "\xd1\x80", "\xd0\xa1" => "\xd1\x81",
109
+		"\xd0\xa2" => "\xd1\x82", "\xd0\xa3" => "\xd1\x83", "\xd0\xa4" => "\xd1\x84", "\xd0\xa5" => "\xd1\x85",
110
+		"\xd0\xa6" => "\xd1\x86", "\xd0\xa7" => "\xd1\x87", "\xd0\xa8" => "\xd1\x88", "\xd0\xa9" => "\xd1\x89",
111
+		"\xd0\xaa" => "\xd1\x8a", "\xd0\xab" => "\xd1\x8b", "\xd0\xac" => "\xd1\x8c", "\xd0\xad" => "\xd1\x8d",
112
+		"\xd0\xae" => "\xd1\x8e", "\xd0\xaf" => "\xd1\x8f", "\xd1\xa0" => "\xd1\xa1", "\xd1\xa2" => "\xd1\xa3",
113
+		"\xd1\xa4" => "\xd1\xa5", "\xd1\xa6" => "\xd1\xa7", "\xd1\xa8" => "\xd1\xa9", "\xd1\xaa" => "\xd1\xab",
114
+		"\xd1\xac" => "\xd1\xad", "\xd1\xae" => "\xd1\xaf", "\xd1\xb0" => "\xd1\xb1", "\xd1\xb2" => "\xd1\xb3",
115
+		"\xd1\xb4" => "\xd1\xb5", "\xd1\xb6" => "\xd1\xb7", "\xd1\xb8" => "\xd1\xb9", "\xd1\xba" => "\xd1\xbb",
116
+		"\xd1\xbc" => "\xd1\xbd", "\xd1\xbe" => "\xd1\xbf", "\xd2\x80" => "\xd2\x81", "\xd2\x8a" => "\xd2\x8b",
117
+		"\xd2\x8c" => "\xd2\x8d", "\xd2\x8e" => "\xd2\x8f", "\xd2\x90" => "\xd2\x91", "\xd2\x92" => "\xd2\x93",
118
+		"\xd2\x94" => "\xd2\x95", "\xd2\x96" => "\xd2\x97", "\xd2\x98" => "\xd2\x99", "\xd2\x9a" => "\xd2\x9b",
119
+		"\xd2\x9c" => "\xd2\x9d", "\xd2\x9e" => "\xd2\x9f", "\xd2\xa0" => "\xd2\xa1", "\xd2\xa2" => "\xd2\xa3",
120
+		"\xd2\xa4" => "\xd2\xa5", "\xd2\xa6" => "\xd2\xa7", "\xd2\xa8" => "\xd2\xa9", "\xd2\xaa" => "\xd2\xab",
121
+		"\xd2\xac" => "\xd2\xad", "\xd2\xae" => "\xd2\xaf", "\xd2\xb0" => "\xd2\xb1", "\xd2\xb2" => "\xd2\xb3",
122
+		"\xd2\xb4" => "\xd2\xb5", "\xd2\xb6" => "\xd2\xb7", "\xd2\xb8" => "\xd2\xb9", "\xd2\xba" => "\xd2\xbb",
123
+		"\xd2\xbc" => "\xd2\xbd", "\xd2\xbe" => "\xd2\xbf", "\xd3\x80" => "\xd3\x8f", "\xd3\x81" => "\xd3\x82",
124
+		"\xd3\x83" => "\xd3\x84", "\xd3\x85" => "\xd3\x86", "\xd3\x87" => "\xd3\x88", "\xd3\x89" => "\xd3\x8a",
125
+		"\xd3\x8b" => "\xd3\x8c", "\xd3\x8d" => "\xd3\x8e", "\xd3\x90" => "\xd3\x91", "\xd3\x92" => "\xd3\x93",
126
+		"\xd3\x94" => "\xd3\x95", "\xd3\x96" => "\xd3\x97", "\xd3\x98" => "\xd3\x99", "\xd3\x9a" => "\xd3\x9b",
127
+		"\xd3\x9c" => "\xd3\x9d", "\xd3\x9e" => "\xd3\x9f", "\xd3\xa0" => "\xd3\xa1", "\xd3\xa2" => "\xd3\xa3",
128
+		"\xd3\xa4" => "\xd3\xa5", "\xd3\xa6" => "\xd3\xa7", "\xd3\xa8" => "\xd3\xa9", "\xd3\xaa" => "\xd3\xab",
129
+		"\xd3\xac" => "\xd3\xad", "\xd3\xae" => "\xd3\xaf", "\xd3\xb0" => "\xd3\xb1", "\xd3\xb2" => "\xd3\xb3",
130
+		"\xd3\xb4" => "\xd3\xb5", "\xd3\xb6" => "\xd3\xb7", "\xd3\xb8" => "\xd3\xb9", "\xd3\xba" => "\xd3\xbb",
131
+		"\xd3\xbc" => "\xd3\xbd", "\xd3\xbe" => "\xd3\xbf", "\xd4\x80" => "\xd4\x81", "\xd4\x82" => "\xd4\x83",
132
+		"\xd4\x84" => "\xd4\x85", "\xd4\x86" => "\xd4\x87", "\xd4\x88" => "\xd4\x89", "\xd4\x8a" => "\xd4\x8b",
133
+		"\xd4\x8c" => "\xd4\x8d", "\xd4\x8e" => "\xd4\x8f", "\xd4\x90" => "\xd4\x91", "\xd4\x92" => "\xd4\x93",
134
+		"\xd4\xb1" => "\xd5\xa1", "\xd4\xb2" => "\xd5\xa2", "\xd4\xb3" => "\xd5\xa3", "\xd4\xb4" => "\xd5\xa4",
135
+		"\xd4\xb5" => "\xd5\xa5", "\xd4\xb6" => "\xd5\xa6", "\xd4\xb7" => "\xd5\xa7", "\xd4\xb8" => "\xd5\xa8",
136
+		"\xd4\xb9" => "\xd5\xa9", "\xd4\xba" => "\xd5\xaa", "\xd4\xbb" => "\xd5\xab", "\xd4\xbc" => "\xd5\xac",
137
+		"\xd4\xbd" => "\xd5\xad", "\xd4\xbe" => "\xd5\xae", "\xd4\xbf" => "\xd5\xaf", "\xd5\x80" => "\xd5\xb0",
138
+		"\xd5\x81" => "\xd5\xb1", "\xd5\x82" => "\xd5\xb2", "\xd5\x83" => "\xd5\xb3", "\xd5\x84" => "\xd5\xb4",
139
+		"\xd5\x85" => "\xd5\xb5", "\xd5\x86" => "\xd5\xb6", "\xd5\x87" => "\xd5\xb7", "\xd5\x88" => "\xd5\xb8",
140
+		"\xd5\x89" => "\xd5\xb9", "\xd5\x8a" => "\xd5\xba", "\xd5\x8b" => "\xd5\xbb", "\xd5\x8c" => "\xd5\xbc",
141
+		"\xd5\x8d" => "\xd5\xbd", "\xd5\x8e" => "\xd5\xbe", "\xd5\x8f" => "\xd5\xbf", "\xd5\x90" => "\xd6\x80",
142
+		"\xd5\x91" => "\xd6\x81", "\xd5\x92" => "\xd6\x82", "\xd5\x93" => "\xd6\x83", "\xd5\x94" => "\xd6\x84",
143
+		"\xd5\x95" => "\xd6\x85", "\xd5\x96" => "\xd6\x86", "\xd6\x87" => "\xd5\xa5\xd6\x82", "\xe1\x82\xa0" => "\xe2\xb4\x80",
144
+		"\xe1\x82\xa1" => "\xe2\xb4\x81", "\xe1\x82\xa2" => "\xe2\xb4\x82", "\xe1\x82\xa3" => "\xe2\xb4\x83", "\xe1\x82\xa4" => "\xe2\xb4\x84",
145
+		"\xe1\x82\xa5" => "\xe2\xb4\x85", "\xe1\x82\xa6" => "\xe2\xb4\x86", "\xe1\x82\xa7" => "\xe2\xb4\x87", "\xe1\x82\xa8" => "\xe2\xb4\x88",
146
+		"\xe1\x82\xa9" => "\xe2\xb4\x89", "\xe1\x82\xaa" => "\xe2\xb4\x8a", "\xe1\x82\xab" => "\xe2\xb4\x8b", "\xe1\x82\xac" => "\xe2\xb4\x8c",
147
+		"\xe1\x82\xad" => "\xe2\xb4\x8d", "\xe1\x82\xae" => "\xe2\xb4\x8e", "\xe1\x82\xaf" => "\xe2\xb4\x8f", "\xe1\x82\xb0" => "\xe2\xb4\x90",
148
+		"\xe1\x82\xb1" => "\xe2\xb4\x91", "\xe1\x82\xb2" => "\xe2\xb4\x92", "\xe1\x82\xb3" => "\xe2\xb4\x93", "\xe1\x82\xb4" => "\xe2\xb4\x94",
149
+		"\xe1\x82\xb5" => "\xe2\xb4\x95", "\xe1\x82\xb6" => "\xe2\xb4\x96", "\xe1\x82\xb7" => "\xe2\xb4\x97", "\xe1\x82\xb8" => "\xe2\xb4\x98",
150
+		"\xe1\x82\xb9" => "\xe2\xb4\x99", "\xe1\x82\xba" => "\xe2\xb4\x9a", "\xe1\x82\xbb" => "\xe2\xb4\x9b", "\xe1\x82\xbc" => "\xe2\xb4\x9c",
151
+		"\xe1\x82\xbd" => "\xe2\xb4\x9d", "\xe1\x82\xbe" => "\xe2\xb4\x9e", "\xe1\x82\xbf" => "\xe2\xb4\x9f", "\xe1\x83\x80" => "\xe2\xb4\xa0",
152
+		"\xe1\x83\x81" => "\xe2\xb4\xa1", "\xe1\x83\x82" => "\xe2\xb4\xa2", "\xe1\x83\x83" => "\xe2\xb4\xa3", "\xe1\x83\x84" => "\xe2\xb4\xa4",
153
+		"\xe1\x83\x85" => "\xe2\xb4\xa5", "\xe1\xb8\x80" => "\xe1\xb8\x81", "\xe1\xb8\x82" => "\xe1\xb8\x83", "\xe1\xb8\x84" => "\xe1\xb8\x85",
154
+		"\xe1\xb8\x86" => "\xe1\xb8\x87", "\xe1\xb8\x88" => "\xe1\xb8\x89", "\xe1\xb8\x8a" => "\xe1\xb8\x8b", "\xe1\xb8\x8c" => "\xe1\xb8\x8d",
155
+		"\xe1\xb8\x8e" => "\xe1\xb8\x8f", "\xe1\xb8\x90" => "\xe1\xb8\x91", "\xe1\xb8\x92" => "\xe1\xb8\x93", "\xe1\xb8\x94" => "\xe1\xb8\x95",
156
+		"\xe1\xb8\x96" => "\xe1\xb8\x97", "\xe1\xb8\x98" => "\xe1\xb8\x99", "\xe1\xb8\x9a" => "\xe1\xb8\x9b", "\xe1\xb8\x9c" => "\xe1\xb8\x9d",
157
+		"\xe1\xb8\x9e" => "\xe1\xb8\x9f", "\xe1\xb8\xa0" => "\xe1\xb8\xa1", "\xe1\xb8\xa2" => "\xe1\xb8\xa3", "\xe1\xb8\xa4" => "\xe1\xb8\xa5",
158
+		"\xe1\xb8\xa6" => "\xe1\xb8\xa7", "\xe1\xb8\xa8" => "\xe1\xb8\xa9", "\xe1\xb8\xaa" => "\xe1\xb8\xab", "\xe1\xb8\xac" => "\xe1\xb8\xad",
159
+		"\xe1\xb8\xae" => "\xe1\xb8\xaf", "\xe1\xb8\xb0" => "\xe1\xb8\xb1", "\xe1\xb8\xb2" => "\xe1\xb8\xb3", "\xe1\xb8\xb4" => "\xe1\xb8\xb5",
160
+		"\xe1\xb8\xb6" => "\xe1\xb8\xb7", "\xe1\xb8\xb8" => "\xe1\xb8\xb9", "\xe1\xb8\xba" => "\xe1\xb8\xbb", "\xe1\xb8\xbc" => "\xe1\xb8\xbd",
161
+		"\xe1\xb8\xbe" => "\xe1\xb8\xbf", "\xe1\xb9\x80" => "\xe1\xb9\x81", "\xe1\xb9\x82" => "\xe1\xb9\x83", "\xe1\xb9\x84" => "\xe1\xb9\x85",
162
+		"\xe1\xb9\x86" => "\xe1\xb9\x87", "\xe1\xb9\x88" => "\xe1\xb9\x89", "\xe1\xb9\x8a" => "\xe1\xb9\x8b", "\xe1\xb9\x8c" => "\xe1\xb9\x8d",
163
+		"\xe1\xb9\x8e" => "\xe1\xb9\x8f", "\xe1\xb9\x90" => "\xe1\xb9\x91", "\xe1\xb9\x92" => "\xe1\xb9\x93", "\xe1\xb9\x94" => "\xe1\xb9\x95",
164
+		"\xe1\xb9\x96" => "\xe1\xb9\x97", "\xe1\xb9\x98" => "\xe1\xb9\x99", "\xe1\xb9\x9a" => "\xe1\xb9\x9b", "\xe1\xb9\x9c" => "\xe1\xb9\x9d",
165
+		"\xe1\xb9\x9e" => "\xe1\xb9\x9f", "\xe1\xb9\xa0" => "\xe1\xb9\xa1", "\xe1\xb9\xa2" => "\xe1\xb9\xa3", "\xe1\xb9\xa4" => "\xe1\xb9\xa5",
166
+		"\xe1\xb9\xa6" => "\xe1\xb9\xa7", "\xe1\xb9\xa8" => "\xe1\xb9\xa9", "\xe1\xb9\xaa" => "\xe1\xb9\xab", "\xe1\xb9\xac" => "\xe1\xb9\xad",
167
+		"\xe1\xb9\xae" => "\xe1\xb9\xaf", "\xe1\xb9\xb0" => "\xe1\xb9\xb1", "\xe1\xb9\xb2" => "\xe1\xb9\xb3", "\xe1\xb9\xb4" => "\xe1\xb9\xb5",
168
+		"\xe1\xb9\xb6" => "\xe1\xb9\xb7", "\xe1\xb9\xb8" => "\xe1\xb9\xb9", "\xe1\xb9\xba" => "\xe1\xb9\xbb", "\xe1\xb9\xbc" => "\xe1\xb9\xbd",
169
+		"\xe1\xb9\xbe" => "\xe1\xb9\xbf", "\xe1\xba\x80" => "\xe1\xba\x81", "\xe1\xba\x82" => "\xe1\xba\x83", "\xe1\xba\x84" => "\xe1\xba\x85",
170
+		"\xe1\xba\x86" => "\xe1\xba\x87", "\xe1\xba\x88" => "\xe1\xba\x89", "\xe1\xba\x8a" => "\xe1\xba\x8b", "\xe1\xba\x8c" => "\xe1\xba\x8d",
171
+		"\xe1\xba\x8e" => "\xe1\xba\x8f", "\xe1\xba\x90" => "\xe1\xba\x91", "\xe1\xba\x92" => "\xe1\xba\x93", "\xe1\xba\x94" => "\xe1\xba\x95",
172
+		"\xe1\xba\x96" => "h\xcc\xb1", "\xe1\xba\x97" => "t\xcc\x88", "\xe1\xba\x98" => "w\xcc\x8a", "\xe1\xba\x99" => "y\xcc\x8a",
173
+		"\xe1\xba\x9a" => "a\xca\xbe", "\xe1\xba\x9b" => "\xe1\xb9\xa1", "\xe1\xba\xa0" => "\xe1\xba\xa1", "\xe1\xba\xa2" => "\xe1\xba\xa3",
174
+		"\xe1\xba\xa4" => "\xe1\xba\xa5", "\xe1\xba\xa6" => "\xe1\xba\xa7", "\xe1\xba\xa8" => "\xe1\xba\xa9", "\xe1\xba\xaa" => "\xe1\xba\xab",
175
+		"\xe1\xba\xac" => "\xe1\xba\xad", "\xe1\xba\xae" => "\xe1\xba\xaf", "\xe1\xba\xb0" => "\xe1\xba\xb1", "\xe1\xba\xb2" => "\xe1\xba\xb3",
176
+		"\xe1\xba\xb4" => "\xe1\xba\xb5", "\xe1\xba\xb6" => "\xe1\xba\xb7", "\xe1\xba\xb8" => "\xe1\xba\xb9", "\xe1\xba\xba" => "\xe1\xba\xbb",
177
+		"\xe1\xba\xbc" => "\xe1\xba\xbd", "\xe1\xba\xbe" => "\xe1\xba\xbf", "\xe1\xbb\x80" => "\xe1\xbb\x81", "\xe1\xbb\x82" => "\xe1\xbb\x83",
178
+		"\xe1\xbb\x84" => "\xe1\xbb\x85", "\xe1\xbb\x86" => "\xe1\xbb\x87", "\xe1\xbb\x88" => "\xe1\xbb\x89", "\xe1\xbb\x8a" => "\xe1\xbb\x8b",
179
+		"\xe1\xbb\x8c" => "\xe1\xbb\x8d", "\xe1\xbb\x8e" => "\xe1\xbb\x8f", "\xe1\xbb\x90" => "\xe1\xbb\x91", "\xe1\xbb\x92" => "\xe1\xbb\x93",
180
+		"\xe1\xbb\x94" => "\xe1\xbb\x95", "\xe1\xbb\x96" => "\xe1\xbb\x97", "\xe1\xbb\x98" => "\xe1\xbb\x99", "\xe1\xbb\x9a" => "\xe1\xbb\x9b",
181
+		"\xe1\xbb\x9c" => "\xe1\xbb\x9d", "\xe1\xbb\x9e" => "\xe1\xbb\x9f", "\xe1\xbb\xa0" => "\xe1\xbb\xa1", "\xe1\xbb\xa2" => "\xe1\xbb\xa3",
182
+		"\xe1\xbb\xa4" => "\xe1\xbb\xa5", "\xe1\xbb\xa6" => "\xe1\xbb\xa7", "\xe1\xbb\xa8" => "\xe1\xbb\xa9", "\xe1\xbb\xaa" => "\xe1\xbb\xab",
183
+		"\xe1\xbb\xac" => "\xe1\xbb\xad", "\xe1\xbb\xae" => "\xe1\xbb\xaf", "\xe1\xbb\xb0" => "\xe1\xbb\xb1", "\xe1\xbb\xb2" => "\xe1\xbb\xb3",
184
+		"\xe1\xbb\xb4" => "\xe1\xbb\xb5", "\xe1\xbb\xb6" => "\xe1\xbb\xb7", "\xe1\xbb\xb8" => "\xe1\xbb\xb9", "\xe1\xbc\x88" => "\xe1\xbc\x80",
185
+		"\xe1\xbc\x89" => "\xe1\xbc\x81", "\xe1\xbc\x8a" => "\xe1\xbc\x82", "\xe1\xbc\x8b" => "\xe1\xbc\x83", "\xe1\xbc\x8c" => "\xe1\xbc\x84",
186
+		"\xe1\xbc\x8d" => "\xe1\xbc\x85", "\xe1\xbc\x8e" => "\xe1\xbc\x86", "\xe1\xbc\x8f" => "\xe1\xbc\x87", "\xe1\xbc\x98" => "\xe1\xbc\x90",
187
+		"\xe1\xbc\x99" => "\xe1\xbc\x91", "\xe1\xbc\x9a" => "\xe1\xbc\x92", "\xe1\xbc\x9b" => "\xe1\xbc\x93", "\xe1\xbc\x9c" => "\xe1\xbc\x94",
188
+		"\xe1\xbc\x9d" => "\xe1\xbc\x95", "\xe1\xbc\xa8" => "\xe1\xbc\xa0", "\xe1\xbc\xa9" => "\xe1\xbc\xa1", "\xe1\xbc\xaa" => "\xe1\xbc\xa2",
189
+		"\xe1\xbc\xab" => "\xe1\xbc\xa3", "\xe1\xbc\xac" => "\xe1\xbc\xa4", "\xe1\xbc\xad" => "\xe1\xbc\xa5", "\xe1\xbc\xae" => "\xe1\xbc\xa6",
190
+		"\xe1\xbc\xaf" => "\xe1\xbc\xa7", "\xe1\xbc\xb8" => "\xe1\xbc\xb0", "\xe1\xbc\xb9" => "\xe1\xbc\xb1", "\xe1\xbc\xba" => "\xe1\xbc\xb2",
191
+		"\xe1\xbc\xbb" => "\xe1\xbc\xb3", "\xe1\xbc\xbc" => "\xe1\xbc\xb4", "\xe1\xbc\xbd" => "\xe1\xbc\xb5", "\xe1\xbc\xbe" => "\xe1\xbc\xb6",
192
+		"\xe1\xbc\xbf" => "\xe1\xbc\xb7", "\xe1\xbd\x88" => "\xe1\xbd\x80", "\xe1\xbd\x89" => "\xe1\xbd\x81", "\xe1\xbd\x8a" => "\xe1\xbd\x82",
193
+		"\xe1\xbd\x8b" => "\xe1\xbd\x83", "\xe1\xbd\x8c" => "\xe1\xbd\x84", "\xe1\xbd\x8d" => "\xe1\xbd\x85", "\xe1\xbd\x90" => "\xcf\x85\xcc\x93",
194
+		"\xe1\xbd\x92" => "\xcf\x85\xcc\x93\xcc\x80", "\xe1\xbd\x94" => "\xcf\x85\xcc\x93\xcc\x81", "\xe1\xbd\x96" => "\xcf\x85\xcc\x93\xcd\x82", "\xe1\xbd\x99" => "\xe1\xbd\x91",
195
+		"\xe1\xbd\x9b" => "\xe1\xbd\x93", "\xe1\xbd\x9d" => "\xe1\xbd\x95", "\xe1\xbd\x9f" => "\xe1\xbd\x97", "\xe1\xbd\xa8" => "\xe1\xbd\xa0",
196
+		"\xe1\xbd\xa9" => "\xe1\xbd\xa1", "\xe1\xbd\xaa" => "\xe1\xbd\xa2", "\xe1\xbd\xab" => "\xe1\xbd\xa3", "\xe1\xbd\xac" => "\xe1\xbd\xa4",
197
+		"\xe1\xbd\xad" => "\xe1\xbd\xa5", "\xe1\xbd\xae" => "\xe1\xbd\xa6", "\xe1\xbd\xaf" => "\xe1\xbd\xa7", "\xe1\xbe\x80" => "\xe1\xbc\x80\xce\xb9",
198
+		"\xe1\xbe\x81" => "\xe1\xbc\x81\xce\xb9", "\xe1\xbe\x82" => "\xe1\xbc\x82\xce\xb9", "\xe1\xbe\x83" => "\xe1\xbc\x83\xce\xb9", "\xe1\xbe\x84" => "\xe1\xbc\x84\xce\xb9",
199
+		"\xe1\xbe\x85" => "\xe1\xbc\x85\xce\xb9", "\xe1\xbe\x86" => "\xe1\xbc\x86\xce\xb9", "\xe1\xbe\x87" => "\xe1\xbc\x87\xce\xb9", "\xe1\xbe\x88" => "\xe1\xbe\x80",
200
+		"\xe1\xbe\x89" => "\xe1\xbe\x81", "\xe1\xbe\x8a" => "\xe1\xbe\x82", "\xe1\xbe\x8b" => "\xe1\xbe\x83", "\xe1\xbe\x8c" => "\xe1\xbe\x84",
201
+		"\xe1\xbe\x8d" => "\xe1\xbe\x85", "\xe1\xbe\x8e" => "\xe1\xbe\x86", "\xe1\xbe\x8f" => "\xe1\xbe\x87", "\xe1\xbe\x90" => "\xe1\xbc\xa0\xce\xb9",
202
+		"\xe1\xbe\x91" => "\xe1\xbc\xa1\xce\xb9", "\xe1\xbe\x92" => "\xe1\xbc\xa2\xce\xb9", "\xe1\xbe\x93" => "\xe1\xbc\xa3\xce\xb9", "\xe1\xbe\x94" => "\xe1\xbc\xa4\xce\xb9",
203
+		"\xe1\xbe\x95" => "\xe1\xbc\xa5\xce\xb9", "\xe1\xbe\x96" => "\xe1\xbc\xa6\xce\xb9", "\xe1\xbe\x97" => "\xe1\xbc\xa7\xce\xb9", "\xe1\xbe\x98" => "\xe1\xbe\x90",
204
+		"\xe1\xbe\x99" => "\xe1\xbe\x91", "\xe1\xbe\x9a" => "\xe1\xbe\x92", "\xe1\xbe\x9b" => "\xe1\xbe\x93", "\xe1\xbe\x9c" => "\xe1\xbe\x94",
205
+		"\xe1\xbe\x9d" => "\xe1\xbe\x95", "\xe1\xbe\x9e" => "\xe1\xbe\x96", "\xe1\xbe\x9f" => "\xe1\xbe\x97", "\xe1\xbe\xa0" => "\xe1\xbd\xa0\xce\xb9",
206
+		"\xe1\xbe\xa1" => "\xe1\xbd\xa1\xce\xb9", "\xe1\xbe\xa2" => "\xe1\xbd\xa2\xce\xb9", "\xe1\xbe\xa3" => "\xe1\xbd\xa3\xce\xb9", "\xe1\xbe\xa4" => "\xe1\xbd\xa4\xce\xb9",
207
+		"\xe1\xbe\xa5" => "\xe1\xbd\xa5\xce\xb9", "\xe1\xbe\xa6" => "\xe1\xbd\xa6\xce\xb9", "\xe1\xbe\xa7" => "\xe1\xbd\xa7\xce\xb9", "\xe1\xbe\xa8" => "\xe1\xbe\xa0",
208
+		"\xe1\xbe\xa9" => "\xe1\xbe\xa1", "\xe1\xbe\xaa" => "\xe1\xbe\xa2", "\xe1\xbe\xab" => "\xe1\xbe\xa3", "\xe1\xbe\xac" => "\xe1\xbe\xa4",
209
+		"\xe1\xbe\xad" => "\xe1\xbe\xa5", "\xe1\xbe\xae" => "\xe1\xbe\xa6", "\xe1\xbe\xaf" => "\xe1\xbe\xa7", "\xe1\xbe\xb2" => "\xe1\xbd\xb0\xce\xb9",
210
+		"\xe1\xbe\xb3" => "\xce\xb1\xce\xb9", "\xe1\xbe\xb4" => "\xce\xac\xce\xb9", "\xe1\xbe\xb6" => "\xce\xb1\xcd\x82", "\xe1\xbe\xb7" => "\xce\xb1\xcd\x82\xce\xb9",
211
+		"\xe1\xbe\xb8" => "\xe1\xbe\xb0", "\xe1\xbe\xb9" => "\xe1\xbe\xb1", "\xe1\xbe\xba" => "\xe1\xbd\xb0", "\xe1\xbe\xbb" => "\xe1\xbd\xb1",
212
+		"\xe1\xbe\xbc" => "\xe1\xbe\xb3", "\xe1\xbe\xbe" => "\xce\xb9", "\xe1\xbf\x82" => "\xe1\xbd\xb4\xce\xb9", "\xe1\xbf\x83" => "\xce\xb7\xce\xb9",
213
+		"\xe1\xbf\x84" => "\xce\xae\xce\xb9", "\xe1\xbf\x86" => "\xce\xb7\xcd\x82", "\xe1\xbf\x87" => "\xce\xb7\xcd\x82\xce\xb9", "\xe1\xbf\x88" => "\xe1\xbd\xb2",
214
+		"\xe1\xbf\x89" => "\xe1\xbd\xb3", "\xe1\xbf\x8a" => "\xe1\xbd\xb4", "\xe1\xbf\x8b" => "\xe1\xbd\xb5", "\xe1\xbf\x8c" => "\xe1\xbf\x83",
215
+		"\xe1\xbf\x92" => "\xce\xb9\xcc\x88\xcc\x80", "\xe1\xbf\x93" => "\xce\xb9\xcc\x88\xcc\x81", "\xe1\xbf\x96" => "\xce\xb9\xcd\x82", "\xe1\xbf\x97" => "\xce\xb9\xcc\x88\xcd\x82",
216
+		"\xe1\xbf\x98" => "\xe1\xbf\x90", "\xe1\xbf\x99" => "\xe1\xbf\x91", "\xe1\xbf\x9a" => "\xe1\xbd\xb6", "\xe1\xbf\x9b" => "\xe1\xbd\xb7",
217
+		"\xe1\xbf\xa2" => "\xcf\x85\xcc\x88\xcc\x80", "\xe1\xbf\xa3" => "\xcf\x85\xcc\x88\xcc\x81", "\xe1\xbf\xa4" => "\xcf\x81\xcc\x93", "\xe1\xbf\xa6" => "\xcf\x85\xcd\x82",
218
+		"\xe1\xbf\xa7" => "\xcf\x85\xcc\x88\xcd\x82", "\xe1\xbf\xa8" => "\xe1\xbf\xa0", "\xe1\xbf\xa9" => "\xe1\xbf\xa1", "\xe1\xbf\xaa" => "\xe1\xbd\xba",
219
+		"\xe1\xbf\xab" => "\xe1\xbd\xbb", "\xe1\xbf\xac" => "\xe1\xbf\xa5", "\xe1\xbf\xb2" => "\xe1\xbd\xbc\xce\xb9", "\xe1\xbf\xb3" => "\xcf\x89\xce\xb9",
220
+		"\xe1\xbf\xb4" => "\xcf\x8e\xce\xb9", "\xe1\xbf\xb6" => "\xcf\x89\xcd\x82", "\xe1\xbf\xb7" => "\xcf\x89\xcd\x82\xce\xb9", "\xe1\xbf\xb8" => "\xe1\xbd\xb8",
221
+		"\xe1\xbf\xb9" => "\xe1\xbd\xb9", "\xe1\xbf\xba" => "\xe1\xbd\xbc", "\xe1\xbf\xbb" => "\xe1\xbd\xbd", "\xe1\xbf\xbc" => "\xe1\xbf\xb3",
222
+		"\xe2\x84\xa6" => "\xcf\x89", "\xe2\x84\xaa" => "k", "\xe2\x84\xab" => "\xc3\xa5", "\xe2\x84\xb2" => "\xe2\x85\x8e",
223
+		"\xe2\x85\xa0" => "\xe2\x85\xb0", "\xe2\x85\xa1" => "\xe2\x85\xb1", "\xe2\x85\xa2" => "\xe2\x85\xb2", "\xe2\x85\xa3" => "\xe2\x85\xb3",
224
+		"\xe2\x85\xa4" => "\xe2\x85\xb4", "\xe2\x85\xa5" => "\xe2\x85\xb5", "\xe2\x85\xa6" => "\xe2\x85\xb6", "\xe2\x85\xa7" => "\xe2\x85\xb7",
225
+		"\xe2\x85\xa8" => "\xe2\x85\xb8", "\xe2\x85\xa9" => "\xe2\x85\xb9", "\xe2\x85\xaa" => "\xe2\x85\xba", "\xe2\x85\xab" => "\xe2\x85\xbb",
226
+		"\xe2\x85\xac" => "\xe2\x85\xbc", "\xe2\x85\xad" => "\xe2\x85\xbd", "\xe2\x85\xae" => "\xe2\x85\xbe", "\xe2\x85\xaf" => "\xe2\x85\xbf",
227
+		"\xe2\x86\x83" => "\xe2\x86\x84", "\xe2\x92\xb6" => "\xe2\x93\x90", "\xe2\x92\xb7" => "\xe2\x93\x91", "\xe2\x92\xb8" => "\xe2\x93\x92",
228
+		"\xe2\x92\xb9" => "\xe2\x93\x93", "\xe2\x92\xba" => "\xe2\x93\x94", "\xe2\x92\xbb" => "\xe2\x93\x95", "\xe2\x92\xbc" => "\xe2\x93\x96",
229
+		"\xe2\x92\xbd" => "\xe2\x93\x97", "\xe2\x92\xbe" => "\xe2\x93\x98", "\xe2\x92\xbf" => "\xe2\x93\x99", "\xe2\x93\x80" => "\xe2\x93\x9a",
230
+		"\xe2\x93\x81" => "\xe2\x93\x9b", "\xe2\x93\x82" => "\xe2\x93\x9c", "\xe2\x93\x83" => "\xe2\x93\x9d", "\xe2\x93\x84" => "\xe2\x93\x9e",
231
+		"\xe2\x93\x85" => "\xe2\x93\x9f", "\xe2\x93\x86" => "\xe2\x93\xa0", "\xe2\x93\x87" => "\xe2\x93\xa1", "\xe2\x93\x88" => "\xe2\x93\xa2",
232
+		"\xe2\x93\x89" => "\xe2\x93\xa3", "\xe2\x93\x8a" => "\xe2\x93\xa4", "\xe2\x93\x8b" => "\xe2\x93\xa5", "\xe2\x93\x8c" => "\xe2\x93\xa6",
233
+		"\xe2\x93\x8d" => "\xe2\x93\xa7", "\xe2\x93\x8e" => "\xe2\x93\xa8", "\xe2\x93\x8f" => "\xe2\x93\xa9", "\xe2\xb0\x80" => "\xe2\xb0\xb0",
234
+		"\xe2\xb0\x81" => "\xe2\xb0\xb1", "\xe2\xb0\x82" => "\xe2\xb0\xb2", "\xe2\xb0\x83" => "\xe2\xb0\xb3", "\xe2\xb0\x84" => "\xe2\xb0\xb4",
235
+		"\xe2\xb0\x85" => "\xe2\xb0\xb5", "\xe2\xb0\x86" => "\xe2\xb0\xb6", "\xe2\xb0\x87" => "\xe2\xb0\xb7", "\xe2\xb0\x88" => "\xe2\xb0\xb8",
236
+		"\xe2\xb0\x89" => "\xe2\xb0\xb9", "\xe2\xb0\x8a" => "\xe2\xb0\xba", "\xe2\xb0\x8b" => "\xe2\xb0\xbb", "\xe2\xb0\x8c" => "\xe2\xb0\xbc",
237
+		"\xe2\xb0\x8d" => "\xe2\xb0\xbd", "\xe2\xb0\x8e" => "\xe2\xb0\xbe", "\xe2\xb0\x8f" => "\xe2\xb0\xbf", "\xe2\xb0\x90" => "\xe2\xb1\x80",
238
+		"\xe2\xb0\x91" => "\xe2\xb1\x81", "\xe2\xb0\x92" => "\xe2\xb1\x82", "\xe2\xb0\x93" => "\xe2\xb1\x83", "\xe2\xb0\x94" => "\xe2\xb1\x84",
239
+		"\xe2\xb0\x95" => "\xe2\xb1\x85", "\xe2\xb0\x96" => "\xe2\xb1\x86", "\xe2\xb0\x97" => "\xe2\xb1\x87", "\xe2\xb0\x98" => "\xe2\xb1\x88",
240
+		"\xe2\xb0\x99" => "\xe2\xb1\x89", "\xe2\xb0\x9a" => "\xe2\xb1\x8a", "\xe2\xb0\x9b" => "\xe2\xb1\x8b", "\xe2\xb0\x9c" => "\xe2\xb1\x8c",
241
+		"\xe2\xb0\x9d" => "\xe2\xb1\x8d", "\xe2\xb0\x9e" => "\xe2\xb1\x8e", "\xe2\xb0\x9f" => "\xe2\xb1\x8f", "\xe2\xb0\xa0" => "\xe2\xb1\x90",
242
+		"\xe2\xb0\xa1" => "\xe2\xb1\x91", "\xe2\xb0\xa2" => "\xe2\xb1\x92", "\xe2\xb0\xa3" => "\xe2\xb1\x93", "\xe2\xb0\xa4" => "\xe2\xb1\x94",
243
+		"\xe2\xb0\xa5" => "\xe2\xb1\x95", "\xe2\xb0\xa6" => "\xe2\xb1\x96", "\xe2\xb0\xa7" => "\xe2\xb1\x97", "\xe2\xb0\xa8" => "\xe2\xb1\x98",
244
+		"\xe2\xb0\xa9" => "\xe2\xb1\x99", "\xe2\xb0\xaa" => "\xe2\xb1\x9a", "\xe2\xb0\xab" => "\xe2\xb1\x9b", "\xe2\xb0\xac" => "\xe2\xb1\x9c",
245
+		"\xe2\xb0\xad" => "\xe2\xb1\x9d", "\xe2\xb0\xae" => "\xe2\xb1\x9e", "\xe2\xb1\xa0" => "\xe2\xb1\xa1", "\xe2\xb1\xa2" => "\xc9\xab",
246
+		"\xe2\xb1\xa3" => "\xe1\xb5\xbd", "\xe2\xb1\xa4" => "\xc9\xbd", "\xe2\xb1\xa7" => "\xe2\xb1\xa8", "\xe2\xb1\xa9" => "\xe2\xb1\xaa",
247
+		"\xe2\xb1\xab" => "\xe2\xb1\xac", "\xe2\xb1\xb5" => "\xe2\xb1\xb6", "\xe2\xb2\x80" => "\xe2\xb2\x81", "\xe2\xb2\x82" => "\xe2\xb2\x83",
248
+		"\xe2\xb2\x84" => "\xe2\xb2\x85", "\xe2\xb2\x86" => "\xe2\xb2\x87", "\xe2\xb2\x88" => "\xe2\xb2\x89", "\xe2\xb2\x8a" => "\xe2\xb2\x8b",
249
+		"\xe2\xb2\x8c" => "\xe2\xb2\x8d", "\xe2\xb2\x8e" => "\xe2\xb2\x8f", "\xe2\xb2\x90" => "\xe2\xb2\x91", "\xe2\xb2\x92" => "\xe2\xb2\x93",
250
+		"\xe2\xb2\x94" => "\xe2\xb2\x95", "\xe2\xb2\x96" => "\xe2\xb2\x97", "\xe2\xb2\x98" => "\xe2\xb2\x99", "\xe2\xb2\x9a" => "\xe2\xb2\x9b",
251
+		"\xe2\xb2\x9c" => "\xe2\xb2\x9d", "\xe2\xb2\x9e" => "\xe2\xb2\x9f", "\xe2\xb2\xa0" => "\xe2\xb2\xa1", "\xe2\xb2\xa2" => "\xe2\xb2\xa3",
252
+		"\xe2\xb2\xa4" => "\xe2\xb2\xa5", "\xe2\xb2\xa6" => "\xe2\xb2\xa7", "\xe2\xb2\xa8" => "\xe2\xb2\xa9", "\xe2\xb2\xaa" => "\xe2\xb2\xab",
253
+		"\xe2\xb2\xac" => "\xe2\xb2\xad", "\xe2\xb2\xae" => "\xe2\xb2\xaf", "\xe2\xb2\xb0" => "\xe2\xb2\xb1", "\xe2\xb2\xb2" => "\xe2\xb2\xb3",
254
+		"\xe2\xb2\xb4" => "\xe2\xb2\xb5", "\xe2\xb2\xb6" => "\xe2\xb2\xb7", "\xe2\xb2\xb8" => "\xe2\xb2\xb9", "\xe2\xb2\xba" => "\xe2\xb2\xbb",
255
+		"\xe2\xb2\xbc" => "\xe2\xb2\xbd", "\xe2\xb2\xbe" => "\xe2\xb2\xbf", "\xe2\xb3\x80" => "\xe2\xb3\x81", "\xe2\xb3\x82" => "\xe2\xb3\x83",
256
+		"\xe2\xb3\x84" => "\xe2\xb3\x85", "\xe2\xb3\x86" => "\xe2\xb3\x87", "\xe2\xb3\x88" => "\xe2\xb3\x89", "\xe2\xb3\x8a" => "\xe2\xb3\x8b",
257
+		"\xe2\xb3\x8c" => "\xe2\xb3\x8d", "\xe2\xb3\x8e" => "\xe2\xb3\x8f", "\xe2\xb3\x90" => "\xe2\xb3\x91", "\xe2\xb3\x92" => "\xe2\xb3\x93",
258
+		"\xe2\xb3\x94" => "\xe2\xb3\x95", "\xe2\xb3\x96" => "\xe2\xb3\x97", "\xe2\xb3\x98" => "\xe2\xb3\x99", "\xe2\xb3\x9a" => "\xe2\xb3\x9b",
259
+		"\xe2\xb3\x9c" => "\xe2\xb3\x9d", "\xe2\xb3\x9e" => "\xe2\xb3\x9f", "\xe2\xb3\xa0" => "\xe2\xb3\xa1", "\xe2\xb3\xa2" => "\xe2\xb3\xa3",
260
+		"\xef\xac\x80" => "ff", "\xef\xac\x81" => "fi", "\xef\xac\x82" => "fl", "\xef\xac\x83" => "ffi",
261
+		"\xef\xac\x84" => "ffl", "\xef\xac\x85" => "st", "\xef\xac\x86" => "st", "\xef\xac\x93" => "\xd5\xb4\xd5\xb6",
262
+		"\xef\xac\x94" => "\xd5\xb4\xd5\xa5", "\xef\xac\x95" => "\xd5\xb4\xd5\xab", "\xef\xac\x96" => "\xd5\xbe\xd5\xb6", "\xef\xac\x97" => "\xd5\xb4\xd5\xad",
263
+		"\xef\xbc\xa1" => "\xef\xbd\x81", "\xef\xbc\xa2" => "\xef\xbd\x82", "\xef\xbc\xa3" => "\xef\xbd\x83", "\xef\xbc\xa4" => "\xef\xbd\x84",
264
+		"\xef\xbc\xa5" => "\xef\xbd\x85", "\xef\xbc\xa6" => "\xef\xbd\x86", "\xef\xbc\xa7" => "\xef\xbd\x87", "\xef\xbc\xa8" => "\xef\xbd\x88",
265
+		"\xef\xbc\xa9" => "\xef\xbd\x89", "\xef\xbc\xaa" => "\xef\xbd\x8a", "\xef\xbc\xab" => "\xef\xbd\x8b", "\xef\xbc\xac" => "\xef\xbd\x8c",
266
+		"\xef\xbc\xad" => "\xef\xbd\x8d", "\xef\xbc\xae" => "\xef\xbd\x8e", "\xef\xbc\xaf" => "\xef\xbd\x8f", "\xef\xbc\xb0" => "\xef\xbd\x90",
267
+		"\xef\xbc\xb1" => "\xef\xbd\x91", "\xef\xbc\xb2" => "\xef\xbd\x92", "\xef\xbc\xb3" => "\xef\xbd\x93", "\xef\xbc\xb4" => "\xef\xbd\x94",
268
+		"\xef\xbc\xb5" => "\xef\xbd\x95", "\xef\xbc\xb6" => "\xef\xbd\x96", "\xef\xbc\xb7" => "\xef\xbd\x97", "\xef\xbc\xb8" => "\xef\xbd\x98",
269
+		"\xef\xbc\xb9" => "\xef\xbd\x99", "\xef\xbc\xba" => "\xef\xbd\x9a", "\xf0\x90\x90\x80" => "\xf0\x90\x90\xa8", "\xf0\x90\x90\x81" => "\xf0\x90\x90\xa9",
270
+		"\xf0\x90\x90\x82" => "\xf0\x90\x90\xaa", "\xf0\x90\x90\x83" => "\xf0\x90\x90\xab", "\xf0\x90\x90\x84" => "\xf0\x90\x90\xac", "\xf0\x90\x90\x85" => "\xf0\x90\x90\xad",
271
+		"\xf0\x90\x90\x86" => "\xf0\x90\x90\xae", "\xf0\x90\x90\x87" => "\xf0\x90\x90\xaf", "\xf0\x90\x90\x88" => "\xf0\x90\x90\xb0", "\xf0\x90\x90\x89" => "\xf0\x90\x90\xb1",
272
+		"\xf0\x90\x90\x8a" => "\xf0\x90\x90\xb2", "\xf0\x90\x90\x8b" => "\xf0\x90\x90\xb3", "\xf0\x90\x90\x8c" => "\xf0\x90\x90\xb4", "\xf0\x90\x90\x8d" => "\xf0\x90\x90\xb5",
273
+		"\xf0\x90\x90\x8e" => "\xf0\x90\x90\xb6", "\xf0\x90\x90\x8f" => "\xf0\x90\x90\xb7", "\xf0\x90\x90\x90" => "\xf0\x90\x90\xb8", "\xf0\x90\x90\x91" => "\xf0\x90\x90\xb9",
274
+		"\xf0\x90\x90\x92" => "\xf0\x90\x90\xba", "\xf0\x90\x90\x93" => "\xf0\x90\x90\xbb", "\xf0\x90\x90\x94" => "\xf0\x90\x90\xbc", "\xf0\x90\x90\x95" => "\xf0\x90\x90\xbd",
275
+		"\xf0\x90\x90\x96" => "\xf0\x90\x90\xbe", "\xf0\x90\x90\x97" => "\xf0\x90\x90\xbf", "\xf0\x90\x90\x98" => "\xf0\x90\x91\x80", "\xf0\x90\x90\x99" => "\xf0\x90\x91\x81",
276
+		"\xf0\x90\x90\x9a" => "\xf0\x90\x91\x82", "\xf0\x90\x90\x9b" => "\xf0\x90\x91\x83", "\xf0\x90\x90\x9c" => "\xf0\x90\x91\x84", "\xf0\x90\x90\x9d" => "\xf0\x90\x91\x85",
277
+		"\xf0\x90\x90\x9e" => "\xf0\x90\x91\x86", "\xf0\x90\x90\x9f" => "\xf0\x90\x91\x87", "\xf0\x90\x90\xa0" => "\xf0\x90\x91\x88", "\xf0\x90\x90\xa1" => "\xf0\x90\x91\x89",
278
+		"\xf0\x90\x90\xa2" => "\xf0\x90\x91\x8a", "\xf0\x90\x90\xa3" => "\xf0\x90\x91\x8b", "\xf0\x90\x90\xa4" => "\xf0\x90\x91\x8c", "\xf0\x90\x90\xa5" => "\xf0\x90\x91\x8d",
279
+		"\xf0\x90\x91\x8e" => "\xf0\x90\x90\xa6", "\xf0\x90\x91\x8f" => "\xf0\x90\x90\xa7",
280 280
 	);
281 281
 
282 282
 	return strtr($string, $case_folding);
@@ -293,259 +293,259 @@  discard block
 block discarded – undo
293 293
 function utf8_strtoupper($string)
294 294
 {
295 295
 	static $case_folding = array(
296
-		'a' => 'A',		'b' => 'B',		'c' => 'C',		'd' => 'D',
297
-		'e' => 'E',		'f' => 'F',		'g' => 'G',		'h' => 'H',
298
-		'i' => 'I',		'j' => 'J',		'k' => 'K',		'l' => 'L',
299
-		'm' => 'M',		'n' => 'N',		'o' => 'O',		'p' => 'P',
300
-		'q' => 'Q',		'r' => 'R',		's' => 'S',		't' => 'T',
301
-		'u' => 'U',		'v' => 'V',		'w' => 'W',		'x' => 'X',
302
-		'y' => 'Y',		'z' => 'Z',		"\xce\xbc" => "\xc2\xb5",		"\xc3\xa0" => "\xc3\x80",
303
-		"\xc3\xa1" => "\xc3\x81",		"\xc3\xa2" => "\xc3\x82",		"\xc3\xa3" => "\xc3\x83",		"\xc3\xa4" => "\xc3\x84",
304
-		"\xc3\xa5" => "\xc3\x85",		"\xc3\xa6" => "\xc3\x86",		"\xc3\xa7" => "\xc3\x87",		"\xc3\xa8" => "\xc3\x88",
305
-		"\xc3\xa9" => "\xc3\x89",		"\xc3\xaa" => "\xc3\x8a",		"\xc3\xab" => "\xc3\x8b",		"\xc3\xac" => "\xc3\x8c",
306
-		"\xc3\xad" => "\xc3\x8d",		"\xc3\xae" => "\xc3\x8e",		"\xc3\xaf" => "\xc3\x8f",		"\xc3\xb0" => "\xc3\x90",
307
-		"\xc3\xb1" => "\xc3\x91",		"\xc3\xb2" => "\xc3\x92",		"\xc3\xb3" => "\xc3\x93",		"\xc3\xb4" => "\xc3\x94",
308
-		"\xc3\xb5" => "\xc3\x95",		"\xc3\xb6" => "\xc3\x96",		"\xc3\xb8" => "\xc3\x98",		"\xc3\xb9" => "\xc3\x99",
309
-		"\xc3\xba" => "\xc3\x9a",		"\xc3\xbb" => "\xc3\x9b",		"\xc3\xbc" => "\xc3\x9c",		"\xc3\xbd" => "\xc3\x9d",
310
-		"\xc3\xbe" => "\xc3\x9e",		"ss" => "\xc3\x9f",	"\xc4\x81" => "\xc4\x80",		"\xc4\x83" => "\xc4\x82",
311
-		"\xc4\x85" => "\xc4\x84",		"\xc4\x87" => "\xc4\x86",		"\xc4\x89" => "\xc4\x88",		"\xc4\x8b" => "\xc4\x8a",
312
-		"\xc4\x8d" => "\xc4\x8c",		"\xc4\x8f" => "\xc4\x8e",		"\xc4\x91" => "\xc4\x90",		"\xc4\x93" => "\xc4\x92",
313
-		"\xc4\x95" => "\xc4\x94",		"\xc4\x97" => "\xc4\x96",		"\xc4\x99" => "\xc4\x98",		"\xc4\x9b" => "\xc4\x9a",
314
-		"\xc4\x9d" => "\xc4\x9c",		"\xc4\x9f" => "\xc4\x9e",		"\xc4\xa1" => "\xc4\xa0",		"\xc4\xa3" => "\xc4\xa2",
315
-		"\xc4\xa5" => "\xc4\xa4",		"\xc4\xa7" => "\xc4\xa6",		"\xc4\xa9" => "\xc4\xa8",		"\xc4\xab" => "\xc4\xaa",
316
-		"\xc4\xad" => "\xc4\xac",		"\xc4\xaf" => "\xc4\xae",		"i\xcc\x87" => "\xc4\xb0",		"\xc4\xb3" => "\xc4\xb2",
317
-		"\xc4\xb5" => "\xc4\xb4",		"\xc4\xb7" => "\xc4\xb6",		"\xc4\xba" => "\xc4\xb9",		"\xc4\xbc" => "\xc4\xbb",
318
-		"\xc4\xbe" => "\xc4\xbd",		"\xc5\x80" => "\xc4\xbf",		"\xc5\x82" => "\xc5\x81",		"\xc5\x84" => "\xc5\x83",
319
-		"\xc5\x86" => "\xc5\x85",		"\xc5\x88" => "\xc5\x87",		"\xca\xbcn" => "\xc5\x89",	"\xc5\x8b" => "\xc5\x8a",
320
-		"\xc5\x8d" => "\xc5\x8c",		"\xc5\x8f" => "\xc5\x8e",		"\xc5\x91" => "\xc5\x90",		"\xc5\x93" => "\xc5\x92",
321
-		"\xc5\x95" => "\xc5\x94",		"\xc5\x97" => "\xc5\x96",		"\xc5\x99" => "\xc5\x98",		"\xc5\x9b" => "\xc5\x9a",
322
-		"\xc5\x9d" => "\xc5\x9c",		"\xc5\x9f" => "\xc5\x9e",		"\xc5\xa1" => "\xc5\xa0",		"\xc5\xa3" => "\xc5\xa2",
323
-		"\xc5\xa5" => "\xc5\xa4",		"\xc5\xa7" => "\xc5\xa6",		"\xc5\xa9" => "\xc5\xa8",		"\xc5\xab" => "\xc5\xaa",
324
-		"\xc5\xad" => "\xc5\xac",		"\xc5\xaf" => "\xc5\xae",		"\xc5\xb1" => "\xc5\xb0",		"\xc5\xb3" => "\xc5\xb2",
325
-		"\xc5\xb5" => "\xc5\xb4",		"\xc5\xb7" => "\xc5\xb6",		"\xc3\xbf" => "\xc5\xb8",		"\xc5\xba" => "\xc5\xb9",
326
-		"\xc5\xbc" => "\xc5\xbb",		"\xc5\xbe" => "\xc5\xbd",		"\xc9\x93" => "\xc6\x81",
327
-		"\xc6\x83" => "\xc6\x82",		"\xc6\x85" => "\xc6\x84",		"\xc9\x94" => "\xc6\x86",		"\xc6\x88" => "\xc6\x87",
328
-		"\xc9\x96" => "\xc6\x89",		"\xc9\x97" => "\xc6\x8a",		"\xc6\x8c" => "\xc6\x8b",		"\xc7\x9d" => "\xc6\x8e",
329
-		"\xc9\x99" => "\xc6\x8f",		"\xc9\x9b" => "\xc6\x90",		"\xc6\x92" => "\xc6\x91",		"\xc9\xa0" => "\xc6\x93",
330
-		"\xc9\xa3" => "\xc6\x94",		"\xc9\xa9" => "\xc6\x96",		"\xc9\xa8" => "\xc6\x97",		"\xc6\x99" => "\xc6\x98",
331
-		"\xc9\xaf" => "\xc6\x9c",		"\xc9\xb2" => "\xc6\x9d",		"\xc9\xb5" => "\xc6\x9f",		"\xc6\xa1" => "\xc6\xa0",
332
-		"\xc6\xa3" => "\xc6\xa2",		"\xc6\xa5" => "\xc6\xa4",		"\xca\x80" => "\xc6\xa6",		"\xc6\xa8" => "\xc6\xa7",
333
-		"\xca\x83" => "\xc6\xa9",		"\xc6\xad" => "\xc6\xac",		"\xca\x88" => "\xc6\xae",		"\xc6\xb0" => "\xc6\xaf",
334
-		"\xca\x8a" => "\xc6\xb1",		"\xca\x8b" => "\xc6\xb2",		"\xc6\xb4" => "\xc6\xb3",		"\xc6\xb6" => "\xc6\xb5",
335
-		"\xca\x92" => "\xc6\xb7",		"\xc6\xb9" => "\xc6\xb8",		"\xc6\xbd" => "\xc6\xbc",		"\xc7\x86" => "\xc7\x84",
336
-		"\xc7\x86" => "\xc7\x85",		"\xc7\x89" => "\xc7\x87",		"\xc7\x89" => "\xc7\x88",		"\xc7\x8c" => "\xc7\x8a",
337
-		"\xc7\x8c" => "\xc7\x8b",		"\xc7\x8e" => "\xc7\x8d",		"\xc7\x90" => "\xc7\x8f",		"\xc7\x92" => "\xc7\x91",
338
-		"\xc7\x94" => "\xc7\x93",		"\xc7\x96" => "\xc7\x95",		"\xc7\x98" => "\xc7\x97",		"\xc7\x9a" => "\xc7\x99",
339
-		"\xc7\x9c" => "\xc7\x9b",		"\xc7\x9f" => "\xc7\x9e",		"\xc7\xa1" => "\xc7\xa0",		"\xc7\xa3" => "\xc7\xa2",
340
-		"\xc7\xa5" => "\xc7\xa4",		"\xc7\xa7" => "\xc7\xa6",		"\xc7\xa9" => "\xc7\xa8",		"\xc7\xab" => "\xc7\xaa",
341
-		"\xc7\xad" => "\xc7\xac",		"\xc7\xaf" => "\xc7\xae",		"j\xcc\x8c" => "\xc7\xb0",		"\xc7\xb3" => "\xc7\xb1",
342
-		"\xc7\xb3" => "\xc7\xb2",		"\xc7\xb5" => "\xc7\xb4",		"\xc6\x95" => "\xc7\xb6",		"\xc6\xbf" => "\xc7\xb7",
343
-		"\xc7\xb9" => "\xc7\xb8",		"\xc7\xbb" => "\xc7\xba",		"\xc7\xbd" => "\xc7\xbc",		"\xc7\xbf" => "\xc7\xbe",
344
-		"\xc8\x81" => "\xc8\x80",		"\xc8\x83" => "\xc8\x82",		"\xc8\x85" => "\xc8\x84",		"\xc8\x87" => "\xc8\x86",
345
-		"\xc8\x89" => "\xc8\x88",		"\xc8\x8b" => "\xc8\x8a",		"\xc8\x8d" => "\xc8\x8c",		"\xc8\x8f" => "\xc8\x8e",
346
-		"\xc8\x91" => "\xc8\x90",		"\xc8\x93" => "\xc8\x92",		"\xc8\x95" => "\xc8\x94",		"\xc8\x97" => "\xc8\x96",
347
-		"\xc8\x99" => "\xc8\x98",		"\xc8\x9b" => "\xc8\x9a",		"\xc8\x9d" => "\xc8\x9c",		"\xc8\x9f" => "\xc8\x9e",
348
-		"\xc6\x9e" => "\xc8\xa0",		"\xc8\xa3" => "\xc8\xa2",		"\xc8\xa5" => "\xc8\xa4",		"\xc8\xa7" => "\xc8\xa6",
349
-		"\xc8\xa9" => "\xc8\xa8",		"\xc8\xab" => "\xc8\xaa",		"\xc8\xad" => "\xc8\xac",		"\xc8\xaf" => "\xc8\xae",
350
-		"\xc8\xb1" => "\xc8\xb0",		"\xc8\xb3" => "\xc8\xb2",		"\xe2\xb1\xa5" => "\xc8\xba",		"\xc8\xbc" => "\xc8\xbb",
351
-		"\xc6\x9a" => "\xc8\xbd",		"\xe2\xb1\xa6" => "\xc8\xbe",		"\xc9\x82" => "\xc9\x81",		"\xc6\x80" => "\xc9\x83",
352
-		"\xca\x89" => "\xc9\x84",		"\xca\x8c" => "\xc9\x85",		"\xc9\x87" => "\xc9\x86",		"\xc9\x89" => "\xc9\x88",
353
-		"\xc9\x8b" => "\xc9\x8a",		"\xc9\x8d" => "\xc9\x8c",		"\xc9\x8f" => "\xc9\x8e",		"\xce\xb9" => "\xcd\x85",
354
-		"\xce\xac" => "\xce\x86",		"\xce\xad" => "\xce\x88",		"\xce\xae" => "\xce\x89",		"\xce\xaf" => "\xce\x8a",
355
-		"\xcf\x8c" => "\xce\x8c",		"\xcf\x8d" => "\xce\x8e",		"\xcf\x8e" => "\xce\x8f",		"\xce\xb9\xcc\x88\xcc\x81" => "\xce\x90",
356
-		"\xce\xb1" => "\xce\x91",		"\xce\xb2" => "\xce\x92",		"\xce\xb3" => "\xce\x93",		"\xce\xb4" => "\xce\x94",
357
-		"\xce\xb5" => "\xce\x95",		"\xce\xb6" => "\xce\x96",		"\xce\xb7" => "\xce\x97",		"\xce\xb8" => "\xce\x98",
358
-		"\xce\xb9" => "\xce\x99",		"\xce\xba" => "\xce\x9a",		"\xce\xbb" => "\xce\x9b",		"\xce\xbc" => "\xce\x9c",
359
-		"\xce\xbd" => "\xce\x9d",		"\xce\xbe" => "\xce\x9e",		"\xce\xbf" => "\xce\x9f",		"\xcf\x80" => "\xce\xa0",
360
-		"\xcf\x81" => "\xce\xa1",		"\xcf\x83" => "\xce\xa3",		"\xcf\x84" => "\xce\xa4",		"\xcf\x85" => "\xce\xa5",
361
-		"\xcf\x86" => "\xce\xa6",		"\xcf\x87" => "\xce\xa7",		"\xcf\x88" => "\xce\xa8",		"\xcf\x89" => "\xce\xa9",
362
-		"\xcf\x8a" => "\xce\xaa",		"\xcf\x8b" => "\xce\xab",		"\xcf\x85\xcc\x88\xcc\x81" => "\xce\xb0",	"\xcf\x83" => "\xcf\x82",
363
-		"\xce\xb2" => "\xcf\x90",		"\xce\xb8" => "\xcf\x91",		"\xcf\x86" => "\xcf\x95",		"\xcf\x80" => "\xcf\x96",
364
-		"\xcf\x99" => "\xcf\x98",		"\xcf\x9b" => "\xcf\x9a",		"\xcf\x9d" => "\xcf\x9c",		"\xcf\x9f" => "\xcf\x9e",
365
-		"\xcf\xa1" => "\xcf\xa0",		"\xcf\xa3" => "\xcf\xa2",		"\xcf\xa5" => "\xcf\xa4",		"\xcf\xa7" => "\xcf\xa6",
366
-		"\xcf\xa9" => "\xcf\xa8",		"\xcf\xab" => "\xcf\xaa",		"\xcf\xad" => "\xcf\xac",		"\xcf\xaf" => "\xcf\xae",
367
-		"\xce\xba" => "\xcf\xb0",		"\xcf\x81" => "\xcf\xb1",		"\xce\xb8" => "\xcf\xb4",		"\xce\xb5" => "\xcf\xb5",
368
-		"\xcf\xb8" => "\xcf\xb7",		"\xcf\xb2" => "\xcf\xb9",		"\xcf\xbb" => "\xcf\xba",		"\xcd\xbb" => "\xcf\xbd",
369
-		"\xcd\xbc" => "\xcf\xbe",		"\xcd\xbd" => "\xcf\xbf",		"\xd1\x90" => "\xd0\x80",		"\xd1\x91" => "\xd0\x81",
370
-		"\xd1\x92" => "\xd0\x82",		"\xd1\x93" => "\xd0\x83",		"\xd1\x94" => "\xd0\x84",		"\xd1\x95" => "\xd0\x85",
371
-		"\xd1\x96" => "\xd0\x86",		"\xd1\x97" => "\xd0\x87",		"\xd1\x98" => "\xd0\x88",		"\xd1\x99" => "\xd0\x89",
372
-		"\xd1\x9a" => "\xd0\x8a",		"\xd1\x9b" => "\xd0\x8b",		"\xd1\x9c" => "\xd0\x8c",		"\xd1\x9d" => "\xd0\x8d",
373
-		"\xd1\x9e" => "\xd0\x8e",		"\xd1\x9f" => "\xd0\x8f",		"\xd0\xb0" => "\xd0\x90",		"\xd0\xb1" => "\xd0\x91",
374
-		"\xd0\xb2" => "\xd0\x92",		"\xd0\xb3" => "\xd0\x93",		"\xd0\xb4" => "\xd0\x94",		"\xd0\xb5" => "\xd0\x95",
375
-		"\xd0\xb6" => "\xd0\x96",		"\xd0\xb7" => "\xd0\x97",		"\xd0\xb8" => "\xd0\x98",		"\xd0\xb9" => "\xd0\x99",
376
-		"\xd0\xba" => "\xd0\x9a",		"\xd0\xbb" => "\xd0\x9b",		"\xd0\xbc" => "\xd0\x9c",		"\xd0\xbd" => "\xd0\x9d",
377
-		"\xd0\xbe" => "\xd0\x9e",		"\xd0\xbf" => "\xd0\x9f",		"\xd1\x80" => "\xd0\xa0",		"\xd1\x81" => "\xd0\xa1",
378
-		"\xd1\x82" => "\xd0\xa2",		"\xd1\x83" => "\xd0\xa3",		"\xd1\x84" => "\xd0\xa4",		"\xd1\x85" => "\xd0\xa5",
379
-		"\xd1\x86" => "\xd0\xa6",		"\xd1\x87" => "\xd0\xa7",		"\xd1\x88" => "\xd0\xa8",		"\xd1\x89" => "\xd0\xa9",
380
-		"\xd1\x8a" => "\xd0\xaa",		"\xd1\x8b" => "\xd0\xab",		"\xd1\x8c" => "\xd0\xac",		"\xd1\x8d" => "\xd0\xad",
381
-		"\xd1\x8e" => "\xd0\xae",		"\xd1\x8f" => "\xd0\xaf",		"\xd1\xa1" => "\xd1\xa0",		"\xd1\xa3" => "\xd1\xa2",
382
-		"\xd1\xa5" => "\xd1\xa4",		"\xd1\xa7" => "\xd1\xa6",		"\xd1\xa9" => "\xd1\xa8",		"\xd1\xab" => "\xd1\xaa",
383
-		"\xd1\xad" => "\xd1\xac",		"\xd1\xaf" => "\xd1\xae",		"\xd1\xb1" => "\xd1\xb0",		"\xd1\xb3" => "\xd1\xb2",
384
-		"\xd1\xb5" => "\xd1\xb4",		"\xd1\xb7" => "\xd1\xb6",		"\xd1\xb9" => "\xd1\xb8",		"\xd1\xbb" => "\xd1\xba",
385
-		"\xd1\xbd" => "\xd1\xbc",		"\xd1\xbf" => "\xd1\xbe",		"\xd2\x81" => "\xd2\x80",		"\xd2\x8b" => "\xd2\x8a",
386
-		"\xd2\x8d" => "\xd2\x8c",		"\xd2\x8f" => "\xd2\x8e",		"\xd2\x91" => "\xd2\x90",		"\xd2\x93" => "\xd2\x92",
387
-		"\xd2\x95" => "\xd2\x94",		"\xd2\x97" => "\xd2\x96",		"\xd2\x99" => "\xd2\x98",		"\xd2\x9b" => "\xd2\x9a",
388
-		"\xd2\x9d" => "\xd2\x9c",		"\xd2\x9f" => "\xd2\x9e",		"\xd2\xa1" => "\xd2\xa0",		"\xd2\xa3" => "\xd2\xa2",
389
-		"\xd2\xa5" => "\xd2\xa4",		"\xd2\xa7" => "\xd2\xa6",		"\xd2\xa9" => "\xd2\xa8",		"\xd2\xab" => "\xd2\xaa",
390
-		"\xd2\xad" => "\xd2\xac",		"\xd2\xaf" => "\xd2\xae",		"\xd2\xb1" => "\xd2\xb0",		"\xd2\xb3" => "\xd2\xb2",
391
-		"\xd2\xb5" => "\xd2\xb4",		"\xd2\xb7" => "\xd2\xb6",		"\xd2\xb9" => "\xd2\xb8",		"\xd2\xbb" => "\xd2\xba",
392
-		"\xd2\xbd" => "\xd2\xbc",		"\xd2\xbf" => "\xd2\xbe",		"\xd3\x8f" => "\xd3\x80",		"\xd3\x82" => "\xd3\x81",
393
-		"\xd3\x84" => "\xd3\x83",		"\xd3\x86" => "\xd3\x85",		"\xd3\x88" => "\xd3\x87",		"\xd3\x8a" => "\xd3\x89",
394
-		"\xd3\x8c" => "\xd3\x8b",		"\xd3\x8e" => "\xd3\x8d",		"\xd3\x91" => "\xd3\x90",		"\xd3\x93" => "\xd3\x92",
395
-		"\xd3\x95" => "\xd3\x94",		"\xd3\x97" => "\xd3\x96",		"\xd3\x99" => "\xd3\x98",		"\xd3\x9b" => "\xd3\x9a",
396
-		"\xd3\x9d" => "\xd3\x9c",		"\xd3\x9f" => "\xd3\x9e",		"\xd3\xa1" => "\xd3\xa0",		"\xd3\xa3" => "\xd3\xa2",
397
-		"\xd3\xa5" => "\xd3\xa4",		"\xd3\xa7" => "\xd3\xa6",		"\xd3\xa9" => "\xd3\xa8",		"\xd3\xab" => "\xd3\xaa",
398
-		"\xd3\xad" => "\xd3\xac",		"\xd3\xaf" => "\xd3\xae",		"\xd3\xb1" => "\xd3\xb0",		"\xd3\xb3" => "\xd3\xb2",
399
-		"\xd3\xb5" => "\xd3\xb4",		"\xd3\xb7" => "\xd3\xb6",		"\xd3\xb9" => "\xd3\xb8",		"\xd3\xbb" => "\xd3\xba",
400
-		"\xd3\xbd" => "\xd3\xbc",		"\xd3\xbf" => "\xd3\xbe",		"\xd4\x81" => "\xd4\x80",		"\xd4\x83" => "\xd4\x82",
401
-		"\xd4\x85" => "\xd4\x84",		"\xd4\x87" => "\xd4\x86",		"\xd4\x89" => "\xd4\x88",		"\xd4\x8b" => "\xd4\x8a",
402
-		"\xd4\x8d" => "\xd4\x8c",		"\xd4\x8f" => "\xd4\x8e",		"\xd4\x91" => "\xd4\x90",		"\xd4\x93" => "\xd4\x92",
403
-		"\xd5\xa1" => "\xd4\xb1",		"\xd5\xa2" => "\xd4\xb2",		"\xd5\xa3" => "\xd4\xb3",		"\xd5\xa4" => "\xd4\xb4",
404
-		"\xd5\xa5" => "\xd4\xb5",		"\xd5\xa6" => "\xd4\xb6",		"\xd5\xa7" => "\xd4\xb7",		"\xd5\xa8" => "\xd4\xb8",
405
-		"\xd5\xa9" => "\xd4\xb9",		"\xd5\xaa" => "\xd4\xba",		"\xd5\xab" => "\xd4\xbb",		"\xd5\xac" => "\xd4\xbc",
406
-		"\xd5\xad" => "\xd4\xbd",		"\xd5\xae" => "\xd4\xbe",		"\xd5\xaf" => "\xd4\xbf",		"\xd5\xb0" => "\xd5\x80",
407
-		"\xd5\xb1" => "\xd5\x81",		"\xd5\xb2" => "\xd5\x82",		"\xd5\xb3" => "\xd5\x83",		"\xd5\xb4" => "\xd5\x84",
408
-		"\xd5\xb5" => "\xd5\x85",		"\xd5\xb6" => "\xd5\x86",		"\xd5\xb7" => "\xd5\x87",		"\xd5\xb8" => "\xd5\x88",
409
-		"\xd5\xb9" => "\xd5\x89",		"\xd5\xba" => "\xd5\x8a",		"\xd5\xbb" => "\xd5\x8b",		"\xd5\xbc" => "\xd5\x8c",
410
-		"\xd5\xbd" => "\xd5\x8d",		"\xd5\xbe" => "\xd5\x8e",		"\xd5\xbf" => "\xd5\x8f",		"\xd6\x80" => "\xd5\x90",
411
-		"\xd6\x81" => "\xd5\x91",		"\xd6\x82" => "\xd5\x92",		"\xd6\x83" => "\xd5\x93",		"\xd6\x84" => "\xd5\x94",
412
-		"\xd6\x85" => "\xd5\x95",		"\xd6\x86" => "\xd5\x96",		"\xd5\xa5\xd6\x82" => "\xd6\x87",		"\xe2\xb4\x80" => "\xe1\x82\xa0",
413
-		"\xe2\xb4\x81" => "\xe1\x82\xa1",		"\xe2\xb4\x82" => "\xe1\x82\xa2",		"\xe2\xb4\x83" => "\xe1\x82\xa3",		"\xe2\xb4\x84" => "\xe1\x82\xa4",
414
-		"\xe2\xb4\x85" => "\xe1\x82\xa5",		"\xe2\xb4\x86" => "\xe1\x82\xa6",		"\xe2\xb4\x87" => "\xe1\x82\xa7",		"\xe2\xb4\x88" => "\xe1\x82\xa8",
415
-		"\xe2\xb4\x89" => "\xe1\x82\xa9",		"\xe2\xb4\x8a" => "\xe1\x82\xaa",		"\xe2\xb4\x8b" => "\xe1\x82\xab",		"\xe2\xb4\x8c" => "\xe1\x82\xac",
416
-		"\xe2\xb4\x8d" => "\xe1\x82\xad",		"\xe2\xb4\x8e" => "\xe1\x82\xae",		"\xe2\xb4\x8f" => "\xe1\x82\xaf",		"\xe2\xb4\x90" => "\xe1\x82\xb0",
417
-		"\xe2\xb4\x91" => "\xe1\x82\xb1",		"\xe2\xb4\x92" => "\xe1\x82\xb2",		"\xe2\xb4\x93" => "\xe1\x82\xb3",		"\xe2\xb4\x94" => "\xe1\x82\xb4",
418
-		"\xe2\xb4\x95" => "\xe1\x82\xb5",		"\xe2\xb4\x96" => "\xe1\x82\xb6",		"\xe2\xb4\x97" => "\xe1\x82\xb7",		"\xe2\xb4\x98" => "\xe1\x82\xb8",
419
-		"\xe2\xb4\x99" => "\xe1\x82\xb9",		"\xe2\xb4\x9a" => "\xe1\x82\xba",		"\xe2\xb4\x9b" => "\xe1\x82\xbb",		"\xe2\xb4\x9c" => "\xe1\x82\xbc",
420
-		"\xe2\xb4\x9d" => "\xe1\x82\xbd",		"\xe2\xb4\x9e" => "\xe1\x82\xbe",		"\xe2\xb4\x9f" => "\xe1\x82\xbf",		"\xe2\xb4\xa0" => "\xe1\x83\x80",
421
-		"\xe2\xb4\xa1" => "\xe1\x83\x81",		"\xe2\xb4\xa2" => "\xe1\x83\x82",		"\xe2\xb4\xa3" => "\xe1\x83\x83",		"\xe2\xb4\xa4" => "\xe1\x83\x84",
422
-		"\xe2\xb4\xa5" => "\xe1\x83\x85",		"\xe1\xb8\x81" => "\xe1\xb8\x80",		"\xe1\xb8\x83" => "\xe1\xb8\x82",		"\xe1\xb8\x85" => "\xe1\xb8\x84",
423
-		"\xe1\xb8\x87" => "\xe1\xb8\x86",		"\xe1\xb8\x89" => "\xe1\xb8\x88",		"\xe1\xb8\x8b" => "\xe1\xb8\x8a",		"\xe1\xb8\x8d" => "\xe1\xb8\x8c",
424
-		"\xe1\xb8\x8f" => "\xe1\xb8\x8e",		"\xe1\xb8\x91" => "\xe1\xb8\x90",		"\xe1\xb8\x93" => "\xe1\xb8\x92",		"\xe1\xb8\x95" => "\xe1\xb8\x94",
425
-		"\xe1\xb8\x97" => "\xe1\xb8\x96",		"\xe1\xb8\x99" => "\xe1\xb8\x98",		"\xe1\xb8\x9b" => "\xe1\xb8\x9a",		"\xe1\xb8\x9d" => "\xe1\xb8\x9c",
426
-		"\xe1\xb8\x9f" => "\xe1\xb8\x9e",		"\xe1\xb8\xa1" => "\xe1\xb8\xa0",		"\xe1\xb8\xa3" => "\xe1\xb8\xa2",		"\xe1\xb8\xa5" => "\xe1\xb8\xa4",
427
-		"\xe1\xb8\xa7" => "\xe1\xb8\xa6",		"\xe1\xb8\xa9" => "\xe1\xb8\xa8",		"\xe1\xb8\xab" => "\xe1\xb8\xaa",		"\xe1\xb8\xad" => "\xe1\xb8\xac",
428
-		"\xe1\xb8\xaf" => "\xe1\xb8\xae",		"\xe1\xb8\xb1" => "\xe1\xb8\xb0",		"\xe1\xb8\xb3" => "\xe1\xb8\xb2",		"\xe1\xb8\xb5" => "\xe1\xb8\xb4",
429
-		"\xe1\xb8\xb7" => "\xe1\xb8\xb6",		"\xe1\xb8\xb9" => "\xe1\xb8\xb8",		"\xe1\xb8\xbb" => "\xe1\xb8\xba",		"\xe1\xb8\xbd" => "\xe1\xb8\xbc",
430
-		"\xe1\xb8\xbf" => "\xe1\xb8\xbe",		"\xe1\xb9\x81" => "\xe1\xb9\x80",		"\xe1\xb9\x83" => "\xe1\xb9\x82",		"\xe1\xb9\x85" => "\xe1\xb9\x84",
431
-		"\xe1\xb9\x87" => "\xe1\xb9\x86",		"\xe1\xb9\x89" => "\xe1\xb9\x88",		"\xe1\xb9\x8b" => "\xe1\xb9\x8a",		"\xe1\xb9\x8d" => "\xe1\xb9\x8c",
432
-		"\xe1\xb9\x8f" => "\xe1\xb9\x8e",		"\xe1\xb9\x91" => "\xe1\xb9\x90",		"\xe1\xb9\x93" => "\xe1\xb9\x92",		"\xe1\xb9\x95" => "\xe1\xb9\x94",
433
-		"\xe1\xb9\x97" => "\xe1\xb9\x96",		"\xe1\xb9\x99" => "\xe1\xb9\x98",		"\xe1\xb9\x9b" => "\xe1\xb9\x9a",		"\xe1\xb9\x9d" => "\xe1\xb9\x9c",
434
-		"\xe1\xb9\x9f" => "\xe1\xb9\x9e",		"\xe1\xb9\xa1" => "\xe1\xb9\xa0",		"\xe1\xb9\xa3" => "\xe1\xb9\xa2",		"\xe1\xb9\xa5" => "\xe1\xb9\xa4",
435
-		"\xe1\xb9\xa7" => "\xe1\xb9\xa6",		"\xe1\xb9\xa9" => "\xe1\xb9\xa8",		"\xe1\xb9\xab" => "\xe1\xb9\xaa",		"\xe1\xb9\xad" => "\xe1\xb9\xac",
436
-		"\xe1\xb9\xaf" => "\xe1\xb9\xae",		"\xe1\xb9\xb1" => "\xe1\xb9\xb0",		"\xe1\xb9\xb3" => "\xe1\xb9\xb2",		"\xe1\xb9\xb5" => "\xe1\xb9\xb4",
437
-		"\xe1\xb9\xb7" => "\xe1\xb9\xb6",		"\xe1\xb9\xb9" => "\xe1\xb9\xb8",		"\xe1\xb9\xbb" => "\xe1\xb9\xba",		"\xe1\xb9\xbd" => "\xe1\xb9\xbc",
438
-		"\xe1\xb9\xbf" => "\xe1\xb9\xbe",		"\xe1\xba\x81" => "\xe1\xba\x80",		"\xe1\xba\x83" => "\xe1\xba\x82",		"\xe1\xba\x85" => "\xe1\xba\x84",
439
-		"\xe1\xba\x87" => "\xe1\xba\x86",		"\xe1\xba\x89" => "\xe1\xba\x88",		"\xe1\xba\x8b" => "\xe1\xba\x8a",		"\xe1\xba\x8d" => "\xe1\xba\x8c",
440
-		"\xe1\xba\x8f" => "\xe1\xba\x8e",		"\xe1\xba\x91" => "\xe1\xba\x90",		"\xe1\xba\x93" => "\xe1\xba\x92",		"\xe1\xba\x95" => "\xe1\xba\x94",
441
-		"h\xcc\xb1" => "\xe1\xba\x96",		"t\xcc\x88" => "\xe1\xba\x97",		"w\xcc\x8a" => "\xe1\xba\x98",		"y\xcc\x8a" => "\xe1\xba\x99",
442
-		"a\xca\xbe" => "\xe1\xba\x9a",	"\xe1\xb9\xa1" => "\xe1\xba\x9b",		"\xe1\xba\xa1" => "\xe1\xba\xa0",		"\xe1\xba\xa3" => "\xe1\xba\xa2",
443
-		"\xe1\xba\xa5" => "\xe1\xba\xa4",		"\xe1\xba\xa7" => "\xe1\xba\xa6",		"\xe1\xba\xa9" => "\xe1\xba\xa8",		"\xe1\xba\xab" => "\xe1\xba\xaa",
444
-		"\xe1\xba\xad" => "\xe1\xba\xac",		"\xe1\xba\xaf" => "\xe1\xba\xae",		"\xe1\xba\xb1" => "\xe1\xba\xb0",		"\xe1\xba\xb3" => "\xe1\xba\xb2",
445
-		"\xe1\xba\xb5" => "\xe1\xba\xb4",		"\xe1\xba\xb7" => "\xe1\xba\xb6",		"\xe1\xba\xb9" => "\xe1\xba\xb8",		"\xe1\xba\xbb" => "\xe1\xba\xba",
446
-		"\xe1\xba\xbd" => "\xe1\xba\xbc",		"\xe1\xba\xbf" => "\xe1\xba\xbe",		"\xe1\xbb\x81" => "\xe1\xbb\x80",		"\xe1\xbb\x83" => "\xe1\xbb\x82",
447
-		"\xe1\xbb\x85" => "\xe1\xbb\x84",		"\xe1\xbb\x87" => "\xe1\xbb\x86",		"\xe1\xbb\x89" => "\xe1\xbb\x88",		"\xe1\xbb\x8b" => "\xe1\xbb\x8a",
448
-		"\xe1\xbb\x8d" => "\xe1\xbb\x8c",		"\xe1\xbb\x8f" => "\xe1\xbb\x8e",		"\xe1\xbb\x91" => "\xe1\xbb\x90",		"\xe1\xbb\x93" => "\xe1\xbb\x92",
449
-		"\xe1\xbb\x95" => "\xe1\xbb\x94",		"\xe1\xbb\x97" => "\xe1\xbb\x96",		"\xe1\xbb\x99" => "\xe1\xbb\x98",		"\xe1\xbb\x9b" => "\xe1\xbb\x9a",
450
-		"\xe1\xbb\x9d" => "\xe1\xbb\x9c",		"\xe1\xbb\x9f" => "\xe1\xbb\x9e",		"\xe1\xbb\xa1" => "\xe1\xbb\xa0",		"\xe1\xbb\xa3" => "\xe1\xbb\xa2",
451
-		"\xe1\xbb\xa5" => "\xe1\xbb\xa4",		"\xe1\xbb\xa7" => "\xe1\xbb\xa6",		"\xe1\xbb\xa9" => "\xe1\xbb\xa8",		"\xe1\xbb\xab" => "\xe1\xbb\xaa",
452
-		"\xe1\xbb\xad" => "\xe1\xbb\xac",		"\xe1\xbb\xaf" => "\xe1\xbb\xae",		"\xe1\xbb\xb1" => "\xe1\xbb\xb0",		"\xe1\xbb\xb3" => "\xe1\xbb\xb2",
453
-		"\xe1\xbb\xb5" => "\xe1\xbb\xb4",		"\xe1\xbb\xb7" => "\xe1\xbb\xb6",		"\xe1\xbb\xb9" => "\xe1\xbb\xb8",		"\xe1\xbc\x80" => "\xe1\xbc\x88",
454
-		"\xe1\xbc\x81" => "\xe1\xbc\x89",		"\xe1\xbc\x82" => "\xe1\xbc\x8a",		"\xe1\xbc\x83" => "\xe1\xbc\x8b",		"\xe1\xbc\x84" => "\xe1\xbc\x8c",
455
-		"\xe1\xbc\x85" => "\xe1\xbc\x8d",		"\xe1\xbc\x86" => "\xe1\xbc\x8e",		"\xe1\xbc\x87" => "\xe1\xbc\x8f",		"\xe1\xbc\x90" => "\xe1\xbc\x98",
456
-		"\xe1\xbc\x91" => "\xe1\xbc\x99",		"\xe1\xbc\x92" => "\xe1\xbc\x9a",		"\xe1\xbc\x93" => "\xe1\xbc\x9b",		"\xe1\xbc\x94" => "\xe1\xbc\x9c",
457
-		"\xe1\xbc\x95" => "\xe1\xbc\x9d",		"\xe1\xbc\xa0" => "\xe1\xbc\xa8",		"\xe1\xbc\xa1" => "\xe1\xbc\xa9",		"\xe1\xbc\xa2" => "\xe1\xbc\xaa",
458
-		"\xe1\xbc\xa3" => "\xe1\xbc\xab",		"\xe1\xbc\xa4" => "\xe1\xbc\xac",		"\xe1\xbc\xa5" => "\xe1\xbc\xad",		"\xe1\xbc\xa6" => "\xe1\xbc\xae",
459
-		"\xe1\xbc\xa7" => "\xe1\xbc\xaf",		"\xe1\xbc\xb0" => "\xe1\xbc\xb8",		"\xe1\xbc\xb1" => "\xe1\xbc\xb9",		"\xe1\xbc\xb2" => "\xe1\xbc\xba",
460
-		"\xe1\xbc\xb3" => "\xe1\xbc\xbb",		"\xe1\xbc\xb4" => "\xe1\xbc\xbc",		"\xe1\xbc\xb5" => "\xe1\xbc\xbd",		"\xe1\xbc\xb6" => "\xe1\xbc\xbe",
461
-		"\xe1\xbc\xb7" => "\xe1\xbc\xbf",		"\xe1\xbd\x80" => "\xe1\xbd\x88",		"\xe1\xbd\x81" => "\xe1\xbd\x89",		"\xe1\xbd\x82" => "\xe1\xbd\x8a",
462
-		"\xe1\xbd\x83" => "\xe1\xbd\x8b",		"\xe1\xbd\x84" => "\xe1\xbd\x8c",		"\xe1\xbd\x85" => "\xe1\xbd\x8d",		"\xcf\x85\xcc\x93" => "\xe1\xbd\x90",
463
-		"\xcf\x85\xcc\x93\xcc\x80" => "\xe1\xbd\x92",	"\xcf\x85\xcc\x93\xcc\x81" => "\xe1\xbd\x94",	"\xcf\x85\xcc\x93\xcd\x82" => "\xe1\xbd\x96",		"\xe1\xbd\x91" => "\xe1\xbd\x99",
464
-		"\xe1\xbd\x93" => "\xe1\xbd\x9b",		"\xe1\xbd\x95" => "\xe1\xbd\x9d",		"\xe1\xbd\x97" => "\xe1\xbd\x9f",		"\xe1\xbd\xa0" => "\xe1\xbd\xa8",
465
-		"\xe1\xbd\xa1" => "\xe1\xbd\xa9",		"\xe1\xbd\xa2" => "\xe1\xbd\xaa",		"\xe1\xbd\xa3" => "\xe1\xbd\xab",		"\xe1\xbd\xa4" => "\xe1\xbd\xac",
466
-		"\xe1\xbd\xa5" => "\xe1\xbd\xad",		"\xe1\xbd\xa6" => "\xe1\xbd\xae",		"\xe1\xbd\xa7" => "\xe1\xbd\xaf",		"\xe1\xbc\x80\xce\xb9" => "\xe1\xbe\x80",
467
-		"\xe1\xbc\x81\xce\xb9" => "\xe1\xbe\x81",	"\xe1\xbc\x82\xce\xb9" => "\xe1\xbe\x82",	"\xe1\xbc\x83\xce\xb9" => "\xe1\xbe\x83",	"\xe1\xbc\x84\xce\xb9" => "\xe1\xbe\x84",
468
-		"\xe1\xbc\x85\xce\xb9" => "\xe1\xbe\x85",	"\xe1\xbc\x86\xce\xb9" => "\xe1\xbe\x86",	"\xe1\xbc\x87\xce\xb9" => "\xe1\xbe\x87",	"\xe1\xbe\x80" => "\xe1\xbe\x88",
469
-		"\xe1\xbe\x81" => "\xe1\xbe\x89",		"\xe1\xbe\x82" => "\xe1\xbe\x8a",		"\xe1\xbe\x83" => "\xe1\xbe\x8b",		"\xe1\xbe\x84" => "\xe1\xbe\x8c",
470
-		"\xe1\xbe\x85" => "\xe1\xbe\x8d",		"\xe1\xbe\x86" => "\xe1\xbe\x8e",		"\xe1\xbe\x87" => "\xe1\xbe\x8f",		"\xe1\xbc\xa0\xce\xb9" => "\xe1\xbe\x90",
471
-		"\xe1\xbc\xa1\xce\xb9" => "\xe1\xbe\x91",	"\xe1\xbc\xa2\xce\xb9" => "\xe1\xbe\x92",	"\xe1\xbc\xa3\xce\xb9" => "\xe1\xbe\x93",	"\xe1\xbc\xa4\xce\xb9" => "\xe1\xbe\x94",
472
-		"\xe1\xbc\xa5\xce\xb9" => "\xe1\xbe\x95",	"\xe1\xbc\xa6\xce\xb9" => "\xe1\xbe\x96",	"\xe1\xbc\xa7\xce\xb9" => "\xe1\xbe\x97",	"\xe1\xbe\x90" => "\xe1\xbe\x98",
473
-		"\xe1\xbe\x91" => "\xe1\xbe\x99",		"\xe1\xbe\x92" => "\xe1\xbe\x9a",		"\xe1\xbe\x93" => "\xe1\xbe\x9b",		"\xe1\xbe\x94" => "\xe1\xbe\x9c",
474
-		"\xe1\xbe\x95" => "\xe1\xbe\x9d",		"\xe1\xbe\x96" => "\xe1\xbe\x9e",		"\xe1\xbe\x97" => "\xe1\xbe\x9f",		"\xe1\xbd\xa0\xce\xb9" => "\xe1\xbe\xa0",
475
-		"\xe1\xbd\xa1\xce\xb9" => "\xe1\xbe\xa1",	"\xe1\xbd\xa2\xce\xb9" => "\xe1\xbe\xa2",	"\xe1\xbd\xa3\xce\xb9" => "\xe1\xbe\xa3",	"\xe1\xbd\xa4\xce\xb9" => "\xe1\xbe\xa4",
476
-		"\xe1\xbd\xa5\xce\xb9" => "\xe1\xbe\xa5",	"\xe1\xbd\xa6\xce\xb9" => "\xe1\xbe\xa6",	"\xe1\xbd\xa7\xce\xb9" => "\xe1\xbe\xa7",	"\xe1\xbe\xa0" => "\xe1\xbe\xa8",
477
-		"\xe1\xbe\xa1" => "\xe1\xbe\xa9",		"\xe1\xbe\xa2" => "\xe1\xbe\xaa",		"\xe1\xbe\xa3" => "\xe1\xbe\xab",		"\xe1\xbe\xa4" => "\xe1\xbe\xac",
478
-		"\xe1\xbe\xa5" => "\xe1\xbe\xad",		"\xe1\xbe\xa6" => "\xe1\xbe\xae",		"\xe1\xbe\xa7" => "\xe1\xbe\xaf",		"\xe1\xbd\xb0\xce\xb9" => "\xe1\xbe\xb2",
479
-		"\xce\xb1\xce\xb9" => "\xe1\xbe\xb3",	"\xce\xac\xce\xb9" => "\xe1\xbe\xb4",	"\xce\xb1\xcd\x82" => "\xe1\xbe\xb6",		"\xce\xb1\xcd\x82\xce\xb9" => "\xe1\xbe\xb7",
480
-		"\xe1\xbe\xb0" => "\xe1\xbe\xb8",		"\xe1\xbe\xb1" => "\xe1\xbe\xb9",		"\xe1\xbd\xb0" => "\xe1\xbe\xba",		"\xe1\xbd\xb1" => "\xe1\xbe\xbb",
481
-		"\xe1\xbe\xb3" => "\xe1\xbe\xbc",		"\xce\xb9" => "\xe1\xbe\xbe",		"\xe1\xbd\xb4\xce\xb9" => "\xe1\xbf\x82",	"\xce\xb7\xce\xb9" => "\xe1\xbf\x83",
482
-		"\xce\xae\xce\xb9" => "\xe1\xbf\x84",	"\xce\xb7\xcd\x82" => "\xe1\xbf\x86",		"\xce\xb7\xcd\x82\xce\xb9" => "\xe1\xbf\x87",	"\xe1\xbd\xb2" => "\xe1\xbf\x88",
483
-		"\xe1\xbd\xb3" => "\xe1\xbf\x89",		"\xe1\xbd\xb4" => "\xe1\xbf\x8a",		"\xe1\xbd\xb5" => "\xe1\xbf\x8b",		"\xe1\xbf\x83" => "\xe1\xbf\x8c",
484
-		"\xce\xb9\xcc\x88\xcc\x80" => "\xe1\xbf\x92",	"\xce\xb9\xcc\x88\xcc\x81" => "\xe1\xbf\x93",	"\xce\xb9\xcd\x82" => "\xe1\xbf\x96",		"\xce\xb9\xcc\x88\xcd\x82" => "\xe1\xbf\x97",
485
-		"\xe1\xbf\x90" => "\xe1\xbf\x98",		"\xe1\xbf\x91" => "\xe1\xbf\x99",		"\xe1\xbd\xb6" => "\xe1\xbf\x9a",		"\xe1\xbd\xb7" => "\xe1\xbf\x9b",
486
-		"\xcf\x85\xcc\x88\xcc\x80" => "\xe1\xbf\xa2",	"\xcf\x85\xcc\x88\xcc\x81" => "\xe1\xbf\xa3",	"\xcf\x81\xcc\x93" => "\xe1\xbf\xa4",		"\xcf\x85\xcd\x82" => "\xe1\xbf\xa6",
487
-		"\xcf\x85\xcc\x88\xcd\x82" => "\xe1\xbf\xa7",		"\xe1\xbf\xa0" => "\xe1\xbf\xa8",		"\xe1\xbf\xa1" => "\xe1\xbf\xa9",		"\xe1\xbd\xba" => "\xe1\xbf\xaa",
488
-		"\xe1\xbd\xbb" => "\xe1\xbf\xab",		"\xe1\xbf\xa5" => "\xe1\xbf\xac",		"\xe1\xbd\xbc\xce\xb9" => "\xe1\xbf\xb2",	"\xcf\x89\xce\xb9" => "\xe1\xbf\xb3",
489
-		"\xcf\x8e\xce\xb9" => "\xe1\xbf\xb4",	"\xcf\x89\xcd\x82" => "\xe1\xbf\xb6",		"\xcf\x89\xcd\x82\xce\xb9" => "\xe1\xbf\xb7",	"\xe1\xbd\xb8" => "\xe1\xbf\xb8",
490
-		"\xe1\xbd\xb9" => "\xe1\xbf\xb9",		"\xe1\xbd\xbc" => "\xe1\xbf\xba",		"\xe1\xbd\xbd" => "\xe1\xbf\xbb",		"\xe1\xbf\xb3" => "\xe1\xbf\xbc",
491
-		"\xcf\x89" => "\xe2\x84\xa6",		"k" => "\xe2\x84\xaa",		"\xc3\xa5" => "\xe2\x84\xab",		"\xe2\x85\x8e" => "\xe2\x84\xb2",
492
-		"\xe2\x85\xb0" => "\xe2\x85\xa0",		"\xe2\x85\xb1" => "\xe2\x85\xa1",		"\xe2\x85\xb2" => "\xe2\x85\xa2",		"\xe2\x85\xb3" => "\xe2\x85\xa3",
493
-		"\xe2\x85\xb4" => "\xe2\x85\xa4",		"\xe2\x85\xb5" => "\xe2\x85\xa5",		"\xe2\x85\xb6" => "\xe2\x85\xa6",		"\xe2\x85\xb7" => "\xe2\x85\xa7",
494
-		"\xe2\x85\xb8" => "\xe2\x85\xa8",		"\xe2\x85\xb9" => "\xe2\x85\xa9",		"\xe2\x85\xba" => "\xe2\x85\xaa",		"\xe2\x85\xbb" => "\xe2\x85\xab",
495
-		"\xe2\x85\xbc" => "\xe2\x85\xac",		"\xe2\x85\xbd" => "\xe2\x85\xad",		"\xe2\x85\xbe" => "\xe2\x85\xae",		"\xe2\x85\xbf" => "\xe2\x85\xaf",
496
-		"\xe2\x86\x84" => "\xe2\x86\x83",		"\xe2\x93\x90" => "\xe2\x92\xb6",		"\xe2\x93\x91" => "\xe2\x92\xb7",		"\xe2\x93\x92" => "\xe2\x92\xb8",
497
-		"\xe2\x93\x93" => "\xe2\x92\xb9",		"\xe2\x93\x94" => "\xe2\x92\xba",		"\xe2\x93\x95" => "\xe2\x92\xbb",		"\xe2\x93\x96" => "\xe2\x92\xbc",
498
-		"\xe2\x93\x97" => "\xe2\x92\xbd",		"\xe2\x93\x98" => "\xe2\x92\xbe",		"\xe2\x93\x99" => "\xe2\x92\xbf",		"\xe2\x93\x9a" => "\xe2\x93\x80",
499
-		"\xe2\x93\x9b" => "\xe2\x93\x81",		"\xe2\x93\x9c" => "\xe2\x93\x82",		"\xe2\x93\x9d" => "\xe2\x93\x83",		"\xe2\x93\x9e" => "\xe2\x93\x84",
500
-		"\xe2\x93\x9f" => "\xe2\x93\x85",		"\xe2\x93\xa0" => "\xe2\x93\x86",		"\xe2\x93\xa1" => "\xe2\x93\x87",		"\xe2\x93\xa2" => "\xe2\x93\x88",
501
-		"\xe2\x93\xa3" => "\xe2\x93\x89",		"\xe2\x93\xa4" => "\xe2\x93\x8a",		"\xe2\x93\xa5" => "\xe2\x93\x8b",		"\xe2\x93\xa6" => "\xe2\x93\x8c",
502
-		"\xe2\x93\xa7" => "\xe2\x93\x8d",		"\xe2\x93\xa8" => "\xe2\x93\x8e",		"\xe2\x93\xa9" => "\xe2\x93\x8f",		"\xe2\xb0\xb0" => "\xe2\xb0\x80",
503
-		"\xe2\xb0\xb1" => "\xe2\xb0\x81",		"\xe2\xb0\xb2" => "\xe2\xb0\x82",		"\xe2\xb0\xb3" => "\xe2\xb0\x83",		"\xe2\xb0\xb4" => "\xe2\xb0\x84",
504
-		"\xe2\xb0\xb5" => "\xe2\xb0\x85",		"\xe2\xb0\xb6" => "\xe2\xb0\x86",		"\xe2\xb0\xb7" => "\xe2\xb0\x87",		"\xe2\xb0\xb8" => "\xe2\xb0\x88",
505
-		"\xe2\xb0\xb9" => "\xe2\xb0\x89",		"\xe2\xb0\xba" => "\xe2\xb0\x8a",		"\xe2\xb0\xbb" => "\xe2\xb0\x8b",		"\xe2\xb0\xbc" => "\xe2\xb0\x8c",
506
-		"\xe2\xb0\xbd" => "\xe2\xb0\x8d",		"\xe2\xb0\xbe" => "\xe2\xb0\x8e",		"\xe2\xb0\xbf" => "\xe2\xb0\x8f",		"\xe2\xb1\x80" => "\xe2\xb0\x90",
507
-		"\xe2\xb1\x81" => "\xe2\xb0\x91",		"\xe2\xb1\x82" => "\xe2\xb0\x92",		"\xe2\xb1\x83" => "\xe2\xb0\x93",		"\xe2\xb1\x84" => "\xe2\xb0\x94",
508
-		"\xe2\xb1\x85" => "\xe2\xb0\x95",		"\xe2\xb1\x86" => "\xe2\xb0\x96",		"\xe2\xb1\x87" => "\xe2\xb0\x97",		"\xe2\xb1\x88" => "\xe2\xb0\x98",
509
-		"\xe2\xb1\x89" => "\xe2\xb0\x99",		"\xe2\xb1\x8a" => "\xe2\xb0\x9a",		"\xe2\xb1\x8b" => "\xe2\xb0\x9b",		"\xe2\xb1\x8c" => "\xe2\xb0\x9c",
510
-		"\xe2\xb1\x8d" => "\xe2\xb0\x9d",		"\xe2\xb1\x8e" => "\xe2\xb0\x9e",		"\xe2\xb1\x8f" => "\xe2\xb0\x9f",		"\xe2\xb1\x90" => "\xe2\xb0\xa0",
511
-		"\xe2\xb1\x91" => "\xe2\xb0\xa1",		"\xe2\xb1\x92" => "\xe2\xb0\xa2",		"\xe2\xb1\x93" => "\xe2\xb0\xa3",		"\xe2\xb1\x94" => "\xe2\xb0\xa4",
512
-		"\xe2\xb1\x95" => "\xe2\xb0\xa5",		"\xe2\xb1\x96" => "\xe2\xb0\xa6",		"\xe2\xb1\x97" => "\xe2\xb0\xa7",		"\xe2\xb1\x98" => "\xe2\xb0\xa8",
513
-		"\xe2\xb1\x99" => "\xe2\xb0\xa9",		"\xe2\xb1\x9a" => "\xe2\xb0\xaa",		"\xe2\xb1\x9b" => "\xe2\xb0\xab",		"\xe2\xb1\x9c" => "\xe2\xb0\xac",
514
-		"\xe2\xb1\x9d" => "\xe2\xb0\xad",		"\xe2\xb1\x9e" => "\xe2\xb0\xae",		"\xe2\xb1\xa1" => "\xe2\xb1\xa0",		"\xc9\xab" => "\xe2\xb1\xa2",
515
-		"\xe1\xb5\xbd" => "\xe2\xb1\xa3",		"\xc9\xbd" => "\xe2\xb1\xa4",		"\xe2\xb1\xa8" => "\xe2\xb1\xa7",		"\xe2\xb1\xaa" => "\xe2\xb1\xa9",
516
-		"\xe2\xb1\xac" => "\xe2\xb1\xab",		"\xe2\xb1\xb6" => "\xe2\xb1\xb5",		"\xe2\xb2\x81" => "\xe2\xb2\x80",		"\xe2\xb2\x83" => "\xe2\xb2\x82",
517
-		"\xe2\xb2\x85" => "\xe2\xb2\x84",		"\xe2\xb2\x87" => "\xe2\xb2\x86",		"\xe2\xb2\x89" => "\xe2\xb2\x88",		"\xe2\xb2\x8b" => "\xe2\xb2\x8a",
518
-		"\xe2\xb2\x8d" => "\xe2\xb2\x8c",		"\xe2\xb2\x8f" => "\xe2\xb2\x8e",		"\xe2\xb2\x91" => "\xe2\xb2\x90",		"\xe2\xb2\x93" => "\xe2\xb2\x92",
519
-		"\xe2\xb2\x95" => "\xe2\xb2\x94",		"\xe2\xb2\x97" => "\xe2\xb2\x96",		"\xe2\xb2\x99" => "\xe2\xb2\x98",		"\xe2\xb2\x9b" => "\xe2\xb2\x9a",
520
-		"\xe2\xb2\x9d" => "\xe2\xb2\x9c",		"\xe2\xb2\x9f" => "\xe2\xb2\x9e",		"\xe2\xb2\xa1" => "\xe2\xb2\xa0",		"\xe2\xb2\xa3" => "\xe2\xb2\xa2",
521
-		"\xe2\xb2\xa5" => "\xe2\xb2\xa4",		"\xe2\xb2\xa7" => "\xe2\xb2\xa6",		"\xe2\xb2\xa9" => "\xe2\xb2\xa8",		"\xe2\xb2\xab" => "\xe2\xb2\xaa",
522
-		"\xe2\xb2\xad" => "\xe2\xb2\xac",		"\xe2\xb2\xaf" => "\xe2\xb2\xae",		"\xe2\xb2\xb1" => "\xe2\xb2\xb0",		"\xe2\xb2\xb3" => "\xe2\xb2\xb2",
523
-		"\xe2\xb2\xb5" => "\xe2\xb2\xb4",		"\xe2\xb2\xb7" => "\xe2\xb2\xb6",		"\xe2\xb2\xb9" => "\xe2\xb2\xb8",		"\xe2\xb2\xbb" => "\xe2\xb2\xba",
524
-		"\xe2\xb2\xbd" => "\xe2\xb2\xbc",		"\xe2\xb2\xbf" => "\xe2\xb2\xbe",		"\xe2\xb3\x81" => "\xe2\xb3\x80",		"\xe2\xb3\x83" => "\xe2\xb3\x82",
525
-		"\xe2\xb3\x85" => "\xe2\xb3\x84",		"\xe2\xb3\x87" => "\xe2\xb3\x86",		"\xe2\xb3\x89" => "\xe2\xb3\x88",		"\xe2\xb3\x8b" => "\xe2\xb3\x8a",
526
-		"\xe2\xb3\x8d" => "\xe2\xb3\x8c",		"\xe2\xb3\x8f" => "\xe2\xb3\x8e",		"\xe2\xb3\x91" => "\xe2\xb3\x90",		"\xe2\xb3\x93" => "\xe2\xb3\x92",
527
-		"\xe2\xb3\x95" => "\xe2\xb3\x94",		"\xe2\xb3\x97" => "\xe2\xb3\x96",		"\xe2\xb3\x99" => "\xe2\xb3\x98",		"\xe2\xb3\x9b" => "\xe2\xb3\x9a",
528
-		"\xe2\xb3\x9d" => "\xe2\xb3\x9c",		"\xe2\xb3\x9f" => "\xe2\xb3\x9e",		"\xe2\xb3\xa1" => "\xe2\xb3\xa0",		"\xe2\xb3\xa3" => "\xe2\xb3\xa2",
529
-		"ff" => "\xef\xac\x80",	"fi" => "\xef\xac\x81",	"fl" => "\xef\xac\x82",	"ffi" => "\xef\xac\x83",
530
-		"ffl" => "\xef\xac\x84",	"st" => "\xef\xac\x85",	"st" => "\xef\xac\x86",	"\xd5\xb4\xd5\xb6" => "\xef\xac\x93",
531
-		"\xd5\xb4\xd5\xa5" => "\xef\xac\x94",	"\xd5\xb4\xd5\xab" => "\xef\xac\x95",	"\xd5\xbe\xd5\xb6" => "\xef\xac\x96",	"\xd5\xb4\xd5\xad" => "\xef\xac\x97",
532
-		"\xef\xbd\x81" => "\xef\xbc\xa1",		"\xef\xbd\x82" => "\xef\xbc\xa2",		"\xef\xbd\x83" => "\xef\xbc\xa3",		"\xef\xbd\x84" => "\xef\xbc\xa4",
533
-		"\xef\xbd\x85" => "\xef\xbc\xa5",		"\xef\xbd\x86" => "\xef\xbc\xa6",		"\xef\xbd\x87" => "\xef\xbc\xa7",		"\xef\xbd\x88" => "\xef\xbc\xa8",
534
-		"\xef\xbd\x89" => "\xef\xbc\xa9",		"\xef\xbd\x8a" => "\xef\xbc\xaa",		"\xef\xbd\x8b" => "\xef\xbc\xab",		"\xef\xbd\x8c" => "\xef\xbc\xac",
535
-		"\xef\xbd\x8d" => "\xef\xbc\xad",	"\xef\xbd\x8e" => "\xef\xbc\xae",		"\xef\xbd\x8f" => "\xef\xbc\xaf",		"\xef\xbd\x90" => "\xef\xbc\xb0",
536
-		"\xef\xbd\x91" => "\xef\xbc\xb1",		"\xef\xbd\x92" => "\xef\xbc\xb2",		"\xef\xbd\x93" => "\xef\xbc\xb3",		"\xef\xbd\x94" => "\xef\xbc\xb4",
537
-		"\xef\xbd\x95" => "\xef\xbc\xb5",		"\xef\xbd\x96" => "\xef\xbc\xb6",		"\xef\xbd\x97" => "\xef\xbc\xb7",	"\xef\xbd\x98" => "\xef\xbc\xb8",
538
-		"\xef\xbd\x99" => "\xef\xbc\xb9",		"\xef\xbd\x9a" => "\xef\xbc\xba",		"\xf0\x90\x90\xa8" => "\xf0\x90\x90\x80",	"\xf0\x90\x90\xa9" => "\xf0\x90\x90\x81",
539
-		"\xf0\x90\x90\xaa" => "\xf0\x90\x90\x82",	"\xf0\x90\x90\xab" => "\xf0\x90\x90\x83",	"\xf0\x90\x90\xac" => "\xf0\x90\x90\x84",	"\xf0\x90\x90\xad" => "\xf0\x90\x90\x85",
540
-		"\xf0\x90\x90\xae" => "\xf0\x90\x90\x86",	"\xf0\x90\x90\xaf" => "\xf0\x90\x90\x87",	"\xf0\x90\x90\xb0" => "\xf0\x90\x90\x88",	"\xf0\x90\x90\xb1" => "\xf0\x90\x90\x89",
541
-		"\xf0\x90\x90\xb2" => "\xf0\x90\x90\x8a",	"\xf0\x90\x90\xb3" => "\xf0\x90\x90\x8b",	"\xf0\x90\x90\xb4" => "\xf0\x90\x90\x8c",	"\xf0\x90\x90\xb5" => "\xf0\x90\x90\x8d",
542
-		"\xf0\x90\x90\xb6" => "\xf0\x90\x90\x8e",	"\xf0\x90\x90\xb7" => "\xf0\x90\x90\x8f",	"\xf0\x90\x90\xb8" => "\xf0\x90\x90\x90",	"\xf0\x90\x90\xb9" => "\xf0\x90\x90\x91",
543
-		"\xf0\x90\x90\xba" => "\xf0\x90\x90\x92",	"\xf0\x90\x90\xbb" => "\xf0\x90\x90\x93",	"\xf0\x90\x90\xbc" => "\xf0\x90\x90\x94",	"\xf0\x90\x90\xbd" => "\xf0\x90\x90\x95",
544
-		"\xf0\x90\x90\xbe" => "\xf0\x90\x90\x96",	"\xf0\x90\x90\xbf" => "\xf0\x90\x90\x97",	"\xf0\x90\x91\x80" => "\xf0\x90\x90\x98",	"\xf0\x90\x91\x81" => "\xf0\x90\x90\x99",
545
-		"\xf0\x90\x91\x82" => "\xf0\x90\x90\x9a",	"\xf0\x90\x91\x83" => "\xf0\x90\x90\x9b",	"\xf0\x90\x91\x84" => "\xf0\x90\x90\x9c",	"\xf0\x90\x91\x85" => "\xf0\x90\x90\x9d",
546
-		"\xf0\x90\x91\x86" => "\xf0\x90\x90\x9e",	"\xf0\x90\x91\x87" => "\xf0\x90\x90\x9f",	"\xf0\x90\x91\x88" => "\xf0\x90\x90\xa0",	"\xf0\x90\x91\x89" => "\xf0\x90\x90\xa1",
547
-		"\xf0\x90\x91\x8a" => "\xf0\x90\x90\xa2",	"\xf0\x90\x91\x8b" => "\xf0\x90\x90\xa3",	"\xf0\x90\x91\x8c" => "\xf0\x90\x90\xa4",	"\xf0\x90\x91\x8d" => "\xf0\x90\x90\xa5",
548
-		"\xf0\x90\x90\xa6" => "\xf0\x90\x91\x8e",	"\xf0\x90\x90\xa7" => "\xf0\x90\x91\x8f",
296
+		'a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D',
297
+		'e' => 'E', 'f' => 'F', 'g' => 'G', 'h' => 'H',
298
+		'i' => 'I', 'j' => 'J', 'k' => 'K', 'l' => 'L',
299
+		'm' => 'M', 'n' => 'N', 'o' => 'O', 'p' => 'P',
300
+		'q' => 'Q', 'r' => 'R', 's' => 'S', 't' => 'T',
301
+		'u' => 'U', 'v' => 'V', 'w' => 'W', 'x' => 'X',
302
+		'y' => 'Y', 'z' => 'Z', "\xce\xbc" => "\xc2\xb5", "\xc3\xa0" => "\xc3\x80",
303
+		"\xc3\xa1" => "\xc3\x81", "\xc3\xa2" => "\xc3\x82", "\xc3\xa3" => "\xc3\x83", "\xc3\xa4" => "\xc3\x84",
304
+		"\xc3\xa5" => "\xc3\x85", "\xc3\xa6" => "\xc3\x86", "\xc3\xa7" => "\xc3\x87", "\xc3\xa8" => "\xc3\x88",
305
+		"\xc3\xa9" => "\xc3\x89", "\xc3\xaa" => "\xc3\x8a", "\xc3\xab" => "\xc3\x8b", "\xc3\xac" => "\xc3\x8c",
306
+		"\xc3\xad" => "\xc3\x8d", "\xc3\xae" => "\xc3\x8e", "\xc3\xaf" => "\xc3\x8f", "\xc3\xb0" => "\xc3\x90",
307
+		"\xc3\xb1" => "\xc3\x91", "\xc3\xb2" => "\xc3\x92", "\xc3\xb3" => "\xc3\x93", "\xc3\xb4" => "\xc3\x94",
308
+		"\xc3\xb5" => "\xc3\x95", "\xc3\xb6" => "\xc3\x96", "\xc3\xb8" => "\xc3\x98", "\xc3\xb9" => "\xc3\x99",
309
+		"\xc3\xba" => "\xc3\x9a", "\xc3\xbb" => "\xc3\x9b", "\xc3\xbc" => "\xc3\x9c", "\xc3\xbd" => "\xc3\x9d",
310
+		"\xc3\xbe" => "\xc3\x9e", "ss" => "\xc3\x9f", "\xc4\x81" => "\xc4\x80", "\xc4\x83" => "\xc4\x82",
311
+		"\xc4\x85" => "\xc4\x84", "\xc4\x87" => "\xc4\x86", "\xc4\x89" => "\xc4\x88", "\xc4\x8b" => "\xc4\x8a",
312
+		"\xc4\x8d" => "\xc4\x8c", "\xc4\x8f" => "\xc4\x8e", "\xc4\x91" => "\xc4\x90", "\xc4\x93" => "\xc4\x92",
313
+		"\xc4\x95" => "\xc4\x94", "\xc4\x97" => "\xc4\x96", "\xc4\x99" => "\xc4\x98", "\xc4\x9b" => "\xc4\x9a",
314
+		"\xc4\x9d" => "\xc4\x9c", "\xc4\x9f" => "\xc4\x9e", "\xc4\xa1" => "\xc4\xa0", "\xc4\xa3" => "\xc4\xa2",
315
+		"\xc4\xa5" => "\xc4\xa4", "\xc4\xa7" => "\xc4\xa6", "\xc4\xa9" => "\xc4\xa8", "\xc4\xab" => "\xc4\xaa",
316
+		"\xc4\xad" => "\xc4\xac", "\xc4\xaf" => "\xc4\xae", "i\xcc\x87" => "\xc4\xb0", "\xc4\xb3" => "\xc4\xb2",
317
+		"\xc4\xb5" => "\xc4\xb4", "\xc4\xb7" => "\xc4\xb6", "\xc4\xba" => "\xc4\xb9", "\xc4\xbc" => "\xc4\xbb",
318
+		"\xc4\xbe" => "\xc4\xbd", "\xc5\x80" => "\xc4\xbf", "\xc5\x82" => "\xc5\x81", "\xc5\x84" => "\xc5\x83",
319
+		"\xc5\x86" => "\xc5\x85", "\xc5\x88" => "\xc5\x87", "\xca\xbcn" => "\xc5\x89", "\xc5\x8b" => "\xc5\x8a",
320
+		"\xc5\x8d" => "\xc5\x8c", "\xc5\x8f" => "\xc5\x8e", "\xc5\x91" => "\xc5\x90", "\xc5\x93" => "\xc5\x92",
321
+		"\xc5\x95" => "\xc5\x94", "\xc5\x97" => "\xc5\x96", "\xc5\x99" => "\xc5\x98", "\xc5\x9b" => "\xc5\x9a",
322
+		"\xc5\x9d" => "\xc5\x9c", "\xc5\x9f" => "\xc5\x9e", "\xc5\xa1" => "\xc5\xa0", "\xc5\xa3" => "\xc5\xa2",
323
+		"\xc5\xa5" => "\xc5\xa4", "\xc5\xa7" => "\xc5\xa6", "\xc5\xa9" => "\xc5\xa8", "\xc5\xab" => "\xc5\xaa",
324
+		"\xc5\xad" => "\xc5\xac", "\xc5\xaf" => "\xc5\xae", "\xc5\xb1" => "\xc5\xb0", "\xc5\xb3" => "\xc5\xb2",
325
+		"\xc5\xb5" => "\xc5\xb4", "\xc5\xb7" => "\xc5\xb6", "\xc3\xbf" => "\xc5\xb8", "\xc5\xba" => "\xc5\xb9",
326
+		"\xc5\xbc" => "\xc5\xbb", "\xc5\xbe" => "\xc5\xbd", "\xc9\x93" => "\xc6\x81",
327
+		"\xc6\x83" => "\xc6\x82", "\xc6\x85" => "\xc6\x84", "\xc9\x94" => "\xc6\x86", "\xc6\x88" => "\xc6\x87",
328
+		"\xc9\x96" => "\xc6\x89", "\xc9\x97" => "\xc6\x8a", "\xc6\x8c" => "\xc6\x8b", "\xc7\x9d" => "\xc6\x8e",
329
+		"\xc9\x99" => "\xc6\x8f", "\xc9\x9b" => "\xc6\x90", "\xc6\x92" => "\xc6\x91", "\xc9\xa0" => "\xc6\x93",
330
+		"\xc9\xa3" => "\xc6\x94", "\xc9\xa9" => "\xc6\x96", "\xc9\xa8" => "\xc6\x97", "\xc6\x99" => "\xc6\x98",
331
+		"\xc9\xaf" => "\xc6\x9c", "\xc9\xb2" => "\xc6\x9d", "\xc9\xb5" => "\xc6\x9f", "\xc6\xa1" => "\xc6\xa0",
332
+		"\xc6\xa3" => "\xc6\xa2", "\xc6\xa5" => "\xc6\xa4", "\xca\x80" => "\xc6\xa6", "\xc6\xa8" => "\xc6\xa7",
333
+		"\xca\x83" => "\xc6\xa9", "\xc6\xad" => "\xc6\xac", "\xca\x88" => "\xc6\xae", "\xc6\xb0" => "\xc6\xaf",
334
+		"\xca\x8a" => "\xc6\xb1", "\xca\x8b" => "\xc6\xb2", "\xc6\xb4" => "\xc6\xb3", "\xc6\xb6" => "\xc6\xb5",
335
+		"\xca\x92" => "\xc6\xb7", "\xc6\xb9" => "\xc6\xb8", "\xc6\xbd" => "\xc6\xbc", "\xc7\x86" => "\xc7\x84",
336
+		"\xc7\x86" => "\xc7\x85", "\xc7\x89" => "\xc7\x87", "\xc7\x89" => "\xc7\x88", "\xc7\x8c" => "\xc7\x8a",
337
+		"\xc7\x8c" => "\xc7\x8b", "\xc7\x8e" => "\xc7\x8d", "\xc7\x90" => "\xc7\x8f", "\xc7\x92" => "\xc7\x91",
338
+		"\xc7\x94" => "\xc7\x93", "\xc7\x96" => "\xc7\x95", "\xc7\x98" => "\xc7\x97", "\xc7\x9a" => "\xc7\x99",
339
+		"\xc7\x9c" => "\xc7\x9b", "\xc7\x9f" => "\xc7\x9e", "\xc7\xa1" => "\xc7\xa0", "\xc7\xa3" => "\xc7\xa2",
340
+		"\xc7\xa5" => "\xc7\xa4", "\xc7\xa7" => "\xc7\xa6", "\xc7\xa9" => "\xc7\xa8", "\xc7\xab" => "\xc7\xaa",
341
+		"\xc7\xad" => "\xc7\xac", "\xc7\xaf" => "\xc7\xae", "j\xcc\x8c" => "\xc7\xb0", "\xc7\xb3" => "\xc7\xb1",
342
+		"\xc7\xb3" => "\xc7\xb2", "\xc7\xb5" => "\xc7\xb4", "\xc6\x95" => "\xc7\xb6", "\xc6\xbf" => "\xc7\xb7",
343
+		"\xc7\xb9" => "\xc7\xb8", "\xc7\xbb" => "\xc7\xba", "\xc7\xbd" => "\xc7\xbc", "\xc7\xbf" => "\xc7\xbe",
344
+		"\xc8\x81" => "\xc8\x80", "\xc8\x83" => "\xc8\x82", "\xc8\x85" => "\xc8\x84", "\xc8\x87" => "\xc8\x86",
345
+		"\xc8\x89" => "\xc8\x88", "\xc8\x8b" => "\xc8\x8a", "\xc8\x8d" => "\xc8\x8c", "\xc8\x8f" => "\xc8\x8e",
346
+		"\xc8\x91" => "\xc8\x90", "\xc8\x93" => "\xc8\x92", "\xc8\x95" => "\xc8\x94", "\xc8\x97" => "\xc8\x96",
347
+		"\xc8\x99" => "\xc8\x98", "\xc8\x9b" => "\xc8\x9a", "\xc8\x9d" => "\xc8\x9c", "\xc8\x9f" => "\xc8\x9e",
348
+		"\xc6\x9e" => "\xc8\xa0", "\xc8\xa3" => "\xc8\xa2", "\xc8\xa5" => "\xc8\xa4", "\xc8\xa7" => "\xc8\xa6",
349
+		"\xc8\xa9" => "\xc8\xa8", "\xc8\xab" => "\xc8\xaa", "\xc8\xad" => "\xc8\xac", "\xc8\xaf" => "\xc8\xae",
350
+		"\xc8\xb1" => "\xc8\xb0", "\xc8\xb3" => "\xc8\xb2", "\xe2\xb1\xa5" => "\xc8\xba", "\xc8\xbc" => "\xc8\xbb",
351
+		"\xc6\x9a" => "\xc8\xbd", "\xe2\xb1\xa6" => "\xc8\xbe", "\xc9\x82" => "\xc9\x81", "\xc6\x80" => "\xc9\x83",
352
+		"\xca\x89" => "\xc9\x84", "\xca\x8c" => "\xc9\x85", "\xc9\x87" => "\xc9\x86", "\xc9\x89" => "\xc9\x88",
353
+		"\xc9\x8b" => "\xc9\x8a", "\xc9\x8d" => "\xc9\x8c", "\xc9\x8f" => "\xc9\x8e", "\xce\xb9" => "\xcd\x85",
354
+		"\xce\xac" => "\xce\x86", "\xce\xad" => "\xce\x88", "\xce\xae" => "\xce\x89", "\xce\xaf" => "\xce\x8a",
355
+		"\xcf\x8c" => "\xce\x8c", "\xcf\x8d" => "\xce\x8e", "\xcf\x8e" => "\xce\x8f", "\xce\xb9\xcc\x88\xcc\x81" => "\xce\x90",
356
+		"\xce\xb1" => "\xce\x91", "\xce\xb2" => "\xce\x92", "\xce\xb3" => "\xce\x93", "\xce\xb4" => "\xce\x94",
357
+		"\xce\xb5" => "\xce\x95", "\xce\xb6" => "\xce\x96", "\xce\xb7" => "\xce\x97", "\xce\xb8" => "\xce\x98",
358
+		"\xce\xb9" => "\xce\x99", "\xce\xba" => "\xce\x9a", "\xce\xbb" => "\xce\x9b", "\xce\xbc" => "\xce\x9c",
359
+		"\xce\xbd" => "\xce\x9d", "\xce\xbe" => "\xce\x9e", "\xce\xbf" => "\xce\x9f", "\xcf\x80" => "\xce\xa0",
360
+		"\xcf\x81" => "\xce\xa1", "\xcf\x83" => "\xce\xa3", "\xcf\x84" => "\xce\xa4", "\xcf\x85" => "\xce\xa5",
361
+		"\xcf\x86" => "\xce\xa6", "\xcf\x87" => "\xce\xa7", "\xcf\x88" => "\xce\xa8", "\xcf\x89" => "\xce\xa9",
362
+		"\xcf\x8a" => "\xce\xaa", "\xcf\x8b" => "\xce\xab", "\xcf\x85\xcc\x88\xcc\x81" => "\xce\xb0", "\xcf\x83" => "\xcf\x82",
363
+		"\xce\xb2" => "\xcf\x90", "\xce\xb8" => "\xcf\x91", "\xcf\x86" => "\xcf\x95", "\xcf\x80" => "\xcf\x96",
364
+		"\xcf\x99" => "\xcf\x98", "\xcf\x9b" => "\xcf\x9a", "\xcf\x9d" => "\xcf\x9c", "\xcf\x9f" => "\xcf\x9e",
365
+		"\xcf\xa1" => "\xcf\xa0", "\xcf\xa3" => "\xcf\xa2", "\xcf\xa5" => "\xcf\xa4", "\xcf\xa7" => "\xcf\xa6",
366
+		"\xcf\xa9" => "\xcf\xa8", "\xcf\xab" => "\xcf\xaa", "\xcf\xad" => "\xcf\xac", "\xcf\xaf" => "\xcf\xae",
367
+		"\xce\xba" => "\xcf\xb0", "\xcf\x81" => "\xcf\xb1", "\xce\xb8" => "\xcf\xb4", "\xce\xb5" => "\xcf\xb5",
368
+		"\xcf\xb8" => "\xcf\xb7", "\xcf\xb2" => "\xcf\xb9", "\xcf\xbb" => "\xcf\xba", "\xcd\xbb" => "\xcf\xbd",
369
+		"\xcd\xbc" => "\xcf\xbe", "\xcd\xbd" => "\xcf\xbf", "\xd1\x90" => "\xd0\x80", "\xd1\x91" => "\xd0\x81",
370
+		"\xd1\x92" => "\xd0\x82", "\xd1\x93" => "\xd0\x83", "\xd1\x94" => "\xd0\x84", "\xd1\x95" => "\xd0\x85",
371
+		"\xd1\x96" => "\xd0\x86", "\xd1\x97" => "\xd0\x87", "\xd1\x98" => "\xd0\x88", "\xd1\x99" => "\xd0\x89",
372
+		"\xd1\x9a" => "\xd0\x8a", "\xd1\x9b" => "\xd0\x8b", "\xd1\x9c" => "\xd0\x8c", "\xd1\x9d" => "\xd0\x8d",
373
+		"\xd1\x9e" => "\xd0\x8e", "\xd1\x9f" => "\xd0\x8f", "\xd0\xb0" => "\xd0\x90", "\xd0\xb1" => "\xd0\x91",
374
+		"\xd0\xb2" => "\xd0\x92", "\xd0\xb3" => "\xd0\x93", "\xd0\xb4" => "\xd0\x94", "\xd0\xb5" => "\xd0\x95",
375
+		"\xd0\xb6" => "\xd0\x96", "\xd0\xb7" => "\xd0\x97", "\xd0\xb8" => "\xd0\x98", "\xd0\xb9" => "\xd0\x99",
376
+		"\xd0\xba" => "\xd0\x9a", "\xd0\xbb" => "\xd0\x9b", "\xd0\xbc" => "\xd0\x9c", "\xd0\xbd" => "\xd0\x9d",
377
+		"\xd0\xbe" => "\xd0\x9e", "\xd0\xbf" => "\xd0\x9f", "\xd1\x80" => "\xd0\xa0", "\xd1\x81" => "\xd0\xa1",
378
+		"\xd1\x82" => "\xd0\xa2", "\xd1\x83" => "\xd0\xa3", "\xd1\x84" => "\xd0\xa4", "\xd1\x85" => "\xd0\xa5",
379
+		"\xd1\x86" => "\xd0\xa6", "\xd1\x87" => "\xd0\xa7", "\xd1\x88" => "\xd0\xa8", "\xd1\x89" => "\xd0\xa9",
380
+		"\xd1\x8a" => "\xd0\xaa", "\xd1\x8b" => "\xd0\xab", "\xd1\x8c" => "\xd0\xac", "\xd1\x8d" => "\xd0\xad",
381
+		"\xd1\x8e" => "\xd0\xae", "\xd1\x8f" => "\xd0\xaf", "\xd1\xa1" => "\xd1\xa0", "\xd1\xa3" => "\xd1\xa2",
382
+		"\xd1\xa5" => "\xd1\xa4", "\xd1\xa7" => "\xd1\xa6", "\xd1\xa9" => "\xd1\xa8", "\xd1\xab" => "\xd1\xaa",
383
+		"\xd1\xad" => "\xd1\xac", "\xd1\xaf" => "\xd1\xae", "\xd1\xb1" => "\xd1\xb0", "\xd1\xb3" => "\xd1\xb2",
384
+		"\xd1\xb5" => "\xd1\xb4", "\xd1\xb7" => "\xd1\xb6", "\xd1\xb9" => "\xd1\xb8", "\xd1\xbb" => "\xd1\xba",
385
+		"\xd1\xbd" => "\xd1\xbc", "\xd1\xbf" => "\xd1\xbe", "\xd2\x81" => "\xd2\x80", "\xd2\x8b" => "\xd2\x8a",
386
+		"\xd2\x8d" => "\xd2\x8c", "\xd2\x8f" => "\xd2\x8e", "\xd2\x91" => "\xd2\x90", "\xd2\x93" => "\xd2\x92",
387
+		"\xd2\x95" => "\xd2\x94", "\xd2\x97" => "\xd2\x96", "\xd2\x99" => "\xd2\x98", "\xd2\x9b" => "\xd2\x9a",
388
+		"\xd2\x9d" => "\xd2\x9c", "\xd2\x9f" => "\xd2\x9e", "\xd2\xa1" => "\xd2\xa0", "\xd2\xa3" => "\xd2\xa2",
389
+		"\xd2\xa5" => "\xd2\xa4", "\xd2\xa7" => "\xd2\xa6", "\xd2\xa9" => "\xd2\xa8", "\xd2\xab" => "\xd2\xaa",
390
+		"\xd2\xad" => "\xd2\xac", "\xd2\xaf" => "\xd2\xae", "\xd2\xb1" => "\xd2\xb0", "\xd2\xb3" => "\xd2\xb2",
391
+		"\xd2\xb5" => "\xd2\xb4", "\xd2\xb7" => "\xd2\xb6", "\xd2\xb9" => "\xd2\xb8", "\xd2\xbb" => "\xd2\xba",
392
+		"\xd2\xbd" => "\xd2\xbc", "\xd2\xbf" => "\xd2\xbe", "\xd3\x8f" => "\xd3\x80", "\xd3\x82" => "\xd3\x81",
393
+		"\xd3\x84" => "\xd3\x83", "\xd3\x86" => "\xd3\x85", "\xd3\x88" => "\xd3\x87", "\xd3\x8a" => "\xd3\x89",
394
+		"\xd3\x8c" => "\xd3\x8b", "\xd3\x8e" => "\xd3\x8d", "\xd3\x91" => "\xd3\x90", "\xd3\x93" => "\xd3\x92",
395
+		"\xd3\x95" => "\xd3\x94", "\xd3\x97" => "\xd3\x96", "\xd3\x99" => "\xd3\x98", "\xd3\x9b" => "\xd3\x9a",
396
+		"\xd3\x9d" => "\xd3\x9c", "\xd3\x9f" => "\xd3\x9e", "\xd3\xa1" => "\xd3\xa0", "\xd3\xa3" => "\xd3\xa2",
397
+		"\xd3\xa5" => "\xd3\xa4", "\xd3\xa7" => "\xd3\xa6", "\xd3\xa9" => "\xd3\xa8", "\xd3\xab" => "\xd3\xaa",
398
+		"\xd3\xad" => "\xd3\xac", "\xd3\xaf" => "\xd3\xae", "\xd3\xb1" => "\xd3\xb0", "\xd3\xb3" => "\xd3\xb2",
399
+		"\xd3\xb5" => "\xd3\xb4", "\xd3\xb7" => "\xd3\xb6", "\xd3\xb9" => "\xd3\xb8", "\xd3\xbb" => "\xd3\xba",
400
+		"\xd3\xbd" => "\xd3\xbc", "\xd3\xbf" => "\xd3\xbe", "\xd4\x81" => "\xd4\x80", "\xd4\x83" => "\xd4\x82",
401
+		"\xd4\x85" => "\xd4\x84", "\xd4\x87" => "\xd4\x86", "\xd4\x89" => "\xd4\x88", "\xd4\x8b" => "\xd4\x8a",
402
+		"\xd4\x8d" => "\xd4\x8c", "\xd4\x8f" => "\xd4\x8e", "\xd4\x91" => "\xd4\x90", "\xd4\x93" => "\xd4\x92",
403
+		"\xd5\xa1" => "\xd4\xb1", "\xd5\xa2" => "\xd4\xb2", "\xd5\xa3" => "\xd4\xb3", "\xd5\xa4" => "\xd4\xb4",
404
+		"\xd5\xa5" => "\xd4\xb5", "\xd5\xa6" => "\xd4\xb6", "\xd5\xa7" => "\xd4\xb7", "\xd5\xa8" => "\xd4\xb8",
405
+		"\xd5\xa9" => "\xd4\xb9", "\xd5\xaa" => "\xd4\xba", "\xd5\xab" => "\xd4\xbb", "\xd5\xac" => "\xd4\xbc",
406
+		"\xd5\xad" => "\xd4\xbd", "\xd5\xae" => "\xd4\xbe", "\xd5\xaf" => "\xd4\xbf", "\xd5\xb0" => "\xd5\x80",
407
+		"\xd5\xb1" => "\xd5\x81", "\xd5\xb2" => "\xd5\x82", "\xd5\xb3" => "\xd5\x83", "\xd5\xb4" => "\xd5\x84",
408
+		"\xd5\xb5" => "\xd5\x85", "\xd5\xb6" => "\xd5\x86", "\xd5\xb7" => "\xd5\x87", "\xd5\xb8" => "\xd5\x88",
409
+		"\xd5\xb9" => "\xd5\x89", "\xd5\xba" => "\xd5\x8a", "\xd5\xbb" => "\xd5\x8b", "\xd5\xbc" => "\xd5\x8c",
410
+		"\xd5\xbd" => "\xd5\x8d", "\xd5\xbe" => "\xd5\x8e", "\xd5\xbf" => "\xd5\x8f", "\xd6\x80" => "\xd5\x90",
411
+		"\xd6\x81" => "\xd5\x91", "\xd6\x82" => "\xd5\x92", "\xd6\x83" => "\xd5\x93", "\xd6\x84" => "\xd5\x94",
412
+		"\xd6\x85" => "\xd5\x95", "\xd6\x86" => "\xd5\x96", "\xd5\xa5\xd6\x82" => "\xd6\x87", "\xe2\xb4\x80" => "\xe1\x82\xa0",
413
+		"\xe2\xb4\x81" => "\xe1\x82\xa1", "\xe2\xb4\x82" => "\xe1\x82\xa2", "\xe2\xb4\x83" => "\xe1\x82\xa3", "\xe2\xb4\x84" => "\xe1\x82\xa4",
414
+		"\xe2\xb4\x85" => "\xe1\x82\xa5", "\xe2\xb4\x86" => "\xe1\x82\xa6", "\xe2\xb4\x87" => "\xe1\x82\xa7", "\xe2\xb4\x88" => "\xe1\x82\xa8",
415
+		"\xe2\xb4\x89" => "\xe1\x82\xa9", "\xe2\xb4\x8a" => "\xe1\x82\xaa", "\xe2\xb4\x8b" => "\xe1\x82\xab", "\xe2\xb4\x8c" => "\xe1\x82\xac",
416
+		"\xe2\xb4\x8d" => "\xe1\x82\xad", "\xe2\xb4\x8e" => "\xe1\x82\xae", "\xe2\xb4\x8f" => "\xe1\x82\xaf", "\xe2\xb4\x90" => "\xe1\x82\xb0",
417
+		"\xe2\xb4\x91" => "\xe1\x82\xb1", "\xe2\xb4\x92" => "\xe1\x82\xb2", "\xe2\xb4\x93" => "\xe1\x82\xb3", "\xe2\xb4\x94" => "\xe1\x82\xb4",
418
+		"\xe2\xb4\x95" => "\xe1\x82\xb5", "\xe2\xb4\x96" => "\xe1\x82\xb6", "\xe2\xb4\x97" => "\xe1\x82\xb7", "\xe2\xb4\x98" => "\xe1\x82\xb8",
419
+		"\xe2\xb4\x99" => "\xe1\x82\xb9", "\xe2\xb4\x9a" => "\xe1\x82\xba", "\xe2\xb4\x9b" => "\xe1\x82\xbb", "\xe2\xb4\x9c" => "\xe1\x82\xbc",
420
+		"\xe2\xb4\x9d" => "\xe1\x82\xbd", "\xe2\xb4\x9e" => "\xe1\x82\xbe", "\xe2\xb4\x9f" => "\xe1\x82\xbf", "\xe2\xb4\xa0" => "\xe1\x83\x80",
421
+		"\xe2\xb4\xa1" => "\xe1\x83\x81", "\xe2\xb4\xa2" => "\xe1\x83\x82", "\xe2\xb4\xa3" => "\xe1\x83\x83", "\xe2\xb4\xa4" => "\xe1\x83\x84",
422
+		"\xe2\xb4\xa5" => "\xe1\x83\x85", "\xe1\xb8\x81" => "\xe1\xb8\x80", "\xe1\xb8\x83" => "\xe1\xb8\x82", "\xe1\xb8\x85" => "\xe1\xb8\x84",
423
+		"\xe1\xb8\x87" => "\xe1\xb8\x86", "\xe1\xb8\x89" => "\xe1\xb8\x88", "\xe1\xb8\x8b" => "\xe1\xb8\x8a", "\xe1\xb8\x8d" => "\xe1\xb8\x8c",
424
+		"\xe1\xb8\x8f" => "\xe1\xb8\x8e", "\xe1\xb8\x91" => "\xe1\xb8\x90", "\xe1\xb8\x93" => "\xe1\xb8\x92", "\xe1\xb8\x95" => "\xe1\xb8\x94",
425
+		"\xe1\xb8\x97" => "\xe1\xb8\x96", "\xe1\xb8\x99" => "\xe1\xb8\x98", "\xe1\xb8\x9b" => "\xe1\xb8\x9a", "\xe1\xb8\x9d" => "\xe1\xb8\x9c",
426
+		"\xe1\xb8\x9f" => "\xe1\xb8\x9e", "\xe1\xb8\xa1" => "\xe1\xb8\xa0", "\xe1\xb8\xa3" => "\xe1\xb8\xa2", "\xe1\xb8\xa5" => "\xe1\xb8\xa4",
427
+		"\xe1\xb8\xa7" => "\xe1\xb8\xa6", "\xe1\xb8\xa9" => "\xe1\xb8\xa8", "\xe1\xb8\xab" => "\xe1\xb8\xaa", "\xe1\xb8\xad" => "\xe1\xb8\xac",
428
+		"\xe1\xb8\xaf" => "\xe1\xb8\xae", "\xe1\xb8\xb1" => "\xe1\xb8\xb0", "\xe1\xb8\xb3" => "\xe1\xb8\xb2", "\xe1\xb8\xb5" => "\xe1\xb8\xb4",
429
+		"\xe1\xb8\xb7" => "\xe1\xb8\xb6", "\xe1\xb8\xb9" => "\xe1\xb8\xb8", "\xe1\xb8\xbb" => "\xe1\xb8\xba", "\xe1\xb8\xbd" => "\xe1\xb8\xbc",
430
+		"\xe1\xb8\xbf" => "\xe1\xb8\xbe", "\xe1\xb9\x81" => "\xe1\xb9\x80", "\xe1\xb9\x83" => "\xe1\xb9\x82", "\xe1\xb9\x85" => "\xe1\xb9\x84",
431
+		"\xe1\xb9\x87" => "\xe1\xb9\x86", "\xe1\xb9\x89" => "\xe1\xb9\x88", "\xe1\xb9\x8b" => "\xe1\xb9\x8a", "\xe1\xb9\x8d" => "\xe1\xb9\x8c",
432
+		"\xe1\xb9\x8f" => "\xe1\xb9\x8e", "\xe1\xb9\x91" => "\xe1\xb9\x90", "\xe1\xb9\x93" => "\xe1\xb9\x92", "\xe1\xb9\x95" => "\xe1\xb9\x94",
433
+		"\xe1\xb9\x97" => "\xe1\xb9\x96", "\xe1\xb9\x99" => "\xe1\xb9\x98", "\xe1\xb9\x9b" => "\xe1\xb9\x9a", "\xe1\xb9\x9d" => "\xe1\xb9\x9c",
434
+		"\xe1\xb9\x9f" => "\xe1\xb9\x9e", "\xe1\xb9\xa1" => "\xe1\xb9\xa0", "\xe1\xb9\xa3" => "\xe1\xb9\xa2", "\xe1\xb9\xa5" => "\xe1\xb9\xa4",
435
+		"\xe1\xb9\xa7" => "\xe1\xb9\xa6", "\xe1\xb9\xa9" => "\xe1\xb9\xa8", "\xe1\xb9\xab" => "\xe1\xb9\xaa", "\xe1\xb9\xad" => "\xe1\xb9\xac",
436
+		"\xe1\xb9\xaf" => "\xe1\xb9\xae", "\xe1\xb9\xb1" => "\xe1\xb9\xb0", "\xe1\xb9\xb3" => "\xe1\xb9\xb2", "\xe1\xb9\xb5" => "\xe1\xb9\xb4",
437
+		"\xe1\xb9\xb7" => "\xe1\xb9\xb6", "\xe1\xb9\xb9" => "\xe1\xb9\xb8", "\xe1\xb9\xbb" => "\xe1\xb9\xba", "\xe1\xb9\xbd" => "\xe1\xb9\xbc",
438
+		"\xe1\xb9\xbf" => "\xe1\xb9\xbe", "\xe1\xba\x81" => "\xe1\xba\x80", "\xe1\xba\x83" => "\xe1\xba\x82", "\xe1\xba\x85" => "\xe1\xba\x84",
439
+		"\xe1\xba\x87" => "\xe1\xba\x86", "\xe1\xba\x89" => "\xe1\xba\x88", "\xe1\xba\x8b" => "\xe1\xba\x8a", "\xe1\xba\x8d" => "\xe1\xba\x8c",
440
+		"\xe1\xba\x8f" => "\xe1\xba\x8e", "\xe1\xba\x91" => "\xe1\xba\x90", "\xe1\xba\x93" => "\xe1\xba\x92", "\xe1\xba\x95" => "\xe1\xba\x94",
441
+		"h\xcc\xb1" => "\xe1\xba\x96", "t\xcc\x88" => "\xe1\xba\x97", "w\xcc\x8a" => "\xe1\xba\x98", "y\xcc\x8a" => "\xe1\xba\x99",
442
+		"a\xca\xbe" => "\xe1\xba\x9a", "\xe1\xb9\xa1" => "\xe1\xba\x9b", "\xe1\xba\xa1" => "\xe1\xba\xa0", "\xe1\xba\xa3" => "\xe1\xba\xa2",
443
+		"\xe1\xba\xa5" => "\xe1\xba\xa4", "\xe1\xba\xa7" => "\xe1\xba\xa6", "\xe1\xba\xa9" => "\xe1\xba\xa8", "\xe1\xba\xab" => "\xe1\xba\xaa",
444
+		"\xe1\xba\xad" => "\xe1\xba\xac", "\xe1\xba\xaf" => "\xe1\xba\xae", "\xe1\xba\xb1" => "\xe1\xba\xb0", "\xe1\xba\xb3" => "\xe1\xba\xb2",
445
+		"\xe1\xba\xb5" => "\xe1\xba\xb4", "\xe1\xba\xb7" => "\xe1\xba\xb6", "\xe1\xba\xb9" => "\xe1\xba\xb8", "\xe1\xba\xbb" => "\xe1\xba\xba",
446
+		"\xe1\xba\xbd" => "\xe1\xba\xbc", "\xe1\xba\xbf" => "\xe1\xba\xbe", "\xe1\xbb\x81" => "\xe1\xbb\x80", "\xe1\xbb\x83" => "\xe1\xbb\x82",
447
+		"\xe1\xbb\x85" => "\xe1\xbb\x84", "\xe1\xbb\x87" => "\xe1\xbb\x86", "\xe1\xbb\x89" => "\xe1\xbb\x88", "\xe1\xbb\x8b" => "\xe1\xbb\x8a",
448
+		"\xe1\xbb\x8d" => "\xe1\xbb\x8c", "\xe1\xbb\x8f" => "\xe1\xbb\x8e", "\xe1\xbb\x91" => "\xe1\xbb\x90", "\xe1\xbb\x93" => "\xe1\xbb\x92",
449
+		"\xe1\xbb\x95" => "\xe1\xbb\x94", "\xe1\xbb\x97" => "\xe1\xbb\x96", "\xe1\xbb\x99" => "\xe1\xbb\x98", "\xe1\xbb\x9b" => "\xe1\xbb\x9a",
450
+		"\xe1\xbb\x9d" => "\xe1\xbb\x9c", "\xe1\xbb\x9f" => "\xe1\xbb\x9e", "\xe1\xbb\xa1" => "\xe1\xbb\xa0", "\xe1\xbb\xa3" => "\xe1\xbb\xa2",
451
+		"\xe1\xbb\xa5" => "\xe1\xbb\xa4", "\xe1\xbb\xa7" => "\xe1\xbb\xa6", "\xe1\xbb\xa9" => "\xe1\xbb\xa8", "\xe1\xbb\xab" => "\xe1\xbb\xaa",
452
+		"\xe1\xbb\xad" => "\xe1\xbb\xac", "\xe1\xbb\xaf" => "\xe1\xbb\xae", "\xe1\xbb\xb1" => "\xe1\xbb\xb0", "\xe1\xbb\xb3" => "\xe1\xbb\xb2",
453
+		"\xe1\xbb\xb5" => "\xe1\xbb\xb4", "\xe1\xbb\xb7" => "\xe1\xbb\xb6", "\xe1\xbb\xb9" => "\xe1\xbb\xb8", "\xe1\xbc\x80" => "\xe1\xbc\x88",
454
+		"\xe1\xbc\x81" => "\xe1\xbc\x89", "\xe1\xbc\x82" => "\xe1\xbc\x8a", "\xe1\xbc\x83" => "\xe1\xbc\x8b", "\xe1\xbc\x84" => "\xe1\xbc\x8c",
455
+		"\xe1\xbc\x85" => "\xe1\xbc\x8d", "\xe1\xbc\x86" => "\xe1\xbc\x8e", "\xe1\xbc\x87" => "\xe1\xbc\x8f", "\xe1\xbc\x90" => "\xe1\xbc\x98",
456
+		"\xe1\xbc\x91" => "\xe1\xbc\x99", "\xe1\xbc\x92" => "\xe1\xbc\x9a", "\xe1\xbc\x93" => "\xe1\xbc\x9b", "\xe1\xbc\x94" => "\xe1\xbc\x9c",
457
+		"\xe1\xbc\x95" => "\xe1\xbc\x9d", "\xe1\xbc\xa0" => "\xe1\xbc\xa8", "\xe1\xbc\xa1" => "\xe1\xbc\xa9", "\xe1\xbc\xa2" => "\xe1\xbc\xaa",
458
+		"\xe1\xbc\xa3" => "\xe1\xbc\xab", "\xe1\xbc\xa4" => "\xe1\xbc\xac", "\xe1\xbc\xa5" => "\xe1\xbc\xad", "\xe1\xbc\xa6" => "\xe1\xbc\xae",
459
+		"\xe1\xbc\xa7" => "\xe1\xbc\xaf", "\xe1\xbc\xb0" => "\xe1\xbc\xb8", "\xe1\xbc\xb1" => "\xe1\xbc\xb9", "\xe1\xbc\xb2" => "\xe1\xbc\xba",
460
+		"\xe1\xbc\xb3" => "\xe1\xbc\xbb", "\xe1\xbc\xb4" => "\xe1\xbc\xbc", "\xe1\xbc\xb5" => "\xe1\xbc\xbd", "\xe1\xbc\xb6" => "\xe1\xbc\xbe",
461
+		"\xe1\xbc\xb7" => "\xe1\xbc\xbf", "\xe1\xbd\x80" => "\xe1\xbd\x88", "\xe1\xbd\x81" => "\xe1\xbd\x89", "\xe1\xbd\x82" => "\xe1\xbd\x8a",
462
+		"\xe1\xbd\x83" => "\xe1\xbd\x8b", "\xe1\xbd\x84" => "\xe1\xbd\x8c", "\xe1\xbd\x85" => "\xe1\xbd\x8d", "\xcf\x85\xcc\x93" => "\xe1\xbd\x90",
463
+		"\xcf\x85\xcc\x93\xcc\x80" => "\xe1\xbd\x92", "\xcf\x85\xcc\x93\xcc\x81" => "\xe1\xbd\x94", "\xcf\x85\xcc\x93\xcd\x82" => "\xe1\xbd\x96", "\xe1\xbd\x91" => "\xe1\xbd\x99",
464
+		"\xe1\xbd\x93" => "\xe1\xbd\x9b", "\xe1\xbd\x95" => "\xe1\xbd\x9d", "\xe1\xbd\x97" => "\xe1\xbd\x9f", "\xe1\xbd\xa0" => "\xe1\xbd\xa8",
465
+		"\xe1\xbd\xa1" => "\xe1\xbd\xa9", "\xe1\xbd\xa2" => "\xe1\xbd\xaa", "\xe1\xbd\xa3" => "\xe1\xbd\xab", "\xe1\xbd\xa4" => "\xe1\xbd\xac",
466
+		"\xe1\xbd\xa5" => "\xe1\xbd\xad", "\xe1\xbd\xa6" => "\xe1\xbd\xae", "\xe1\xbd\xa7" => "\xe1\xbd\xaf", "\xe1\xbc\x80\xce\xb9" => "\xe1\xbe\x80",
467
+		"\xe1\xbc\x81\xce\xb9" => "\xe1\xbe\x81", "\xe1\xbc\x82\xce\xb9" => "\xe1\xbe\x82", "\xe1\xbc\x83\xce\xb9" => "\xe1\xbe\x83", "\xe1\xbc\x84\xce\xb9" => "\xe1\xbe\x84",
468
+		"\xe1\xbc\x85\xce\xb9" => "\xe1\xbe\x85", "\xe1\xbc\x86\xce\xb9" => "\xe1\xbe\x86", "\xe1\xbc\x87\xce\xb9" => "\xe1\xbe\x87", "\xe1\xbe\x80" => "\xe1\xbe\x88",
469
+		"\xe1\xbe\x81" => "\xe1\xbe\x89", "\xe1\xbe\x82" => "\xe1\xbe\x8a", "\xe1\xbe\x83" => "\xe1\xbe\x8b", "\xe1\xbe\x84" => "\xe1\xbe\x8c",
470
+		"\xe1\xbe\x85" => "\xe1\xbe\x8d", "\xe1\xbe\x86" => "\xe1\xbe\x8e", "\xe1\xbe\x87" => "\xe1\xbe\x8f", "\xe1\xbc\xa0\xce\xb9" => "\xe1\xbe\x90",
471
+		"\xe1\xbc\xa1\xce\xb9" => "\xe1\xbe\x91", "\xe1\xbc\xa2\xce\xb9" => "\xe1\xbe\x92", "\xe1\xbc\xa3\xce\xb9" => "\xe1\xbe\x93", "\xe1\xbc\xa4\xce\xb9" => "\xe1\xbe\x94",
472
+		"\xe1\xbc\xa5\xce\xb9" => "\xe1\xbe\x95", "\xe1\xbc\xa6\xce\xb9" => "\xe1\xbe\x96", "\xe1\xbc\xa7\xce\xb9" => "\xe1\xbe\x97", "\xe1\xbe\x90" => "\xe1\xbe\x98",
473
+		"\xe1\xbe\x91" => "\xe1\xbe\x99", "\xe1\xbe\x92" => "\xe1\xbe\x9a", "\xe1\xbe\x93" => "\xe1\xbe\x9b", "\xe1\xbe\x94" => "\xe1\xbe\x9c",
474
+		"\xe1\xbe\x95" => "\xe1\xbe\x9d", "\xe1\xbe\x96" => "\xe1\xbe\x9e", "\xe1\xbe\x97" => "\xe1\xbe\x9f", "\xe1\xbd\xa0\xce\xb9" => "\xe1\xbe\xa0",
475
+		"\xe1\xbd\xa1\xce\xb9" => "\xe1\xbe\xa1", "\xe1\xbd\xa2\xce\xb9" => "\xe1\xbe\xa2", "\xe1\xbd\xa3\xce\xb9" => "\xe1\xbe\xa3", "\xe1\xbd\xa4\xce\xb9" => "\xe1\xbe\xa4",
476
+		"\xe1\xbd\xa5\xce\xb9" => "\xe1\xbe\xa5", "\xe1\xbd\xa6\xce\xb9" => "\xe1\xbe\xa6", "\xe1\xbd\xa7\xce\xb9" => "\xe1\xbe\xa7", "\xe1\xbe\xa0" => "\xe1\xbe\xa8",
477
+		"\xe1\xbe\xa1" => "\xe1\xbe\xa9", "\xe1\xbe\xa2" => "\xe1\xbe\xaa", "\xe1\xbe\xa3" => "\xe1\xbe\xab", "\xe1\xbe\xa4" => "\xe1\xbe\xac",
478
+		"\xe1\xbe\xa5" => "\xe1\xbe\xad", "\xe1\xbe\xa6" => "\xe1\xbe\xae", "\xe1\xbe\xa7" => "\xe1\xbe\xaf", "\xe1\xbd\xb0\xce\xb9" => "\xe1\xbe\xb2",
479
+		"\xce\xb1\xce\xb9" => "\xe1\xbe\xb3", "\xce\xac\xce\xb9" => "\xe1\xbe\xb4", "\xce\xb1\xcd\x82" => "\xe1\xbe\xb6", "\xce\xb1\xcd\x82\xce\xb9" => "\xe1\xbe\xb7",
480
+		"\xe1\xbe\xb0" => "\xe1\xbe\xb8", "\xe1\xbe\xb1" => "\xe1\xbe\xb9", "\xe1\xbd\xb0" => "\xe1\xbe\xba", "\xe1\xbd\xb1" => "\xe1\xbe\xbb",
481
+		"\xe1\xbe\xb3" => "\xe1\xbe\xbc", "\xce\xb9" => "\xe1\xbe\xbe", "\xe1\xbd\xb4\xce\xb9" => "\xe1\xbf\x82", "\xce\xb7\xce\xb9" => "\xe1\xbf\x83",
482
+		"\xce\xae\xce\xb9" => "\xe1\xbf\x84", "\xce\xb7\xcd\x82" => "\xe1\xbf\x86", "\xce\xb7\xcd\x82\xce\xb9" => "\xe1\xbf\x87", "\xe1\xbd\xb2" => "\xe1\xbf\x88",
483
+		"\xe1\xbd\xb3" => "\xe1\xbf\x89", "\xe1\xbd\xb4" => "\xe1\xbf\x8a", "\xe1\xbd\xb5" => "\xe1\xbf\x8b", "\xe1\xbf\x83" => "\xe1\xbf\x8c",
484
+		"\xce\xb9\xcc\x88\xcc\x80" => "\xe1\xbf\x92", "\xce\xb9\xcc\x88\xcc\x81" => "\xe1\xbf\x93", "\xce\xb9\xcd\x82" => "\xe1\xbf\x96", "\xce\xb9\xcc\x88\xcd\x82" => "\xe1\xbf\x97",
485
+		"\xe1\xbf\x90" => "\xe1\xbf\x98", "\xe1\xbf\x91" => "\xe1\xbf\x99", "\xe1\xbd\xb6" => "\xe1\xbf\x9a", "\xe1\xbd\xb7" => "\xe1\xbf\x9b",
486
+		"\xcf\x85\xcc\x88\xcc\x80" => "\xe1\xbf\xa2", "\xcf\x85\xcc\x88\xcc\x81" => "\xe1\xbf\xa3", "\xcf\x81\xcc\x93" => "\xe1\xbf\xa4", "\xcf\x85\xcd\x82" => "\xe1\xbf\xa6",
487
+		"\xcf\x85\xcc\x88\xcd\x82" => "\xe1\xbf\xa7", "\xe1\xbf\xa0" => "\xe1\xbf\xa8", "\xe1\xbf\xa1" => "\xe1\xbf\xa9", "\xe1\xbd\xba" => "\xe1\xbf\xaa",
488
+		"\xe1\xbd\xbb" => "\xe1\xbf\xab", "\xe1\xbf\xa5" => "\xe1\xbf\xac", "\xe1\xbd\xbc\xce\xb9" => "\xe1\xbf\xb2", "\xcf\x89\xce\xb9" => "\xe1\xbf\xb3",
489
+		"\xcf\x8e\xce\xb9" => "\xe1\xbf\xb4", "\xcf\x89\xcd\x82" => "\xe1\xbf\xb6", "\xcf\x89\xcd\x82\xce\xb9" => "\xe1\xbf\xb7", "\xe1\xbd\xb8" => "\xe1\xbf\xb8",
490
+		"\xe1\xbd\xb9" => "\xe1\xbf\xb9", "\xe1\xbd\xbc" => "\xe1\xbf\xba", "\xe1\xbd\xbd" => "\xe1\xbf\xbb", "\xe1\xbf\xb3" => "\xe1\xbf\xbc",
491
+		"\xcf\x89" => "\xe2\x84\xa6", "k" => "\xe2\x84\xaa", "\xc3\xa5" => "\xe2\x84\xab", "\xe2\x85\x8e" => "\xe2\x84\xb2",
492
+		"\xe2\x85\xb0" => "\xe2\x85\xa0", "\xe2\x85\xb1" => "\xe2\x85\xa1", "\xe2\x85\xb2" => "\xe2\x85\xa2", "\xe2\x85\xb3" => "\xe2\x85\xa3",
493
+		"\xe2\x85\xb4" => "\xe2\x85\xa4", "\xe2\x85\xb5" => "\xe2\x85\xa5", "\xe2\x85\xb6" => "\xe2\x85\xa6", "\xe2\x85\xb7" => "\xe2\x85\xa7",
494
+		"\xe2\x85\xb8" => "\xe2\x85\xa8", "\xe2\x85\xb9" => "\xe2\x85\xa9", "\xe2\x85\xba" => "\xe2\x85\xaa", "\xe2\x85\xbb" => "\xe2\x85\xab",
495
+		"\xe2\x85\xbc" => "\xe2\x85\xac", "\xe2\x85\xbd" => "\xe2\x85\xad", "\xe2\x85\xbe" => "\xe2\x85\xae", "\xe2\x85\xbf" => "\xe2\x85\xaf",
496
+		"\xe2\x86\x84" => "\xe2\x86\x83", "\xe2\x93\x90" => "\xe2\x92\xb6", "\xe2\x93\x91" => "\xe2\x92\xb7", "\xe2\x93\x92" => "\xe2\x92\xb8",
497
+		"\xe2\x93\x93" => "\xe2\x92\xb9", "\xe2\x93\x94" => "\xe2\x92\xba", "\xe2\x93\x95" => "\xe2\x92\xbb", "\xe2\x93\x96" => "\xe2\x92\xbc",
498
+		"\xe2\x93\x97" => "\xe2\x92\xbd", "\xe2\x93\x98" => "\xe2\x92\xbe", "\xe2\x93\x99" => "\xe2\x92\xbf", "\xe2\x93\x9a" => "\xe2\x93\x80",
499
+		"\xe2\x93\x9b" => "\xe2\x93\x81", "\xe2\x93\x9c" => "\xe2\x93\x82", "\xe2\x93\x9d" => "\xe2\x93\x83", "\xe2\x93\x9e" => "\xe2\x93\x84",
500
+		"\xe2\x93\x9f" => "\xe2\x93\x85", "\xe2\x93\xa0" => "\xe2\x93\x86", "\xe2\x93\xa1" => "\xe2\x93\x87", "\xe2\x93\xa2" => "\xe2\x93\x88",
501
+		"\xe2\x93\xa3" => "\xe2\x93\x89", "\xe2\x93\xa4" => "\xe2\x93\x8a", "\xe2\x93\xa5" => "\xe2\x93\x8b", "\xe2\x93\xa6" => "\xe2\x93\x8c",
502
+		"\xe2\x93\xa7" => "\xe2\x93\x8d", "\xe2\x93\xa8" => "\xe2\x93\x8e", "\xe2\x93\xa9" => "\xe2\x93\x8f", "\xe2\xb0\xb0" => "\xe2\xb0\x80",
503
+		"\xe2\xb0\xb1" => "\xe2\xb0\x81", "\xe2\xb0\xb2" => "\xe2\xb0\x82", "\xe2\xb0\xb3" => "\xe2\xb0\x83", "\xe2\xb0\xb4" => "\xe2\xb0\x84",
504
+		"\xe2\xb0\xb5" => "\xe2\xb0\x85", "\xe2\xb0\xb6" => "\xe2\xb0\x86", "\xe2\xb0\xb7" => "\xe2\xb0\x87", "\xe2\xb0\xb8" => "\xe2\xb0\x88",
505
+		"\xe2\xb0\xb9" => "\xe2\xb0\x89", "\xe2\xb0\xba" => "\xe2\xb0\x8a", "\xe2\xb0\xbb" => "\xe2\xb0\x8b", "\xe2\xb0\xbc" => "\xe2\xb0\x8c",
506
+		"\xe2\xb0\xbd" => "\xe2\xb0\x8d", "\xe2\xb0\xbe" => "\xe2\xb0\x8e", "\xe2\xb0\xbf" => "\xe2\xb0\x8f", "\xe2\xb1\x80" => "\xe2\xb0\x90",
507
+		"\xe2\xb1\x81" => "\xe2\xb0\x91", "\xe2\xb1\x82" => "\xe2\xb0\x92", "\xe2\xb1\x83" => "\xe2\xb0\x93", "\xe2\xb1\x84" => "\xe2\xb0\x94",
508
+		"\xe2\xb1\x85" => "\xe2\xb0\x95", "\xe2\xb1\x86" => "\xe2\xb0\x96", "\xe2\xb1\x87" => "\xe2\xb0\x97", "\xe2\xb1\x88" => "\xe2\xb0\x98",
509
+		"\xe2\xb1\x89" => "\xe2\xb0\x99", "\xe2\xb1\x8a" => "\xe2\xb0\x9a", "\xe2\xb1\x8b" => "\xe2\xb0\x9b", "\xe2\xb1\x8c" => "\xe2\xb0\x9c",
510
+		"\xe2\xb1\x8d" => "\xe2\xb0\x9d", "\xe2\xb1\x8e" => "\xe2\xb0\x9e", "\xe2\xb1\x8f" => "\xe2\xb0\x9f", "\xe2\xb1\x90" => "\xe2\xb0\xa0",
511
+		"\xe2\xb1\x91" => "\xe2\xb0\xa1", "\xe2\xb1\x92" => "\xe2\xb0\xa2", "\xe2\xb1\x93" => "\xe2\xb0\xa3", "\xe2\xb1\x94" => "\xe2\xb0\xa4",
512
+		"\xe2\xb1\x95" => "\xe2\xb0\xa5", "\xe2\xb1\x96" => "\xe2\xb0\xa6", "\xe2\xb1\x97" => "\xe2\xb0\xa7", "\xe2\xb1\x98" => "\xe2\xb0\xa8",
513
+		"\xe2\xb1\x99" => "\xe2\xb0\xa9", "\xe2\xb1\x9a" => "\xe2\xb0\xaa", "\xe2\xb1\x9b" => "\xe2\xb0\xab", "\xe2\xb1\x9c" => "\xe2\xb0\xac",
514
+		"\xe2\xb1\x9d" => "\xe2\xb0\xad", "\xe2\xb1\x9e" => "\xe2\xb0\xae", "\xe2\xb1\xa1" => "\xe2\xb1\xa0", "\xc9\xab" => "\xe2\xb1\xa2",
515
+		"\xe1\xb5\xbd" => "\xe2\xb1\xa3", "\xc9\xbd" => "\xe2\xb1\xa4", "\xe2\xb1\xa8" => "\xe2\xb1\xa7", "\xe2\xb1\xaa" => "\xe2\xb1\xa9",
516
+		"\xe2\xb1\xac" => "\xe2\xb1\xab", "\xe2\xb1\xb6" => "\xe2\xb1\xb5", "\xe2\xb2\x81" => "\xe2\xb2\x80", "\xe2\xb2\x83" => "\xe2\xb2\x82",
517
+		"\xe2\xb2\x85" => "\xe2\xb2\x84", "\xe2\xb2\x87" => "\xe2\xb2\x86", "\xe2\xb2\x89" => "\xe2\xb2\x88", "\xe2\xb2\x8b" => "\xe2\xb2\x8a",
518
+		"\xe2\xb2\x8d" => "\xe2\xb2\x8c", "\xe2\xb2\x8f" => "\xe2\xb2\x8e", "\xe2\xb2\x91" => "\xe2\xb2\x90", "\xe2\xb2\x93" => "\xe2\xb2\x92",
519
+		"\xe2\xb2\x95" => "\xe2\xb2\x94", "\xe2\xb2\x97" => "\xe2\xb2\x96", "\xe2\xb2\x99" => "\xe2\xb2\x98", "\xe2\xb2\x9b" => "\xe2\xb2\x9a",
520
+		"\xe2\xb2\x9d" => "\xe2\xb2\x9c", "\xe2\xb2\x9f" => "\xe2\xb2\x9e", "\xe2\xb2\xa1" => "\xe2\xb2\xa0", "\xe2\xb2\xa3" => "\xe2\xb2\xa2",
521
+		"\xe2\xb2\xa5" => "\xe2\xb2\xa4", "\xe2\xb2\xa7" => "\xe2\xb2\xa6", "\xe2\xb2\xa9" => "\xe2\xb2\xa8", "\xe2\xb2\xab" => "\xe2\xb2\xaa",
522
+		"\xe2\xb2\xad" => "\xe2\xb2\xac", "\xe2\xb2\xaf" => "\xe2\xb2\xae", "\xe2\xb2\xb1" => "\xe2\xb2\xb0", "\xe2\xb2\xb3" => "\xe2\xb2\xb2",
523
+		"\xe2\xb2\xb5" => "\xe2\xb2\xb4", "\xe2\xb2\xb7" => "\xe2\xb2\xb6", "\xe2\xb2\xb9" => "\xe2\xb2\xb8", "\xe2\xb2\xbb" => "\xe2\xb2\xba",
524
+		"\xe2\xb2\xbd" => "\xe2\xb2\xbc", "\xe2\xb2\xbf" => "\xe2\xb2\xbe", "\xe2\xb3\x81" => "\xe2\xb3\x80", "\xe2\xb3\x83" => "\xe2\xb3\x82",
525
+		"\xe2\xb3\x85" => "\xe2\xb3\x84", "\xe2\xb3\x87" => "\xe2\xb3\x86", "\xe2\xb3\x89" => "\xe2\xb3\x88", "\xe2\xb3\x8b" => "\xe2\xb3\x8a",
526
+		"\xe2\xb3\x8d" => "\xe2\xb3\x8c", "\xe2\xb3\x8f" => "\xe2\xb3\x8e", "\xe2\xb3\x91" => "\xe2\xb3\x90", "\xe2\xb3\x93" => "\xe2\xb3\x92",
527
+		"\xe2\xb3\x95" => "\xe2\xb3\x94", "\xe2\xb3\x97" => "\xe2\xb3\x96", "\xe2\xb3\x99" => "\xe2\xb3\x98", "\xe2\xb3\x9b" => "\xe2\xb3\x9a",
528
+		"\xe2\xb3\x9d" => "\xe2\xb3\x9c", "\xe2\xb3\x9f" => "\xe2\xb3\x9e", "\xe2\xb3\xa1" => "\xe2\xb3\xa0", "\xe2\xb3\xa3" => "\xe2\xb3\xa2",
529
+		"ff" => "\xef\xac\x80", "fi" => "\xef\xac\x81", "fl" => "\xef\xac\x82", "ffi" => "\xef\xac\x83",
530
+		"ffl" => "\xef\xac\x84", "st" => "\xef\xac\x85", "st" => "\xef\xac\x86", "\xd5\xb4\xd5\xb6" => "\xef\xac\x93",
531
+		"\xd5\xb4\xd5\xa5" => "\xef\xac\x94", "\xd5\xb4\xd5\xab" => "\xef\xac\x95", "\xd5\xbe\xd5\xb6" => "\xef\xac\x96", "\xd5\xb4\xd5\xad" => "\xef\xac\x97",
532
+		"\xef\xbd\x81" => "\xef\xbc\xa1", "\xef\xbd\x82" => "\xef\xbc\xa2", "\xef\xbd\x83" => "\xef\xbc\xa3", "\xef\xbd\x84" => "\xef\xbc\xa4",
533
+		"\xef\xbd\x85" => "\xef\xbc\xa5", "\xef\xbd\x86" => "\xef\xbc\xa6", "\xef\xbd\x87" => "\xef\xbc\xa7", "\xef\xbd\x88" => "\xef\xbc\xa8",
534
+		"\xef\xbd\x89" => "\xef\xbc\xa9", "\xef\xbd\x8a" => "\xef\xbc\xaa", "\xef\xbd\x8b" => "\xef\xbc\xab", "\xef\xbd\x8c" => "\xef\xbc\xac",
535
+		"\xef\xbd\x8d" => "\xef\xbc\xad", "\xef\xbd\x8e" => "\xef\xbc\xae", "\xef\xbd\x8f" => "\xef\xbc\xaf", "\xef\xbd\x90" => "\xef\xbc\xb0",
536
+		"\xef\xbd\x91" => "\xef\xbc\xb1", "\xef\xbd\x92" => "\xef\xbc\xb2", "\xef\xbd\x93" => "\xef\xbc\xb3", "\xef\xbd\x94" => "\xef\xbc\xb4",
537
+		"\xef\xbd\x95" => "\xef\xbc\xb5", "\xef\xbd\x96" => "\xef\xbc\xb6", "\xef\xbd\x97" => "\xef\xbc\xb7", "\xef\xbd\x98" => "\xef\xbc\xb8",
538
+		"\xef\xbd\x99" => "\xef\xbc\xb9", "\xef\xbd\x9a" => "\xef\xbc\xba", "\xf0\x90\x90\xa8" => "\xf0\x90\x90\x80", "\xf0\x90\x90\xa9" => "\xf0\x90\x90\x81",
539
+		"\xf0\x90\x90\xaa" => "\xf0\x90\x90\x82", "\xf0\x90\x90\xab" => "\xf0\x90\x90\x83", "\xf0\x90\x90\xac" => "\xf0\x90\x90\x84", "\xf0\x90\x90\xad" => "\xf0\x90\x90\x85",
540
+		"\xf0\x90\x90\xae" => "\xf0\x90\x90\x86", "\xf0\x90\x90\xaf" => "\xf0\x90\x90\x87", "\xf0\x90\x90\xb0" => "\xf0\x90\x90\x88", "\xf0\x90\x90\xb1" => "\xf0\x90\x90\x89",
541
+		"\xf0\x90\x90\xb2" => "\xf0\x90\x90\x8a", "\xf0\x90\x90\xb3" => "\xf0\x90\x90\x8b", "\xf0\x90\x90\xb4" => "\xf0\x90\x90\x8c", "\xf0\x90\x90\xb5" => "\xf0\x90\x90\x8d",
542
+		"\xf0\x90\x90\xb6" => "\xf0\x90\x90\x8e", "\xf0\x90\x90\xb7" => "\xf0\x90\x90\x8f", "\xf0\x90\x90\xb8" => "\xf0\x90\x90\x90", "\xf0\x90\x90\xb9" => "\xf0\x90\x90\x91",
543
+		"\xf0\x90\x90\xba" => "\xf0\x90\x90\x92", "\xf0\x90\x90\xbb" => "\xf0\x90\x90\x93", "\xf0\x90\x90\xbc" => "\xf0\x90\x90\x94", "\xf0\x90\x90\xbd" => "\xf0\x90\x90\x95",
544
+		"\xf0\x90\x90\xbe" => "\xf0\x90\x90\x96", "\xf0\x90\x90\xbf" => "\xf0\x90\x90\x97", "\xf0\x90\x91\x80" => "\xf0\x90\x90\x98", "\xf0\x90\x91\x81" => "\xf0\x90\x90\x99",
545
+		"\xf0\x90\x91\x82" => "\xf0\x90\x90\x9a", "\xf0\x90\x91\x83" => "\xf0\x90\x90\x9b", "\xf0\x90\x91\x84" => "\xf0\x90\x90\x9c", "\xf0\x90\x91\x85" => "\xf0\x90\x90\x9d",
546
+		"\xf0\x90\x91\x86" => "\xf0\x90\x90\x9e", "\xf0\x90\x91\x87" => "\xf0\x90\x90\x9f", "\xf0\x90\x91\x88" => "\xf0\x90\x90\xa0", "\xf0\x90\x91\x89" => "\xf0\x90\x90\xa1",
547
+		"\xf0\x90\x91\x8a" => "\xf0\x90\x90\xa2", "\xf0\x90\x91\x8b" => "\xf0\x90\x90\xa3", "\xf0\x90\x91\x8c" => "\xf0\x90\x90\xa4", "\xf0\x90\x91\x8d" => "\xf0\x90\x90\xa5",
548
+		"\xf0\x90\x90\xa6" => "\xf0\x90\x91\x8e", "\xf0\x90\x90\xa7" => "\xf0\x90\x91\x8f",
549 549
 	);
550 550
 
551 551
 	return strtr($string, $case_folding);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@
 block discarded – undo
11 11
  * @version 2.1 Beta 4
12 12
  */
13 13
 
14
-if (!defined('SMF'))
14
+if (!defined('SMF')) {
15 15
 	die('No direct access...');
16
+}
16 17
 
17 18
 /**
18 19
  * Converts the given UTF-8 string into lowercase.
Please login to merge, or discard this patch.
Sources/ModerationCenter.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1799,9 +1799,9 @@
 block discarded – undo
1799 1799
 }
1800 1800
 
1801 1801
 /**
1802
-  * Callback for createList().
1803
-  * @return int The total number of warning templates
1804
-  */
1802
+ * Callback for createList().
1803
+ * @return int The total number of warning templates
1804
+ */
1805 1805
 function list_getWarningTemplateCount()
1806 1806
 {
1807 1807
 	global $smcFunc, $user_info;
Please login to merge, or discard this patch.
Braces   +136 added lines, -100 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 4
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * Entry point for the moderation center.
@@ -26,8 +27,9 @@  discard block
 block discarded – undo
26 27
 	global $smcFunc, $txt, $context, $scripturl, $modSettings, $user_info, $sourcedir, $options;
27 28
 
28 29
 	// Don't run this twice... and don't conflict with the admin bar.
29
-	if (isset($context['admin_area']))
30
-		return;
30
+	if (isset($context['admin_area'])) {
31
+			return;
32
+	}
31 33
 
32 34
 	$context['can_moderate_boards'] = $user_info['mod_cache']['bq'] != '0=1';
33 35
 	$context['can_moderate_groups'] = $user_info['mod_cache']['gq'] != '0=1';
@@ -35,8 +37,9 @@  discard block
 block discarded – undo
35 37
 	$context['can_moderate_users'] = allowedTo('moderate_forum');
36 38
 
37 39
 	// Everyone using this area must be allowed here!
38
-	if (!$context['can_moderate_boards'] && !$context['can_moderate_groups'] && !$context['can_moderate_approvals'] && !$context['can_moderate_users'])
39
-		isAllowedTo('access_mod_center');
40
+	if (!$context['can_moderate_boards'] && !$context['can_moderate_groups'] && !$context['can_moderate_approvals'] && !$context['can_moderate_users']) {
41
+			isAllowedTo('access_mod_center');
42
+	}
40 43
 
41 44
 	// We're gonna want a menu of some kind.
42 45
 	require_once($sourcedir . '/Subs-Menu.php');
@@ -195,8 +198,9 @@  discard block
 block discarded – undo
195 198
 	unset($moderation_areas);
196 199
 
197 200
 	// We got something - didn't we? DIDN'T WE!
198
-	if ($mod_include_data == false)
199
-		fatal_lang_error('no_access', false);
201
+	if ($mod_include_data == false) {
202
+			fatal_lang_error('no_access', false);
203
+	}
200 204
 
201 205
 	// Retain the ID information in case required by a subaction.
202 206
 	$context['moderation_menu_id'] = $context['max_menu_id'];
@@ -219,22 +223,25 @@  discard block
 block discarded – undo
219 223
 		'url' => $scripturl . '?action=moderate',
220 224
 		'name' => $txt['moderation_center'],
221 225
 	);
222
-	if (isset($mod_include_data['current_area']) && $mod_include_data['current_area'] != 'index')
223
-		$context['linktree'][] = array(
226
+	if (isset($mod_include_data['current_area']) && $mod_include_data['current_area'] != 'index') {
227
+			$context['linktree'][] = array(
224 228
 			'url' => $scripturl . '?action=moderate;area=' . $mod_include_data['current_area'],
225 229
 			'name' => $mod_include_data['label'],
226 230
 		);
227
-	if (!empty($mod_include_data['current_subsection']) && $mod_include_data['subsections'][$mod_include_data['current_subsection']][0] != $mod_include_data['label'])
228
-		$context['linktree'][] = array(
231
+	}
232
+	if (!empty($mod_include_data['current_subsection']) && $mod_include_data['subsections'][$mod_include_data['current_subsection']][0] != $mod_include_data['label']) {
233
+			$context['linktree'][] = array(
229 234
 			'url' => $scripturl . '?action=moderate;area=' . $mod_include_data['current_area'] . ';sa=' . $mod_include_data['current_subsection'],
230 235
 			'name' => $mod_include_data['subsections'][$mod_include_data['current_subsection']][0],
231 236
 		);
237
+	}
232 238
 
233 239
 	// Now - finally - the bit before the encore - the main performance of course!
234 240
 	if (!$dont_call)
235 241
 	{
236
-		if (isset($mod_include_data['file']))
237
-			require_once($sourcedir . '/' . $mod_include_data['file']);
242
+		if (isset($mod_include_data['file'])) {
243
+					require_once($sourcedir . '/' . $mod_include_data['file']);
244
+		}
238 245
 
239 246
 		call_helper($mod_include_data['function']);
240 247
 	}
@@ -259,8 +266,9 @@  discard block
 block discarded – undo
259 266
 	// Load what blocks the user actually can see...
260 267
 	$valid_blocks = array();
261 268
 
262
-	if ($context['can_moderate_groups'])
263
-		$valid_blocks['g'] = 'GroupRequests';
269
+	if ($context['can_moderate_groups']) {
270
+			$valid_blocks['g'] = 'GroupRequests';
271
+	}
264 272
 	if ($context['can_moderate_boards'])
265 273
 	{
266 274
 		$valid_blocks['r'] = 'ReportedPosts';
@@ -269,8 +277,9 @@  discard block
 block discarded – undo
269 277
 	if ($context['can_moderate_users'])
270 278
 	{
271 279
 		// This falls under the category of moderating users as well...
272
-		if (!$context['can_moderate_boards'])
273
-			$valid_blocks['w'] = 'WatchedUsers';
280
+		if (!$context['can_moderate_boards']) {
281
+					$valid_blocks['w'] = 'WatchedUsers';
282
+		}
274 283
 
275 284
 		$valid_blocks['rm'] = 'ReportedMembers';
276 285
 	}
@@ -281,8 +290,9 @@  discard block
 block discarded – undo
281 290
 	foreach ($valid_blocks as $k => $block)
282 291
 	{
283 292
 		$block = 'ModBlock' . $block;
284
-		if (function_exists($block))
285
-			$context['mod_blocks'][] = $block();
293
+		if (function_exists($block)) {
294
+					$context['mod_blocks'][] = $block();
295
+		}
286 296
 	}
287 297
 
288 298
 	$context['admin_prefs'] = !empty($options['admin_preferences']) ? $smcFunc['json_decode']($options['admin_preferences'], true) : array();
@@ -309,8 +319,9 @@  discard block
 block discarded – undo
309 319
 			)
310 320
 		);
311 321
 		$watched_users = array();
312
-		while ($row = $smcFunc['db_fetch_assoc']($request))
313
-			$watched_users[] = $row;
322
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
323
+					$watched_users[] = $row;
324
+		}
314 325
 		$smcFunc['db_free_result']($request);
315 326
 
316 327
 		cache_put_data('recent_user_watches', $watched_users, 240);
@@ -402,8 +413,9 @@  discard block
 block discarded – undo
402 413
 			$note_owner = $smcFunc['db_num_rows']($get_owner);
403 414
 			$smcFunc['db_free_result']($get_owner);
404 415
 
405
-			if (empty($note_owner))
406
-				fatal_lang_error('mc_notes_delete_own', false);
416
+			if (empty($note_owner)) {
417
+							fatal_lang_error('mc_notes_delete_own', false);
418
+			}
407 419
 		}
408 420
 
409 421
 		// Lets delete it.
@@ -460,12 +472,14 @@  discard block
 block discarded – undo
460 472
 			)
461 473
 		);
462 474
 		$moderator_notes = array();
463
-		while ($row = $smcFunc['db_fetch_assoc']($request))
464
-			$moderator_notes[] = $row;
475
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
476
+					$moderator_notes[] = $row;
477
+		}
465 478
 		$smcFunc['db_free_result']($request);
466 479
 
467
-		if ($offset == 0)
468
-			cache_put_data('moderator_notes', $moderator_notes, 240);
480
+		if ($offset == 0) {
481
+					cache_put_data('moderator_notes', $moderator_notes, 240);
482
+		}
469 483
 	}
470 484
 
471 485
 	// Lets construct a page index.
@@ -504,8 +518,9 @@  discard block
 block discarded – undo
504 518
 	// Got the info already?
505 519
 	$cachekey = md5($smcFunc['json_encode']($user_info['mod_cache']['bq']));
506 520
 	$context['reported_posts'] = array();
507
-	if ($user_info['mod_cache']['bq'] == '0=1')
508
-		return 'reported_posts_block';
521
+	if ($user_info['mod_cache']['bq'] == '0=1') {
522
+			return 'reported_posts_block';
523
+	}
509 524
 
510 525
 	if (($reported_posts = cache_get_data('reported_posts_' . $cachekey, 90)) === null)
511 526
 	{
@@ -529,8 +544,9 @@  discard block
 block discarded – undo
529 544
 			)
530 545
 		);
531 546
 		$reported_posts = array();
532
-		while ($row = $smcFunc['db_fetch_assoc']($request))
533
-			$reported_posts[] = $row;
547
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
548
+					$reported_posts[] = $row;
549
+		}
534 550
 		$smcFunc['db_free_result']($request);
535 551
 
536 552
 		// Cache it.
@@ -568,8 +584,9 @@  discard block
 block discarded – undo
568 584
 
569 585
 	$context['group_requests'] = array();
570 586
 	// Make sure they can even moderate someone!
571
-	if ($user_info['mod_cache']['gq'] == '0=1')
572
-		return 'group_requests_block';
587
+	if ($user_info['mod_cache']['gq'] == '0=1') {
588
+			return 'group_requests_block';
589
+	}
573 590
 
574 591
 	// What requests are outstanding?
575 592
 	$request = $smcFunc['db_query']('', '
@@ -618,8 +635,9 @@  discard block
 block discarded – undo
618 635
 	// Got the info already?
619 636
 	$cachekey = md5($smcFunc['json_encode']((int) allowedTo('moderate_forum')));
620 637
 	$context['reported_users'] = array();
621
-	if (!allowedTo('moderate_forum'))
622
-		return 'reported_users_block';
638
+	if (!allowedTo('moderate_forum')) {
639
+			return 'reported_users_block';
640
+	}
623 641
 
624 642
 	if (($reported_users = cache_get_data('reported_users_' . $cachekey, 90)) === null)
625 643
 	{
@@ -642,8 +660,9 @@  discard block
 block discarded – undo
642 660
 			)
643 661
 		);
644 662
 		$reported_users = array();
645
-		while ($row = $smcFunc['db_fetch_assoc']($request))
646
-			$reported_users[] = $row;
663
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
664
+					$reported_users[] = $row;
665
+		}
647 666
 		$smcFunc['db_free_result']($request);
648 667
 
649 668
 		// Cache it.
@@ -742,15 +761,15 @@  discard block
 block discarded – undo
742 761
 		// Time to update.
743 762
 		updateSettings(array('last_mod_report_action' => time()));
744 763
 		recountOpenReports('members');
745
-	}
746
-	elseif (isset($_POST['close']) && isset($_POST['close_selected']))
764
+	} elseif (isset($_POST['close']) && isset($_POST['close_selected']))
747 765
 	{
748 766
 		checkSession();
749 767
 
750 768
 		// All the ones to update...
751 769
 		$toClose = array();
752
-		foreach ($_POST['close'] as $rid)
753
-			$toClose[] = (int) $rid;
770
+		foreach ($_POST['close'] as $rid) {
771
+					$toClose[] = (int) $rid;
772
+		}
754 773
 
755 774
 		if (!empty($toClose))
756 775
 		{
@@ -903,8 +922,9 @@  discard block
 block discarded – undo
903 922
 	global $context, $user_info;
904 923
 
905 924
 	// You need to be allowed to moderate groups...
906
-	if ($user_info['mod_cache']['gq'] == '0=1')
907
-		isAllowedTo('manage_membergroups');
925
+	if ($user_info['mod_cache']['gq'] == '0=1') {
926
+			isAllowedTo('manage_membergroups');
927
+	}
908 928
 
909 929
 	// Load the group templates.
910 930
 	loadTemplate('ModerationCenter');
@@ -915,8 +935,9 @@  discard block
 block discarded – undo
915 935
 		'view' => 'ViewGroups',
916 936
 	);
917 937
 
918
-	if (!isset($_GET['sa']) || !isset($subActions[$_GET['sa']]))
919
-		$_GET['sa'] = 'view';
938
+	if (!isset($_GET['sa']) || !isset($subActions[$_GET['sa']])) {
939
+			$_GET['sa'] = 'view';
940
+	}
920 941
 	$context['sub_action'] = $_GET['sa'];
921 942
 
922 943
 	// Call the relevant function.
@@ -946,8 +967,9 @@  discard block
 block discarded – undo
946 967
 			'id_notice' => $id_notice,
947 968
 		)
948 969
 	);
949
-	if ($smcFunc['db_num_rows']($request) == 0)
950
-		fatal_lang_error('no_access', false);
970
+	if ($smcFunc['db_num_rows']($request) == 0) {
971
+			fatal_lang_error('no_access', false);
972
+	}
951 973
 	list ($context['notice_body'], $context['notice_subject']) = $smcFunc['db_fetch_row']($request);
952 974
 	$smcFunc['db_free_result']($request);
953 975
 
@@ -984,18 +1006,20 @@  discard block
 block discarded – undo
984 1006
 		checkSession(!is_array($_REQUEST['delete']) ? 'get' : 'post');
985 1007
 
986 1008
 		$toDelete = array();
987
-		if (!is_array($_REQUEST['delete']))
988
-			$toDelete[] = (int) $_REQUEST['delete'];
989
-		else
990
-			foreach ($_REQUEST['delete'] as $did)
1009
+		if (!is_array($_REQUEST['delete'])) {
1010
+					$toDelete[] = (int) $_REQUEST['delete'];
1011
+		} else {
1012
+					foreach ($_REQUEST['delete'] as $did)
991 1013
 				$toDelete[] = (int) $did;
1014
+		}
992 1015
 
993 1016
 		if (!empty($toDelete))
994 1017
 		{
995 1018
 			require_once($sourcedir . '/RemoveTopic.php');
996 1019
 			// If they don't have permission we'll let it error - either way no chance of a security slip here!
997
-			foreach ($toDelete as $did)
998
-				removeMessage($did);
1020
+			foreach ($toDelete as $did) {
1021
+							removeMessage($did);
1022
+			}
999 1023
 		}
1000 1024
 	}
1001 1025
 
@@ -1004,20 +1028,21 @@  discard block
 block discarded – undo
1004 1028
 	{
1005 1029
 		$approve_query = '';
1006 1030
 		$delete_boards = array();
1007
-	}
1008
-	else
1031
+	} else
1009 1032
 	{
1010 1033
 		// Still obey permissions!
1011 1034
 		$approve_boards = boardsAllowedTo('approve_posts');
1012 1035
 		$delete_boards = boardsAllowedTo('delete_any');
1013 1036
 
1014
-		if ($approve_boards == array(0))
1015
-			$approve_query = '';
1016
-		elseif (!empty($approve_boards))
1017
-			$approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
1037
+		if ($approve_boards == array(0)) {
1038
+					$approve_query = '';
1039
+		} elseif (!empty($approve_boards)) {
1040
+					$approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
1041
+		}
1018 1042
 		// Nada, zip, etc...
1019
-		else
1020
-			$approve_query = ' AND 1=0';
1043
+		else {
1044
+					$approve_query = ' AND 1=0';
1045
+		}
1021 1046
 	}
1022 1047
 
1023 1048
 	require_once($sourcedir . '/Subs-List.php');
@@ -1116,10 +1141,11 @@  discard block
 block discarded – undo
1116 1141
 				'data' => array(
1117 1142
 					'function' => function($member) use ($scripturl)
1118 1143
 					{
1119
-						if ($member['last_post_id'])
1120
-							return '<a href="' . $scripturl . '?msg=' . $member['last_post_id'] . '">' . $member['last_post'] . '</a>';
1121
-						else
1122
-							return $member['last_post'];
1144
+						if ($member['last_post_id']) {
1145
+													return '<a href="' . $scripturl . '?msg=' . $member['last_post_id'] . '">' . $member['last_post'] . '</a>';
1146
+						} else {
1147
+													return $member['last_post'];
1148
+						}
1123 1149
 					},
1124 1150
 				),
1125 1151
 			),
@@ -1247,8 +1273,9 @@  discard block
 block discarded – undo
1247 1273
 			)
1248 1274
 		);
1249 1275
 		$latest_posts = array();
1250
-		while ($row = $smcFunc['db_fetch_assoc']($request))
1251
-			$latest_posts[$row['id_member']] = $row['last_post_id'];
1276
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1277
+					$latest_posts[$row['id_member']] = $row['last_post_id'];
1278
+		}
1252 1279
 
1253 1280
 		if (!empty($latest_posts))
1254 1281
 		{
@@ -1439,15 +1466,17 @@  discard block
 block discarded – undo
1439 1466
 	// Setup the direction stuff...
1440 1467
 	$context['order'] = isset($_REQUEST['sort']) && isset($sort_types[$_REQUEST['sort']]) ? $_REQUEST['sort'] : 'member';
1441 1468
 
1442
-	if (!isset($search_params['string']) || (!empty($_REQUEST['search']) && $search_params['string'] != $_REQUEST['search']))
1443
-		$search_params_string = empty($_REQUEST['search']) ? '' : $_REQUEST['search'];
1444
-	else
1445
-		$search_params_string = $search_params['string'];
1469
+	if (!isset($search_params['string']) || (!empty($_REQUEST['search']) && $search_params['string'] != $_REQUEST['search'])) {
1470
+			$search_params_string = empty($_REQUEST['search']) ? '' : $_REQUEST['search'];
1471
+	} else {
1472
+			$search_params_string = $search_params['string'];
1473
+	}
1446 1474
 
1447
-	if (isset($_REQUEST['search_type']) || empty($search_params['type']) || !isset($searchTypes[$search_params['type']]))
1448
-		$search_params_type = isset($_REQUEST['search_type']) && isset($searchTypes[$_REQUEST['search_type']]) ? $_REQUEST['search_type'] : (isset($searchTypes[$context['order']]) ? $context['order'] : 'member');
1449
-	else
1450
-		$search_params_type = $search_params['type'];
1475
+	if (isset($_REQUEST['search_type']) || empty($search_params['type']) || !isset($searchTypes[$search_params['type']])) {
1476
+			$search_params_type = isset($_REQUEST['search_type']) && isset($searchTypes[$_REQUEST['search_type']]) ? $_REQUEST['search_type'] : (isset($searchTypes[$context['order']]) ? $context['order'] : 'member');
1477
+	} else {
1478
+			$search_params_type = $search_params['type'];
1479
+	}
1451 1480
 
1452 1481
 	$search_params = array(
1453 1482
 		'string' => $search_params_string,
@@ -1530,9 +1559,10 @@  discard block
 block discarded – undo
1530 1559
 								' . $rowData['reason'] . '
1531 1560
 							</div>';
1532 1561
 
1533
-						if (!empty($rowData['id_notice']))
1534
-							$output .= '
1562
+						if (!empty($rowData['id_notice'])) {
1563
+													$output .= '
1535 1564
 								&nbsp;<a href="' . $scripturl . '?action=moderate;area=notice;nid=' . $rowData['id_notice'] . '" onclick="window.open(this.href, \'\', \'scrollbars=yes,resizable=yes,width=400,height=250\');return false;" target="_blank" class="new_win" title="' . $txt['profile_warning_previous_notice'] . '"><span class="generic_icons filter centericon"></span></a>';
1565
+						}
1536 1566
 						return $output;
1537 1567
 					},
1538 1568
 				),
@@ -1650,9 +1680,9 @@  discard block
 block discarded – undo
1650 1680
 	global $smcFunc, $modSettings, $context, $txt, $scripturl, $sourcedir, $user_info;
1651 1681
 
1652 1682
 	// Submitting a new one?
1653
-	if (isset($_POST['add']))
1654
-		return ModifyWarningTemplate();
1655
-	elseif (isset($_POST['delete']) && !empty($_POST['deltpl']))
1683
+	if (isset($_POST['add'])) {
1684
+			return ModifyWarningTemplate();
1685
+	} elseif (isset($_POST['delete']) && !empty($_POST['deltpl']))
1656 1686
 	{
1657 1687
 		checkSession();
1658 1688
 		validateToken('mod-wt');
@@ -1671,8 +1701,9 @@  discard block
 block discarded – undo
1671 1701
 				'current_member' => $user_info['id'],
1672 1702
 			)
1673 1703
 		);
1674
-		while ($row = $smcFunc['db_fetch_assoc']($request))
1675
-			logAction('delete_warn_template', array('template' => $row['recipient_name']));
1704
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1705
+					logAction('delete_warn_template', array('template' => $row['recipient_name']));
1706
+		}
1676 1707
 		$smcFunc['db_free_result']($request);
1677 1708
 
1678 1709
 		// Do the deletes.
@@ -1963,16 +1994,18 @@  discard block
 block discarded – undo
1963 1994
 				);
1964 1995
 
1965 1996
 				// If it wasn't visible and now is they've effectively added it.
1966
-				if ($context['template_data']['personal'] && !$recipient_id)
1967
-					logAction('add_warn_template', array('template' => $_POST['template_title']));
1997
+				if ($context['template_data']['personal'] && !$recipient_id) {
1998
+									logAction('add_warn_template', array('template' => $_POST['template_title']));
1999
+				}
1968 2000
 				// Conversely if they made it personal it's a delete.
1969
-				elseif (!$context['template_data']['personal'] && $recipient_id)
1970
-					logAction('delete_warn_template', array('template' => $_POST['template_title']));
2001
+				elseif (!$context['template_data']['personal'] && $recipient_id) {
2002
+									logAction('delete_warn_template', array('template' => $_POST['template_title']));
2003
+				}
1971 2004
 				// Otherwise just an edit.
1972
-				else
1973
-					logAction('modify_warn_template', array('template' => $_POST['template_title']));
1974
-			}
1975
-			else
2005
+				else {
2006
+									logAction('modify_warn_template', array('template' => $_POST['template_title']));
2007
+				}
2008
+			} else
1976 2009
 			{
1977 2010
 				$smcFunc['db_insert']('',
1978 2011
 					'{db_prefix}log_comments',
@@ -1992,17 +2025,18 @@  discard block
 block discarded – undo
1992 2025
 
1993 2026
 			// Get out of town...
1994 2027
 			redirectexit('action=moderate;area=warnings;sa=templates');
1995
-		}
1996
-		else
2028
+		} else
1997 2029
 		{
1998 2030
 			$context['warning_errors'] = array();
1999 2031
 			$context['template_data']['title'] = !empty($_POST['template_title']) ? $_POST['template_title'] : '';
2000 2032
 			$context['template_data']['body'] = !empty($_POST['template_body']) ? $_POST['template_body'] : $txt['mc_warning_template_body_default'];
2001 2033
 			$context['template_data']['personal'] = !empty($_POST['make_personal']);
2002
-			if (empty($_POST['template_title']))
2003
-				$context['warning_errors'][] = $txt['mc_warning_template_error_no_title'];
2004
-			if (empty($_POST['template_body']))
2005
-				$context['warning_errors'][] = $txt['mc_warning_template_error_no_body'];
2034
+			if (empty($_POST['template_title'])) {
2035
+							$context['warning_errors'][] = $txt['mc_warning_template_error_no_title'];
2036
+			}
2037
+			if (empty($_POST['template_body'])) {
2038
+							$context['warning_errors'][] = $txt['mc_warning_template_error_no_body'];
2039
+			}
2006 2040
 		}
2007 2041
 	}
2008 2042
 
@@ -2047,8 +2081,9 @@  discard block
 block discarded – undo
2047 2081
 		// Now check other options!
2048 2082
 		$pref_binary = 0;
2049 2083
 
2050
-		if ($context['can_moderate_approvals'] && !empty($_POST['mod_notify_approval']))
2051
-			$pref_binary |= 4;
2084
+		if ($context['can_moderate_approvals'] && !empty($_POST['mod_notify_approval'])) {
2085
+					$pref_binary |= 4;
2086
+		}
2052 2087
 
2053 2088
 		// Put it all together.
2054 2089
 		$mod_prefs = '0||' . $pref_binary;
@@ -2072,9 +2107,10 @@  discard block
 block discarded – undo
2072 2107
 	unset($_SESSION['moderate_time']);
2073 2108
 
2074 2109
 	// Clean any moderator tokens as well.
2075
-	foreach ($_SESSION['token'] as $key => $token)
2076
-		if (strpos($key, '-mod') !== false)
2110
+	foreach ($_SESSION['token'] as $key => $token) {
2111
+			if (strpos($key, '-mod') !== false)
2077 2112
 			unset($_SESSION['token'][$key]);
2113
+	}
2078 2114
 
2079 2115
 	redirectexit();
2080 2116
 }
Please login to merge, or discard this patch.
Sources/Search.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 
660 660
 	// Remove the phrase parts and extract the words.
661 661
 	$wordArray = preg_replace('~(?:^|\s)(?:[-]?)"(?:[^"]+)"(?:$|\s)~' . ($context['utf8'] ? 'u' : ''), ' ', $search_params['search']);
662
-	$wordArray = explode(' ',  $smcFunc['htmlspecialchars'](un_htmlspecialchars($wordArray), ENT_QUOTES));
662
+	$wordArray = explode(' ', $smcFunc['htmlspecialchars'](un_htmlspecialchars($wordArray), ENT_QUOTES));
663 663
 
664 664
 	// A minus sign in front of a word excludes the word.... so...
665 665
 	$excludedWords = array();
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 						SELECT
1105 1105
 							{int:id_search},
1106 1106
 							t.id_topic,
1107
-							' . $relevance. ',
1107
+							' . $relevance . ',
1108 1108
 							' . (empty($userQuery) ? 't.id_first_msg' : 'm.id_msg') . ',
1109 1109
 							1
1110 1110
 						FROM ' . $subject_query['from'] . (empty($subject_query['inner_join']) ? '' : '
@@ -1339,7 +1339,7 @@  discard block
 block discarded – undo
1339 1339
 						if (empty($subject_query['where']))
1340 1340
 							continue;
1341 1341
 
1342
-						$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_topics', ($smcFunc['db_support_ignore'] ? ( '
1342
+						$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_topics', ($smcFunc['db_support_ignore'] ? ('
1343 1343
 							INSERT IGNORE INTO {db_prefix}' . ($createTemporary ? 'tmp_' : '') . 'log_search_topics
1344 1344
 								(' . ($createTemporary ? '' : 'id_search, ') . 'id_topic)') : '') . '
1345 1345
 							SELECT ' . ($createTemporary ? '' : $_SESSION['search_cache']['id_search'] . ', ') . 't.id_topic
@@ -1568,7 +1568,7 @@  discard block
 block discarded – undo
1568 1568
 					}
1569 1569
 					$main_query['select']['relevance'] = substr($relevance, 0, -3) . ') / ' . $new_weight_total . ' AS relevance';
1570 1570
 
1571
-					$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_no_index', ($smcFunc['db_support_ignore'] ? ( '
1571
+					$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_no_index', ($smcFunc['db_support_ignore'] ? ('
1572 1572
 						INSERT IGNORE INTO ' . '{db_prefix}log_search_results
1573 1573
 							(' . implode(', ', array_keys($main_query['select'])) . ')') : '') . '
1574 1574
 						SELECT
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
 					$relevance = substr($relevance, 0, -3) . ') / ' . $weight_total . ' AS relevance';
1637 1637
 
1638 1638
 					$usedIDs = array_flip(empty($inserts) ? array() : array_keys($inserts));
1639
-					$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_sub_only', ($smcFunc['db_support_ignore'] ? ( '
1639
+					$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_sub_only', ($smcFunc['db_support_ignore'] ? ('
1640 1640
 						INSERT IGNORE INTO {db_prefix}log_search_results
1641 1641
 							(id_search, id_topic, relevance, id_msg, num_matches)') : '') . '
1642 1642
 						SELECT
@@ -2102,7 +2102,7 @@  discard block
 block discarded – undo
2102 2102
 		$query = trim($query, "\*+");
2103 2103
 		$query = strtr($smcFunc['htmlspecialchars']($query), array('\\\'' => '\''));
2104 2104
 
2105
-		$body_highlighted = preg_replace_callback('/((<[^>]*)|' . preg_quote(strtr($query, array('\'' => '&#039;')), '/') . ')/i' . ($context['utf8'] ? 'u' : ''), function ($m)
2105
+		$body_highlighted = preg_replace_callback('/((<[^>]*)|' . preg_quote(strtr($query, array('\'' => '&#039;')), '/') . ')/i' . ($context['utf8'] ? 'u' : ''), function($m)
2106 2106
 		{
2107 2107
 			return isset($m[2]) && "$m[2]" == "$m[1]" ? stripslashes("$m[1]") : "<strong class=\"highlight\">$m[1]</strong>";
2108 2108
 		}, $body_highlighted);
Please login to merge, or discard this patch.
Braces   +417 added lines, -309 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 4
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 // This defines two version types for checking the API's are compatible with this version of SMF.
20 21
 $GLOBALS['search_versions'] = array(
@@ -39,8 +40,9 @@  discard block
 block discarded – undo
39 40
 	global $txt, $scripturl, $modSettings, $user_info, $context, $smcFunc, $sourcedir;
40 41
 
41 42
 	// Is the load average too high to allow searching just now?
42
-	if (!empty($context['load_average']) && !empty($modSettings['loadavg_search']) && $context['load_average'] >= $modSettings['loadavg_search'])
43
-		fatal_lang_error('loadavg_search_disabled', false);
43
+	if (!empty($context['load_average']) && !empty($modSettings['loadavg_search']) && $context['load_average'] >= $modSettings['loadavg_search']) {
44
+			fatal_lang_error('loadavg_search_disabled', false);
45
+	}
44 46
 
45 47
 	loadLanguage('Search');
46 48
 	// Don't load this in XML mode.
@@ -88,23 +90,30 @@  discard block
 block discarded – undo
88 90
 			@list ($k, $v) = explode('|\'|', $data);
89 91
 			$context['search_params'][$k] = $v;
90 92
 		}
91
-		if (isset($context['search_params']['brd']))
92
-			$context['search_params']['brd'] = $context['search_params']['brd'] == '' ? array() : explode(',', $context['search_params']['brd']);
93
+		if (isset($context['search_params']['brd'])) {
94
+					$context['search_params']['brd'] = $context['search_params']['brd'] == '' ? array() : explode(',', $context['search_params']['brd']);
95
+		}
93 96
 	}
94 97
 
95
-	if (isset($_REQUEST['search']))
96
-		$context['search_params']['search'] = un_htmlspecialchars($_REQUEST['search']);
98
+	if (isset($_REQUEST['search'])) {
99
+			$context['search_params']['search'] = un_htmlspecialchars($_REQUEST['search']);
100
+	}
97 101
 
98
-	if (isset($context['search_params']['search']))
99
-		$context['search_params']['search'] = $smcFunc['htmlspecialchars']($context['search_params']['search']);
100
-	if (isset($context['search_params']['userspec']))
101
-		$context['search_params']['userspec'] = $smcFunc['htmlspecialchars']($context['search_params']['userspec']);
102
-	if (!empty($context['search_params']['searchtype']))
103
-		$context['search_params']['searchtype'] = 2;
104
-	if (!empty($context['search_params']['minage']))
105
-		$context['search_params']['minage'] = (int) $context['search_params']['minage'];
106
-	if (!empty($context['search_params']['maxage']))
107
-		$context['search_params']['maxage'] = (int) $context['search_params']['maxage'];
102
+	if (isset($context['search_params']['search'])) {
103
+			$context['search_params']['search'] = $smcFunc['htmlspecialchars']($context['search_params']['search']);
104
+	}
105
+	if (isset($context['search_params']['userspec'])) {
106
+			$context['search_params']['userspec'] = $smcFunc['htmlspecialchars']($context['search_params']['userspec']);
107
+	}
108
+	if (!empty($context['search_params']['searchtype'])) {
109
+			$context['search_params']['searchtype'] = 2;
110
+	}
111
+	if (!empty($context['search_params']['minage'])) {
112
+			$context['search_params']['minage'] = (int) $context['search_params']['minage'];
113
+	}
114
+	if (!empty($context['search_params']['maxage'])) {
115
+			$context['search_params']['maxage'] = (int) $context['search_params']['maxage'];
116
+	}
108 117
 
109 118
 	$context['search_params']['show_complete'] = !empty($context['search_params']['show_complete']);
110 119
 	$context['search_params']['subject_only'] = !empty($context['search_params']['subject_only']);
@@ -116,11 +125,13 @@  discard block
 block discarded – undo
116 125
 		$context['search_errors']['messages'] = array();
117 126
 		foreach ($context['search_errors'] as $search_error => $dummy)
118 127
 		{
119
-			if ($search_error === 'messages')
120
-				continue;
128
+			if ($search_error === 'messages') {
129
+							continue;
130
+			}
121 131
 
122
-			if ($search_error == 'string_too_long')
123
-				$txt['error_string_too_long'] = sprintf($txt['error_string_too_long'], $context['search_string_limit']);
132
+			if ($search_error == 'string_too_long') {
133
+							$txt['error_string_too_long'] = sprintf($txt['error_string_too_long'], $context['search_string_limit']);
134
+			}
124 135
 
125 136
 			$context['search_errors']['messages'][] = $txt['error_' . $search_error];
126 137
 		}
@@ -143,12 +154,13 @@  discard block
 block discarded – undo
143 154
 	while ($row = $smcFunc['db_fetch_assoc']($request))
144 155
 	{
145 156
 		// This category hasn't been set up yet..
146
-		if (!isset($context['categories'][$row['id_cat']]))
147
-			$context['categories'][$row['id_cat']] = array(
157
+		if (!isset($context['categories'][$row['id_cat']])) {
158
+					$context['categories'][$row['id_cat']] = array(
148 159
 				'id' => $row['id_cat'],
149 160
 				'name' => $row['cat_name'],
150 161
 				'boards' => array()
151 162
 			);
163
+		}
152 164
 
153 165
 		// Set this board up, and let the template know when it's a child.  (indent them..)
154 166
 		$context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array(
@@ -159,8 +171,9 @@  discard block
 block discarded – undo
159 171
 		);
160 172
 
161 173
 		// If a board wasn't checked that probably should have been ensure the board selection is selected, yo!
162
-		if (!$context['categories'][$row['id_cat']]['boards'][$row['id_board']]['selected'] && (empty($modSettings['recycle_enable']) || $row['id_board'] != $modSettings['recycle_board']))
163
-			$context['boards_check_all'] = false;
174
+		if (!$context['categories'][$row['id_cat']]['boards'][$row['id_board']]['selected'] && (empty($modSettings['recycle_enable']) || $row['id_board'] != $modSettings['recycle_board'])) {
175
+					$context['boards_check_all'] = false;
176
+		}
164 177
 	}
165 178
 	$smcFunc['db_free_result']($request);
166 179
 
@@ -182,18 +195,20 @@  discard block
 block discarded – undo
182 195
 	}
183 196
 
184 197
 	$max_boards = ceil(count($temp_boards) / 2);
185
-	if ($max_boards == 1)
186
-		$max_boards = 2;
198
+	if ($max_boards == 1) {
199
+			$max_boards = 2;
200
+	}
187 201
 
188 202
 	// Now, alternate them so they can be shown left and right ;).
189 203
 	$context['board_columns'] = array();
190 204
 	for ($i = 0; $i < $max_boards; $i++)
191 205
 	{
192 206
 		$context['board_columns'][] = $temp_boards[$i];
193
-		if (isset($temp_boards[$i + $max_boards]))
194
-			$context['board_columns'][] = $temp_boards[$i + $max_boards];
195
-		else
196
-			$context['board_columns'][] = array();
207
+		if (isset($temp_boards[$i + $max_boards])) {
208
+					$context['board_columns'][] = $temp_boards[$i + $max_boards];
209
+		} else {
210
+					$context['board_columns'][] = array();
211
+		}
197 212
 	}
198 213
 
199 214
 	if (!empty($_REQUEST['topic']))
@@ -225,8 +240,9 @@  discard block
 block discarded – undo
225 240
 			)
226 241
 		);
227 242
 
228
-		if ($smcFunc['db_num_rows']($request) == 0)
229
-			fatal_lang_error('topic_gone', false);
243
+		if ($smcFunc['db_num_rows']($request) == 0) {
244
+					fatal_lang_error('topic_gone', false);
245
+		}
230 246
 
231 247
 		list ($context['search_topic']['subject']) = $smcFunc['db_fetch_row']($request);
232 248
 		$smcFunc['db_free_result']($request);
@@ -256,11 +272,13 @@  discard block
 block discarded – undo
256 272
 	global $excludedWords, $participants, $smcFunc;
257 273
 
258 274
 	// if comming from the quick search box, and we want to search on members, well we need to do that ;)
259
-	if (isset($_REQUEST['search_selection']) && $_REQUEST['search_selection'] === 'members')
260
-		redirectexit($scripturl . '?action=mlist;sa=search;fields=name,email;search=' . urlencode($_REQUEST['search']));
275
+	if (isset($_REQUEST['search_selection']) && $_REQUEST['search_selection'] === 'members') {
276
+			redirectexit($scripturl . '?action=mlist;sa=search;fields=name,email;search=' . urlencode($_REQUEST['search']));
277
+	}
261 278
 
262
-	if (!empty($context['load_average']) && !empty($modSettings['loadavg_search']) && $context['load_average'] >= $modSettings['loadavg_search'])
263
-		fatal_lang_error('loadavg_search_disabled', false);
279
+	if (!empty($context['load_average']) && !empty($modSettings['loadavg_search']) && $context['load_average'] >= $modSettings['loadavg_search']) {
280
+			fatal_lang_error('loadavg_search_disabled', false);
281
+	}
264 282
 
265 283
 	// No, no, no... this is a bit hard on the server, so don't you go prefetching it!
266 284
 	if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch')
@@ -307,8 +325,9 @@  discard block
 block discarded – undo
307 325
 	}
308 326
 
309 327
 	// Zero weight.  Weightless :P.
310
-	if (empty($weight_total))
311
-		fatal_lang_error('search_invalid_weights');
328
+	if (empty($weight_total)) {
329
+			fatal_lang_error('search_invalid_weights');
330
+	}
312 331
 
313 332
 	// These vars don't require an interface, they're just here for tweaking.
314 333
 	$recentPercentage = 0.30;
@@ -326,11 +345,13 @@  discard block
 block discarded – undo
326 345
 	$context['search_string_limit'] = 100;
327 346
 
328 347
 	loadLanguage('Search');
329
-	if (!isset($_REQUEST['xml']))
330
-		loadTemplate('Search');
348
+	if (!isset($_REQUEST['xml'])) {
349
+			loadTemplate('Search');
350
+	}
331 351
 	//If we're doing XML we need to use the results template regardless really.
332
-	else
333
-		$context['sub_template'] = 'results';
352
+	else {
353
+			$context['sub_template'] = 'results';
354
+	}
334 355
 
335 356
 	// Are you allowed?
336 357
 	isAllowedTo('search_posts');
@@ -363,34 +384,39 @@  discard block
 block discarded – undo
363 384
 			$search_params[$k] = $v;
364 385
 		}
365 386
 
366
-		if (isset($search_params['brd']))
367
-			$search_params['brd'] = empty($search_params['brd']) ? array() : explode(',', $search_params['brd']);
387
+		if (isset($search_params['brd'])) {
388
+					$search_params['brd'] = empty($search_params['brd']) ? array() : explode(',', $search_params['brd']);
389
+		}
368 390
 	}
369 391
 
370 392
 	// Store whether simple search was used (needed if the user wants to do another query).
371
-	if (!isset($search_params['advanced']))
372
-		$search_params['advanced'] = empty($_REQUEST['advanced']) ? 0 : 1;
393
+	if (!isset($search_params['advanced'])) {
394
+			$search_params['advanced'] = empty($_REQUEST['advanced']) ? 0 : 1;
395
+	}
373 396
 
374 397
 	// 1 => 'allwords' (default, don't set as param) / 2 => 'anywords'.
375
-	if (!empty($search_params['searchtype']) || (!empty($_REQUEST['searchtype']) && $_REQUEST['searchtype'] == 2))
376
-		$search_params['searchtype'] = 2;
398
+	if (!empty($search_params['searchtype']) || (!empty($_REQUEST['searchtype']) && $_REQUEST['searchtype'] == 2)) {
399
+			$search_params['searchtype'] = 2;
400
+	}
377 401
 
378 402
 	// Minimum age of messages. Default to zero (don't set param in that case).
379
-	if (!empty($search_params['minage']) || (!empty($_REQUEST['minage']) && $_REQUEST['minage'] > 0))
380
-		$search_params['minage'] = !empty($search_params['minage']) ? (int) $search_params['minage'] : (int) $_REQUEST['minage'];
403
+	if (!empty($search_params['minage']) || (!empty($_REQUEST['minage']) && $_REQUEST['minage'] > 0)) {
404
+			$search_params['minage'] = !empty($search_params['minage']) ? (int) $search_params['minage'] : (int) $_REQUEST['minage'];
405
+	}
381 406
 
382 407
 	// Maximum age of messages. Default to infinite (9999 days: param not set).
383
-	if (!empty($search_params['maxage']) || (!empty($_REQUEST['maxage']) && $_REQUEST['maxage'] < 9999))
384
-		$search_params['maxage'] = !empty($search_params['maxage']) ? (int) $search_params['maxage'] : (int) $_REQUEST['maxage'];
408
+	if (!empty($search_params['maxage']) || (!empty($_REQUEST['maxage']) && $_REQUEST['maxage'] < 9999)) {
409
+			$search_params['maxage'] = !empty($search_params['maxage']) ? (int) $search_params['maxage'] : (int) $_REQUEST['maxage'];
410
+	}
385 411
 
386 412
 	// Searching a specific topic?
387 413
 	if (!empty($_REQUEST['topic']) || (!empty($_REQUEST['search_selection']) && $_REQUEST['search_selection'] == 'topic'))
388 414
 	{
389 415
 		$search_params['topic'] = empty($_REQUEST['search_selection']) ? (int) $_REQUEST['topic'] : (isset($_REQUEST['sd_topic']) ? (int) $_REQUEST['sd_topic'] : '');
390 416
 		$search_params['show_complete'] = true;
417
+	} elseif (!empty($search_params['topic'])) {
418
+			$search_params['topic'] = (int) $search_params['topic'];
391 419
 	}
392
-	elseif (!empty($search_params['topic']))
393
-		$search_params['topic'] = (int) $search_params['topic'];
394 420
 
395 421
 	if (!empty($search_params['minage']) || !empty($search_params['maxage']))
396 422
 	{
@@ -408,19 +434,21 @@  discard block
 block discarded – undo
408 434
 			)
409 435
 		);
410 436
 		list ($minMsgID, $maxMsgID) = $smcFunc['db_fetch_row']($request);
411
-		if ($minMsgID < 0 || $maxMsgID < 0)
412
-			$context['search_errors']['no_messages_in_time_frame'] = true;
437
+		if ($minMsgID < 0 || $maxMsgID < 0) {
438
+					$context['search_errors']['no_messages_in_time_frame'] = true;
439
+		}
413 440
 		$smcFunc['db_free_result']($request);
414 441
 	}
415 442
 
416 443
 	// Default the user name to a wildcard matching every user (*).
417
-	if (!empty($search_params['userspec']) || (!empty($_REQUEST['userspec']) && $_REQUEST['userspec'] != '*'))
418
-		$search_params['userspec'] = isset($search_params['userspec']) ? $search_params['userspec'] : $_REQUEST['userspec'];
444
+	if (!empty($search_params['userspec']) || (!empty($_REQUEST['userspec']) && $_REQUEST['userspec'] != '*')) {
445
+			$search_params['userspec'] = isset($search_params['userspec']) ? $search_params['userspec'] : $_REQUEST['userspec'];
446
+	}
419 447
 
420 448
 	// If there's no specific user, then don't mention it in the main query.
421
-	if (empty($search_params['userspec']))
422
-		$userQuery = '';
423
-	else
449
+	if (empty($search_params['userspec'])) {
450
+			$userQuery = '';
451
+	} else
424 452
 	{
425 453
 		$userString = strtr($smcFunc['htmlspecialchars']($search_params['userspec'], ENT_QUOTES), array('&quot;' => '"'));
426 454
 		$userString = strtr($userString, array('%' => '\%', '_' => '\_', '*' => '%', '?' => '_'));
@@ -432,19 +460,21 @@  discard block
 block discarded – undo
432 460
 		{
433 461
 			$possible_users[$k] = trim($possible_users[$k]);
434 462
 
435
-			if (strlen($possible_users[$k]) == 0)
436
-				unset($possible_users[$k]);
463
+			if (strlen($possible_users[$k]) == 0) {
464
+							unset($possible_users[$k]);
465
+			}
437 466
 		}
438 467
 
439 468
 		// Create a list of database-escaped search names.
440 469
 		$realNameMatches = array();
441
-		foreach ($possible_users as $possible_user)
442
-			$realNameMatches[] = $smcFunc['db_quote'](
470
+		foreach ($possible_users as $possible_user) {
471
+					$realNameMatches[] = $smcFunc['db_quote'](
443 472
 				'{string:possible_user}',
444 473
 				array(
445 474
 					'possible_user' => $possible_user
446 475
 				)
447 476
 			);
477
+		}
448 478
 
449 479
 		// Retrieve a list of possible members.
450 480
 		$request = $smcFunc['db_query']('', '
@@ -456,9 +486,9 @@  discard block
 block discarded – undo
456 486
 			)
457 487
 		);
458 488
 		// Simply do nothing if there're too many members matching the criteria.
459
-		if ($smcFunc['db_num_rows']($request) > $maxMembersToSearch)
460
-			$userQuery = '';
461
-		elseif ($smcFunc['db_num_rows']($request) == 0)
489
+		if ($smcFunc['db_num_rows']($request) > $maxMembersToSearch) {
490
+					$userQuery = '';
491
+		} elseif ($smcFunc['db_num_rows']($request) == 0)
462 492
 		{
463 493
 			$userQuery = $smcFunc['db_quote'](
464 494
 				'm.id_member = {int:id_member_guest} AND ({raw:match_possible_guest_names})',
@@ -467,12 +497,12 @@  discard block
 block discarded – undo
467 497
 					'match_possible_guest_names' => 'm.poster_name LIKE ' . implode(' OR m.poster_name LIKE ', $realNameMatches),
468 498
 				)
469 499
 			);
470
-		}
471
-		else
500
+		} else
472 501
 		{
473 502
 			$memberlist = array();
474
-			while ($row = $smcFunc['db_fetch_assoc']($request))
475
-				$memberlist[] = $row['id_member'];
503
+			while ($row = $smcFunc['db_fetch_assoc']($request)) {
504
+							$memberlist[] = $row['id_member'];
505
+			}
476 506
 			$userQuery = $smcFunc['db_quote'](
477 507
 				'(m.id_member IN ({array_int:matched_members}) OR (m.id_member = {int:id_member_guest} AND ({raw:match_possible_guest_names})))',
478 508
 				array(
@@ -486,22 +516,25 @@  discard block
 block discarded – undo
486 516
 	}
487 517
 
488 518
 	// If the boards were passed by URL (params=), temporarily put them back in $_REQUEST.
489
-	if (!empty($search_params['brd']) && is_array($search_params['brd']))
490
-		$_REQUEST['brd'] = $search_params['brd'];
519
+	if (!empty($search_params['brd']) && is_array($search_params['brd'])) {
520
+			$_REQUEST['brd'] = $search_params['brd'];
521
+	}
491 522
 
492 523
 	// Ensure that brd is an array.
493 524
 	if ((!empty($_REQUEST['brd']) && !is_array($_REQUEST['brd'])) || (!empty($_REQUEST['search_selection']) && $_REQUEST['search_selection'] == 'board'))
494 525
 	{
495
-		if (!empty($_REQUEST['brd']))
496
-			$_REQUEST['brd'] = strpos($_REQUEST['brd'], ',') !== false ? explode(',', $_REQUEST['brd']) : array($_REQUEST['brd']);
497
-		else
498
-			$_REQUEST['brd'] = isset($_REQUEST['sd_brd']) ? array($_REQUEST['sd_brd']) : array();
526
+		if (!empty($_REQUEST['brd'])) {
527
+					$_REQUEST['brd'] = strpos($_REQUEST['brd'], ',') !== false ? explode(',', $_REQUEST['brd']) : array($_REQUEST['brd']);
528
+		} else {
529
+					$_REQUEST['brd'] = isset($_REQUEST['sd_brd']) ? array($_REQUEST['sd_brd']) : array();
530
+		}
499 531
 	}
500 532
 
501 533
 	// Make sure all boards are integers.
502
-	if (!empty($_REQUEST['brd']))
503
-		foreach ($_REQUEST['brd'] as $id => $brd)
534
+	if (!empty($_REQUEST['brd'])) {
535
+			foreach ($_REQUEST['brd'] as $id => $brd)
504 536
 			$_REQUEST['brd'][$id] = (int) $brd;
537
+	}
505 538
 
506 539
 	// Special case for boards: searching just one topic?
507 540
 	if (!empty($search_params['topic']))
@@ -520,17 +553,18 @@  discard block
 block discarded – undo
520 553
 			)
521 554
 		);
522 555
 
523
-		if ($smcFunc['db_num_rows']($request) == 0)
524
-			fatal_lang_error('topic_gone', false);
556
+		if ($smcFunc['db_num_rows']($request) == 0) {
557
+					fatal_lang_error('topic_gone', false);
558
+		}
525 559
 
526 560
 		$search_params['brd'] = array();
527 561
 		list ($search_params['brd'][0]) = $smcFunc['db_fetch_row']($request);
528 562
 		$smcFunc['db_free_result']($request);
529 563
 	}
530 564
 	// Select all boards you've selected AND are allowed to see.
531
-	elseif ($user_info['is_admin'] && (!empty($search_params['advanced']) || !empty($_REQUEST['brd'])))
532
-		$search_params['brd'] = empty($_REQUEST['brd']) ? array() : $_REQUEST['brd'];
533
-	else
565
+	elseif ($user_info['is_admin'] && (!empty($search_params['advanced']) || !empty($_REQUEST['brd']))) {
566
+			$search_params['brd'] = empty($_REQUEST['brd']) ? array() : $_REQUEST['brd'];
567
+	} else
534 568
 	{
535 569
 		$see_board = empty($search_params['advanced']) ? 'query_wanna_see_board' : 'query_see_board';
536 570
 		$request = $smcFunc['db_query']('', '
@@ -548,19 +582,22 @@  discard block
 block discarded – undo
548 582
 			)
549 583
 		);
550 584
 		$search_params['brd'] = array();
551
-		while ($row = $smcFunc['db_fetch_assoc']($request))
552
-			$search_params['brd'][] = $row['id_board'];
585
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
586
+					$search_params['brd'][] = $row['id_board'];
587
+		}
553 588
 		$smcFunc['db_free_result']($request);
554 589
 
555 590
 		// This error should pro'bly only happen for hackers.
556
-		if (empty($search_params['brd']))
557
-			$context['search_errors']['no_boards_selected'] = true;
591
+		if (empty($search_params['brd'])) {
592
+					$context['search_errors']['no_boards_selected'] = true;
593
+		}
558 594
 	}
559 595
 
560 596
 	if (count($search_params['brd']) != 0)
561 597
 	{
562
-		foreach ($search_params['brd'] as $k => $v)
563
-			$search_params['brd'][$k] = (int) $v;
598
+		foreach ($search_params['brd'] as $k => $v) {
599
+					$search_params['brd'][$k] = (int) $v;
600
+		}
564 601
 
565 602
 		// If we've selected all boards, this parameter can be left empty.
566 603
 		$request = $smcFunc['db_query']('', '
@@ -574,15 +611,16 @@  discard block
 block discarded – undo
574 611
 		list ($num_boards) = $smcFunc['db_fetch_row']($request);
575 612
 		$smcFunc['db_free_result']($request);
576 613
 
577
-		if (count($search_params['brd']) == $num_boards)
614
+		if (count($search_params['brd']) == $num_boards) {
615
+					$boardQuery = '';
616
+		} elseif (count($search_params['brd']) == $num_boards - 1 && !empty($modSettings['recycle_board']) && !in_array($modSettings['recycle_board'], $search_params['brd'])) {
617
+					$boardQuery = '!= ' . $modSettings['recycle_board'];
618
+		} else {
619
+					$boardQuery = 'IN (' . implode(', ', $search_params['brd']) . ')';
620
+		}
621
+	} else {
578 622
 			$boardQuery = '';
579
-		elseif (count($search_params['brd']) == $num_boards - 1 && !empty($modSettings['recycle_board']) && !in_array($modSettings['recycle_board'], $search_params['brd']))
580
-			$boardQuery = '!= ' . $modSettings['recycle_board'];
581
-		else
582
-			$boardQuery = 'IN (' . implode(', ', $search_params['brd']) . ')';
583 623
 	}
584
-	else
585
-		$boardQuery = '';
586 624
 
587 625
 	$search_params['show_complete'] = !empty($search_params['show_complete']) || !empty($_REQUEST['show_complete']);
588 626
 	$search_params['subject_only'] = !empty($search_params['subject_only']) || !empty($_REQUEST['subject_only']);
@@ -596,11 +634,13 @@  discard block
 block discarded – undo
596 634
 		'id_msg',
597 635
 	);
598 636
 	call_integration_hook('integrate_search_sort_columns', array(&$sort_columns));
599
-	if (empty($search_params['sort']) && !empty($_REQUEST['sort']))
600
-		list ($search_params['sort'], $search_params['sort_dir']) = array_pad(explode('|', $_REQUEST['sort']), 2, '');
637
+	if (empty($search_params['sort']) && !empty($_REQUEST['sort'])) {
638
+			list ($search_params['sort'], $search_params['sort_dir']) = array_pad(explode('|', $_REQUEST['sort']), 2, '');
639
+	}
601 640
 	$search_params['sort'] = !empty($search_params['sort']) && in_array($search_params['sort'], $sort_columns) ? $search_params['sort'] : 'relevance';
602
-	if (!empty($search_params['topic']) && $search_params['sort'] === 'num_replies')
603
-		$search_params['sort'] = 'id_msg';
641
+	if (!empty($search_params['topic']) && $search_params['sort'] === 'num_replies') {
642
+			$search_params['sort'] = 'id_msg';
643
+	}
604 644
 
605 645
 	// Sorting direction: descending unless stated otherwise.
606 646
 	$search_params['sort_dir'] = !empty($search_params['sort_dir']) && $search_params['sort_dir'] == 'asc' ? 'asc' : 'desc';
@@ -624,17 +664,19 @@  discard block
 block discarded – undo
624 664
 	// What are we searching for?
625 665
 	if (empty($search_params['search']))
626 666
 	{
627
-		if (isset($_GET['search']))
628
-			$search_params['search'] = un_htmlspecialchars($_GET['search']);
629
-		elseif (isset($_POST['search']))
630
-			$search_params['search'] = $_POST['search'];
631
-		else
632
-			$search_params['search'] = '';
667
+		if (isset($_GET['search'])) {
668
+					$search_params['search'] = un_htmlspecialchars($_GET['search']);
669
+		} elseif (isset($_POST['search'])) {
670
+					$search_params['search'] = $_POST['search'];
671
+		} else {
672
+					$search_params['search'] = '';
673
+		}
633 674
 	}
634 675
 
635 676
 	// Nothing??
636
-	if (!isset($search_params['search']) || $search_params['search'] == '')
637
-		$context['search_errors']['invalid_search_string'] = true;
677
+	if (!isset($search_params['search']) || $search_params['search'] == '') {
678
+			$context['search_errors']['invalid_search_string'] = true;
679
+	}
638 680
 	// Too long?
639 681
 	elseif ($smcFunc['strlen']($search_params['search']) > $context['search_string_limit'])
640 682
 	{
@@ -648,8 +690,9 @@  discard block
 block discarded – undo
648 690
 	$stripped_query = un_htmlspecialchars($smcFunc['strtolower']($stripped_query));
649 691
 
650 692
 	// This (hidden) setting will do fulltext searching in the most basic way.
651
-	if (!empty($modSettings['search_simple_fulltext']))
652
-		$stripped_query = strtr($stripped_query, array('"' => ''));
693
+	if (!empty($modSettings['search_simple_fulltext'])) {
694
+			$stripped_query = strtr($stripped_query, array('"' => ''));
695
+	}
653 696
 
654 697
 	$no_regexp = preg_match('~&#(?:\d{1,7}|x[0-9a-fA-F]{1,6});~', $stripped_query) === 1;
655 698
 
@@ -672,8 +715,9 @@  discard block
 block discarded – undo
672 715
 	{
673 716
 		if ($word === '-')
674 717
 		{
675
-			if (($word = trim($phraseArray[$index], '-_\' ')) !== '' && !in_array($word, $blacklisted_words))
676
-				$excludedWords[] = $word;
718
+			if (($word = trim($phraseArray[$index], '-_\' ')) !== '' && !in_array($word, $blacklisted_words)) {
719
+							$excludedWords[] = $word;
720
+			}
677 721
 			unset($phraseArray[$index]);
678 722
 		}
679 723
 	}
@@ -683,8 +727,9 @@  discard block
 block discarded – undo
683 727
 	{
684 728
 		if (strpos(trim($word), '-') === 0)
685 729
 		{
686
-			if (($word = trim($word, '-_\' ')) !== '' && !in_array($word, $blacklisted_words))
687
-				$excludedWords[] = $word;
730
+			if (($word = trim($word, '-_\' ')) !== '' && !in_array($word, $blacklisted_words)) {
731
+							$excludedWords[] = $word;
732
+			}
688 733
 			unset($wordArray[$index]);
689 734
 		}
690 735
 	}
@@ -697,8 +742,9 @@  discard block
 block discarded – undo
697 742
 	foreach ($searchArray as $index => $value)
698 743
 	{
699 744
 		// Skip anything practically empty.
700
-		if (($searchArray[$index] = trim($value, '-_\' ')) === '')
701
-			unset($searchArray[$index]);
745
+		if (($searchArray[$index] = trim($value, '-_\' ')) === '') {
746
+					unset($searchArray[$index]);
747
+		}
702 748
 		// Skip blacklisted words. Make sure to note we skipped them in case we end up with nothing.
703 749
 		elseif (in_array($searchArray[$index], $blacklisted_words))
704 750
 		{
@@ -716,31 +762,37 @@  discard block
 block discarded – undo
716 762
 
717 763
 	// Create an array of replacements for highlighting.
718 764
 	$context['mark'] = array();
719
-	foreach ($searchArray as $word)
720
-		$context['mark'][$word] = '<strong class="highlight">' . $word . '</strong>';
765
+	foreach ($searchArray as $word) {
766
+			$context['mark'][$word] = '<strong class="highlight">' . $word . '</strong>';
767
+	}
721 768
 
722 769
 	// Initialize two arrays storing the words that have to be searched for.
723 770
 	$orParts = array();
724 771
 	$searchWords = array();
725 772
 
726 773
 	// Make sure at least one word is being searched for.
727
-	if (empty($searchArray))
728
-		$context['search_errors']['invalid_search_string' . (!empty($foundBlackListedWords) ? '_blacklist' : '')] = true;
774
+	if (empty($searchArray)) {
775
+			$context['search_errors']['invalid_search_string' . (!empty($foundBlackListedWords) ? '_blacklist' : '')] = true;
776
+	}
729 777
 	// All words/sentences must match.
730
-	elseif (empty($search_params['searchtype']))
731
-		$orParts[0] = $searchArray;
778
+	elseif (empty($search_params['searchtype'])) {
779
+			$orParts[0] = $searchArray;
780
+	}
732 781
 	// Any word/sentence must match.
733
-	else
734
-		foreach ($searchArray as $index => $value)
782
+	else {
783
+			foreach ($searchArray as $index => $value)
735 784
 			$orParts[$index] = array($value);
785
+	}
736 786
 
737 787
 	// Don't allow duplicate error messages if one string is too short.
738
-	if (isset($context['search_errors']['search_string_small_words'], $context['search_errors']['invalid_search_string']))
739
-		unset($context['search_errors']['invalid_search_string']);
788
+	if (isset($context['search_errors']['search_string_small_words'], $context['search_errors']['invalid_search_string'])) {
789
+			unset($context['search_errors']['invalid_search_string']);
790
+	}
740 791
 	// Make sure the excluded words are in all or-branches.
741
-	foreach ($orParts as $orIndex => $andParts)
742
-		foreach ($excludedWords as $word)
792
+	foreach ($orParts as $orIndex => $andParts) {
793
+			foreach ($excludedWords as $word)
743 794
 			$orParts[$orIndex][] = $word;
795
+	}
744 796
 
745 797
 	// Determine the or-branches and the fulltext search words.
746 798
 	foreach ($orParts as $orIndex => $andParts)
@@ -754,8 +806,9 @@  discard block
 block discarded – undo
754 806
 		);
755 807
 
756 808
 		// Sort the indexed words (large words -> small words -> excluded words).
757
-		if ($searchAPI->supportsMethod('searchSort'))
758
-			usort($orParts[$orIndex], 'searchSort');
809
+		if ($searchAPI->supportsMethod('searchSort')) {
810
+					usort($orParts[$orIndex], 'searchSort');
811
+		}
759 812
 
760 813
 		foreach ($orParts[$orIndex] as $word)
761 814
 		{
@@ -767,15 +820,17 @@  discard block
 block discarded – undo
767 820
 			if (!$is_excluded || count($subjectWords) === 1)
768 821
 			{
769 822
 				$searchWords[$orIndex]['subject_words'] = array_merge($searchWords[$orIndex]['subject_words'], $subjectWords);
770
-				if ($is_excluded)
771
-					$excludedSubjectWords = array_merge($excludedSubjectWords, $subjectWords);
823
+				if ($is_excluded) {
824
+									$excludedSubjectWords = array_merge($excludedSubjectWords, $subjectWords);
825
+				}
826
+			} else {
827
+							$excludedPhrases[] = $word;
772 828
 			}
773
-			else
774
-				$excludedPhrases[] = $word;
775 829
 
776 830
 			// Have we got indexes to prepare?
777
-			if ($searchAPI->supportsMethod('prepareIndexes'))
778
-				$searchAPI->prepareIndexes($word, $searchWords[$orIndex], $excludedIndexWords, $is_excluded);
831
+			if ($searchAPI->supportsMethod('prepareIndexes')) {
832
+							$searchAPI->prepareIndexes($word, $searchWords[$orIndex], $excludedIndexWords, $is_excluded);
833
+			}
779 834
 		}
780 835
 
781 836
 		// Search_force_index requires all AND parts to have at least one fulltext word.
@@ -783,8 +838,7 @@  discard block
 block discarded – undo
783 838
 		{
784 839
 			$context['search_errors']['query_not_specific_enough'] = true;
785 840
 			break;
786
-		}
787
-		elseif ($search_params['subject_only'] && empty($searchWords[$orIndex]['subject_words']) && empty($excludedSubjectWords))
841
+		} elseif ($search_params['subject_only'] && empty($searchWords[$orIndex]['subject_words']) && empty($excludedSubjectWords))
788 842
 		{
789 843
 			$context['search_errors']['query_not_specific_enough'] = true;
790 844
 			break;
@@ -812,8 +866,9 @@  discard block
 block discarded – undo
812 866
 		$found_misspelling = false;
813 867
 		foreach ($searchArray as $word)
814 868
 		{
815
-			if (empty($link))
816
-				continue;
869
+			if (empty($link)) {
870
+							continue;
871
+			}
817 872
 
818 873
 			// Don't check phrases.
819 874
 			if (preg_match('~^\w+$~', $word) === 0)
@@ -828,8 +883,7 @@  discard block
 block discarded – undo
828 883
 				$did_you_mean['search'][] = $word;
829 884
 				$did_you_mean['display'][] = $smcFunc['htmlspecialchars']($word);
830 885
 				continue;
831
-			}
832
-			elseif (spell_check($link, $word))
886
+			} elseif (spell_check($link, $word))
833 887
 			{
834 888
 				$did_you_mean['search'][] = $word;
835 889
 				$did_you_mean['display'][] = $smcFunc['htmlspecialchars']($word);
@@ -840,11 +894,13 @@  discard block
 block discarded – undo
840 894
 			foreach ($suggestions as $i => $s)
841 895
 			{
842 896
 				// Search is case insensitive.
843
-				if ($smcFunc['strtolower']($s) == $smcFunc['strtolower']($word))
844
-					unset($suggestions[$i]);
897
+				if ($smcFunc['strtolower']($s) == $smcFunc['strtolower']($word)) {
898
+									unset($suggestions[$i]);
899
+				}
845 900
 				// Plus, don't suggest something the user thinks is rude!
846
-				elseif ($suggestions[$i] != censorText($s))
847
-					unset($suggestions[$i]);
901
+				elseif ($suggestions[$i] != censorText($s)) {
902
+									unset($suggestions[$i]);
903
+				}
848 904
 			}
849 905
 
850 906
 			// Anything found?  If so, correct it!
@@ -854,8 +910,7 @@  discard block
 block discarded – undo
854 910
 				$did_you_mean['search'][] = $suggestions[0];
855 911
 				$did_you_mean['display'][] = '<em><strong>' . $smcFunc['htmlspecialchars']($suggestions[0]) . '</strong></em>';
856 912
 				$found_misspelling = true;
857
-			}
858
-			else
913
+			} else
859 914
 			{
860 915
 				$did_you_mean['search'][] = $word;
861 916
 				$did_you_mean['display'][] = $smcFunc['htmlspecialchars']($word);
@@ -872,8 +927,7 @@  discard block
 block discarded – undo
872 927
 				{
873 928
 					$temp_excluded['search'][] = '-"' . $word . '"';
874 929
 					$temp_excluded['display'][] = '-&quot;' . $smcFunc['htmlspecialchars']($word) . '&quot;';
875
-				}
876
-				else
930
+				} else
877 931
 				{
878 932
 					$temp_excluded['search'][] = '-' . $word;
879 933
 					$temp_excluded['display'][] = '-' . $smcFunc['htmlspecialchars']($word);
@@ -885,11 +939,13 @@  discard block
 block discarded – undo
885 939
 
886 940
 			$temp_params = $search_params;
887 941
 			$temp_params['search'] = implode(' ', $did_you_mean['search']);
888
-			if (isset($temp_params['brd']))
889
-				$temp_params['brd'] = implode(',', $temp_params['brd']);
942
+			if (isset($temp_params['brd'])) {
943
+							$temp_params['brd'] = implode(',', $temp_params['brd']);
944
+			}
890 945
 			$context['params'] = array();
891
-			foreach ($temp_params as $k => $v)
892
-				$context['did_you_mean_params'][] = $k . '|\'|' . $v;
946
+			foreach ($temp_params as $k => $v) {
947
+							$context['did_you_mean_params'][] = $k . '|\'|' . $v;
948
+			}
893 949
 			$context['did_you_mean_params'] = base64_encode(implode('|"|', $context['did_you_mean_params']));
894 950
 			$context['did_you_mean'] = implode(' ', $did_you_mean['display']);
895 951
 		}
@@ -897,18 +953,20 @@  discard block
 block discarded – undo
897 953
 
898 954
 	// Let the user adjust the search query, should they wish?
899 955
 	$context['search_params'] = $search_params;
900
-	if (isset($context['search_params']['search']))
901
-		$context['search_params']['search'] = $smcFunc['htmlspecialchars']($context['search_params']['search']);
902
-	if (isset($context['search_params']['userspec']))
903
-		$context['search_params']['userspec'] = $smcFunc['htmlspecialchars']($context['search_params']['userspec']);
956
+	if (isset($context['search_params']['search'])) {
957
+			$context['search_params']['search'] = $smcFunc['htmlspecialchars']($context['search_params']['search']);
958
+	}
959
+	if (isset($context['search_params']['userspec'])) {
960
+			$context['search_params']['userspec'] = $smcFunc['htmlspecialchars']($context['search_params']['userspec']);
961
+	}
904 962
 
905 963
 	// Do we have captcha enabled?
906 964
 	if ($user_info['is_guest'] && !empty($modSettings['search_enable_captcha']) && empty($_SESSION['ss_vv_passed']) && (empty($_SESSION['last_ss']) || $_SESSION['last_ss'] != $search_params['search']))
907 965
 	{
908 966
 		// If we come from another search box tone down the error...
909
-		if (!isset($_REQUEST['search_vv']))
910
-			$context['search_errors']['need_verification_code'] = true;
911
-		else
967
+		if (!isset($_REQUEST['search_vv'])) {
968
+					$context['search_errors']['need_verification_code'] = true;
969
+		} else
912 970
 		{
913 971
 			require_once($sourcedir . '/Subs-Editor.php');
914 972
 			$verificationOptions = array(
@@ -918,12 +976,14 @@  discard block
 block discarded – undo
918 976
 
919 977
 			if (is_array($context['require_verification']))
920 978
 			{
921
-				foreach ($context['require_verification'] as $error)
922
-					$context['search_errors'][$error] = true;
979
+				foreach ($context['require_verification'] as $error) {
980
+									$context['search_errors'][$error] = true;
981
+				}
923 982
 			}
924 983
 			// Don't keep asking for it - they've proven themselves worthy.
925
-			else
926
-				$_SESSION['ss_vv_passed'] = true;
984
+			else {
985
+							$_SESSION['ss_vv_passed'] = true;
986
+			}
927 987
 		}
928 988
 	}
929 989
 
@@ -931,19 +991,22 @@  discard block
 block discarded – undo
931 991
 
932 992
 	// All search params have been checked, let's compile them to a single string... made less simple by PHP 4.3.9 and below.
933 993
 	$temp_params = $search_params;
934
-	if (isset($temp_params['brd']))
935
-		$temp_params['brd'] = implode(',', $temp_params['brd']);
994
+	if (isset($temp_params['brd'])) {
995
+			$temp_params['brd'] = implode(',', $temp_params['brd']);
996
+	}
936 997
 	$context['params'] = array();
937
-	foreach ($temp_params as $k => $v)
938
-		$context['params'][] = $k . '|\'|' . $v;
998
+	foreach ($temp_params as $k => $v) {
999
+			$context['params'][] = $k . '|\'|' . $v;
1000
+	}
939 1001
 
940 1002
 	if (!empty($context['params']))
941 1003
 	{
942 1004
 		// Due to old IE's 2083 character limit, we have to compress long search strings
943 1005
 		$params = @gzcompress(implode('|"|', $context['params']));
944 1006
 		// Gzcompress failed, use try non-gz
945
-		if (empty($params))
946
-			$params = implode('|"|', $context['params']);
1007
+		if (empty($params)) {
1008
+					$params = implode('|"|', $context['params']);
1009
+		}
947 1010
 		// Base64 encode, then replace +/= with uri safe ones that can be reverted
948 1011
 		$context['params'] = str_replace(array('+', '/', '='), array('-', '_', '.'), base64_encode($params));
949 1012
 	}
@@ -969,8 +1032,9 @@  discard block
 block discarded – undo
969 1032
 	}
970 1033
 
971 1034
 	// Spam me not, Spam-a-lot?
972
-	if (empty($_SESSION['last_ss']) || $_SESSION['last_ss'] != $search_params['search'])
973
-		spamProtection('search');
1035
+	if (empty($_SESSION['last_ss']) || $_SESSION['last_ss'] != $search_params['search']) {
1036
+			spamProtection('search');
1037
+	}
974 1038
 	// Store the last search string to allow pages of results to be browsed.
975 1039
 	$_SESSION['last_ss'] = $search_params['search'];
976 1040
 
@@ -1030,8 +1094,9 @@  discard block
 block discarded – undo
1030 1094
 						'where' => array(),
1031 1095
 					);
1032 1096
 
1033
-					if ($modSettings['postmod_active'])
1034
-						$subject_query['where'][] = 't.approved = {int:is_approved}';
1097
+					if ($modSettings['postmod_active']) {
1098
+											$subject_query['where'][] = 't.approved = {int:is_approved}';
1099
+					}
1035 1100
 
1036 1101
 					$numTables = 0;
1037 1102
 					$prev_join = 0;
@@ -1043,8 +1108,7 @@  discard block
 block discarded – undo
1043 1108
 						{
1044 1109
 							$subject_query['left_join'][] = '{db_prefix}log_search_subjects AS subj' . $numTables . ' ON (subj' . $numTables . '.word ' . (empty($modSettings['search_match_words']) ? 'LIKE {string:subject_words_' . $numTables . '_wild}' : '= {string:subject_words_' . $numTables . '}') . ' AND subj' . $numTables . '.id_topic = t.id_topic)';
1045 1110
 							$subject_query['where'][] = '(subj' . $numTables . '.word IS NULL)';
1046
-						}
1047
-						else
1111
+						} else
1048 1112
 						{
1049 1113
 							$subject_query['inner_join'][] = '{db_prefix}log_search_subjects AS subj' . $numTables . ' ON (subj' . $numTables . '.id_topic = ' . ($prev_join === 0 ? 't' : 'subj' . $prev_join) . '.id_topic)';
1050 1114
 							$subject_query['where'][] = 'subj' . $numTables . '.word ' . (empty($modSettings['search_match_words']) ? 'LIKE {string:subject_words_' . $numTables . '_wild}' : '= {string:subject_words_' . $numTables . '}');
@@ -1062,14 +1126,18 @@  discard block
 block discarded – undo
1062 1126
 						}
1063 1127
 						$subject_query['where'][] = $userQuery;
1064 1128
 					}
1065
-					if (!empty($search_params['topic']))
1066
-						$subject_query['where'][] = 't.id_topic = ' . $search_params['topic'];
1067
-					if (!empty($minMsgID))
1068
-						$subject_query['where'][] = 't.id_first_msg >= ' . $minMsgID;
1069
-					if (!empty($maxMsgID))
1070
-						$subject_query['where'][] = 't.id_last_msg <= ' . $maxMsgID;
1071
-					if (!empty($boardQuery))
1072
-						$subject_query['where'][] = 't.id_board ' . $boardQuery;
1129
+					if (!empty($search_params['topic'])) {
1130
+											$subject_query['where'][] = 't.id_topic = ' . $search_params['topic'];
1131
+					}
1132
+					if (!empty($minMsgID)) {
1133
+											$subject_query['where'][] = 't.id_first_msg >= ' . $minMsgID;
1134
+					}
1135
+					if (!empty($maxMsgID)) {
1136
+											$subject_query['where'][] = 't.id_last_msg <= ' . $maxMsgID;
1137
+					}
1138
+					if (!empty($boardQuery)) {
1139
+											$subject_query['where'][] = 't.id_board ' . $boardQuery;
1140
+					}
1073 1141
 					if (!empty($excludedPhrases))
1074 1142
 					{
1075 1143
 						if ($subject_query['from'] != '{db_prefix}messages AS m')
@@ -1089,8 +1157,9 @@  discard block
 block discarded – undo
1089 1157
 					foreach ($weight_factors as $type => $value)
1090 1158
 					{
1091 1159
 						$relevance .= $weight[$type];
1092
-						if (!empty($value['results']))
1093
-							$relevance .= ' * ' . $value['results'];
1160
+						if (!empty($value['results'])) {
1161
+													$relevance .= ' * ' . $value['results'];
1162
+						}
1094 1163
 						$relevance .= ' + ';
1095 1164
 					}
1096 1165
 					$relevance = substr($relevance, 0, -3) . ') / ' . $weight_total . ' AS relevance';
@@ -1128,20 +1197,23 @@  discard block
 block discarded – undo
1128 1197
 						while ($row = $smcFunc['db_fetch_row']($ignoreRequest))
1129 1198
 						{
1130 1199
 							// No duplicates!
1131
-							if (isset($inserts[$row[1]]))
1132
-								continue;
1200
+							if (isset($inserts[$row[1]])) {
1201
+															continue;
1202
+							}
1133 1203
 
1134
-							foreach ($row as $key => $value)
1135
-								$inserts[$row[1]][] = (int) $row[$key];
1204
+							foreach ($row as $key => $value) {
1205
+															$inserts[$row[1]][] = (int) $row[$key];
1206
+							}
1136 1207
 						}
1137 1208
 						$smcFunc['db_free_result']($ignoreRequest);
1138 1209
 						$numSubjectResults = count($inserts);
1210
+					} else {
1211
+											$numSubjectResults += $smcFunc['db_affected_rows']();
1139 1212
 					}
1140
-					else
1141
-						$numSubjectResults += $smcFunc['db_affected_rows']();
1142 1213
 
1143
-					if (!empty($modSettings['search_max_results']) && $numSubjectResults >= $modSettings['search_max_results'])
1144
-						break;
1214
+					if (!empty($modSettings['search_max_results']) && $numSubjectResults >= $modSettings['search_max_results']) {
1215
+											break;
1216
+					}
1145 1217
 				}
1146 1218
 
1147 1219
 				// If there's data to be inserted for non-IGNORE databases do it here!
@@ -1156,8 +1228,7 @@  discard block
 block discarded – undo
1156 1228
 				}
1157 1229
 
1158 1230
 				$_SESSION['search_cache']['num_results'] = $numSubjectResults;
1159
-			}
1160
-			else
1231
+			} else
1161 1232
 			{
1162 1233
 				$main_query = array(
1163 1234
 					'select' => array(
@@ -1189,8 +1260,7 @@  discard block
 block discarded – undo
1189 1260
 					$main_query['weights'] = $weight_factors;
1190 1261
 
1191 1262
 					$main_query['group_by'][] = 't.id_topic';
1192
-				}
1193
-				else
1263
+				} else
1194 1264
 				{
1195 1265
 					// This is outrageous!
1196 1266
 					$main_query['select']['id_topic'] = 'm.id_msg AS id_topic';
@@ -1211,8 +1281,9 @@  discard block
 block discarded – undo
1211 1281
 						$main_query['where'][] = 't.id_topic = {int:topic}';
1212 1282
 						$main_query['parameters']['topic'] = $search_params['topic'];
1213 1283
 					}
1214
-					if (!empty($search_params['show_complete']))
1215
-						$main_query['group_by'][] = 'm.id_msg, t.id_first_msg, t.id_last_msg';
1284
+					if (!empty($search_params['show_complete'])) {
1285
+											$main_query['group_by'][] = 'm.id_msg, t.id_first_msg, t.id_last_msg';
1286
+					}
1216 1287
 				}
1217 1288
 
1218 1289
 				// *** Get the subject results.
@@ -1237,14 +1308,15 @@  discard block
 block discarded – undo
1237 1308
 					) !== false;
1238 1309
 
1239 1310
 					// Clean up some previous cache.
1240
-					if (!$createTemporary)
1241
-						$smcFunc['db_search_query']('delete_log_search_topics', '
1311
+					if (!$createTemporary) {
1312
+											$smcFunc['db_search_query']('delete_log_search_topics', '
1242 1313
 							DELETE FROM {db_prefix}log_search_topics
1243 1314
 							WHERE id_search = {int:search_id}',
1244 1315
 							array(
1245 1316
 								'search_id' => $_SESSION['search_cache']['id_search'],
1246 1317
 							)
1247 1318
 						);
1319
+					}
1248 1320
 
1249 1321
 					foreach ($searchWords as $orIndex => $words)
1250 1322
 					{
@@ -1276,8 +1348,7 @@  discard block
 block discarded – undo
1276 1348
 								$subject_query['where'][] = '(subj' . $numTables . '.word IS NULL)';
1277 1349
 								$subject_query['where'][] = 'm.body NOT ' . (empty($modSettings['search_match_words']) || $no_regexp ? ' LIKE ' : ' RLIKE ') . '{string:body_not_' . $count . '}';
1278 1350
 								$subject_query['params']['body_not_' . $count++] = empty($modSettings['search_match_words']) || $no_regexp ? '%' . strtr($subjectWord, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $subjectWord), '\\\'') . '[[:>:]]';
1279
-							}
1280
-							else
1351
+							} else
1281 1352
 							{
1282 1353
 								$subject_query['inner_join'][] = '{db_prefix}log_search_subjects AS subj' . $numTables . ' ON (subj' . $numTables . '.id_topic = ' . ($prev_join === 0 ? 't' : 'subj' . $prev_join) . '.id_topic)';
1283 1354
 								$subject_query['where'][] = 'subj' . $numTables . '.word LIKE {string:subject_like_' . $count . '}';
@@ -1332,8 +1403,9 @@  discard block
 block discarded – undo
1332 1403
 						call_integration_hook('integrate_subject_search_query', array(&$subject_query));
1333 1404
 
1334 1405
 						// Nothing to search for?
1335
-						if (empty($subject_query['where']))
1336
-							continue;
1406
+						if (empty($subject_query['where'])) {
1407
+													continue;
1408
+						}
1337 1409
 
1338 1410
 						$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_topics', ($smcFunc['db_support_ignore'] ? ( '
1339 1411
 							INSERT IGNORE INTO {db_prefix}' . ($createTemporary ? 'tmp_' : '') . 'log_search_topics
@@ -1356,19 +1428,21 @@  discard block
 block discarded – undo
1356 1428
 							{
1357 1429
 								$ind = $createTemporary ? 0 : 1;
1358 1430
 								// No duplicates!
1359
-								if (isset($inserts[$row[$ind]]))
1360
-									continue;
1431
+								if (isset($inserts[$row[$ind]])) {
1432
+																	continue;
1433
+								}
1361 1434
 
1362 1435
 								$inserts[$row[$ind]] = $row;
1363 1436
 							}
1364 1437
 							$smcFunc['db_free_result']($ignoreRequest);
1365 1438
 							$numSubjectResults = count($inserts);
1439
+						} else {
1440
+													$numSubjectResults += $smcFunc['db_affected_rows']();
1366 1441
 						}
1367
-						else
1368
-							$numSubjectResults += $smcFunc['db_affected_rows']();
1369 1442
 
1370
-						if (!empty($modSettings['search_max_results']) && $numSubjectResults >= $modSettings['search_max_results'])
1371
-							break;
1443
+						if (!empty($modSettings['search_max_results']) && $numSubjectResults >= $modSettings['search_max_results']) {
1444
+													break;
1445
+						}
1372 1446
 					}
1373 1447
 
1374 1448
 					// Got some non-MySQL data to plonk in?
@@ -1386,8 +1460,9 @@  discard block
 block discarded – undo
1386 1460
 					{
1387 1461
 						$main_query['weights']['subject']['search'] = 'CASE WHEN MAX(lst.id_topic) IS NULL THEN 0 ELSE 1 END';
1388 1462
 						$main_query['left_join'][] = '{db_prefix}' . ($createTemporary ? 'tmp_' : '') . 'log_search_topics AS lst ON (' . ($createTemporary ? '' : 'lst.id_search = {int:id_search} AND ') . 'lst.id_topic = t.id_topic)';
1389
-						if (!$createTemporary)
1390
-							$main_query['parameters']['id_search'] = $_SESSION['search_cache']['id_search'];
1463
+						if (!$createTemporary) {
1464
+													$main_query['parameters']['id_search'] = $_SESSION['search_cache']['id_search'];
1465
+						}
1391 1466
 					}
1392 1467
 				}
1393 1468
 
@@ -1413,14 +1488,15 @@  discard block
 block discarded – undo
1413 1488
 					) !== false;
1414 1489
 
1415 1490
 					// Clear, all clear!
1416
-					if (!$createTemporary)
1417
-						$smcFunc['db_search_query']('delete_log_search_messages', '
1491
+					if (!$createTemporary) {
1492
+											$smcFunc['db_search_query']('delete_log_search_messages', '
1418 1493
 							DELETE FROM {db_prefix}log_search_messages
1419 1494
 							WHERE id_search = {int:id_search}',
1420 1495
 							array(
1421 1496
 								'id_search' => $_SESSION['search_cache']['id_search'],
1422 1497
 							)
1423 1498
 						);
1499
+					}
1424 1500
 
1425 1501
 					foreach ($searchWords as $orIndex => $words)
1426 1502
 					{
@@ -1454,19 +1530,21 @@  discard block
 block discarded – undo
1454 1530
 								while ($row = $smcFunc['db_fetch_row']($ignoreRequest))
1455 1531
 								{
1456 1532
 									// No duplicates!
1457
-									if (isset($inserts[$row[0]]))
1458
-										continue;
1533
+									if (isset($inserts[$row[0]])) {
1534
+																			continue;
1535
+									}
1459 1536
 
1460 1537
 									$inserts[$row[0]] = $row;
1461 1538
 								}
1462 1539
 								$smcFunc['db_free_result']($ignoreRequest);
1463 1540
 								$indexedResults = count($inserts);
1541
+							} else {
1542
+															$indexedResults += $smcFunc['db_affected_rows']();
1464 1543
 							}
1465
-							else
1466
-								$indexedResults += $smcFunc['db_affected_rows']();
1467 1544
 
1468
-							if (!empty($maxMessageResults) && $indexedResults >= $maxMessageResults)
1469
-								break;
1545
+							if (!empty($maxMessageResults) && $indexedResults >= $maxMessageResults) {
1546
+															break;
1547
+							}
1470 1548
 						}
1471 1549
 					}
1472 1550
 
@@ -1486,8 +1564,7 @@  discard block
 block discarded – undo
1486 1564
 						$context['search_errors']['query_not_specific_enough'] = true;
1487 1565
 						$_REQUEST['params'] = $context['params'];
1488 1566
 						return PlushSearch1();
1489
-					}
1490
-					elseif (!empty($indexedResults))
1567
+					} elseif (!empty($indexedResults))
1491 1568
 					{
1492 1569
 						$main_query['inner_join'][] = '{db_prefix}' . ($createTemporary ? 'tmp_' : '') . 'log_search_messages AS lsm ON (lsm.id_msg = m.id_msg)';
1493 1570
 						if (!$createTemporary)
@@ -1509,15 +1586,18 @@  discard block
 block discarded – undo
1509 1586
 						foreach ($words['all_words'] as $regularWord)
1510 1587
 						{
1511 1588
 							$where[] = 'm.body' . (in_array($regularWord, $excludedWords) ? ' NOT' : '') . (empty($modSettings['search_match_words']) || $no_regexp ? ' LIKE ' : ' RLIKE ') . '{string:all_word_body_' . $count . '}';
1512
-							if (in_array($regularWord, $excludedWords))
1513
-								$where[] = 'm.subject NOT' . (empty($modSettings['search_match_words']) || $no_regexp ? ' LIKE ' : ' RLIKE ') . '{string:all_word_body_' . $count . '}';
1589
+							if (in_array($regularWord, $excludedWords)) {
1590
+															$where[] = 'm.subject NOT' . (empty($modSettings['search_match_words']) || $no_regexp ? ' LIKE ' : ' RLIKE ') . '{string:all_word_body_' . $count . '}';
1591
+							}
1514 1592
 							$main_query['parameters']['all_word_body_' . $count++] = empty($modSettings['search_match_words']) || $no_regexp ? '%' . strtr($regularWord, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $regularWord), '\\\'') . '[[:>:]]';
1515 1593
 						}
1516
-						if (!empty($where))
1517
-							$orWhere[] = count($where) > 1 ? '(' . implode(' AND ', $where) . ')' : $where[0];
1594
+						if (!empty($where)) {
1595
+													$orWhere[] = count($where) > 1 ? '(' . implode(' AND ', $where) . ')' : $where[0];
1596
+						}
1597
+					}
1598
+					if (!empty($orWhere)) {
1599
+											$main_query['where'][] = count($orWhere) > 1 ? '(' . implode(' OR ', $orWhere) . ')' : $orWhere[0];
1518 1600
 					}
1519
-					if (!empty($orWhere))
1520
-						$main_query['where'][] = count($orWhere) > 1 ? '(' . implode(' OR ', $orWhere) . ')' : $orWhere[0];
1521 1601
 
1522 1602
 					if (!empty($userQuery))
1523 1603
 					{
@@ -1555,8 +1635,9 @@  discard block
 block discarded – undo
1555 1635
 					foreach ($main_query['weights'] as $type => $value)
1556 1636
 					{
1557 1637
 						$relevance .= $weight[$type];
1558
-						if (!empty($value['search']))
1559
-							$relevance .= ' * ' . $value['search'];
1638
+						if (!empty($value['search'])) {
1639
+													$relevance .= ' * ' . $value['search'];
1640
+						}
1560 1641
 						$relevance .= ' + ';
1561 1642
 						$new_weight_total += $weight[$type];
1562 1643
 					}
@@ -1587,11 +1668,13 @@  discard block
 block discarded – undo
1587 1668
 						while ($row = $smcFunc['db_fetch_row']($ignoreRequest))
1588 1669
 						{
1589 1670
 							// No duplicates!
1590
-							if (isset($inserts[$row[2]]))
1591
-								continue;
1671
+							if (isset($inserts[$row[2]])) {
1672
+															continue;
1673
+							}
1592 1674
 
1593
-							foreach ($row as $key => $value)
1594
-								$inserts[$row[2]][] = (int) $row[$key];
1675
+							foreach ($row as $key => $value) {
1676
+															$inserts[$row[2]][] = (int) $row[$key];
1677
+							}
1595 1678
 						}
1596 1679
 						$smcFunc['db_free_result']($ignoreRequest);
1597 1680
 
@@ -1599,8 +1682,9 @@  discard block
 block discarded – undo
1599 1682
 						if (!empty($inserts))
1600 1683
 						{
1601 1684
 							$query_columns = array();
1602
-							foreach ($main_query['select'] as $k => $v)
1603
-								$query_columns[$k] = 'int';
1685
+							foreach ($main_query['select'] as $k => $v) {
1686
+															$query_columns[$k] = 'int';
1687
+							}
1604 1688
 
1605 1689
 							$smcFunc['db_insert']('',
1606 1690
 								'{db_prefix}log_search_results',
@@ -1610,21 +1694,23 @@  discard block
 block discarded – undo
1610 1694
 							);
1611 1695
 						}
1612 1696
 						$_SESSION['search_cache']['num_results'] += count($inserts);
1697
+					} else {
1698
+											$_SESSION['search_cache']['num_results'] = $smcFunc['db_affected_rows']();
1613 1699
 					}
1614
-					else
1615
-						$_SESSION['search_cache']['num_results'] = $smcFunc['db_affected_rows']();
1616 1700
 				}
1617 1701
 
1618 1702
 				// Insert subject-only matches.
1619 1703
 				if ($_SESSION['search_cache']['num_results'] < $modSettings['search_max_results'] && $numSubjectResults !== 0)
1620 1704
 				{
1621 1705
 					$relevance = '1000 * (';
1622
-					foreach ($weight_factors as $type => $value)
1623
-						if (isset($value['results']))
1706
+					foreach ($weight_factors as $type => $value) {
1707
+											if (isset($value['results']))
1624 1708
 						{
1625 1709
 							$relevance .= $weight[$type];
1626
-							if (!empty($value['results']))
1627
-								$relevance .= ' * ' . $value['results'];
1710
+					}
1711
+							if (!empty($value['results'])) {
1712
+															$relevance .= ' * ' . $value['results'];
1713
+							}
1628 1714
 							$relevance .= ' + ';
1629 1715
 						}
1630 1716
 					$relevance = substr($relevance, 0, -3) . ') / ' . $weight_total . ' AS relevance';
@@ -1658,8 +1744,9 @@  discard block
 block discarded – undo
1658 1744
 						while ($row = $smcFunc['db_fetch_row']($ignoreRequest))
1659 1745
 						{
1660 1746
 							// No duplicates!
1661
-							if (isset($usedIDs[$row[1]]))
1662
-								continue;
1747
+							if (isset($usedIDs[$row[1]])) {
1748
+															continue;
1749
+							}
1663 1750
 
1664 1751
 							$usedIDs[$row[1]] = true;
1665 1752
 							$inserts[] = $row;
@@ -1677,12 +1764,12 @@  discard block
 block discarded – undo
1677 1764
 							);
1678 1765
 						}
1679 1766
 						$_SESSION['search_cache']['num_results'] += count($inserts);
1767
+					} else {
1768
+											$_SESSION['search_cache']['num_results'] += $smcFunc['db_affected_rows']();
1680 1769
 					}
1681
-					else
1682
-						$_SESSION['search_cache']['num_results'] += $smcFunc['db_affected_rows']();
1770
+				} elseif ($_SESSION['search_cache']['num_results'] == -1) {
1771
+									$_SESSION['search_cache']['num_results'] = 0;
1683 1772
 				}
1684
-				elseif ($_SESSION['search_cache']['num_results'] == -1)
1685
-					$_SESSION['search_cache']['num_results'] = 0;
1686 1773
 			}
1687 1774
 		}
1688 1775
 
@@ -1752,14 +1839,16 @@  discard block
 block discarded – undo
1752 1839
 			)
1753 1840
 		);
1754 1841
 		$posters = array();
1755
-		while ($row = $smcFunc['db_fetch_assoc']($request))
1756
-			$posters[] = $row['id_member'];
1842
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
1843
+					$posters[] = $row['id_member'];
1844
+		}
1757 1845
 		$smcFunc['db_free_result']($request);
1758 1846
 
1759 1847
 		call_integration_hook('integrate_search_message_list', array(&$msg_list, &$posters));
1760 1848
 
1761
-		if (!empty($posters))
1762
-			loadMemberData(array_unique($posters));
1849
+		if (!empty($posters)) {
1850
+					loadMemberData(array_unique($posters));
1851
+		}
1763 1852
 
1764 1853
 		// PG optimization to evade FIND_IN_SET
1765 1854
 		if ($smcFunc['db_title'] == 'PostgreSQL')
@@ -1768,8 +1857,9 @@  discard block
 block discarded – undo
1768 1857
 			$msg_list_size = count($msg_list);
1769 1858
 			for ($i = 0; $i < $msg_list_size; $i++)
1770 1859
 			{
1771
-				if ($i > 0)
1772
-					$orderJoin .= ',';
1860
+				if ($i > 0) {
1861
+									$orderJoin .= ',';
1862
+				}
1773 1863
 				$orderJoin .= '(' . $i . ',' . $msg_list[$i] . ')';
1774 1864
 			}
1775 1865
 
@@ -1809,8 +1899,9 @@  discard block
 block discarded – undo
1809 1899
 		);
1810 1900
 
1811 1901
 		// If there are no results that means the things in the cache got deleted, so pretend we have no topics anymore.
1812
-		if ($smcFunc['db_num_rows']($messages_request) == 0)
1813
-			$context['topics'] = array();
1902
+		if ($smcFunc['db_num_rows']($messages_request) == 0) {
1903
+					$context['topics'] = array();
1904
+		}
1814 1905
 
1815 1906
 		// If we want to know who participated in what then load this now.
1816 1907
 		if (!empty($modSettings['enableParticipation']) && !$user_info['is_guest'])
@@ -1828,8 +1919,9 @@  discard block
 block discarded – undo
1828 1919
 					'limit' => count($participants),
1829 1920
 				)
1830 1921
 			);
1831
-			while ($row = $smcFunc['db_fetch_assoc']($result))
1832
-				$participants[$row['id_topic']] = true;
1922
+			while ($row = $smcFunc['db_fetch_assoc']($result)) {
1923
+							$participants[$row['id_topic']] = true;
1924
+			}
1833 1925
 			$smcFunc['db_free_result']($result);
1834 1926
 		}
1835 1927
 	}
@@ -1838,15 +1930,17 @@  discard block
 block discarded – undo
1838 1930
 	$context['page_index'] = constructPageIndex($scripturl . '?action=search2;params=' . $context['params'], $_REQUEST['start'], $num_results, $modSettings['search_results_per_page'], false);
1839 1931
 
1840 1932
 	// Consider the search complete!
1841
-	if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2)
1842
-		cache_put_data('search_start:' . ($user_info['is_guest'] ? $user_info['ip'] : $user_info['id']), null, 90);
1933
+	if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) {
1934
+			cache_put_data('search_start:' . ($user_info['is_guest'] ? $user_info['ip'] : $user_info['id']), null, 90);
1935
+	}
1843 1936
 
1844 1937
 	$context['key_words'] = &$searchArray;
1845 1938
 
1846 1939
 	// Setup the default topic icons... for checking they exist and the like!
1847 1940
 	$context['icon_sources'] = array();
1848
-	foreach ($context['stable_icons'] as $icon)
1849
-		$context['icon_sources'][$icon] = 'images_url';
1941
+	foreach ($context['stable_icons'] as $icon) {
1942
+			$context['icon_sources'][$icon] = 'images_url';
1943
+	}
1850 1944
 
1851 1945
 	$context['sub_template'] = 'results';
1852 1946
 	$context['page_title'] = $txt['search_results'];
@@ -1877,26 +1971,31 @@  discard block
 block discarded – undo
1877 1971
 	global $boards_can, $participants, $smcFunc;
1878 1972
 	static $recycle_board = null;
1879 1973
 
1880
-	if ($recycle_board === null)
1881
-		$recycle_board = !empty($modSettings['recycle_enable']) && !empty($modSettings['recycle_board']) ? (int) $modSettings['recycle_board'] : 0;
1974
+	if ($recycle_board === null) {
1975
+			$recycle_board = !empty($modSettings['recycle_enable']) && !empty($modSettings['recycle_board']) ? (int) $modSettings['recycle_board'] : 0;
1976
+	}
1882 1977
 
1883 1978
 	// Remember which message this is.  (ie. reply #83)
1884 1979
 	static $counter = null;
1885
-	if ($counter == null || $reset)
1886
-		$counter = $_REQUEST['start'] + 1;
1980
+	if ($counter == null || $reset) {
1981
+			$counter = $_REQUEST['start'] + 1;
1982
+	}
1887 1983
 
1888 1984
 	// If the query returned false, bail.
1889
-	if ($messages_request == false)
1890
-		return false;
1985
+	if ($messages_request == false) {
1986
+			return false;
1987
+	}
1891 1988
 
1892 1989
 	// Start from the beginning...
1893
-	if ($reset)
1894
-		return @$smcFunc['db_data_seek']($messages_request, 0);
1990
+	if ($reset) {
1991
+			return @$smcFunc['db_data_seek']($messages_request, 0);
1992
+	}
1895 1993
 
1896 1994
 	// Attempt to get the next message.
1897 1995
 	$message = $smcFunc['db_fetch_assoc']($messages_request);
1898
-	if (!$message)
1899
-		return false;
1996
+	if (!$message) {
1997
+			return false;
1998
+	}
1900 1999
 
1901 2000
 	// Can't have an empty subject can we?
1902 2001
 	$message['subject'] = $message['subject'] != '' ? $message['subject'] : $txt['no_subject'];
@@ -1935,9 +2034,9 @@  discard block
 block discarded – undo
1935 2034
 
1936 2035
 		if ($smcFunc['strlen']($message['body']) > $charLimit)
1937 2036
 		{
1938
-			if (empty($context['key_words']))
1939
-				$message['body'] = $smcFunc['substr']($message['body'], 0, $charLimit) . '<strong>...</strong>';
1940
-			else
2037
+			if (empty($context['key_words'])) {
2038
+							$message['body'] = $smcFunc['substr']($message['body'], 0, $charLimit) . '<strong>...</strong>';
2039
+			} else
1941 2040
 			{
1942 2041
 				$matchString = '';
1943 2042
 				$force_partial_word = false;
@@ -1946,18 +2045,20 @@  discard block
 block discarded – undo
1946 2045
 					$keyword = un_htmlspecialchars($keyword);
1947 2046
 					$keyword = preg_replace_callback('~(&amp;#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', strtr($keyword, array('\\\'' => '\'', '&' => '&amp;')));
1948 2047
 
1949
-					if (preg_match('~[\'\.,/@%&;:(){}\[\]_\-+\\\\]$~', $keyword) != 0 || preg_match('~^[\'\.,/@%&;:(){}\[\]_\-+\\\\]~', $keyword) != 0)
1950
-						$force_partial_word = true;
2048
+					if (preg_match('~[\'\.,/@%&;:(){}\[\]_\-+\\\\]$~', $keyword) != 0 || preg_match('~^[\'\.,/@%&;:(){}\[\]_\-+\\\\]~', $keyword) != 0) {
2049
+											$force_partial_word = true;
2050
+					}
1951 2051
 					$matchString .= strtr(preg_quote($keyword, '/'), array('\*' => '.+?')) . '|';
1952 2052
 				}
1953 2053
 				$matchString = un_htmlspecialchars(substr($matchString, 0, -1));
1954 2054
 
1955 2055
 				$message['body'] = un_htmlspecialchars(strtr($message['body'], array('&nbsp;' => ' ', '<br>' => "\n", '&#91;' => '[', '&#93;' => ']', '&#58;' => ':', '&#64;' => '@')));
1956 2056
 
1957
-				if (empty($modSettings['search_method']) || $force_partial_word)
1958
-					preg_match_all('/([^\s\W]{' . $charLimit . '}[\s\W]|[\s\W].{0,' . $charLimit . '}?|^)(' . $matchString . ')(.{0,' . $charLimit . '}[\s\W]|[^\s\W]{0,' . $charLimit . '})/is' . ($context['utf8'] ? 'u' : ''), $message['body'], $matches);
1959
-				else
1960
-					preg_match_all('/([^\s\W]{' . $charLimit . '}[\s\W]|[\s\W].{0,' . $charLimit . '}?[\s\W]|^)(' . $matchString . ')([\s\W].{0,' . $charLimit . '}[\s\W]|[\s\W][^\s\W]{0,' . $charLimit . '})/is' . ($context['utf8'] ? 'u' : ''), $message['body'], $matches);
2057
+				if (empty($modSettings['search_method']) || $force_partial_word) {
2058
+									preg_match_all('/([^\s\W]{' . $charLimit . '}[\s\W]|[\s\W].{0,' . $charLimit . '}?|^)(' . $matchString . ')(.{0,' . $charLimit . '}[\s\W]|[^\s\W]{0,' . $charLimit . '})/is' . ($context['utf8'] ? 'u' : ''), $message['body'], $matches);
2059
+				} else {
2060
+									preg_match_all('/([^\s\W]{' . $charLimit . '}[\s\W]|[\s\W].{0,' . $charLimit . '}?[\s\W]|^)(' . $matchString . ')([\s\W].{0,' . $charLimit . '}[\s\W]|[\s\W][^\s\W]{0,' . $charLimit . '})/is' . ($context['utf8'] ? 'u' : ''), $message['body'], $matches);
2061
+				}
1961 2062
 
1962 2063
 				$message['body'] = '';
1963 2064
 				foreach ($matches[0] as $index => $match)
@@ -1970,8 +2071,7 @@  discard block
 block discarded – undo
1970 2071
 			// Re-fix the international characters.
1971 2072
 			$message['body'] = preg_replace_callback('~(&amp;#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $message['body']);
1972 2073
 		}
1973
-	}
1974
-	else
2074
+	} else
1975 2075
 	{
1976 2076
 		// Run BBC interpreter on the message.
1977 2077
 		$message['body'] = parse_bbc($message['body'], $message['smileys_enabled'], $message['id_msg']);
@@ -1990,21 +2090,26 @@  discard block
 block discarded – undo
1990 2090
 	// Sadly, we need to check the icon ain't broke.
1991 2091
 	if (!empty($modSettings['messageIconChecks_enable']))
1992 2092
 	{
1993
-		if (!isset($context['icon_sources'][$message['first_icon']]))
1994
-			$context['icon_sources'][$message['first_icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['first_icon'] . '.png') ? 'images_url' : 'default_images_url';
1995
-		if (!isset($context['icon_sources'][$message['last_icon']]))
1996
-			$context['icon_sources'][$message['last_icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['last_icon'] . '.png') ? 'images_url' : 'default_images_url';
1997
-		if (!isset($context['icon_sources'][$message['icon']]))
1998
-			$context['icon_sources'][$message['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['icon'] . '.png') ? 'images_url' : 'default_images_url';
1999
-	}
2000
-	else
2093
+		if (!isset($context['icon_sources'][$message['first_icon']])) {
2094
+					$context['icon_sources'][$message['first_icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['first_icon'] . '.png') ? 'images_url' : 'default_images_url';
2095
+		}
2096
+		if (!isset($context['icon_sources'][$message['last_icon']])) {
2097
+					$context['icon_sources'][$message['last_icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['last_icon'] . '.png') ? 'images_url' : 'default_images_url';
2098
+		}
2099
+		if (!isset($context['icon_sources'][$message['icon']])) {
2100
+					$context['icon_sources'][$message['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['icon'] . '.png') ? 'images_url' : 'default_images_url';
2101
+		}
2102
+	} else
2001 2103
 	{
2002
-		if (!isset($context['icon_sources'][$message['first_icon']]))
2003
-			$context['icon_sources'][$message['first_icon']] = 'images_url';
2004
-		if (!isset($context['icon_sources'][$message['last_icon']]))
2005
-			$context['icon_sources'][$message['last_icon']] = 'images_url';
2006
-		if (!isset($context['icon_sources'][$message['icon']]))
2007
-			$context['icon_sources'][$message['icon']] = 'images_url';
2104
+		if (!isset($context['icon_sources'][$message['first_icon']])) {
2105
+					$context['icon_sources'][$message['first_icon']] = 'images_url';
2106
+		}
2107
+		if (!isset($context['icon_sources'][$message['last_icon']])) {
2108
+					$context['icon_sources'][$message['last_icon']] = 'images_url';
2109
+		}
2110
+		if (!isset($context['icon_sources'][$message['icon']])) {
2111
+					$context['icon_sources'][$message['icon']] = 'images_url';
2112
+		}
2008 2113
 	}
2009 2114
 
2010 2115
 	// Do we have quote tag enabled?
@@ -2014,12 +2119,14 @@  discard block
 block discarded – undo
2014 2119
 	$colorClass = 'windowbg';
2015 2120
 
2016 2121
 	// Sticky topics should get a different color, too.
2017
-	if ($message['is_sticky'])
2018
-		$colorClass .= ' sticky';
2122
+	if ($message['is_sticky']) {
2123
+			$colorClass .= ' sticky';
2124
+	}
2019 2125
 
2020 2126
 	// Locked topics get special treatment as well.
2021
-	if ($message['locked'])
2022
-		$colorClass .= ' locked';
2127
+	if ($message['locked']) {
2128
+			$colorClass .= ' locked';
2129
+	}
2023 2130
 
2024 2131
 	$output = array_merge($context['topics'][$message['id_msg']], array(
2025 2132
 		'id' => $message['id_topic'],
@@ -2163,8 +2270,9 @@  discard block
 block discarded – undo
2163 2270
 
2164 2271
 	// Load up the search API we are going to use.
2165 2272
 	$modSettings['search_index'] = empty($modSettings['search_index']) ? 'standard' : $modSettings['search_index'];
2166
-	if (!file_exists($sourcedir . '/SearchAPI-' . ucwords($modSettings['search_index']) . '.php'))
2167
-		fatal_lang_error('search_api_missing');
2273
+	if (!file_exists($sourcedir . '/SearchAPI-' . ucwords($modSettings['search_index']) . '.php')) {
2274
+			fatal_lang_error('search_api_missing');
2275
+	}
2168 2276
 	require_once($sourcedir . '/SearchAPI-' . ucwords($modSettings['search_index']) . '.php');
2169 2277
 
2170 2278
 	// Create an instance of the search API and check it is valid for this version of SMF.
Please login to merge, or discard this patch.
Sources/DbSearch-postgresql.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 	$version = $smcFunc['db_get_version']();
39 39
 	// if we got a Beta Version
40 40
 	if (stripos($version, 'beta') !== false)
41
-		$version = substr($version, 0, stripos($version, 'beta')).'.0';
41
+		$version = substr($version, 0, stripos($version, 'beta')) . '.0';
42 42
 	// or RC
43 43
 	if (stripos($version, 'rc') !== false)
44
-		$version = substr($version, 0, stripos($version, 'rc')).'.0';
44
+		$version = substr($version, 0, stripos($version, 'rc')) . '.0';
45 45
 
46
-	if (version_compare($version,'9.5.0','>='))
46
+	if (version_compare($version, '9.5.0', '>='))
47 47
 		$smcFunc['db_support_ignore'] = true;
48 48
 }
49 49
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
  */
56 56
 function smf_db_search_support($search_type)
57 57
 {
58
-	$supported_types = array('custom','fulltext');
58
+	$supported_types = array('custom', 'fulltext');
59 59
 
60 60
 	return in_array($search_type, $supported_types);
61 61
 }
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
 	if (preg_match('~^\s*INSERT\sIGNORE~i', $db_string) != 0)
110 110
 	{
111 111
 		$db_string = preg_replace('~^\s*INSERT\sIGNORE~i', 'INSERT', $db_string);
112
-		if ($smcFunc['db_support_ignore']){
112
+		if ($smcFunc['db_support_ignore']) {
113 113
 			//pg style "INSERT INTO.... ON CONFLICT DO NOTHING"
114
-			$db_string = $db_string.' ON CONFLICT DO NOTHING';
114
+			$db_string = $db_string . ' ON CONFLICT DO NOTHING';
115 115
 		}
116 116
 		else
117 117
 		{
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		$language_ftx = $modSettings['search_language'];
169 169
 	else
170 170
 	{
171
-		$request = $smcFunc['db_query']('','
171
+		$request = $smcFunc['db_query']('', '
172 172
 			SELECT cfgname FROM pg_ts_config WHERE oid = current_setting({string:default_language})::regconfig',
173 173
 			array(
174 174
 			'default_language' => 'default_text_search_config'
Please login to merge, or discard this patch.
Braces   +25 added lines, -19 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 4
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  *  Add the file functions to the $smcFunc array.
@@ -23,29 +24,33 @@  discard block
 block discarded – undo
23 24
 {
24 25
 	global $smcFunc;
25 26
 
26
-	if (!isset($smcFunc['db_search_query']) || $smcFunc['db_search_query'] != 'smf_db_search_query')
27
-		$smcFunc += array(
27
+	if (!isset($smcFunc['db_search_query']) || $smcFunc['db_search_query'] != 'smf_db_search_query') {
28
+			$smcFunc += array(
28 29
 			'db_search_query' => 'smf_db_search_query',
29 30
 			'db_search_support' => 'smf_db_search_support',
30 31
 			'db_create_word_search' => 'smf_db_create_word_search',
31 32
 			'db_support_ignore' => false,
32 33
 			'db_search_language' => 'smf_db_search_language',
33 34
 		);
35
+	}
34 36
 
35 37
 	db_extend();
36 38
 
37 39
 	//pg 9.5 got ignore support
38 40
 	$version = $smcFunc['db_get_version']();
39 41
 	// if we got a Beta Version
40
-	if (stripos($version, 'beta') !== false)
41
-		$version = substr($version, 0, stripos($version, 'beta')).'.0';
42
+	if (stripos($version, 'beta') !== false) {
43
+			$version = substr($version, 0, stripos($version, 'beta')).'.0';
44
+	}
42 45
 	// or RC
43
-	if (stripos($version, 'rc') !== false)
44
-		$version = substr($version, 0, stripos($version, 'rc')).'.0';
46
+	if (stripos($version, 'rc') !== false) {
47
+			$version = substr($version, 0, stripos($version, 'rc')).'.0';
48
+	}
45 49
 
46
-	if (version_compare($version,'9.5.0','>='))
47
-		$smcFunc['db_support_ignore'] = true;
48
-}
50
+	if (version_compare($version,'9.5.0','>=')) {
51
+			$smcFunc['db_support_ignore'] = true;
52
+	}
53
+	}
49 54
 
50 55
 /**
51 56
  * This function will tell you whether this database type supports this search type.
@@ -104,16 +109,16 @@  discard block
 block discarded – undo
104 109
 		),
105 110
 	);
106 111
 
107
-	if (isset($replacements[$identifier]))
108
-		$db_string = preg_replace(array_keys($replacements[$identifier]), array_values($replacements[$identifier]), $db_string);
112
+	if (isset($replacements[$identifier])) {
113
+			$db_string = preg_replace(array_keys($replacements[$identifier]), array_values($replacements[$identifier]), $db_string);
114
+	}
109 115
 	if (preg_match('~^\s*INSERT\sIGNORE~i', $db_string) != 0)
110 116
 	{
111 117
 		$db_string = preg_replace('~^\s*INSERT\sIGNORE~i', 'INSERT', $db_string);
112 118
 		if ($smcFunc['db_support_ignore']){
113 119
 			//pg style "INSERT INTO.... ON CONFLICT DO NOTHING"
114 120
 			$db_string = $db_string.' ON CONFLICT DO NOTHING';
115
-		}
116
-		else
121
+		} else
117 122
 		{
118 123
 			// Don't error on multi-insert.
119 124
 			$db_values['db_error_skip'] = true;
@@ -121,8 +126,9 @@  discard block
 block discarded – undo
121 126
 	}
122 127
 
123 128
 	//fix double quotes
124
-	if ($identifier == 'insert_into_log_messages_fulltext')
125
-		$db_values = str_replace('"', "'", $db_values);
129
+	if ($identifier == 'insert_into_log_messages_fulltext') {
130
+			$db_values = str_replace('"', "'", $db_values);
131
+	}
126 132
 
127 133
 	$return = $smcFunc['db_query']('', $db_string,
128 134
 		$db_values, $connection
@@ -164,9 +170,9 @@  discard block
 block discarded – undo
164 170
 
165 171
 	$language_ftx = 'english';
166 172
 
167
-	if (!empty($modSettings['search_language']))
168
-		$language_ftx = $modSettings['search_language'];
169
-	else
173
+	if (!empty($modSettings['search_language'])) {
174
+			$language_ftx = $modSettings['search_language'];
175
+	} else
170 176
 	{
171 177
 		$request = $smcFunc['db_query']('','
172 178
 			SELECT cfgname FROM pg_ts_config WHERE oid = current_setting({string:default_language})::regconfig',
Please login to merge, or discard this patch.
Themes/default/Errors.template.php 1 patch
Braces   +24 added lines, -17 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 {
24 24
 	global $context, $txt;
25 25
 
26
-	if (!empty($context['simple_action']))
27
-		echo '
26
+	if (!empty($context['simple_action'])) {
27
+			echo '
28 28
 		<strong>
29 29
 			', $context['error_title'], '
30 30
 		</strong><br>
31 31
 		<div ', $context['error_code'], 'class="padding">', $context['error_message'], '</div>';
32
-	else
32
+	} else
33 33
 	{
34 34
 		echo '
35 35
 	<div id="fatal_error">
@@ -82,21 +82,23 @@  discard block
 block discarded – undo
82 82
 						&nbsp;&nbsp;', $txt['apply_filter_of_type'], ':';
83 83
 
84 84
 	$error_types = array();
85
-	foreach ($context['error_types'] as $type => $details)
86
-		$error_types[] = ($details['is_selected'] ? '<img src="' . $settings['images_url'] . '/selected.png" alt=""> ' : '') . '<a href="' . $details['url'] . '" ' . ($details['is_selected'] ? 'style="font-weight: bold;"' : '') . ' title="' . $details['description'] . '">' . $details['label'] . '</a>';
85
+	foreach ($context['error_types'] as $type => $details) {
86
+			$error_types[] = ($details['is_selected'] ? '<img src="' . $settings['images_url'] . '/selected.png" alt=""> ' : '') . '<a href="' . $details['url'] . '" ' . ($details['is_selected'] ? 'style="font-weight: bold;"' : '') . ' title="' . $details['description'] . '">' . $details['label'] . '</a>';
87
+	}
87 88
 
88 89
 	echo '
89 90
 						', implode('&nbsp;|&nbsp;', $error_types), '
90 91
 					</td>
91 92
 				</tr>';
92 93
 
93
-	if ($context['has_filter'])
94
-		echo '
94
+	if ($context['has_filter']) {
95
+			echo '
95 96
 				<tr>
96 97
 					<td colspan="3" class="windowbg">
97 98
 						<strong>&nbsp;&nbsp;', $txt['applying_filter'], ':</strong> ', $context['filter']['entity'], ' ', $context['filter']['value']['html'], '&nbsp;&nbsp;[<a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', '">', $txt['clear_filter'], '</a>]
98 99
 					</td>
99 100
 				</tr>';
101
+	}
100 102
 
101 103
 	echo '
102 104
 				<tr>
@@ -107,11 +109,12 @@  discard block
 block discarded – undo
107 109
 				</tr>';
108 110
 
109 111
 	// No errors, then show a message
110
-	if (count($context['errors']) == 0)
111
-		echo '
112
+	if (count($context['errors']) == 0) {
113
+			echo '
112 114
 				<tr class="windowbg">
113 115
 					<td class="centertext" colspan="2">', $txt['errlog_no_entries'], '</td>
114 116
 				</tr>';
117
+	}
115 118
 
116 119
 	// we have some errors, must be some mods installed :P
117 120
 	foreach ($context['errors'] as $error)
@@ -125,19 +128,21 @@  discard block
 block discarded – undo
125 128
 							<a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? '' : ';desc', $context['has_filter'] ? $context['filter']['href'] : '', '" title="', $txt['reverse_direction'], '"><span class="generic_icons sort_' . $context['sort_direction'] . '"></span></a>
126 129
 							', $error['time'], '<br>';
127 130
 
128
-		if (!empty($error['member']['ip']))
129
-			echo '
131
+		if (!empty($error['member']['ip'])) {
132
+					echo '
130 133
 							<a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=ip;value=', $error['member']['ip'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_ip'], '"><span class="generic_icons filter centericon"></span></a>
131 134
 							<strong><a href="', $scripturl, '?action=trackip;searchip=', $error['member']['ip'], '">', $error['member']['ip'], '</a></strong>&nbsp;&nbsp;<br>';
135
+		}
132 136
 
133 137
 		echo '
134 138
 						</div>
135 139
 						<div style="float: left; width: 50%; line-height: 1.8em; padding: 0 4px;">';
136 140
 
137
-		if ($error['member']['session'] != '')
138
-			echo '
141
+		if ($error['member']['session'] != '') {
142
+					echo '
139 143
 							<a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=session;value=', $error['member']['session'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_session'], '"><span class="generic_icons filter centericon"></span></a>
140 144
 							', $error['member']['session'], '<br>';
145
+		}
141 146
 
142 147
 		echo '
143 148
 							<a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=error_type;value=', $error['error_type']['type'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_type'], '"><span class="generic_icons filter centericon"></span></a>
@@ -151,8 +156,8 @@  discard block
 block discarded – undo
151 156
 							<a style="display: table-cell;" href="', $error['url']['html'], '">', $error['url']['html'], '</a>
152 157
 						</div>';
153 158
 
154
-		if (!empty($error['file']))
155
-			echo '
159
+		if (!empty($error['file'])) {
160
+					echo '
156 161
 						<div style="float: left; width: 100%; padding: 4px 0; line-height: 1.6em; border-top: 1px solid #e3e3e3;">
157 162
 							<a style="display: table-cell; padding: 4px; width: 20px; vertical-align: top;" href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=file;value=', $error['file']['search'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_file'], '"><span class="generic_icons filter"></span></a>
158 163
 							<div>
@@ -160,6 +165,7 @@  discard block
 block discarded – undo
160 165
 								', $txt['line'], ': ', $error['file']['line'], '
161 166
 							</div>
162 167
 						</div>';
168
+		}
163 169
 
164 170
 		echo '
165 171
 					</td>
@@ -187,9 +193,10 @@  discard block
 block discarded – undo
187 193
 				</div>
188 194
 			</div>';
189 195
 
190
-	if ($context['sort_direction'] == 'down')
191
-		echo '
196
+	if ($context['sort_direction'] == 'down') {
197
+			echo '
192 198
 			<input type="hidden" name="desc" value="1">';
199
+	}
193 200
 
194 201
 	echo '
195 202
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
Please login to merge, or discard this patch.
Sources/Profile.php 1 patch
Braces   +155 added lines, -118 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@  discard block
 block discarded – undo
15 15
  * @version 2.1 Beta 4
16 16
  */
17 17
 
18
-if (!defined('SMF'))
18
+if (!defined('SMF')) {
19 19
 	die('No direct access...');
20
+}
20 21
 
21 22
 /**
22 23
  * The main designating function for modifying profiles. Loads up info, determins what to do, etc.
@@ -29,18 +30,21 @@  discard block
 block discarded – undo
29 30
 	global $modSettings, $memberContext, $profile_vars, $post_errors, $smcFunc;
30 31
 
31 32
 	// Don't reload this as we may have processed error strings.
32
-	if (empty($post_errors))
33
-		loadLanguage('Profile+Drafts');
33
+	if (empty($post_errors)) {
34
+			loadLanguage('Profile+Drafts');
35
+	}
34 36
 	loadTemplate('Profile');
35 37
 
36 38
 	require_once($sourcedir . '/Subs-Menu.php');
37 39
 
38 40
 	// Did we get the user by name...
39
-	if (isset($_REQUEST['user']))
40
-		$memberResult = loadMemberData($_REQUEST['user'], true, 'profile');
41
+	if (isset($_REQUEST['user'])) {
42
+			$memberResult = loadMemberData($_REQUEST['user'], true, 'profile');
43
+	}
41 44
 	// ... or by id_member?
42
-	elseif (!empty($_REQUEST['u']))
43
-		$memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile');
45
+	elseif (!empty($_REQUEST['u'])) {
46
+			$memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile');
47
+	}
44 48
 	// If it was just ?action=profile, edit your own profile, but only if you're not a guest.
45 49
 	else
46 50
 	{
@@ -50,8 +54,9 @@  discard block
 block discarded – undo
50 54
 	}
51 55
 
52 56
 	// Check if loadMemberData() has returned a valid result.
53
-	if (!$memberResult)
54
-		fatal_lang_error('not_a_user', false, 404);
57
+	if (!$memberResult) {
58
+			fatal_lang_error('not_a_user', false, 404);
59
+	}
55 60
 
56 61
 	// If all went well, we have a valid member ID!
57 62
 	list ($memID) = $memberResult;
@@ -67,8 +72,9 @@  discard block
 block discarded – undo
67 72
 
68 73
 	// Group management isn't actually a permission. But we need it to be for this, so we need a phantom permission.
69 74
 	// And we care about what the current user can do, not what the user whose profile it is.
70
-	if ($user_info['mod_cache']['gq'] != '0=1')
71
-		$user_info['permissions'][] = 'approve_group_requests';
75
+	if ($user_info['mod_cache']['gq'] != '0=1') {
76
+			$user_info['permissions'][] = 'approve_group_requests';
77
+	}
72 78
 
73 79
 	// If paid subscriptions are enabled, make sure we actually have at least one subscription available...
74 80
 	$context['subs_available'] = false;
@@ -436,21 +442,25 @@  discard block
 block discarded – undo
436 442
 		foreach ($section['areas'] as $area_id => $area)
437 443
 		{
438 444
 			// If it said no permissions that meant it wasn't valid!
439
-			if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any']))
440
-				$profile_areas[$section_id]['areas'][$area_id]['enabled'] = false;
445
+			if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any'])) {
446
+							$profile_areas[$section_id]['areas'][$area_id]['enabled'] = false;
447
+			}
441 448
 			// Otherwise pick the right set.
442
-			else
443
-				$profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any'];
449
+			else {
450
+							$profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any'];
451
+			}
444 452
 
445 453
 			// Password required in most cases
446
-			if (!empty($area['password']))
447
-				$context['password_areas'][] = $area_id;
454
+			if (!empty($area['password'])) {
455
+							$context['password_areas'][] = $area_id;
456
+			}
448 457
 		}
449 458
 	}
450 459
 
451 460
 	// Is there an updated message to show?
452
-	if (isset($_GET['updated']))
453
-		$context['profile_updated'] = $txt['profile_updated_own'];
461
+	if (isset($_GET['updated'])) {
462
+			$context['profile_updated'] = $txt['profile_updated_own'];
463
+	}
454 464
 
455 465
 	// Set a few options for the menu.
456 466
 	$menuOptions = array(
@@ -465,8 +475,9 @@  discard block
 block discarded – undo
465 475
 	$profile_include_data = createMenu($profile_areas, $menuOptions);
466 476
 
467 477
 	// No menu means no access.
468
-	if (!$profile_include_data && (!$user_info['is_guest'] || validateSession()))
469
-		fatal_lang_error('no_access', false);
478
+	if (!$profile_include_data && (!$user_info['is_guest'] || validateSession())) {
479
+			fatal_lang_error('no_access', false);
480
+	}
470 481
 
471 482
 	// Make a note of the Unique ID for this menu.
472 483
 	$context['profile_menu_id'] = $context['max_menu_id'];
@@ -492,8 +503,9 @@  discard block
 block discarded – undo
492 503
 			if ($current_area == $area_id)
493 504
 			{
494 505
 				// This can't happen - but is a security check.
495
-				if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($area['enabled']) && $area['enabled'] == false))
496
-					fatal_lang_error('no_access', false);
506
+				if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($area['enabled']) && $area['enabled'] == false)) {
507
+									fatal_lang_error('no_access', false);
508
+				}
497 509
 
498 510
 				// Are we saving data in a valid area?
499 511
 				if (isset($area['sc']) && (isset($_REQUEST['save']) || $context['do_preview']))
@@ -512,12 +524,14 @@  discard block
 block discarded – undo
512 524
 				}
513 525
 
514 526
 				// Does this require session validating?
515
-				if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner']))
516
-					$security_checks['validate'] = true;
527
+				if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner'])) {
528
+									$security_checks['validate'] = true;
529
+				}
517 530
 
518 531
 				// Permissions for good measure.
519
-				if (!empty($profile_include_data['permission']))
520
-					$security_checks['permission'] = $profile_include_data['permission'];
532
+				if (!empty($profile_include_data['permission'])) {
533
+									$security_checks['permission'] = $profile_include_data['permission'];
534
+				}
521 535
 
522 536
 				// Either way got something.
523 537
 				$found_area = true;
@@ -526,21 +540,26 @@  discard block
 block discarded – undo
526 540
 	}
527 541
 
528 542
 	// Oh dear, some serious security lapse is going on here... we'll put a stop to that!
529
-	if (!$found_area)
530
-		fatal_lang_error('no_access', false);
543
+	if (!$found_area) {
544
+			fatal_lang_error('no_access', false);
545
+	}
531 546
 
532 547
 	// Release this now.
533 548
 	unset($profile_areas);
534 549
 
535 550
 	// Now the context is setup have we got any security checks to carry out additional to that above?
536
-	if (isset($security_checks['session']))
537
-		checkSession($security_checks['session']);
538
-	if (isset($security_checks['validate']))
539
-		validateSession();
540
-	if (isset($security_checks['validateToken']))
541
-		validateToken($token_name, $token_type);
542
-	if (isset($security_checks['permission']))
543
-		isAllowedTo($security_checks['permission']);
551
+	if (isset($security_checks['session'])) {
552
+			checkSession($security_checks['session']);
553
+	}
554
+	if (isset($security_checks['validate'])) {
555
+			validateSession();
556
+	}
557
+	if (isset($security_checks['validateToken'])) {
558
+			validateToken($token_name, $token_type);
559
+	}
560
+	if (isset($security_checks['permission'])) {
561
+			isAllowedTo($security_checks['permission']);
562
+	}
544 563
 
545 564
 	// Create a token if needed.
546 565
 	if (isset($security_checks['needsToken']) || isset($security_checks['validateToken']))
@@ -550,8 +569,9 @@  discard block
 block discarded – undo
550 569
 	}
551 570
 
552 571
 	// File to include?
553
-	if (isset($profile_include_data['file']))
554
-		require_once($sourcedir . '/' . $profile_include_data['file']);
572
+	if (isset($profile_include_data['file'])) {
573
+			require_once($sourcedir . '/' . $profile_include_data['file']);
574
+	}
555 575
 
556 576
 	// Build the link tree.
557 577
 	$context['linktree'][] = array(
@@ -559,17 +579,19 @@  discard block
 block discarded – undo
559 579
 		'name' => sprintf($txt['profile_of_username'], $context['member']['name']),
560 580
 	);
561 581
 
562
-	if (!empty($profile_include_data['label']))
563
-		$context['linktree'][] = array(
582
+	if (!empty($profile_include_data['label'])) {
583
+			$context['linktree'][] = array(
564 584
 			'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'],
565 585
 			'name' => $profile_include_data['label'],
566 586
 		);
587
+	}
567 588
 
568
-	if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label'])
569
-		$context['linktree'][] = array(
589
+	if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label']) {
590
+			$context['linktree'][] = array(
570 591
 			'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'] . ';sa=' . $profile_include_data['current_subsection'],
571 592
 			'name' => $profile_include_data['subsections'][$profile_include_data['current_subsection']][0],
572 593
 		);
594
+	}
573 595
 
574 596
 	// Set the template for this area and add the profile layer.
575 597
 	$context['sub_template'] = $profile_include_data['function'];
@@ -595,12 +617,14 @@  discard block
 block discarded – undo
595 617
 		if ($check_password)
596 618
 		{
597 619
 			// Check to ensure we're forcing SSL for authentication
598
-			if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on'))
599
-				fatal_lang_error('login_ssl_required');
620
+			if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) {
621
+							fatal_lang_error('login_ssl_required');
622
+			}
600 623
 
601 624
 			// You didn't even enter a password!
602
-			if (trim($_POST['oldpasswrd']) == '')
603
-				$post_errors[] = 'no_password';
625
+			if (trim($_POST['oldpasswrd']) == '') {
626
+							$post_errors[] = 'no_password';
627
+			}
604 628
 
605 629
 			// Since the password got modified due to all the $_POST cleaning, lets undo it so we can get the correct password
606 630
 			$_POST['oldpasswrd'] = un_htmlspecialchars($_POST['oldpasswrd']);
@@ -609,42 +633,43 @@  discard block
 block discarded – undo
609 633
 			$good_password = in_array(true, call_integration_hook('integrate_verify_password', array($cur_profile['member_name'], $_POST['oldpasswrd'], false)), true);
610 634
 
611 635
 			// Bad password!!!
612
-			if (!$good_password && !hash_verify_password($user_profile[$memID]['member_name'], un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])), $user_info['passwd']))
613
-				$post_errors[] = 'bad_password';
636
+			if (!$good_password && !hash_verify_password($user_profile[$memID]['member_name'], un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])), $user_info['passwd'])) {
637
+							$post_errors[] = 'bad_password';
638
+			}
614 639
 
615 640
 			// Warn other elements not to jump the gun and do custom changes!
616
-			if (in_array('bad_password', $post_errors))
617
-				$context['password_auth_failed'] = true;
641
+			if (in_array('bad_password', $post_errors)) {
642
+							$context['password_auth_failed'] = true;
643
+			}
618 644
 		}
619 645
 
620 646
 		// Change the IP address in the database.
621
-		if ($context['user']['is_owner'])
622
-			$profile_vars['member_ip'] = $user_info['ip'];
647
+		if ($context['user']['is_owner']) {
648
+					$profile_vars['member_ip'] = $user_info['ip'];
649
+		}
623 650
 
624 651
 		// Now call the sub-action function...
625 652
 		if ($current_area == 'activateaccount')
626 653
 		{
627
-			if (empty($post_errors))
628
-				activateAccount($memID);
629
-		}
630
-		elseif ($current_area == 'deleteaccount')
654
+			if (empty($post_errors)) {
655
+							activateAccount($memID);
656
+			}
657
+		} elseif ($current_area == 'deleteaccount')
631 658
 		{
632 659
 			if (empty($post_errors))
633 660
 			{
634 661
 				deleteAccount2($memID);
635 662
 				redirectexit();
636 663
 			}
637
-		}
638
-		elseif ($current_area == 'groupmembership' && empty($post_errors))
664
+		} elseif ($current_area == 'groupmembership' && empty($post_errors))
639 665
 		{
640 666
 			$msg = groupMembership2($profile_vars, $post_errors, $memID);
641 667
 
642 668
 			// Whatever we've done, we have nothing else to do here...
643 669
 			redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=groupmembership' . (!empty($msg) ? ';msg=' . $msg : ''));
644
-		}
645
-		elseif (in_array($current_area, array('account', 'forumprofile', 'theme')))
646
-			saveProfileFields();
647
-		else
670
+		} elseif (in_array($current_area, array('account', 'forumprofile', 'theme'))) {
671
+					saveProfileFields();
672
+		} else
648 673
 		{
649 674
 			$force_redirect = true;
650 675
 			// Ensure we include this.
@@ -660,34 +685,36 @@  discard block
 block discarded – undo
660 685
 			// Load the language file so we can give a nice explanation of the errors.
661 686
 			loadLanguage('Errors');
662 687
 			$context['post_errors'] = $post_errors;
663
-		}
664
-		elseif (!empty($profile_vars))
688
+		} elseif (!empty($profile_vars))
665 689
 		{
666 690
 			// If we've changed the password, notify any integration that may be listening in.
667
-			if (isset($profile_vars['passwd']))
668
-				call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2']));
691
+			if (isset($profile_vars['passwd'])) {
692
+							call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2']));
693
+			}
669 694
 
670 695
 			updateMemberData($memID, $profile_vars);
671 696
 
672 697
 			// What if this is the newest member?
673
-			if ($modSettings['latestMember'] == $memID)
674
-				updateStats('member');
675
-			elseif (isset($profile_vars['real_name']))
676
-				updateSettings(array('memberlist_updated' => time()));
698
+			if ($modSettings['latestMember'] == $memID) {
699
+							updateStats('member');
700
+			} elseif (isset($profile_vars['real_name'])) {
701
+							updateSettings(array('memberlist_updated' => time()));
702
+			}
677 703
 
678 704
 			// If the member changed his/her birthdate, update calendar statistics.
679
-			if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name']))
680
-				updateSettings(array(
705
+			if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name'])) {
706
+							updateSettings(array(
681 707
 					'calendar_updated' => time(),
682 708
 				));
709
+			}
683 710
 
684 711
 			// Anything worth logging?
685 712
 			if (!empty($context['log_changes']) && !empty($modSettings['modlog_enabled']))
686 713
 			{
687 714
 				$log_changes = array();
688 715
 				require_once($sourcedir . '/Logging.php');
689
-				foreach ($context['log_changes'] as $k => $v)
690
-					$log_changes[] = array(
716
+				foreach ($context['log_changes'] as $k => $v) {
717
+									$log_changes[] = array(
691 718
 						'action' => $k,
692 719
 						'log_type' => 'user',
693 720
 						'extra' => array_merge($v, array(
@@ -695,14 +722,16 @@  discard block
 block discarded – undo
695 722
 							'member_affected' => $memID,
696 723
 						)),
697 724
 					);
725
+				}
698 726
 
699 727
 				logActions($log_changes);
700 728
 			}
701 729
 
702 730
 			// Have we got any post save functions to execute?
703
-			if (!empty($context['profile_execute_on_save']))
704
-				foreach ($context['profile_execute_on_save'] as $saveFunc)
731
+			if (!empty($context['profile_execute_on_save'])) {
732
+							foreach ($context['profile_execute_on_save'] as $saveFunc)
705 733
 					$saveFunc();
734
+			}
706 735
 
707 736
 			// Let them know it worked!
708 737
 			$context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $cur_profile['member_name']);
@@ -716,27 +745,31 @@  discard block
 block discarded – undo
716 745
 	if (!empty($post_errors))
717 746
 	{
718 747
 		// Set all the errors so the template knows what went wrong.
719
-		foreach ($post_errors as $error_type)
720
-			$context['modify_error'][$error_type] = true;
748
+		foreach ($post_errors as $error_type) {
749
+					$context['modify_error'][$error_type] = true;
750
+		}
721 751
 	}
722 752
 	// If it's you then we should redirect upon save.
723
-	elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview'])
724
-		redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated');
725
-	elseif (!empty($force_redirect))
726
-		redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area);
753
+	elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview']) {
754
+			redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated');
755
+	} elseif (!empty($force_redirect)) {
756
+			redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area);
757
+	}
727 758
 
728 759
 
729 760
 	// Get the right callable.
730 761
 	$call = call_helper($profile_include_data['function'], true);
731 762
 
732 763
 	// Is it valid?
733
-	if (!empty($call))
734
-		call_user_func($call, $memID);
764
+	if (!empty($call)) {
765
+			call_user_func($call, $memID);
766
+	}
735 767
 
736 768
 	// Set the page title if it's not already set...
737
-	if (!isset($context['page_title']))
738
-		$context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : '');
739
-}
769
+	if (!isset($context['page_title'])) {
770
+			$context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : '');
771
+	}
772
+	}
740 773
 
741 774
 /**
742 775
  * Set up the requirements for the profile popup - the area that is shown as the popup menu for the current user.
@@ -859,16 +892,18 @@  discard block
 block discarded – undo
859 892
 	if (!allowedTo('admin_forum') && $area != 'register')
860 893
 	{
861 894
 		// If it's the owner they can see two types of private fields, regardless.
862
-		if ($memID == $user_info['id'])
863
-			$where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)';
864
-		else
865
-			$where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0';
895
+		if ($memID == $user_info['id']) {
896
+					$where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)';
897
+		} else {
898
+					$where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0';
899
+		}
866 900
 	}
867 901
 
868
-	if ($area == 'register')
869
-		$where .= ' AND show_reg != 0';
870
-	elseif ($area != 'summary')
871
-		$where .= ' AND show_profile = {string:area}';
902
+	if ($area == 'register') {
903
+			$where .= ' AND show_reg != 0';
904
+	} elseif ($area != 'summary') {
905
+			$where .= ' AND show_profile = {string:area}';
906
+	}
872 907
 
873 908
 	// Load all the relevant fields - and data.
874 909
 	$request = $smcFunc['db_query']('', '
@@ -894,13 +929,15 @@  discard block
 block discarded – undo
894 929
 		if (isset($_POST['customfield']) && isset($_POST['customfield'][$row['col_name']]))
895 930
 		{
896 931
 			$value = $smcFunc['htmlspecialchars']($_POST['customfield'][$row['col_name']]);
897
-			if (in_array($row['field_type'], array('select', 'radio')))
898
-					$value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : '';
932
+			if (in_array($row['field_type'], array('select', 'radio'))) {
933
+								$value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : '';
934
+			}
899 935
 		}
900 936
 
901 937
 		// Don't show the "disabled" option for the "gender" field if we are on the "summary" area.
902
-		if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'Disabled')
903
-			continue;
938
+		if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'Disabled') {
939
+					continue;
940
+		}
904 941
 
905 942
 		// HTML for the input form.
906 943
 		$output_html = $value;
@@ -909,8 +946,7 @@  discard block
 block discarded – undo
909 946
 			$true = (!$exists && $row['default_value']) || $value;
910 947
 			$input_html = '<input type="checkbox" name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . ($true ? ' checked' : '') . '>';
911 948
 			$output_html = $true ? $txt['yes'] : $txt['no'];
912
-		}
913
-		elseif ($row['field_type'] == 'select')
949
+		} elseif ($row['field_type'] == 'select')
914 950
 		{
915 951
 			$input_html = '<select name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"><option value="-1"></option>';
916 952
 			$options = explode(',', $row['field_options']);
@@ -918,13 +954,13 @@  discard block
 block discarded – undo
918 954
 			{
919 955
 				$true = (!$exists && $row['default_value'] == $v) || $value == $v;
920 956
 				$input_html .= '<option value="' . $k . '"' . ($true ? ' selected' : '') . '>' . $v . '</option>';
921
-				if ($true)
922
-					$output_html = $v;
957
+				if ($true) {
958
+									$output_html = $v;
959
+				}
923 960
 			}
924 961
 
925 962
 			$input_html .= '</select>';
926
-		}
927
-		elseif ($row['field_type'] == 'radio')
963
+		} elseif ($row['field_type'] == 'radio')
928 964
 		{
929 965
 			$input_html = '<fieldset>';
930 966
 			$options = explode(',', $row['field_options']);
@@ -932,36 +968,37 @@  discard block
 block discarded – undo
932 968
 			{
933 969
 				$true = (!$exists && $row['default_value'] == $v) || $value == $v;
934 970
 				$input_html .= '<label for="customfield_' . $row['col_name'] . '_' . $k . '"><input type="radio" name="customfield[' . $row['col_name'] . ']" id="customfield_' . $row['col_name'] . '_' . $k . '" value="' . $k . '"' . ($true ? ' checked' : '') . '>' . $v . '</label><br>';
935
-				if ($true)
936
-					$output_html = $v;
971
+				if ($true) {
972
+									$output_html = $v;
973
+				}
937 974
 			}
938 975
 			$input_html .= '</fieldset>';
939
-		}
940
-		elseif ($row['field_type'] == 'text')
976
+		} elseif ($row['field_type'] == 'text')
941 977
 		{
942 978
 			$input_html = '<input type="text" name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . ($row['field_length'] != 0 ? ' maxlength="' . $row['field_length'] . '"' : '') . ' size="' . ($row['field_length'] == 0 || $row['field_length'] >= 50 ? 50 : ($row['field_length'] > 30 ? 30 : ($row['field_length'] > 10 ? 20 : 10))) . '" value="' . un_htmlspecialchars($value) . '"' . ($row['show_reg'] == 2 ? ' required' : '') . '>';
943
-		}
944
-		else
979
+		} else
945 980
 		{
946 981
 			@list ($rows, $cols) = @explode(',', $row['default_value']);
947 982
 			$input_html = '<textarea name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . (!empty($rows) ? ' rows="' . $rows . '"' : '') . (!empty($cols) ? ' cols="' . $cols . '"' : '') . ($row['show_reg'] == 2 ? ' required' : '') . '>' . un_htmlspecialchars($value) . '</textarea>';
948 983
 		}
949 984
 
950 985
 		// Parse BBCode
951
-		if ($row['bbc'])
952
-			$output_html = parse_bbc($output_html);
953
-		elseif ($row['field_type'] == 'textarea')
954
-			// Allow for newlines at least
986
+		if ($row['bbc']) {
987
+					$output_html = parse_bbc($output_html);
988
+		} elseif ($row['field_type'] == 'textarea') {
989
+					// Allow for newlines at least
955 990
 			$output_html = strtr($output_html, array("\n" => '<br>'));
991
+		}
956 992
 
957 993
 		// Enclosing the user input within some other text?
958
-		if (!empty($row['enclose']) && !empty($output_html))
959
-			$output_html = strtr($row['enclose'], array(
994
+		if (!empty($row['enclose']) && !empty($output_html)) {
995
+					$output_html = strtr($row['enclose'], array(
960 996
 				'{SCRIPTURL}' => $scripturl,
961 997
 				'{IMAGES_URL}' => $settings['images_url'],
962 998
 				'{DEFAULT_IMAGES_URL}' => $settings['default_images_url'],
963 999
 				'{INPUT}' => un_htmlspecialchars($output_html),
964 1000
 			));
1001
+		}
965 1002
 
966 1003
 		$context['custom_fields'][] = array(
967 1004
 			'name' => $row['field_name'],
Please login to merge, or discard this patch.