Completed
Pull Request — release-2.1 (#4574)
by Matthew
07:51
created
Packages/backups/index.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Try to handle it with the upper level index.php. (it should know what to do.)
4
-if (file_exists(dirname(dirname(__FILE__)) . '/index.php'))
4
+if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) {
5 5
 	include (dirname(dirname(__FILE__)) . '/index.php');
6
-else
6
+} else {
7 7
 	exit;
8
+}
8 9
 
9 10
 ?>
10 11
\ No newline at end of file
Please login to merge, or discard this patch.
ssi_examples.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -583,8 +583,7 @@  discard block
 block discarded – undo
583 583
 	{
584 584
 		$header = '<?php require("' . ($user_info['is_admin'] ? addslashes(realpath($boarddir . '/SSI.php')) : 'SSI.php') . '"); ?>' . "\n" . $header;
585 585
 		return $header . template_homepage_sample1_html() . $footer;
586
-	}
587
-	else
586
+	} else
588 587
 	{
589 588
 		echo $header;
590 589
 		template_homepage_sample1_php();
@@ -599,9 +598,10 @@  discard block
 block discarded – undo
599 598
 
600 599
 	$topics = ssi_recentTopics(8, null, null, 'array');
601 600
 
602
-	foreach ($topics as $topic)
603
-		echo '
601
+	foreach ($topics as $topic) {
602
+			echo '
604 603
 			<li><a href="', $topic['href'], '">', $topic['subject'], '</a> ', $txt['by'], ' ', $topic['poster']['link'], '</li>';
604
+	}
605 605
 
606 606
 	unset($topics);
607 607
 
Please login to merge, or discard this patch.
Themes/default/SplitTopics.template.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 				</div>
102 102
 				<ul id="messages_not_selected" class="split_messages smalltext">';
103 103
 
104
-	foreach ($context['not_selected']['messages'] as $message)
105
-		echo '
104
+	foreach ($context['not_selected']['messages'] as $message) {
105
+			echo '
106 106
 					<li class="windowbg" id="not_selected_', $message['id'], '">
107 107
 						<div class="message_header">
108 108
 							<a class="split_icon floatright" href="', $scripturl, '?action=splittopics;sa=selectTopics;subname=', $context['topic']['subject'], ';topic=', $context['topic']['id'], '.', $context['not_selected']['start'], ';start2=', $context['selected']['start'], ';move=down;msg=', $message['id'], '" onclick="return select(\'down\', ', $message['id'], ');"><span class="generic_icons split_sel" title="-&gt;"></span></a>
@@ -111,6 +111,7 @@  discard block
 block discarded – undo
111 111
 						</div>
112 112
 						<div class="post">', $message['body'], '</div>
113 113
 					</li>';
114
+	}
114 115
 
115 116
 	echo '
116 117
 					<li class="dummy">
@@ -130,8 +131,8 @@  discard block
 block discarded – undo
130 131
 				</div>
131 132
 				<ul id="messages_selected" class="split_messages smalltext">';
132 133
 
133
-	if (!empty($context['selected']['messages']))
134
-		foreach ($context['selected']['messages'] as $message)
134
+	if (!empty($context['selected']['messages'])) {
135
+			foreach ($context['selected']['messages'] as $message)
135 136
 			echo '
136 137
 					<li class="windowbg" id="selected_', $message['id'], '">
137 138
 						<div class="message_header">
@@ -141,6 +142,7 @@  discard block
 block discarded – undo
141 142
 						</div>
142 143
 						<div class="post">', $message['body'], '</div>
143 144
 					</li>';
145
+	}
144 146
 
145 147
 	echo '
146 148
 					<li class="dummy">
Please login to merge, or discard this patch.
Sources/Mentions.php 1 patch
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 			)
51 51
 		);
52 52
 		$members = array();
53
-		while ($row = $smcFunc['db_fetch_assoc']($request))
54
-			$members[$row['id_member']] = array(
53
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
54
+					$members[$row['id_member']] = array(
55 55
 				'id' => $row['id_member'],
56 56
 				'real_name' => $row['real_name'],
57 57
 				'email_address' => $row['email_address'],
@@ -62,6 +62,7 @@  discard block
 block discarded – undo
62 62
 				),
63 63
 				'lngfile' => $row['lngfile'],
64 64
 			);
