@@ -3096,8 +3096,7 @@ |
||
3096 | 3096 | <div class="roundframe"> |
3097 | 3097 | <div> |
3098 | 3098 | ', !empty($context['tfa_backup']) ? ' |
3099 | - <div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' : |
|
3100 | - ($modSettings['tfa_mode'] == 2 ? ' |
|
3099 | + <div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' : ($modSettings['tfa_mode'] == 2 ? ' |
|
3101 | 3100 | <div class="smalltext"><strong>' . $txt['tfa_forced_desc'] . '</strong></div>' : ''), ' |
3102 | 3101 | <div class="smalltext">', $txt['tfa_desc'], '</div> |
3103 | 3102 | <div class="floatleft"> |
@@ -18,23 +18,25 @@ discard block |
||
18 | 18 | global $context; |
19 | 19 | |
20 | 20 | // Prevent Chrome from auto completing fields when viewing/editing other members profiles |
21 | - if (isBrowser('is_chrome') && !$context['user']['is_owner']) |
|
22 | - echo ' |
|
21 | + if (isBrowser('is_chrome') && !$context['user']['is_owner']) { |
|
22 | + echo ' |
|
23 | 23 | <script> |
24 | 24 | disableAutoComplete(); |
25 | 25 | </script>'; |
26 | + } |
|
26 | 27 | |
27 | 28 | // If an error occurred while trying to save previously, give the user a clue! |
28 | 29 | echo ' |
29 | 30 | ', template_error_message(); |
30 | 31 | |
31 | 32 | // If the profile was update successfully, let the user know this. |
32 | - if (!empty($context['profile_updated'])) |
|
33 | - echo ' |
|
33 | + if (!empty($context['profile_updated'])) { |
|
34 | + echo ' |
|
34 | 35 | <div class="infobox"> |
35 | 36 | ', $context['profile_updated'], ' |
36 | 37 | </div>'; |
37 | -} |
|
38 | + } |
|
39 | + } |
|
38 | 40 | |
39 | 41 | /** |
40 | 42 | * Template for any HTML needed below the profile (closing off divs/tables, etc.) |
@@ -99,19 +101,19 @@ discard block |
||
99 | 101 | </div> |
100 | 102 | <div class="alerts_unread">'; |
101 | 103 | |
102 | - if (empty($context['unread_alerts'])) |
|
103 | - template_alerts_all_read(); |
|
104 | - |
|
105 | - else |
|
104 | + if (empty($context['unread_alerts'])) { |
|
105 | + template_alerts_all_read(); |
|
106 | + } else |
|
106 | 107 | { |
107 | - foreach ($context['unread_alerts'] as $id_alert => $details) |
|
108 | - echo ' |
|
108 | + foreach ($context['unread_alerts'] as $id_alert => $details) { |
|
109 | + echo ' |
|
109 | 110 | <div class="unread"> |
110 | 111 | ', !empty($details['sender']) ? $details['sender']['avatar']['image'] : '', ' |
111 | 112 | <div class="details"> |
112 | 113 | ', !empty($details['icon']) ? $details['icon'] : '', '<span>', $details['text'], '</span> - ', $details['time'], ' |
113 | 114 | </div> |
114 | 115 | </div>'; |
116 | + } |
|
115 | 117 | } |
116 | 118 | |
117 | 119 | echo ' |
@@ -161,10 +163,11 @@ discard block |
||
161 | 163 | <div class="custom_fields_above_name"> |
162 | 164 | <ul>'; |
163 | 165 | |
164 | - foreach ($context['print_custom_fields']['above_member'] as $field) |
|
165 | - if (!empty($field['output_html'])) |
|
166 | + foreach ($context['print_custom_fields']['above_member'] as $field) { |
|
167 | + if (!empty($field['output_html'])) |
|
166 | 168 | echo ' |
167 | 169 | <li>', $field['output_html'], '</li>'; |
170 | + } |
|
168 | 171 | |
169 | 172 | echo ' |
170 | 173 | </ul> |
@@ -176,20 +179,22 @@ discard block |
||
176 | 179 | <div class="username clear"> |
177 | 180 | <h4>'; |
178 | 181 | |
179 | - if (!empty($context['print_custom_fields']['before_member'])) |
|
180 | - foreach ($context['print_custom_fields']['before_member'] as $field) |
|
182 | + if (!empty($context['print_custom_fields']['before_member'])) { |
|
183 | + foreach ($context['print_custom_fields']['before_member'] as $field) |
|
181 | 184 | if (!empty($field['output_html'])) |
182 | 185 | echo ' |
183 | 186 | <span>', $field['output_html'], '</span>'; |
187 | + } |
|
184 | 188 | |
185 | 189 | echo ' |
186 | 190 | ', $context['member']['name']; |
187 | 191 | |
188 | - if (!empty($context['print_custom_fields']['after_member'])) |
|
189 | - foreach ($context['print_custom_fields']['after_member'] as $field) |
|
192 | + if (!empty($context['print_custom_fields']['after_member'])) { |
|
193 | + foreach ($context['print_custom_fields']['after_member'] as $field) |
|
190 | 194 | if (!empty($field['output_html'])) |
191 | 195 | echo ' |
192 | 196 | <span>', $field['output_html'], '</span>'; |
197 | + } |
|
193 | 198 | |
194 | 199 | |
195 | 200 | echo ' |
@@ -205,10 +210,11 @@ discard block |
||
205 | 210 | <div class="custom_fields_below_avatar"> |
206 | 211 | <ul>'; |
207 | 212 | |
208 | - foreach ($context['print_custom_fields']['below_avatar'] as $field) |
|
209 | - if (!empty($field['output_html'])) |
|
213 | + foreach ($context['print_custom_fields']['below_avatar'] as $field) { |
|
214 | + if (!empty($field['output_html'])) |
|
210 | 215 | echo ' |
211 | 216 | <li>', $field['output_html'], '</li>'; |
217 | + } |
|
212 | 218 | |
213 | 219 | echo ' |
214 | 220 | </ul> |
@@ -220,22 +226,25 @@ discard block |
||
220 | 226 | <ul class="clear">'; |
221 | 227 | |
222 | 228 | // Email is only visible if it's your profile or you have the moderate_forum permission |
223 | - if ($context['member']['show_email']) |
|
224 | - echo ' |
|
229 | + if ($context['member']['show_email']) { |
|
230 | + echo ' |
|
225 | 231 | <li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>'; |
232 | + } |
|
226 | 233 | |
227 | 234 | // Don't show an icon if they haven't specified a website. |
228 | - if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) |
|
229 | - echo ' |
|
235 | + if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) { |
|
236 | + echo ' |
|
230 | 237 | <li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
238 | + } |
|
231 | 239 | |
232 | 240 | // Are there any custom profile fields as icons? |
233 | 241 | if (!empty($context['print_custom_fields']['icons'])) |
234 | 242 | { |
235 | - foreach ($context['print_custom_fields']['icons'] as $field) |
|
236 | - if (!empty($field['output_html'])) |
|
243 | + foreach ($context['print_custom_fields']['icons'] as $field) { |
|
244 | + if (!empty($field['output_html'])) |
|
237 | 245 | echo ' |
238 | 246 | <li class="custom_field">', $field['output_html'], '</li>'; |
247 | + } |
|
239 | 248 | } |
240 | 249 | |
241 | 250 | echo ' |
@@ -244,24 +253,27 @@ discard block |
||
244 | 253 | ', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['text'] . '" rel="nofollow">' : '', $settings['use_image_buttons'] ? '<span class="' . ($context['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $context['member']['online']['text'] . '"></span>' : $context['member']['online']['label'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['label'] . '</span>' : ''; |
245 | 254 | |
246 | 255 | // Can they add this member as a buddy? |
247 | - if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) |
|
248 | - echo ' |
|
256 | + if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) { |
|
257 | + echo ' |
|
249 | 258 | <br> |
250 | 259 | <a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a>'; |
260 | + } |
|
251 | 261 | |
252 | 262 | echo ' |
253 | 263 | </span>'; |
254 | 264 | |
255 | - if (!$context['user']['is_owner'] && $context['can_send_pm']) |
|
256 | - echo ' |
|
265 | + if (!$context['user']['is_owner'] && $context['can_send_pm']) { |
|
266 | + echo ' |
|
257 | 267 | <a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>'; |
268 | + } |
|
258 | 269 | |
259 | 270 | echo ' |
260 | 271 | <a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>'; |
261 | 272 | |
262 | - if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) |
|
263 | - echo ' |
|
273 | + if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) { |
|
274 | + echo ' |
|
264 | 275 | <a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>'; |
276 | + } |
|
265 | 277 | |
266 | 278 | echo ' |
267 | 279 | <a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>'; |
@@ -273,10 +285,11 @@ discard block |
||
273 | 285 | <div class="custom_fields_bottom"> |
274 | 286 | <ul class="nolist">'; |
275 | 287 | |
276 | - foreach ($context['print_custom_fields']['bottom_poster'] as $field) |
|
277 | - if (!empty($field['output_html'])) |
|
288 | + foreach ($context['print_custom_fields']['bottom_poster'] as $field) { |
|
289 | + if (!empty($field['output_html'])) |
|
278 | 290 | echo ' |
279 | 291 | <li>', $field['output_html'], '</li>'; |
292 | + } |
|
280 | 293 | |
281 | 294 | echo ' |
282 | 295 | </ul> |
@@ -289,30 +302,35 @@ discard block |
||
289 | 302 | <div id="detailedinfo"> |
290 | 303 | <dl class="settings">'; |
291 | 304 | |
292 | - if ($context['user']['is_owner'] || $context['user']['is_admin']) |
|
293 | - echo ' |
|
305 | + if ($context['user']['is_owner'] || $context['user']['is_admin']) { |
|
306 | + echo ' |
|
294 | 307 | <dt>', $txt['username'], ': </dt> |
295 | 308 | <dd>', $context['member']['username'], '</dd>'; |
309 | + } |
|
296 | 310 | |
297 | - if (!isset($context['disabled_fields']['posts'])) |
|
298 | - echo ' |
|
311 | + if (!isset($context['disabled_fields']['posts'])) { |
|
312 | + echo ' |
|
299 | 313 | <dt>', $txt['profile_posts'], ': </dt> |
300 | 314 | <dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>'; |
315 | + } |
|
301 | 316 | |
302 | - if ($context['member']['show_email']) |
|
303 | - echo ' |
|
317 | + if ($context['member']['show_email']) { |
|
318 | + echo ' |
|
304 | 319 | <dt>', $txt['email'], ': </dt> |
305 | 320 | <dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>'; |
321 | + } |
|
306 | 322 | |
307 | - if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) |
|
308 | - echo ' |
|
323 | + if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) { |
|
324 | + echo ' |
|
309 | 325 | <dt>', $txt['custom_title'], ': </dt> |
310 | 326 | <dd>', $context['member']['title'], '</dd>'; |
327 | + } |
|
311 | 328 | |
312 | - if (!empty($context['member']['blurb'])) |
|
313 | - echo ' |
|
329 | + if (!empty($context['member']['blurb'])) { |
|
330 | + echo ' |
|
314 | 331 | <dt>', $txt['personal_text'], ': </dt> |
315 | 332 | <dd>', $context['member']['blurb'], '</dd>'; |
333 | + } |
|
316 | 334 | |
317 | 335 | echo ' |
318 | 336 | <dt>', $txt['age'], ':</dt> |
@@ -326,19 +344,21 @@ discard block |
||
326 | 344 | { |
327 | 345 | $fields = array(); |
328 | 346 | |
329 | - foreach ($context['print_custom_fields']['standard'] as $field) |
|
330 | - if (!empty($field['output_html'])) |
|
347 | + foreach ($context['print_custom_fields']['standard'] as $field) { |
|
348 | + if (!empty($field['output_html'])) |
|
331 | 349 | $fields[] = $field; |
350 | + } |
|
332 | 351 | |
333 | 352 | if (count($fields) > 0) |
334 | 353 | { |
335 | 354 | echo ' |
336 | 355 | <dl class="settings">'; |
337 | 356 | |
338 | - foreach ($fields as $field) |
|
339 | - echo ' |
|
357 | + foreach ($fields as $field) { |
|
358 | + echo ' |
|
340 | 359 | <dt>', $field['name'], ':</dt> |
341 | 360 | <dd>', $field['output_html'], '</dd>'; |
361 | + } |
|
342 | 362 | |
343 | 363 | echo ' |
344 | 364 | </dl>'; |
@@ -358,9 +378,10 @@ discard block |
||
358 | 378 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>'; |
359 | 379 | |
360 | 380 | // Can we provide information on what this means? |
361 | - if (!empty($context['warning_status'])) |
|
362 | - echo ' |
|
381 | + if (!empty($context['warning_status'])) { |
|
382 | + echo ' |
|
363 | 383 | <span class="smalltext">(', $context['warning_status'], ')</span>'; |
384 | + } |
|
364 | 385 | |
365 | 386 | echo ' |
366 | 387 | </dd>'; |
@@ -371,11 +392,12 @@ discard block |
||
371 | 392 | { |
372 | 393 | |
373 | 394 | // If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves. |
374 | - if (!empty($context['activate_message'])) |
|
375 | - echo ' |
|
395 | + if (!empty($context['activate_message'])) { |
|
396 | + echo ' |
|
376 | 397 | <dt class="clear"> |
377 | 398 | <span class="alert">', $context['activate_message'], '</span> (<a href="', $context['activate_link'], '"', ($context['activate_type'] == 4 ? ' class="you_sure" data-confirm="' . $txt['profileConfirm'] . '"' : ''), '>', $context['activate_link_text'], '</a>) |
378 | 399 | </dt>'; |
400 | + } |
|
379 | 401 | |
380 | 402 | // If the current member is banned, show a message and possibly a link to the ban. |
381 | 403 | if (!empty($context['member']['bans'])) |
@@ -387,10 +409,11 @@ discard block |
||
387 | 409 | <dt class="clear" id="ban_info" style="display: none;"> |
388 | 410 | <strong>', $txt['user_banned_by_following'], ':</strong>'; |
389 | 411 | |
390 | - foreach ($context['member']['bans'] as $ban) |
|
391 | - echo ' |
|
412 | + foreach ($context['member']['bans'] as $ban) { |
|
413 | + echo ' |
|
392 | 414 | <br> |
393 | 415 | <span class="smalltext">', $ban['explanation'], '</span>'; |
416 | + } |
|
394 | 417 | |
395 | 418 | echo ' |
396 | 419 | </dt>'; |
@@ -404,30 +427,34 @@ discard block |
||
404 | 427 | // If the person looking is allowed, they can check the members IP address and hostname. |
405 | 428 | if ($context['can_see_ip']) |
406 | 429 | { |
407 | - if (!empty($context['member']['ip'])) |
|
408 | - echo ' |
|
430 | + if (!empty($context['member']['ip'])) { |
|
431 | + echo ' |
|
409 | 432 | <dt>', $txt['ip'], ': </dt> |
410 | 433 | <dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>'; |
434 | + } |
|
411 | 435 | |
412 | - if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) |
|
413 | - echo ' |
|
436 | + if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) { |
|
437 | + echo ' |
|
414 | 438 | <dt>', $txt['hostname'], ': </dt> |
415 | 439 | <dd>', $context['member']['hostname'], '</dd>'; |
440 | + } |
|
416 | 441 | } |
417 | 442 | |
418 | 443 | echo ' |
419 | 444 | <dt>', $txt['local_time'], ':</dt> |
420 | 445 | <dd>', $context['member']['local_time'], '</dd>'; |
421 | 446 | |
422 | - if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) |
|
423 | - echo ' |
|
447 | + if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) { |
|
448 | + echo ' |
|
424 | 449 | <dt>', $txt['language'], ':</dt> |
425 | 450 | <dd>', $context['member']['language'], '</dd>'; |
451 | + } |
|
426 | 452 | |
427 | - if ($context['member']['show_last_login']) |
|
428 | - echo ' |
|
453 | + if ($context['member']['show_last_login']) { |
|
454 | + echo ' |
|
429 | 455 | <dt>', $txt['lastLoggedIn'], ': </dt> |
430 | 456 | <dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>'; |
457 | + } |
|
431 | 458 | |
432 | 459 | echo ' |
433 | 460 | </dl>'; |
@@ -439,10 +466,11 @@ discard block |
||
439 | 466 | <div class="custom_fields_above_signature"> |
440 | 467 | <ul class="nolist">'; |
441 | 468 | |
442 | - foreach ($context['print_custom_fields']['above_signature'] as $field) |
|
443 | - if (!empty($field['output_html'])) |
|
469 | + foreach ($context['print_custom_fields']['above_signature'] as $field) { |
|
470 | + if (!empty($field['output_html'])) |
|
444 | 471 | echo ' |
445 | 472 | <li>', $field['output_html'], '</li>'; |
473 | + } |
|
446 | 474 | |
447 | 475 | echo ' |
448 | 476 | </ul> |
@@ -450,12 +478,13 @@ discard block |
||
450 | 478 | } |
451 | 479 | |
452 | 480 | // Show the users signature. |
453 | - if ($context['signature_enabled'] && !empty($context['member']['signature'])) |
|
454 | - echo ' |
|
481 | + if ($context['signature_enabled'] && !empty($context['member']['signature'])) { |
|
482 | + echo ' |
|
455 | 483 | <div class="signature"> |
456 | 484 | <h5>', $txt['signature'], ':</h5> |
457 | 485 | ', $context['member']['signature'], ' |
458 | 486 | </div>'; |
487 | + } |
|
459 | 488 | |
460 | 489 | // Are there any custom profile fields for below the signature? |
461 | 490 | if (!empty($context['print_custom_fields']['below_signature'])) |
@@ -464,10 +493,11 @@ discard block |
||
464 | 493 | <div class="custom_fields_below_signature"> |
465 | 494 | <ul class="nolist">'; |
466 | 495 | |
467 | - foreach ($context['print_custom_fields']['below_signature'] as $field) |
|
468 | - if (!empty($field['output_html'])) |
|
496 | + foreach ($context['print_custom_fields']['below_signature'] as $field) { |
|
497 | + if (!empty($field['output_html'])) |
|
469 | 498 | echo ' |
470 | 499 | <li>', $field['output_html'], '</li>'; |
500 | + } |
|
471 | 501 | |
472 | 502 | echo ' |
473 | 503 | </ul> |
@@ -513,62 +543,70 @@ discard block |
||
513 | 543 | </div> |
514 | 544 | <div class="list_posts">'; |
515 | 545 | |
516 | - if (!$post['approved']) |
|
517 | - echo ' |
|
546 | + if (!$post['approved']) { |
|
547 | + echo ' |
|
518 | 548 | <div class="approve_post"> |
519 | 549 | <em>', $txt['post_awaiting_approval'], '</em> |
520 | 550 | </div>'; |
551 | + } |
|
521 | 552 | |
522 | 553 | echo ' |
523 | 554 | ', $post['body'], ' |
524 | 555 | </div>'; |
525 | 556 | |
526 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
527 | - echo ' |
|
557 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
558 | + echo ' |
|
528 | 559 | <div class="floatright"> |
529 | 560 | <ul class="quickbuttons">'; |
561 | + } |
|
530 | 562 | |
531 | 563 | // If they *can* reply? |
532 | - if ($post['can_reply']) |
|
533 | - echo ' |
|
564 | + if ($post['can_reply']) { |
|
565 | + echo ' |
|
534 | 566 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
567 | + } |
|
535 | 568 | |
536 | 569 | // If they *can* quote? |
537 | - if ($post['can_quote']) |
|
538 | - echo ' |
|
570 | + if ($post['can_quote']) { |
|
571 | + echo ' |
|
539 | 572 | <li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
573 | + } |
|
540 | 574 | |
541 | 575 | // How about... even... remove it entirely?! |
542 | - if ($post['can_delete']) |
|
543 | - echo ' |
|
576 | + if ($post['can_delete']) { |
|
577 | + echo ' |
|
544 | 578 | <li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
579 | + } |
|
545 | 580 | |
546 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
547 | - echo ' |
|
581 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
582 | + echo ' |
|
548 | 583 | </ul> |
549 | 584 | </div><!-- .floatright -->'; |
585 | + } |
|
550 | 586 | |
551 | 587 | echo ' |
552 | 588 | </div><!-- $post[css_class] -->'; |
553 | 589 | } |
590 | + } else { |
|
591 | + template_show_list('attachments'); |
|
554 | 592 | } |
555 | - else |
|
556 | - template_show_list('attachments'); |
|
557 | 593 | |
558 | 594 | // No posts? Just end with a informative message. |
559 | - if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) |
|
560 | - echo ' |
|
595 | + if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) { |
|
596 | + echo ' |
|
561 | 597 | <div class="windowbg2"> |
562 | 598 | ', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), ' |
563 | 599 | </div>'; |
600 | + } |
|
564 | 601 | |
565 | 602 | // Show more page numbers. |
566 | - if (!empty($context['page_index'])) |
|
567 | - echo ' |
|
603 | + if (!empty($context['page_index'])) { |
|
604 | + echo ' |
|
568 | 605 | <div class="pagesection"> |
569 | 606 | <div class="pagelinks">', $context['page_index'], '</div> |
570 | 607 | </div>'; |
571 | -} |
|
608 | + } |
|
609 | + } |
|
572 | 610 | |
573 | 611 | /** |
574 | 612 | * Template for showing alerts within the alerts popup |
@@ -578,11 +616,12 @@ discard block |
||
578 | 616 | global $context, $txt, $scripturl; |
579 | 617 | |
580 | 618 | // Do we have an update message? |
581 | - if (!empty($context['update_message'])) |
|
582 | - echo ' |
|
619 | + if (!empty($context['update_message'])) { |
|
620 | + echo ' |
|
583 | 621 | <div class="infobox"> |
584 | 622 | ', $context['update_message'], '. |
585 | 623 | </div>'; |
624 | + } |
|
586 | 625 | |
587 | 626 | echo ' |
588 | 627 | <div class="cat_bar"> |
@@ -591,13 +630,12 @@ discard block |
||
591 | 630 | </h3> |
592 | 631 | </div>'; |
593 | 632 | |
594 | - if (empty($context['alerts'])) |
|
595 | - echo ' |
|
633 | + if (empty($context['alerts'])) { |
|
634 | + echo ' |
|
596 | 635 | <div class="information"> |
597 | 636 | ', $txt['alerts_none'], ' |
598 | 637 | </div>'; |
599 | - |
|
600 | - else |
|
638 | + } else |
|
601 | 639 | { |
602 | 640 | // Start the form. |
603 | 641 | echo ' |
@@ -659,12 +697,12 @@ discard block |
||
659 | 697 | </div>' : ''; |
660 | 698 | |
661 | 699 | // No drafts? Just show an informative message. |
662 | - if (empty($context['drafts'])) |
|
663 | - echo ' |
|
700 | + if (empty($context['drafts'])) { |
|
701 | + echo ' |
|
664 | 702 | <div class="windowbg2 centertext"> |
665 | 703 | ', $txt['draft_none'], ' |
666 | 704 | </div>'; |
667 | - else |
|
705 | + } else |
|
668 | 706 | { |
669 | 707 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
670 | 708 | foreach ($context['drafts'] as $draft) |
@@ -676,13 +714,15 @@ discard block |
||
676 | 714 | <h5> |
677 | 715 | <strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> '; |
678 | 716 | |
679 | - if (!empty($draft['sticky'])) |
|
680 | - echo ' |
|
717 | + if (!empty($draft['sticky'])) { |
|
718 | + echo ' |
|
681 | 719 | <span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>'; |
720 | + } |
|
682 | 721 | |
683 | - if (!empty($draft['locked'])) |
|
684 | - echo ' |
|
722 | + if (!empty($draft['locked'])) { |
|
723 | + echo ' |
|
685 | 724 | <span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>'; |
725 | + } |
|
686 | 726 | |
687 | 727 | echo ' |
688 | 728 | </h5> |
@@ -715,13 +755,13 @@ discard block |
||
715 | 755 | { |
716 | 756 | global $context, $scripturl, $txt; |
717 | 757 | |
718 | - if (!empty($context['saved_successful'])) |
|
719 | - echo ' |
|
758 | + if (!empty($context['saved_successful'])) { |
|
759 | + echo ' |
|
720 | 760 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
721 | - |
|
722 | - elseif (!empty($context['saved_failed'])) |
|
723 | - echo ' |
|
761 | + } elseif (!empty($context['saved_failed'])) { |
|
762 | + echo ' |
|
724 | 763 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
764 | + } |
|
725 | 765 | |
726 | 766 | echo ' |
727 | 767 | <div id="edit_buddies"> |
@@ -736,14 +776,16 @@ discard block |
||
736 | 776 | <th scope="col" class="quarter_table">', $txt['name'], '</th> |
737 | 777 | <th scope="col">', $txt['status'], '</th>'; |
738 | 778 | |
739 | - if (allowedTo('moderate_forum')) |
|
740 | - echo ' |
|
779 | + if (allowedTo('moderate_forum')) { |
|
780 | + echo ' |
|
741 | 781 | <th scope="col">', $txt['email'], '</th>'; |
782 | + } |
|
742 | 783 | |
743 | - if (!empty($context['custom_pf'])) |
|
744 | - foreach ($context['custom_pf'] as $column) |
|
784 | + if (!empty($context['custom_pf'])) { |
|
785 | + foreach ($context['custom_pf'] as $column) |
|
745 | 786 | echo ' |
746 | 787 | <th scope="col">', $column['label'], '</th>'; |
788 | + } |
|
747 | 789 | |
748 | 790 | echo ' |
749 | 791 | <th scope="col">', $txt['remove'], '</th> |
@@ -752,13 +794,14 @@ discard block |
||
752 | 794 | <tbody>'; |
753 | 795 | |
754 | 796 | // If they don't have any buddies don't list them! |
755 | - if (empty($context['buddies'])) |
|
756 | - echo ' |
|
797 | + if (empty($context['buddies'])) { |
|
798 | + echo ' |
|
757 | 799 | <tr class="windowbg"> |
758 | 800 | <td colspan="', allowedTo('moderate_forum') ? '10' : '9', '"> |
759 | 801 | <strong>', $txt['no_buddies'], '</strong> |
760 | 802 | </td> |
761 | 803 | </tr>'; |
804 | + } |
|
762 | 805 | |
763 | 806 | // Now loop through each buddy showing info on each. |
764 | 807 | else |
@@ -772,17 +815,19 @@ discard block |
||
772 | 815 | <a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a> |
773 | 816 | </td>'; |
774 | 817 | |
775 | - if ($buddy['show_email']) |
|
776 | - echo ' |
|
818 | + if ($buddy['show_email']) { |
|
819 | + echo ' |
|
777 | 820 | <td> |
778 | 821 | <a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a> |
779 | 822 | </td>'; |
823 | + } |
|
780 | 824 | |
781 | 825 | // Show the custom profile fields for this user. |
782 | - if (!empty($context['custom_pf'])) |
|
783 | - foreach ($context['custom_pf'] as $key => $column) |
|
826 | + if (!empty($context['custom_pf'])) { |
|
827 | + foreach ($context['custom_pf'] as $key => $column) |
|
784 | 828 | echo ' |
785 | 829 | <td class="lefttext">', $buddy['options'][$key], '</td>'; |
830 | + } |
|
786 | 831 | |
787 | 832 | echo ' |
788 | 833 | <td> |
@@ -815,9 +860,10 @@ discard block |
||
815 | 860 | </dl> |
816 | 861 | </div>'; |
817 | 862 | |
818 | - if (!empty($context['token_check'])) |
|
819 | - echo ' |
|
863 | + if (!empty($context['token_check'])) { |
|
864 | + echo ' |
|
820 | 865 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
866 | + } |
|
821 | 867 | |
822 | 868 | echo ' |
823 | 869 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -843,13 +889,13 @@ discard block |
||
843 | 889 | { |
844 | 890 | global $context, $scripturl, $txt; |
845 | 891 | |
846 | - if (!empty($context['saved_successful'])) |
|
847 | - echo ' |
|
892 | + if (!empty($context['saved_successful'])) { |
|
893 | + echo ' |
|
848 | 894 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
849 | - |
|
850 | - elseif (!empty($context['saved_failed'])) |
|
851 | - echo ' |
|
895 | + } elseif (!empty($context['saved_failed'])) { |
|
896 | + echo ' |
|
852 | 897 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
898 | + } |
|
853 | 899 | |
854 | 900 | echo ' |
855 | 901 | <div id="edit_buddies"> |
@@ -864,9 +910,10 @@ discard block |
||
864 | 910 | <th scope="col" class="quarter_table">', $txt['name'], '</th> |
865 | 911 | <th scope="col">', $txt['status'], '</th>'; |
866 | 912 | |
867 | - if (allowedTo('moderate_forum')) |
|
868 | - echo ' |
|
913 | + if (allowedTo('moderate_forum')) { |
|
914 | + echo ' |
|
869 | 915 | <th scope="col">', $txt['email'], '</th>'; |
916 | + } |
|
870 | 917 | |
871 | 918 | echo ' |
872 | 919 | <th scope="col">', $txt['ignore_remove'], '</th> |
@@ -875,13 +922,14 @@ discard block |
||
875 | 922 | <tbody>'; |
876 | 923 | |
877 | 924 | // If they don't have anyone on their ignore list, don't list it! |
878 | - if (empty($context['ignore_list'])) |
|
879 | - echo ' |
|
925 | + if (empty($context['ignore_list'])) { |
|
926 | + echo ' |
|
880 | 927 | <tr class="windowbg"> |
881 | 928 | <td colspan="', allowedTo('moderate_forum') ? '4' : '3', '"> |
882 | 929 | <strong>', $txt['no_ignore'], '</strong> |
883 | 930 | </td> |
884 | 931 | </tr>'; |
932 | + } |
|
885 | 933 | |
886 | 934 | // Now loop through each buddy showing info on each. |
887 | 935 | foreach ($context['ignore_list'] as $member) |
@@ -893,11 +941,12 @@ discard block |
||
893 | 941 | <a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a> |
894 | 942 | </td>'; |
895 | 943 | |
896 | - if ($member['show_email']) |
|
897 | - echo ' |
|
944 | + if ($member['show_email']) { |
|
945 | + echo ' |
|
898 | 946 | <td> |
899 | 947 | <a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a> |
900 | 948 | </td>'; |
949 | + } |
|
901 | 950 | echo ' |
902 | 951 | <td> |
903 | 952 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['ignore_remove'], '"></span></a> |
@@ -927,9 +976,10 @@ discard block |
||
927 | 976 | </dl> |
928 | 977 | </div>'; |
929 | 978 | |
930 | - if (!empty($context['token_check'])) |
|
931 | - echo ' |
|
979 | + if (!empty($context['token_check'])) { |
|
980 | + echo ' |
|
932 | 981 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
982 | + } |
|
933 | 983 | |
934 | 984 | echo ' |
935 | 985 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -975,9 +1025,10 @@ discard block |
||
975 | 1025 | <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>'; |
976 | 1026 | |
977 | 1027 | // Second address detected? |
978 | - if (!empty($context['last_ip2'])) |
|
979 | - echo ' |
|
1028 | + if (!empty($context['last_ip2'])) { |
|
1029 | + echo ' |
|
980 | 1030 | , <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>'; |
1031 | + } |
|
981 | 1032 | |
982 | 1033 | echo ' |
983 | 1034 | </dd>'; |
@@ -1043,9 +1094,10 @@ discard block |
||
1043 | 1094 | </div> |
1044 | 1095 | <div class="windowbg2 noup">'; |
1045 | 1096 | |
1046 | - foreach ($context['whois_servers'] as $server) |
|
1047 | - echo ' |
|
1097 | + foreach ($context['whois_servers'] as $server) { |
|
1098 | + echo ' |
|
1048 | 1099 | <a href="', $server['url'], '" target="_blank"', isset($context['auto_whois_server']) && $context['auto_whois_server']['name'] == $server['name'] ? ' style="font-weight: bold;"' : '', '>', $server['name'], '</a><br>'; |
1100 | + } |
|
1049 | 1101 | echo ' |
1050 | 1102 | </div> |
1051 | 1103 | <br>'; |
@@ -1057,13 +1109,12 @@ discard block |
||
1057 | 1109 | <h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3> |
1058 | 1110 | </div>'; |
1059 | 1111 | |
1060 | - if (empty($context['ips'])) |
|
1061 | - echo ' |
|
1112 | + if (empty($context['ips'])) { |
|
1113 | + echo ' |
|
1062 | 1114 | <p class="windowbg2 description"> |
1063 | 1115 | <em>', $txt['no_members_from_ip'], '</em> |
1064 | 1116 | </p>'; |
1065 | - |
|
1066 | - else |
|
1117 | + } else |
|
1067 | 1118 | { |
1068 | 1119 | echo ' |
1069 | 1120 | <table class="table_grid"> |
@@ -1076,12 +1127,13 @@ discard block |
||
1076 | 1127 | <tbody>'; |
1077 | 1128 | |
1078 | 1129 | // Loop through each of the members and display them. |
1079 | - foreach ($context['ips'] as $ip => $memberlist) |
|
1080 | - echo ' |
|
1130 | + foreach ($context['ips'] as $ip => $memberlist) { |
|
1131 | + echo ' |
|
1081 | 1132 | <tr class="windowbg"> |
1082 | 1133 | <td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td> |
1083 | 1134 | <td>', implode(', ', $memberlist), '</td> |
1084 | 1135 | </tr>'; |
1136 | + } |
|
1085 | 1137 | |
1086 | 1138 | echo ' |
1087 | 1139 | </tbody> |
@@ -1123,11 +1175,10 @@ discard block |
||
1123 | 1175 | </h3> |
1124 | 1176 | </div>'; |
1125 | 1177 | |
1126 | - if ($context['member']['has_all_permissions']) |
|
1127 | - echo ' |
|
1178 | + if ($context['member']['has_all_permissions']) { |
|
1179 | + echo ' |
|
1128 | 1180 | <div class="information">', $txt['showPermissions_all'], '</div>'; |
1129 | - |
|
1130 | - else |
|
1181 | + } else |
|
1131 | 1182 | { |
1132 | 1183 | echo ' |
1133 | 1184 | <div class="information">',$txt['showPermissions_help'], '</div> |
@@ -1142,9 +1193,10 @@ discard block |
||
1142 | 1193 | <div class="windowbg smalltext"> |
1143 | 1194 | ', $txt['showPermissions_restricted_boards_desc'], ':<br>'; |
1144 | 1195 | |
1145 | - foreach ($context['no_access_boards'] as $no_access_board) |
|
1146 | - echo ' |
|
1196 | + foreach ($context['no_access_boards'] as $no_access_board) { |
|
1197 | + echo ' |
|
1147 | 1198 | <a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', '; |
1199 | + } |
|
1148 | 1200 | echo ' |
1149 | 1201 | </div>'; |
1150 | 1202 | } |
@@ -1176,12 +1228,13 @@ discard block |
||
1176 | 1228 | </td> |
1177 | 1229 | <td class="smalltext">'; |
1178 | 1230 | |
1179 | - if ($permission['is_denied']) |
|
1180 | - echo ' |
|
1231 | + if ($permission['is_denied']) { |
|
1232 | + echo ' |
|
1181 | 1233 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
1182 | - else |
|
1183 | - echo ' |
|
1234 | + } else { |
|
1235 | + echo ' |
|
1184 | 1236 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
1237 | + } |
|
1185 | 1238 | |
1186 | 1239 | echo ' |
1187 | 1240 | </td> |
@@ -1192,10 +1245,10 @@ discard block |
||
1192 | 1245 | </table> |
1193 | 1246 | </div><!-- .tborder --> |
1194 | 1247 | <br>'; |
1195 | - } |
|
1196 | - else |
|
1197 | - echo ' |
|
1248 | + } else { |
|
1249 | + echo ' |
|
1198 | 1250 | <p class="windowbg2">', $txt['showPermissions_none_general'], '</p>'; |
1251 | + } |
|
1199 | 1252 | |
1200 | 1253 | // Board permission section. |
1201 | 1254 | echo ' |
@@ -1206,14 +1259,16 @@ discard block |
||
1206 | 1259 | <select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();"> |
1207 | 1260 | <option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], '</option>'; |
1208 | 1261 | |
1209 | - if (!empty($context['boards'])) |
|
1210 | - echo ' |
|
1262 | + if (!empty($context['boards'])) { |
|
1263 | + echo ' |
|
1211 | 1264 | <option value="" disabled>---------------------------</option>'; |
1265 | + } |
|
1212 | 1266 | |
1213 | 1267 | // Fill the box with any local permission boards. |
1214 | - foreach ($context['boards'] as $board) |
|
1215 | - echo ' |
|
1268 | + foreach ($context['boards'] as $board) { |
|
1269 | + echo ' |
|
1216 | 1270 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>'; |
1271 | + } |
|
1217 | 1272 | |
1218 | 1273 | echo ' |
1219 | 1274 | </select> |
@@ -1242,13 +1297,13 @@ discard block |
||
1242 | 1297 | </td> |
1243 | 1298 | <td class="smalltext">'; |
1244 | 1299 | |
1245 | - if ($permission['is_denied']) |
|
1246 | - echo ' |
|
1300 | + if ($permission['is_denied']) { |
|
1301 | + echo ' |
|
1247 | 1302 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
1248 | - |
|
1249 | - else |
|
1250 | - echo ' |
|
1303 | + } else { |
|
1304 | + echo ' |
|
1251 | 1305 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
1306 | + } |
|
1252 | 1307 | |
1253 | 1308 | echo ' |
1254 | 1309 | </td> |
@@ -1257,10 +1312,10 @@ discard block |
||
1257 | 1312 | echo ' |
1258 | 1313 | </tbody> |
1259 | 1314 | </table>'; |
1260 | - } |
|
1261 | - else |
|
1262 | - echo ' |
|
1315 | + } else { |
|
1316 | + echo ' |
|
1263 | 1317 | <p class="windowbg2">', $txt['showPermissions_none_board'], '</p>'; |
1318 | + } |
|
1264 | 1319 | echo ' |
1265 | 1320 | </div><!-- #permissions -->'; |
1266 | 1321 | } |
@@ -1301,9 +1356,10 @@ discard block |
||
1301 | 1356 | </div>'; |
1302 | 1357 | |
1303 | 1358 | // If they haven't post at all, don't draw the graph. |
1304 | - if (empty($context['posts_by_time'])) |
|
1305 | - echo ' |
|
1359 | + if (empty($context['posts_by_time'])) { |
|
1360 | + echo ' |
|
1306 | 1361 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1362 | + } |
|
1307 | 1363 | |
1308 | 1364 | // Otherwise do! |
1309 | 1365 | else |
@@ -1312,8 +1368,8 @@ discard block |
||
1312 | 1368 | <ul class="activity_stats flow_hidden">'; |
1313 | 1369 | |
1314 | 1370 | // The labels. |
1315 | - foreach ($context['posts_by_time'] as $time_of_day) |
|
1316 | - echo ' |
|
1371 | + foreach ($context['posts_by_time'] as $time_of_day) { |
|
1372 | + echo ' |
|
1317 | 1373 | <li', $time_of_day['is_last'] ? ' class="last"' : '', '> |
1318 | 1374 | <div class="bar" style="padding-top: ', ((int) (100 - $time_of_day['relative_percent'])), 'px;" title="', sprintf($txt['statPanel_activityTime_posts'], $time_of_day['posts'], $time_of_day['posts_percent']), '"> |
1319 | 1375 | <div style="height: ', (int) $time_of_day['relative_percent'], 'px;"> |
@@ -1322,6 +1378,7 @@ discard block |
||
1322 | 1378 | </div> |
1323 | 1379 | <span class="stats_hour">', $time_of_day['hour_format'], '</span> |
1324 | 1380 | </li>'; |
1381 | + } |
|
1325 | 1382 | |
1326 | 1383 | echo ' |
1327 | 1384 | </ul>'; |
@@ -1340,11 +1397,10 @@ discard block |
||
1340 | 1397 | </h3> |
1341 | 1398 | </div>'; |
1342 | 1399 | |
1343 | - if (empty($context['popular_boards'])) |
|
1344 | - echo ' |
|
1400 | + if (empty($context['popular_boards'])) { |
|
1401 | + echo ' |
|
1345 | 1402 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1346 | - |
|
1347 | - else |
|
1403 | + } else |
|
1348 | 1404 | { |
1349 | 1405 | echo ' |
1350 | 1406 | <dl class="stats">'; |
@@ -1374,10 +1430,10 @@ discard block |
||
1374 | 1430 | </h3> |
1375 | 1431 | </div>'; |
1376 | 1432 | |
1377 | - if (empty($context['board_activity'])) |
|
1378 | - echo ' |
|
1433 | + if (empty($context['board_activity'])) { |
|
1434 | + echo ' |
|
1379 | 1435 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1380 | - else |
|
1436 | + } else |
|
1381 | 1437 | { |
1382 | 1438 | echo ' |
1383 | 1439 | <dl class="stats">'; |
@@ -1428,90 +1484,97 @@ discard block |
||
1428 | 1484 | <h3 class="catbg profile_hd">'; |
1429 | 1485 | |
1430 | 1486 | // Don't say "Profile" if this isn't the profile... |
1431 | - if (!empty($context['profile_header_text'])) |
|
1432 | - echo ' |
|
1487 | + if (!empty($context['profile_header_text'])) { |
|
1488 | + echo ' |
|
1433 | 1489 | ', $context['profile_header_text']; |
1434 | - else |
|
1435 | - echo ' |
|
1490 | + } else { |
|
1491 | + echo ' |
|
1436 | 1492 | ', $txt['profile']; |
1493 | + } |
|
1437 | 1494 | |
1438 | 1495 | echo ' |
1439 | 1496 | </h3> |
1440 | 1497 | </div>'; |
1441 | 1498 | |
1442 | 1499 | // Have we some description? |
1443 | - if ($context['page_desc']) |
|
1444 | - echo ' |
|
1500 | + if ($context['page_desc']) { |
|
1501 | + echo ' |
|
1445 | 1502 | <p class="information">', $context['page_desc'], '</p>'; |
1503 | + } |
|
1446 | 1504 | |
1447 | 1505 | echo ' |
1448 | 1506 | <div class="roundframe">'; |
1449 | 1507 | |
1450 | 1508 | // Any bits at the start? |
1451 | - if (!empty($context['profile_prehtml'])) |
|
1452 | - echo ' |
|
1509 | + if (!empty($context['profile_prehtml'])) { |
|
1510 | + echo ' |
|
1453 | 1511 | <div>', $context['profile_prehtml'], '</div>'; |
1512 | + } |
|
1454 | 1513 | |
1455 | - if (!empty($context['profile_fields'])) |
|
1456 | - echo ' |
|
1514 | + if (!empty($context['profile_fields'])) { |
|
1515 | + echo ' |
|
1457 | 1516 | <dl class="settings">'; |
1517 | + } |
|
1458 | 1518 | |
1459 | 1519 | // Start the big old loop 'of love. |
1460 | 1520 | $lastItem = 'hr'; |
1461 | 1521 | foreach ($context['profile_fields'] as $key => $field) |
1462 | 1522 | { |
1463 | 1523 | // We add a little hack to be sure we never get more than one hr in a row! |
1464 | - if ($lastItem == 'hr' && $field['type'] == 'hr') |
|
1465 | - continue; |
|
1524 | + if ($lastItem == 'hr' && $field['type'] == 'hr') { |
|
1525 | + continue; |
|
1526 | + } |
|
1466 | 1527 | |
1467 | 1528 | $lastItem = $field['type']; |
1468 | - if ($field['type'] == 'hr') |
|
1469 | - echo ' |
|
1529 | + if ($field['type'] == 'hr') { |
|
1530 | + echo ' |
|
1470 | 1531 | </dl> |
1471 | 1532 | <hr> |
1472 | 1533 | <dl class="settings">'; |
1473 | - |
|
1474 | - elseif ($field['type'] == 'callback') |
|
1534 | + } elseif ($field['type'] == 'callback') |
|
1475 | 1535 | { |
1476 | 1536 | if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func'])) |
1477 | 1537 | { |
1478 | 1538 | $callback_func = 'template_profile_' . $field['callback_func']; |
1479 | 1539 | $callback_func(); |
1480 | 1540 | } |
1481 | - } |
|
1482 | - else |
|
1541 | + } else |
|
1483 | 1542 | { |
1484 | 1543 | echo ' |
1485 | 1544 | <dt> |
1486 | 1545 | <strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>'; |
1487 | 1546 | |
1488 | 1547 | // Does it have any subtext to show? |
1489 | - if (!empty($field['subtext'])) |
|
1490 | - echo ' |
|
1548 | + if (!empty($field['subtext'])) { |
|
1549 | + echo ' |
|
1491 | 1550 | <br> |
1492 | 1551 | <span class="smalltext">', $field['subtext'], '</span>'; |
1552 | + } |
|
1493 | 1553 | |
1494 | 1554 | echo ' |
1495 | 1555 | </dt> |
1496 | 1556 | <dd>'; |
1497 | 1557 | |
1498 | 1558 | // Want to put something infront of the box? |
1499 | - if (!empty($field['preinput'])) |
|
1500 | - echo ' |
|
1559 | + if (!empty($field['preinput'])) { |
|
1560 | + echo ' |
|
1501 | 1561 | ', $field['preinput']; |
1562 | + } |
|
1502 | 1563 | |
1503 | 1564 | // What type of data are we showing? |
1504 | - if ($field['type'] == 'label') |
|
1505 | - echo ' |
|
1565 | + if ($field['type'] == 'label') { |
|
1566 | + echo ' |
|
1506 | 1567 | ', $field['value']; |
1568 | + } |
|
1507 | 1569 | |
1508 | 1570 | // Maybe it's a text box - very likely! |
1509 | 1571 | elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url'))) |
1510 | 1572 | { |
1511 | - if ($field['type'] == 'int' || $field['type'] == 'float') |
|
1512 | - $type = 'number'; |
|
1513 | - else |
|
1514 | - $type = $field['type']; |
|
1573 | + if ($field['type'] == 'int' || $field['type'] == 'float') { |
|
1574 | + $type = 'number'; |
|
1575 | + } else { |
|
1576 | + $type = $field['type']; |
|
1577 | + } |
|
1515 | 1578 | $step = $field['type'] == 'float' ? ' step="0.1"' : ''; |
1516 | 1579 | |
1517 | 1580 | |
@@ -1519,10 +1582,11 @@ discard block |
||
1519 | 1582 | <input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>'; |
1520 | 1583 | } |
1521 | 1584 | // You "checking" me out? ;) |
1522 | - elseif ($field['type'] == 'check') |
|
1523 | - echo ' |
|
1585 | + elseif ($field['type'] == 'check') { |
|
1586 | + echo ' |
|
1524 | 1587 | <input type="hidden" name="', $key, '" value="0"> |
1525 | 1588 | <input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>'; |
1589 | + } |
|
1526 | 1590 | |
1527 | 1591 | // Always fun - select boxes! |
1528 | 1592 | elseif ($field['type'] == 'select') |
@@ -1533,14 +1597,16 @@ discard block |
||
1533 | 1597 | if (isset($field['options'])) |
1534 | 1598 | { |
1535 | 1599 | // Is this some code to generate the options? |
1536 | - if (!is_array($field['options'])) |
|
1537 | - $field['options'] = $field['options'](); |
|
1600 | + if (!is_array($field['options'])) { |
|
1601 | + $field['options'] = $field['options'](); |
|
1602 | + } |
|
1538 | 1603 | |
1539 | 1604 | // Assuming we now have some! |
1540 | - if (is_array($field['options'])) |
|
1541 | - foreach ($field['options'] as $value => $name) |
|
1605 | + if (is_array($field['options'])) { |
|
1606 | + foreach ($field['options'] as $value => $name) |
|
1542 | 1607 | echo ' |
1543 | 1608 | <option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
1609 | + } |
|
1544 | 1610 | } |
1545 | 1611 | |
1546 | 1612 | echo ' |
@@ -1548,31 +1614,34 @@ discard block |
||
1548 | 1614 | } |
1549 | 1615 | |
1550 | 1616 | // Something to end with? |
1551 | - if (!empty($field['postinput'])) |
|
1552 | - echo ' |
|
1617 | + if (!empty($field['postinput'])) { |
|
1618 | + echo ' |
|
1553 | 1619 | ', $field['postinput']; |
1620 | + } |
|
1554 | 1621 | |
1555 | 1622 | echo ' |
1556 | 1623 | </dd>'; |
1557 | 1624 | } |
1558 | 1625 | } |
1559 | 1626 | |
1560 | - if (!empty($context['profile_fields'])) |
|
1561 | - echo ' |
|
1627 | + if (!empty($context['profile_fields'])) { |
|
1628 | + echo ' |
|
1562 | 1629 | </dl>'; |
1630 | + } |
|
1563 | 1631 | |
1564 | 1632 | // Are there any custom profile fields - if so print them! |
1565 | 1633 | if (!empty($context['custom_fields'])) |
1566 | 1634 | { |
1567 | - if ($lastItem != 'hr') |
|
1568 | - echo ' |
|
1635 | + if ($lastItem != 'hr') { |
|
1636 | + echo ' |
|
1569 | 1637 | <hr>'; |
1638 | + } |
|
1570 | 1639 | |
1571 | 1640 | echo ' |
1572 | 1641 | <dl class="settings">'; |
1573 | 1642 | |
1574 | - foreach ($context['custom_fields'] as $field) |
|
1575 | - echo ' |
|
1643 | + foreach ($context['custom_fields'] as $field) { |
|
1644 | + echo ' |
|
1576 | 1645 | <dt> |
1577 | 1646 | <strong>', $field['name'], ': </strong><br> |
1578 | 1647 | <span class="smalltext">', $field['desc'], '</span> |
@@ -1580,6 +1649,7 @@ discard block |
||
1580 | 1649 | <dd> |
1581 | 1650 | ', $field['input_html'], ' |
1582 | 1651 | </dd>'; |
1652 | + } |
|
1583 | 1653 | |
1584 | 1654 | echo ' |
1585 | 1655 | </dl>'; |
@@ -1587,13 +1657,14 @@ discard block |
||
1587 | 1657 | } |
1588 | 1658 | |
1589 | 1659 | // Any closing HTML? |
1590 | - if (!empty($context['profile_posthtml'])) |
|
1591 | - echo ' |
|
1660 | + if (!empty($context['profile_posthtml'])) { |
|
1661 | + echo ' |
|
1592 | 1662 | <div>', $context['profile_posthtml'], '</div>'; |
1663 | + } |
|
1593 | 1664 | |
1594 | 1665 | // Only show the password box if it's actually needed. |
1595 | - if ($context['require_password']) |
|
1596 | - echo ' |
|
1666 | + if ($context['require_password']) { |
|
1667 | + echo ' |
|
1597 | 1668 | <dl class="settings"> |
1598 | 1669 | <dt> |
1599 | 1670 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br> |
@@ -1603,18 +1674,21 @@ discard block |
||
1603 | 1674 | <input type="password" name="oldpasswrd" id="oldpasswrd" size="20"> |
1604 | 1675 | </dd> |
1605 | 1676 | </dl>'; |
1677 | + } |
|
1606 | 1678 | |
1607 | 1679 | // The button shouldn't say "Change profile" unless we're changing the profile... |
1608 | - if (!empty($context['submit_button_text'])) |
|
1609 | - echo ' |
|
1680 | + if (!empty($context['submit_button_text'])) { |
|
1681 | + echo ' |
|
1610 | 1682 | <input type="submit" name="save" value="', $context['submit_button_text'], '" class="button">'; |
1611 | - else |
|
1612 | - echo ' |
|
1683 | + } else { |
|
1684 | + echo ' |
|
1613 | 1685 | <input type="submit" name="save" value="', $txt['change_profile'], '" class="button">'; |
1686 | + } |
|
1614 | 1687 | |
1615 | - if (!empty($context['token_check'])) |
|
1616 | - echo ' |
|
1688 | + if (!empty($context['token_check'])) { |
|
1689 | + echo ' |
|
1617 | 1690 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
1691 | + } |
|
1618 | 1692 | |
1619 | 1693 | echo ' |
1620 | 1694 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1624,10 +1698,11 @@ discard block |
||
1624 | 1698 | </form>'; |
1625 | 1699 | |
1626 | 1700 | // Any final spellchecking stuff? |
1627 | - if (!empty($context['show_spellchecking'])) |
|
1628 | - echo ' |
|
1701 | + if (!empty($context['show_spellchecking'])) { |
|
1702 | + echo ' |
|
1629 | 1703 | <form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value=""></form>'; |
1630 | -} |
|
1704 | + } |
|
1705 | + } |
|
1631 | 1706 | |
1632 | 1707 | /** |
1633 | 1708 | * Personal Message settings. |
@@ -1664,10 +1739,11 @@ discard block |
||
1664 | 1739 | <select name="pm_receive_from" id="pm_receive_from"> |
1665 | 1740 | <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>'; |
1666 | 1741 | |
1667 | - if (!empty($modSettings['enable_buddylist'])) |
|
1668 | - echo ' |
|
1742 | + if (!empty($modSettings['enable_buddylist'])) { |
|
1743 | + echo ' |
|
1669 | 1744 | <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option> |
1670 | 1745 | <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>'; |
1746 | + } |
|
1671 | 1747 | |
1672 | 1748 | echo ' |
1673 | 1749 | <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option> |
@@ -1710,11 +1786,12 @@ discard block |
||
1710 | 1786 | if (empty($setting) || !is_array($setting)) |
1711 | 1787 | { |
1712 | 1788 | // Insert a separator (unless this is the first item in the list) |
1713 | - if ($i !== $first_option_key) |
|
1714 | - echo ' |
|
1789 | + if ($i !== $first_option_key) { |
|
1790 | + echo ' |
|
1715 | 1791 | </dl> |
1716 | 1792 | <hr> |
1717 | 1793 | <dl class="settings">'; |
1794 | + } |
|
1718 | 1795 | |
1719 | 1796 | // Should we give a name to this section? |
1720 | 1797 | if (is_string($setting) && !empty($setting)) |
@@ -1723,69 +1800,67 @@ discard block |
||
1723 | 1800 | echo ' |
1724 | 1801 | <dt><strong>' . $setting . '</strong></dt> |
1725 | 1802 | <dd></dd>'; |
1803 | + } else { |
|
1804 | + $titled_section = false; |
|
1726 | 1805 | } |
1727 | - else |
|
1728 | - $titled_section = false; |
|
1729 | 1806 | |
1730 | 1807 | continue; |
1731 | 1808 | } |
1732 | 1809 | |
1733 | 1810 | // Is this disabled? |
1734 | - if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) |
|
1735 | - continue; |
|
1736 | - |
|
1737 | - elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) |
|
1738 | - continue; |
|
1739 | - |
|
1740 | - elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) |
|
1741 | - continue; |
|
1742 | - |
|
1743 | - elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) |
|
1744 | - continue; |
|
1745 | - |
|
1746 | - elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) |
|
1747 | - continue; |
|
1748 | - |
|
1749 | - elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
|
1750 | - continue; |
|
1751 | - |
|
1752 | - elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
|
1753 | - continue; |
|
1811 | + if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) { |
|
1812 | + continue; |
|
1813 | + } elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) { |
|
1814 | + continue; |
|
1815 | + } elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) { |
|
1816 | + continue; |
|
1817 | + } elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) { |
|
1818 | + continue; |
|
1819 | + } elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) { |
|
1820 | + continue; |
|
1821 | + } elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) { |
|
1822 | + continue; |
|
1823 | + } elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) { |
|
1824 | + continue; |
|
1825 | + } |
|
1754 | 1826 | |
1755 | 1827 | // Some of these may not be set... Set to defaults here |
1756 | 1828 | $opts = array('topics_per_page', 'messages_per_page', 'display_quick_mod'); |
1757 | - if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) |
|
1758 | - $context['member']['options'][$setting['id']] = 0; |
|
1759 | - |
|
1760 | - if (!isset($setting['type']) || $setting['type'] == 'bool') |
|
1761 | - $setting['type'] = 'checkbox'; |
|
1762 | - |
|
1763 | - elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') |
|
1764 | - $setting['type'] = 'number'; |
|
1829 | + if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) { |
|
1830 | + $context['member']['options'][$setting['id']] = 0; |
|
1831 | + } |
|
1765 | 1832 | |
1766 | - elseif ($setting['type'] == 'string') |
|
1767 | - $setting['type'] = 'text'; |
|
1833 | + if (!isset($setting['type']) || $setting['type'] == 'bool') { |
|
1834 | + $setting['type'] = 'checkbox'; |
|
1835 | + } elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') { |
|
1836 | + $setting['type'] = 'number'; |
|
1837 | + } elseif ($setting['type'] == 'string') { |
|
1838 | + $setting['type'] = 'text'; |
|
1839 | + } |
|
1768 | 1840 | |
1769 | - if (isset($setting['options'])) |
|
1770 | - $setting['type'] = 'list'; |
|
1841 | + if (isset($setting['options'])) { |
|
1842 | + $setting['type'] = 'list'; |
|
1843 | + } |
|
1771 | 1844 | |
1772 | 1845 | echo ' |
1773 | 1846 | <dt> |
1774 | 1847 | <label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>'; |
1775 | 1848 | |
1776 | - if (isset($setting['description'])) |
|
1777 | - echo ' |
|
1849 | + if (isset($setting['description'])) { |
|
1850 | + echo ' |
|
1778 | 1851 | <br> |
1779 | 1852 | <span class="smalltext">', $setting['description'], '</span>'; |
1853 | + } |
|
1780 | 1854 | echo ' |
1781 | 1855 | </dt> |
1782 | 1856 | <dd>'; |
1783 | 1857 | |
1784 | 1858 | // Display checkbox options |
1785 | - if ($setting['type'] == 'checkbox') |
|
1786 | - echo ' |
|
1859 | + if ($setting['type'] == 'checkbox') { |
|
1860 | + echo ' |
|
1787 | 1861 | <input type="hidden" name="default_options[' . $setting['id'] . ']" value="0"> |
1788 | 1862 | <input type="checkbox" name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', !empty($context['member']['options'][$setting['id']]) ? ' checked' : '', ' value="1">'; |
1863 | + } |
|
1789 | 1864 | |
1790 | 1865 | // How about selection lists, we all love them |
1791 | 1866 | elseif ($setting['type'] == 'list') |
@@ -1793,9 +1868,10 @@ discard block |
||
1793 | 1868 | echo ' |
1794 | 1869 | <select name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', '>'; |
1795 | 1870 | |
1796 | - foreach ($setting['options'] as $value => $label) |
|
1797 | - echo ' |
|
1871 | + foreach ($setting['options'] as $value => $label) { |
|
1872 | + echo ' |
|
1798 | 1873 | <option value="', $value, '"', $value == $context['member']['options'][$setting['id']] ? ' selected' : '', '>', $label, '</option>'; |
1874 | + } |
|
1799 | 1875 | |
1800 | 1876 | echo ' |
1801 | 1877 | </select>'; |
@@ -1811,14 +1887,13 @@ discard block |
||
1811 | 1887 | |
1812 | 1888 | echo ' |
1813 | 1889 | <input type="number"', $min . $max . $step; |
1814 | - } |
|
1815 | - elseif (isset($setting['type']) && $setting['type'] == 'url') |
|
1816 | - echo' |
|
1890 | + } elseif (isset($setting['type']) && $setting['type'] == 'url') { |
|
1891 | + echo' |
|
1817 | 1892 | <input type="url"'; |
1818 | - |
|
1819 | - else |
|
1820 | - echo ' |
|
1893 | + } else { |
|
1894 | + echo ' |
|
1821 | 1895 | <input type="text"'; |
1896 | + } |
|
1822 | 1897 | |
1823 | 1898 | echo ' name="default_options[', $setting['id'], ']" id="', $setting['id'], '" value="', isset($context['member']['options'][$setting['id']]) ? $context['member']['options'][$setting['id']] : $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : '', '>'; |
1824 | 1899 | } |
@@ -1855,8 +1930,8 @@ discard block |
||
1855 | 1930 | <dl class="settings">'; |
1856 | 1931 | |
1857 | 1932 | // Allow notification on announcements to be disabled? |
1858 | - if (!empty($modSettings['allow_disableAnnounce'])) |
|
1859 | - echo ' |
|
1933 | + if (!empty($modSettings['allow_disableAnnounce'])) { |
|
1934 | + echo ' |
|
1860 | 1935 | <dt> |
1861 | 1936 | <label for="notify_announcements">', $txt['notify_important_email'], '</label> |
1862 | 1937 | </dt> |
@@ -1864,15 +1939,17 @@ discard block |
||
1864 | 1939 | <input type="hidden" name="notify_announcements" value="0"> |
1865 | 1940 | <input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '> |
1866 | 1941 | </dd>'; |
1942 | + } |
|
1867 | 1943 | |
1868 | - if (!empty($modSettings['enable_ajax_alerts'])) |
|
1869 | - echo ' |
|
1944 | + if (!empty($modSettings['enable_ajax_alerts'])) { |
|
1945 | + echo ' |
|
1870 | 1946 | <dt> |
1871 | 1947 | <label for="notify_send_body">', $txt['notify_alert_timeout'], '</label> |
1872 | 1948 | </dt> |
1873 | 1949 | <dd> |
1874 | 1950 | <input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '"> |
1875 | 1951 | </dd>'; |
1952 | + } |
|
1876 | 1953 | |
1877 | 1954 | echo ' |
1878 | 1955 | </dl> |
@@ -1904,9 +1981,10 @@ discard block |
||
1904 | 1981 | |
1905 | 1982 | $label = $txt['alert_opt_' . $opts[1]]; |
1906 | 1983 | $label_pos = isset($opts['label']) ? $opts['label'] : ''; |
1907 | - if ($label_pos == 'before') |
|
1908 | - echo ' |
|
1984 | + if ($label_pos == 'before') { |
|
1985 | + echo ' |
|
1909 | 1986 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
1987 | + } |
|
1910 | 1988 | |
1911 | 1989 | $this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0; |
1912 | 1990 | switch ($opts[0]) |
@@ -1920,17 +1998,19 @@ discard block |
||
1920 | 1998 | echo ' |
1921 | 1999 | <select name="opt_', $opts[1], '" id="opt_', $opts[1], '">'; |
1922 | 2000 | |
1923 | - foreach ($opts['opts'] as $k => $v) |
|
1924 | - echo ' |
|
2001 | + foreach ($opts['opts'] as $k => $v) { |
|
2002 | + echo ' |
|
1925 | 2003 | <option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>'; |
2004 | + } |
|
1926 | 2005 | echo ' |
1927 | 2006 | </select>'; |
1928 | 2007 | break; |
1929 | 2008 | } |
1930 | 2009 | |
1931 | - if ($label_pos == 'after') |
|
1932 | - echo ' |
|
2010 | + if ($label_pos == 'after') { |
|
2011 | + echo ' |
|
1933 | 2012 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
2013 | + } |
|
1934 | 2014 | |
1935 | 2015 | echo ' |
1936 | 2016 | </td> |
@@ -2047,11 +2127,12 @@ discard block |
||
2047 | 2127 | <p class="information">', $txt['groupMembership_info'], '</p>'; |
2048 | 2128 | |
2049 | 2129 | // Do we have an update message? |
2050 | - if (!empty($context['update_message'])) |
|
2051 | - echo ' |
|
2130 | + if (!empty($context['update_message'])) { |
|
2131 | + echo ' |
|
2052 | 2132 | <div class="infobox"> |
2053 | 2133 | ', $context['update_message'], '. |
2054 | 2134 | </div>'; |
2135 | + } |
|
2055 | 2136 | |
2056 | 2137 | echo ' |
2057 | 2138 | <div id="groups">'; |
@@ -2073,8 +2154,7 @@ discard block |
||
2073 | 2154 | </div> |
2074 | 2155 | </div> |
2075 | 2156 | </div><!-- .groupmembership -->'; |
2076 | - } |
|
2077 | - else |
|
2157 | + } else |
|
2078 | 2158 | { |
2079 | 2159 | echo ' |
2080 | 2160 | <div class="title_bar"> |
@@ -2086,27 +2166,30 @@ discard block |
||
2086 | 2166 | echo ' |
2087 | 2167 | <div class="windowbg" id="primdiv_', $group['id'], '">'; |
2088 | 2168 | |
2089 | - if ($context['can_edit_primary']) |
|
2090 | - echo ' |
|
2169 | + if ($context['can_edit_primary']) { |
|
2170 | + echo ' |
|
2091 | 2171 | <input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '"', $group['is_primary'] ? ' checked' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');"', $group['can_be_primary'] ? '' : ' disabled', '>'; |
2172 | + } |
|
2092 | 2173 | |
2093 | 2174 | echo ' |
2094 | 2175 | <label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>'; |
2095 | 2176 | |
2096 | 2177 | // Can they leave their group? |
2097 | - if ($group['can_leave']) |
|
2098 | - echo ' |
|
2178 | + if ($group['can_leave']) { |
|
2179 | + echo ' |
|
2099 | 2180 | <a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>'; |
2181 | + } |
|
2100 | 2182 | |
2101 | 2183 | echo ' |
2102 | 2184 | </div><!-- .windowbg -->'; |
2103 | 2185 | } |
2104 | 2186 | |
2105 | - if ($context['can_edit_primary']) |
|
2106 | - echo ' |
|
2187 | + if ($context['can_edit_primary']) { |
|
2188 | + echo ' |
|
2107 | 2189 | <div class="padding righttext"> |
2108 | 2190 | <input type="submit" value="', $txt['make_primary'], '" class="button"> |
2109 | 2191 | </div>'; |
2192 | + } |
|
2110 | 2193 | |
2111 | 2194 | // Any groups they can join? |
2112 | 2195 | if (!empty($context['groups']['available'])) |
@@ -2122,17 +2205,16 @@ discard block |
||
2122 | 2205 | <div class="windowbg"> |
2123 | 2206 | <strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), ''; |
2124 | 2207 | |
2125 | - if ($group['type'] == 3) |
|
2126 | - echo ' |
|
2208 | + if ($group['type'] == 3) { |
|
2209 | + echo ' |
|
2127 | 2210 | <a href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '" class="button floatright">', $txt['join_group'], '</a>'; |
2128 | - |
|
2129 | - elseif ($group['type'] == 2 && $group['pending']) |
|
2130 | - echo ' |
|
2211 | + } elseif ($group['type'] == 2 && $group['pending']) { |
|
2212 | + echo ' |
|
2131 | 2213 | <span class="floatright">', $txt['approval_pending'], '</span>'; |
2132 | - |
|
2133 | - elseif ($group['type'] == 2) |
|
2134 | - echo ' |
|
2214 | + } elseif ($group['type'] == 2) { |
|
2215 | + echo ' |
|
2135 | 2216 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>'; |
2217 | + } |
|
2136 | 2218 | |
2137 | 2219 | echo ' |
2138 | 2220 | </div><!-- .windowbg -->'; |
@@ -2155,9 +2237,10 @@ discard block |
||
2155 | 2237 | |
2156 | 2238 | prevDiv.className = "windowbg"; |
2157 | 2239 | }'; |
2158 | - if (isset($context['groups']['member'][$context['primary_group']])) |
|
2159 | - echo ' |
|
2240 | + if (isset($context['groups']['member'][$context['primary_group']])) { |
|
2241 | + echo ' |
|
2160 | 2242 | highlightSelected("primdiv_' . $context['primary_group'] . '");'; |
2243 | + } |
|
2161 | 2244 | |
2162 | 2245 | echo ' |
2163 | 2246 | </script>'; |
@@ -2166,9 +2249,10 @@ discard block |
||
2166 | 2249 | echo ' |
2167 | 2250 | </div><!-- #groups -->'; |
2168 | 2251 | |
2169 | - if (!empty($context['token_check'])) |
|
2170 | - echo ' |
|
2252 | + if (!empty($context['token_check'])) { |
|
2253 | + echo ' |
|
2171 | 2254 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2255 | + } |
|
2172 | 2256 | |
2173 | 2257 | echo ' |
2174 | 2258 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2216,14 +2300,15 @@ discard block |
||
2216 | 2300 | |
2217 | 2301 | foreach ($category['boards'] as $board) |
2218 | 2302 | { |
2219 | - if ($i == $limit) |
|
2220 | - echo ' |
|
2303 | + if ($i == $limit) { |
|
2304 | + echo ' |
|
2221 | 2305 | </ul> |
2222 | 2306 | </li> |
2223 | 2307 | </ul> |
2224 | 2308 | <ul class="ignoreboards floatright"> |
2225 | 2309 | <li class="category"> |
2226 | 2310 | <ul>'; |
2311 | + } |
|
2227 | 2312 | |
2228 | 2313 | echo ' |
2229 | 2314 | <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;"> |
@@ -2269,10 +2354,11 @@ discard block |
||
2269 | 2354 | |
2270 | 2355 | // Work out the starting color. |
2271 | 2356 | $context['current_color'] = $context['colors'][0]; |
2272 | - foreach ($context['colors'] as $limit => $color) |
|
2273 | - if ($context['member']['warning'] >= $limit) |
|
2357 | + foreach ($context['colors'] as $limit => $color) { |
|
2358 | + if ($context['member']['warning'] >= $limit) |
|
2274 | 2359 | $context['current_color'] = $color; |
2275 | -} |
|
2360 | + } |
|
2361 | + } |
|
2276 | 2362 | |
2277 | 2363 | // Show all warnings of a user? |
2278 | 2364 | function template_viewWarning() |
@@ -2311,14 +2397,15 @@ discard block |
||
2311 | 2397 | </dd>'; |
2312 | 2398 | |
2313 | 2399 | // There's some impact of this? |
2314 | - if (!empty($context['level_effects'][$context['current_level']])) |
|
2315 | - echo ' |
|
2400 | + if (!empty($context['level_effects'][$context['current_level']])) { |
|
2401 | + echo ' |
|
2316 | 2402 | <dt> |
2317 | 2403 | <strong>', $txt['profile_viewwarning_impact'], ':</strong> |
2318 | 2404 | </dt> |
2319 | 2405 | <dd> |
2320 | 2406 | ', $context['level_effects'][$context['current_level']], ' |
2321 | 2407 | </dd>'; |
2408 | + } |
|
2322 | 2409 | |
2323 | 2410 | echo ' |
2324 | 2411 | </dl> |
@@ -2356,10 +2443,11 @@ discard block |
||
2356 | 2443 | |
2357 | 2444 | // Otherwise see what we can do...'; |
2358 | 2445 | |
2359 | - foreach ($context['notification_templates'] as $k => $type) |
|
2360 | - echo ' |
|
2446 | + foreach ($context['notification_templates'] as $k => $type) { |
|
2447 | + echo ' |
|
2361 | 2448 | if (index == ', $k, ') |
2362 | 2449 | document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";'; |
2450 | + } |
|
2363 | 2451 | |
2364 | 2452 | echo ' |
2365 | 2453 | } |
@@ -2369,10 +2457,11 @@ discard block |
||
2369 | 2457 | // Also set the right effect. |
2370 | 2458 | effectText = "";'; |
2371 | 2459 | |
2372 | - foreach ($context['level_effects'] as $limit => $text) |
|
2373 | - echo ' |
|
2460 | + foreach ($context['level_effects'] as $limit => $text) { |
|
2461 | + echo ' |
|
2374 | 2462 | if (slideAmount >= ', $limit, ') |
2375 | 2463 | effectText = "', $text, '";'; |
2464 | + } |
|
2376 | 2465 | |
2377 | 2466 | echo ' |
2378 | 2467 | setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\'); |
@@ -2387,32 +2476,35 @@ discard block |
||
2387 | 2476 | </h3> |
2388 | 2477 | </div>'; |
2389 | 2478 | |
2390 | - if (!$context['user']['is_owner']) |
|
2391 | - echo ' |
|
2479 | + if (!$context['user']['is_owner']) { |
|
2480 | + echo ' |
|
2392 | 2481 | <p class="information">', $txt['profile_warning_desc'], '</p>'; |
2482 | + } |
|
2393 | 2483 | |
2394 | 2484 | echo ' |
2395 | 2485 | <div class="windowbg"> |
2396 | 2486 | <dl class="settings">'; |
2397 | 2487 | |
2398 | - if (!$context['user']['is_owner']) |
|
2399 | - echo ' |
|
2488 | + if (!$context['user']['is_owner']) { |
|
2489 | + echo ' |
|
2400 | 2490 | <dt> |
2401 | 2491 | <strong>', $txt['profile_warning_name'], ':</strong> |
2402 | 2492 | </dt> |
2403 | 2493 | <dd> |
2404 | 2494 | <strong>', $context['member']['name'], '</strong> |
2405 | 2495 | </dd>'; |
2496 | + } |
|
2406 | 2497 | |
2407 | 2498 | echo ' |
2408 | 2499 | <dt> |
2409 | 2500 | <strong>', $txt['profile_warning_level'], ':</strong>'; |
2410 | 2501 | |
2411 | 2502 | // Is there only so much they can apply? |
2412 | - if ($context['warning_limit']) |
|
2413 | - echo ' |
|
2503 | + if ($context['warning_limit']) { |
|
2504 | + echo ' |
|
2414 | 2505 | <br> |
2415 | 2506 | <span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>'; |
2507 | + } |
|
2416 | 2508 | |
2417 | 2509 | echo ' |
2418 | 2510 | </dt> |
@@ -2467,9 +2559,10 @@ discard block |
||
2467 | 2559 | <option value="-1">', $txt['profile_warning_notify_template'], '</option> |
2468 | 2560 | <option value="-1" disabled>------------------------------</option>'; |
2469 | 2561 | |
2470 | - foreach ($context['notification_templates'] as $id_template => $template) |
|
2471 | - echo ' |
|
2562 | + foreach ($context['notification_templates'] as $id_template => $template) { |
|
2563 | + echo ' |
|
2472 | 2564 | <option value="', $id_template, '">', $template['title'], '</option>'; |
2565 | + } |
|
2473 | 2566 | |
2474 | 2567 | echo ' |
2475 | 2568 | </select> |
@@ -2482,9 +2575,10 @@ discard block |
||
2482 | 2575 | </dl> |
2483 | 2576 | <div class="righttext">'; |
2484 | 2577 | |
2485 | - if (!empty($context['token_check'])) |
|
2486 | - echo ' |
|
2578 | + if (!empty($context['token_check'])) { |
|
2579 | + echo ' |
|
2487 | 2580 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2581 | + } |
|
2488 | 2582 | |
2489 | 2583 | echo ' |
2490 | 2584 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2500,8 +2594,8 @@ discard block |
||
2500 | 2594 | echo ' |
2501 | 2595 | <script>'; |
2502 | 2596 | |
2503 | - if (!$context['user']['is_owner']) |
|
2504 | - echo ' |
|
2597 | + if (!$context['user']['is_owner']) { |
|
2598 | + echo ' |
|
2505 | 2599 | modifyWarnNotify(); |
2506 | 2600 | $(document).ready(function() { |
2507 | 2601 | $("#preview_button").click(function() { |
@@ -2540,6 +2634,7 @@ discard block |
||
2540 | 2634 | }); |
2541 | 2635 | return false; |
2542 | 2636 | }'; |
2637 | + } |
|
2543 | 2638 | |
2544 | 2639 | echo ' |
2545 | 2640 | </script>'; |
@@ -2562,17 +2657,19 @@ discard block |
||
2562 | 2657 | </div>'; |
2563 | 2658 | |
2564 | 2659 | // If deleting another account give them a lovely info box. |
2565 | - if (!$context['user']['is_owner']) |
|
2566 | - echo ' |
|
2660 | + if (!$context['user']['is_owner']) { |
|
2661 | + echo ' |
|
2567 | 2662 | <p class="information">', $txt['deleteAccount_desc'], '</p>'; |
2663 | + } |
|
2568 | 2664 | |
2569 | 2665 | echo ' |
2570 | 2666 | <div class="windowbg2">'; |
2571 | 2667 | |
2572 | 2668 | // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;) |
2573 | - if ($context['needs_approval']) |
|
2574 | - echo ' |
|
2669 | + if ($context['needs_approval']) { |
|
2670 | + echo ' |
|
2575 | 2671 | <div class="errorbox">', $txt['deleteAccount_approval'], '</div>'; |
2672 | + } |
|
2576 | 2673 | |
2577 | 2674 | // If the user is deleting their own account warn them first - and require a password! |
2578 | 2675 | if ($context['user']['is_owner']) |
@@ -2584,9 +2681,10 @@ discard block |
||
2584 | 2681 | <input type="password" name="oldpasswrd" size="20"> |
2585 | 2682 | <input type="submit" value="', $txt['yes'], '" class="button">'; |
2586 | 2683 | |
2587 | - if (!empty($context['token_check'])) |
|
2588 | - echo ' |
|
2684 | + if (!empty($context['token_check'])) { |
|
2685 | + echo ' |
|
2589 | 2686 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2687 | + } |
|
2590 | 2688 | |
2591 | 2689 | echo ' |
2592 | 2690 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2616,10 +2714,11 @@ discard block |
||
2616 | 2714 | <option value="topics">', $txt['deleteAccount_topics'], '</option> |
2617 | 2715 | </select>'; |
2618 | 2716 | |
2619 | - if ($context['show_perma_delete']) |
|
2620 | - echo ' |
|
2717 | + if ($context['show_perma_delete']) { |
|
2718 | + echo ' |
|
2621 | 2719 | <br> |
2622 | 2720 | <label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>'; |
2721 | + } |
|
2623 | 2722 | |
2624 | 2723 | echo ' |
2625 | 2724 | </div>'; |
@@ -2632,9 +2731,10 @@ discard block |
||
2632 | 2731 | <div> |
2633 | 2732 | <input type="submit" value="', $txt['delete'], '" class="button">'; |
2634 | 2733 | |
2635 | - if (!empty($context['token_check'])) |
|
2636 | - echo ' |
|
2734 | + if (!empty($context['token_check'])) { |
|
2735 | + echo ' |
|
2637 | 2736 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2737 | + } |
|
2638 | 2738 | |
2639 | 2739 | echo ' |
2640 | 2740 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2660,8 +2760,8 @@ discard block |
||
2660 | 2760 | <hr>'; |
2661 | 2761 | |
2662 | 2762 | // Only show the password box if it's actually needed. |
2663 | - if ($context['require_password']) |
|
2664 | - echo ' |
|
2763 | + if ($context['require_password']) { |
|
2764 | + echo ' |
|
2665 | 2765 | <dl class="settings"> |
2666 | 2766 | <dt> |
2667 | 2767 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br> |
@@ -2671,13 +2771,15 @@ discard block |
||
2671 | 2771 | <input type="password" name="oldpasswrd" size="20"> |
2672 | 2772 | </dd> |
2673 | 2773 | </dl>'; |
2774 | + } |
|
2674 | 2775 | |
2675 | 2776 | echo ' |
2676 | 2777 | <div class="righttext">'; |
2677 | 2778 | |
2678 | - if (!empty($context['token_check'])) |
|
2679 | - echo ' |
|
2779 | + if (!empty($context['token_check'])) { |
|
2780 | + echo ' |
|
2680 | 2781 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2782 | + } |
|
2681 | 2783 | |
2682 | 2784 | echo ' |
2683 | 2785 | <input type="submit" value="', $txt['change_profile'], '" class="button"> |
@@ -2704,9 +2806,10 @@ discard block |
||
2704 | 2806 | <ul id="list_errors">'; |
2705 | 2807 | |
2706 | 2808 | // Cycle through each error and display an error message. |
2707 | - foreach ($context['post_errors'] as $error) |
|
2708 | - echo ' |
|
2809 | + foreach ($context['post_errors'] as $error) { |
|
2810 | + echo ' |
|
2709 | 2811 | <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>'; |
2812 | + } |
|
2710 | 2813 | |
2711 | 2814 | echo ' |
2712 | 2815 | </ul>'; |
@@ -2732,12 +2835,13 @@ discard block |
||
2732 | 2835 | <select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 && !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>'; |
2733 | 2836 | |
2734 | 2837 | // Fill the select box with all primary member groups that can be assigned to a member. |
2735 | - foreach ($context['member_groups'] as $member_group) |
|
2736 | - if (!empty($member_group['can_be_primary'])) |
|
2838 | + foreach ($context['member_groups'] as $member_group) { |
|
2839 | + if (!empty($member_group['can_be_primary'])) |
|
2737 | 2840 | echo ' |
2738 | 2841 | <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '> |
2739 | 2842 | ', $member_group['name'], ' |
2740 | 2843 | </option>'; |
2844 | + } |
|
2741 | 2845 | |
2742 | 2846 | echo ' |
2743 | 2847 | </select> |
@@ -2750,10 +2854,11 @@ discard block |
||
2750 | 2854 | <input type="hidden" name="additional_groups[]" value="0">'; |
2751 | 2855 | |
2752 | 2856 | // For each membergroup show a checkbox so members can be assigned to more than one group. |
2753 | - foreach ($context['member_groups'] as $member_group) |
|
2754 | - if ($member_group['can_be_additional']) |
|
2857 | + foreach ($context['member_groups'] as $member_group) { |
|
2858 | + if ($member_group['can_be_additional']) |
|
2755 | 2859 | echo ' |
2756 | 2860 | <label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked' : '', '> ', $member_group['name'], '</label><br>'; |
2861 | + } |
|
2757 | 2862 | |
2758 | 2863 | echo ' |
2759 | 2864 | </span> |
@@ -2813,9 +2918,10 @@ discard block |
||
2813 | 2918 | <span class="smalltext">', $txt['sig_info'], '</span><br> |
2814 | 2919 | <br>'; |
2815 | 2920 | |
2816 | - if ($context['show_spellchecking']) |
|
2817 | - echo ' |
|
2921 | + if ($context['show_spellchecking']) { |
|
2922 | + echo ' |
|
2818 | 2923 | <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">'; |
2924 | + } |
|
2819 | 2925 | |
2820 | 2926 | echo ' |
2821 | 2927 | </dt> |
@@ -2823,17 +2929,20 @@ discard block |
||
2823 | 2929 | <textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>'; |
2824 | 2930 | |
2825 | 2931 | // If there is a limit at all! |
2826 | - if (!empty($context['signature_limits']['max_length'])) |
|
2827 | - echo ' |
|
2932 | + if (!empty($context['signature_limits']['max_length'])) { |
|
2933 | + echo ' |
|
2828 | 2934 | <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>'; |
2935 | + } |
|
2829 | 2936 | |
2830 | - if (!empty($context['show_preview_button'])) |
|
2831 | - echo ' |
|
2937 | + if (!empty($context['show_preview_button'])) { |
|
2938 | + echo ' |
|
2832 | 2939 | <input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button">'; |
2940 | + } |
|
2833 | 2941 | |
2834 | - if ($context['signature_warning']) |
|
2835 | - echo ' |
|
2942 | + if ($context['signature_warning']) { |
|
2943 | + echo ' |
|
2836 | 2944 | <span class="smalltext">', $context['signature_warning'], '</span>'; |
2945 | + } |
|
2837 | 2946 | |
2838 | 2947 | // Some javascript used to count how many characters have been used so far in the signature. |
2839 | 2948 | echo ' |
@@ -2878,9 +2987,10 @@ discard block |
||
2878 | 2987 | <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">'; |
2879 | 2988 | |
2880 | 2989 | // This lists all the file categories. |
2881 | - foreach ($context['avatars'] as $avatar) |
|
2882 | - echo ' |
|
2990 | + foreach ($context['avatars'] as $avatar) { |
|
2991 | + echo ' |
|
2883 | 2992 | <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>'; |
2993 | + } |
|
2884 | 2994 | |
2885 | 2995 | echo ' |
2886 | 2996 | </select> |
@@ -2912,20 +3022,22 @@ discard block |
||
2912 | 3022 | } |
2913 | 3023 | |
2914 | 3024 | // If the user can link to an off server avatar, show them a box to input the address. |
2915 | - if (!empty($context['member']['avatar']['allow_external'])) |
|
2916 | - echo ' |
|
3025 | + if (!empty($context['member']['avatar']['allow_external'])) { |
|
3026 | + echo ' |
|
2917 | 3027 | <div id="avatar_external"> |
2918 | 3028 | <div class="smalltext">', $txt['avatar_by_url'], '</div>', !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_download_and_resize' ? template_max_size('external') : '', ' |
2919 | 3029 | <input type="text" name="userpicpersonal" size="45" value="', ((stristr($context['member']['avatar']['external'], 'http://') || stristr($context['member']['avatar']['external'], 'https://')) ? $context['member']['avatar']['external'] : 'http://'), '" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'external\');" onchange="if (typeof(previewExternalAvatar) != \'undefined\') previewExternalAvatar(this.value);"> |
2920 | 3030 | </div>'; |
3031 | + } |
|
2921 | 3032 | |
2922 | 3033 | // If the user is able to upload avatars to the server show them an upload box. |
2923 | - if (!empty($context['member']['avatar']['allow_upload'])) |
|
2924 | - echo ' |
|
3034 | + if (!empty($context['member']['avatar']['allow_upload'])) { |
|
3035 | + echo ' |
|
2925 | 3036 | <div id="avatar_upload"> |
2926 | 3037 | <input type="file" size="44" name="attachment" id="avatar_upload_box" value="" onchange="readfromUpload(this)" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'upload\');" accept="image/gif, image/jpeg, image/jpg, image/png">', template_max_size('upload'), ' |
2927 | 3038 | ', (!empty($context['member']['avatar']['id_attach']) ? '<br><img src="' . $context['member']['avatar']['href'] . (strpos($context['member']['avatar']['href'], '?') === false ? '?' : '&') . 'time=' . time() . '" alt="" id="attached_image"><input type="hidden" name="id_attach" value="' . $context['member']['avatar']['id_attach'] . '">' : ''), ' |
2928 | 3039 | </div>'; |
3040 | + } |
|
2929 | 3041 | |
2930 | 3042 | // if the user is able to use Gravatar avatars show then the image preview |
2931 | 3043 | if (!empty($context['member']['avatar']['allow_gravatar'])) |
@@ -2934,16 +3046,17 @@ discard block |
||
2934 | 3046 | <div id="avatar_gravatar"> |
2935 | 3047 | <img src="' . $context['member']['avatar']['href'] . '" alt="">'; |
2936 | 3048 | |
2937 | - if (empty($modSettings['gravatarAllowExtraEmail'])) |
|
2938 | - echo ' |
|
3049 | + if (empty($modSettings['gravatarAllowExtraEmail'])) { |
|
3050 | + echo ' |
|
2939 | 3051 | <div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>'; |
2940 | - else |
|
3052 | + } else |
|
2941 | 3053 | { |
2942 | 3054 | // Depending on other stuff, the stored value here might have some odd things in it from other areas. |
2943 | - if ($context['member']['avatar']['external'] == $context['member']['email']) |
|
2944 | - $textbox_value = ''; |
|
2945 | - else |
|
2946 | - $textbox_value = $context['member']['avatar']['external']; |
|
3055 | + if ($context['member']['avatar']['external'] == $context['member']['email']) { |
|
3056 | + $textbox_value = ''; |
|
3057 | + } else { |
|
3058 | + $textbox_value = $context['member']['avatar']['external']; |
|
3059 | + } |
|
2947 | 3060 | |
2948 | 3061 | echo ' |
2949 | 3062 | <div class="smalltext">', $txt['gravatar_alternateEmail'], '</div> |
@@ -3015,8 +3128,9 @@ discard block |
||
3015 | 3128 | $h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0; |
3016 | 3129 | |
3017 | 3130 | $suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : ''); |
3018 | - if (empty($suffix)) |
|
3019 | - return; |
|
3131 | + if (empty($suffix)) { |
|
3132 | + return; |
|
3133 | + } |
|
3020 | 3134 | |
3021 | 3135 | echo ' |
3022 | 3136 | <div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>'; |
@@ -3041,9 +3155,10 @@ discard block |
||
3041 | 3155 | <select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">'; |
3042 | 3156 | |
3043 | 3157 | // Help the user by showing a list of common time formats. |
3044 | - foreach ($context['easy_timeformats'] as $time_format) |
|
3045 | - echo ' |
|
3158 | + foreach ($context['easy_timeformats'] as $time_format) { |
|
3159 | + echo ' |
|
3046 | 3160 | <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>'; |
3161 | + } |
|
3047 | 3162 | |
3048 | 3163 | echo ' |
3049 | 3164 | </select><br> |
@@ -3081,9 +3196,10 @@ discard block |
||
3081 | 3196 | <dd> |
3082 | 3197 | <select name="smiley_set" id="smiley_set" onchange="document.getElementById(\'smileypr\').src = this.selectedIndex == 0 ? \'', $settings['images_url'], '/blank.png\' : \'', $modSettings['smileys_url'], '/\' + (this.selectedIndex != 1 ? this.options[this.selectedIndex].value : \'', !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'], '\') + \'/smiley.gif\';">'; |
3083 | 3198 | |
3084 | - foreach ($context['smiley_sets'] as $set) |
|
3085 | - echo ' |
|
3199 | + foreach ($context['smiley_sets'] as $set) { |
|
3200 | + echo ' |
|
3086 | 3201 | <option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>'; |
3202 | + } |
|
3087 | 3203 | |
3088 | 3204 | echo ' |
3089 | 3205 | </select> |
@@ -3135,10 +3251,11 @@ discard block |
||
3135 | 3251 | <img src="', $context['tfa_qr_url'], '" alt=""> |
3136 | 3252 | </div>'; |
3137 | 3253 | |
3138 | - if (!empty($context['from_ajax'])) |
|
3139 | - echo ' |
|
3254 | + if (!empty($context['from_ajax'])) { |
|
3255 | + echo ' |
|
3140 | 3256 | <br> |
3141 | 3257 | <a href="javascript:self.close();"></a>'; |
3258 | + } |
|
3142 | 3259 | |
3143 | 3260 | echo ' |
3144 | 3261 | </div> |
@@ -3178,17 +3295,16 @@ discard block |
||
3178 | 3295 | </dt> |
3179 | 3296 | <dd>'; |
3180 | 3297 | |
3181 | - if (!$context['tfa_enabled'] && $context['user']['is_owner']) |
|
3182 | - echo ' |
|
3298 | + if (!$context['tfa_enabled'] && $context['user']['is_owner']) { |
|
3299 | + echo ' |
|
3183 | 3300 | <a href="', !empty($modSettings['force_ssl']) && $modSettings['force_ssl'] < 2 ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>'; |
3184 | - |
|
3185 | - elseif (!$context['tfa_enabled']) |
|
3186 | - echo ' |
|
3301 | + } elseif (!$context['tfa_enabled']) { |
|
3302 | + echo ' |
|
3187 | 3303 | ', $txt['tfa_profile_disabled']; |
3188 | - |
|
3189 | - else |
|
3190 | - echo ' |
|
3304 | + } else { |
|
3305 | + echo ' |
|
3191 | 3306 | ', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable'); |
3307 | + } |
|
3192 | 3308 | |
3193 | 3309 | echo ' |
3194 | 3310 | </dd>'; |
@@ -232,7 +232,7 @@ |
||
232 | 232 | // In maintenance mode, only login is allowed and don't show OverlayDiv |
233 | 233 | echo ' |
234 | 234 | <ul class="floatleft welcome"> |
235 | - <li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl. '?action=login', 'return true;'), '</li> |
|
235 | + <li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl . '?action=login', 'return true;'), '</li> |
|
236 | 236 | </ul>'; |
237 | 237 | |
238 | 238 | if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1) |
@@ -72,9 +72,10 @@ discard block |
||
72 | 72 | |
73 | 73 | // Allow css/js files to be disabled for this specific theme. |
74 | 74 | // Add the identifier as an array key. IE array('smf_script'); Some external files might not add identifiers, on those cases SMF uses its filename as reference. |
75 | - if (!isset($settings['disable_files'])) |
|
76 | - $settings['disable_files'] = array(); |
|
77 | -} |
|
75 | + if (!isset($settings['disable_files'])) { |
|
76 | + $settings['disable_files'] = array(); |
|
77 | + } |
|
78 | + } |
|
78 | 79 | |
79 | 80 | /** |
80 | 81 | * The main sub template above the content. |
@@ -112,8 +113,9 @@ discard block |
||
112 | 113 | echo ' |
113 | 114 | <meta'; |
114 | 115 | |
115 | - foreach ($meta_tag as $meta_key => $meta_value) |
|
116 | - echo ' ', $meta_key, '="', $meta_value, '"'; |
|
116 | + foreach ($meta_tag as $meta_key => $meta_value) { |
|
117 | + echo ' ', $meta_key, '="', $meta_value, '"'; |
|
118 | + } |
|
117 | 119 | |
118 | 120 | echo '>'; |
119 | 121 | } |
@@ -124,14 +126,16 @@ discard block |
||
124 | 126 | <meta name="theme-color" content="#557EA0">'; |
125 | 127 | |
126 | 128 | // Please don't index these Mr Robot. |
127 | - if (!empty($context['robot_no_index'])) |
|
128 | - echo ' |
|
129 | + if (!empty($context['robot_no_index'])) { |
|
130 | + echo ' |
|
129 | 131 | <meta name="robots" content="noindex">'; |
132 | + } |
|
130 | 133 | |
131 | 134 | // Present a canonical url for search engines to prevent duplicate content in their indices. |
132 | - if (!empty($context['canonical_url'])) |
|
133 | - echo ' |
|
135 | + if (!empty($context['canonical_url'])) { |
|
136 | + echo ' |
|
134 | 137 | <link rel="canonical" href="', $context['canonical_url'], '">'; |
138 | + } |
|
135 | 139 | |
136 | 140 | // Show all the relative links, such as help, search, contents, and the like. |
137 | 141 | echo ' |
@@ -140,24 +144,28 @@ discard block |
||
140 | 144 | <link rel="search" href="' . $scripturl . '?action=search">' : ''); |
141 | 145 | |
142 | 146 | // If RSS feeds are enabled, advertise the presence of one. |
143 | - if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) |
|
144 | - echo ' |
|
147 | + if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) { |
|
148 | + echo ' |
|
145 | 149 | <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?action=.xml;type=rss2', !empty($context['current_board']) ? ';board=' . $context['current_board'] : '', '"> |
146 | 150 | <link rel="alternate" type="application/atom+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $scripturl, '?action=.xml;type=atom', !empty($context['current_board']) ? ';board=' . $context['current_board'] : '', '">'; |
151 | + } |
|
147 | 152 | |
148 | 153 | // If we're viewing a topic, these should be the previous and next topics, respectively. |
149 | - if (!empty($context['links']['next'])) |
|
150 | - echo ' |
|
154 | + if (!empty($context['links']['next'])) { |
|
155 | + echo ' |
|
151 | 156 | <link rel="next" href="', $context['links']['next'], '">'; |
157 | + } |
|
152 | 158 | |
153 | - if (!empty($context['links']['prev'])) |
|
154 | - echo ' |
|
159 | + if (!empty($context['links']['prev'])) { |
|
160 | + echo ' |
|
155 | 161 | <link rel="prev" href="', $context['links']['prev'], '">'; |
162 | + } |
|
156 | 163 | |
157 | 164 | // If we're in a board, or a topic for that matter, the index will be the board's index. |
158 | - if (!empty($context['current_board'])) |
|
159 | - echo ' |
|
165 | + if (!empty($context['current_board'])) { |
|
166 | + echo ' |
|
160 | 167 | <link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0">'; |
168 | + } |
|
161 | 169 | |
162 | 170 | // Output any remaining HTML headers. (from mods, maybe?) |
163 | 171 | echo $context['html_headers']; |
@@ -190,20 +198,22 @@ discard block |
||
190 | 198 | <li> |
191 | 199 | <a href="', $scripturl, '?action=profile"', !empty($context['self_profile']) ? ' class="active"' : '', ' id="profile_menu_top" onclick="return false;">'; |
192 | 200 | |
193 | - if (!empty($context['user']['avatar'])) |
|
194 | - echo $context['user']['avatar']['image']; |
|
201 | + if (!empty($context['user']['avatar'])) { |
|
202 | + echo $context['user']['avatar']['image']; |
|
203 | + } |
|
195 | 204 | |
196 | 205 | echo $context['user']['name'], '</a> |
197 | 206 | <div id="profile_menu" class="top_menu"></div> |
198 | 207 | </li>'; |
199 | 208 | |
200 | 209 | // Secondly, PMs if we're doing them |
201 | - if ($context['allow_pm']) |
|
202 | - echo ' |
|
210 | + if ($context['allow_pm']) { |
|
211 | + echo ' |
|
203 | 212 | <li> |
204 | 213 | <a href="', $scripturl, '?action=pm"', !empty($context['self_pm']) ? ' class="active"' : '', ' id="pm_menu_top">', $txt['pm_short'], !empty($context['user']['unread_messages']) ? ' <span class="amt">' . $context['user']['unread_messages'] . '</span>' : '', '</a> |
205 | 214 | <div id="pm_menu" class="top_menu scrollable"></div> |
206 | 215 | </li>'; |
216 | + } |
|
207 | 217 | |
208 | 218 | // Thirdly, alerts |
209 | 219 | echo ' |
@@ -218,17 +228,18 @@ discard block |
||
218 | 228 | } |
219 | 229 | // Otherwise they're a guest. Ask them to either register or login. |
220 | 230 | else |
221 | - if (empty($maintenance)) |
|
222 | - echo ' |
|
231 | + if (empty($maintenance)) { |
|
232 | + echo ' |
|
223 | 233 | <ul class="floatleft welcome"> |
224 | 234 | <li>', sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup'), '</li> |
225 | 235 | </ul>'; |
226 | - else |
|
227 | - // In maintenance mode, only login is allowed and don't show OverlayDiv |
|
236 | + } else { |
|
237 | + // In maintenance mode, only login is allowed and don't show OverlayDiv |
|
228 | 238 | echo ' |
229 | 239 | <ul class="floatleft welcome"> |
230 | 240 | <li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl. '?action=login', 'return true;'), '</li> |
231 | 241 | </ul>'; |
242 | + } |
|
232 | 243 | |
233 | 244 | if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1) |
234 | 245 | { |
@@ -236,9 +247,10 @@ discard block |
||
236 | 247 | <form id="languages_form" method="get" class="floatright"> |
237 | 248 | <select id="language_select" name="language" onchange="this.form.submit()">'; |
238 | 249 | |
239 | - foreach ($context['languages'] as $language) |
|
240 | - echo ' |
|
250 | + foreach ($context['languages'] as $language) { |
|
251 | + echo ' |
|
241 | 252 | <option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', str_replace('-utf8', '', $language['name']), '</option>'; |
253 | + } |
|
242 | 254 | |
243 | 255 | echo ' |
244 | 256 | </select> |
@@ -262,32 +274,37 @@ discard block |
||
262 | 274 | <option value="all"', ($selected == 'all' ? ' selected' : ''), '>', $txt['search_entireforum'], ' </option>'; |
263 | 275 | |
264 | 276 | // Can't limit it to a specific topic if we are not in one |
265 | - if (!empty($context['current_topic'])) |
|
266 | - echo ' |
|
277 | + if (!empty($context['current_topic'])) { |
|
278 | + echo ' |
|
267 | 279 | <option value="topic"', ($selected == 'current_topic' ? ' selected' : ''), '>', $txt['search_thistopic'], '</option>'; |
280 | + } |
|
268 | 281 | |
269 | 282 | // Can't limit it to a specific board if we are not in one |
270 | - if (!empty($context['current_board'])) |
|
271 | - echo ' |
|
283 | + if (!empty($context['current_board'])) { |
|
284 | + echo ' |
|
272 | 285 | <option value="board"', ($selected == 'current_board' ? ' selected' : ''), '>', $txt['search_thisbrd'], '</option>'; |
286 | + } |
|
273 | 287 | |
274 | 288 | // Can't search for members if we can't see the memberlist |
275 | - if (!empty($context['allow_memberlist'])) |
|
276 | - echo ' |
|
289 | + if (!empty($context['allow_memberlist'])) { |
|
290 | + echo ' |
|
277 | 291 | <option value="members"', ($selected == 'members' ? ' selected' : ''), '>', $txt['search_members'], ' </option>'; |
292 | + } |
|
278 | 293 | |
279 | 294 | echo ' |
280 | 295 | </select>'; |
281 | 296 | |
282 | 297 | // Search within current topic? |
283 | - if (!empty($context['current_topic'])) |
|
284 | - echo ' |
|
298 | + if (!empty($context['current_topic'])) { |
|
299 | + echo ' |
|
285 | 300 | <input type="hidden" name="sd_topic" value="', $context['current_topic'], '">'; |
301 | + } |
|
286 | 302 | |
287 | 303 | // If we're on a certain board, limit it to this board ;). |
288 | - elseif (!empty($context['current_board'])) |
|
289 | - echo ' |
|
304 | + elseif (!empty($context['current_board'])) { |
|
305 | + echo ' |
|
290 | 306 | <input type="hidden" name="sd_brd" value="', $context['current_board'], '">'; |
307 | + } |
|
291 | 308 | |
292 | 309 | echo ' |
293 | 310 | <input type="submit" name="search2" value="', $txt['search'], '" class="button"> |
@@ -319,12 +336,13 @@ discard block |
||
319 | 336 | </div>'; |
320 | 337 | |
321 | 338 | // Show a random news item? (or you could pick one from news_lines...) |
322 | - if (!empty($settings['enable_news']) && !empty($context['random_news_line'])) |
|
323 | - echo ' |
|
339 | + if (!empty($settings['enable_news']) && !empty($context['random_news_line'])) { |
|
340 | + echo ' |
|
324 | 341 | <div class="news"> |
325 | 342 | <h2>', $txt['news'], ': </h2> |
326 | 343 | <p>', $context['random_news_line'], '</p> |
327 | 344 | </div>'; |
345 | + } |
|
328 | 346 | |
329 | 347 | echo ' |
330 | 348 | <hr class="clear"> |
@@ -385,9 +403,10 @@ discard block |
||
385 | 403 | </ul>'; |
386 | 404 | |
387 | 405 | // Show the load time? |
388 | - if ($context['show_load_time']) |
|
389 | - echo ' |
|
406 | + if ($context['show_load_time']) { |
|
407 | + echo ' |
|
390 | 408 | <p>', sprintf($txt['page_created_full'], $context['load_time'], $context['load_queries']), '</p>'; |
409 | + } |
|
391 | 410 | |
392 | 411 | echo ' |
393 | 412 | </div> |
@@ -418,18 +437,20 @@ discard block |
||
418 | 437 | global $context, $shown_linktree, $scripturl, $txt; |
419 | 438 | |
420 | 439 | // If linktree is empty, just return - also allow an override. |
421 | - if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show)) |
|
422 | - return; |
|
440 | + if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show)) { |
|
441 | + return; |
|
442 | + } |
|
423 | 443 | echo ' |
424 | 444 | <div class="navigate_section"> |
425 | 445 | <ul>'; |
426 | 446 | |
427 | - if ($context['user']['is_logged']) |
|
428 | - echo ' |
|
447 | + if ($context['user']['is_logged']) { |
|
448 | + echo ' |
|
429 | 449 | <li class="unread_links"> |
430 | 450 | <a href="', $scripturl, '?action=unread" title="', $txt['unread_since_visit'], '">', $txt['view_unread_category'], '</a> |
431 | 451 | <a href="', $scripturl, '?action=unreadreplies" title="', $txt['show_unread_replies'], '">', $txt['unread_replies'], '</a> |
432 | 452 | </li>'; |
453 | + } |
|
433 | 454 | |
434 | 455 | // Each tree item has a URL and name. Some may have extra_before and extra_after. |
435 | 456 | foreach ($context['linktree'] as $link_num => $tree) |
@@ -440,25 +461,29 @@ discard block |
||
440 | 461 | // Don't show a separator for the first one. |
441 | 462 | // Better here. Always points to the next level when the linktree breaks to a second line. |
442 | 463 | // Picked a better looking HTML entity, and added support for RTL plus a span for styling. |
443 | - if ($link_num != 0) |
|
444 | - echo ' |
|
464 | + if ($link_num != 0) { |
|
465 | + echo ' |
|
445 | 466 | <span class="dividers">', $context['right_to_left'] ? ' ◄ ' : ' ► ', '</span>'; |
467 | + } |
|
446 | 468 | |
447 | 469 | // Show something before the link? |
448 | - if (isset($tree['extra_before'])) |
|
449 | - echo $tree['extra_before'], ' '; |
|
470 | + if (isset($tree['extra_before'])) { |
|
471 | + echo $tree['extra_before'], ' '; |
|
472 | + } |
|
450 | 473 | |
451 | 474 | // Show the link, including a URL if it should have one. |
452 | - if (isset($tree['url'])) |
|
453 | - echo ' |
|
475 | + if (isset($tree['url'])) { |
|
476 | + echo ' |
|
454 | 477 | <a href="' . $tree['url'] . '"><span>' . $tree['name'] . '</span></a>'; |
455 | - else |
|
456 | - echo ' |
|
478 | + } else { |
|
479 | + echo ' |
|
457 | 480 | <span>' . $tree['name'] . '</span>'; |
481 | + } |
|
458 | 482 | |
459 | 483 | // Show something after the link...? |
460 | - if (isset($tree['extra_after'])) |
|
461 | - echo ' ', $tree['extra_after']; |
|
484 | + if (isset($tree['extra_after'])) { |
|
485 | + echo ' ', $tree['extra_after']; |
|
486 | + } |
|
462 | 487 | |
463 | 488 | echo ' |
464 | 489 | </li>'; |
@@ -509,13 +534,14 @@ discard block |
||
509 | 534 | echo ' |
510 | 535 | <ul>'; |
511 | 536 | |
512 | - foreach ($childbutton['sub_buttons'] as $grandchildbutton) |
|
513 | - echo ' |
|
537 | + foreach ($childbutton['sub_buttons'] as $grandchildbutton) { |
|
538 | + echo ' |
|
514 | 539 | <li> |
515 | 540 | <a href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '> |
516 | 541 | ', $grandchildbutton['title'], ' |
517 | 542 | </a> |
518 | 543 | </li>'; |
544 | + } |
|
519 | 545 | |
520 | 546 | echo ' |
521 | 547 | </ul>'; |
@@ -546,8 +572,9 @@ discard block |
||
546 | 572 | { |
547 | 573 | global $context, $txt; |
548 | 574 | |
549 | - if (!is_array($strip_options)) |
|
550 | - $strip_options = array(); |
|
575 | + if (!is_array($strip_options)) { |
|
576 | + $strip_options = array(); |
|
577 | + } |
|
551 | 578 | |
552 | 579 | // Create the buttons... |
553 | 580 | $buttons = array(); |
@@ -556,8 +583,9 @@ discard block |
||
556 | 583 | // As of 2.1, the 'test' for each button happens while the array is being generated. The extra 'test' check here is deprecated but kept for backward compatibility (update your mods, folks!) |
557 | 584 | if (!isset($value['test']) || !empty($context[$value['test']])) |
558 | 585 | { |
559 | - if (!isset($value['id'])) |
|
560 | - $value['id'] = $key; |
|
586 | + if (!isset($value['id'])) { |
|
587 | + $value['id'] = $key; |
|
588 | + } |
|
561 | 589 | |
562 | 590 | $button = ' |
563 | 591 | <a class="button button_strip_' . $key . (!empty($value['active']) ? ' active' : '') . (isset($value['class']) ? ' ' . $value['class'] : '') . '" ' . (!empty($value['url']) ? 'href="' . $value['url'] . '"' : '') . ' ' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '>' . $txt[$value['text']] . '</a>'; |
@@ -570,13 +598,15 @@ discard block |
||
570 | 598 | <div class="overview">'; |
571 | 599 | foreach ($value['sub_buttons'] as $element) |
572 | 600 | { |
573 | - if (isset($element['test']) && empty($context[$element['test']])) |
|
574 | - continue; |
|
601 | + if (isset($element['test']) && empty($context[$element['test']])) { |
|
602 | + continue; |
|
603 | + } |
|
575 | 604 | |
576 | 605 | $button .= ' |
577 | 606 | <a href="' . $element['url'] . '"><strong>' . $txt[$element['text']] . '</strong>'; |
578 | - if (isset($txt[$element['text'] . '_desc'])) |
|
579 | - $button .= '<br><span>' . $txt[$element['text'] . '_desc'] . '</span>'; |
|
607 | + if (isset($txt[$element['text'] . '_desc'])) { |
|
608 | + $button .= '<br><span>' . $txt[$element['text'] . '_desc'] . '</span>'; |
|
609 | + } |
|
580 | 610 | $button .= '</a>'; |
581 | 611 | } |
582 | 612 | $button .= ' |
@@ -590,8 +620,9 @@ discard block |
||
590 | 620 | } |
591 | 621 | |
592 | 622 | // No buttons? No button strip either. |
593 | - if (empty($buttons)) |
|
594 | - return; |
|
623 | + if (empty($buttons)) { |
|
624 | + return; |
|
625 | + } |
|
595 | 626 | |
596 | 627 | echo ' |
597 | 628 | <div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"' : ''), '> |
@@ -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 | * Fetches a list of boards and (optional) categories including |
@@ -37,11 +38,12 @@ discard block |
||
37 | 38 | require_once($sourcedir . '/Subs-Boards.php'); |
38 | 39 | |
39 | 40 | // For performance, track the latest post while going through the boards. |
40 | - if (!empty($boardIndexOptions['set_latest_post'])) |
|
41 | - $latest_post = array( |
|
41 | + if (!empty($boardIndexOptions['set_latest_post'])) { |
|
42 | + $latest_post = array( |
|
42 | 43 | 'timestamp' => 0, |
43 | 44 | 'ref' => 0, |
44 | 45 | ); |
46 | + } |
|
45 | 47 | |
46 | 48 | // Find all boards and categories, as well as related information. This will be sorted by the natural order of boards and categories, which we control. |
47 | 49 | $result_boards = $smcFunc['db_query']('', ' |
@@ -74,10 +76,11 @@ discard block |
||
74 | 76 | ); |
75 | 77 | |
76 | 78 | // Start with an empty array. |
77 | - if ($boardIndexOptions['include_categories']) |
|
78 | - $categories = array(); |
|
79 | - else |
|
80 | - $this_category = array(); |
|
79 | + if ($boardIndexOptions['include_categories']) { |
|
80 | + $categories = array(); |
|
81 | + } else { |
|
82 | + $this_category = array(); |
|
83 | + } |
|
81 | 84 | $boards = array(); |
82 | 85 | |
83 | 86 | // Run through the categories and boards (or only boards).... |
@@ -88,8 +91,9 @@ discard block |
||
88 | 91 | $row_board['is_read'] = !empty($row_board['is_read']) || $ignoreThisBoard ? '1' : '0'; |
89 | 92 | |
90 | 93 | // Add parent boards to the $boards list later used to fetch moderators |
91 | - if ($row_board['id_parent'] == $boardIndexOptions['parent_id']) |
|
92 | - $boards[] = $row_board['id_board']; |
|
94 | + if ($row_board['id_parent'] == $boardIndexOptions['parent_id']) { |
|
95 | + $boards[] = $row_board['id_board']; |
|
96 | + } |
|
93 | 97 | |
94 | 98 | if ($boardIndexOptions['include_categories']) |
95 | 99 | { |
@@ -111,8 +115,9 @@ discard block |
||
111 | 115 | } |
112 | 116 | |
113 | 117 | // If this board has new posts in it (and isn't the recycle bin!) then the category is new. |
114 | - if (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $row_board['id_board']) |
|
115 | - $categories[$row_board['id_cat']]['new'] |= empty($row_board['is_read']) && $row_board['poster_name'] != ''; |
|
118 | + if (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $row_board['id_board']) { |
|
119 | + $categories[$row_board['id_cat']]['new'] |= empty($row_board['is_read']) && $row_board['poster_name'] != ''; |
|
120 | + } |
|
116 | 121 | |
117 | 122 | // Avoid showing category unread link where it only has redirection boards. |
118 | 123 | $categories[$row_board['id_cat']]['show_unread'] = !empty($categories[$row_board['id_cat']]['show_unread']) ? 1 : !$row_board['is_redirect']; |
@@ -161,14 +166,12 @@ discard block |
||
161 | 166 | { |
162 | 167 | $this_category[$row_board['id_board']]['board_class'] = 'redirect'; |
163 | 168 | $this_category[$row_board['id_board']]['board_tooltip'] = $txt['redirect_board']; |
164 | - } |
|
165 | - elseif ($this_category[$row_board['id_board']]['new'] || $context['user']['is_guest']) |
|
169 | + } elseif ($this_category[$row_board['id_board']]['new'] || $context['user']['is_guest']) |
|
166 | 170 | { |
167 | 171 | // If we're showing to guests, we want to give them the idea that something interesting is going on! |
168 | 172 | $this_category[$row_board['id_board']]['board_class'] = 'on'; |
169 | 173 | $this_category[$row_board['id_board']]['board_tooltip'] = $txt['new_posts']; |
170 | - } |
|
171 | - else |
|
174 | + } else |
|
172 | 175 | { |
173 | 176 | $this_category[$row_board['id_board']]['board_tooltip'] = $txt['old_posts']; |
174 | 177 | } |
@@ -219,14 +222,16 @@ discard block |
||
219 | 222 | // Child of a child... just add it on... |
220 | 223 | elseif (!empty($boardIndexOptions['countChildPosts'])) |
221 | 224 | { |
222 | - if (!isset($parent_map)) |
|
223 | - $parent_map = array(); |
|
225 | + if (!isset($parent_map)) { |
|
226 | + $parent_map = array(); |
|
227 | + } |
|
224 | 228 | |
225 | - if (!isset($parent_map[$row_board['id_parent']])) |
|
226 | - foreach ($this_category as $id => $board) |
|
229 | + if (!isset($parent_map[$row_board['id_parent']])) { |
|
230 | + foreach ($this_category as $id => $board) |
|
227 | 231 | { |
228 | 232 | if (!isset($board['children'][$row_board['id_parent']])) |
229 | 233 | continue; |
234 | + } |
|
230 | 235 | |
231 | 236 | $parent_map[$row_board['id_parent']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['id_parent']]); |
232 | 237 | $parent_map[$row_board['id_board']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['id_parent']]); |
@@ -247,8 +252,9 @@ discard block |
||
247 | 252 | continue; |
248 | 253 | } |
249 | 254 | // Found a child of a child - skip. |
250 | - else |
|
251 | - continue; |
|
255 | + else { |
|
256 | + continue; |
|
257 | + } |
|
252 | 258 | |
253 | 259 | // Prepare the subject, and make sure it's not too long. |
254 | 260 | censorText($row_board['subject']); |
@@ -269,12 +275,13 @@ discard block |
||
269 | 275 | 'topic' => $row_board['id_topic'] |
270 | 276 | ); |
271 | 277 | |
272 | - if (!empty($settings['avatars_on_boardIndex'])) |
|
273 | - $this_last_post['member']['avatar'] = set_avatar_data(array( |
|
278 | + if (!empty($settings['avatars_on_boardIndex'])) { |
|
279 | + $this_last_post['member']['avatar'] = set_avatar_data(array( |
|
274 | 280 | 'avatar' => $row_board['avatar'], |
275 | 281 | 'email' => $row_board['email_address'], |
276 | 282 | 'filename' => !empty($row_board['member_filename']) ? $row_board['member_filename'] : '', |
277 | 283 | )); |
284 | + } |
|
278 | 285 | |
279 | 286 | // Provide the href and link. |
280 | 287 | if ($row_board['subject'] != '') |
@@ -286,8 +293,7 @@ discard block |
||
286 | 293 | link, href, subject, start (where they should go for the first unread post.), |
287 | 294 | and member. (which has id, name, link, href, username in it.) */ |
288 | 295 | $this_last_post['last_post_message'] = sprintf($txt['last_post_message'], $this_last_post['member']['link'], $this_last_post['link'], $this_last_post['time']); |
289 | - } |
|
290 | - else |
|
296 | + } else |
|
291 | 297 | { |
292 | 298 | $this_last_post['href'] = ''; |
293 | 299 | $this_last_post['link'] = $txt['not_applicable']; |
@@ -295,8 +301,9 @@ discard block |
||
295 | 301 | } |
296 | 302 | |
297 | 303 | // Set the last post in the parent board. |
298 | - if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || ($isChild && !empty($row_board['poster_time']) && $this_category[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time']))) |
|
299 | - $this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'] = $this_last_post; |
|
304 | + if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || ($isChild && !empty($row_board['poster_time']) && $this_category[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time']))) { |
|
305 | + $this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'] = $this_last_post; |
|
306 | + } |
|
300 | 307 | // Just in the child...? |
301 | 308 | if ($isChild) |
302 | 309 | { |
@@ -306,15 +313,17 @@ discard block |
||
306 | 313 | $this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['new'] &= $row_board['poster_name'] != ''; |
307 | 314 | } |
308 | 315 | // No last post for this board? It's not new then, is it..? |
309 | - elseif ($row_board['poster_name'] == '') |
|
310 | - $this_category[$row_board['id_board']]['new'] = false; |
|
316 | + elseif ($row_board['poster_name'] == '') { |
|
317 | + $this_category[$row_board['id_board']]['new'] = false; |
|
318 | + } |
|
311 | 319 | |
312 | 320 | // Determine a global most recent topic. |
313 | - if (!empty($boardIndexOptions['set_latest_post']) && !empty($row_board['poster_time']) && $row_board['poster_time'] > $latest_post['timestamp'] && !$ignoreThisBoard) |
|
314 | - $latest_post = array( |
|
321 | + if (!empty($boardIndexOptions['set_latest_post']) && !empty($row_board['poster_time']) && $row_board['poster_time'] > $latest_post['timestamp'] && !$ignoreThisBoard) { |
|
322 | + $latest_post = array( |
|
315 | 323 | 'timestamp' => $row_board['poster_time'], |
316 | 324 | 'ref' => &$this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'], |
317 | 325 | ); |
326 | + } |
|
318 | 327 | } |
319 | 328 | $smcFunc['db_free_result']($result_boards); |
320 | 329 | |
@@ -331,8 +340,9 @@ discard block |
||
331 | 340 | if (!empty($moderators[$board['id']])) |
332 | 341 | { |
333 | 342 | $categories[$k]['boards'][$j]['moderators'] = $moderators[$board['id']]; |
334 | - foreach ($moderators[$board['id']] as $moderator) |
|
335 | - $categories[$k]['boards'][$j]['link_moderators'][] = $moderator['link']; |
|
343 | + foreach ($moderators[$board['id']] as $moderator) { |
|
344 | + $categories[$k]['boards'][$j]['link_moderators'][] = $moderator['link']; |
|
345 | + } |
|
336 | 346 | } |
337 | 347 | if (!empty($groups[$board['id']])) |
338 | 348 | { |
@@ -345,16 +355,16 @@ discard block |
||
345 | 355 | } |
346 | 356 | } |
347 | 357 | } |
348 | - } |
|
349 | - else |
|
358 | + } else |
|
350 | 359 | { |
351 | 360 | foreach ($this_category as $k => $board) |
352 | 361 | { |
353 | 362 | if (!empty($moderators[$board['id']])) |
354 | 363 | { |
355 | 364 | $this_category[$k]['moderators'] = $moderators[$board['id']]; |
356 | - foreach ($moderators[$board['id']] as $moderator) |
|
357 | - $this_category[$k]['link_moderators'][] = $moderator['link']; |
|
365 | + foreach ($moderators[$board['id']] as $moderator) { |
|
366 | + $this_category[$k]['link_moderators'][] = $moderator['link']; |
|
367 | + } |
|
358 | 368 | } |
359 | 369 | if (!empty($groups[$board['id']])) |
360 | 370 | { |
@@ -368,20 +378,23 @@ discard block |
||
368 | 378 | } |
369 | 379 | } |
370 | 380 | |
371 | - if ($boardIndexOptions['include_categories']) |
|
372 | - sortCategories($categories); |
|
373 | - else |
|
374 | - sortBoards($this_category); |
|
381 | + if ($boardIndexOptions['include_categories']) { |
|
382 | + sortCategories($categories); |
|
383 | + } else { |
|
384 | + sortBoards($this_category); |
|
385 | + } |
|
375 | 386 | |
376 | 387 | // By now we should know the most recent post...if we wanna know it that is. |
377 | - if (!empty($boardIndexOptions['set_latest_post']) && !empty($latest_post['ref'])) |
|
378 | - $context['latest_post'] = $latest_post['ref']; |
|
388 | + if (!empty($boardIndexOptions['set_latest_post']) && !empty($latest_post['ref'])) { |
|
389 | + $context['latest_post'] = $latest_post['ref']; |
|
390 | + } |
|
379 | 391 | |
380 | 392 | // I can't remember why but trying to make a ternary to get this all in one line is actually a Very Bad Idea. |
381 | - if ($boardIndexOptions['include_categories']) |
|
382 | - call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$categories)); |
|
383 | - else |
|
384 | - call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$this_category)); |
|
393 | + if ($boardIndexOptions['include_categories']) { |
|
394 | + call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$categories)); |
|
395 | + } else { |
|
396 | + call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$this_category)); |
|
397 | + } |
|
385 | 398 | |
386 | 399 | return $boardIndexOptions['include_categories'] ? $categories : $this_category; |
387 | 400 | } |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 4 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Downloads an avatar or attachment based on $_GET['attach'], and increments the download count. |
@@ -40,11 +41,11 @@ discard block |
||
40 | 41 | |
41 | 42 | if (!empty($modSettings['enableCompressedOutput']) && !headers_sent() && ob_get_length() == 0) |
42 | 43 | { |
43 | - if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler') |
|
44 | - $modSettings['enableCompressedOutput'] = 0; |
|
45 | - |
|
46 | - else |
|
47 | - ob_start('ob_gzhandler'); |
|
44 | + if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler') { |
|
45 | + $modSettings['enableCompressedOutput'] = 0; |
|
46 | + } else { |
|
47 | + ob_start('ob_gzhandler'); |
|
48 | + } |
|
48 | 49 | } |
49 | 50 | |
50 | 51 | if (empty($modSettings['enableCompressedOutput'])) |
@@ -76,8 +77,9 @@ discard block |
||
76 | 77 | } |
77 | 78 | |
78 | 79 | // Use cache when possible. |
79 | - if (($cache = cache_get_data('attachment_lookup_id-' . $attachId)) != null) |
|
80 | - list($file, $thumbFile) = $cache; |
|
80 | + if (($cache = cache_get_data('attachment_lookup_id-' . $attachId)) != null) { |
|
81 | + list($file, $thumbFile) = $cache; |
|
82 | + } |
|
81 | 83 | |
82 | 84 | // Get the info from the DB. |
83 | 85 | if (empty($file) || empty($thumbFile) && !empty($file['id_thumb'])) |
@@ -85,10 +87,9 @@ discard block |
||
85 | 87 | // Do we have a hook wanting to use our attachment system? We use $attachRequest to prevent accidental usage of $request. |
86 | 88 | $attachRequest = null; |
87 | 89 | call_integration_hook('integrate_download_request', array(&$attachRequest)); |
88 | - if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest)) |
|
89 | - $request = $attachRequest; |
|
90 | - |
|
91 | - else |
|
90 | + if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest)) { |
|
91 | + $request = $attachRequest; |
|
92 | + } else |
|
92 | 93 | { |
93 | 94 | // Make sure this attachment is on this board and load its info while we are at it. |
94 | 95 | $request = $smcFunc['db_query']('', ' |
@@ -181,13 +182,15 @@ discard block |
||
181 | 182 | } |
182 | 183 | |
183 | 184 | // Cache it. |
184 | - if (!empty($file) || !empty($thumbFile)) |
|
185 | - cache_put_data('attachment_lookup_id-' . $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900)); |
|
185 | + if (!empty($file) || !empty($thumbFile)) { |
|
186 | + cache_put_data('attachment_lookup_id-' . $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900)); |
|
187 | + } |
|
186 | 188 | } |
187 | 189 | |
188 | 190 | // Replace the normal file with its thumbnail if it has one! |
189 | - if (!empty($showThumb) && !empty($thumbFile)) |
|
190 | - $file = $thumbFile; |
|
191 | + if (!empty($showThumb) && !empty($thumbFile)) { |
|
192 | + $file = $thumbFile; |
|
193 | + } |
|
191 | 194 | |
192 | 195 | // No point in a nicer message, because this is supposed to be an attachment anyway... |
193 | 196 | if (!file_exists($file['filePath'])) |
@@ -237,8 +240,8 @@ discard block |
||
237 | 240 | } |
238 | 241 | |
239 | 242 | // Update the download counter (unless it's a thumbnail or resuming an incomplete download). |
240 | - if ($file['attachment_type'] != 3 && empty($showThumb) && $range === 0) |
|
241 | - $smcFunc['db_query']('', ' |
|
243 | + if ($file['attachment_type'] != 3 && empty($showThumb) && $range === 0) { |
|
244 | + $smcFunc['db_query']('', ' |
|
242 | 245 | UPDATE {db_prefix}attachments |
243 | 246 | SET downloads = downloads + 1 |
244 | 247 | WHERE id_attach = {int:id_attach}', |
@@ -246,12 +249,14 @@ discard block |
||
246 | 249 | 'id_attach' => $attachId, |
247 | 250 | ) |
248 | 251 | ); |
252 | + } |
|
249 | 253 | |
250 | 254 | // Send the attachment headers. |
251 | 255 | header('Pragma: '); |
252 | 256 | |
253 | - if (!isBrowser('gecko')) |
|
254 | - header('Content-Transfer-Encoding: binary'); |
|
257 | + if (!isBrowser('gecko')) { |
|
258 | + header('Content-Transfer-Encoding: binary'); |
|
259 | + } |
|
255 | 260 | |
256 | 261 | header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT'); |
257 | 262 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($file['filePath'])) . ' GMT'); |
@@ -260,18 +265,19 @@ discard block |
||
260 | 265 | header('ETag: ' . $eTag); |
261 | 266 | |
262 | 267 | // Make sure the mime type warrants an inline display. |
263 | - if (isset($_REQUEST['image']) && !empty($file['mime_type']) && strpos($file['mime_type'], 'image/') !== 0) |
|
264 | - unset($_REQUEST['image']); |
|
268 | + if (isset($_REQUEST['image']) && !empty($file['mime_type']) && strpos($file['mime_type'], 'image/') !== 0) { |
|
269 | + unset($_REQUEST['image']); |
|
270 | + } |
|
265 | 271 | |
266 | 272 | // Does this have a mime type? |
267 | - elseif (!empty($file['mime_type']) && (isset($_REQUEST['image']) || !in_array($file['fileext'], array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff')))) |
|
268 | - header('Content-Type: ' . strtr($file['mime_type'], array('image/bmp' => 'image/x-ms-bmp'))); |
|
269 | - |
|
270 | - else |
|
273 | + elseif (!empty($file['mime_type']) && (isset($_REQUEST['image']) || !in_array($file['fileext'], array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff')))) { |
|
274 | + header('Content-Type: ' . strtr($file['mime_type'], array('image/bmp' => 'image/x-ms-bmp'))); |
|
275 | + } else |
|
271 | 276 | { |
272 | 277 | header('Content-Type: ' . (isBrowser('ie') || isBrowser('opera') ? 'application/octetstream' : 'application/octet-stream')); |
273 | - if (isset($_REQUEST['image'])) |
|
274 | - unset($_REQUEST['image']); |
|
278 | + if (isset($_REQUEST['image'])) { |
|
279 | + unset($_REQUEST['image']); |
|
280 | + } |
|
275 | 281 | } |
276 | 282 | |
277 | 283 | // Convert the file to UTF-8, cuz most browsers dig that. |
@@ -279,24 +285,22 @@ discard block |
||
279 | 285 | $disposition = !isset($_REQUEST['image']) ? 'attachment' : 'inline'; |
280 | 286 | |
281 | 287 | // Different browsers like different standards... |
282 | - if (isBrowser('firefox')) |
|
283 | - header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name))); |
|
284 | - |
|
285 | - elseif (isBrowser('opera')) |
|
286 | - header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"'); |
|
287 | - |
|
288 | - elseif (isBrowser('ie')) |
|
289 | - header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"'); |
|
290 | - |
|
291 | - else |
|
292 | - header('Content-Disposition: ' . $disposition . '; filename="' . $utf8name . '"'); |
|
288 | + if (isBrowser('firefox')) { |
|
289 | + header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name))); |
|
290 | + } elseif (isBrowser('opera')) { |
|
291 | + header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"'); |
|
292 | + } elseif (isBrowser('ie')) { |
|
293 | + header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"'); |
|
294 | + } else { |
|
295 | + header('Content-Disposition: ' . $disposition . '; filename="' . $utf8name . '"'); |
|
296 | + } |
|
293 | 297 | |
294 | 298 | // If this has an "image extension" - but isn't actually an image - then ensure it isn't cached cause of silly IE. |
295 | - if (!isset($_REQUEST['image']) && in_array($file['fileext'], array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff'))) |
|
296 | - header('Cache-Control: no-cache'); |
|
297 | - |
|
298 | - else |
|
299 | - header('Cache-Control: max-age=' . (525600 * 60) . ', private'); |
|
299 | + if (!isset($_REQUEST['image']) && in_array($file['fileext'], array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff'))) { |
|
300 | + header('Cache-Control: no-cache'); |
|
301 | + } else { |
|
302 | + header('Cache-Control: max-age=' . (525600 * 60) . ', private'); |
|
303 | + } |
|
300 | 304 | |
301 | 305 | // Multipart and resuming support |
302 | 306 | if (isset($_SERVER['HTTP_RANGE'])) |
@@ -304,9 +308,9 @@ discard block |
||
304 | 308 | header("HTTP/1.1 206 Partial Content"); |
305 | 309 | header("Content-Length: $new_length"); |
306 | 310 | header("Content-Range: bytes $range-$range_end/$size"); |
311 | + } else { |
|
312 | + header("Content-Length: " . $size); |
|
307 | 313 | } |
308 | - else |
|
309 | - header("Content-Length: " . $size); |
|
310 | 314 | |
311 | 315 | |
312 | 316 | // Try to buy some time... |
@@ -315,8 +319,9 @@ discard block |
||
315 | 319 | // For multipart/resumable downloads, send the requested chunk(s) of the file |
316 | 320 | if (isset($_SERVER['HTTP_RANGE'])) |
317 | 321 | { |
318 | - while (@ob_get_level() > 0) |
|
319 | - @ob_end_clean(); |
|
322 | + while (@ob_get_level() > 0) { |
|
323 | + @ob_end_clean(); |
|
324 | + } |
|
320 | 325 | |
321 | 326 | // 40 kilobytes is a good-ish amount |
322 | 327 | $chunksize = 40 * 1024; |
@@ -340,8 +345,9 @@ discard block |
||
340 | 345 | elseif ($size > 4194304) |
341 | 346 | { |
342 | 347 | // Forcibly end any output buffering going on. |
343 | - while (@ob_get_level() > 0) |
|
344 | - @ob_end_clean(); |
|
348 | + while (@ob_get_level() > 0) { |
|
349 | + @ob_end_clean(); |
|
350 | + } |
|
345 | 351 | |
346 | 352 | $fp = fopen($file['filePath'], 'rb'); |
347 | 353 | while (!feof($fp)) |
@@ -353,8 +359,9 @@ discard block |
||
353 | 359 | } |
354 | 360 | |
355 | 361 | // On some of the less-bright hosts, readfile() is disabled. It's just a faster, more byte safe, version of what's in the if. |
356 | - elseif (@readfile($file['filePath']) === null) |
|
357 | - echo file_get_contents($file['filePath']); |
|
362 | + elseif (@readfile($file['filePath']) === null) { |
|
363 | + echo file_get_contents($file['filePath']); |
|
364 | + } |
|
358 | 365 | |
359 | 366 | die(); |
360 | 367 | } |
@@ -898,13 +898,13 @@ |
||
898 | 898 | if ($start_char === 'C') |
899 | 899 | $limit_seek = $limit; |
900 | 900 | else |
901 | - $limit_seek = $limit + 1; |
|
901 | + $limit_seek = $limit + 1; |
|
902 | 902 | |
903 | 903 | $request = $smcFunc['db_query']('', ' |
904 | 904 | SELECT id_msg, id_member, approved |
905 | 905 | FROM {db_prefix}messages |
906 | 906 | WHERE id_topic = {int:current_topic} |
907 | - AND id_msg '. $page_operator . ' {int:page_id}'. (!$modSettings['postmod_active'] || $approve_posts ? '' : ' |
|
907 | + AND id_msg '. $page_operator . ' {int:page_id}' . (!$modSettings['postmod_active'] || $approve_posts ? '' : ' |
|
908 | 908 | AND (approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR id_member = {int:current_member}') . ')') . ' |
909 | 909 | ORDER BY id_msg ' . ($ascending ? '' : 'DESC') . ($context['messages_per_page'] == -1 ? '' : ' |
910 | 910 | LIMIT {int:limit}'), |
@@ -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 | * The central part of the board - topic display. |
@@ -34,8 +35,9 @@ discard block |
||
34 | 35 | global $messages_request, $language, $smcFunc; |
35 | 36 | |
36 | 37 | // What are you gonna display if these are empty?! |
37 | - if (empty($topic)) |
|
38 | - fatal_lang_error('no_board', false); |
|
38 | + if (empty($topic)) { |
|
39 | + fatal_lang_error('no_board', false); |
|
40 | + } |
|
39 | 41 | |
40 | 42 | // Load the proper template. |
41 | 43 | loadTemplate('Display'); |
@@ -52,15 +54,17 @@ discard block |
||
52 | 54 | $context['messages_per_page'] = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) ? $options['messages_per_page'] : $modSettings['defaultMaxMessages']; |
53 | 55 | |
54 | 56 | // Let's do some work on what to search index. |
55 | - if (count($_GET) > 2) |
|
56 | - foreach ($_GET as $k => $v) |
|
57 | + if (count($_GET) > 2) { |
|
58 | + foreach ($_GET as $k => $v) |
|
57 | 59 | { |
58 | 60 | if (!in_array($k, array('topic', 'board', 'start', session_name()))) |
59 | 61 | $context['robot_no_index'] = true; |
62 | + } |
|
60 | 63 | } |
61 | 64 | |
62 | - if (!empty($_REQUEST['start']) && (!is_numeric($_REQUEST['start']) || $_REQUEST['start'] % $context['messages_per_page'] != 0)) |
|
63 | - $context['robot_no_index'] = true; |
|
65 | + if (!empty($_REQUEST['start']) && (!is_numeric($_REQUEST['start']) || $_REQUEST['start'] % $context['messages_per_page'] != 0)) { |
|
66 | + $context['robot_no_index'] = true; |
|
67 | + } |
|
64 | 68 | |
65 | 69 | // Find the previous or next topic. Make a fuss if there are no more. |
66 | 70 | if (isset($_REQUEST['prev_next']) && ($_REQUEST['prev_next'] == 'prev' || $_REQUEST['prev_next'] == 'next')) |
@@ -172,8 +176,9 @@ discard block |
||
172 | 176 | $topic_parameters |
173 | 177 | ); |
174 | 178 | |
175 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
176 | - fatal_lang_error('not_a_topic', false, 404); |
|
179 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
180 | + fatal_lang_error('not_a_topic', false, 404); |
|
181 | + } |
|
177 | 182 | $context['topicinfo'] = $smcFunc['db_fetch_assoc']($request); |
178 | 183 | $smcFunc['db_free_result']($request); |
179 | 184 | |
@@ -210,8 +215,9 @@ discard block |
||
210 | 215 | $context['topic_unwatched'] = isset($context['topicinfo']['unwatched']) ? $context['topicinfo']['unwatched'] : 0; |
211 | 216 | |
212 | 217 | // Add up unapproved replies to get real number of replies... |
213 | - if ($modSettings['postmod_active'] && $approve_posts) |
|
214 | - $context['real_num_replies'] += $context['topicinfo']['unapproved_posts'] - ($context['topicinfo']['approved'] ? 0 : 1); |
|
218 | + if ($modSettings['postmod_active'] && $approve_posts) { |
|
219 | + $context['real_num_replies'] += $context['topicinfo']['unapproved_posts'] - ($context['topicinfo']['approved'] ? 0 : 1); |
|
220 | + } |
|
215 | 221 | |
216 | 222 | // If this topic has unapproved posts, we need to work out how many posts the user can see, for page indexing. |
217 | 223 | if ($modSettings['postmod_active'] && $context['topicinfo']['unapproved_posts'] && !$user_info['is_guest'] && !$approve_posts) |
@@ -231,11 +237,11 @@ discard block |
||
231 | 237 | $smcFunc['db_free_result']($request); |
232 | 238 | |
233 | 239 | $context['total_visible_posts'] = $context['num_replies'] + $myUnapprovedPosts + ($context['topicinfo']['approved'] ? 1 : 0); |
240 | + } elseif ($user_info['is_guest']) { |
|
241 | + $context['total_visible_posts'] = $context['num_replies'] + ($context['topicinfo']['approved'] ? 1 : 0); |
|
242 | + } else { |
|
243 | + $context['total_visible_posts'] = $context['num_replies'] + $context['topicinfo']['unapproved_posts'] + ($context['topicinfo']['approved'] ? 1 : 0); |
|
234 | 244 | } |
235 | - elseif ($user_info['is_guest']) |
|
236 | - $context['total_visible_posts'] = $context['num_replies'] + ($context['topicinfo']['approved'] ? 1 : 0); |
|
237 | - else |
|
238 | - $context['total_visible_posts'] = $context['num_replies'] + $context['topicinfo']['unapproved_posts'] + ($context['topicinfo']['approved'] ? 1 : 0); |
|
239 | 245 | |
240 | 246 | // The start isn't a number; it's information about what to do, where to go. |
241 | 247 | if (!is_numeric($_REQUEST['start'])) |
@@ -248,8 +254,7 @@ discard block |
||
248 | 254 | { |
249 | 255 | $context['start_from'] = $context['total_visible_posts'] - 1; |
250 | 256 | $_REQUEST['start'] = empty($options['view_newest_first']) ? $context['start_from'] : 0; |
251 | - } |
|
252 | - else |
|
257 | + } else |
|
253 | 258 | { |
254 | 259 | // Find the earliest unread message in the topic. (the use of topics here is just for both tables.) |
255 | 260 | $request = $smcFunc['db_query']('', ' |
@@ -277,9 +282,9 @@ discard block |
||
277 | 282 | if (substr($_REQUEST['start'], 0, 4) == 'from') |
278 | 283 | { |
279 | 284 | $timestamp = (int) substr($_REQUEST['start'], 4); |
280 | - if ($timestamp === 0) |
|
281 | - $_REQUEST['start'] = 0; |
|
282 | - else |
|
285 | + if ($timestamp === 0) { |
|
286 | + $_REQUEST['start'] = 0; |
|
287 | + } else |
|
283 | 288 | { |
284 | 289 | // Find the number of messages posted before said time... |
285 | 290 | $request = $smcFunc['db_query']('', ' |
@@ -307,11 +312,11 @@ discard block |
||
307 | 312 | elseif (substr($_REQUEST['start'], 0, 3) == 'msg') |
308 | 313 | { |
309 | 314 | $virtual_msg = (int) substr($_REQUEST['start'], 3); |
310 | - if (!$context['topicinfo']['unapproved_posts'] && $virtual_msg >= $context['topicinfo']['id_last_msg']) |
|
311 | - $context['start_from'] = $context['total_visible_posts'] - 1; |
|
312 | - elseif (!$context['topicinfo']['unapproved_posts'] && $virtual_msg <= $context['topicinfo']['id_first_msg']) |
|
313 | - $context['start_from'] = 0; |
|
314 | - else |
|
315 | + if (!$context['topicinfo']['unapproved_posts'] && $virtual_msg >= $context['topicinfo']['id_last_msg']) { |
|
316 | + $context['start_from'] = $context['total_visible_posts'] - 1; |
|
317 | + } elseif (!$context['topicinfo']['unapproved_posts'] && $virtual_msg <= $context['topicinfo']['id_first_msg']) { |
|
318 | + $context['start_from'] = 0; |
|
319 | + } else |
|
315 | 320 | { |
316 | 321 | // Find the start value for that message...... |
317 | 322 | $request = $smcFunc['db_query']('', ' |
@@ -394,21 +399,25 @@ discard block |
||
394 | 399 | ); |
395 | 400 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
396 | 401 | { |
397 | - if (empty($row['id_member'])) |
|
398 | - continue; |
|
402 | + if (empty($row['id_member'])) { |
|
403 | + continue; |
|
404 | + } |
|
399 | 405 | |
400 | - if (!empty($row['online_color'])) |
|
401 | - $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>'; |
|
402 | - else |
|
403 | - $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
406 | + if (!empty($row['online_color'])) { |
|
407 | + $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>'; |
|
408 | + } else { |
|
409 | + $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
410 | + } |
|
404 | 411 | |
405 | 412 | $is_buddy = in_array($row['id_member'], $user_info['buddies']); |
406 | - if ($is_buddy) |
|
407 | - $link = '<strong>' . $link . '</strong>'; |
|
413 | + if ($is_buddy) { |
|
414 | + $link = '<strong>' . $link . '</strong>'; |
|
415 | + } |
|
408 | 416 | |
409 | 417 | // Add them both to the list and to the more detailed list. |
410 | - if (!empty($row['show_online']) || allowedTo('moderate_forum')) |
|
411 | - $context['view_members_list'][$row['log_time'] . $row['member_name']] = empty($row['show_online']) ? '<em>' . $link . '</em>' : $link; |
|
418 | + if (!empty($row['show_online']) || allowedTo('moderate_forum')) { |
|
419 | + $context['view_members_list'][$row['log_time'] . $row['member_name']] = empty($row['show_online']) ? '<em>' . $link . '</em>' : $link; |
|
420 | + } |
|
412 | 421 | $context['view_members'][$row['log_time'] . $row['member_name']] = array( |
413 | 422 | 'id' => $row['id_member'], |
414 | 423 | 'username' => $row['member_name'], |
@@ -420,8 +429,9 @@ discard block |
||
420 | 429 | 'hidden' => empty($row['show_online']), |
421 | 430 | ); |
422 | 431 | |
423 | - if (empty($row['show_online'])) |
|
424 | - $context['view_num_hidden']++; |
|
432 | + if (empty($row['show_online'])) { |
|
433 | + $context['view_num_hidden']++; |
|
434 | + } |
|
425 | 435 | } |
426 | 436 | |
427 | 437 | // The number of guests is equal to the rows minus the ones we actually used ;). |
@@ -435,11 +445,13 @@ discard block |
||
435 | 445 | |
436 | 446 | // If all is set, but not allowed... just unset it. |
437 | 447 | $can_show_all = !empty($modSettings['enableAllMessages']) && $context['total_visible_posts'] > $context['messages_per_page'] && $context['total_visible_posts'] < $modSettings['enableAllMessages']; |
438 | - if (isset($_REQUEST['all']) && !$can_show_all) |
|
439 | - unset($_REQUEST['all']); |
|
448 | + if (isset($_REQUEST['all']) && !$can_show_all) { |
|
449 | + unset($_REQUEST['all']); |
|
450 | + } |
|
440 | 451 | // Otherwise, it must be allowed... so pretend start was -1. |
441 | - elseif (isset($_REQUEST['all'])) |
|
442 | - $_REQUEST['start'] = -1; |
|
452 | + elseif (isset($_REQUEST['all'])) { |
|
453 | + $_REQUEST['start'] = -1; |
|
454 | + } |
|
443 | 455 | |
444 | 456 | // Construct the page index, allowing for the .START method... |
445 | 457 | $context['page_index'] = constructPageIndex($scripturl . '?topic=' . $topic . '.%1$d', $_REQUEST['start'], $context['total_visible_posts'], $context['messages_per_page'], true); |
@@ -476,8 +488,9 @@ discard block |
||
476 | 488 | $_REQUEST['start'] = 0; |
477 | 489 | } |
478 | 490 | // They aren't using it, but the *option* is there, at least. |
479 | - else |
|
480 | - $context['page_index'] .= ' <a href="' . $scripturl . '?topic=' . $topic . '.0;all">' . $txt['all'] . '</a> '; |
|
491 | + else { |
|
492 | + $context['page_index'] .= ' <a href="' . $scripturl . '?topic=' . $topic . '.0;all">' . $txt['all'] . '</a> '; |
|
493 | + } |
|
481 | 494 | } |
482 | 495 | |
483 | 496 | // Build the link tree. |
@@ -493,14 +506,16 @@ discard block |
||
493 | 506 | if (!empty($board_info['moderators'])) |
494 | 507 | { |
495 | 508 | // Add a link for each moderator... |
496 | - foreach ($board_info['moderators'] as $mod) |
|
497 | - $context['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod['name'] . '</a>'; |
|
509 | + foreach ($board_info['moderators'] as $mod) { |
|
510 | + $context['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod['name'] . '</a>'; |
|
511 | + } |
|
498 | 512 | } |
499 | 513 | if (!empty($board_info['moderator_groups'])) |
500 | 514 | { |
501 | 515 | // Add a link for each moderator group as well... |
502 | - foreach ($board_info['moderator_groups'] as $mod_group) |
|
503 | - $context['link_moderators'][] = '<a href="' . $scripturl . '?action=groups;sa=viewmemberes;group=' . $mod_group['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod_group['name'] . '</a>'; |
|
516 | + foreach ($board_info['moderator_groups'] as $mod_group) { |
|
517 | + $context['link_moderators'][] = '<a href="' . $scripturl . '?action=groups;sa=viewmemberes;group=' . $mod_group['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod_group['name'] . '</a>'; |
|
518 | + } |
|
504 | 519 | } |
505 | 520 | |
506 | 521 | if (!empty($context['link_moderators'])) |
@@ -531,9 +546,9 @@ discard block |
||
531 | 546 | // For quick reply we need a response prefix in the default forum language. |
532 | 547 | if (!isset($context['response_prefix']) && !($context['response_prefix'] = cache_get_data('response_prefix', 600))) |
533 | 548 | { |
534 | - if ($language === $user_info['language']) |
|
535 | - $context['response_prefix'] = $txt['response_prefix']; |
|
536 | - else |
|
549 | + if ($language === $user_info['language']) { |
|
550 | + $context['response_prefix'] = $txt['response_prefix']; |
|
551 | + } else |
|
537 | 552 | { |
538 | 553 | loadLanguage('index', $language, false); |
539 | 554 | $context['response_prefix'] = $txt['response_prefix']; |
@@ -565,8 +580,9 @@ discard block |
||
565 | 580 | list($start, $end, $allday, $span, $tz, $tz_abbrev) = buildEventDatetimes($row); |
566 | 581 | |
567 | 582 | // Sanity check |
568 | - if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) |
|
569 | - continue; |
|
583 | + if (!empty($start['error_count']) || !empty($start['warning_count']) || !empty($end['error_count']) || !empty($end['warning_count'])) { |
|
584 | + continue; |
|
585 | + } |
|
570 | 586 | |
571 | 587 | $linked_calendar_event = array( |
572 | 588 | 'id' => $row['id_event'], |
@@ -615,8 +631,9 @@ discard block |
||
615 | 631 | } |
616 | 632 | $smcFunc['db_free_result']($request); |
617 | 633 | |
618 | - if (!empty($context['linked_calendar_events'])) |
|
619 | - $context['linked_calendar_events'][count($context['linked_calendar_events']) - 1]['is_last'] = true; |
|
634 | + if (!empty($context['linked_calendar_events'])) { |
|
635 | + $context['linked_calendar_events'][count($context['linked_calendar_events']) - 1]['is_last'] = true; |
|
636 | + } |
|
620 | 637 | } |
621 | 638 | |
622 | 639 | // Create the poll info if it exists. |
@@ -679,8 +696,9 @@ discard block |
||
679 | 696 | $smcFunc['db_free_result']($request); |
680 | 697 | |
681 | 698 | // Got we multi choice? |
682 | - if ($pollinfo['max_votes'] > 1) |
|
683 | - $realtotal = $pollinfo['total']; |
|
699 | + if ($pollinfo['max_votes'] > 1) { |
|
700 | + $realtotal = $pollinfo['total']; |
|
701 | + } |
|
684 | 702 | |
685 | 703 | // If this is a guest we need to do our best to work out if they have voted, and what they voted for. |
686 | 704 | if ($user_info['is_guest'] && $pollinfo['guest_vote'] && allowedTo('poll_vote')) |
@@ -693,20 +711,21 @@ discard block |
||
693 | 711 | foreach ($guestinfo as $i => $guestvoted) |
694 | 712 | { |
695 | 713 | $guestvoted = explode(',', $guestvoted); |
696 | - if ($guestvoted[0] == $context['topicinfo']['id_poll']) |
|
697 | - break; |
|
714 | + if ($guestvoted[0] == $context['topicinfo']['id_poll']) { |
|
715 | + break; |
|
716 | + } |
|
698 | 717 | } |
699 | 718 | // Has the poll been reset since guest voted? |
700 | 719 | if ($pollinfo['reset_poll'] > $guestvoted[1]) |
701 | 720 | { |
702 | 721 | // Remove the poll info from the cookie to allow guest to vote again |
703 | 722 | unset($guestinfo[$i]); |
704 | - if (!empty($guestinfo)) |
|
705 | - $_COOKIE['guest_poll_vote'] = ';' . implode(';', $guestinfo); |
|
706 | - else |
|
707 | - unset($_COOKIE['guest_poll_vote']); |
|
708 | - } |
|
709 | - else |
|
723 | + if (!empty($guestinfo)) { |
|
724 | + $_COOKIE['guest_poll_vote'] = ';' . implode(';', $guestinfo); |
|
725 | + } else { |
|
726 | + unset($_COOKIE['guest_poll_vote']); |
|
727 | + } |
|
728 | + } else |
|
710 | 729 | { |
711 | 730 | // What did they vote for? |
712 | 731 | unset($guestvoted[0], $guestvoted[1]); |
@@ -820,23 +839,29 @@ discard block |
||
820 | 839 | // Build the poll moderation button array. |
821 | 840 | $context['poll_buttons'] = array(); |
822 | 841 | |
823 | - if ($context['allow_return_vote']) |
|
824 | - $context['poll_buttons']['vote'] = array('text' => 'poll_return_vote', 'image' => 'poll_options.png', 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']); |
|
842 | + if ($context['allow_return_vote']) { |
|
843 | + $context['poll_buttons']['vote'] = array('text' => 'poll_return_vote', 'image' => 'poll_options.png', 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']); |
|
844 | + } |
|
825 | 845 | |
826 | - if ($context['show_view_results_button']) |
|
827 | - $context['poll_buttons']['results'] = array('text' => 'poll_results', 'image' => 'poll_results.png', 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start'] . ';viewresults'); |
|
846 | + if ($context['show_view_results_button']) { |
|
847 | + $context['poll_buttons']['results'] = array('text' => 'poll_results', 'image' => 'poll_results.png', 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start'] . ';viewresults'); |
|
848 | + } |
|
828 | 849 | |
829 | - if ($context['allow_change_vote']) |
|
830 | - $context['poll_buttons']['change_vote'] = array('text' => 'poll_change_vote', 'image' => 'poll_change_vote.png', 'url' => $scripturl . '?action=vote;topic=' . $context['current_topic'] . '.' . $context['start'] . ';poll=' . $context['poll']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
850 | + if ($context['allow_change_vote']) { |
|
851 | + $context['poll_buttons']['change_vote'] = array('text' => 'poll_change_vote', 'image' => 'poll_change_vote.png', 'url' => $scripturl . '?action=vote;topic=' . $context['current_topic'] . '.' . $context['start'] . ';poll=' . $context['poll']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
852 | + } |
|
831 | 853 | |
832 | - if ($context['allow_lock_poll']) |
|
833 | - $context['poll_buttons']['lock'] = array('text' => (!$context['poll']['is_locked'] ? 'poll_lock' : 'poll_unlock'), 'image' => 'poll_lock.png', 'url' => $scripturl . '?action=lockvoting;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
854 | + if ($context['allow_lock_poll']) { |
|
855 | + $context['poll_buttons']['lock'] = array('text' => (!$context['poll']['is_locked'] ? 'poll_lock' : 'poll_unlock'), 'image' => 'poll_lock.png', 'url' => $scripturl . '?action=lockvoting;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
856 | + } |
|
834 | 857 | |
835 | - if ($context['allow_edit_poll']) |
|
836 | - $context['poll_buttons']['edit'] = array('text' => 'poll_edit', 'image' => 'poll_edit.png', 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']); |
|
858 | + if ($context['allow_edit_poll']) { |
|
859 | + $context['poll_buttons']['edit'] = array('text' => 'poll_edit', 'image' => 'poll_edit.png', 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']); |
|
860 | + } |
|
837 | 861 | |
838 | - if ($context['can_remove_poll']) |
|
839 | - $context['poll_buttons']['remove_poll'] = array('text' => 'poll_remove', 'image' => 'admin_remove_poll.png', 'custom' => 'data-confirm="' . $txt['poll_remove_warn'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
862 | + if ($context['can_remove_poll']) { |
|
863 | + $context['poll_buttons']['remove_poll'] = array('text' => 'poll_remove', 'image' => 'admin_remove_poll.png', 'custom' => 'data-confirm="' . $txt['poll_remove_warn'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
864 | + } |
|
840 | 865 | |
841 | 866 | // Allow mods to add additional buttons here |
842 | 867 | call_integration_hook('integrate_poll_buttons'); |
@@ -871,9 +896,9 @@ discard block |
||
871 | 896 | { |
872 | 897 | $start_char = 'C'; |
873 | 898 | $page_id = $context['topicinfo']['id_first_msg']; |
899 | + } else { |
|
900 | + $start_char = null; |
|
874 | 901 | } |
875 | - else |
|
876 | - $start_char = null; |
|
877 | 902 | |
878 | 903 | $limit = $context['messages_per_page']; |
879 | 904 | |
@@ -888,17 +913,17 @@ discard block |
||
888 | 913 | { |
889 | 914 | $ascending = true; |
890 | 915 | $page_operator = '>='; |
891 | - } |
|
892 | - else |
|
916 | + } else |
|
893 | 917 | { |
894 | 918 | $ascending = false; |
895 | 919 | $page_operator = '<='; |
896 | 920 | } |
897 | 921 | |
898 | - if ($start_char === 'C') |
|
899 | - $limit_seek = $limit; |
|
900 | - else |
|
901 | - $limit_seek = $limit + 1; |
|
922 | + if ($start_char === 'C') { |
|
923 | + $limit_seek = $limit; |
|
924 | + } else { |
|
925 | + $limit_seek = $limit + 1; |
|
926 | + } |
|
902 | 927 | |
903 | 928 | $request = $smcFunc['db_query']('', ' |
904 | 929 | SELECT id_msg, id_member, approved |
@@ -921,21 +946,23 @@ discard block |
||
921 | 946 | $found_msg = false; |
922 | 947 | |
923 | 948 | // Fallback |
924 | - if ($smcFunc['db_num_rows']($request) < 1) |
|
925 | - unset($start_char); |
|
926 | - else |
|
949 | + if ($smcFunc['db_num_rows']($request) < 1) { |
|
950 | + unset($start_char); |
|
951 | + } else |
|
927 | 952 | { |
928 | 953 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
929 | 954 | { |
930 | 955 | // Check if the start msg is in our result |
931 | - if ($row['id_msg'] == $page_id) |
|
932 | - $found_msg = true; |
|
956 | + if ($row['id_msg'] == $page_id) { |
|
957 | + $found_msg = true; |
|
958 | + } |
|
933 | 959 | |
934 | 960 | // Skip the the start msg if we not in mode C |
935 | 961 | if ($start_char === 'C' || $row['id_msg'] != $page_id) |
936 | 962 | { |
937 | - if (!empty($row['id_member'])) |
|
938 | - $all_posters[$row['id_msg']] = $row['id_member']; |
|
963 | + if (!empty($row['id_member'])) { |
|
964 | + $all_posters[$row['id_msg']] = $row['id_member']; |
|
965 | + } |
|
939 | 966 | |
940 | 967 | $messages[] = $row['id_msg']; |
941 | 968 | } |
@@ -951,8 +978,9 @@ discard block |
||
951 | 978 | } |
952 | 979 | |
953 | 980 | // Before Page bring in the right order |
954 | - if (!empty($start_char) && $start_char === 'L') |
|
955 | - krsort($messages); |
|
981 | + if (!empty($start_char) && $start_char === 'L') { |
|
982 | + krsort($messages); |
|
983 | + } |
|
956 | 984 | } |
957 | 985 | |
958 | 986 | // Jump to page |
@@ -989,14 +1017,16 @@ discard block |
||
989 | 1017 | |
990 | 1018 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
991 | 1019 | { |
992 | - if (!empty($row['id_member'])) |
|
993 | - $all_posters[$row['id_msg']] = $row['id_member']; |
|
1020 | + if (!empty($row['id_member'])) { |
|
1021 | + $all_posters[$row['id_msg']] = $row['id_member']; |
|
1022 | + } |
|
994 | 1023 | $messages[] = $row['id_msg']; |
995 | 1024 | } |
996 | 1025 | |
997 | 1026 | // Sort the messages into the correct display order |
998 | - if (!$ascending) |
|
999 | - sort($messages); |
|
1027 | + if (!$ascending) { |
|
1028 | + sort($messages); |
|
1029 | + } |
|
1000 | 1030 | } |
1001 | 1031 | |
1002 | 1032 | // Remember the paging data for next time |
@@ -1016,8 +1046,9 @@ discard block |
||
1016 | 1046 | if (!$user_info['is_guest'] && !empty($messages)) |
1017 | 1047 | { |
1018 | 1048 | $mark_at_msg = max($messages); |
1019 | - if ($mark_at_msg >= $context['topicinfo']['id_last_msg']) |
|
1020 | - $mark_at_msg = $modSettings['maxMsgID']; |
|
1049 | + if ($mark_at_msg >= $context['topicinfo']['id_last_msg']) { |
|
1050 | + $mark_at_msg = $modSettings['maxMsgID']; |
|
1051 | + } |
|
1021 | 1052 | if ($mark_at_msg >= $context['topicinfo']['new_from']) |
1022 | 1053 | { |
1023 | 1054 | $smcFunc['db_insert']($context['topicinfo']['new_from'] == 0 ? 'ignore' : 'replace', |
@@ -1049,8 +1080,9 @@ discard block |
||
1049 | 1080 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1050 | 1081 | { |
1051 | 1082 | // Find if this topic is marked for notification... |
1052 | - if (!empty($row['id_topic'])) |
|
1053 | - $context['is_marked_notify'] = true; |
|
1083 | + if (!empty($row['id_topic'])) { |
|
1084 | + $context['is_marked_notify'] = true; |
|
1085 | + } |
|
1054 | 1086 | |
1055 | 1087 | // Only do this once, but mark the notifications as "not sent yet" for next time. |
1056 | 1088 | if (!empty($row['sent']) && $do_once) |
@@ -1072,8 +1104,9 @@ discard block |
||
1072 | 1104 | } |
1073 | 1105 | |
1074 | 1106 | // Have we recently cached the number of new topics in this board, and it's still a lot? |
1075 | - if (isset($_REQUEST['topicseen']) && isset($_SESSION['topicseen_cache'][$board]) && $_SESSION['topicseen_cache'][$board] > 5) |
|
1076 | - $_SESSION['topicseen_cache'][$board]--; |
|
1107 | + if (isset($_REQUEST['topicseen']) && isset($_SESSION['topicseen_cache'][$board]) && $_SESSION['topicseen_cache'][$board] > 5) { |
|
1108 | + $_SESSION['topicseen_cache'][$board]--; |
|
1109 | + } |
|
1077 | 1110 | // Mark board as seen if this is the only new topic. |
1078 | 1111 | elseif (isset($_REQUEST['topicseen'])) |
1079 | 1112 | { |
@@ -1097,14 +1130,16 @@ discard block |
||
1097 | 1130 | $smcFunc['db_free_result']($request); |
1098 | 1131 | |
1099 | 1132 | // If there're no real new topics in this board, mark the board as seen. |
1100 | - if (empty($numNewTopics)) |
|
1101 | - $_REQUEST['boardseen'] = true; |
|
1102 | - else |
|
1103 | - $_SESSION['topicseen_cache'][$board] = $numNewTopics; |
|
1133 | + if (empty($numNewTopics)) { |
|
1134 | + $_REQUEST['boardseen'] = true; |
|
1135 | + } else { |
|
1136 | + $_SESSION['topicseen_cache'][$board] = $numNewTopics; |
|
1137 | + } |
|
1104 | 1138 | } |
1105 | 1139 | // Probably one less topic - maybe not, but even if we decrease this too fast it will only make us look more often. |
1106 | - elseif (isset($_SESSION['topicseen_cache'][$board])) |
|
1107 | - $_SESSION['topicseen_cache'][$board]--; |
|
1140 | + elseif (isset($_SESSION['topicseen_cache'][$board])) { |
|
1141 | + $_SESSION['topicseen_cache'][$board]--; |
|
1142 | + } |
|
1108 | 1143 | |
1109 | 1144 | // Mark board as seen if we came using last post link from BoardIndex. (or other places...) |
1110 | 1145 | if (isset($_REQUEST['boardseen'])) |
@@ -1161,23 +1196,26 @@ discard block |
||
1161 | 1196 | $temp = array(); |
1162 | 1197 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1163 | 1198 | { |
1164 | - if (!$row['approved'] && $modSettings['postmod_active'] && !allowedTo('approve_posts') && (!isset($all_posters[$row['id_msg']]) || $all_posters[$row['id_msg']] != $user_info['id'])) |
|
1165 | - continue; |
|
1199 | + if (!$row['approved'] && $modSettings['postmod_active'] && !allowedTo('approve_posts') && (!isset($all_posters[$row['id_msg']]) || $all_posters[$row['id_msg']] != $user_info['id'])) { |
|
1200 | + continue; |
|
1201 | + } |
|
1166 | 1202 | |
1167 | 1203 | $temp[$row['id_attach']] = $row; |
1168 | 1204 | $temp[$row['id_attach']]['topic'] = $topic; |
1169 | 1205 | $temp[$row['id_attach']]['board'] = $board; |
1170 | 1206 | |
1171 | - if (!isset($context['loaded_attachments'][$row['id_msg']])) |
|
1172 | - $context['loaded_attachments'][$row['id_msg']] = array(); |
|
1207 | + if (!isset($context['loaded_attachments'][$row['id_msg']])) { |
|
1208 | + $context['loaded_attachments'][$row['id_msg']] = array(); |
|
1209 | + } |
|
1173 | 1210 | } |
1174 | 1211 | $smcFunc['db_free_result']($request); |
1175 | 1212 | |
1176 | 1213 | // This is better than sorting it with the query... |
1177 | 1214 | ksort($temp); |
1178 | 1215 | |
1179 | - foreach ($temp as $row) |
|
1180 | - $context['loaded_attachments'][$row['id_msg']][] = $row; |
|
1216 | + foreach ($temp as $row) { |
|
1217 | + $context['loaded_attachments'][$row['id_msg']][] = $row; |
|
1218 | + } |
|
1181 | 1219 | } |
1182 | 1220 | |
1183 | 1221 | $msg_parameters = array( |
@@ -1204,21 +1242,23 @@ discard block |
||
1204 | 1242 | ); |
1205 | 1243 | |
1206 | 1244 | // And the likes |
1207 | - if (!empty($modSettings['enable_likes'])) |
|
1208 | - $context['my_likes'] = $context['user']['is_guest'] ? array() : prepareLikesContext($topic); |
|
1245 | + if (!empty($modSettings['enable_likes'])) { |
|
1246 | + $context['my_likes'] = $context['user']['is_guest'] ? array() : prepareLikesContext($topic); |
|
1247 | + } |
|
1209 | 1248 | |
1210 | 1249 | // Go to the last message if the given time is beyond the time of the last message. |
1211 | - if (isset($context['start_from']) && $context['start_from'] >= $context['topicinfo']['num_replies']) |
|
1212 | - $context['start_from'] = $context['topicinfo']['num_replies']; |
|
1250 | + if (isset($context['start_from']) && $context['start_from'] >= $context['topicinfo']['num_replies']) { |
|
1251 | + $context['start_from'] = $context['topicinfo']['num_replies']; |
|
1252 | + } |
|
1213 | 1253 | |
1214 | 1254 | // Since the anchor information is needed on the top of the page we load these variables beforehand. |
1215 | 1255 | $context['first_message'] = isset($messages[$firstIndex]) ? $messages[$firstIndex] : $messages[0]; |
1216 | - if (empty($options['view_newest_first'])) |
|
1217 | - $context['first_new_message'] = isset($context['start_from']) && $_REQUEST['start'] == $context['start_from']; |
|
1218 | - else |
|
1219 | - $context['first_new_message'] = isset($context['start_from']) && $_REQUEST['start'] == $context['topicinfo']['num_replies'] - $context['start_from']; |
|
1220 | - } |
|
1221 | - else |
|
1256 | + if (empty($options['view_newest_first'])) { |
|
1257 | + $context['first_new_message'] = isset($context['start_from']) && $_REQUEST['start'] == $context['start_from']; |
|
1258 | + } else { |
|
1259 | + $context['first_new_message'] = isset($context['start_from']) && $_REQUEST['start'] == $context['topicinfo']['num_replies'] - $context['start_from']; |
|
1260 | + } |
|
1261 | + } else |
|
1222 | 1262 | { |
1223 | 1263 | $messages_request = false; |
1224 | 1264 | $context['first_message'] = 0; |
@@ -1253,8 +1293,9 @@ discard block |
||
1253 | 1293 | 'can_restore_msg' => 'move_any', |
1254 | 1294 | 'can_like' => 'likes_like', |
1255 | 1295 | ); |
1256 | - foreach ($common_permissions as $contextual => $perm) |
|
1257 | - $context[$contextual] = allowedTo($perm); |
|
1296 | + foreach ($common_permissions as $contextual => $perm) { |
|
1297 | + $context[$contextual] = allowedTo($perm); |
|
1298 | + } |
|
1258 | 1299 | |
1259 | 1300 | // Permissions with _any/_own versions. $context[YYY] => ZZZ_any/_own. |
1260 | 1301 | $anyown_permissions = array( |
@@ -1267,8 +1308,9 @@ discard block |
||
1267 | 1308 | 'can_reply_unapproved' => 'post_unapproved_replies', |
1268 | 1309 | 'can_view_warning' => 'profile_warning', |
1269 | 1310 | ); |
1270 | - foreach ($anyown_permissions as $contextual => $perm) |
|
1271 | - $context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own')); |
|
1311 | + foreach ($anyown_permissions as $contextual => $perm) { |
|
1312 | + $context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own')); |
|
1313 | + } |
|
1272 | 1314 | |
1273 | 1315 | if (!$user_info['is_admin'] && !$modSettings['topic_move_any']) |
1274 | 1316 | { |
@@ -1314,8 +1356,9 @@ discard block |
||
1314 | 1356 | // Check if the draft functions are enabled and that they have permission to use them (for quick reply.) |
1315 | 1357 | $context['drafts_save'] = !empty($modSettings['drafts_post_enabled']) && allowedTo('post_draft') && $context['can_reply']; |
1316 | 1358 | $context['drafts_autosave'] = !empty($context['drafts_save']) && !empty($modSettings['drafts_autosave_enabled']); |
1317 | - if (!empty($context['drafts_save'])) |
|
1318 | - loadLanguage('Drafts'); |
|
1359 | + if (!empty($context['drafts_save'])) { |
|
1360 | + loadLanguage('Drafts'); |
|
1361 | + } |
|
1319 | 1362 | |
1320 | 1363 | // When was the last time this topic was replied to? Should we warn them about it? |
1321 | 1364 | if (!empty($modSettings['oldTopicDays']) && ($context['can_reply'] || $context['can_reply_unapproved']) && empty($context['topicinfo']['is_sticky'])) |
@@ -1376,26 +1419,31 @@ discard block |
||
1376 | 1419 | // Message icons - customized icons are off? |
1377 | 1420 | $context['icons'] = getMessageIcons($board); |
1378 | 1421 | |
1379 | - if (!empty($context['icons'])) |
|
1380 | - $context['icons'][count($context['icons']) - 1]['is_last'] = true; |
|
1422 | + if (!empty($context['icons'])) { |
|
1423 | + $context['icons'][count($context['icons']) - 1]['is_last'] = true; |
|
1424 | + } |
|
1381 | 1425 | |
1382 | 1426 | // Build the normal button array. |
1383 | 1427 | $context['normal_buttons'] = array(); |
1384 | 1428 | |
1385 | - if ($context['can_reply']) |
|
1386 | - $context['normal_buttons']['reply'] = array('text' => 'reply', 'image' => 'reply.png', 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true); |
|
1429 | + if ($context['can_reply']) { |
|
1430 | + $context['normal_buttons']['reply'] = array('text' => 'reply', 'image' => 'reply.png', 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true); |
|
1431 | + } |
|
1387 | 1432 | |
1388 | - if ($context['can_add_poll']) |
|
1389 | - $context['normal_buttons']['add_poll'] = array('text' => 'add_poll', 'image' => 'add_poll.png', 'url' => $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start']); |
|
1433 | + if ($context['can_add_poll']) { |
|
1434 | + $context['normal_buttons']['add_poll'] = array('text' => 'add_poll', 'image' => 'add_poll.png', 'url' => $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start']); |
|
1435 | + } |
|
1390 | 1436 | |
1391 | - if ($context['can_mark_unread']) |
|
1392 | - $context['normal_buttons']['mark_unread'] = array('text' => 'mark_unread', 'image' => 'markunread.png', 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1437 | + if ($context['can_mark_unread']) { |
|
1438 | + $context['normal_buttons']['mark_unread'] = array('text' => 'mark_unread', 'image' => 'markunread.png', 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1439 | + } |
|
1393 | 1440 | |
1394 | - if ($context['can_print']) |
|
1395 | - $context['normal_buttons']['print'] = array('text' => 'print', 'image' => 'print.png', 'custom' => 'rel="nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'); |
|
1441 | + if ($context['can_print']) { |
|
1442 | + $context['normal_buttons']['print'] = array('text' => 'print', 'image' => 'print.png', 'custom' => 'rel="nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'); |
|
1443 | + } |
|
1396 | 1444 | |
1397 | - if ($context['can_set_notify']) |
|
1398 | - $context['normal_buttons']['notify'] = array( |
|
1445 | + if ($context['can_set_notify']) { |
|
1446 | + $context['normal_buttons']['notify'] = array( |
|
1399 | 1447 | 'text' => 'notify_topic_' . $context['topic_notification_mode'], |
1400 | 1448 | 'sub_buttons' => array( |
1401 | 1449 | array( |
@@ -1417,38 +1465,47 @@ discard block |
||
1417 | 1465 | ), |
1418 | 1466 | ), |
1419 | 1467 | ); |
1468 | + } |
|
1420 | 1469 | |
1421 | 1470 | // Build the mod button array |
1422 | 1471 | $context['mod_buttons'] = array(); |
1423 | 1472 | |
1424 | - if ($context['can_move']) |
|
1425 | - $context['mod_buttons']['move'] = array('text' => 'move_topic', 'image' => 'admin_move.png', 'url' => $scripturl . '?action=movetopic;current_board=' . $context['current_board'] . ';topic=' . $context['current_topic'] . '.0'); |
|
1473 | + if ($context['can_move']) { |
|
1474 | + $context['mod_buttons']['move'] = array('text' => 'move_topic', 'image' => 'admin_move.png', 'url' => $scripturl . '?action=movetopic;current_board=' . $context['current_board'] . ';topic=' . $context['current_topic'] . '.0'); |
|
1475 | + } |
|
1426 | 1476 | |
1427 | - if ($context['can_delete']) |
|
1428 | - $context['mod_buttons']['delete'] = array('text' => 'remove_topic', 'image' => 'admin_rem.png', 'custom' => 'data-confirm="' . $txt['are_sure_remove_topic'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id']); |
|
1477 | + if ($context['can_delete']) { |
|
1478 | + $context['mod_buttons']['delete'] = array('text' => 'remove_topic', 'image' => 'admin_rem.png', 'custom' => 'data-confirm="' . $txt['are_sure_remove_topic'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id']); |
|
1479 | + } |
|
1429 | 1480 | |
1430 | - if ($context['can_lock']) |
|
1431 | - $context['mod_buttons']['lock'] = array('text' => empty($context['is_locked']) ? 'set_lock' : 'set_unlock', 'image' => 'admin_lock.png', 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1481 | + if ($context['can_lock']) { |
|
1482 | + $context['mod_buttons']['lock'] = array('text' => empty($context['is_locked']) ? 'set_lock' : 'set_unlock', 'image' => 'admin_lock.png', 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1483 | + } |
|
1432 | 1484 | |
1433 | - if ($context['can_sticky']) |
|
1434 | - $context['mod_buttons']['sticky'] = array('text' => empty($context['is_sticky']) ? 'set_sticky' : 'set_nonsticky', 'image' => 'admin_sticky.png', 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1485 | + if ($context['can_sticky']) { |
|
1486 | + $context['mod_buttons']['sticky'] = array('text' => empty($context['is_sticky']) ? 'set_sticky' : 'set_nonsticky', 'image' => 'admin_sticky.png', 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1487 | + } |
|
1435 | 1488 | |
1436 | - if ($context['can_merge']) |
|
1437 | - $context['mod_buttons']['merge'] = array('text' => 'merge', 'image' => 'merge.png', 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']); |
|
1489 | + if ($context['can_merge']) { |
|
1490 | + $context['mod_buttons']['merge'] = array('text' => 'merge', 'image' => 'merge.png', 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']); |
|
1491 | + } |
|
1438 | 1492 | |
1439 | - if ($context['calendar_post']) |
|
1440 | - $context['mod_buttons']['calendar'] = array('text' => 'calendar_link', 'image' => 'linktocal.png', 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0'); |
|
1493 | + if ($context['calendar_post']) { |
|
1494 | + $context['mod_buttons']['calendar'] = array('text' => 'calendar_link', 'image' => 'linktocal.png', 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0'); |
|
1495 | + } |
|
1441 | 1496 | |
1442 | 1497 | // Restore topic. eh? No monkey business. |
1443 | - if ($context['can_restore_topic']) |
|
1444 | - $context['mod_buttons']['restore_topic'] = array('text' => 'restore_topic', 'image' => '', 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1498 | + if ($context['can_restore_topic']) { |
|
1499 | + $context['mod_buttons']['restore_topic'] = array('text' => 'restore_topic', 'image' => '', 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1500 | + } |
|
1445 | 1501 | |
1446 | 1502 | // Show a message in case a recently posted message became unapproved. |
1447 | 1503 | $context['becomesUnapproved'] = !empty($_SESSION['becomesUnapproved']) ? true : false; |
1448 | 1504 | |
1449 | 1505 | // Don't want to show this forever... |
1450 | - if ($context['becomesUnapproved']) |
|
1451 | - unset($_SESSION['becomesUnapproved']); |
|
1506 | + if ($context['becomesUnapproved']) { |
|
1507 | + unset($_SESSION['becomesUnapproved']); |
|
1508 | + } |
|
1452 | 1509 | |
1453 | 1510 | // Allow adding new mod buttons easily. |
1454 | 1511 | // Note: $context['normal_buttons'] and $context['mod_buttons'] are added for backward compatibility with 2.0, but are deprecated and should not be used |
@@ -1457,12 +1514,14 @@ discard block |
||
1457 | 1514 | call_integration_hook('integrate_mod_buttons', array(&$context['mod_buttons'])); |
1458 | 1515 | |
1459 | 1516 | // Load the drafts js file |
1460 | - if ($context['drafts_autosave']) |
|
1461 | - loadJavaScriptFile('drafts.js', array('defer' => false), 'smf_drafts'); |
|
1517 | + if ($context['drafts_autosave']) { |
|
1518 | + loadJavaScriptFile('drafts.js', array('defer' => false), 'smf_drafts'); |
|
1519 | + } |
|
1462 | 1520 | |
1463 | 1521 | // Spellcheck |
1464 | - if ($context['show_spellchecking']) |
|
1465 | - loadJavaScriptFile('spellcheck.js', array('defer' => false), 'smf_spellcheck'); |
|
1522 | + if ($context['show_spellchecking']) { |
|
1523 | + loadJavaScriptFile('spellcheck.js', array('defer' => false), 'smf_spellcheck'); |
|
1524 | + } |
|
1466 | 1525 | |
1467 | 1526 | // topic.js |
1468 | 1527 | loadJavaScriptFile('topic.js', array('defer' => false), 'smf_topic'); |
@@ -1496,16 +1555,19 @@ discard block |
||
1496 | 1555 | static $counter = null; |
1497 | 1556 | |
1498 | 1557 | // If the query returned false, bail. |
1499 | - if ($messages_request == false) |
|
1500 | - return false; |
|
1558 | + if ($messages_request == false) { |
|
1559 | + return false; |
|
1560 | + } |
|
1501 | 1561 | |
1502 | 1562 | // Remember which message this is. (ie. reply #83) |
1503 | - if ($counter === null || $reset) |
|
1504 | - $counter = empty($options['view_newest_first']) ? $context['start'] : $context['total_visible_posts'] - $context['start']; |
|
1563 | + if ($counter === null || $reset) { |
|
1564 | + $counter = empty($options['view_newest_first']) ? $context['start'] : $context['total_visible_posts'] - $context['start']; |
|
1565 | + } |
|
1505 | 1566 | |
1506 | 1567 | // Start from the beginning... |
1507 | - if ($reset) |
|
1508 | - return @$smcFunc['db_data_seek']($messages_request, 0); |
|
1568 | + if ($reset) { |
|
1569 | + return @$smcFunc['db_data_seek']($messages_request, 0); |
|
1570 | + } |
|
1509 | 1571 | |
1510 | 1572 | // Attempt to get the next message. |
1511 | 1573 | $message = $smcFunc['db_fetch_assoc']($messages_request); |
@@ -1519,19 +1581,21 @@ discard block |
||
1519 | 1581 | if (empty($context['icon_sources'])) |
1520 | 1582 | { |
1521 | 1583 | $context['icon_sources'] = array(); |
1522 | - foreach ($context['stable_icons'] as $icon) |
|
1523 | - $context['icon_sources'][$icon] = 'images_url'; |
|
1584 | + foreach ($context['stable_icons'] as $icon) { |
|
1585 | + $context['icon_sources'][$icon] = 'images_url'; |
|
1586 | + } |
|
1524 | 1587 | } |
1525 | 1588 | |
1526 | 1589 | // Message Icon Management... check the images exist. |
1527 | 1590 | if (empty($modSettings['messageIconChecks_disable'])) |
1528 | 1591 | { |
1529 | 1592 | // If the current icon isn't known, then we need to do something... |
1530 | - if (!isset($context['icon_sources'][$message['icon']])) |
|
1531 | - $context['icon_sources'][$message['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
1593 | + if (!isset($context['icon_sources'][$message['icon']])) { |
|
1594 | + $context['icon_sources'][$message['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['icon'] . '.png') ? 'images_url' : 'default_images_url'; |
|
1595 | + } |
|
1596 | + } elseif (!isset($context['icon_sources'][$message['icon']])) { |
|
1597 | + $context['icon_sources'][$message['icon']] = 'images_url'; |
|
1532 | 1598 | } |
1533 | - elseif (!isset($context['icon_sources'][$message['icon']])) |
|
1534 | - $context['icon_sources'][$message['icon']] = 'images_url'; |
|
1535 | 1599 | |
1536 | 1600 | // If you're a lazy bum, you probably didn't give a subject... |
1537 | 1601 | $message['subject'] = $message['subject'] != '' ? $message['subject'] : $txt['no_subject']; |
@@ -1556,8 +1620,7 @@ discard block |
||
1556 | 1620 | $memberContext[$message['id_member']]['email'] = $message['poster_email']; |
1557 | 1621 | $memberContext[$message['id_member']]['show_email'] = allowedTo('moderate_forum'); |
1558 | 1622 | $memberContext[$message['id_member']]['is_guest'] = true; |
1559 | - } |
|
1560 | - else |
|
1623 | + } else |
|
1561 | 1624 | { |
1562 | 1625 | // Define this here to make things a bit more readable |
1563 | 1626 | $can_view_warning = $context['user']['can_mod'] || allowedTo('view_warning_any') || ($message['id_member'] == $user_info['id'] && allowedTo('view_warning_own')); |
@@ -1580,8 +1643,9 @@ discard block |
||
1580 | 1643 | $message['body'] = parse_bbc($message['body'], $message['smileys_enabled'], $message['id_msg']); |
1581 | 1644 | |
1582 | 1645 | // If it's in the recycle bin we need to override whatever icon we did have. |
1583 | - if (!empty($board_info['recycle'])) |
|
1584 | - $message['icon'] = 'recycled'; |
|
1646 | + if (!empty($board_info['recycle'])) { |
|
1647 | + $message['icon'] = 'recycled'; |
|
1648 | + } |
|
1585 | 1649 | |
1586 | 1650 | require_once($sourcedir . '/Subs-Attachments.php'); |
1587 | 1651 | |
@@ -1625,32 +1689,36 @@ discard block |
||
1625 | 1689 | } |
1626 | 1690 | |
1627 | 1691 | // Are likes enable? |
1628 | - if (!empty($modSettings['enable_likes'])) |
|
1629 | - $output['likes'] = array( |
|
1692 | + if (!empty($modSettings['enable_likes'])) { |
|
1693 | + $output['likes'] = array( |
|
1630 | 1694 | 'count' => $message['likes'], |
1631 | 1695 | 'you' => in_array($message['id_msg'], $context['my_likes']), |
1632 | 1696 | 'can_like' => !$context['user']['is_guest'] && $message['id_member'] != $context['user']['id'] && !empty($context['can_like']), |
1633 | 1697 | ); |
1698 | + } |
|
1634 | 1699 | |
1635 | 1700 | // Is this user the message author? |
1636 | 1701 | $output['is_message_author'] = $message['id_member'] == $user_info['id']; |
1637 | - if (!empty($output['modified']['name'])) |
|
1638 | - $output['modified']['last_edit_text'] = sprintf($txt['last_edit_by'], $output['modified']['time'], $output['modified']['name']); |
|
1702 | + if (!empty($output['modified']['name'])) { |
|
1703 | + $output['modified']['last_edit_text'] = sprintf($txt['last_edit_by'], $output['modified']['time'], $output['modified']['name']); |
|
1704 | + } |
|
1639 | 1705 | |
1640 | 1706 | // Did they give a reason for editing? |
1641 | - if (!empty($output['modified']['name']) && !empty($output['modified']['reason'])) |
|
1642 | - $output['modified']['last_edit_text'] .= ' ' . sprintf($txt['last_edit_reason'], $output['modified']['reason']); |
|
1707 | + if (!empty($output['modified']['name']) && !empty($output['modified']['reason'])) { |
|
1708 | + $output['modified']['last_edit_text'] .= ' ' . sprintf($txt['last_edit_reason'], $output['modified']['reason']); |
|
1709 | + } |
|
1643 | 1710 | |
1644 | 1711 | // Any custom profile fields? |
1645 | - if (!empty($memberContext[$message['id_member']]['custom_fields'])) |
|
1646 | - foreach ($memberContext[$message['id_member']]['custom_fields'] as $custom) |
|
1712 | + if (!empty($memberContext[$message['id_member']]['custom_fields'])) { |
|
1713 | + foreach ($memberContext[$message['id_member']]['custom_fields'] as $custom) |
|
1647 | 1714 | $output['custom_fields'][$context['cust_profile_fields_placement'][$custom['placement']]][] = $custom; |
1715 | + } |
|
1648 | 1716 | |
1649 | - if (empty($options['view_newest_first'])) |
|
1650 | - $counter++; |
|
1651 | - |
|
1652 | - else |
|
1653 | - $counter--; |
|
1717 | + if (empty($options['view_newest_first'])) { |
|
1718 | + $counter++; |
|
1719 | + } else { |
|
1720 | + $counter--; |
|
1721 | + } |
|
1654 | 1722 | |
1655 | 1723 | call_integration_hook('integrate_prepare_display_context', array(&$output, &$message, $counter)); |
1656 | 1724 | |
@@ -1676,8 +1744,9 @@ discard block |
||
1676 | 1744 | */ |
1677 | 1745 | function approved_attach_sort($a, $b) |
1678 | 1746 | { |
1679 | - if ($a['is_approved'] == $b['is_approved']) |
|
1680 | - return 0; |
|
1747 | + if ($a['is_approved'] == $b['is_approved']) { |
|
1748 | + return 0; |
|
1749 | + } |
|
1681 | 1750 | |
1682 | 1751 | return $a['is_approved'] > $b['is_approved'] ? -1 : 1; |
1683 | 1752 | } |
@@ -1694,16 +1763,19 @@ discard block |
||
1694 | 1763 | |
1695 | 1764 | require_once($sourcedir . '/RemoveTopic.php'); |
1696 | 1765 | |
1697 | - if (empty($_REQUEST['msgs'])) |
|
1698 | - redirectexit('topic=' . $topic . '.' . $_REQUEST['start']); |
|
1766 | + if (empty($_REQUEST['msgs'])) { |
|
1767 | + redirectexit('topic=' . $topic . '.' . $_REQUEST['start']); |
|
1768 | + } |
|
1699 | 1769 | |
1700 | 1770 | $messages = array(); |
1701 | - foreach ($_REQUEST['msgs'] as $dummy) |
|
1702 | - $messages[] = (int) $dummy; |
|
1771 | + foreach ($_REQUEST['msgs'] as $dummy) { |
|
1772 | + $messages[] = (int) $dummy; |
|
1773 | + } |
|
1703 | 1774 | |
1704 | 1775 | // We are restoring messages. We handle this in another place. |
1705 | - if (isset($_REQUEST['restore_selected'])) |
|
1706 | - redirectexit('action=restoretopic;msgs=' . implode(',', $messages) . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1776 | + if (isset($_REQUEST['restore_selected'])) { |
|
1777 | + redirectexit('action=restoretopic;msgs=' . implode(',', $messages) . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
1778 | + } |
|
1707 | 1779 | if (isset($_REQUEST['split_selection'])) |
1708 | 1780 | { |
1709 | 1781 | $request = $smcFunc['db_query']('', ' |
@@ -1722,8 +1794,9 @@ discard block |
||
1722 | 1794 | } |
1723 | 1795 | |
1724 | 1796 | // Allowed to delete any message? |
1725 | - if (allowedTo('delete_any')) |
|
1726 | - $allowed_all = true; |
|
1797 | + if (allowedTo('delete_any')) { |
|
1798 | + $allowed_all = true; |
|
1799 | + } |
|
1727 | 1800 | // Allowed to delete replies to their messages? |
1728 | 1801 | elseif (allowedTo('delete_replies')) |
1729 | 1802 | { |
@@ -1740,13 +1813,14 @@ discard block |
||
1740 | 1813 | $smcFunc['db_free_result']($request); |
1741 | 1814 | |
1742 | 1815 | $allowed_all = $starter == $user_info['id']; |
1816 | + } else { |
|
1817 | + $allowed_all = false; |
|
1743 | 1818 | } |
1744 | - else |
|
1745 | - $allowed_all = false; |
|
1746 | 1819 | |
1747 | 1820 | // Make sure they're allowed to delete their own messages, if not any. |
1748 | - if (!$allowed_all) |
|
1749 | - isAllowedTo('delete_own'); |
|
1821 | + if (!$allowed_all) { |
|
1822 | + isAllowedTo('delete_own'); |
|
1823 | + } |
|
1750 | 1824 | |
1751 | 1825 | // Allowed to remove which messages? |
1752 | 1826 | $request = $smcFunc['db_query']('', ' |
@@ -1766,8 +1840,9 @@ discard block |
||
1766 | 1840 | $messages = array(); |
1767 | 1841 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1768 | 1842 | { |
1769 | - if (!$allowed_all && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + $modSettings['edit_disable_time'] * 60 < time()) |
|
1770 | - continue; |
|
1843 | + if (!$allowed_all && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + $modSettings['edit_disable_time'] * 60 < time()) { |
|
1844 | + continue; |
|
1845 | + } |
|
1771 | 1846 | |
1772 | 1847 | $messages[$row['id_msg']] = array($row['subject'], $row['id_member']); |
1773 | 1848 | } |
@@ -1790,17 +1865,20 @@ discard block |
||
1790 | 1865 | foreach ($messages as $message => $info) |
1791 | 1866 | { |
1792 | 1867 | // Just skip the first message - if it's not the last. |
1793 | - if ($message == $first_message && $message != $last_message) |
|
1794 | - continue; |
|
1868 | + if ($message == $first_message && $message != $last_message) { |
|
1869 | + continue; |
|
1870 | + } |
|
1795 | 1871 | // If the first message is going then don't bother going back to the topic as we're effectively deleting it. |
1796 | - elseif ($message == $first_message) |
|
1797 | - $topicGone = true; |
|
1872 | + elseif ($message == $first_message) { |
|
1873 | + $topicGone = true; |
|
1874 | + } |
|
1798 | 1875 | |
1799 | 1876 | removeMessage($message); |
1800 | 1877 | |
1801 | 1878 | // Log this moderation action ;). |
1802 | - if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id'])) |
|
1803 | - logAction('delete', array('topic' => $topic, 'subject' => $info[0], 'member' => $info[1], 'board' => $board)); |
|
1879 | + if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id'])) { |
|
1880 | + logAction('delete', array('topic' => $topic, 'subject' => $info[0], 'member' => $info[1], 'board' => $board)); |
|
1881 | + } |
|
1804 | 1882 | } |
1805 | 1883 | |
1806 | 1884 | redirectexit(!empty($topicGone) ? 'board=' . $board : 'topic=' . $topic . '.' . $_REQUEST['start']); |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 4 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Add the functions implemented in this file to the $smcFunc array. |
@@ -23,8 +24,8 @@ discard block |
||
23 | 24 | { |
24 | 25 | global $smcFunc; |
25 | 26 | |
26 | - if (!isset($smcFunc['db_backup_table']) || $smcFunc['db_backup_table'] != 'smf_db_backup_table') |
|
27 | - $smcFunc += array( |
|
27 | + if (!isset($smcFunc['db_backup_table']) || $smcFunc['db_backup_table'] != 'smf_db_backup_table') { |
|
28 | + $smcFunc += array( |
|
28 | 29 | 'db_backup_table' => 'smf_db_backup_table', |
29 | 30 | 'db_optimize_table' => 'smf_db_optimize_table', |
30 | 31 | 'db_table_sql' => 'smf_db_table_sql', |
@@ -32,7 +33,8 @@ discard block |
||
32 | 33 | 'db_get_version' => 'smf_db_get_version', |
33 | 34 | 'db_get_vendor' => 'smf_db_get_vendor', |
34 | 35 | ); |
35 | -} |
|
36 | + } |
|
37 | + } |
|
36 | 38 | |
37 | 39 | /** |
38 | 40 | * Backup $table to $backup_table. |
@@ -74,8 +76,9 @@ discard block |
||
74 | 76 | )); |
75 | 77 | |
76 | 78 | // Old school or no school? |
77 | - if ($request) |
|
78 | - return $request; |
|
79 | + if ($request) { |
|
80 | + return $request; |
|
81 | + } |
|
79 | 82 | } |
80 | 83 | |
81 | 84 | // At this point, the quick method failed. |
@@ -99,8 +102,9 @@ discard block |
||
99 | 102 | foreach ($create as $k => $l) |
100 | 103 | { |
101 | 104 | // Get the name of the auto_increment column. |
102 | - if (strpos($l, 'auto_increment')) |
|
103 | - $auto_inc = trim($l); |
|
105 | + if (strpos($l, 'auto_increment')) { |
|
106 | + $auto_inc = trim($l); |
|
107 | + } |
|
104 | 108 | |
105 | 109 | // For the engine type, see if we can work out what it is. |
106 | 110 | if (strpos($l, 'ENGINE') !== false || strpos($l, 'TYPE') !== false) |
@@ -108,30 +112,36 @@ discard block |
||
108 | 112 | // Extract the engine type. |
109 | 113 | preg_match('~(ENGINE|TYPE)=(\w+)(\sDEFAULT)?(\sCHARSET=(\w+))?(\sCOLLATE=(\w+))?~', $l, $match); |
110 | 114 | |
111 | - if (!empty($match[1])) |
|
112 | - $engine = $match[1]; |
|
115 | + if (!empty($match[1])) { |
|
116 | + $engine = $match[1]; |
|
117 | + } |
|
113 | 118 | |
114 | - if (!empty($match[2])) |
|
115 | - $engine = $match[2]; |
|
119 | + if (!empty($match[2])) { |
|
120 | + $engine = $match[2]; |
|
121 | + } |
|
116 | 122 | |
117 | - if (!empty($match[5])) |
|
118 | - $charset = $match[5]; |
|
123 | + if (!empty($match[5])) { |
|
124 | + $charset = $match[5]; |
|
125 | + } |
|
119 | 126 | |
120 | - if (!empty($match[7])) |
|
121 | - $collate = $match[7]; |
|
127 | + if (!empty($match[7])) { |
|
128 | + $collate = $match[7]; |
|
129 | + } |
|
122 | 130 | } |
123 | 131 | |
124 | 132 | // Skip everything but keys... |
125 | - if (strpos($l, 'KEY') === false) |
|
126 | - unset($create[$k]); |
|
133 | + if (strpos($l, 'KEY') === false) { |
|
134 | + unset($create[$k]); |
|
135 | + } |
|
127 | 136 | } |
128 | 137 | |
129 | - if (!empty($create)) |
|
130 | - $create = '( |
|
138 | + if (!empty($create)) { |
|
139 | + $create = '( |
|
131 | 140 | ' . implode(' |
132 | 141 | ', $create) . ')'; |
133 | - else |
|
134 | - $create = ''; |
|
142 | + } else { |
|
143 | + $create = ''; |
|
144 | + } |
|
135 | 145 | |
136 | 146 | $request = $smcFunc['db_query']('', ' |
137 | 147 | CREATE TABLE {raw:backup_table} {raw:create} |
@@ -150,8 +160,9 @@ discard block |
||
150 | 160 | |
151 | 161 | if ($auto_inc != '') |
152 | 162 | { |
153 | - if (preg_match('~\`(.+?)\`\s~', $auto_inc, $match) != 0 && substr($auto_inc, -1, 1) == ',') |
|
154 | - $auto_inc = substr($auto_inc, 0, -1); |
|
163 | + if (preg_match('~\`(.+?)\`\s~', $auto_inc, $match) != 0 && substr($auto_inc, -1, 1) == ',') { |
|
164 | + $auto_inc = substr($auto_inc, 0, -1); |
|
165 | + } |
|
155 | 166 | |
156 | 167 | $smcFunc['db_query']('', ' |
157 | 168 | ALTER TABLE {raw:backup_table} |
@@ -195,8 +206,9 @@ discard block |
||
195 | 206 | 'table' => $table, |
196 | 207 | ) |
197 | 208 | ); |
198 | - if (!$request) |
|
199 | - return -1; |
|
209 | + if (!$request) { |
|
210 | + return -1; |
|
211 | + } |
|
200 | 212 | |
201 | 213 | // How much left? |
202 | 214 | $request = $smcFunc['db_query']('', ' |
@@ -239,8 +251,9 @@ discard block |
||
239 | 251 | ) |
240 | 252 | ); |
241 | 253 | $tables = array(); |
242 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
243 | - $tables[] = $row[0]; |
|
254 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
255 | + $tables[] = $row[0]; |
|
256 | + } |
|
244 | 257 | $smcFunc['db_free_result']($request); |
245 | 258 | |
246 | 259 | return $tables; |
@@ -284,8 +297,9 @@ discard block |
||
284 | 297 | if (!empty($row['Default']) || $row['Null'] !== 'YES') |
285 | 298 | { |
286 | 299 | // Make a special case of auto-timestamp. |
287 | - if ($row['Default'] == 'CURRENT_TIMESTAMP') |
|
288 | - $schema_create .= ' /*!40102 NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP */'; |
|
300 | + if ($row['Default'] == 'CURRENT_TIMESTAMP') { |
|
301 | + $schema_create .= ' /*!40102 NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP */'; |
|
302 | + } |
|
289 | 303 | // Text shouldn't have a default. |
290 | 304 | elseif ($row['Default'] !== null) |
291 | 305 | { |
@@ -320,14 +334,16 @@ discard block |
||
320 | 334 | $row['Key_name'] = $row['Key_name'] == 'PRIMARY' ? 'PRIMARY KEY' : (empty($row['Non_unique']) ? 'UNIQUE ' : ($row['Comment'] == 'FULLTEXT' || (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT') ? 'FULLTEXT ' : 'KEY ')) . '`' . $row['Key_name'] . '`'; |
321 | 335 | |
322 | 336 | // Is this the first column in the index? |
323 | - if (empty($indexes[$row['Key_name']])) |
|
324 | - $indexes[$row['Key_name']] = array(); |
|
337 | + if (empty($indexes[$row['Key_name']])) { |
|
338 | + $indexes[$row['Key_name']] = array(); |
|
339 | + } |
|
325 | 340 | |
326 | 341 | // A sub part, like only indexing 15 characters of a varchar. |
327 | - if (!empty($row['Sub_part'])) |
|
328 | - $indexes[$row['Key_name']][$row['Seq_in_index']] = '`' . $row['Column_name'] . '`(' . $row['Sub_part'] . ')'; |
|
329 | - else |
|
330 | - $indexes[$row['Key_name']][$row['Seq_in_index']] = '`' . $row['Column_name'] . '`'; |
|
342 | + if (!empty($row['Sub_part'])) { |
|
343 | + $indexes[$row['Key_name']][$row['Seq_in_index']] = '`' . $row['Column_name'] . '`(' . $row['Sub_part'] . ')'; |
|
344 | + } else { |
|
345 | + $indexes[$row['Key_name']][$row['Seq_in_index']] = '`' . $row['Column_name'] . '`'; |
|
346 | + } |
|
331 | 347 | } |
332 | 348 | $smcFunc['db_free_result']($result); |
333 | 349 | |
@@ -365,8 +381,9 @@ discard block |
||
365 | 381 | { |
366 | 382 | static $ver; |
367 | 383 | |
368 | - if (!empty($ver)) |
|
369 | - return $ver; |
|
384 | + if (!empty($ver)) { |
|
385 | + return $ver; |
|
386 | + } |
|
370 | 387 | |
371 | 388 | global $smcFunc; |
372 | 389 | |
@@ -391,8 +408,9 @@ discard block |
||
391 | 408 | global $smcFunc; |
392 | 409 | static $db_type; |
393 | 410 | |
394 | - if (!empty($db_type)) |
|
395 | - return $db_type; |
|
411 | + if (!empty($db_type)) { |
|
412 | + return $db_type; |
|
413 | + } |
|
396 | 414 | |
397 | 415 | $request = $smcFunc['db_query']('', |
398 | 416 | 'SELECT VARIABLE_VALUE |
@@ -408,13 +426,15 @@ discard block |
||
408 | 426 | // Skip these if we don't have a comment. |
409 | 427 | if (!empty($comment)) |
410 | 428 | { |
411 | - if (stripos($comment, 'percona') !== false) |
|
412 | - return 'Percona'; |
|
413 | - if (stripos($comment, 'mariadb') !== false) |
|
414 | - return 'MariaDB'; |
|
429 | + if (stripos($comment, 'percona') !== false) { |
|
430 | + return 'Percona'; |
|
431 | + } |
|
432 | + if (stripos($comment, 'mariadb') !== false) { |
|
433 | + return 'MariaDB'; |
|
434 | + } |
|
435 | + } else { |
|
436 | + return 'fail'; |
|
415 | 437 | } |
416 | - else |
|
417 | - return 'fail'; |
|
418 | 438 | |
419 | 439 | return 'MySQL'; |
420 | 440 | } |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | * @version 2.1 Beta 4 |
14 | 14 | */ |
15 | 15 | |
16 | -if (!defined('SMF')) |
|
16 | +if (!defined('SMF')) { |
|
17 | 17 | die('No direct access...'); |
18 | +} |
|
18 | 19 | |
19 | 20 | /** |
20 | 21 | * Main entry point for the admin search settings screen. |
@@ -107,11 +108,13 @@ discard block |
||
107 | 108 | // Perhaps the search method wants to add some settings? |
108 | 109 | require_once($sourcedir . '/Search.php'); |
109 | 110 | $searchAPI = findSearchAPI(); |
110 | - if (is_callable(array($searchAPI, 'searchSettings'))) |
|
111 | - call_user_func_array(array($searchAPI, 'searchSettings'), array(&$config_vars)); |
|
111 | + if (is_callable(array($searchAPI, 'searchSettings'))) { |
|
112 | + call_user_func_array(array($searchAPI, 'searchSettings'), array(&$config_vars)); |
|
113 | + } |
|
112 | 114 | |
113 | - if ($return_config) |
|
114 | - return $config_vars; |
|
115 | + if ($return_config) { |
|
116 | + return $config_vars; |
|
117 | + } |
|
115 | 118 | |
116 | 119 | $context['page_title'] = $txt['search_settings_title']; |
117 | 120 | $context['sub_template'] = 'show_settings'; |
@@ -126,8 +129,9 @@ discard block |
||
126 | 129 | |
127 | 130 | call_integration_hook('integrate_save_search_settings'); |
128 | 131 | |
129 | - if (empty($_POST['search_results_per_page'])) |
|
130 | - $_POST['search_results_per_page'] = !empty($modSettings['search_results_per_page']) ? $modSettings['search_results_per_page'] : $modSettings['defaultMaxMessages']; |
|
132 | + if (empty($_POST['search_results_per_page'])) { |
|
133 | + $_POST['search_results_per_page'] = !empty($modSettings['search_results_per_page']) ? $modSettings['search_results_per_page'] : $modSettings['defaultMaxMessages']; |
|
134 | + } |
|
131 | 135 | saveDBSettings($config_vars); |
132 | 136 | $_SESSION['adm-save'] = true; |
133 | 137 | redirectexit('action=admin;area=managesearch;sa=settings;' . $context['session_var'] . '=' . $context['session_id']); |
@@ -177,17 +181,20 @@ discard block |
||
177 | 181 | call_integration_hook('integrate_save_search_weights'); |
178 | 182 | |
179 | 183 | $changes = array(); |
180 | - foreach ($factors as $factor) |
|
181 | - $changes[$factor] = (int) $_POST[$factor]; |
|
184 | + foreach ($factors as $factor) { |
|
185 | + $changes[$factor] = (int) $_POST[$factor]; |
|
186 | + } |
|
182 | 187 | updateSettings($changes); |
183 | 188 | } |
184 | 189 | |
185 | 190 | $context['relative_weights'] = array('total' => 0); |
186 | - foreach ($factors as $factor) |
|
187 | - $context['relative_weights']['total'] += isset($modSettings[$factor]) ? $modSettings[$factor] : 0; |
|
191 | + foreach ($factors as $factor) { |
|
192 | + $context['relative_weights']['total'] += isset($modSettings[$factor]) ? $modSettings[$factor] : 0; |
|
193 | + } |
|
188 | 194 | |
189 | - foreach ($factors as $factor) |
|
190 | - $context['relative_weights'][$factor] = round(100 * (isset($modSettings[$factor]) ? $modSettings[$factor] : 0) / $context['relative_weights']['total'], 1); |
|
195 | + foreach ($factors as $factor) { |
|
196 | + $context['relative_weights'][$factor] = round(100 * (isset($modSettings[$factor]) ? $modSettings[$factor] : 0) / $context['relative_weights']['total'], 1); |
|
197 | + } |
|
191 | 198 | |
192 | 199 | createToken('admin-msw'); |
193 | 200 | } |
@@ -215,8 +222,9 @@ discard block |
||
215 | 222 | $context['search_apis'] = loadSearchAPIs(); |
216 | 223 | |
217 | 224 | // Detect whether a fulltext index is set. |
218 | - if ($context['supports_fulltext']) |
|
219 | - detectFulltextIndex(); |
|
225 | + if ($context['supports_fulltext']) { |
|
226 | + detectFulltextIndex(); |
|
227 | + } |
|
220 | 228 | |
221 | 229 | if (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'createfulltext') |
222 | 230 | { |
@@ -240,8 +248,7 @@ discard block |
||
240 | 248 | 'language' => $language_ftx |
241 | 249 | ) |
242 | 250 | ); |
243 | - } |
|
244 | - else |
|
251 | + } else |
|
245 | 252 | { |
246 | 253 | // Make sure it's gone before creating it. |
247 | 254 | $smcFunc['db_query']('', ' |
@@ -259,8 +266,7 @@ discard block |
||
259 | 266 | ) |
260 | 267 | ); |
261 | 268 | } |
262 | - } |
|
263 | - elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removefulltext' && !empty($context['fulltext_index'])) |
|
269 | + } elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removefulltext' && !empty($context['fulltext_index'])) |
|
264 | 270 | { |
265 | 271 | checkSession('get'); |
266 | 272 | validateToken('admin-msm', 'get'); |
@@ -277,12 +283,12 @@ discard block |
||
277 | 283 | $context['fulltext_index'] = array(); |
278 | 284 | |
279 | 285 | // Go back to the default search method. |
280 | - if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext') |
|
281 | - updateSettings(array( |
|
286 | + if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext') { |
|
287 | + updateSettings(array( |
|
282 | 288 | 'search_index' => '', |
283 | 289 | )); |
284 | - } |
|
285 | - elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removecustom') |
|
290 | + } |
|
291 | + } elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removecustom') |
|
286 | 292 | { |
287 | 293 | checkSession('get'); |
288 | 294 | validateToken('admin-msm', 'get'); |
@@ -304,12 +310,12 @@ discard block |
||
304 | 310 | )); |
305 | 311 | |
306 | 312 | // Go back to the default search method. |
307 | - if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') |
|
308 | - updateSettings(array( |
|
313 | + if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') { |
|
314 | + updateSettings(array( |
|
309 | 315 | 'search_index' => '', |
310 | 316 | )); |
311 | - } |
|
312 | - elseif (isset($_POST['save'])) |
|
317 | + } |
|
318 | + } elseif (isset($_POST['save'])) |
|
313 | 319 | { |
314 | 320 | checkSession(); |
315 | 321 | validateToken('admin-msmpost'); |
@@ -331,8 +337,8 @@ discard block |
||
331 | 337 | // Get some info about the messages table, to show its size and index size. |
332 | 338 | if ($db_type == 'mysql') |
333 | 339 | { |
334 | - if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) |
|
335 | - $request = $smcFunc['db_query']('', ' |
|
340 | + if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) { |
|
341 | + $request = $smcFunc['db_query']('', ' |
|
336 | 342 | SHOW TABLE STATUS |
337 | 343 | FROM {string:database_name} |
338 | 344 | LIKE {string:table_name}', |
@@ -341,14 +347,15 @@ discard block |
||
341 | 347 | 'table_name' => str_replace('_', '\_', $match[2]) . 'messages', |
342 | 348 | ) |
343 | 349 | ); |
344 | - else |
|
345 | - $request = $smcFunc['db_query']('', ' |
|
350 | + } else { |
|
351 | + $request = $smcFunc['db_query']('', ' |
|
346 | 352 | SHOW TABLE STATUS |
347 | 353 | LIKE {string:table_name}', |
348 | 354 | array( |
349 | 355 | 'table_name' => str_replace('_', '\_', $db_prefix) . 'messages', |
350 | 356 | ) |
351 | 357 | ); |
358 | + } |
|
352 | 359 | if ($request !== false && $smcFunc['db_num_rows']($request) == 1) |
353 | 360 | { |
354 | 361 | // Only do this if the user has permission to execute this query. |
@@ -360,8 +367,8 @@ discard block |
||
360 | 367 | } |
361 | 368 | |
362 | 369 | // Now check the custom index table, if it exists at all. |
363 | - if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) |
|
364 | - $request = $smcFunc['db_query']('', ' |
|
370 | + if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) { |
|
371 | + $request = $smcFunc['db_query']('', ' |
|
365 | 372 | SHOW TABLE STATUS |
366 | 373 | FROM {string:database_name} |
367 | 374 | LIKE {string:table_name}', |
@@ -370,14 +377,15 @@ discard block |
||
370 | 377 | 'table_name' => str_replace('_', '\_', $match[2]) . 'log_search_words', |
371 | 378 | ) |
372 | 379 | ); |
373 | - else |
|
374 | - $request = $smcFunc['db_query']('', ' |
|
380 | + } else { |
|
381 | + $request = $smcFunc['db_query']('', ' |
|
375 | 382 | SHOW TABLE STATUS |
376 | 383 | LIKE {string:table_name}', |
377 | 384 | array( |
378 | 385 | 'table_name' => str_replace('_', '\_', $db_prefix) . 'log_search_words', |
379 | 386 | ) |
380 | 387 | ); |
388 | + } |
|
381 | 389 | if ($request !== false && $smcFunc['db_num_rows']($request) == 1) |
382 | 390 | { |
383 | 391 | // Only do this if the user has permission to execute this query. |
@@ -386,8 +394,7 @@ discard block |
||
386 | 394 | $context['table_info']['custom_index_length'] = $row['Data_length'] + $row['Index_length']; |
387 | 395 | $smcFunc['db_free_result']($request); |
388 | 396 | } |
389 | - } |
|
390 | - elseif ($db_type == 'postgresql') |
|
397 | + } elseif ($db_type == 'postgresql') |
|
391 | 398 | { |
392 | 399 | // In order to report the sizes correctly we need to perform vacuum (optimize) on the tables we will be using. |
393 | 400 | //db_extend(); |
@@ -429,38 +436,38 @@ discard block |
||
429 | 436 | $context['table_info']['data_length'] = (int) $row['table_size']; |
430 | 437 | $context['table_info']['index_length'] = (int) $row['index_size']; |
431 | 438 | $context['table_info']['fulltext_length'] = (int) $row['index_size']; |
432 | - } |
|
433 | - elseif ($row['indexname'] == $db_prefix . 'log_search_words') |
|
439 | + } elseif ($row['indexname'] == $db_prefix . 'log_search_words') |
|
434 | 440 | { |
435 | 441 | $context['table_info']['index_length'] = (int) $row['index_size']; |
436 | 442 | $context['table_info']['custom_index_length'] = (int) $row['index_size']; |
437 | 443 | } |
438 | 444 | } |
439 | 445 | $smcFunc['db_free_result']($request); |
440 | - } |
|
441 | - else |
|
442 | - // Didn't work for some reason... |
|
446 | + } else { |
|
447 | + // Didn't work for some reason... |
|
443 | 448 | $context['table_info'] = array( |
444 | 449 | 'data_length' => $txt['not_applicable'], |
445 | 450 | 'index_length' => $txt['not_applicable'], |
446 | 451 | 'fulltext_length' => $txt['not_applicable'], |
447 | 452 | 'custom_index_length' => $txt['not_applicable'], |
448 | 453 | ); |
449 | - } |
|
450 | - else |
|
451 | - $context['table_info'] = array( |
|
454 | + } |
|
455 | + } else { |
|
456 | + $context['table_info'] = array( |
|
452 | 457 | 'data_length' => $txt['not_applicable'], |
453 | 458 | 'index_length' => $txt['not_applicable'], |
454 | 459 | 'fulltext_length' => $txt['not_applicable'], |
455 | 460 | 'custom_index_length' => $txt['not_applicable'], |
456 | 461 | ); |
462 | + } |
|
457 | 463 | |
458 | 464 | // Format the data and index length in kilobytes. |
459 | 465 | foreach ($context['table_info'] as $type => $size) |
460 | 466 | { |
461 | 467 | // If it's not numeric then just break. This database engine doesn't support size. |
462 | - if (!is_numeric($size)) |
|
463 | - break; |
|
468 | + if (!is_numeric($size)) { |
|
469 | + break; |
|
470 | + } |
|
464 | 471 | |
465 | 472 | $context['table_info'][$type] = comma_format($context['table_info'][$type] / 1024) . ' ' . $txt['search_method_kilobytes']; |
466 | 473 | } |
@@ -489,8 +496,9 @@ discard block |
||
489 | 496 | |
490 | 497 | // Scotty, we need more time... |
491 | 498 | @set_time_limit(600); |
492 | - if (function_exists('apache_reset_timeout')) |
|
493 | - @apache_reset_timeout(); |
|
499 | + if (function_exists('apache_reset_timeout')) { |
|
500 | + @apache_reset_timeout(); |
|
501 | + } |
|
494 | 502 | |
495 | 503 | $context[$context['admin_menu_name']]['current_subsection'] = 'method'; |
496 | 504 | $context['page_title'] = $txt['search_index_custom']; |
@@ -520,8 +528,7 @@ discard block |
||
520 | 528 | $context['start'] = (int) $context['index_settings']['resume_at']; |
521 | 529 | unset($context['index_settings']['resume_at']); |
522 | 530 | $context['step'] = 1; |
523 | - } |
|
524 | - else |
|
531 | + } else |
|
525 | 532 | { |
526 | 533 | $context['index_settings'] = array( |
527 | 534 | 'bytes_per_word' => isset($_REQUEST['bytes_per_word']) && isset($index_properties[$_REQUEST['bytes_per_word']]) ? (int) $_REQUEST['bytes_per_word'] : 2, |
@@ -530,12 +537,14 @@ discard block |
||
530 | 537 | $context['step'] = isset($_REQUEST['step']) ? (int) $_REQUEST['step'] : 0; |
531 | 538 | |
532 | 539 | // admin timeouts are painful when building these long indexes - but only if we actually have such things enabled |
533 | - if (empty($modSettings['securityDisable']) && $_SESSION['admin_time'] + 3300 < time() && $context['step'] >= 1) |
|
534 | - $_SESSION['admin_time'] = time(); |
|
540 | + if (empty($modSettings['securityDisable']) && $_SESSION['admin_time'] + 3300 < time() && $context['step'] >= 1) { |
|
541 | + $_SESSION['admin_time'] = time(); |
|
542 | + } |
|
535 | 543 | } |
536 | 544 | |
537 | - if ($context['step'] !== 0) |
|
538 | - checkSession('request'); |
|
545 | + if ($context['step'] !== 0) { |
|
546 | + checkSession('request'); |
|
547 | + } |
|
539 | 548 | |
540 | 549 | // Step 0: let the user determine how they like their index. |
541 | 550 | if ($context['step'] === 0) |
@@ -564,12 +573,14 @@ discard block |
||
564 | 573 | $smcFunc['db_create_word_search']($index_properties[$context['index_settings']['bytes_per_word']]['column_definition']); |
565 | 574 | |
566 | 575 | // Temporarily switch back to not using a search index. |
567 | - if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') |
|
568 | - updateSettings(array('search_index' => '')); |
|
576 | + if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') { |
|
577 | + updateSettings(array('search_index' => '')); |
|
578 | + } |
|
569 | 579 | |
570 | 580 | // Don't let simultanious processes be updating the search index. |
571 | - if (!empty($modSettings['search_custom_index_config'])) |
|
572 | - updateSettings(array('search_custom_index_config' => '')); |
|
581 | + if (!empty($modSettings['search_custom_index_config'])) { |
|
582 | + updateSettings(array('search_custom_index_config' => '')); |
|
583 | + } |
|
573 | 584 | } |
574 | 585 | |
575 | 586 | $num_messages = array( |
@@ -585,16 +596,16 @@ discard block |
||
585 | 596 | 'starting_id' => $context['start'], |
586 | 597 | ) |
587 | 598 | ); |
588 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
589 | - $num_messages[empty($row['todo']) ? 'done' : 'todo'] = $row['num_messages']; |
|
599 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
600 | + $num_messages[empty($row['todo']) ? 'done' : 'todo'] = $row['num_messages']; |
|
601 | + } |
|
590 | 602 | |
591 | 603 | if (empty($num_messages['todo'])) |
592 | 604 | { |
593 | 605 | $context['step'] = 2; |
594 | 606 | $context['percentage'] = 80; |
595 | 607 | $context['start'] = 0; |
596 | - } |
|
597 | - else |
|
608 | + } else |
|
598 | 609 | { |
599 | 610 | // Number of seconds before the next step. |
600 | 611 | $stop = time() + 3; |
@@ -635,21 +646,22 @@ discard block |
||
635 | 646 | |
636 | 647 | $context['start'] += $forced_break ? $number_processed : $messages_per_batch; |
637 | 648 | |
638 | - if (!empty($inserts)) |
|
639 | - $smcFunc['db_insert']('ignore', |
|
649 | + if (!empty($inserts)) { |
|
650 | + $smcFunc['db_insert']('ignore', |
|
640 | 651 | '{db_prefix}log_search_words', |
641 | 652 | array('id_word' => 'int', 'id_msg' => 'int'), |
642 | 653 | $inserts, |
643 | 654 | array('id_word', 'id_msg') |
644 | 655 | ); |
656 | + } |
|
645 | 657 | if ($num_messages['todo'] === 0) |
646 | 658 | { |
647 | 659 | $context['step'] = 2; |
648 | 660 | $context['start'] = 0; |
649 | 661 | break; |
662 | + } else { |
|
663 | + updateSettings(array('search_custom_index_resume' => $smcFunc['json_encode'](array_merge($context['index_settings'], array('resume_at' => $context['start']))))); |
|
650 | 664 | } |
651 | - else |
|
652 | - updateSettings(array('search_custom_index_resume' => $smcFunc['json_encode'](array_merge($context['index_settings'], array('resume_at' => $context['start']))))); |
|
653 | 665 | } |
654 | 666 | |
655 | 667 | // Since there are still two steps to go, 80% is the maximum here. |
@@ -660,9 +672,9 @@ discard block |
||
660 | 672 | // Step 2: removing the words that occur too often and are of no use. |
661 | 673 | elseif ($context['step'] === 2) |
662 | 674 | { |
663 | - if ($context['index_settings']['bytes_per_word'] < 4) |
|
664 | - $context['step'] = 3; |
|
665 | - else |
|
675 | + if ($context['index_settings']['bytes_per_word'] < 4) { |
|
676 | + $context['step'] = 3; |
|
677 | + } else |
|
666 | 678 | { |
667 | 679 | $stop_words = $context['start'] === 0 || empty($modSettings['search_stopwords']) ? array() : explode(',', $modSettings['search_stopwords']); |
668 | 680 | $stop = time() + 3; |
@@ -683,20 +695,22 @@ discard block |
||
683 | 695 | 'minimum_messages' => $max_messages, |
684 | 696 | ) |
685 | 697 | ); |
686 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
687 | - $stop_words[] = $row['id_word']; |
|
698 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
699 | + $stop_words[] = $row['id_word']; |
|
700 | + } |
|
688 | 701 | $smcFunc['db_free_result']($request); |
689 | 702 | |
690 | 703 | updateSettings(array('search_stopwords' => implode(',', $stop_words))); |
691 | 704 | |
692 | - if (!empty($stop_words)) |
|
693 | - $smcFunc['db_query']('', ' |
|
705 | + if (!empty($stop_words)) { |
|
706 | + $smcFunc['db_query']('', ' |
|
694 | 707 | DELETE FROM {db_prefix}log_search_words |
695 | 708 | WHERE id_word in ({array_int:stop_words})', |
696 | 709 | array( |
697 | 710 | 'stop_words' => $stop_words, |
698 | 711 | ) |
699 | 712 | ); |
713 | + } |
|
700 | 714 | |
701 | 715 | $context['start'] += $index_properties[$context['index_settings']['bytes_per_word']]['step_size']; |
702 | 716 | if ($context['start'] > $index_properties[$context['index_settings']['bytes_per_word']]['max_size']) |
@@ -757,8 +771,9 @@ discard block |
||
757 | 771 | $searchAPI = new $search_class_name(); |
758 | 772 | |
759 | 773 | // No Support? NEXT! |
760 | - if (!$searchAPI->is_supported) |
|
761 | - continue; |
|
774 | + if (!$searchAPI->is_supported) { |
|
775 | + continue; |
|
776 | + } |
|
762 | 777 | |
763 | 778 | $apis[$index_name] = array( |
764 | 779 | 'filename' => $file, |
@@ -805,10 +820,10 @@ discard block |
||
805 | 820 | 'messages_ftx' => $db_prefix . 'messages_ftx', |
806 | 821 | ) |
807 | 822 | ); |
808 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
809 | - $context['fulltext_index'][] = $row['indexname']; |
|
810 | - } |
|
811 | - else |
|
823 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
824 | + $context['fulltext_index'][] = $row['indexname']; |
|
825 | + } |
|
826 | + } else |
|
812 | 827 | { |
813 | 828 | $request = $smcFunc['db_query']('', ' |
814 | 829 | SHOW INDEX |
@@ -819,17 +834,19 @@ discard block |
||
819 | 834 | $context['fulltext_index'] = array(); |
820 | 835 | if ($request !== false || $smcFunc['db_num_rows']($request) != 0) |
821 | 836 | { |
822 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
823 | - if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) |
|
837 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
838 | + if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) |
|
824 | 839 | $context['fulltext_index'][] = $row['Key_name']; |
840 | + } |
|
825 | 841 | $smcFunc['db_free_result']($request); |
826 | 842 | |
827 | - if (is_array($context['fulltext_index'])) |
|
828 | - $context['fulltext_index'] = array_unique($context['fulltext_index']); |
|
843 | + if (is_array($context['fulltext_index'])) { |
|
844 | + $context['fulltext_index'] = array_unique($context['fulltext_index']); |
|
845 | + } |
|
829 | 846 | } |
830 | 847 | |
831 | - if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) |
|
832 | - $request = $smcFunc['db_query']('', ' |
|
848 | + if (preg_match('~^`(.+?)`\.(.+?)$~', $db_prefix, $match) !== 0) { |
|
849 | + $request = $smcFunc['db_query']('', ' |
|
833 | 850 | SHOW TABLE STATUS |
834 | 851 | FROM {string:database_name} |
835 | 852 | LIKE {string:table_name}', |
@@ -838,20 +855,22 @@ discard block |
||
838 | 855 | 'table_name' => str_replace('_', '\_', $match[2]) . 'messages', |
839 | 856 | ) |
840 | 857 | ); |
841 | - else |
|
842 | - $request = $smcFunc['db_query']('', ' |
|
858 | + } else { |
|
859 | + $request = $smcFunc['db_query']('', ' |
|
843 | 860 | SHOW TABLE STATUS |
844 | 861 | LIKE {string:table_name}', |
845 | 862 | array( |
846 | 863 | 'table_name' => str_replace('_', '\_', $db_prefix) . 'messages', |
847 | 864 | ) |
848 | 865 | ); |
866 | + } |
|
849 | 867 | |
850 | 868 | if ($request !== false) |
851 | 869 | { |
852 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
853 | - if (isset($row['Engine']) && strtolower($row['Engine']) != 'myisam' && !(strtolower($row['Engine']) == 'innodb' && version_compare($smcFunc['db_get_version'](), '5.6.4', '>='))) |
|
870 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
871 | + if (isset($row['Engine']) && strtolower($row['Engine']) != 'myisam' && !(strtolower($row['Engine']) == 'innodb' && version_compare($smcFunc['db_get_version'](), '5.6.4', '>='))) |
|
854 | 872 | $context['cannot_create_fulltext'] = true; |
873 | + } |
|
855 | 874 | $smcFunc['db_free_result']($request); |
856 | 875 | } |
857 | 876 | } |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | <div class="windowbg2 noup"> |
128 | 128 | <dl class="settings">'; |
129 | 129 | |
130 | - if (!empty($context['table_info'])) |
|
131 | - echo ' |
|
130 | + if (!empty($context['table_info'])) { |
|
131 | + echo ' |
|
132 | 132 | <dt> |
133 | 133 | <strong>', $txt['search_method_messages_table_space'], ':</strong> |
134 | 134 | </dt> |
@@ -141,6 +141,7 @@ discard block |
||
141 | 141 | <dd> |
142 | 142 | ', $context['table_info']['index_length'], ' |
143 | 143 | </dd>'; |
144 | + } |
|
144 | 145 | echo ' |
145 | 146 | </dl> |
146 | 147 | ', $context['double_index'] ? '<div class="noticebox"> |
@@ -163,17 +164,17 @@ discard block |
||
163 | 164 | <dd> |
164 | 165 | <span class="smalltext">'; |
165 | 166 | |
166 | - if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) |
|
167 | - echo ' |
|
167 | + if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) { |
|
168 | + echo ' |
|
168 | 169 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createfulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_create'], '</a>]'; |
169 | - |
|
170 | - elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) |
|
171 | - echo ' |
|
170 | + } elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) { |
|
171 | + echo ' |
|
172 | 172 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_fulltext_cannot_create']; |
173 | - else |
|
174 | - echo ' |
|
173 | + } else { |
|
174 | + echo ' |
|
175 | 175 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removefulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_remove'], '</a>]<br> |
176 | 176 | <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['fulltext_length']; |
177 | + } |
|
177 | 178 | echo ' |
178 | 179 | </span> |
179 | 180 | </dd>'; |
@@ -187,26 +188,27 @@ discard block |
||
187 | 188 | <dd> |
188 | 189 | <span class="smalltext">'; |
189 | 190 | |
190 | - if ($context['custom_index']) |
|
191 | - echo ' |
|
191 | + if ($context['custom_index']) { |
|
192 | + echo ' |
|
192 | 193 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>]<br> |
193 | 194 | <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length']; |
194 | - |
|
195 | - elseif ($context['partial_custom_index']) |
|
196 | - echo ' |
|
195 | + } elseif ($context['partial_custom_index']) { |
|
196 | + echo ' |
|
197 | 197 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_partial'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>] [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;resume;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_resume'], '</a>]<br> |
198 | 198 | <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length']; |
199 | - else |
|
200 | - echo ' |
|
199 | + } else { |
|
200 | + echo ' |
|
201 | 201 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex">', $txt['search_index_create_custom'], '</a>]'; |
202 | + } |
|
202 | 203 | echo ' |
203 | 204 | </span> |
204 | 205 | </dd>'; |
205 | 206 | |
206 | 207 | foreach ($context['search_apis'] as $api) |
207 | 208 | { |
208 | - if (empty($api['label']) || $api['has_template']) |
|
209 | - continue; |
|
209 | + if (empty($api['label']) || $api['has_template']) { |
|
210 | + continue; |
|
211 | + } |
|
210 | 212 | |
211 | 213 | echo ' |
212 | 214 | <dt> |
@@ -214,11 +216,12 @@ discard block |
||
214 | 216 | ', $api['label'], ' |
215 | 217 | </dt>'; |
216 | 218 | |
217 | - if ($api['desc']) |
|
218 | - echo ' |
|
219 | + if ($api['desc']) { |
|
220 | + echo ' |
|
219 | 221 | <dd> |
220 | 222 | <span class="smalltext">', $api['desc'], '</span> |
221 | 223 | </dd>'; |
224 | + } |
|
222 | 225 | } |
223 | 226 | |
224 | 227 | echo ' |
@@ -54,9 +54,10 @@ discard block |
||
54 | 54 | <dd> |
55 | 55 | <div id="known_themes_list">'; |
56 | 56 | |
57 | - foreach ($context['themes'] as $theme) |
|
58 | - echo ' |
|
57 | + foreach ($context['themes'] as $theme) { |
|
58 | + echo ' |
|
59 | 59 | <label for="options-known_themes_', $theme['id'], '"><input type="checkbox" name="options[known_themes][]" id="options-known_themes_', $theme['id'], '" value="', $theme['id'], '"', $theme['known'] ? ' checked' : '', '> ', $theme['name'], '</label><br>'; |
60 | + } |
|
60 | 61 | |
61 | 62 | echo ' |
62 | 63 | </div> |
@@ -73,9 +74,10 @@ discard block |
||
73 | 74 | <select name="options[theme_guests]" id="theme_guests">'; |
74 | 75 | |
75 | 76 | // Put an option for each theme in the select box. |
76 | - foreach ($context['themes'] as $theme) |
|
77 | - echo ' |
|
77 | + foreach ($context['themes'] as $theme) { |
|
78 | + echo ' |
|
78 | 79 | <option value="', $theme['id'], '"', $modSettings['theme_guests'] == $theme['id'] ? ' selected' : '', '>', $theme['name'], '</option>'; |
80 | + } |
|
79 | 81 | |
80 | 82 | echo ' |
81 | 83 | </select> |
@@ -90,9 +92,10 @@ discard block |
||
90 | 92 | <option value="0">', $txt['theme_forum_default'], '</option>'; |
91 | 93 | |
92 | 94 | // Same thing, this time for changing the theme of everyone. |
93 | - foreach ($context['themes'] as $theme) |
|
94 | - echo ' |
|
95 | + foreach ($context['themes'] as $theme) { |
|
96 | + echo ' |
|
95 | 97 | <option value="', $theme['id'], '">', $theme['name'], '</option>'; |
98 | + } |
|
96 | 99 | |
97 | 100 | echo ' |
98 | 101 | </select> |
@@ -187,11 +190,12 @@ discard block |
||
187 | 190 | global $context, $scripturl, $txt; |
188 | 191 | |
189 | 192 | // Show a nice confirmation message. |
190 | - if (isset($_GET['done'])) |
|
191 | - echo ' |
|
193 | + if (isset($_GET['done'])) { |
|
194 | + echo ' |
|
192 | 195 | <div class="infobox"> |
193 | 196 | ', $txt['theme_confirmed_' . $_GET['done']], ' |
194 | 197 | </div>'; |
198 | + } |
|
195 | 199 | |
196 | 200 | echo ' |
197 | 201 | <div id="admincenter"> |
@@ -354,11 +358,12 @@ discard block |
||
354 | 358 | if (empty($setting) || !is_array($setting)) |
355 | 359 | { |
356 | 360 | // Insert a separator (unless this is the first item in the list) |
357 | - if ($i !== $first_option_key) |
|
358 | - echo ' |
|
361 | + if ($i !== $first_option_key) { |
|
362 | + echo ' |
|
359 | 363 | </dl> |
360 | 364 | <hr> |
361 | 365 | <dl class="settings">'; |
366 | + } |
|
362 | 367 | |
363 | 368 | // Should we give a name to this section? |
364 | 369 | if (is_string($setting) && !empty($setting)) |
@@ -367,9 +372,9 @@ discard block |
||
367 | 372 | echo ' |
368 | 373 | <dt><strong>' . $setting . '</strong></dt> |
369 | 374 | <dd></dd>'; |
375 | + } else { |
|
376 | + $titled_section = false; |
|
370 | 377 | } |
371 | - else |
|
372 | - $titled_section = false; |
|
373 | 378 | |
374 | 379 | continue; |
375 | 380 | } |
@@ -378,8 +383,8 @@ discard block |
||
378 | 383 | <dt>'; |
379 | 384 | |
380 | 385 | // Show the change option box? |
381 | - if ($context['theme_options_reset']) |
|
382 | - echo ' |
|
386 | + if ($context['theme_options_reset']) { |
|
387 | + echo ' |
|
383 | 388 | <span class="floatleft"> |
384 | 389 | <select name="', !empty($setting['default']) ? 'default_' : '', 'options_master[', $setting['id'], ']" onchange="this.form.options_', $setting['id'], '.disabled = this.selectedIndex != 1;"> |
385 | 390 | <option value="0" selected>', $txt['themeadmin_reset_options_none'], '</option> |
@@ -387,23 +392,26 @@ discard block |
||
387 | 392 | <option value="2">', $txt['themeadmin_reset_options_default'], '</option> |
388 | 393 | </select> |
389 | 394 | </span>'; |
395 | + } |
|
390 | 396 | |
391 | 397 | echo ' |
392 | 398 | <label for="options_', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>'; |
393 | 399 | |
394 | - if (isset($setting['description'])) |
|
395 | - echo ' |
|
400 | + if (isset($setting['description'])) { |
|
401 | + echo ' |
|
396 | 402 | <br> |
397 | 403 | <span class="smalltext">', $setting['description'], '</span>'; |
404 | + } |
|
398 | 405 | echo ' |
399 | 406 | </dt>'; |
400 | 407 | |
401 | 408 | // Display checkbox options |
402 | - if ($setting['type'] == 'checkbox') |
|
403 | - echo ' |
|
409 | + if ($setting['type'] == 'checkbox') { |
|
410 | + echo ' |
|
404 | 411 | <dd> |
405 | 412 | <input type="hidden" name="' . (!empty($setting['default']) ? 'default_' : '') . 'options[' . $setting['id'] . ']" value="0"> |
406 | 413 | <input type="checkbox" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="options_', $setting['id'], '"', !empty($setting['value']) ? ' checked' : '', $context['theme_options_reset'] ? ' disabled' : '', ' value="1" class="floatleft">'; |
414 | + } |
|
407 | 415 | |
408 | 416 | // How about selection lists, we all love them |
409 | 417 | elseif ($setting['type'] == 'list') |
@@ -412,9 +420,10 @@ discard block |
||
412 | 420 | <dd> |
413 | 421 | <select class="floatleft" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="options_', $setting['id'], '"', $context['theme_options_reset'] ? ' disabled' : '', '>'; |
414 | 422 | |
415 | - foreach ($setting['options'] as $value => $label) |
|
416 | - echo ' |
|
423 | + foreach ($setting['options'] as $value => $label) { |
|
424 | + echo ' |
|
417 | 425 | <option value="', $value, '"', $value == $setting['value'] ? ' selected' : '', '>', $label, '</option>'; |
426 | + } |
|
418 | 427 | |
419 | 428 | echo ' |
420 | 429 | </select>'; |
@@ -433,14 +442,13 @@ discard block |
||
433 | 442 | |
434 | 443 | echo ' |
435 | 444 | <input type="number"', $min . $max . $step; |
436 | - } |
|
437 | - elseif (isset($setting['type']) && $setting['type'] == 'url') |
|
438 | - echo' |
|
445 | + } elseif (isset($setting['type']) && $setting['type'] == 'url') { |
|
446 | + echo' |
|
439 | 447 | <input type="url"'; |
440 | - |
|
441 | - else |
|
442 | - echo ' |
|
448 | + } else { |
|
449 | + echo ' |
|
443 | 450 | <input type="text"'; |
451 | + } |
|
444 | 452 | |
445 | 453 | echo ' name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="options_', $setting['id'], '" value="', $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : '', $context['theme_options_reset'] ? ' disabled' : '', '>'; |
446 | 454 | } |
@@ -479,8 +487,8 @@ discard block |
||
479 | 487 | <br>'; |
480 | 488 | |
481 | 489 | // @todo Why can't I edit the default theme popup. |
482 | - if ($context['theme_settings']['theme_id'] != 1) |
|
483 | - echo ' |
|
490 | + if ($context['theme_settings']['theme_id'] != 1) { |
|
491 | + echo ' |
|
484 | 492 | <div class="cat_bar"> |
485 | 493 | <h3 class="catbg config_hd"> |
486 | 494 | ', $txt['theme_edit'], ' |
@@ -496,6 +504,7 @@ discard block |
||
496 | 504 | </li> |
497 | 505 | </ul> |
498 | 506 | </div>'; |
507 | + } |
|
499 | 508 | |
500 | 509 | echo ' |
501 | 510 | <div class="cat_bar"> |
@@ -549,9 +558,10 @@ discard block |
||
549 | 558 | <dd> |
550 | 559 | <select id="variant" name="options[default_variant]" onchange="changeVariant(this.value)">'; |
551 | 560 | |
552 | - foreach ($context['theme_variants'] as $key => $variant) |
|
553 | - echo ' |
|
561 | + foreach ($context['theme_variants'] as $key => $variant) { |
|
562 | + echo ' |
|
554 | 563 | <option value="', $key, '"', $context['default_variant'] == $key ? ' selected' : '', '>', $variant['label'], '</option>'; |
564 | + } |
|
555 | 565 | |
556 | 566 | echo ' |
557 | 567 | </select> |
@@ -587,11 +597,12 @@ discard block |
||
587 | 597 | if (empty($setting) || !is_array($setting)) |
588 | 598 | { |
589 | 599 | // We don't need a separator before the first list element |
590 | - if ($i !== $first_setting_key) |
|
591 | - echo ' |
|
600 | + if ($i !== $first_setting_key) { |
|
601 | + echo ' |
|
592 | 602 | </dl> |
593 | 603 | <hr> |
594 | 604 | <dl class="settings">'; |
605 | + } |
|
595 | 606 | |
596 | 607 | // Add a fake heading? |
597 | 608 | if (is_string($setting) && !empty($setting)) |
@@ -600,9 +611,9 @@ discard block |
||
600 | 611 | echo ' |
601 | 612 | <dt><strong>' . $setting . '</strong></dt> |
602 | 613 | <dd></dd>'; |
614 | + } else { |
|
615 | + $titled_section = false; |
|
603 | 616 | } |
604 | - else |
|
605 | - $titled_section = false; |
|
606 | 617 | |
607 | 618 | continue; |
608 | 619 | } |
@@ -611,20 +622,22 @@ discard block |
||
611 | 622 | <dt> |
612 | 623 | <label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>:'; |
613 | 624 | |
614 | - if (isset($setting['description'])) |
|
615 | - echo '<br> |
|
625 | + if (isset($setting['description'])) { |
|
626 | + echo '<br> |
|
616 | 627 | <span class="smalltext">', $setting['description'], '</span>'; |
628 | + } |
|
617 | 629 | |
618 | 630 | echo ' |
619 | 631 | </dt>'; |
620 | 632 | |
621 | 633 | // A checkbox? |
622 | - if ($setting['type'] == 'checkbox') |
|
623 | - echo ' |
|
634 | + if ($setting['type'] == 'checkbox') { |
|
635 | + echo ' |
|
624 | 636 | <dd> |
625 | 637 | <input type="hidden" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" value="0"> |
626 | 638 | <input type="checkbox" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '"', !empty($setting['value']) ? ' checked' : '', ' value="1"> |
627 | 639 | </dd>'; |
640 | + } |
|
628 | 641 | |
629 | 642 | // A list with options? |
630 | 643 | elseif ($setting['type'] == 'list') |
@@ -633,9 +646,10 @@ discard block |
||
633 | 646 | <dd> |
634 | 647 | <select name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">'; |
635 | 648 | |
636 | - foreach ($setting['options'] as $value => $label) |
|
637 | - echo ' |
|
649 | + foreach ($setting['options'] as $value => $label) { |
|
650 | + echo ' |
|
638 | 651 | <option value="', $value, '"', $value == $setting['value'] ? ' selected' : '', '>', $label, '</option>'; |
652 | + } |
|
639 | 653 | |
640 | 654 | echo ' |
641 | 655 | </select> |
@@ -663,14 +677,13 @@ discard block |
||
663 | 677 | |
664 | 678 | echo ' |
665 | 679 | <input type="number"', $min . $max . $step; |
666 | - } |
|
667 | - elseif (isset($setting['type']) && $setting['type'] == 'url') |
|
668 | - echo' |
|
680 | + } elseif (isset($setting['type']) && $setting['type'] == 'url') { |
|
681 | + echo' |
|
669 | 682 | <input type="url"'; |
670 | - |
|
671 | - else |
|
672 | - echo ' |
|
683 | + } else { |
|
684 | + echo ' |
|
673 | 685 | <input type="text"'; |
686 | + } |
|
674 | 687 | |
675 | 688 | echo ' name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="options_', $setting['id'], '" value="', $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : (empty($settings['size']) ? ' size="40"' : ' size="' . $setting['size'] . '"'), '> |
676 | 689 | </dd>'; |
@@ -742,9 +755,10 @@ discard block |
||
742 | 755 | <label for="variant', $theme['id'], '"><strong>', $theme['pick_label'], '</strong></label>: |
743 | 756 | <select id="variant', $theme['id'], '" name="vrt[', $theme['id'], ']" onchange="changeVariant', $theme['id'], '(this.value);">'; |
744 | 757 | |
745 | - foreach ($theme['variants'] as $key => $variant) |
|
746 | - echo ' |
|
758 | + foreach ($theme['variants'] as $key => $variant) { |
|
759 | + echo ' |
|
747 | 760 | <option value="', $key, '"', $theme['selected_variant'] == $key ? ' selected' : '', '>', $variant['label'], '</option>'; |
761 | + } |
|
748 | 762 | |
749 | 763 | echo ' |
750 | 764 | </select> |
@@ -822,21 +836,23 @@ discard block |
||
822 | 836 | <div class="windowbg">'; |
823 | 837 | |
824 | 838 | // Oops! there was an error :( |
825 | - if (!empty($context['error_message'])) |
|
826 | - echo ' |
|
839 | + if (!empty($context['error_message'])) { |
|
840 | + echo ' |
|
827 | 841 | <p> |
828 | 842 | ', $context['error_message'], ' |
829 | 843 | </p>'; |
844 | + } |
|
830 | 845 | |
831 | 846 | // Not much to show except a link back... |
832 | - else |
|
833 | - echo ' |
|
847 | + else { |
|
848 | + echo ' |
|
834 | 849 | <p> |
835 | 850 | <a href="', $scripturl, '?action=admin;area=theme;sa=list;th=', $context['installed_theme']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $context['installed_theme']['name'], '</a> ', $txt['theme_' . (isset($context['installed_theme']['updated']) ? 'updated' : 'installed') . '_message'], ' |
836 | 851 | </p> |
837 | 852 | <p> |
838 | 853 | <a href="', $scripturl, '?action=admin;area=theme;sa=admin;', $context['session_var'], '=', $context['session_id'], '">', $txt['back'], '</a> |
839 | 854 | </p>'; |
855 | + } |
|
840 | 856 | |
841 | 857 | echo ' |
842 | 858 | </div><!-- .windowbg --> |
@@ -903,11 +919,12 @@ discard block |
||
903 | 919 | <span class="floatleft">', $template['filename'], $template['already_exists'] ? ' <span class="error">(' . $txt['themeadmin_edit_exists'] . ')</span>' : '', '</span> |
904 | 920 | <span class="floatright">'; |
905 | 921 | |
906 | - if ($template['can_copy']) |
|
907 | - echo ' |
|
922 | + if ($template['can_copy']) { |
|
923 | + echo ' |
|
908 | 924 | <a href="', $scripturl, '?action=admin;area=theme;th=', $context['theme_id'], ';', $context['session_var'], '=', $context['session_id'], ';sa=copy;template=', $template['value'], '" data-confirm="', $template['already_exists'] ? $txt['themeadmin_edit_overwrite_confirm'] : $txt['themeadmin_edit_copy_confirm'], '" class="you_sure">', $txt['themeadmin_edit_do_copy'], '</a>'; |
909 | - else |
|
910 | - echo $txt['themeadmin_edit_no_copy']; |
|
925 | + } else { |
|
926 | + echo $txt['themeadmin_edit_no_copy']; |
|
927 | + } |
|
911 | 928 | |
912 | 929 | echo ' |
913 | 930 | </span> |
@@ -930,11 +947,12 @@ discard block |
||
930 | 947 | echo ' |
931 | 948 | <div id="admincenter">'; |
932 | 949 | |
933 | - if (!empty($context['browse_title'])) |
|
934 | - echo ' |
|
950 | + if (!empty($context['browse_title'])) { |
|
951 | + echo ' |
|
935 | 952 | <div class="cat_bar"> |
936 | 953 | <h3 class="catbg">', $context['browse_title'], '</h3> |
937 | 954 | </div>'; |
955 | + } |
|
938 | 956 | |
939 | 957 | echo ' |
940 | 958 | <table class="table_grid tborder"> |
@@ -954,16 +972,15 @@ discard block |
||
954 | 972 | <tr class="windowbg"> |
955 | 973 | <td>'; |
956 | 974 | |
957 | - if ($file['is_editable']) |
|
958 | - echo ' |
|
975 | + if ($file['is_editable']) { |
|
976 | + echo ' |
|
959 | 977 | <a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>'; |
960 | - |
|
961 | - elseif ($file['is_directory']) |
|
962 | - echo ' |
|
978 | + } elseif ($file['is_directory']) { |
|
979 | + echo ' |
|
963 | 980 | <a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>'; |
964 | - |
|
965 | - else |
|
966 | - echo $file['filename']; |
|
981 | + } else { |
|
982 | + echo $file['filename']; |
|
983 | + } |
|
967 | 984 | |
968 | 985 | echo ' |
969 | 986 | </td> |
@@ -985,11 +1002,12 @@ discard block |
||
985 | 1002 | { |
986 | 1003 | global $context, $settings, $scripturl, $txt; |
987 | 1004 | |
988 | - if ($context['session_error']) |
|
989 | - echo ' |
|
1005 | + if ($context['session_error']) { |
|
1006 | + echo ' |
|
990 | 1007 | <div class="errorbox"> |
991 | 1008 | ', $txt['error_session_timeout'], ' |
992 | 1009 | </div>'; |
1010 | + } |
|
993 | 1011 | |
994 | 1012 | // From now on no one can complain that editing css is difficult. If you disagree, go to www.w3schools.com. |
995 | 1013 | echo ' |
@@ -1053,17 +1071,18 @@ discard block |
||
1053 | 1071 | { |
1054 | 1072 | '; |
1055 | 1073 | |
1056 | - if (isBrowser('is_ie')) |
|
1057 | - echo ' |
|
1074 | + if (isBrowser('is_ie')) { |
|
1075 | + echo ' |
|
1058 | 1076 | var sheets = frames["css_preview_box"].document.styleSheets; |
1059 | 1077 | for (var j = 0; j < sheets.length; j++) |
1060 | 1078 | { |
1061 | 1079 | if (sheets[j].id == "css_preview_box") |
1062 | 1080 | sheets[j].cssText = document.forms.stylesheetForm.entire_file.value; |
1063 | 1081 | }'; |
1064 | - else |
|
1065 | - echo ' |
|
1082 | + } else { |
|
1083 | + echo ' |
|
1066 | 1084 | setInnerHTML(frames["css_preview_box"].document.getElementById("css_preview_sheet"), document.forms.stylesheetForm.entire_file.value);'; |
1085 | + } |
|
1067 | 1086 | echo ' |
1068 | 1087 | } |
1069 | 1088 | catch (e) |
@@ -1115,9 +1134,10 @@ discard block |
||
1115 | 1134 | </div> |
1116 | 1135 | <div class="windowbg">'; |
1117 | 1136 | |
1118 | - if (!$context['allow_save']) |
|
1119 | - echo ' |
|
1137 | + if (!$context['allow_save']) { |
|
1138 | + echo ' |
|
1120 | 1139 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>'; |
1140 | + } |
|
1121 | 1141 | |
1122 | 1142 | echo ' |
1123 | 1143 | <textarea class="edit_file" name="entire_file" cols="80" rows="20" onkeyup="setPreviewTimeout();" onchange="refreshPreview(true);">', $context['entire_file'], '</textarea> |
@@ -1131,9 +1151,10 @@ discard block |
||
1131 | 1151 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
1132 | 1152 | |
1133 | 1153 | // Hopefully it exists. |
1134 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
1135 | - echo ' |
|
1154 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
1155 | + echo ' |
|
1136 | 1156 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
1157 | + } |
|
1137 | 1158 | |
1138 | 1159 | echo ' |
1139 | 1160 | </form> |
@@ -1147,18 +1168,20 @@ discard block |
||
1147 | 1168 | { |
1148 | 1169 | global $context, $scripturl, $txt; |
1149 | 1170 | |
1150 | - if ($context['session_error']) |
|
1151 | - echo ' |
|
1171 | + if ($context['session_error']) { |
|
1172 | + echo ' |
|
1152 | 1173 | <div class="errorbox"> |
1153 | 1174 | ', $txt['error_session_timeout'], ' |
1154 | 1175 | </div>'; |
1176 | + } |
|
1155 | 1177 | |
1156 | - if (isset($context['parse_error'])) |
|
1157 | - echo ' |
|
1178 | + if (isset($context['parse_error'])) { |
|
1179 | + echo ' |
|
1158 | 1180 | <div class="errorbox"> |
1159 | 1181 | ', $txt['themeadmin_edit_error'], ' |
1160 | 1182 | <div><pre>', $context['parse_error'], '</pre></div> |
1161 | 1183 | </div>'; |
1184 | + } |
|
1162 | 1185 | |
1163 | 1186 | // Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.) |
1164 | 1187 | echo ' |
@@ -1169,16 +1192,18 @@ discard block |
||
1169 | 1192 | </div> |
1170 | 1193 | <div class="windowbg">'; |
1171 | 1194 | |
1172 | - if (!$context['allow_save']) |
|
1173 | - echo ' |
|
1195 | + if (!$context['allow_save']) { |
|
1196 | + echo ' |
|
1174 | 1197 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>'; |
1198 | + } |
|
1175 | 1199 | |
1176 | - foreach ($context['file_parts'] as $part) |
|
1177 | - echo ' |
|
1200 | + foreach ($context['file_parts'] as $part) { |
|
1201 | + echo ' |
|
1178 | 1202 | <label for="on_line', $part['line'], '">', $txt['themeadmin_edit_on_line'], ' ', $part['line'], '</label>:<br> |
1179 | 1203 | <div class="centertext"> |
1180 | 1204 | <textarea id="on_line', $part['line'], '" name="entire_file[]" cols="80" rows="', $part['lines'] > 14 ? '14' : $part['lines'], '" class="edit_file">', $part['data'], '</textarea> |
1181 | 1205 | </div>'; |
1206 | + } |
|
1182 | 1207 | |
1183 | 1208 | echo ' |
1184 | 1209 | <div class="padding righttext"> |
@@ -1187,9 +1212,10 @@ discard block |
||
1187 | 1212 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
1188 | 1213 | |
1189 | 1214 | // Hopefully it exists. |
1190 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
1191 | - echo ' |
|
1215 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
1216 | + echo ' |
|
1192 | 1217 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
1218 | + } |
|
1193 | 1219 | |
1194 | 1220 | echo ' |
1195 | 1221 | </div><!-- .righttext --> |
@@ -1205,18 +1231,20 @@ discard block |
||
1205 | 1231 | { |
1206 | 1232 | global $context, $scripturl, $txt; |
1207 | 1233 | |
1208 | - if ($context['session_error']) |
|
1209 | - echo ' |
|
1234 | + if ($context['session_error']) { |
|
1235 | + echo ' |
|
1210 | 1236 | <div class="errorbox"> |
1211 | 1237 | ', $txt['error_session_timeout'], ' |
1212 | 1238 | </div>'; |
1239 | + } |
|
1213 | 1240 | |
1214 | 1241 | // Is this file writeable? |
1215 | - if (!$context['allow_save']) |
|
1216 | - echo ' |
|
1242 | + if (!$context['allow_save']) { |
|
1243 | + echo ' |
|
1217 | 1244 | <div class="errorbox"> |
1218 | 1245 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], ' |
1219 | 1246 | </div>'; |
1247 | + } |
|
1220 | 1248 | |
1221 | 1249 | // Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.) |
1222 | 1250 | echo ' |
@@ -1232,9 +1260,10 @@ discard block |
||
1232 | 1260 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
1233 | 1261 | |
1234 | 1262 | // Hopefully it exists. |
1235 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
1236 | - echo ' |
|
1263 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
1264 | + echo ' |
|
1237 | 1265 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
1266 | + } |
|
1238 | 1267 | |
1239 | 1268 | echo ' |
1240 | 1269 | </div><!-- .windowbg --> |