@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | { |
20 | 20 | /** |
21 | 21 | * Constants for receiving email notfications. |
22 | - */ |
|
22 | + */ |
|
23 | 23 | const RECEIVE_NOTIFY_EMAIL = 0x02; |
24 | 24 | const RECEIVE_NOTIFY_ALERT = 0x01; |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Constants for reply types. |
28 | - */ |
|
28 | + */ |
|
29 | 29 | const NOTIFY_TYPE_REPLY_AND_MODIFY = 1; |
30 | 30 | const NOTIFY_TYPE_REPLY_AND_TOPIC_START_FOLLOWING = 2; |
31 | 31 | const NOTIFY_TYPE_ONLY_REPLIES = 3; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Constants for frequencies. |
36 | - */ |
|
36 | + */ |
|
37 | 37 | const FREQUENCY_NOTHING = 0; |
38 | 38 | const FREQUENCY_EVERYTHING = 1; |
39 | 39 | const FREQUENCY_FIRST_UNREAD_MSG = 2; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | const FREQUENCY_WEEKLY_DIGEST = 4; |
42 | 42 | |
43 | 43 | /** |
44 | - * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
44 | + * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
45 | 45 | * @return bool Always returns true |
46 | 46 | */ |
47 | 47 | public function execute() |
@@ -96,8 +96,9 @@ discard block |
||
96 | 96 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
97 | 97 | { |
98 | 98 | $groups = array_merge(array($row['id_group'], $row['id_post_group']), (empty($row['additional_groups']) ? array() : explode(',', $row['additional_groups']))); |
99 | - if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) |
|
100 | - continue; |
|
99 | + if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) { |
|
100 | + continue; |
|
101 | + } |
|
101 | 102 | |
102 | 103 | $members[] = $row['id_member']; |
103 | 104 | $watched[$row['id_member']] = $row; |
@@ -105,8 +106,9 @@ discard block |
||
105 | 106 | |
106 | 107 | $smcFunc['db_free_result']($request); |
107 | 108 | |
108 | - if (empty($members)) |
|
109 | - return true; |
|
109 | + if (empty($members)) { |
|
110 | + return true; |
|
111 | + } |
|
110 | 112 | |
111 | 113 | $members = array_unique($members); |
112 | 114 | $prefs = getNotifyPrefs($members, '', true); |
@@ -122,8 +124,9 @@ discard block |
||
122 | 124 | self::handleQuoteNotifications($msgOptions, $posterOptions, $quotedMembers, $prefs, $done_members, $alert_rows); |
123 | 125 | |
124 | 126 | // Save ourselves a bit of work in the big loop below |
125 | - foreach ($done_members as $done_member) |
|
126 | - unset($watched[$done_member]); |
|
127 | + foreach ($done_members as $done_member) { |
|
128 | + unset($watched[$done_member]); |
|
129 | + } |
|
127 | 130 | |
128 | 131 | // Handle rest of the notifications for watched topics and boards |
129 | 132 | foreach ($watched as $member => $data) |
@@ -132,20 +135,23 @@ discard block |
||
132 | 135 | $notify_types = !empty($prefs[$member]['msg_notify_type']) ? $prefs[$member]['msg_notify_type'] : self::NOTIFY_TYPE_REPLY_AND_MODIFY; |
133 | 136 | |
134 | 137 | // Don't send a notification if the watching member ignored the member who made the action. |
135 | - if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) |
|
136 | - continue; |
|
137 | - if (!in_array($type, array('reply', 'topic')) && $notify_types == self::NOTIFY_TYPE_REPLY_AND_TOPIC_START_FOLLOWING && $member != $data['id_member_started']) |
|
138 | - continue; |
|
139 | - elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) |
|
140 | - continue; |
|
141 | - elseif (!in_array($type, array('reply', 'topic')) && $notify_types == self::NOTIFY_TYPE_ONLY_REPLIES) |
|
142 | - continue; |
|
143 | - elseif ($notify_types == self::NOTIFY_TYPE_NOTHING) |
|
144 | - continue; |
|
138 | + if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) { |
|
139 | + continue; |
|
140 | + } |
|
141 | + if (!in_array($type, array('reply', 'topic')) && $notify_types == self::NOTIFY_TYPE_REPLY_AND_TOPIC_START_FOLLOWING && $member != $data['id_member_started']) { |
|
142 | + continue; |
|
143 | + } elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) { |
|
144 | + continue; |
|
145 | + } elseif (!in_array($type, array('reply', 'topic')) && $notify_types == self::NOTIFY_TYPE_ONLY_REPLIES) { |
|
146 | + continue; |
|
147 | + } elseif ($notify_types == self::NOTIFY_TYPE_NOTHING) { |
|
148 | + continue; |
|
149 | + } |
|
145 | 150 | |
146 | 151 | if (empty($frequency) || $frequency > self::FREQUENCY_FIRST_UNREAD_MSG || $data['sent'] |
147 | - || (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))) |
|
148 | - continue; |
|
152 | + || (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))) { |
|
153 | + continue; |
|
154 | + } |
|
149 | 155 | |
150 | 156 | // Watched topic? |
151 | 157 | if (!empty($data['id_topic']) && $type != 'topic' && !empty($prefs[$member])) |
@@ -155,10 +161,12 @@ discard block |
||
155 | 161 | |
156 | 162 | if ($type == 'reply') |
157 | 163 | { |
158 | - if (!empty($prefs[$member]['msg_receive_body'])) |
|
159 | - $message_type .= '_body'; |
|
160 | - if (!empty($frequency)) |
|
161 | - $message_type .= '_once'; |
|
164 | + if (!empty($prefs[$member]['msg_receive_body'])) { |
|
165 | + $message_type .= '_body'; |
|
166 | + } |
|
167 | + if (!empty($frequency)) { |
|
168 | + $message_type .= '_once'; |
|
169 | + } |
|
162 | 170 | } |
163 | 171 | |
164 | 172 | $content_type = 'topic'; |
@@ -171,12 +179,14 @@ discard block |
||
171 | 179 | $content_type = 'board'; |
172 | 180 | |
173 | 181 | $message_type = !empty($frequency) ? 'notify_boards_once' : 'notify_boards'; |
174 | - if (!empty($prefs[$member]['msg_receive_body'])) |
|
175 | - $message_type .= '_body'; |
|
182 | + if (!empty($prefs[$member]['msg_receive_body'])) { |
|
183 | + $message_type .= '_body'; |
|
184 | + } |
|
176 | 185 | } |
177 | 186 | // If neither of the above, this might be a redundent row due to the OR clause in our SQL query, skip |
178 | - else |
|
179 | - continue; |
|
187 | + else { |
|
188 | + continue; |
|
189 | + } |
|
180 | 190 | |
181 | 191 | // Bitwise check: Receiving a email notification? |
182 | 192 | if ($pref & self::RECEIVE_NOTIFY_EMAIL) |
@@ -193,8 +203,9 @@ discard block |
||
193 | 203 | $mail_result = sendmail($data['email_address'], $emaildata['subject'], $emaildata['body'], null, 'm' . $topicOptions['id'], $emaildata['is_html']); |
194 | 204 | |
195 | 205 | // We failed, don't trigger a alert as we don't have a way to attempt to resend just the email currently. |
196 | - if ($mail_result === false) |
|
197 | - continue; |
|
206 | + if ($mail_result === false) { |
|
207 | + continue; |
|
208 | + } |
|
198 | 209 | } |
199 | 210 | |
200 | 211 | // Bitwise check: Receiving a alert? |
@@ -245,14 +256,15 @@ discard block |
||
245 | 256 | ); |
246 | 257 | |
247 | 258 | // Insert the alerts if any |
248 | - if (!empty($alert_rows)) |
|
249 | - $smcFunc['db_insert']('', |
|
259 | + if (!empty($alert_rows)) { |
|
260 | + $smcFunc['db_insert']('', |
|
250 | 261 | '{db_prefix}user_alerts', |
251 | 262 | array('alert_time' => 'int', 'id_member' => 'int', 'id_member_started' => 'int', 'member_name' => 'string', |
252 | 263 | 'content_type' => 'string', 'content_id' => 'int', 'content_action' => 'string', 'is_read' => 'int', 'extra' => 'string'), |
253 | 264 | $alert_rows, |
254 | 265 | array() |
255 | 266 | ); |
267 | + } |
|
256 | 268 | |
257 | 269 | return true; |
258 | 270 | } |
@@ -263,8 +275,9 @@ discard block |
||
263 | 275 | |
264 | 276 | foreach ($quotedMembers as $id => $member) |
265 | 277 | { |
266 | - if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) |
|
267 | - continue; |
|
278 | + if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) { |
|
279 | + continue; |
|
280 | + } |
|
268 | 281 | |
269 | 282 | $done_members[] = $id; |
270 | 283 | |
@@ -318,32 +331,35 @@ discard block |
||
318 | 331 | { |
319 | 332 | if (preg_match('/\[quote(.*)?\]/i', $block, $matches)) |
320 | 333 | { |
321 | - if ($quote_level == 0) |
|
322 | - $message .= '[quote' . $matches[1] . ']'; |
|
334 | + if ($quote_level == 0) { |
|
335 | + $message .= '[quote' . $matches[1] . ']'; |
|
336 | + } |
|
323 | 337 | $quote_level++; |
324 | - } |
|
325 | - elseif (preg_match('/\[\/quote\]/i', $block)) |
|
338 | + } elseif (preg_match('/\[\/quote\]/i', $block)) |
|
326 | 339 | { |
327 | - if ($quote_level <= 1) |
|
328 | - $message .= '[/quote]'; |
|
340 | + if ($quote_level <= 1) { |
|
341 | + $message .= '[/quote]'; |
|
342 | + } |
|
329 | 343 | if ($quote_level >= 1) |
330 | 344 | { |
331 | 345 | $quote_level--; |
332 | 346 | $message .= "\n"; |
333 | 347 | } |
348 | + } elseif ($quote_level <= 1) { |
|
349 | + $message .= $block; |
|
334 | 350 | } |
335 | - elseif ($quote_level <= 1) |
|
336 | - $message .= $block; |
|
337 | 351 | } |
338 | 352 | |
339 | 353 | preg_match_all('/\[quote.*?link=msg=([0-9]+).*?\]/i', $message, $matches); |
340 | 354 | |
341 | 355 | $id_msgs = $matches[1]; |
342 | - foreach ($id_msgs as $k => $id_msg) |
|
343 | - $id_msgs[$k] = (int) $id_msg; |
|
356 | + foreach ($id_msgs as $k => $id_msg) { |
|
357 | + $id_msgs[$k] = (int) $id_msg; |
|
358 | + } |
|
344 | 359 | |
345 | - if (empty($id_msgs)) |
|
346 | - return array(); |
|
360 | + if (empty($id_msgs)) { |
|
361 | + return array(); |
|
362 | + } |
|
347 | 363 | |
348 | 364 | // Get the messages |
349 | 365 | $request = $smcFunc['db_query']('', ' |
@@ -361,8 +377,9 @@ discard block |
||
361 | 377 | $members = array(); |
362 | 378 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
363 | 379 | { |
364 | - if ($posterOptions['id'] == $row['id_member']) |
|
365 | - continue; |
|
380 | + if ($posterOptions['id'] == $row['id_member']) { |
|
381 | + continue; |
|
382 | + } |
|
366 | 383 | |
367 | 384 | $members[$row['id_member']] = $row; |
368 | 385 | } |
@@ -376,10 +393,11 @@ discard block |
||
376 | 393 | |
377 | 394 | foreach ($members as $id => $member) |
378 | 395 | { |
379 | - if (!empty($prefs[$id]['msg_mention'])) |
|
380 | - $done_members[] = $id; |
|
381 | - else |
|
382 | - continue; |
|
396 | + if (!empty($prefs[$id]['msg_mention'])) { |
|
397 | + $done_members[] = $id; |
|
398 | + } else { |
|
399 | + continue; |
|
400 | + } |
|
383 | 401 | |
384 | 402 | // Alerts' emails are always instant |
385 | 403 | if ($prefs[$id]['msg_mention'] & self::RECEIVE_NOTIFY_EMAIL) |
@@ -15,8 +15,9 @@ discard block |
||
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 | * Main dispatcher. This function checks permissions and passes control through to the relevant section. |
@@ -246,8 +247,9 @@ discard block |
||
246 | 247 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
247 | 248 | { |
248 | 249 | // Private PM/email subjects and similar shouldn't be shown in the mailbox area. |
249 | - if (!empty($row['private'])) |
|
250 | - $row['subject'] = $txt['personal_message']; |
|
250 | + if (!empty($row['private'])) { |
|
251 | + $row['subject'] = $txt['personal_message']; |
|
252 | + } |
|
251 | 253 | |
252 | 254 | $mails[] = $row; |
253 | 255 | } |
@@ -301,8 +303,9 @@ discard block |
||
301 | 303 | $element = substr($key, strrpos($key, '_') + 1); |
302 | 304 | $processedBirthdayEmails[$index][$element] = $value; |
303 | 305 | } |
304 | - foreach ($processedBirthdayEmails as $index => $dummy) |
|
305 | - $emails[$index] = $index; |
|
306 | + foreach ($processedBirthdayEmails as $index => $dummy) { |
|
307 | + $emails[$index] = $index; |
|
308 | + } |
|
306 | 309 | |
307 | 310 | $config_vars = array( |
308 | 311 | // Mail queue stuff, this rocks ;) |
@@ -323,8 +326,9 @@ discard block |
||
323 | 326 | |
324 | 327 | call_integration_hook('integrate_modify_mail_settings', array(&$config_vars)); |
325 | 328 | |
326 | - if ($return_config) |
|
327 | - return $config_vars; |
|
329 | + if ($return_config) { |
|
330 | + return $config_vars; |
|
331 | + } |
|
328 | 332 | |
329 | 333 | // Saving? |
330 | 334 | if (isset($_GET['save'])) |
@@ -399,9 +403,9 @@ discard block |
||
399 | 403 | ); |
400 | 404 | list ($_GET['te']) = $smcFunc['db_fetch_row']($request); |
401 | 405 | $smcFunc['db_free_result']($request); |
406 | + } else { |
|
407 | + $_GET['te'] = (int) $_GET['te']; |
|
402 | 408 | } |
403 | - else |
|
404 | - $_GET['te'] = (int) $_GET['te']; |
|
405 | 409 | |
406 | 410 | $_GET['sent'] = isset($_GET['sent']) ? (int) $_GET['sent'] : 0; |
407 | 411 | |
@@ -425,12 +429,14 @@ discard block |
||
425 | 429 | |
426 | 430 | // Try get more time... |
427 | 431 | @set_time_limit(600); |
428 | - if (function_exists('apache_reset_timeout')) |
|
429 | - @apache_reset_timeout(); |
|
432 | + if (function_exists('apache_reset_timeout')) { |
|
433 | + @apache_reset_timeout(); |
|
434 | + } |
|
430 | 435 | |
431 | 436 | // Have we already used our maximum time? |
432 | - if ((time() - $time_start) < 5) |
|
433 | - return; |
|
437 | + if ((time() - $time_start) < 5) { |
|
438 | + return; |
|
439 | + } |
|
434 | 440 | |
435 | 441 | $context['continue_get_data'] = '?action=admin;area=mailqueue;sa=clear;te=' . $_GET['te'] . ';sent=' . $_GET['sent'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
436 | 442 | $context['page_title'] = $txt['not_done_title']; |
@@ -480,9 +486,10 @@ discard block |
||
480 | 486 | } |
481 | 487 | |
482 | 488 | // The result. |
483 | - if (isset($_GET['result'])) |
|
484 | - $context['result'] = ($_GET['result'] == 'success' ? 'success' : 'failure'); |
|
485 | -} |
|
489 | + if (isset($_GET['result'])) { |
|
490 | + $context['result'] = ($_GET['result'] == 'success' ? 'success' : 'failure'); |
|
491 | + } |
|
492 | + } |
|
486 | 493 | |
487 | 494 | /** |
488 | 495 | * Little utility function to calculate how long ago a time was. |
@@ -494,8 +501,9 @@ discard block |
||
494 | 501 | { |
495 | 502 | global $txt; |
496 | 503 | |
497 | - if ($time_diff < 0) |
|
498 | - $time_diff = 0; |
|
504 | + if ($time_diff < 0) { |
|
505 | + $time_diff = 0; |
|
506 | + } |
|
499 | 507 | |
500 | 508 | // Just do a bit of an if fest... |
501 | 509 | if ($time_diff > 86400) |
@@ -516,8 +524,9 @@ discard block |
||
516 | 524 | return sprintf($minutes == 1 ? $txt['mq_minute'] : $txt['mq_minutes'], $minutes); |
517 | 525 | } |
518 | 526 | // Otherwise must be second |
519 | - else |
|
520 | - return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
521 | -} |
|
527 | + else { |
|
528 | + return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
529 | + } |
|
530 | + } |
|
522 | 531 | |
523 | 532 | ?> |
524 | 533 | \ No newline at end of file |
@@ -48,9 +48,10 @@ |
||
48 | 48 | global $context, $txt; |
49 | 49 | |
50 | 50 | // The results. |
51 | - if (!empty($context['result'])) |
|
52 | - echo ' |
|
51 | + if (!empty($context['result'])) { |
|
52 | + echo ' |
|
53 | 53 | <div class="', $context['result'] == 'success' ? 'infobox' : 'errorbox', '">', $txt['mailtest_result_' . $context['result']], '</div>'; |
54 | + } |
|
54 | 55 | |
55 | 56 | echo ' |
56 | 57 | <form id="admin_form_wrapper" action="', $context['post_url'], '" method="post"> |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | foreach ($message['custom_fields']['above_member'] as $custom) |
232 | 232 | echo ' |
233 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
233 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
234 | 234 | |
235 | 235 | echo ' |
236 | 236 | </ul> |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | if (!empty($message['custom_fields']['below_avatar'])) |
280 | 280 | foreach ($message['custom_fields']['below_avatar'] as $custom) |
281 | 281 | echo ' |
282 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
282 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
283 | 283 | |
284 | 284 | if (!$message['member']['is_guest']) |
285 | 285 | echo ' |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | foreach ($message['custom_fields']['icons'] as $custom) |
323 | 323 | echo ' |
324 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
324 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
325 | 325 | |
326 | 326 | echo ' |
327 | 327 | </ol> |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | if (!empty($message['custom_fields']['standard'])) |
386 | 386 | foreach ($message['custom_fields']['standard'] as $custom) |
387 | 387 | echo ' |
388 | - <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
|
388 | + <li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>'; |
|
389 | 389 | |
390 | 390 | // Are we showing the warning status? |
391 | 391 | if ($message['member']['can_see_warning']) |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | if (!empty($message['custom_fields']['bottom_poster'])) |
397 | 397 | foreach ($message['custom_fields']['bottom_poster'] as $custom) |
398 | 398 | echo ' |
399 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
399 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | // Done with the information about the poster... on to the post itself. |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | |
498 | 498 | foreach ($message['custom_fields']['above_signature'] as $custom) |
499 | 499 | echo ' |
500 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
500 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
501 | 501 | |
502 | 502 | echo ' |
503 | 503 | </ul> |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | |
521 | 521 | foreach ($message['custom_fields']['below_signature'] as $custom) |
522 | 522 | echo ' |
523 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
523 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
524 | 524 | |
525 | 525 | echo ' |
526 | 526 | </ul> |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | while ($message = $context['get_pmessage']('subject')) |
657 | 657 | { |
658 | 658 | echo ' |
659 | - <tr class="windowbg', $message['is_unread'] ? ' unread_pm' : '','"> |
|
659 | + <tr class="windowbg', $message['is_unread'] ? ' unread_pm' : '', '"> |
|
660 | 660 | <td class="table_icon"> |
661 | 661 | <script> |
662 | 662 | currentLabels[', $message['id'], '] = {'; |
@@ -956,13 +956,13 @@ discard block |
||
956 | 956 | // You can only reply if they are not a guest... |
957 | 957 | if (!$message['member']['is_guest']) |
958 | 958 | echo ' |
959 | - <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button , '</a>', $context['menu_separator'], ' |
|
960 | - <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button , '</a> ', $context['menu_separator']; |
|
959 | + <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button, '</a>', $context['menu_separator'], ' |
|
960 | + <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button, '</a> ', $context['menu_separator']; |
|
961 | 961 | |
962 | 962 | // This is for "forwarding" - even if the member is gone. |
963 | 963 | else |
964 | 964 | echo ' |
965 | - <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button , '</a>', $context['menu_separator']; |
|
965 | + <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button, '</a>', $context['menu_separator']; |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | echo ' |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | <div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors"> |
1063 | 1063 | <dl> |
1064 | 1064 | <dt> |
1065 | - <strong id="error_serious">', $txt['error_while_submitting'] , '</strong> |
|
1065 | + <strong id="error_serious">', $txt['error_while_submitting'], '</strong> |
|
1066 | 1066 | </dt> |
1067 | 1067 | <dd class="error" id="error_list"> |
1068 | 1068 | ', empty($context['post_error']['messages']) ? '' : implode('<br>', $context['post_error']['messages']), ' |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | <span', (isset($context['post_error']['no_subject']) ? ' class="error"' : ''), ' id="caption_subject">', $txt['subject'], ':</span> |
1119 | 1119 | </dt> |
1120 | 1120 | <dd id="pm_subject"> |
1121 | - <input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="80"',isset($context['post_error']['no_subject']) ? ' class="error"' : '', '> |
|
1121 | + <input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="80"', isset($context['post_error']['no_subject']) ? ' class="error"' : '', '> |
|
1122 | 1122 | </dd> |
1123 | 1123 | </dl>'; |
1124 | 1124 | |
@@ -1471,7 +1471,7 @@ discard block |
||
1471 | 1471 | echo ' |
1472 | 1472 | <div class="block righttext"> |
1473 | 1473 | <input type="submit" name="save" value="', $txt['save'], '" class="button"> |
1474 | - <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button you_sure"> |
|
1474 | + <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'], '" class="button you_sure"> |
|
1475 | 1475 | </div>'; |
1476 | 1476 | |
1477 | 1477 | echo ' |
@@ -1635,7 +1635,7 @@ discard block |
||
1635 | 1635 | if (!empty($context['rules'])) |
1636 | 1636 | echo ' |
1637 | 1637 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1638 | - <input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button smalltext you_sure">'; |
|
1638 | + <input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'], '" class="button smalltext you_sure">'; |
|
1639 | 1639 | |
1640 | 1640 | echo ' |
1641 | 1641 | </div> |
@@ -1878,9 +1878,9 @@ discard block |
||
1878 | 1878 | |
1879 | 1879 | echo ' |
1880 | 1880 | <select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();"> |
1881 | - <option value="">', $txt['pm_rule_sel_action'] , ':</option> |
|
1882 | - <option value="lab"', $action['t'] == 'lab' ? ' selected' : '', '>', $txt['pm_rule_label'] , '</option> |
|
1883 | - <option value="del"', $action['t'] == 'del' ? ' selected' : '', '>', $txt['pm_rule_delete'] , '</option> |
|
1881 | + <option value="">', $txt['pm_rule_sel_action'], ':</option> |
|
1882 | + <option value="lab"', $action['t'] == 'lab' ? ' selected' : '', '>', $txt['pm_rule_label'], '</option> |
|
1883 | + <option value="del"', $action['t'] == 'del' ? ' selected' : '', '>', $txt['pm_rule_delete'], '</option> |
|
1884 | 1884 | </select> |
1885 | 1885 | <span id="labdiv', $k, '"> |
1886 | 1886 | <select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();"> |
@@ -1992,7 +1992,7 @@ discard block |
||
1992 | 1992 | </div> |
1993 | 1993 | <ul class="quickbuttons"> |
1994 | 1994 | <li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;id_draft=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons modifybutton"></span>', $txt['draft_edit'], '</a></li> |
1995 | - <li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;delete=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['draft_remove'] ,'?" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['draft_delete'], '</a></li> |
|
1995 | + <li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;delete=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['draft_remove'], '?" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['draft_delete'], '</a></li> |
|
1996 | 1996 | </ul> |
1997 | 1997 | </div><!-- .windowbg -->'; |
1998 | 1998 | } |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | <div id="personal_messages">'; |
22 | 22 | |
23 | 23 | // Show the capacity bar, if available. |
24 | - if (!empty($context['limit_bar'])) |
|
25 | - echo ' |
|
24 | + if (!empty($context['limit_bar'])) { |
|
25 | + echo ' |
|
26 | 26 | <div class="cat_bar"> |
27 | 27 | <h3 class="catbg"> |
28 | 28 | <span class="floatleft">', $txt['pm_capacity'], ':</span> |
@@ -32,14 +32,16 @@ discard block |
||
32 | 32 | <span class="floatright', $context['limit_bar']['percent'] > 90 ? ' alert' : '', '">', $context['limit_bar']['text'], '</span> |
33 | 33 | </h3> |
34 | 34 | </div>'; |
35 | + } |
|
35 | 36 | |
36 | 37 | // Message sent? Show a small indication. |
37 | - if (isset($context['pm_sent'])) |
|
38 | - echo ' |
|
38 | + if (isset($context['pm_sent'])) { |
|
39 | + echo ' |
|
39 | 40 | <div class="infobox"> |
40 | 41 | ', $txt['pm_sent'], ' |
41 | 42 | </div>'; |
42 | -} |
|
43 | + } |
|
44 | + } |
|
43 | 45 | |
44 | 46 | /** |
45 | 47 | * Just the end of the index bar, nothing special. |
@@ -68,13 +70,13 @@ discard block |
||
68 | 70 | </div> |
69 | 71 | <div class="pm_unread">'; |
70 | 72 | |
71 | - if (empty($context['unread_pms'])) |
|
72 | - echo ' |
|
73 | + if (empty($context['unread_pms'])) { |
|
74 | + echo ' |
|
73 | 75 | <div class="no_unread">', $txt['pm_no_unread'], '</div>'; |
74 | - else |
|
76 | + } else |
|
75 | 77 | { |
76 | - foreach ($context['unread_pms'] as $id_pm => $pm_details) |
|
77 | - echo ' |
|
78 | + foreach ($context['unread_pms'] as $id_pm => $pm_details) { |
|
79 | + echo ' |
|
78 | 80 | <div class="unread"> |
79 | 81 | ', !empty($pm_details['member']) ? $pm_details['member']['avatar']['image'] : '', ' |
80 | 82 | <div class="details"> |
@@ -85,6 +87,7 @@ discard block |
||
85 | 87 | </div> |
86 | 88 | </div> |
87 | 89 | </div>'; |
90 | + } |
|
88 | 91 | } |
89 | 92 | |
90 | 93 | echo ' |
@@ -193,14 +196,15 @@ discard block |
||
193 | 196 | if ($context['get_pmessage']('message', true)) |
194 | 197 | { |
195 | 198 | // Show the helpful titlebar - generally. |
196 | - if ($context['display_mode'] != 1) |
|
197 | - echo ' |
|
199 | + if ($context['display_mode'] != 1) { |
|
200 | + echo ' |
|
198 | 201 | <div class="cat_bar"> |
199 | 202 | <h3 class="catbg"> |
200 | 203 | <span id="author">', $txt['author'], '</span> |
201 | 204 | <span id="topic_title">', $txt[$context['display_mode'] == 0 ? 'messages' : 'conversation'], '</span> |
202 | 205 | </h3> |
203 | 206 | </div>'; |
207 | + } |
|
204 | 208 | |
205 | 209 | // Show a few buttons if we are in conversation mode and outputting the first message. |
206 | 210 | if ($context['display_mode'] == 2) |
@@ -228,9 +232,10 @@ discard block |
||
228 | 232 | <div class="custom_fields_above_member"> |
229 | 233 | <ul class="nolist">'; |
230 | 234 | |
231 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
232 | - echo ' |
|
235 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
236 | + echo ' |
|
233 | 237 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
238 | + } |
|
234 | 239 | |
235 | 240 | echo ' |
236 | 241 | </ul> |
@@ -242,25 +247,28 @@ discard block |
||
242 | 247 | <a id="msg', $message['id'], '"></a>'; |
243 | 248 | |
244 | 249 | // Show online and offline buttons? |
245 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
246 | - echo ' |
|
250 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
251 | + echo ' |
|
247 | 252 | <span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>'; |
253 | + } |
|
248 | 254 | |
249 | 255 | // Custom fields BEFORE the username? |
250 | - if (!empty($message['custom_fields']['before_member'])) |
|
251 | - foreach ($message['custom_fields']['before_member'] as $custom) |
|
256 | + if (!empty($message['custom_fields']['before_member'])) { |
|
257 | + foreach ($message['custom_fields']['before_member'] as $custom) |
|
252 | 258 | echo ' |
253 | 259 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
260 | + } |
|
254 | 261 | |
255 | 262 | // Show a link to the member's profile. |
256 | 263 | echo ' |
257 | 264 | ', $message['member']['link']; |
258 | 265 | |
259 | 266 | // Custom fields AFTER the username? |
260 | - if (!empty($message['custom_fields']['after_member'])) |
|
261 | - foreach ($message['custom_fields']['after_member'] as $custom) |
|
267 | + if (!empty($message['custom_fields']['after_member'])) { |
|
268 | + foreach ($message['custom_fields']['after_member'] as $custom) |
|
262 | 269 | echo ' |
263 | 270 | <span class="custom ', $custom['col_name'], '">', $custom['value'], '</span>'; |
271 | + } |
|
264 | 272 | |
265 | 273 | echo ' |
266 | 274 | </h4>'; |
@@ -269,48 +277,56 @@ discard block |
||
269 | 277 | <ul class="user_info">'; |
270 | 278 | |
271 | 279 | // Show the user's avatar. |
272 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
273 | - echo ' |
|
280 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
281 | + echo ' |
|
274 | 282 | <li class="avatar"> |
275 | 283 | <a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">', $message['member']['avatar']['image'], '</a> |
276 | 284 | </li>'; |
285 | + } |
|
277 | 286 | |
278 | 287 | // Are there any custom fields below the avatar? |
279 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
280 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
288 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
289 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
281 | 290 | echo ' |
282 | 291 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
292 | + } |
|
283 | 293 | |
284 | - if (!$message['member']['is_guest']) |
|
285 | - echo ' |
|
294 | + if (!$message['member']['is_guest']) { |
|
295 | + echo ' |
|
286 | 296 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
297 | + } |
|
287 | 298 | // Show the member's primary group (like 'Administrator') if they have one. |
288 | - if (isset($message['member']['group']) && $message['member']['group'] != '') |
|
289 | - echo ' |
|
299 | + if (isset($message['member']['group']) && $message['member']['group'] != '') { |
|
300 | + echo ' |
|
290 | 301 | <li class="membergroup">', $message['member']['group'], '</li>'; |
302 | + } |
|
291 | 303 | |
292 | 304 | // Show the member's custom title, if they have one. |
293 | - if (isset($message['member']['title']) && $message['member']['title'] != '') |
|
294 | - echo ' |
|
305 | + if (isset($message['member']['title']) && $message['member']['title'] != '') { |
|
306 | + echo ' |
|
295 | 307 | <li class="title">', $message['member']['title'], '</li>'; |
308 | + } |
|
296 | 309 | |
297 | 310 | // Don't show these things for guests. |
298 | 311 | if (!$message['member']['is_guest']) |
299 | 312 | { |
300 | 313 | // Show the post group if and only if they have no other group or the option is on, and they are in a post group. |
301 | - if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') |
|
302 | - echo ' |
|
314 | + if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') { |
|
315 | + echo ' |
|
303 | 316 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
317 | + } |
|
304 | 318 | |
305 | 319 | // Show how many posts they have made. |
306 | - if (!isset($context['disabled_fields']['posts'])) |
|
307 | - echo ' |
|
320 | + if (!isset($context['disabled_fields']['posts'])) { |
|
321 | + echo ' |
|
308 | 322 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
323 | + } |
|
309 | 324 | |
310 | 325 | // Show their personal text? |
311 | - if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') |
|
312 | - echo ' |
|
326 | + if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') { |
|
327 | + echo ' |
|
313 | 328 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
329 | + } |
|
314 | 330 | |
315 | 331 | // Any custom fields to show as icons? |
316 | 332 | if (!empty($message['custom_fields']['icons'])) |
@@ -319,9 +335,10 @@ discard block |
||
319 | 335 | <li class="im_icons"> |
320 | 336 | <ol>'; |
321 | 337 | |
322 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
323 | - echo ' |
|
338 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
339 | + echo ' |
|
324 | 340 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
341 | + } |
|
325 | 342 | |
326 | 343 | echo ' |
327 | 344 | </ol> |
@@ -329,25 +346,28 @@ discard block |
||
329 | 346 | } |
330 | 347 | |
331 | 348 | // Show the IP to this user for this post - because you can moderate? |
332 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
333 | - echo ' |
|
349 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
350 | + echo ' |
|
334 | 351 | <li class="poster_ip"> |
335 | 352 | <a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a> |
336 | 353 | </li>'; |
354 | + } |
|
337 | 355 | |
338 | 356 | // Or, should we show it because this is you? |
339 | - elseif ($message['can_see_ip']) |
|
340 | - echo ' |
|
357 | + elseif ($message['can_see_ip']) { |
|
358 | + echo ' |
|
341 | 359 | <li class="poster_ip"> |
342 | 360 | <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a> |
343 | 361 | </li>'; |
362 | + } |
|
344 | 363 | |
345 | 364 | // Okay, you are logged in, then we can show something about why IPs are logged... |
346 | - else |
|
347 | - echo ' |
|
365 | + else { |
|
366 | + echo ' |
|
348 | 367 | <li class="poster_ip"> |
349 | 368 | <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a> |
350 | 369 | </li>'; |
370 | + } |
|
351 | 371 | |
352 | 372 | // Show the profile, website, email address, and personal message buttons. |
353 | 373 | if ($message['member']['show_profile_buttons']) |
@@ -357,24 +377,28 @@ discard block |
||
357 | 377 | <ol class="profile_icons">'; |
358 | 378 | |
359 | 379 | // Show the profile button |
360 | - if ($message['member']['can_view_profile']) |
|
361 | - echo ' |
|
380 | + if ($message['member']['can_view_profile']) { |
|
381 | + echo ' |
|
362 | 382 | <li><a href="', $message['member']['href'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="' . $txt['view_profile'] . '" title="' . $txt['view_profile'] . '">' : $txt['view_profile']), '</a></li>'; |
383 | + } |
|
363 | 384 | |
364 | 385 | // Don't show an icon if they haven't specified a website. |
365 | - if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) |
|
366 | - echo ' |
|
386 | + if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) { |
|
387 | + echo ' |
|
367 | 388 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
389 | + } |
|
368 | 390 | |
369 | 391 | // Don't show the email address if they want it hidden. |
370 | - if ($message['member']['show_email']) |
|
371 | - echo ' |
|
392 | + if ($message['member']['show_email']) { |
|
393 | + echo ' |
|
372 | 394 | <li><a href="mailto:', $message['member']['email'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
395 | + } |
|
373 | 396 | |
374 | 397 | // Since we know this person isn't a guest, you *can* message them. |
375 | - if ($context['can_send_pm']) |
|
376 | - echo ' |
|
398 | + if ($context['can_send_pm']) { |
|
399 | + echo ' |
|
377 | 400 | <li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>'; |
401 | + } |
|
378 | 402 | |
379 | 403 | echo ' |
380 | 404 | </ol> |
@@ -382,21 +406,24 @@ discard block |
||
382 | 406 | } |
383 | 407 | |
384 | 408 | // Any custom fields for standard placement? |
385 | - if (!empty($message['custom_fields']['standard'])) |
|
386 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
409 | + if (!empty($message['custom_fields']['standard'])) { |
|
410 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
387 | 411 | echo ' |
388 | 412 | <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
413 | + } |
|
389 | 414 | |
390 | 415 | // Are we showing the warning status? |
391 | - if ($message['member']['can_see_warning']) |
|
392 | - echo ' |
|
416 | + if ($message['member']['can_see_warning']) { |
|
417 | + echo ' |
|
393 | 418 | <li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span>', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>'; |
419 | + } |
|
394 | 420 | |
395 | 421 | // Are there any custom fields to show at the bottom of the poster info? |
396 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
397 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
422 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
423 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
398 | 424 | echo ' |
399 | 425 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
426 | + } |
|
400 | 427 | } |
401 | 428 | |
402 | 429 | // Done with the information about the poster... on to the post itself. |
@@ -415,25 +442,29 @@ discard block |
||
415 | 442 | <span class="smalltext">« <strong> ', $txt['sent_to'], ':</strong> '; |
416 | 443 | |
417 | 444 | // People it was sent directly to.... |
418 | - if (!empty($message['recipients']['to'])) |
|
419 | - echo implode(', ', $message['recipients']['to']); |
|
445 | + if (!empty($message['recipients']['to'])) { |
|
446 | + echo implode(', ', $message['recipients']['to']); |
|
447 | + } |
|
420 | 448 | |
421 | 449 | // Otherwise, we're just going to say "some people"... |
422 | - elseif ($context['folder'] != 'sent') |
|
423 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
450 | + elseif ($context['folder'] != 'sent') { |
|
451 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
452 | + } |
|
424 | 453 | |
425 | 454 | echo ' |
426 | 455 | <strong> ', $txt['on'], ':</strong> ', $message['time'], ' » |
427 | 456 | </span>'; |
428 | 457 | |
429 | 458 | // If we're in the sent items, show who it was sent to besides the "To:" people. |
430 | - if (!empty($message['recipients']['bcc'])) |
|
431 | - echo '<br> |
|
459 | + if (!empty($message['recipients']['bcc'])) { |
|
460 | + echo '<br> |
|
432 | 461 | <span class="smalltext">« <strong> ', $txt['pm_bcc'], ':</strong> ', implode(', ', $message['recipients']['bcc']), ' »</span>'; |
462 | + } |
|
433 | 463 | |
434 | - if (!empty($message['is_replied_to'])) |
|
435 | - echo '<br> |
|
464 | + if (!empty($message['is_replied_to'])) { |
|
465 | + echo '<br> |
|
436 | 466 | <span class="smalltext">« ', $context['folder'] == 'sent' ? $txt['pm_sent_is_replied_to'] : $txt['pm_is_replied_to'], ' »</span>'; |
467 | + } |
|
437 | 468 | |
438 | 469 | echo ' |
439 | 470 | </div><!-- .keyinfo --> |
@@ -443,13 +474,15 @@ discard block |
||
443 | 474 | ', $message['body'], ' |
444 | 475 | </div>'; |
445 | 476 | |
446 | - if ($message['can_report'] || $context['can_send_pm']) |
|
447 | - echo ' |
|
477 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
478 | + echo ' |
|
448 | 479 | <div class="under_message">'; |
480 | + } |
|
449 | 481 | |
450 | - if ($message['can_report']) |
|
451 | - echo ' |
|
482 | + if ($message['can_report']) { |
|
483 | + echo ' |
|
452 | 484 | <a href="' . $scripturl . '?action=pm;sa=report;l=' . $context['current_label_id'] . ';pmsg=' . $message['id'] . '" class="floatright">' . $txt['pm_report_to_admin'] . '</a>'; |
485 | + } |
|
453 | 486 | |
454 | 487 | echo ' |
455 | 488 | <ul class="quickbuttons">'; |
@@ -461,32 +494,36 @@ discard block |
||
461 | 494 | if (!$message['member']['is_guest']) |
462 | 495 | { |
463 | 496 | // Is there than more than one recipient you can reply to? |
464 | - if ($message['number_recipients'] > 1) |
|
465 | - echo ' |
|
497 | + if ($message['number_recipients'] > 1) { |
|
498 | + echo ' |
|
466 | 499 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=all"><span class="generic_icons reply_all_button"></span>', $txt['reply_to_all'], '</a></li>'; |
500 | + } |
|
467 | 501 | |
468 | 502 | echo ' |
469 | 503 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li> |
470 | 504 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
471 | 505 | } |
472 | 506 | // This is for "forwarding" - even if the member is gone. |
473 | - else |
|
474 | - echo ' |
|
507 | + else { |
|
508 | + echo ' |
|
475 | 509 | <li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote"><span class="generic_icons quote"></span>', $txt['reply_quote'], '</a></li>'; |
510 | + } |
|
476 | 511 | } |
477 | 512 | echo ' |
478 | 513 | <li><a href="', $scripturl, '?action=pm;sa=pmactions;pm_actions%5b', $message['id'], '%5D=delete;f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', addslashes($txt['remove_message_question']), '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['delete'], '</a></li>'; |
479 | 514 | |
480 | - if (empty($context['display_mode'])) |
|
481 | - echo ' |
|
515 | + if (empty($context['display_mode'])) { |
|
516 | + echo ' |
|
482 | 517 | <li><input type="checkbox" name="pms[]" id="deletedisplay', $message['id'], '" value="', $message['id'], '" onclick="document.getElementById(\'deletelisting', $message['id'], '\').checked = this.checked;"></li>'; |
518 | + } |
|
483 | 519 | |
484 | 520 | echo ' |
485 | 521 | </ul>'; |
486 | 522 | |
487 | - if ($message['can_report'] || $context['can_send_pm']) |
|
488 | - echo ' |
|
523 | + if ($message['can_report'] || $context['can_send_pm']) { |
|
524 | + echo ' |
|
489 | 525 | </div><!-- .under_message -->'; |
526 | + } |
|
490 | 527 | |
491 | 528 | // Are there any custom profile fields for above the signature? |
492 | 529 | if (!empty($message['custom_fields']['above_signature'])) |
@@ -495,9 +532,10 @@ discard block |
||
495 | 532 | <div class="custom_fields_above_signature"> |
496 | 533 | <ul class="nolist">'; |
497 | 534 | |
498 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
499 | - echo ' |
|
535 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
536 | + echo ' |
|
500 | 537 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
538 | + } |
|
501 | 539 | |
502 | 540 | echo ' |
503 | 541 | </ul> |
@@ -505,11 +543,12 @@ discard block |
||
505 | 543 | } |
506 | 544 | |
507 | 545 | // Show the member's signature? |
508 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
509 | - echo ' |
|
546 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
547 | + echo ' |
|
510 | 548 | <div class="signature"> |
511 | 549 | ', $message['member']['signature'], ' |
512 | 550 | </div>'; |
551 | + } |
|
513 | 552 | |
514 | 553 | // Are there any custom profile fields for below the signature? |
515 | 554 | if (!empty($message['custom_fields']['below_signature'])) |
@@ -518,9 +557,10 @@ discard block |
||
518 | 557 | <div class="custom_fields_below_signature"> |
519 | 558 | <ul class="nolist">'; |
520 | 559 | |
521 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
522 | - echo ' |
|
560 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
561 | + echo ' |
|
523 | 562 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
563 | + } |
|
524 | 564 | |
525 | 565 | echo ' |
526 | 566 | </ul> |
@@ -547,10 +587,11 @@ discard block |
||
547 | 587 | echo ' |
548 | 588 | <option value="" disabled>', $txt['pm_msg_label_apply'], ':</option>'; |
549 | 589 | |
550 | - foreach ($context['labels'] as $label) |
|
551 | - if (!isset($message['labels'][$label['id']])) |
|
590 | + foreach ($context['labels'] as $label) { |
|
591 | + if (!isset($message['labels'][$label['id']])) |
|
552 | 592 | echo ' |
553 | 593 | <option value="', $label['id'], '">', $label['name'], '</option>'; |
594 | + } |
|
554 | 595 | } |
555 | 596 | |
556 | 597 | // ... and are there any that can be removed? |
@@ -559,9 +600,10 @@ discard block |
||
559 | 600 | echo ' |
560 | 601 | <option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>'; |
561 | 602 | |
562 | - foreach ($message['labels'] as $label) |
|
563 | - echo ' |
|
603 | + foreach ($message['labels'] as $label) { |
|
604 | + echo ' |
|
564 | 605 | <option value="', $label['id'], '"> ', $label['name'], '</option>'; |
606 | + } |
|
565 | 607 | } |
566 | 608 | echo ' |
567 | 609 | </select> |
@@ -580,14 +622,15 @@ discard block |
||
580 | 622 | </div><!-- .windowbg -->'; |
581 | 623 | } |
582 | 624 | |
583 | - if (empty($context['display_mode'])) |
|
584 | - echo ' |
|
625 | + if (empty($context['display_mode'])) { |
|
626 | + echo ' |
|
585 | 627 | <div class="pagesection"> |
586 | 628 | <div class="floatleft">', $context['page_index'], '</div> |
587 | 629 | <div class="floatright"> |
588 | 630 | <input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button"> |
589 | 631 | </div> |
590 | 632 | </div>'; |
633 | + } |
|
591 | 634 | |
592 | 635 | // Show a few buttons if we are in conversation mode and outputting the first message. |
593 | 636 | elseif ($context['display_mode'] == 2 && isset($context['conversation_buttons'])) |
@@ -647,11 +690,12 @@ discard block |
||
647 | 690 | </thead> |
648 | 691 | <tbody>'; |
649 | 692 | |
650 | - if (!$context['show_delete']) |
|
651 | - echo ' |
|
693 | + if (!$context['show_delete']) { |
|
694 | + echo ' |
|
652 | 695 | <tr class="windowbg"> |
653 | 696 | <td colspan="5">', $txt['pm_alert_none'], '</td> |
654 | 697 | </tr>'; |
698 | + } |
|
655 | 699 | |
656 | 700 | while ($message = $context['get_pmessage']('subject')) |
657 | 701 | { |
@@ -709,17 +753,19 @@ discard block |
||
709 | 753 | |
710 | 754 | foreach ($context['labels'] as $label) |
711 | 755 | { |
712 | - if ($label['id'] != $context['current_label_id']) |
|
713 | - echo ' |
|
756 | + if ($label['id'] != $context['current_label_id']) { |
|
757 | + echo ' |
|
714 | 758 | <option value="add_', $label['id'], '"> ', $label['name'], '</option>'; |
759 | + } |
|
715 | 760 | } |
716 | 761 | |
717 | 762 | echo ' |
718 | 763 | <option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>'; |
719 | 764 | |
720 | - foreach ($context['labels'] as $label) |
|
721 | - echo ' |
|
765 | + foreach ($context['labels'] as $label) { |
|
766 | + echo ' |
|
722 | 767 | <option value="rem_', $label['id'], '"> ', $label['name'], '</option>'; |
768 | + } |
|
723 | 769 | |
724 | 770 | echo ' |
725 | 771 | </select> |
@@ -744,11 +790,12 @@ discard block |
||
744 | 790 | { |
745 | 791 | global $context, $scripturl, $txt; |
746 | 792 | |
747 | - if (!empty($context['search_errors'])) |
|
748 | - echo ' |
|
793 | + if (!empty($context['search_errors'])) { |
|
794 | + echo ' |
|
749 | 795 | <div class="errorbox"> |
750 | 796 | ', implode('<br>', $context['search_errors']['messages']), ' |
751 | 797 | </div>'; |
798 | + } |
|
752 | 799 | |
753 | 800 | echo ' |
754 | 801 | <form action="', $scripturl, '?action=pm;sa=search2" method="post" accept-charset="', $context['character_set'], '" name="searchform" id="searchform"> |
@@ -816,9 +863,10 @@ discard block |
||
816 | 863 | </dd> |
817 | 864 | </dl>'; |
818 | 865 | |
819 | - if (!$context['currently_using_labels']) |
|
820 | - echo ' |
|
866 | + if (!$context['currently_using_labels']) { |
|
867 | + echo ' |
|
821 | 868 | <input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button floatright">'; |
869 | + } |
|
822 | 870 | |
823 | 871 | echo ' |
824 | 872 | </div><!-- .roundframe -->'; |
@@ -837,12 +885,13 @@ discard block |
||
837 | 885 | <div id="advanced_panel_div"> |
838 | 886 | <ul id="searchLabelsExpand">'; |
839 | 887 | |
840 | - foreach ($context['search_labels'] as $label) |
|
841 | - echo ' |
|
888 | + foreach ($context['search_labels'] as $label) { |
|
889 | + echo ' |
|
842 | 890 | <li> |
843 | 891 | <label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '"', $label['checked'] ? ' checked' : '', '> |
844 | 892 | ', $label['name'], '</label> |
845 | 893 | </li>'; |
894 | + } |
|
846 | 895 | |
847 | 896 | echo ' |
848 | 897 | </ul> |
@@ -904,8 +953,8 @@ discard block |
||
904 | 953 | </div>'; |
905 | 954 | |
906 | 955 | // Complete results? |
907 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
908 | - echo ' |
|
956 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
957 | + echo ' |
|
909 | 958 | <table class="table_grid"> |
910 | 959 | <thead> |
911 | 960 | <tr class="title_bar"> |
@@ -915,6 +964,7 @@ discard block |
||
915 | 964 | </tr> |
916 | 965 | </thead> |
917 | 966 | <tbody>'; |
967 | + } |
|
918 | 968 | |
919 | 969 | // Print each message out... |
920 | 970 | foreach ($context['personal_messages'] as $message) |
@@ -934,12 +984,14 @@ discard block |
||
934 | 984 | |
935 | 985 | // Show the recipients. |
936 | 986 | // @todo This doesn't deal with the sent item searching quite right for bcc. |
937 | - if (!empty($message['recipients']['to'])) |
|
938 | - echo implode(', ', $message['recipients']['to']); |
|
987 | + if (!empty($message['recipients']['to'])) { |
|
988 | + echo implode(', ', $message['recipients']['to']); |
|
989 | + } |
|
939 | 990 | |
940 | 991 | // Otherwise, we're just going to say "some people"... |
941 | - elseif ($context['folder'] != 'sent') |
|
942 | - echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
992 | + elseif ($context['folder'] != 'sent') { |
|
993 | + echo '(', $txt['pm_undisclosed_recipients'], ')'; |
|
994 | + } |
|
943 | 995 | |
944 | 996 | echo ' |
945 | 997 | </h3> |
@@ -954,15 +1006,17 @@ discard block |
||
954 | 1006 | $reply_button = create_button('im_reply.png', 'reply', 'reply', 'class="centericon"'); |
955 | 1007 | |
956 | 1008 | // You can only reply if they are not a guest... |
957 | - if (!$message['member']['is_guest']) |
|
958 | - echo ' |
|
1009 | + if (!$message['member']['is_guest']) { |
|
1010 | + echo ' |
|
959 | 1011 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button , '</a>', $context['menu_separator'], ' |
960 | 1012 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button , '</a> ', $context['menu_separator']; |
1013 | + } |
|
961 | 1014 | |
962 | 1015 | // This is for "forwarding" - even if the member is gone. |
963 | - else |
|
964 | - echo ' |
|
1016 | + else { |
|
1017 | + echo ' |
|
965 | 1018 | <a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button , '</a>', $context['menu_separator']; |
1019 | + } |
|
966 | 1020 | } |
967 | 1021 | |
968 | 1022 | echo ' |
@@ -971,27 +1025,30 @@ discard block |
||
971 | 1025 | } |
972 | 1026 | // Otherwise just a simple list! |
973 | 1027 | // @todo No context at all of the search? |
974 | - else |
|
975 | - echo ' |
|
1028 | + else { |
|
1029 | + echo ' |
|
976 | 1030 | <tr class="windowbg"> |
977 | 1031 | <td>', $message['time'], '</td> |
978 | 1032 | <td>', $message['link'], '</td> |
979 | 1033 | <td>', $message['member']['link'], '</td> |
980 | 1034 | </tr>'; |
1035 | + } |
|
981 | 1036 | } |
982 | 1037 | |
983 | 1038 | // Finish off the page... |
984 | - if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
|
985 | - echo ' |
|
1039 | + if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) { |
|
1040 | + echo ' |
|
986 | 1041 | </tbody> |
987 | 1042 | </table>'; |
1043 | + } |
|
988 | 1044 | |
989 | 1045 | // No results? |
990 | - if (empty($context['personal_messages'])) |
|
991 | - echo ' |
|
1046 | + if (empty($context['personal_messages'])) { |
|
1047 | + echo ' |
|
992 | 1048 | <div class="windowbg"> |
993 | 1049 | <p class="centertext">', $txt['pm_search_none_found'], '</p> |
994 | 1050 | </div>'; |
1051 | + } |
|
995 | 1052 | |
996 | 1053 | echo ' |
997 | 1054 | <div class="pagesection"> |
@@ -1016,15 +1073,17 @@ discard block |
||
1016 | 1073 | </div> |
1017 | 1074 | <div class="windowbg">'; |
1018 | 1075 | |
1019 | - if (!empty($context['send_log']['sent'])) |
|
1020 | - foreach ($context['send_log']['sent'] as $log_entry) |
|
1076 | + if (!empty($context['send_log']['sent'])) { |
|
1077 | + foreach ($context['send_log']['sent'] as $log_entry) |
|
1021 | 1078 | echo ' |
1022 | 1079 | <span class="error">', $log_entry, '</span><br>'; |
1080 | + } |
|
1023 | 1081 | |
1024 | - if (!empty($context['send_log']['failed'])) |
|
1025 | - foreach ($context['send_log']['failed'] as $log_entry) |
|
1082 | + if (!empty($context['send_log']['failed'])) { |
|
1083 | + foreach ($context['send_log']['failed'] as $log_entry) |
|
1026 | 1084 | echo ' |
1027 | 1085 | <span class="error">', $log_entry, '</span><br>'; |
1086 | + } |
|
1028 | 1087 | |
1029 | 1088 | echo ' |
1030 | 1089 | </div> |
@@ -1070,12 +1129,13 @@ discard block |
||
1070 | 1129 | </dl> |
1071 | 1130 | </div>'; |
1072 | 1131 | |
1073 | - if (!empty($modSettings['drafts_pm_enabled'])) |
|
1074 | - echo ' |
|
1132 | + if (!empty($modSettings['drafts_pm_enabled'])) { |
|
1133 | + echo ' |
|
1075 | 1134 | <div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', |
1076 | 1135 | sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), ' |
1077 | 1136 | ', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), ' |
1078 | 1137 | </div>'; |
1138 | + } |
|
1079 | 1139 | |
1080 | 1140 | echo ' |
1081 | 1141 | <dl id="post_header">'; |
@@ -1141,22 +1201,24 @@ discard block |
||
1141 | 1201 | <dt><strong>', $txt['subject'], '</strong></dt> |
1142 | 1202 | <dd><strong>', $txt['draft_saved_on'], '</strong></dd>'; |
1143 | 1203 | |
1144 | - foreach ($context['drafts'] as $draft) |
|
1145 | - echo ' |
|
1204 | + foreach ($context['drafts'] as $draft) { |
|
1205 | + echo ' |
|
1146 | 1206 | <dt>', $draft['link'], '</dt> |
1147 | 1207 | <dd>', $draft['poster_time'], '</dd>'; |
1208 | + } |
|
1148 | 1209 | echo ' |
1149 | 1210 | </dl> |
1150 | 1211 | </div>'; |
1151 | 1212 | } |
1152 | 1213 | |
1153 | 1214 | // Require an image to be typed to save spamming? |
1154 | - if ($context['require_verification']) |
|
1155 | - echo ' |
|
1215 | + if ($context['require_verification']) { |
|
1216 | + echo ' |
|
1156 | 1217 | <div class="post_verification"> |
1157 | 1218 | <strong>', $txt['pm_visual_verification_label'], ':</strong> |
1158 | 1219 | ', template_control_verification($context['visual_verification_id'], 'all'), ' |
1159 | 1220 | </div>'; |
1221 | + } |
|
1160 | 1222 | |
1161 | 1223 | // Send, Preview, spellcheck buttons. |
1162 | 1224 | echo ' |
@@ -1274,8 +1336,8 @@ discard block |
||
1274 | 1336 | }'; |
1275 | 1337 | |
1276 | 1338 | // Code for showing and hiding drafts |
1277 | - if (!empty($context['drafts'])) |
|
1278 | - echo ' |
|
1339 | + if (!empty($context['drafts'])) { |
|
1340 | + echo ' |
|
1279 | 1341 | var oSwapDraftOptions = new smc_Toggle({ |
1280 | 1342 | bToggleEnabled: true, |
1281 | 1343 | bCurrentlyCollapsed: true, |
@@ -1297,13 +1359,14 @@ discard block |
||
1297 | 1359 | } |
1298 | 1360 | ] |
1299 | 1361 | });'; |
1362 | + } |
|
1300 | 1363 | |
1301 | 1364 | echo ' |
1302 | 1365 | </script>'; |
1303 | 1366 | |
1304 | 1367 | // Show the message you're replying to. |
1305 | - if ($context['reply']) |
|
1306 | - echo ' |
|
1368 | + if ($context['reply']) { |
|
1369 | + echo ' |
|
1307 | 1370 | <br><br> |
1308 | 1371 | <div class="cat_bar"> |
1309 | 1372 | <h3 class="catbg">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3> |
@@ -1317,6 +1380,7 @@ discard block |
||
1317 | 1380 | ', $context['quoted_message']['body'], ' |
1318 | 1381 | </div> |
1319 | 1382 | <br class="clear">'; |
1383 | + } |
|
1320 | 1384 | |
1321 | 1385 | echo ' |
1322 | 1386 | <script> |
@@ -1328,23 +1392,25 @@ discard block |
||
1328 | 1392 | sToControlId: \'to_control\', |
1329 | 1393 | aToRecipients: ['; |
1330 | 1394 | |
1331 | - foreach ($context['recipients']['to'] as $i => $member) |
|
1332 | - echo ' |
|
1395 | + foreach ($context['recipients']['to'] as $i => $member) { |
|
1396 | + echo ' |
|
1333 | 1397 | { |
1334 | 1398 | sItemId: ', JavaScriptEscape($member['id']), ', |
1335 | 1399 | sItemName: ', JavaScriptEscape($member['name']), ' |
1336 | 1400 | }', $i == count($context['recipients']['to']) - 1 ? '' : ','; |
1401 | + } |
|
1337 | 1402 | |
1338 | 1403 | echo ' |
1339 | 1404 | ], |
1340 | 1405 | aBccRecipients: ['; |
1341 | 1406 | |
1342 | - foreach ($context['recipients']['bcc'] as $i => $member) |
|
1343 | - echo ' |
|
1407 | + foreach ($context['recipients']['bcc'] as $i => $member) { |
|
1408 | + echo ' |
|
1344 | 1409 | { |
1345 | 1410 | sItemId: ', JavaScriptEscape($member['id']), ', |
1346 | 1411 | sItemName: ', JavaScriptEscape($member['name']), ' |
1347 | 1412 | }', $i == count($context['recipients']['bcc']) - 1 ? '' : ','; |
1413 | + } |
|
1348 | 1414 | |
1349 | 1415 | echo ' |
1350 | 1416 | ], |
@@ -1433,26 +1499,28 @@ discard block |
||
1433 | 1499 | </th> |
1434 | 1500 | <th class="centertext table_icon">'; |
1435 | 1501 | |
1436 | - if (count($context['labels']) > 2) |
|
1437 | - echo ' |
|
1502 | + if (count($context['labels']) > 2) { |
|
1503 | + echo ' |
|
1438 | 1504 | <input type="checkbox" onclick="invertAll(this, this.form);">'; |
1505 | + } |
|
1439 | 1506 | |
1440 | 1507 | echo ' |
1441 | 1508 | </th> |
1442 | 1509 | </tr> |
1443 | 1510 | </thead> |
1444 | 1511 | <tbody>'; |
1445 | - if (count($context['labels']) < 2) |
|
1446 | - echo ' |
|
1512 | + if (count($context['labels']) < 2) { |
|
1513 | + echo ' |
|
1447 | 1514 | <tr class="windowbg"> |
1448 | 1515 | <td colspan="2">', $txt['pm_labels_no_exist'], '</td> |
1449 | 1516 | </tr>'; |
1450 | - else |
|
1517 | + } else |
|
1451 | 1518 | { |
1452 | 1519 | foreach ($context['labels'] as $label) |
1453 | 1520 | { |
1454 | - if ($label['id'] == -1) |
|
1455 | - continue; |
|
1521 | + if ($label['id'] == -1) { |
|
1522 | + continue; |
|
1523 | + } |
|
1456 | 1524 | |
1457 | 1525 | echo ' |
1458 | 1526 | <tr class="windowbg"> |
@@ -1467,12 +1535,13 @@ discard block |
||
1467 | 1535 | </tbody> |
1468 | 1536 | </table>'; |
1469 | 1537 | |
1470 | - if (!count($context['labels']) < 2) |
|
1471 | - echo ' |
|
1538 | + if (!count($context['labels']) < 2) { |
|
1539 | + echo ' |
|
1472 | 1540 | <div class="block righttext"> |
1473 | 1541 | <input type="submit" name="save" value="', $txt['save'], '" class="button"> |
1474 | 1542 | <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button you_sure"> |
1475 | 1543 | </div>'; |
1544 | + } |
|
1476 | 1545 | |
1477 | 1546 | echo ' |
1478 | 1547 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1528,9 +1597,10 @@ discard block |
||
1528 | 1597 | <select name="id_admin"> |
1529 | 1598 | <option value="0">', $txt['pm_report_all_admins'], '</option>'; |
1530 | 1599 | |
1531 | - foreach ($context['admins'] as $id => $name) |
|
1532 | - echo ' |
|
1600 | + foreach ($context['admins'] as $id => $name) { |
|
1601 | + echo ' |
|
1533 | 1602 | <option value="', $id, '">', $name, '</option>'; |
1603 | + } |
|
1534 | 1604 | |
1535 | 1605 | echo ' |
1536 | 1606 | </select> |
@@ -1593,9 +1663,10 @@ discard block |
||
1593 | 1663 | </th> |
1594 | 1664 | <th class="centertext table_icon">'; |
1595 | 1665 | |
1596 | - if (!empty($context['rules'])) |
|
1597 | - echo ' |
|
1666 | + if (!empty($context['rules'])) { |
|
1667 | + echo ' |
|
1598 | 1668 | <input type="checkbox" onclick="invertAll(this, this.form);">'; |
1669 | + } |
|
1599 | 1670 | |
1600 | 1671 | echo ' |
1601 | 1672 | </th> |
@@ -1603,16 +1674,17 @@ discard block |
||
1603 | 1674 | </thead> |
1604 | 1675 | <tbody>'; |
1605 | 1676 | |
1606 | - if (empty($context['rules'])) |
|
1607 | - echo ' |
|
1677 | + if (empty($context['rules'])) { |
|
1678 | + echo ' |
|
1608 | 1679 | <tr class="windowbg"> |
1609 | 1680 | <td colspan="2"> |
1610 | 1681 | ', $txt['pm_rules_none'], ' |
1611 | 1682 | </td> |
1612 | 1683 | </tr>'; |
1684 | + } |
|
1613 | 1685 | |
1614 | - foreach ($context['rules'] as $rule) |
|
1615 | - echo ' |
|
1686 | + foreach ($context['rules'] as $rule) { |
|
1687 | + echo ' |
|
1616 | 1688 | <tr class="windowbg"> |
1617 | 1689 | <td> |
1618 | 1690 | <a href="', $scripturl, '?action=pm;sa=manrules;add;rid=', $rule['id'], '">', $rule['name'], '</a> |
@@ -1621,6 +1693,7 @@ discard block |
||
1621 | 1693 | <input type="checkbox" name="delrule[', $rule['id'], ']"> |
1622 | 1694 | </td> |
1623 | 1695 | </tr>'; |
1696 | + } |
|
1624 | 1697 | |
1625 | 1698 | echo ' |
1626 | 1699 | </tbody> |
@@ -1628,14 +1701,16 @@ discard block |
||
1628 | 1701 | <div class="righttext"> |
1629 | 1702 | <a class="button" href="', $scripturl, '?action=pm;sa=manrules;add;rid=0">', $txt['pm_add_rule'], '</a>'; |
1630 | 1703 | |
1631 | - if (!empty($context['rules'])) |
|
1632 | - echo ' |
|
1704 | + if (!empty($context['rules'])) { |
|
1705 | + echo ' |
|
1633 | 1706 | [<a href="', $scripturl, '?action=pm;sa=manrules;apply;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['pm_js_apply_rules_confirm'], '\');">', $txt['pm_apply_rules'], '</a>]'; |
1707 | + } |
|
1634 | 1708 | |
1635 | - if (!empty($context['rules'])) |
|
1636 | - echo ' |
|
1709 | + if (!empty($context['rules'])) { |
|
1710 | + echo ' |
|
1637 | 1711 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1638 | 1712 | <input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button smalltext you_sure">'; |
1713 | + } |
|
1639 | 1714 | |
1640 | 1715 | echo ' |
1641 | 1716 | </div> |
@@ -1657,14 +1732,16 @@ discard block |
||
1657 | 1732 | var groups = new Array() |
1658 | 1733 | var labels = new Array()'; |
1659 | 1734 | |
1660 | - foreach ($context['groups'] as $id => $title) |
|
1661 | - echo ' |
|
1735 | + foreach ($context['groups'] as $id => $title) { |
|
1736 | + echo ' |
|
1662 | 1737 | groups[', $id, '] = "', addslashes($title), '";'; |
1738 | + } |
|
1663 | 1739 | |
1664 | - foreach ($context['labels'] as $label) |
|
1665 | - if ($label['id'] != -1) |
|
1740 | + foreach ($context['labels'] as $label) { |
|
1741 | + if ($label['id'] != -1) |
|
1666 | 1742 | echo ' |
1667 | 1743 | labels[', ($label['id']), '] = "', addslashes($label['name']), '";'; |
1744 | + } |
|
1668 | 1745 | |
1669 | 1746 | echo ' |
1670 | 1747 | function addCriteriaOption() |
@@ -1679,8 +1756,9 @@ discard block |
||
1679 | 1756 | |
1680 | 1757 | setOuterHTML(document.getElementById("criteriaAddHere"), \'<br><select name="ruletype[\' + criteriaNum + \']" id="ruletype\' + criteriaNum + \'" onchange="updateRuleDef(\' + criteriaNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_criteria_pick']), ':<\' + \'/option><option value="mid">', addslashes($txt['pm_rule_mid']), '<\' + \'/option><option value="gid">', addslashes($txt['pm_rule_gid']), '<\' + \'/option><option value="sub">', addslashes($txt['pm_rule_sub']), '<\' + \'/option><option value="msg">', addslashes($txt['pm_rule_msg']), '<\' + \'/option><option value="bud">', addslashes($txt['pm_rule_bud']), '<\' + \'/option><\' + \'/select> <span id="defdiv\' + criteriaNum + \'" style="display: none;"><input type="text" name="ruledef[\' + criteriaNum + \']" id="ruledef\' + criteriaNum + \'" onkeyup="rebuildRuleDesc();" value=""><\' + \'/span><span id="defseldiv\' + criteriaNum + \'" style="display: none;"><select name="ruledefgroup[\' + criteriaNum + \']" id="ruledefgroup\' + criteriaNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_group']), '<\' + \'/option>'; |
1681 | 1758 | |
1682 | - foreach ($context['groups'] as $id => $group) |
|
1683 | - echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
1759 | + foreach ($context['groups'] as $id => $group) { |
|
1760 | + echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
|
1761 | + } |
|
1684 | 1762 | |
1685 | 1763 | echo '<\' + \'/select><\' + \'/span><span id="criteriaAddHere"><\' + \'/span>\'); |
1686 | 1764 | } |
@@ -1697,9 +1775,10 @@ discard block |
||
1697 | 1775 | |
1698 | 1776 | setOuterHTML(document.getElementById("actionAddHere"), \'<br><select name="acttype[\' + actionNum + \']" id="acttype\' + actionNum + \'" onchange="updateActionDef(\' + actionNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_action']), ':<\' + \'/option><option value="lab">', addslashes($txt['pm_rule_label']), '<\' + \'/option><option value="del">', addslashes($txt['pm_rule_delete']), '<\' + \'/option><\' + \'/select> <span id="labdiv\' + actionNum + \'" style="display: none;"><select name="labdef[\' + actionNum + \']" id="labdef\' + actionNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_label']), '<\' + \'/option>'; |
1699 | 1777 | |
1700 | - foreach ($context['labels'] as $label) |
|
1701 | - if ($label['id'] != -1) |
|
1778 | + foreach ($context['labels'] as $label) { |
|
1779 | + if ($label['id'] != -1) |
|
1702 | 1780 | echo '<option value="', ($label['id']), '">', addslashes($label['name']), '<\' + \'/option>'; |
1781 | + } |
|
1703 | 1782 | |
1704 | 1783 | echo '<\' + \'/select><\' + \'/span><span id="actionAddHere"><\' + \'/span>\'); |
1705 | 1784 | } |
@@ -1813,19 +1892,20 @@ discard block |
||
1813 | 1892 | $isFirst = true; |
1814 | 1893 | foreach ($context['rule']['criteria'] as $k => $criteria) |
1815 | 1894 | { |
1816 | - if (!$isFirst && $criteria['t'] == '') |
|
1817 | - echo '<div id="removeonjs1">'; |
|
1818 | - |
|
1819 | - elseif (!$isFirst) |
|
1820 | - echo '<br>'; |
|
1895 | + if (!$isFirst && $criteria['t'] == '') { |
|
1896 | + echo '<div id="removeonjs1">'; |
|
1897 | + } elseif (!$isFirst) { |
|
1898 | + echo '<br>'; |
|
1899 | + } |
|
1821 | 1900 | |
1822 | 1901 | echo ' |
1823 | 1902 | <select name="ruletype[', $k, ']" id="ruletype', $k, '" onchange="updateRuleDef(', $k, '); rebuildRuleDesc();"> |
1824 | 1903 | <option value="">', $txt['pm_rule_criteria_pick'], ':</option>'; |
1825 | 1904 | |
1826 | - foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) |
|
1827 | - echo ' |
|
1905 | + foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) { |
|
1906 | + echo ' |
|
1828 | 1907 | <option value="', $cr, '"', $criteria['t'] == $cr ? ' selected' : '', '>', $txt['pm_rule_' . $cr], '</option>'; |
1908 | + } |
|
1829 | 1909 | |
1830 | 1910 | echo ' |
1831 | 1911 | </select> |
@@ -1836,19 +1916,20 @@ discard block |
||
1836 | 1916 | <select name="ruledefgroup[', $k, ']" id="ruledefgroup', $k, '" onchange="rebuildRuleDesc();"> |
1837 | 1917 | <option value="">', $txt['pm_rule_sel_group'], '</option>'; |
1838 | 1918 | |
1839 | - foreach ($context['groups'] as $id => $group) |
|
1840 | - echo ' |
|
1919 | + foreach ($context['groups'] as $id => $group) { |
|
1920 | + echo ' |
|
1841 | 1921 | <option value="', $id, '"', $criteria['t'] == 'gid' && $criteria['v'] == $id ? ' selected' : '', '>', $group, '</option>'; |
1922 | + } |
|
1842 | 1923 | echo ' |
1843 | 1924 | </select> |
1844 | 1925 | </span>'; |
1845 | 1926 | |
1846 | 1927 | // If this is the dummy we add a means to hide for non js users. |
1847 | - if ($isFirst) |
|
1848 | - $isFirst = false; |
|
1849 | - |
|
1850 | - elseif ($criteria['t'] == '') |
|
1851 | - echo '</div><!-- .removeonjs1 -->'; |
|
1928 | + if ($isFirst) { |
|
1929 | + $isFirst = false; |
|
1930 | + } elseif ($criteria['t'] == '') { |
|
1931 | + echo '</div><!-- .removeonjs1 -->'; |
|
1932 | + } |
|
1852 | 1933 | } |
1853 | 1934 | |
1854 | 1935 | echo ' |
@@ -1871,10 +1952,11 @@ discard block |
||
1871 | 1952 | $isFirst = true; |
1872 | 1953 | foreach ($context['rule']['actions'] as $k => $action) |
1873 | 1954 | { |
1874 | - if (!$isFirst && $action['t'] == '') |
|
1875 | - echo '<div id="removeonjs2">'; |
|
1876 | - elseif (!$isFirst) |
|
1877 | - echo '<br>'; |
|
1955 | + if (!$isFirst && $action['t'] == '') { |
|
1956 | + echo '<div id="removeonjs2">'; |
|
1957 | + } elseif (!$isFirst) { |
|
1958 | + echo '<br>'; |
|
1959 | + } |
|
1878 | 1960 | |
1879 | 1961 | echo ' |
1880 | 1962 | <select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();"> |
@@ -1886,20 +1968,21 @@ discard block |
||
1886 | 1968 | <select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();"> |
1887 | 1969 | <option value="">', $txt['pm_rule_sel_label'], '</option>'; |
1888 | 1970 | |
1889 | - foreach ($context['labels'] as $label) |
|
1890 | - if ($label['id'] != -1) |
|
1971 | + foreach ($context['labels'] as $label) { |
|
1972 | + if ($label['id'] != -1) |
|
1891 | 1973 | echo ' |
1892 | 1974 | <option value="', ($label['id']), '"', $action['t'] == 'lab' && $action['v'] == $label['id'] ? ' selected' : '', '>', $label['name'], '</option>'; |
1975 | + } |
|
1893 | 1976 | |
1894 | 1977 | echo ' |
1895 | 1978 | </select> |
1896 | 1979 | </span>'; |
1897 | 1980 | |
1898 | - if ($isFirst) |
|
1899 | - $isFirst = false; |
|
1900 | - |
|
1901 | - elseif ($action['t'] == '') |
|
1902 | - echo '</div><!-- .removeonjs2 -->'; |
|
1981 | + if ($isFirst) { |
|
1982 | + $isFirst = false; |
|
1983 | + } elseif ($action['t'] == '') { |
|
1984 | + echo '</div><!-- .removeonjs2 -->'; |
|
1985 | + } |
|
1903 | 1986 | } |
1904 | 1987 | |
1905 | 1988 | echo ' |
@@ -1923,22 +2006,25 @@ discard block |
||
1923 | 2006 | echo ' |
1924 | 2007 | <script>'; |
1925 | 2008 | |
1926 | - foreach ($context['rule']['criteria'] as $k => $c) |
|
1927 | - echo ' |
|
2009 | + foreach ($context['rule']['criteria'] as $k => $c) { |
|
2010 | + echo ' |
|
1928 | 2011 | updateRuleDef(', $k, ');'; |
2012 | + } |
|
1929 | 2013 | |
1930 | - foreach ($context['rule']['actions'] as $k => $c) |
|
1931 | - echo ' |
|
2014 | + foreach ($context['rule']['actions'] as $k => $c) { |
|
2015 | + echo ' |
|
1932 | 2016 | updateActionDef(', $k, ');'; |
2017 | + } |
|
1933 | 2018 | |
1934 | 2019 | echo ' |
1935 | 2020 | rebuildRuleDesc();'; |
1936 | 2021 | |
1937 | 2022 | // If this isn't a new rule and we have JS enabled remove the JS compatibility stuff. |
1938 | - if ($context['rid']) |
|
1939 | - echo ' |
|
2023 | + if ($context['rid']) { |
|
2024 | + echo ' |
|
1940 | 2025 | document.getElementById("removeonjs1").style.display = "none"; |
1941 | 2026 | document.getElementById("removeonjs2").style.display = "none";'; |
2027 | + } |
|
1942 | 2028 | |
1943 | 2029 | echo ' |
1944 | 2030 | document.getElementById("addonjs1").style.display = ""; |
@@ -1966,12 +2052,12 @@ discard block |
||
1966 | 2052 | </div>'; |
1967 | 2053 | |
1968 | 2054 | // No drafts? Just show an informative message. |
1969 | - if (empty($context['drafts'])) |
|
1970 | - echo ' |
|
2055 | + if (empty($context['drafts'])) { |
|
2056 | + echo ' |
|
1971 | 2057 | <div class="windowbg centertext"> |
1972 | 2058 | ', $txt['draft_none'], ' |
1973 | 2059 | </div>'; |
1974 | - else |
|
2060 | + } else |
|
1975 | 2061 | { |
1976 | 2062 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
1977 | 2063 | foreach ($context['drafts'] as $draft) |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | * @version 2.1 Beta 4 |
15 | 15 | */ |
16 | 16 | |
17 | -if (!defined('SMF')) |
|
17 | +if (!defined('SMF')) { |
|
18 | 18 | die('No direct access...'); |
19 | +} |
|
19 | 20 | |
20 | 21 | /** |
21 | 22 | * Turn off/on notification for a particular board. |
@@ -34,8 +35,9 @@ discard block |
||
34 | 35 | is_not_guest(); |
35 | 36 | |
36 | 37 | // You have to specify a board to turn notifications on! |
37 | - if (empty($board)) |
|
38 | - fatal_lang_error('no_board', false); |
|
38 | + if (empty($board)) { |
|
39 | + fatal_lang_error('no_board', false); |
|
40 | + } |
|
39 | 41 | |
40 | 42 | // No subaction: find out what to do. |
41 | 43 | if (isset($_GET['mode'])) |
@@ -48,16 +50,16 @@ discard block |
||
48 | 50 | require_once($sourcedir . '/Subs-Notify.php'); |
49 | 51 | setNotifyPrefs($user_info['id'], array('board_notify_' . $board => $alertPref)); |
50 | 52 | |
51 | - if ($mode > 1) |
|
52 | - // Turn notification on. (note this just blows smoke if it's already on.) |
|
53 | + if ($mode > 1) { |
|
54 | + // Turn notification on. (note this just blows smoke if it's already on.) |
|
53 | 55 | $smcFunc['db_insert']('ignore', |
54 | 56 | '{db_prefix}log_notify', |
55 | 57 | array('id_member' => 'int', 'id_board' => 'int'), |
56 | 58 | array($user_info['id'], $board), |
57 | 59 | array('id_member', 'id_board') |
58 | 60 | ); |
59 | - else |
|
60 | - $smcFunc['db_query']('', ' |
|
61 | + } else { |
|
62 | + $smcFunc['db_query']('', ' |
|
61 | 63 | DELETE FROM {db_prefix}log_notify |
62 | 64 | WHERE id_member = {int:current_member} |
63 | 65 | AND id_board = {int:current_board}', |
@@ -66,6 +68,7 @@ discard block |
||
66 | 68 | 'current_member' => $user_info['id'], |
67 | 69 | ) |
68 | 70 | ); |
71 | + } |
|
69 | 72 | } |
70 | 73 | |
71 | 74 | // Back to the board! |
@@ -80,10 +83,10 @@ discard block |
||
80 | 83 | ), |
81 | 84 | ); |
82 | 85 | $context['sub_template'] = 'generic_xml'; |
86 | + } else { |
|
87 | + redirectexit('board=' . $board . '.' . $_REQUEST['start']); |
|
88 | + } |
|
83 | 89 | } |
84 | - else |
|
85 | - redirectexit('board=' . $board . '.' . $_REQUEST['start']); |
|
86 | -} |
|
87 | 90 | |
88 | 91 | /** |
89 | 92 | * Turn off/on unread replies subscription for a topic as well as sets individual topic's alert preferences |
@@ -128,8 +131,7 @@ discard block |
||
128 | 131 | 'id_msg' => 0, |
129 | 132 | 'unwatched' => empty($mode) ? 1 : 0, |
130 | 133 | ); |
131 | - } |
|
132 | - else |
|
134 | + } else |
|
133 | 135 | { |
134 | 136 | $insert = false; |
135 | 137 | $log['unwatched'] = empty($mode) ? 1 : 0; |
@@ -156,9 +158,8 @@ discard block |
||
156 | 158 | array($user_info['id'], $log['id_topic']), |
157 | 159 | array('id_member', 'id_board') |
158 | 160 | ); |
159 | - } |
|
160 | - else |
|
161 | - $smcFunc['db_query']('', ' |
|
161 | + } else { |
|
162 | + $smcFunc['db_query']('', ' |
|
162 | 163 | DELETE FROM {db_prefix}log_notify |
163 | 164 | WHERE id_topic = {int:topic} |
164 | 165 | AND id_member = {int:member}', |
@@ -166,6 +167,7 @@ discard block |
||
166 | 167 | 'topic' => $log['id_topic'], |
167 | 168 | 'member' => $user_info['id'], |
168 | 169 | )); |
170 | + } |
|
169 | 171 | } |
170 | 172 | } |
171 | 173 | |
@@ -181,9 +183,9 @@ discard block |
||
181 | 183 | ), |
182 | 184 | ); |
183 | 185 | $context['sub_template'] = 'generic_xml'; |
186 | + } else { |
|
187 | + redirectexit('topic=' . $topic . '.' . $_REQUEST['start']); |
|
188 | + } |
|
184 | 189 | } |
185 | - else |
|
186 | - redirectexit('topic=' . $topic . '.' . $_REQUEST['start']); |
|
187 | -} |
|
188 | 190 | |
189 | 191 | ?> |
190 | 192 | \ No newline at end of file |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | * @version 2.1 Beta 4 |
15 | 15 | */ |
16 | 16 | |
17 | -if (!defined('SMF')) |
|
17 | +if (!defined('SMF')) { |
|
18 | 18 | die('No direct access...'); |
19 | +} |
|
19 | 20 | |
20 | 21 | /** |
21 | 22 | * !!!Compatibility!!! |
@@ -31,8 +32,9 @@ discard block |
||
31 | 32 | { |
32 | 33 | global $modSettings; |
33 | 34 | |
34 | - if (!$compat_mode) |
|
35 | - return $text; |
|
35 | + if (!$compat_mode) { |
|
36 | + return $text; |
|
37 | + } |
|
36 | 38 | |
37 | 39 | // Turn line breaks back into br's. |
38 | 40 | $text = strtr($text, array("\r" => '', "\n" => '<br>')); |
@@ -49,8 +51,9 @@ discard block |
||
49 | 51 | for ($i = 0, $n = count($parts); $i < $n; $i++) |
50 | 52 | { |
51 | 53 | // Value of 2 means we're inside the tag. |
52 | - if ($i % 4 == 2) |
|
53 | - $parts[$i] = strtr($parts[$i], array('[' => '[', ']' => ']', "'" => "'")); |
|
54 | + if ($i % 4 == 2) { |
|
55 | + $parts[$i] = strtr($parts[$i], array('[' => '[', ']' => ']', "'" => "'")); |
|
56 | + } |
|
54 | 57 | } |
55 | 58 | // Put our humpty dumpty message back together again. |
56 | 59 | $text = implode('', $parts); |
@@ -109,8 +112,9 @@ discard block |
||
109 | 112 | $text = preg_replace('~</p>\s*(?!<)~i', '</p><br>', $text); |
110 | 113 | |
111 | 114 | // Safari/webkit wraps lines in Wysiwyg in <div>'s. |
112 | - if (isBrowser('webkit')) |
|
113 | - $text = preg_replace(array('~<div(?:\s(?:[^<>]*?))?' . '>~i', '</div>'), array('<br>', ''), $text); |
|
115 | + if (isBrowser('webkit')) { |
|
116 | + $text = preg_replace(array('~<div(?:\s(?:[^<>]*?))?' . '>~i', '</div>'), array('<br>', ''), $text); |
|
117 | + } |
|
114 | 118 | |
115 | 119 | // If there's a trailing break get rid of it - Firefox tends to add one. |
116 | 120 | $text = preg_replace('~<br\s?/?' . '>$~i', '', $text); |
@@ -125,8 +129,9 @@ discard block |
||
125 | 129 | for ($i = 0, $n = count($parts); $i < $n; $i++) |
126 | 130 | { |
127 | 131 | // Value of 2 means we're inside the tag. |
128 | - if ($i % 4 == 2) |
|
129 | - $parts[$i] = strip_tags($parts[$i]); |
|
132 | + if ($i % 4 == 2) { |
|
133 | + $parts[$i] = strip_tags($parts[$i]); |
|
134 | + } |
|
130 | 135 | } |
131 | 136 | |
132 | 137 | $text = strtr(implode('', $parts), array('#smf_br_spec_grudge_cool!#' => '<br>')); |
@@ -152,18 +157,19 @@ discard block |
||
152 | 157 | { |
153 | 158 | $found = array_search($file, $smileysto); |
154 | 159 | // Note the weirdness here is to stop double spaces between smileys. |
155 | - if ($found) |
|
156 | - $matches[1][$k] = '-[]-smf_smily_start#|#' . $smcFunc['htmlspecialchars']($smileysfrom[$found]) . '-[]-smf_smily_end#|#'; |
|
157 | - else |
|
158 | - $matches[1][$k] = ''; |
|
160 | + if ($found) { |
|
161 | + $matches[1][$k] = '-[]-smf_smily_start#|#' . $smcFunc['htmlspecialchars']($smileysfrom[$found]) . '-[]-smf_smily_end#|#'; |
|
162 | + } else { |
|
163 | + $matches[1][$k] = ''; |
|
164 | + } |
|
159 | 165 | } |
160 | - } |
|
161 | - else |
|
166 | + } else |
|
162 | 167 | { |
163 | 168 | // Load all the smileys. |
164 | 169 | $names = array(); |
165 | - foreach ($matches[1] as $file) |
|
166 | - $names[] = $file; |
|
170 | + foreach ($matches[1] as $file) { |
|
171 | + $names[] = $file; |
|
172 | + } |
|
167 | 173 | $names = array_unique($names); |
168 | 174 | |
169 | 175 | if (!empty($names)) |
@@ -177,13 +183,15 @@ discard block |
||
177 | 183 | ) |
178 | 184 | ); |
179 | 185 | $mappings = array(); |
180 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
181 | - $mappings[$row['filename']] = $smcFunc['htmlspecialchars']($row['code']); |
|
186 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
187 | + $mappings[$row['filename']] = $smcFunc['htmlspecialchars']($row['code']); |
|
188 | + } |
|
182 | 189 | $smcFunc['db_free_result']($request); |
183 | 190 | |
184 | - foreach ($matches[1] as $k => $file) |
|
185 | - if (isset($mappings[$file])) |
|
191 | + foreach ($matches[1] as $k => $file) { |
|
192 | + if (isset($mappings[$file])) |
|
186 | 193 | $matches[1][$k] = '-[]-smf_smily_start#|#' . $mappings[$file] . '-[]-smf_smily_end#|#'; |
194 | + } |
|
187 | 195 | } |
188 | 196 | } |
189 | 197 | |
@@ -195,8 +203,9 @@ discard block |
||
195 | 203 | } |
196 | 204 | |
197 | 205 | // Only try to buy more time if the client didn't quit. |
198 | - if (connection_aborted() && $context['server']['is_apache']) |
|
199 | - @apache_reset_timeout(); |
|
206 | + if (connection_aborted() && $context['server']['is_apache']) { |
|
207 | + @apache_reset_timeout(); |
|
208 | + } |
|
200 | 209 | |
201 | 210 | $parts = preg_split('~(<[A-Za-z]+\s*[^<>]*?style="?[^<>"]+"?[^<>]*?(?:/?)>|</[A-Za-z]+>)~', $text, -1, PREG_SPLIT_DELIM_CAPTURE); |
202 | 211 | $replacement = ''; |
@@ -207,9 +216,9 @@ discard block |
||
207 | 216 | if (preg_match('~(<([A-Za-z]+)\s*[^<>]*?)style="?([^<>"]+)"?([^<>]*?(/?)>)~', $part, $matches) === 1) |
208 | 217 | { |
209 | 218 | // If it's being closed instantly, we can't deal with it...yet. |
210 | - if ($matches[5] === '/') |
|
211 | - continue; |
|
212 | - else |
|
219 | + if ($matches[5] === '/') { |
|
220 | + continue; |
|
221 | + } else |
|
213 | 222 | { |
214 | 223 | // Get an array of styles that apply to this element. (The strtr is there to combat HTML generated by Word.) |
215 | 224 | $styles = explode(';', strtr($matches[3], array('"' => ''))); |
@@ -225,8 +234,9 @@ discard block |
||
225 | 234 | $clean_type_value_pair = strtolower(strtr(trim($type_value_pair), '=', ':')); |
226 | 235 | |
227 | 236 | // Something like 'font-weight: bold' is expected here. |
228 | - if (strpos($clean_type_value_pair, ':') === false) |
|
229 | - continue; |
|
237 | + if (strpos($clean_type_value_pair, ':') === false) { |
|
238 | + continue; |
|
239 | + } |
|
230 | 240 | |
231 | 241 | // Capture the elements of a single style item (e.g. 'font-weight' and 'bold'). |
232 | 242 | list ($style_type, $style_value) = explode(':', $type_value_pair); |
@@ -248,8 +258,7 @@ discard block |
||
248 | 258 | { |
249 | 259 | $curCloseTags .= '[/u]'; |
250 | 260 | $replacement .= '[u]'; |
251 | - } |
|
252 | - elseif ($style_value == 'line-through') |
|
261 | + } elseif ($style_value == 'line-through') |
|
253 | 262 | { |
254 | 263 | $curCloseTags .= '[/s]'; |
255 | 264 | $replacement .= '[s]'; |
@@ -261,13 +270,11 @@ discard block |
||
261 | 270 | { |
262 | 271 | $curCloseTags .= '[/left]'; |
263 | 272 | $replacement .= '[left]'; |
264 | - } |
|
265 | - elseif ($style_value == 'center') |
|
273 | + } elseif ($style_value == 'center') |
|
266 | 274 | { |
267 | 275 | $curCloseTags .= '[/center]'; |
268 | 276 | $replacement .= '[center]'; |
269 | - } |
|
270 | - elseif ($style_value == 'right') |
|
277 | + } elseif ($style_value == 'right') |
|
271 | 278 | { |
272 | 279 | $curCloseTags .= '[/right]'; |
273 | 280 | $replacement .= '[right]'; |
@@ -289,8 +296,9 @@ discard block |
||
289 | 296 | |
290 | 297 | case 'font-size': |
291 | 298 | // Sometimes people put decimals where decimals should not be. |
292 | - if (preg_match('~(\d)+\.\d+(p[xt])~i', $style_value, $dec_matches) === 1) |
|
293 | - $style_value = $dec_matches[1] . $dec_matches[2]; |
|
299 | + if (preg_match('~(\d)+\.\d+(p[xt])~i', $style_value, $dec_matches) === 1) { |
|
300 | + $style_value = $dec_matches[1] . $dec_matches[2]; |
|
301 | + } |
|
294 | 302 | |
295 | 303 | $curCloseTags .= '[/size]'; |
296 | 304 | $replacement .= '[size=' . $style_value . ']'; |
@@ -298,8 +306,9 @@ discard block |
||
298 | 306 | |
299 | 307 | case 'font-family': |
300 | 308 | // Only get the first freaking font if there's a list! |
301 | - if (strpos($style_value, ',') !== false) |
|
302 | - $style_value = substr($style_value, 0, strpos($style_value, ',')); |
|
309 | + if (strpos($style_value, ',') !== false) { |
|
310 | + $style_value = substr($style_value, 0, strpos($style_value, ',')); |
|
311 | + } |
|
303 | 312 | |
304 | 313 | $curCloseTags .= '[/font]'; |
305 | 314 | $replacement .= '[font=' . strtr($style_value, array("'" => '')) . ']'; |
@@ -308,13 +317,15 @@ discard block |
||
308 | 317 | // This is a hack for images with dimensions embedded. |
309 | 318 | case 'width': |
310 | 319 | case 'height': |
311 | - if (preg_match('~[1-9]\d*~i', $style_value, $dimension) === 1) |
|
312 | - $extra_attr .= ' ' . $style_type . '="' . $dimension[0] . '"'; |
|
320 | + if (preg_match('~[1-9]\d*~i', $style_value, $dimension) === 1) { |
|
321 | + $extra_attr .= ' ' . $style_type . '="' . $dimension[0] . '"'; |
|
322 | + } |
|
313 | 323 | break; |
314 | 324 | |
315 | 325 | case 'list-style-type': |
316 | - if (preg_match('~none|disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-alpha|upper-alpha|lower-greek|lower-latin|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha~i', $style_value, $listType) === 1) |
|
317 | - $extra_attr .= ' listtype="' . $listType[0] . '"'; |
|
326 | + if (preg_match('~none|disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-alpha|upper-alpha|lower-greek|lower-latin|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha~i', $style_value, $listType) === 1) { |
|
327 | + $extra_attr .= ' listtype="' . $listType[0] . '"'; |
|
328 | + } |
|
318 | 329 | break; |
319 | 330 | } |
320 | 331 | } |
@@ -327,18 +338,17 @@ discard block |
||
327 | 338 | } |
328 | 339 | |
329 | 340 | // If there's something that still needs closing, push it to the stack. |
330 | - if (!empty($curCloseTags)) |
|
331 | - array_push($stack, array( |
|
341 | + if (!empty($curCloseTags)) { |
|
342 | + array_push($stack, array( |
|
332 | 343 | 'element' => strtolower($curElement), |
333 | 344 | 'closeTags' => $curCloseTags |
334 | 345 | ) |
335 | 346 | ); |
336 | - elseif (!empty($extra_attr)) |
|
337 | - $replacement .= $precedingStyle . $extra_attr . $afterStyle; |
|
347 | + } elseif (!empty($extra_attr)) { |
|
348 | + $replacement .= $precedingStyle . $extra_attr . $afterStyle; |
|
349 | + } |
|
338 | 350 | } |
339 | - } |
|
340 | - |
|
341 | - elseif (preg_match('~</([A-Za-z]+)>~', $part, $matches) === 1) |
|
351 | + } elseif (preg_match('~</([A-Za-z]+)>~', $part, $matches) === 1) |
|
342 | 352 | { |
343 | 353 | // Is this the element that we've been waiting for to be closed? |
344 | 354 | if (!empty($stack) && strtolower($matches[1]) === $stack[count($stack) - 1]['element']) |
@@ -348,28 +358,32 @@ discard block |
||
348 | 358 | } |
349 | 359 | |
350 | 360 | // Must've been something else. |
351 | - else |
|
352 | - $replacement .= $part; |
|
361 | + else { |
|
362 | + $replacement .= $part; |
|
363 | + } |
|
353 | 364 | } |
354 | 365 | // In all other cases, just add the part to the replacement. |
355 | - else |
|
356 | - $replacement .= $part; |
|
366 | + else { |
|
367 | + $replacement .= $part; |
|
368 | + } |
|
357 | 369 | } |
358 | 370 | |
359 | 371 | // Now put back the replacement in the text. |
360 | 372 | $text = $replacement; |
361 | 373 | |
362 | 374 | // We are not finished yet, request more time. |
363 | - if (connection_aborted() && $context['server']['is_apache']) |
|
364 | - @apache_reset_timeout(); |
|
375 | + if (connection_aborted() && $context['server']['is_apache']) { |
|
376 | + @apache_reset_timeout(); |
|
377 | + } |
|
365 | 378 | |
366 | 379 | // Let's pull out any legacy alignments. |
367 | 380 | while (preg_match('~<([A-Za-z]+)\s+[^<>]*?(align="*(left|center|right)"*)[^<>]*?(/?)>~i', $text, $matches) === 1) |
368 | 381 | { |
369 | 382 | // Find the position in the text of this tag over again. |
370 | 383 | $start_pos = strpos($text, $matches[0]); |
371 | - if ($start_pos === false) |
|
372 | - break; |
|
384 | + if ($start_pos === false) { |
|
385 | + break; |
|
386 | + } |
|
373 | 387 | |
374 | 388 | // End tag? |
375 | 389 | if ($matches[4] != '/' && strpos($text, '</' . $matches[1] . '>', $start_pos) !== false) |
@@ -383,8 +397,7 @@ discard block |
||
383 | 397 | |
384 | 398 | // Put the tags back into the body. |
385 | 399 | $text = substr($text, 0, $start_pos) . $tag . '[' . $matches[3] . ']' . $content . '[/' . $matches[3] . ']' . substr($text, $end_pos); |
386 | - } |
|
387 | - else |
|
400 | + } else |
|
388 | 401 | { |
389 | 402 | // Just get rid of this evil tag. |
390 | 403 | $text = substr($text, 0, $start_pos) . substr($text, $start_pos + strlen($matches[0])); |
@@ -397,8 +410,9 @@ discard block |
||
397 | 410 | // Find the position of this again. |
398 | 411 | $start_pos = strpos($text, $matches[0]); |
399 | 412 | $end_pos = false; |
400 | - if ($start_pos === false) |
|
401 | - break; |
|
413 | + if ($start_pos === false) { |
|
414 | + break; |
|
415 | + } |
|
402 | 416 | |
403 | 417 | // This must have an end tag - and we must find the right one. |
404 | 418 | $lower_text = strtolower($text); |
@@ -431,8 +445,9 @@ discard block |
||
431 | 445 | break; |
432 | 446 | } |
433 | 447 | } |
434 | - if ($end_pos === false) |
|
435 | - break; |
|
448 | + if ($end_pos === false) { |
|
449 | + break; |
|
450 | + } |
|
436 | 451 | |
437 | 452 | // Now work out what the attributes are. |
438 | 453 | $attribs = fetchTagAttributes($matches[1]); |
@@ -446,11 +461,11 @@ discard block |
||
446 | 461 | $v = (int) trim($v); |
447 | 462 | $v = empty($v) ? 1 : $v; |
448 | 463 | $tags[] = array('[size=' . $sizes_equivalence[$v] . ']', '[/size]'); |
464 | + } elseif ($s == 'face') { |
|
465 | + $tags[] = array('[font=' . trim(strtolower($v)) . ']', '[/font]'); |
|
466 | + } elseif ($s == 'color') { |
|
467 | + $tags[] = array('[color=' . trim(strtolower($v)) . ']', '[/color]'); |
|
449 | 468 | } |
450 | - elseif ($s == 'face') |
|
451 | - $tags[] = array('[font=' . trim(strtolower($v)) . ']', '[/font]'); |
|
452 | - elseif ($s == 'color') |
|
453 | - $tags[] = array('[color=' . trim(strtolower($v)) . ']', '[/color]'); |
|
454 | 469 | } |
455 | 470 | |
456 | 471 | // As before add in our tags. |
@@ -458,8 +473,9 @@ discard block |
||
458 | 473 | foreach ($tags as $tag) |
459 | 474 | { |
460 | 475 | $before .= $tag[0]; |
461 | - if (isset($tag[1])) |
|
462 | - $after = $tag[1] . $after; |
|
476 | + if (isset($tag[1])) { |
|
477 | + $after = $tag[1] . $after; |
|
478 | + } |
|
463 | 479 | } |
464 | 480 | |
465 | 481 | // Remove the tag so it's never checked again. |
@@ -470,8 +486,9 @@ discard block |
||
470 | 486 | } |
471 | 487 | |
472 | 488 | // Almost there, just a little more time. |
473 | - if (connection_aborted() && $context['server']['is_apache']) |
|
474 | - @apache_reset_timeout(); |
|
489 | + if (connection_aborted() && $context['server']['is_apache']) { |
|
490 | + @apache_reset_timeout(); |
|
491 | + } |
|
475 | 492 | |
476 | 493 | if (count($parts = preg_split('~<(/?)(li|ol|ul)([^>]*)>~i', $text, null, PREG_SPLIT_DELIM_CAPTURE)) > 1) |
477 | 494 | { |
@@ -527,12 +544,13 @@ discard block |
||
527 | 544 | { |
528 | 545 | $inList = true; |
529 | 546 | |
530 | - if ($tag === 'ol') |
|
531 | - $listType = 'decimal'; |
|
532 | - elseif (preg_match('~type="?(' . implode('|', array_keys($listTypeMapping)) . ')"?~', $parts[$i + 3], $match) === 1) |
|
533 | - $listType = $listTypeMapping[$match[1]]; |
|
534 | - else |
|
535 | - $listType = null; |
|
547 | + if ($tag === 'ol') { |
|
548 | + $listType = 'decimal'; |
|
549 | + } elseif (preg_match('~type="?(' . implode('|', array_keys($listTypeMapping)) . ')"?~', $parts[$i + 3], $match) === 1) { |
|
550 | + $listType = $listTypeMapping[$match[1]]; |
|
551 | + } else { |
|
552 | + $listType = null; |
|
553 | + } |
|
536 | 554 | |
537 | 555 | $listDepth++; |
538 | 556 | |
@@ -596,9 +614,7 @@ discard block |
||
596 | 614 | $parts[$i + 1] = ''; |
597 | 615 | $parts[$i + 2] = str_repeat("\t", $listDepth) . '[/list]'; |
598 | 616 | $parts[$i + 3] = ''; |
599 | - } |
|
600 | - |
|
601 | - else |
|
617 | + } else |
|
602 | 618 | { |
603 | 619 | // We're in a list item. |
604 | 620 | if ($listDepth > 0) |
@@ -635,9 +651,7 @@ discard block |
||
635 | 651 | $parts[$i + 1] = ''; |
636 | 652 | $parts[$i + 2] = ''; |
637 | 653 | $parts[$i + 3] = ''; |
638 | - } |
|
639 | - |
|
640 | - else |
|
654 | + } else |
|
641 | 655 | { |
642 | 656 | // Remove the trailing breaks from the list item. |
643 | 657 | $parts[$i] = preg_replace('~\s*<br\s*' . '/?' . '>\s*$~', '', $parts[$i]); |
@@ -675,8 +689,9 @@ discard block |
||
675 | 689 | $text .= str_repeat("\t", $listDepth) . '[/list]'; |
676 | 690 | } |
677 | 691 | |
678 | - for ($i = $listDepth; $i > 0; $i--) |
|
679 | - $text .= '[/li]' . "\n" . str_repeat("\t", $i - 1) . '[/list]'; |
|
692 | + for ($i = $listDepth; $i > 0; $i--) { |
|
693 | + $text .= '[/li]' . "\n" . str_repeat("\t", $i - 1) . '[/list]'; |
|
694 | + } |
|
680 | 695 | } |
681 | 696 | |
682 | 697 | // I love my own image... |
@@ -684,8 +699,9 @@ discard block |
||
684 | 699 | { |
685 | 700 | // Find the position of the image. |
686 | 701 | $start_pos = strpos($text, $matches[0]); |
687 | - if ($start_pos === false) |
|
688 | - break; |
|
702 | + if ($start_pos === false) { |
|
703 | + break; |
|
704 | + } |
|
689 | 705 | $end_pos = $start_pos + strlen($matches[0]); |
690 | 706 | |
691 | 707 | $params = ''; |
@@ -694,12 +710,13 @@ discard block |
||
694 | 710 | $attrs = fetchTagAttributes($matches[1]); |
695 | 711 | foreach ($attrs as $attrib => $value) |
696 | 712 | { |
697 | - if (in_array($attrib, array('width', 'height'))) |
|
698 | - $params .= ' ' . $attrib . '=' . (int) $value; |
|
699 | - elseif ($attrib == 'alt' && trim($value) != '') |
|
700 | - $params .= ' alt=' . trim($value); |
|
701 | - elseif ($attrib == 'src') |
|
702 | - $src = trim($value); |
|
713 | + if (in_array($attrib, array('width', 'height'))) { |
|
714 | + $params .= ' ' . $attrib . '=' . (int) $value; |
|
715 | + } elseif ($attrib == 'alt' && trim($value) != '') { |
|
716 | + $params .= ' alt=' . trim($value); |
|
717 | + } elseif ($attrib == 'src') { |
|
718 | + $src = trim($value); |
|
719 | + } |
|
703 | 720 | } |
704 | 721 | |
705 | 722 | $tag = ''; |
@@ -710,10 +727,11 @@ discard block |
||
710 | 727 | { |
711 | 728 | $baseURL = (isset($parsedURL['scheme']) ? $parsedURL['scheme'] : 'http') . '://' . $parsedURL['host'] . (empty($parsedURL['port']) ? '' : ':' . $parsedURL['port']); |
712 | 729 | |
713 | - if (substr($src, 0, 1) === '/') |
|
714 | - $src = $baseURL . $src; |
|
715 | - else |
|
716 | - $src = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $src; |
|
730 | + if (substr($src, 0, 1) === '/') { |
|
731 | + $src = $baseURL . $src; |
|
732 | + } else { |
|
733 | + $src = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $src; |
|
734 | + } |
|
717 | 735 | } |
718 | 736 | |
719 | 737 | $tag = '[img' . $params . ']' . $src . '[/img]'; |
@@ -891,20 +909,23 @@ discard block |
||
891 | 909 | }, |
892 | 910 | ); |
893 | 911 | |
894 | - foreach ($tags as $tag => $replace) |
|
895 | - $text = preg_replace_callback($tag, $replace, $text); |
|
912 | + foreach ($tags as $tag => $replace) { |
|
913 | + $text = preg_replace_callback($tag, $replace, $text); |
|
914 | + } |
|
896 | 915 | |
897 | 916 | // Please give us just a little more time. |
898 | - if (connection_aborted() && $context['server']['is_apache']) |
|
899 | - @apache_reset_timeout(); |
|
917 | + if (connection_aborted() && $context['server']['is_apache']) { |
|
918 | + @apache_reset_timeout(); |
|
919 | + } |
|
900 | 920 | |
901 | 921 | // What about URL's - the pain in the ass of the tag world. |
902 | 922 | while (preg_match('~<a\s+([^<>]*)>([^<>]*)</a>~i', $text, $matches) === 1) |
903 | 923 | { |
904 | 924 | // Find the position of the URL. |
905 | 925 | $start_pos = strpos($text, $matches[0]); |
906 | - if ($start_pos === false) |
|
907 | - break; |
|
926 | + if ($start_pos === false) { |
|
927 | + break; |
|
928 | + } |
|
908 | 929 | $end_pos = $start_pos + strlen($matches[0]); |
909 | 930 | |
910 | 931 | $tag_type = 'url'; |
@@ -918,8 +939,9 @@ discard block |
||
918 | 939 | $href = trim($value); |
919 | 940 | |
920 | 941 | // Are we dealing with an FTP link? |
921 | - if (preg_match('~^ftps?://~', $href) === 1) |
|
922 | - $tag_type = 'ftp'; |
|
942 | + if (preg_match('~^ftps?://~', $href) === 1) { |
|
943 | + $tag_type = 'ftp'; |
|
944 | + } |
|
923 | 945 | |
924 | 946 | // Or is this a link to an email address? |
925 | 947 | elseif (substr($href, 0, 7) == 'mailto:') |
@@ -933,28 +955,31 @@ discard block |
||
933 | 955 | { |
934 | 956 | $baseURL = (isset($parsedURL['scheme']) ? $parsedURL['scheme'] : 'http') . '://' . $parsedURL['host'] . (empty($parsedURL['port']) ? '' : ':' . $parsedURL['port']); |
935 | 957 | |
936 | - if (substr($href, 0, 1) === '/') |
|
937 | - $href = $baseURL . $href; |
|
938 | - else |
|
939 | - $href = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $href; |
|
958 | + if (substr($href, 0, 1) === '/') { |
|
959 | + $href = $baseURL . $href; |
|
960 | + } else { |
|
961 | + $href = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $href; |
|
962 | + } |
|
940 | 963 | } |
941 | 964 | } |
942 | 965 | |
943 | 966 | // External URL? |
944 | 967 | if ($attrib == 'target' && $tag_type == 'url') |
945 | 968 | { |
946 | - if (trim($value) == '_blank') |
|
947 | - $tag_type == 'iurl'; |
|
969 | + if (trim($value) == '_blank') { |
|
970 | + $tag_type == 'iurl'; |
|
971 | + } |
|
948 | 972 | } |
949 | 973 | } |
950 | 974 | |
951 | 975 | $tag = ''; |
952 | 976 | if ($href != '') |
953 | 977 | { |
954 | - if ($matches[2] == $href) |
|
955 | - $tag = '[' . $tag_type . ']' . $href . '[/' . $tag_type . ']'; |
|
956 | - else |
|
957 | - $tag = '[' . $tag_type . '=' . $href . ']' . $matches[2] . '[/' . $tag_type . ']'; |
|
978 | + if ($matches[2] == $href) { |
|
979 | + $tag = '[' . $tag_type . ']' . $href . '[/' . $tag_type . ']'; |
|
980 | + } else { |
|
981 | + $tag = '[' . $tag_type . '=' . $href . ']' . $matches[2] . '[/' . $tag_type . ']'; |
|
982 | + } |
|
958 | 983 | } |
959 | 984 | |
960 | 985 | // Replace the tag |
@@ -994,17 +1019,18 @@ discard block |
||
994 | 1019 | // We're either moving from the key to the attribute or we're in a string and this is fine. |
995 | 1020 | if ($text[$i] == '=') |
996 | 1021 | { |
997 | - if ($tag_state == 0) |
|
998 | - $tag_state = 1; |
|
999 | - elseif ($tag_state == 2) |
|
1000 | - $value .= '='; |
|
1022 | + if ($tag_state == 0) { |
|
1023 | + $tag_state = 1; |
|
1024 | + } elseif ($tag_state == 2) { |
|
1025 | + $value .= '='; |
|
1026 | + } |
|
1001 | 1027 | } |
1002 | 1028 | // A space is either moving from an attribute back to a potential key or in a string is fine. |
1003 | 1029 | elseif ($text[$i] == ' ') |
1004 | 1030 | { |
1005 | - if ($tag_state == 2) |
|
1006 | - $value .= ' '; |
|
1007 | - elseif ($tag_state == 1) |
|
1031 | + if ($tag_state == 2) { |
|
1032 | + $value .= ' '; |
|
1033 | + } elseif ($tag_state == 1) |
|
1008 | 1034 | { |
1009 | 1035 | $attribs[$key] = $value; |
1010 | 1036 | $key = $value = ''; |
@@ -1015,24 +1041,27 @@ discard block |
||
1015 | 1041 | elseif ($text[$i] == '"') |
1016 | 1042 | { |
1017 | 1043 | // Must be either going into or out of a string. |
1018 | - if ($tag_state == 1) |
|
1019 | - $tag_state = 2; |
|
1020 | - else |
|
1021 | - $tag_state = 1; |
|
1044 | + if ($tag_state == 1) { |
|
1045 | + $tag_state = 2; |
|
1046 | + } else { |
|
1047 | + $tag_state = 1; |
|
1048 | + } |
|
1022 | 1049 | } |
1023 | 1050 | // Otherwise it's fine. |
1024 | 1051 | else |
1025 | 1052 | { |
1026 | - if ($tag_state == 0) |
|
1027 | - $key .= $text[$i]; |
|
1028 | - else |
|
1029 | - $value .= $text[$i]; |
|
1053 | + if ($tag_state == 0) { |
|
1054 | + $key .= $text[$i]; |
|
1055 | + } else { |
|
1056 | + $value .= $text[$i]; |
|
1057 | + } |
|
1030 | 1058 | } |
1031 | 1059 | } |
1032 | 1060 | |
1033 | 1061 | // Anything left? |
1034 | - if ($key != '' && $value != '') |
|
1035 | - $attribs[$key] = $value; |
|
1062 | + if ($key != '' && $value != '') { |
|
1063 | + $attribs[$key] = $value; |
|
1064 | + } |
|
1036 | 1065 | |
1037 | 1066 | return $attribs; |
1038 | 1067 | } |
@@ -1050,8 +1079,9 @@ discard block |
||
1050 | 1079 | global $modSettings; |
1051 | 1080 | |
1052 | 1081 | // Don't care about the texts that are too short. |
1053 | - if (strlen($text) < 3) |
|
1054 | - return $text; |
|
1082 | + if (strlen($text) < 3) { |
|
1083 | + return $text; |
|
1084 | + } |
|
1055 | 1085 | |
1056 | 1086 | // A list of tags that's disabled by the admin. |
1057 | 1087 | $disabled = empty($modSettings['disabledBBC']) ? array() : array_flip(explode(',', strtolower($modSettings['disabledBBC']))); |
@@ -1062,10 +1092,12 @@ discard block |
||
1062 | 1092 | $self_closing_tags = array(); |
1063 | 1093 | foreach ($all_tags as $tag) |
1064 | 1094 | { |
1065 | - if (!isset($disabled[$tag['tag']])) |
|
1066 | - $valid_tags[$tag['tag']] = !empty($tag['block_level']); |
|
1067 | - if (isset($tag['type']) && $tag['type'] == 'closed') |
|
1068 | - $self_closing_tags[] = $tag['tag']; |
|
1095 | + if (!isset($disabled[$tag['tag']])) { |
|
1096 | + $valid_tags[$tag['tag']] = !empty($tag['block_level']); |
|
1097 | + } |
|
1098 | + if (isset($tag['type']) && $tag['type'] == 'closed') { |
|
1099 | + $self_closing_tags[] = $tag['tag']; |
|
1100 | + } |
|
1069 | 1101 | } |
1070 | 1102 | |
1071 | 1103 | // Right - we're going to start by going through the whole lot to make sure we don't have align stuff crossed as this happens load and is stupid! |
@@ -1092,16 +1124,19 @@ discard block |
||
1092 | 1124 | $tagName = substr($match, $isClosingTag ? 2 : 1, -1); |
1093 | 1125 | |
1094 | 1126 | // We're closing the exact same tag that we opened. |
1095 | - if ($isClosingTag && $insideTag === $tagName) |
|
1096 | - $insideTag = null; |
|
1127 | + if ($isClosingTag && $insideTag === $tagName) { |
|
1128 | + $insideTag = null; |
|
1129 | + } |
|
1097 | 1130 | |
1098 | 1131 | // We're opening a tag and we're not yet inside one either |
1099 | - elseif (!$isClosingTag && $insideTag === null) |
|
1100 | - $insideTag = $tagName; |
|
1132 | + elseif (!$isClosingTag && $insideTag === null) { |
|
1133 | + $insideTag = $tagName; |
|
1134 | + } |
|
1101 | 1135 | |
1102 | 1136 | // In all other cases, this tag must be invalid |
1103 | - else |
|
1104 | - unset($matches[$i]); |
|
1137 | + else { |
|
1138 | + unset($matches[$i]); |
|
1139 | + } |
|
1105 | 1140 | } |
1106 | 1141 | |
1107 | 1142 | // The next one is gonna be the other one. |
@@ -1109,8 +1144,9 @@ discard block |
||
1109 | 1144 | } |
1110 | 1145 | |
1111 | 1146 | // We're still inside a tag and had no chance for closure? |
1112 | - if ($insideTag !== null) |
|
1113 | - $matches[] = '[/' . $insideTag . ']'; |
|
1147 | + if ($insideTag !== null) { |
|
1148 | + $matches[] = '[/' . $insideTag . ']'; |
|
1149 | + } |
|
1114 | 1150 | |
1115 | 1151 | // And a complete text string again. |
1116 | 1152 | $text = implode('', $matches); |
@@ -1119,8 +1155,9 @@ discard block |
||
1119 | 1155 | // Quickly remove any tags which are back to back. |
1120 | 1156 | $backToBackPattern = '~\\[(' . implode('|', array_diff(array_keys($valid_tags), array('td', 'anchor'))) . ')[^<>\\[\\]]*\\]\s*\\[/\\1\\]~'; |
1121 | 1157 | $lastlen = 0; |
1122 | - while (strlen($text) !== $lastlen) |
|
1123 | - $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
|
1158 | + while (strlen($text) !== $lastlen) { |
|
1159 | + $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
|
1160 | + } |
|
1124 | 1161 | |
1125 | 1162 | // Need to sort the tags my name length. |
1126 | 1163 | uksort($valid_tags, 'sort_array_length'); |
@@ -1157,8 +1194,9 @@ discard block |
||
1157 | 1194 | $isCompetingTag = in_array($tag, $competing_tags); |
1158 | 1195 | |
1159 | 1196 | // Check if this might be one of those cleaned out tags. |
1160 | - if ($tag === '') |
|
1161 | - continue; |
|
1197 | + if ($tag === '') { |
|
1198 | + continue; |
|
1199 | + } |
|
1162 | 1200 | |
1163 | 1201 | // Special case: inside [code] blocks any code is left untouched. |
1164 | 1202 | elseif ($tag === 'code') |
@@ -1169,8 +1207,9 @@ discard block |
||
1169 | 1207 | $inCode = false; |
1170 | 1208 | |
1171 | 1209 | // Reopen tags that were closed before the code block. |
1172 | - if (!empty($inlineElements)) |
|
1173 | - $parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']'; |
|
1210 | + if (!empty($inlineElements)) { |
|
1211 | + $parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']'; |
|
1212 | + } |
|
1174 | 1213 | } |
1175 | 1214 | |
1176 | 1215 | // We're outside a coding and nobbc block and opening it. |
@@ -1199,8 +1238,9 @@ discard block |
||
1199 | 1238 | $inNoBbc = false; |
1200 | 1239 | |
1201 | 1240 | // Some inline elements might've been closed that need reopening. |
1202 | - if (!empty($inlineElements)) |
|
1203 | - $parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']'; |
|
1241 | + if (!empty($inlineElements)) { |
|
1242 | + $parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']'; |
|
1243 | + } |
|
1204 | 1244 | } |
1205 | 1245 | |
1206 | 1246 | // We're outside a nobbc and coding block and opening it. |
@@ -1220,8 +1260,9 @@ discard block |
||
1220 | 1260 | } |
1221 | 1261 | |
1222 | 1262 | // So, we're inside one of the special blocks: ignore any tag. |
1223 | - elseif ($inCode || $inNoBbc) |
|
1224 | - continue; |
|
1263 | + elseif ($inCode || $inNoBbc) { |
|
1264 | + continue; |
|
1265 | + } |
|
1225 | 1266 | |
1226 | 1267 | // We're dealing with an opening tag. |
1227 | 1268 | if ($isOpeningTag) |
@@ -1262,8 +1303,9 @@ discard block |
||
1262 | 1303 | if ($parts[$j + 3] === $tag) |
1263 | 1304 | { |
1264 | 1305 | // If it's an opening tag, increase the level. |
1265 | - if ($parts[$j + 2] === '') |
|
1266 | - $curLevel++; |
|
1306 | + if ($parts[$j + 2] === '') { |
|
1307 | + $curLevel++; |
|
1308 | + } |
|
1267 | 1309 | |
1268 | 1310 | // A closing tag, decrease the level. |
1269 | 1311 | else |
@@ -1286,13 +1328,15 @@ discard block |
||
1286 | 1328 | { |
1287 | 1329 | if ($isCompetingTag) |
1288 | 1330 | { |
1289 | - if (!isset($competingElements[$tag])) |
|
1290 | - $competingElements[$tag] = array(); |
|
1331 | + if (!isset($competingElements[$tag])) { |
|
1332 | + $competingElements[$tag] = array(); |
|
1333 | + } |
|
1291 | 1334 | |
1292 | 1335 | $competingElements[$tag][] = $parts[$i + 4]; |
1293 | 1336 | |
1294 | - if (count($competingElements[$tag]) > 1) |
|
1295 | - $parts[$i] .= '[/' . $tag . ']'; |
|
1337 | + if (count($competingElements[$tag]) > 1) { |
|
1338 | + $parts[$i] .= '[/' . $tag . ']'; |
|
1339 | + } |
|
1296 | 1340 | } |
1297 | 1341 | |
1298 | 1342 | $inlineElements[$elementContent] = $tag; |
@@ -1312,15 +1356,17 @@ discard block |
||
1312 | 1356 | $addClosingTags = array(); |
1313 | 1357 | while ($element = array_pop($blockElements)) |
1314 | 1358 | { |
1315 | - if ($element === $tag) |
|
1316 | - break; |
|
1359 | + if ($element === $tag) { |
|
1360 | + break; |
|
1361 | + } |
|
1317 | 1362 | |
1318 | 1363 | // Still a block tag was open not equal to this tag. |
1319 | 1364 | $addClosingTags[] = $element['type']; |
1320 | 1365 | } |
1321 | 1366 | |
1322 | - if (!empty($addClosingTags)) |
|
1323 | - $parts[$i + 1] = '[/' . implode('][/', array_reverse($addClosingTags)) . ']' . $parts[$i + 1]; |
|
1367 | + if (!empty($addClosingTags)) { |
|
1368 | + $parts[$i + 1] = '[/' . implode('][/', array_reverse($addClosingTags)) . ']' . $parts[$i + 1]; |
|
1369 | + } |
|
1324 | 1370 | |
1325 | 1371 | // Apparently the closing tag was not found on the stack. |
1326 | 1372 | if (!is_string($element) || $element !== $tag) |
@@ -1330,8 +1376,7 @@ discard block |
||
1330 | 1376 | $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = ''; |
1331 | 1377 | continue; |
1332 | 1378 | } |
1333 | - } |
|
1334 | - else |
|
1379 | + } else |
|
1335 | 1380 | { |
1336 | 1381 | // Get rid of this closing tag! |
1337 | 1382 | $parts[$i + 1] = $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = ''; |
@@ -1360,53 +1405,62 @@ discard block |
||
1360 | 1405 | unset($inlineElements[$tagContentToBeClosed]); |
1361 | 1406 | |
1362 | 1407 | // Was this the tag we were looking for? |
1363 | - if ($tagToBeClosed === $tag) |
|
1364 | - break; |
|
1408 | + if ($tagToBeClosed === $tag) { |
|
1409 | + break; |
|
1410 | + } |
|
1365 | 1411 | |
1366 | 1412 | // Nope, close it and look further! |
1367 | - else |
|
1368 | - $parts[$i] .= '[/' . $tagToBeClosed . ']'; |
|
1413 | + else { |
|
1414 | + $parts[$i] .= '[/' . $tagToBeClosed . ']'; |
|
1415 | + } |
|
1369 | 1416 | } |
1370 | 1417 | |
1371 | 1418 | if ($isCompetingTag && !empty($competingElements[$tag])) |
1372 | 1419 | { |
1373 | 1420 | array_pop($competingElements[$tag]); |
1374 | 1421 | |
1375 | - if (count($competingElements[$tag]) > 0) |
|
1376 | - $parts[$i + 5] = '[' . $tag . $competingElements[$tag][count($competingElements[$tag]) - 1] . $parts[$i + 5]; |
|
1422 | + if (count($competingElements[$tag]) > 0) { |
|
1423 | + $parts[$i + 5] = '[' . $tag . $competingElements[$tag][count($competingElements[$tag]) - 1] . $parts[$i + 5]; |
|
1424 | + } |
|
1377 | 1425 | } |
1378 | 1426 | } |
1379 | 1427 | |
1380 | 1428 | // Unexpected closing tag, ex-ter-mi-nate. |
1381 | - else |
|
1382 | - $parts[$i + 1] = $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = ''; |
|
1429 | + else { |
|
1430 | + $parts[$i + 1] = $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = ''; |
|
1431 | + } |
|
1383 | 1432 | } |
1384 | 1433 | } |
1385 | 1434 | } |
1386 | 1435 | |
1387 | 1436 | // Close the code tags. |
1388 | - if ($inCode) |
|
1389 | - $parts[$i] .= '[/code]'; |
|
1437 | + if ($inCode) { |
|
1438 | + $parts[$i] .= '[/code]'; |
|
1439 | + } |
|
1390 | 1440 | |
1391 | 1441 | // The same for nobbc tags. |
1392 | - elseif ($inNoBbc) |
|
1393 | - $parts[$i] .= '[/nobbc]'; |
|
1442 | + elseif ($inNoBbc) { |
|
1443 | + $parts[$i] .= '[/nobbc]'; |
|
1444 | + } |
|
1394 | 1445 | |
1395 | 1446 | // Still inline tags left unclosed? Close them now, better late than never. |
1396 | - elseif (!empty($inlineElements)) |
|
1397 | - $parts[$i] .= '[/' . implode('][/', array_reverse($inlineElements)) . ']'; |
|
1447 | + elseif (!empty($inlineElements)) { |
|
1448 | + $parts[$i] .= '[/' . implode('][/', array_reverse($inlineElements)) . ']'; |
|
1449 | + } |
|
1398 | 1450 | |
1399 | 1451 | // Now close the block elements. |
1400 | - if (!empty($blockElements)) |
|
1401 | - $parts[$i] .= '[/' . implode('][/', array_reverse($blockElements)) . ']'; |
|
1452 | + if (!empty($blockElements)) { |
|
1453 | + $parts[$i] .= '[/' . implode('][/', array_reverse($blockElements)) . ']'; |
|
1454 | + } |
|
1402 | 1455 | |
1403 | 1456 | $text = implode('', $parts); |
1404 | 1457 | } |
1405 | 1458 | |
1406 | 1459 | // Final clean up of back to back tags. |
1407 | 1460 | $lastlen = 0; |
1408 | - while (strlen($text) !== $lastlen) |
|
1409 | - $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
|
1461 | + while (strlen($text) !== $lastlen) { |
|
1462 | + $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
|
1463 | + } |
|
1410 | 1464 | |
1411 | 1465 | return $text; |
1412 | 1466 | } |
@@ -1437,22 +1491,25 @@ discard block |
||
1437 | 1491 | $context['template_layers'] = array(); |
1438 | 1492 | // Lets make sure we aren't going to output anything nasty. |
1439 | 1493 | @ob_end_clean(); |
1440 | - if (!empty($modSettings['enableCompressedOutput'])) |
|
1441 | - @ob_start('ob_gzhandler'); |
|
1442 | - else |
|
1443 | - @ob_start(); |
|
1494 | + if (!empty($modSettings['enableCompressedOutput'])) { |
|
1495 | + @ob_start('ob_gzhandler'); |
|
1496 | + } else { |
|
1497 | + @ob_start(); |
|
1498 | + } |
|
1444 | 1499 | |
1445 | 1500 | // If we don't have any locale better avoid broken js |
1446 | - if (empty($txt['lang_locale'])) |
|
1447 | - die(); |
|
1501 | + if (empty($txt['lang_locale'])) { |
|
1502 | + die(); |
|
1503 | + } |
|
1448 | 1504 | |
1449 | 1505 | $file_data = '(function ($) { |
1450 | 1506 | \'use strict\'; |
1451 | 1507 | |
1452 | 1508 | $.sceditor.locale[' . JavaScriptEscape($txt['lang_locale']) . '] = {'; |
1453 | - foreach ($editortxt as $key => $val) |
|
1454 | - $file_data .= ' |
|
1509 | + foreach ($editortxt as $key => $val) { |
|
1510 | + $file_data .= ' |
|
1455 | 1511 | ' . JavaScriptEscape($key) . ': ' . JavaScriptEscape($val) . ','; |
1512 | + } |
|
1456 | 1513 | |
1457 | 1514 | $file_data .= ' |
1458 | 1515 | dateFormat: "day.month.year" |
@@ -1520,8 +1577,9 @@ discard block |
||
1520 | 1577 | ) |
1521 | 1578 | ); |
1522 | 1579 | $icon_data = array(); |
1523 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1524 | - $icon_data[] = $row; |
|
1580 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1581 | + $icon_data[] = $row; |
|
1582 | + } |
|
1525 | 1583 | $smcFunc['db_free_result']($request); |
1526 | 1584 | |
1527 | 1585 | $icons = array(); |
@@ -1536,9 +1594,9 @@ discard block |
||
1536 | 1594 | } |
1537 | 1595 | |
1538 | 1596 | cache_put_data('posting_icons-' . $board_id, $icons, 480); |
1597 | + } else { |
|
1598 | + $icons = $temp; |
|
1539 | 1599 | } |
1540 | - else |
|
1541 | - $icons = $temp; |
|
1542 | 1600 | } |
1543 | 1601 | call_integration_hook('integrate_load_message_icons', array(&$icons)); |
1544 | 1602 | |
@@ -1581,8 +1639,9 @@ discard block |
||
1581 | 1639 | { |
1582 | 1640 | // Some general stuff. |
1583 | 1641 | $settings['smileys_url'] = $modSettings['smileys_url'] . '/' . $user_info['smiley_set']; |
1584 | - if (!empty($context['drafts_autosave'])) |
|
1585 | - $context['drafts_autosave_frequency'] = empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000; |
|
1642 | + if (!empty($context['drafts_autosave'])) { |
|
1643 | + $context['drafts_autosave_frequency'] = empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000; |
|
1644 | + } |
|
1586 | 1645 | |
1587 | 1646 | // This really has some WYSIWYG stuff. |
1588 | 1647 | loadCSSFile('jquery.sceditor.css', array('force_current' => false, 'validate' => true), 'smf_jquery_sceditor'); |
@@ -1599,8 +1658,9 @@ discard block |
||
1599 | 1658 | var bbc_quote = \'' . addcslashes($txt['quote'], "'") . '\'; |
1600 | 1659 | var bbc_search_on = \'' . addcslashes($txt['search_on'], "'") . '\';'); |
1601 | 1660 | // editor language file |
1602 | - if (!empty($txt['lang_locale']) && $txt['lang_locale'] != 'en_US') |
|
1603 | - loadJavaScriptFile($scripturl . '?action=loadeditorlocale', array('external' => true), 'sceditor_language'); |
|
1661 | + if (!empty($txt['lang_locale']) && $txt['lang_locale'] != 'en_US') { |
|
1662 | + loadJavaScriptFile($scripturl . '?action=loadeditorlocale', array('external' => true), 'sceditor_language'); |
|
1663 | + } |
|
1604 | 1664 | |
1605 | 1665 | $context['shortcuts_text'] = $txt['shortcuts' . (!empty($context['drafts_save']) ? '_drafts' : '') . (stripos($_SERVER['HTTP_USER_AGENT'], 'Macintosh') !== false ? '_mac' : (isBrowser('is_firefox') ? '_firefox' : ''))]; |
1606 | 1666 | $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && (function_exists('pspell_new') || (function_exists('enchant_broker_init') && ($txt['lang_character_set'] == 'UTF-8' || function_exists('iconv')))); |
@@ -1609,11 +1669,12 @@ discard block |
||
1609 | 1669 | loadJavaScriptFile('spellcheck.js', array('minimize' => true), 'smf_spellcheck'); |
1610 | 1670 | |
1611 | 1671 | // Some hidden information is needed in order to make the spell checking work. |
1612 | - if (!isset($_REQUEST['xml'])) |
|
1613 | - $context['insert_after_template'] .= ' |
|
1672 | + if (!isset($_REQUEST['xml'])) { |
|
1673 | + $context['insert_after_template'] .= ' |
|
1614 | 1674 | <form name="spell_form" id="spell_form" method="post" accept-charset="' . $context['character_set'] . '" target="spellWindow" action="' . $scripturl . '?action=spellcheck"> |
1615 | 1675 | <input type="hidden" name="spellstring" value=""> |
1616 | 1676 | </form>'; |
1677 | + } |
|
1617 | 1678 | } |
1618 | 1679 | } |
1619 | 1680 | |
@@ -1805,8 +1866,9 @@ discard block |
||
1805 | 1866 | |
1806 | 1867 | // Generate a list of buttons that shouldn't be shown - this should be the fastest way to do this. |
1807 | 1868 | $disabled_tags = array(); |
1808 | - if (!empty($modSettings['disabledBBC'])) |
|
1809 | - $disabled_tags = explode(',', $modSettings['disabledBBC']); |
|
1869 | + if (!empty($modSettings['disabledBBC'])) { |
|
1870 | + $disabled_tags = explode(',', $modSettings['disabledBBC']); |
|
1871 | + } |
|
1810 | 1872 | |
1811 | 1873 | foreach ($disabled_tags as $tag) |
1812 | 1874 | { |
@@ -1818,9 +1880,10 @@ discard block |
||
1818 | 1880 | $context['disabled_tags']['orderedlist'] = true; |
1819 | 1881 | } |
1820 | 1882 | |
1821 | - foreach ($editor_tag_map as $thisTag => $tagNameBBC) |
|
1822 | - if ($tag === $thisTag) |
|
1883 | + foreach ($editor_tag_map as $thisTag => $tagNameBBC) { |
|
1884 | + if ($tag === $thisTag) |
|
1823 | 1885 | $context['disabled_tags'][$tagNameBBC] = true; |
1886 | + } |
|
1824 | 1887 | |
1825 | 1888 | $context['disabled_tags'][$tag] = true; |
1826 | 1889 | } |
@@ -1831,8 +1894,9 @@ discard block |
||
1831 | 1894 | |
1832 | 1895 | foreach ($context['bbc_tags'] as $row => $tagRow) |
1833 | 1896 | { |
1834 | - if (!isset($context['bbc_toolbar'][$row])) |
|
1835 | - $context['bbc_toolbar'][$row] = array(); |
|
1897 | + if (!isset($context['bbc_toolbar'][$row])) { |
|
1898 | + $context['bbc_toolbar'][$row] = array(); |
|
1899 | + } |
|
1836 | 1900 | |
1837 | 1901 | $tagsRow = array(); |
1838 | 1902 | |
@@ -1868,20 +1932,21 @@ discard block |
||
1868 | 1932 | |
1869 | 1933 | $context['bbcodes_handlers'] .= ' |
1870 | 1934 | });'; |
1871 | - } |
|
1872 | - else |
|
1935 | + } else |
|
1873 | 1936 | { |
1874 | 1937 | $context['bbc_toolbar'][$row][] = implode(',', $tagsRow); |
1875 | 1938 | $tagsRow = array(); |
1876 | 1939 | } |
1877 | 1940 | } |
1878 | 1941 | |
1879 | - if (!empty($tagsRow)) |
|
1880 | - $context['bbc_toolbar'][$row][] = implode(',', $tagsRow); |
|
1942 | + if (!empty($tagsRow)) { |
|
1943 | + $context['bbc_toolbar'][$row][] = implode(',', $tagsRow); |
|
1944 | + } |
|
1881 | 1945 | } |
1882 | 1946 | |
1883 | - if (!empty($bbcodes_styles)) |
|
1884 | - addInlineCss($bbcodes_styles); |
|
1947 | + if (!empty($bbcodes_styles)) { |
|
1948 | + addInlineCss($bbcodes_styles); |
|
1949 | + } |
|
1885 | 1950 | } |
1886 | 1951 | |
1887 | 1952 | // Initialize smiley array... if not loaded before. |
@@ -1893,8 +1958,8 @@ discard block |
||
1893 | 1958 | ); |
1894 | 1959 | |
1895 | 1960 | // Load smileys - don't bother to run a query if we're not using the database's ones anyhow. |
1896 | - if (empty($modSettings['smiley_enable']) && $user_info['smiley_set'] != 'none') |
|
1897 | - $context['smileys']['postform'][] = array( |
|
1961 | + if (empty($modSettings['smiley_enable']) && $user_info['smiley_set'] != 'none') { |
|
1962 | + $context['smileys']['postform'][] = array( |
|
1898 | 1963 | 'smileys' => array( |
1899 | 1964 | array( |
1900 | 1965 | 'code' => ':)', |
@@ -1980,7 +2045,7 @@ discard block |
||
1980 | 2045 | ), |
1981 | 2046 | 'isLast' => true, |
1982 | 2047 | ); |
1983 | - elseif ($user_info['smiley_set'] != 'none') |
|
2048 | + } elseif ($user_info['smiley_set'] != 'none') |
|
1984 | 2049 | { |
1985 | 2050 | if (($temp = cache_get_data('posting_smileys', 480)) == null) |
1986 | 2051 | { |
@@ -2003,17 +2068,19 @@ discard block |
||
2003 | 2068 | |
2004 | 2069 | foreach ($context['smileys'] as $section => $smileyRows) |
2005 | 2070 | { |
2006 | - foreach ($smileyRows as $rowIndex => $smileys) |
|
2007 | - $context['smileys'][$section][$rowIndex]['smileys'][count($smileys['smileys']) - 1]['isLast'] = true; |
|
2071 | + foreach ($smileyRows as $rowIndex => $smileys) { |
|
2072 | + $context['smileys'][$section][$rowIndex]['smileys'][count($smileys['smileys']) - 1]['isLast'] = true; |
|
2073 | + } |
|
2008 | 2074 | |
2009 | - if (!empty($smileyRows)) |
|
2010 | - $context['smileys'][$section][count($smileyRows) - 1]['isLast'] = true; |
|
2075 | + if (!empty($smileyRows)) { |
|
2076 | + $context['smileys'][$section][count($smileyRows) - 1]['isLast'] = true; |
|
2077 | + } |
|
2011 | 2078 | } |
2012 | 2079 | |
2013 | 2080 | cache_put_data('posting_smileys', $context['smileys'], 480); |
2081 | + } else { |
|
2082 | + $context['smileys'] = $temp; |
|
2014 | 2083 | } |
2015 | - else |
|
2016 | - $context['smileys'] = $temp; |
|
2017 | 2084 | } |
2018 | 2085 | } |
2019 | 2086 | |
@@ -2029,12 +2096,15 @@ discard block |
||
2029 | 2096 | 'plugins' => 'undo', |
2030 | 2097 | 'bbcodeTrim' => true, |
2031 | 2098 | ); |
2032 | - if (!empty($context['controls']['richedit'][$editorOptions['id']]['locale'])) |
|
2033 | - $sce_options['locale'] = $context['controls']['richedit'][$editorOptions['id']]['locale']; |
|
2034 | - if (!empty($context['right_to_left'])) |
|
2035 | - $sce_options['rtl'] = true; |
|
2036 | - if ($editorOptions['id'] != 'quickReply') |
|
2037 | - $sce_options['autofocus'] = true; |
|
2099 | + if (!empty($context['controls']['richedit'][$editorOptions['id']]['locale'])) { |
|
2100 | + $sce_options['locale'] = $context['controls']['richedit'][$editorOptions['id']]['locale']; |
|
2101 | + } |
|
2102 | + if (!empty($context['right_to_left'])) { |
|
2103 | + $sce_options['rtl'] = true; |
|
2104 | + } |
|
2105 | + if ($editorOptions['id'] != 'quickReply') { |
|
2106 | + $sce_options['autofocus'] = true; |
|
2107 | + } |
|
2038 | 2108 | |
2039 | 2109 | $sce_options['emoticons'] = array(); |
2040 | 2110 | $sce_options['emoticonsDescriptions'] = array(); |
@@ -2051,10 +2121,11 @@ discard block |
||
2051 | 2121 | $countLocations--; |
2052 | 2122 | |
2053 | 2123 | unset($smiley_location); |
2054 | - if ($location == 'postform') |
|
2055 | - $smiley_location = &$sce_options['emoticons']['dropdown']; |
|
2056 | - elseif ($location == 'popup') |
|
2057 | - $smiley_location = &$sce_options['emoticons']['popup']; |
|
2124 | + if ($location == 'postform') { |
|
2125 | + $smiley_location = &$sce_options['emoticons']['dropdown']; |
|
2126 | + } elseif ($location == 'popup') { |
|
2127 | + $smiley_location = &$sce_options['emoticons']['popup']; |
|
2128 | + } |
|
2058 | 2129 | |
2059 | 2130 | $numRows = count($smileyRows); |
2060 | 2131 | |
@@ -2068,8 +2139,9 @@ discard block |
||
2068 | 2139 | $sce_options['emoticonsDescriptions'][$smiley['code']] = $smiley['description']; |
2069 | 2140 | } |
2070 | 2141 | |
2071 | - if (empty($smileyRow['isLast']) && $numRows != 1) |
|
2072 | - $smiley_location['-' . $emptyPlaceholder++] = ''; |
|
2142 | + if (empty($smileyRow['isLast']) && $numRows != 1) { |
|
2143 | + $smiley_location['-' . $emptyPlaceholder++] = ''; |
|
2144 | + } |
|
2073 | 2145 | } |
2074 | 2146 | } |
2075 | 2147 | } |
@@ -2084,8 +2156,9 @@ discard block |
||
2084 | 2156 | |
2085 | 2157 | $count_tags--; |
2086 | 2158 | |
2087 | - if (!empty($count_tags)) |
|
2088 | - $sce_options['toolbar'] .= '||'; |
|
2159 | + if (!empty($count_tags)) { |
|
2160 | + $sce_options['toolbar'] .= '||'; |
|
2161 | + } |
|
2089 | 2162 | } |
2090 | 2163 | } |
2091 | 2164 | |
@@ -2113,8 +2186,9 @@ discard block |
||
2113 | 2186 | loadTemplate('GenericControls'); |
2114 | 2187 | |
2115 | 2188 | // Some javascript ma'am? |
2116 | - if (!empty($verificationOptions['override_visual']) || (!empty($modSettings['visual_verification_type']) && !isset($verificationOptions['override_visual']))) |
|
2117 | - loadJavaScriptFile('captcha.js', array('minimize' => true), 'smf_captcha'); |
|
2189 | + if (!empty($verificationOptions['override_visual']) || (!empty($modSettings['visual_verification_type']) && !isset($verificationOptions['override_visual']))) { |
|
2190 | + loadJavaScriptFile('captcha.js', array('minimize' => true), 'smf_captcha'); |
|
2191 | + } |
|
2118 | 2192 | |
2119 | 2193 | $context['use_graphic_library'] = in_array('gd', get_loaded_extensions()); |
2120 | 2194 | |
@@ -2127,8 +2201,8 @@ discard block |
||
2127 | 2201 | $isNew = !isset($context['controls']['verification'][$verificationOptions['id']]); |
2128 | 2202 | |
2129 | 2203 | // Log this into our collection. |
2130 | - if ($isNew) |
|
2131 | - $context['controls']['verification'][$verificationOptions['id']] = array( |
|
2204 | + if ($isNew) { |
|
2205 | + $context['controls']['verification'][$verificationOptions['id']] = array( |
|
2132 | 2206 | 'id' => $verificationOptions['id'], |
2133 | 2207 | 'empty_field' => empty($verificationOptions['no_empty_field']), |
2134 | 2208 | 'show_visual' => !empty($verificationOptions['override_visual']) || (!empty($modSettings['visual_verification_type']) && !isset($verificationOptions['override_visual'])), |
@@ -2139,13 +2213,15 @@ discard block |
||
2139 | 2213 | 'questions' => array(), |
2140 | 2214 | 'can_recaptcha' => !empty($modSettings['recaptcha_enabled']) && !empty($modSettings['recaptcha_site_key']) && !empty($modSettings['recaptcha_secret_key']), |
2141 | 2215 | ); |
2216 | + } |
|
2142 | 2217 | $thisVerification = &$context['controls']['verification'][$verificationOptions['id']]; |
2143 | 2218 | |
2144 | 2219 | // Is there actually going to be anything? |
2145 | - if (empty($thisVerification['show_visual']) && empty($thisVerification['number_questions']) && empty($thisVerification['can_recaptcha'])) |
|
2146 | - return false; |
|
2147 | - elseif (!$isNew && !$do_test) |
|
2148 | - return true; |
|
2220 | + if (empty($thisVerification['show_visual']) && empty($thisVerification['number_questions']) && empty($thisVerification['can_recaptcha'])) { |
|
2221 | + return false; |
|
2222 | + } elseif (!$isNew && !$do_test) { |
|
2223 | + return true; |
|
2224 | + } |
|
2149 | 2225 | |
2150 | 2226 | // Sanitize reCAPTCHA fields? |
2151 | 2227 | if ($thisVerification['can_recaptcha']) |
@@ -2158,11 +2234,12 @@ discard block |
||
2158 | 2234 | } |
2159 | 2235 | |
2160 | 2236 | // Add javascript for the object. |
2161 | - if ($context['controls']['verification'][$verificationOptions['id']]['show_visual']) |
|
2162 | - $context['insert_after_template'] .= ' |
|
2237 | + if ($context['controls']['verification'][$verificationOptions['id']]['show_visual']) { |
|
2238 | + $context['insert_after_template'] .= ' |
|
2163 | 2239 | <script> |
2164 | 2240 | var verification' . $verificationOptions['id'] . 'Handle = new smfCaptcha("' . $thisVerification['image_href'] . '", "' . $verificationOptions['id'] . '", ' . ($context['use_graphic_library'] ? 1 : 0) . '); |
2165 | 2241 | </script>'; |
2242 | + } |
|
2166 | 2243 | |
2167 | 2244 | // If we want questions do we have a cache of all the IDs? |
2168 | 2245 | if (!empty($thisVerification['number_questions']) && empty($modSettings['question_id_cache'])) |
@@ -2185,8 +2262,9 @@ discard block |
||
2185 | 2262 | unset ($row['id_question']); |
2186 | 2263 | // Make them all lowercase. We can't directly use $smcFunc['strtolower'] with array_walk, so do it manually, eh? |
2187 | 2264 | $row['answers'] = $smcFunc['json_decode']($row['answers'], true); |
2188 | - foreach ($row['answers'] as $k => $v) |
|
2189 | - $row['answers'][$k] = $smcFunc['strtolower']($v); |
|
2265 | + foreach ($row['answers'] as $k => $v) { |
|
2266 | + $row['answers'][$k] = $smcFunc['strtolower']($v); |
|
2267 | + } |
|
2190 | 2268 | |
2191 | 2269 | $modSettings['question_id_cache']['questions'][$id_question] = $row; |
2192 | 2270 | $modSettings['question_id_cache']['langs'][$row['lngfile']][] = $id_question; |
@@ -2197,35 +2275,42 @@ discard block |
||
2197 | 2275 | } |
2198 | 2276 | } |
2199 | 2277 | |
2200 | - if (!isset($_SESSION[$verificationOptions['id'] . '_vv'])) |
|
2201 | - $_SESSION[$verificationOptions['id'] . '_vv'] = array(); |
|
2278 | + if (!isset($_SESSION[$verificationOptions['id'] . '_vv'])) { |
|
2279 | + $_SESSION[$verificationOptions['id'] . '_vv'] = array(); |
|
2280 | + } |
|
2202 | 2281 | |
2203 | 2282 | // Do we need to refresh the verification? |
2204 | - if (!$do_test && (!empty($_SESSION[$verificationOptions['id'] . '_vv']['did_pass']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['count']) || $_SESSION[$verificationOptions['id'] . '_vv']['count'] > 3) && empty($verificationOptions['dont_refresh'])) |
|
2205 | - $force_refresh = true; |
|
2206 | - else |
|
2207 | - $force_refresh = false; |
|
2283 | + if (!$do_test && (!empty($_SESSION[$verificationOptions['id'] . '_vv']['did_pass']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['count']) || $_SESSION[$verificationOptions['id'] . '_vv']['count'] > 3) && empty($verificationOptions['dont_refresh'])) { |
|
2284 | + $force_refresh = true; |
|
2285 | + } else { |
|
2286 | + $force_refresh = false; |
|
2287 | + } |
|
2208 | 2288 | |
2209 | 2289 | // This can also force a fresh, although unlikely. |
2210 | - if (($thisVerification['show_visual'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['code'])) || ($thisVerification['number_questions'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['q']))) |
|
2211 | - $force_refresh = true; |
|
2290 | + if (($thisVerification['show_visual'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['code'])) || ($thisVerification['number_questions'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['q']))) { |
|
2291 | + $force_refresh = true; |
|
2292 | + } |
|
2212 | 2293 | |
2213 | 2294 | $verification_errors = array(); |
2214 | 2295 | // Start with any testing. |
2215 | 2296 | if ($do_test) |
2216 | 2297 | { |
2217 | 2298 | // This cannot happen! |
2218 | - if (!isset($_SESSION[$verificationOptions['id'] . '_vv']['count'])) |
|
2219 | - fatal_lang_error('no_access', false); |
|
2299 | + if (!isset($_SESSION[$verificationOptions['id'] . '_vv']['count'])) { |
|
2300 | + fatal_lang_error('no_access', false); |
|
2301 | + } |
|
2220 | 2302 | // ... nor this! |
2221 | - if ($thisVerification['number_questions'] && (!isset($_SESSION[$verificationOptions['id'] . '_vv']['q']) || !isset($_REQUEST[$verificationOptions['id'] . '_vv']['q']))) |
|
2222 | - fatal_lang_error('no_access', false); |
|
2303 | + if ($thisVerification['number_questions'] && (!isset($_SESSION[$verificationOptions['id'] . '_vv']['q']) || !isset($_REQUEST[$verificationOptions['id'] . '_vv']['q']))) { |
|
2304 | + fatal_lang_error('no_access', false); |
|
2305 | + } |
|
2223 | 2306 | // Hmm, it's requested but not actually declared. This shouldn't happen. |
2224 | - if ($thisVerification['empty_field'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field'])) |
|
2225 | - fatal_lang_error('no_access', false); |
|
2307 | + if ($thisVerification['empty_field'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field'])) { |
|
2308 | + fatal_lang_error('no_access', false); |
|
2309 | + } |
|
2226 | 2310 | // While we're here, did the user do something bad? |
2227 | - if ($thisVerification['empty_field'] && !empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field']) && !empty($_REQUEST[$_SESSION[$verificationOptions['id'] . '_vv']['empty_field']])) |
|
2228 | - $verification_errors[] = 'wrong_verification_answer'; |
|
2311 | + if ($thisVerification['empty_field'] && !empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field']) && !empty($_REQUEST[$_SESSION[$verificationOptions['id'] . '_vv']['empty_field']])) { |
|
2312 | + $verification_errors[] = 'wrong_verification_answer'; |
|
2313 | + } |
|
2229 | 2314 | |
2230 | 2315 | if ($thisVerification['can_recaptcha']) |
2231 | 2316 | { |
@@ -2236,22 +2321,25 @@ discard block |
||
2236 | 2321 | { |
2237 | 2322 | $resp = $reCaptcha->verify($_POST['g-recaptcha-response'], $user_info['ip']); |
2238 | 2323 | |
2239 | - if (!$resp->isSuccess()) |
|
2240 | - $verification_errors[] = 'wrong_verification_code'; |
|
2324 | + if (!$resp->isSuccess()) { |
|
2325 | + $verification_errors[] = 'wrong_verification_code'; |
|
2326 | + } |
|
2327 | + } else { |
|
2328 | + $verification_errors[] = 'wrong_verification_code'; |
|
2241 | 2329 | } |
2242 | - else |
|
2243 | - $verification_errors[] = 'wrong_verification_code'; |
|
2244 | 2330 | } |
2245 | - if ($thisVerification['show_visual'] && (empty($_REQUEST[$verificationOptions['id'] . '_vv']['code']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['code']) || strtoupper($_REQUEST[$verificationOptions['id'] . '_vv']['code']) !== $_SESSION[$verificationOptions['id'] . '_vv']['code'])) |
|
2246 | - $verification_errors[] = 'wrong_verification_code'; |
|
2331 | + if ($thisVerification['show_visual'] && (empty($_REQUEST[$verificationOptions['id'] . '_vv']['code']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['code']) || strtoupper($_REQUEST[$verificationOptions['id'] . '_vv']['code']) !== $_SESSION[$verificationOptions['id'] . '_vv']['code'])) { |
|
2332 | + $verification_errors[] = 'wrong_verification_code'; |
|
2333 | + } |
|
2247 | 2334 | if ($thisVerification['number_questions']) |
2248 | 2335 | { |
2249 | 2336 | $incorrectQuestions = array(); |
2250 | 2337 | foreach ($_SESSION[$verificationOptions['id'] . '_vv']['q'] as $q) |
2251 | 2338 | { |
2252 | 2339 | // We don't have this question any more, thus no answers. |
2253 | - if (!isset($modSettings['question_id_cache']['questions'][$q])) |
|
2254 | - continue; |
|
2340 | + if (!isset($modSettings['question_id_cache']['questions'][$q])) { |
|
2341 | + continue; |
|
2342 | + } |
|
2255 | 2343 | // This is quite complex. We have our question but it might have multiple answers. |
2256 | 2344 | // First, did they actually answer this question? |
2257 | 2345 | if (!isset($_REQUEST[$verificationOptions['id'] . '_vv']['q'][$q]) || trim($_REQUEST[$verificationOptions['id'] . '_vv']['q'][$q]) == '') |
@@ -2263,24 +2351,28 @@ discard block |
||
2263 | 2351 | else |
2264 | 2352 | { |
2265 | 2353 | $given_answer = trim($smcFunc['htmlspecialchars'](strtolower($_REQUEST[$verificationOptions['id'] . '_vv']['q'][$q]))); |
2266 | - if (!in_array($given_answer, $modSettings['question_id_cache']['questions'][$q]['answers'])) |
|
2267 | - $incorrectQuestions[] = $q; |
|
2354 | + if (!in_array($given_answer, $modSettings['question_id_cache']['questions'][$q]['answers'])) { |
|
2355 | + $incorrectQuestions[] = $q; |
|
2356 | + } |
|
2268 | 2357 | } |
2269 | 2358 | } |
2270 | 2359 | |
2271 | - if (!empty($incorrectQuestions)) |
|
2272 | - $verification_errors[] = 'wrong_verification_answer'; |
|
2360 | + if (!empty($incorrectQuestions)) { |
|
2361 | + $verification_errors[] = 'wrong_verification_answer'; |
|
2362 | + } |
|
2273 | 2363 | } |
2274 | 2364 | } |
2275 | 2365 | |
2276 | 2366 | // Any errors means we refresh potentially. |
2277 | 2367 | if (!empty($verification_errors)) |
2278 | 2368 | { |
2279 | - if (empty($_SESSION[$verificationOptions['id'] . '_vv']['errors'])) |
|
2280 | - $_SESSION[$verificationOptions['id'] . '_vv']['errors'] = 0; |
|
2369 | + if (empty($_SESSION[$verificationOptions['id'] . '_vv']['errors'])) { |
|
2370 | + $_SESSION[$verificationOptions['id'] . '_vv']['errors'] = 0; |
|
2371 | + } |
|
2281 | 2372 | // Too many errors? |
2282 | - elseif ($_SESSION[$verificationOptions['id'] . '_vv']['errors'] > $thisVerification['max_errors']) |
|
2283 | - $force_refresh = true; |
|
2373 | + elseif ($_SESSION[$verificationOptions['id'] . '_vv']['errors'] > $thisVerification['max_errors']) { |
|
2374 | + $force_refresh = true; |
|
2375 | + } |
|
2284 | 2376 | |
2285 | 2377 | // Keep a track of these. |
2286 | 2378 | $_SESSION[$verificationOptions['id'] . '_vv']['errors']++; |
@@ -2313,8 +2405,9 @@ discard block |
||
2313 | 2405 | // Are we overriding the range? |
2314 | 2406 | $character_range = !empty($verificationOptions['override_range']) ? $verificationOptions['override_range'] : $context['standard_captcha_range']; |
2315 | 2407 | |
2316 | - for ($i = 0; $i < 6; $i++) |
|
2317 | - $_SESSION[$verificationOptions['id'] . '_vv']['code'] .= $character_range[array_rand($character_range)]; |
|
2408 | + for ($i = 0; $i < 6; $i++) { |
|
2409 | + $_SESSION[$verificationOptions['id'] . '_vv']['code'] .= $character_range[array_rand($character_range)]; |
|
2410 | + } |
|
2318 | 2411 | } |
2319 | 2412 | |
2320 | 2413 | // Getting some new questions? |
@@ -2322,8 +2415,9 @@ discard block |
||
2322 | 2415 | { |
2323 | 2416 | // Attempt to try the current page's language, followed by the user's preference, followed by the site default. |
2324 | 2417 | $possible_langs = array(); |
2325 | - if (isset($_SESSION['language'])) |
|
2326 | - $possible_langs[] = strtr($_SESSION['language'], array('-utf8' => '')); |
|
2418 | + if (isset($_SESSION['language'])) { |
|
2419 | + $possible_langs[] = strtr($_SESSION['language'], array('-utf8' => '')); |
|
2420 | + } |
|
2327 | 2421 | if (!empty($user_info['language'])); |
2328 | 2422 | $possible_langs[] = $user_info['language']; |
2329 | 2423 | $possible_langs[] = $language; |
@@ -2342,8 +2436,7 @@ discard block |
||
2342 | 2436 | } |
2343 | 2437 | } |
2344 | 2438 | } |
2345 | - } |
|
2346 | - else |
|
2439 | + } else |
|
2347 | 2440 | { |
2348 | 2441 | // Same questions as before. |
2349 | 2442 | $questionIDs = !empty($_SESSION[$verificationOptions['id'] . '_vv']['q']) ? $_SESSION[$verificationOptions['id'] . '_vv']['q'] : array(); |
@@ -2353,8 +2446,9 @@ discard block |
||
2353 | 2446 | // If we do have an empty field, it would be nice to hide it from legitimate users who shouldn't be populating it anyway. |
2354 | 2447 | if (!empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field'])) |
2355 | 2448 | { |
2356 | - if (!isset($context['html_headers'])) |
|
2357 | - $context['html_headers'] = ''; |
|
2449 | + if (!isset($context['html_headers'])) { |
|
2450 | + $context['html_headers'] = ''; |
|
2451 | + } |
|
2358 | 2452 | $context['html_headers'] .= '<style>.vv_special { display:none; }</style>'; |
2359 | 2453 | } |
2360 | 2454 | |
@@ -2380,11 +2474,13 @@ discard block |
||
2380 | 2474 | $_SESSION[$verificationOptions['id'] . '_vv']['count'] = empty($_SESSION[$verificationOptions['id'] . '_vv']['count']) ? 1 : $_SESSION[$verificationOptions['id'] . '_vv']['count'] + 1; |
2381 | 2475 | |
2382 | 2476 | // Return errors if we have them. |
2383 | - if (!empty($verification_errors)) |
|
2384 | - return $verification_errors; |
|
2477 | + if (!empty($verification_errors)) { |
|
2478 | + return $verification_errors; |
|
2479 | + } |
|
2385 | 2480 | // If we had a test that one, make a note. |
2386 | - elseif ($do_test) |
|
2387 | - $_SESSION[$verificationOptions['id'] . '_vv']['did_pass'] = true; |
|
2481 | + elseif ($do_test) { |
|
2482 | + $_SESSION[$verificationOptions['id'] . '_vv']['did_pass'] = true; |
|
2483 | + } |
|
2388 | 2484 | |
2389 | 2485 | // Say that everything went well chaps. |
2390 | 2486 | return true; |
@@ -2409,8 +2505,9 @@ discard block |
||
2409 | 2505 | call_integration_hook('integrate_autosuggest', array(&$searchTypes)); |
2410 | 2506 | |
2411 | 2507 | // If we're just checking the callback function is registered return true or false. |
2412 | - if ($checkRegistered != null) |
|
2413 | - return isset($searchTypes[$checkRegistered]) && function_exists('AutoSuggest_Search_' . $checkRegistered); |
|
2508 | + if ($checkRegistered != null) { |
|
2509 | + return isset($searchTypes[$checkRegistered]) && function_exists('AutoSuggest_Search_' . $checkRegistered); |
|
2510 | + } |
|
2414 | 2511 | |
2415 | 2512 | checkSession('get'); |
2416 | 2513 | loadTemplate('Xml'); |
@@ -2561,24 +2658,27 @@ discard block |
||
2561 | 2658 | foreach ($possible_versions as $ver) |
2562 | 2659 | { |
2563 | 2660 | $ver = trim($ver); |
2564 | - if (strpos($ver, 'SMF') === 0) |
|
2565 | - $versions[] = $ver; |
|
2661 | + if (strpos($ver, 'SMF') === 0) { |
|
2662 | + $versions[] = $ver; |
|
2663 | + } |
|
2566 | 2664 | } |
2567 | 2665 | } |
2568 | 2666 | $smcFunc['db_free_result']($request); |
2569 | 2667 | |
2570 | 2668 | // Just in case we don't have ANYthing. |
2571 | - if (empty($versions)) |
|
2572 | - $versions = array('SMF 2.0'); |
|
2669 | + if (empty($versions)) { |
|
2670 | + $versions = array('SMF 2.0'); |
|
2671 | + } |
|
2573 | 2672 | |
2574 | - foreach ($versions as $id => $version) |
|
2575 | - if (strpos($version, strtoupper($_REQUEST['search'])) !== false) |
|
2673 | + foreach ($versions as $id => $version) { |
|
2674 | + if (strpos($version, strtoupper($_REQUEST['search'])) !== false) |
|
2576 | 2675 | $xml_data['items']['children'][] = array( |
2577 | 2676 | 'attributes' => array( |
2578 | 2677 | 'id' => $id, |
2579 | 2678 | ), |
2580 | 2679 | 'value' => $version, |
2581 | 2680 | ); |
2681 | + } |
|
2582 | 2682 | |
2583 | 2683 | return $xml_data; |
2584 | 2684 | } |