65
+		}
65 66
 		$smcFunc['db_free_result']($request);
66 67
 
67 68
 		return $members;
@@ -83,13 +84,14 @@  discard block
 block discarded – undo
83 84
 
84 85
 		call_integration_hook('mention_insert_' . $content_type, array($content_id, &$members));
85 86
 
86
-		foreach ($members as $member)
87
-			$smcFunc['db_insert']('ignore',
87
+		foreach ($members as $member) {
88
+					$smcFunc['db_insert']('ignore',
88 89
 				'{db_prefix}mentions',
89 90
 				array('content_id' => 'int', 'content_type' => 'string', 'id_member' => 'int', 'id_mentioned' => 'int', 'time' => 'int'),
90 91
 				array((int) $content_id, $content_type, $id_member, $member['id'], time()),
91 92
 				array('content_id', 'content_type', 'id_mentioned')
92 93
 			);
94
+		}
93 95
 	}
94 96
 
95 97
 	/**
@@ -103,8 +105,9 @@  discard block
 block discarded – undo
103 105
 	 */
104 106
 	public static function getBody($body, array $members)
105 107
 	{
106
-		foreach ($members as $member)
107
-			$body = str_ireplace(static::$char . $member['real_name'], '[member=' . $member['id'] . ']' . $member['real_name'] . '[/member]', $body);
108
+		foreach ($members as $member) {
109
+					$body = str_ireplace(static::$char . $member['real_name'], '[member=' . $member['id'] . ']' . $member['real_name'] . '[/member]', $body);
110
+		}
108 111
 
109 112
 		return $body;
110 113
 	}
@@ -123,8 +126,9 @@  discard block
 block discarded – undo
123 126
 
124 127
 		$possible_names = self::getPossibleMentions($body);
125 128
 
126
-		if (empty($possible_names) || !allowedTo('mention'))
127
-			return array();
129
+		if (empty($possible_names) || !allowedTo('mention')) {
130
+					return array();
131
+		}
128 132
 
129 133
 		$request = $smcFunc['db_query']('', '
130 134
 			SELECT id_member, real_name
@@ -140,8 +144,9 @@  discard block
 block discarded – undo
140 144
 		$members = array();
141 145
 		while ($row = $smcFunc['db_fetch_assoc']($request))
142 146
 		{
143
-			if (stripos($body, static::$char . $row['real_name']) === false)
144
-				continue;
147
+			if (stripos($body, static::$char . $row['real_name']) === false) {
148
+							continue;
149
+			}
145 150
 
146 151
 			$members[$row['id_member']] = array(
147 152
 				'id' => $row['id_member'],
@@ -185,8 +190,9 @@  discard block
 block discarded – undo
185 190
 		$body = htmlspecialchars_decode(preg_replace('~<br\s*/?\>~', "\n", str_replace('&nbsp;', ' ', $body)), ENT_QUOTES);
186 191
 
187 192
 		// Remove quotes, we don't want to get double mentions.
188
-		while (preg_match('~\[quote[^\]]*\](.+?)\[\/quote\]~s', $body))
189
-			$body = preg_replace('~\[quote[^\]]*\](.+?)\[\/quote\]~s', '', $body);
193
+		while (preg_match('~\[quote[^\]]*\](.+?)\[\/quote\]~s', $body)) {
194
+					$body = preg_replace('~\[quote[^\]]*\](.+?)\[\/quote\]~s', '', $body);
195
+		}
190 196
 
191 197
 		$matches = array();
192 198
 		$string = str_split($body);
@@ -197,9 +203,9 @@  discard block
 block discarded – undo
197 203
 			{
198 204
 				$depth++;
199 205
 				$matches[] = array();
206
+			} elseif ($char == "\n") {
207
+							$depth = 0;
200 208
 			}
201
-			elseif ($char == "\n")
202
-				$depth = 0;
203 209
 
204 210
 			for ($i = $depth; $i > 0; $i--)
205 211
 			{
@@ -212,8 +218,9 @@  discard block
 block discarded – undo
212 218
 			}
213 219
 		}
214 220
 
215
-		foreach ($matches as $k => $match)
216
-			$matches[$k] = substr(implode('', $match), 1);
221
+		foreach ($matches as $k => $match) {
222
+					$matches[$k] = substr(implode('', $match), 1);
223
+		}
217 224
 
218 225
 		// Names can have spaces, other breaks, or they can't...we try to match every possible
219 226
 		// combination.
@@ -223,8 +230,9 @@  discard block
 block discarded – undo
223 230
 			$match = preg_split('/([^\w])/', $match, -1, PREG_SPLIT_DELIM_CAPTURE);
224 231
 			$count = count($match);
225 232
 			
226
-			for ($i = 1; $i <= $count; $i++)
227
-				$names[] = $smcFunc['htmlspecialchars']($smcFunc['htmltrim'](implode('', array_slice($match, 0, $i))));
233
+			for ($i = 1; $i <= $count; $i++) {
234
+							$names[] = $smcFunc['htmlspecialchars']($smcFunc['htmltrim'](implode('', array_slice($match, 0, $i))));
235
+			}
228 236
 		}
229 237
 
230 238
 		$names = array_unique($names);
Please login to merge, or discard this patch.
Sources/tasks/GroupAct-Notify.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -132,8 +132,9 @@  discard block
 block discarded – undo
132 132
 						'GROUPNAME' => $user['group_name'],
133 133
 					);
