@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | <subject is_first="', $context['message']['first_in_topic'] ? '1' : '0', '"><![CDATA[', cleanXml($context['message']['subject']), ']]></subject> |
| 75 | 75 | <body><![CDATA[', $context['message']['body'], ']]></body> |
| 76 | 76 | <success><![CDATA[', $txt['quick_modify_message'], ']]></success>'; |
| 77 | - } |
|
| 78 | - else |
|
| 79 | - echo ' |
|
| 77 | + } else { |
|
| 78 | + echo ' |
|
| 80 | 79 | <error in_subject="', $context['message']['error_in_subject'] ? '1' : '0', '" in_body="', cleanXml($context['message']['error_in_body']) ? '1' : '0', '"><![CDATA[', implode('<br />', $context['message']['errors']), ']]></error>'; |
| 80 | + } |
|
| 81 | 81 | echo ' |
| 82 | 82 | </message> |
| 83 | 83 | </smf>'; |
@@ -101,13 +101,14 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | echo ' |
| 103 | 103 | <modified><![CDATA[', empty($modified) ? '' : cleanXml('« <em>' . $modified . '</em>»'), ']]></modified>'; |
| 104 | - if (!empty($context['message']['subject'])) |
|
| 105 | - echo ' |
|
| 104 | + if (!empty($context['message']['subject'])) { |
|
| 105 | + echo ' |
|
| 106 | 106 | <subject><![CDATA[', cleanXml($context['message']['subject']), ']]></subject>'; |
| 107 | - } |
|
| 108 | - else |
|
| 109 | - echo ' |
|
| 107 | + } |
|
| 108 | + } else { |
|
| 109 | + echo ' |
|
| 110 | 110 | <error in_subject="', $context['message']['error_in_subject'] ? '1' : '0', '"><![CDATA[', cleanXml(implode('<br />', $context['message']['errors'])), ']]></error>'; |
| 111 | + } |
|
| 111 | 112 | echo ' |
| 112 | 113 | </message> |
| 113 | 114 | </smf>'; |
@@ -127,10 +128,11 @@ discard block |
||
| 127 | 128 | <body><![CDATA[', $context['preview_message'], ']]></body> |
| 128 | 129 | </preview> |
| 129 | 130 | <errors serious="', empty($context['error_type']) || $context['error_type'] != 'serious' ? '0' : '1', '" topic_locked="', $context['locked'] ? '1' : '0', '">'; |
| 130 | - if (!empty($context['post_error'])) |
|
| 131 | - foreach ($context['post_error'] as $message) |
|
| 131 | + if (!empty($context['post_error'])) { |
|
| 132 | + foreach ($context['post_error'] as $message) |
|
| 132 | 133 | echo ' |
| 133 | 134 | <error><![CDATA[', cleanXml($message), ']]></error>'; |
| 135 | + } |
|
| 134 | 136 | echo ' |
| 135 | 137 | <caption name="guestname" class="', isset($context['post_error']['long_name']) || isset($context['post_error']['no_name']) || isset($context['post_error']['bad_name']) ? 'error' : '', '" /> |
| 136 | 138 | <caption name="email" class="', isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? 'error' : '', '" /> |
@@ -145,14 +147,15 @@ discard block |
||
| 145 | 147 | { |
| 146 | 148 | echo ' |
| 147 | 149 | <new_posts>'; |
| 148 | - foreach ($context['previous_posts'] as $post) |
|
| 149 | - echo ' |
|
| 150 | + foreach ($context['previous_posts'] as $post) { |
|
| 151 | + echo ' |
|
| 150 | 152 | <post id="', $post['id'], '"> |
| 151 | 153 | <time><![CDATA[', $post['time'], ']]></time> |
| 152 | 154 | <poster><![CDATA[', cleanXml($post['poster']), ']]></poster> |
| 153 | 155 | <message><![CDATA[', cleanXml($post['message']), ']]></message> |
| 154 | 156 | <is_ignored>', $post['is_ignored'] ? '1' : '0', '</is_ignored> |
| 155 | 157 | </post>'; |
| 158 | + } |
|
| 156 | 159 | echo ' |
| 157 | 160 | </new_posts>'; |
| 158 | 161 | } |
@@ -176,10 +179,11 @@ discard block |
||
| 176 | 179 | <body><![CDATA[', $context['preview_message'], ']]></body> |
| 177 | 180 | </preview> |
| 178 | 181 | <errors serious="', empty($context['error_type']) || $context['error_type'] != 'serious' ? '0' : '1', '">'; |
| 179 | - if (!empty($context['post_error']['messages'])) |
|
| 180 | - foreach ($context['post_error']['messages'] as $message) |
|
| 182 | + if (!empty($context['post_error']['messages'])) { |
|
| 183 | + foreach ($context['post_error']['messages'] as $message) |
|
| 181 | 184 | echo ' |
| 182 | 185 | <error><![CDATA[', cleanXml($message), ']]></error>'; |
| 186 | + } |
|
| 183 | 187 | |
| 184 | 188 | echo ' |
| 185 | 189 | <caption name="to" class="', isset($context['post_error']['no_to']) ? 'error' : '', '" /> |
@@ -208,10 +212,11 @@ discard block |
||
| 208 | 212 | <body><![CDATA[', $context['preview_message'], ']]></body> |
| 209 | 213 | </preview> |
| 210 | 214 | <errors serious="', empty($context['error_type']) || $context['error_type'] != 'serious' ? '0' : '1', '">'; |
| 211 | - if (!empty($context['post_error']['messages'])) |
|
| 212 | - foreach ($context['post_error']['messages'] as $message) |
|
| 215 | + if (!empty($context['post_error']['messages'])) { |
|
| 216 | + foreach ($context['post_error']['messages'] as $message) |
|
| 213 | 217 | echo ' |
| 214 | 218 | <error><![CDATA[', cleanXml($message), ']]></error>'; |
| 219 | + } |
|
| 215 | 220 | |
| 216 | 221 | echo ' |
| 217 | 222 | </errors>'; |
@@ -227,19 +232,22 @@ discard block |
||
| 227 | 232 | { |
| 228 | 233 | global $context, $modSettings; |
| 229 | 234 | |
| 230 | - if (empty($context['yearly'])) |
|
| 231 | - return; |
|
| 235 | + if (empty($context['yearly'])) { |
|
| 236 | + return; |
|
| 237 | + } |
|
| 232 | 238 | |
| 233 | 239 | echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '> |
| 234 | 240 | <smf>'; |
| 235 | - foreach ($context['yearly'] as $year) |
|
| 236 | - foreach ($year['months'] as $month) |
|
| 241 | + foreach ($context['yearly'] as $year) { |
|
| 242 | + foreach ($year['months'] as $month) |
|
| 237 | 243 | { |
| 238 | 244 | echo ' |
| 239 | 245 | <month id="', $month['date']['year'], $month['date']['month'], '">'; |
| 240 | - foreach ($month['days'] as $day) |
|
| 241 | - echo ' |
|
| 246 | + } |
|
| 247 | + foreach ($month['days'] as $day) { |
|
| 248 | + echo ' |
|
| 242 | 249 | <day date="', $day['year'], '-', $day['month'], '-', $day['day'], '" new_topics="', $day['new_topics'], '" new_posts="', $day['new_posts'], '" new_members="', $day['new_members'], '" most_members_online="', $day['most_members_online'], '"', empty($modSettings['hitStats']) ? '' : ' hits="' . $day['hits'] . '"', ' />'; |
| 250 | + } |
|
| 243 | 251 | echo ' |
| 244 | 252 | </month>'; |
| 245 | 253 | } |
@@ -260,17 +268,18 @@ discard block |
||
| 260 | 268 | <pageIndex section="selected" startFrom="', $context['selected']['start'], '"><![CDATA[', $context['selected']['page_index'], ']]></pageIndex>'; |
| 261 | 269 | foreach ($context['changes'] as $change) |
| 262 | 270 | { |
| 263 | - if ($change['type'] == 'remove') |
|
| 264 | - echo ' |
|
| 271 | + if ($change['type'] == 'remove') { |
|
| 272 | + echo ' |
|
| 265 | 273 | <change id="', $change['id'], '" curAction="remove" section="', $change['section'], '" />'; |
| 266 | - else |
|
| 267 | - echo ' |
|
| 274 | + } else { |
|
| 275 | + echo ' |
|
| 268 | 276 | <change id="', $change['id'], '" curAction="insert" section="', $change['section'], '"> |
| 269 | 277 | <subject><![CDATA[', cleanXml($change['insert_value']['subject']), ']]></subject> |
| 270 | 278 | <time><![CDATA[', cleanXml($change['insert_value']['time']), ']]></time> |
| 271 | 279 | <body><![CDATA[', cleanXml($change['insert_value']['body']), ']]></body> |
| 272 | 280 | <poster><![CDATA[', cleanXml($change['insert_value']['poster']), ']]></poster> |
| 273 | 281 | </change>'; |
| 282 | + } |
|
| 274 | 283 | } |
| 275 | 284 | echo ' |
| 276 | 285 | </smf>'; |
@@ -301,10 +310,10 @@ discard block |
||
| 301 | 310 | echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '> |
| 302 | 311 | <smf>'; |
| 303 | 312 | |
| 304 | - if (empty($context['topics'])) |
|
| 305 | - echo ' |
|
| 313 | + if (empty($context['topics'])) { |
|
| 314 | + echo ' |
|
| 306 | 315 | <noresults>', $txt['search_no_results'], '</noresults>'; |
| 307 | - else |
|
| 316 | + } else |
|
| 308 | 317 | { |
| 309 | 318 | echo ' |
| 310 | 319 | <results>'; |
@@ -370,9 +379,10 @@ discard block |
||
| 370 | 379 | { |
| 371 | 380 | echo ' |
| 372 | 381 | <item type="category" id="', $category['id'], '"><![CDATA[', cleanXml($category['name']), ']]></item>'; |
| 373 | - foreach ($category['boards'] as $board) |
|
| 374 | - echo ' |
|
| 382 | + foreach ($category['boards'] as $board) { |
|
| 383 | + echo ' |
|
| 375 | 384 | <item type="board" id="', $board['id'], '" childlevel="', $board['child_level'], '"><![CDATA[', cleanXml($board['name']), ']]></item>'; |
| 385 | + } |
|
| 376 | 386 | } |
| 377 | 387 | echo ' |
| 378 | 388 | </smf>'; |
@@ -387,9 +397,10 @@ discard block |
||
| 387 | 397 | |
| 388 | 398 | echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '> |
| 389 | 399 | <smf>'; |
| 390 | - foreach ($context['icons'] as $icon) |
|
| 391 | - echo ' |
|
| 400 | + foreach ($context['icons'] as $icon) { |
|
| 401 | + echo ' |
|
| 392 | 402 | <icon value="', $icon['value'], '" url="', $icon['url'], '"><![CDATA[', cleanXml($icon['name']), ']]></icon>'; |
| 403 | + } |
|
| 393 | 404 | echo ' |
| 394 | 405 | </smf>'; |
| 395 | 406 | } |
@@ -438,16 +449,18 @@ discard block |
||
| 438 | 449 | foreach ($xml_data as $key => $data) |
| 439 | 450 | { |
| 440 | 451 | // A group? |
| 441 | - if (is_array($data) && isset($data['identifier'])) |
|
| 442 | - template_generic_xml_recursive($data['children'], $key, $data['identifier'], $level); |
|
| 452 | + if (is_array($data) && isset($data['identifier'])) { |
|
| 453 | + template_generic_xml_recursive($data['children'], $key, $data['identifier'], $level); |
|
| 454 | + } |
|
| 443 | 455 | // An item... |
| 444 | 456 | elseif (is_array($data) && isset($data['value'])) |
| 445 | 457 | { |
| 446 | 458 | echo "\n", str_repeat("\t", $level), '<', $child_ident; |
| 447 | 459 | |
| 448 | - if (!empty($data['attributes'])) |
|
| 449 | - foreach ($data['attributes'] as $k => $v) |
|
| 460 | + if (!empty($data['attributes'])) { |
|
| 461 | + foreach ($data['attributes'] as $k => $v) |
|
| 450 | 462 | echo ' ' . $k . '="' . $v . '"'; |
| 463 | + } |
|
| 451 | 464 | echo '><![CDATA[', cleanXml($data['value']), ']]></', $child_ident, '>'; |
| 452 | 465 | } |
| 453 | 466 | |
@@ -44,10 +44,11 @@ discard block |
||
| 44 | 44 | <dt>', $txt['users_online_today'], ':</dt> |
| 45 | 45 | <dd>', $context['online_today'], '</dd>'; |
| 46 | 46 | |
| 47 | - if (!empty($modSettings['hitStats'])) |
|
| 48 | - echo ' |
|
| 47 | + if (!empty($modSettings['hitStats'])) { |
|
| 48 | + echo ' |
|
| 49 | 49 | <dt>', $txt['num_hits'], ':</dt> |
| 50 | 50 | <dd>', $context['num_hits'], '</dd>'; |
| 51 | + } |
|
| 51 | 52 | |
| 52 | 53 | echo ' |
| 53 | 54 | </dl> |
@@ -71,17 +72,19 @@ discard block |
||
| 71 | 72 | <dt>', $txt['gender_stats'], ':</dt> |
| 72 | 73 | <dd>'; |
| 73 | 74 | |
| 74 | - foreach ($context['gender'] as $g => $n) |
|
| 75 | - echo $g, ': ', $n, '<br>'; |
|
| 75 | + foreach ($context['gender'] as $g => $n) { |
|
| 76 | + echo $g, ': ', $n, '<br>'; |
|
| 77 | + } |
|
| 76 | 78 | |
| 77 | 79 | echo ' |
| 78 | 80 | </dd>'; |
| 79 | 81 | } |
| 80 | 82 | |
| 81 | - if (!empty($modSettings['hitStats'])) |
|
| 82 | - echo ' |
|
| 83 | + if (!empty($modSettings['hitStats'])) { |
|
| 84 | + echo ' |
|
| 83 | 85 | <dt>', $txt['average_hits'], ':</dt> |
| 84 | 86 | <dd>', $context['average_hits'], '</dd>'; |
| 87 | + } |
|
| 85 | 88 | |
| 86 | 89 | echo ' |
| 87 | 90 | </dl>'; |
@@ -105,14 +108,15 @@ discard block |
||
| 105 | 108 | </dt> |
| 106 | 109 | <dd class="statsbar">'; |
| 107 | 110 | |
| 108 | - if (!empty($item['percent'])) |
|
| 109 | - echo ' |
|
| 111 | + if (!empty($item['percent'])) { |
|
| 112 | + echo ' |
|
| 110 | 113 | <div class="bar" style="width: ', $item['percent'], '%;"> |
| 111 | 114 | <span class="righttext">', $item['num'], '</span> |
| 112 | 115 | </div>'; |
| 113 | - else |
|
| 114 | - echo ' |
|
| 116 | + } else { |
|
| 117 | + echo ' |
|
| 115 | 118 | <div class="bar empty"><span class="righttext">', $item['num'], '</span></div>'; |
| 119 | + } |
|
| 116 | 120 | |
| 117 | 121 | echo ' |
| 118 | 122 | </dd>'; |
@@ -144,9 +148,10 @@ discard block |
||
| 144 | 148 | <th>', $txt['stats_new_members'], '</th> |
| 145 | 149 | <th>', $txt['most_online'], '</th>'; |
| 146 | 150 | |
| 147 | - if (!empty($modSettings['hitStats'])) |
|
| 148 | - echo ' |
|
| 151 | + if (!empty($modSettings['hitStats'])) { |
|
| 152 | + echo ' |
|
| 149 | 153 | <th>', $txt['page_views'], '</th>'; |
| 154 | + } |
|
| 150 | 155 | |
| 151 | 156 | echo ' |
| 152 | 157 | </tr> |
@@ -165,9 +170,10 @@ discard block |
||
| 165 | 170 | <th>', $year['new_members'], '</th> |
| 166 | 171 | <th>', $year['most_members_online'], '</th>'; |
| 167 | 172 | |
| 168 | - if (!empty($modSettings['hitStats'])) |
|
| 169 | - echo ' |
|
| 173 | + if (!empty($modSettings['hitStats'])) { |
|
| 174 | + echo ' |
|
| 170 | 175 | <th>', $year['hits'], '</th>'; |
| 176 | + } |
|
| 171 | 177 | |
| 172 | 178 | echo ' |
| 173 | 179 | </tr>'; |
@@ -184,9 +190,10 @@ discard block |
||
| 184 | 190 | <th>', $month['new_members'], '</th> |
| 185 | 191 | <th>', $month['most_members_online'], '</th>'; |
| 186 | 192 | |
| 187 | - if (!empty($modSettings['hitStats'])) |
|
| 188 | - echo ' |
|
| 193 | + if (!empty($modSettings['hitStats'])) { |
|
| 194 | + echo ' |
|
| 189 | 195 | <th>', $month['hits'], '</th>'; |
| 196 | + } |
|
| 190 | 197 | |
| 191 | 198 | echo ' |
| 192 | 199 | </tr>'; |
@@ -203,9 +210,10 @@ discard block |
||
| 203 | 210 | <td>', $day['new_members'], '</td> |
| 204 | 211 | <td>', $day['most_members_online'], '</td>'; |
| 205 | 212 | |
| 206 | - if (!empty($modSettings['hitStats'])) |
|
| 207 | - echo ' |
|
| 213 | + if (!empty($modSettings['hitStats'])) { |
|
| 214 | + echo ' |
|
| 208 | 215 | <td>', $day['hits'], '</td>'; |
| 216 | + } |
|
| 209 | 217 | |
| 210 | 218 | echo ' |
| 211 | 219 | </tr>'; |
@@ -50,8 +50,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 185 | 190 | $body = htmlspecialchars_decode(preg_replace('~<br\s*/?\>~', "\n", str_replace(' ', ' ', $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 |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -132,8 +132,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 152 | 153 | $alert_rows, |
| 153 | 154 | array() |
| 154 | 155 | ); |
| 156 | + } |
|
| 155 | 157 | } |
| 156 | 158 | |
| 157 | 159 | return true; |
@@ -32,8 +32,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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. |
@@ -40,8 +40,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -51,8 +51,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 127 | 128 | $alert_rows, |
| 128 | 129 | array() |
| 129 | 130 | ); |
| 131 | + } |
|
| 130 | 132 | } |
| 131 | 133 | |
| 132 | 134 | return true; |
@@ -46,9 +46,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -54,8 +54,9 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | $smcFunc['db_free_result']($request); |
| 56 | 56 | |
| 57 | - if (empty($members)) |
|
| 58 | - return true; |
|
| 57 | + if (empty($members)) { |
|
| 58 | + return true; |
|
| 59 | + } |
|
| 59 | 60 | |
| 60 | 61 | require_once($sourcedir . '/Subs-Notify.php'); |
| 61 | 62 | $members = array_unique($members); |
@@ -103,14 +104,15 @@ discard block |
||
| 103 | 104 | } |
| 104 | 105 | |
| 105 | 106 | // Insert the alerts if any |
| 106 | - if (!empty($alert_rows)) |
|
| 107 | - $smcFunc['db_insert']('', |
|
| 107 | + if (!empty($alert_rows)) { |
|
| 108 | + $smcFunc['db_insert']('', |
|
| 108 | 109 | '{db_prefix}user_alerts', |
| 109 | 110 | array('alert_time' => 'int', 'id_member' => 'int', 'id_member_started' => 'int', 'member_name' => 'string', |
| 110 | 111 | 'content_type' => 'string', 'content_id' => 'int', 'content_action' => 'string', 'is_read' => 'int', 'extra' => 'string'), |
| 111 | 112 | $alert_rows, |
| 112 | 113 | array() |
| 113 | 114 | ); |
| 115 | + } |
|
| 114 | 116 | |
| 115 | 117 | return true; |
| 116 | 118 | } |