@@ -18,11 +18,12 @@ discard block |
||
18 | 18 | global $context, $txt, $scripturl, $modSettings; |
19 | 19 | |
20 | 20 | // If maintenance has finished tell the user. |
21 | - if (!empty($context['maintenance_finished'])) |
|
22 | - echo ' |
|
21 | + if (!empty($context['maintenance_finished'])) { |
|
22 | + echo ' |
|
23 | 23 | <div class="infobox"> |
24 | 24 | ', sprintf($txt['maintain_done'], $context['maintenance_finished']), ' |
25 | 25 | </div>'; |
26 | + } |
|
26 | 27 | |
27 | 28 | echo ' |
28 | 29 | <div id="manage_maintenance"> |
@@ -39,8 +40,8 @@ discard block |
||
39 | 40 | </div>'; |
40 | 41 | |
41 | 42 | // Show an option to convert the body column of the post table to MEDIUMTEXT or TEXT |
42 | - if (isset($context['convert_to'])) |
|
43 | - echo ' |
|
43 | + if (isset($context['convert_to'])) { |
|
44 | + echo ' |
|
44 | 45 | <div class="cat_bar"> |
45 | 46 | <h3 class="catbg">', $txt[$context['convert_to'] . '_title'], '</h3> |
46 | 47 | </div> |
@@ -53,10 +54,11 @@ discard block |
||
53 | 54 | <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '"> |
54 | 55 | </form> |
55 | 56 | </div>'; |
57 | + } |
|
56 | 58 | |
57 | 59 | // We might want to convert entities if we're on UTF-8. |
58 | - if ($context['convert_entities']) |
|
59 | - echo ' |
|
60 | + if ($context['convert_entities']) { |
|
61 | + echo ' |
|
60 | 62 | <div class="cat_bar"> |
61 | 63 | <h3 class="catbg">', $txt['entity_convert_title'], '</h3> |
62 | 64 | </div> |
@@ -68,6 +70,7 @@ discard block |
||
68 | 70 | <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '"> |
69 | 71 | </form> |
70 | 72 | </div>'; |
73 | + } |
|
71 | 74 | |
72 | 75 | echo ' |
73 | 76 | </div><!-- #manage_maintenance -->'; |
@@ -85,11 +88,12 @@ discard block |
||
85 | 88 | <div id="manage_maintenance">'; |
86 | 89 | |
87 | 90 | // If maintenance has finished tell the user. |
88 | - if (!empty($context['maintenance_finished'])) |
|
89 | - echo ' |
|
91 | + if (!empty($context['maintenance_finished'])) { |
|
92 | + echo ' |
|
90 | 93 | <div class="infobox"> |
91 | 94 | ', sprintf($txt['maintain_done'], $context['maintenance_finished']), ' |
92 | 95 | </div>'; |
96 | + } |
|
93 | 97 | |
94 | 98 | echo ' |
95 | 99 | <div class="cat_bar"> |
@@ -221,11 +225,12 @@ discard block |
||
221 | 225 | <div id="manage_maintenance">'; |
222 | 226 | |
223 | 227 | // If maintenance has finished, tell the user. |
224 | - if (!empty($context['maintenance_finished'])) |
|
225 | - echo ' |
|
228 | + if (!empty($context['maintenance_finished'])) { |
|
229 | + echo ' |
|
226 | 230 | <div class="infobox"> |
227 | 231 | ', sprintf($txt['maintain_done'], $context['maintenance_finished']), ' |
228 | 232 | </div>'; |
233 | + } |
|
229 | 234 | |
230 | 235 | echo ' |
231 | 236 | <div class="cat_bar"> |
@@ -287,9 +292,10 @@ discard block |
||
287 | 292 | </p> |
288 | 293 | <div style="display: none;" id="membersPanel">'; |
289 | 294 | |
290 | - foreach ($context['membergroups'] as $group) |
|
291 | - echo ' |
|
295 | + foreach ($context['membergroups'] as $group) { |
|
296 | + echo ' |
|
292 | 297 | <label for="groups', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups', $group['id'], '" checked> ', $group['name'], '</label><br>'; |
298 | + } |
|
293 | 299 | |
294 | 300 | echo ' |
295 | 301 | </div> |
@@ -333,11 +339,12 @@ discard block |
||
333 | 339 | global $scripturl, $txt, $context, $settings, $modSettings; |
334 | 340 | |
335 | 341 | // If maintenance has finished tell the user. |
336 | - if (!empty($context['maintenance_finished'])) |
|
337 | - echo ' |
|
342 | + if (!empty($context['maintenance_finished'])) { |
|
343 | + echo ' |
|
338 | 344 | <div class="infobox"> |
339 | 345 | ', sprintf($txt['maintain_done'], $context['maintenance_finished']), ' |
340 | 346 | </div>'; |
347 | + } |
|
341 | 348 | |
342 | 349 | // Bit of javascript for showing which boards to prune in an otherwise hidden list. |
343 | 350 | echo ' |
@@ -405,21 +412,23 @@ discard block |
||
405 | 412 | <ul>'; |
406 | 413 | |
407 | 414 | // Display a checkbox with every board. |
408 | - foreach ($category['boards'] as $board) |
|
409 | - echo ' |
|
415 | + foreach ($category['boards'] as $board) { |
|
416 | + echo ' |
|
410 | 417 | <li style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'] * 1.5, 'em;"> |
411 | 418 | <label for="boards_', $board['id'], '"><input type="checkbox" name="boards[', $board['id'], ']" id="boards_', $board['id'], '" checked>', $board['name'], '</label> |
412 | 419 | </li>'; |
420 | + } |
|
413 | 421 | |
414 | 422 | echo ' |
415 | 423 | </ul> |
416 | 424 | </fieldset>'; |
417 | 425 | |
418 | 426 | // Increase $i, and check if we're at the middle yet. |
419 | - if (++$i == $middle) |
|
420 | - echo ' |
|
427 | + if (++$i == $middle) { |
|
428 | + echo ' |
|
421 | 429 | </div><!-- .floatleft --> |
422 | 430 | <div class="floatright" style="width: 49%;">'; |
431 | + } |
|
423 | 432 | } |
424 | 433 | |
425 | 434 | echo ' |
@@ -461,9 +470,10 @@ discard block |
||
461 | 470 | echo ' |
462 | 471 | <optgroup label="', $category['name'], '">'; |
463 | 472 | |
464 | - foreach ($category['boards'] as $board) |
|
465 | - echo ' |
|
473 | + foreach ($category['boards'] as $board) { |
|
474 | + echo ' |
|
466 | 475 | <option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=> ', $board['name'], '</option>'; |
476 | + } |
|
467 | 477 | |
468 | 478 | echo ' |
469 | 479 | </optgroup>'; |
@@ -481,9 +491,10 @@ discard block |
||
481 | 491 | echo ' |
482 | 492 | <optgroup label="', $category['name'], '">'; |
483 | 493 | |
484 | - foreach ($category['boards'] as $board) |
|
485 | - echo ' |
|
494 | + foreach ($category['boards'] as $board) { |
|
495 | + echo ' |
|
486 | 496 | <option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=> ', $board['name'], '</option>'; |
497 | + } |
|
487 | 498 | |
488 | 499 | echo ' |
489 | 500 | </optgroup>'; |
@@ -526,9 +537,10 @@ discard block |
||
526 | 537 | ', $txt['database_optimize_attempt'], '<br>'; |
527 | 538 | |
528 | 539 | // List each table being optimized... |
529 | - foreach ($context['optimized_tables'] as $table) |
|
530 | - echo ' |
|
540 | + foreach ($context['optimized_tables'] as $table) { |
|
541 | + echo ' |
|
531 | 542 | ', sprintf($txt['database_optimizing'], $table['name'], $table['data_freed']), '<br>'; |
543 | + } |
|
532 | 544 | |
533 | 545 | // How did we go? |
534 | 546 | echo ' |
@@ -588,13 +600,14 @@ discard block |
||
588 | 600 | </li> |
589 | 601 | </ul>'; |
590 | 602 | |
591 | - if (!empty($context['exceeding_messages_morethan'])) |
|
592 | - echo ' |
|
603 | + if (!empty($context['exceeding_messages_morethan'])) { |
|
604 | + echo ' |
|
593 | 605 | <p>', $context['exceeding_messages_morethan'], '</p>'; |
594 | - } |
|
595 | - else |
|
596 | - echo ' |
|
606 | + } |
|
607 | + } else { |
|
608 | + echo ' |
|
597 | 609 | <p class="infobox">', $txt['convert_to_text'], '</p>'; |
610 | + } |
|
598 | 611 | |
599 | 612 | echo ' |
600 | 613 | <form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=convertmsgbody" method="post" accept-charset="', $context['character_set'], '"> |
@@ -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 dispatcher, the maintenance access point. |
@@ -95,14 +96,16 @@ discard block |
||
95 | 96 | call_integration_hook('integrate_manage_maintenance', array(&$subActions)); |
96 | 97 | |
97 | 98 | // Yep, sub-action time! |
98 | - if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) |
|
99 | - $subAction = $_REQUEST['sa']; |
|
100 | - else |
|
101 | - $subAction = 'routine'; |
|
99 | + if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) { |
|
100 | + $subAction = $_REQUEST['sa']; |
|
101 | + } else { |
|
102 | + $subAction = 'routine'; |
|
103 | + } |
|
102 | 104 | |
103 | 105 | // Doing something special? |
104 | - if (isset($_REQUEST['activity']) && isset($subActions[$subAction]['activities'][$_REQUEST['activity']])) |
|
105 | - $activity = $_REQUEST['activity']; |
|
106 | + if (isset($_REQUEST['activity']) && isset($subActions[$subAction]['activities'][$_REQUEST['activity']])) { |
|
107 | + $activity = $_REQUEST['activity']; |
|
108 | + } |
|
106 | 109 | |
107 | 110 | // Set a few things. |
108 | 111 | $context['page_title'] = $txt['maintain_title']; |
@@ -113,8 +116,9 @@ discard block |
||
113 | 116 | call_helper($subActions[$subAction]['function']); |
114 | 117 | |
115 | 118 | // Any special activity? |
116 | - if (isset($activity)) |
|
117 | - call_helper($subActions[$subAction]['activities'][$activity]); |
|
119 | + if (isset($activity)) { |
|
120 | + call_helper($subActions[$subAction]['activities'][$activity]); |
|
121 | + } |
|
118 | 122 | |
119 | 123 | // Create a maintenance token. Kinda hard to do it any other way. |
120 | 124 | createToken('admin-maint'); |
@@ -135,17 +139,19 @@ discard block |
||
135 | 139 | db_extend('packages'); |
136 | 140 | |
137 | 141 | $colData = $smcFunc['db_list_columns']('{db_prefix}messages', true); |
138 | - foreach ($colData as $column) |
|
139 | - if ($column['name'] == 'body') |
|
142 | + foreach ($colData as $column) { |
|
143 | + if ($column['name'] == 'body') |
|
140 | 144 | $body_type = $column['type']; |
145 | + } |
|
141 | 146 | |
142 | 147 | $context['convert_to'] = $body_type == 'text' ? 'mediumtext' : 'text'; |
143 | 148 | $context['convert_to_suggest'] = ($body_type != 'text' && !empty($modSettings['max_messageLength']) && $modSettings['max_messageLength'] < 65536); |
144 | 149 | } |
145 | 150 | |
146 | - if (isset($_GET['done']) && $_GET['done'] == 'convertentities') |
|
147 | - $context['maintenance_finished'] = $txt['entity_convert_title']; |
|
148 | -} |
|
151 | + if (isset($_GET['done']) && $_GET['done'] == 'convertentities') { |
|
152 | + $context['maintenance_finished'] = $txt['entity_convert_title']; |
|
153 | + } |
|
154 | + } |
|
149 | 155 | |
150 | 156 | /** |
151 | 157 | * Supporting function for the routine maintenance area. |
@@ -154,9 +160,10 @@ discard block |
||
154 | 160 | { |
155 | 161 | global $context, $txt; |
156 | 162 | |
157 | - if (isset($_GET['done']) && $_GET['done'] == 'recount') |
|
158 | - $context['maintenance_finished'] = $txt['maintain_recount']; |
|
159 | -} |
|
163 | + if (isset($_GET['done']) && $_GET['done'] == 'recount') { |
|
164 | + $context['maintenance_finished'] = $txt['maintain_recount']; |
|
165 | + } |
|
166 | + } |
|
160 | 167 | |
161 | 168 | /** |
162 | 169 | * Supporting function for the members maintenance area. |
@@ -187,8 +194,9 @@ discard block |
||
187 | 194 | } |
188 | 195 | $smcFunc['db_free_result']($result); |
189 | 196 | |
190 | - if (isset($_GET['done']) && $_GET['done'] == 'recountposts') |
|
191 | - $context['maintenance_finished'] = $txt['maintain_recountposts']; |
|
197 | + if (isset($_GET['done']) && $_GET['done'] == 'recountposts') { |
|
198 | + $context['maintenance_finished'] = $txt['maintain_recountposts']; |
|
199 | + } |
|
192 | 200 | |
193 | 201 | loadJavaScriptFile('suggest.js', array('defer' => false, 'minimize' => true), 'smf_suggest'); |
194 | 202 | } |
@@ -214,11 +222,12 @@ discard block |
||
214 | 222 | $context['categories'] = array(); |
215 | 223 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
216 | 224 | { |
217 | - if (!isset($context['categories'][$row['id_cat']])) |
|
218 | - $context['categories'][$row['id_cat']] = array( |
|
225 | + if (!isset($context['categories'][$row['id_cat']])) { |
|
226 | + $context['categories'][$row['id_cat']] = array( |
|
219 | 227 | 'name' => $row['cat_name'], |
220 | 228 | 'boards' => array() |
221 | 229 | ); |
230 | + } |
|
222 | 231 | |
223 | 232 | $context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array( |
224 | 233 | 'id' => $row['id_board'], |
@@ -231,11 +240,12 @@ discard block |
||
231 | 240 | require_once($sourcedir . '/Subs-Boards.php'); |
232 | 241 | sortCategories($context['categories']); |
233 | 242 | |
234 | - if (isset($_GET['done']) && $_GET['done'] == 'purgeold') |
|
235 | - $context['maintenance_finished'] = $txt['maintain_old']; |
|
236 | - elseif (isset($_GET['done']) && $_GET['done'] == 'massmove') |
|
237 | - $context['maintenance_finished'] = $txt['move_topics_maintenance']; |
|
238 | -} |
|
243 | + if (isset($_GET['done']) && $_GET['done'] == 'purgeold') { |
|
244 | + $context['maintenance_finished'] = $txt['maintain_old']; |
|
245 | + } elseif (isset($_GET['done']) && $_GET['done'] == 'massmove') { |
|
246 | + $context['maintenance_finished'] = $txt['move_topics_maintenance']; |
|
247 | + } |
|
248 | + } |
|
239 | 249 | |
240 | 250 | /** |
241 | 251 | * Find and fix all errors on the forum. |
@@ -343,15 +353,17 @@ discard block |
||
343 | 353 | // Show me your badge! |
344 | 354 | isAllowedTo('admin_forum'); |
345 | 355 | |
346 | - if ($db_type != 'mysql') |
|
347 | - return; |
|
356 | + if ($db_type != 'mysql') { |
|
357 | + return; |
|
358 | + } |
|
348 | 359 | |
349 | 360 | db_extend('packages'); |
350 | 361 | |
351 | 362 | $colData = $smcFunc['db_list_columns']('{db_prefix}messages', true); |
352 | - foreach ($colData as $column) |
|
353 | - if ($column['name'] == 'body') |
|
363 | + foreach ($colData as $column) { |
|
364 | + if ($column['name'] == 'body') |
|
354 | 365 | $body_type = $column['type']; |
366 | + } |
|
355 | 367 | |
356 | 368 | $context['convert_to'] = $body_type == 'text' ? 'mediumtext' : 'text'; |
357 | 369 | |
@@ -361,33 +373,36 @@ discard block |
||
361 | 373 | validateToken('admin-maint'); |
362 | 374 | |
363 | 375 | // Make it longer so we can do their limit. |
364 | - if ($body_type == 'text') |
|
365 | - $smcFunc['db_change_column']('{db_prefix}messages', 'body', array('type' => 'mediumtext')); |
|
376 | + if ($body_type == 'text') { |
|
377 | + $smcFunc['db_change_column']('{db_prefix}messages', 'body', array('type' => 'mediumtext')); |
|
378 | + } |
|
366 | 379 | // Shorten the column so we can have a bit (literally per record) less space occupied |
367 | - else |
|
368 | - $smcFunc['db_change_column']('{db_prefix}messages', 'body', array('type' => 'text')); |
|
380 | + else { |
|
381 | + $smcFunc['db_change_column']('{db_prefix}messages', 'body', array('type' => 'text')); |
|
382 | + } |
|
369 | 383 | |
370 | 384 | // 3rd party integrations may be interested in knowning about this. |
371 | 385 | call_integration_hook('integrate_convert_msgbody', array($body_type)); |
372 | 386 | |
373 | 387 | $colData = $smcFunc['db_list_columns']('{db_prefix}messages', true); |
374 | - foreach ($colData as $column) |
|
375 | - if ($column['name'] == 'body') |
|
388 | + foreach ($colData as $column) { |
|
389 | + if ($column['name'] == 'body') |
|
376 | 390 | $body_type = $column['type']; |
391 | + } |
|
377 | 392 | |
378 | 393 | $context['maintenance_finished'] = $txt[$context['convert_to'] . '_title']; |
379 | 394 | $context['convert_to'] = $body_type == 'text' ? 'mediumtext' : 'text'; |
380 | 395 | $context['convert_to_suggest'] = ($body_type != 'text' && !empty($modSettings['max_messageLength']) && $modSettings['max_messageLength'] < 65536); |
381 | 396 | |
382 | 397 | return; |
383 | - } |
|
384 | - elseif ($body_type != 'text' && (!isset($_POST['do_conversion']) || isset($_POST['cont']))) |
|
398 | + } elseif ($body_type != 'text' && (!isset($_POST['do_conversion']) || isset($_POST['cont']))) |
|
385 | 399 | { |
386 | 400 | checkSession(); |
387 | - if (empty($_REQUEST['start'])) |
|
388 | - validateToken('admin-maint'); |
|
389 | - else |
|
390 | - validateToken('admin-convertMsg'); |
|
401 | + if (empty($_REQUEST['start'])) { |
|
402 | + validateToken('admin-maint'); |
|
403 | + } else { |
|
404 | + validateToken('admin-convertMsg'); |
|
405 | + } |
|
391 | 406 | |
392 | 407 | $context['page_title'] = $txt['not_done_title']; |
393 | 408 | $context['continue_post_data'] = ''; |
@@ -419,8 +434,9 @@ discard block |
||
419 | 434 | 'increment' => $increment - 1, |
420 | 435 | ) |
421 | 436 | ); |
422 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
423 | - $id_msg_exceeding[] = $row['id_msg']; |
|
437 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
438 | + $id_msg_exceeding[] = $row['id_msg']; |
|
439 | + } |
|
424 | 440 | $smcFunc['db_free_result']($request); |
425 | 441 | |
426 | 442 | $_REQUEST['start'] += $increment; |
@@ -449,9 +465,9 @@ discard block |
||
449 | 465 | { |
450 | 466 | $query_msg = array_slice($id_msg_exceeding, 0, 100); |
451 | 467 | $context['exceeding_messages_morethan'] = sprintf($txt['exceeding_messages_morethan'], count($id_msg_exceeding)); |
468 | + } else { |
|
469 | + $query_msg = $id_msg_exceeding; |
|
452 | 470 | } |
453 | - else |
|
454 | - $query_msg = $id_msg_exceeding; |
|
455 | 471 | |
456 | 472 | $context['exceeding_messages'] = array(); |
457 | 473 | $request = $smcFunc['db_query']('', ' |
@@ -462,8 +478,9 @@ discard block |
||
462 | 478 | 'messages' => $query_msg, |
463 | 479 | ) |
464 | 480 | ); |
465 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
466 | - $context['exceeding_messages'][] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>'; |
|
481 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
482 | + $context['exceeding_messages'][] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>'; |
|
483 | + } |
|
467 | 484 | $smcFunc['db_free_result']($request); |
468 | 485 | } |
469 | 486 | } |
@@ -487,8 +504,9 @@ discard block |
||
487 | 504 | isAllowedTo('admin_forum'); |
488 | 505 | |
489 | 506 | // Check to see if UTF-8 is currently the default character set. |
490 | - if ($modSettings['global_character_set'] !== 'UTF-8') |
|
491 | - fatal_lang_error('entity_convert_only_utf8'); |
|
507 | + if ($modSettings['global_character_set'] !== 'UTF-8') { |
|
508 | + fatal_lang_error('entity_convert_only_utf8'); |
|
509 | + } |
|
492 | 510 | |
493 | 511 | // Some starting values. |
494 | 512 | $context['table'] = empty($_REQUEST['table']) ? 0 : (int) $_REQUEST['table']; |
@@ -550,13 +568,14 @@ discard block |
||
550 | 568 | // Make sure we keep stuff unique! |
551 | 569 | $primary_keys = array(); |
552 | 570 | |
553 | - if (function_exists('apache_reset_timeout')) |
|
554 | - @apache_reset_timeout(); |
|
571 | + if (function_exists('apache_reset_timeout')) { |
|
572 | + @apache_reset_timeout(); |
|
573 | + } |
|
555 | 574 | |
556 | 575 | // Get a list of text columns. |
557 | 576 | $columns = array(); |
558 | - if ($db_type == 'postgresql') |
|
559 | - $request = $smcFunc['db_query']('', ' |
|
577 | + if ($db_type == 'postgresql') { |
|
578 | + $request = $smcFunc['db_query']('', ' |
|
560 | 579 | SELECT column_name "Field", data_type "Type" |
561 | 580 | FROM information_schema.columns |
562 | 581 | WHERE table_name = {string:cur_table} |
@@ -565,21 +584,23 @@ discard block |
||
565 | 584 | 'cur_table' => $db_prefix.$cur_table, |
566 | 585 | ) |
567 | 586 | ); |
568 | - else |
|
569 | - $request = $smcFunc['db_query']('', ' |
|
587 | + } else { |
|
588 | + $request = $smcFunc['db_query']('', ' |
|
570 | 589 | SHOW FULL COLUMNS |
571 | 590 | FROM {db_prefix}{raw:cur_table}', |
572 | 591 | array( |
573 | 592 | 'cur_table' => $cur_table, |
574 | 593 | ) |
575 | 594 | ); |
576 | - while ($column_info = $smcFunc['db_fetch_assoc']($request)) |
|
577 | - if (strpos($column_info['Type'], 'text') !== false || strpos($column_info['Type'], 'char') !== false) |
|
595 | + } |
|
596 | + while ($column_info = $smcFunc['db_fetch_assoc']($request)) { |
|
597 | + if (strpos($column_info['Type'], 'text') !== false || strpos($column_info['Type'], 'char') !== false) |
|
578 | 598 | $columns[] = strtolower($column_info['Field']); |
599 | + } |
|
579 | 600 | |
580 | 601 | // Get the column with the (first) primary key. |
581 | - if ($db_type == 'postgresql') |
|
582 | - $request = $smcFunc['db_query']('', ' |
|
602 | + if ($db_type == 'postgresql') { |
|
603 | + $request = $smcFunc['db_query']('', ' |
|
583 | 604 | SELECT a.attname "Column_name", \'PRIMARY\' "Key_name", attnum "Seq_in_index" |
584 | 605 | FROM pg_index i |
585 | 606 | JOIN pg_attribute a ON a.attrelid = i.indrelid |
@@ -590,20 +611,22 @@ discard block |
||
590 | 611 | 'cur_table' => $db_prefix.$cur_table, |
591 | 612 | ) |
592 | 613 | ); |
593 | - else |
|
594 | - $request = $smcFunc['db_query']('', ' |
|
614 | + } else { |
|
615 | + $request = $smcFunc['db_query']('', ' |
|
595 | 616 | SHOW KEYS |
596 | 617 | FROM {db_prefix}{raw:cur_table}', |
597 | 618 | array( |
598 | 619 | 'cur_table' => $cur_table, |
599 | 620 | ) |
600 | 621 | ); |
622 | + } |
|
601 | 623 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
602 | 624 | { |
603 | 625 | if ($row['Key_name'] === 'PRIMARY') |
604 | 626 | { |
605 | - if ((empty($primary_key) || $row['Seq_in_index'] == 1) && !in_array(strtolower($row['Column_name']), $columns)) |
|
606 | - $primary_key = $row['Column_name']; |
|
627 | + if ((empty($primary_key) || $row['Seq_in_index'] == 1) && !in_array(strtolower($row['Column_name']), $columns)) { |
|
628 | + $primary_key = $row['Column_name']; |
|
629 | + } |
|
607 | 630 | |
608 | 631 | $primary_keys[] = $row['Column_name']; |
609 | 632 | } |
@@ -612,8 +635,9 @@ discard block |
||
612 | 635 | |
613 | 636 | // No primary key, no glory. |
614 | 637 | // Same for columns. Just to be sure we've work to do! |
615 | - if (empty($primary_key) || empty($columns)) |
|
616 | - continue; |
|
638 | + if (empty($primary_key) || empty($columns)) { |
|
639 | + continue; |
|
640 | + } |
|
617 | 641 | |
618 | 642 | // Get the maximum value for the primary key. |
619 | 643 | $request = $smcFunc['db_query']('', ' |
@@ -627,8 +651,9 @@ discard block |
||
627 | 651 | list($max_value) = $smcFunc['db_fetch_row']($request); |
628 | 652 | $smcFunc['db_free_result']($request); |
629 | 653 | |
630 | - if (empty($max_value)) |
|
631 | - continue; |
|
654 | + if (empty($max_value)) { |
|
655 | + continue; |
|
656 | + } |
|
632 | 657 | |
633 | 658 | while ($context['start'] <= $max_value) |
634 | 659 | { |
@@ -652,10 +677,11 @@ discard block |
||
652 | 677 | { |
653 | 678 | $insertion_variables = array(); |
654 | 679 | $changes = array(); |
655 | - foreach ($row as $column_name => $column_value) |
|
656 | - if ($column_name !== $primary_key && strpos($column_value, '&#') !== false) |
|
680 | + foreach ($row as $column_name => $column_value) { |
|
681 | + if ($column_name !== $primary_key && strpos($column_value, '&#') !== false) |
|
657 | 682 | { |
658 | 683 | $changes[] = $column_name . ' = {string:changes_' . $column_name . '}'; |
684 | + } |
|
659 | 685 | $insertion_variables['changes_' . $column_name] = preg_replace_callback('~&#(\d{1,5}|x[0-9a-fA-F]{1,4});~', 'fixchardb__callback', $column_value); |
660 | 686 | } |
661 | 687 | |
@@ -667,8 +693,8 @@ discard block |
||
667 | 693 | } |
668 | 694 | |
669 | 695 | // Update the row. |
670 | - if (!empty($changes)) |
|
671 | - $smcFunc['db_query']('', ' |
|
696 | + if (!empty($changes)) { |
|
697 | + $smcFunc['db_query']('', ' |
|
672 | 698 | UPDATE {db_prefix}' . $cur_table . ' |
673 | 699 | SET |
674 | 700 | ' . implode(', |
@@ -676,6 +702,7 @@ discard block |
||
676 | 702 | WHERE ' . implode(' AND ', $where), |
677 | 703 | $insertion_variables |
678 | 704 | ); |
705 | + } |
|
679 | 706 | } |
680 | 707 | $smcFunc['db_free_result']($request); |
681 | 708 | $context['start'] += 500; |
@@ -716,10 +743,11 @@ discard block |
||
716 | 743 | |
717 | 744 | checkSession('request'); |
718 | 745 | |
719 | - if (!isset($_SESSION['optimized_tables'])) |
|
720 | - validateToken('admin-maint'); |
|
721 | - else |
|
722 | - validateToken('admin-optimize', 'post', false); |
|
746 | + if (!isset($_SESSION['optimized_tables'])) { |
|
747 | + validateToken('admin-maint'); |
|
748 | + } else { |
|
749 | + validateToken('admin-optimize', 'post', false); |
|
750 | + } |
|
723 | 751 | |
724 | 752 | ignore_user_abort(true); |
725 | 753 | db_extend(); |
@@ -735,13 +763,15 @@ discard block |
||
735 | 763 | // Get a list of tables, as well as how many there are. |
736 | 764 | $temp_tables = $smcFunc['db_list_tables'](false, $real_prefix . '%'); |
737 | 765 | $tables = array(); |
738 | - foreach ($temp_tables as $table) |
|
739 | - $tables[] = array('table_name' => $table); |
|
766 | + foreach ($temp_tables as $table) { |
|
767 | + $tables[] = array('table_name' => $table); |
|
768 | + } |
|
740 | 769 | |
741 | 770 | // If there aren't any tables then I believe that would mean the world has exploded... |
742 | 771 | $context['num_tables'] = count($tables); |
743 | - if ($context['num_tables'] == 0) |
|
744 | - fatal_error('You appear to be running SMF in a flat file mode... fantastic!', false); |
|
772 | + if ($context['num_tables'] == 0) { |
|
773 | + fatal_error('You appear to be running SMF in a flat file mode... fantastic!', false); |
|
774 | + } |
|
745 | 775 | |
746 | 776 | $_REQUEST['start'] = empty($_REQUEST['start']) ? 0 : (int) $_REQUEST['start']; |
747 | 777 | |
@@ -752,8 +782,9 @@ discard block |
||
752 | 782 | $_SESSION['optimized_tables'] = !empty($_SESSION['optimized_tables']) ? $_SESSION['optimized_tables'] : array(); |
753 | 783 | for ($key = $_REQUEST['start']; $context['num_tables'] - 1; $key++) |
754 | 784 | { |
755 | - if (empty($tables[$key])) |
|
756 | - break; |
|
785 | + if (empty($tables[$key])) { |
|
786 | + break; |
|
787 | + } |
|
757 | 788 | |
758 | 789 | // Continue? |
759 | 790 | if (microtime(true) - $time_start > 10) |
@@ -767,8 +798,9 @@ discard block |
||
767 | 798 | createToken('admin-optimize'); |
768 | 799 | $context['continue_post_data'] = '<input type="hidden" name="' . $context['admin-optimize_token_var'] . '" value="' . $context['admin-optimize_token'] . '">'; |
769 | 800 | |
770 | - if (function_exists('apache_reset_timeout')) |
|
771 | - apache_reset_timeout(); |
|
801 | + if (function_exists('apache_reset_timeout')) { |
|
802 | + apache_reset_timeout(); |
|
803 | + } |
|
772 | 804 | |
773 | 805 | return; |
774 | 806 | } |
@@ -776,11 +808,12 @@ discard block |
||
776 | 808 | // Optimize the table! We use backticks here because it might be a custom table. |
777 | 809 | $data_freed = $smcFunc['db_optimize_table']($tables[$key]['table_name']); |
778 | 810 | |
779 | - if ($data_freed > 0) |
|
780 | - $_SESSION['optimized_tables'][] = array( |
|
811 | + if ($data_freed > 0) { |
|
812 | + $_SESSION['optimized_tables'][] = array( |
|
781 | 813 | 'name' => $tables[$key]['table_name'], |
782 | 814 | 'data_freed' => $data_freed, |
783 | 815 | ); |
816 | + } |
|
784 | 817 | } |
785 | 818 | |
786 | 819 | // Number of tables, etc... |
@@ -815,10 +848,11 @@ discard block |
||
815 | 848 | checkSession('request'); |
816 | 849 | |
817 | 850 | // validate the request or the loop |
818 | - if (!isset($_REQUEST['step'])) |
|
819 | - validateToken('admin-maint'); |
|
820 | - else |
|
821 | - validateToken('admin-boardrecount'); |
|
851 | + if (!isset($_REQUEST['step'])) { |
|
852 | + validateToken('admin-maint'); |
|
853 | + } else { |
|
854 | + validateToken('admin-boardrecount'); |
|
855 | + } |
|
822 | 856 | |
823 | 857 | $context['page_title'] = $txt['not_done_title']; |
824 | 858 | $context['continue_post_data'] = ''; |
@@ -839,8 +873,9 @@ discard block |
||
839 | 873 | $smcFunc['db_free_result']($request); |
840 | 874 | |
841 | 875 | $increment = min(max(50, ceil($max_topics / 4)), 2000); |
842 | - if (empty($_REQUEST['start'])) |
|
843 | - $_REQUEST['start'] = 0; |
|
876 | + if (empty($_REQUEST['start'])) { |
|
877 | + $_REQUEST['start'] = 0; |
|
878 | + } |
|
844 | 879 | |
845 | 880 | $total_steps = 8; |
846 | 881 | |
@@ -867,8 +902,8 @@ discard block |
||
867 | 902 | 'max_id' => $_REQUEST['start'] + $increment, |
868 | 903 | ) |
869 | 904 | ); |
870 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
871 | - $smcFunc['db_query']('', ' |
|
905 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
906 | + $smcFunc['db_query']('', ' |
|
872 | 907 | UPDATE {db_prefix}topics |
873 | 908 | SET num_replies = {int:num_replies} |
874 | 909 | WHERE id_topic = {int:id_topic}', |
@@ -877,6 +912,7 @@ discard block |
||
877 | 912 | 'id_topic' => $row['id_topic'], |
878 | 913 | ) |
879 | 914 | ); |
915 | + } |
|
880 | 916 | $smcFunc['db_free_result']($request); |
881 | 917 | |
882 | 918 | // Recount unapproved messages |
@@ -895,8 +931,8 @@ discard block |
||
895 | 931 | 'max_id' => $_REQUEST['start'] + $increment, |
896 | 932 | ) |
897 | 933 | ); |
898 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
899 | - $smcFunc['db_query']('', ' |
|
934 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
935 | + $smcFunc['db_query']('', ' |
|
900 | 936 | UPDATE {db_prefix}topics |
901 | 937 | SET unapproved_posts = {int:unapproved_posts} |
902 | 938 | WHERE id_topic = {int:id_topic}', |
@@ -905,6 +941,7 @@ discard block |
||
905 | 941 | 'id_topic' => $row['id_topic'], |
906 | 942 | ) |
907 | 943 | ); |
944 | + } |
|
908 | 945 | $smcFunc['db_free_result']($request); |
909 | 946 | |
910 | 947 | $_REQUEST['start'] += $increment; |
@@ -927,8 +964,8 @@ discard block |
||
927 | 964 | // Update the post count of each board. |
928 | 965 | if ($_REQUEST['step'] <= 1) |
929 | 966 | { |
930 | - if (empty($_REQUEST['start'])) |
|
931 | - $smcFunc['db_query']('', ' |
|
967 | + if (empty($_REQUEST['start'])) { |
|
968 | + $smcFunc['db_query']('', ' |
|
932 | 969 | UPDATE {db_prefix}boards |
933 | 970 | SET num_posts = {int:num_posts} |
934 | 971 | WHERE redirect = {string:redirect}', |
@@ -937,6 +974,7 @@ discard block |
||
937 | 974 | 'redirect' => '', |
938 | 975 | ) |
939 | 976 | ); |
977 | + } |
|
940 | 978 | |
941 | 979 | while ($_REQUEST['start'] < $max_topics) |
942 | 980 | { |
@@ -953,8 +991,8 @@ discard block |
||
953 | 991 | 'is_approved' => 1, |
954 | 992 | ) |
955 | 993 | ); |
956 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
957 | - $smcFunc['db_query']('', ' |
|
994 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
995 | + $smcFunc['db_query']('', ' |
|
958 | 996 | UPDATE {db_prefix}boards |
959 | 997 | SET num_posts = num_posts + {int:real_num_posts} |
960 | 998 | WHERE id_board = {int:id_board}', |
@@ -963,6 +1001,7 @@ discard block |
||
963 | 1001 | 'real_num_posts' => $row['real_num_posts'], |
964 | 1002 | ) |
965 | 1003 | ); |
1004 | + } |
|
966 | 1005 | $smcFunc['db_free_result']($request); |
967 | 1006 | |
968 | 1007 | $_REQUEST['start'] += $increment; |
@@ -985,14 +1024,15 @@ discard block |
||
985 | 1024 | // Update the topic count of each board. |
986 | 1025 | if ($_REQUEST['step'] <= 2) |
987 | 1026 | { |
988 | - if (empty($_REQUEST['start'])) |
|
989 | - $smcFunc['db_query']('', ' |
|
1027 | + if (empty($_REQUEST['start'])) { |
|
1028 | + $smcFunc['db_query']('', ' |
|
990 | 1029 | UPDATE {db_prefix}boards |
991 | 1030 | SET num_topics = {int:num_topics}', |
992 | 1031 | array( |
993 | 1032 | 'num_topics' => 0, |
994 | 1033 | ) |
995 | 1034 | ); |
1035 | + } |
|
996 | 1036 | |
997 | 1037 | while ($_REQUEST['start'] < $max_topics) |
998 | 1038 | { |
@@ -1009,8 +1049,8 @@ discard block |
||
1009 | 1049 | 'id_topic_max' => $_REQUEST['start'] + $increment, |
1010 | 1050 | ) |
1011 | 1051 | ); |
1012 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1013 | - $smcFunc['db_query']('', ' |
|
1052 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1053 | + $smcFunc['db_query']('', ' |
|
1014 | 1054 | UPDATE {db_prefix}boards |
1015 | 1055 | SET num_topics = num_topics + {int:real_num_topics} |
1016 | 1056 | WHERE id_board = {int:id_board}', |
@@ -1019,6 +1059,7 @@ discard block |
||
1019 | 1059 | 'real_num_topics' => $row['real_num_topics'], |
1020 | 1060 | ) |
1021 | 1061 | ); |
1062 | + } |
|
1022 | 1063 | $smcFunc['db_free_result']($request); |
1023 | 1064 | |
1024 | 1065 | $_REQUEST['start'] += $increment; |
@@ -1041,14 +1082,15 @@ discard block |
||
1041 | 1082 | // Update the unapproved post count of each board. |
1042 | 1083 | if ($_REQUEST['step'] <= 3) |
1043 | 1084 | { |
1044 | - if (empty($_REQUEST['start'])) |
|
1045 | - $smcFunc['db_query']('', ' |
|
1085 | + if (empty($_REQUEST['start'])) { |
|
1086 | + $smcFunc['db_query']('', ' |
|
1046 | 1087 | UPDATE {db_prefix}boards |
1047 | 1088 | SET unapproved_posts = {int:unapproved_posts}', |
1048 | 1089 | array( |
1049 | 1090 | 'unapproved_posts' => 0, |
1050 | 1091 | ) |
1051 | 1092 | ); |
1093 | + } |
|
1052 | 1094 | |
1053 | 1095 | while ($_REQUEST['start'] < $max_topics) |
1054 | 1096 | { |
@@ -1065,8 +1107,8 @@ discard block |
||
1065 | 1107 | 'is_approved' => 0, |
1066 | 1108 | ) |
1067 | 1109 | ); |
1068 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1069 | - $smcFunc['db_query']('', ' |
|
1110 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1111 | + $smcFunc['db_query']('', ' |
|
1070 | 1112 | UPDATE {db_prefix}boards |
1071 | 1113 | SET unapproved_posts = unapproved_posts + {int:unapproved_posts} |
1072 | 1114 | WHERE id_board = {int:id_board}', |
@@ -1075,6 +1117,7 @@ discard block |
||
1075 | 1117 | 'unapproved_posts' => $row['real_unapproved_posts'], |
1076 | 1118 | ) |
1077 | 1119 | ); |
1120 | + } |
|
1078 | 1121 | $smcFunc['db_free_result']($request); |
1079 | 1122 | |
1080 | 1123 | $_REQUEST['start'] += $increment; |
@@ -1097,14 +1140,15 @@ discard block |
||
1097 | 1140 | // Update the unapproved topic count of each board. |
1098 | 1141 | if ($_REQUEST['step'] <= 4) |
1099 | 1142 | { |
1100 | - if (empty($_REQUEST['start'])) |
|
1101 | - $smcFunc['db_query']('', ' |
|
1143 | + if (empty($_REQUEST['start'])) { |
|
1144 | + $smcFunc['db_query']('', ' |
|
1102 | 1145 | UPDATE {db_prefix}boards |
1103 | 1146 | SET unapproved_topics = {int:unapproved_topics}', |
1104 | 1147 | array( |
1105 | 1148 | 'unapproved_topics' => 0, |
1106 | 1149 | ) |
1107 | 1150 | ); |
1151 | + } |
|
1108 | 1152 | |
1109 | 1153 | while ($_REQUEST['start'] < $max_topics) |
1110 | 1154 | { |
@@ -1121,8 +1165,8 @@ discard block |
||
1121 | 1165 | 'id_topic_max' => $_REQUEST['start'] + $increment, |
1122 | 1166 | ) |
1123 | 1167 | ); |
1124 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1125 | - $smcFunc['db_query']('', ' |
|
1168 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1169 | + $smcFunc['db_query']('', ' |
|
1126 | 1170 | UPDATE {db_prefix}boards |
1127 | 1171 | SET unapproved_topics = unapproved_topics + {int:real_unapproved_topics} |
1128 | 1172 | WHERE id_board = {int:id_board}', |
@@ -1131,6 +1175,7 @@ discard block |
||
1131 | 1175 | 'real_unapproved_topics' => $row['real_unapproved_topics'], |
1132 | 1176 | ) |
1133 | 1177 | ); |
1178 | + } |
|
1134 | 1179 | $smcFunc['db_free_result']($request); |
1135 | 1180 | |
1136 | 1181 | $_REQUEST['start'] += $increment; |
@@ -1164,8 +1209,9 @@ discard block |
||
1164 | 1209 | 'is_not_deleted' => 0, |
1165 | 1210 | ) |
1166 | 1211 | ); |
1167 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1168 | - updateMemberData($row['id_member'], array('instant_messages' => $row['real_num'])); |
|
1212 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1213 | + updateMemberData($row['id_member'], array('instant_messages' => $row['real_num'])); |
|
1214 | + } |
|
1169 | 1215 | $smcFunc['db_free_result']($request); |
1170 | 1216 | |
1171 | 1217 | $request = $smcFunc['db_query']('', ' |
@@ -1180,8 +1226,9 @@ discard block |
||
1180 | 1226 | 'is_not_read' => 0, |
1181 | 1227 | ) |
1182 | 1228 | ); |
1183 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1184 | - updateMemberData($row['id_member'], array('unread_messages' => $row['real_num'])); |
|
1229 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1230 | + updateMemberData($row['id_member'], array('unread_messages' => $row['real_num'])); |
|
1231 | + } |
|
1185 | 1232 | $smcFunc['db_free_result']($request); |
1186 | 1233 | |
1187 | 1234 | if (microtime(true) - $time_start > 3) |
@@ -1213,12 +1260,13 @@ discard block |
||
1213 | 1260 | ) |
1214 | 1261 | ); |
1215 | 1262 | $boards = array(); |
1216 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1217 | - $boards[$row['id_board']][] = $row['id_msg']; |
|
1263 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1264 | + $boards[$row['id_board']][] = $row['id_msg']; |
|
1265 | + } |
|
1218 | 1266 | $smcFunc['db_free_result']($request); |
1219 | 1267 | |
1220 | - foreach ($boards as $board_id => $messages) |
|
1221 | - $smcFunc['db_query']('', ' |
|
1268 | + foreach ($boards as $board_id => $messages) { |
|
1269 | + $smcFunc['db_query']('', ' |
|
1222 | 1270 | UPDATE {db_prefix}messages |
1223 | 1271 | SET id_board = {int:id_board} |
1224 | 1272 | WHERE id_msg IN ({array_int:id_msg_array})', |
@@ -1227,6 +1275,7 @@ discard block |
||
1227 | 1275 | 'id_board' => $board_id, |
1228 | 1276 | ) |
1229 | 1277 | ); |
1278 | + } |
|
1230 | 1279 | |
1231 | 1280 | $_REQUEST['start'] += $increment; |
1232 | 1281 | |
@@ -1256,8 +1305,9 @@ discard block |
||
1256 | 1305 | ) |
1257 | 1306 | ); |
1258 | 1307 | $realBoardCounts = array(); |
1259 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1260 | - $realBoardCounts[$row['id_board']] = $row['local_last_msg']; |
|
1308 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1309 | + $realBoardCounts[$row['id_board']] = $row['local_last_msg']; |
|
1310 | + } |
|
1261 | 1311 | $smcFunc['db_free_result']($request); |
1262 | 1312 | |
1263 | 1313 | $request = $smcFunc['db_query']('', ' |
@@ -1277,18 +1327,20 @@ discard block |
||
1277 | 1327 | krsort($resort_me); |
1278 | 1328 | |
1279 | 1329 | $lastModifiedMsg = array(); |
1280 | - foreach ($resort_me as $rows) |
|
1281 | - foreach ($rows as $row) |
|
1330 | + foreach ($resort_me as $rows) { |
|
1331 | + foreach ($rows as $row) |
|
1282 | 1332 | { |
1283 | 1333 | // The latest message is the latest of the current board and its children. |
1284 | 1334 | if (isset($lastModifiedMsg[$row['id_board']])) |
1285 | 1335 | $curLastModifiedMsg = max($row['local_last_msg'], $lastModifiedMsg[$row['id_board']]); |
1286 | - else |
|
1287 | - $curLastModifiedMsg = $row['local_last_msg']; |
|
1336 | + } |
|
1337 | + else { |
|
1338 | + $curLastModifiedMsg = $row['local_last_msg']; |
|
1339 | + } |
|
1288 | 1340 | |
1289 | 1341 | // If what is and what should be the latest message differ, an update is necessary. |
1290 | - if ($row['local_last_msg'] != $row['id_last_msg'] || $curLastModifiedMsg != $row['id_msg_updated']) |
|
1291 | - $smcFunc['db_query']('', ' |
|
1342 | + if ($row['local_last_msg'] != $row['id_last_msg'] || $curLastModifiedMsg != $row['id_msg_updated']) { |
|
1343 | + $smcFunc['db_query']('', ' |
|
1292 | 1344 | UPDATE {db_prefix}boards |
1293 | 1345 | SET id_last_msg = {int:id_last_msg}, id_msg_updated = {int:id_msg_updated} |
1294 | 1346 | WHERE id_board = {int:id_board}', |
@@ -1298,12 +1350,14 @@ discard block |
||
1298 | 1350 | 'id_board' => $row['id_board'], |
1299 | 1351 | ) |
1300 | 1352 | ); |
1353 | + } |
|
1301 | 1354 | |
1302 | 1355 | // Parent boards inherit the latest modified message of their children. |
1303 | - if (isset($lastModifiedMsg[$row['id_parent']])) |
|
1304 | - $lastModifiedMsg[$row['id_parent']] = max($row['local_last_msg'], $lastModifiedMsg[$row['id_parent']]); |
|
1305 | - else |
|
1306 | - $lastModifiedMsg[$row['id_parent']] = $row['local_last_msg']; |
|
1356 | + if (isset($lastModifiedMsg[$row['id_parent']])) { |
|
1357 | + $lastModifiedMsg[$row['id_parent']] = max($row['local_last_msg'], $lastModifiedMsg[$row['id_parent']]); |
|
1358 | + } else { |
|
1359 | + $lastModifiedMsg[$row['id_parent']] = $row['local_last_msg']; |
|
1360 | + } |
|
1307 | 1361 | } |
1308 | 1362 | |
1309 | 1363 | // Update all the basic statistics. |
@@ -1375,8 +1429,9 @@ discard block |
||
1375 | 1429 | require_once($sourcedir . '/Subs-Auth.php'); |
1376 | 1430 | $members = findMembers($_POST['to']); |
1377 | 1431 | |
1378 | - if (empty($members)) |
|
1379 | - fatal_lang_error('reattribute_cannot_find_member'); |
|
1432 | + if (empty($members)) { |
|
1433 | + fatal_lang_error('reattribute_cannot_find_member'); |
|
1434 | + } |
|
1380 | 1435 | |
1381 | 1436 | $memID = array_shift($members); |
1382 | 1437 | $memID = $memID['id']; |
@@ -1406,8 +1461,9 @@ discard block |
||
1406 | 1461 | validateToken('admin-maint'); |
1407 | 1462 | |
1408 | 1463 | $groups = array(); |
1409 | - foreach ($_POST['groups'] as $id => $dummy) |
|
1410 | - $groups[] = (int) $id; |
|
1464 | + foreach ($_POST['groups'] as $id => $dummy) { |
|
1465 | + $groups[] = (int) $id; |
|
1466 | + } |
|
1411 | 1467 | $time_limit = (time() - ($_POST['maxdays'] * 24 * 3600)); |
1412 | 1468 | $where_vars = array( |
1413 | 1469 | 'time_limit' => $time_limit, |
@@ -1416,9 +1472,9 @@ discard block |
||
1416 | 1472 | { |
1417 | 1473 | $where = 'mem.date_registered < {int:time_limit} AND mem.is_activated = {int:is_activated}'; |
1418 | 1474 | $where_vars['is_activated'] = 0; |
1475 | + } else { |
|
1476 | + $where = 'mem.last_login < {int:time_limit} AND (mem.last_login != 0 OR mem.date_registered < {int:time_limit})'; |
|
1419 | 1477 | } |
1420 | - else |
|
1421 | - $where = 'mem.last_login < {int:time_limit} AND (mem.last_login != 0 OR mem.date_registered < {int:time_limit})'; |
|
1422 | 1478 | |
1423 | 1479 | // Need to get *all* groups then work out which (if any) we avoid. |
1424 | 1480 | $request = $smcFunc['db_query']('', ' |
@@ -1437,8 +1493,7 @@ discard block |
||
1437 | 1493 | { |
1438 | 1494 | $where .= ' AND mem.id_post_group != {int:id_post_group_' . $row['id_group'] . '}'; |
1439 | 1495 | $where_vars['id_post_group_' . $row['id_group']] = $row['id_group']; |
1440 | - } |
|
1441 | - else |
|
1496 | + } else |
|
1442 | 1497 | { |
1443 | 1498 | $where .= ' AND mem.id_group != {int:id_group_' . $row['id_group'] . '} AND FIND_IN_SET({int:id_group_' . $row['id_group'] . '}, mem.additional_groups) = 0'; |
1444 | 1499 | $where_vars['id_group_' . $row['id_group']] = $row['id_group']; |
@@ -1465,8 +1520,9 @@ discard block |
||
1465 | 1520 | $members = array(); |
1466 | 1521 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
1467 | 1522 | { |
1468 | - if (!$row['is_mod'] || !in_array(3, $groups)) |
|
1469 | - $members[] = $row['id_member']; |
|
1523 | + if (!$row['is_mod'] || !in_array(3, $groups)) { |
|
1524 | + $members[] = $row['id_member']; |
|
1525 | + } |
|
1470 | 1526 | } |
1471 | 1527 | $smcFunc['db_free_result']($request); |
1472 | 1528 | |
@@ -1513,8 +1569,9 @@ discard block |
||
1513 | 1569 | ) |
1514 | 1570 | ); |
1515 | 1571 | |
1516 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
1517 | - $drafts[] = (int) $row[0]; |
|
1572 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
1573 | + $drafts[] = (int) $row[0]; |
|
1574 | + } |
|
1518 | 1575 | $smcFunc['db_free_result']($request); |
1519 | 1576 | |
1520 | 1577 | // If we have old drafts, remove them |
@@ -1557,8 +1614,9 @@ discard block |
||
1557 | 1614 | $sticky = isset($_POST['move_type_sticky']) || isset($_GET['sticky']); |
1558 | 1615 | |
1559 | 1616 | // No boards then this is your stop. |
1560 | - if (empty($id_board_from) || empty($id_board_to)) |
|
1561 | - return; |
|
1617 | + if (empty($id_board_from) || empty($id_board_to)) { |
|
1618 | + return; |
|
1619 | + } |
|
1562 | 1620 | |
1563 | 1621 | // The big WHERE clause |
1564 | 1622 | $conditions = 'WHERE t.id_board = {int:id_board_from} |
@@ -1606,18 +1664,20 @@ discard block |
||
1606 | 1664 | ); |
1607 | 1665 | list ($total_topics) = $smcFunc['db_fetch_row']($request); |
1608 | 1666 | $smcFunc['db_free_result']($request); |
1667 | + } else { |
|
1668 | + $total_topics = (int) $_REQUEST['totaltopics']; |
|
1609 | 1669 | } |
1610 | - else |
|
1611 | - $total_topics = (int) $_REQUEST['totaltopics']; |
|
1612 | 1670 | |
1613 | 1671 | // Seems like we need this here. |
1614 | 1672 | $context['continue_get_data'] = '?action=admin;area=maintain;sa=topics;activity=massmove;id_board_from=' . $id_board_from . ';id_board_to=' . $id_board_to . ';totaltopics=' . $total_topics . ';max_days=' . $max_days; |
1615 | 1673 | |
1616 | - if ($locked) |
|
1617 | - $context['continue_get_data'] .= ';locked'; |
|
1674 | + if ($locked) { |
|
1675 | + $context['continue_get_data'] .= ';locked'; |
|
1676 | + } |
|
1618 | 1677 | |
1619 | - if ($sticky) |
|
1620 | - $context['continue_get_data'] .= ';sticky'; |
|
1678 | + if ($sticky) { |
|
1679 | + $context['continue_get_data'] .= ';sticky'; |
|
1680 | + } |
|
1621 | 1681 | |
1622 | 1682 | $context['continue_get_data'] .= ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
1623 | 1683 | |
@@ -1638,8 +1698,9 @@ discard block |
||
1638 | 1698 | |
1639 | 1699 | // Get the ids. |
1640 | 1700 | $topics = array(); |
1641 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1642 | - $topics[] = $row['id_topic']; |
|
1701 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1702 | + $topics[] = $row['id_topic']; |
|
1703 | + } |
|
1643 | 1704 | |
1644 | 1705 | // Just return if we don't have any topics left to move. |
1645 | 1706 | if (empty($topics)) |
@@ -1730,9 +1791,9 @@ discard block |
||
1730 | 1791 | // save it so we don't do this again for this task |
1731 | 1792 | list ($_SESSION['total_members']) = $smcFunc['db_fetch_row']($request); |
1732 | 1793 | $smcFunc['db_free_result']($request); |
1794 | + } else { |
|
1795 | + validateToken('admin-recountposts'); |
|
1733 | 1796 | } |
1734 | - else |
|
1735 | - validateToken('admin-recountposts'); |
|
1736 | 1797 | |
1737 | 1798 | // Lets get a group of members and determine their post count (from the boards that have post count enabled of course). |
1738 | 1799 | $request = $smcFunc['db_query']('', ' |
@@ -1778,8 +1839,9 @@ discard block |
||
1778 | 1839 | createToken('admin-recountposts'); |
1779 | 1840 | $context['continue_post_data'] = '<input type="hidden" name="' . $context['admin-recountposts_token_var'] . '" value="' . $context['admin-recountposts_token'] . '">'; |
1780 | 1841 | |
1781 | - if (function_exists('apache_reset_timeout')) |
|
1782 | - apache_reset_timeout(); |
|
1842 | + if (function_exists('apache_reset_timeout')) { |
|
1843 | + apache_reset_timeout(); |
|
1844 | + } |
|
1783 | 1845 | return; |
1784 | 1846 | } |
1785 | 1847 | |
@@ -1865,10 +1927,9 @@ discard block |
||
1865 | 1927 | checkSession('request'); |
1866 | 1928 | validateToken('admin-hook', 'request'); |
1867 | 1929 | |
1868 | - if ($_REQUEST['do'] == 'remove') |
|
1869 | - remove_integration_function($_REQUEST['hook'], urldecode($_REQUEST['function'])); |
|
1870 | - |
|
1871 | - else |
|
1930 | + if ($_REQUEST['do'] == 'remove') { |
|
1931 | + remove_integration_function($_REQUEST['hook'], urldecode($_REQUEST['function'])); |
|
1932 | + } else |
|
1872 | 1933 | { |
1873 | 1934 | $function_remove = urldecode($_REQUEST['function']) . (($_REQUEST['do'] == 'disable') ? '' : '!'); |
1874 | 1935 | $function_add = urldecode($_REQUEST['function']) . (($_REQUEST['do'] == 'disable') ? '!' : ''); |
@@ -1918,11 +1979,11 @@ discard block |
||
1918 | 1979 | // Show a nice icon to indicate this is an instance. |
1919 | 1980 | $instance = (!empty($data['instance']) ? '<span class="generic_icons news" title="' . $txt['hooks_field_function_method'] . '"></span> ' : ''); |
1920 | 1981 | |
1921 | - if (!empty($data['included_file'])) |
|
1922 | - return $instance . $txt['hooks_field_function'] . ': ' . $data['real_function'] . '<br>' . $txt['hooks_field_included_file'] . ': ' . $data['included_file']; |
|
1923 | - |
|
1924 | - else |
|
1925 | - return $instance . $data['real_function']; |
|
1982 | + if (!empty($data['included_file'])) { |
|
1983 | + return $instance . $txt['hooks_field_function'] . ': ' . $data['real_function'] . '<br>' . $txt['hooks_field_included_file'] . ': ' . $data['included_file']; |
|
1984 | + } else { |
|
1985 | + return $instance . $data['real_function']; |
|
1986 | + } |
|
1926 | 1987 | }, |
1927 | 1988 | ), |
1928 | 1989 | 'sort' => array( |
@@ -1987,11 +2048,12 @@ discard block |
||
1987 | 2048 | 'data' => array( |
1988 | 2049 | 'function' => function($data) use ($txt, $scripturl, $context) |
1989 | 2050 | { |
1990 | - if (!$data['hook_exists']) |
|
1991 | - return ' |
|
2051 | + if (!$data['hook_exists']) { |
|
2052 | + return ' |
|
1992 | 2053 | <a href="' . $scripturl . '?action=admin;area=maintain;sa=hooks;do=remove;hook=' . $data['hook_name'] . ';function=' . urlencode($data['function_name']) . $context['filter_url'] . ';' . $context['admin-hook_token_var'] . '=' . $context['admin-hook_token'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" data-confirm="' . $txt['quickmod_confirm'] . '" class="you_sure"> |
1993 | 2054 | <span class="generic_icons delete" title="' . $txt['hooks_button_remove'] . '"></span> |
1994 | 2055 | </a>'; |
2056 | + } |
|
1995 | 2057 | }, |
1996 | 2058 | 'class' => 'centertext', |
1997 | 2059 | ), |
@@ -2026,10 +2088,11 @@ discard block |
||
2026 | 2088 | { |
2027 | 2089 | if ($file != '.' && $file != '..') |
2028 | 2090 | { |
2029 | - if (is_dir($dir_path . '/' . $file)) |
|
2030 | - $files = array_merge($files, get_files_recursive($dir_path . '/' . $file)); |
|
2031 | - else |
|
2032 | - $files[] = array('dir' => $dir_path, 'name' => $file); |
|
2091 | + if (is_dir($dir_path . '/' . $file)) { |
|
2092 | + $files = array_merge($files, get_files_recursive($dir_path . '/' . $file)); |
|
2093 | + } else { |
|
2094 | + $files[] = array('dir' => $dir_path, 'name' => $file); |
|
2095 | + } |
|
2033 | 2096 | } |
2034 | 2097 | } |
2035 | 2098 | } |
@@ -2078,16 +2141,16 @@ discard block |
||
2078 | 2141 | // I need to know if there is at least one function called in this file. |
2079 | 2142 | $temp_data['include'][$hookParsedData['pureFunc']] = array('hook' => $hook, 'function' => $hookParsedData['pureFunc']); |
2080 | 2143 | unset($temp_hooks[$hook][$rawFunc]); |
2081 | - } |
|
2082 | - elseif (strpos(str_replace(' (', '(', $fc), 'function ' . trim($hookParsedData['pureFunc']) . '(') !== false) |
|
2144 | + } elseif (strpos(str_replace(' (', '(', $fc), 'function ' . trim($hookParsedData['pureFunc']) . '(') !== false) |
|
2083 | 2145 | { |
2084 | 2146 | $hook_status[$hook][$hookParsedData['pureFunc']] = $hookParsedData; |
2085 | 2147 | $hook_status[$hook][$hookParsedData['pureFunc']]['exists'] = true; |
2086 | 2148 | $hook_status[$hook][$hookParsedData['pureFunc']]['in_file'] = (!empty($file['name']) ? $file['name'] : (!empty($hookParsedData['hookFile']) ? $hookParsedData['hookFile'] : '')); |
2087 | 2149 | |
2088 | 2150 | // Does the hook has its own file? |
2089 | - if (!empty($hookParsedData['hookFile'])) |
|
2090 | - $temp_data['include'][$hookParsedData['pureFunc']] = array('hook' => $hook, 'function' => $hookParsedData['pureFunc']); |
|
2151 | + if (!empty($hookParsedData['hookFile'])) { |
|
2152 | + $temp_data['include'][$hookParsedData['pureFunc']] = array('hook' => $hook, 'function' => $hookParsedData['pureFunc']); |
|
2153 | + } |
|
2091 | 2154 | |
2092 | 2155 | // I want to remember all the functions called within this file (to check later if they are enabled or disabled and decide if the integrare_*_include of that file can be disabled too) |
2093 | 2156 | $temp_data['function'][$file['name']][$hookParsedData['pureFunc']] = $hookParsedData['enabled']; |
@@ -2114,15 +2177,17 @@ discard block |
||
2114 | 2177 | $sort = array(); |
2115 | 2178 | $hooks_filters = array(); |
2116 | 2179 | |
2117 | - foreach ($hooks as $hook => $functions) |
|
2118 | - $hooks_filters[] = '<option' . ($context['current_filter'] == $hook ? ' selected ' : '') . ' value="' . $hook . '">' . $hook . '</option>'; |
|
2180 | + foreach ($hooks as $hook => $functions) { |
|
2181 | + $hooks_filters[] = '<option' . ($context['current_filter'] == $hook ? ' selected ' : '') . ' value="' . $hook . '">' . $hook . '</option>'; |
|
2182 | + } |
|
2119 | 2183 | |
2120 | - if (!empty($hooks_filters)) |
|
2121 | - $context['insert_after_template'] .= ' |
|
2184 | + if (!empty($hooks_filters)) { |
|
2185 | + $context['insert_after_template'] .= ' |
|
2122 | 2186 | <script> |
2123 | 2187 | var hook_name_header = document.getElementById(\'header_list_integration_hooks_hook_name\'); |
2124 | 2188 | hook_name_header.innerHTML += ' . JavaScriptEscape('<select style="margin-left:15px;" onchange="window.location=(\'' . $scripturl . '?action=admin;area=maintain;sa=hooks\' + (this.value ? \';filter=\' + this.value : \'\'));"><option value="">' . $txt['hooks_reset_filter'] . '</option>' . implode('', $hooks_filters) . '</select>') . '; |
2125 | 2189 | </script>'; |
2190 | + } |
|
2126 | 2191 | |
2127 | 2192 | $temp_data = array(); |
2128 | 2193 | $id = 0; |
@@ -2164,10 +2229,11 @@ discard block |
||
2164 | 2229 | |
2165 | 2230 | foreach ($temp_data as $data) |
2166 | 2231 | { |
2167 | - if (++$counter < $start) |
|
2168 | - continue; |
|
2169 | - elseif ($counter == $start + $per_page) |
|
2170 | - break; |
|
2232 | + if (++$counter < $start) { |
|
2233 | + continue; |
|
2234 | + } elseif ($counter == $start + $per_page) { |
|
2235 | + break; |
|
2236 | + } |
|
2171 | 2237 | |
2172 | 2238 | $hooks_data[] = $data; |
2173 | 2239 | } |
@@ -2189,13 +2255,15 @@ discard block |
||
2189 | 2255 | $hooks_count = 0; |
2190 | 2256 | |
2191 | 2257 | $context['filter'] = false; |
2192 | - if (isset($_GET['filter'])) |
|
2193 | - $context['filter'] = $_GET['filter']; |
|
2258 | + if (isset($_GET['filter'])) { |
|
2259 | + $context['filter'] = $_GET['filter']; |
|
2260 | + } |
|
2194 | 2261 | |
2195 | 2262 | foreach ($hooks as $hook => $functions) |
2196 | 2263 | { |
2197 | - if (empty($context['filter']) || (!empty($context['filter']) && $context['filter'] == $hook)) |
|
2198 | - $hooks_count += count($functions); |
|
2264 | + if (empty($context['filter']) || (!empty($context['filter']) && $context['filter'] == $hook)) { |
|
2265 | + $hooks_count += count($functions); |
|
2266 | + } |
|
2199 | 2267 | } |
2200 | 2268 | |
2201 | 2269 | return $hooks_count; |
@@ -2216,8 +2284,9 @@ discard block |
||
2216 | 2284 | $integration_hooks = array(); |
2217 | 2285 | foreach ($modSettings as $key => $value) |
2218 | 2286 | { |
2219 | - if (!empty($value) && substr($key, 0, 10) === 'integrate_') |
|
2220 | - $integration_hooks[$key] = explode(',', $value); |
|
2287 | + if (!empty($value) && substr($key, 0, 10) === 'integrate_') { |
|
2288 | + $integration_hooks[$key] = explode(',', $value); |
|
2289 | + } |
|
2221 | 2290 | } |
2222 | 2291 | } |
2223 | 2292 | |
@@ -2248,8 +2317,9 @@ discard block |
||
2248 | 2317 | ); |
2249 | 2318 | |
2250 | 2319 | // Meh... |
2251 | - if (empty($rawData)) |
|
2252 | - return $hookData; |
|
2320 | + if (empty($rawData)) { |
|
2321 | + return $hookData; |
|
2322 | + } |
|
2253 | 2323 | |
2254 | 2324 | // For convenience purposes only! |
2255 | 2325 | $modFunc = $rawData; |
@@ -2260,11 +2330,11 @@ discard block |
||
2260 | 2330 | list ($hookData['hookFile'], $modFunc) = explode('|', $modFunc); |
2261 | 2331 | |
2262 | 2332 | // Does the file exists? who knows! |
2263 | - if (empty($settings['theme_dir'])) |
|
2264 | - $hookData['absPath'] = strtr(trim($hookData['hookFile']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir)); |
|
2265 | - |
|
2266 | - else |
|
2267 | - $hookData['absPath'] = strtr(trim($hookData['hookFile']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir'])); |
|
2333 | + if (empty($settings['theme_dir'])) { |
|
2334 | + $hookData['absPath'] = strtr(trim($hookData['hookFile']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir)); |
|
2335 | + } else { |
|
2336 | + $hookData['absPath'] = strtr(trim($hookData['hookFile']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir'])); |
|
2337 | + } |
|
2268 | 2338 | |
2269 | 2339 | $hookData['fileExists'] = file_exists($hookData['absPath']); |
2270 | 2340 | $hookData['hookFile'] = basename($hookData['hookFile']); |
@@ -2289,11 +2359,10 @@ discard block |
||
2289 | 2359 | { |
2290 | 2360 | list ($hookData['class'], $hookData['method']) = explode('::', $modFunc); |
2291 | 2361 | $hookData['pureFunc'] = $hookData['method']; |
2362 | + } else { |
|
2363 | + $hookData['pureFunc'] = $modFunc; |
|
2292 | 2364 | } |
2293 | 2365 | |
2294 | - else |
|
2295 | - $hookData['pureFunc'] = $modFunc; |
|
2296 | - |
|
2297 | 2366 | return $hookData; |
2298 | 2367 | } |
2299 | 2368 | |
@@ -2311,16 +2380,18 @@ discard block |
||
2311 | 2380 | function fixchardb__callback($matches) |
2312 | 2381 | { |
2313 | 2382 | global $smcFunc; |
2314 | - if (!isset($matches[1])) |
|
2315 | - return ''; |
|
2383 | + if (!isset($matches[1])) { |
|
2384 | + return ''; |
|
2385 | + } |
|
2316 | 2386 | |
2317 | 2387 | $num = $matches[1][0] === 'x' ? hexdec(substr($matches[1], 1)) : (int) $matches[1]; |
2318 | 2388 | |
2319 | 2389 | // it's to big for mb3? |
2320 | - if ($num > 0xFFFF && !$smcFunc['db_mb4']) |
|
2321 | - return $matches[0]; |
|
2322 | - else |
|
2323 | - return fixchar__callback($matches); |
|
2324 | -} |
|
2390 | + if ($num > 0xFFFF && !$smcFunc['db_mb4']) { |
|
2391 | + return $matches[0]; |
|
2392 | + } else { |
|
2393 | + return fixchar__callback($matches); |
|
2394 | + } |
|
2395 | + } |
|
2325 | 2396 | |
2326 | 2397 | ?> |
2327 | 2398 | \ No newline at end of file |
@@ -65,9 +65,10 @@ discard block |
||
65 | 65 | ', implode(', ', $context['administrators']); |
66 | 66 | |
67 | 67 | // If we have lots of admins... don't show them all. |
68 | - if (!empty($context['more_admins_link'])) |
|
69 | - echo ' |
|
68 | + if (!empty($context['more_admins_link'])) { |
|
69 | + echo ' |
|
70 | 70 | (', $context['more_admins_link'], ')'; |
71 | + } |
|
71 | 72 | |
72 | 73 | echo ' |
73 | 74 | </div><!-- #version_details --> |
@@ -84,17 +85,19 @@ discard block |
||
84 | 85 | foreach ($area['areas'] as $item_id => $item) |
85 | 86 | { |
86 | 87 | // No point showing the 'home' page here, we're already on it! |
87 | - if ($area_id == 'forum' && $item_id == 'index') |
|
88 | - continue; |
|
88 | + if ($area_id == 'forum' && $item_id == 'index') { |
|
89 | + continue; |
|
90 | + } |
|
89 | 91 | |
90 | 92 | $url = isset($item['url']) ? $item['url'] : $scripturl . '?action=admin;area=' . $item_id . (!empty($context[$context['admin_menu_name']]['extra_parameters']) ? $context[$context['admin_menu_name']]['extra_parameters'] : ''); |
91 | 93 | |
92 | - if (!empty($item['icon_file'])) |
|
93 | - echo ' |
|
94 | + if (!empty($item['icon_file'])) { |
|
95 | + echo ' |
|
94 | 96 | <a href="', $url, '" class="admin_group', !empty($item['inactive']) ? ' inactive' : '', '"><img class="large_admin_menu_icon_file" src="', $item['icon_file'], '" alt="">', $item['label'], '</a>'; |
95 | - else |
|
96 | - echo ' |
|
97 | + } else { |
|
98 | + echo ' |
|
97 | 99 | <a href="', $url, '"><span class="large_', $item['icon_class'], !empty($item['inactive']) ? ' inactive' : '', '"></span>', $item['label'], '</a>'; |
100 | + } |
|
98 | 101 | } |
99 | 102 | |
100 | 103 | echo ' |
@@ -105,10 +108,11 @@ discard block |
||
105 | 108 | </div><!-- #admincenter -->'; |
106 | 109 | |
107 | 110 | // The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization. |
108 | - if (empty($modSettings['disable_smf_js'])) |
|
109 | - echo ' |
|
111 | + if (empty($modSettings['disable_smf_js'])) { |
|
112 | + echo ' |
|
110 | 113 | <script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script> |
111 | 114 | <script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>'; |
115 | + } |
|
112 | 116 | |
113 | 117 | // This sets the announcements and current versions themselves ;). |
114 | 118 | echo ' |
@@ -186,9 +190,10 @@ discard block |
||
186 | 190 | <em>', $version['version'], '</em>'; |
187 | 191 | |
188 | 192 | // more details for this item, show them a link |
189 | - if ($context['can_admin'] && isset($version['more'])) |
|
190 | - echo |
|
193 | + if ($context['can_admin'] && isset($version['more'])) { |
|
194 | + echo |
|
191 | 195 | ' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>'; |
196 | + } |
|
192 | 197 | echo ' |
193 | 198 | <br>'; |
194 | 199 | } |
@@ -219,21 +224,23 @@ discard block |
||
219 | 224 | |
220 | 225 | foreach ($context['credits'] as $section) |
221 | 226 | { |
222 | - if (isset($section['pretext'])) |
|
223 | - echo ' |
|
227 | + if (isset($section['pretext'])) { |
|
228 | + echo ' |
|
224 | 229 | <p>', $section['pretext'], '</p> |
225 | 230 | <hr>'; |
231 | + } |
|
226 | 232 | |
227 | 233 | echo ' |
228 | 234 | <dl>'; |
229 | 235 | |
230 | 236 | foreach ($section['groups'] as $group) |
231 | 237 | { |
232 | - if (isset($group['title'])) |
|
233 | - echo ' |
|
238 | + if (isset($group['title'])) { |
|
239 | + echo ' |
|
234 | 240 | <dt> |
235 | 241 | <strong>', $group['title'], ':</strong> |
236 | 242 | </dt>'; |
243 | + } |
|
237 | 244 | |
238 | 245 | echo ' |
239 | 246 | <dd>', implode(', ', $group['members']), '</dd>'; |
@@ -242,10 +249,11 @@ discard block |
||
242 | 249 | echo ' |
243 | 250 | </dl>'; |
244 | 251 | |
245 | - if (isset($section['posttext'])) |
|
246 | - echo ' |
|
252 | + if (isset($section['posttext'])) { |
|
253 | + echo ' |
|
247 | 254 | <hr> |
248 | 255 | <p>', $section['posttext'], '</p>'; |
256 | + } |
|
249 | 257 | } |
250 | 258 | |
251 | 259 | echo ' |
@@ -261,9 +269,10 @@ discard block |
||
261 | 269 | smfSupportVersions.forum = "', $context['forum_version'], '";'; |
262 | 270 | |
263 | 271 | // Don't worry, none of this is logged, it's just used to give information that might be of use. |
264 | - foreach ($context['current_versions'] as $variable => $version) |
|
265 | - echo ' |
|
272 | + foreach ($context['current_versions'] as $variable => $version) { |
|
273 | + echo ' |
|
266 | 274 | smfSupportVersions.', $variable, ' = "', $version['version'], '";'; |
275 | + } |
|
267 | 276 | |
268 | 277 | // Now we just have to include the script and wait ;). |
269 | 278 | echo ' |
@@ -360,8 +369,8 @@ discard block |
||
360 | 369 | <tbody>'; |
361 | 370 | |
362 | 371 | // Loop through every source file displaying its version - using javascript. |
363 | - foreach ($context['file_versions'] as $filename => $version) |
|
364 | - echo ' |
|
372 | + foreach ($context['file_versions'] as $filename => $version) { |
|
373 | + echo ' |
|
365 | 374 | <tr class="windowbg"> |
366 | 375 | <td class="half_table"> |
367 | 376 | ', $filename, ' |
@@ -373,6 +382,7 @@ discard block |
||
373 | 382 | <em id="currentSources', $filename, '">??</em> |
374 | 383 | </td> |
375 | 384 | </tr>'; |
385 | + } |
|
376 | 386 | |
377 | 387 | // Default template files. |
378 | 388 | echo ' |
@@ -398,8 +408,8 @@ discard block |
||
398 | 408 | <table id="Default" class="table_grid"> |
399 | 409 | <tbody>'; |
400 | 410 | |
401 | - foreach ($context['default_template_versions'] as $filename => $version) |
|
402 | - echo ' |
|
411 | + foreach ($context['default_template_versions'] as $filename => $version) { |
|
412 | + echo ' |
|
403 | 413 | <tr class="windowbg"> |
404 | 414 | <td class="half_table"> |
405 | 415 | ', $filename, ' |
@@ -411,6 +421,7 @@ discard block |
||
411 | 421 | <em id="currentDefault', $filename, '">??</em> |
412 | 422 | </td> |
413 | 423 | </tr>'; |
424 | + } |
|
414 | 425 | |
415 | 426 | // Now the language files... |
416 | 427 | echo ' |
@@ -438,8 +449,8 @@ discard block |
||
438 | 449 | |
439 | 450 | foreach ($context['default_language_versions'] as $language => $files) |
440 | 451 | { |
441 | - foreach ($files as $filename => $version) |
|
442 | - echo ' |
|
452 | + foreach ($files as $filename => $version) { |
|
453 | + echo ' |
|
443 | 454 | <tr class="windowbg"> |
444 | 455 | <td class="half_table"> |
445 | 456 | ', $filename, '.<em>', $language, '</em>.php |
@@ -451,6 +462,7 @@ discard block |
||
451 | 462 | <em id="current', $filename, '.', $language, '">??</em> |
452 | 463 | </td> |
453 | 464 | </tr>'; |
465 | + } |
|
454 | 466 | } |
455 | 467 | |
456 | 468 | echo ' |
@@ -480,8 +492,8 @@ discard block |
||
480 | 492 | <table id="Templates" class="table_grid"> |
481 | 493 | <tbody>'; |
482 | 494 | |
483 | - foreach ($context['template_versions'] as $filename => $version) |
|
484 | - echo ' |
|
495 | + foreach ($context['template_versions'] as $filename => $version) { |
|
496 | + echo ' |
|
485 | 497 | <tr class="windowbg"> |
486 | 498 | <td class="half_table"> |
487 | 499 | ', $filename, ' |
@@ -493,6 +505,7 @@ discard block |
||
493 | 505 | <em id="currentTemplates', $filename, '">??</em> |
494 | 506 | </td> |
495 | 507 | </tr>'; |
508 | + } |
|
496 | 509 | |
497 | 510 | echo ' |
498 | 511 | </tbody> |
@@ -522,8 +535,8 @@ discard block |
||
522 | 535 | <table id="Tasks" class="table_grid"> |
523 | 536 | <tbody>'; |
524 | 537 | |
525 | - foreach ($context['tasks_versions'] as $filename => $version) |
|
526 | - echo ' |
|
538 | + foreach ($context['tasks_versions'] as $filename => $version) { |
|
539 | + echo ' |
|
527 | 540 | <tr class="windowbg"> |
528 | 541 | <td class="half_table"> |
529 | 542 | ', $filename, ' |
@@ -535,6 +548,7 @@ discard block |
||
535 | 548 | <em id="currentTasks', $filename, '">??</em> |
536 | 549 | </td> |
537 | 550 | </tr>'; |
551 | + } |
|
538 | 552 | |
539 | 553 | echo ' |
540 | 554 | </tbody> |
@@ -576,9 +590,10 @@ discard block |
||
576 | 590 | { |
577 | 591 | global $context, $scripturl, $txt, $modSettings; |
578 | 592 | |
579 | - if (!empty($context['saved_successful'])) |
|
580 | - echo ' |
|
593 | + if (!empty($context['saved_successful'])) { |
|
594 | + echo ' |
|
581 | 595 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
596 | + } |
|
582 | 597 | |
583 | 598 | // First section is for adding/removing words from the censored list. |
584 | 599 | echo ' |
@@ -593,11 +608,12 @@ discard block |
||
593 | 608 | <p>', $txt['admin_censored_where'], '</p>'; |
594 | 609 | |
595 | 610 | // Show text boxes for censoring [bad ] => [good ]. |
596 | - foreach ($context['censored_words'] as $vulgar => $proper) |
|
597 | - echo ' |
|
611 | + foreach ($context['censored_words'] as $vulgar => $proper) { |
|
612 | + echo ' |
|
598 | 613 | <div class="block"> |
599 | 614 | <input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> => <input type="text" name="censor_proper[]" value="', $proper, '" size="30"> |
600 | 615 | </div>'; |
616 | + } |
|
601 | 617 | |
602 | 618 | // Now provide a way to censor more words. |
603 | 619 | echo ' |
@@ -672,27 +688,30 @@ discard block |
||
672 | 688 | <div class="windowbg"> |
673 | 689 | ', $txt['not_done_reason']; |
674 | 690 | |
675 | - if (!empty($context['continue_percent'])) |
|
676 | - echo ' |
|
691 | + if (!empty($context['continue_percent'])) { |
|
692 | + echo ' |
|
677 | 693 | <div class="progress_bar"> |
678 | 694 | <span>', $context['continue_percent'], '%</span> |
679 | 695 | <div class="bar" style="width: ', $context['continue_percent'], '%;"></div> |
680 | 696 | </div>'; |
697 | + } |
|
681 | 698 | |
682 | - if (!empty($context['substep_enabled'])) |
|
683 | - echo ' |
|
699 | + if (!empty($context['substep_enabled'])) { |
|
700 | + echo ' |
|
684 | 701 | <div class="progress_bar progress_blue"> |
685 | 702 | <span>', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</span> |
686 | 703 | <div class="bar" style="width: ', $context['substep_continue_percent'], '%;"></div> |
687 | 704 | </div>'; |
705 | + } |
|
688 | 706 | |
689 | 707 | echo ' |
690 | 708 | <form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">'; |
691 | 709 | |
692 | 710 | // Do we have a token? |
693 | - if (isset($context['not_done_token']) && isset($context[$context['not_done_token'] . '_token'], $context[$context['not_done_token'] . '_token_var'])) |
|
694 | - echo ' |
|
711 | + if (isset($context['not_done_token']) && isset($context[$context['not_done_token'] . '_token'], $context[$context['not_done_token'] . '_token_var'])) { |
|
712 | + echo ' |
|
695 | 713 | <input type="hidden" name="', $context[$context['not_done_token'] . '_token_var'], '" value="', $context[$context['not_done_token'] . '_token'], '">'; |
714 | + } |
|
696 | 715 | |
697 | 716 | echo ' |
698 | 717 | <input type="submit" name="cont" value="', $txt['not_done_continue'], '" class="button"> |
@@ -726,35 +745,40 @@ discard block |
||
726 | 745 | { |
727 | 746 | global $context, $txt, $scripturl; |
728 | 747 | |
729 | - if (!empty($context['saved_successful'])) |
|
730 | - echo ' |
|
748 | + if (!empty($context['saved_successful'])) { |
|
749 | + echo ' |
|
731 | 750 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
732 | - elseif (!empty($context['saved_failed'])) |
|
733 | - echo ' |
|
751 | + } elseif (!empty($context['saved_failed'])) { |
|
752 | + echo ' |
|
734 | 753 | <div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>'; |
754 | + } |
|
735 | 755 | |
736 | - if (!empty($context['settings_pre_javascript'])) |
|
737 | - echo ' |
|
756 | + if (!empty($context['settings_pre_javascript'])) { |
|
757 | + echo ' |
|
738 | 758 | <script>', $context['settings_pre_javascript'], '</script>'; |
759 | + } |
|
739 | 760 | |
740 | - if (!empty($context['settings_insert_above'])) |
|
741 | - echo $context['settings_insert_above']; |
|
761 | + if (!empty($context['settings_insert_above'])) { |
|
762 | + echo $context['settings_insert_above']; |
|
763 | + } |
|
742 | 764 | |
743 | 765 | echo ' |
744 | 766 | <div id="admincenter"> |
745 | 767 | <form id="admin_form_wrapper" action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>'; |
746 | 768 | |
747 | 769 | // Is there a custom title? |
748 | - if (isset($context['settings_title'])) |
|
749 | - echo ' |
|
770 | + if (isset($context['settings_title'])) { |
|
771 | + echo ' |
|
750 | 772 | <div class="cat_bar"> |
751 | 773 | <h3 class="catbg">', $context['settings_title'], '</h3> |
752 | 774 | </div>'; |
775 | + } |
|
753 | 776 | |
754 | 777 | // Have we got a message to display? |
755 | - if (!empty($context['settings_message'])) |
|
756 | - echo ' |
|
778 | + if (!empty($context['settings_message'])) { |
|
779 | + echo ' |
|
757 | 780 | <div class="information">', $context['settings_message'], '</div>'; |
781 | + } |
|
758 | 782 | |
759 | 783 | // Now actually loop through all the variables. |
760 | 784 | $is_open = false; |
@@ -807,8 +831,9 @@ discard block |
||
807 | 831 | // Hang about? Are you pulling my leg - a callback?! |
808 | 832 | if (is_array($config_var) && $config_var['type'] == 'callback') |
809 | 833 | { |
810 | - if (function_exists('template_callback_' . $config_var['name'])) |
|
811 | - call_user_func('template_callback_' . $config_var['name']); |
|
834 | + if (function_exists('template_callback_' . $config_var['name'])) { |
|
835 | + call_user_func('template_callback_' . $config_var['name']); |
|
836 | + } |
|
812 | 837 | |
813 | 838 | continue; |
814 | 839 | } |
@@ -838,9 +863,10 @@ discard block |
||
838 | 863 | $text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time'); |
839 | 864 | |
840 | 865 | // Show the [?] button. |
841 | - if ($config_var['help']) |
|
842 | - echo ' |
|
866 | + if ($config_var['help']) { |
|
867 | + echo ' |
|
843 | 868 | <a id="setting_', $config_var['name'], '_help" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="', $txt['help'], '"></span></a> '; |
869 | + } |
|
844 | 870 | |
845 | 871 | echo ' |
846 | 872 | <a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span> |
@@ -849,23 +875,26 @@ discard block |
||
849 | 875 | $config_var['preinput']; |
850 | 876 | |
851 | 877 | // Show a check box. |
852 | - if ($config_var['type'] == 'check') |
|
853 | - echo ' |
|
878 | + if ($config_var['type'] == 'check') { |
|
879 | + echo ' |
|
854 | 880 | <input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1">'; |
881 | + } |
|
855 | 882 | // Escape (via htmlspecialchars.) the text box. |
856 | - elseif ($config_var['type'] == 'password') |
|
857 | - echo ' |
|
883 | + elseif ($config_var['type'] == 'password') { |
|
884 | + echo ' |
|
858 | 885 | <input type="password"', $disabled, $javascript, ' name="', $config_var['name'], '[0]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' value="*#fakepass#*" onfocus="this.value = \'\'; this.form.', $config_var['name'], '.disabled = false;"><br> |
859 | 886 | <input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), '>'; |
887 | + } |
|
860 | 888 | // Show a selection box. |
861 | 889 | elseif ($config_var['type'] == 'select') |
862 | 890 | { |
863 | 891 | echo ' |
864 | 892 | <select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), (!empty($config_var['multiple']) && !empty($config_var['size']) ? ' size="' . $config_var['size'] . '"' : ''), '>'; |
865 | 893 | |
866 | - foreach ($config_var['data'] as $option) |
|
867 | - echo ' |
|
894 | + foreach ($config_var['data'] as $option) { |
|
895 | + echo ' |
|
868 | 896 | <option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected' : ''), '>', $option[1], '</option>'; |
897 | + } |
|
869 | 898 | echo ' |
870 | 899 | </select>'; |
871 | 900 | } |
@@ -882,16 +911,18 @@ discard block |
||
882 | 911 | |
883 | 912 | foreach ($context['board_list'] as $id_cat => $cat) |
884 | 913 | { |
885 | - if (!$first) |
|
886 | - echo ' |
|
914 | + if (!$first) { |
|
915 | + echo ' |
|
887 | 916 | <hr>'; |
917 | + } |
|
888 | 918 | echo ' |
889 | 919 | <strong>', $cat['name'], '</strong> |
890 | 920 | <ul>'; |
891 | 921 | |
892 | - foreach ($cat['boards'] as $id_board => $brd) |
|
893 | - echo ' |
|
922 | + foreach ($cat['boards'] as $id_board => $brd) { |
|
923 | + echo ' |
|
894 | 924 | <li><label><input type="checkbox" name="', $config_var['name'], '[', $brd['id'], ']" value="1"', in_array($brd['id'], $config_var['value']) ? ' checked' : '', '> ', $brd['child_level'] > 0 ? str_repeat(' ', $brd['child_level']) : '', $brd['name'], '</label></li>'; |
925 | + } |
|
895 | 926 | |
896 | 927 | echo ' |
897 | 928 | </ul>'; |
@@ -901,12 +932,14 @@ discard block |
||
901 | 932 | </fieldset>'; |
902 | 933 | } |
903 | 934 | // Text area? |
904 | - elseif ($config_var['type'] == 'large_text') |
|
905 | - echo ' |
|
935 | + elseif ($config_var['type'] == 'large_text') { |
|
936 | + echo ' |
|
906 | 937 | <textarea rows="', (!empty($config_var['size']) ? $config_var['size'] : (!empty($config_var['rows']) ? $config_var['rows'] : 4)), '" cols="', (!empty($config_var['cols']) ? $config_var['cols'] : 30), '" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>'; |
938 | + } |
|
907 | 939 | // Permission group? |
908 | - elseif ($config_var['type'] == 'permissions') |
|
909 | - theme_inline_permissions($config_var['name']); |
|
940 | + elseif ($config_var['type'] == 'permissions') { |
|
941 | + theme_inline_permissions($config_var['name']); |
|
942 | + } |
|
910 | 943 | |
911 | 944 | // BBC selection? |
912 | 945 | elseif ($config_var['type'] == 'bbc') |
@@ -918,22 +951,24 @@ discard block |
||
918 | 951 | |
919 | 952 | foreach ($context['bbc_columns'] as $bbcColumn) |
920 | 953 | { |
921 | - foreach ($bbcColumn as $bbcTag) |
|
922 | - echo ' |
|
954 | + foreach ($bbcColumn as $bbcTag) { |
|
955 | + echo ' |
|
923 | 956 | <li class="list_bbc floatleft"> |
924 | 957 | <input type="checkbox" name="', $config_var['name'], '_enabledTags[]" id="tag_', $config_var['name'], '_', $bbcTag['tag'], '" value="', $bbcTag['tag'], '"', !in_array($bbcTag['tag'], $context['bbc_sections'][$config_var['name']]['disabled']) ? ' checked' : '', '> <label for="tag_', $config_var['name'], '_', $bbcTag['tag'], '">', $bbcTag['tag'], '</label>', $bbcTag['show_help'] ? ' (<a href="' . $scripturl . '?action=helpadmin;help=tag_' . $bbcTag['tag'] . '" onclick="return reqOverlayDiv(this.href);">?</a>)' : '', ' |
925 | 958 | </li>'; |
959 | + } |
|
926 | 960 | } |
927 | 961 | echo ' </ul> |
928 | 962 | <input type="checkbox" id="bbc_', $config_var['name'], '_select_all" onclick="invertAll(this, this.form, \'', $config_var['name'], '_enabledTags\');"', $context['bbc_sections'][$config_var['name']]['all_selected'] ? ' checked' : '', '> <label for="bbc_', $config_var['name'], '_select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label> |
929 | 963 | </fieldset>'; |
930 | 964 | } |
931 | 965 | // A simple message? |
932 | - elseif ($config_var['type'] == 'var_message') |
|
933 | - echo ' |
|
966 | + elseif ($config_var['type'] == 'var_message') { |
|
967 | + echo ' |
|
934 | 968 | <div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '> |
935 | 969 | ', $config_var['var_message'], ' |
936 | 970 | </div>'; |
971 | + } |
|
937 | 972 | // Assume it must be a text box |
938 | 973 | else |
939 | 974 | { |
@@ -958,62 +993,70 @@ discard block |
||
958 | 993 | ' . $config_var['postinput'] : '',' |
959 | 994 | </dd>'; |
960 | 995 | } |
961 | - } |
|
962 | - else |
|
996 | + } else |
|
963 | 997 | { |
964 | 998 | // Just show a separator. |
965 | - if ($config_var == '') |
|
966 | - echo ' |
|
999 | + if ($config_var == '') { |
|
1000 | + echo ' |
|
967 | 1001 | </dl> |
968 | 1002 | <hr> |
969 | 1003 | <dl class="settings">'; |
970 | - else |
|
971 | - echo ' |
|
1004 | + } else { |
|
1005 | + echo ' |
|
972 | 1006 | <dd> |
973 | 1007 | <strong>' . $config_var . '</strong> |
974 | 1008 | </dd>'; |
1009 | + } |
|
975 | 1010 | } |
976 | 1011 | } |
977 | 1012 | |
978 | - if ($is_open) |
|
979 | - echo ' |
|
1013 | + if ($is_open) { |
|
1014 | + echo ' |
|
980 | 1015 | </dl>'; |
1016 | + } |
|
981 | 1017 | |
982 | - if (empty($context['settings_save_dont_show'])) |
|
983 | - echo ' |
|
1018 | + if (empty($context['settings_save_dont_show'])) { |
|
1019 | + echo ' |
|
984 | 1020 | <input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button">'; |
1021 | + } |
|
985 | 1022 | |
986 | - if ($is_open) |
|
987 | - echo ' |
|
1023 | + if ($is_open) { |
|
1024 | + echo ' |
|
988 | 1025 | </div><!-- .windowbg -->'; |
1026 | + } |
|
989 | 1027 | |
990 | 1028 | |
991 | 1029 | // At least one token has to be used! |
992 | - if (isset($context['admin-ssc_token'])) |
|
993 | - echo ' |
|
1030 | + if (isset($context['admin-ssc_token'])) { |
|
1031 | + echo ' |
|
994 | 1032 | <input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '">'; |
1033 | + } |
|
995 | 1034 | |
996 | - if (isset($context['admin-dbsc_token'])) |
|
997 | - echo ' |
|
1035 | + if (isset($context['admin-dbsc_token'])) { |
|
1036 | + echo ' |
|
998 | 1037 | <input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '">'; |
1038 | + } |
|
999 | 1039 | |
1000 | - if (isset($context['admin-mp_token'])) |
|
1001 | - echo ' |
|
1040 | + if (isset($context['admin-mp_token'])) { |
|
1041 | + echo ' |
|
1002 | 1042 | <input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">'; |
1043 | + } |
|
1003 | 1044 | |
1004 | 1045 | echo ' |
1005 | 1046 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1006 | 1047 | </form> |
1007 | 1048 | </div><!-- #admincenter -->'; |
1008 | 1049 | |
1009 | - if (!empty($context['settings_post_javascript'])) |
|
1010 | - echo ' |
|
1050 | + if (!empty($context['settings_post_javascript'])) { |
|
1051 | + echo ' |
|
1011 | 1052 | <script> |
1012 | 1053 | ', $context['settings_post_javascript'], ' |
1013 | 1054 | </script>'; |
1055 | + } |
|
1014 | 1056 | |
1015 | - if (!empty($context['settings_insert_below'])) |
|
1016 | - echo $context['settings_insert_below']; |
|
1057 | + if (!empty($context['settings_insert_below'])) { |
|
1058 | + echo $context['settings_insert_below']; |
|
1059 | + } |
|
1017 | 1060 | |
1018 | 1061 | // We may have added a board listing. If we did, we need to make it work. |
1019 | 1062 | addInlineJavascript(' |
@@ -1036,9 +1079,10 @@ discard block |
||
1036 | 1079 | { |
1037 | 1080 | global $context, $txt; |
1038 | 1081 | |
1039 | - if (!empty($context['saved_successful'])) |
|
1040 | - echo ' |
|
1082 | + if (!empty($context['saved_successful'])) { |
|
1083 | + echo ' |
|
1041 | 1084 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
1085 | + } |
|
1042 | 1086 | |
1043 | 1087 | // Standard fields. |
1044 | 1088 | template_show_list('standard_profile_fields'); |
@@ -1072,11 +1116,12 @@ discard block |
||
1072 | 1116 | { |
1073 | 1117 | loadLanguage('Errors'); |
1074 | 1118 | |
1075 | - if (isset($txt['custom_option_' . $_GET['msg']])) |
|
1076 | - echo ' |
|
1119 | + if (isset($txt['custom_option_' . $_GET['msg']])) { |
|
1120 | + echo ' |
|
1077 | 1121 | <div class="errorbox">', |
1078 | 1122 | $txt['custom_option_' . $_GET['msg']], ' |
1079 | 1123 | </div>'; |
1124 | + } |
|
1080 | 1125 | } |
1081 | 1126 | |
1082 | 1127 | echo ' |
@@ -1143,9 +1188,10 @@ discard block |
||
1143 | 1188 | <dd> |
1144 | 1189 | <select name="placement" id="placement">'; |
1145 | 1190 | |
1146 | - foreach ($context['cust_profile_fields_placement'] as $order => $name) |
|
1147 | - echo ' |
|
1191 | + foreach ($context['cust_profile_fields_placement'] as $order => $name) { |
|
1192 | + echo ' |
|
1148 | 1193 | <option value="', $order, '"', $context['field']['placement'] == $order ? ' selected' : '', '>', $txt['custom_profile_placement_' . $name], '</option>'; |
1194 | + } |
|
1149 | 1195 | |
1150 | 1196 | echo ' |
1151 | 1197 | </select> |
@@ -1169,9 +1215,10 @@ discard block |
||
1169 | 1215 | <dd> |
1170 | 1216 | <select name="field_type" id="field_type" onchange="updateInputBoxes();">'; |
1171 | 1217 | |
1172 | - foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) |
|
1173 | - echo ' |
|
1218 | + foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) { |
|
1219 | + echo ' |
|
1174 | 1220 | <option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>'; |
1221 | + } |
|
1175 | 1222 | |
1176 | 1223 | echo ' |
1177 | 1224 | </select> |
@@ -1203,9 +1250,10 @@ discard block |
||
1203 | 1250 | </dt> |
1204 | 1251 | <dd id="options_dd">'; |
1205 | 1252 | |
1206 | - foreach ($context['field']['options'] as $k => $option) |
|
1207 | - echo ' |
|
1253 | + foreach ($context['field']['options'] as $k => $option) { |
|
1254 | + echo ' |
|
1208 | 1255 | ', $k == 0 ? '' : '<br>', '<input type="radio" name="default_select" value="', $k, '"', $context['field']['default_select'] == $option ? ' checked' : '', '><input type="text" name="select_option[', $k, ']" value="', $option, '">'; |
1256 | + } |
|
1209 | 1257 | |
1210 | 1258 | echo ' |
1211 | 1259 | <span id="addopt"></span> |
@@ -1269,9 +1317,10 @@ discard block |
||
1269 | 1317 | </fieldset> |
1270 | 1318 | <input type="submit" name="save" value="', $txt['save'], '" class="button">'; |
1271 | 1319 | |
1272 | - if ($context['fid']) |
|
1273 | - echo ' |
|
1320 | + if ($context['fid']) { |
|
1321 | + echo ' |
|
1274 | 1322 | <input type="submit" name="delete" value="', $txt['delete'], '" data-confirm="', $txt['custom_edit_delete_sure'], '" class="button you_sure">'; |
1323 | + } |
|
1275 | 1324 | |
1276 | 1325 | echo ' |
1277 | 1326 | </div><!-- .windowbg --> |
@@ -1318,8 +1367,7 @@ discard block |
||
1318 | 1367 | <p class="centertext"> |
1319 | 1368 | <strong>', $txt['admin_search_results_none'], '</strong> |
1320 | 1369 | </p>'; |
1321 | - } |
|
1322 | - else |
|
1370 | + } else |
|
1323 | 1371 | { |
1324 | 1372 | echo ' |
1325 | 1373 | <ol class="search_results">'; |
@@ -1346,9 +1394,10 @@ discard block |
||
1346 | 1394 | <li> |
1347 | 1395 | <a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'], ']'; |
1348 | 1396 | |
1349 | - if ($result['help']) |
|
1350 | - echo ' |
|
1397 | + if ($result['help']) { |
|
1398 | + echo ' |
|
1351 | 1399 | <p class="double_height">', $result['help'], '</p>'; |
1400 | + } |
|
1352 | 1401 | |
1353 | 1402 | echo ' |
1354 | 1403 | </li>'; |
@@ -1388,10 +1437,11 @@ discard block |
||
1388 | 1437 | <strong>', $txt['setup_verification_answer'], '</strong> |
1389 | 1438 | </dd>'; |
1390 | 1439 | |
1391 | - if (!empty($context['qa_by_lang'][$lang_id])) |
|
1392 | - foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
1440 | + if (!empty($context['qa_by_lang'][$lang_id])) { |
|
1441 | + foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
1393 | 1442 | { |
1394 | 1443 | $question = $context['question_answers'][$q_id]; |
1444 | + } |
|
1395 | 1445 | |
1396 | 1446 | echo ' |
1397 | 1447 | <dt> |
@@ -1399,9 +1449,10 @@ discard block |
||
1399 | 1449 | </dt> |
1400 | 1450 | <dd>'; |
1401 | 1451 | |
1402 | - foreach ($question['answers'] as $answer) |
|
1403 | - echo ' |
|
1452 | + foreach ($question['answers'] as $answer) { |
|
1453 | + echo ' |
|
1404 | 1454 | <input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="verification_answer">'; |
1455 | + } |
|
1405 | 1456 | |
1406 | 1457 | echo ' |
1407 | 1458 | <div class="qa_add_answer"><a href="javascript:void(0);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div> |
@@ -1440,11 +1491,12 @@ discard block |
||
1440 | 1491 | ', $txt['errors_found'], ': |
1441 | 1492 | <ul>'; |
1442 | 1493 | |
1443 | - foreach ($context['repair_errors'] as $error) |
|
1444 | - echo ' |
|
1494 | + foreach ($context['repair_errors'] as $error) { |
|
1495 | + echo ' |
|
1445 | 1496 | <li> |
1446 | 1497 | ', $error, ' |
1447 | 1498 | </li>'; |
1499 | + } |
|
1448 | 1500 | |
1449 | 1501 | echo ' |
1450 | 1502 | </ul> |
@@ -1454,15 +1506,14 @@ discard block |
||
1454 | 1506 | <p class="padding"> |
1455 | 1507 | <strong><a href="', $scripturl, '?action=admin;area=repairboards;fixErrors;', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="', $scripturl, '?action=admin;area=maintain">', $txt['no'], '</a></strong> |
1456 | 1508 | </p>'; |
1457 | - } |
|
1458 | - else |
|
1459 | - echo ' |
|
1509 | + } else { |
|
1510 | + echo ' |
|
1460 | 1511 | <p>', $txt['maintain_no_errors'], '</p> |
1461 | 1512 | <p class="padding"> |
1462 | 1513 | <a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a> |
1463 | 1514 | </p>'; |
1464 | - } |
|
1465 | - else |
|
1515 | + } |
|
1516 | + } else |
|
1466 | 1517 | { |
1467 | 1518 | if (!empty($context['redirect_to_recount'])) |
1468 | 1519 | { |
@@ -1474,8 +1525,7 @@ discard block |
||
1474 | 1525 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1475 | 1526 | <input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '"> |
1476 | 1527 | </form>'; |
1477 | - } |
|
1478 | - else |
|
1528 | + } else |
|
1479 | 1529 | { |
1480 | 1530 | echo ' |
1481 | 1531 | <p>', $txt['errors_fixed'], '</p> |
@@ -1566,9 +1616,10 @@ discard block |
||
1566 | 1616 | <tr class="windowbg"> |
1567 | 1617 | <td class="equal_table">', $key, '</td>'; |
1568 | 1618 | |
1569 | - foreach ($setting as $key_lm => $value) |
|
1570 | - echo ' |
|
1619 | + foreach ($setting as $key_lm => $value) { |
|
1620 | + echo ' |
|
1571 | 1621 | <td class="equal_table">', $value, '</td>'; |
1622 | + } |
|
1572 | 1623 | |
1573 | 1624 | echo ' |
1574 | 1625 | </tr>'; |
@@ -1628,8 +1679,8 @@ discard block |
||
1628 | 1679 | { |
1629 | 1680 | global $context, $txt; |
1630 | 1681 | |
1631 | - if ($context['user']['is_admin']) |
|
1632 | - echo ' |
|
1682 | + if ($context['user']['is_admin']) { |
|
1683 | + echo ' |
|
1633 | 1684 | <span class="floatright admin_search"> |
1634 | 1685 | <span class="generic_icons filter centericon"></span> |
1635 | 1686 | <input type="search" name="search_term" placeholder="', $txt['admin_search'], '"> |
@@ -1640,6 +1691,7 @@ discard block |
||
1640 | 1691 | </select> |
1641 | 1692 | <input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button"> |
1642 | 1693 | </span>'; |
1643 | -} |
|
1694 | + } |
|
1695 | + } |
|
1644 | 1696 | |
1645 | 1697 | ?> |
1646 | 1698 | \ No newline at end of file |