134 134
 
135
-					if (!empty($custom_reason))
136
-						$replacements['REASON'] = $custom_reason;
135
+					if (!empty($custom_reason)) {
136
+											$replacements['REASON'] = $custom_reason;
137
+					}
137 138
 
138 139
 					$emaildata = loadEmailTemplate($email_template_name, $replacements, $user['language']);
139 140
 
@@ -142,8 +143,8 @@  discard block
 block discarded – undo
142 143
 			}
143 144
 
144 145
 			// Insert the alerts if any
145
-			if (!empty($alert_rows))
146
-				$smcFunc['db_insert']('',
146
+			if (!empty($alert_rows)) {
147
+							$smcFunc['db_insert']('',
147 148
 					'{db_prefix}user_alerts',
148 149
 					array(
149 150
 						'alert_time' => 'int', 'id_member' => 'int', 'content_type' => 'string',
@@ -152,6 +153,7 @@  discard block
 block discarded – undo
152 153
 					$alert_rows,
153 154
 					array()
154 155
 				);
156
+			}
155 157
 		}
156 158
 
157 159
 		return true;
Please login to merge, or discard this patch.
Sources/tasks/EventNew-Notify.php 1 patch
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,8 +32,9 @@  discard block
 block discarded – undo
32 32
 		$members = membersAllowedTo('calendar_view');
33 33
 
34 34
 		// Don't alert the event creator
35
-		if (!empty($this->_details['sender_id']))
36
-			$members = array_diff($members, array($this->_details['sender_id']));
35
+		if (!empty($this->_details['sender_id'])) {
36
+					$members = array_diff($members, array($this->_details['sender_id']));
37
+		}
37 38
 
38 39
 		// Having successfully figured this out, now let's get the preferences of everyone.
39 40
 		require_once($sourcedir . '/Subs-Notify.php');
@@ -44,10 +45,11 @@  discard block
 block discarded – undo
44 45
 		if (!empty($this->_details['sender_id']) && empty($this->_details['sender_name']))
45 46
 		{
46 47
 			loadMemberData($this->_details['sender_id'], 'minimal');
47
-			if (!empty($user_profile[$this->_details['sender_id']]))
48
-				$this->_details['sender_name'] = $user_profile[$this->_details['sender_id']]['real_name'];
49
-			else
50
-				$this->_details['sender_id'] = 0;
48
+			if (!empty($user_profile[$this->_details['sender_id']])) {
49
+							$this->_details['sender_name'] = $user_profile[$this->_details['sender_id']]['real_name'];
50
+			} else {
51
+							$this->_details['sender_id'] = 0;
52
+			}
51 53
 		}
52 54
 
53 55
 		// So now we find out who wants what.
@@ -59,9 +61,10 @@  discard block
 block discarded – undo
59 61
 
60 62
 		foreach ($prefs as $member => $pref_option)
61 63
 		{
62
-			foreach ($alert_bits as $type => $bitvalue)
63
-				if ($pref_option['event_new'] & $bitvalue)
64
+			foreach ($alert_bits as $type => $bitvalue) {
65
+							if ($pref_option['event_new'] & $bitvalue)
64 66
 					$notifies[$type][] = $member;
67
+			}
65 68
 		}
66 69
 
67 70
 		// Firstly, anyone who wants alerts.
Please login to merge, or discard this patch.
Sources/tasks/MsgReportReply-Notify.php 1 patch
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@  discard block
 block discarded – undo
40 40
 				'last_comment' => $this->_details['comment_id'],
41 41
 			)
