@@ -67,10 +67,13 @@ discard block |
||
67 | 67 | |
68 | 68 | // Show just numbers...? |
69 | 69 | if ($settings['display_who_viewing'] == 1) |
70 | - echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members']; |
|
70 | + { |
|
71 | + echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members']; |
|
72 | + } |
|
71 | 73 | // Or show the actual people viewing the topic? |
72 | - else |
|
73 | - echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
74 | + else { |
|
75 | + echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
76 | + } |
|
74 | 77 | |
75 | 78 | // Now show how many guests are here too. |
76 | 79 | echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], ' |
@@ -79,10 +82,12 @@ discard block |
||
79 | 82 | |
80 | 83 | // Is this topic a redirect? |
81 | 84 | if (!empty($context['topic_redirected_from'])) |
82 | - echo ' |
|
85 | + { |
|
86 | + echo ' |
|
83 | 87 | <span id="redirectfrom"> |
84 | 88 | ' . sprintf($txt['no_redir'], '<a href="' . $context['topic_redirected_from']['redir_href'] . '">' . $context['topic_redirected_from']['subject'] . '</a>'), ' |
85 | 89 | </span>'; |
90 | + } |
|
86 | 91 | echo ' |
87 | 92 | </div>'; |
88 | 93 | } |
@@ -109,7 +114,9 @@ discard block |
||
109 | 114 | while ($message = $controller->{$context['get_message'][1]}()) |
110 | 115 | { |
111 | 116 | if ($message['can_remove']) |
112 | - $removableMessageIDs[] = $message['id']; |
|
117 | + { |
|
118 | + $removableMessageIDs[] = $message['id']; |
|
119 | + } |
|
113 | 120 | |
114 | 121 | // Are we ignoring this message? |
115 | 122 | if (!empty($message['is_ignored'])) |
@@ -117,14 +124,17 @@ discard block |
||
117 | 124 | $ignoring = true; |
118 | 125 | $ignoredMsgs[] = $message['id']; |
119 | 126 | } |
120 | - else |
|
121 | - $ignoring = false; |
|
127 | + else { |
|
128 | + $ignoring = false; |
|
129 | + } |
|
122 | 130 | |
123 | 131 | // Show the message anchor and a "new" anchor if this message is new. |
124 | 132 | if ($message['id'] != $context['first_message'] && ($message['first_new'])) |
125 | - echo ' |
|
133 | + { |
|
134 | + echo ' |
|
126 | 135 | <a id="new"> </a> |
127 | 136 | <hr class="new_post_separator" />'; |
137 | + } |
|
128 | 138 | |
129 | 139 | echo ' |
130 | 140 | <article class="post_wrapper forumposts', $message['classes'], $message['approved'] ? '' : ' approvebg', '">', $message['id'] != $context['first_message'] ? ' |
@@ -132,10 +142,12 @@ discard block |
||
132 | 142 | |
133 | 143 | // Showing the sidebar posting area? |
134 | 144 | if (empty($options['hide_poster_area'])) |
135 | - echo ' |
|
145 | + { |
|
146 | + echo ' |
|
136 | 147 | <aside> |
137 | 148 | <ul class="poster">', template_build_poster_div($message, $ignoring), '</ul> |
138 | 149 | </aside>'; |
150 | + } |
|
139 | 151 | |
140 | 152 | echo ' |
141 | 153 | <div class="postarea', empty($options['hide_poster_area']) ? '' : '2', '"> |
@@ -151,10 +163,12 @@ discard block |
||
151 | 163 | <ul class="menulevel2">'; |
152 | 164 | |
153 | 165 | foreach ($context['follow_ups'][$message['id']] as $follow_up) |
154 | - echo ' |
|
166 | + { |
|
167 | + echo ' |
|
155 | 168 | <li class="listlevel2"> |
156 | 169 | <a class="linklevel2" href="', $scripturl, '?topic=', $follow_up['follow_up'], '.0">', $follow_up['subject'], '</a> |
157 | 170 | </li>'; |
171 | + } |
|
158 | 172 | |
159 | 173 | echo ' |
160 | 174 | </ul> |
@@ -175,18 +189,22 @@ discard block |
||
175 | 189 | |
176 | 190 | // Ignoring this user? Hide the post. |
177 | 191 | if ($ignoring) |
178 | - echo ' |
|
192 | + { |
|
193 | + echo ' |
|
179 | 194 | <details id="msg_', $message['id'], '_ignored_prompt"> |
180 | 195 | ', $txt['ignoring_user'], ' |
181 | 196 | <a href="#" id="msg_', $message['id'], '_ignored_link" class="hide">', $txt['show_ignore_user_post'], '</a> |
182 | 197 | </details>'; |
198 | + } |
|
183 | 199 | |
184 | 200 | // Awaiting moderation? |
185 | 201 | if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) |
186 | - echo ' |
|
202 | + { |
|
203 | + echo ' |
|
187 | 204 | <div class="approve_post"> |
188 | 205 | ', $txt['post_awaiting_approval'], ' |
189 | 206 | </div>'; |
207 | + } |
|
190 | 208 | |
191 | 209 | // Show the post itself, finally! |
192 | 210 | echo ' |
@@ -200,7 +218,9 @@ discard block |
||
200 | 218 | |
201 | 219 | // Assuming there are attachments... |
202 | 220 | if (!empty($message['attachment'])) |
203 | - template_display_attachments($message, $ignoring); |
|
221 | + { |
|
222 | + template_display_attachments($message, $ignoring); |
|
223 | + } |
|
204 | 224 | |
205 | 225 | // Show the quickbuttons, for various operations on posts. |
206 | 226 | echo ' |
@@ -209,22 +229,28 @@ discard block |
||
209 | 229 | |
210 | 230 | // Show a checkbox for quick moderation? |
211 | 231 | if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) |
212 | - echo ' |
|
232 | + { |
|
233 | + echo ' |
|
213 | 234 | <li class="listlevel1 inline_mod_check hide" id="in_topic_mod_check_', $message['id'], '"></li>'; |
235 | + } |
|
214 | 236 | |
215 | 237 | // Show "Last Edit: Time by Person" if this post was edited. |
216 | 238 | if ($settings['show_modify']) |
217 | - echo ' |
|
239 | + { |
|
240 | + echo ' |
|
218 | 241 | <li id="modified_', $message['id'], '" class="listlevel1 modified', !empty($message['modified']['name']) ? '"' : ' hide"', '> |
219 | 242 | ', !empty($message['modified']['name']) ? $message['modified']['last_edit_text'] : '', ' |
220 | 243 | </li>'; |
244 | + } |
|
221 | 245 | |
222 | 246 | // Maybe they can modify the post (this is the more button) |
223 | 247 | if ($message['can_modify'] || ($context['can_report_moderator'])) |
224 | - echo ' |
|
248 | + { |
|
249 | + echo ' |
|
225 | 250 | <li class="listlevel1 subsections" aria-haspopup="true"> |
226 | 251 | <a href="#" ', !empty($options['use_click_menu']) ? '' : 'onclick="event.stopPropagation();return false;" ', 'class="linklevel1 post_options">', $txt['post_options'], ' |
227 | 252 | </a>'; |
253 | + } |
|
228 | 254 | |
229 | 255 | if ($message['can_modify'] || $message['can_remove'] || !empty($context['can_follow_up']) || ($context['can_split'] && !empty($context['real_num_replies'])) || $context['can_restore_msg'] || $message['can_approve'] || $message['can_unapprove'] || $context['can_report_moderator']) |
230 | 256 | { |
@@ -234,67 +260,85 @@ discard block |
||
234 | 260 | |
235 | 261 | // Can the user modify the contents of this post? |
236 | 262 | if ($message['can_modify']) |
237 | - echo ' |
|
263 | + { |
|
264 | + echo ' |
|
238 | 265 | <li class="listlevel2"> |
239 | 266 | <a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '" class="linklevel2 modify_button">', $txt['modify'], '</a> |
240 | 267 | </li>'; |
268 | + } |
|
241 | 269 | |
242 | 270 | // How about... even... remove it entirely?! |
243 | 271 | if ($message['can_remove']) |
244 | - echo ' |
|
272 | + { |
|
273 | + echo ' |
|
245 | 274 | <li class="listlevel2"> |
246 | 275 | <a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['remove_message'], '?\');" class="linklevel2 remove_button">', $txt['remove'], '</a> |
247 | 276 | </li>'; |
277 | + } |
|
248 | 278 | |
249 | 279 | // Can they quote to a new topic? @todo - This needs rethinking for GUI layout. |
250 | 280 | if (!empty($context['can_follow_up'])) |
251 | - echo ' |
|
281 | + { |
|
282 | + echo ' |
|
252 | 283 | <li class="listlevel2"> |
253 | 284 | <a href="', $scripturl, '?action=post;board=', $context['current_board'], ';quote=', $message['id'], ';followup=', $message['id'], '" class="linklevel2 quotetonew_button">', $txt['quote_new'], '</a> |
254 | 285 | </li>'; |
286 | + } |
|
255 | 287 | |
256 | 288 | // What about splitting it off the rest of the topic? |
257 | 289 | if ($context['can_split'] && !empty($context['real_num_replies']) && $context['topic_first_message'] !== $message['id']) |
258 | - echo ' |
|
290 | + { |
|
291 | + echo ' |
|
259 | 292 | <li class="listlevel2"> |
260 | 293 | <a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '" class="linklevel2 split_button">', $txt['split_topic'], '</a> |
261 | 294 | </li>'; |
295 | + } |
|
262 | 296 | |
263 | 297 | // Can we restore topics? |
264 | 298 | if ($context['can_restore_msg']) |
265 | - echo ' |
|
299 | + { |
|
300 | + echo ' |
|
266 | 301 | <li class="listlevel2"> |
267 | 302 | <a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" class="linklevel2 restore_button">', $txt['restore_message'], '</a> |
268 | 303 | </li>'; |
304 | + } |
|
269 | 305 | |
270 | 306 | // Maybe we can approve it, maybe we should? |
271 | 307 | if ($message['can_approve']) |
272 | - echo ' |
|
308 | + { |
|
309 | + echo ' |
|
273 | 310 | <li class="listlevel2"> |
274 | 311 | <a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" class="linklevel2 approve_button">', $txt['approve'], '</a> |
275 | 312 | </li>'; |
313 | + } |
|
276 | 314 | |
277 | 315 | // Maybe we can unapprove it? |
278 | 316 | if ($message['can_unapprove']) |
279 | - echo ' |
|
317 | + { |
|
318 | + echo ' |
|
280 | 319 | <li class="listlevel2"> |
281 | 320 | <a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" class="linklevel2 unapprove_button">', $txt['unapprove'], '</a> |
282 | 321 | </li>'; |
322 | + } |
|
283 | 323 | |
284 | 324 | // Maybe they want to report this post to the moderator(s)? |
285 | 325 | if ($context['can_report_moderator']) |
286 | - echo ' |
|
326 | + { |
|
327 | + echo ' |
|
287 | 328 | <li class="listlevel2"> |
288 | 329 | <a href="' . $scripturl . '?action=reporttm;topic=' . $context['current_topic'] . '.' . $message['counter'] . ';msg=' . $message['id'] . '" class="linklevel2 warn_button">' . $txt['report_to_mod'] . '</a> |
289 | 330 | </li>'; |
331 | + } |
|
290 | 332 | |
291 | 333 | // Anything else added by mods for example? |
292 | 334 | if (!empty($context['additional_drop_buttons'])) |
293 | - foreach ($context['additional_drop_buttons'] as $key => $button) |
|
335 | + { |
|
336 | + foreach ($context['additional_drop_buttons'] as $key => $button) |
|
294 | 337 | echo ' |
295 | 338 | <li class="listlevel2"> |
296 | 339 | <a href="' . $button['href'] . '" class="linklevel2 ', $key, '">' . $button['text'] . '</a> |
297 | 340 | </li>'; |
341 | + } |
|
298 | 342 | |
299 | 343 | echo ' |
300 | 344 | </ul> |
@@ -306,50 +350,61 @@ discard block |
||
306 | 350 | { |
307 | 351 | // Can they like/unlike this post? |
308 | 352 | if ($message['can_like'] || $message['can_unlike']) |
309 | - echo ' |
|
353 | + { |
|
354 | + echo ' |
|
310 | 355 | <li class="listlevel1', !empty($message['like_counter']) ? ' liked"' : '"', '> |
311 | 356 | <a class="linklevel1 ', $message['can_unlike'] ? 'unreact_button' : 'react_button', '" href="javascript:void(0)"', !empty($message['like_counter']) ? ' title="' . $txt['liked_by'] . ' ' . implode(', ', $context['likes'][$message['id']]['member']) . '"' : '', ' onclick="likePosts.prototype.likeUnlikePosts(event,', $message['id'], ', ', $context['current_topic'], '); return false;">', |
312 | 357 | !empty($message['like_counter']) ? '<span class="likes_indicator">' . $message['like_counter'] . '</span> ' . $txt['likes'] : $txt['like_post'], ' |
313 | 358 | </a> |
314 | 359 | </li>'; |
360 | + } |
|
315 | 361 | |
316 | 362 | // Or just view the count |
317 | - else |
|
318 | - echo ' |
|
363 | + else { |
|
364 | + echo ' |
|
319 | 365 | <li class="listlevel1', !empty($message['like_counter']) ? ' liked"' : '"', '> |
320 | 366 | <a href="javascript:void(0)" role="button" title="', !empty($message['like_counter']) ? $txt['liked_by'] . ' ' . implode(', ', $context['likes'][$message['id']]['member']) : '', '" class="linklevel1 reacts_button">', |
321 | 367 | !empty($message['like_counter']) ? '<span class="likes_indicator">' . $message['like_counter'] . '</span> ' . $txt['likes'] : ' ', ' |
322 | 368 | </a> |
323 | 369 | </li>'; |
370 | + } |
|
324 | 371 | } |
325 | 372 | |
326 | 373 | // Can the user quick modify the contents of this post? Show the quick (inline) modify button. |
327 | 374 | if ($message['can_modify']) |
328 | - echo ' |
|
375 | + { |
|
376 | + echo ' |
|
329 | 377 | <li id="modify_button_', $message['id'], '" class="listlevel1 quick_edit hide"> |
330 | 378 | <a class="linklevel1 quick_edit" role="button" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\')">', $txt['quick_edit'], '</a> |
331 | 379 | </li>'; |
380 | + } |
|
332 | 381 | |
333 | 382 | // Can they reply? Have they turned on quick reply? |
334 | 383 | if ($context['can_quote'] && !empty($options['display_quick_reply'])) |
335 | - echo ' |
|
384 | + { |
|
385 | + echo ' |
|
336 | 386 | <li class="listlevel1"> |
337 | 387 | <a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');" class="linklevel1 quote_button">', $txt['quote'], '</a> |
338 | 388 | </li>'; |
389 | + } |
|
339 | 390 | // So... quick reply is off, but they *can* reply? |
340 | 391 | elseif ($context['can_quote']) |
341 | - echo ' |
|
392 | + { |
|
393 | + echo ' |
|
342 | 394 | <li class="listlevel1"> |
343 | 395 | <a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" class="linklevel1 quote_button">', $txt['quote'], '</a> |
344 | 396 | </li>'; |
397 | + } |
|
345 | 398 | |
346 | 399 | // Anything else added by mods for example? |
347 | 400 | if (!empty($context['additional_quick_buttons'])) |
348 | - foreach ($context['additional_quick_buttons'] as $key => $button) |
|
401 | + { |
|
402 | + foreach ($context['additional_quick_buttons'] as $key => $button) |
|
349 | 403 | echo ' |
350 | 404 | <li class="listlevel1"> |
351 | 405 | <a href="' . $button['href'] . '" class="linklevel1 ', $key, '">' . $button['text'] . '</a> |
352 | 406 | </li>'; |
407 | + } |
|
353 | 408 | |
354 | 409 | echo ' |
355 | 410 | </ul> |
@@ -364,7 +419,9 @@ discard block |
||
364 | 419 | foreach ($message['member']['custom_fields'] as $custom) |
365 | 420 | { |
366 | 421 | if ($custom['placement'] != 2 || empty($custom['value'])) |
367 | - continue; |
|
422 | + { |
|
423 | + continue; |
|
424 | + } |
|
368 | 425 | |
369 | 426 | if (empty($shown)) |
370 | 427 | { |
@@ -379,15 +436,19 @@ discard block |
||
379 | 436 | } |
380 | 437 | |
381 | 438 | if ($shown) |
382 | - echo ' |
|
439 | + { |
|
440 | + echo ' |
|
383 | 441 | </ul> |
384 | 442 | </div>'; |
443 | + } |
|
385 | 444 | } |
386 | 445 | |
387 | 446 | // Show the member's signature? |
388 | 447 | if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
389 | - echo ' |
|
448 | + { |
|
449 | + echo ' |
|
390 | 450 | <div id="msg_', $message['id'], '_signature" class="signature', $ignoring ? ' hide"' : '"', '>', $message['member']['signature'], '</div>'; |
451 | + } |
|
391 | 452 | |
392 | 453 | echo ' |
393 | 454 | </footer> |
@@ -452,7 +513,8 @@ discard block |
||
452 | 513 | |
453 | 514 | // Guests just need more. |
454 | 515 | if ($context['user']['is_guest']) |
455 | - echo ' |
|
516 | + { |
|
517 | + echo ' |
|
456 | 518 | <dl> |
457 | 519 | <dt> |
458 | 520 | <label for="guestname">', $txt['name'], ':</label> <input type="text" name="guestname" id="guestname" value="', $context['name'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" /> |
@@ -461,11 +523,14 @@ discard block |
||
461 | 523 | <label for="email">', $txt['email'], ':</label> <input type="text" name="email" id="email" value="', $context['email'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" /> |
462 | 524 | </dd> |
463 | 525 | </dl>'; |
526 | + } |
|
464 | 527 | |
465 | 528 | // Is visual verification enabled? |
466 | 529 | if (!empty($context['require_verification'])) |
467 | - template_verification_controls($context['visual_verification_id'], ' |
|
530 | + { |
|
531 | + template_verification_controls($context['visual_verification_id'], ' |
|
468 | 532 | <strong>' . $txt['verification'] . ':</strong>', '<br />'); |
533 | + } |
|
469 | 534 | |
470 | 535 | // Using the full editor or a plain text box? |
471 | 536 | if (empty($options['use_editor_quick_reply'])) |
@@ -479,22 +544,28 @@ discard block |
||
479 | 544 | |
480 | 545 | // Spellcheck button? |
481 | 546 | if ($context['show_spellchecking']) |
482 | - echo ' |
|
547 | + { |
|
548 | + echo ' |
|
483 | 549 | <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'postmodify\', \'message\', ', (empty($options['use_editor_quick_reply']) ? 'false' : 'true'), ')" tabindex="', $context['tabindex']++, '" />'; |
550 | + } |
|
484 | 551 | |
485 | 552 | // Draft save button? |
486 | 553 | if (!empty($context['drafts_save'])) |
487 | - echo ' |
|
554 | + { |
|
555 | + echo ' |
|
488 | 556 | <input type="button" name="save_draft" value="', $txt['draft_save'], '" onclick="return confirm(' . JavaScriptEscape($txt['draft_save_note']) . ') && submitThisOnce(this);" accesskey="d" tabindex="', $context['tabindex']++, '" /> |
489 | 557 | <input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '" />'; |
558 | + } |
|
490 | 559 | |
491 | 560 | // Show the draft last saved on area |
492 | 561 | if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled'])) |
493 | - echo ' |
|
562 | + { |
|
563 | + echo ' |
|
494 | 564 | <div class="draftautosave"> |
495 | 565 | <span id="throbber" class="hide"><i class="icon icon-spin i-spinner"></i> </span> |
496 | 566 | <span id="draft_lastautosave"></span> |
497 | 567 | </div>'; |
568 | + } |
|
498 | 569 | echo ' |
499 | 570 | </div> |
500 | 571 | </div>'; |
@@ -525,8 +596,10 @@ discard block |
||
525 | 596 | |
526 | 597 | // Mentions enabled |
527 | 598 | if (!empty($modSettings['mentions_enabled'])) |
528 | - echo ' |
|
599 | + { |
|
600 | + echo ' |
|
529 | 601 | add_elk_mention(\'#message\');'; |
602 | + } |
|
530 | 603 | |
531 | 604 | echo ' |
532 | 605 | </script>'; |
@@ -567,18 +640,21 @@ discard block |
||
567 | 640 | |
568 | 641 | // Spell check for quick modify and quick reply (w/o the editor) |
569 | 642 | if ($context['show_spellchecking'] && empty($options['use_editor_quick_reply'])) |
570 | - echo ' |
|
643 | + { |
|
644 | + echo ' |
|
571 | 645 | <form name="spell_form" id="spell_form" method="post" accept-charset="UTF-8" target="spellWindow" action="', $scripturl, '?action=spellcheck"> |
572 | 646 | <input type="hidden" id="spellstring" name="spellstring" value="" /> |
573 | 647 | <input type="hidden" id="fulleditor" name="fulleditor" value="" /> |
574 | 648 | </form>'; |
649 | + } |
|
575 | 650 | |
576 | 651 | // Quick moderation options |
577 | 652 | echo ' |
578 | 653 | <script>'; |
579 | 654 | |
580 | 655 | if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $context['can_remove_post']) |
581 | - echo ' |
|
656 | + { |
|
657 | + echo ' |
|
582 | 658 | var oInTopicModeration = new InTopicModeration({ |
583 | 659 | sSelf: \'oInTopicModeration\', |
584 | 660 | sCheckboxContainerMask: \'in_topic_mod_check_\', |
@@ -603,6 +679,7 @@ discard block |
||
603 | 679 | sSplitButtonConfirm: \'', $txt['quickmod_confirm'], '\', |
604 | 680 | sFormId: \'quickModForm\' |
605 | 681 | });'; |
682 | + } |
|
606 | 683 | |
607 | 684 | // Quick modify can be used |
608 | 685 | echo ' |
@@ -665,8 +742,10 @@ discard block |
||
665 | 742 | });'; |
666 | 743 | |
667 | 744 | if (!empty($ignoredMsgs)) |
668 | - echo ' |
|
745 | + { |
|
746 | + echo ' |
|
669 | 747 | ignore_toggles([', implode(', ', $ignoredMsgs), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');'; |
748 | + } |
|
670 | 749 | |
671 | 750 | echo ' |
672 | 751 | </script>'; |
@@ -703,9 +782,11 @@ discard block |
||
703 | 782 | <dd class="statsbar">'; |
704 | 783 | |
705 | 784 | if ($context['allow_poll_view']) |
706 | - echo ' |
|
785 | + { |
|
786 | + echo ' |
|
707 | 787 | ', $option['bar_ndt'], ' |
708 | 788 | <span class="righttext poll-percent">[ ', $option['votes'], ' ] (', $option['percent'], '%)</span>'; |
789 | + } |
|
709 | 790 | |
710 | 791 | echo ' |
711 | 792 | </dd>'; |
@@ -715,10 +796,12 @@ discard block |
||
715 | 796 | </dl>'; |
716 | 797 | |
717 | 798 | if ($context['allow_poll_view']) |
718 | - echo ' |
|
799 | + { |
|
800 | + echo ' |
|
719 | 801 | <p> |
720 | 802 | <strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], ' |
721 | 803 | </p>'; |
804 | + } |
|
722 | 805 | } |
723 | 806 | // They are allowed to vote! Go to it! |
724 | 807 | else |
@@ -728,16 +811,20 @@ discard block |
||
728 | 811 | |
729 | 812 | // Show a warning if they are allowed more than one option. |
730 | 813 | if ($context['poll']['allowed_warning']) |
731 | - echo ' |
|
814 | + { |
|
815 | + echo ' |
|
732 | 816 | <p>', $context['poll']['allowed_warning'], '</p>'; |
817 | + } |
|
733 | 818 | |
734 | 819 | echo ' |
735 | 820 | <ul class="options">'; |
736 | 821 | |
737 | 822 | // Show each option with its button - a radio likely. |
738 | 823 | foreach ($context['poll']['options'] as $option) |
739 | - echo ' |
|
824 | + { |
|
825 | + echo ' |
|
740 | 826 | <li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>'; |
827 | + } |
|
741 | 828 | |
742 | 829 | echo ' |
743 | 830 | </ul> |
@@ -750,10 +837,12 @@ discard block |
||
750 | 837 | |
751 | 838 | // Is the clock ticking? |
752 | 839 | if (!empty($context['poll']['expire_time'])) |
753 | - echo ' |
|
840 | + { |
|
841 | + echo ' |
|
754 | 842 | <p> |
755 | 843 | <strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], ' |
756 | 844 | </p>'; |
845 | + } |
|
757 | 846 | |
758 | 847 | echo ' |
759 | 848 | </div> |
@@ -780,10 +869,12 @@ discard block |
||
780 | 869 | <ul>'; |
781 | 870 | |
782 | 871 | foreach ($context['linked_calendar_events'] as $event) |
783 | - echo ' |
|
872 | + { |
|
873 | + echo ' |
|
784 | 874 | <li> |
785 | 875 | ', ($event['can_edit'] ? '<a href="' . $event['modify_href'] . '"><i class="icon i-modify" title="' . $txt['modify'] . '"></i></a> ' : ''), '<strong>', $event['title'], '</strong>: ', $event['start_date'], ($event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : ''), ' |
786 | 876 | </li>'; |
877 | + } |
|
787 | 878 | |
788 | 879 | echo ' |
789 | 880 | </ul> |
@@ -873,8 +964,10 @@ discard block |
||
873 | 964 | <legend>', $txt['attach_awaiting_approve']; |
874 | 965 | |
875 | 966 | if ($context['can_approve']) |
876 | - echo ' |
|
967 | + { |
|
968 | + echo ' |
|
877 | 969 | <a class="linkbutton" href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>'; |
970 | + } |
|
878 | 971 | |
879 | 972 | echo ' |
880 | 973 | </legend>'; |
@@ -886,16 +979,21 @@ discard block |
||
886 | 979 | if ($attachment['is_image']) |
887 | 980 | { |
888 | 981 | if ($attachment['thumbnail']['has_thumb']) |
889 | - echo ' |
|
982 | + { |
|
983 | + echo ' |
|
890 | 984 | <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" ', $attachment['thumbnail']['lightbox'], '> |
891 | 985 | <img class="attachment_image" src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" loading="lazy" /> |
892 | 986 | </a>'; |
893 | - else |
|
894 | - echo ' |
|
987 | + } |
|
988 | + else { |
|
989 | + echo ' |
|
895 | 990 | <img class="attachment_image" src="', $attachment['href'], ';image" alt="" style="max-width:100%; max-height:' . $attachment['height'] . 'px;" loading="lazy" />'; |
991 | + } |
|
896 | 992 | } |
897 | 993 | elseif (!empty($modSettings['attachmentShowImages'])) |
898 | - echo ' <img class="attachment_image" src="', $attachment['href'], ';thumb" alt="" style="max-width:' . $modSettings['attachmentThumbWidth'] . 'px; max-height:' . $modSettings['attachmentThumbHeight'] . 'px;" loading="lazy" />'; |
|
994 | + { |
|
995 | + echo ' <img class="attachment_image" src="', $attachment['href'], ';thumb" alt="" style="max-width:' . $modSettings['attachmentThumbWidth'] . 'px; max-height:' . $modSettings['attachmentThumbHeight'] . 'px;" loading="lazy" />'; |
|
996 | + } |
|
899 | 997 | |
900 | 998 | echo ' |
901 | 999 | <a href="', $attachment['href'], '" class="attachment_name"> |
@@ -904,8 +1002,10 @@ discard block |
||
904 | 1002 | <span class="attachment_details">', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . sprintf($txt['attach_viewed'], $attachment['downloads']) : ' ' . sprintf($txt['attach_downloaded'], $attachment['downloads'])) . '</span>'; |
905 | 1003 | |
906 | 1004 | if (!$attachment['is_approved'] && $context['can_approve']) |
907 | - echo ' |
|
1005 | + { |
|
1006 | + echo ' |
|
908 | 1007 | <a class="linkbutton" href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a> | <a class="linkbutton" href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>'; |
1008 | + } |
|
909 | 1009 | |
910 | 1010 | echo ' |
911 | 1011 | </div>'; |
@@ -913,8 +1013,10 @@ discard block |
||
913 | 1013 | |
914 | 1014 | // If we had unapproved attachments clean up. |
915 | 1015 | if ($last_approved_state == 0) |
916 | - echo ' |
|
1016 | + { |
|
1017 | + echo ' |
|
917 | 1018 | </fieldset>'; |
1019 | + } |
|
918 | 1020 | |
919 | 1021 | echo ' |
920 | 1022 | </footer>'; |
@@ -92,27 +92,42 @@ discard block |
||
92 | 92 | if (strpos($query, 'DATE_SUB') !== false) |
93 | 93 | { |
94 | 94 | if (!empty($modSettings['badbehavior_logging'])) |
95 | - $query = 'DELETE FROM {db_prefix}log_badbehavior WHERE date < ' . (bb2_db_date() - 7 * 86400); |
|
96 | - else |
|
97 | - return true; |
|
95 | + { |
|
96 | + $query = 'DELETE FROM {db_prefix}log_badbehavior WHERE date < ' . (bb2_db_date() - 7 * 86400); |
|
97 | + } |
|
98 | + else { |
|
99 | + return true; |
|
100 | + } |
|
98 | 101 | } |
99 | 102 | |
100 | 103 | if (strpos($query, 'OPTIMIZE TABLE') !== false) |
101 | - return true; |
|
104 | + { |
|
105 | + return true; |
|
106 | + } |
|
102 | 107 | elseif (strpos($query, '@@session.wait_timeout') !== false) |
103 | - return true; |
|
108 | + { |
|
109 | + return true; |
|
110 | + } |
|
104 | 111 | elseif (empty($query)) |
105 | - return true; |
|
112 | + { |
|
113 | + return true; |
|
114 | + } |
|
106 | 115 | |
107 | 116 | // Run the query, return success, failure or the actual results |
108 | 117 | $result = $db->query('', $query, array()); |
109 | 118 | |
110 | 119 | if (!$result) |
111 | - return false; |
|
120 | + { |
|
121 | + return false; |
|
122 | + } |
|
112 | 123 | elseif ($result === true) |
113 | - return (bb2_db_affected_rows() !== 0); |
|
124 | + { |
|
125 | + return (bb2_db_affected_rows() !== 0); |
|
126 | + } |
|
114 | 127 | elseif (bb2_db_num_rows($result) === 0) |
115 | - return false; |
|
128 | + { |
|
129 | + return false; |
|
130 | + } |
|
116 | 131 | |
117 | 132 | return bb2_db_rows($result); |
118 | 133 | } |
@@ -131,7 +146,9 @@ discard block |
||
131 | 146 | |
132 | 147 | $temp = array(); |
133 | 148 | while ($row = $db->fetch_assoc($result)) |
134 | - $temp[] = $row; |
|
149 | + { |
|
150 | + $temp[] = $row; |
|
151 | + } |
|
135 | 152 | $db->free_result($result); |
136 | 153 | |
137 | 154 | return $temp; |
@@ -164,7 +181,9 @@ discard block |
||
164 | 181 | |
165 | 182 | // Logging not enabled |
166 | 183 | if (!$settings['logging']) |
167 | - return ''; |
|
184 | + { |
|
185 | + return ''; |
|
186 | + } |
|
168 | 187 | |
169 | 188 | // Clean the data that bb sent us |
170 | 189 | $ip = bb2_db_escape(substr($package['ip'], 0, 19)); |
@@ -204,11 +223,15 @@ discard block |
||
204 | 223 | foreach ($package['request_entity'] as $h => $v) |
205 | 224 | { |
206 | 225 | if (is_array($v)) |
207 | - $v = bb2_multi_implode($v, ' | ', true); |
|
226 | + { |
|
227 | + $v = bb2_multi_implode($v, ' | ', true); |
|
228 | + } |
|
208 | 229 | |
209 | 230 | $v = trim($v); |
210 | 231 | if ($v !== '') |
211 | - $request_entity .= bb2_db_escape("$h: $v\n"); |
|
232 | + { |
|
233 | + $request_entity .= bb2_db_escape("$h: $v\n"); |
|
234 | + } |
|
212 | 235 | } |
213 | 236 | |
214 | 237 | // Only such much space in this column, so brutally cut it |
@@ -221,7 +244,9 @@ discard block |
||
221 | 244 | { |
222 | 245 | $$id = trim($$id); |
223 | 246 | while (preg_match('~[\'\\\\]$~', substr($$id, -1)) === 1) |
224 | - $$id = trim(substr($$id, 0, -1)); |
|
247 | + { |
|
248 | + $$id = trim(substr($$id, 0, -1)); |
|
249 | + } |
|
225 | 250 | |
226 | 251 | $$id = str_replace("'", '_', $$id); |
227 | 252 | } |
@@ -247,16 +272,22 @@ discard block |
||
247 | 272 | function bb2_multi_implode($array, $glue = ',', $trim_all = false) |
248 | 273 | { |
249 | 274 | if (!is_array($array)) |
250 | - $array = array($array); |
|
275 | + { |
|
276 | + $array = array($array); |
|
277 | + } |
|
251 | 278 | |
252 | 279 | foreach ($array as $key => $value) |
253 | 280 | { |
254 | 281 | if (is_array($value)) |
255 | - $array[$key] = bb2_multi_implode($value, $glue, $trim_all); |
|
282 | + { |
|
283 | + $array[$key] = bb2_multi_implode($value, $glue, $trim_all); |
|
284 | + } |
|
256 | 285 | } |
257 | 286 | |
258 | 287 | if ($trim_all) |
259 | - $array = array_map('trim', $array); |
|
288 | + { |
|
289 | + $array = array_map('trim', $array); |
|
290 | + } |
|
260 | 291 | |
261 | 292 | return implode($glue, $array); |
262 | 293 | } |
@@ -285,7 +316,9 @@ discard block |
||
285 | 316 | |
286 | 317 | // Nothing in the whitelist |
287 | 318 | if (empty($whitelist['badbehavior_ip_wl']) && empty($whitelist['badbehavior_useragent_wl']) && empty($whitelist['badbehavior_url_wl'])) |
288 | - return false; |
|
319 | + { |
|
320 | + return false; |
|
321 | + } |
|
289 | 322 | |
290 | 323 | // Build up the whitelist array so badbehavior can use it |
291 | 324 | return array_merge( |
@@ -309,7 +342,9 @@ discard block |
||
309 | 342 | |
310 | 343 | // Make sure that the proxy addresses are split into an array, and if it's empty - make sure reverse proxy is disabled |
311 | 344 | if (!empty($modSettings['badbehavior_reverse_proxy_addresses'])) |
312 | - $badbehavior_reverse_proxy_addresses = explode('|', trim($modSettings['badbehavior_reverse_proxy_addresses'])); |
|
345 | + { |
|
346 | + $badbehavior_reverse_proxy_addresses = explode('|', trim($modSettings['badbehavior_reverse_proxy_addresses'])); |
|
347 | + } |
|
313 | 348 | else |
314 | 349 | { |
315 | 350 | $badbehavior_reverse_proxy_addresses = array(); |
@@ -346,7 +381,9 @@ discard block |
||
346 | 381 | global $bb2_javascript; |
347 | 382 | |
348 | 383 | if (empty($bb2_javascript)) |
349 | - return ''; |
|
384 | + { |
|
385 | + return ''; |
|
386 | + } |
|
350 | 387 | |
351 | 388 | // Prepare it so we can use addInlineJavascript by removing the script tags hats its pre wrapped in |
352 | 389 | $temp = str_replace('<script type="text/javascript">' . "\n" . '<!--' . "\n", '', $bb2_javascript); |
@@ -380,7 +417,9 @@ discard block |
||
380 | 417 | } |
381 | 418 | |
382 | 419 | if ($bb2_blocked !== false) |
383 | - return sprintf($txt['badbehavior_blocked'], $bb2_blocked[0]['COUNT(*)']); |
|
420 | + { |
|
421 | + return sprintf($txt['badbehavior_blocked'], $bb2_blocked[0]['COUNT(*)']); |
|
422 | + } |
|
384 | 423 | } |
385 | 424 | } |
386 | 425 |
@@ -60,7 +60,9 @@ discard block |
||
60 | 60 | // If the maillist function is on then so is the enhanced digest |
61 | 61 | $maillist = !empty($modSettings['maillist_enabled']) && !empty($modSettings['maillist_digest_enabled']); |
62 | 62 | if ($maillist) |
63 | - require_once(SUBSDIR . '/Emailpost.subs.php'); |
|
63 | + { |
|
64 | + require_once(SUBSDIR . '/Emailpost.subs.php'); |
|
65 | + } |
|
64 | 66 | |
65 | 67 | $is_weekly = !empty($is_weekly) ? 1 : 0; |
66 | 68 | |
@@ -101,21 +103,28 @@ discard block |
||
101 | 103 | // Store this useful data! |
102 | 104 | $boards[$row['id_board']] = $row['id_board']; |
103 | 105 | if ($row['id_topic']) |
104 | - $notify['topics'][$row['id_topic']][] = $row['id_member']; |
|
105 | - else |
|
106 | - $notify['boards'][$row['id_board']][] = $row['id_member']; |
|
106 | + { |
|
107 | + $notify['topics'][$row['id_topic']][] = $row['id_member']; |
|
108 | + } |
|
109 | + else { |
|
110 | + $notify['boards'][$row['id_board']][] = $row['id_member']; |
|
111 | + } |
|
107 | 112 | } |
108 | 113 | $db->free_result($request); |
109 | 114 | |
110 | 115 | if (empty($boards)) |
111 | - return true; |
|
116 | + { |
|
117 | + return true; |
|
118 | + } |
|
112 | 119 | |
113 | 120 | // Just get the board names. |
114 | 121 | require_once(SUBSDIR . '/Boards.subs.php'); |
115 | 122 | $boards = fetchBoardsInfo(array('boards' => $boards), array('override_permissions' => true)); |
116 | 123 | |
117 | 124 | if (empty($boards)) |
118 | - return true; |
|
125 | + { |
|
126 | + return true; |
|
127 | + } |
|
119 | 128 | |
120 | 129 | // Get the actual topics... |
121 | 130 | $request = $db->query('', ' |
@@ -141,11 +150,13 @@ discard block |
||
141 | 150 | while ($row = $db->fetch_assoc($request)) |
142 | 151 | { |
143 | 152 | if (!isset($types[$row['note_type']][$row['id_board']])) |
144 | - $types[$row['note_type']][$row['id_board']] = array( |
|
153 | + { |
|
154 | + $types[$row['note_type']][$row['id_board']] = array( |
|
145 | 155 | 'lines' => array(), |
146 | 156 | 'name' => un_htmlspecialchars($row['board_name']), |
147 | 157 | 'id' => $row['id_board'], |
148 | 158 | ); |
159 | + } |
|
149 | 160 | |
150 | 161 | // A reply has been made |
151 | 162 | if ($row['note_type'] === 'reply') |
@@ -188,12 +199,14 @@ discard block |
||
188 | 199 | |
189 | 200 | // Topics are simple since we are only concerned with the first post |
190 | 201 | if (!isset($types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']])) |
191 | - $types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']] = array( |
|
202 | + { |
|
203 | + $types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']] = array( |
|
192 | 204 | 'id' => $row['id_topic'], |
193 | 205 | 'link' => $scripturl . '?topic=' . $row['id_topic'] . '.new;topicseen#new', |
194 | 206 | 'subject' => un_htmlspecialchars($row['subject']), |
195 | 207 | 'body' => $row['body'], |
196 | 208 | ); |
209 | + } |
|
197 | 210 | } |
198 | 211 | elseif ($maillist && empty($modSettings['pbe_no_mod_notices'])) |
199 | 212 | { |
@@ -210,15 +223,21 @@ discard block |
||
210 | 223 | $types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'] = array(); |
211 | 224 | |
212 | 225 | if (!empty($notify['topics'][$row['id_topic']])) |
213 | - $types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'] = array_merge($types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'], $notify['topics'][$row['id_topic']]); |
|
226 | + { |
|
227 | + $types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'] = array_merge($types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'], $notify['topics'][$row['id_topic']]); |
|
228 | + } |
|
214 | 229 | |
215 | 230 | if (!empty($notify['boards'][$row['id_board']])) |
216 | - $types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'] = array_merge($types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'], $notify['boards'][$row['id_board']]); |
|
231 | + { |
|
232 | + $types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'] = array_merge($types[$row['note_type']][$row['id_board']]['lines'][$row['id_topic']]['members'], $notify['boards'][$row['id_board']]); |
|
233 | + } |
|
217 | 234 | } |
218 | 235 | $db->free_result($request); |
219 | 236 | |
220 | 237 | if (empty($types)) |
221 | - return true; |
|
238 | + { |
|
239 | + return true; |
|
240 | + } |
|
222 | 241 | |
223 | 242 | // Fix the last reply message so its suitable for previewing |
224 | 243 | if ($maillist && !empty($types['reply'])) |
@@ -305,13 +324,17 @@ discard block |
||
305 | 324 | |
306 | 325 | $email['body'] .= "\n" . sprintf($langtxt[$lang]['topic_lines'], $topic['subject'], $board['name']); |
307 | 326 | if ($maillist) |
308 | - $email['body'] .= $langtxt[$lang]['preview'] . $topic['body'] . $langtxt[$lang]['see_full'] . $topic['link'] . "\n"; |
|
327 | + { |
|
328 | + $email['body'] .= $langtxt[$lang]['preview'] . $topic['body'] . $langtxt[$lang]['see_full'] . $topic['link'] . "\n"; |
|
329 | + } |
|
309 | 330 | } |
310 | 331 | } |
311 | 332 | } |
312 | 333 | |
313 | 334 | if ($titled) |
314 | - $email['body'] .= "\n"; |
|
335 | + { |
|
336 | + $email['body'] .= "\n"; |
|
337 | + } |
|
315 | 338 | } |
316 | 339 | |
317 | 340 | // What about replies? |
@@ -336,13 +359,17 @@ discard block |
||
336 | 359 | |
337 | 360 | $email['body'] .= "\n" . ($topic['count'] === 1 ? sprintf($langtxt[$lang]['replies_one'], $topic['subject']) : sprintf($langtxt[$lang]['replies_many'], $topic['count'], $topic['subject'])); |
338 | 361 | if ($maillist) |
339 | - $email['body'] .= $langtxt[$lang]['reply_preview'] . $topic['body'] . $langtxt[$lang]['unread_reply_link'] . $topic['link'] . "\n"; |
|
362 | + { |
|
363 | + $email['body'] .= $langtxt[$lang]['reply_preview'] . $topic['body'] . $langtxt[$lang]['unread_reply_link'] . $topic['link'] . "\n"; |
|
364 | + } |
|
340 | 365 | } |
341 | 366 | } |
342 | 367 | } |
343 | 368 | |
344 | 369 | if ($titled) |
345 | - $email['body'] .= "\n"; |
|
370 | + { |
|
371 | + $email['body'] .= "\n"; |
|
372 | + } |
|
346 | 373 | } |
347 | 374 | |
348 | 375 | // Finally, moderation actions! |
@@ -350,7 +377,9 @@ discard block |
||
350 | 377 | foreach ($types as $note_type => $type) |
351 | 378 | { |
352 | 379 | if ($note_type === 'topic' || $note_type === 'reply') |
353 | - continue; |
|
380 | + { |
|
381 | + continue; |
|
382 | + } |
|
354 | 383 | |
355 | 384 | foreach ($type as $id => $board) |
356 | 385 | { |
@@ -371,7 +400,9 @@ discard block |
||
371 | 400 | } |
372 | 401 | |
373 | 402 | if ($titled) |
374 | - $email['body'] .= "\n"; |
|
403 | + { |
|
404 | + $email['body'] .= "\n"; |
|
405 | + } |
|
375 | 406 | |
376 | 407 | // Then just say our goodbyes! |
377 | 408 | $email['body'] .= "\n\n" . $langtxt[$lang]['bye']; |
@@ -382,7 +413,9 @@ discard block |
||
382 | 413 | |
383 | 414 | // Using the queue, do a final flush before we say that's all folks |
384 | 415 | if (!empty($modSettings['mail_queue'])) |
385 | - AddMailQueue(true); |
|
416 | + { |
|
417 | + AddMailQueue(true); |
|
418 | + } |
|
386 | 419 | |
387 | 420 | // Clean up... |
388 | 421 | if ($is_weekly) |
@@ -127,10 +127,14 @@ discard block |
||
127 | 127 | { |
128 | 128 | // If its not an array, make it one |
129 | 129 | if (!is_array($tags)) |
130 | - $tags = array($tags); |
|
130 | + { |
|
131 | + $tags = array($tags); |
|
132 | + } |
|
131 | 133 | |
132 | 134 | if (!empty($tags)) |
133 | - $this->_skip_tags = $tags; |
|
135 | + { |
|
136 | + $this->_skip_tags = $tags; |
|
137 | + } |
|
134 | 138 | } |
135 | 139 | |
136 | 140 | /** |
@@ -142,10 +146,14 @@ discard block |
||
142 | 146 | { |
143 | 147 | // If its not an array, make it one |
144 | 148 | if (!is_array($styles)) |
145 | - $styles = array($styles); |
|
149 | + { |
|
150 | + $styles = array($styles); |
|
151 | + } |
|
146 | 152 | |
147 | 153 | if (!empty($styles)) |
148 | - $this->_skip_style = $styles; |
|
154 | + { |
|
155 | + $this->_skip_style = $styles; |
|
156 | + } |
|
149 | 157 | } |
150 | 158 | |
151 | 159 | /** |
@@ -168,7 +176,9 @@ discard block |
||
168 | 176 | { |
169 | 177 | // Using the internal DOM methods we need to do a little extra work |
170 | 178 | if (preg_match('~<body.*?>(.*)</body>~s', $bbc, $body)) |
171 | - $bbc = $body[1]; |
|
179 | + { |
|
180 | + $bbc = $body[1]; |
|
181 | + } |
|
172 | 182 | } |
173 | 183 | |
174 | 184 | // Remove comment blocks |
@@ -198,9 +208,12 @@ discard block |
||
198 | 208 | |
199 | 209 | // Strip can return nothing due to an error |
200 | 210 | if (empty($working)) |
201 | - $parts[$i] = $part; |
|
202 | - else |
|
203 | - $parts[$i] = htmlspecialchars_decode($working); |
|
211 | + { |
|
212 | + $parts[$i] = $part; |
|
213 | + } |
|
214 | + else { |
|
215 | + $parts[$i] = htmlspecialchars_decode($working); |
|
216 | + } |
|
204 | 217 | } |
205 | 218 | } |
206 | 219 | $bbc = implode('', $parts); |
@@ -222,12 +235,16 @@ discard block |
||
222 | 235 | while ($parent) |
223 | 236 | { |
224 | 237 | if (is_null($parent)) |
225 | - return false; |
|
238 | + { |
|
239 | + return false; |
|
240 | + } |
|
226 | 241 | |
227 | 242 | // Anywhere nested inside a code block we don't render tags |
228 | 243 | $tag = $parser ? $parent->nodeName : $parent->nodeName(); |
229 | 244 | if ($tag === 'code') |
230 | - return true; |
|
245 | + { |
|
246 | + return true; |
|
247 | + } |
|
231 | 248 | |
232 | 249 | // Back out another level, until we are done |
233 | 250 | $parent = $parser ? $parent->parentNode : $parent->parentNode(); |
@@ -244,7 +261,9 @@ discard block |
||
244 | 261 | private function _convert_childNodes($node) |
245 | 262 | { |
246 | 263 | if (empty($node) || self::_has_parent_code($node, $this->_parser)) |
247 | - return; |
|
264 | + { |
|
265 | + return; |
|
266 | + } |
|
248 | 267 | |
249 | 268 | // Keep traversing till we are at the base of this node |
250 | 269 | if ($node->hasChildNodes()) |
@@ -467,9 +486,12 @@ discard block |
||
467 | 486 | $value = $this->_get_value($node); |
468 | 487 | |
469 | 488 | if (!empty($title)) |
470 | - $bbc = '[abbr=' . $title . ']' . $value . '[/abbr]'; |
|
471 | - else |
|
472 | - $bbc = ''; |
|
489 | + { |
|
490 | + $bbc = '[abbr=' . $title . ']' . $value . '[/abbr]'; |
|
491 | + } |
|
492 | + else { |
|
493 | + $bbc = ''; |
|
494 | + } |
|
473 | 495 | |
474 | 496 | return $bbc; |
475 | 497 | } |
@@ -492,29 +514,42 @@ discard block |
||
492 | 514 | |
493 | 515 | // An anchor link |
494 | 516 | if (empty($href) && !empty($id)) |
495 | - $bbc = '[anchor=' . $id . ']' . $value . '[/anchor]'; |
|
517 | + { |
|
518 | + $bbc = '[anchor=' . $id . ']' . $value . '[/anchor]'; |
|
519 | + } |
|
496 | 520 | elseif (!empty($href) && $href[0] === '#') |
497 | - $bbc = '[url=' . $href . ']' . $value . '[/url]'; |
|
521 | + { |
|
522 | + $bbc = '[url=' . $href . ']' . $value . '[/url]'; |
|
523 | + } |
|
498 | 524 | // Maybe an email link |
499 | 525 | elseif (substr($href, 0, 7) === 'mailto:') |
500 | 526 | { |
501 | 527 | if ($href != 'mailto:' . (isset($modSettings['maillist_sitename_address']) ? $modSettings['maillist_sitename_address'] : '')) |
502 | - $href = substr($href, 7); |
|
503 | - else |
|
504 | - $href = ''; |
|
528 | + { |
|
529 | + $href = substr($href, 7); |
|
530 | + } |
|
531 | + else { |
|
532 | + $href = ''; |
|
533 | + } |
|
505 | 534 | |
506 | 535 | if (!empty($value)) |
507 | - $bbc = '[email=' . $href . ']' . $value . '[/email]'; |
|
508 | - else |
|
509 | - $bbc = '[email]' . $href . '[/email]'; |
|
536 | + { |
|
537 | + $bbc = '[email=' . $href . ']' . $value . '[/email]'; |
|
538 | + } |
|
539 | + else { |
|
540 | + $bbc = '[email]' . $href . '[/email]'; |
|
541 | + } |
|
510 | 542 | } |
511 | 543 | // FTP |
512 | 544 | elseif (substr($href, 0, 6) === 'ftp://') |
513 | 545 | { |
514 | 546 | if (!empty($value)) |
515 | - $bbc = '[ftp=' . $href . ']' . $value . '[/ftp]'; |
|
516 | - else |
|
517 | - $bbc = '[ftp]' . $href . '[/ftp]'; |
|
547 | + { |
|
548 | + $bbc = '[ftp=' . $href . ']' . $value . '[/ftp]'; |
|
549 | + } |
|
550 | + else { |
|
551 | + $bbc = '[ftp]' . $href . '[/ftp]'; |
|
552 | + } |
|
518 | 553 | } |
519 | 554 | // Oh a link then |
520 | 555 | else |
@@ -525,15 +560,21 @@ discard block |
||
525 | 560 | $baseURL = (isset($parsedURL['scheme']) ? $parsedURL['scheme'] : 'http') . '://' . $parsedURL['host'] . (empty($parsedURL['port']) ? '' : ':' . $parsedURL['port']); |
526 | 561 | |
527 | 562 | if (substr($href, 0, 1) === '/') |
528 | - $href = $baseURL . $href; |
|
529 | - else |
|
530 | - $href = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $href; |
|
563 | + { |
|
564 | + $href = $baseURL . $href; |
|
565 | + } |
|
566 | + else { |
|
567 | + $href = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $href; |
|
568 | + } |
|
531 | 569 | } |
532 | 570 | |
533 | 571 | if (!empty($value)) |
534 | - $bbc = '[url=' . $href . ']' . $value . '[/url]'; |
|
535 | - else |
|
536 | - $bbc = '[url]' . $href . '[/url]'; |
|
572 | + { |
|
573 | + $bbc = '[url=' . $href . ']' . $value . '[/url]'; |
|
574 | + } |
|
575 | + else { |
|
576 | + $bbc = '[url]' . $href . '[/url]'; |
|
577 | + } |
|
537 | 578 | } |
538 | 579 | |
539 | 580 | return $bbc; |
@@ -555,7 +596,9 @@ discard block |
||
555 | 596 | $value = $this->_get_value($node); |
556 | 597 | |
557 | 598 | if ($dir == 'rtl' || $dir == 'ltr') |
558 | - $bbc = '[bdo=' . $dir . ']' . $value . '[/bdo]'; |
|
599 | + { |
|
600 | + $bbc = '[bdo=' . $dir . ']' . $value . '[/bdo]'; |
|
601 | + } |
|
559 | 602 | |
560 | 603 | return $bbc; |
561 | 604 | } |
@@ -583,13 +626,19 @@ discard block |
||
583 | 626 | |
584 | 627 | // Remove any leading and trailing blank lines |
585 | 628 | if (empty($first_line)) |
586 | - array_shift($lines); |
|
629 | + { |
|
630 | + array_shift($lines); |
|
631 | + } |
|
587 | 632 | if (empty($last_line)) |
588 | - array_pop($lines); |
|
633 | + { |
|
634 | + array_pop($lines); |
|
635 | + } |
|
589 | 636 | |
590 | 637 | // Convert what remains |
591 | 638 | foreach ($lines as $line) |
592 | - $bbc .= $line . $this->line_end; |
|
639 | + { |
|
640 | + $bbc .= $line . $this->line_end; |
|
641 | + } |
|
593 | 642 | |
594 | 643 | $bbc = rtrim($bbc, $this->line_end); |
595 | 644 | } |
@@ -627,9 +676,13 @@ discard block |
||
627 | 676 | $blocks[0] = '[size=' . $size . ']' . $blocks[0] . '[/size]'; |
628 | 677 | } |
629 | 678 | if (!empty($face)) |
630 | - $blocks[0] = '[font=' . strtolower($face) . ']' . $blocks[0] . '[/font]'; |
|
679 | + { |
|
680 | + $blocks[0] = '[font=' . strtolower($face) . ']' . $blocks[0] . '[/font]'; |
|
681 | + } |
|
631 | 682 | if (!empty($color)) |
632 | - $blocks[0] = '[color=' . strtolower($color) . ']' . $blocks[0] . '[/color]'; |
|
683 | + { |
|
684 | + $blocks[0] = '[color=' . strtolower($color) . ']' . $blocks[0] . '[/color]'; |
|
685 | + } |
|
633 | 686 | |
634 | 687 | return implode('', $blocks); |
635 | 688 | } |
@@ -680,11 +733,16 @@ discard block |
||
680 | 733 | |
681 | 734 | // Do the basic things first, title/alt |
682 | 735 | if (!empty($title) && empty($alt)) |
683 | - $bbc = '[img alt=' . $title . ']' . $src . '[/img]'; |
|
736 | + { |
|
737 | + $bbc = '[img alt=' . $title . ']' . $src . '[/img]'; |
|
738 | + } |
|
684 | 739 | elseif (!empty($alt)) |
685 | - $bbc = '[img alt=' . $alt . ']' . $src . '[/img]'; |
|
686 | - else |
|
687 | - $bbc = '[img]' . $src . '[/img]'; |
|
740 | + { |
|
741 | + $bbc = '[img alt=' . $alt . ']' . $src . '[/img]'; |
|
742 | + } |
|
743 | + else { |
|
744 | + $bbc = '[img]' . $src . '[/img]'; |
|
745 | + } |
|
688 | 746 | |
689 | 747 | // If the tag has a style attribute |
690 | 748 | if (!empty($style)) |
@@ -709,14 +767,20 @@ discard block |
||
709 | 767 | if (empty($size)) |
710 | 768 | { |
711 | 769 | if (!empty($width)) |
712 | - $size .= 'width=' . $width . ' '; |
|
770 | + { |
|
771 | + $size .= 'width=' . $width . ' '; |
|
772 | + } |
|
713 | 773 | |
714 | 774 | if (!empty($height)) |
715 | - $size .= 'height=' . $height; |
|
775 | + { |
|
776 | + $size .= 'height=' . $height; |
|
777 | + } |
|
716 | 778 | } |
717 | 779 | |
718 | 780 | if (!empty($size)) |
719 | - $bbc = str_replace('[img', '[img ' . trim($size), $bbc); |
|
781 | + { |
|
782 | + $bbc = str_replace('[img', '[img ' . trim($size), $bbc); |
|
783 | + } |
|
720 | 784 | |
721 | 785 | return $bbc; |
722 | 786 | } |
@@ -752,7 +816,9 @@ discard block |
||
752 | 816 | { |
753 | 817 | // Skip any inline styles as needed |
754 | 818 | if (in_array($tag, $this->_skip_style)) |
755 | - continue; |
|
819 | + { |
|
820 | + continue; |
|
821 | + } |
|
756 | 822 | |
757 | 823 | // Well this can be as long, complete and exhaustive as we want :P |
758 | 824 | switch ($tag) |
@@ -760,27 +826,39 @@ discard block |
||
760 | 826 | case 'font-family': |
761 | 827 | // Only get the first font if there's a list |
762 | 828 | if (strpos($value, ',') !== false) |
763 | - $value = substr($value, 0, strpos($value, ',')); |
|
829 | + { |
|
830 | + $value = substr($value, 0, strpos($value, ',')); |
|
831 | + } |
|
764 | 832 | $bbc = '[font=' . strtr($value, array("'" => '')) . ']' . $bbc . '[/font]'; |
765 | 833 | break; |
766 | 834 | case 'font-weight': |
767 | 835 | if ($value === 'bold' || $value === 'bolder' || $value == '700' || $value == '600') |
768 | - $bbc = '[b]' . $bbc . '[/b]'; |
|
836 | + { |
|
837 | + $bbc = '[b]' . $bbc . '[/b]'; |
|
838 | + } |
|
769 | 839 | break; |
770 | 840 | case 'font-style': |
771 | 841 | if ($value == 'italic') |
772 | - $bbc = '[i]' . $bbc . '[/i]'; |
|
842 | + { |
|
843 | + $bbc = '[i]' . $bbc . '[/i]'; |
|
844 | + } |
|
773 | 845 | break; |
774 | 846 | case 'text-decoration': |
775 | 847 | if ($value == 'underline') |
776 | - $bbc = '[u]' . $bbc . '[/u]'; |
|
848 | + { |
|
849 | + $bbc = '[u]' . $bbc . '[/u]'; |
|
850 | + } |
|
777 | 851 | elseif ($value == 'line-through') |
778 | - $bbc = '[s]' . $bbc . '[/s]'; |
|
852 | + { |
|
853 | + $bbc = '[s]' . $bbc . '[/s]'; |
|
854 | + } |
|
779 | 855 | break; |
780 | 856 | case 'font-size': |
781 | 857 | // Account for formatting issues, decimal in the wrong spot |
782 | 858 | if (preg_match('~(\d+)\.\d+(p[xt])~i', $value, $dec_matches) === 1) |
783 | - $value = $dec_matches[1] . $dec_matches[2]; |
|
859 | + { |
|
860 | + $value = $dec_matches[1] . $dec_matches[2]; |
|
861 | + } |
|
784 | 862 | $bbc = '[size=' . $value . ']' . $bbc . '[/size]'; |
785 | 863 | break; |
786 | 864 | case 'color': |
@@ -791,11 +869,17 @@ discard block |
||
791 | 869 | case 'text-align': |
792 | 870 | case 'align': |
793 | 871 | if ($value === 'right') |
794 | - $bbc = '[right]' . $value . '[/right]'; |
|
872 | + { |
|
873 | + $bbc = '[right]' . $value . '[/right]'; |
|
874 | + } |
|
795 | 875 | elseif ($value === 'left') |
796 | - $bbc = '[left]' . $value . '[/left]'; |
|
876 | + { |
|
877 | + $bbc = '[left]' . $value . '[/left]'; |
|
878 | + } |
|
797 | 879 | elseif ($value === 'center') |
798 | - $bbc = '[center]' . $value . '[/center]'; |
|
880 | + { |
|
881 | + $bbc = '[center]' . $value . '[/center]'; |
|
882 | + } |
|
799 | 883 | break; |
800 | 884 | } |
801 | 885 | } |
@@ -824,11 +908,17 @@ discard block |
||
824 | 908 | { |
825 | 909 | $align = trim($align, '"'); |
826 | 910 | if ($align === 'right') |
827 | - $value = '[right]' . $value . '[/right]'; |
|
911 | + { |
|
912 | + $value = '[right]' . $value . '[/right]'; |
|
913 | + } |
|
828 | 914 | elseif ($align === 'left') |
829 | - $value = '[left]' . $value . '[/left]'; |
|
915 | + { |
|
916 | + $value = '[left]' . $value . '[/left]'; |
|
917 | + } |
|
830 | 918 | elseif ($align === 'center') |
831 | - $value = '[center]' . $value . '[/center]'; |
|
919 | + { |
|
920 | + $value = '[center]' . $value . '[/center]'; |
|
921 | + } |
|
832 | 922 | } |
833 | 923 | |
834 | 924 | // And are we spanning more than one col here? |
@@ -848,12 +938,17 @@ discard block |
||
848 | 938 | private function _get_value($node) |
849 | 939 | { |
850 | 940 | if ($node === null) |
851 | - return ''; |
|
941 | + { |
|
942 | + return ''; |
|
943 | + } |
|
852 | 944 | |
853 | 945 | if ($this->_parser) |
854 | - return $node->nodeValue; |
|
855 | - else |
|
856 | - return $node->innertext; |
|
946 | + { |
|
947 | + return $node->nodeValue; |
|
948 | + } |
|
949 | + else { |
|
950 | + return $node->innertext; |
|
951 | + } |
|
857 | 952 | } |
858 | 953 | |
859 | 954 | /** |
@@ -864,12 +959,17 @@ discard block |
||
864 | 959 | private function _get_name($node) |
865 | 960 | { |
866 | 961 | if ($node === null) |
867 | - return ''; |
|
962 | + { |
|
963 | + return ''; |
|
964 | + } |
|
868 | 965 | |
869 | 966 | if ($this->_parser) |
870 | - return $node->nodeName; |
|
871 | - else |
|
872 | - return $node->nodeName(); |
|
967 | + { |
|
968 | + return $node->nodeName; |
|
969 | + } |
|
970 | + else { |
|
971 | + return $node->nodeName(); |
|
972 | + } |
|
873 | 973 | } |
874 | 974 | |
875 | 975 | /** |
@@ -889,8 +989,9 @@ discard block |
||
889 | 989 | |
890 | 990 | return preg_replace('@^<' . $tag . '[^>]*>|</' . $tag . '>$@', '', $html); |
891 | 991 | } |
892 | - else |
|
893 | - return $node->innertext; |
|
992 | + else { |
|
993 | + return $node->innertext; |
|
994 | + } |
|
894 | 995 | } |
895 | 996 | |
896 | 997 | /** |
@@ -903,7 +1004,9 @@ discard block |
||
903 | 1004 | if ($this->_parser) |
904 | 1005 | { |
905 | 1006 | if (version_compare(PHP_VERSION, '5.3.6') >= 0) |
906 | - return $this->doc->saveHTML($node); |
|
1007 | + { |
|
1008 | + return $this->doc->saveHTML($node); |
|
1009 | + } |
|
907 | 1010 | else |
908 | 1011 | { |
909 | 1012 | // @todo remove when 5.3.6 min |
@@ -913,16 +1016,21 @@ discard block |
||
913 | 1016 | |
914 | 1017 | // We just want the html of the inserted node, it *may* be wrapped |
915 | 1018 | if (preg_match('~<body>(.*)</body>~s', $html, $body)) |
916 | - $html = $body[1]; |
|
1019 | + { |
|
1020 | + $html = $body[1]; |
|
1021 | + } |
|
917 | 1022 | elseif (preg_match('~<html>(.*)</html>~s', $html, $body)) |
918 | - $html = $body[1]; |
|
1023 | + { |
|
1024 | + $html = $body[1]; |
|
1025 | + } |
|
919 | 1026 | |
920 | 1027 | // Clean it up |
921 | 1028 | return rtrim($html, "\n"); |
922 | 1029 | } |
923 | 1030 | } |
924 | - else |
|
925 | - return $node->outertext; |
|
1031 | + else { |
|
1032 | + return $node->outertext; |
|
1033 | + } |
|
926 | 1034 | } |
927 | 1035 | |
928 | 1036 | /** |