@@ -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' || !isset($db_character_set) || $db_character_set !== 'utf8') |
|
| 491 | - fatal_lang_error('entity_convert_only_utf8'); |
|
| 507 | + if ($modSettings['global_character_set'] !== 'UTF-8' || !isset($db_character_set) || $db_character_set !== 'utf8') { |
|
| 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 |
@@ -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'], '"> |