42 42
 		);
43
-		while ($row = $smcFunc['db_fetch_row']($request))
44
-			$possible_members[] = $row[0];
43
+		while ($row = $smcFunc['db_fetch_row']($request)) {
44
+					$possible_members[] = $row[0];
45
+		}
45 46
 		$smcFunc['db_free_result']($request);
46 47
 
47 48
 		// Presumably, there are some people?
@@ -50,8 +51,9 @@  discard block
 block discarded – undo
50 51
 			$possible_members = array_flip(array_flip($possible_members));
51 52
 			$possible_members = array_diff($possible_members, array($this->_details['sender_id']));
52 53
 		}
53
-		if (empty($possible_members))
54
-			return true;
54
+		if (empty($possible_members)) {
55
+					return true;
56
+		}
55 57
 
56 58
 		// We need to know who can moderate this board - and therefore who can see this report.
57 59
 		// First up, people who have moderate_board in the board this topic was in.
@@ -67,8 +69,9 @@  discard block
 block discarded – undo
67 69
 				'current_board' => $this->_details['board_id'],
68 70
 			)
69 71
 		);
70
-		while ($row = $smcFunc['db_fetch_assoc']($request))
71
-			$members[] = $row['id_member'];
72
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
73
+					$members[] = $row['id_member'];
74
+		}
72 75
 		$smcFunc['db_free_result']($request);
73 76
 
74 77
 		// Thirdly, anyone assigned to be a moderator of this group as a group->board moderator.
@@ -85,8 +88,9 @@  discard block
 block discarded – undo
85 88
 			)
86 89
 		);
87 90
 
88
-		while ($row = $smcFunc['db_fetch_assoc']($request))
89
-			$members[] = $row['id_member'];
91
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
92
+					$members[] = $row['id_member'];
93
+		}
90 94
 		$smcFunc['db_free_result']($request);
91 95
 
92 96
 		// So now we have two lists: the people who replied to a report in the past,
@@ -108,8 +112,9 @@  discard block
 block discarded – undo
108 112
 		{
109 113
 			foreach ($alert_bits as $type => $bitvalue)
110 114
 			{
111
-				if ($pref_option['msg_report_reply'] & $bitvalue)
112
-					$notifies[$type][] = $member;
115
+				if ($pref_option['msg_report_reply'] & $bitvalue) {
116
+									$notifies[$type][] = $member;
117
+				}
113 118
 			}
114 119
 		}
115 120
 
@@ -170,8 +175,9 @@  discard block
 block discarded – undo
170 175
 			);
171 176
 			while ($row = $smcFunc['db_fetch_assoc']($request))
172 177
 			{
173
-				if (empty($row['lngfile']))
174
-					$row['lngfile'] = $language;
178
+				if (empty($row['lngfile'])) {
179
+									$row['lngfile'] = $language;
180
+				}
175 181
 				$emails[$row['lngfile']][$row['id_member']] = $row['email_address'];
176 182
 			}
177 183
 			$smcFunc['db_free_result']($request);
