@@ -1050,15 +1050,15 @@ |
||
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | 1052 | /** |
| 1053 | - * Formats a line (passed as a fields array) as CSV and returns the CSV as a string. |
|
| 1054 | - * from https://stackoverflow.com/questions/3933668/convert-array-into-csv |
|
| 1053 | + * Formats a line (passed as a fields array) as CSV and returns the CSV as a string. |
|
| 1054 | + * from https://stackoverflow.com/questions/3933668/convert-array-into-csv |
|
| 1055 | 1055 | * |
| 1056 | 1056 | * @param array $fields a line of the array |
| 1057 | 1057 | * @param string @delimiter the delimiter char |
| 1058 | 1058 | * @param string @enclosure the enclosure char |
| 1059 | 1059 | * @param boolean $encloseAll enclose all |
| 1060 | 1060 | * @param boolean $nullToMysqlNull |
| 1061 | - */ |
|
| 1061 | + */ |
|
| 1062 | 1062 | function arrayToCsv( array $fields, $delimiter = ';', $enclosure = '"', $encloseAll = false, $nullToMysqlNull = false ) { |
| 1063 | 1063 | $delimiter_esc = preg_quote($delimiter, '/'); |
| 1064 | 1064 | $enclosure_esc = preg_quote($enclosure, '/'); |
@@ -992,12 +992,12 @@ discard block |
||
| 992 | 992 | { |
| 993 | 993 | loadMemberData($memID, false, 'profile'); |
| 994 | 994 | $profile = $user_profile[$memID]; |
| 995 | - $removeFields = array('secret_question','tfa_secret','password_salt'); |
|
| 995 | + $removeFields = array('secret_question', 'tfa_secret', 'password_salt'); |
|
| 996 | 996 | foreach ($removeFields as $value) |
| 997 | 997 | { |
| 998 | 998 | unset($profile[$value]); |
| 999 | 999 | } |
| 1000 | - foreach($profile as $key => &$value) |
|
| 1000 | + foreach ($profile as $key => &$value) |
|
| 1001 | 1001 | { |
| 1002 | 1002 | if (is_array($value)) |
| 1003 | 1003 | $value = $smcFunc['json_encode']($value); |
@@ -1009,7 +1009,7 @@ discard block |
||
| 1009 | 1009 | elseif ($mode == 'messages') // messages |
| 1010 | 1010 | { |
| 1011 | 1011 | |
| 1012 | - $request = $smcFunc['db_query']('',' |
|
| 1012 | + $request = $smcFunc['db_query']('', ' |
|
| 1013 | 1013 | SELECT id_msg, id_topic, poster_time, subject, modified_time, modified_name, modified_reason, body, likes, poster_ip |
| 1014 | 1014 | FROM {db_prefix}messages |
| 1015 | 1015 | WHERE id_member = {int:memID}', |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | } |
| 1028 | 1028 | elseif ($mode == 'pmessages') |
| 1029 | 1029 | { |
| 1030 | - $request = $smcFunc['db_query']('',' |
|
| 1030 | + $request = $smcFunc['db_query']('', ' |
|
| 1031 | 1031 | SELECT pm.msgtime, pm.subject, pm.body |
| 1032 | 1032 | FROM {db_prefix}personal_messages pm |
| 1033 | 1033 | LEFT JOIN {db_prefix}pm_recipients pmr on (pm.id_pm = pmr.id_pm and pmr.id_member = {int:memID}) |
@@ -1045,14 +1045,14 @@ discard block |
||
| 1045 | 1045 | } |
| 1046 | 1046 | $count = count($profileData); |
| 1047 | 1047 | $csv_data = ''; |
| 1048 | - for($i = 0; $i < $count; $i++) |
|
| 1048 | + for ($i = 0; $i < $count; $i++) |
|
| 1049 | 1049 | { |
| 1050 | 1050 | $csv_data .= arrayToCsv($profileData[$i]) . "\r\n"; |
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | 1053 | |
| 1054 | 1054 | header("Pragma: no-cache"); |
| 1055 | - header('Content-Disposition: attachment; filename="privacySMF'.$mode.'.csv";'); |
|
| 1055 | + header('Content-Disposition: attachment; filename="privacySMF' . $mode . '.csv";'); |
|
| 1056 | 1056 | header("Content-Length: " . strlen($csv_data)); |
| 1057 | 1057 | header("Content-Transfer-Encoding: binary"); |
| 1058 | 1058 | header("Content-Type: application/force-download"); |
@@ -1071,12 +1071,12 @@ discard block |
||
| 1071 | 1071 | * @param boolean $encloseAll enclose all |
| 1072 | 1072 | * @param boolean $nullToMysqlNull |
| 1073 | 1073 | */ |
| 1074 | -function arrayToCsv( array $fields, $delimiter = ';', $enclosure = '"', $encloseAll = false, $nullToMysqlNull = false ) { |
|
| 1074 | +function arrayToCsv(array $fields, $delimiter = ';', $enclosure = '"', $encloseAll = false, $nullToMysqlNull = false) { |
|
| 1075 | 1075 | $delimiter_esc = preg_quote($delimiter, '/'); |
| 1076 | 1076 | $enclosure_esc = preg_quote($enclosure, '/'); |
| 1077 | 1077 | |
| 1078 | 1078 | $output = array(); |
| 1079 | - foreach ( $fields as $field ) |
|
| 1079 | + foreach ($fields as $field) |
|
| 1080 | 1080 | { |
| 1081 | 1081 | if ($field === null && $nullToMysqlNull) |
| 1082 | 1082 | { |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | 1087 | // Enclose fields containing $delimiter, $enclosure or whitespace |
| 1088 | - if ( $encloseAll || preg_match( "/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field ) ) |
|
| 1088 | + if ($encloseAll || preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field)) |
|
| 1089 | 1089 | { |
| 1090 | 1090 | $output[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure; |
| 1091 | 1091 | } |
@@ -1095,7 +1095,7 @@ discard block |
||
| 1095 | 1095 | } |
| 1096 | 1096 | } |
| 1097 | 1097 | |
| 1098 | - return implode( $delimiter, $output ); |
|
| 1098 | + return implode($delimiter, $output); |
|
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | ?> |
| 1102 | 1102 | \ No newline at end of file |
@@ -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 | * Activate an account. |
@@ -48,8 +49,9 @@ discard block |
||
| 48 | 49 | logAction('approve_member', array('member' => $memID), 'admin'); |
| 49 | 50 | |
| 50 | 51 | // If we are doing approval, update the stats for the member just in case. |
| 51 | - if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 5, 13, 14, 15))) |
|
| 52 | - updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0))); |
|
| 52 | + if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 5, 13, 14, 15))) { |
|
| 53 | + updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0))); |
|
| 54 | + } |
|
| 53 | 55 | |
| 54 | 56 | // Make sure we update the stats too. |
| 55 | 57 | updateStats('member', false); |
@@ -76,8 +78,9 @@ discard block |
||
| 76 | 78 | $issueErrors = array(); |
| 77 | 79 | |
| 78 | 80 | // Doesn't hurt to be overly cautious. |
| 79 | - if (empty($modSettings['warning_enable']) || ($context['user']['is_owner'] && !$cur_profile['warning']) || !allowedTo('issue_warning')) |
|
| 80 | - fatal_lang_error('no_access', false); |
|
| 81 | + if (empty($modSettings['warning_enable']) || ($context['user']['is_owner'] && !$cur_profile['warning']) || !allowedTo('issue_warning')) { |
|
| 82 | + fatal_lang_error('no_access', false); |
|
| 83 | + } |
|
| 81 | 84 | |
| 82 | 85 | // Get the base (errors related) stuff done. |
| 83 | 86 | loadLanguage('Errors'); |
@@ -135,16 +138,18 @@ discard block |
||
| 135 | 138 | |
| 136 | 139 | // This cannot be empty! |
| 137 | 140 | $_POST['warn_reason'] = isset($_POST['warn_reason']) ? trim($_POST['warn_reason']) : ''; |
| 138 | - if ($_POST['warn_reason'] == '' && !$context['user']['is_owner']) |
|
| 139 | - $issueErrors[] = 'warning_no_reason'; |
|
| 141 | + if ($_POST['warn_reason'] == '' && !$context['user']['is_owner']) { |
|
| 142 | + $issueErrors[] = 'warning_no_reason'; |
|
| 143 | + } |
|
| 140 | 144 | $_POST['warn_reason'] = $smcFunc['htmlspecialchars']($_POST['warn_reason']); |
| 141 | 145 | |
| 142 | 146 | $_POST['warning_level'] = (int) $_POST['warning_level']; |
| 143 | 147 | $_POST['warning_level'] = max(0, min(100, $_POST['warning_level'])); |
| 144 | - if ($_POST['warning_level'] < $context['min_allowed']) |
|
| 145 | - $_POST['warning_level'] = $context['min_allowed']; |
|
| 146 | - elseif ($_POST['warning_level'] > $context['max_allowed']) |
|
| 147 | - $_POST['warning_level'] = $context['max_allowed']; |
|
| 148 | + if ($_POST['warning_level'] < $context['min_allowed']) { |
|
| 149 | + $_POST['warning_level'] = $context['min_allowed']; |
|
| 150 | + } elseif ($_POST['warning_level'] > $context['max_allowed']) { |
|
| 151 | + $_POST['warning_level'] = $context['max_allowed']; |
|
| 152 | + } |
|
| 148 | 153 | |
| 149 | 154 | // Do we actually have to issue them with a PM? |
| 150 | 155 | $id_notice = 0; |
@@ -152,8 +157,9 @@ discard block |
||
| 152 | 157 | { |
| 153 | 158 | $_POST['warn_sub'] = trim($_POST['warn_sub']); |
| 154 | 159 | $_POST['warn_body'] = trim($_POST['warn_body']); |
| 155 | - if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) |
|
| 156 | - $issueErrors[] = 'warning_notify_blank'; |
|
| 160 | + if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) { |
|
| 161 | + $issueErrors[] = 'warning_notify_blank'; |
|
| 162 | + } |
|
| 157 | 163 | // Send the PM? |
| 158 | 164 | else |
| 159 | 165 | { |
@@ -190,8 +196,8 @@ discard block |
||
| 190 | 196 | if (empty($issueErrors)) |
| 191 | 197 | { |
| 192 | 198 | // Log what we've done! |
| 193 | - if (!$context['user']['is_owner']) |
|
| 194 | - $smcFunc['db_insert']('', |
|
| 199 | + if (!$context['user']['is_owner']) { |
|
| 200 | + $smcFunc['db_insert']('', |
|
| 195 | 201 | '{db_prefix}log_comments', |
| 196 | 202 | array( |
| 197 | 203 | 'id_member' => 'int', 'member_name' => 'string', 'comment_type' => 'string', 'id_recipient' => 'int', 'recipient_name' => 'string-255', |
@@ -203,14 +209,14 @@ discard block |
||
| 203 | 209 | ), |
| 204 | 210 | array('id_comment') |
| 205 | 211 | ); |
| 212 | + } |
|
| 206 | 213 | |
| 207 | 214 | // Make the change. |
| 208 | 215 | updateMemberData($memID, array('warning' => $_POST['warning_level'])); |
| 209 | 216 | |
| 210 | 217 | // Leave a lovely message. |
| 211 | 218 | $context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : $txt['profile_warning_success']; |
| 212 | - } |
|
| 213 | - else |
|
| 219 | + } else |
|
| 214 | 220 | { |
| 215 | 221 | // Try to remember some bits. |
| 216 | 222 | $context['warning_data'] = array( |
@@ -229,8 +235,9 @@ discard block |
||
| 229 | 235 | { |
| 230 | 236 | $warning_body = !empty($_POST['warn_body']) ? trim(censorText($_POST['warn_body'])) : ''; |
| 231 | 237 | $context['preview_subject'] = !empty($_POST['warn_sub']) ? trim($smcFunc['htmlspecialchars']($_POST['warn_sub'])) : ''; |
| 232 | - if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) |
|
| 233 | - $issueErrors[] = 'warning_notify_blank'; |
|
| 238 | + if (empty($_POST['warn_sub']) || empty($_POST['warn_body'])) { |
|
| 239 | + $issueErrors[] = 'warning_notify_blank'; |
|
| 240 | + } |
|
| 234 | 241 | |
| 235 | 242 | if (!empty($_POST['warn_body'])) |
| 236 | 243 | { |
@@ -254,8 +261,9 @@ discard block |
||
| 254 | 261 | { |
| 255 | 262 | // Fill in the suite of errors. |
| 256 | 263 | $context['post_errors'] = array(); |
| 257 | - foreach ($issueErrors as $error) |
|
| 258 | - $context['post_errors'][] = $txt[$error]; |
|
| 264 | + foreach ($issueErrors as $error) { |
|
| 265 | + $context['post_errors'][] = $txt[$error]; |
|
| 266 | + } |
|
| 259 | 267 | } |
| 260 | 268 | |
| 261 | 269 | |
@@ -272,9 +280,10 @@ discard block |
||
| 272 | 280 | $modSettings['warning_mute'] => $txt['profile_warning_effect_mute'], |
| 273 | 281 | ); |
| 274 | 282 | $context['current_level'] = 0; |
| 275 | - foreach ($context['level_effects'] as $limit => $dummy) |
|
| 276 | - if ($context['member']['warning'] >= $limit) |
|
| 283 | + foreach ($context['level_effects'] as $limit => $dummy) { |
|
| 284 | + if ($context['member']['warning'] >= $limit) |
|
| 277 | 285 | $context['current_level'] = $limit; |
| 286 | + } |
|
| 278 | 287 | |
| 279 | 288 | $listOptions = array( |
| 280 | 289 | 'id' => 'view_warnings', |
@@ -337,11 +346,12 @@ discard block |
||
| 337 | 346 | ' . $warning['reason'] . ' |
| 338 | 347 | </div>'; |
| 339 | 348 | |
| 340 | - if (!empty($warning['id_notice'])) |
|
| 341 | - $ret .= ' |
|
| 349 | + if (!empty($warning['id_notice'])) { |
|
| 350 | + $ret .= ' |
|
| 342 | 351 | <div class="floatright"> |
| 343 | 352 | <a href="' . $scripturl . '?action=moderate;area=notice;nid=' . $warning['id_notice'] . '" onclick="window.open(this.href, \'\', \'scrollbars=yes,resizable=yes,width=400,height=250\');return false;" target="_blank" rel="noopener" title="' . $txt['profile_warning_previous_notice'] . '"><span class="generic_icons filter centericon"></span></a> |
| 344 | 353 | </div>'; |
| 354 | + } |
|
| 345 | 355 | |
| 346 | 356 | return $ret; |
| 347 | 357 | }, |
@@ -412,8 +422,9 @@ discard block |
||
| 412 | 422 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 413 | 423 | { |
| 414 | 424 | // If we're not warning for a message skip any that are. |
| 415 | - if (!$context['warning_for_message'] && strpos($row['body'], '{MESSAGE}') !== false) |
|
| 416 | - continue; |
|
| 425 | + if (!$context['warning_for_message'] && strpos($row['body'], '{MESSAGE}') !== false) { |
|
| 426 | + continue; |
|
| 427 | + } |
|
| 417 | 428 | |
| 418 | 429 | $context['notification_templates'][] = array( |
| 419 | 430 | 'title' => $row['template_title'], |
@@ -423,16 +434,18 @@ discard block |
||
| 423 | 434 | $smcFunc['db_free_result']($request); |
| 424 | 435 | |
| 425 | 436 | // Setup the "default" templates. |
| 426 | - foreach (array('spamming', 'offence', 'insulting') as $type) |
|
| 427 | - $context['notification_templates'][] = array( |
|
| 437 | + foreach (array('spamming', 'offence', 'insulting') as $type) { |
|
| 438 | + $context['notification_templates'][] = array( |
|
| 428 | 439 | 'title' => $txt['profile_warning_notify_title_' . $type], |
| 429 | 440 | 'body' => sprintf($txt['profile_warning_notify_template_outline' . (!empty($context['warning_for_message']) ? '_post' : '')], $txt['profile_warning_notify_for_' . $type]), |
| 430 | 441 | ); |
| 442 | + } |
|
| 431 | 443 | |
| 432 | 444 | // Replace all the common variables in the templates. |
| 433 | - foreach ($context['notification_templates'] as $k => $name) |
|
| 434 | - $context['notification_templates'][$k]['body'] = strtr($name['body'], array('{MEMBER}' => un_htmlspecialchars($context['member']['name']), '{MESSAGE}' => '[url=' . $scripturl . '?msg=' . $context['warning_for_message'] . ']' . un_htmlspecialchars($context['warned_message_subject']) . '[/url]', '{SCRIPTURL}' => $scripturl, '{FORUMNAME}' => $mbname, '{REGARDS}' => $txt['regards_team'])); |
|
| 435 | -} |
|
| 445 | + foreach ($context['notification_templates'] as $k => $name) { |
|
| 446 | + $context['notification_templates'][$k]['body'] = strtr($name['body'], array('{MEMBER}' => un_htmlspecialchars($context['member']['name']), '{MESSAGE}' => '[url=' . $scripturl . '?msg=' . $context['warning_for_message'] . ']' . un_htmlspecialchars($context['warned_message_subject']) . '[/url]', '{SCRIPTURL}' => $scripturl, '{FORUMNAME}' => $mbname, '{REGARDS}' => $txt['regards_team'])); |
|
| 447 | + } |
|
| 448 | + } |
|
| 436 | 449 | |
| 437 | 450 | /** |
| 438 | 451 | * Get the number of warnings a user has. Callback for $listOptions['get_count'] in issueWarning() |
@@ -516,10 +529,11 @@ discard block |
||
| 516 | 529 | { |
| 517 | 530 | global $txt, $context, $modSettings, $cur_profile; |
| 518 | 531 | |
| 519 | - if (!$context['user']['is_owner']) |
|
| 520 | - isAllowedTo('profile_remove_any'); |
|
| 521 | - elseif (!allowedTo('profile_remove_any')) |
|
| 522 | - isAllowedTo('profile_remove_own'); |
|
| 532 | + if (!$context['user']['is_owner']) { |
|
| 533 | + isAllowedTo('profile_remove_any'); |
|
| 534 | + } elseif (!allowedTo('profile_remove_any')) { |
|
| 535 | + isAllowedTo('profile_remove_own'); |
|
| 536 | + } |
|
| 523 | 537 | |
| 524 | 538 | // Permissions for removing stuff... |
| 525 | 539 | $context['can_delete_posts'] = !$context['user']['is_owner'] && allowedTo('moderate_forum'); |
@@ -546,10 +560,11 @@ discard block |
||
| 546 | 560 | |
| 547 | 561 | // @todo Add a way to delete pms as well? |
| 548 | 562 | |
| 549 | - if (!$context['user']['is_owner']) |
|
| 550 | - isAllowedTo('profile_remove_any'); |
|
| 551 | - elseif (!allowedTo('profile_remove_any')) |
|
| 552 | - isAllowedTo('profile_remove_own'); |
|
| 563 | + if (!$context['user']['is_owner']) { |
|
| 564 | + isAllowedTo('profile_remove_any'); |
|
| 565 | + } elseif (!allowedTo('profile_remove_any')) { |
|
| 566 | + isAllowedTo('profile_remove_own'); |
|
| 567 | + } |
|
| 553 | 568 | |
| 554 | 569 | checkSession(); |
| 555 | 570 | |
@@ -575,8 +590,9 @@ discard block |
||
| 575 | 590 | list ($another) = $smcFunc['db_fetch_row']($request); |
| 576 | 591 | $smcFunc['db_free_result']($request); |
| 577 | 592 | |
| 578 | - if (empty($another)) |
|
| 579 | - fatal_lang_error('at_least_one_admin', 'critical'); |
|
| 593 | + if (empty($another)) { |
|
| 594 | + fatal_lang_error('at_least_one_admin', 'critical'); |
|
| 595 | + } |
|
| 580 | 596 | } |
| 581 | 597 | |
| 582 | 598 | // This file is needed for the deleteMembers function. |
@@ -655,8 +671,9 @@ discard block |
||
| 655 | 671 | ) |
| 656 | 672 | ); |
| 657 | 673 | $topicIDs = array(); |
| 658 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 659 | - $topicIDs[] = $row['id_topic']; |
|
| 674 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 675 | + $topicIDs[] = $row['id_topic']; |
|
| 676 | + } |
|
| 660 | 677 | $smcFunc['db_free_result']($request); |
| 661 | 678 | |
| 662 | 679 | // Actually remove the topics. Ignore recycling if we want to perma-delete things... |
@@ -679,8 +696,9 @@ discard block |
||
| 679 | 696 | // This could take a while... but ya know it's gonna be worth it in the end. |
| 680 | 697 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 681 | 698 | { |
| 682 | - if (function_exists('apache_reset_timeout')) |
|
| 683 | - @apache_reset_timeout(); |
|
| 699 | + if (function_exists('apache_reset_timeout')) { |
|
| 700 | + @apache_reset_timeout(); |
|
| 701 | + } |
|
| 684 | 702 | |
| 685 | 703 | removeMessage($row['id_msg']); |
| 686 | 704 | } |
@@ -688,8 +706,9 @@ discard block |
||
| 688 | 706 | } |
| 689 | 707 | |
| 690 | 708 | // Only delete this poor members account if they are actually being booted out of camp. |
| 691 | - if (isset($_POST['deleteAccount'])) |
|
| 692 | - deleteMembers($memID); |
|
| 709 | + if (isset($_POST['deleteAccount'])) { |
|
| 710 | + deleteMembers($memID); |
|
| 711 | + } |
|
| 693 | 712 | } |
| 694 | 713 | // Do they need approval to delete? |
| 695 | 714 | elseif (!empty($modSettings['approveAccountDeletion']) && !allowedTo('moderate_forum')) |
@@ -740,18 +759,18 @@ discard block |
||
| 740 | 759 | { |
| 741 | 760 | foreach ($costs as $duration => $cost) |
| 742 | 761 | { |
| 743 | - if ($cost != 0) |
|
| 744 | - $cost_array[$duration] = $cost; |
|
| 762 | + if ($cost != 0) { |
|
| 763 | + $cost_array[$duration] = $cost; |
|
| 764 | + } |
|
| 745 | 765 | } |
| 746 | - } |
|
| 747 | - else |
|
| 766 | + } else |
|
| 748 | 767 | { |
| 749 | 768 | $cost_array['fixed'] = $costs['fixed']; |
| 750 | 769 | } |
| 751 | 770 | |
| 752 | - if (empty($cost_array)) |
|
| 753 | - unset($context['subscriptions'][$id]); |
|
| 754 | - else |
|
| 771 | + if (empty($cost_array)) { |
|
| 772 | + unset($context['subscriptions'][$id]); |
|
| 773 | + } else |
|
| 755 | 774 | { |
| 756 | 775 | $context['subscriptions'][$id]['member'] = 0; |
| 757 | 776 | $context['subscriptions'][$id]['subscribed'] = false; |
@@ -764,13 +783,15 @@ discard block |
||
| 764 | 783 | foreach ($gateways as $id => $gateway) |
| 765 | 784 | { |
| 766 | 785 | $gateways[$id] = new $gateway['display_class'](); |
| 767 | - if (!$gateways[$id]->gatewayEnabled()) |
|
| 768 | - unset($gateways[$id]); |
|
| 786 | + if (!$gateways[$id]->gatewayEnabled()) { |
|
| 787 | + unset($gateways[$id]); |
|
| 788 | + } |
|
| 769 | 789 | } |
| 770 | 790 | |
| 771 | 791 | // No gateways yet? |
| 772 | - if (empty($gateways)) |
|
| 773 | - fatal_error($txt['paid_admin_not_setup_gateway']); |
|
| 792 | + if (empty($gateways)) { |
|
| 793 | + fatal_error($txt['paid_admin_not_setup_gateway']); |
|
| 794 | + } |
|
| 774 | 795 | |
| 775 | 796 | // Get the current subscriptions. |
| 776 | 797 | $request = $smcFunc['db_query']('', ' |
@@ -785,8 +806,9 @@ discard block |
||
| 785 | 806 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 786 | 807 | { |
| 787 | 808 | // The subscription must exist! |
| 788 | - if (!isset($context['subscriptions'][$row['id_subscribe']])) |
|
| 789 | - continue; |
|
| 809 | + if (!isset($context['subscriptions'][$row['id_subscribe']])) { |
|
| 810 | + continue; |
|
| 811 | + } |
|
| 790 | 812 | |
| 791 | 813 | $context['current'][$row['id_subscribe']] = array( |
| 792 | 814 | 'id' => $row['id_sublog'], |
@@ -800,8 +822,9 @@ discard block |
||
| 800 | 822 | 'status_text' => $row['status'] == 0 ? ($row['payments_pending'] ? $txt['paid_pending'] : $txt['paid_finished']) : $txt['paid_active'], |
| 801 | 823 | ); |
| 802 | 824 | |
| 803 | - if ($row['status'] == 1) |
|
| 804 | - $context['subscriptions'][$row['id_subscribe']]['subscribed'] = true; |
|
| 825 | + if ($row['status'] == 1) { |
|
| 826 | + $context['subscriptions'][$row['id_subscribe']]['subscribed'] = true; |
|
| 827 | + } |
|
| 805 | 828 | } |
| 806 | 829 | $smcFunc['db_free_result']($request); |
| 807 | 830 | |
@@ -852,21 +875,25 @@ discard block |
||
| 852 | 875 | if (isset($_GET['confirm']) && isset($_POST['sub_id']) && is_array($_POST['sub_id'])) |
| 853 | 876 | { |
| 854 | 877 | // Hopefully just one. |
| 855 | - foreach ($_POST['sub_id'] as $k => $v) |
|
| 856 | - $ID_SUB = (int) $k; |
|
| 878 | + foreach ($_POST['sub_id'] as $k => $v) { |
|
| 879 | + $ID_SUB = (int) $k; |
|
| 880 | + } |
|
| 857 | 881 | |
| 858 | - if (!isset($context['subscriptions'][$ID_SUB]) || $context['subscriptions'][$ID_SUB]['active'] == 0) |
|
| 859 | - fatal_lang_error('paid_sub_not_active'); |
|
| 882 | + if (!isset($context['subscriptions'][$ID_SUB]) || $context['subscriptions'][$ID_SUB]['active'] == 0) { |
|
| 883 | + fatal_lang_error('paid_sub_not_active'); |
|
| 884 | + } |
|
| 860 | 885 | |
| 861 | 886 | // Simplify... |
| 862 | 887 | $context['sub'] = $context['subscriptions'][$ID_SUB]; |
| 863 | 888 | $period = 'xx'; |
| 864 | - if ($context['sub']['flexible']) |
|
| 865 | - $period = isset($_POST['cur'][$ID_SUB]) && isset($context['sub']['costs'][$_POST['cur'][$ID_SUB]]) ? $_POST['cur'][$ID_SUB] : 'xx'; |
|
| 889 | + if ($context['sub']['flexible']) { |
|
| 890 | + $period = isset($_POST['cur'][$ID_SUB]) && isset($context['sub']['costs'][$_POST['cur'][$ID_SUB]]) ? $_POST['cur'][$ID_SUB] : 'xx'; |
|
| 891 | + } |
|
| 866 | 892 | |
| 867 | 893 | // Check we have a valid cost. |
| 868 | - if ($context['sub']['flexible'] && $period == 'xx') |
|
| 869 | - fatal_lang_error('paid_sub_not_active'); |
|
| 894 | + if ($context['sub']['flexible'] && $period == 'xx') { |
|
| 895 | + fatal_lang_error('paid_sub_not_active'); |
|
| 896 | + } |
|
| 870 | 897 | |
| 871 | 898 | // Sort out the cost/currency. |
| 872 | 899 | $context['currency'] = $modSettings['paid_currency_code']; |
@@ -879,8 +906,7 @@ discard block |
||
| 879 | 906 | $context['cost'] = sprintf($modSettings['paid_currency_symbol'], $context['value']) . '/' . $txt[$_POST['cur'][$ID_SUB]]; |
| 880 | 907 | // The period value for paypal. |
| 881 | 908 | $context['paypal_period'] = strtoupper(substr($_POST['cur'][$ID_SUB], 0, 1)); |
| 882 | - } |
|
| 883 | - else |
|
| 909 | + } else |
|
| 884 | 910 | { |
| 885 | 911 | // Real cost... |
| 886 | 912 | $context['value'] = $context['sub']['costs']['fixed']; |
@@ -897,13 +923,15 @@ discard block |
||
| 897 | 923 | foreach ($gateways as $id => $gateway) |
| 898 | 924 | { |
| 899 | 925 | $fields = $gateways[$id]->fetchGatewayFields($context['sub']['id'] . '+' . $memID, $context['sub'], $context['value'], $period, $scripturl . '?action=profile;u=' . $memID . ';area=subscriptions;sub_id=' . $context['sub']['id'] . ';done'); |
| 900 | - if (!empty($fields['form'])) |
|
| 901 | - $context['gateways'][] = $fields; |
|
| 926 | + if (!empty($fields['form'])) { |
|
| 927 | + $context['gateways'][] = $fields; |
|
| 928 | + } |
|
| 902 | 929 | } |
| 903 | 930 | |
| 904 | 931 | // Bugger?! |
| 905 | - if (empty($context['gateways'])) |
|
| 906 | - fatal_error($txt['paid_admin_not_setup_gateway']); |
|
| 932 | + if (empty($context['gateways'])) { |
|
| 933 | + fatal_error($txt['paid_admin_not_setup_gateway']); |
|
| 934 | + } |
|
| 907 | 935 | |
| 908 | 936 | // Now we are going to assume they want to take this out ;) |
| 909 | 937 | $new_data = array($context['sub']['id'], $context['value'], $period, 'prepay'); |
@@ -911,16 +939,19 @@ discard block |
||
| 911 | 939 | { |
| 912 | 940 | // What are the details like? |
| 913 | 941 | $current_pending = array(); |
| 914 | - if ($context['current'][$context['sub']['id']]['pending_details'] != '') |
|
| 915 | - $current_pending = $smcFunc['json_decode']($context['current'][$context['sub']['id']]['pending_details'], true); |
|
| 942 | + if ($context['current'][$context['sub']['id']]['pending_details'] != '') { |
|
| 943 | + $current_pending = $smcFunc['json_decode']($context['current'][$context['sub']['id']]['pending_details'], true); |
|
| 944 | + } |
|
| 916 | 945 | // Don't get silly. |
| 917 | - if (count($current_pending) > 9) |
|
| 918 | - $current_pending = array(); |
|
| 946 | + if (count($current_pending) > 9) { |
|
| 947 | + $current_pending = array(); |
|
| 948 | + } |
|
| 919 | 949 | $pending_count = 0; |
| 920 | 950 | // Only record real pending payments as will otherwise confuse the admin! |
| 921 | - foreach ($current_pending as $pending) |
|
| 922 | - if ($pending[3] == 'payback') |
|
| 951 | + foreach ($current_pending as $pending) { |
|
| 952 | + if ($pending[3] == 'payback') |
|
| 923 | 953 | $pending_count++; |
| 954 | + } |
|
| 924 | 955 | |
| 925 | 956 | if (!in_array($new_data, $current_pending)) |
| 926 | 957 | { |
@@ -964,10 +995,10 @@ discard block |
||
| 964 | 995 | |
| 965 | 996 | // Quit. |
| 966 | 997 | return; |
| 998 | + } else { |
|
| 999 | + $context['sub_template'] = 'user_subscription'; |
|
| 1000 | + } |
|
| 967 | 1001 | } |
| 968 | - else |
|
| 969 | - $context['sub_template'] = 'user_subscription'; |
|
| 970 | -} |
|
| 971 | 1002 | |
| 972 | 1003 | /** |
| 973 | 1004 | * Function to allow the user to todo Privacy stuff |
@@ -978,23 +1009,28 @@ discard block |
||
| 978 | 1009 | { |
| 979 | 1010 | global $txt, $user_profile, $context, $smcFunc, $user_info; |
| 980 | 1011 | |
| 981 | - if ($memID == $user_info['id']) |
|
| 982 | - $context['pdc']['own'] = true; |
|
| 983 | - else |
|
| 984 | - $context['pdc']['name'] = $context['member']['name']; |
|
| 1012 | + if ($memID == $user_info['id']) { |
|
| 1013 | + $context['pdc']['own'] = true; |
|
| 1014 | + } else { |
|
| 1015 | + $context['pdc']['name'] = $context['member']['name']; |
|
| 1016 | + } |
|
| 985 | 1017 | |
| 986 | - if (!empty($_REQUEST['nofound'])) |
|
| 987 | - $context['pdc']['nofound'] = true; |
|
| 1018 | + if (!empty($_REQUEST['nofound'])) { |
|
| 1019 | + $context['pdc']['nofound'] = true; |
|
| 1020 | + } |
|
| 988 | 1021 | |
| 989 | - if (empty($_REQUEST['activity'])) |
|
| 990 | - return; |
|
| 1022 | + if (empty($_REQUEST['activity'])) { |
|
| 1023 | + return; |
|
| 1024 | + } |
|
| 991 | 1025 | |
| 992 | 1026 | $mode = $_REQUEST['activity']; |
| 993 | 1027 | |
| 994 | 1028 | $profileData = array(); |
| 995 | - if ($mode == 'profile') // profile |
|
| 1029 | + if ($mode == 'profile') { |
|
| 1030 | + // profile |
|
| 996 | 1031 | { |
| 997 | 1032 | loadMemberData($memID, false, 'profile'); |
| 1033 | + } |
|
| 998 | 1034 | $profile = $user_profile[$memID]; |
| 999 | 1035 | $removeFields = array('secret_question','tfa_secret','password_salt'); |
| 1000 | 1036 | foreach ($removeFields as $value) |
@@ -1003,14 +1039,15 @@ discard block |
||
| 1003 | 1039 | } |
| 1004 | 1040 | foreach($profile as $key => &$value) |
| 1005 | 1041 | { |
| 1006 | - if (is_array($value)) |
|
| 1007 | - $value = $smcFunc['json_encode']($value); |
|
| 1042 | + if (is_array($value)) { |
|
| 1043 | + $value = $smcFunc['json_encode']($value); |
|
| 1044 | + } |
|
| 1008 | 1045 | } |
| 1009 | 1046 | $profileData[0] = array_keys($profile); |
| 1010 | 1047 | $profileData[1] = $profile; |
| 1011 | 1048 | call_integration_hook('integrate_getProfile_profile', array(&$profileData)); |
| 1012 | - } |
|
| 1013 | - elseif ($mode == 'messages') // messages |
|
| 1049 | + } elseif ($mode == 'messages') { |
|
| 1050 | + // messages |
|
| 1014 | 1051 | { |
| 1015 | 1052 | |
| 1016 | 1053 | $request = $smcFunc['db_query']('',' |
@@ -1021,15 +1058,16 @@ discard block |
||
| 1021 | 1058 | 'memID' => $memID, |
| 1022 | 1059 | ) |
| 1023 | 1060 | ); |
| 1061 | + } |
|
| 1024 | 1062 | $profileData = $smcFunc['db_fetch_all']($request); |
| 1025 | - if (!is_array($profileData)) |
|
| 1026 | - redirectexit('action=profile;area=getprofiledata;u=' . $memID . ';nofound=1'); |
|
| 1063 | + if (!is_array($profileData)) { |
|
| 1064 | + redirectexit('action=profile;area=getprofiledata;u=' . $memID . ';nofound=1'); |
|
| 1065 | + } |
|
| 1027 | 1066 | array_unshift($profileData, array_keys($profileData[0])); |
| 1028 | 1067 | $smcFunc['db_free_result']($request); |
| 1029 | 1068 | |
| 1030 | 1069 | call_integration_hook('integrate_getProfile_messages', array(&$profileData)); |
| 1031 | - } |
|
| 1032 | - elseif ($mode == 'pmessages') |
|
| 1070 | + } elseif ($mode == 'pmessages') |
|
| 1033 | 1071 | { |
| 1034 | 1072 | $request = $smcFunc['db_query']('',' |
| 1035 | 1073 | SELECT pm.msgtime, pm.subject, pm.body |
@@ -1041,8 +1079,9 @@ discard block |
||
| 1041 | 1079 | ) |
| 1042 | 1080 | ); |
| 1043 | 1081 | $profileData = $smcFunc['db_fetch_all']($request); |
| 1044 | - if (!is_array($profileData)) |
|
| 1045 | - redirectexit('action=profile;area=getprofiledata;u=' . $memID . ';nofound=1'); |
|
| 1082 | + if (!is_array($profileData)) { |
|
| 1083 | + redirectexit('action=profile;area=getprofiledata;u=' . $memID . ';nofound=1'); |
|
| 1084 | + } |
|
| 1046 | 1085 | array_unshift($profileData, array_keys($profileData[0])); |
| 1047 | 1086 | $smcFunc['db_free_result']($request); |
| 1048 | 1087 | call_integration_hook('integrate_getProfile_pmessages', array(&$profileData)); |
@@ -1092,8 +1131,7 @@ discard block |
||
| 1092 | 1131 | if ( $encloseAll || preg_match( "/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field ) ) |
| 1093 | 1132 | { |
| 1094 | 1133 | $output[] = $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure; |
| 1095 | - } |
|
| 1096 | - else |
|
| 1134 | + } else |
|
| 1097 | 1135 | { |
| 1098 | 1136 | $output[] = $field; |
| 1099 | 1137 | } |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | * @version 2.1 Beta 4 |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -if (!defined('SMF')) |
|
| 18 | +if (!defined('SMF')) { |
|
| 19 | 19 | die('No direct access...'); |
| 20 | +} |
|
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | 23 | * The main designating function for modifying profiles. Loads up info, determins what to do, etc. |
@@ -29,18 +30,21 @@ discard block |
||
| 29 | 30 | global $modSettings, $memberContext, $profile_vars, $post_errors, $smcFunc; |
| 30 | 31 | |
| 31 | 32 | // Don't reload this as we may have processed error strings. |
| 32 | - if (empty($post_errors)) |
|
| 33 | - loadLanguage('Profile+Drafts'); |
|
| 33 | + if (empty($post_errors)) { |
|
| 34 | + loadLanguage('Profile+Drafts'); |
|
| 35 | + } |
|
| 34 | 36 | loadTemplate('Profile'); |
| 35 | 37 | |
| 36 | 38 | require_once($sourcedir . '/Subs-Menu.php'); |
| 37 | 39 | |
| 38 | 40 | // Did we get the user by name... |
| 39 | - if (isset($_REQUEST['user'])) |
|
| 40 | - $memberResult = loadMemberData($_REQUEST['user'], true, 'profile'); |
|
| 41 | + if (isset($_REQUEST['user'])) { |
|
| 42 | + $memberResult = loadMemberData($_REQUEST['user'], true, 'profile'); |
|
| 43 | + } |
|
| 41 | 44 | // ... or by id_member? |
| 42 | - elseif (!empty($_REQUEST['u'])) |
|
| 43 | - $memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile'); |
|
| 45 | + elseif (!empty($_REQUEST['u'])) { |
|
| 46 | + $memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile'); |
|
| 47 | + } |
|
| 44 | 48 | // If it was just ?action=profile, edit your own profile, but only if you're not a guest. |
| 45 | 49 | else |
| 46 | 50 | { |
@@ -50,8 +54,9 @@ discard block |
||
| 50 | 54 | } |
| 51 | 55 | |
| 52 | 56 | // Check if loadMemberData() has returned a valid result. |
| 53 | - if (!$memberResult) |
|
| 54 | - fatal_lang_error('not_a_user', false, 404); |
|
| 57 | + if (!$memberResult) { |
|
| 58 | + fatal_lang_error('not_a_user', false, 404); |
|
| 59 | + } |
|
| 55 | 60 | |
| 56 | 61 | // If all went well, we have a valid member ID! |
| 57 | 62 | list ($memID) = $memberResult; |
@@ -67,8 +72,9 @@ discard block |
||
| 67 | 72 | |
| 68 | 73 | // Group management isn't actually a permission. But we need it to be for this, so we need a phantom permission. |
| 69 | 74 | // And we care about what the current user can do, not what the user whose profile it is. |
| 70 | - if ($user_info['mod_cache']['gq'] != '0=1') |
|
| 71 | - $user_info['permissions'][] = 'approve_group_requests'; |
|
| 75 | + if ($user_info['mod_cache']['gq'] != '0=1') { |
|
| 76 | + $user_info['permissions'][] = 'approve_group_requests'; |
|
| 77 | + } |
|
| 72 | 78 | |
| 73 | 79 | // If paid subscriptions are enabled, make sure we actually have at least one subscription available... |
| 74 | 80 | $context['subs_available'] = false; |
@@ -423,8 +429,8 @@ discard block |
||
| 423 | 429 | ), |
| 424 | 430 | ); |
| 425 | 431 | |
| 426 | - if (!empty($modSettings['enable_privacy_userexport'])) |
|
| 427 | - $profile_areas['profile_action']['areas']['getprofiledata'] = array( |
|
| 432 | + if (!empty($modSettings['enable_privacy_userexport'])) { |
|
| 433 | + $profile_areas['profile_action']['areas']['getprofiledata'] = array( |
|
| 428 | 434 | 'label' => $txt['getProfileData'], |
| 429 | 435 | 'file' => 'Profile-Actions.php', |
| 430 | 436 | 'function' => 'getProfileData', |
@@ -437,6 +443,7 @@ discard block |
||
| 437 | 443 | 'any' => array('privacy_userexport_others'), |
| 438 | 444 | ), |
| 439 | 445 | ); |
| 446 | + } |
|
| 440 | 447 | |
| 441 | 448 | // Let them modify profile areas easily. |
| 442 | 449 | call_integration_hook('integrate_pre_profile_areas', array(&$profile_areas)); |
@@ -451,21 +458,25 @@ discard block |
||
| 451 | 458 | foreach ($section['areas'] as $area_id => $area) |
| 452 | 459 | { |
| 453 | 460 | // If it said no permissions that meant it wasn't valid! |
| 454 | - if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any'])) |
|
| 455 | - $profile_areas[$section_id]['areas'][$area_id]['enabled'] = false; |
|
| 461 | + if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any'])) { |
|
| 462 | + $profile_areas[$section_id]['areas'][$area_id]['enabled'] = false; |
|
| 463 | + } |
|
| 456 | 464 | // Otherwise pick the right set. |
| 457 | - else |
|
| 458 | - $profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any']; |
|
| 465 | + else { |
|
| 466 | + $profile_areas[$section_id]['areas'][$area_id]['permission'] = $area['permission'][$context['user']['is_owner'] ? 'own' : 'any']; |
|
| 467 | + } |
|
| 459 | 468 | |
| 460 | 469 | // Password required in most cases |
| 461 | - if (!empty($area['password'])) |
|
| 462 | - $context['password_areas'][] = $area_id; |
|
| 470 | + if (!empty($area['password'])) { |
|
| 471 | + $context['password_areas'][] = $area_id; |
|
| 472 | + } |
|
| 463 | 473 | } |
| 464 | 474 | } |
| 465 | 475 | |
| 466 | 476 | // Is there an updated message to show? |
| 467 | - if (isset($_GET['updated'])) |
|
| 468 | - $context['profile_updated'] = $txt['profile_updated_own']; |
|
| 477 | + if (isset($_GET['updated'])) { |
|
| 478 | + $context['profile_updated'] = $txt['profile_updated_own']; |
|
| 479 | + } |
|
| 469 | 480 | |
| 470 | 481 | // Set a few options for the menu. |
| 471 | 482 | $menuOptions = array( |
@@ -480,8 +491,9 @@ discard block |
||
| 480 | 491 | $profile_include_data = createMenu($profile_areas, $menuOptions); |
| 481 | 492 | |
| 482 | 493 | // No menu means no access. |
| 483 | - if (!$profile_include_data && (!$user_info['is_guest'] || validateSession())) |
|
| 484 | - fatal_lang_error('no_access', false); |
|
| 494 | + if (!$profile_include_data && (!$user_info['is_guest'] || validateSession())) { |
|
| 495 | + fatal_lang_error('no_access', false); |
|
| 496 | + } |
|
| 485 | 497 | |
| 486 | 498 | // Make a note of the Unique ID for this menu. |
| 487 | 499 | $context['profile_menu_id'] = $context['max_menu_id']; |
@@ -507,8 +519,9 @@ discard block |
||
| 507 | 519 | if ($current_area == $area_id) |
| 508 | 520 | { |
| 509 | 521 | // This can't happen - but is a security check. |
| 510 | - if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($area['enabled']) && $area['enabled'] == false)) |
|
| 511 | - fatal_lang_error('no_access', false); |
|
| 522 | + if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($area['enabled']) && $area['enabled'] == false)) { |
|
| 523 | + fatal_lang_error('no_access', false); |
|
| 524 | + } |
|
| 512 | 525 | |
| 513 | 526 | // Are we saving data in a valid area? |
| 514 | 527 | if (isset($area['sc']) && (isset($_REQUEST['save']) || $context['do_preview'])) |
@@ -527,12 +540,14 @@ discard block |
||
| 527 | 540 | } |
| 528 | 541 | |
| 529 | 542 | // Does this require session validating? |
| 530 | - if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner'])) |
|
| 531 | - $security_checks['validate'] = true; |
|
| 543 | + if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner'])) { |
|
| 544 | + $security_checks['validate'] = true; |
|
| 545 | + } |
|
| 532 | 546 | |
| 533 | 547 | // Permissions for good measure. |
| 534 | - if (!empty($profile_include_data['permission'])) |
|
| 535 | - $security_checks['permission'] = $profile_include_data['permission']; |
|
| 548 | + if (!empty($profile_include_data['permission'])) { |
|
| 549 | + $security_checks['permission'] = $profile_include_data['permission']; |
|
| 550 | + } |
|
| 536 | 551 | |
| 537 | 552 | // Either way got something. |
| 538 | 553 | $found_area = true; |
@@ -541,21 +556,26 @@ discard block |
||
| 541 | 556 | } |
| 542 | 557 | |
| 543 | 558 | // Oh dear, some serious security lapse is going on here... we'll put a stop to that! |
| 544 | - if (!$found_area) |
|
| 545 | - fatal_lang_error('no_access', false); |
|
| 559 | + if (!$found_area) { |
|
| 560 | + fatal_lang_error('no_access', false); |
|
| 561 | + } |
|
| 546 | 562 | |
| 547 | 563 | // Release this now. |
| 548 | 564 | unset($profile_areas); |
| 549 | 565 | |
| 550 | 566 | // Now the context is setup have we got any security checks to carry out additional to that above? |
| 551 | - if (isset($security_checks['session'])) |
|
| 552 | - checkSession($security_checks['session']); |
|
| 553 | - if (isset($security_checks['validate'])) |
|
| 554 | - validateSession(); |
|
| 555 | - if (isset($security_checks['validateToken'])) |
|
| 556 | - validateToken($token_name, $token_type); |
|
| 557 | - if (isset($security_checks['permission'])) |
|
| 558 | - isAllowedTo($security_checks['permission']); |
|
| 567 | + if (isset($security_checks['session'])) { |
|
| 568 | + checkSession($security_checks['session']); |
|
| 569 | + } |
|
| 570 | + if (isset($security_checks['validate'])) { |
|
| 571 | + validateSession(); |
|
| 572 | + } |
|
| 573 | + if (isset($security_checks['validateToken'])) { |
|
| 574 | + validateToken($token_name, $token_type); |
|
| 575 | + } |
|
| 576 | + if (isset($security_checks['permission'])) { |
|
| 577 | + isAllowedTo($security_checks['permission']); |
|
| 578 | + } |
|
| 559 | 579 | |
| 560 | 580 | // Create a token if needed. |
| 561 | 581 | if (isset($security_checks['needsToken']) || isset($security_checks['validateToken'])) |
@@ -565,8 +585,9 @@ discard block |
||
| 565 | 585 | } |
| 566 | 586 | |
| 567 | 587 | // File to include? |
| 568 | - if (isset($profile_include_data['file'])) |
|
| 569 | - require_once($sourcedir . '/' . $profile_include_data['file']); |
|
| 588 | + if (isset($profile_include_data['file'])) { |
|
| 589 | + require_once($sourcedir . '/' . $profile_include_data['file']); |
|
| 590 | + } |
|
| 570 | 591 | |
| 571 | 592 | // Build the link tree. |
| 572 | 593 | $context['linktree'][] = array( |
@@ -574,17 +595,19 @@ discard block |
||
| 574 | 595 | 'name' => sprintf($txt['profile_of_username'], $context['member']['name']), |
| 575 | 596 | ); |
| 576 | 597 | |
| 577 | - if (!empty($profile_include_data['label'])) |
|
| 578 | - $context['linktree'][] = array( |
|
| 598 | + if (!empty($profile_include_data['label'])) { |
|
| 599 | + $context['linktree'][] = array( |
|
| 579 | 600 | 'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'], |
| 580 | 601 | 'name' => $profile_include_data['label'], |
| 581 | 602 | ); |
| 603 | + } |
|
| 582 | 604 | |
| 583 | - if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label']) |
|
| 584 | - $context['linktree'][] = array( |
|
| 605 | + if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label']) { |
|
| 606 | + $context['linktree'][] = array( |
|
| 585 | 607 | 'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'] . ';sa=' . $profile_include_data['current_subsection'], |
| 586 | 608 | 'name' => $profile_include_data['subsections'][$profile_include_data['current_subsection']][0], |
| 587 | 609 | ); |
| 610 | + } |
|
| 588 | 611 | |
| 589 | 612 | // Set the template for this area and add the profile layer. |
| 590 | 613 | $context['sub_template'] = $profile_include_data['function']; |
@@ -610,12 +633,14 @@ discard block |
||
| 610 | 633 | if ($check_password) |
| 611 | 634 | { |
| 612 | 635 | // Check to ensure we're forcing SSL for authentication |
| 613 | - if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) |
|
| 614 | - fatal_lang_error('login_ssl_required'); |
|
| 636 | + if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) { |
|
| 637 | + fatal_lang_error('login_ssl_required'); |
|
| 638 | + } |
|
| 615 | 639 | |
| 616 | 640 | // You didn't even enter a password! |
| 617 | - if (trim($_POST['oldpasswrd']) == '') |
|
| 618 | - $post_errors[] = 'no_password'; |
|
| 641 | + if (trim($_POST['oldpasswrd']) == '') { |
|
| 642 | + $post_errors[] = 'no_password'; |
|
| 643 | + } |
|
| 619 | 644 | |
| 620 | 645 | // Since the password got modified due to all the $_POST cleaning, lets undo it so we can get the correct password |
| 621 | 646 | $_POST['oldpasswrd'] = un_htmlspecialchars($_POST['oldpasswrd']); |
@@ -624,42 +649,43 @@ discard block |
||
| 624 | 649 | $good_password = in_array(true, call_integration_hook('integrate_verify_password', array($cur_profile['member_name'], $_POST['oldpasswrd'], false)), true); |
| 625 | 650 | |
| 626 | 651 | // Bad password!!! |
| 627 | - if (!$good_password && !hash_verify_password($user_profile[$memID]['member_name'], un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])), $user_info['passwd'])) |
|
| 628 | - $post_errors[] = 'bad_password'; |
|
| 652 | + if (!$good_password && !hash_verify_password($user_profile[$memID]['member_name'], un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])), $user_info['passwd'])) { |
|
| 653 | + $post_errors[] = 'bad_password'; |
|
| 654 | + } |
|
| 629 | 655 | |
| 630 | 656 | // Warn other elements not to jump the gun and do custom changes! |
| 631 | - if (in_array('bad_password', $post_errors)) |
|
| 632 | - $context['password_auth_failed'] = true; |
|
| 657 | + if (in_array('bad_password', $post_errors)) { |
|
| 658 | + $context['password_auth_failed'] = true; |
|
| 659 | + } |
|
| 633 | 660 | } |
| 634 | 661 | |
| 635 | 662 | // Change the IP address in the database. |
| 636 | - if ($context['user']['is_owner']) |
|
| 637 | - $profile_vars['member_ip'] = $user_info['ip']; |
|
| 663 | + if ($context['user']['is_owner']) { |
|
| 664 | + $profile_vars['member_ip'] = $user_info['ip']; |
|
| 665 | + } |
|
| 638 | 666 | |
| 639 | 667 | // Now call the sub-action function... |
| 640 | 668 | if ($current_area == 'activateaccount') |
| 641 | 669 | { |
| 642 | - if (empty($post_errors)) |
|
| 643 | - activateAccount($memID); |
|
| 644 | - } |
|
| 645 | - elseif ($current_area == 'deleteaccount') |
|
| 670 | + if (empty($post_errors)) { |
|
| 671 | + activateAccount($memID); |
|
| 672 | + } |
|
| 673 | + } elseif ($current_area == 'deleteaccount') |
|
| 646 | 674 | { |
| 647 | 675 | if (empty($post_errors)) |
| 648 | 676 | { |
| 649 | 677 | deleteAccount2($memID); |
| 650 | 678 | redirectexit(); |
| 651 | 679 | } |
| 652 | - } |
|
| 653 | - elseif ($current_area == 'groupmembership' && empty($post_errors)) |
|
| 680 | + } elseif ($current_area == 'groupmembership' && empty($post_errors)) |
|
| 654 | 681 | { |
| 655 | 682 | $msg = groupMembership2($profile_vars, $post_errors, $memID); |
| 656 | 683 | |
| 657 | 684 | // Whatever we've done, we have nothing else to do here... |
| 658 | 685 | redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=groupmembership' . (!empty($msg) ? ';msg=' . $msg : '')); |
| 659 | - } |
|
| 660 | - elseif (in_array($current_area, array('account', 'forumprofile', 'theme'))) |
|
| 661 | - saveProfileFields(); |
|
| 662 | - else |
|
| 686 | + } elseif (in_array($current_area, array('account', 'forumprofile', 'theme'))) { |
|
| 687 | + saveProfileFields(); |
|
| 688 | + } else |
|
| 663 | 689 | { |
| 664 | 690 | $force_redirect = true; |
| 665 | 691 | // Ensure we include this. |
@@ -675,34 +701,36 @@ discard block |
||
| 675 | 701 | // Load the language file so we can give a nice explanation of the errors. |
| 676 | 702 | loadLanguage('Errors'); |
| 677 | 703 | $context['post_errors'] = $post_errors; |
| 678 | - } |
|
| 679 | - elseif (!empty($profile_vars)) |
|
| 704 | + } elseif (!empty($profile_vars)) |
|
| 680 | 705 | { |
| 681 | 706 | // If we've changed the password, notify any integration that may be listening in. |
| 682 | - if (isset($profile_vars['passwd'])) |
|
| 683 | - call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2'])); |
|
| 707 | + if (isset($profile_vars['passwd'])) { |
|
| 708 | + call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2'])); |
|
| 709 | + } |
|
| 684 | 710 | |
| 685 | 711 | updateMemberData($memID, $profile_vars); |
| 686 | 712 | |
| 687 | 713 | // What if this is the newest member? |
| 688 | - if ($modSettings['latestMember'] == $memID) |
|
| 689 | - updateStats('member'); |
|
| 690 | - elseif (isset($profile_vars['real_name'])) |
|
| 691 | - updateSettings(array('memberlist_updated' => time())); |
|
| 714 | + if ($modSettings['latestMember'] == $memID) { |
|
| 715 | + updateStats('member'); |
|
| 716 | + } elseif (isset($profile_vars['real_name'])) { |
|
| 717 | + updateSettings(array('memberlist_updated' => time())); |
|
| 718 | + } |
|
| 692 | 719 | |
| 693 | 720 | // If the member changed his/her birthdate, update calendar statistics. |
| 694 | - if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name'])) |
|
| 695 | - updateSettings(array( |
|
| 721 | + if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name'])) { |
|
| 722 | + updateSettings(array( |
|
| 696 | 723 | 'calendar_updated' => time(), |
| 697 | 724 | )); |
| 725 | + } |
|
| 698 | 726 | |
| 699 | 727 | // Anything worth logging? |
| 700 | 728 | if (!empty($context['log_changes']) && !empty($modSettings['modlog_enabled'])) |
| 701 | 729 | { |
| 702 | 730 | $log_changes = array(); |
| 703 | 731 | require_once($sourcedir . '/Logging.php'); |
| 704 | - foreach ($context['log_changes'] as $k => $v) |
|
| 705 | - $log_changes[] = array( |
|
| 732 | + foreach ($context['log_changes'] as $k => $v) { |
|
| 733 | + $log_changes[] = array( |
|
| 706 | 734 | 'action' => $k, |
| 707 | 735 | 'log_type' => 'user', |
| 708 | 736 | 'extra' => array_merge($v, array( |
@@ -710,14 +738,16 @@ discard block |
||
| 710 | 738 | 'member_affected' => $memID, |
| 711 | 739 | )), |
| 712 | 740 | ); |
| 741 | + } |
|
| 713 | 742 | |
| 714 | 743 | logActions($log_changes); |
| 715 | 744 | } |
| 716 | 745 | |
| 717 | 746 | // Have we got any post save functions to execute? |
| 718 | - if (!empty($context['profile_execute_on_save'])) |
|
| 719 | - foreach ($context['profile_execute_on_save'] as $saveFunc) |
|
| 747 | + if (!empty($context['profile_execute_on_save'])) { |
|
| 748 | + foreach ($context['profile_execute_on_save'] as $saveFunc) |
|
| 720 | 749 | $saveFunc(); |
| 750 | + } |
|
| 721 | 751 | |
| 722 | 752 | // Let them know it worked! |
| 723 | 753 | $context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $cur_profile['member_name']); |
@@ -731,27 +761,31 @@ discard block |
||
| 731 | 761 | if (!empty($post_errors)) |
| 732 | 762 | { |
| 733 | 763 | // Set all the errors so the template knows what went wrong. |
| 734 | - foreach ($post_errors as $error_type) |
|
| 735 | - $context['modify_error'][$error_type] = true; |
|
| 764 | + foreach ($post_errors as $error_type) { |
|
| 765 | + $context['modify_error'][$error_type] = true; |
|
| 766 | + } |
|
| 736 | 767 | } |
| 737 | 768 | // If it's you then we should redirect upon save. |
| 738 | - elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview']) |
|
| 739 | - redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated'); |
|
| 740 | - elseif (!empty($force_redirect)) |
|
| 741 | - redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area); |
|
| 769 | + elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview']) { |
|
| 770 | + redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated'); |
|
| 771 | + } elseif (!empty($force_redirect)) { |
|
| 772 | + redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area); |
|
| 773 | + } |
|
| 742 | 774 | |
| 743 | 775 | |
| 744 | 776 | // Get the right callable. |
| 745 | 777 | $call = call_helper($profile_include_data['function'], true); |
| 746 | 778 | |
| 747 | 779 | // Is it valid? |
| 748 | - if (!empty($call)) |
|
| 749 | - call_user_func($call, $memID); |
|
| 780 | + if (!empty($call)) { |
|
| 781 | + call_user_func($call, $memID); |
|
| 782 | + } |
|
| 750 | 783 | |
| 751 | 784 | // Set the page title if it's not already set... |
| 752 | - if (!isset($context['page_title'])) |
|
| 753 | - $context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : ''); |
|
| 754 | -} |
|
| 785 | + if (!isset($context['page_title'])) { |
|
| 786 | + $context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : ''); |
|
| 787 | + } |
|
| 788 | + } |
|
| 755 | 789 | |
| 756 | 790 | /** |
| 757 | 791 | * Set up the requirements for the profile popup - the area that is shown as the popup menu for the current user. |
@@ -874,16 +908,18 @@ discard block |
||
| 874 | 908 | if (!allowedTo('admin_forum') && $area != 'register') |
| 875 | 909 | { |
| 876 | 910 | // If it's the owner they can see two types of private fields, regardless. |
| 877 | - if ($memID == $user_info['id']) |
|
| 878 | - $where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)'; |
|
| 879 | - else |
|
| 880 | - $where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0'; |
|
| 911 | + if ($memID == $user_info['id']) { |
|
| 912 | + $where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)'; |
|
| 913 | + } else { |
|
| 914 | + $where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0'; |
|
| 915 | + } |
|
| 881 | 916 | } |
| 882 | 917 | |
| 883 | - if ($area == 'register') |
|
| 884 | - $where .= ' AND show_reg != 0'; |
|
| 885 | - elseif ($area != 'summary') |
|
| 886 | - $where .= ' AND show_profile = {string:area}'; |
|
| 918 | + if ($area == 'register') { |
|
| 919 | + $where .= ' AND show_reg != 0'; |
|
| 920 | + } elseif ($area != 'summary') { |
|
| 921 | + $where .= ' AND show_profile = {string:area}'; |
|
| 922 | + } |
|
| 887 | 923 | |
| 888 | 924 | // Load all the relevant fields - and data. |
| 889 | 925 | $request = $smcFunc['db_query']('', ' |
@@ -911,8 +947,9 @@ discard block |
||
| 911 | 947 | $fieldOptions = explode(',', $row['field_options']); |
| 912 | 948 | foreach ($fieldOptions as $k => $v) |
| 913 | 949 | { |
| 914 | - if (empty($currentKey)) |
|
| 915 | - $currentKey = $v === $value ? $k : 0; |
|
| 950 | + if (empty($currentKey)) { |
|
| 951 | + $currentKey = $v === $value ? $k : 0; |
|
| 952 | + } |
|
| 916 | 953 | } |
| 917 | 954 | } |
| 918 | 955 | |
@@ -920,13 +957,15 @@ discard block |
||
| 920 | 957 | if (isset($_POST['customfield']) && isset($_POST['customfield'][$row['col_name']])) |
| 921 | 958 | { |
| 922 | 959 | $value = $smcFunc['htmlspecialchars']($_POST['customfield'][$row['col_name']]); |
| 923 | - if (in_array($row['field_type'], array('select', 'radio'))) |
|
| 924 | - $value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : ''; |
|
| 960 | + if (in_array($row['field_type'], array('select', 'radio'))) { |
|
| 961 | + $value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : ''; |
|
| 962 | + } |
|
| 925 | 963 | } |
| 926 | 964 | |
| 927 | 965 | // Don't show the "disabled" option for the "gender" field if we are on the "summary" area. |
| 928 | - if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'None') |
|
| 929 | - continue; |
|
| 966 | + if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'None') { |
|
| 967 | + continue; |
|
| 968 | + } |
|
| 930 | 969 | |
| 931 | 970 | // HTML for the input form. |
| 932 | 971 | $output_html = $value; |
@@ -935,8 +974,7 @@ discard block |
||
| 935 | 974 | $true = (!$exists && $row['default_value']) || $value; |
| 936 | 975 | $input_html = '<input type="checkbox" name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . ($true ? ' checked' : '') . '>'; |
| 937 | 976 | $output_html = $true ? $txt['yes'] : $txt['no']; |
| 938 | - } |
|
| 939 | - elseif ($row['field_type'] == 'select') |
|
| 977 | + } elseif ($row['field_type'] == 'select') |
|
| 940 | 978 | { |
| 941 | 979 | $input_html = '<select name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"><option value="-1"></option>'; |
| 942 | 980 | $options = explode(',', $row['field_options']); |
@@ -944,13 +982,13 @@ discard block |
||
| 944 | 982 | { |
| 945 | 983 | $true = (!$exists && $row['default_value'] == $v) || $value == $v; |
| 946 | 984 | $input_html .= '<option value="' . $k . '"' . ($true ? ' selected' : '') . '>' . $v . '</option>'; |
| 947 | - if ($true) |
|
| 948 | - $output_html = $v; |
|
| 985 | + if ($true) { |
|
| 986 | + $output_html = $v; |
|
| 987 | + } |
|
| 949 | 988 | } |
| 950 | 989 | |
| 951 | 990 | $input_html .= '</select>'; |
| 952 | - } |
|
| 953 | - elseif ($row['field_type'] == 'radio') |
|
| 991 | + } elseif ($row['field_type'] == 'radio') |
|
| 954 | 992 | { |
| 955 | 993 | $input_html = '<fieldset>'; |
| 956 | 994 | $options = explode(',', $row['field_options']); |
@@ -958,37 +996,38 @@ discard block |
||
| 958 | 996 | { |
| 959 | 997 | $true = (!$exists && $row['default_value'] == $v) || $value == $v; |
| 960 | 998 | $input_html .= '<label for="customfield_' . $row['col_name'] . '_' . $k . '"><input type="radio" name="customfield[' . $row['col_name'] . ']" id="customfield_' . $row['col_name'] . '_' . $k . '" value="' . $k . '"' . ($true ? ' checked' : '') . '>' . $v . '</label><br>'; |
| 961 | - if ($true) |
|
| 962 | - $output_html = $v; |
|
| 999 | + if ($true) { |
|
| 1000 | + $output_html = $v; |
|
| 1001 | + } |
|
| 963 | 1002 | } |
| 964 | 1003 | $input_html .= '</fieldset>'; |
| 965 | - } |
|
| 966 | - elseif ($row['field_type'] == 'text') |
|
| 1004 | + } elseif ($row['field_type'] == 'text') |
|
| 967 | 1005 | { |
| 968 | 1006 | $input_html = '<input type="text" name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . ($row['field_length'] != 0 ? ' maxlength="' . $row['field_length'] . '"' : '') . ' size="' . ($row['field_length'] == 0 || $row['field_length'] >= 50 ? 50 : ($row['field_length'] > 30 ? 30 : ($row['field_length'] > 10 ? 20 : 10))) . '" value="' . un_htmlspecialchars($value) . '"' . ($row['show_reg'] == 2 ? ' required' : '') . '>'; |
| 969 | - } |
|
| 970 | - else |
|
| 1007 | + } else |
|
| 971 | 1008 | { |
| 972 | 1009 | @list ($rows, $cols) = @explode(',', $row['default_value']); |
| 973 | 1010 | $input_html = '<textarea name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . (!empty($rows) ? ' rows="' . $rows . '"' : '') . (!empty($cols) ? ' cols="' . $cols . '"' : '') . ($row['show_reg'] == 2 ? ' required' : '') . '>' . un_htmlspecialchars($value) . '</textarea>'; |
| 974 | 1011 | } |
| 975 | 1012 | |
| 976 | 1013 | // Parse BBCode |
| 977 | - if ($row['bbc']) |
|
| 978 | - $output_html = parse_bbc($output_html); |
|
| 979 | - elseif ($row['field_type'] == 'textarea') |
|
| 980 | - // Allow for newlines at least |
|
| 1014 | + if ($row['bbc']) { |
|
| 1015 | + $output_html = parse_bbc($output_html); |
|
| 1016 | + } elseif ($row['field_type'] == 'textarea') { |
|
| 1017 | + // Allow for newlines at least |
|
| 981 | 1018 | $output_html = strtr($output_html, array("\n" => '<br>')); |
| 1019 | + } |
|
| 982 | 1020 | |
| 983 | 1021 | // Enclosing the user input within some other text? |
| 984 | - if (!empty($row['enclose']) && !empty($output_html)) |
|
| 985 | - $output_html = strtr($row['enclose'], array( |
|
| 1022 | + if (!empty($row['enclose']) && !empty($output_html)) { |
|
| 1023 | + $output_html = strtr($row['enclose'], array( |
|
| 986 | 1024 | '{SCRIPTURL}' => $scripturl, |
| 987 | 1025 | '{IMAGES_URL}' => $settings['images_url'], |
| 988 | 1026 | '{DEFAULT_IMAGES_URL}' => $settings['default_images_url'], |
| 989 | 1027 | '{INPUT}' => un_htmlspecialchars($output_html), |
| 990 | 1028 | '{KEY}' => $currentKey |
| 991 | 1029 | )); |
| 1030 | + } |
|
| 992 | 1031 | |
| 993 | 1032 | $context['custom_fields'][] = array( |
| 994 | 1033 | 'name' => $row['field_name'], |
@@ -955,7 +955,7 @@ discard block |
||
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | echo isset($config_var['postinput']) ? ' |
| 958 | - ' . $config_var['postinput'] : '',' |
|
| 958 | + ' . $config_var['postinput'] : '', ' |
|
| 959 | 959 | </dd>'; |
| 960 | 960 | } |
| 961 | 961 | } |
@@ -1675,7 +1675,7 @@ discard block |
||
| 1675 | 1675 | </dl> |
| 1676 | 1676 | <input type="submit" name="save_setting" value="', $txt['save'], '" class="button"> |
| 1677 | 1677 | <div class="block"> |
| 1678 | - ',template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message') ,' |
|
| 1678 | + ',template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), ' |
|
| 1679 | 1679 | </div> |
| 1680 | 1680 | <input type="submit" name="save_new_policy" value="', $txt['policy_save'], '" class="button"> |
| 1681 | 1681 | <input type="submit" name="update_policy" value="', $txt['policy_update'], '" class="button">'; |
@@ -65,9 +65,10 @@ discard block |
||
| 65 | 65 | ', implode(', ', $context['administrators']); |
| 66 | 66 | |
| 67 | 67 | // If we have lots of admins... don't show them all. |
| 68 | - if (!empty($context['more_admins_link'])) |
|
| 69 | - echo ' |
|
| 68 | + if (!empty($context['more_admins_link'])) { |
|
| 69 | + echo ' |
|
| 70 | 70 | (', $context['more_admins_link'], ')'; |
| 71 | + } |
|
| 71 | 72 | |
| 72 | 73 | echo ' |
| 73 | 74 | </div><!-- #version_details --> |
@@ -84,17 +85,19 @@ discard block |
||
| 84 | 85 | foreach ($area['areas'] as $item_id => $item) |
| 85 | 86 | { |
| 86 | 87 | // No point showing the 'home' page here, we're already on it! |
| 87 | - if ($area_id == 'forum' && $item_id == 'index') |
|
| 88 | - continue; |
|
| 88 | + if ($area_id == 'forum' && $item_id == 'index') { |
|
| 89 | + continue; |
|
| 90 | + } |
|
| 89 | 91 | |
| 90 | 92 | $url = isset($item['url']) ? $item['url'] : $scripturl . '?action=admin;area=' . $item_id . (!empty($context[$context['admin_menu_name']]['extra_parameters']) ? $context[$context['admin_menu_name']]['extra_parameters'] : ''); |
| 91 | 93 | |
| 92 | - if (!empty($item['icon_file'])) |
|
| 93 | - echo ' |
|
| 94 | + if (!empty($item['icon_file'])) { |
|
| 95 | + echo ' |
|
| 94 | 96 | <a href="', $url, '" class="admin_group', !empty($item['inactive']) ? ' inactive' : '', '"><img class="large_admin_menu_icon_file" src="', $item['icon_file'], '" alt="">', $item['label'], '</a>'; |
| 95 | - else |
|
| 96 | - echo ' |
|
| 97 | + } else { |
|
| 98 | + echo ' |
|
| 97 | 99 | <a href="', $url, '"><span class="large_', $item['icon_class'], !empty($item['inactive']) ? ' inactive' : '', '"></span>', $item['label'], '</a>'; |
| 100 | + } |
|
| 98 | 101 | } |
| 99 | 102 | |
| 100 | 103 | echo ' |
@@ -105,10 +108,11 @@ discard block |
||
| 105 | 108 | </div><!-- #admincenter -->'; |
| 106 | 109 | |
| 107 | 110 | // The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization. |
| 108 | - if (empty($modSettings['disable_smf_js'])) |
|
| 109 | - echo ' |
|
| 111 | + if (empty($modSettings['disable_smf_js'])) { |
|
| 112 | + echo ' |
|
| 110 | 113 | <script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script> |
| 111 | 114 | <script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>'; |
| 115 | + } |
|
| 112 | 116 | |
| 113 | 117 | // This sets the announcements and current versions themselves ;). |
| 114 | 118 | echo ' |
@@ -186,9 +190,10 @@ discard block |
||
| 186 | 190 | <em>', $version['version'], '</em>'; |
| 187 | 191 | |
| 188 | 192 | // more details for this item, show them a link |
| 189 | - if ($context['can_admin'] && isset($version['more'])) |
|
| 190 | - echo |
|
| 193 | + if ($context['can_admin'] && isset($version['more'])) { |
|
| 194 | + echo |
|
| 191 | 195 | ' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>'; |
| 196 | + } |
|
| 192 | 197 | echo ' |
| 193 | 198 | <br>'; |
| 194 | 199 | } |
@@ -219,21 +224,23 @@ discard block |
||
| 219 | 224 | |
| 220 | 225 | foreach ($context['credits'] as $section) |
| 221 | 226 | { |
| 222 | - if (isset($section['pretext'])) |
|
| 223 | - echo ' |
|
| 227 | + if (isset($section['pretext'])) { |
|
| 228 | + echo ' |
|
| 224 | 229 | <p>', $section['pretext'], '</p> |
| 225 | 230 | <hr>'; |
| 231 | + } |
|
| 226 | 232 | |
| 227 | 233 | echo ' |
| 228 | 234 | <dl>'; |
| 229 | 235 | |
| 230 | 236 | foreach ($section['groups'] as $group) |
| 231 | 237 | { |
| 232 | - if (isset($group['title'])) |
|
| 233 | - echo ' |
|
| 238 | + if (isset($group['title'])) { |
|
| 239 | + echo ' |
|
| 234 | 240 | <dt> |
| 235 | 241 | <strong>', $group['title'], ':</strong> |
| 236 | 242 | </dt>'; |
| 243 | + } |
|
| 237 | 244 | |
| 238 | 245 | echo ' |
| 239 | 246 | <dd>', implode(', ', $group['members']), '</dd>'; |
@@ -242,10 +249,11 @@ discard block |
||
| 242 | 249 | echo ' |
| 243 | 250 | </dl>'; |
| 244 | 251 | |
| 245 | - if (isset($section['posttext'])) |
|
| 246 | - echo ' |
|
| 252 | + if (isset($section['posttext'])) { |
|
| 253 | + echo ' |
|
| 247 | 254 | <hr> |
| 248 | 255 | <p>', $section['posttext'], '</p>'; |
| 256 | + } |
|
| 249 | 257 | } |
| 250 | 258 | |
| 251 | 259 | echo ' |
@@ -261,9 +269,10 @@ discard block |
||
| 261 | 269 | smfSupportVersions.forum = "', $context['forum_version'], '";'; |
| 262 | 270 | |
| 263 | 271 | // Don't worry, none of this is logged, it's just used to give information that might be of use. |
| 264 | - foreach ($context['current_versions'] as $variable => $version) |
|
| 265 | - echo ' |
|
| 272 | + foreach ($context['current_versions'] as $variable => $version) { |
|
| 273 | + echo ' |
|
| 266 | 274 | smfSupportVersions.', $variable, ' = "', $version['version'], '";'; |
| 275 | + } |
|
| 267 | 276 | |
| 268 | 277 | // Now we just have to include the script and wait ;). |
| 269 | 278 | echo ' |
@@ -360,8 +369,8 @@ discard block |
||
| 360 | 369 | <tbody>'; |
| 361 | 370 | |
| 362 | 371 | // Loop through every source file displaying its version - using javascript. |
| 363 | - foreach ($context['file_versions'] as $filename => $version) |
|
| 364 | - echo ' |
|
| 372 | + foreach ($context['file_versions'] as $filename => $version) { |
|
| 373 | + echo ' |
|
| 365 | 374 | <tr class="windowbg"> |
| 366 | 375 | <td class="half_table"> |
| 367 | 376 | ', $filename, ' |
@@ -373,6 +382,7 @@ discard block |
||
| 373 | 382 | <em id="currentSources', $filename, '">??</em> |
| 374 | 383 | </td> |
| 375 | 384 | </tr>'; |
| 385 | + } |
|
| 376 | 386 | |
| 377 | 387 | // Default template files. |
| 378 | 388 | echo ' |
@@ -398,8 +408,8 @@ discard block |
||
| 398 | 408 | <table id="Default" class="table_grid"> |
| 399 | 409 | <tbody>'; |
| 400 | 410 | |
| 401 | - foreach ($context['default_template_versions'] as $filename => $version) |
|
| 402 | - echo ' |
|
| 411 | + foreach ($context['default_template_versions'] as $filename => $version) { |
|
| 412 | + echo ' |
|
| 403 | 413 | <tr class="windowbg"> |
| 404 | 414 | <td class="half_table"> |
| 405 | 415 | ', $filename, ' |
@@ -411,6 +421,7 @@ discard block |
||
| 411 | 421 | <em id="currentDefault', $filename, '">??</em> |
| 412 | 422 | </td> |
| 413 | 423 | </tr>'; |
| 424 | + } |
|
| 414 | 425 | |
| 415 | 426 | // Now the language files... |
| 416 | 427 | echo ' |
@@ -438,8 +449,8 @@ discard block |
||
| 438 | 449 | |
| 439 | 450 | foreach ($context['default_language_versions'] as $language => $files) |
| 440 | 451 | { |
| 441 | - foreach ($files as $filename => $version) |
|
| 442 | - echo ' |
|
| 452 | + foreach ($files as $filename => $version) { |
|
| 453 | + echo ' |
|
| 443 | 454 | <tr class="windowbg"> |
| 444 | 455 | <td class="half_table"> |
| 445 | 456 | ', $filename, '.<em>', $language, '</em>.php |
@@ -451,6 +462,7 @@ discard block |
||
| 451 | 462 | <em id="current', $filename, '.', $language, '">??</em> |
| 452 | 463 | </td> |
| 453 | 464 | </tr>'; |
| 465 | + } |
|
| 454 | 466 | } |
| 455 | 467 | |
| 456 | 468 | echo ' |
@@ -480,8 +492,8 @@ discard block |
||
| 480 | 492 | <table id="Templates" class="table_grid"> |
| 481 | 493 | <tbody>'; |
| 482 | 494 | |
| 483 | - foreach ($context['template_versions'] as $filename => $version) |
|
| 484 | - echo ' |
|
| 495 | + foreach ($context['template_versions'] as $filename => $version) { |
|
| 496 | + echo ' |
|
| 485 | 497 | <tr class="windowbg"> |
| 486 | 498 | <td class="half_table"> |
| 487 | 499 | ', $filename, ' |
@@ -493,6 +505,7 @@ discard block |
||
| 493 | 505 | <em id="currentTemplates', $filename, '">??</em> |
| 494 | 506 | </td> |
| 495 | 507 | </tr>'; |
| 508 | + } |
|
| 496 | 509 | |
| 497 | 510 | echo ' |
| 498 | 511 | </tbody> |
@@ -522,8 +535,8 @@ discard block |
||
| 522 | 535 | <table id="Tasks" class="table_grid"> |
| 523 | 536 | <tbody>'; |
| 524 | 537 | |
| 525 | - foreach ($context['tasks_versions'] as $filename => $version) |
|
| 526 | - echo ' |
|
| 538 | + foreach ($context['tasks_versions'] as $filename => $version) { |
|
| 539 | + echo ' |
|
| 527 | 540 | <tr class="windowbg"> |
| 528 | 541 | <td class="half_table"> |
| 529 | 542 | ', $filename, ' |
@@ -535,6 +548,7 @@ discard block |
||
| 535 | 548 | <em id="currentTasks', $filename, '">??</em> |
| 536 | 549 | </td> |
| 537 | 550 | </tr>'; |
| 551 | + } |
|
| 538 | 552 | |
| 539 | 553 | echo ' |
| 540 | 554 | </tbody> |
@@ -576,9 +590,10 @@ discard block |
||
| 576 | 590 | { |
| 577 | 591 | global $context, $scripturl, $txt, $modSettings; |
| 578 | 592 | |
| 579 | - if (!empty($context['saved_successful'])) |
|
| 580 | - echo ' |
|
| 593 | + if (!empty($context['saved_successful'])) { |
|
| 594 | + echo ' |
|
| 581 | 595 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
| 596 | + } |
|
| 582 | 597 | |
| 583 | 598 | // First section is for adding/removing words from the censored list. |
| 584 | 599 | echo ' |
@@ -593,11 +608,12 @@ discard block |
||
| 593 | 608 | <p>', $txt['admin_censored_where'], '</p>'; |
| 594 | 609 | |
| 595 | 610 | // Show text boxes for censoring [bad ] => [good ]. |
| 596 | - foreach ($context['censored_words'] as $vulgar => $proper) |
|
| 597 | - echo ' |
|
| 611 | + foreach ($context['censored_words'] as $vulgar => $proper) { |
|
| 612 | + echo ' |
|
| 598 | 613 | <div class="block"> |
| 599 | 614 | <input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> => <input type="text" name="censor_proper[]" value="', $proper, '" size="30"> |
| 600 | 615 | </div>'; |
| 616 | + } |
|
| 601 | 617 | |
| 602 | 618 | // Now provide a way to censor more words. |
| 603 | 619 | echo ' |
@@ -672,27 +688,30 @@ discard block |
||
| 672 | 688 | <div class="windowbg"> |
| 673 | 689 | ', $txt['not_done_reason']; |
| 674 | 690 | |
| 675 | - if (!empty($context['continue_percent'])) |
|
| 676 | - echo ' |
|
| 691 | + if (!empty($context['continue_percent'])) { |
|
| 692 | + echo ' |
|
| 677 | 693 | <div class="progress_bar"> |
| 678 | 694 | <span>', $context['continue_percent'], '%</span> |
| 679 | 695 | <div class="bar" style="width: ', $context['continue_percent'], '%;"></div> |
| 680 | 696 | </div>'; |
| 697 | + } |
|
| 681 | 698 | |
| 682 | - if (!empty($context['substep_enabled'])) |
|
| 683 | - echo ' |
|
| 699 | + if (!empty($context['substep_enabled'])) { |
|
| 700 | + echo ' |
|
| 684 | 701 | <div class="progress_bar progress_blue"> |
| 685 | 702 | <span>', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</span> |
| 686 | 703 | <div class="bar" style="width: ', $context['substep_continue_percent'], '%;"></div> |
| 687 | 704 | </div>'; |
| 705 | + } |
|
| 688 | 706 | |
| 689 | 707 | echo ' |
| 690 | 708 | <form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">'; |
| 691 | 709 | |
| 692 | 710 | // Do we have a token? |
| 693 | - if (isset($context['not_done_token']) && isset($context[$context['not_done_token'] . '_token'], $context[$context['not_done_token'] . '_token_var'])) |
|
| 694 | - echo ' |
|
| 711 | + if (isset($context['not_done_token']) && isset($context[$context['not_done_token'] . '_token'], $context[$context['not_done_token'] . '_token_var'])) { |
|
| 712 | + echo ' |
|
| 695 | 713 | <input type="hidden" name="', $context[$context['not_done_token'] . '_token_var'], '" value="', $context[$context['not_done_token'] . '_token'], '">'; |
| 714 | + } |
|
| 696 | 715 | |
| 697 | 716 | echo ' |
| 698 | 717 | <input type="submit" name="cont" value="', $txt['not_done_continue'], '" class="button"> |
@@ -726,35 +745,40 @@ discard block |
||
| 726 | 745 | { |
| 727 | 746 | global $context, $txt, $scripturl; |
| 728 | 747 | |
| 729 | - if (!empty($context['saved_successful'])) |
|
| 730 | - echo ' |
|
| 748 | + if (!empty($context['saved_successful'])) { |
|
| 749 | + echo ' |
|
| 731 | 750 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
| 732 | - elseif (!empty($context['saved_failed'])) |
|
| 733 | - echo ' |
|
| 751 | + } elseif (!empty($context['saved_failed'])) { |
|
| 752 | + echo ' |
|
| 734 | 753 | <div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>'; |
| 754 | + } |
|
| 735 | 755 | |
| 736 | - if (!empty($context['settings_pre_javascript'])) |
|
| 737 | - echo ' |
|
| 756 | + if (!empty($context['settings_pre_javascript'])) { |
|
| 757 | + echo ' |
|
| 738 | 758 | <script>', $context['settings_pre_javascript'], '</script>'; |
| 759 | + } |
|
| 739 | 760 | |
| 740 | - if (!empty($context['settings_insert_above'])) |
|
| 741 | - echo $context['settings_insert_above']; |
|
| 761 | + if (!empty($context['settings_insert_above'])) { |
|
| 762 | + echo $context['settings_insert_above']; |
|
| 763 | + } |
|
| 742 | 764 | |
| 743 | 765 | echo ' |
| 744 | 766 | <div id="admincenter"> |
| 745 | 767 | <form id="admin_form_wrapper" action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>'; |
| 746 | 768 | |
| 747 | 769 | // Is there a custom title? |
| 748 | - if (isset($context['settings_title'])) |
|
| 749 | - echo ' |
|
| 770 | + if (isset($context['settings_title'])) { |
|
| 771 | + echo ' |
|
| 750 | 772 | <div class="cat_bar"> |
| 751 | 773 | <h3 class="catbg">', $context['settings_title'], '</h3> |
| 752 | 774 | </div>'; |
| 775 | + } |
|
| 753 | 776 | |
| 754 | 777 | // Have we got a message to display? |
| 755 | - if (!empty($context['settings_message'])) |
|
| 756 | - echo ' |
|
| 778 | + if (!empty($context['settings_message'])) { |
|
| 779 | + echo ' |
|
| 757 | 780 | <div class="information">', $context['settings_message'], '</div>'; |
| 781 | + } |
|
| 758 | 782 | |
| 759 | 783 | // Now actually loop through all the variables. |
| 760 | 784 | $is_open = false; |
@@ -807,8 +831,9 @@ discard block |
||
| 807 | 831 | // Hang about? Are you pulling my leg - a callback?! |
| 808 | 832 | if (is_array($config_var) && $config_var['type'] == 'callback') |
| 809 | 833 | { |
| 810 | - if (function_exists('template_callback_' . $config_var['name'])) |
|
| 811 | - call_user_func('template_callback_' . $config_var['name']); |
|
| 834 | + if (function_exists('template_callback_' . $config_var['name'])) { |
|
| 835 | + call_user_func('template_callback_' . $config_var['name']); |
|
| 836 | + } |
|
| 812 | 837 | |
| 813 | 838 | continue; |
| 814 | 839 | } |
@@ -838,9 +863,10 @@ discard block |
||
| 838 | 863 | $text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time'); |
| 839 | 864 | |
| 840 | 865 | // Show the [?] button. |
| 841 | - if ($config_var['help']) |
|
| 842 | - echo ' |
|
| 866 | + if ($config_var['help']) { |
|
| 867 | + echo ' |
|
| 843 | 868 | <a id="setting_', $config_var['name'], '_help" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="', $txt['help'], '"></span></a> '; |
| 869 | + } |
|
| 844 | 870 | |
| 845 | 871 | echo ' |
| 846 | 872 | <a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span> |
@@ -849,23 +875,26 @@ discard block |
||
| 849 | 875 | $config_var['preinput']; |
| 850 | 876 | |
| 851 | 877 | // Show a check box. |
| 852 | - if ($config_var['type'] == 'check') |
|
| 853 | - echo ' |
|
| 878 | + if ($config_var['type'] == 'check') { |
|
| 879 | + echo ' |
|
| 854 | 880 | <input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1">'; |
| 881 | + } |
|
| 855 | 882 | // Escape (via htmlspecialchars.) the text box. |
| 856 | - elseif ($config_var['type'] == 'password') |
|
| 857 | - echo ' |
|
| 883 | + elseif ($config_var['type'] == 'password') { |
|
| 884 | + echo ' |
|
| 858 | 885 | <input type="password"', $disabled, $javascript, ' name="', $config_var['name'], '[0]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' value="*#fakepass#*" onfocus="this.value = \'\'; this.form.', $config_var['name'], '.disabled = false;"><br> |
| 859 | 886 | <input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), '>'; |
| 887 | + } |
|
| 860 | 888 | // Show a selection box. |
| 861 | 889 | elseif ($config_var['type'] == 'select') |
| 862 | 890 | { |
| 863 | 891 | echo ' |
| 864 | 892 | <select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), (!empty($config_var['multiple']) && !empty($config_var['size']) ? ' size="' . $config_var['size'] . '"' : ''), '>'; |
| 865 | 893 | |
| 866 | - foreach ($config_var['data'] as $option) |
|
| 867 | - echo ' |
|
| 894 | + foreach ($config_var['data'] as $option) { |
|
| 895 | + echo ' |
|
| 868 | 896 | <option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected' : ''), '>', $option[1], '</option>'; |
| 897 | + } |
|
| 869 | 898 | echo ' |
| 870 | 899 | </select>'; |
| 871 | 900 | } |
@@ -882,16 +911,18 @@ discard block |
||
| 882 | 911 | |
| 883 | 912 | foreach ($context['board_list'] as $id_cat => $cat) |
| 884 | 913 | { |
| 885 | - if (!$first) |
|
| 886 | - echo ' |
|
| 914 | + if (!$first) { |
|
| 915 | + echo ' |
|
| 887 | 916 | <hr>'; |
| 917 | + } |
|
| 888 | 918 | echo ' |
| 889 | 919 | <strong>', $cat['name'], '</strong> |
| 890 | 920 | <ul>'; |
| 891 | 921 | |
| 892 | - foreach ($cat['boards'] as $id_board => $brd) |
|
| 893 | - echo ' |
|
| 922 | + foreach ($cat['boards'] as $id_board => $brd) { |
|
| 923 | + echo ' |
|
| 894 | 924 | <li><label><input type="checkbox" name="', $config_var['name'], '[', $brd['id'], ']" value="1"', in_array($brd['id'], $config_var['value']) ? ' checked' : '', '> ', $brd['child_level'] > 0 ? str_repeat(' ', $brd['child_level']) : '', $brd['name'], '</label></li>'; |
| 925 | + } |
|
| 895 | 926 | |
| 896 | 927 | echo ' |
| 897 | 928 | </ul>'; |
@@ -901,12 +932,14 @@ discard block |
||
| 901 | 932 | </fieldset>'; |
| 902 | 933 | } |
| 903 | 934 | // Text area? |
| 904 | - elseif ($config_var['type'] == 'large_text') |
|
| 905 | - echo ' |
|
| 935 | + elseif ($config_var['type'] == 'large_text') { |
|
| 936 | + echo ' |
|
| 906 | 937 | <textarea rows="', (!empty($config_var['size']) ? $config_var['size'] : (!empty($config_var['rows']) ? $config_var['rows'] : 4)), '" cols="', (!empty($config_var['cols']) ? $config_var['cols'] : 30), '" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>'; |
| 938 | + } |
|
| 907 | 939 | // Permission group? |
| 908 | - elseif ($config_var['type'] == 'permissions') |
|
| 909 | - theme_inline_permissions($config_var['name']); |
|
| 940 | + elseif ($config_var['type'] == 'permissions') { |
|
| 941 | + theme_inline_permissions($config_var['name']); |
|
| 942 | + } |
|
| 910 | 943 | |
| 911 | 944 | // BBC selection? |
| 912 | 945 | elseif ($config_var['type'] == 'bbc') |
@@ -918,22 +951,24 @@ discard block |
||
| 918 | 951 | |
| 919 | 952 | foreach ($context['bbc_columns'] as $bbcColumn) |
| 920 | 953 | { |
| 921 | - foreach ($bbcColumn as $bbcTag) |
|
| 922 | - echo ' |
|
| 954 | + foreach ($bbcColumn as $bbcTag) { |
|
| 955 | + echo ' |
|
| 923 | 956 | <li class="list_bbc floatleft"> |
| 924 | 957 | <input type="checkbox" name="', $config_var['name'], '_enabledTags[]" id="tag_', $config_var['name'], '_', $bbcTag['tag'], '" value="', $bbcTag['tag'], '"', !in_array($bbcTag['tag'], $context['bbc_sections'][$config_var['name']]['disabled']) ? ' checked' : '', '> <label for="tag_', $config_var['name'], '_', $bbcTag['tag'], '">', $bbcTag['tag'], '</label>', $bbcTag['show_help'] ? ' (<a href="' . $scripturl . '?action=helpadmin;help=tag_' . $bbcTag['tag'] . '" onclick="return reqOverlayDiv(this.href);">?</a>)' : '', ' |
| 925 | 958 | </li>'; |
| 959 | + } |
|
| 926 | 960 | } |
| 927 | 961 | echo ' </ul> |
| 928 | 962 | <input type="checkbox" id="bbc_', $config_var['name'], '_select_all" onclick="invertAll(this, this.form, \'', $config_var['name'], '_enabledTags\');"', $context['bbc_sections'][$config_var['name']]['all_selected'] ? ' checked' : '', '> <label for="bbc_', $config_var['name'], '_select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label> |
| 929 | 963 | </fieldset>'; |
| 930 | 964 | } |
| 931 | 965 | // A simple message? |
| 932 | - elseif ($config_var['type'] == 'var_message') |
|
| 933 | - echo ' |
|
| 966 | + elseif ($config_var['type'] == 'var_message') { |
|
| 967 | + echo ' |
|
| 934 | 968 | <div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '> |
| 935 | 969 | ', $config_var['var_message'], ' |
| 936 | 970 | </div>'; |
| 971 | + } |
|
| 937 | 972 | // Assume it must be a text box |
| 938 | 973 | else |
| 939 | 974 | { |
@@ -958,62 +993,70 @@ discard block |
||
| 958 | 993 | ' . $config_var['postinput'] : '',' |
| 959 | 994 | </dd>'; |
| 960 | 995 | } |
| 961 | - } |
|
| 962 | - else |
|
| 996 | + } else |
|
| 963 | 997 | { |
| 964 | 998 | // Just show a separator. |
| 965 | - if ($config_var == '') |
|
| 966 | - echo ' |
|
| 999 | + if ($config_var == '') { |
|
| 1000 | + echo ' |
|
| 967 | 1001 | </dl> |
| 968 | 1002 | <hr> |
| 969 | 1003 | <dl class="settings">'; |
| 970 | - else |
|
| 971 | - echo ' |
|
| 1004 | + } else { |
|
| 1005 | + echo ' |
|
| 972 | 1006 | <dd> |
| 973 | 1007 | <strong>' . $config_var . '</strong> |
| 974 | 1008 | </dd>'; |
| 1009 | + } |
|
| 975 | 1010 | } |
| 976 | 1011 | } |
| 977 | 1012 | |
| 978 | - if ($is_open) |
|
| 979 | - echo ' |
|
| 1013 | + if ($is_open) { |
|
| 1014 | + echo ' |
|
| 980 | 1015 | </dl>'; |
| 1016 | + } |
|
| 981 | 1017 | |
| 982 | - if (empty($context['settings_save_dont_show'])) |
|
| 983 | - echo ' |
|
| 1018 | + if (empty($context['settings_save_dont_show'])) { |
|
| 1019 | + echo ' |
|
| 984 | 1020 | <input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button">'; |
| 1021 | + } |
|
| 985 | 1022 | |
| 986 | - if ($is_open) |
|
| 987 | - echo ' |
|
| 1023 | + if ($is_open) { |
|
| 1024 | + echo ' |
|
| 988 | 1025 | </div><!-- .windowbg -->'; |
| 1026 | + } |
|
| 989 | 1027 | |
| 990 | 1028 | |
| 991 | 1029 | // At least one token has to be used! |
| 992 | - if (isset($context['admin-ssc_token'])) |
|
| 993 | - echo ' |
|
| 1030 | + if (isset($context['admin-ssc_token'])) { |
|
| 1031 | + echo ' |
|
| 994 | 1032 | <input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '">'; |
| 1033 | + } |
|
| 995 | 1034 | |
| 996 | - if (isset($context['admin-dbsc_token'])) |
|
| 997 | - echo ' |
|
| 1035 | + if (isset($context['admin-dbsc_token'])) { |
|
| 1036 | + echo ' |
|
| 998 | 1037 | <input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '">'; |
| 1038 | + } |
|
| 999 | 1039 | |
| 1000 | - if (isset($context['admin-mp_token'])) |
|
| 1001 | - echo ' |
|
| 1040 | + if (isset($context['admin-mp_token'])) { |
|
| 1041 | + echo ' |
|
| 1002 | 1042 | <input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">'; |
| 1043 | + } |
|
| 1003 | 1044 | |
| 1004 | 1045 | echo ' |
| 1005 | 1046 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 1006 | 1047 | </form> |
| 1007 | 1048 | </div><!-- #admincenter -->'; |
| 1008 | 1049 | |
| 1009 | - if (!empty($context['settings_post_javascript'])) |
|
| 1010 | - echo ' |
|
| 1050 | + if (!empty($context['settings_post_javascript'])) { |
|
| 1051 | + echo ' |
|
| 1011 | 1052 | <script> |
| 1012 | 1053 | ', $context['settings_post_javascript'], ' |
| 1013 | 1054 | </script>'; |
| 1055 | + } |
|
| 1014 | 1056 | |
| 1015 | - if (!empty($context['settings_insert_below'])) |
|
| 1016 | - echo $context['settings_insert_below']; |
|
| 1057 | + if (!empty($context['settings_insert_below'])) { |
|
| 1058 | + echo $context['settings_insert_below']; |
|
| 1059 | + } |
|
| 1017 | 1060 | |
| 1018 | 1061 | // We may have added a board listing. If we did, we need to make it work. |
| 1019 | 1062 | addInlineJavascript(' |
@@ -1036,9 +1079,10 @@ discard block |
||
| 1036 | 1079 | { |
| 1037 | 1080 | global $context, $txt; |
| 1038 | 1081 | |
| 1039 | - if (!empty($context['saved_successful'])) |
|
| 1040 | - echo ' |
|
| 1082 | + if (!empty($context['saved_successful'])) { |
|
| 1083 | + echo ' |
|
| 1041 | 1084 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
| 1085 | + } |
|
| 1042 | 1086 | |
| 1043 | 1087 | // Standard fields. |
| 1044 | 1088 | template_show_list('standard_profile_fields'); |
@@ -1072,11 +1116,12 @@ discard block |
||
| 1072 | 1116 | { |
| 1073 | 1117 | loadLanguage('Errors'); |
| 1074 | 1118 | |
| 1075 | - if (isset($txt['custom_option_' . $_GET['msg']])) |
|
| 1076 | - echo ' |
|
| 1119 | + if (isset($txt['custom_option_' . $_GET['msg']])) { |
|
| 1120 | + echo ' |
|
| 1077 | 1121 | <div class="errorbox">', |
| 1078 | 1122 | $txt['custom_option_' . $_GET['msg']], ' |
| 1079 | 1123 | </div>'; |
| 1124 | + } |
|
| 1080 | 1125 | } |
| 1081 | 1126 | |
| 1082 | 1127 | echo ' |
@@ -1143,9 +1188,10 @@ discard block |
||
| 1143 | 1188 | <dd> |
| 1144 | 1189 | <select name="placement" id="placement">'; |
| 1145 | 1190 | |
| 1146 | - foreach ($context['cust_profile_fields_placement'] as $order => $name) |
|
| 1147 | - echo ' |
|
| 1191 | + foreach ($context['cust_profile_fields_placement'] as $order => $name) { |
|
| 1192 | + echo ' |
|
| 1148 | 1193 | <option value="', $order, '"', $context['field']['placement'] == $order ? ' selected' : '', '>', $txt['custom_profile_placement_' . $name], '</option>'; |
| 1194 | + } |
|
| 1149 | 1195 | |
| 1150 | 1196 | echo ' |
| 1151 | 1197 | </select> |
@@ -1169,9 +1215,10 @@ discard block |
||
| 1169 | 1215 | <dd> |
| 1170 | 1216 | <select name="field_type" id="field_type" onchange="updateInputBoxes();">'; |
| 1171 | 1217 | |
| 1172 | - foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) |
|
| 1173 | - echo ' |
|
| 1218 | + foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) { |
|
| 1219 | + echo ' |
|
| 1174 | 1220 | <option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>'; |
| 1221 | + } |
|
| 1175 | 1222 | |
| 1176 | 1223 | echo ' |
| 1177 | 1224 | </select> |
@@ -1203,9 +1250,10 @@ discard block |
||
| 1203 | 1250 | </dt> |
| 1204 | 1251 | <dd id="options_dd">'; |
| 1205 | 1252 | |
| 1206 | - foreach ($context['field']['options'] as $k => $option) |
|
| 1207 | - echo ' |
|
| 1253 | + foreach ($context['field']['options'] as $k => $option) { |
|
| 1254 | + echo ' |
|
| 1208 | 1255 | ', $k == 0 ? '' : '<br>', '<input type="radio" name="default_select" value="', $k, '"', $context['field']['default_select'] == $option ? ' checked' : '', '><input type="text" name="select_option[', $k, ']" value="', $option, '">'; |
| 1256 | + } |
|
| 1209 | 1257 | |
| 1210 | 1258 | echo ' |
| 1211 | 1259 | <span id="addopt"></span> |
@@ -1269,9 +1317,10 @@ discard block |
||
| 1269 | 1317 | </fieldset> |
| 1270 | 1318 | <input type="submit" name="save" value="', $txt['save'], '" class="button">'; |
| 1271 | 1319 | |
| 1272 | - if ($context['fid']) |
|
| 1273 | - echo ' |
|
| 1320 | + if ($context['fid']) { |
|
| 1321 | + echo ' |
|
| 1274 | 1322 | <input type="submit" name="delete" value="', $txt['delete'], '" data-confirm="', $txt['custom_edit_delete_sure'], '" class="button you_sure">'; |
| 1323 | + } |
|
| 1275 | 1324 | |
| 1276 | 1325 | echo ' |
| 1277 | 1326 | </div><!-- .windowbg --> |
@@ -1318,8 +1367,7 @@ discard block |
||
| 1318 | 1367 | <p class="centertext"> |
| 1319 | 1368 | <strong>', $txt['admin_search_results_none'], '</strong> |
| 1320 | 1369 | </p>'; |
| 1321 | - } |
|
| 1322 | - else |
|
| 1370 | + } else |
|
| 1323 | 1371 | { |
| 1324 | 1372 | echo ' |
| 1325 | 1373 | <ol class="search_results">'; |
@@ -1346,9 +1394,10 @@ discard block |
||
| 1346 | 1394 | <li> |
| 1347 | 1395 | <a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'], ']'; |
| 1348 | 1396 | |
| 1349 | - if ($result['help']) |
|
| 1350 | - echo ' |
|
| 1397 | + if ($result['help']) { |
|
| 1398 | + echo ' |
|
| 1351 | 1399 | <p class="double_height">', $result['help'], '</p>'; |
| 1400 | + } |
|
| 1352 | 1401 | |
| 1353 | 1402 | echo ' |
| 1354 | 1403 | </li>'; |
@@ -1388,10 +1437,11 @@ discard block |
||
| 1388 | 1437 | <strong>', $txt['setup_verification_answer'], '</strong> |
| 1389 | 1438 | </dd>'; |
| 1390 | 1439 | |
| 1391 | - if (!empty($context['qa_by_lang'][$lang_id])) |
|
| 1392 | - foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
| 1440 | + if (!empty($context['qa_by_lang'][$lang_id])) { |
|
| 1441 | + foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
| 1393 | 1442 | { |
| 1394 | 1443 | $question = $context['question_answers'][$q_id]; |
| 1444 | + } |
|
| 1395 | 1445 | |
| 1396 | 1446 | echo ' |
| 1397 | 1447 | <dt> |
@@ -1399,9 +1449,10 @@ discard block |
||
| 1399 | 1449 | </dt> |
| 1400 | 1450 | <dd>'; |
| 1401 | 1451 | |
| 1402 | - foreach ($question['answers'] as $answer) |
|
| 1403 | - echo ' |
|
| 1452 | + foreach ($question['answers'] as $answer) { |
|
| 1453 | + echo ' |
|
| 1404 | 1454 | <input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="verification_answer">'; |
| 1455 | + } |
|
| 1405 | 1456 | |
| 1406 | 1457 | echo ' |
| 1407 | 1458 | <div class="qa_add_answer"><a href="javascript:void(0);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div> |
@@ -1440,11 +1491,12 @@ discard block |
||
| 1440 | 1491 | ', $txt['errors_found'], ': |
| 1441 | 1492 | <ul>'; |
| 1442 | 1493 | |
| 1443 | - foreach ($context['repair_errors'] as $error) |
|
| 1444 | - echo ' |
|
| 1494 | + foreach ($context['repair_errors'] as $error) { |
|
| 1495 | + echo ' |
|
| 1445 | 1496 | <li> |
| 1446 | 1497 | ', $error, ' |
| 1447 | 1498 | </li>'; |
| 1499 | + } |
|
| 1448 | 1500 | |
| 1449 | 1501 | echo ' |
| 1450 | 1502 | </ul> |
@@ -1454,15 +1506,14 @@ discard block |
||
| 1454 | 1506 | <p class="padding"> |
| 1455 | 1507 | <strong><a href="', $scripturl, '?action=admin;area=repairboards;fixErrors;', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="', $scripturl, '?action=admin;area=maintain">', $txt['no'], '</a></strong> |
| 1456 | 1508 | </p>'; |
| 1457 | - } |
|
| 1458 | - else |
|
| 1459 | - echo ' |
|
| 1509 | + } else { |
|
| 1510 | + echo ' |
|
| 1460 | 1511 | <p>', $txt['maintain_no_errors'], '</p> |
| 1461 | 1512 | <p class="padding"> |
| 1462 | 1513 | <a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a> |
| 1463 | 1514 | </p>'; |
| 1464 | - } |
|
| 1465 | - else |
|
| 1515 | + } |
|
| 1516 | + } else |
|
| 1466 | 1517 | { |
| 1467 | 1518 | if (!empty($context['redirect_to_recount'])) |
| 1468 | 1519 | { |
@@ -1474,8 +1525,7 @@ discard block |
||
| 1474 | 1525 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 1475 | 1526 | <input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '"> |
| 1476 | 1527 | </form>'; |
| 1477 | - } |
|
| 1478 | - else |
|
| 1528 | + } else |
|
| 1479 | 1529 | { |
| 1480 | 1530 | echo ' |
| 1481 | 1531 | <p>', $txt['errors_fixed'], '</p> |
@@ -1566,9 +1616,10 @@ discard block |
||
| 1566 | 1616 | <tr class="windowbg"> |
| 1567 | 1617 | <td class="equal_table">', $key, '</td>'; |
| 1568 | 1618 | |
| 1569 | - foreach ($setting as $key_lm => $value) |
|
| 1570 | - echo ' |
|
| 1619 | + foreach ($setting as $key_lm => $value) { |
|
| 1620 | + echo ' |
|
| 1571 | 1621 | <td class="equal_table">', $value, '</td>'; |
| 1622 | + } |
|
| 1572 | 1623 | |
| 1573 | 1624 | echo ' |
| 1574 | 1625 | </tr>'; |
@@ -1628,8 +1679,8 @@ discard block |
||
| 1628 | 1679 | { |
| 1629 | 1680 | global $context, $txt; |
| 1630 | 1681 | |
| 1631 | - if ($context['user']['is_admin']) |
|
| 1632 | - echo ' |
|
| 1682 | + if ($context['user']['is_admin']) { |
|
| 1683 | + echo ' |
|
| 1633 | 1684 | <span class="floatright admin_search"> |
| 1634 | 1685 | <span class="generic_icons filter centericon"></span> |
| 1635 | 1686 | <input type="search" name="search_term" placeholder="', $txt['admin_search'], '"> |
@@ -1640,7 +1691,8 @@ discard block |
||
| 1640 | 1691 | </select> |
| 1641 | 1692 | <input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button"> |
| 1642 | 1693 | </span>'; |
| 1643 | -} |
|
| 1694 | + } |
|
| 1695 | + } |
|
| 1644 | 1696 | |
| 1645 | 1697 | /** |
| 1646 | 1698 | * Form for stopping people using naughty words, etc. |
@@ -1649,9 +1701,10 @@ discard block |
||
| 1649 | 1701 | { |
| 1650 | 1702 | global $context, $scripturl, $txt, $modSettings; |
| 1651 | 1703 | |
| 1652 | - if (!empty($context['saved_successful'])) |
|
| 1653 | - echo ' |
|
| 1704 | + if (!empty($context['saved_successful'])) { |
|
| 1705 | + echo ' |
|
| 1654 | 1706 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
| 1707 | + } |
|
| 1655 | 1708 | |
| 1656 | 1709 | // First section is for adding/removing words from the censored list. |
| 1657 | 1710 | echo ' |
@@ -1342,7 +1342,7 @@ discard block |
||
| 1342 | 1342 | 'class' => 'centercol', |
| 1343 | 1343 | ), |
| 1344 | 1344 | 'data' => array( |
| 1345 | - 'function' => function ($rowData) |
|
| 1345 | + 'function' => function($rowData) |
|
| 1346 | 1346 | { |
| 1347 | 1347 | $isChecked = $rowData['disabled'] ? '' : ' checked'; |
| 1348 | 1348 | $onClickHandler = $rowData['can_show_register'] ? sprintf(' onclick="document.getElementById(\'reg_%1$s\').disabled = !this.checked;"', $rowData['id']) : ''; |
@@ -1358,7 +1358,7 @@ discard block |
||
| 1358 | 1358 | 'class' => 'centercol', |
| 1359 | 1359 | ), |
| 1360 | 1360 | 'data' => array( |
| 1361 | - 'function' => function ($rowData) |
|
| 1361 | + 'function' => function($rowData) |
|
| 1362 | 1362 | { |
| 1363 | 1363 | $isChecked = $rowData['on_register'] && !$rowData['disabled'] ? ' checked' : ''; |
| 1364 | 1364 | $isDisabled = $rowData['can_show_register'] ? '' : ' disabled'; |
@@ -1405,15 +1405,15 @@ discard block |
||
| 1405 | 1405 | 'value' => $txt['custom_profile_fieldorder'], |
| 1406 | 1406 | ), |
| 1407 | 1407 | 'data' => array( |
| 1408 | - 'function' => function ($rowData) use ($context, $txt, $scripturl) |
|
| 1408 | + 'function' => function($rowData) use ($context, $txt, $scripturl) |
|
| 1409 | 1409 | { |
| 1410 | - $return = '<p class="centertext bold_text">'. $rowData['field_order'] .'<br>'; |
|
| 1410 | + $return = '<p class="centertext bold_text">' . $rowData['field_order'] . '<br>'; |
|
| 1411 | 1411 | |
| 1412 | 1412 | if ($rowData['field_order'] > 1) |
| 1413 | - $return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=up"><span class="toggle_up" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_up'] .'"></span></a>'; |
|
| 1413 | + $return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=up"><span class="toggle_up" title="' . $txt['custom_edit_order_move'] . ' ' . $txt['custom_edit_order_up'] . '"></span></a>'; |
|
| 1414 | 1414 | |
| 1415 | 1415 | if ($rowData['field_order'] < $context['custFieldsMaxOrder']) |
| 1416 | - $return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=down"><span class="toggle_down" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_down'] .'"></span></a>'; |
|
| 1416 | + $return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=down"><span class="toggle_down" title="' . $txt['custom_edit_order_move'] . ' ' . $txt['custom_edit_order_down'] . '"></span></a>'; |
|
| 1417 | 1417 | |
| 1418 | 1418 | $return .= '</p>'; |
| 1419 | 1419 | |
@@ -1431,7 +1431,7 @@ discard block |
||
| 1431 | 1431 | 'value' => $txt['custom_profile_fieldname'], |
| 1432 | 1432 | ), |
| 1433 | 1433 | 'data' => array( |
| 1434 | - 'function' => function ($rowData) use ($scripturl) |
|
| 1434 | + 'function' => function($rowData) use ($scripturl) |
|
| 1435 | 1435 | { |
| 1436 | 1436 | return sprintf('<a href="%1$s?action=admin;area=featuresettings;sa=profileedit;fid=%2$d">%3$s</a><div class="smalltext">%4$s</div>', $scripturl, $rowData['id_field'], $rowData['field_name'], $rowData['field_desc']); |
| 1437 | 1437 | }, |
@@ -1447,7 +1447,7 @@ discard block |
||
| 1447 | 1447 | 'value' => $txt['custom_profile_fieldtype'], |
| 1448 | 1448 | ), |
| 1449 | 1449 | 'data' => array( |
| 1450 | - 'function' => function ($rowData) use ($txt) |
|
| 1450 | + 'function' => function($rowData) use ($txt) |
|
| 1451 | 1451 | { |
| 1452 | 1452 | $textKey = sprintf('custom_profile_type_%1$s', $rowData['field_type']); |
| 1453 | 1453 | return isset($txt[$textKey]) ? $txt[$textKey] : $textKey; |
@@ -1465,7 +1465,7 @@ discard block |
||
| 1465 | 1465 | 'value' => $txt['custom_profile_active'], |
| 1466 | 1466 | ), |
| 1467 | 1467 | 'data' => array( |
| 1468 | - 'function' => function ($rowData) use ($txt) |
|
| 1468 | + 'function' => function($rowData) use ($txt) |
|
| 1469 | 1469 | { |
| 1470 | 1470 | return $rowData['active'] ? $txt['yes'] : $txt['no']; |
| 1471 | 1471 | }, |
@@ -1482,7 +1482,7 @@ discard block |
||
| 1482 | 1482 | 'value' => $txt['custom_profile_placement'], |
| 1483 | 1483 | ), |
| 1484 | 1484 | 'data' => array( |
| 1485 | - 'function' => function ($rowData) |
|
| 1485 | + 'function' => function($rowData) |
|
| 1486 | 1486 | { |
| 1487 | 1487 | global $txt, $context; |
| 1488 | 1488 | |
@@ -1717,7 +1717,7 @@ discard block |
||
| 1717 | 1717 | redirectexit('action=admin;area=featuresettings;sa=profile'); // @todo implement an error handler |
| 1718 | 1718 | |
| 1719 | 1719 | // All good, proceed. |
| 1720 | - $smcFunc['db_query']('',' |
|
| 1720 | + $smcFunc['db_query']('', ' |
|
| 1721 | 1721 | UPDATE {db_prefix}custom_fields |
| 1722 | 1722 | SET field_order = {int:old_order} |
| 1723 | 1723 | WHERE field_order = {int:new_order}', |
@@ -1726,7 +1726,7 @@ discard block |
||
| 1726 | 1726 | 'old_order' => $context['field']['order'], |
| 1727 | 1727 | ) |
| 1728 | 1728 | ); |
| 1729 | - $smcFunc['db_query']('',' |
|
| 1729 | + $smcFunc['db_query']('', ' |
|
| 1730 | 1730 | UPDATE {db_prefix}custom_fields |
| 1731 | 1731 | SET field_order = {int:new_order} |
| 1732 | 1732 | WHERE id_field = {int:id_field}', |
@@ -1828,7 +1828,7 @@ discard block |
||
| 1828 | 1828 | $smcFunc['db_free_result']($request); |
| 1829 | 1829 | |
| 1830 | 1830 | $unique = false; |
| 1831 | - for ($i = 0; !$unique && $i < 9; $i ++) |
|
| 1831 | + for ($i = 0; !$unique && $i < 9; $i++) |
|
| 1832 | 1832 | { |
| 1833 | 1833 | if (!in_array($col_name, $current_fields)) |
| 1834 | 1834 | $unique = true; |
@@ -2001,7 +2001,7 @@ discard block |
||
| 2001 | 2001 | ); |
| 2002 | 2002 | |
| 2003 | 2003 | // Re-arrange the order. |
| 2004 | - $smcFunc['db_query']('',' |
|
| 2004 | + $smcFunc['db_query']('', ' |
|
| 2005 | 2005 | UPDATE {db_prefix}custom_fields |
| 2006 | 2006 | SET field_order = field_order - 1 |
| 2007 | 2007 | WHERE field_order > {int:current_order}', |
@@ -2266,7 +2266,7 @@ discard block |
||
| 2266 | 2266 | $context['token_check'] = 'noti-admin'; |
| 2267 | 2267 | |
| 2268 | 2268 | // Specify our action since we'll want to post back here instead of the profile |
| 2269 | - $context['action'] = 'action=admin;area=featuresettings;sa=alerts;'. $context['session_var'] .'='. $context['session_id']; |
|
| 2269 | + $context['action'] = 'action=admin;area=featuresettings;sa=alerts;' . $context['session_var'] . '=' . $context['session_id']; |
|
| 2270 | 2270 | |
| 2271 | 2271 | loadTemplate('Profile'); |
| 2272 | 2272 | loadLanguage('Profile'); |
@@ -2347,7 +2347,7 @@ discard block |
||
| 2347 | 2347 | // Now create the editor. |
| 2348 | 2348 | $editorOptions = array( |
| 2349 | 2349 | 'id' => 'policy_text', |
| 2350 | - 'value' => !empty($modSettings['policy_text'.$currentVersion]) ? $modSettings['policy_text'.$currentVersion] : '', |
|
| 2350 | + 'value' => !empty($modSettings['policy_text' . $currentVersion]) ? $modSettings['policy_text' . $currentVersion] : '', |
|
| 2351 | 2351 | 'height' => '250px', |
| 2352 | 2352 | 'width' => '100%', |
| 2353 | 2353 | 'labels' => array( |
@@ -2379,18 +2379,18 @@ discard block |
||
| 2379 | 2379 | if (!empty($_REQUEST['save_new_policy'])) |
| 2380 | 2380 | { |
| 2381 | 2381 | $currentVersion++; |
| 2382 | - $config_vars[] = array('text', 'policy_text'.$currentVersion); |
|
| 2383 | - $_POST['policy_text'.$currentVersion] = $_REQUEST['policy_text']; |
|
| 2382 | + $config_vars[] = array('text', 'policy_text' . $currentVersion); |
|
| 2383 | + $_POST['policy_text' . $currentVersion] = $_REQUEST['policy_text']; |
|
| 2384 | 2384 | $config_vars[] = array('text', 'policy_version'); |
| 2385 | - $_POST['policy_version'] = 'policy_text'.$currentVersion; |
|
| 2385 | + $_POST['policy_version'] = 'policy_text' . $currentVersion; |
|
| 2386 | 2386 | unset($config_vars[1]); |
| 2387 | 2387 | } |
| 2388 | 2388 | elseif (!empty($_REQUEST['update_policy'])) |
| 2389 | 2389 | { |
| 2390 | - $config_vars[] = array('text', 'policy_text'.$currentVersion); |
|
| 2391 | - $_POST['policy_text'.$currentVersion] = $_REQUEST['policy_text']; |
|
| 2390 | + $config_vars[] = array('text', 'policy_text' . $currentVersion); |
|
| 2391 | + $_POST['policy_text' . $currentVersion] = $_REQUEST['policy_text']; |
|
| 2392 | 2392 | $config_vars[] = array('text', 'policy_version'); |
| 2393 | - $_POST['policy_version'] = 'policy_text'.$currentVersion; |
|
| 2393 | + $_POST['policy_version'] = 'policy_text' . $currentVersion; |
|
| 2394 | 2394 | unset($config_vars[1]); |
| 2395 | 2395 | } |
| 2396 | 2396 | saveDBSettings($config_vars); |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | * @version 2.1 Beta 4 |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -if (!defined('SMF')) |
|
| 17 | +if (!defined('SMF')) { |
|
| 18 | 18 | die('No direct access...'); |
| 19 | +} |
|
| 19 | 20 | |
| 20 | 21 | /** |
| 21 | 22 | * This function makes sure the requested subaction does exists, if it doesn't, it sets a default action or. |
@@ -212,16 +213,18 @@ discard block |
||
| 212 | 213 | { |
| 213 | 214 | $all_zones = timezone_identifiers_list(); |
| 214 | 215 | // Make sure we set the value to the same as the printed value. |
| 215 | - foreach ($all_zones as $zone) |
|
| 216 | - $config_vars['default_timezone'][2][$zone] = $zone; |
|
| 216 | + foreach ($all_zones as $zone) { |
|
| 217 | + $config_vars['default_timezone'][2][$zone] = $zone; |
|
| 218 | + } |
|
| 219 | + } else { |
|
| 220 | + unset($config_vars['default_timezone']); |
|
| 217 | 221 | } |
| 218 | - else |
|
| 219 | - unset($config_vars['default_timezone']); |
|
| 220 | 222 | |
| 221 | 223 | call_integration_hook('integrate_modify_basic_settings', array(&$config_vars)); |
| 222 | 224 | |
| 223 | - if ($return_config) |
|
| 224 | - return $config_vars; |
|
| 225 | + if ($return_config) { |
|
| 226 | + return $config_vars; |
|
| 227 | + } |
|
| 225 | 228 | |
| 226 | 229 | // Saving? |
| 227 | 230 | if (isset($_GET['save'])) |
@@ -229,8 +232,9 @@ discard block |
||
| 229 | 232 | checkSession(); |
| 230 | 233 | |
| 231 | 234 | // Prevent absurd boundaries here - make it a day tops. |
| 232 | - if (isset($_POST['lastActive'])) |
|
| 233 | - $_POST['lastActive'] = min((int) $_POST['lastActive'], 1440); |
|
| 235 | + if (isset($_POST['lastActive'])) { |
|
| 236 | + $_POST['lastActive'] = min((int) $_POST['lastActive'], 1440); |
|
| 237 | + } |
|
| 234 | 238 | |
| 235 | 239 | call_integration_hook('integrate_save_basic_settings'); |
| 236 | 240 | |
@@ -238,8 +242,9 @@ discard block |
||
| 238 | 242 | $_SESSION['adm-save'] = true; |
| 239 | 243 | |
| 240 | 244 | // Do a bit of housekeeping |
| 241 | - if (empty($_POST['minimize_files'])) |
|
| 242 | - deleteAllMinified(); |
|
| 245 | + if (empty($_POST['minimize_files'])) { |
|
| 246 | + deleteAllMinified(); |
|
| 247 | + } |
|
| 243 | 248 | |
| 244 | 249 | writeLog(); |
| 245 | 250 | redirectexit('action=admin;area=featuresettings;sa=basic'); |
@@ -279,8 +284,9 @@ discard block |
||
| 279 | 284 | |
| 280 | 285 | call_integration_hook('integrate_modify_bbc_settings', array(&$config_vars)); |
| 281 | 286 | |
| 282 | - if ($return_config) |
|
| 283 | - return $config_vars; |
|
| 287 | + if ($return_config) { |
|
| 288 | + return $config_vars; |
|
| 289 | + } |
|
| 284 | 290 | |
| 285 | 291 | // Setup the template. |
| 286 | 292 | require_once($sourcedir . '/ManageServer.php'); |
@@ -297,13 +303,15 @@ discard block |
||
| 297 | 303 | |
| 298 | 304 | // Clean up the tags. |
| 299 | 305 | $bbcTags = array(); |
| 300 | - foreach (parse_bbc(false) as $tag) |
|
| 301 | - $bbcTags[] = $tag['tag']; |
|
| 306 | + foreach (parse_bbc(false) as $tag) { |
|
| 307 | + $bbcTags[] = $tag['tag']; |
|
| 308 | + } |
|
| 302 | 309 | |
| 303 | - if (!isset($_POST['disabledBBC_enabledTags'])) |
|
| 304 | - $_POST['disabledBBC_enabledTags'] = array(); |
|
| 305 | - elseif (!is_array($_POST['disabledBBC_enabledTags'])) |
|
| 306 | - $_POST['disabledBBC_enabledTags'] = array($_POST['disabledBBC_enabledTags']); |
|
| 310 | + if (!isset($_POST['disabledBBC_enabledTags'])) { |
|
| 311 | + $_POST['disabledBBC_enabledTags'] = array(); |
|
| 312 | + } elseif (!is_array($_POST['disabledBBC_enabledTags'])) { |
|
| 313 | + $_POST['disabledBBC_enabledTags'] = array($_POST['disabledBBC_enabledTags']); |
|
| 314 | + } |
|
| 307 | 315 | // Work out what is actually disabled! |
| 308 | 316 | $_POST['disabledBBC'] = implode(',', array_diff($bbcTags, $_POST['disabledBBC_enabledTags'])); |
| 309 | 317 | |
@@ -347,8 +355,9 @@ discard block |
||
| 347 | 355 | |
| 348 | 356 | call_integration_hook('integrate_layout_settings', array(&$config_vars)); |
| 349 | 357 | |
| 350 | - if ($return_config) |
|
| 351 | - return $config_vars; |
|
| 358 | + if ($return_config) { |
|
| 359 | + return $config_vars; |
|
| 360 | + } |
|
| 352 | 361 | |
| 353 | 362 | // Saving? |
| 354 | 363 | if (isset($_GET['save'])) |
@@ -388,8 +397,9 @@ discard block |
||
| 388 | 397 | |
| 389 | 398 | call_integration_hook('integrate_likes_settings', array(&$config_vars)); |
| 390 | 399 | |
| 391 | - if ($return_config) |
|
| 392 | - return $config_vars; |
|
| 400 | + if ($return_config) { |
|
| 401 | + return $config_vars; |
|
| 402 | + } |
|
| 393 | 403 | |
| 394 | 404 | // Saving? |
| 395 | 405 | if (isset($_GET['save'])) |
@@ -427,8 +437,9 @@ discard block |
||
| 427 | 437 | |
| 428 | 438 | call_integration_hook('integrate_mentions_settings', array(&$config_vars)); |
| 429 | 439 | |
| 430 | - if ($return_config) |
|
| 431 | - return $config_vars; |
|
| 440 | + if ($return_config) { |
|
| 441 | + return $config_vars; |
|
| 442 | + } |
|
| 432 | 443 | |
| 433 | 444 | // Saving? |
| 434 | 445 | if (isset($_GET['save'])) |
@@ -472,8 +483,8 @@ discard block |
||
| 472 | 483 | 'enable' => array('check', 'warning_enable'), |
| 473 | 484 | ); |
| 474 | 485 | |
| 475 | - if (!empty($modSettings['warning_settings']) && $currently_enabled) |
|
| 476 | - $config_vars += array( |
|
| 486 | + if (!empty($modSettings['warning_settings']) && $currently_enabled) { |
|
| 487 | + $config_vars += array( |
|
| 477 | 488 | '', |
| 478 | 489 | array('int', 'warning_watch', 'subtext' => $txt['setting_warning_watch_note'] . ' ' . $txt['zero_to_disable']), |
| 479 | 490 | 'moderate' => array('int', 'warning_moderate', 'subtext' => $txt['setting_warning_moderate_note'] . ' ' . $txt['zero_to_disable']), |
@@ -482,15 +493,18 @@ discard block |
||
| 482 | 493 | 'rem2' => array('int', 'warning_decrement', 'subtext' => $txt['setting_warning_decrement_note'] . ' ' . $txt['zero_to_disable']), |
| 483 | 494 | array('permissions', 'view_warning'), |
| 484 | 495 | ); |
| 496 | + } |
|
| 485 | 497 | |
| 486 | 498 | call_integration_hook('integrate_warning_settings', array(&$config_vars)); |
| 487 | 499 | |
| 488 | - if ($return_config) |
|
| 489 | - return $config_vars; |
|
| 500 | + if ($return_config) { |
|
| 501 | + return $config_vars; |
|
| 502 | + } |
|
| 490 | 503 | |
| 491 | 504 | // Cannot use moderation if post moderation is not enabled. |
| 492 | - if (!$modSettings['postmod_active']) |
|
| 493 | - unset($config_vars['moderate']); |
|
| 505 | + if (!$modSettings['postmod_active']) { |
|
| 506 | + unset($config_vars['moderate']); |
|
| 507 | + } |
|
| 494 | 508 | |
| 495 | 509 | // Will need the utility functions from here. |
| 496 | 510 | require_once($sourcedir . '/ManageServer.php'); |
@@ -515,16 +529,16 @@ discard block |
||
| 515 | 529 | 'warning_watch' => 10, |
| 516 | 530 | 'warning_mute' => 60, |
| 517 | 531 | ); |
| 518 | - if ($modSettings['postmod_active']) |
|
| 519 | - $vars['warning_moderate'] = 35; |
|
| 532 | + if ($modSettings['postmod_active']) { |
|
| 533 | + $vars['warning_moderate'] = 35; |
|
| 534 | + } |
|
| 520 | 535 | |
| 521 | 536 | foreach ($vars as $var => $value) |
| 522 | 537 | { |
| 523 | 538 | $config_vars[] = array('int', $var); |
| 524 | 539 | $_POST[$var] = $value; |
| 525 | 540 | } |
| 526 | - } |
|
| 527 | - else |
|
| 541 | + } else |
|
| 528 | 542 | { |
| 529 | 543 | $_POST['warning_watch'] = min($_POST['warning_watch'], 100); |
| 530 | 544 | $_POST['warning_moderate'] = $modSettings['postmod_active'] ? min($_POST['warning_moderate'], 100) : 0; |
@@ -612,8 +626,9 @@ discard block |
||
| 612 | 626 | |
| 613 | 627 | call_integration_hook('integrate_spam_settings', array(&$config_vars)); |
| 614 | 628 | |
| 615 | - if ($return_config) |
|
| 616 | - return $config_vars; |
|
| 629 | + if ($return_config) { |
|
| 630 | + return $config_vars; |
|
| 631 | + } |
|
| 617 | 632 | |
| 618 | 633 | // You need to be an admin to edit settings! |
| 619 | 634 | isAllowedTo('admin_forum'); |
@@ -647,8 +662,9 @@ discard block |
||
| 647 | 662 | |
| 648 | 663 | if (empty($context['qa_by_lang'][strtr($language, array('-utf8' => ''))]) && !empty($context['question_answers'])) |
| 649 | 664 | { |
| 650 | - if (empty($context['settings_insert_above'])) |
|
| 651 | - $context['settings_insert_above'] = ''; |
|
| 665 | + if (empty($context['settings_insert_above'])) { |
|
| 666 | + $context['settings_insert_above'] = ''; |
|
| 667 | + } |
|
| 652 | 668 | |
| 653 | 669 | $context['settings_insert_above'] .= '<div class="noticebox">' . sprintf($txt['question_not_defined'], $context['languages'][$language]['name']) . '</div>'; |
| 654 | 670 | } |
@@ -690,8 +706,9 @@ discard block |
||
| 690 | 706 | $_POST['pm_spam_settings'] = (int) $_POST['max_pm_recipients'] . ',' . (int) $_POST['pm_posts_verification'] . ',' . (int) $_POST['pm_posts_per_hour']; |
| 691 | 707 | |
| 692 | 708 | // Hack in guest requiring verification! |
| 693 | - if (empty($_POST['posts_require_captcha']) && !empty($_POST['guests_require_captcha'])) |
|
| 694 | - $_POST['posts_require_captcha'] = -1; |
|
| 709 | + if (empty($_POST['posts_require_captcha']) && !empty($_POST['guests_require_captcha'])) { |
|
| 710 | + $_POST['posts_require_captcha'] = -1; |
|
| 711 | + } |
|
| 695 | 712 | |
| 696 | 713 | $save_vars = $config_vars; |
| 697 | 714 | unset($save_vars['pm1'], $save_vars['pm2'], $save_vars['pm3'], $save_vars['guest_verify']); |
@@ -708,14 +725,16 @@ discard block |
||
| 708 | 725 | foreach ($context['qa_languages'] as $lang_id => $dummy) |
| 709 | 726 | { |
| 710 | 727 | // If we had some questions for this language before, but don't now, delete everything from that language. |
| 711 | - if ((!isset($_POST['question'][$lang_id]) || !is_array($_POST['question'][$lang_id])) && !empty($context['qa_by_lang'][$lang_id])) |
|
| 712 | - $changes['delete'] = array_merge($questions['delete'], $context['qa_by_lang'][$lang_id]); |
|
| 728 | + if ((!isset($_POST['question'][$lang_id]) || !is_array($_POST['question'][$lang_id])) && !empty($context['qa_by_lang'][$lang_id])) { |
|
| 729 | + $changes['delete'] = array_merge($questions['delete'], $context['qa_by_lang'][$lang_id]); |
|
| 730 | + } |
|
| 713 | 731 | |
| 714 | 732 | // Now step through and see if any existing questions no longer exist. |
| 715 | - if (!empty($context['qa_by_lang'][$lang_id])) |
|
| 716 | - foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
| 733 | + if (!empty($context['qa_by_lang'][$lang_id])) { |
|
| 734 | + foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
|
| 717 | 735 | if (empty($_POST['question'][$lang_id][$q_id])) |
| 718 | 736 | $changes['delete'][] = $q_id; |
| 737 | + } |
|
| 719 | 738 | |
| 720 | 739 | // Now let's see if there are new questions or ones that need updating. |
| 721 | 740 | if (isset($_POST['question'][$lang_id])) |
@@ -724,14 +743,16 @@ discard block |
||
| 724 | 743 | { |
| 725 | 744 | // Ignore junky ids. |
| 726 | 745 | $q_id = (int) $q_id; |
| 727 | - if ($q_id <= 0) |
|
| 728 | - continue; |
|
| 746 | + if ($q_id <= 0) { |
|
| 747 | + continue; |
|
| 748 | + } |
|
| 729 | 749 | |
| 730 | 750 | // Check the question isn't empty (because they want to delete it?) |
| 731 | 751 | if (empty($question) || trim($question) == '') |
| 732 | 752 | { |
| 733 | - if (isset($context['question_answers'][$q_id])) |
|
| 734 | - $changes['delete'][] = $q_id; |
|
| 753 | + if (isset($context['question_answers'][$q_id])) { |
|
| 754 | + $changes['delete'][] = $q_id; |
|
| 755 | + } |
|
| 735 | 756 | continue; |
| 736 | 757 | } |
| 737 | 758 | $question = $smcFunc['htmlspecialchars'](trim($question)); |
@@ -739,19 +760,22 @@ discard block |
||
| 739 | 760 | // Get the answers. Firstly check there actually might be some. |
| 740 | 761 | if (!isset($_POST['answer'][$lang_id][$q_id]) || !is_array($_POST['answer'][$lang_id][$q_id])) |
| 741 | 762 | { |
| 742 | - if (isset($context['question_answers'][$q_id])) |
|
| 743 | - $changes['delete'][] = $q_id; |
|
| 763 | + if (isset($context['question_answers'][$q_id])) { |
|
| 764 | + $changes['delete'][] = $q_id; |
|
| 765 | + } |
|
| 744 | 766 | continue; |
| 745 | 767 | } |
| 746 | 768 | // Now get them and check that they might be viable. |
| 747 | 769 | $answers = array(); |
| 748 | - foreach ($_POST['answer'][$lang_id][$q_id] as $answer) |
|
| 749 | - if (!empty($answer) && trim($answer) !== '') |
|
| 770 | + foreach ($_POST['answer'][$lang_id][$q_id] as $answer) { |
|
| 771 | + if (!empty($answer) && trim($answer) !== '') |
|
| 750 | 772 | $answers[] = $smcFunc['htmlspecialchars'](trim($answer)); |
| 773 | + } |
|
| 751 | 774 | if (empty($answers)) |
| 752 | 775 | { |
| 753 | - if (isset($context['question_answers'][$q_id])) |
|
| 754 | - $changes['delete'][] = $q_id; |
|
| 776 | + if (isset($context['question_answers'][$q_id])) { |
|
| 777 | + $changes['delete'][] = $q_id; |
|
| 778 | + } |
|
| 755 | 779 | continue; |
| 756 | 780 | } |
| 757 | 781 | $answers = $smcFunc['json_encode']($answers); |
@@ -761,16 +785,17 @@ discard block |
||
| 761 | 785 | { |
| 762 | 786 | // New question. Now, we don't want to randomly consume ids, so we'll set those, rather than trusting the browser's supplied ids. |
| 763 | 787 | $changes['insert'][] = array($lang_id, $question, $answers); |
| 764 | - } |
|
| 765 | - else |
|
| 788 | + } else |
|
| 766 | 789 | { |
| 767 | 790 | // It's an existing question. Let's see what's changed, if anything. |
| 768 | - if ($lang_id != $context['question_answers'][$q_id]['lngfile'] || $question != $context['question_answers'][$q_id]['question'] || $answers != $context['question_answers'][$q_id]['answers']) |
|
| 769 | - $changes['replace'][$q_id] = array('lngfile' => $lang_id, 'question' => $question, 'answers' => $answers); |
|
| 791 | + if ($lang_id != $context['question_answers'][$q_id]['lngfile'] || $question != $context['question_answers'][$q_id]['question'] || $answers != $context['question_answers'][$q_id]['answers']) { |
|
| 792 | + $changes['replace'][$q_id] = array('lngfile' => $lang_id, 'question' => $question, 'answers' => $answers); |
|
| 793 | + } |
|
| 770 | 794 | } |
| 771 | 795 | |
| 772 | - if (!isset($qs_per_lang[$lang_id])) |
|
| 773 | - $qs_per_lang[$lang_id] = 0; |
|
| 796 | + if (!isset($qs_per_lang[$lang_id])) { |
|
| 797 | + $qs_per_lang[$lang_id] = 0; |
|
| 798 | + } |
|
| 774 | 799 | $qs_per_lang[$lang_id]++; |
| 775 | 800 | } |
| 776 | 801 | } |
@@ -820,8 +845,9 @@ discard block |
||
| 820 | 845 | |
| 821 | 846 | // Lastly, the count of messages needs to be no more than the lowest number of questions for any one language. |
| 822 | 847 | $count_questions = empty($qs_per_lang) ? 0 : min($qs_per_lang); |
| 823 | - if (empty($count_questions) || $_POST['qa_verification_number'] > $count_questions) |
|
| 824 | - $_POST['qa_verification_number'] = $count_questions; |
|
| 848 | + if (empty($count_questions) || $_POST['qa_verification_number'] > $count_questions) { |
|
| 849 | + $_POST['qa_verification_number'] = $count_questions; |
|
| 850 | + } |
|
| 825 | 851 | |
| 826 | 852 | call_integration_hook('integrate_save_spam_settings', array(&$save_vars)); |
| 827 | 853 | |
@@ -836,24 +862,27 @@ discard block |
||
| 836 | 862 | |
| 837 | 863 | $character_range = array_merge(range('A', 'H'), array('K', 'M', 'N', 'P', 'R'), range('T', 'Y')); |
| 838 | 864 | $_SESSION['visual_verification_code'] = ''; |
| 839 | - for ($i = 0; $i < 6; $i++) |
|
| 840 | - $_SESSION['visual_verification_code'] .= $character_range[array_rand($character_range)]; |
|
| 865 | + for ($i = 0; $i < 6; $i++) { |
|
| 866 | + $_SESSION['visual_verification_code'] .= $character_range[array_rand($character_range)]; |
|
| 867 | + } |
|
| 841 | 868 | |
| 842 | 869 | // Some javascript for CAPTCHA. |
| 843 | 870 | $context['settings_post_javascript'] = ''; |
| 844 | - if ($context['use_graphic_library']) |
|
| 845 | - $context['settings_post_javascript'] .= ' |
|
| 871 | + if ($context['use_graphic_library']) { |
|
| 872 | + $context['settings_post_javascript'] .= ' |
|
| 846 | 873 | function refreshImages() |
| 847 | 874 | { |
| 848 | 875 | var imageType = document.getElementById(\'visual_verification_type\').value; |
| 849 | 876 | document.getElementById(\'verification_image\').src = \'' . $context['verification_image_href'] . ';type=\' + imageType; |
| 850 | 877 | }'; |
| 878 | + } |
|
| 851 | 879 | |
| 852 | 880 | // Show the image itself, or text saying we can't. |
| 853 | - if ($context['use_graphic_library']) |
|
| 854 | - $config_vars['vv']['postinput'] = '<br><img src="' . $context['verification_image_href'] . ';type=' . (empty($modSettings['visual_verification_type']) ? 0 : $modSettings['visual_verification_type']) . '" alt="' . $txt['setting_image_verification_sample'] . '" id="verification_image"><br>'; |
|
| 855 | - else |
|
| 856 | - $config_vars['vv']['postinput'] = '<br><span class="smalltext">' . $txt['setting_image_verification_nogd'] . '</span>'; |
|
| 881 | + if ($context['use_graphic_library']) { |
|
| 882 | + $config_vars['vv']['postinput'] = '<br><img src="' . $context['verification_image_href'] . ';type=' . (empty($modSettings['visual_verification_type']) ? 0 : $modSettings['visual_verification_type']) . '" alt="' . $txt['setting_image_verification_sample'] . '" id="verification_image"><br>'; |
|
| 883 | + } else { |
|
| 884 | + $config_vars['vv']['postinput'] = '<br><span class="smalltext">' . $txt['setting_image_verification_nogd'] . '</span>'; |
|
| 885 | + } |
|
| 857 | 886 | |
| 858 | 887 | // Hack for PM spam settings. |
| 859 | 888 | list ($modSettings['max_pm_recipients'], $modSettings['pm_posts_verification'], $modSettings['pm_posts_per_hour']) = explode(',', $modSettings['pm_spam_settings']); |
@@ -863,9 +892,10 @@ discard block |
||
| 863 | 892 | $modSettings['posts_require_captcha'] = !isset($modSettings['posts_require_captcha']) || $modSettings['posts_require_captcha'] == -1 ? 0 : $modSettings['posts_require_captcha']; |
| 864 | 893 | |
| 865 | 894 | // Some minor javascript for the guest post setting. |
| 866 | - if ($modSettings['posts_require_captcha']) |
|
| 867 | - $context['settings_post_javascript'] .= ' |
|
| 895 | + if ($modSettings['posts_require_captcha']) { |
|
| 896 | + $context['settings_post_javascript'] .= ' |
|
| 868 | 897 | document.getElementById(\'guests_require_captcha\').disabled = true;'; |
| 898 | + } |
|
| 869 | 899 | |
| 870 | 900 | // And everything else. |
| 871 | 901 | $context['post_url'] = $scripturl . '?action=admin;area=antispam;save'; |
@@ -912,8 +942,9 @@ discard block |
||
| 912 | 942 | |
| 913 | 943 | call_integration_hook('integrate_signature_settings', array(&$config_vars)); |
| 914 | 944 | |
| 915 | - if ($return_config) |
|
| 916 | - return $config_vars; |
|
| 945 | + if ($return_config) { |
|
| 946 | + return $config_vars; |
|
| 947 | + } |
|
| 917 | 948 | |
| 918 | 949 | // Setup the template. |
| 919 | 950 | $context['page_title'] = $txt['signature_settings']; |
@@ -968,8 +999,9 @@ discard block |
||
| 968 | 999 | $sig = strtr($row['signature'], array('<br>' => "\n")); |
| 969 | 1000 | |
| 970 | 1001 | // Max characters... |
| 971 | - if (!empty($sig_limits[1])) |
|
| 972 | - $sig = $smcFunc['substr']($sig, 0, $sig_limits[1]); |
|
| 1002 | + if (!empty($sig_limits[1])) { |
|
| 1003 | + $sig = $smcFunc['substr']($sig, 0, $sig_limits[1]); |
|
| 1004 | + } |
|
| 973 | 1005 | // Max lines... |
| 974 | 1006 | if (!empty($sig_limits[2])) |
| 975 | 1007 | { |
@@ -979,8 +1011,9 @@ discard block |
||
| 979 | 1011 | if ($sig[$i] == "\n") |
| 980 | 1012 | { |
| 981 | 1013 | $count++; |
| 982 | - if ($count >= $sig_limits[2]) |
|
| 983 | - $sig = substr($sig, 0, $i) . strtr(substr($sig, $i), array("\n" => ' ')); |
|
| 1014 | + if ($count >= $sig_limits[2]) { |
|
| 1015 | + $sig = substr($sig, 0, $i) . strtr(substr($sig, $i), array("\n" => ' ')); |
|
| 1016 | + } |
|
| 984 | 1017 | } |
| 985 | 1018 | } |
| 986 | 1019 | } |
@@ -991,17 +1024,19 @@ discard block |
||
| 991 | 1024 | { |
| 992 | 1025 | $limit_broke = 0; |
| 993 | 1026 | // Attempt to allow all sizes of abuse, so to speak. |
| 994 | - if ($matches[2][$ind] == 'px' && $size > $sig_limits[7]) |
|
| 995 | - $limit_broke = $sig_limits[7] . 'px'; |
|
| 996 | - elseif ($matches[2][$ind] == 'pt' && $size > ($sig_limits[7] * 0.75)) |
|
| 997 | - $limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt'; |
|
| 998 | - elseif ($matches[2][$ind] == 'em' && $size > ((float) $sig_limits[7] / 16)) |
|
| 999 | - $limit_broke = ((float) $sig_limits[7] / 16) . 'em'; |
|
| 1000 | - elseif ($matches[2][$ind] != 'px' && $matches[2][$ind] != 'pt' && $matches[2][$ind] != 'em' && $sig_limits[7] < 18) |
|
| 1001 | - $limit_broke = 'large'; |
|
| 1002 | - |
|
| 1003 | - if ($limit_broke) |
|
| 1004 | - $sig = str_replace($matches[0][$ind], '[size=' . $sig_limits[7] . 'px', $sig); |
|
| 1027 | + if ($matches[2][$ind] == 'px' && $size > $sig_limits[7]) { |
|
| 1028 | + $limit_broke = $sig_limits[7] . 'px'; |
|
| 1029 | + } elseif ($matches[2][$ind] == 'pt' && $size > ($sig_limits[7] * 0.75)) { |
|
| 1030 | + $limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt'; |
|
| 1031 | + } elseif ($matches[2][$ind] == 'em' && $size > ((float) $sig_limits[7] / 16)) { |
|
| 1032 | + $limit_broke = ((float) $sig_limits[7] / 16) . 'em'; |
|
| 1033 | + } elseif ($matches[2][$ind] != 'px' && $matches[2][$ind] != 'pt' && $matches[2][$ind] != 'em' && $sig_limits[7] < 18) { |
|
| 1034 | + $limit_broke = 'large'; |
|
| 1035 | + } |
|
| 1036 | + |
|
| 1037 | + if ($limit_broke) { |
|
| 1038 | + $sig = str_replace($matches[0][$ind], '[size=' . $sig_limits[7] . 'px', $sig); |
|
| 1039 | + } |
|
| 1005 | 1040 | } |
| 1006 | 1041 | } |
| 1007 | 1042 | |
@@ -1057,32 +1092,34 @@ discard block |
||
| 1057 | 1092 | $img_offset = false; |
| 1058 | 1093 | } |
| 1059 | 1094 | } |
| 1095 | + } else { |
|
| 1096 | + $replaces[$image] = ''; |
|
| 1060 | 1097 | } |
| 1061 | - else |
|
| 1062 | - $replaces[$image] = ''; |
|
| 1063 | 1098 | |
| 1064 | 1099 | continue; |
| 1065 | 1100 | } |
| 1066 | 1101 | |
| 1067 | 1102 | // Does it have predefined restraints? Width first. |
| 1068 | - if ($matches[6][$key]) |
|
| 1069 | - $matches[2][$key] = $matches[6][$key]; |
|
| 1103 | + if ($matches[6][$key]) { |
|
| 1104 | + $matches[2][$key] = $matches[6][$key]; |
|
| 1105 | + } |
|
| 1070 | 1106 | if ($matches[2][$key] && $sig_limits[5] && $matches[2][$key] > $sig_limits[5]) |
| 1071 | 1107 | { |
| 1072 | 1108 | $width = $sig_limits[5]; |
| 1073 | 1109 | $matches[4][$key] = $matches[4][$key] * ($width / $matches[2][$key]); |
| 1110 | + } elseif ($matches[2][$key]) { |
|
| 1111 | + $width = $matches[2][$key]; |
|
| 1074 | 1112 | } |
| 1075 | - elseif ($matches[2][$key]) |
|
| 1076 | - $width = $matches[2][$key]; |
|
| 1077 | 1113 | // ... and height. |
| 1078 | 1114 | if ($matches[4][$key] && $sig_limits[6] && $matches[4][$key] > $sig_limits[6]) |
| 1079 | 1115 | { |
| 1080 | 1116 | $height = $sig_limits[6]; |
| 1081 | - if ($width != -1) |
|
| 1082 | - $width = $width * ($height / $matches[4][$key]); |
|
| 1117 | + if ($width != -1) { |
|
| 1118 | + $width = $width * ($height / $matches[4][$key]); |
|
| 1119 | + } |
|
| 1120 | + } elseif ($matches[4][$key]) { |
|
| 1121 | + $height = $matches[4][$key]; |
|
| 1083 | 1122 | } |
| 1084 | - elseif ($matches[4][$key]) |
|
| 1085 | - $height = $matches[4][$key]; |
|
| 1086 | 1123 | |
| 1087 | 1124 | // If the dimensions are still not fixed - we need to check the actual image. |
| 1088 | 1125 | if (($width == -1 && $sig_limits[5]) || ($height == -1 && $sig_limits[6])) |
@@ -1100,12 +1137,13 @@ discard block |
||
| 1100 | 1137 | if ($sizes[1] > $sig_limits[6] && $sig_limits[6]) |
| 1101 | 1138 | { |
| 1102 | 1139 | $height = $sig_limits[6]; |
| 1103 | - if ($width == -1) |
|
| 1104 | - $width = $sizes[0]; |
|
| 1140 | + if ($width == -1) { |
|
| 1141 | + $width = $sizes[0]; |
|
| 1142 | + } |
|
| 1105 | 1143 | $width = $width * ($height / $sizes[1]); |
| 1144 | + } elseif ($width != -1) { |
|
| 1145 | + $height = $sizes[1]; |
|
| 1106 | 1146 | } |
| 1107 | - elseif ($width != -1) |
|
| 1108 | - $height = $sizes[1]; |
|
| 1109 | 1147 | } |
| 1110 | 1148 | } |
| 1111 | 1149 | |
@@ -1118,8 +1156,9 @@ discard block |
||
| 1118 | 1156 | // Record that we got one. |
| 1119 | 1157 | $image_count_holder[$image] = isset($image_count_holder[$image]) ? $image_count_holder[$image] + 1 : 1; |
| 1120 | 1158 | } |
| 1121 | - if (!empty($replaces)) |
|
| 1122 | - $sig = str_replace(array_keys($replaces), array_values($replaces), $sig); |
|
| 1159 | + if (!empty($replaces)) { |
|
| 1160 | + $sig = str_replace(array_keys($replaces), array_values($replaces), $sig); |
|
| 1161 | + } |
|
| 1123 | 1162 | } |
| 1124 | 1163 | } |
| 1125 | 1164 | // Try to fix disabled tags. |
@@ -1131,18 +1170,20 @@ discard block |
||
| 1131 | 1170 | |
| 1132 | 1171 | $sig = strtr($sig, array("\n" => '<br>')); |
| 1133 | 1172 | call_integration_hook('integrate_apply_signature_settings', array(&$sig, $sig_limits, $disabledTags)); |
| 1134 | - if ($sig != $row['signature']) |
|
| 1135 | - $changes[$row['id_member']] = $sig; |
|
| 1173 | + if ($sig != $row['signature']) { |
|
| 1174 | + $changes[$row['id_member']] = $sig; |
|
| 1175 | + } |
|
| 1176 | + } |
|
| 1177 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 1178 | + $done = true; |
|
| 1136 | 1179 | } |
| 1137 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 1138 | - $done = true; |
|
| 1139 | 1180 | $smcFunc['db_free_result']($request); |
| 1140 | 1181 | |
| 1141 | 1182 | // Do we need to delete what we have? |
| 1142 | 1183 | if (!empty($changes)) |
| 1143 | 1184 | { |
| 1144 | - foreach ($changes as $id => $sig) |
|
| 1145 | - $smcFunc['db_query']('', ' |
|
| 1185 | + foreach ($changes as $id => $sig) { |
|
| 1186 | + $smcFunc['db_query']('', ' |
|
| 1146 | 1187 | UPDATE {db_prefix}members |
| 1147 | 1188 | SET signature = {string:signature} |
| 1148 | 1189 | WHERE id_member = {int:id_member}', |
@@ -1151,11 +1192,13 @@ discard block |
||
| 1151 | 1192 | 'signature' => $sig, |
| 1152 | 1193 | ) |
| 1153 | 1194 | ); |
| 1195 | + } |
|
| 1154 | 1196 | } |
| 1155 | 1197 | |
| 1156 | 1198 | $_GET['step'] += 50; |
| 1157 | - if (!$done) |
|
| 1158 | - pauseSignatureApplySettings(); |
|
| 1199 | + if (!$done) { |
|
| 1200 | + pauseSignatureApplySettings(); |
|
| 1201 | + } |
|
| 1159 | 1202 | } |
| 1160 | 1203 | $settings_applied = true; |
| 1161 | 1204 | } |
@@ -1173,8 +1216,9 @@ discard block |
||
| 1173 | 1216 | ); |
| 1174 | 1217 | |
| 1175 | 1218 | // Temporarily make each setting a modSetting! |
| 1176 | - foreach ($context['signature_settings'] as $key => $value) |
|
| 1177 | - $modSettings['signature_' . $key] = $value; |
|
| 1219 | + foreach ($context['signature_settings'] as $key => $value) { |
|
| 1220 | + $modSettings['signature_' . $key] = $value; |
|
| 1221 | + } |
|
| 1178 | 1222 | |
| 1179 | 1223 | // Make sure we check the right tags! |
| 1180 | 1224 | $modSettings['bbc_disabled_signature_bbc'] = $disabledTags; |
@@ -1186,23 +1230,26 @@ discard block |
||
| 1186 | 1230 | |
| 1187 | 1231 | // Clean up the tag stuff! |
| 1188 | 1232 | $bbcTags = array(); |
| 1189 | - foreach (parse_bbc(false) as $tag) |
|
| 1190 | - $bbcTags[] = $tag['tag']; |
|
| 1233 | + foreach (parse_bbc(false) as $tag) { |
|
| 1234 | + $bbcTags[] = $tag['tag']; |
|
| 1235 | + } |
|
| 1191 | 1236 | |
| 1192 | - if (!isset($_POST['signature_bbc_enabledTags'])) |
|
| 1193 | - $_POST['signature_bbc_enabledTags'] = array(); |
|
| 1194 | - elseif (!is_array($_POST['signature_bbc_enabledTags'])) |
|
| 1195 | - $_POST['signature_bbc_enabledTags'] = array($_POST['signature_bbc_enabledTags']); |
|
| 1237 | + if (!isset($_POST['signature_bbc_enabledTags'])) { |
|
| 1238 | + $_POST['signature_bbc_enabledTags'] = array(); |
|
| 1239 | + } elseif (!is_array($_POST['signature_bbc_enabledTags'])) { |
|
| 1240 | + $_POST['signature_bbc_enabledTags'] = array($_POST['signature_bbc_enabledTags']); |
|
| 1241 | + } |
|
| 1196 | 1242 | |
| 1197 | 1243 | $sig_limits = array(); |
| 1198 | 1244 | foreach ($context['signature_settings'] as $key => $value) |
| 1199 | 1245 | { |
| 1200 | - if ($key == 'allow_smileys') |
|
| 1201 | - continue; |
|
| 1202 | - elseif ($key == 'max_smileys' && empty($_POST['signature_allow_smileys'])) |
|
| 1203 | - $sig_limits[] = -1; |
|
| 1204 | - else |
|
| 1205 | - $sig_limits[] = !empty($_POST['signature_' . $key]) ? max(1, (int) $_POST['signature_' . $key]) : 0; |
|
| 1246 | + if ($key == 'allow_smileys') { |
|
| 1247 | + continue; |
|
| 1248 | + } elseif ($key == 'max_smileys' && empty($_POST['signature_allow_smileys'])) { |
|
| 1249 | + $sig_limits[] = -1; |
|
| 1250 | + } else { |
|
| 1251 | + $sig_limits[] = !empty($_POST['signature_' . $key]) ? max(1, (int) $_POST['signature_' . $key]) : 0; |
|
| 1252 | + } |
|
| 1206 | 1253 | } |
| 1207 | 1254 | |
| 1208 | 1255 | call_integration_hook('integrate_save_signature_settings', array(&$sig_limits, &$bbcTags)); |
@@ -1235,12 +1282,14 @@ discard block |
||
| 1235 | 1282 | |
| 1236 | 1283 | // Try get more time... |
| 1237 | 1284 | @set_time_limit(600); |
| 1238 | - if (function_exists('apache_reset_timeout')) |
|
| 1239 | - @apache_reset_timeout(); |
|
| 1285 | + if (function_exists('apache_reset_timeout')) { |
|
| 1286 | + @apache_reset_timeout(); |
|
| 1287 | + } |
|
| 1240 | 1288 | |
| 1241 | 1289 | // Have we exhausted all the time we allowed? |
| 1242 | - if (time() - array_sum(explode(' ', $sig_start)) < 3) |
|
| 1243 | - return; |
|
| 1290 | + if (time() - array_sum(explode(' ', $sig_start)) < 3) { |
|
| 1291 | + return; |
|
| 1292 | + } |
|
| 1244 | 1293 | |
| 1245 | 1294 | $context['continue_get_data'] = '?action=admin;area=featuresettings;sa=sig;apply;step=' . $_GET['step'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
| 1246 | 1295 | $context['page_title'] = $txt['not_done_title']; |
@@ -1286,9 +1335,10 @@ discard block |
||
| 1286 | 1335 | $disable_fields = array_flip($standard_fields); |
| 1287 | 1336 | if (!empty($_POST['active'])) |
| 1288 | 1337 | { |
| 1289 | - foreach ($_POST['active'] as $value) |
|
| 1290 | - if (isset($disable_fields[$value])) |
|
| 1338 | + foreach ($_POST['active'] as $value) { |
|
| 1339 | + if (isset($disable_fields[$value])) |
|
| 1291 | 1340 | unset($disable_fields[$value]); |
| 1341 | + } |
|
| 1292 | 1342 | } |
| 1293 | 1343 | // What we have left! |
| 1294 | 1344 | $changes['disabled_profile_fields'] = empty($disable_fields) ? '' : implode(',', array_keys($disable_fields)); |
@@ -1297,16 +1347,18 @@ discard block |
||
| 1297 | 1347 | $reg_fields = array(); |
| 1298 | 1348 | if (!empty($_POST['reg'])) |
| 1299 | 1349 | { |
| 1300 | - foreach ($_POST['reg'] as $value) |
|
| 1301 | - if (in_array($value, $standard_fields) && !isset($disable_fields[$value])) |
|
| 1350 | + foreach ($_POST['reg'] as $value) { |
|
| 1351 | + if (in_array($value, $standard_fields) && !isset($disable_fields[$value])) |
|
| 1302 | 1352 | $reg_fields[] = $value; |
| 1353 | + } |
|
| 1303 | 1354 | } |
| 1304 | 1355 | // What we have left! |
| 1305 | 1356 | $changes['registration_fields'] = empty($reg_fields) ? '' : implode(',', $reg_fields); |
| 1306 | 1357 | |
| 1307 | 1358 | $_SESSION['adm-save'] = true; |
| 1308 | - if (!empty($changes)) |
|
| 1309 | - updateSettings($changes); |
|
| 1359 | + if (!empty($changes)) { |
|
| 1360 | + updateSettings($changes); |
|
| 1361 | + } |
|
| 1310 | 1362 | } |
| 1311 | 1363 | |
| 1312 | 1364 | createToken('admin-scp'); |
@@ -1409,11 +1461,13 @@ discard block |
||
| 1409 | 1461 | { |
| 1410 | 1462 | $return = '<p class="centertext bold_text">'. $rowData['field_order'] .'<br>'; |
| 1411 | 1463 | |
| 1412 | - if ($rowData['field_order'] > 1) |
|
| 1413 | - $return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=up"><span class="toggle_up" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_up'] .'"></span></a>'; |
|
| 1464 | + if ($rowData['field_order'] > 1) { |
|
| 1465 | + $return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=up"><span class="toggle_up" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_up'] .'"></span></a>'; |
|
| 1466 | + } |
|
| 1414 | 1467 | |
| 1415 | - if ($rowData['field_order'] < $context['custFieldsMaxOrder']) |
|
| 1416 | - $return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=down"><span class="toggle_down" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_down'] .'"></span></a>'; |
|
| 1468 | + if ($rowData['field_order'] < $context['custFieldsMaxOrder']) { |
|
| 1469 | + $return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=down"><span class="toggle_down" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_down'] .'"></span></a>'; |
|
| 1470 | + } |
|
| 1417 | 1471 | |
| 1418 | 1472 | $return .= '</p>'; |
| 1419 | 1473 | |
@@ -1551,16 +1605,16 @@ discard block |
||
| 1551 | 1605 | $disabled_fields = isset($modSettings['disabled_profile_fields']) ? explode(',', $modSettings['disabled_profile_fields']) : array(); |
| 1552 | 1606 | $registration_fields = isset($modSettings['registration_fields']) ? explode(',', $modSettings['registration_fields']) : array(); |
| 1553 | 1607 | |
| 1554 | - foreach ($standard_fields as $field) |
|
| 1555 | - $list[] = array( |
|
| 1608 | + foreach ($standard_fields as $field) { |
|
| 1609 | + $list[] = array( |
|
| 1556 | 1610 | 'id' => $field, |
| 1557 | 1611 | 'label' => isset($txt['standard_profile_field_' . $field]) ? $txt['standard_profile_field_' . $field] : (isset($txt[$field]) ? $txt[$field] : $field), |
| 1558 | 1612 | 'disabled' => in_array($field, $disabled_fields), |
| 1559 | 1613 | 'on_register' => in_array($field, $registration_fields) && !in_array($field, $fields_no_registration), |
| 1560 | 1614 | 'can_show_register' => !in_array($field, $fields_no_registration), |
| 1561 | 1615 | ); |
| 1562 | - } |
|
| 1563 | - else |
|
| 1616 | + } |
|
| 1617 | + } else |
|
| 1564 | 1618 | { |
| 1565 | 1619 | // Load all the fields. |
| 1566 | 1620 | $request = $smcFunc['db_query']('', ' |
@@ -1574,8 +1628,9 @@ discard block |
||
| 1574 | 1628 | 'items_per_page' => $items_per_page, |
| 1575 | 1629 | ) |
| 1576 | 1630 | ); |
| 1577 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1578 | - $list[] = $row; |
|
| 1631 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1632 | + $list[] = $row; |
|
| 1633 | + } |
|
| 1579 | 1634 | $smcFunc['db_free_result']($request); |
| 1580 | 1635 | } |
| 1581 | 1636 | |
@@ -1641,9 +1696,9 @@ discard block |
||
| 1641 | 1696 | $context['field'] = array(); |
| 1642 | 1697 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1643 | 1698 | { |
| 1644 | - if ($row['field_type'] == 'textarea') |
|
| 1645 | - @list ($rows, $cols) = @explode(',', $row['default_value']); |
|
| 1646 | - else |
|
| 1699 | + if ($row['field_type'] == 'textarea') { |
|
| 1700 | + @list ($rows, $cols) = @explode(',', $row['default_value']); |
|
| 1701 | + } else |
|
| 1647 | 1702 | { |
| 1648 | 1703 | $rows = 3; |
| 1649 | 1704 | $cols = 30; |
@@ -1679,8 +1734,8 @@ discard block |
||
| 1679 | 1734 | } |
| 1680 | 1735 | |
| 1681 | 1736 | // Setup the default values as needed. |
| 1682 | - if (empty($context['field'])) |
|
| 1683 | - $context['field'] = array( |
|
| 1737 | + if (empty($context['field'])) { |
|
| 1738 | + $context['field'] = array( |
|
| 1684 | 1739 | 'name' => '', |
| 1685 | 1740 | 'col_name' => '???', |
| 1686 | 1741 | 'desc' => '', |
@@ -1705,6 +1760,7 @@ discard block |
||
| 1705 | 1760 | 'enclose' => '', |
| 1706 | 1761 | 'placement' => 0, |
| 1707 | 1762 | ); |
| 1763 | + } |
|
| 1708 | 1764 | |
| 1709 | 1765 | // Are we moving it? |
| 1710 | 1766 | if (isset($_GET['move']) && in_array($smcFunc['htmlspecialchars']($_GET['move']), $move_to)) |
@@ -1713,8 +1769,10 @@ discard block |
||
| 1713 | 1769 | $new_order = ($_GET['move'] == 'up' ? ($context['field']['order'] - 1) : ($context['field']['order'] + 1)); |
| 1714 | 1770 | |
| 1715 | 1771 | // Is this a valid position? |
| 1716 | - if ($new_order <= 0 || $new_order > $order_count) |
|
| 1717 | - redirectexit('action=admin;area=featuresettings;sa=profile'); // @todo implement an error handler |
|
| 1772 | + if ($new_order <= 0 || $new_order > $order_count) { |
|
| 1773 | + redirectexit('action=admin;area=featuresettings;sa=profile'); |
|
| 1774 | + } |
|
| 1775 | + // @todo implement an error handler |
|
| 1718 | 1776 | |
| 1719 | 1777 | // All good, proceed. |
| 1720 | 1778 | $smcFunc['db_query']('',' |
@@ -1745,12 +1803,14 @@ discard block |
||
| 1745 | 1803 | validateToken('admin-ecp'); |
| 1746 | 1804 | |
| 1747 | 1805 | // Everyone needs a name - even the (bracket) unknown... |
| 1748 | - if (trim($_POST['field_name']) == '') |
|
| 1749 | - redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $_GET['fid'] . ';msg=need_name'); |
|
| 1806 | + if (trim($_POST['field_name']) == '') { |
|
| 1807 | + redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $_GET['fid'] . ';msg=need_name'); |
|
| 1808 | + } |
|
| 1750 | 1809 | |
| 1751 | 1810 | // Regex you say? Do a very basic test to see if the pattern is valid |
| 1752 | - if (!empty($_POST['regex']) && @preg_match($_POST['regex'], 'dummy') === false) |
|
| 1753 | - redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $_GET['fid'] . ';msg=regex_error'); |
|
| 1811 | + if (!empty($_POST['regex']) && @preg_match($_POST['regex'], 'dummy') === false) { |
|
| 1812 | + redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $_GET['fid'] . ';msg=regex_error'); |
|
| 1813 | + } |
|
| 1754 | 1814 | |
| 1755 | 1815 | $_POST['field_name'] = $smcFunc['htmlspecialchars']($_POST['field_name']); |
| 1756 | 1816 | $_POST['field_desc'] = $smcFunc['htmlspecialchars']($_POST['field_desc']); |
@@ -1767,8 +1827,9 @@ discard block |
||
| 1767 | 1827 | |
| 1768 | 1828 | // Some masking stuff... |
| 1769 | 1829 | $mask = isset($_POST['mask']) ? $_POST['mask'] : ''; |
| 1770 | - if ($mask == 'regex' && isset($_POST['regex'])) |
|
| 1771 | - $mask .= $_POST['regex']; |
|
| 1830 | + if ($mask == 'regex' && isset($_POST['regex'])) { |
|
| 1831 | + $mask .= $_POST['regex']; |
|
| 1832 | + } |
|
| 1772 | 1833 | |
| 1773 | 1834 | $field_length = isset($_POST['max_length']) ? (int) $_POST['max_length'] : 255; |
| 1774 | 1835 | $enclose = isset($_POST['enclose']) ? $_POST['enclose'] : ''; |
@@ -1787,8 +1848,9 @@ discard block |
||
| 1787 | 1848 | $v = strtr($v, array(',' => '')); |
| 1788 | 1849 | |
| 1789 | 1850 | // Nada, zip, etc... |
| 1790 | - if (trim($v) == '') |
|
| 1791 | - continue; |
|
| 1851 | + if (trim($v) == '') { |
|
| 1852 | + continue; |
|
| 1853 | + } |
|
| 1792 | 1854 | |
| 1793 | 1855 | // Otherwise, save it boy. |
| 1794 | 1856 | $field_options .= $v . ','; |
@@ -1796,15 +1858,17 @@ discard block |
||
| 1796 | 1858 | $newOptions[$k] = $v; |
| 1797 | 1859 | |
| 1798 | 1860 | // Is it default? |
| 1799 | - if (isset($_POST['default_select']) && $_POST['default_select'] == $k) |
|
| 1800 | - $default = $v; |
|
| 1861 | + if (isset($_POST['default_select']) && $_POST['default_select'] == $k) { |
|
| 1862 | + $default = $v; |
|
| 1863 | + } |
|
| 1801 | 1864 | } |
| 1802 | 1865 | $field_options = substr($field_options, 0, -1); |
| 1803 | 1866 | } |
| 1804 | 1867 | |
| 1805 | 1868 | // Text area has default has dimensions |
| 1806 | - if ($_POST['field_type'] == 'textarea') |
|
| 1807 | - $default = (int) $_POST['rows'] . ',' . (int) $_POST['cols']; |
|
| 1869 | + if ($_POST['field_type'] == 'textarea') { |
|
| 1870 | + $default = (int) $_POST['rows'] . ',' . (int) $_POST['cols']; |
|
| 1871 | + } |
|
| 1808 | 1872 | |
| 1809 | 1873 | // Come up with the unique name? |
| 1810 | 1874 | if (empty($context['fid'])) |
@@ -1813,32 +1877,36 @@ discard block |
||
| 1813 | 1877 | preg_match('~([\w\d_-]+)~', $col_name, $matches); |
| 1814 | 1878 | |
| 1815 | 1879 | // If there is nothing to the name, then let's start out own - for foreign languages etc. |
| 1816 | - if (isset($matches[1])) |
|
| 1817 | - $col_name = $initial_col_name = 'cust_' . strtolower($matches[1]); |
|
| 1818 | - else |
|
| 1819 | - $col_name = $initial_col_name = 'cust_' . mt_rand(1, 9999); |
|
| 1880 | + if (isset($matches[1])) { |
|
| 1881 | + $col_name = $initial_col_name = 'cust_' . strtolower($matches[1]); |
|
| 1882 | + } else { |
|
| 1883 | + $col_name = $initial_col_name = 'cust_' . mt_rand(1, 9999); |
|
| 1884 | + } |
|
| 1820 | 1885 | |
| 1821 | 1886 | // Make sure this is unique. |
| 1822 | 1887 | $current_fields = array(); |
| 1823 | 1888 | $request = $smcFunc['db_query']('', ' |
| 1824 | 1889 | SELECT id_field, col_name |
| 1825 | 1890 | FROM {db_prefix}custom_fields'); |
| 1826 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1827 | - $current_fields[$row['id_field']] = $row['col_name']; |
|
| 1891 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1892 | + $current_fields[$row['id_field']] = $row['col_name']; |
|
| 1893 | + } |
|
| 1828 | 1894 | $smcFunc['db_free_result']($request); |
| 1829 | 1895 | |
| 1830 | 1896 | $unique = false; |
| 1831 | 1897 | for ($i = 0; !$unique && $i < 9; $i ++) |
| 1832 | 1898 | { |
| 1833 | - if (!in_array($col_name, $current_fields)) |
|
| 1834 | - $unique = true; |
|
| 1835 | - else |
|
| 1836 | - $col_name = $initial_col_name . $i; |
|
| 1899 | + if (!in_array($col_name, $current_fields)) { |
|
| 1900 | + $unique = true; |
|
| 1901 | + } else { |
|
| 1902 | + $col_name = $initial_col_name . $i; |
|
| 1903 | + } |
|
| 1837 | 1904 | } |
| 1838 | 1905 | |
| 1839 | 1906 | // Still not a unique column name? Leave it up to the user, then. |
| 1840 | - if (!$unique) |
|
| 1841 | - fatal_lang_error('custom_option_not_unique'); |
|
| 1907 | + if (!$unique) { |
|
| 1908 | + fatal_lang_error('custom_option_not_unique'); |
|
| 1909 | + } |
|
| 1842 | 1910 | } |
| 1843 | 1911 | // Work out what to do with the user data otherwise... |
| 1844 | 1912 | else |
@@ -1866,8 +1934,9 @@ discard block |
||
| 1866 | 1934 | // Work out what's changed! |
| 1867 | 1935 | foreach ($context['field']['options'] as $k => $option) |
| 1868 | 1936 | { |
| 1869 | - if (trim($option) == '') |
|
| 1870 | - continue; |
|
| 1937 | + if (trim($option) == '') { |
|
| 1938 | + continue; |
|
| 1939 | + } |
|
| 1871 | 1940 | |
| 1872 | 1941 | // Still exists? |
| 1873 | 1942 | if (in_array($option, $newOptions)) |
@@ -1881,8 +1950,8 @@ discard block |
||
| 1881 | 1950 | foreach ($optionChanges as $k => $option) |
| 1882 | 1951 | { |
| 1883 | 1952 | // Just been renamed? |
| 1884 | - if (!in_array($k, $takenKeys) && !empty($newOptions[$k])) |
|
| 1885 | - $smcFunc['db_query']('', ' |
|
| 1953 | + if (!in_array($k, $takenKeys) && !empty($newOptions[$k])) { |
|
| 1954 | + $smcFunc['db_query']('', ' |
|
| 1886 | 1955 | UPDATE {db_prefix}themes |
| 1887 | 1956 | SET value = {string:new_value} |
| 1888 | 1957 | WHERE variable = {string:current_column} |
@@ -1895,6 +1964,7 @@ discard block |
||
| 1895 | 1964 | 'old_value' => $option, |
| 1896 | 1965 | ) |
| 1897 | 1966 | ); |
| 1967 | + } |
|
| 1898 | 1968 | } |
| 1899 | 1969 | } |
| 1900 | 1970 | // @todo Maybe we should adjust based on new text length limits? |
@@ -1937,8 +2007,8 @@ discard block |
||
| 1937 | 2007 | ); |
| 1938 | 2008 | |
| 1939 | 2009 | // Just clean up any old selects - these are a pain! |
| 1940 | - if (($_POST['field_type'] == 'select' || $_POST['field_type'] == 'radio') && !empty($newOptions)) |
|
| 1941 | - $smcFunc['db_query']('', ' |
|
| 2010 | + if (($_POST['field_type'] == 'select' || $_POST['field_type'] == 'radio') && !empty($newOptions)) { |
|
| 2011 | + $smcFunc['db_query']('', ' |
|
| 1942 | 2012 | DELETE FROM {db_prefix}themes |
| 1943 | 2013 | WHERE variable = {string:current_column} |
| 1944 | 2014 | AND value NOT IN ({array_string:new_option_values}) |
@@ -1949,8 +2019,8 @@ discard block |
||
| 1949 | 2019 | 'current_column' => $context['field']['col_name'], |
| 1950 | 2020 | ) |
| 1951 | 2021 | ); |
| 1952 | - } |
|
| 1953 | - else |
|
| 2022 | + } |
|
| 2023 | + } else |
|
| 1954 | 2024 | { |
| 1955 | 2025 | // Gotta figure it out the order. |
| 1956 | 2026 | $new_order = $order_count > 1 ? ($order_count + 1) : 1; |
@@ -2125,11 +2195,13 @@ discard block |
||
| 2125 | 2195 | call_integration_hook('integrate_prune_settings', array(&$config_vars, &$prune_toggle, false)); |
| 2126 | 2196 | |
| 2127 | 2197 | $prune_toggle_dt = array(); |
| 2128 | - foreach ($prune_toggle as $item) |
|
| 2129 | - $prune_toggle_dt[] = 'setting_' . $item; |
|
| 2198 | + foreach ($prune_toggle as $item) { |
|
| 2199 | + $prune_toggle_dt[] = 'setting_' . $item; |
|
| 2200 | + } |
|
| 2130 | 2201 | |
| 2131 | - if ($return_config) |
|
| 2132 | - return $config_vars; |
|
| 2202 | + if ($return_config) { |
|
| 2203 | + return $config_vars; |
|
| 2204 | + } |
|
| 2133 | 2205 | |
| 2134 | 2206 | addInlineJavaScript(' |
| 2135 | 2207 | function togglePruned() |
@@ -2167,15 +2239,16 @@ discard block |
||
| 2167 | 2239 | $vals = array(); |
| 2168 | 2240 | foreach ($config_vars as $index => $dummy) |
| 2169 | 2241 | { |
| 2170 | - if (!is_array($dummy) || $index == 'pruningOptions' || !in_array($dummy[1], $prune_toggle)) |
|
| 2171 | - continue; |
|
| 2242 | + if (!is_array($dummy) || $index == 'pruningOptions' || !in_array($dummy[1], $prune_toggle)) { |
|
| 2243 | + continue; |
|
| 2244 | + } |
|
| 2172 | 2245 | |
| 2173 | 2246 | $vals[] = empty($_POST[$dummy[1]]) || $_POST[$dummy[1]] < 0 ? 0 : (int) $_POST[$dummy[1]]; |
| 2174 | 2247 | } |
| 2175 | 2248 | $_POST['pruningOptions'] = implode(',', $vals); |
| 2249 | + } else { |
|
| 2250 | + $_POST['pruningOptions'] = ''; |
|
| 2176 | 2251 | } |
| 2177 | - else |
|
| 2178 | - $_POST['pruningOptions'] = ''; |
|
| 2179 | 2252 | |
| 2180 | 2253 | saveDBSettings($savevar); |
| 2181 | 2254 | $_SESSION['adm-save'] = true; |
@@ -2187,10 +2260,11 @@ discard block |
||
| 2187 | 2260 | $context['sub_template'] = 'show_settings'; |
| 2188 | 2261 | |
| 2189 | 2262 | // Get the actual values |
| 2190 | - if (!empty($modSettings['pruningOptions'])) |
|
| 2191 | - @list ($modSettings['pruneErrorLog'], $modSettings['pruneModLog'], $modSettings['pruneBanLog'], $modSettings['pruneReportLog'], $modSettings['pruneScheduledTaskLog'], $modSettings['pruneSpiderHitLog']) = explode(',', $modSettings['pruningOptions']); |
|
| 2192 | - else |
|
| 2193 | - $modSettings['pruneErrorLog'] = $modSettings['pruneModLog'] = $modSettings['pruneBanLog'] = $modSettings['pruneReportLog'] = $modSettings['pruneScheduledTaskLog'] = $modSettings['pruneSpiderHitLog'] = 0; |
|
| 2263 | + if (!empty($modSettings['pruningOptions'])) { |
|
| 2264 | + @list ($modSettings['pruneErrorLog'], $modSettings['pruneModLog'], $modSettings['pruneBanLog'], $modSettings['pruneReportLog'], $modSettings['pruneScheduledTaskLog'], $modSettings['pruneSpiderHitLog']) = explode(',', $modSettings['pruningOptions']); |
|
| 2265 | + } else { |
|
| 2266 | + $modSettings['pruneErrorLog'] = $modSettings['pruneModLog'] = $modSettings['pruneBanLog'] = $modSettings['pruneReportLog'] = $modSettings['pruneScheduledTaskLog'] = $modSettings['pruneSpiderHitLog'] = 0; |
|
| 2267 | + } |
|
| 2194 | 2268 | |
| 2195 | 2269 | prepareDBSettingContext($config_vars); |
| 2196 | 2270 | } |
@@ -2212,8 +2286,9 @@ discard block |
||
| 2212 | 2286 | // Make it even easier to add new settings. |
| 2213 | 2287 | call_integration_hook('integrate_general_mod_settings', array(&$config_vars)); |
| 2214 | 2288 | |
| 2215 | - if ($return_config) |
|
| 2216 | - return $config_vars; |
|
| 2289 | + if ($return_config) { |
|
| 2290 | + return $config_vars; |
|
| 2291 | + } |
|
| 2217 | 2292 | |
| 2218 | 2293 | $context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=general'; |
| 2219 | 2294 | $context['settings_title'] = $txt['mods_cat_modifications_misc']; |
@@ -2300,8 +2375,9 @@ discard block |
||
| 2300 | 2375 | |
| 2301 | 2376 | call_integration_hook('integrate_privacy_settings', array(&$config_vars)); |
| 2302 | 2377 | |
| 2303 | - if ($return_config) |
|
| 2304 | - return $config_vars; |
|
| 2378 | + if ($return_config) { |
|
| 2379 | + return $config_vars; |
|
| 2380 | + } |
|
| 2305 | 2381 | |
| 2306 | 2382 | // Saving? |
| 2307 | 2383 | if (isset($_GET['save'])) |
@@ -2366,8 +2442,9 @@ discard block |
||
| 2366 | 2442 | $context['policy']['not'] = 50; |
| 2367 | 2443 | $context['policy']['fresh'] = 10000; |
| 2368 | 2444 | |
| 2369 | - if ($return_config) |
|
| 2370 | - return $config_vars; |
|
| 2445 | + if ($return_config) { |
|
| 2446 | + return $config_vars; |
|
| 2447 | + } |
|
| 2371 | 2448 | |
| 2372 | 2449 | // Saving? |
| 2373 | 2450 | if (isset($_GET['save'])) |
@@ -2384,8 +2461,7 @@ discard block |
||
| 2384 | 2461 | $config_vars[] = array('text', 'policy_version'); |
| 2385 | 2462 | $_POST['policy_version'] = 'policy_text'.$currentVersion; |
| 2386 | 2463 | unset($config_vars[1]); |
| 2387 | - } |
|
| 2388 | - elseif (!empty($_REQUEST['update_policy'])) |
|
| 2464 | + } elseif (!empty($_REQUEST['update_policy'])) |
|
| 2389 | 2465 | { |
| 2390 | 2466 | $config_vars[] = array('text', 'policy_text'.$currentVersion); |
| 2391 | 2467 | $_POST['policy_text'.$currentVersion] = $_REQUEST['policy_text']; |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | $fields = ''; |
| 460 | 460 | foreach ($context['print_custom_fields']['below_signature'] as $field) |
| 461 | 461 | if (!empty($field['output_html'])) |
| 462 | - $fields .= ' |
|
| 462 | + $fields .= ' |
|
| 463 | 463 | <li>' . $field['output_html'] . '</li>'; |
| 464 | 464 | |
| 465 | 465 | if (!empty($fields)) |
@@ -3273,7 +3273,7 @@ discard block |
||
| 3273 | 3273 | ', $txt['profileDataCenter'], ' |
| 3274 | 3274 | </h3> |
| 3275 | 3275 | </div> |
| 3276 | - ',( !empty($context['pdc']['nofound']) ? '<p class="information">' . $txt['profileDataNotFound'] . '</p>' : ''),'<div class="windowbg"> |
|
| 3276 | + ',(!empty($context['pdc']['nofound']) ? '<p class="information">' . $txt['profileDataNotFound'] . '</p>' : ''), '<div class="windowbg"> |
|
| 3277 | 3277 | <div> |
| 3278 | 3278 | <form action="', $scripturl, '?action=profile;area=getprofiledata;activity=profile" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator"> |
| 3279 | 3279 | <p', '', '>', (!empty($context['pdc']['own']) ? $txt['profileDownloadProfile_own'] : sprintf($txt['profileDownloadProfile_any'], $context['pdc']['name'])), ': </p> |