@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | LEFT JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic) |
| 233 | 233 | WHERE t.id_topic IS NULL |
| 234 | 234 | GROUP BY m.id_topic, m.id_board', |
| 235 | - 'fix_processing' => function ($row) use ($smcFunc) |
|
| 235 | + 'fix_processing' => function($row) use ($smcFunc) |
|
| 236 | 236 | { |
| 237 | 237 | global $salvageBoardID; |
| 238 | 238 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | // Remove all topics that have zero messages in the messages table. |
| 319 | 319 | 'fix_collect' => array( |
| 320 | 320 | 'index' => 'id_topic', |
| 321 | - 'process' => function ($topics) use ($smcFunc) |
|
| 321 | + 'process' => function($topics) use ($smcFunc) |
|
| 322 | 322 | { |
| 323 | 323 | $smcFunc['db_query']('', ' |
| 324 | 324 | DELETE FROM {db_prefix}topics |
@@ -356,21 +356,21 @@ discard block |
||
| 356 | 356 | AND p.id_poll IS NULL |
| 357 | 357 | GROUP BY o.id_poll |
| 358 | 358 | ', |
| 359 | - 'fix_processing' => function ($row) use ($smcFunc, $txt) |
|
| 359 | + 'fix_processing' => function($row) use ($smcFunc, $txt) |
|
| 360 | 360 | { |
| 361 | 361 | global $salvageBoardID; |
| 362 | 362 | |
| 363 | 363 | $row['poster_name'] = !empty($row['poster_name']) ? $row['poster_name'] : $txt['guest']; |
| 364 | 364 | $row['id_poster'] = !empty($row['id_poster']) ? $row['id_poster'] : 0; |
| 365 | 365 | |
| 366 | - if(empty($row['id_board'])) |
|
| 366 | + if (empty($row['id_board'])) |
|
| 367 | 367 | { |
| 368 | 368 | // Only if we don't have a reasonable idea of where to put it. |
| 369 | 369 | createSalvageArea(); |
| 370 | - $row['id_board'] = (int)$salvageBoardID; |
|
| 370 | + $row['id_board'] = (int) $salvageBoardID; |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - if(empty($row['id_topic'])) { |
|
| 373 | + if (empty($row['id_topic'])) { |
|
| 374 | 374 | $newMessageID = $smcFunc['db_insert']('', |
| 375 | 375 | '{db_prefix}messages', |
| 376 | 376 | array( |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | LEFT JOIN {db_prefix}topics AS t ON (t.id_poll = p.id_poll) |
| 493 | 493 | WHERE p.id_poll BETWEEN {STEP_LOW} AND {STEP_HIGH} |
| 494 | 494 | AND t.id_poll IS NULL', |
| 495 | - 'fix_processing' => function ($row) use ($smcFunc, $txt) |
|
| 495 | + 'fix_processing' => function($row) use ($smcFunc, $txt) |
|
| 496 | 496 | { |
| 497 | 497 | global $salvageBoardID; |
| 498 | 498 | |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
| 606 | 606 | GROUP BY t.id_topic, t.id_first_msg, t.id_last_msg, t.approved, mf.approved |
| 607 | 607 | ORDER BY t.id_topic', |
| 608 | - 'fix_processing' => function ($row) use ($smcFunc) |
|
| 608 | + 'fix_processing' => function($row) use ($smcFunc) |
|
| 609 | 609 | { |
| 610 | 610 | $row['firstmsg_approved'] = (int) $row['firstmsg_approved']; |
| 611 | 611 | $row['myid_first_msg'] = (int) $row['myid_first_msg']; |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | ) |
| 635 | 635 | ); |
| 636 | 636 | }, |
| 637 | - 'message_function' => function ($row) use ($txt, &$context) |
|
| 637 | + 'message_function' => function($row) use ($txt, &$context) |
|
| 638 | 638 | { |
| 639 | 639 | // A pretend error? |
| 640 | 640 | if ($row['myid_first_msg'] == $row['myid_first_msg'] && $row['myid_first_msg'] == $row['myid_first_msg'] && $row['approved'] == $row['firstmsg_approved']) |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
| 669 | 669 | GROUP BY t.id_topic, t.num_replies, mf.approved |
| 670 | 670 | ORDER BY t.id_topic', |
| 671 | - 'fix_processing' => function ($row) |
|
| 671 | + 'fix_processing' => function($row) |
|
| 672 | 672 | { |
| 673 | 673 | |
| 674 | 674 | global $smcFunc; |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | ); |
| 690 | 690 | |
| 691 | 691 | }, |
| 692 | - 'message_function' => function ($row) |
|
| 692 | + 'message_function' => function($row) |
|
| 693 | 693 | { |
| 694 | 694 | |
| 695 | 695 | global $txt, $context; |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | GROUP BY t.id_topic, t.unapproved_posts |
| 723 | 723 | HAVING unapproved_posts != COUNT(mu.id_msg) |
| 724 | 724 | ORDER BY t.id_topic', |
| 725 | - 'fix_processing' => function ($row) |
|
| 725 | + 'fix_processing' => function($row) |
|
| 726 | 726 | { |
| 727 | 727 | |
| 728 | 728 | global $smcFunc; |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | WHERE b.id_board IS NULL |
| 765 | 765 | AND t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
| 766 | 766 | GROUP BY t.id_board', |
| 767 | - 'fix_processing' => function ($row) |
|
| 767 | + 'fix_processing' => function($row) |
|
| 768 | 768 | { |
| 769 | 769 | |
| 770 | 770 | global $smcFunc, $salvageCatID, $txt; |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | ORDER BY b.id_cat, b.id_board', |
| 814 | 814 | 'fix_collect' => array( |
| 815 | 815 | 'index' => 'id_cat', |
| 816 | - 'process' => function ($cats) |
|
| 816 | + 'process' => function($cats) |
|
| 817 | 817 | { |
| 818 | 818 | global $smcFunc, $salvageCatID; |
| 819 | 819 | createSalvageArea(); |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | // Last step-make sure all non-guest posters still exist. |
| 850 | 850 | 'fix_collect' => array( |
| 851 | 851 | 'index' => 'id_msg', |
| 852 | - 'process' => function ($msgs) |
|
| 852 | + 'process' => function($msgs) |
|
| 853 | 853 | { |
| 854 | 854 | |
| 855 | 855 | global $smcFunc; |
@@ -878,7 +878,7 @@ discard block |
||
| 878 | 878 | ORDER BY b.id_parent, b.id_board', |
| 879 | 879 | 'fix_collect' => array( |
| 880 | 880 | 'index' => 'id_parent', |
| 881 | - 'process' => function ($parents) |
|
| 881 | + 'process' => function($parents) |
|
| 882 | 882 | { |
| 883 | 883 | global $smcFunc, $salvageBoardID, $salvageCatID; |
| 884 | 884 | createSalvageArea(); |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | AND p.id_poll IS NULL', |
| 913 | 913 | 'fix_collect' => array( |
| 914 | 914 | 'index' => 'id_poll', |
| 915 | - 'process' => function ($polls) |
|
| 915 | + 'process' => function($polls) |
|
| 916 | 916 | { |
| 917 | 917 | |
| 918 | 918 | global $smcFunc; |
@@ -946,7 +946,7 @@ discard block |
||
| 946 | 946 | ORDER BY cal.id_topic', |
| 947 | 947 | 'fix_collect' => array( |
| 948 | 948 | 'index' => 'id_topic', |
| 949 | - 'process' => function ($events) |
|
| 949 | + 'process' => function($events) |
|
| 950 | 950 | { |
| 951 | 951 | |
| 952 | 952 | global $smcFunc; |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | AND lt.id_member BETWEEN {STEP_LOW} AND {STEP_HIGH}', |
| 979 | 979 | 'fix_collect' => array( |
| 980 | 980 | 'index' => 'id_topic', |
| 981 | - 'process' => function ($topics) |
|
| 981 | + 'process' => function($topics) |
|
| 982 | 982 | { |
| 983 | 983 | |
| 984 | 984 | global $smcFunc; |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | GROUP BY lt.id_member', |
| 1011 | 1011 | 'fix_collect' => array( |
| 1012 | 1012 | 'index' => 'id_member', |
| 1013 | - 'process' => function ($members) |
|
| 1013 | + 'process' => function($members) |
|
| 1014 | 1014 | { |
| 1015 | 1015 | |
| 1016 | 1016 | global $smcFunc; |
@@ -1042,7 +1042,7 @@ discard block |
||
| 1042 | 1042 | GROUP BY lb.id_board', |
| 1043 | 1043 | 'fix_collect' => array( |
| 1044 | 1044 | 'index' => 'id_board', |
| 1045 | - 'process' => function ($boards) |
|
| 1045 | + 'process' => function($boards) |
|
| 1046 | 1046 | { |
| 1047 | 1047 | |
| 1048 | 1048 | global $smcFunc; |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | GROUP BY lb.id_member', |
| 1075 | 1075 | 'fix_collect' => array( |
| 1076 | 1076 | 'index' => 'id_member', |
| 1077 | - 'process' => function ($members) use ($smcFunc) |
|
| 1077 | + 'process' => function($members) use ($smcFunc) |
|
| 1078 | 1078 | { |
| 1079 | 1079 | $smcFunc['db_query']('', ' |
| 1080 | 1080 | DELETE FROM {db_prefix}log_boards |
@@ -1103,7 +1103,7 @@ discard block |
||
| 1103 | 1103 | GROUP BY lmr.id_board', |
| 1104 | 1104 | 'fix_collect' => array( |
| 1105 | 1105 | 'index' => 'id_board', |
| 1106 | - 'process' => function ($boards) use ($smcFunc) |
|
| 1106 | + 'process' => function($boards) use ($smcFunc) |
|
| 1107 | 1107 | { |
| 1108 | 1108 | $smcFunc['db_query']('', ' |
| 1109 | 1109 | DELETE FROM {db_prefix}log_mark_read |
@@ -1132,7 +1132,7 @@ discard block |
||
| 1132 | 1132 | GROUP BY lmr.id_member', |
| 1133 | 1133 | 'fix_collect' => array( |
| 1134 | 1134 | 'index' => 'id_member', |
| 1135 | - 'process' => function ($members) use ($smcFunc) |
|
| 1135 | + 'process' => function($members) use ($smcFunc) |
|
| 1136 | 1136 | { |
| 1137 | 1137 | $smcFunc['db_query']('', ' |
| 1138 | 1138 | DELETE FROM {db_prefix}log_mark_read |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | GROUP BY pmr.id_pm', |
| 1162 | 1162 | 'fix_collect' => array( |
| 1163 | 1163 | 'index' => 'id_pm', |
| 1164 | - 'process' => function ($pms) use ($smcFunc) |
|
| 1164 | + 'process' => function($pms) use ($smcFunc) |
|
| 1165 | 1165 | { |
| 1166 | 1166 | $smcFunc['db_query']('', ' |
| 1167 | 1167 | DELETE FROM {db_prefix}pm_recipients |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | GROUP BY pmr.id_member', |
| 1192 | 1192 | 'fix_collect' => array( |
| 1193 | 1193 | 'index' => 'id_member', |
| 1194 | - 'process' => function ($members) |
|
| 1194 | + 'process' => function($members) |
|
| 1195 | 1195 | { |
| 1196 | 1196 | |
| 1197 | 1197 | global $smcFunc; |
@@ -1223,7 +1223,7 @@ discard block |
||
| 1223 | 1223 | AND mem.id_member IS NULL', |
| 1224 | 1224 | 'fix_collect' => array( |
| 1225 | 1225 | 'index' => 'id_pm', |
| 1226 | - 'process' => function ($guestMessages) |
|
| 1226 | + 'process' => function($guestMessages) |
|
| 1227 | 1227 | { |
| 1228 | 1228 | |
| 1229 | 1229 | global $smcFunc; |
@@ -1255,7 +1255,7 @@ discard block |
||
| 1255 | 1255 | GROUP BY ln.id_member', |
| 1256 | 1256 | 'fix_collect' => array( |
| 1257 | 1257 | 'index' => 'id_member', |
| 1258 | - 'process' => function ($members) use ($smcFunc) |
|
| 1258 | + 'process' => function($members) use ($smcFunc) |
|
| 1259 | 1259 | { |
| 1260 | 1260 | $smcFunc['db_query']('', ' |
| 1261 | 1261 | DELETE FROM {db_prefix}log_notify |
@@ -1282,7 +1282,7 @@ discard block |
||
| 1282 | 1282 | LEFT JOIN {db_prefix}log_search_subjects AS lss ON (lss.id_topic = t.id_topic) |
| 1283 | 1283 | WHERE t.id_topic BETWEEN {STEP_LOW} AND {STEP_HIGH} |
| 1284 | 1284 | AND lss.id_topic IS NULL', |
| 1285 | - 'fix_full_processing' => function ($result) |
|
| 1285 | + 'fix_full_processing' => function($result) |
|
| 1286 | 1286 | { |
| 1287 | 1287 | |
| 1288 | 1288 | global $smcFunc; |
@@ -1314,7 +1314,7 @@ discard block |
||
| 1314 | 1314 | ); |
| 1315 | 1315 | |
| 1316 | 1316 | }, |
| 1317 | - 'message_function' => function ($row) |
|
| 1317 | + 'message_function' => function($row) |
|
| 1318 | 1318 | { |
| 1319 | 1319 | |
| 1320 | 1320 | global $txt, $context; |
@@ -1344,7 +1344,7 @@ discard block |
||
| 1344 | 1344 | AND t.id_topic IS NULL', |
| 1345 | 1345 | 'fix_collect' => array( |
| 1346 | 1346 | 'index' => 'id_topic', |
| 1347 | - 'process' => function ($deleteTopics) |
|
| 1347 | + 'process' => function($deleteTopics) |
|
| 1348 | 1348 | { |
| 1349 | 1349 | |
| 1350 | 1350 | global $smcFunc; |
@@ -1376,7 +1376,7 @@ discard block |
||
| 1376 | 1376 | AND mem.id_member IS NULL', |
| 1377 | 1377 | 'fix_collect' => array( |
| 1378 | 1378 | 'index' => 'id_member', |
| 1379 | - 'process' => function ($members) |
|
| 1379 | + 'process' => function($members) |
|
| 1380 | 1380 | { |
| 1381 | 1381 | |
| 1382 | 1382 | global $smcFunc; |
@@ -1407,7 +1407,7 @@ discard block |
||
| 1407 | 1407 | AND p.id_poll IS NULL', |
| 1408 | 1408 | 'fix_collect' => array( |
| 1409 | 1409 | 'index' => 'id_poll', |
| 1410 | - 'process' => function ($polls) |
|
| 1410 | + 'process' => function($polls) |
|
| 1411 | 1411 | { |
| 1412 | 1412 | |
| 1413 | 1413 | global $smcFunc; |
@@ -1438,7 +1438,7 @@ discard block |
||
| 1438 | 1438 | AND lrc.id_report IS NULL', |
| 1439 | 1439 | 'fix_collect' => array( |
| 1440 | 1440 | 'index' => 'id_report', |
| 1441 | - 'process' => function ($reports) |
|
| 1441 | + 'process' => function($reports) |
|
| 1442 | 1442 | { |
| 1443 | 1443 | |
| 1444 | 1444 | global $smcFunc; |
@@ -1469,7 +1469,7 @@ discard block |
||
| 1469 | 1469 | AND lr.id_report IS NULL', |
| 1470 | 1470 | 'fix_collect' => array( |
| 1471 | 1471 | 'index' => 'id_report', |
| 1472 | - 'process' => function ($reports) |
|
| 1472 | + 'process' => function($reports) |
|
| 1473 | 1473 | { |
| 1474 | 1474 | global $smcFunc; |
| 1475 | 1475 | $smcFunc['db_query']('', ' |
@@ -1499,7 +1499,7 @@ discard block |
||
| 1499 | 1499 | GROUP BY lgr.id_member', |
| 1500 | 1500 | 'fix_collect' => array( |
| 1501 | 1501 | 'index' => 'id_member', |
| 1502 | - 'process' => function ($members) |
|
| 1502 | + 'process' => function($members) |
|
| 1503 | 1503 | { |
| 1504 | 1504 | global $smcFunc; |
| 1505 | 1505 | $smcFunc['db_query']('', ' |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | GROUP BY lgr.id_group', |
| 1530 | 1530 | 'fix_collect' => array( |
| 1531 | 1531 | 'index' => 'id_group', |
| 1532 | - 'process' => function ($groups) |
|
| 1532 | + 'process' => function($groups) |
|
| 1533 | 1533 | { |
| 1534 | 1534 | global $smcFunc; |
| 1535 | 1535 | $smcFunc['db_query']('', ' |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Finds or repairs errors in the database to fix possible problems. |
@@ -50,8 +51,9 @@ discard block |
||
| 50 | 51 | ); |
| 51 | 52 | |
| 52 | 53 | // Start displaying errors without fixing them. |
| 53 | - if (isset($_GET['fixErrors'])) |
|
| 54 | - checkSession('get'); |
|
| 54 | + if (isset($_GET['fixErrors'])) { |
|
| 55 | + checkSession('get'); |
|
| 56 | + } |
|
| 55 | 57 | |
| 56 | 58 | // Will want this. |
| 57 | 59 | loadForumTests(); |
@@ -69,11 +71,11 @@ discard block |
||
| 69 | 71 | $_SESSION['repairboards_to_fix'] = $context['to_fix']; |
| 70 | 72 | $_SESSION['repairboards_to_fix2'] = null; |
| 71 | 73 | |
| 72 | - if (empty($context['repair_errors'])) |
|
| 73 | - $context['repair_errors'][] = '???'; |
|
| 74 | + if (empty($context['repair_errors'])) { |
|
| 75 | + $context['repair_errors'][] = '???'; |
|
| 76 | + } |
|
| 74 | 77 | } |
| 75 | - } |
|
| 76 | - else |
|
| 78 | + } else |
|
| 77 | 79 | { |
| 78 | 80 | $context['error_search'] = false; |
| 79 | 81 | $context['to_fix'] = isset($_SESSION['repairboards_to_fix']) ? $_SESSION['repairboards_to_fix'] : array(); |
@@ -120,16 +122,19 @@ discard block |
||
| 120 | 122 | |
| 121 | 123 | // More time, I need more time! |
| 122 | 124 | @set_time_limit(600); |
| 123 | - if (function_exists('apache_reset_timeout')) |
|
| 124 | - @apache_reset_timeout(); |
|
| 125 | + if (function_exists('apache_reset_timeout')) { |
|
| 126 | + @apache_reset_timeout(); |
|
| 127 | + } |
|
| 125 | 128 | |
| 126 | 129 | // Errr, wait. How much time has this taken already? |
| 127 | - if (!$force && time() - array_sum(explode(' ', $time_start)) < 3) |
|
| 128 | - return; |
|
| 130 | + if (!$force && time() - array_sum(explode(' ', $time_start)) < 3) { |
|
| 131 | + return; |
|
| 132 | + } |
|
| 129 | 133 | |
| 130 | 134 | // Restore the query cache if interested. |
| 131 | - if (!empty($db_temp_cache)) |
|
| 132 | - $db_cache = $db_temp_cache; |
|
| 135 | + if (!empty($db_temp_cache)) { |
|
| 136 | + $db_cache = $db_temp_cache; |
|
| 137 | + } |
|
| 133 | 138 | |
| 134 | 139 | $context['continue_get_data'] = '?action=admin;area=repairboards' . (isset($_GET['fixErrors']) ? ';fixErrors' : '') . ';step=' . $_GET['step'] . ';substep=' . $_GET['substep'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
| 135 | 140 | $context['page_title'] = $txt['not_done_title']; |
@@ -138,10 +143,11 @@ discard block |
||
| 138 | 143 | $context['sub_template'] = 'not_done'; |
| 139 | 144 | |
| 140 | 145 | // Change these two if more steps are added! |
| 141 | - if (empty($max_substep)) |
|
| 142 | - $context['continue_percent'] = round(($_GET['step'] * 100) / $context['total_steps']); |
|
| 143 | - else |
|
| 144 | - $context['continue_percent'] = round((($_GET['step'] + ($_GET['substep'] / $max_substep)) * 100) / $context['total_steps']); |
|
| 146 | + if (empty($max_substep)) { |
|
| 147 | + $context['continue_percent'] = round(($_GET['step'] * 100) / $context['total_steps']); |
|
| 148 | + } else { |
|
| 149 | + $context['continue_percent'] = round((($_GET['step'] + ($_GET['substep'] / $max_substep)) * 100) / $context['total_steps']); |
|
| 150 | + } |
|
| 145 | 151 | |
| 146 | 152 | // Never more than 100%! |
| 147 | 153 | $context['continue_percent'] = min($context['continue_percent'], 100); |
@@ -612,8 +618,9 @@ discard block |
||
| 612 | 618 | $row['myid_last_msg'] = (int) $row['myid_last_msg']; |
| 613 | 619 | |
| 614 | 620 | // Not really a problem? |
| 615 | - if ($row['myid_first_msg'] == $row['myid_first_msg'] && $row['myid_first_msg'] == $row['myid_first_msg'] && $row['approved'] == $row['firstmsg_approved']) |
|
| 616 | - return false; |
|
| 621 | + if ($row['myid_first_msg'] == $row['myid_first_msg'] && $row['myid_first_msg'] == $row['myid_first_msg'] && $row['approved'] == $row['firstmsg_approved']) { |
|
| 622 | + return false; |
|
| 623 | + } |
|
| 617 | 624 | |
| 618 | 625 | $memberStartedID = (int) getMsgMemberID($row['myid_first_msg']); |
| 619 | 626 | $memberUpdatedID = (int) getMsgMemberID($row['myid_last_msg']); |
@@ -637,15 +644,19 @@ discard block |
||
| 637 | 644 | 'message_function' => function ($row) use ($txt, &$context) |
| 638 | 645 | { |
| 639 | 646 | // A pretend error? |
| 640 | - if ($row['myid_first_msg'] == $row['myid_first_msg'] && $row['myid_first_msg'] == $row['myid_first_msg'] && $row['approved'] == $row['firstmsg_approved']) |
|
| 641 | - return false; |
|
| 647 | + if ($row['myid_first_msg'] == $row['myid_first_msg'] && $row['myid_first_msg'] == $row['myid_first_msg'] && $row['approved'] == $row['firstmsg_approved']) { |
|
| 648 | + return false; |
|
| 649 | + } |
|
| 642 | 650 | |
| 643 | - if ($row['id_first_msg'] != $row['myid_first_msg']) |
|
| 644 | - $context['repair_errors'][] = sprintf($txt['repair_stats_topics_1'], $row['id_topic'], $row['id_first_msg']); |
|
| 645 | - if ($row['id_last_msg'] != $row['myid_last_msg']) |
|
| 646 | - $context['repair_errors'][] = sprintf($txt['repair_stats_topics_2'], $row['id_topic'], $row['id_last_msg']); |
|
| 647 | - if ($row['approved'] != $row['firstmsg_approved']) |
|
| 648 | - $context['repair_errors'][] = sprintf($txt['repair_stats_topics_5'], $row['id_topic']); |
|
| 651 | + if ($row['id_first_msg'] != $row['myid_first_msg']) { |
|
| 652 | + $context['repair_errors'][] = sprintf($txt['repair_stats_topics_1'], $row['id_topic'], $row['id_first_msg']); |
|
| 653 | + } |
|
| 654 | + if ($row['id_last_msg'] != $row['myid_last_msg']) { |
|
| 655 | + $context['repair_errors'][] = sprintf($txt['repair_stats_topics_2'], $row['id_topic'], $row['id_last_msg']); |
|
| 656 | + } |
|
| 657 | + if ($row['approved'] != $row['firstmsg_approved']) { |
|
| 658 | + $context['repair_errors'][] = sprintf($txt['repair_stats_topics_5'], $row['id_topic']); |
|
| 659 | + } |
|
| 649 | 660 | |
| 650 | 661 | return true; |
| 651 | 662 | }, |
@@ -675,8 +686,9 @@ discard block |
||
| 675 | 686 | $row['my_num_replies'] = (int) $row['my_num_replies']; |
| 676 | 687 | |
| 677 | 688 | // Not really a problem? |
| 678 | - if ($row['my_num_replies'] == $row['num_replies']) |
|
| 679 | - return false; |
|
| 689 | + if ($row['my_num_replies'] == $row['num_replies']) { |
|
| 690 | + return false; |
|
| 691 | + } |
|
| 680 | 692 | |
| 681 | 693 | $smcFunc['db_query']('', ' |
| 682 | 694 | UPDATE {db_prefix}topics |
@@ -695,11 +707,13 @@ discard block |
||
| 695 | 707 | global $txt, $context; |
| 696 | 708 | |
| 697 | 709 | // Just joking? |
| 698 | - if ($row['my_num_replies'] == $row['num_replies']) |
|
| 699 | - return false; |
|
| 710 | + if ($row['my_num_replies'] == $row['num_replies']) { |
|
| 711 | + return false; |
|
| 712 | + } |
|
| 700 | 713 | |
| 701 | - if ($row['num_replies'] != $row['my_num_replies']) |
|
| 702 | - $context['repair_errors'][] = sprintf($txt['repair_stats_topics_3'], $row['id_topic'], $row['num_replies']); |
|
| 714 | + if ($row['num_replies'] != $row['my_num_replies']) { |
|
| 715 | + $context['repair_errors'][] = sprintf($txt['repair_stats_topics_3'], $row['id_topic'], $row['num_replies']); |
|
| 716 | + } |
|
| 703 | 717 | |
| 704 | 718 | return true; |
| 705 | 719 | |
@@ -1290,8 +1304,9 @@ discard block |
||
| 1290 | 1304 | $inserts = array(); |
| 1291 | 1305 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
| 1292 | 1306 | { |
| 1293 | - foreach (text2words($row['subject']) as $word) |
|
| 1294 | - $inserts[] = array($word, $row['id_topic']); |
|
| 1307 | + foreach (text2words($row['subject']) as $word) { |
|
| 1308 | + $inserts[] = array($word, $row['id_topic']); |
|
| 1309 | + } |
|
| 1295 | 1310 | if (count($inserts) > 500) |
| 1296 | 1311 | { |
| 1297 | 1312 | $smcFunc['db_insert']('ignore', |
@@ -1305,13 +1320,14 @@ discard block |
||
| 1305 | 1320 | |
| 1306 | 1321 | } |
| 1307 | 1322 | |
| 1308 | - if (!empty($inserts)) |
|
| 1309 | - $smcFunc['db_insert']('ignore', |
|
| 1323 | + if (!empty($inserts)) { |
|
| 1324 | + $smcFunc['db_insert']('ignore', |
|
| 1310 | 1325 | '{db_prefix}log_search_subjects', |
| 1311 | 1326 | array('word' => 'string', 'id_topic' => 'int'), |
| 1312 | 1327 | $inserts, |
| 1313 | 1328 | array('word', 'id_topic') |
| 1314 | 1329 | ); |
| 1330 | + } |
|
| 1315 | 1331 | |
| 1316 | 1332 | }, |
| 1317 | 1333 | 'message_function' => function ($row) |
@@ -1581,8 +1597,9 @@ discard block |
||
| 1581 | 1597 | $current_step++; |
| 1582 | 1598 | |
| 1583 | 1599 | // Already done this? |
| 1584 | - if ($_GET['step'] > $current_step) |
|
| 1585 | - continue; |
|
| 1600 | + if ($_GET['step'] > $current_step) { |
|
| 1601 | + continue; |
|
| 1602 | + } |
|
| 1586 | 1603 | |
| 1587 | 1604 | // If we're fixing it but it ain't broke why try? |
| 1588 | 1605 | if ($do_fix && !in_array($error_type, $to_fix)) |
@@ -1611,14 +1628,16 @@ discard block |
||
| 1611 | 1628 | while (!$done) |
| 1612 | 1629 | { |
| 1613 | 1630 | // Make sure there's at least one ID to test. |
| 1614 | - if (isset($test['substeps']) && empty($step_max)) |
|
| 1615 | - break; |
|
| 1631 | + if (isset($test['substeps']) && empty($step_max)) { |
|
| 1632 | + break; |
|
| 1633 | + } |
|
| 1616 | 1634 | |
| 1617 | 1635 | // What is the testing query (Changes if we are testing or fixing) |
| 1618 | - if (!$do_fix) |
|
| 1619 | - $test_query = 'check_query'; |
|
| 1620 | - else |
|
| 1621 | - $test_query = isset($test['fix_query']) ? 'fix_query' : 'check_query'; |
|
| 1636 | + if (!$do_fix) { |
|
| 1637 | + $test_query = 'check_query'; |
|
| 1638 | + } else { |
|
| 1639 | + $test_query = isset($test['fix_query']) ? 'fix_query' : 'check_query'; |
|
| 1640 | + } |
|
| 1622 | 1641 | |
| 1623 | 1642 | // Do the test... |
| 1624 | 1643 | $request = $smcFunc['db_query']('', |
@@ -1628,10 +1647,11 @@ discard block |
||
| 1628 | 1647 | ); |
| 1629 | 1648 | |
| 1630 | 1649 | // Does it need a fix? |
| 1631 | - if (!empty($test['check_type']) && $test['check_type'] == 'count') |
|
| 1632 | - list ($needs_fix) = $smcFunc['db_fetch_row']($request); |
|
| 1633 | - else |
|
| 1634 | - $needs_fix = $smcFunc['db_num_rows']($request); |
|
| 1650 | + if (!empty($test['check_type']) && $test['check_type'] == 'count') { |
|
| 1651 | + list ($needs_fix) = $smcFunc['db_fetch_row']($request); |
|
| 1652 | + } else { |
|
| 1653 | + $needs_fix = $smcFunc['db_num_rows']($request); |
|
| 1654 | + } |
|
| 1635 | 1655 | |
| 1636 | 1656 | $total_queries++; |
| 1637 | 1657 | |
@@ -1643,8 +1663,9 @@ discard block |
||
| 1643 | 1663 | // Assume need to fix. |
| 1644 | 1664 | $found_errors = true; |
| 1645 | 1665 | |
| 1646 | - if (isset($test['message'])) |
|
| 1647 | - $context['repair_errors'][] = $txt[$test['message']]; |
|
| 1666 | + if (isset($test['message'])) { |
|
| 1667 | + $context['repair_errors'][] = $txt[$test['message']]; |
|
| 1668 | + } |
|
| 1648 | 1669 | |
| 1649 | 1670 | // One per row! |
| 1650 | 1671 | elseif (isset($test['messages'])) |
@@ -1654,10 +1675,11 @@ discard block |
||
| 1654 | 1675 | $variables = $test['messages']; |
| 1655 | 1676 | foreach ($variables as $k => $v) |
| 1656 | 1677 | { |
| 1657 | - if ($k == 0 && isset($txt[$v])) |
|
| 1658 | - $variables[$k] = $txt[$v]; |
|
| 1659 | - elseif ($k > 0 && isset($row[$v])) |
|
| 1660 | - $variables[$k] = $row[$v]; |
|
| 1678 | + if ($k == 0 && isset($txt[$v])) { |
|
| 1679 | + $variables[$k] = $txt[$v]; |
|
| 1680 | + } elseif ($k > 0 && isset($row[$v])) { |
|
| 1681 | + $variables[$k] = $row[$v]; |
|
| 1682 | + } |
|
| 1661 | 1683 | } |
| 1662 | 1684 | $context['repair_errors'][] = call_user_func_array('sprintf', $variables); |
| 1663 | 1685 | } |
@@ -1668,13 +1690,15 @@ discard block |
||
| 1668 | 1690 | { |
| 1669 | 1691 | // Find out if there are actually errors. |
| 1670 | 1692 | $found_errors = false; |
| 1671 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1672 | - $found_errors |= $test['message_function']($row); |
|
| 1693 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1694 | + $found_errors |= $test['message_function']($row); |
|
| 1695 | + } |
|
| 1673 | 1696 | } |
| 1674 | 1697 | |
| 1675 | 1698 | // Actually have something to fix? |
| 1676 | - if ($found_errors) |
|
| 1677 | - $to_fix[] = $error_type; |
|
| 1699 | + if ($found_errors) { |
|
| 1700 | + $to_fix[] = $error_type; |
|
| 1701 | + } |
|
| 1678 | 1702 | } |
| 1679 | 1703 | |
| 1680 | 1704 | // We want to fix, we need to fix - so work out what exactly to do! |
@@ -1684,8 +1708,9 @@ discard block |
||
| 1684 | 1708 | if (isset($test['fix_collect'])) |
| 1685 | 1709 | { |
| 1686 | 1710 | $ids = array(); |
| 1687 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1688 | - $ids[] = $row[$test['fix_collect']['index']]; |
|
| 1711 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1712 | + $ids[] = $row[$test['fix_collect']['index']]; |
|
| 1713 | + } |
|
| 1689 | 1714 | if (!empty($ids)) |
| 1690 | 1715 | { |
| 1691 | 1716 | // Fix it! |
@@ -1694,30 +1719,34 @@ discard block |
||
| 1694 | 1719 | } |
| 1695 | 1720 | |
| 1696 | 1721 | // Simply executing a fix it query? |
| 1697 | - elseif (isset($test['fix_it_query'])) |
|
| 1698 | - $smcFunc['db_query']('', |
|
| 1722 | + elseif (isset($test['fix_it_query'])) { |
|
| 1723 | + $smcFunc['db_query']('', |
|
| 1699 | 1724 | $test['fix_it_query'], |
| 1700 | 1725 | array( |
| 1701 | 1726 | ) |
| 1702 | 1727 | ); |
| 1728 | + } |
|
| 1703 | 1729 | |
| 1704 | 1730 | // Do we have some processing to do? |
| 1705 | 1731 | elseif (isset($test['fix_processing'])) |
| 1706 | 1732 | { |
| 1707 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1708 | - $test['fix_processing']($row); |
|
| 1733 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1734 | + $test['fix_processing']($row); |
|
| 1735 | + } |
|
| 1709 | 1736 | } |
| 1710 | 1737 | |
| 1711 | 1738 | // What about the full set of processing? |
| 1712 | - elseif (isset($test['fix_full_processing'])) |
|
| 1713 | - $test['fix_full_processing']($request); |
|
| 1739 | + elseif (isset($test['fix_full_processing'])) { |
|
| 1740 | + $test['fix_full_processing']($request); |
|
| 1741 | + } |
|
| 1714 | 1742 | |
| 1715 | 1743 | // Do we have other things we need to fix as a result? |
| 1716 | 1744 | if (!empty($test['force_fix'])) |
| 1717 | 1745 | { |
| 1718 | - foreach ($test['force_fix'] as $item) |
|
| 1719 | - if (!in_array($item, $to_fix)) |
|
| 1746 | + foreach ($test['force_fix'] as $item) { |
|
| 1747 | + if (!in_array($item, $to_fix)) |
|
| 1720 | 1748 | $to_fix[] = $item; |
| 1749 | + } |
|
| 1721 | 1750 | } |
| 1722 | 1751 | } |
| 1723 | 1752 | } |
@@ -1735,16 +1764,17 @@ discard block |
||
| 1735 | 1764 | if ($_GET['substep'] <= $step_max) |
| 1736 | 1765 | { |
| 1737 | 1766 | pauseRepairProcess($to_fix, $error_type, $step_max); |
| 1767 | + } else { |
|
| 1768 | + $done = true; |
|
| 1738 | 1769 | } |
| 1739 | - else |
|
| 1740 | - $done = true; |
|
| 1770 | + } else { |
|
| 1771 | + $done = true; |
|
| 1741 | 1772 | } |
| 1742 | - else |
|
| 1743 | - $done = true; |
|
| 1744 | 1773 | |
| 1745 | 1774 | // Don't allow more than 1000 queries at a time. |
| 1746 | - if ($total_queries >= 1000) |
|
| 1747 | - pauseRepairProcess($to_fix, $error_type, $step_max, true); |
|
| 1775 | + if ($total_queries >= 1000) { |
|
| 1776 | + pauseRepairProcess($to_fix, $error_type, $step_max, true); |
|
| 1777 | + } |
|
| 1748 | 1778 | } |
| 1749 | 1779 | |
| 1750 | 1780 | // Keep going. |
@@ -1757,8 +1787,9 @@ discard block |
||
| 1757 | 1787 | if ($do_fix) |
| 1758 | 1788 | { |
| 1759 | 1789 | $key = array_search($error_type, $to_fix); |
| 1760 | - if ($key !== false && isset($to_fix[$key])) |
|
| 1761 | - unset($to_fix[$key]); |
|
| 1790 | + if ($key !== false && isset($to_fix[$key])) { |
|
| 1791 | + unset($to_fix[$key]); |
|
| 1792 | + } |
|
| 1762 | 1793 | } |
| 1763 | 1794 | |
| 1764 | 1795 | // Are we done? |
@@ -1781,10 +1812,11 @@ discard block |
||
| 1781 | 1812 | static $createOnce = false; |
| 1782 | 1813 | |
| 1783 | 1814 | // Have we already created it? |
| 1784 | - if ($createOnce) |
|
| 1785 | - return; |
|
| 1786 | - else |
|
| 1787 | - $createOnce = true; |
|
| 1815 | + if ($createOnce) { |
|
| 1816 | + return; |
|
| 1817 | + } else { |
|
| 1818 | + $createOnce = true; |
|
| 1819 | + } |
|
| 1788 | 1820 | |
| 1789 | 1821 | // Back to the forum's default language. |
| 1790 | 1822 | loadLanguage('Admin', $language); |
@@ -1799,8 +1831,9 @@ discard block |
||
| 1799 | 1831 | 'cat_name' => $txt['salvaged_category_name'], |
| 1800 | 1832 | ) |
| 1801 | 1833 | ); |
| 1802 | - if ($smcFunc['db_num_rows']($result) != 0) |
|
| 1803 | - list ($salvageCatID) = $smcFunc['db_fetch_row']($result); |
|
| 1834 | + if ($smcFunc['db_num_rows']($result) != 0) { |
|
| 1835 | + list ($salvageCatID) = $smcFunc['db_fetch_row']($result); |
|
| 1836 | + } |
|
| 1804 | 1837 | $smcFunc['db_free_result']($result); |
| 1805 | 1838 | |
| 1806 | 1839 | if (empty($salvageCatID)) |
@@ -1832,8 +1865,9 @@ discard block |
||
| 1832 | 1865 | 'board_name' => $txt['salvaged_board_name'], |
| 1833 | 1866 | ) |
| 1834 | 1867 | ); |
| 1835 | - if ($smcFunc['db_num_rows']($result) != 0) |
|
| 1836 | - list ($salvageBoardID) = $smcFunc['db_fetch_row']($result); |
|
| 1868 | + if ($smcFunc['db_num_rows']($result) != 0) { |
|
| 1869 | + list ($salvageBoardID) = $smcFunc['db_fetch_row']($result); |
|
| 1870 | + } |
|
| 1837 | 1871 | $smcFunc['db_free_result']($result); |
| 1838 | 1872 | |
| 1839 | 1873 | if (empty($salvageBoardID)) |
@@ -12,7 +12,8 @@ |
||
| 12 | 12 | header('Location: ' . $boardurl); |
| 13 | 13 | } |
| 14 | 14 | // Can't find it... just forget it. |
| 15 | -else |
|
| 15 | +else { |
|
| 16 | 16 | exit; |
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | ?> |
| 19 | 20 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -12,7 +12,8 @@ |
||
| 12 | 12 | header('Location: ' . $boardurl); |
| 13 | 13 | } |
| 14 | 14 | // Can't find it... just forget it. |
| 15 | -else |
|
| 15 | +else { |
|
| 16 | 16 | exit; |
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | ?> |
| 19 | 20 | \ No newline at end of file |
@@ -645,12 +645,12 @@ |
||
| 645 | 645 | </dd>'; |
| 646 | 646 | } |
| 647 | 647 | // A Textarea? |
| 648 | - elseif ($setting['type'] == 'textarea') |
|
| 648 | + elseif ($setting['type'] == 'textarea') |
|
| 649 | 649 | { |
| 650 | 650 | echo ' |
| 651 | 651 | <dd> |
| 652 | 652 | <textarea rows="4" style="width: 95%;" cols="40" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">', $setting['value'], '</textarea>'; |
| 653 | - echo ' |
|
| 653 | + echo ' |
|
| 654 | 654 | </dd>'; |
| 655 | 655 | } |
| 656 | 656 | // A regular input box, then? |
@@ -54,9 +54,10 @@ discard block |
||
| 54 | 54 | <dd> |
| 55 | 55 | <div id="known_themes_list">'; |
| 56 | 56 | |
| 57 | - foreach ($context['themes'] as $theme) |
|
| 58 | - echo ' |
|
| 57 | + foreach ($context['themes'] as $theme) { |
|
| 58 | + echo ' |
|
| 59 | 59 | <label for="options-known_themes_', $theme['id'], '"><input type="checkbox" name="options[known_themes][]" id="options-known_themes_', $theme['id'], '" value="', $theme['id'], '"', $theme['known'] ? ' checked' : '', '> ', $theme['name'], '</label><br>'; |
| 60 | + } |
|
| 60 | 61 | |
| 61 | 62 | echo ' |
| 62 | 63 | </div> |
@@ -73,9 +74,10 @@ discard block |
||
| 73 | 74 | <select name="options[theme_guests]" id="theme_guests">'; |
| 74 | 75 | |
| 75 | 76 | // Put an option for each theme in the select box. |
| 76 | - foreach ($context['themes'] as $theme) |
|
| 77 | - echo ' |
|
| 77 | + foreach ($context['themes'] as $theme) { |
|
| 78 | + echo ' |
|
| 78 | 79 | <option value="', $theme['id'], '"', $modSettings['theme_guests'] == $theme['id'] ? ' selected' : '', '>', $theme['name'], '</option>'; |
| 80 | + } |
|
| 79 | 81 | |
| 80 | 82 | echo ' |
| 81 | 83 | </select> |
@@ -90,9 +92,10 @@ discard block |
||
| 90 | 92 | <option value="0">', $txt['theme_forum_default'], '</option>'; |
| 91 | 93 | |
| 92 | 94 | // Same thing, this time for changing the theme of everyone. |
| 93 | - foreach ($context['themes'] as $theme) |
|
| 94 | - echo ' |
|
| 95 | + foreach ($context['themes'] as $theme) { |
|
| 96 | + echo ' |
|
| 95 | 97 | <option value="', $theme['id'], '">', $theme['name'], '</option>'; |
| 98 | + } |
|
| 96 | 99 | |
| 97 | 100 | echo ' |
| 98 | 101 | </select> |
@@ -189,11 +192,12 @@ discard block |
||
| 189 | 192 | global $context, $scripturl, $txt; |
| 190 | 193 | |
| 191 | 194 | // Show a nice confirmation message. |
| 192 | - if (isset($_GET['done'])) |
|
| 193 | - echo ' |
|
| 195 | + if (isset($_GET['done'])) { |
|
| 196 | + echo ' |
|
| 194 | 197 | <div class="infobox"> |
| 195 | 198 | ', $txt['theme_confirmed_' . $_GET['done']], ' |
| 196 | 199 | </div>'; |
| 200 | + } |
|
| 197 | 201 | |
| 198 | 202 | echo ' |
| 199 | 203 | <div id="admincenter">'; |
@@ -357,11 +361,12 @@ discard block |
||
| 357 | 361 | if (empty($setting) || !is_array($setting)) |
| 358 | 362 | { |
| 359 | 363 | // Insert a separator (unless this is the first item in the list) |
| 360 | - if ($i !== $first_option_key) |
|
| 361 | - echo ' |
|
| 364 | + if ($i !== $first_option_key) { |
|
| 365 | + echo ' |
|
| 362 | 366 | </dl> |
| 363 | 367 | <hr> |
| 364 | 368 | <dl class="settings">'; |
| 369 | + } |
|
| 365 | 370 | |
| 366 | 371 | // Should we give a name to this section? |
| 367 | 372 | if (is_string($setting) && !empty($setting)) |
@@ -369,9 +374,9 @@ discard block |
||
| 369 | 374 | $titled_section = true; |
| 370 | 375 | echo ' |
| 371 | 376 | <dt><strong>' . $setting . '</strong></dt><dd></dd>'; |
| 377 | + } else { |
|
| 378 | + $titled_section = false; |
|
| 372 | 379 | } |
| 373 | - else |
|
| 374 | - $titled_section = false; |
|
| 375 | 380 | |
| 376 | 381 | continue; |
| 377 | 382 | } |
@@ -380,19 +385,21 @@ discard block |
||
| 380 | 385 | <dt ', $context['theme_options_reset'] ? 'style="width:50%"' : '', '>'; |
| 381 | 386 | |
| 382 | 387 | // Show the change option box ? |
| 383 | - if ($context['theme_options_reset']) |
|
| 384 | - echo ' |
|
| 388 | + if ($context['theme_options_reset']) { |
|
| 389 | + echo ' |
|
| 385 | 390 | <span class="floatleft"><select name="', !empty($setting['default']) ? 'default_' : '', 'options_master[', $setting['id'], ']" onchange="this.form.options_', $setting['id'], '.disabled = this.selectedIndex != 1;"> |
| 386 | 391 | <option value="0" selected>', $txt['themeadmin_reset_options_none'], '</option> |
| 387 | 392 | <option value="1">', $txt['themeadmin_reset_options_change'], '</option> |
| 388 | 393 | <option value="2">', $txt['themeadmin_reset_options_default'], '</option> |
| 389 | 394 | </select> </span>'; |
| 395 | + } |
|
| 390 | 396 | |
| 391 | 397 | echo ' |
| 392 | 398 | <label for="options_', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>'; |
| 393 | - if (isset($setting['description'])) |
|
| 394 | - echo ' |
|
| 399 | + if (isset($setting['description'])) { |
|
| 400 | + echo ' |
|
| 395 | 401 | <br><span class="smalltext">', $setting['description'], '</span>'; |
| 402 | + } |
|
| 396 | 403 | echo ' |
| 397 | 404 | </dt>'; |
| 398 | 405 | |
@@ -434,13 +441,11 @@ discard block |
||
| 434 | 441 | |
| 435 | 442 | echo ' |
| 436 | 443 | <input type="number"', $min . $max . $step; |
| 437 | - } |
|
| 438 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 444 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 439 | 445 | { |
| 440 | 446 | echo' |
| 441 | 447 | <input type="url"'; |
| 442 | - } |
|
| 443 | - else |
|
| 448 | + } else |
|
| 444 | 449 | { |
| 445 | 450 | echo ' |
| 446 | 451 | <input type="text"'; |
@@ -484,8 +489,8 @@ discard block |
||
| 484 | 489 | <br>'; |
| 485 | 490 | |
| 486 | 491 | // @todo Why can't I edit the default theme popup. |
| 487 | - if ($context['theme_settings']['theme_id'] != 1) |
|
| 488 | - echo ' |
|
| 492 | + if ($context['theme_settings']['theme_id'] != 1) { |
|
| 493 | + echo ' |
|
| 489 | 494 | <div class="cat_bar"> |
| 490 | 495 | <h3 class="catbg config_hd"> |
| 491 | 496 | ', $txt['theme_edit'], ' |
@@ -501,6 +506,7 @@ discard block |
||
| 501 | 506 | </li> |
| 502 | 507 | </ul> |
| 503 | 508 | </div>'; |
| 509 | + } |
|
| 504 | 510 | |
| 505 | 511 | echo ' |
| 506 | 512 | <div class="cat_bar"> |
@@ -554,9 +560,10 @@ discard block |
||
| 554 | 560 | <dd> |
| 555 | 561 | <select id="variant" name="options[default_variant]" onchange="changeVariant(this.value)">'; |
| 556 | 562 | |
| 557 | - foreach ($context['theme_variants'] as $key => $variant) |
|
| 558 | - echo ' |
|
| 563 | + foreach ($context['theme_variants'] as $key => $variant) { |
|
| 564 | + echo ' |
|
| 559 | 565 | <option value="', $key, '"', $context['default_variant'] == $key ? ' selected' : '', '>', $variant['label'], '</option>'; |
| 566 | + } |
|
| 560 | 567 | |
| 561 | 568 | echo ' |
| 562 | 569 | </select> |
@@ -592,11 +599,12 @@ discard block |
||
| 592 | 599 | if (empty($setting) || !is_array($setting)) |
| 593 | 600 | { |
| 594 | 601 | // We don't need a separator before the first list element |
| 595 | - if ($i !== $first_setting_key) |
|
| 596 | - echo ' |
|
| 602 | + if ($i !== $first_setting_key) { |
|
| 603 | + echo ' |
|
| 597 | 604 | </dl> |
| 598 | 605 | <hr> |
| 599 | 606 | <dl class="settings">'; |
| 607 | + } |
|
| 600 | 608 | |
| 601 | 609 | // Add a fake heading? |
| 602 | 610 | if (is_string($setting) && !empty($setting)) |
@@ -604,9 +612,9 @@ discard block |
||
| 604 | 612 | $titled_section = true; |
| 605 | 613 | echo ' |
| 606 | 614 | <dt><strong>' . $setting . '</strong></dt><dd></dd>'; |
| 615 | + } else { |
|
| 616 | + $titled_section = false; |
|
| 607 | 617 | } |
| 608 | - else |
|
| 609 | - $titled_section = false; |
|
| 610 | 618 | |
| 611 | 619 | continue; |
| 612 | 620 | } |
@@ -615,9 +623,10 @@ discard block |
||
| 615 | 623 | <dt> |
| 616 | 624 | <label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>:'; |
| 617 | 625 | |
| 618 | - if (isset($setting['description'])) |
|
| 619 | - echo '<br> |
|
| 626 | + if (isset($setting['description'])) { |
|
| 627 | + echo '<br> |
|
| 620 | 628 | <span class="smalltext">', $setting['description'], '</span>'; |
| 629 | + } |
|
| 621 | 630 | |
| 622 | 631 | echo ' |
| 623 | 632 | </dt>'; |
@@ -638,9 +647,10 @@ discard block |
||
| 638 | 647 | <dd> |
| 639 | 648 | <select name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">'; |
| 640 | 649 | |
| 641 | - foreach ($setting['options'] as $value => $label) |
|
| 642 | - echo ' |
|
| 650 | + foreach ($setting['options'] as $value => $label) { |
|
| 651 | + echo ' |
|
| 643 | 652 | <option value="', $value, '"', $value == $setting['value'] ? ' selected' : '', '>', $label, '</option>'; |
| 653 | + } |
|
| 644 | 654 | |
| 645 | 655 | echo ' |
| 646 | 656 | </select> |
@@ -669,13 +679,11 @@ discard block |
||
| 669 | 679 | |
| 670 | 680 | echo ' |
| 671 | 681 | <input type="number"', $min . $max . $step; |
| 672 | - } |
|
| 673 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 682 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 674 | 683 | { |
| 675 | 684 | echo' |
| 676 | 685 | <input type="url"'; |
| 677 | - } |
|
| 678 | - else |
|
| 686 | + } else |
|
| 679 | 687 | { |
| 680 | 688 | echo ' |
| 681 | 689 | <input type="text"'; |
@@ -828,21 +836,23 @@ discard block |
||
| 828 | 836 | <div class="windowbg">'; |
| 829 | 837 | |
| 830 | 838 | // Oops! there was an error :( |
| 831 | - if (!empty($context['error_message'])) |
|
| 832 | - echo ' |
|
| 839 | + if (!empty($context['error_message'])) { |
|
| 840 | + echo ' |
|
| 833 | 841 | <p> |
| 834 | 842 | ', $context['error_message'], ' |
| 835 | 843 | </p>'; |
| 844 | + } |
|
| 836 | 845 | |
| 837 | 846 | // Not much to show except a link back... |
| 838 | - else |
|
| 839 | - echo ' |
|
| 847 | + else { |
|
| 848 | + echo ' |
|
| 840 | 849 | <p> |
| 841 | 850 | <a href="', $scripturl, '?action=admin;area=theme;sa=list;th=', $context['installed_theme']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $context['installed_theme']['name'], '</a> ', $txt['theme_' . (isset($context['installed_theme']['updated']) ? 'updated' : 'installed') . '_message'], ' |
| 842 | 851 | </p> |
| 843 | 852 | <p> |
| 844 | 853 | <a href="', $scripturl, '?action=admin;area=theme;sa=admin;', $context['session_var'], '=', $context['session_id'], '">', $txt['back'], '</a> |
| 845 | 854 | </p>'; |
| 855 | + } |
|
| 846 | 856 | |
| 847 | 857 | echo ' |
| 848 | 858 | </div> |
@@ -909,10 +919,11 @@ discard block |
||
| 909 | 919 | <span class="floatleft">', $template['filename'], $template['already_exists'] ? ' <span class="error">(' . $txt['themeadmin_edit_exists'] . ')</span>' : '', '</span> |
| 910 | 920 | <span class="floatright">'; |
| 911 | 921 | |
| 912 | - if ($template['can_copy']) |
|
| 913 | - echo '<a href="', $scripturl, '?action=admin;area=theme;th=', $context['theme_id'], ';', $context['session_var'], '=', $context['session_id'], ';sa=copy;template=', $template['value'], '" data-confirm="', $template['already_exists'] ? $txt['themeadmin_edit_overwrite_confirm'] : $txt['themeadmin_edit_copy_confirm'], '" class="you_sure">', $txt['themeadmin_edit_do_copy'], '</a>'; |
|
| 914 | - else |
|
| 915 | - echo $txt['themeadmin_edit_no_copy']; |
|
| 922 | + if ($template['can_copy']) { |
|
| 923 | + echo '<a href="', $scripturl, '?action=admin;area=theme;th=', $context['theme_id'], ';', $context['session_var'], '=', $context['session_id'], ';sa=copy;template=', $template['value'], '" data-confirm="', $template['already_exists'] ? $txt['themeadmin_edit_overwrite_confirm'] : $txt['themeadmin_edit_copy_confirm'], '" class="you_sure">', $txt['themeadmin_edit_do_copy'], '</a>'; |
|
| 924 | + } else { |
|
| 925 | + echo $txt['themeadmin_edit_no_copy']; |
|
| 926 | + } |
|
| 916 | 927 | |
| 917 | 928 | echo ' |
| 918 | 929 | </span> |
@@ -935,11 +946,12 @@ discard block |
||
| 935 | 946 | echo ' |
| 936 | 947 | <div id="admincenter">'; |
| 937 | 948 | |
| 938 | - if (!empty($context['browse_title'])) |
|
| 939 | - echo ' |
|
| 949 | + if (!empty($context['browse_title'])) { |
|
| 950 | + echo ' |
|
| 940 | 951 | <div class="cat_bar"> |
| 941 | 952 | <h3 class="catbg">', $context['browse_title'], '</h3> |
| 942 | 953 | </div>'; |
| 954 | + } |
|
| 943 | 955 | |
| 944 | 956 | echo ' |
| 945 | 957 | <table class="table_grid tborder"> |
@@ -959,14 +971,13 @@ discard block |
||
| 959 | 971 | <tr class="windowbg"> |
| 960 | 972 | <td>'; |
| 961 | 973 | |
| 962 | - if ($file['is_editable']) |
|
| 963 | - echo '<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>'; |
|
| 964 | - |
|
| 965 | - elseif ($file['is_directory']) |
|
| 966 | - echo '<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>'; |
|
| 967 | - |
|
| 968 | - else |
|
| 969 | - echo $file['filename']; |
|
| 974 | + if ($file['is_editable']) { |
|
| 975 | + echo '<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>'; |
|
| 976 | + } elseif ($file['is_directory']) { |
|
| 977 | + echo '<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>'; |
|
| 978 | + } else { |
|
| 979 | + echo $file['filename']; |
|
| 980 | + } |
|
| 970 | 981 | |
| 971 | 982 | echo ' |
| 972 | 983 | </td> |
@@ -988,11 +999,12 @@ discard block |
||
| 988 | 999 | { |
| 989 | 1000 | global $context, $settings, $scripturl, $txt; |
| 990 | 1001 | |
| 991 | - if ($context['session_error']) |
|
| 992 | - echo ' |
|
| 1002 | + if ($context['session_error']) { |
|
| 1003 | + echo ' |
|
| 993 | 1004 | <div class="errorbox"> |
| 994 | 1005 | ', $txt['error_session_timeout'], ' |
| 995 | 1006 | </div>'; |
| 1007 | + } |
|
| 996 | 1008 | |
| 997 | 1009 | // From now on no one can complain that editing css is difficult. If you disagree, go to www.w3schools.com. |
| 998 | 1010 | echo ' |
@@ -1055,17 +1067,18 @@ discard block |
||
| 1055 | 1067 | try |
| 1056 | 1068 | { |
| 1057 | 1069 | '; |
| 1058 | - if (isBrowser('is_ie')) |
|
| 1059 | - echo ' |
|
| 1070 | + if (isBrowser('is_ie')) { |
|
| 1071 | + echo ' |
|
| 1060 | 1072 | var sheets = frames["css_preview_box"].document.styleSheets; |
| 1061 | 1073 | for (var j = 0; j < sheets.length; j++) |
| 1062 | 1074 | { |
| 1063 | 1075 | if (sheets[j].id == "css_preview_box") |
| 1064 | 1076 | sheets[j].cssText = document.forms.stylesheetForm.entire_file.value; |
| 1065 | 1077 | }'; |
| 1066 | - else |
|
| 1067 | - echo ' |
|
| 1078 | + } else { |
|
| 1079 | + echo ' |
|
| 1068 | 1080 | setInnerHTML(frames["css_preview_box"].document.getElementById("css_preview_sheet"), document.forms.stylesheetForm.entire_file.value);'; |
| 1081 | + } |
|
| 1069 | 1082 | echo ' |
| 1070 | 1083 | } |
| 1071 | 1084 | catch (e) |
@@ -1117,9 +1130,10 @@ discard block |
||
| 1117 | 1130 | </div> |
| 1118 | 1131 | <div class="windowbg">'; |
| 1119 | 1132 | |
| 1120 | - if (!$context['allow_save']) |
|
| 1121 | - echo ' |
|
| 1133 | + if (!$context['allow_save']) { |
|
| 1134 | + echo ' |
|
| 1122 | 1135 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>'; |
| 1136 | + } |
|
| 1123 | 1137 | |
| 1124 | 1138 | echo ' |
| 1125 | 1139 | <textarea name="entire_file" cols="80" rows="20" style="width: 96%; font-family: monospace; margin-top: 1ex; white-space: pre;" onkeyup="setPreviewTimeout();" onchange="refreshPreview(true);">', $context['entire_file'], '</textarea><br> |
@@ -1132,9 +1146,10 @@ discard block |
||
| 1132 | 1146 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
| 1133 | 1147 | |
| 1134 | 1148 | // Hopefully it exists. |
| 1135 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
| 1136 | - echo ' |
|
| 1149 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
| 1150 | + echo ' |
|
| 1137 | 1151 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
| 1152 | + } |
|
| 1138 | 1153 | |
| 1139 | 1154 | echo ' |
| 1140 | 1155 | </form> |
@@ -1148,18 +1163,20 @@ discard block |
||
| 1148 | 1163 | { |
| 1149 | 1164 | global $context, $scripturl, $txt; |
| 1150 | 1165 | |
| 1151 | - if ($context['session_error']) |
|
| 1152 | - echo ' |
|
| 1166 | + if ($context['session_error']) { |
|
| 1167 | + echo ' |
|
| 1153 | 1168 | <div class="errorbox"> |
| 1154 | 1169 | ', $txt['error_session_timeout'], ' |
| 1155 | 1170 | </div>'; |
| 1171 | + } |
|
| 1156 | 1172 | |
| 1157 | - if (isset($context['parse_error'])) |
|
| 1158 | - echo ' |
|
| 1173 | + if (isset($context['parse_error'])) { |
|
| 1174 | + echo ' |
|
| 1159 | 1175 | <div class="errorbox"> |
| 1160 | 1176 | ', $txt['themeadmin_edit_error'], ' |
| 1161 | 1177 | <div><pre>', $context['parse_error'], '</pre></div> |
| 1162 | 1178 | </div>'; |
| 1179 | + } |
|
| 1163 | 1180 | |
| 1164 | 1181 | // Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.) |
| 1165 | 1182 | echo ' |
@@ -1170,16 +1187,18 @@ discard block |
||
| 1170 | 1187 | </div> |
| 1171 | 1188 | <div class="windowbg">'; |
| 1172 | 1189 | |
| 1173 | - if (!$context['allow_save']) |
|
| 1174 | - echo ' |
|
| 1190 | + if (!$context['allow_save']) { |
|
| 1191 | + echo ' |
|
| 1175 | 1192 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>'; |
| 1193 | + } |
|
| 1176 | 1194 | |
| 1177 | - foreach ($context['file_parts'] as $part) |
|
| 1178 | - echo ' |
|
| 1195 | + foreach ($context['file_parts'] as $part) { |
|
| 1196 | + echo ' |
|
| 1179 | 1197 | <label for="on_line', $part['line'], '">', $txt['themeadmin_edit_on_line'], ' ', $part['line'], '</label>:<br> |
| 1180 | 1198 | <div class="centertext"> |
| 1181 | 1199 | <textarea id="on_line', $part['line'], '" name="entire_file[]" cols="80" rows="', $part['lines'] > 14 ? '14' : $part['lines'], '" class="edit_file">', $part['data'], '</textarea> |
| 1182 | 1200 | </div>'; |
| 1201 | + } |
|
| 1183 | 1202 | |
| 1184 | 1203 | echo ' |
| 1185 | 1204 | <div class="padding righttext"> |
@@ -1188,9 +1207,10 @@ discard block |
||
| 1188 | 1207 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
| 1189 | 1208 | |
| 1190 | 1209 | // Hopefully it exists. |
| 1191 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
| 1192 | - echo ' |
|
| 1210 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
| 1211 | + echo ' |
|
| 1193 | 1212 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
| 1213 | + } |
|
| 1194 | 1214 | |
| 1195 | 1215 | echo ' |
| 1196 | 1216 | </div> |
@@ -1206,18 +1226,20 @@ discard block |
||
| 1206 | 1226 | { |
| 1207 | 1227 | global $context, $scripturl, $txt; |
| 1208 | 1228 | |
| 1209 | - if ($context['session_error']) |
|
| 1210 | - echo ' |
|
| 1229 | + if ($context['session_error']) { |
|
| 1230 | + echo ' |
|
| 1211 | 1231 | <div class="errorbox"> |
| 1212 | 1232 | ', $txt['error_session_timeout'], ' |
| 1213 | 1233 | </div>'; |
| 1234 | + } |
|
| 1214 | 1235 | |
| 1215 | 1236 | //Is this file writeable? |
| 1216 | - if (!$context['allow_save']) |
|
| 1217 | - echo ' |
|
| 1237 | + if (!$context['allow_save']) { |
|
| 1238 | + echo ' |
|
| 1218 | 1239 | <div class="errorbox"> |
| 1219 | 1240 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], ' |
| 1220 | 1241 | </div>'; |
| 1242 | + } |
|
| 1221 | 1243 | |
| 1222 | 1244 | // Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.) |
| 1223 | 1245 | echo ' |
@@ -1233,9 +1255,10 @@ discard block |
||
| 1233 | 1255 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
| 1234 | 1256 | |
| 1235 | 1257 | // Hopefully it exists. |
| 1236 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
| 1237 | - echo ' |
|
| 1258 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
| 1259 | + echo ' |
|
| 1238 | 1260 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
| 1261 | + } |
|
| 1239 | 1262 | |
| 1240 | 1263 | echo ' |
| 1241 | 1264 | </div> |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | class CreatePost_Notify_Background extends SMF_BackgroundTask |
| 19 | 19 | { |
| 20 | 20 | /** |
| 21 | - * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
| 21 | + * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
| 22 | 22 | * @return bool Always returns true |
| 23 | 23 | */ |
| 24 | 24 | public function execute() |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | // Don't send a notification if the watching member ignored the member who made the action. |
| 108 | 108 | if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) |
| 109 | - continue; |
|
| 109 | + continue; |
|
| 110 | 110 | if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started']) |
| 111 | 111 | continue; |
| 112 | 112 | elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) |
@@ -73,8 +73,9 @@ discard block |
||
| 73 | 73 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 74 | 74 | { |
| 75 | 75 | $groups = array_merge(array($row['id_group'], $row['id_post_group']), (empty($row['additional_groups']) ? array() : explode(',', $row['additional_groups']))); |
| 76 | - if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) |
|
| 77 | - continue; |
|
| 76 | + if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) { |
|
| 77 | + continue; |
|
| 78 | + } |
|
| 78 | 79 | |
| 79 | 80 | $members[] = $row['id_member']; |
| 80 | 81 | $watched[$row['id_member']] = $row; |
@@ -82,8 +83,9 @@ discard block |
||
| 82 | 83 | |
| 83 | 84 | $smcFunc['db_free_result']($request); |
| 84 | 85 | |
| 85 | - if (empty($members)) |
|
| 86 | - return true; |
|
| 86 | + if (empty($members)) { |
|
| 87 | + return true; |
|
| 88 | + } |
|
| 87 | 89 | |
| 88 | 90 | $members = array_unique($members); |
| 89 | 91 | $prefs = getNotifyPrefs($members, '', true); |
@@ -105,20 +107,23 @@ discard block |
||
| 105 | 107 | $notify_types = !empty($prefs[$member]['msg_notify_type']) ? $prefs[$member]['msg_notify_type'] : 1; |
| 106 | 108 | |
| 107 | 109 | // Don't send a notification if the watching member ignored the member who made the action. |
| 108 | - if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) |
|
| 109 | - continue; |
|
| 110 | - if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started']) |
|
| 111 | - continue; |
|
| 112 | - elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) |
|
| 113 | - continue; |
|
| 114 | - elseif (!in_array($type, array('reply', 'topic')) && $notify_types == 3) |
|
| 115 | - continue; |
|
| 116 | - elseif ($notify_types == 4) |
|
| 117 | - continue; |
|
| 110 | + if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) { |
|
| 111 | + continue; |
|
| 112 | + } |
|
| 113 | + if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started']) { |
|
| 114 | + continue; |
|
| 115 | + } elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) { |
|
| 116 | + continue; |
|
| 117 | + } elseif (!in_array($type, array('reply', 'topic')) && $notify_types == 3) { |
|
| 118 | + continue; |
|
| 119 | + } elseif ($notify_types == 4) { |
|
| 120 | + continue; |
|
| 121 | + } |
|
| 118 | 122 | |
| 119 | 123 | if ($frequency > 2 || (!empty($frequency) && $data['sent']) || in_array($member, $done_members) |
| 120 | - || (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))) |
|
| 121 | - continue; |
|
| 124 | + || (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))) { |
|
| 125 | + continue; |
|
| 126 | + } |
|
| 122 | 127 | |
| 123 | 128 | // Watched topic? |
| 124 | 129 | if (!empty($data['id_topic']) && $type != 'topic' && !empty($prefs[$member])) |
@@ -128,10 +133,12 @@ discard block |
||
| 128 | 133 | |
| 129 | 134 | if ($type == 'reply') |
| 130 | 135 | { |
| 131 | - if (!empty($prefs[$member]['msg_receive_body'])) |
|
| 132 | - $message_type .= '_body'; |
|
| 133 | - if (!empty($frequency)) |
|
| 134 | - $message_type .= '_once'; |
|
| 136 | + if (!empty($prefs[$member]['msg_receive_body'])) { |
|
| 137 | + $message_type .= '_body'; |
|
| 138 | + } |
|
| 139 | + if (!empty($frequency)) { |
|
| 140 | + $message_type .= '_once'; |
|
| 141 | + } |
|
| 135 | 142 | } |
| 136 | 143 | |
| 137 | 144 | $content_type = 'topic'; |
@@ -144,12 +151,14 @@ discard block |
||
| 144 | 151 | $content_type = 'board'; |
| 145 | 152 | |
| 146 | 153 | $message_type = !empty($frequency) ? 'notify_boards_once' : 'notify_boards'; |
| 147 | - if (!empty($prefs[$member]['msg_receive_body'])) |
|
| 148 | - $message_type .= '_body'; |
|
| 154 | + if (!empty($prefs[$member]['msg_receive_body'])) { |
|
| 155 | + $message_type .= '_body'; |
|
| 156 | + } |
|
| 149 | 157 | } |
| 150 | 158 | // If neither of the above, this might be a redundent row due to the OR clause in our SQL query, skip |
| 151 | - else |
|
| 152 | - continue; |
|
| 159 | + else { |
|
| 160 | + continue; |
|
| 161 | + } |
|
| 153 | 162 | |
| 154 | 163 | if ($pref & 0x02) |
| 155 | 164 | { |
@@ -212,14 +221,15 @@ discard block |
||
| 212 | 221 | ); |
| 213 | 222 | |
| 214 | 223 | // Insert the alerts if any |
| 215 | - if (!empty($alert_rows)) |
|
| 216 | - $smcFunc['db_insert']('', |
|
| 224 | + if (!empty($alert_rows)) { |
|
| 225 | + $smcFunc['db_insert']('', |
|
| 217 | 226 | '{db_prefix}user_alerts', |
| 218 | 227 | array('alert_time' => 'int', 'id_member' => 'int', 'id_member_started' => 'int', 'member_name' => 'string', |
| 219 | 228 | 'content_type' => 'string', 'content_id' => 'int', 'content_action' => 'string', 'is_read' => 'int', 'extra' => 'string'), |
| 220 | 229 | $alert_rows, |
| 221 | 230 | array() |
| 222 | 231 | ); |
| 232 | + } |
|
| 223 | 233 | |
| 224 | 234 | return true; |
| 225 | 235 | } |
@@ -230,8 +240,9 @@ discard block |
||
| 230 | 240 | |
| 231 | 241 | foreach ($quotedMembers as $id => $member) |
| 232 | 242 | { |
| 233 | - if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) |
|
| 234 | - continue; |
|
| 243 | + if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) { |
|
| 244 | + continue; |
|
| 245 | + } |
|
| 235 | 246 | |
| 236 | 247 | $done_members[] = $id; |
| 237 | 248 | |
@@ -283,32 +294,35 @@ discard block |
||
| 283 | 294 | { |
| 284 | 295 | if (preg_match('/\[quote(.*)?\]/i', $block, $matches)) |
| 285 | 296 | { |
| 286 | - if ($quote_level == 0) |
|
| 287 | - $message .= '[quote' . $matches[1] . ']'; |
|
| 297 | + if ($quote_level == 0) { |
|
| 298 | + $message .= '[quote' . $matches[1] . ']'; |
|
| 299 | + } |
|
| 288 | 300 | $quote_level++; |
| 289 | - } |
|
| 290 | - elseif (preg_match('/\[\/quote\]/i', $block)) |
|
| 301 | + } elseif (preg_match('/\[\/quote\]/i', $block)) |
|
| 291 | 302 | { |
| 292 | - if ($quote_level <= 1) |
|
| 293 | - $message .= '[/quote]'; |
|
| 303 | + if ($quote_level <= 1) { |
|
| 304 | + $message .= '[/quote]'; |
|
| 305 | + } |
|
| 294 | 306 | if ($quote_level >= 1) |
| 295 | 307 | { |
| 296 | 308 | $quote_level--; |
| 297 | 309 | $message .= "\n"; |
| 298 | 310 | } |
| 311 | + } elseif ($quote_level <= 1) { |
|
| 312 | + $message .= $block; |
|
| 299 | 313 | } |
| 300 | - elseif ($quote_level <= 1) |
|
| 301 | - $message .= $block; |
|
| 302 | 314 | } |
| 303 | 315 | |
| 304 | 316 | preg_match_all('/\[quote.*?link=msg=([0-9]+).*?\]/i', $message, $matches); |
| 305 | 317 | |
| 306 | 318 | $id_msgs = $matches[1]; |
| 307 | - foreach ($id_msgs as $k => $id_msg) |
|
| 308 | - $id_msgs[$k] = (int) $id_msg; |
|
| 319 | + foreach ($id_msgs as $k => $id_msg) { |
|
| 320 | + $id_msgs[$k] = (int) $id_msg; |
|
| 321 | + } |
|
| 309 | 322 | |
| 310 | - if (empty($id_msgs)) |
|
| 311 | - return array(); |
|
| 323 | + if (empty($id_msgs)) { |
|
| 324 | + return array(); |
|
| 325 | + } |
|
| 312 | 326 | |
| 313 | 327 | // Get the messages |
| 314 | 328 | $request = $smcFunc['db_query']('', ' |
@@ -326,8 +340,9 @@ discard block |
||
| 326 | 340 | $members = array(); |
| 327 | 341 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 328 | 342 | { |
| 329 | - if ($posterOptions['id'] == $row['id_member']) |
|
| 330 | - continue; |
|
| 343 | + if ($posterOptions['id'] == $row['id_member']) { |
|
| 344 | + continue; |
|
| 345 | + } |
|
| 331 | 346 | |
| 332 | 347 | $members[$row['id_member']] = $row; |
| 333 | 348 | } |
@@ -341,10 +356,11 @@ discard block |
||
| 341 | 356 | |
| 342 | 357 | foreach ($members as $id => $member) |
| 343 | 358 | { |
| 344 | - if (!empty($prefs[$id]['msg_mention'])) |
|
| 345 | - $done_members[] = $id; |
|
| 346 | - else |
|
| 347 | - continue; |
|
| 359 | + if (!empty($prefs[$id]['msg_mention'])) { |
|
| 360 | + $done_members[] = $id; |
|
| 361 | + } else { |
|
| 362 | + continue; |
|
| 363 | + } |
|
| 348 | 364 | |
| 349 | 365 | // Alerts' emails are always instant |
| 350 | 366 | if ($prefs[$id]['msg_mention'] & 0x02) |
@@ -51,30 +51,33 @@ discard block |
||
| 51 | 51 | $ignored_members = explode(',', $row['pm_ignore_list']); |
| 52 | 52 | |
| 53 | 53 | // If the user is in group 1 anywhere, they can see everything anyway. |
| 54 | - if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0) |
|
| 55 | - $author = $row['id_member']; |
|
| 54 | + if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0) { |
|
| 55 | + $author = $row['id_member']; |
|
| 56 | + } |
|
| 56 | 57 | } |
| 57 | 58 | $smcFunc['db_free_result']($request); |
| 58 | - } |
|
| 59 | - else |
|
| 59 | + } else |
|
| 60 | 60 | { |
| 61 | 61 | // This isn't something we know natively how to support. Call the hooks, if they're dealing with it, return false, otherwise return the user id. |
| 62 | 62 | $hook_results = call_integration_hook('integrate_find_like_author', array($this->_details['content_type'], $this->_details['content_id'])); |
| 63 | - foreach ($hook_results as $result) |
|
| 64 | - if (!empty($result)) |
|
| 63 | + foreach ($hook_results as $result) { |
|
| 64 | + if (!empty($result)) |
|
| 65 | 65 | { |
| 66 | 66 | $author = $result; |
| 67 | + } |
|
| 67 | 68 | break; |
| 68 | 69 | } |
| 69 | 70 | } |
| 70 | 71 | |
| 71 | 72 | // If we didn't have a member... leave. |
| 72 | - if (empty($author)) |
|
| 73 | - return true; |
|
| 73 | + if (empty($author)) { |
|
| 74 | + return true; |
|
| 75 | + } |
|
| 74 | 76 | |
| 75 | 77 | // If the person who sent the notification is the person whose content it is, do nothing. |
| 76 | - if ($author == $this->_details['sender_id']) |
|
| 77 | - return true; |
|
| 78 | + if ($author == $this->_details['sender_id']) { |
|
| 79 | + return true; |
|
| 80 | + } |
|
| 78 | 81 | |
| 79 | 82 | // If the person who sent the notification is on this person's ignore list, do nothing. |
| 80 | 83 | if (!empty($ignored_members) && in_array($this->_details['sender_id'], $ignored_members)) { |
@@ -88,8 +91,9 @@ discard block |
||
| 88 | 91 | // As a result, the value should really just be non empty. |
| 89 | 92 | |
| 90 | 93 | // Check the value. If no value or it's empty, they didn't want alerts, oh well. |
| 91 | - if (empty($prefs[$author][$this->_details['content_type'] . '_like'])) |
|
| 92 | - return true; |
|
| 94 | + if (empty($prefs[$author][$this->_details['content_type'] . '_like'])) { |
|
| 95 | + return true; |
|
| 96 | + } |
|
| 93 | 97 | |
| 94 | 98 | // Don't spam the alerts: if there is an existing unread alert of the |
| 95 | 99 | // requested type for the target user from the sender, don't make a new one. |
@@ -109,8 +113,9 @@ discard block |
||
| 109 | 113 | ) |
| 110 | 114 | ); |
| 111 | 115 | |
| 112 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
| 113 | - return true; |
|
| 116 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
| 117 | + return true; |
|
| 118 | + } |
|
| 114 | 119 | $smcFunc['db_free_result']($request); |
| 115 | 120 | |
| 116 | 121 | // Issue, update, move on. |
@@ -670,7 +670,7 @@ |
||
| 670 | 670 | // Show "<< Last Edit: Time by Person >>" if this post was edited. But we need the div even if it wasn't modified! |
| 671 | 671 | // Because we insert into it through AJAX and we don't want to stop themers moving it around if they so wish so they can put it where they want it. |
| 672 | 672 | echo ' |
| 673 | - <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '','" id="modified_', $message['id'], '">'; |
|
| 673 | + <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '', '" id="modified_', $message['id'], '">'; |
|
| 674 | 674 | |
| 675 | 675 | if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
| 676 | 676 | echo |
@@ -51,11 +51,13 @@ discard block |
||
| 51 | 51 | <p>'; |
| 52 | 52 | |
| 53 | 53 | // Show just numbers...? |
| 54 | - if ($settings['display_who_viewing'] == 1) |
|
| 55 | - echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
| 54 | + if ($settings['display_who_viewing'] == 1) { |
|
| 55 | + echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
| 56 | + } |
|
| 56 | 57 | // Or show the actual people viewing the topic? |
| 57 | - else |
|
| 58 | - echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
| 58 | + else { |
|
| 59 | + echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
| 60 | + } |
|
| 59 | 61 | |
| 60 | 62 | // Now show how many guests are here too. |
| 61 | 63 | echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], ' |
@@ -93,10 +95,11 @@ discard block |
||
| 93 | 95 | <dt class="', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt> |
| 94 | 96 | <dd class="statsbar', $option['voted_this'] ? ' voted' : '', '">'; |
| 95 | 97 | |
| 96 | - if ($context['allow_results_view']) |
|
| 97 | - echo ' |
|
| 98 | + if ($context['allow_results_view']) { |
|
| 99 | + echo ' |
|
| 98 | 100 | ', $option['bar_ndt'], ' |
| 99 | 101 | <span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>'; |
| 102 | + } |
|
| 100 | 103 | |
| 101 | 104 | echo ' |
| 102 | 105 | </dd>'; |
@@ -105,9 +108,10 @@ discard block |
||
| 105 | 108 | echo ' |
| 106 | 109 | </dl>'; |
| 107 | 110 | |
| 108 | - if ($context['allow_results_view']) |
|
| 109 | - echo ' |
|
| 111 | + if ($context['allow_results_view']) { |
|
| 112 | + echo ' |
|
| 110 | 113 | <p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>'; |
| 114 | + } |
|
| 111 | 115 | } |
| 112 | 116 | // They are allowed to vote! Go to it! |
| 113 | 117 | else |
@@ -116,17 +120,19 @@ discard block |
||
| 116 | 120 | <form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">'; |
| 117 | 121 | |
| 118 | 122 | // Show a warning if they are allowed more than one option. |
| 119 | - if ($context['poll']['allowed_warning']) |
|
| 120 | - echo ' |
|
| 123 | + if ($context['poll']['allowed_warning']) { |
|
| 124 | + echo ' |
|
| 121 | 125 | <p class="smallpadding">', $context['poll']['allowed_warning'], '</p>'; |
| 126 | + } |
|
| 122 | 127 | |
| 123 | 128 | echo ' |
| 124 | 129 | <ul class="options">'; |
| 125 | 130 | |
| 126 | 131 | // Show each option with its button - a radio likely. |
| 127 | - foreach ($context['poll']['options'] as $option) |
|
| 128 | - echo ' |
|
| 132 | + foreach ($context['poll']['options'] as $option) { |
|
| 133 | + echo ' |
|
| 129 | 134 | <li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>'; |
| 135 | + } |
|
| 130 | 136 | |
| 131 | 137 | echo ' |
| 132 | 138 | </ul> |
@@ -138,9 +144,10 @@ discard block |
||
| 138 | 144 | } |
| 139 | 145 | |
| 140 | 146 | // Is the clock ticking? |
| 141 | - if (!empty($context['poll']['expire_time'])) |
|
| 142 | - echo ' |
|
| 147 | + if (!empty($context['poll']['expire_time'])) { |
|
| 148 | + echo ' |
|
| 143 | 149 | <p><strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '</p>'; |
| 150 | + } |
|
| 144 | 151 | |
| 145 | 152 | echo ' |
| 146 | 153 | </div> |
@@ -170,11 +177,13 @@ discard block |
||
| 170 | 177 | <li> |
| 171 | 178 | <b class="event_title"><a href="', $scripturl, '?action=calendar;event=', $event['id'], '">', $event['title'], '</a></b>'; |
| 172 | 179 | |
| 173 | - if ($event['can_edit']) |
|
| 174 | - echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
| 180 | + if ($event['can_edit']) { |
|
| 181 | + echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
| 182 | + } |
|
| 175 | 183 | |
| 176 | - if ($event['can_export']) |
|
| 177 | - echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
| 184 | + if ($event['can_export']) { |
|
| 185 | + echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
| 186 | + } |
|
| 178 | 187 | |
| 179 | 188 | echo ' |
| 180 | 189 | <br>'; |
@@ -182,14 +191,14 @@ discard block |
||
| 182 | 191 | if (!empty($event['allday'])) |
| 183 | 192 | { |
| 184 | 193 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' – <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : ''; |
| 185 | - } |
|
| 186 | - else |
|
| 194 | + } else |
|
| 187 | 195 | { |
| 188 | 196 | // Display event info relative to user's local timezone |
| 189 | 197 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
| 190 | 198 | |
| 191 | - if ($event['start_date_local'] != $event['end_date_local']) |
|
| 192 | - echo trim($event['end_date_local']) . ', '; |
|
| 199 | + if ($event['start_date_local'] != $event['end_date_local']) { |
|
| 200 | + echo trim($event['end_date_local']) . ', '; |
|
| 201 | + } |
|
| 193 | 202 | |
| 194 | 203 | echo trim($event['end_time_local']); |
| 195 | 204 | |
@@ -198,23 +207,27 @@ discard block |
||
| 198 | 207 | { |
| 199 | 208 | echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">'; |
| 200 | 209 | |
| 201 | - if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) |
|
| 202 | - echo trim($event['start_date_orig']), ', '; |
|
| 210 | + if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) { |
|
| 211 | + echo trim($event['start_date_orig']), ', '; |
|
| 212 | + } |
|
| 203 | 213 | |
| 204 | 214 | echo trim($event['start_time_orig']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
| 205 | 215 | |
| 206 | - if ($event['start_date_orig'] != $event['end_date_orig']) |
|
| 207 | - echo trim($event['end_date_orig']) . ', '; |
|
| 216 | + if ($event['start_date_orig'] != $event['end_date_orig']) { |
|
| 217 | + echo trim($event['end_date_orig']) . ', '; |
|
| 218 | + } |
|
| 208 | 219 | |
| 209 | 220 | echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)'; |
| 210 | 221 | } |
| 211 | 222 | // Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion |
| 212 | - else |
|
| 213 | - echo ' ', $event['tz_abbrev'], '</time>'; |
|
| 223 | + else { |
|
| 224 | + echo ' ', $event['tz_abbrev'], '</time>'; |
|
| 225 | + } |
|
| 214 | 226 | } |
| 215 | 227 | |
| 216 | - if (!empty($event['location'])) |
|
| 217 | - echo '<br>', $event['location']; |
|
| 228 | + if (!empty($event['location'])) { |
|
| 229 | + echo '<br>', $event['location']; |
|
| 230 | + } |
|
| 218 | 231 | |
| 219 | 232 | echo ' |
| 220 | 233 | </li>'; |
@@ -253,8 +266,9 @@ discard block |
||
| 253 | 266 | $context['removableMessageIDs'] = array(); |
| 254 | 267 | |
| 255 | 268 | // Get all the messages... |
| 256 | - while ($message = $context['get_message']()) |
|
| 257 | - template_single_post($message); |
|
| 269 | + while ($message = $context['get_message']()) { |
|
| 270 | + template_single_post($message); |
|
| 271 | + } |
|
| 258 | 272 | |
| 259 | 273 | echo ' |
| 260 | 274 | </form> |
@@ -292,8 +306,9 @@ discard block |
||
| 292 | 306 | <div id="display_jump_to"> </div>'; |
| 293 | 307 | |
| 294 | 308 | // Show quickreply |
| 295 | - if ($context['can_reply']) |
|
| 296 | - template_quickreply(); |
|
| 309 | + if ($context['can_reply']) { |
|
| 310 | + template_quickreply(); |
|
| 311 | + } |
|
| 297 | 312 | |
| 298 | 313 | // User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device. |
| 299 | 314 | echo ' |
@@ -306,8 +321,8 @@ discard block |
||
| 306 | 321 | </div>'; |
| 307 | 322 | |
| 308 | 323 | // Show the moderation button & pop only if user can moderate |
| 309 | - if ($context['can_moderate_forum'] || $context['user']['is_mod']) |
|
| 310 | - echo ' |
|
| 324 | + if ($context['can_moderate_forum'] || $context['user']['is_mod']) { |
|
| 325 | + echo ' |
|
| 311 | 326 | <div id="mobile_moderation" class="popup_container"> |
| 312 | 327 | <div class="popup_window description"> |
| 313 | 328 | <div class="popup_heading">', $txt['mobile_moderation'], ' |
@@ -317,6 +332,7 @@ discard block |
||
| 317 | 332 | </div> |
| 318 | 333 | </div> |
| 319 | 334 | </div>'; |
| 335 | + } |
|
| 320 | 336 | |
| 321 | 337 | echo ' |
| 322 | 338 | <script>'; |
@@ -440,9 +456,10 @@ discard block |
||
| 440 | 456 | }); |
| 441 | 457 | }'; |
| 442 | 458 | |
| 443 | - if (!empty($context['ignoredMsgs'])) |
|
| 444 | - echo ' |
|
| 459 | + if (!empty($context['ignoredMsgs'])) { |
|
| 460 | + echo ' |
|
| 445 | 461 | ignore_toggles([', implode(', ', $context['ignoredMsgs']), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');'; |
| 462 | + } |
|
| 446 | 463 | |
| 447 | 464 | echo ' |
| 448 | 465 | </script>'; |
@@ -459,8 +476,9 @@ discard block |
||
| 459 | 476 | |
| 460 | 477 | $ignoring = false; |
| 461 | 478 | |
| 462 | - if ($message['can_remove']) |
|
| 463 | - $context['removableMessageIDs'][] = $message['id']; |
|
| 479 | + if ($message['can_remove']) { |
|
| 480 | + $context['removableMessageIDs'][] = $message['id']; |
|
| 481 | + } |
|
| 464 | 482 | |
| 465 | 483 | // Are we ignoring this message? |
| 466 | 484 | if (!empty($message['is_ignored'])) |
@@ -486,9 +504,10 @@ discard block |
||
| 486 | 504 | <div class="custom_fields_above_member"> |
| 487 | 505 | <ul class="nolist">'; |
| 488 | 506 | |
| 489 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
| 490 | - echo ' |
|
| 507 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
| 508 | + echo ' |
|
| 491 | 509 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 510 | + } |
|
| 492 | 511 | |
| 493 | 512 | echo ' |
| 494 | 513 | </ul> |
@@ -499,9 +518,10 @@ discard block |
||
| 499 | 518 | <h4>'; |
| 500 | 519 | |
| 501 | 520 | // Show online and offline buttons? |
| 502 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
| 503 | - echo ' |
|
| 521 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
| 522 | + echo ' |
|
| 504 | 523 | ', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>', $context['can_send_pm'] ? '</a>' : ''; |
| 524 | + } |
|
| 505 | 525 | |
| 506 | 526 | |
| 507 | 527 | // Show a link to the member's profile. |
@@ -514,51 +534,59 @@ discard block |
||
| 514 | 534 | |
| 515 | 535 | |
| 516 | 536 | // Show the user's avatar. |
| 517 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
| 518 | - echo ' |
|
| 537 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
| 538 | + echo ' |
|
| 519 | 539 | <li class="avatar"> |
| 520 | 540 | <a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a> |
| 521 | 541 | </li>'; |
| 542 | + } |
|
| 522 | 543 | |
| 523 | 544 | // Are there any custom fields below the avatar? |
| 524 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
| 525 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 545 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
| 546 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 526 | 547 | echo ' |
| 527 | 548 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 549 | + } |
|
| 528 | 550 | |
| 529 | 551 | // Show the post group icons, but not for guests. |
| 530 | - if (!$message['member']['is_guest']) |
|
| 531 | - echo ' |
|
| 552 | + if (!$message['member']['is_guest']) { |
|
| 553 | + echo ' |
|
| 532 | 554 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
| 555 | + } |
|
| 533 | 556 | |
| 534 | 557 | // Show the member's primary group (like 'Administrator') if they have one. |
| 535 | - if (!empty($message['member']['group'])) |
|
| 536 | - echo ' |
|
| 558 | + if (!empty($message['member']['group'])) { |
|
| 559 | + echo ' |
|
| 537 | 560 | <li class="membergroup">', $message['member']['group'], '</li>'; |
| 561 | + } |
|
| 538 | 562 | |
| 539 | 563 | // Show the member's custom title, if they have one. |
| 540 | - if (!empty($message['member']['title'])) |
|
| 541 | - echo ' |
|
| 564 | + if (!empty($message['member']['title'])) { |
|
| 565 | + echo ' |
|
| 542 | 566 | <li class="title">', $message['member']['title'], '</li>'; |
| 567 | + } |
|
| 543 | 568 | |
| 544 | 569 | // Don't show these things for guests. |
| 545 | 570 | if (!$message['member']['is_guest']) |
| 546 | 571 | { |
| 547 | 572 | |
| 548 | 573 | // Show the post group if and only if they have no other group or the option is on, and they are in a post group. |
| 549 | - if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) |
|
| 550 | - echo ' |
|
| 574 | + if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) { |
|
| 575 | + echo ' |
|
| 551 | 576 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
| 577 | + } |
|
| 552 | 578 | |
| 553 | 579 | // Show how many posts they have made. |
| 554 | - if (!isset($context['disabled_fields']['posts'])) |
|
| 555 | - echo ' |
|
| 580 | + if (!isset($context['disabled_fields']['posts'])) { |
|
| 581 | + echo ' |
|
| 556 | 582 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
| 583 | + } |
|
| 557 | 584 | |
| 558 | 585 | // Show their personal text? |
| 559 | - if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) |
|
| 560 | - echo ' |
|
| 586 | + if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) { |
|
| 587 | + echo ' |
|
| 561 | 588 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
| 589 | + } |
|
| 562 | 590 | |
| 563 | 591 | // Any custom fields to show as icons? |
| 564 | 592 | if (!empty($message['custom_fields']['icons'])) |
@@ -567,9 +595,10 @@ discard block |
||
| 567 | 595 | <li class="im_icons"> |
| 568 | 596 | <ol>'; |
| 569 | 597 | |
| 570 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
| 571 | - echo ' |
|
| 598 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
| 599 | + echo ' |
|
| 572 | 600 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 601 | + } |
|
| 573 | 602 | |
| 574 | 603 | echo ' |
| 575 | 604 | </ol> |
@@ -584,19 +613,22 @@ discard block |
||
| 584 | 613 | <ol class="profile_icons">'; |
| 585 | 614 | |
| 586 | 615 | // Don't show an icon if they haven't specified a website. |
| 587 | - if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) |
|
| 588 | - echo ' |
|
| 616 | + if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) { |
|
| 617 | + echo ' |
|
| 589 | 618 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
| 619 | + } |
|
| 590 | 620 | |
| 591 | 621 | // Since we know this person isn't a guest, you *can* message them. |
| 592 | - if ($context['can_send_pm']) |
|
| 593 | - echo ' |
|
| 622 | + if ($context['can_send_pm']) { |
|
| 623 | + echo ' |
|
| 594 | 624 | <li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>'; |
| 625 | + } |
|
| 595 | 626 | |
| 596 | 627 | // Show the email if necessary |
| 597 | - if (!empty($message['member']['email']) && $message['member']['show_email']) |
|
| 598 | - echo ' |
|
| 628 | + if (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
| 629 | + echo ' |
|
| 599 | 630 | <li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
| 631 | + } |
|
| 600 | 632 | |
| 601 | 633 | echo ' |
| 602 | 634 | </ol> |
@@ -604,48 +636,56 @@ discard block |
||
| 604 | 636 | } |
| 605 | 637 | |
| 606 | 638 | // Any custom fields for standard placement? |
| 607 | - if (!empty($message['custom_fields']['standard'])) |
|
| 608 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
| 639 | + if (!empty($message['custom_fields']['standard'])) { |
|
| 640 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
| 609 | 641 | echo ' |
| 610 | 642 | <li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>'; |
| 643 | + } |
|
| 611 | 644 | |
| 612 | 645 | } |
| 613 | 646 | // Otherwise, show the guest's email. |
| 614 | - elseif (!empty($message['member']['email']) && $message['member']['show_email']) |
|
| 615 | - echo ' |
|
| 647 | + elseif (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
| 648 | + echo ' |
|
| 616 | 649 | <li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
| 650 | + } |
|
| 617 | 651 | |
| 618 | 652 | // Show the IP to this user for this post - because you can moderate? |
| 619 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
| 620 | - echo ' |
|
| 653 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
| 654 | + echo ' |
|
| 621 | 655 | <li class="poster_ip"><a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a></li>'; |
| 656 | + } |
|
| 622 | 657 | |
| 623 | 658 | // Or, should we show it because this is you? |
| 624 | - elseif ($message['can_see_ip']) |
|
| 625 | - echo ' |
|
| 659 | + elseif ($message['can_see_ip']) { |
|
| 660 | + echo ' |
|
| 626 | 661 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>'; |
| 662 | + } |
|
| 627 | 663 | |
| 628 | 664 | // Okay, are you at least logged in? Then we can show something about why IPs are logged... |
| 629 | - elseif (!$context['user']['is_guest']) |
|
| 630 | - echo ' |
|
| 665 | + elseif (!$context['user']['is_guest']) { |
|
| 666 | + echo ' |
|
| 631 | 667 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>'; |
| 668 | + } |
|
| 632 | 669 | |
| 633 | 670 | // Otherwise, you see NOTHING! |
| 634 | - else |
|
| 635 | - echo ' |
|
| 671 | + else { |
|
| 672 | + echo ' |
|
| 636 | 673 | <li class="poster_ip">', $txt['logged'], '</li>'; |
| 674 | + } |
|
| 637 | 675 | |
| 638 | 676 | // Are we showing the warning status? |
| 639 | 677 | // Don't show these things for guests. |
| 640 | - if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) |
|
| 641 | - echo ' |
|
| 678 | + if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) { |
|
| 679 | + echo ' |
|
| 642 | 680 | <li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span> ', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>'; |
| 681 | + } |
|
| 643 | 682 | |
| 644 | 683 | // Are there any custom fields to show at the bottom of the poster info? |
| 645 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
| 646 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 684 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
| 685 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 647 | 686 | echo ' |
| 648 | 687 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 688 | + } |
|
| 649 | 689 | |
| 650 | 690 | // Poster info ends. |
| 651 | 691 | echo ' |
@@ -674,9 +714,10 @@ discard block |
||
| 674 | 714 | echo ' |
| 675 | 715 | <span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '','" id="modified_', $message['id'], '">'; |
| 676 | 716 | |
| 677 | - if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
|
| 678 | - echo |
|
| 717 | + if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) { |
|
| 718 | + echo |
|
| 679 | 719 | $message['modified']['last_edit_text']; |
| 720 | + } |
|
| 680 | 721 | |
| 681 | 722 | echo ' |
| 682 | 723 | </span> |
@@ -685,22 +726,24 @@ discard block |
||
| 685 | 726 | </div>'; |
| 686 | 727 | |
| 687 | 728 | // Ignoring this user? Hide the post. |
| 688 | - if ($ignoring) |
|
| 689 | - echo ' |
|
| 729 | + if ($ignoring) { |
|
| 730 | + echo ' |
|
| 690 | 731 | <div id="msg_', $message['id'], '_ignored_prompt"> |
| 691 | 732 | ', $txt['ignoring_user'], ' |
| 692 | 733 | <a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a> |
| 693 | 734 | </div>'; |
| 735 | + } |
|
| 694 | 736 | |
| 695 | 737 | // Show the post itself, finally! |
| 696 | 738 | echo ' |
| 697 | 739 | <div class="post">'; |
| 698 | 740 | |
| 699 | - if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) |
|
| 700 | - echo ' |
|
| 741 | + if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) { |
|
| 742 | + echo ' |
|
| 701 | 743 | <div class="approve_post"> |
| 702 | 744 | ', $txt['post_awaiting_approval'], ' |
| 703 | 745 | </div>'; |
| 746 | + } |
|
| 704 | 747 | echo ' |
| 705 | 748 | <div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>', $message['body'], '</div> |
| 706 | 749 | </div>'; |
@@ -717,9 +760,9 @@ discard block |
||
| 717 | 760 | foreach ($message['attachment'] as $attachment) |
| 718 | 761 | { |
| 719 | 762 | // Do we want this attachment to not be showed here? |
| 720 | - if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) |
|
| 721 | - continue; |
|
| 722 | - elseif (!$div_output) |
|
| 763 | + if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) { |
|
| 764 | + continue; |
|
| 765 | + } elseif (!$div_output) |
|
| 723 | 766 | { |
| 724 | 767 | $div_output = true; |
| 725 | 768 | |
@@ -735,9 +778,10 @@ discard block |
||
| 735 | 778 | <fieldset> |
| 736 | 779 | <legend>', $txt['attach_awaiting_approve']; |
| 737 | 780 | |
| 738 | - if ($context['can_approve']) |
|
| 739 | - echo ' |
|
| 781 | + if ($context['can_approve']) { |
|
| 782 | + echo ' |
|
| 740 | 783 | [<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]'; |
| 784 | + } |
|
| 741 | 785 | |
| 742 | 786 | echo ' |
| 743 | 787 | </legend>'; |
@@ -751,12 +795,13 @@ discard block |
||
| 751 | 795 | echo ' |
| 752 | 796 | <div class="attachments_top">'; |
| 753 | 797 | |
| 754 | - if ($attachment['thumbnail']['has_thumb']) |
|
| 755 | - echo ' |
|
| 798 | + if ($attachment['thumbnail']['has_thumb']) { |
|
| 799 | + echo ' |
|
| 756 | 800 | <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" class="atc_img"></a>'; |
| 757 | - else |
|
| 758 | - echo ' |
|
| 801 | + } else { |
|
| 802 | + echo ' |
|
| 759 | 803 | <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" class="atc_img">'; |
| 804 | + } |
|
| 760 | 805 | |
| 761 | 806 | echo ' |
| 762 | 807 | </div>'; |
@@ -766,9 +811,10 @@ discard block |
||
| 766 | 811 | <div class="attachments_bot"> |
| 767 | 812 | <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*"> ' . $attachment['name'] . '</a> '; |
| 768 | 813 | |
| 769 | - if (!$attachment['is_approved'] && $context['can_approve']) |
|
| 770 | - echo ' |
|
| 814 | + if (!$attachment['is_approved'] && $context['can_approve']) { |
|
| 815 | + echo ' |
|
| 771 | 816 | [<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>] | [<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] '; |
| 817 | + } |
|
| 772 | 818 | echo ' |
| 773 | 819 | <br>', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br>' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br>' . sprintf($txt['attach_downloaded'], $attachment['downloads'])), ' |
| 774 | 820 | </div>'; |
@@ -777,33 +823,38 @@ discard block |
||
| 777 | 823 | </div>'; |
| 778 | 824 | |
| 779 | 825 | // Next attachment line ? |
| 780 | - if (++$i % $attachments_per_line === 0) |
|
| 781 | - echo ' |
|
| 826 | + if (++$i % $attachments_per_line === 0) { |
|
| 827 | + echo ' |
|
| 782 | 828 | <br>'; |
| 829 | + } |
|
| 783 | 830 | } |
| 784 | 831 | |
| 785 | 832 | // If we had unapproved attachments clean up. |
| 786 | - if ($last_approved_state == 0) |
|
| 787 | - echo ' |
|
| 833 | + if ($last_approved_state == 0) { |
|
| 834 | + echo ' |
|
| 788 | 835 | </fieldset>'; |
| 836 | + } |
|
| 789 | 837 | |
| 790 | 838 | // Only do this if we output a div above - otherwise it'll break things |
| 791 | - if ($div_output) |
|
| 792 | - echo ' |
|
| 839 | + if ($div_output) { |
|
| 840 | + echo ' |
|
| 793 | 841 | </div>'; |
| 842 | + } |
|
| 794 | 843 | } |
| 795 | 844 | |
| 796 | 845 | // And stuff below the attachments. |
| 797 | - if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
| 798 | - echo ' |
|
| 846 | + if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
| 847 | + echo ' |
|
| 799 | 848 | <div class="under_message">'; |
| 849 | + } |
|
| 800 | 850 | |
| 801 | 851 | // Maybe they want to report this post to the moderator(s)? |
| 802 | - if ($context['can_report_moderator']) |
|
| 803 | - echo ' |
|
| 852 | + if ($context['can_report_moderator']) { |
|
| 853 | + echo ' |
|
| 804 | 854 | <ul class="floatright smalltext"> |
| 805 | 855 | <li class="report_link"><a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a></li> |
| 806 | 856 | </ul>'; |
| 857 | + } |
|
| 807 | 858 | |
| 808 | 859 | // What about likes? |
| 809 | 860 | if (!empty($modSettings['enable_likes'])) |
@@ -844,78 +895,91 @@ discard block |
||
| 844 | 895 | <ul class="quickbuttons">'; |
| 845 | 896 | |
| 846 | 897 | // Can they quote? if so they can select and quote as well! |
| 847 | - if ($context['can_quote']) |
|
| 848 | - echo ' |
|
| 898 | + if ($context['can_quote']) { |
|
| 899 | + echo ' |
|
| 849 | 900 | <li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li> |
| 850 | 901 | <li style="display:none;" id="quoteSelected_', $message['id'], '"><a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'], '</a></li>'; |
| 902 | + } |
|
| 851 | 903 | |
| 852 | 904 | // Can the user modify the contents of this post? Show the modify inline image. |
| 853 | - if ($message['can_modify']) |
|
| 854 | - echo ' |
|
| 905 | + if ($message['can_modify']) { |
|
| 906 | + echo ' |
|
| 855 | 907 | <li class="quick_edit"><a title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\', \'', !empty($modSettings['toggle_subject']), '\')"><span class="generic_icons quick_edit_button"></span>', $txt['quick_edit'], '</a></li>'; |
| 908 | + } |
|
| 856 | 909 | |
| 857 | - if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
| 858 | - echo ' |
|
| 910 | + if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
| 911 | + echo ' |
|
| 859 | 912 | <li class="post_options">', $txt['post_options']; |
| 913 | + } |
|
| 860 | 914 | |
| 861 | 915 | echo ' |
| 862 | 916 | <ul>'; |
| 863 | 917 | |
| 864 | 918 | // Can the user modify the contents of this post? |
| 865 | - if ($message['can_modify']) |
|
| 866 | - echo ' |
|
| 919 | + if ($message['can_modify']) { |
|
| 920 | + echo ' |
|
| 867 | 921 | <li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '"><span class="generic_icons modify_button"></span>', $txt['modify'], '</a></li>'; |
| 922 | + } |
|
| 868 | 923 | |
| 869 | 924 | // How about... even... remove it entirely?! |
| 870 | - if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) |
|
| 871 | - echo ' |
|
| 925 | + if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) { |
|
| 926 | + echo ' |
|
| 872 | 927 | <li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'], '</a></li>'; |
| 873 | - elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) |
|
| 874 | - echo ' |
|
| 928 | + } elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) { |
|
| 929 | + echo ' |
|
| 875 | 930 | <li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
| 931 | + } |
|
| 876 | 932 | |
| 877 | 933 | // What about splitting it off the rest of the topic? |
| 878 | - if ($context['can_split'] && !empty($context['real_num_replies'])) |
|
| 879 | - echo ' |
|
| 934 | + if ($context['can_split'] && !empty($context['real_num_replies'])) { |
|
| 935 | + echo ' |
|
| 880 | 936 | <li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '"><span class="generic_icons split_button"></span>', $txt['split'], '</a></li>'; |
| 937 | + } |
|
| 881 | 938 | |
| 882 | 939 | // Can we issue a warning because of this post? Remember, we can't give guests warnings. |
| 883 | - if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) |
|
| 884 | - echo ' |
|
| 940 | + if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) { |
|
| 941 | + echo ' |
|
| 885 | 942 | <li><a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><span class="generic_icons warn_button"></span>', $txt['issue_warning'], '</a></li>'; |
| 943 | + } |
|
| 886 | 944 | |
| 887 | 945 | // Can we restore topics? |
| 888 | - if ($context['can_restore_msg']) |
|
| 889 | - echo ' |
|
| 946 | + if ($context['can_restore_msg']) { |
|
| 947 | + echo ' |
|
| 890 | 948 | <li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons restore_button"></span>', $txt['restore_message'], '</a></li>'; |
| 949 | + } |
|
| 891 | 950 | |
| 892 | 951 | // Maybe we can approve it, maybe we should? |
| 893 | - if ($message['can_approve']) |
|
| 894 | - echo ' |
|
| 952 | + if ($message['can_approve']) { |
|
| 953 | + echo ' |
|
| 895 | 954 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons approve_button"></span>', $txt['approve'], '</a></li>'; |
| 955 | + } |
|
| 896 | 956 | |
| 897 | 957 | // Maybe we can unapprove it? |
| 898 | - if ($message['can_unapprove']) |
|
| 899 | - echo ' |
|
| 958 | + if ($message['can_unapprove']) { |
|
| 959 | + echo ' |
|
| 900 | 960 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons unapprove_button"></span>', $txt['unapprove'], '</a></li>'; |
| 961 | + } |
|
| 901 | 962 | |
| 902 | 963 | echo ' |
| 903 | 964 | </ul> |
| 904 | 965 | </li>'; |
| 905 | 966 | |
| 906 | 967 | // Show a checkbox for quick moderation? |
| 907 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) |
|
| 908 | - echo ' |
|
| 968 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) { |
|
| 969 | + echo ' |
|
| 909 | 970 | <li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>'; |
| 971 | + } |
|
| 910 | 972 | |
| 911 | - if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
| 912 | - echo ' |
|
| 973 | + if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
| 974 | + echo ' |
|
| 913 | 975 | </ul>'; |
| 976 | + } |
|
| 914 | 977 | } |
| 915 | 978 | |
| 916 | - if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
| 917 | - echo ' |
|
| 979 | + if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
| 980 | + echo ' |
|
| 918 | 981 | </div>'; |
| 982 | + } |
|
| 919 | 983 | |
| 920 | 984 | echo ' |
| 921 | 985 | </div> |
@@ -928,9 +992,10 @@ discard block |
||
| 928 | 992 | <div class="custom_fields_above_signature"> |
| 929 | 993 | <ul class="nolist">'; |
| 930 | 994 | |
| 931 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
| 932 | - echo ' |
|
| 995 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
| 996 | + echo ' |
|
| 933 | 997 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 998 | + } |
|
| 934 | 999 | |
| 935 | 1000 | echo ' |
| 936 | 1001 | </ul> |
@@ -938,9 +1003,10 @@ discard block |
||
| 938 | 1003 | } |
| 939 | 1004 | |
| 940 | 1005 | // Show the member's signature? |
| 941 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
| 942 | - echo ' |
|
| 1006 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
| 1007 | + echo ' |
|
| 943 | 1008 | <div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '>', $message['member']['signature'], '</div>'; |
| 1009 | + } |
|
| 944 | 1010 | |
| 945 | 1011 | |
| 946 | 1012 | // Are there any custom profile fields for below the signature? |
@@ -950,9 +1016,10 @@ discard block |
||
| 950 | 1016 | <div class="custom_fields_below_signature"> |
| 951 | 1017 | <ul class="nolist">'; |
| 952 | 1018 | |
| 953 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
| 954 | - echo ' |
|
| 1019 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
| 1020 | + echo ' |
|
| 955 | 1021 | <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
| 1022 | + } |
|
| 956 | 1023 | |
| 957 | 1024 | echo ' |
| 958 | 1025 | </ul> |
@@ -1000,8 +1067,8 @@ discard block |
||
| 1000 | 1067 | <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '">'; |
| 1001 | 1068 | |
| 1002 | 1069 | // Guests just need more. |
| 1003 | - if ($context['user']['is_guest']) |
|
| 1004 | - echo ' |
|
| 1070 | + if ($context['user']['is_guest']) { |
|
| 1071 | + echo ' |
|
| 1005 | 1072 | <dl id="post_header"> |
| 1006 | 1073 | <dt> |
| 1007 | 1074 | ', $txt['name'], ': |
@@ -1016,6 +1083,7 @@ discard block |
||
| 1016 | 1083 | <input type="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" required> |
| 1017 | 1084 | </dd> |
| 1018 | 1085 | </dl>'; |
| 1086 | + } |
|
| 1019 | 1087 | |
| 1020 | 1088 | echo ' |
| 1021 | 1089 | ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), ' |
@@ -1063,8 +1131,8 @@ discard block |
||
| 1063 | 1131 | <br class="clear">'; |
| 1064 | 1132 | |
| 1065 | 1133 | // draft autosave available and the user has it enabled? |
| 1066 | - if (!empty($context['drafts_autosave'])) |
|
| 1067 | - echo ' |
|
| 1134 | + if (!empty($context['drafts_autosave'])) { |
|
| 1135 | + echo ' |
|
| 1068 | 1136 | <script> |
| 1069 | 1137 | var oDraftAutoSave = new smf_DraftAutoSave({ |
| 1070 | 1138 | sSelf: \'oDraftAutoSave\', |
@@ -1076,10 +1144,12 @@ discard block |
||
| 1076 | 1144 | iFreq: ', (empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000), ' |
| 1077 | 1145 | }); |
| 1078 | 1146 | </script>'; |
| 1147 | + } |
|
| 1079 | 1148 | |
| 1080 | - if ($context['show_spellchecking']) |
|
| 1081 | - echo ' |
|
| 1149 | + if ($context['show_spellchecking']) { |
|
| 1150 | + echo ' |
|
| 1082 | 1151 | <form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value=""></form>'; |
| 1152 | + } |
|
| 1083 | 1153 | |
| 1084 | 1154 | echo ' |
| 1085 | 1155 | <script> |