@@ -203,8 +209,9 @@  discard block
 block discarded – undo
203 209
 				$emaildata = loadEmailTemplate('reply_to_moderator', $replacements, empty($modSettings['userLanguage']) ? $language : $this_lang);
204 210
 
205 211
 				// And do the actual sending...
206
-				foreach ($recipients as $id_member => $email_address)
207
-					sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'rptrpy' . $this->_details['comment_id'], $emaildata['is_html'], 3);
212
+				foreach ($recipients as $id_member => $email_address) {
213
+									sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'rptrpy' . $this->_details['comment_id'], $emaildata['is_html'], 3);
214
+				}
208 215
 			}
209 216
 		}
210 217
 
Please login to merge, or discard this patch.
Sources/tasks/Birthday-Notify.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
51 51
 		$birthdays = array();
52 52
 		while ($row = $smcFunc['db_fetch_assoc']($result))
53 53
 		{
54
-			if (!isset($birthdays[$row['lngfile']]))
55
-				$birthdays[$row['lngfile']] = array();
54
+			if (!isset($birthdays[$row['lngfile']])) {
55
+							$birthdays[$row['lngfile']] = array();
56
+			}
56 57
 			$birthdays[$row['lngfile']][$row['id_member']] = array(
57 58
 				'name' => $row['real_name'],
58 59
 				'email' => $row['email_address']
@@ -117,8 +118,8 @@  discard block
 block discarded – undo
117 118
 			AddMailQueue(true);
118 119
 
119 120
 			// Insert the alerts if any
120
-			if (!empty($alert_rows))
121
-				$smcFunc['db_insert']('',
121
+			if (!empty($alert_rows)) {
122
+							$smcFunc['db_insert']('',
122 123
 					'{db_prefix}user_alerts',
123 124
 					array(
124 125
 						'alert_time' => 'int', 'id_member' => 'int', 'content_type' => 'string',
@@ -127,6 +128,7 @@  discard block
 block discarded – undo
127 128
 					$alert_rows,
128 129
 					array()
129 130
 				);
131
+			}
130 132
 		}
131 133
 
132 134
 		return true;
Please login to merge, or discard this patch.
Sources/tasks/MemberReport-Notify.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,9 +46,10 @@  discard block
 block discarded – undo
46 46
 
47 47
 		foreach ($prefs as $member => $pref_option)
48 48
 		{
49
-			foreach ($alert_bits as $type => $bitvalue)
50
-				if ($pref_option['member_report'] & $bitvalue)
49
+			foreach ($alert_bits as $type => $bitvalue) {
50
+							if ($pref_option['member_report'] & $bitvalue)
51 51
 					$notifies[$type][] = $member;
52
+			}
52 53
 		}
53 54
 
54 55
 		// Firstly, anyone who wants alerts.
@@ -109,8 +110,9 @@  discard block
 block discarded – undo
109 110
 			);
110 111
 			while ($row = $smcFunc['db_fetch_assoc']($request))
111 112
 			{
112
-				if (empty($row['lngfile']))
113
-					$row['lngfile'] = $language;
113
+				if (empty($row['lngfile'])) {
114
+									$row['lngfile'] = $language;
115
+				}
114 116
 				$emails[$row['lngfile']][$row['id_member']] = $row['email_address'];
115 117
 			}
116 118
 			$smcFunc['db_free_result']($request);
@@ -129,8 +131,9 @@  discard block
 block discarded – undo
129 131
 				$emaildata = loadEmailTemplate('report_member_profile', $replacements, empty($modSettings['userLanguage']) ? $language : $this_lang);
130 132
 
131 133
 				// And do the actual sending...
132
-				foreach ($recipients as $id_member => $email_address)
133
-					sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'ureport' . $this->_details['report_id'], $emaildata['is_html'], 2);
134
+				foreach ($recipients as $id_member => $email_address) {
135
+									sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'ureport' . $this->_details['report_id'], $emaildata['is_html'], 2);
136
+				}
134 137
 			}
135 138
 		}
136 139
 
Please login to merge, or discard this patch.