@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Add the file functions to the $smcFunc array. |
@@ -53,8 +54,9 @@ discard block |
||
| 53 | 54 | 'messages', 'moderator_groups', 'moderators', 'package_servers', 'permission_profiles', 'permissions', 'personal_messages', |
| 54 | 55 | 'pm_labeled_messages', 'pm_labels', 'pm_recipients', 'pm_rules', 'poll_choices', 'polls', 'scheduled_tasks', 'sessions', 'settings', 'smileys', |
| 55 | 56 | 'spiders', 'subscriptions', 'themes', 'topics', 'user_alerts', 'user_alerts_prefs', 'user_drafts', 'user_likes'); |
| 56 | - foreach ($reservedTables as $k => $table_name) |
|
| 57 | - $reservedTables[$k] = strtolower($db_prefix . $table_name); |
|
| 57 | + foreach ($reservedTables as $k => $table_name) { |
|
| 58 | + $reservedTables[$k] = strtolower($db_prefix . $table_name); |
|
| 59 | + } |
|
| 58 | 60 | |
| 59 | 61 | // We in turn may need the extra stuff. |
| 60 | 62 | db_extend('extra'); |
@@ -109,8 +111,9 @@ discard block |
||
| 109 | 111 | $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); |
| 110 | 112 | |
| 111 | 113 | // First - no way do we touch SMF tables. |
| 112 | - if (in_array(strtolower($table_name), $reservedTables)) |
|
| 113 | - return false; |
|
| 114 | + if (in_array(strtolower($table_name), $reservedTables)) { |
|
| 115 | + return false; |
|
| 116 | + } |
|
| 114 | 117 | |
| 115 | 118 | // Log that we'll want to remove this on uninstall. |
| 116 | 119 | $db_package_log[] = array('remove_table', $table_name); |
@@ -120,9 +123,9 @@ discard block |
||
| 120 | 123 | if (in_array($full_table_name, $tables)) |
| 121 | 124 | { |
| 122 | 125 | // This is a sad day... drop the table? If not, return false (error) by default. |
| 123 | - if ($if_exists == 'overwrite') |
|
| 124 | - $smcFunc['db_drop_table']($table_name); |
|
| 125 | - else if ($if_exists == 'update') |
|
| 126 | + if ($if_exists == 'overwrite') { |
|
| 127 | + $smcFunc['db_drop_table']($table_name); |
|
| 128 | + } else if ($if_exists == 'update') |
|
| 126 | 129 | { |
| 127 | 130 | $smcFunc['db_transaction']('begin'); |
| 128 | 131 | $db_trans = true; |
@@ -134,15 +137,16 @@ discard block |
||
| 134 | 137 | ) |
| 135 | 138 | ); |
| 136 | 139 | $old_table_exists = true; |
| 140 | + } else { |
|
| 141 | + return $if_exists == 'ignore'; |
|
| 137 | 142 | } |
| 138 | - else |
|
| 139 | - return $if_exists == 'ignore'; |
|
| 140 | 143 | } |
| 141 | 144 | |
| 142 | 145 | // Righty - let's do the damn thing! |
| 143 | 146 | $table_query = 'CREATE TABLE ' . $table_name . "\n" . '('; |
| 144 | - foreach ($columns as $column) |
|
| 145 | - $table_query .= "\n\t" . smf_db_create_query_column($column) . ','; |
|
| 147 | + foreach ($columns as $column) { |
|
| 148 | + $table_query .= "\n\t" . smf_db_create_query_column($column) . ','; |
|
| 149 | + } |
|
| 146 | 150 | |
| 147 | 151 | // Loop through the indexes next... |
| 148 | 152 | foreach ($indexes as $index) |
@@ -150,19 +154,21 @@ discard block |
||
| 150 | 154 | $columns = implode(',', $index['columns']); |
| 151 | 155 | |
| 152 | 156 | // Is it the primary? |
| 153 | - if (isset($index['type']) && $index['type'] == 'primary') |
|
| 154 | - $table_query .= "\n\t" . 'PRIMARY KEY (' . implode(',', $index['columns']) . '),'; |
|
| 155 | - else |
|
| 157 | + if (isset($index['type']) && $index['type'] == 'primary') { |
|
| 158 | + $table_query .= "\n\t" . 'PRIMARY KEY (' . implode(',', $index['columns']) . '),'; |
|
| 159 | + } else |
|
| 156 | 160 | { |
| 157 | - if (empty($index['name'])) |
|
| 158 | - $index['name'] = implode('_', $index['columns']); |
|
| 161 | + if (empty($index['name'])) { |
|
| 162 | + $index['name'] = implode('_', $index['columns']); |
|
| 163 | + } |
|
| 159 | 164 | $table_query .= "\n\t" . (isset($index['type']) && $index['type'] == 'unique' ? 'UNIQUE' : 'KEY') . ' ' . $index['name'] . ' (' . $columns . '),'; |
| 160 | 165 | } |
| 161 | 166 | } |
| 162 | 167 | |
| 163 | 168 | // No trailing commas! |
| 164 | - if (substr($table_query, -1) == ',') |
|
| 165 | - $table_query = substr($table_query, 0, -1); |
|
| 169 | + if (substr($table_query, -1) == ',') { |
|
| 170 | + $table_query = substr($table_query, 0, -1); |
|
| 171 | + } |
|
| 166 | 172 | |
| 167 | 173 | // Which engine do we want here? |
| 168 | 174 | if (empty($engines)) |
@@ -172,8 +178,9 @@ discard block |
||
| 172 | 178 | |
| 173 | 179 | while ($row = $smcFunc['db_fetch_assoc']($get_engines)) |
| 174 | 180 | { |
| 175 | - if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') |
|
| 176 | - $engines[] = $row['Engine']; |
|
| 181 | + if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') { |
|
| 182 | + $engines[] = $row['Engine']; |
|
| 183 | + } |
|
| 177 | 184 | } |
| 178 | 185 | |
| 179 | 186 | $smcFunc['db_free_result']($get_engines); |
@@ -187,8 +194,9 @@ discard block |
||
| 187 | 194 | } |
| 188 | 195 | |
| 189 | 196 | $table_query .= ') ENGINE=' . $parameters['engine']; |
| 190 | - if (!empty($db_character_set) && $db_character_set == 'utf8') |
|
| 191 | - $table_query .= ' DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci'; |
|
| 197 | + if (!empty($db_character_set) && $db_character_set == 'utf8') { |
|
| 198 | + $table_query .= ' DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci'; |
|
| 199 | + } |
|
| 192 | 200 | |
| 193 | 201 | // Create the table! |
| 194 | 202 | $smcFunc['db_query']('', $table_query, |
@@ -255,8 +263,9 @@ discard block |
||
| 255 | 263 | $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); |
| 256 | 264 | |
| 257 | 265 | // God no - dropping one of these = bad. |
| 258 | - if (in_array(strtolower($table_name), $reservedTables)) |
|
| 259 | - return false; |
|
| 266 | + if (in_array(strtolower($table_name), $reservedTables)) { |
|
| 267 | + return false; |
|
| 268 | + } |
|
| 260 | 269 | |
| 261 | 270 | // Does it exist? |
| 262 | 271 | if (in_array($full_table_name, $smcFunc['db_list_tables']())) |
@@ -297,14 +306,16 @@ discard block |
||
| 297 | 306 | |
| 298 | 307 | // Does it exist - if so don't add it again! |
| 299 | 308 | $columns = $smcFunc['db_list_columns']($table_name, false); |
| 300 | - foreach ($columns as $column) |
|
| 301 | - if ($column == $column_info['name']) |
|
| 309 | + foreach ($columns as $column) { |
|
| 310 | + if ($column == $column_info['name']) |
|
| 302 | 311 | { |
| 303 | 312 | // If we're going to overwrite then use change column. |
| 304 | 313 | if ($if_exists == 'update') |
| 305 | 314 | return $smcFunc['db_change_column']($table_name, $column_info['name'], $column_info); |
| 306 | - else |
|
| 307 | - return false; |
|
| 315 | + } |
|
| 316 | + else { |
|
| 317 | + return false; |
|
| 318 | + } |
|
| 308 | 319 | } |
| 309 | 320 | |
| 310 | 321 | // Get the specifics... |
@@ -340,8 +351,8 @@ discard block |
||
| 340 | 351 | |
| 341 | 352 | // Does it exist? |
| 342 | 353 | $columns = $smcFunc['db_list_columns']($table_name, true); |
| 343 | - foreach ($columns as $column) |
|
| 344 | - if ($column['name'] == $column_name) |
|
| 354 | + foreach ($columns as $column) { |
|
| 355 | + if ($column['name'] == $column_name) |
|
| 345 | 356 | { |
| 346 | 357 | $smcFunc['db_query']('', ' |
| 347 | 358 | ALTER TABLE ' . $table_name . ' |
@@ -350,6 +361,7 @@ discard block |
||
| 350 | 361 | 'security_override' => true, |
| 351 | 362 | ) |
| 352 | 363 | ); |
| 364 | + } |
|
| 353 | 365 | |
| 354 | 366 | return true; |
| 355 | 367 | } |
@@ -375,37 +387,47 @@ discard block |
||
| 375 | 387 | // Check it does exist! |
| 376 | 388 | $columns = $smcFunc['db_list_columns']($table_name, true); |
| 377 | 389 | $old_info = null; |
| 378 | - foreach ($columns as $column) |
|
| 379 | - if ($column['name'] == $old_column) |
|
| 390 | + foreach ($columns as $column) { |
|
| 391 | + if ($column['name'] == $old_column) |
|
| 380 | 392 | $old_info = $column; |
| 393 | + } |
|
| 381 | 394 | |
| 382 | 395 | // Nothing? |
| 383 | - if ($old_info == null) |
|
| 384 | - return false; |
|
| 396 | + if ($old_info == null) { |
|
| 397 | + return false; |
|
| 398 | + } |
|
| 385 | 399 | |
| 386 | 400 | // Get the right bits. |
| 387 | - if (!isset($column_info['name'])) |
|
| 388 | - $column_info['name'] = $old_column; |
|
| 389 | - if (!isset($column_info['default'])) |
|
| 390 | - $column_info['default'] = $old_info['default']; |
|
| 391 | - if (!isset($column_info['null'])) |
|
| 392 | - $column_info['null'] = $old_info['null']; |
|
| 393 | - if (!isset($column_info['auto'])) |
|
| 394 | - $column_info['auto'] = $old_info['auto']; |
|
| 395 | - if (!isset($column_info['type'])) |
|
| 396 | - $column_info['type'] = $old_info['type']; |
|
| 397 | - if (!isset($column_info['size']) || !is_numeric($column_info['size'])) |
|
| 398 | - $column_info['size'] = $old_info['size']; |
|
| 399 | - if (!isset($column_info['unsigned']) || !in_array($column_info['type'], array('int', 'tinyint', 'smallint', 'mediumint', 'bigint'))) |
|
| 400 | - $column_info['unsigned'] = ''; |
|
| 401 | + if (!isset($column_info['name'])) { |
|
| 402 | + $column_info['name'] = $old_column; |
|
| 403 | + } |
|
| 404 | + if (!isset($column_info['default'])) { |
|
| 405 | + $column_info['default'] = $old_info['default']; |
|
| 406 | + } |
|
| 407 | + if (!isset($column_info['null'])) { |
|
| 408 | + $column_info['null'] = $old_info['null']; |
|
| 409 | + } |
|
| 410 | + if (!isset($column_info['auto'])) { |
|
| 411 | + $column_info['auto'] = $old_info['auto']; |
|
| 412 | + } |
|
| 413 | + if (!isset($column_info['type'])) { |
|
| 414 | + $column_info['type'] = $old_info['type']; |
|
| 415 | + } |
|
| 416 | + if (!isset($column_info['size']) || !is_numeric($column_info['size'])) { |
|
| 417 | + $column_info['size'] = $old_info['size']; |
|
| 418 | + } |
|
| 419 | + if (!isset($column_info['unsigned']) || !in_array($column_info['type'], array('int', 'tinyint', 'smallint', 'mediumint', 'bigint'))) { |
|
| 420 | + $column_info['unsigned'] = ''; |
|
| 421 | + } |
|
| 401 | 422 | |
| 402 | 423 | list ($type, $size) = $smcFunc['db_calculate_type']($column_info['type'], $column_info['size']); |
| 403 | 424 | |
| 404 | 425 | // Allow for unsigned integers (mysql only) |
| 405 | 426 | $unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint')) && !empty($column_info['unsigned']) ? 'unsigned ' : ''; |
| 406 | 427 | |
| 407 | - if ($size !== null) |
|
| 408 | - $type = $type . '(' . $size . ')'; |
|
| 428 | + if ($size !== null) { |
|
| 429 | + $type = $type . '(' . $size . ')'; |
|
| 430 | + } |
|
| 409 | 431 | |
| 410 | 432 | $smcFunc['db_query']('', ' |
| 411 | 433 | ALTER TABLE ' . $table_name . ' |
@@ -435,18 +457,20 @@ discard block |
||
| 435 | 457 | $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); |
| 436 | 458 | |
| 437 | 459 | // No columns = no index. |
| 438 | - if (empty($index_info['columns'])) |
|
| 439 | - return false; |
|
| 460 | + if (empty($index_info['columns'])) { |
|
| 461 | + return false; |
|
| 462 | + } |
|
| 440 | 463 | $columns = implode(',', $index_info['columns']); |
| 441 | 464 | |
| 442 | 465 | // No name - make it up! |
| 443 | 466 | if (empty($index_info['name'])) |
| 444 | 467 | { |
| 445 | 468 | // No need for primary. |
| 446 | - if (isset($index_info['type']) && $index_info['type'] == 'primary') |
|
| 447 | - $index_info['name'] = ''; |
|
| 448 | - else |
|
| 449 | - $index_info['name'] = implode('_', $index_info['columns']); |
|
| 469 | + if (isset($index_info['type']) && $index_info['type'] == 'primary') { |
|
| 470 | + $index_info['name'] = ''; |
|
| 471 | + } else { |
|
| 472 | + $index_info['name'] = implode('_', $index_info['columns']); |
|
| 473 | + } |
|
| 450 | 474 | } |
| 451 | 475 | |
| 452 | 476 | // Log that we are going to want to remove this! |
@@ -460,10 +484,11 @@ discard block |
||
| 460 | 484 | if ($index['name'] == $index_info['name'] || ($index['type'] == 'primary' && isset($index_info['type']) && $index_info['type'] == 'primary')) |
| 461 | 485 | { |
| 462 | 486 | // If we want to overwrite simply remove the current one then continue. |
| 463 | - if ($if_exists != 'update' || $index['type'] == 'primary') |
|
| 464 | - return false; |
|
| 465 | - else |
|
| 466 | - $smcFunc['db_remove_index']($table_name, $index_info['name']); |
|
| 487 | + if ($if_exists != 'update' || $index['type'] == 'primary') { |
|
| 488 | + return false; |
|
| 489 | + } else { |
|
| 490 | + $smcFunc['db_remove_index']($table_name, $index_info['name']); |
|
| 491 | + } |
|
| 467 | 492 | } |
| 468 | 493 | } |
| 469 | 494 | |
@@ -477,8 +502,7 @@ discard block |
||
| 477 | 502 | 'security_override' => true, |
| 478 | 503 | ) |
| 479 | 504 | ); |
| 480 | - } |
|
| 481 | - else |
|
| 505 | + } else |
|
| 482 | 506 | { |
| 483 | 507 | $smcFunc['db_query']('', ' |
| 484 | 508 | ALTER TABLE ' . $table_name . ' |
@@ -562,8 +586,7 @@ discard block |
||
| 562 | 586 | $types = array( |
| 563 | 587 | 'inet' => 'varbinary', |
| 564 | 588 | ); |
| 565 | - } |
|
| 566 | - else |
|
| 589 | + } else |
|
| 567 | 590 | { |
| 568 | 591 | $types = array( |
| 569 | 592 | 'varbinary' => 'inet', |
@@ -577,16 +600,15 @@ discard block |
||
| 577 | 600 | { |
| 578 | 601 | $type_size = 16; |
| 579 | 602 | $type_name = 'varbinary'; |
| 580 | - } |
|
| 581 | - elseif ($type_name == 'varbinary' && $reverse && $type_size == 16) |
|
| 603 | + } elseif ($type_name == 'varbinary' && $reverse && $type_size == 16) |
|
| 582 | 604 | { |
| 583 | 605 | $type_name = 'inet'; |
| 584 | 606 | $type_size = null; |
| 607 | + } elseif ($type_name == 'varbinary') { |
|
| 608 | + $type_name = 'varbinary'; |
|
| 609 | + } else { |
|
| 610 | + $type_name = $types[$type_name]; |
|
| 585 | 611 | } |
| 586 | - elseif ($type_name == 'varbinary') |
|
| 587 | - $type_name = 'varbinary'; |
|
| 588 | - else |
|
| 589 | - $type_name = $types[$type_name]; |
|
| 590 | 612 | } |
| 591 | 613 | |
| 592 | 614 | return array($type_name, $type_size); |
@@ -653,8 +675,7 @@ discard block |
||
| 653 | 675 | if (!$detail) |
| 654 | 676 | { |
| 655 | 677 | $columns[] = $row['Field']; |
| 656 | - } |
|
| 657 | - else |
|
| 678 | + } else |
|
| 658 | 679 | { |
| 659 | 680 | // Is there an auto_increment? |
| 660 | 681 | $auto = strpos($row['Extra'], 'auto_increment') !== false ? true : false; |
@@ -664,10 +685,10 @@ discard block |
||
| 664 | 685 | { |
| 665 | 686 | $type = $matches[1]; |
| 666 | 687 | $size = $matches[2]; |
| 667 | - if (!empty($matches[3]) && $matches[3] == 'unsigned') |
|
| 668 | - $unsigned = true; |
|
| 669 | - } |
|
| 670 | - else |
|
| 688 | + if (!empty($matches[3]) && $matches[3] == 'unsigned') { |
|
| 689 | + $unsigned = true; |
|
| 690 | + } |
|
| 691 | + } else |
|
| 671 | 692 | { |
| 672 | 693 | $type = $row['Type']; |
| 673 | 694 | $size = null; |
@@ -718,19 +739,20 @@ discard block |
||
| 718 | 739 | $indexes = array(); |
| 719 | 740 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
| 720 | 741 | { |
| 721 | - if (!$detail) |
|
| 722 | - $indexes[] = $row['Key_name']; |
|
| 723 | - else |
|
| 742 | + if (!$detail) { |
|
| 743 | + $indexes[] = $row['Key_name']; |
|
| 744 | + } else |
|
| 724 | 745 | { |
| 725 | 746 | // What is the type? |
| 726 | - if ($row['Key_name'] == 'PRIMARY') |
|
| 727 | - $type = 'primary'; |
|
| 728 | - elseif (empty($row['Non_unique'])) |
|
| 729 | - $type = 'unique'; |
|
| 730 | - elseif (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT') |
|
| 731 | - $type = 'fulltext'; |
|
| 732 | - else |
|
| 733 | - $type = 'index'; |
|
| 747 | + if ($row['Key_name'] == 'PRIMARY') { |
|
| 748 | + $type = 'primary'; |
|
| 749 | + } elseif (empty($row['Non_unique'])) { |
|
| 750 | + $type = 'unique'; |
|
| 751 | + } elseif (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT') { |
|
| 752 | + $type = 'fulltext'; |
|
| 753 | + } else { |
|
| 754 | + $type = 'index'; |
|
| 755 | + } |
|
| 734 | 756 | |
| 735 | 757 | // This is the first column we've seen? |
| 736 | 758 | if (empty($indexes[$row['Key_name']])) |
@@ -743,10 +765,11 @@ discard block |
||
| 743 | 765 | } |
| 744 | 766 | |
| 745 | 767 | // Is it a partial index? |
| 746 | - if (!empty($row['Sub_part'])) |
|
| 747 | - $indexes[$row['Key_name']]['columns'][] = $row['Column_name'] . '(' . $row['Sub_part'] . ')'; |
|
| 748 | - else |
|
| 749 | - $indexes[$row['Key_name']]['columns'][] = $row['Column_name']; |
|
| 768 | + if (!empty($row['Sub_part'])) { |
|
| 769 | + $indexes[$row['Key_name']]['columns'][] = $row['Column_name'] . '(' . $row['Sub_part'] . ')'; |
|
| 770 | + } else { |
|
| 771 | + $indexes[$row['Key_name']]['columns'][] = $row['Column_name']; |
|
| 772 | + } |
|
| 750 | 773 | } |
| 751 | 774 | } |
| 752 | 775 | $smcFunc['db_free_result']($result); |
@@ -768,11 +791,11 @@ discard block |
||
| 768 | 791 | if (!empty($column['auto'])) |
| 769 | 792 | { |
| 770 | 793 | $default = 'auto_increment'; |
| 794 | + } elseif (isset($column['default']) && $column['default'] !== null) { |
|
| 795 | + $default = 'default \'' . $smcFunc['db_escape_string']($column['default']) . '\''; |
|
| 796 | + } else { |
|
| 797 | + $default = ''; |
|
| 771 | 798 | } |
| 772 | - elseif (isset($column['default']) && $column['default'] !== null) |
|
| 773 | - $default = 'default \'' . $smcFunc['db_escape_string']($column['default']) . '\''; |
|
| 774 | - else |
|
| 775 | - $default = ''; |
|
| 776 | 799 | |
| 777 | 800 | // Sort out the size... and stuff... |
| 778 | 801 | $column['size'] = isset($column['size']) && is_numeric($column['size']) ? $column['size'] : null; |
@@ -781,8 +804,9 @@ discard block |
||
| 781 | 804 | // Allow unsigned integers (mysql only) |
| 782 | 805 | $unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint')) && !empty($column['unsigned']) ? 'unsigned ' : ''; |
| 783 | 806 | |
| 784 | - if ($size !== null) |
|
| 785 | - $type = $type . '(' . $size . ')'; |
|
| 807 | + if ($size !== null) { |
|
| 808 | + $type = $type . '(' . $size . ')'; |
|
| 809 | + } |
|
| 786 | 810 | |
| 787 | 811 | // Now just put it together! |
| 788 | 812 | return '`' . $column['name'] . '` ' . $type . ' ' . (!empty($unsigned) ? $unsigned : '') . (!empty($column['null']) ? '' : 'NOT NULL') . ' ' . $default; |
@@ -18,9 +18,10 @@ discard block |
||
| 18 | 18 | global $context, $txt, $scripturl; |
| 19 | 19 | |
| 20 | 20 | // Are we done sending the newsletter? |
| 21 | - if (!empty($context['newsletter_sent'])) |
|
| 22 | - echo ' |
|
| 21 | + if (!empty($context['newsletter_sent'])) { |
|
| 22 | + echo ' |
|
| 23 | 23 | <div class="infobox">', $txt['admin_news_newsletter_' . $context['newsletter_sent']], '</div>'; |
| 24 | + } |
|
| 24 | 25 | |
| 25 | 26 | echo ' |
| 26 | 27 | <div id="admincenter"> |
@@ -39,9 +40,10 @@ discard block |
||
| 39 | 40 | </dt> |
| 40 | 41 | <dd>'; |
| 41 | 42 | |
| 42 | - foreach ($context['groups'] as $group) |
|
| 43 | - echo ' |
|
| 43 | + foreach ($context['groups'] as $group) { |
|
| 44 | + echo ' |
|
| 44 | 45 | <label for="groups_', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups_', $group['id'], '" value="', $group['id'], '" checked> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>'; |
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | echo ' |
| 47 | 49 | <br> |
@@ -82,9 +84,10 @@ discard block |
||
| 82 | 84 | </dt> |
| 83 | 85 | <dd>'; |
| 84 | 86 | |
| 85 | - foreach ($context['groups'] as $group) |
|
| 86 | - echo ' |
|
| 87 | + foreach ($context['groups'] as $group) { |
|
| 88 | + echo ' |
|
| 87 | 89 | <label for="exclude_groups_', $group['id'], '"><input type="checkbox" name="exclude_groups[', $group['id'], ']" id="exclude_groups_', $group['id'], '" value="', $group['id'], '"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>'; |
| 90 | + } |
|
| 88 | 91 | |
| 89 | 92 | echo ' |
| 90 | 93 | <br> |
@@ -230,9 +233,10 @@ discard block |
||
| 230 | 233 | <div id="bbcBox_message"></div>'; |
| 231 | 234 | |
| 232 | 235 | // What about smileys? |
| 233 | - if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) |
|
| 234 | - echo ' |
|
| 236 | + if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) { |
|
| 237 | + echo ' |
|
| 235 | 238 | <div id="smileyBox_message"></div>'; |
| 239 | + } |
|
| 236 | 240 | |
| 237 | 241 | // Show BBC buttons, smileys and textbox. |
| 238 | 242 | echo ' |
@@ -253,9 +257,10 @@ discard block |
||
| 253 | 257 | <input type="hidden" name="email_force" value="', $context['email_force'], '"> |
| 254 | 258 | <input type="hidden" name="total_emails" value="', $context['total_emails'], '">'; |
| 255 | 259 | |
| 256 | - foreach ($context['recipients'] as $key => $values) |
|
| 257 | - echo ' |
|
| 260 | + foreach ($context['recipients'] as $key => $values) { |
|
| 261 | + echo ' |
|
| 258 | 262 | <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">'; |
| 263 | + } |
|
| 259 | 264 | |
| 260 | 265 | echo ' |
| 261 | 266 | <script>'; |
@@ -411,9 +416,10 @@ discard block |
||
| 411 | 416 | <input type="hidden" name="parse_html" value="', $context['parse_html'], '">'; |
| 412 | 417 | |
| 413 | 418 | // All the things we must remember! |
| 414 | - foreach ($context['recipients'] as $key => $values) |
|
| 415 | - echo ' |
|
| 419 | + foreach ($context['recipients'] as $key => $values) { |
|
| 420 | + echo ' |
|
| 416 | 421 | <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">'; |
| 422 | + } |
|
| 417 | 423 | |
| 418 | 424 | echo ' |
| 419 | 425 | </div><!-- .windowbg --> |
@@ -446,9 +452,10 @@ discard block |
||
| 446 | 452 | { |
| 447 | 453 | global $context, $txt; |
| 448 | 454 | |
| 449 | - if (!empty($context['saved_successful'])) |
|
| 450 | - echo ' |
|
| 455 | + if (!empty($context['saved_successful'])) { |
|
| 456 | + echo ' |
|
| 451 | 457 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
| 458 | + } |
|
| 452 | 459 | |
| 453 | 460 | template_show_list('news_lists'); |
| 454 | 461 | } |
@@ -44,10 +44,11 @@ discard block |
||
| 44 | 44 | <dt>', $txt['users_online_today'], ':</dt> |
| 45 | 45 | <dd>', $context['online_today'], '</dd>'; |
| 46 | 46 | |
| 47 | - if (!empty($modSettings['hitStats'])) |
|
| 48 | - echo ' |
|
| 47 | + if (!empty($modSettings['hitStats'])) { |
|
| 48 | + echo ' |
|
| 49 | 49 | <dt>', $txt['num_hits'], ':</dt> |
| 50 | 50 | <dd>', $context['num_hits'], '</dd>'; |
| 51 | + } |
|
| 51 | 52 | |
| 52 | 53 | echo ' |
| 53 | 54 | </dl> |
@@ -71,17 +72,19 @@ discard block |
||
| 71 | 72 | <dt>', $txt['gender_stats'], ':</dt> |
| 72 | 73 | <dd>'; |
| 73 | 74 | |
| 74 | - foreach ($context['gender'] as $g => $n) |
|
| 75 | - echo $g, ': ', $n, '<br>'; |
|
| 75 | + foreach ($context['gender'] as $g => $n) { |
|
| 76 | + echo $g, ': ', $n, '<br>'; |
|
| 77 | + } |
|
| 76 | 78 | |
| 77 | 79 | echo ' |
| 78 | 80 | </dd>'; |
| 79 | 81 | } |
| 80 | 82 | |
| 81 | - if (!empty($modSettings['hitStats'])) |
|
| 82 | - echo ' |
|
| 83 | + if (!empty($modSettings['hitStats'])) { |
|
| 84 | + echo ' |
|
| 83 | 85 | <dt>', $txt['average_hits'], ':</dt> |
| 84 | 86 | <dd>', $context['average_hits'], '</dd>'; |
| 87 | + } |
|
| 85 | 88 | |
| 86 | 89 | echo ' |
| 87 | 90 | </dl>'; |
@@ -105,14 +108,15 @@ discard block |
||
| 105 | 108 | </dt> |
| 106 | 109 | <dd class="statsbar">'; |
| 107 | 110 | |
| 108 | - if (!empty($item['percent'])) |
|
| 109 | - echo ' |
|
| 111 | + if (!empty($item['percent'])) { |
|
| 112 | + echo ' |
|
| 110 | 113 | <div class="bar" style="width: ', $item['percent'], '%;"> |
| 111 | 114 | <span class="righttext">', $item['num'], '</span> |
| 112 | 115 | </div>'; |
| 113 | - else |
|
| 114 | - echo ' |
|
| 116 | + } else { |
|
| 117 | + echo ' |
|
| 115 | 118 | <div class="bar empty"><span class="righttext">', $item['num'], '</span></div>'; |
| 119 | + } |
|
| 116 | 120 | |
| 117 | 121 | echo ' |
| 118 | 122 | </dd>'; |
@@ -144,9 +148,10 @@ discard block |
||
| 144 | 148 | <th>', $txt['stats_new_members'], '</th> |
| 145 | 149 | <th>', $txt['most_online'], '</th>'; |
| 146 | 150 | |
| 147 | - if (!empty($modSettings['hitStats'])) |
|
| 148 | - echo ' |
|
| 151 | + if (!empty($modSettings['hitStats'])) { |
|
| 152 | + echo ' |
|
| 149 | 153 | <th>', $txt['page_views'], '</th>'; |
| 154 | + } |
|
| 150 | 155 | |
| 151 | 156 | echo ' |
| 152 | 157 | </tr> |
@@ -165,9 +170,10 @@ discard block |
||
| 165 | 170 | <th>', $year['new_members'], '</th> |
| 166 | 171 | <th>', $year['most_members_online'], '</th>'; |
| 167 | 172 | |
| 168 | - if (!empty($modSettings['hitStats'])) |
|
| 169 | - echo ' |
|
| 173 | + if (!empty($modSettings['hitStats'])) { |
|
| 174 | + echo ' |
|
| 170 | 175 | <th>', $year['hits'], '</th>'; |
| 176 | + } |
|
| 171 | 177 | |
| 172 | 178 | echo ' |
| 173 | 179 | </tr>'; |
@@ -184,9 +190,10 @@ discard block |
||
| 184 | 190 | <th>', $month['new_members'], '</th> |
| 185 | 191 | <th>', $month['most_members_online'], '</th>'; |
| 186 | 192 | |
| 187 | - if (!empty($modSettings['hitStats'])) |
|
| 188 | - echo ' |
|
| 193 | + if (!empty($modSettings['hitStats'])) { |
|
| 194 | + echo ' |
|
| 189 | 195 | <th>', $month['hits'], '</th>'; |
| 196 | + } |
|
| 190 | 197 | |
| 191 | 198 | echo ' |
| 192 | 199 | </tr>'; |
@@ -203,9 +210,10 @@ discard block |
||
| 203 | 210 | <td>', $day['new_members'], '</td> |
| 204 | 211 | <td>', $day['most_members_online'], '</td>'; |
| 205 | 212 | |
| 206 | - if (!empty($modSettings['hitStats'])) |
|
| 207 | - echo ' |
|
| 213 | + if (!empty($modSettings['hitStats'])) { |
|
| 214 | + echo ' |
|
| 208 | 215 | <td>', $day['hits'], '</td>'; |
| 216 | + } |
|
| 209 | 217 | |
| 210 | 218 | echo ' |
| 211 | 219 | </tr>'; |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | <h3 class="catbg">', $context['page_title'], '</h3> |
| 47 | 47 | </div>'; |
| 48 | 48 | |
| 49 | - if (!empty($context['poll_error']['messages'])) |
|
| 50 | - echo ' |
|
| 49 | + if (!empty($context['poll_error']['messages'])) { |
|
| 50 | + echo ' |
|
| 51 | 51 | <div class="errorbox"> |
| 52 | 52 | <dl class="poll_error"> |
| 53 | 53 | <dt> |
@@ -58,6 +58,7 @@ discard block |
||
| 58 | 58 | </dt> |
| 59 | 59 | </dl> |
| 60 | 60 | </div>'; |
| 61 | + } |
|
| 61 | 62 | |
| 62 | 63 | echo ' |
| 63 | 64 | <div> |
@@ -79,8 +80,9 @@ discard block |
||
| 79 | 80 | <input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" size="80" maxlength="255">'; |
| 80 | 81 | |
| 81 | 82 | // Does this option have a vote count yet, or is it new? |
| 82 | - if ($choice['votes'] != -1) |
|
| 83 | - echo ' (', $choice['votes'], ' ', $txt['votes'], ')'; |
|
| 83 | + if ($choice['votes'] != -1) { |
|
| 84 | + echo ' (', $choice['votes'], ' ', $txt['votes'], ')'; |
|
| 85 | + } |
|
| 84 | 86 | |
| 85 | 87 | echo ' |
| 86 | 88 | </dd>'; |
@@ -118,14 +120,15 @@ discard block |
||
| 118 | 120 | <input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked' : '', '> |
| 119 | 121 | </dd>'; |
| 120 | 122 | |
| 121 | - if ($context['poll']['guest_vote_allowed']) |
|
| 122 | - echo ' |
|
| 123 | + if ($context['poll']['guest_vote_allowed']) { |
|
| 124 | + echo ' |
|
| 123 | 125 | <dt> |
| 124 | 126 | <label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label> |
| 125 | 127 | </dt> |
| 126 | 128 | <dd> |
| 127 | 129 | <input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll']['guest_vote']) ? ' checked' : '', '> |
| 128 | 130 | </dd>'; |
| 131 | + } |
|
| 129 | 132 | } |
| 130 | 133 | |
| 131 | 134 | echo ' |
@@ -141,12 +144,13 @@ discard block |
||
| 141 | 144 | </fieldset>'; |
| 142 | 145 | |
| 143 | 146 | // If this is an edit, we can allow them to reset the vote counts. |
| 144 | - if ($context['is_edit']) |
|
| 145 | - echo ' |
|
| 147 | + if ($context['is_edit']) { |
|
| 148 | + echo ' |
|
| 146 | 149 | <fieldset id="poll_reset"> |
| 147 | 150 | <legend>', $txt['reset_votes'], '</legend> |
| 148 | 151 | <input type="checkbox" name="resetVoteCount" value="on"> ' . $txt['reset_votes_check'] . ' |
| 149 | 152 | </fieldset>'; |
| 153 | + } |
|
| 150 | 154 | echo ' |
| 151 | 155 | <input type="submit" name="post" value="', $txt['save'], '" onclick="return submitThisOnce(this);" accesskey="s" class="button"> |
| 152 | 156 | </div><!-- .roundframe --> |
@@ -148,8 +148,8 @@ discard block |
||
| 148 | 148 | </thead> |
| 149 | 149 | <tbody>'; |
| 150 | 150 | |
| 151 | - foreach ($context['membergroups'] as $membergroup) |
|
| 152 | - echo ' |
|
| 151 | + foreach ($context['membergroups'] as $membergroup) { |
|
| 152 | + echo ' |
|
| 153 | 153 | <tr class="windowbg"> |
| 154 | 154 | <td>', $membergroup['name'], '</td> |
| 155 | 155 | <td class="centercol"> |
@@ -159,6 +159,7 @@ discard block |
||
| 159 | 159 | ', $membergroup['can_be_additional'] ? '<input type="checkbox" name="membergroups[2][]" value="' . $membergroup['id'] . '" checked>' : '', ' |
| 160 | 160 | </td> |
| 161 | 161 | </tr>'; |
| 162 | + } |
|
| 162 | 163 | |
| 163 | 164 | echo ' |
| 164 | 165 | <tr class="windowbg"> |
@@ -185,8 +186,8 @@ discard block |
||
| 185 | 186 | </thead> |
| 186 | 187 | <tbody>'; |
| 187 | 188 | |
| 188 | - foreach ($context['postgroups'] as $postgroup) |
|
| 189 | - echo ' |
|
| 189 | + foreach ($context['postgroups'] as $postgroup) { |
|
| 190 | + echo ' |
|
| 190 | 191 | <tr class="windowbg"> |
| 191 | 192 | <td> |
| 192 | 193 | ', $postgroup['name'], ' |
@@ -195,6 +196,7 @@ discard block |
||
| 195 | 196 | <input type="checkbox" name="postgroups[]" value="', $postgroup['id'], '" checked> |
| 196 | 197 | </td> |
| 197 | 198 | </tr>'; |
| 199 | + } |
|
| 198 | 200 | |
| 199 | 201 | echo ' |
| 200 | 202 | <tr class="windowbg"> |
@@ -144,11 +144,12 @@ discard block |
||
| 144 | 144 | <div class="question">', $txt['poll_question'], ': <strong>', $context['poll']['question'], '</strong>'; |
| 145 | 145 | |
| 146 | 146 | $options = 1; |
| 147 | - foreach ($context['poll']['options'] as $option) |
|
| 148 | - echo ' |
|
| 147 | + foreach ($context['poll']['options'] as $option) { |
|
| 148 | + echo ' |
|
| 149 | 149 | <div class="', $option['voted_this'] ? 'voted' : '', '">', $txt['option'], ' ', $options++, ': <strong>', $option['option'], '</strong> |
| 150 | 150 | ', $context['allow_poll_view'] ? $txt['votes'] . ': ' . $option['votes'] . '' : '', ' |
| 151 | 151 | </div>'; |
| 152 | + } |
|
| 152 | 153 | |
| 153 | 154 | echo ' |
| 154 | 155 | </div>'; |
@@ -170,9 +171,10 @@ discard block |
||
| 170 | 171 | echo ' |
| 171 | 172 | <hr>'; |
| 172 | 173 | |
| 173 | - foreach ($context['printattach'][$post['id_msg']] as $attach) |
|
| 174 | - echo ' |
|
| 174 | + foreach ($context['printattach'][$post['id_msg']] as $attach) { |
|
| 175 | + echo ' |
|
| 175 | 176 | <img width="' . $attach['width'] . '" height="' . $attach['height'] . '" src="', $scripturl . '?action=dlattach;topic=' . $topic . '.0;attach=' . $attach['id_attach'] . '" alt="">'; |
| 177 | + } |
|
| 176 | 178 | } |
| 177 | 179 | |
| 178 | 180 | echo ' |
@@ -207,12 +209,13 @@ discard block |
||
| 207 | 209 | <div class="print_options">'; |
| 208 | 210 | |
| 209 | 211 | // Which option is set, text or text&images |
| 210 | - if (isset($_REQUEST['images'])) |
|
| 211 | - echo ' |
|
| 212 | + if (isset($_REQUEST['images'])) { |
|
| 213 | + echo ' |
|
| 212 | 214 | <a href="', $url_text, '">', $txt['print_page_text'], '</a> | <strong><a href="', $url_images, '">', $txt['print_page_images'], '</a></strong>'; |
| 213 | - else |
|
| 214 | - echo ' |
|
| 215 | + } else { |
|
| 216 | + echo ' |
|
| 215 | 217 | <strong><a href="', $url_text, '">', $txt['print_page_text'], '</a></strong> | <a href="', $url_images, '">', $txt['print_page_images'], '</a>'; |
| 218 | + } |
|
| 216 | 219 | |
| 217 | 220 | echo ' |
| 218 | 221 | </div><!-- .print_options -->'; |
@@ -26,9 +26,10 @@ discard block |
||
| 26 | 26 | </div> |
| 27 | 27 | <div class="pagesection">', $context['page_index'], '</div>'; |
| 28 | 28 | |
| 29 | - if (empty($context['posts'])) |
|
| 30 | - echo ' |
|
| 29 | + if (empty($context['posts'])) { |
|
| 30 | + echo ' |
|
| 31 | 31 | <div class="windowbg">', $txt['no_messages'], '</div>'; |
| 32 | + } |
|
| 32 | 33 | |
| 33 | 34 | foreach ($context['posts'] as $post) |
| 34 | 35 | { |
@@ -41,28 +42,33 @@ discard block |
||
| 41 | 42 | </div> |
| 42 | 43 | <div class="list_posts">', $post['message'], '</div>'; |
| 43 | 44 | |
| 44 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
| 45 | - echo ' |
|
| 45 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
| 46 | + echo ' |
|
| 46 | 47 | <ul class="quickbuttons">'; |
| 48 | + } |
|
| 47 | 49 | |
| 48 | 50 | // If they *can* reply? |
| 49 | - if ($post['can_reply']) |
|
| 50 | - echo ' |
|
| 51 | + if ($post['can_reply']) { |
|
| 52 | + echo ' |
|
| 51 | 53 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
| 54 | + } |
|
| 52 | 55 | |
| 53 | 56 | // If they *can* quote? |
| 54 | - if ($post['can_quote']) |
|
| 55 | - echo ' |
|
| 57 | + if ($post['can_quote']) { |
|
| 58 | + echo ' |
|
| 56 | 59 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
| 60 | + } |
|
| 57 | 61 | |
| 58 | 62 | // How about... even... remove it entirely?! |
| 59 | - if ($post['can_delete']) |
|
| 60 | - echo ' |
|
| 63 | + if ($post['can_delete']) { |
|
| 64 | + echo ' |
|
| 61 | 65 | <li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';recent;', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
| 66 | + } |
|
| 62 | 67 | |
| 63 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
| 64 | - echo ' |
|
| 68 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
| 69 | + echo ' |
|
| 65 | 70 | </ul>'; |
| 71 | + } |
|
| 66 | 72 | |
| 67 | 73 | echo ' |
| 68 | 74 | </div><!-- $post[css_class] -->'; |
@@ -84,12 +90,13 @@ discard block |
||
| 84 | 90 | echo ' |
| 85 | 91 | <div id="recent" class="main_content">'; |
| 86 | 92 | |
| 87 | - if ($context['showCheckboxes']) |
|
| 88 | - echo ' |
|
| 93 | + if ($context['showCheckboxes']) { |
|
| 94 | + echo ' |
|
| 89 | 95 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm"> |
| 90 | 96 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 91 | 97 | <input type="hidden" name="qaction" value="markread"> |
| 92 | 98 | <input type="hidden" name="redirect_url" value="action=unread', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '">'; |
| 99 | + } |
|
| 93 | 100 | |
| 94 | 101 | if (!empty($context['topics'])) |
| 95 | 102 | { |
@@ -118,11 +125,12 @@ discard block |
||
| 118 | 125 | </div>'; |
| 119 | 126 | |
| 120 | 127 | // Show a "select all" box for quick moderation? |
| 121 | - if ($context['showCheckboxes']) |
|
| 122 | - echo ' |
|
| 128 | + if ($context['showCheckboxes']) { |
|
| 129 | + echo ' |
|
| 123 | 130 | <div class="moderation"> |
| 124 | 131 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');"> |
| 125 | 132 | </div>'; |
| 133 | + } |
|
| 126 | 134 | |
| 127 | 135 | echo ' |
| 128 | 136 | </div><!-- #topic_header --> |
@@ -142,17 +150,20 @@ discard block |
||
| 142 | 150 | echo ' |
| 143 | 151 | <div class="icons floatright">'; |
| 144 | 152 | |
| 145 | - if ($topic['is_locked']) |
|
| 146 | - echo ' |
|
| 153 | + if ($topic['is_locked']) { |
|
| 154 | + echo ' |
|
| 147 | 155 | <span class="generic_icons lock"></span>'; |
| 156 | + } |
|
| 148 | 157 | |
| 149 | - if ($topic['is_sticky']) |
|
| 150 | - echo ' |
|
| 158 | + if ($topic['is_sticky']) { |
|
| 159 | + echo ' |
|
| 151 | 160 | <span class="generic_icons sticky"></span>'; |
| 161 | + } |
|
| 152 | 162 | |
| 153 | - if ($topic['is_poll']) |
|
| 154 | - echo ' |
|
| 163 | + if ($topic['is_poll']) { |
|
| 164 | + echo ' |
|
| 155 | 165 | <span class="generic_icons poll"></span>'; |
| 166 | + } |
|
| 156 | 167 | |
| 157 | 168 | echo ' |
| 158 | 169 | </div>'; |
@@ -178,19 +189,21 @@ discard block |
||
| 178 | 189 | ', sprintf($txt['last_post_topic'], '<a href="' . $topic['last_post']['href'] . '">' . $topic['last_post']['time'] . '</a>', $topic['last_post']['member']['link']), ' |
| 179 | 190 | </div>'; |
| 180 | 191 | |
| 181 | - if ($context['showCheckboxes']) |
|
| 182 | - echo ' |
|
| 192 | + if ($context['showCheckboxes']) { |
|
| 193 | + echo ' |
|
| 183 | 194 | <div class="moderation"> |
| 184 | 195 | <input type="checkbox" name="topics[]" value="', $topic['id'], '"> |
| 185 | 196 | </div>'; |
| 197 | + } |
|
| 186 | 198 | |
| 187 | 199 | echo ' |
| 188 | 200 | </div><!-- $topic[css_class] -->'; |
| 189 | 201 | } |
| 190 | 202 | |
| 191 | - if (empty($context['topics'])) |
|
| 192 | - echo ' |
|
| 203 | + if (empty($context['topics'])) { |
|
| 204 | + echo ' |
|
| 193 | 205 | <div style="display: none;"></div>'; |
| 206 | + } |
|
| 194 | 207 | |
| 195 | 208 | echo ' |
| 196 | 209 | </div><!-- #topic_container --> |
@@ -205,25 +218,27 @@ discard block |
||
| 205 | 218 | ', $context['page_index'], ' |
| 206 | 219 | </div> |
| 207 | 220 | </div>'; |
| 208 | - } |
|
| 209 | - else |
|
| 210 | - echo ' |
|
| 221 | + } else { |
|
| 222 | + echo ' |
|
| 211 | 223 | <div class="cat_bar"> |
| 212 | 224 | <h3 class="catbg centertext"> |
| 213 | 225 | ', $context['showing_all_topics'] ? $txt['topic_alert_none'] : $txt['unread_topics_visit_none'], ' |
| 214 | 226 | </h3> |
| 215 | 227 | </div>'; |
| 228 | + } |
|
| 216 | 229 | |
| 217 | - if ($context['showCheckboxes']) |
|
| 218 | - echo ' |
|
| 230 | + if ($context['showCheckboxes']) { |
|
| 231 | + echo ' |
|
| 219 | 232 | </form>'; |
| 233 | + } |
|
| 220 | 234 | |
| 221 | 235 | echo ' |
| 222 | 236 | </div><!-- #recent -->'; |
| 223 | 237 | |
| 224 | - if (empty($context['no_topic_listing'])) |
|
| 225 | - template_topic_legend(); |
|
| 226 | -} |
|
| 238 | + if (empty($context['no_topic_listing'])) { |
|
| 239 | + template_topic_legend(); |
|
| 240 | + } |
|
| 241 | + } |
|
| 227 | 242 | |
| 228 | 243 | /** |
| 229 | 244 | * Template for showing unread replies (eg new replies to topics you've posted in) |
@@ -235,12 +250,13 @@ discard block |
||
| 235 | 250 | echo ' |
| 236 | 251 | <div id="recent">'; |
| 237 | 252 | |
| 238 | - if ($context['showCheckboxes']) |
|
| 239 | - echo ' |
|
| 253 | + if ($context['showCheckboxes']) { |
|
| 254 | + echo ' |
|
| 240 | 255 | <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm"> |
| 241 | 256 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 242 | 257 | <input type="hidden" name="qaction" value="markread"> |
| 243 | 258 | <input type="hidden" name="redirect_url" value="action=unreadreplies', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '">'; |
| 259 | + } |
|
| 244 | 260 | |
| 245 | 261 | if (!empty($context['topics'])) |
| 246 | 262 | { |
@@ -269,11 +285,12 @@ discard block |
||
| 269 | 285 | </div>'; |
| 270 | 286 | |
| 271 | 287 | // Show a "select all" box for quick moderation? |
| 272 | - if ($context['showCheckboxes']) |
|
| 273 | - echo ' |
|
| 288 | + if ($context['showCheckboxes']) { |
|
| 289 | + echo ' |
|
| 274 | 290 | <div class="moderation"> |
| 275 | 291 | <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');"> |
| 276 | 292 | </div>'; |
| 293 | + } |
|
| 277 | 294 | |
| 278 | 295 | echo ' |
| 279 | 296 | </div><!-- #topic_header --> |
@@ -293,17 +310,20 @@ discard block |
||
| 293 | 310 | echo ' |
| 294 | 311 | <div class="icons floatright">'; |
| 295 | 312 | |
| 296 | - if ($topic['is_locked']) |
|
| 297 | - echo ' |
|
| 313 | + if ($topic['is_locked']) { |
|
| 314 | + echo ' |
|
| 298 | 315 | <span class="generic_icons lock"></span>'; |
| 316 | + } |
|
| 299 | 317 | |
| 300 | - if ($topic['is_sticky']) |
|
| 301 | - echo ' |
|
| 318 | + if ($topic['is_sticky']) { |
|
| 319 | + echo ' |
|
| 302 | 320 | <span class="generic_icons sticky"></span>'; |
| 321 | + } |
|
| 303 | 322 | |
| 304 | - if ($topic['is_poll']) |
|
| 305 | - echo ' |
|
| 323 | + if ($topic['is_poll']) { |
|
| 324 | + echo ' |
|
| 306 | 325 | <span class="generic_icons poll"></span>'; |
| 326 | + } |
|
| 307 | 327 | |
| 308 | 328 | echo ' |
| 309 | 329 | </div>'; |
@@ -329,11 +349,12 @@ discard block |
||
| 329 | 349 | ', sprintf($txt['last_post_topic'], '<a href="' . $topic['last_post']['href'] . '">' . $topic['last_post']['time'] . '</a>', $topic['last_post']['member']['link']), ' |
| 330 | 350 | </div>'; |
| 331 | 351 | |
| 332 | - if ($context['showCheckboxes']) |
|
| 333 | - echo ' |
|
| 352 | + if ($context['showCheckboxes']) { |
|
| 353 | + echo ' |
|
| 334 | 354 | <div class="moderation"> |
| 335 | 355 | <input type="checkbox" name="topics[]" value="', $topic['id'], '"> |
| 336 | 356 | </div>'; |
| 357 | + } |
|
| 337 | 358 | |
| 338 | 359 | echo ' |
| 339 | 360 | </div><!-- $topic[css_class] -->'; |
@@ -350,24 +371,26 @@ discard block |
||
| 350 | 371 | ', $context['page_index'], ' |
| 351 | 372 | </div> |
| 352 | 373 | </div>'; |
| 353 | - } |
|
| 354 | - else |
|
| 355 | - echo ' |
|
| 374 | + } else { |
|
| 375 | + echo ' |
|
| 356 | 376 | <div class="cat_bar"> |
| 357 | 377 | <h3 class="catbg centertext"> |
| 358 | 378 | ', $context['showing_all_topics'] ? $txt['topic_alert_none'] : $txt['unread_topics_visit_none'], ' |
| 359 | 379 | </h3> |
| 360 | 380 | </div>'; |
| 381 | + } |
|
| 361 | 382 | |
| 362 | - if ($context['showCheckboxes']) |
|
| 363 | - echo ' |
|
| 383 | + if ($context['showCheckboxes']) { |
|
| 384 | + echo ' |
|
| 364 | 385 | </form>'; |
| 386 | + } |
|
| 365 | 387 | |
| 366 | 388 | echo ' |
| 367 | 389 | </div><!-- #recent -->'; |
| 368 | 390 | |
| 369 | - if (empty($context['no_topic_listing'])) |
|
| 370 | - template_topic_legend(); |
|
| 371 | -} |
|
| 391 | + if (empty($context['no_topic_listing'])) { |
|
| 392 | + template_topic_legend(); |
|
| 393 | + } |
|
| 394 | + } |
|
| 372 | 395 | |
| 373 | 396 | ?> |
| 374 | 397 | \ No newline at end of file |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | <div class="windowbg"> |
| 32 | 32 | <ul id="likes">'; |
| 33 | 33 | |
| 34 | - foreach ($context['likers'] as $liker => $like_details) |
|
| 35 | - echo ' |
|
| 34 | + foreach ($context['likers'] as $liker => $like_details) { |
|
| 35 | + echo ' |
|
| 36 | 36 | <li> |
| 37 | 37 | ', $like_details['profile']['avatar']['image'], ' |
| 38 | 38 | <span> |
@@ -41,6 +41,7 @@ discard block |
||
| 41 | 41 | </span> |
| 42 | 42 | <span class="floatright">', $like_details['time'], '</span> |
| 43 | 43 | </li>'; |
| 44 | + } |
|
| 44 | 45 | |
| 45 | 46 | echo ' |
| 46 | 47 | </ul> |
@@ -61,11 +62,12 @@ discard block |
||
| 61 | 62 | echo ' |
| 62 | 63 | <ul class="floatleft">'; |
| 63 | 64 | |
| 64 | - if (!empty($context['data']['can_like'])) |
|
| 65 | - echo ' |
|
| 65 | + if (!empty($context['data']['can_like'])) { |
|
| 66 | + echo ' |
|
| 66 | 67 | <li class="like_button" id="', $context['data']['type'], '_', $context['data']['id_content'], '_likes"', '> |
| 67 | 68 | <a href="', $scripturl, '?action=likes;ltype=', $context['data']['type'], ';sa=like;like=', $context['data']['id_content'], ';', $context['session_var'], '=', $context['session_id'], '" class="', $context['data']['type'], '_like"><span class="generic_icons ', $context['data']['already_liked'] ? 'unlike' : 'like', '"></span> ', $context['data']['already_liked'] ? $txt['unlike'] : $txt['like'], '</a> |
| 68 | 69 | </li>'; |
| 70 | + } |
|
| 69 | 71 | |
| 70 | 72 | if (!empty($context['data']['count'])) |
| 71 | 73 | { |
@@ -26,9 +26,10 @@ discard block |
||
| 26 | 26 | </h3> |
| 27 | 27 | </div>'; |
| 28 | 28 | |
| 29 | - if ($context['ban']['is_new']) |
|
| 30 | - echo ' |
|
| 29 | + if ($context['ban']['is_new']) { |
|
| 30 | + echo ' |
|
| 31 | 31 | <div class="information noup">', $txt['ban_add_notes'], '</div>'; |
| 32 | + } |
|
| 32 | 33 | |
| 33 | 34 | // If there were errors creating the ban, show them. |
| 34 | 35 | if (!empty($context['error_messages'])) |
@@ -38,9 +39,10 @@ discard block |
||
| 38 | 39 | <strong>', $txt['ban_errors_detected'], '</strong> |
| 39 | 40 | <ul>'; |
| 40 | 41 | |
| 41 | - foreach ($context['error_messages'] as $error) |
|
| 42 | - echo ' |
|
| 42 | + foreach ($context['error_messages'] as $error) { |
|
| 43 | + echo ' |
|
| 43 | 44 | <li class="error">', $error, '</li>'; |
| 45 | + } |
|
| 44 | 46 | |
| 45 | 47 | echo ' |
| 46 | 48 | </ul> |
@@ -57,8 +59,8 @@ discard block |
||
| 57 | 59 | <input type="text" id="ban_name" name="ban_name" value="', $context['ban']['name'], '" size="45" maxlength="60"> |
| 58 | 60 | </dd>'; |
| 59 | 61 | |
| 60 | - if (isset($context['ban']['reason'])) |
|
| 61 | - echo ' |
|
| 62 | + if (isset($context['ban']['reason'])) { |
|
| 63 | + echo ' |
|
| 62 | 64 | <dt> |
| 63 | 65 | <strong><label for="reason">', $txt['ban_reason'], ':</label></strong><br> |
| 64 | 66 | <span class="smalltext">', $txt['ban_reason_desc'], '</span> |
@@ -66,9 +68,10 @@ discard block |
||
| 66 | 68 | <dd> |
| 67 | 69 | <textarea name="reason" id="reason" cols="40" rows="3">', $context['ban']['reason'], '</textarea> |
| 68 | 70 | </dd>'; |
| 71 | + } |
|
| 69 | 72 | |
| 70 | - if (isset($context['ban']['notes'])) |
|
| 71 | - echo ' |
|
| 73 | + if (isset($context['ban']['notes'])) { |
|
| 74 | + echo ' |
|
| 72 | 75 | <dt> |
| 73 | 76 | <strong><label for="ban_notes">', $txt['ban_notes'], ':</label></strong><br> |
| 74 | 77 | <span class="smalltext">', $txt['ban_notes_desc'], '</span> |
@@ -76,6 +79,7 @@ discard block |
||
| 76 | 79 | <dd> |
| 77 | 80 | <textarea name="notes" id="ban_notes" cols="40" rows="3">', $context['ban']['notes'], '</textarea> |
| 78 | 81 | </dd>'; |
| 82 | + } |
|
| 79 | 83 | |
| 80 | 84 | echo ' |
| 81 | 85 | </dl> |
@@ -115,8 +119,8 @@ discard block |
||
| 115 | 119 | <input type="text" name="main_ip" value="', $context['ban_suggestions']['main_ip'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;"> |
| 116 | 120 | </dd>'; |
| 117 | 121 | |
| 118 | - if (empty($modSettings['disableHostnameLookup'])) |
|
| 119 | - echo ' |
|
| 122 | + if (empty($modSettings['disableHostnameLookup'])) { |
|
| 123 | + echo ' |
|
| 120 | 124 | <dt> |
| 121 | 125 | <input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', !empty($context['ban_suggestions']['hostname']) ? ' checked' : '', '> |
| 122 | 126 | <label for="hostname_check">', $txt['ban_on_hostname'], '</label> |
@@ -124,6 +128,7 @@ discard block |
||
| 124 | 128 | <dd> |
| 125 | 129 | <input type="text" name="hostname" value="', $context['ban_suggestions']['hostname'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;"> |
| 126 | 130 | </dd>'; |
| 131 | + } |
|
| 127 | 132 | |
| 128 | 133 | echo ' |
| 129 | 134 | <dt> |
@@ -153,14 +158,15 @@ discard block |
||
| 153 | 158 | <dl class="settings">'; |
| 154 | 159 | |
| 155 | 160 | $count = 0; |
| 156 | - foreach ($ban_ips as $ip) |
|
| 157 | - echo ' |
|
| 161 | + foreach ($ban_ips as $ip) { |
|
| 162 | + echo ' |
|
| 158 | 163 | <dt> |
| 159 | 164 | <input type="checkbox" id="suggestions_', $key, '_', $count, '" name="ban_suggestions[', $key, '][]"', !empty($context['ban_suggestions']['saved_triggers'][$key]) && in_array($ip, $context['ban_suggestions']['saved_triggers'][$key]) ? ' checked' : '', ' value="', $ip, '"> |
| 160 | 165 | </dt> |
| 161 | 166 | <dd> |
| 162 | 167 | <label for="suggestions_', $key, '_', $count++, '">', $ip, '</label> |
| 163 | 168 | </dd>'; |
| 169 | + } |
|
| 164 | 170 | |
| 165 | 171 | echo ' |
| 166 | 172 | </dl>'; |
@@ -202,8 +208,8 @@ discard block |
||
| 202 | 208 | addLoadEvent(fUpdateStatus);'; |
| 203 | 209 | |
| 204 | 210 | // Auto suggest only needed for adding new bans, not editing |
| 205 | - if ($context['ban']['is_new'] && empty($_REQUEST['u'])) |
|
| 206 | - echo ' |
|
| 211 | + if ($context['ban']['is_new'] && empty($_REQUEST['u'])) { |
|
| 212 | + echo ' |
|
| 207 | 213 | var oAddMemberSuggest = new smc_AutoSuggest({ |
| 208 | 214 | sSelf: \'oAddMemberSuggest\', |
| 209 | 215 | sSessionId: smf_session_id, |
@@ -221,6 +227,7 @@ discard block |
||
| 221 | 227 | return true; |
| 222 | 228 | } |
| 223 | 229 | oAddMemberSuggest.registerCallback(\'onBeforeUpdate\', \'onUpdateName\');'; |
| 230 | + } |
|
| 224 | 231 | |
| 225 | 232 | echo ' |
| 226 | 233 | function confirmBan(aForm) |
@@ -269,8 +276,8 @@ discard block |
||
| 269 | 276 | <input type="text" name="main_ip" value="', $context['ban_trigger']['ip']['value'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;"> |
| 270 | 277 | </dd>'; |
| 271 | 278 | |
| 272 | - if (empty($modSettings['disableHostnameLookup'])) |
|
| 273 | - echo ' |
|
| 279 | + if (empty($modSettings['disableHostnameLookup'])) { |
|
| 280 | + echo ' |
|
| 274 | 281 | <dt> |
| 275 | 282 | <input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', $context['ban_trigger']['hostname']['selected'] ? ' checked' : '', '> |
| 276 | 283 | <label for="hostname_check">', $txt['ban_on_hostname'], '</label> |
@@ -278,6 +285,7 @@ discard block |
||
| 278 | 285 | <dd> |
| 279 | 286 | <input type="text" name="hostname" value="', $context['ban_trigger']['hostname']['value'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;"> |
| 280 | 287 | </dd>'; |
| 288 | + } |
|
| 281 | 289 | |
| 282 | 290 | echo ' |
| 283 | 291 | <dt> |