@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | echo ' |
74 | 74 | <div class="main_container"> |
75 | - <div class="cat_bar ', $category['is_collapsed'] ? 'collapsed' : '','" id="category_', $category['id'], '"> |
|
75 | + <div class="cat_bar ', $category['is_collapsed'] ? 'collapsed' : '', '" id="category_', $category['id'], '"> |
|
76 | 76 | <h3 class="catbg">'; |
77 | 77 | |
78 | 78 | // If this category even can collapse, show a link to collapse it. |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | foreach ($board['children'] as $child) |
248 | 248 | { |
249 | 249 | if (!$child['is_redirect']) |
250 | - $child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
250 | + $child['link'] = '' . ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
251 | 251 | else |
252 | 252 | $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
253 | 253 |
@@ -31,9 +31,10 @@ discard block |
||
31 | 31 | echo ' |
32 | 32 | <ul id="smf_slider" class="roundframe">'; |
33 | 33 | |
34 | - foreach ($context['news_lines'] as $news) |
|
35 | - echo ' |
|
34 | + foreach ($context['news_lines'] as $news) { |
|
35 | + echo ' |
|
36 | 36 | <li>', $news, '</li>'; |
37 | + } |
|
37 | 38 | |
38 | 39 | echo ' |
39 | 40 | </ul> |
@@ -65,8 +66,9 @@ discard block |
||
65 | 66 | foreach ($context['categories'] as $category) |
66 | 67 | { |
67 | 68 | // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed) |
68 | - if (empty($category['boards']) && !$category['is_collapsed']) |
|
69 | - continue; |
|
69 | + if (empty($category['boards']) && !$category['is_collapsed']) { |
|
70 | + continue; |
|
71 | + } |
|
70 | 72 | |
71 | 73 | echo ' |
72 | 74 | <div class="main_container"> |
@@ -74,9 +76,10 @@ discard block |
||
74 | 76 | <h3 class="catbg">'; |
75 | 77 | |
76 | 78 | // If this category even can collapse, show a link to collapse it. |
77 | - if ($category['can_collapse']) |
|
78 | - echo ' |
|
79 | + if ($category['can_collapse']) { |
|
80 | + echo ' |
|
79 | 81 | <span id="category_', $category['id'], '_upshrink" class="', $category['is_collapsed'] ? 'toggle_down' : 'toggle_up', ' floatright" data-collapsed="', (int) $category['is_collapsed'], '" title="', !$category['is_collapsed'] ? $txt['hide_category'] : $txt['show_category'], '" style="display: none;"></span>'; |
82 | + } |
|
80 | 83 | |
81 | 84 | echo ' |
82 | 85 | ', $category['link'], ' |
@@ -106,10 +109,11 @@ discard block |
||
106 | 109 | </div>'; |
107 | 110 | |
108 | 111 | // Won't somebody think of the children! |
109 | - if (function_exists('template_bi_' . $board['type'] . '_children')) |
|
110 | - call_user_func('template_bi_' . $board['type'] . '_children', $board); |
|
111 | - else |
|
112 | - template_bi_board_children($board); |
|
112 | + if (function_exists('template_bi_' . $board['type'] . '_children')) { |
|
113 | + call_user_func('template_bi_' . $board['type'] . '_children', $board); |
|
114 | + } else { |
|
115 | + template_bi_board_children($board); |
|
116 | + } |
|
113 | 117 | |
114 | 118 | echo ' |
115 | 119 | </div><!-- #board_[id] -->'; |
@@ -124,12 +128,13 @@ discard block |
||
124 | 128 | </div><!-- #boardindex_table -->'; |
125 | 129 | |
126 | 130 | // Show the mark all as read button? |
127 | - if ($context['user']['is_logged'] && !empty($context['categories'])) |
|
128 | - echo ' |
|
131 | + if ($context['user']['is_logged'] && !empty($context['categories'])) { |
|
132 | + echo ' |
|
129 | 133 | <div class="mark_read"> |
130 | 134 | ', template_button_strip($context['mark_read_button'], 'right'), ' |
131 | 135 | </div>'; |
132 | -} |
|
136 | + } |
|
137 | + } |
|
133 | 138 | |
134 | 139 | /** |
135 | 140 | * Outputs the board icon for a standard board. |
@@ -173,18 +178,20 @@ discard block |
||
173 | 178 | </a>'; |
174 | 179 | |
175 | 180 | // Has it outstanding posts for approval? |
176 | - if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) |
|
177 | - echo ' |
|
181 | + if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) { |
|
182 | + echo ' |
|
178 | 183 | <a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>'; |
184 | + } |
|
179 | 185 | |
180 | 186 | echo ' |
181 | 187 | <p class="board_description">', $board['description'], '</p>'; |
182 | 188 | |
183 | 189 | // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.) |
184 | - if (!empty($board['link_moderators'])) |
|
185 | - echo ' |
|
190 | + if (!empty($board['link_moderators'])) { |
|
191 | + echo ' |
|
186 | 192 | <p class="moderators">', count($board['link_moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>'; |
187 | -} |
|
193 | + } |
|
194 | + } |
|
188 | 195 | |
189 | 196 | /** |
190 | 197 | * Outputs the board stats for a standard board. |
@@ -225,10 +232,11 @@ discard block |
||
225 | 232 | */ |
226 | 233 | function template_bi_board_lastpost($board) |
227 | 234 | { |
228 | - if (!empty($board['last_post']['id'])) |
|
229 | - echo ' |
|
235 | + if (!empty($board['last_post']['id'])) { |
|
236 | + echo ' |
|
230 | 237 | <p>', $board['last_post']['last_post_message'], '</p>'; |
231 | -} |
|
238 | + } |
|
239 | + } |
|
232 | 240 | |
233 | 241 | /** |
234 | 242 | * Outputs the board children for a standard board. |
@@ -248,14 +256,16 @@ discard block |
||
248 | 256 | id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */ |
249 | 257 | foreach ($board['children'] as $child) |
250 | 258 | { |
251 | - if (!$child['is_redirect']) |
|
252 | - $child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
253 | - else |
|
254 | - $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
|
259 | + if (!$child['is_redirect']) { |
|
260 | + $child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
261 | + } else { |
|
262 | + $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
|
263 | + } |
|
255 | 264 | |
256 | 265 | // Has it posts awaiting approval? |
257 | - if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) |
|
258 | - $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
266 | + if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) { |
|
267 | + $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
268 | + } |
|
259 | 269 | |
260 | 270 | $children[] = $child['new'] ? '<span class="strong">' . $child['link'] . '</span>' : '<span>' . $child['link'] . '</span>'; |
261 | 271 | } |
@@ -282,8 +292,9 @@ discard block |
||
282 | 292 | { |
283 | 293 | global $context, $options, $txt; |
284 | 294 | |
285 | - if (empty($context['info_center'])) |
|
286 | - return; |
|
295 | + if (empty($context['info_center'])) { |
|
296 | + return; |
|
297 | + } |
|
287 | 298 | |
288 | 299 | // Here's where the "Info Center" starts... |
289 | 300 | echo ' |
@@ -383,14 +394,15 @@ discard block |
||
383 | 394 | /* Each post in latest_posts has: |
384 | 395 | board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.), |
385 | 396 | subject, short_subject (shortened with...), time, link, and href. */ |
386 | - foreach ($context['latest_posts'] as $post) |
|
387 | - echo ' |
|
397 | + foreach ($context['latest_posts'] as $post) { |
|
398 | + echo ' |
|
388 | 399 | <tr class="windowbg"> |
389 | 400 | <td class="recentpost"><strong>', $post['link'], '</strong></td> |
390 | 401 | <td class="recentposter">', $post['poster']['link'], '</td> |
391 | 402 | <td class="recentboard">', $post['board']['link'], '</td> |
392 | 403 | <td class="recenttime">', $post['time'], '</td> |
393 | 404 | </tr>'; |
405 | + } |
|
394 | 406 | echo ' |
395 | 407 | </table>'; |
396 | 408 | } |
@@ -414,11 +426,12 @@ discard block |
||
414 | 426 | </div>'; |
415 | 427 | |
416 | 428 | // Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P |
417 | - if (!empty($context['calendar_holidays'])) |
|
418 | - echo ' |
|
429 | + if (!empty($context['calendar_holidays'])) { |
|
430 | + echo ' |
|
419 | 431 | <p class="inline holiday"> |
420 | 432 | <span>', $txt['calendar_prompt'], '</span> ', implode(', ', $context['calendar_holidays']), ' |
421 | 433 | </p>'; |
434 | + } |
|
422 | 435 | |
423 | 436 | // People's birthdays. Like mine. And yours, I guess. Kidding. |
424 | 437 | if (!empty($context['calendar_birthdays'])) |
@@ -428,9 +441,10 @@ discard block |
||
428 | 441 | <span class="birthday">', $context['calendar_only_today'] ? $txt['birthdays'] : $txt['birthdays_upcoming'], '</span>'; |
429 | 442 | |
430 | 443 | // Each member in calendar_birthdays has: id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) |
431 | - foreach ($context['calendar_birthdays'] as $member) |
|
432 | - echo ' |
|
444 | + foreach ($context['calendar_birthdays'] as $member) { |
|
445 | + echo ' |
|
433 | 446 | <a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<strong class="fix_rtl_names">' : '', $member['name'], $member['is_today'] ? '</strong>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '' : ', '; |
447 | + } |
|
434 | 448 | |
435 | 449 | echo ' |
436 | 450 | </p>'; |
@@ -445,9 +459,10 @@ discard block |
||
445 | 459 | |
446 | 460 | // Each event in calendar_events should have: |
447 | 461 | // title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. |
448 | - foreach ($context['calendar_events'] as $event) |
|
449 | - echo ' |
|
462 | + foreach ($context['calendar_events'] as $event) { |
|
463 | + echo ' |
|
450 | 464 | ', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" title="' . $txt['calendar_edit'] . '"><span class="generic_icons calendar_modify"></span></a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<strong>' . $event['title'] . '</strong>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br>' : ', '; |
465 | + } |
|
451 | 466 | echo ' |
452 | 467 | </p>'; |
453 | 468 | } |
@@ -493,17 +508,21 @@ discard block |
||
493 | 508 | // Handle hidden users and buddies. |
494 | 509 | $bracketList = array(); |
495 | 510 | |
496 | - if ($context['show_buddies']) |
|
497 | - $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
511 | + if ($context['show_buddies']) { |
|
512 | + $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
513 | + } |
|
498 | 514 | |
499 | - if (!empty($context['num_spiders'])) |
|
500 | - $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
515 | + if (!empty($context['num_spiders'])) { |
|
516 | + $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
517 | + } |
|
501 | 518 | |
502 | - if (!empty($context['num_users_hidden'])) |
|
503 | - $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']); |
|
519 | + if (!empty($context['num_users_hidden'])) { |
|
520 | + $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']); |
|
521 | + } |
|
504 | 522 | |
505 | - if (!empty($bracketList)) |
|
506 | - echo ' (' . implode(', ', $bracketList) . ')'; |
|
523 | + if (!empty($bracketList)) { |
|
524 | + echo ' (' . implode(', ', $bracketList) . ')'; |
|
525 | + } |
|
507 | 526 | |
508 | 527 | echo $context['show_who'] ? '</a>' : '', ' |
509 | 528 | |
@@ -517,9 +536,10 @@ discard block |
||
517 | 536 | ', sprintf($txt['users_active'], $modSettings['lastActive']), ': ', implode(', ', $context['list_users_online']); |
518 | 537 | |
519 | 538 | // Showing membergroups? |
520 | - if (!empty($settings['show_group_key']) && !empty($context['membergroups'])) |
|
521 | - echo ' |
|
539 | + if (!empty($settings['show_group_key']) && !empty($context['membergroups'])) { |
|
540 | + echo ' |
|
522 | 541 | <span class="membergroups">' . implode(', ', $context['membergroups']) . '</span>'; |
542 | + } |
|
523 | 543 | } |
524 | 544 | |
525 | 545 | echo ' |
@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | * @version 2.1 Beta 4 |
16 | 16 | */ |
17 | 17 | |
18 | -if (!defined('SMF')) |
|
18 | +if (!defined('SMF')) { |
|
19 | 19 | die('No direct access...'); |
20 | +} |
|
20 | 21 | |
21 | 22 | /** |
22 | 23 | * Main dispatcher. This function checks permissions and passes control through to the relevant section. |
@@ -245,8 +246,9 @@ discard block |
||
245 | 246 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
246 | 247 | { |
247 | 248 | // Private PM/email subjects and similar shouldn't be shown in the mailbox area. |
248 | - if (!empty($row['private'])) |
|
249 | - $row['subject'] = $txt['personal_message']; |
|
249 | + if (!empty($row['private'])) { |
|
250 | + $row['subject'] = $txt['personal_message']; |
|
251 | + } |
|
250 | 252 | |
251 | 253 | $mails[] = $row; |
252 | 254 | } |
@@ -300,8 +302,9 @@ discard block |
||
300 | 302 | $element = substr($key, strrpos($key, '_') + 1); |
301 | 303 | $processedBirthdayEmails[$index][$element] = $value; |
302 | 304 | } |
303 | - foreach ($processedBirthdayEmails as $index => $dummy) |
|
304 | - $emails[$index] = $index; |
|
305 | + foreach ($processedBirthdayEmails as $index => $dummy) { |
|
306 | + $emails[$index] = $index; |
|
307 | + } |
|
305 | 308 | |
306 | 309 | $config_vars = array( |
307 | 310 | // Mail queue stuff, this rocks ;) |
@@ -322,8 +325,9 @@ discard block |
||
322 | 325 | |
323 | 326 | call_integration_hook('integrate_modify_mail_settings', array(&$config_vars)); |
324 | 327 | |
325 | - if ($return_config) |
|
326 | - return $config_vars; |
|
328 | + if ($return_config) { |
|
329 | + return $config_vars; |
|
330 | + } |
|
327 | 331 | |
328 | 332 | // Saving? |
329 | 333 | if (isset($_GET['save'])) |
@@ -398,9 +402,9 @@ discard block |
||
398 | 402 | ); |
399 | 403 | list ($_GET['te']) = $smcFunc['db_fetch_row']($request); |
400 | 404 | $smcFunc['db_free_result']($request); |
405 | + } else { |
|
406 | + $_GET['te'] = (int) $_GET['te']; |
|
401 | 407 | } |
402 | - else |
|
403 | - $_GET['te'] = (int) $_GET['te']; |
|
404 | 408 | |
405 | 409 | $_GET['sent'] = isset($_GET['sent']) ? (int) $_GET['sent'] : 0; |
406 | 410 | |
@@ -424,12 +428,14 @@ discard block |
||
424 | 428 | |
425 | 429 | // Try get more time... |
426 | 430 | @set_time_limit(600); |
427 | - if (function_exists('apache_reset_timeout')) |
|
428 | - @apache_reset_timeout(); |
|
431 | + if (function_exists('apache_reset_timeout')) { |
|
432 | + @apache_reset_timeout(); |
|
433 | + } |
|
429 | 434 | |
430 | 435 | // Have we already used our maximum time? |
431 | - if ((time() - $time_start) < 5) |
|
432 | - return; |
|
436 | + if ((time() - $time_start) < 5) { |
|
437 | + return; |
|
438 | + } |
|
433 | 439 | |
434 | 440 | $context['continue_get_data'] = '?action=admin;area=mailqueue;sa=clear;te=' . $_GET['te'] . ';sent=' . $_GET['sent'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
435 | 441 | $context['page_title'] = $txt['not_done_title']; |
@@ -459,8 +465,9 @@ discard block |
||
459 | 465 | { |
460 | 466 | global $txt; |
461 | 467 | |
462 | - if ($time_diff < 0) |
|
463 | - $time_diff = 0; |
|
468 | + if ($time_diff < 0) { |
|
469 | + $time_diff = 0; |
|
470 | + } |
|
464 | 471 | |
465 | 472 | // Just do a bit of an if fest... |
466 | 473 | if ($time_diff > 86400) |
@@ -481,8 +488,9 @@ discard block |
||
481 | 488 | return sprintf($minutes == 1 ? $txt['mq_minute'] : $txt['mq_minutes'], $minutes); |
482 | 489 | } |
483 | 490 | // Otherwise must be second |
484 | - else |
|
485 | - return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
486 | -} |
|
491 | + else { |
|
492 | + return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
493 | + } |
|
494 | + } |
|
487 | 495 | |
488 | 496 | ?> |
489 | 497 | \ No newline at end of file |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $table = str_replace('{db_prefix}', $db_prefix, $table); |
93 | 93 | |
94 | - $pg_tables = array('pg_catalog','information_schema'); |
|
94 | + $pg_tables = array('pg_catalog', 'information_schema'); |
|
95 | 95 | |
96 | 96 | $request = $smcFunc['db_query']('', ' |
97 | 97 | SELECT pg_relation_size(C.oid) AS "size" |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | global $db_connection; |
291 | 291 | static $ver; |
292 | 292 | |
293 | - if(!empty($ver)) |
|
293 | + if (!empty($ver)) |
|
294 | 294 | return $ver; |
295 | 295 | |
296 | 296 | $ver = pg_version($db_connection)['server']; |
@@ -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. |
@@ -48,13 +50,14 @@ discard block |
||
48 | 50 | |
49 | 51 | // Do we need to drop it first? |
50 | 52 | $tables = smf_db_list_tables(false, $backup_table); |
51 | - if (!empty($tables)) |
|
52 | - $smcFunc['db_query']('', ' |
|
53 | + if (!empty($tables)) { |
|
54 | + $smcFunc['db_query']('', ' |
|
53 | 55 | DROP TABLE {raw:backup_table}', |
54 | 56 | array( |
55 | 57 | 'backup_table' => $backup_table, |
56 | 58 | ) |
57 | 59 | ); |
60 | + } |
|
58 | 61 | |
59 | 62 | /** |
60 | 63 | * @todo Should we create backups of sequences as well? |
@@ -117,8 +120,9 @@ discard block |
||
117 | 120 | ) |
118 | 121 | ); |
119 | 122 | |
120 | - if (!$request) |
|
121 | - return -1; |
|
123 | + if (!$request) { |
|
124 | + return -1; |
|
125 | + } |
|
122 | 126 | |
123 | 127 | $request = $smcFunc['db_query']('', ' |
124 | 128 | SELECT pg_relation_size(C.oid) AS "size" |
@@ -136,11 +140,12 @@ discard block |
||
136 | 140 | $row = $smcFunc['db_fetch_assoc']($request); |
137 | 141 | $smcFunc['db_free_result']($request); |
138 | 142 | |
139 | - if (isset($row['size'])) |
|
140 | - return ($old_size - $row['size']) / 1024; |
|
141 | - else |
|
142 | - return 0; |
|
143 | -} |
|
143 | + if (isset($row['size'])) { |
|
144 | + return ($old_size - $row['size']) / 1024; |
|
145 | + } else { |
|
146 | + return 0; |
|
147 | + } |
|
148 | + } |
|
144 | 149 | |
145 | 150 | /** |
146 | 151 | * This function lists all tables in the database. |
@@ -167,8 +172,9 @@ discard block |
||
167 | 172 | ); |
168 | 173 | |
169 | 174 | $tables = array(); |
170 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
171 | - $tables[] = $row[0]; |
|
175 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
176 | + $tables[] = $row[0]; |
|
177 | + } |
|
172 | 178 | $smcFunc['db_free_result']($request); |
173 | 179 | |
174 | 180 | return $tables; |
@@ -209,12 +215,14 @@ discard block |
||
209 | 215 | ); |
210 | 216 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
211 | 217 | { |
212 | - if ($row['data_type'] == 'character varying') |
|
213 | - $row['data_type'] = 'varchar'; |
|
214 | - elseif ($row['data_type'] == 'character') |
|
215 | - $row['data_type'] = 'char'; |
|
216 | - if ($row['character_maximum_length']) |
|
217 | - $row['data_type'] .= '(' . $row['character_maximum_length'] . ')'; |
|
218 | + if ($row['data_type'] == 'character varying') { |
|
219 | + $row['data_type'] = 'varchar'; |
|
220 | + } elseif ($row['data_type'] == 'character') { |
|
221 | + $row['data_type'] = 'char'; |
|
222 | + } |
|
223 | + if ($row['character_maximum_length']) { |
|
224 | + $row['data_type'] .= '(' . $row['character_maximum_length'] . ')'; |
|
225 | + } |
|
218 | 226 | |
219 | 227 | // Make the CREATE for this column. |
220 | 228 | $schema_create .= ' "' . $row['column_name'] . '" ' . $row['data_type'] . ($row['is_nullable'] != 'YES' ? ' NOT NULL' : ''); |
@@ -265,13 +273,14 @@ discard block |
||
265 | 273 | { |
266 | 274 | if ($row['is_primary']) |
267 | 275 | { |
268 | - if (preg_match('~\(([^\)]+?)\)~i', $row['inddef'], $matches) == 0) |
|
269 | - continue; |
|
276 | + if (preg_match('~\(([^\)]+?)\)~i', $row['inddef'], $matches) == 0) { |
|
277 | + continue; |
|
278 | + } |
|
270 | 279 | |
271 | 280 | $index_create .= $crlf . 'ALTER TABLE ' . $tableName . ' ADD PRIMARY KEY ("' . $matches[1] . '");'; |
281 | + } else { |
|
282 | + $index_create .= $crlf . $row['inddef'] . ';'; |
|
272 | 283 | } |
273 | - else |
|
274 | - $index_create .= $crlf . $row['inddef'] . ';'; |
|
275 | 284 | } |
276 | 285 | $smcFunc['db_free_result']($result); |
277 | 286 | |
@@ -290,8 +299,9 @@ discard block |
||
290 | 299 | global $db_connection; |
291 | 300 | static $ver; |
292 | 301 | |
293 | - if(!empty($ver)) |
|
294 | - return $ver; |
|
302 | + if(!empty($ver)) { |
|
303 | + return $ver; |
|
304 | + } |
|
295 | 305 | |
296 | 306 | $ver = pg_version($db_connection)['server']; |
297 | 307 |
@@ -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 | * Finds or repairs errors in the database to fix possible problems. |
@@ -50,8 +51,9 @@ discard block |
||
50 | 51 | ); |
51 | 52 | |
52 | 53 | // Start displaying errors without fixing them. |
53 | - if (isset($_GET['fixErrors'])) |
|
54 | - checkSession('get'); |
|
54 | + if (isset($_GET['fixErrors'])) { |
|
55 | + checkSession('get'); |
|
56 | + } |
|
55 | 57 | |
56 | 58 | // Will want this. |
57 | 59 | loadForumTests(); |
@@ -69,11 +71,11 @@ discard block |
||
69 | 71 | $_SESSION['repairboards_to_fix'] = $context['to_fix']; |
70 | 72 | $_SESSION['repairboards_to_fix2'] = null; |
71 | 73 | |
72 | - if (empty($context['repair_errors'])) |
|
73 | - $context['repair_errors'][] = '???'; |
|
74 | + if (empty($context['repair_errors'])) { |
|
75 | + $context['repair_errors'][] = '???'; |
|
76 | + } |
|
74 | 77 | } |
75 | - } |
|
76 | - else |
|
78 | + } else |
|
77 | 79 | { |
78 | 80 | $context['error_search'] = false; |
79 | 81 | $context['to_fix'] = isset($_SESSION['repairboards_to_fix']) ? $_SESSION['repairboards_to_fix'] : array(); |
@@ -120,16 +122,19 @@ discard block |
||
120 | 122 | |
121 | 123 | // More time, I need more time! |
122 | 124 | @set_time_limit(600); |
123 | - if (function_exists('apache_reset_timeout')) |
|
124 | - @apache_reset_timeout(); |
|
125 | + if (function_exists('apache_reset_timeout')) { |
|
126 | + @apache_reset_timeout(); |
|
127 | + } |
|
125 | 128 | |
126 | 129 | // Errr, wait. How much time has this taken already? |
127 | - if (!$force && (time() - $time_start) < 3) |
|
128 | - return; |
|
130 | + if (!$force && (time() - $time_start) < 3) { |
|
131 | + return; |
|
132 | + } |
|
129 | 133 | |
130 | 134 | // Restore the query cache if interested. |
131 | - if (!empty($db_temp_cache)) |
|
132 | - $db_cache = $db_temp_cache; |
|
135 | + if (!empty($db_temp_cache)) { |
|
136 | + $db_cache = $db_temp_cache; |
|
137 | + } |
|
133 | 138 | |
134 | 139 | $context['continue_get_data'] = '?action=admin;area=repairboards' . (isset($_GET['fixErrors']) ? ';fixErrors' : '') . ';step=' . $_GET['step'] . ';substep=' . $_GET['substep'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
135 | 140 | $context['page_title'] = $txt['not_done_title']; |
@@ -138,10 +143,11 @@ discard block |
||
138 | 143 | $context['sub_template'] = 'not_done'; |
139 | 144 | |
140 | 145 | // Change these two if more steps are added! |
141 | - if (empty($max_substep)) |
|
142 | - $context['continue_percent'] = round(($_GET['step'] * 100) / $context['total_steps']); |
|
143 | - else |
|
144 | - $context['continue_percent'] = round((($_GET['step'] + ($_GET['substep'] / $max_substep)) * 100) / $context['total_steps']); |
|
146 | + if (empty($max_substep)) { |
|
147 | + $context['continue_percent'] = round(($_GET['step'] * 100) / $context['total_steps']); |
|
148 | + } else { |
|
149 | + $context['continue_percent'] = round((($_GET['step'] + ($_GET['substep'] / $max_substep)) * 100) / $context['total_steps']); |
|
150 | + } |
|
145 | 151 | |
146 | 152 | // Never more than 100%! |
147 | 153 | $context['continue_percent'] = min($context['continue_percent'], 100); |
@@ -612,8 +618,9 @@ discard block |
||
612 | 618 | $row['myid_last_msg'] = (int) $row['myid_last_msg']; |
613 | 619 | |
614 | 620 | // Not really a problem? |
615 | - if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved']) |
|
616 | - return false; |
|
621 | + if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved']) { |
|
622 | + return false; |
|
623 | + } |
|
617 | 624 | |
618 | 625 | $memberStartedID = (int) getMsgMemberID($row['myid_first_msg']); |
619 | 626 | $memberUpdatedID = (int) getMsgMemberID($row['myid_last_msg']); |
@@ -637,15 +644,19 @@ discard block |
||
637 | 644 | 'message_function' => function ($row) use ($txt, &$context) |
638 | 645 | { |
639 | 646 | // A pretend error? |
640 | - if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved']) |
|
641 | - return false; |
|
647 | + if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved']) { |
|
648 | + return false; |
|
649 | + } |
|
642 | 650 | |
643 | - if ($row['id_first_msg'] != $row['myid_first_msg']) |
|
644 | - $context['repair_errors'][] = sprintf($txt['repair_stats_topics_1'], $row['id_topic'], $row['id_first_msg']); |
|
645 | - if ($row['id_last_msg'] != $row['myid_last_msg']) |
|
646 | - $context['repair_errors'][] = sprintf($txt['repair_stats_topics_2'], $row['id_topic'], $row['id_last_msg']); |
|
647 | - if ($row['approved'] != $row['firstmsg_approved']) |
|
648 | - $context['repair_errors'][] = sprintf($txt['repair_stats_topics_5'], $row['id_topic']); |
|
651 | + if ($row['id_first_msg'] != $row['myid_first_msg']) { |
|
652 | + $context['repair_errors'][] = sprintf($txt['repair_stats_topics_1'], $row['id_topic'], $row['id_first_msg']); |
|
653 | + } |
|
654 | + if ($row['id_last_msg'] != $row['myid_last_msg']) { |
|
655 | + $context['repair_errors'][] = sprintf($txt['repair_stats_topics_2'], $row['id_topic'], $row['id_last_msg']); |
|
656 | + } |
|
657 | + if ($row['approved'] != $row['firstmsg_approved']) { |
|
658 | + $context['repair_errors'][] = sprintf($txt['repair_stats_topics_5'], $row['id_topic']); |
|
659 | + } |
|
649 | 660 | |
650 | 661 | return true; |
651 | 662 | }, |
@@ -675,8 +686,9 @@ discard block |
||
675 | 686 | $row['my_num_replies'] = (int) $row['my_num_replies']; |
676 | 687 | |
677 | 688 | // Not really a problem? |
678 | - if ($row['my_num_replies'] == $row['num_replies']) |
|
679 | - return false; |
|
689 | + if ($row['my_num_replies'] == $row['num_replies']) { |
|
690 | + return false; |
|
691 | + } |
|
680 | 692 | |
681 | 693 | $smcFunc['db_query']('', ' |
682 | 694 | UPDATE {db_prefix}topics |
@@ -695,11 +707,13 @@ discard block |
||
695 | 707 | global $txt, $context; |
696 | 708 | |
697 | 709 | // Just joking? |
698 | - if ($row['my_num_replies'] == $row['num_replies']) |
|
699 | - return false; |
|
710 | + if ($row['my_num_replies'] == $row['num_replies']) { |
|
711 | + return false; |
|
712 | + } |
|
700 | 713 | |
701 | - if ($row['num_replies'] != $row['my_num_replies']) |
|
702 | - $context['repair_errors'][] = sprintf($txt['repair_stats_topics_3'], $row['id_topic'], $row['num_replies']); |
|
714 | + if ($row['num_replies'] != $row['my_num_replies']) { |
|
715 | + $context['repair_errors'][] = sprintf($txt['repair_stats_topics_3'], $row['id_topic'], $row['num_replies']); |
|
716 | + } |
|
703 | 717 | |
704 | 718 | return true; |
705 | 719 | |
@@ -1290,8 +1304,9 @@ discard block |
||
1290 | 1304 | $inserts = array(); |
1291 | 1305 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
1292 | 1306 | { |
1293 | - foreach (text2words($row['subject']) as $word) |
|
1294 | - $inserts[] = array($word, $row['id_topic']); |
|
1307 | + foreach (text2words($row['subject']) as $word) { |
|
1308 | + $inserts[] = array($word, $row['id_topic']); |
|
1309 | + } |
|
1295 | 1310 | if (count($inserts) > 500) |
1296 | 1311 | { |
1297 | 1312 | $smcFunc['db_insert']('ignore', |
@@ -1305,13 +1320,14 @@ discard block |
||
1305 | 1320 | |
1306 | 1321 | } |
1307 | 1322 | |
1308 | - if (!empty($inserts)) |
|
1309 | - $smcFunc['db_insert']('ignore', |
|
1323 | + if (!empty($inserts)) { |
|
1324 | + $smcFunc['db_insert']('ignore', |
|
1310 | 1325 | '{db_prefix}log_search_subjects', |
1311 | 1326 | array('word' => 'string', 'id_topic' => 'int'), |
1312 | 1327 | $inserts, |
1313 | 1328 | array('word', 'id_topic') |
1314 | 1329 | ); |
1330 | + } |
|
1315 | 1331 | |
1316 | 1332 | }, |
1317 | 1333 | 'message_function' => function ($row) |
@@ -1581,8 +1597,9 @@ discard block |
||
1581 | 1597 | $current_step++; |
1582 | 1598 | |
1583 | 1599 | // Already done this? |
1584 | - if ($_GET['step'] > $current_step) |
|
1585 | - continue; |
|
1600 | + if ($_GET['step'] > $current_step) { |
|
1601 | + continue; |
|
1602 | + } |
|
1586 | 1603 | |
1587 | 1604 | // If we're fixing it but it ain't broke why try? |
1588 | 1605 | if ($do_fix && !in_array($error_type, $to_fix)) |
@@ -1611,14 +1628,16 @@ discard block |
||
1611 | 1628 | while (!$done) |
1612 | 1629 | { |
1613 | 1630 | // Make sure there's at least one ID to test. |
1614 | - if (isset($test['substeps']) && empty($step_max)) |
|
1615 | - break; |
|
1631 | + if (isset($test['substeps']) && empty($step_max)) { |
|
1632 | + break; |
|
1633 | + } |
|
1616 | 1634 | |
1617 | 1635 | // What is the testing query (Changes if we are testing or fixing) |
1618 | - if (!$do_fix) |
|
1619 | - $test_query = 'check_query'; |
|
1620 | - else |
|
1621 | - $test_query = isset($test['fix_query']) ? 'fix_query' : 'check_query'; |
|
1636 | + if (!$do_fix) { |
|
1637 | + $test_query = 'check_query'; |
|
1638 | + } else { |
|
1639 | + $test_query = isset($test['fix_query']) ? 'fix_query' : 'check_query'; |
|
1640 | + } |
|
1622 | 1641 | |
1623 | 1642 | // Do the test... |
1624 | 1643 | $request = $smcFunc['db_query']('', |
@@ -1628,10 +1647,11 @@ discard block |
||
1628 | 1647 | ); |
1629 | 1648 | |
1630 | 1649 | // Does it need a fix? |
1631 | - if (!empty($test['check_type']) && $test['check_type'] == 'count') |
|
1632 | - list ($needs_fix) = $smcFunc['db_fetch_row']($request); |
|
1633 | - else |
|
1634 | - $needs_fix = $smcFunc['db_num_rows']($request); |
|
1650 | + if (!empty($test['check_type']) && $test['check_type'] == 'count') { |
|
1651 | + list ($needs_fix) = $smcFunc['db_fetch_row']($request); |
|
1652 | + } else { |
|
1653 | + $needs_fix = $smcFunc['db_num_rows']($request); |
|
1654 | + } |
|
1635 | 1655 | |
1636 | 1656 | $total_queries++; |
1637 | 1657 | |
@@ -1643,8 +1663,9 @@ discard block |
||
1643 | 1663 | // Assume need to fix. |
1644 | 1664 | $found_errors = true; |
1645 | 1665 | |
1646 | - if (isset($test['message'])) |
|
1647 | - $context['repair_errors'][] = $txt[$test['message']]; |
|
1666 | + if (isset($test['message'])) { |
|
1667 | + $context['repair_errors'][] = $txt[$test['message']]; |
|
1668 | + } |
|
1648 | 1669 | |
1649 | 1670 | // One per row! |
1650 | 1671 | elseif (isset($test['messages'])) |
@@ -1654,10 +1675,11 @@ discard block |
||
1654 | 1675 | $variables = $test['messages']; |
1655 | 1676 | foreach ($variables as $k => $v) |
1656 | 1677 | { |
1657 | - if ($k == 0 && isset($txt[$v])) |
|
1658 | - $variables[$k] = $txt[$v]; |
|
1659 | - elseif ($k > 0 && isset($row[$v])) |
|
1660 | - $variables[$k] = $row[$v]; |
|
1678 | + if ($k == 0 && isset($txt[$v])) { |
|
1679 | + $variables[$k] = $txt[$v]; |
|
1680 | + } elseif ($k > 0 && isset($row[$v])) { |
|
1681 | + $variables[$k] = $row[$v]; |
|
1682 | + } |
|
1661 | 1683 | } |
1662 | 1684 | $context['repair_errors'][] = call_user_func_array('sprintf', $variables); |
1663 | 1685 | } |
@@ -1668,13 +1690,15 @@ discard block |
||
1668 | 1690 | { |
1669 | 1691 | // Find out if there are actually errors. |
1670 | 1692 | $found_errors = false; |
1671 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1672 | - $found_errors |= $test['message_function']($row); |
|
1693 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1694 | + $found_errors |= $test['message_function']($row); |
|
1695 | + } |
|
1673 | 1696 | } |
1674 | 1697 | |
1675 | 1698 | // Actually have something to fix? |
1676 | - if ($found_errors) |
|
1677 | - $to_fix[] = $error_type; |
|
1699 | + if ($found_errors) { |
|
1700 | + $to_fix[] = $error_type; |
|
1701 | + } |
|
1678 | 1702 | } |
1679 | 1703 | |
1680 | 1704 | // We want to fix, we need to fix - so work out what exactly to do! |
@@ -1684,8 +1708,9 @@ discard block |
||
1684 | 1708 | if (isset($test['fix_collect'])) |
1685 | 1709 | { |
1686 | 1710 | $ids = array(); |
1687 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1688 | - $ids[] = $row[$test['fix_collect']['index']]; |
|
1711 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1712 | + $ids[] = $row[$test['fix_collect']['index']]; |
|
1713 | + } |
|
1689 | 1714 | if (!empty($ids)) |
1690 | 1715 | { |
1691 | 1716 | // Fix it! |
@@ -1694,30 +1719,34 @@ discard block |
||
1694 | 1719 | } |
1695 | 1720 | |
1696 | 1721 | // Simply executing a fix it query? |
1697 | - elseif (isset($test['fix_it_query'])) |
|
1698 | - $smcFunc['db_query']('', |
|
1722 | + elseif (isset($test['fix_it_query'])) { |
|
1723 | + $smcFunc['db_query']('', |
|
1699 | 1724 | $test['fix_it_query'], |
1700 | 1725 | array( |
1701 | 1726 | ) |
1702 | 1727 | ); |
1728 | + } |
|
1703 | 1729 | |
1704 | 1730 | // Do we have some processing to do? |
1705 | 1731 | elseif (isset($test['fix_processing'])) |
1706 | 1732 | { |
1707 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1708 | - $test['fix_processing']($row); |
|
1733 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1734 | + $test['fix_processing']($row); |
|
1735 | + } |
|
1709 | 1736 | } |
1710 | 1737 | |
1711 | 1738 | // What about the full set of processing? |
1712 | - elseif (isset($test['fix_full_processing'])) |
|
1713 | - $test['fix_full_processing']($request); |
|
1739 | + elseif (isset($test['fix_full_processing'])) { |
|
1740 | + $test['fix_full_processing']($request); |
|
1741 | + } |
|
1714 | 1742 | |
1715 | 1743 | // Do we have other things we need to fix as a result? |
1716 | 1744 | if (!empty($test['force_fix'])) |
1717 | 1745 | { |
1718 | - foreach ($test['force_fix'] as $item) |
|
1719 | - if (!in_array($item, $to_fix)) |
|
1746 | + foreach ($test['force_fix'] as $item) { |
|
1747 | + if (!in_array($item, $to_fix)) |
|
1720 | 1748 | $to_fix[] = $item; |
1749 | + } |
|
1721 | 1750 | } |
1722 | 1751 | } |
1723 | 1752 | } |
@@ -1735,16 +1764,17 @@ discard block |
||
1735 | 1764 | if ($_GET['substep'] <= $step_max) |
1736 | 1765 | { |
1737 | 1766 | pauseRepairProcess($to_fix, $error_type, $step_max); |
1767 | + } else { |
|
1768 | + $done = true; |
|
1738 | 1769 | } |
1739 | - else |
|
1740 | - $done = true; |
|
1770 | + } else { |
|
1771 | + $done = true; |
|
1741 | 1772 | } |
1742 | - else |
|
1743 | - $done = true; |
|
1744 | 1773 | |
1745 | 1774 | // Don't allow more than 1000 queries at a time. |
1746 | - if ($total_queries >= 1000) |
|
1747 | - pauseRepairProcess($to_fix, $error_type, $step_max, true); |
|
1775 | + if ($total_queries >= 1000) { |
|
1776 | + pauseRepairProcess($to_fix, $error_type, $step_max, true); |
|
1777 | + } |
|
1748 | 1778 | } |
1749 | 1779 | |
1750 | 1780 | // Keep going. |
@@ -1757,8 +1787,9 @@ discard block |
||
1757 | 1787 | if ($do_fix) |
1758 | 1788 | { |
1759 | 1789 | $key = array_search($error_type, $to_fix); |
1760 | - if ($key !== false && isset($to_fix[$key])) |
|
1761 | - unset($to_fix[$key]); |
|
1790 | + if ($key !== false && isset($to_fix[$key])) { |
|
1791 | + unset($to_fix[$key]); |
|
1792 | + } |
|
1762 | 1793 | } |
1763 | 1794 | |
1764 | 1795 | // Are we done? |
@@ -1781,10 +1812,11 @@ discard block |
||
1781 | 1812 | static $createOnce = false; |
1782 | 1813 | |
1783 | 1814 | // Have we already created it? |
1784 | - if ($createOnce) |
|
1785 | - return; |
|
1786 | - else |
|
1787 | - $createOnce = true; |
|
1815 | + if ($createOnce) { |
|
1816 | + return; |
|
1817 | + } else { |
|
1818 | + $createOnce = true; |
|
1819 | + } |
|
1788 | 1820 | |
1789 | 1821 | // Back to the forum's default language. |
1790 | 1822 | loadLanguage('Admin', $language); |
@@ -1799,8 +1831,9 @@ discard block |
||
1799 | 1831 | 'cat_name' => $txt['salvaged_category_name'], |
1800 | 1832 | ) |
1801 | 1833 | ); |
1802 | - if ($smcFunc['db_num_rows']($result) != 0) |
|
1803 | - list ($salvageCatID) = $smcFunc['db_fetch_row']($result); |
|
1834 | + if ($smcFunc['db_num_rows']($result) != 0) { |
|
1835 | + list ($salvageCatID) = $smcFunc['db_fetch_row']($result); |
|
1836 | + } |
|
1804 | 1837 | $smcFunc['db_free_result']($result); |
1805 | 1838 | |
1806 | 1839 | if (empty($salvageCatID)) |
@@ -1832,8 +1865,9 @@ discard block |
||
1832 | 1865 | 'board_name' => $txt['salvaged_board_name'], |
1833 | 1866 | ) |
1834 | 1867 | ); |
1835 | - if ($smcFunc['db_num_rows']($result) != 0) |
|
1836 | - list ($salvageBoardID) = $smcFunc['db_fetch_row']($result); |
|
1868 | + if ($smcFunc['db_num_rows']($result) != 0) { |
|
1869 | + list ($salvageBoardID) = $smcFunc['db_fetch_row']($result); |
|
1870 | + } |
|
1837 | 1871 | $smcFunc['db_free_result']($result); |
1838 | 1872 | |
1839 | 1873 | if (empty($salvageBoardID)) |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | LEFT JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic) |
233 | 233 | WHERE t.id_topic IS NULL |
234 | 234 | GROUP BY m.id_topic, m.id_board', |
235 | - 'fix_processing' => function ($row) use ($smcFunc) |
|
235 | + 'fix_processing' => function($row) use ($smcFunc) |
|
236 | 236 | { |
237 | 237 | global $salvageBoardID; |
238 | 238 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | // Remove all topics that have zero messages in the messages table. |
319 | 319 | 'fix_collect' => array( |
320 | 320 | 'index' => 'id_topic', |
321 | - 'process' => function ($topics) use ($smcFunc) |
|
321 | + 'process' => function($topics) use ($smcFunc) |
|
322 | 322 | { |
323 | 323 | $smcFunc['db_query']('', ' |
324 | 324 | DELETE FROM {db_prefix}topics |
@@ -356,21 +356,21 @@ discard block |
||
356 | 356 | AND p.id_poll IS NULL |
357 | 357 | GROUP BY o.id_poll, t.id_topic, t.id_board, t.id_member_started, m.member_name |
358 | 358 | ', |
359 | - 'fix_processing' => function ($row) use ($smcFunc, $txt) |
|
359 | + 'fix_processing' => function($row) use ($smcFunc, $txt) |
|
360 | 360 | { |
361 | 361 | global $salvageBoardID; |
362 | 362 | |
363 | 363 | $row['poster_name'] = !empty($row['poster_name']) ? $row['poster_name'] : $txt['guest']; |
364 | 364 | $row['id_poster'] = !empty($row['id_poster']) ? $row['id_poster'] : 0; |
365 | 365 | |
366 | - if(empty($row['id_board'])) |
|
366 | + if (empty($row['id_board'])) |
|
367 | 367 | { |
368 | 368 | // Only if we don't have a reasonable idea of where to put it. |
369 | 369 | createSalvageArea(); |
370 | - $row['id_board'] = (int)$salvageBoardID; |
|
370 | + $row['id_board'] = (int) $salvageBoardID; |
|
371 | 371 | } |
372 | 372 | |
373 | - if(empty($row['id_topic'])) { |
|
373 | + if (empty($row['id_topic'])) { |
|
374 | 374 | $newMessageID = $smcFunc['db_insert']('', |
375 | 375 | '{db_prefix}messages', |
376 | 376 | array( |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | LEFT JOIN {db_prefix}topics AS t ON (t.id_poll = p.id_poll) |
493 | 493 | WHERE p.id_poll BETWEEN {STEP_LOW} AND {STEP_HIGH} |
494 | 494 | AND t.id_poll IS NULL', |
495 | - 'fix_processing' => function ($row) use ($smcFunc, $txt) |
|
495 | + 'fix_processing' => function($row) use ($smcFunc, $txt) |
|
496 | 496 | { |
497 | 497 | global $salvageBoardID; |
498 | 498 | |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
606 | 606 | GROUP BY t.id_topic, t.id_first_msg, t.id_last_msg, t.approved, mf.approved |
607 | 607 | ORDER BY t.id_topic', |
608 | - 'fix_processing' => function ($row) use ($smcFunc) |
|
608 | + 'fix_processing' => function($row) use ($smcFunc) |
|
609 | 609 | { |
610 | 610 | $row['firstmsg_approved'] = (int) $row['firstmsg_approved']; |
611 | 611 | $row['myid_first_msg'] = (int) $row['myid_first_msg']; |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | ) |
635 | 635 | ); |
636 | 636 | }, |
637 | - 'message_function' => function ($row) use ($txt, &$context) |
|
637 | + 'message_function' => function($row) use ($txt, &$context) |
|
638 | 638 | { |
639 | 639 | // A pretend error? |
640 | 640 | if ($row['id_first_msg'] == $row['myid_first_msg'] && $row['id_last_msg'] == $row['myid_last_msg'] && $row['approved'] == $row['firstmsg_approved']) |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
669 | 669 | GROUP BY t.id_topic, t.num_replies, mf.approved |
670 | 670 | ORDER BY t.id_topic', |
671 | - 'fix_processing' => function ($row) |
|
671 | + 'fix_processing' => function($row) |
|
672 | 672 | { |
673 | 673 | |
674 | 674 | global $smcFunc; |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | ); |
690 | 690 | |
691 | 691 | }, |
692 | - 'message_function' => function ($row) |
|
692 | + 'message_function' => function($row) |
|
693 | 693 | { |
694 | 694 | |
695 | 695 | global $txt, $context; |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | GROUP BY t.id_topic, t.unapproved_posts |
723 | 723 | HAVING unapproved_posts != COUNT(mu.id_msg) |
724 | 724 | ORDER BY t.id_topic', |
725 | - 'fix_processing' => function ($row) |
|
725 | + 'fix_processing' => function($row) |
|
726 | 726 | { |
727 | 727 | |
728 | 728 | global $smcFunc; |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | WHERE b.id_board IS NULL |
765 | 765 | AND t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
766 | 766 | GROUP BY t.id_board', |
767 | - 'fix_processing' => function ($row) |
|
767 | + 'fix_processing' => function($row) |
|
768 | 768 | { |
769 | 769 | |
770 | 770 | global $smcFunc, $salvageCatID, $txt; |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | ORDER BY b.id_cat, b.id_board', |
814 | 814 | 'fix_collect' => array( |
815 | 815 | 'index' => 'id_cat', |
816 | - 'process' => function ($cats) |
|
816 | + 'process' => function($cats) |
|
817 | 817 | { |
818 | 818 | global $smcFunc, $salvageCatID; |
819 | 819 | createSalvageArea(); |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | // Last step-make sure all non-guest posters still exist. |
850 | 850 | 'fix_collect' => array( |
851 | 851 | 'index' => 'id_msg', |
852 | - 'process' => function ($msgs) |
|
852 | + 'process' => function($msgs) |
|
853 | 853 | { |
854 | 854 | |
855 | 855 | global $smcFunc; |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | ORDER BY b.id_parent, b.id_board', |
879 | 879 | 'fix_collect' => array( |
880 | 880 | 'index' => 'id_parent', |
881 | - 'process' => function ($parents) |
|
881 | + 'process' => function($parents) |
|
882 | 882 | { |
883 | 883 | global $smcFunc, $salvageBoardID, $salvageCatID; |
884 | 884 | createSalvageArea(); |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | AND p.id_poll IS NULL', |
913 | 913 | 'fix_collect' => array( |
914 | 914 | 'index' => 'id_poll', |
915 | - 'process' => function ($polls) |
|
915 | + 'process' => function($polls) |
|
916 | 916 | { |
917 | 917 | |
918 | 918 | global $smcFunc; |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | ORDER BY cal.id_topic', |
947 | 947 | 'fix_collect' => array( |
948 | 948 | 'index' => 'id_topic', |
949 | - 'process' => function ($events) |
|
949 | + 'process' => function($events) |
|
950 | 950 | { |
951 | 951 | |
952 | 952 | global $smcFunc; |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | AND lt.id_member BETWEEN {STEP_LOW} AND {STEP_HIGH}', |
979 | 979 | 'fix_collect' => array( |
980 | 980 | 'index' => 'id_topic', |
981 | - 'process' => function ($topics) |
|
981 | + 'process' => function($topics) |
|
982 | 982 | { |
983 | 983 | |
984 | 984 | global $smcFunc; |
@@ -1010,7 +1010,7 @@ discard block |
||
1010 | 1010 | GROUP BY lt.id_member', |
1011 | 1011 | 'fix_collect' => array( |
1012 | 1012 | 'index' => 'id_member', |
1013 | - 'process' => function ($members) |
|
1013 | + 'process' => function($members) |
|
1014 | 1014 | { |
1015 | 1015 | |
1016 | 1016 | global $smcFunc; |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | GROUP BY lb.id_board', |
1043 | 1043 | 'fix_collect' => array( |
1044 | 1044 | 'index' => 'id_board', |
1045 | - 'process' => function ($boards) |
|
1045 | + 'process' => function($boards) |
|
1046 | 1046 | { |
1047 | 1047 | |
1048 | 1048 | global $smcFunc; |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | GROUP BY lb.id_member', |
1075 | 1075 | 'fix_collect' => array( |
1076 | 1076 | 'index' => 'id_member', |
1077 | - 'process' => function ($members) use ($smcFunc) |
|
1077 | + 'process' => function($members) use ($smcFunc) |
|
1078 | 1078 | { |
1079 | 1079 | $smcFunc['db_query']('', ' |
1080 | 1080 | DELETE FROM {db_prefix}log_boards |
@@ -1103,7 +1103,7 @@ discard block |
||
1103 | 1103 | GROUP BY lmr.id_board', |
1104 | 1104 | 'fix_collect' => array( |
1105 | 1105 | 'index' => 'id_board', |
1106 | - 'process' => function ($boards) use ($smcFunc) |
|
1106 | + 'process' => function($boards) use ($smcFunc) |
|
1107 | 1107 | { |
1108 | 1108 | $smcFunc['db_query']('', ' |
1109 | 1109 | DELETE FROM {db_prefix}log_mark_read |
@@ -1132,7 +1132,7 @@ discard block |
||
1132 | 1132 | GROUP BY lmr.id_member', |
1133 | 1133 | 'fix_collect' => array( |
1134 | 1134 | 'index' => 'id_member', |
1135 | - 'process' => function ($members) use ($smcFunc) |
|
1135 | + 'process' => function($members) use ($smcFunc) |
|
1136 | 1136 | { |
1137 | 1137 | $smcFunc['db_query']('', ' |
1138 | 1138 | DELETE FROM {db_prefix}log_mark_read |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | GROUP BY pmr.id_pm', |
1162 | 1162 | 'fix_collect' => array( |
1163 | 1163 | 'index' => 'id_pm', |
1164 | - 'process' => function ($pms) use ($smcFunc) |
|
1164 | + 'process' => function($pms) use ($smcFunc) |
|
1165 | 1165 | { |
1166 | 1166 | $smcFunc['db_query']('', ' |
1167 | 1167 | DELETE FROM {db_prefix}pm_recipients |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | GROUP BY pmr.id_member', |
1192 | 1192 | 'fix_collect' => array( |
1193 | 1193 | 'index' => 'id_member', |
1194 | - 'process' => function ($members) |
|
1194 | + 'process' => function($members) |
|
1195 | 1195 | { |
1196 | 1196 | |
1197 | 1197 | global $smcFunc; |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | AND mem.id_member IS NULL', |
1224 | 1224 | 'fix_collect' => array( |
1225 | 1225 | 'index' => 'id_pm', |
1226 | - 'process' => function ($guestMessages) |
|
1226 | + 'process' => function($guestMessages) |
|
1227 | 1227 | { |
1228 | 1228 | |
1229 | 1229 | global $smcFunc; |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | GROUP BY ln.id_member', |
1256 | 1256 | 'fix_collect' => array( |
1257 | 1257 | 'index' => 'id_member', |
1258 | - 'process' => function ($members) use ($smcFunc) |
|
1258 | + 'process' => function($members) use ($smcFunc) |
|
1259 | 1259 | { |
1260 | 1260 | $smcFunc['db_query']('', ' |
1261 | 1261 | DELETE FROM {db_prefix}log_notify |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | LEFT JOIN {db_prefix}log_search_subjects AS lss ON (lss.id_topic = t.id_topic) |
1283 | 1283 | WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
1284 | 1284 | AND lss.id_topic IS NULL', |
1285 | - 'fix_full_processing' => function ($result) |
|
1285 | + 'fix_full_processing' => function($result) |
|
1286 | 1286 | { |
1287 | 1287 | |
1288 | 1288 | global $smcFunc; |
@@ -1314,7 +1314,7 @@ discard block |
||
1314 | 1314 | ); |
1315 | 1315 | |
1316 | 1316 | }, |
1317 | - 'message_function' => function ($row) |
|
1317 | + 'message_function' => function($row) |
|
1318 | 1318 | { |
1319 | 1319 | |
1320 | 1320 | global $txt, $context; |
@@ -1344,7 +1344,7 @@ discard block |
||
1344 | 1344 | AND t.id_topic IS NULL', |
1345 | 1345 | 'fix_collect' => array( |
1346 | 1346 | 'index' => 'id_topic', |
1347 | - 'process' => function ($deleteTopics) |
|
1347 | + 'process' => function($deleteTopics) |
|
1348 | 1348 | { |
1349 | 1349 | |
1350 | 1350 | global $smcFunc; |
@@ -1376,7 +1376,7 @@ discard block |
||
1376 | 1376 | AND mem.id_member IS NULL', |
1377 | 1377 | 'fix_collect' => array( |
1378 | 1378 | 'index' => 'id_member', |
1379 | - 'process' => function ($members) |
|
1379 | + 'process' => function($members) |
|
1380 | 1380 | { |
1381 | 1381 | |
1382 | 1382 | global $smcFunc; |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | AND p.id_poll IS NULL', |
1408 | 1408 | 'fix_collect' => array( |
1409 | 1409 | 'index' => 'id_poll', |
1410 | - 'process' => function ($polls) |
|
1410 | + 'process' => function($polls) |
|
1411 | 1411 | { |
1412 | 1412 | |
1413 | 1413 | global $smcFunc; |
@@ -1438,7 +1438,7 @@ discard block |
||
1438 | 1438 | AND lrc.id_report IS NULL', |
1439 | 1439 | 'fix_collect' => array( |
1440 | 1440 | 'index' => 'id_report', |
1441 | - 'process' => function ($reports) |
|
1441 | + 'process' => function($reports) |
|
1442 | 1442 | { |
1443 | 1443 | |
1444 | 1444 | global $smcFunc; |
@@ -1469,7 +1469,7 @@ discard block |
||
1469 | 1469 | AND lr.id_report IS NULL', |
1470 | 1470 | 'fix_collect' => array( |
1471 | 1471 | 'index' => 'id_report', |
1472 | - 'process' => function ($reports) |
|
1472 | + 'process' => function($reports) |
|
1473 | 1473 | { |
1474 | 1474 | global $smcFunc; |
1475 | 1475 | $smcFunc['db_query']('', ' |
@@ -1499,7 +1499,7 @@ discard block |
||
1499 | 1499 | GROUP BY lgr.id_member', |
1500 | 1500 | 'fix_collect' => array( |
1501 | 1501 | 'index' => 'id_member', |
1502 | - 'process' => function ($members) |
|
1502 | + 'process' => function($members) |
|
1503 | 1503 | { |
1504 | 1504 | global $smcFunc; |
1505 | 1505 | $smcFunc['db_query']('', ' |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | GROUP BY lgr.id_group', |
1530 | 1530 | 'fix_collect' => array( |
1531 | 1531 | 'index' => 'id_group', |
1532 | - 'process' => function ($groups) |
|
1532 | + 'process' => function($groups) |
|
1533 | 1533 | { |
1534 | 1534 | global $smcFunc; |
1535 | 1535 | $smcFunc['db_query']('', ' |
@@ -18,9 +18,10 @@ discard block |
||
18 | 18 | global $context, $txt, $scripturl; |
19 | 19 | |
20 | 20 | // Are we done sending the newsletter? |
21 | - if (!empty($context['newsletter_sent'])) |
|
22 | - echo ' |
|
21 | + if (!empty($context['newsletter_sent'])) { |
|
22 | + echo ' |
|
23 | 23 | <div class="infobox">', $txt['admin_news_newsletter_' . $context['newsletter_sent']], '</div>'; |
24 | + } |
|
24 | 25 | |
25 | 26 | echo ' |
26 | 27 | <div id="admincenter"> |
@@ -39,9 +40,10 @@ discard block |
||
39 | 40 | </dt> |
40 | 41 | <dd>'; |
41 | 42 | |
42 | - foreach ($context['groups'] as $group) |
|
43 | - echo ' |
|
43 | + foreach ($context['groups'] as $group) { |
|
44 | + echo ' |
|
44 | 45 | <label for="groups_', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups_', $group['id'], '" value="', $group['id'], '" checked> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>'; |
46 | + } |
|
45 | 47 | |
46 | 48 | echo ' |
47 | 49 | <br> |
@@ -82,9 +84,10 @@ discard block |
||
82 | 84 | </dt> |
83 | 85 | <dd>'; |
84 | 86 | |
85 | - foreach ($context['groups'] as $group) |
|
86 | - echo ' |
|
87 | + foreach ($context['groups'] as $group) { |
|
88 | + echo ' |
|
87 | 89 | <label for="exclude_groups_', $group['id'], '"><input type="checkbox" name="exclude_groups[', $group['id'], ']" id="exclude_groups_', $group['id'], '" value="', $group['id'], '"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>'; |
90 | + } |
|
88 | 91 | |
89 | 92 | echo ' |
90 | 93 | <br> |
@@ -230,9 +233,10 @@ discard block |
||
230 | 233 | <div id="bbcBox_message"></div>'; |
231 | 234 | |
232 | 235 | // What about smileys? |
233 | - if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) |
|
234 | - echo ' |
|
236 | + if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) { |
|
237 | + echo ' |
|
235 | 238 | <div id="smileyBox_message"></div>'; |
239 | + } |
|
236 | 240 | |
237 | 241 | // Show BBC buttons, smileys and textbox. |
238 | 242 | echo ' |
@@ -253,9 +257,10 @@ discard block |
||
253 | 257 | <input type="hidden" name="email_force" value="', $context['email_force'], '"> |
254 | 258 | <input type="hidden" name="total_emails" value="', $context['total_emails'], '">'; |
255 | 259 | |
256 | - foreach ($context['recipients'] as $key => $values) |
|
257 | - echo ' |
|
260 | + foreach ($context['recipients'] as $key => $values) { |
|
261 | + echo ' |
|
258 | 262 | <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">'; |
263 | + } |
|
259 | 264 | |
260 | 265 | echo ' |
261 | 266 | <script>'; |
@@ -411,9 +416,10 @@ discard block |
||
411 | 416 | <input type="hidden" name="parse_html" value="', $context['parse_html'], '">'; |
412 | 417 | |
413 | 418 | // All the things we must remember! |
414 | - foreach ($context['recipients'] as $key => $values) |
|
415 | - echo ' |
|
419 | + foreach ($context['recipients'] as $key => $values) { |
|
420 | + echo ' |
|
416 | 421 | <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">'; |
422 | + } |
|
417 | 423 | |
418 | 424 | echo ' |
419 | 425 | </div><!-- .windowbg --> |
@@ -446,9 +452,10 @@ discard block |
||
446 | 452 | { |
447 | 453 | global $context, $txt; |
448 | 454 | |
449 | - if (!empty($context['saved_successful'])) |
|
450 | - echo ' |
|
455 | + if (!empty($context['saved_successful'])) { |
|
456 | + echo ' |
|
451 | 457 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
458 | + } |
|
452 | 459 | |
453 | 460 | template_show_list('news_lists'); |
454 | 461 | } |
@@ -44,10 +44,11 @@ discard block |
||
44 | 44 | <dt>', $txt['users_online_today'], ':</dt> |
45 | 45 | <dd>', $context['online_today'], '</dd>'; |
46 | 46 | |
47 | - if (!empty($modSettings['hitStats'])) |
|
48 | - echo ' |
|
47 | + if (!empty($modSettings['hitStats'])) { |
|
48 | + echo ' |
|
49 | 49 | <dt>', $txt['num_hits'], ':</dt> |
50 | 50 | <dd>', $context['num_hits'], '</dd>'; |
51 | + } |
|
51 | 52 | |
52 | 53 | echo ' |
53 | 54 | </dl> |
@@ -71,17 +72,19 @@ discard block |
||
71 | 72 | <dt>', $txt['gender_stats'], ':</dt> |
72 | 73 | <dd>'; |
73 | 74 | |
74 | - foreach ($context['gender'] as $g => $n) |
|
75 | - echo $g, ': ', $n, '<br>'; |
|
75 | + foreach ($context['gender'] as $g => $n) { |
|
76 | + echo $g, ': ', $n, '<br>'; |
|
77 | + } |
|
76 | 78 | |
77 | 79 | echo ' |
78 | 80 | </dd>'; |
79 | 81 | } |
80 | 82 | |
81 | - if (!empty($modSettings['hitStats'])) |
|
82 | - echo ' |
|
83 | + if (!empty($modSettings['hitStats'])) { |
|
84 | + echo ' |
|
83 | 85 | <dt>', $txt['average_hits'], ':</dt> |
84 | 86 | <dd>', $context['average_hits'], '</dd>'; |
87 | + } |
|
85 | 88 | |
86 | 89 | echo ' |
87 | 90 | </dl>'; |
@@ -105,14 +108,15 @@ discard block |
||
105 | 108 | </dt> |
106 | 109 | <dd class="statsbar">'; |
107 | 110 | |
108 | - if (!empty($item['percent'])) |
|
109 | - echo ' |
|
111 | + if (!empty($item['percent'])) { |
|
112 | + echo ' |
|
110 | 113 | <div class="bar" style="width: ', $item['percent'], '%;"> |
111 | 114 | <span class="righttext">', $item['num'], '</span> |
112 | 115 | </div>'; |
113 | - else |
|
114 | - echo ' |
|
116 | + } else { |
|
117 | + echo ' |
|
115 | 118 | <div class="bar empty"><span class="righttext">', $item['num'], '</span></div>'; |
119 | + } |
|
116 | 120 | |
117 | 121 | echo ' |
118 | 122 | </dd>'; |
@@ -144,9 +148,10 @@ discard block |
||
144 | 148 | <th>', $txt['stats_new_members'], '</th> |
145 | 149 | <th>', $txt['most_online'], '</th>'; |
146 | 150 | |
147 | - if (!empty($modSettings['hitStats'])) |
|
148 | - echo ' |
|
151 | + if (!empty($modSettings['hitStats'])) { |
|
152 | + echo ' |
|
149 | 153 | <th>', $txt['page_views'], '</th>'; |
154 | + } |
|
150 | 155 | |
151 | 156 | echo ' |
152 | 157 | </tr> |
@@ -165,9 +170,10 @@ discard block |
||
165 | 170 | <th>', $year['new_members'], '</th> |
166 | 171 | <th>', $year['most_members_online'], '</th>'; |
167 | 172 | |
168 | - if (!empty($modSettings['hitStats'])) |
|
169 | - echo ' |
|
173 | + if (!empty($modSettings['hitStats'])) { |
|
174 | + echo ' |
|
170 | 175 | <th>', $year['hits'], '</th>'; |
176 | + } |
|
171 | 177 | |
172 | 178 | echo ' |
173 | 179 | </tr>'; |
@@ -184,9 +190,10 @@ discard block |
||
184 | 190 | <th>', $month['new_members'], '</th> |
185 | 191 | <th>', $month['most_members_online'], '</th>'; |
186 | 192 | |
187 | - if (!empty($modSettings['hitStats'])) |
|
188 | - echo ' |
|
193 | + if (!empty($modSettings['hitStats'])) { |
|
194 | + echo ' |
|
189 | 195 | <th>', $month['hits'], '</th>'; |
196 | + } |
|
190 | 197 | |
191 | 198 | echo ' |
192 | 199 | </tr>'; |
@@ -203,9 +210,10 @@ discard block |
||
203 | 210 | <td>', $day['new_members'], '</td> |
204 | 211 | <td>', $day['most_members_online'], '</td>'; |
205 | 212 | |
206 | - if (!empty($modSettings['hitStats'])) |
|
207 | - echo ' |
|
213 | + if (!empty($modSettings['hitStats'])) { |
|
214 | + echo ' |
|
208 | 215 | <td>', $day['hits'], '</td>'; |
216 | + } |
|
209 | 217 | |
210 | 218 | echo ' |
211 | 219 | </tr>'; |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | <h3 class="catbg">', $context['page_title'], '</h3> |
47 | 47 | </div>'; |
48 | 48 | |
49 | - if (!empty($context['poll_error']['messages'])) |
|
50 | - echo ' |
|
49 | + if (!empty($context['poll_error']['messages'])) { |
|
50 | + echo ' |
|
51 | 51 | <div class="errorbox"> |
52 | 52 | <dl class="poll_error"> |
53 | 53 | <dt> |
@@ -58,6 +58,7 @@ discard block |
||
58 | 58 | </dt> |
59 | 59 | </dl> |
60 | 60 | </div>'; |
61 | + } |
|
61 | 62 | |
62 | 63 | echo ' |
63 | 64 | <div> |
@@ -79,8 +80,9 @@ discard block |
||
79 | 80 | <input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" size="80" maxlength="255">'; |
80 | 81 | |
81 | 82 | // Does this option have a vote count yet, or is it new? |
82 | - if ($choice['votes'] != -1) |
|
83 | - echo ' (', $choice['votes'], ' ', $txt['votes'], ')'; |
|
83 | + if ($choice['votes'] != -1) { |
|
84 | + echo ' (', $choice['votes'], ' ', $txt['votes'], ')'; |
|
85 | + } |
|
84 | 86 | |
85 | 87 | echo ' |
86 | 88 | </dd>'; |
@@ -118,14 +120,15 @@ discard block |
||
118 | 120 | <input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked' : '', '> |
119 | 121 | </dd>'; |
120 | 122 | |
121 | - if ($context['poll']['guest_vote_allowed']) |
|
122 | - echo ' |
|
123 | + if ($context['poll']['guest_vote_allowed']) { |
|
124 | + echo ' |
|
123 | 125 | <dt> |
124 | 126 | <label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label> |
125 | 127 | </dt> |
126 | 128 | <dd> |
127 | 129 | <input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll']['guest_vote']) ? ' checked' : '', '> |
128 | 130 | </dd>'; |
131 | + } |
|
129 | 132 | } |
130 | 133 | |
131 | 134 | echo ' |
@@ -141,12 +144,13 @@ discard block |
||
141 | 144 | </fieldset>'; |
142 | 145 | |
143 | 146 | // If this is an edit, we can allow them to reset the vote counts. |
144 | - if ($context['is_edit']) |
|
145 | - echo ' |
|
147 | + if ($context['is_edit']) { |
|
148 | + echo ' |
|
146 | 149 | <fieldset id="poll_reset"> |
147 | 150 | <legend>', $txt['reset_votes'], '</legend> |
148 | 151 | <input type="checkbox" name="resetVoteCount" value="on"> ' . $txt['reset_votes_check'] . ' |
149 | 152 | </fieldset>'; |
153 | + } |
|
150 | 154 | echo ' |
151 | 155 | <input type="submit" name="post" value="', $txt['save'], '" onclick="return submitThisOnce(this);" accesskey="s" class="button"> |
152 | 156 | </div><!-- .roundframe --> |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | </thead> |
149 | 149 | <tbody>'; |
150 | 150 | |
151 | - foreach ($context['membergroups'] as $membergroup) |
|
152 | - echo ' |
|
151 | + foreach ($context['membergroups'] as $membergroup) { |
|
152 | + echo ' |
|
153 | 153 | <tr class="windowbg"> |
154 | 154 | <td>', $membergroup['name'], '</td> |
155 | 155 | <td class="centercol"> |
@@ -159,6 +159,7 @@ discard block |
||
159 | 159 | ', $membergroup['can_be_additional'] ? '<input type="checkbox" name="membergroups[2][]" value="' . $membergroup['id'] . '" checked>' : '', ' |
160 | 160 | </td> |
161 | 161 | </tr>'; |
162 | + } |
|
162 | 163 | |
163 | 164 | echo ' |
164 | 165 | <tr class="windowbg"> |
@@ -185,8 +186,8 @@ discard block |
||
185 | 186 | </thead> |
186 | 187 | <tbody>'; |
187 | 188 | |
188 | - foreach ($context['postgroups'] as $postgroup) |
|
189 | - echo ' |
|
189 | + foreach ($context['postgroups'] as $postgroup) { |
|
190 | + echo ' |
|
190 | 191 | <tr class="windowbg"> |
191 | 192 | <td> |
192 | 193 | ', $postgroup['name'], ' |
@@ -195,6 +196,7 @@ discard block |
||
195 | 196 | <input type="checkbox" name="postgroups[]" value="', $postgroup['id'], '" checked> |
196 | 197 | </td> |
197 | 198 | </tr>'; |
199 | + } |
|
198 | 200 | |
199 | 201 | echo ' |
200 | 202 | <tr class="windowbg"> |
@@ -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'] . '"' : ''), '> |