@@ -18,23 +18,25 @@ discard block |
||
| 18 | 18 | global $context; |
| 19 | 19 | |
| 20 | 20 | // Prevent Chrome from auto completing fields when viewing/editing other members profiles |
| 21 | - if (isBrowser('is_chrome') && !$context['user']['is_owner']) |
|
| 22 | - echo ' |
|
| 21 | + if (isBrowser('is_chrome') && !$context['user']['is_owner']) { |
|
| 22 | + echo ' |
|
| 23 | 23 | <script> |
| 24 | 24 | disableAutoComplete(); |
| 25 | 25 | </script>'; |
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | // If an error occurred while trying to save previously, give the user a clue! |
| 28 | 29 | echo ' |
| 29 | 30 | ', template_error_message(); |
| 30 | 31 | |
| 31 | 32 | // If the profile was update successfully, let the user know this. |
| 32 | - if (!empty($context['profile_updated'])) |
|
| 33 | - echo ' |
|
| 33 | + if (!empty($context['profile_updated'])) { |
|
| 34 | + echo ' |
|
| 34 | 35 | <div class="infobox"> |
| 35 | 36 | ', $context['profile_updated'], ' |
| 36 | 37 | </div>'; |
| 37 | -} |
|
| 38 | + } |
|
| 39 | + } |
|
| 38 | 40 | |
| 39 | 41 | /** |
| 40 | 42 | * Template for any HTML needed below the profile (closing off divs/tables, etc.) |
@@ -99,19 +101,19 @@ discard block |
||
| 99 | 101 | </div> |
| 100 | 102 | <div class="alerts_unread">'; |
| 101 | 103 | |
| 102 | - if (empty($context['unread_alerts'])) |
|
| 103 | - template_alerts_all_read(); |
|
| 104 | - |
|
| 105 | - else |
|
| 104 | + if (empty($context['unread_alerts'])) { |
|
| 105 | + template_alerts_all_read(); |
|
| 106 | + } else |
|
| 106 | 107 | { |
| 107 | - foreach ($context['unread_alerts'] as $id_alert => $details) |
|
| 108 | - echo ' |
|
| 108 | + foreach ($context['unread_alerts'] as $id_alert => $details) { |
|
| 109 | + echo ' |
|
| 109 | 110 | <div class="unread"> |
| 110 | 111 | ', !empty($details['sender']) ? $details['sender']['avatar']['image'] : '', ' |
| 111 | 112 | <div class="details"> |
| 112 | 113 | ', !empty($details['icon']) ? $details['icon'] : '', '<span>', $details['text'], '</span> - ', $details['time'], ' |
| 113 | 114 | </div> |
| 114 | 115 | </div>'; |
| 116 | + } |
|
| 115 | 117 | } |
| 116 | 118 | |
| 117 | 119 | echo ' |
@@ -158,37 +160,41 @@ discard block |
||
| 158 | 160 | if (!empty($context['print_custom_fields']['above_member'])) |
| 159 | 161 | { |
| 160 | 162 | $fields = ''; |
| 161 | - foreach ($context['print_custom_fields']['above_member'] as $field) |
|
| 162 | - if (!empty($field['output_html'])) |
|
| 163 | + foreach ($context['print_custom_fields']['above_member'] as $field) { |
|
| 164 | + if (!empty($field['output_html'])) |
|
| 163 | 165 | $fields .= ' |
| 164 | 166 | <li>' . $field['output_html'] . '</li>'; |
| 167 | + } |
|
| 165 | 168 | |
| 166 | - if (!empty($fields)) |
|
| 167 | - echo ' |
|
| 169 | + if (!empty($fields)) { |
|
| 170 | + echo ' |
|
| 168 | 171 | <div class="custom_fields_above_name"> |
| 169 | 172 | <ul>', $fields, ' |
| 170 | 173 | </ul> |
| 171 | 174 | </div>'; |
| 175 | + } |
|
| 172 | 176 | } |
| 173 | 177 | |
| 174 | 178 | echo ' |
| 175 | 179 | <div class="username clear"> |
| 176 | 180 | <h4>'; |
| 177 | 181 | |
| 178 | - if (!empty($context['print_custom_fields']['before_member'])) |
|
| 179 | - foreach ($context['print_custom_fields']['before_member'] as $field) |
|
| 182 | + if (!empty($context['print_custom_fields']['before_member'])) { |
|
| 183 | + foreach ($context['print_custom_fields']['before_member'] as $field) |
|
| 180 | 184 | if (!empty($field['output_html'])) |
| 181 | 185 | echo ' |
| 182 | 186 | <span>', $field['output_html'], '</span>'; |
| 187 | + } |
|
| 183 | 188 | |
| 184 | 189 | echo ' |
| 185 | 190 | ', $context['member']['name']; |
| 186 | 191 | |
| 187 | - if (!empty($context['print_custom_fields']['after_member'])) |
|
| 188 | - foreach ($context['print_custom_fields']['after_member'] as $field) |
|
| 192 | + if (!empty($context['print_custom_fields']['after_member'])) { |
|
| 193 | + foreach ($context['print_custom_fields']['after_member'] as $field) |
|
| 189 | 194 | if (!empty($field['output_html'])) |
| 190 | 195 | echo ' |
| 191 | 196 | <span>', $field['output_html'], '</span>'; |
| 197 | + } |
|
| 192 | 198 | |
| 193 | 199 | |
| 194 | 200 | echo ' |
@@ -201,39 +207,44 @@ discard block |
||
| 201 | 207 | if (!empty($context['print_custom_fields']['below_avatar'])) |
| 202 | 208 | { |
| 203 | 209 | $fields = ''; |
| 204 | - foreach ($context['print_custom_fields']['below_avatar'] as $field) |
|
| 205 | - if (!empty($field['output_html'])) |
|
| 210 | + foreach ($context['print_custom_fields']['below_avatar'] as $field) { |
|
| 211 | + if (!empty($field['output_html'])) |
|
| 206 | 212 | $fields .= ' |
| 207 | 213 | <li>' . $field['output_html'] . '</li>'; |
| 214 | + } |
|
| 208 | 215 | |
| 209 | - if (!empty($fields)) |
|
| 210 | - echo ' |
|
| 216 | + if (!empty($fields)) { |
|
| 217 | + echo ' |
|
| 211 | 218 | <div class="custom_fields_below_avatar"> |
| 212 | 219 | <ul>', $fields, ' |
| 213 | 220 | </ul> |
| 214 | 221 | </div>'; |
| 222 | + } |
|
| 215 | 223 | } |
| 216 | 224 | |
| 217 | 225 | echo ' |
| 218 | 226 | <ul class="icon_fields clear">'; |
| 219 | 227 | |
| 220 | 228 | // Email is only visible if it's your profile or you have the moderate_forum permission |
| 221 | - if ($context['member']['show_email']) |
|
| 222 | - echo ' |
|
| 229 | + if ($context['member']['show_email']) { |
|
| 230 | + echo ' |
|
| 223 | 231 | <li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>'; |
| 232 | + } |
|
| 224 | 233 | |
| 225 | 234 | // Don't show an icon if they haven't specified a website. |
| 226 | - if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) |
|
| 227 | - echo ' |
|
| 235 | + if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) { |
|
| 236 | + echo ' |
|
| 228 | 237 | <li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
| 238 | + } |
|
| 229 | 239 | |
| 230 | 240 | // Are there any custom profile fields as icons? |
| 231 | 241 | if (!empty($context['print_custom_fields']['icons'])) |
| 232 | 242 | { |
| 233 | - foreach ($context['print_custom_fields']['icons'] as $field) |
|
| 234 | - if (!empty($field['output_html'])) |
|
| 243 | + foreach ($context['print_custom_fields']['icons'] as $field) { |
|
| 244 | + if (!empty($field['output_html'])) |
|
| 235 | 245 | echo ' |
| 236 | 246 | <li class="custom_field">', $field['output_html'], '</li>'; |
| 247 | + } |
|
| 237 | 248 | } |
| 238 | 249 | |
| 239 | 250 | echo ' |
@@ -242,24 +253,27 @@ discard block |
||
| 242 | 253 | ', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['text'] . '" rel="nofollow">' : '', $settings['use_image_buttons'] ? '<span class="' . ($context['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $context['member']['online']['text'] . '"></span>' : $context['member']['online']['label'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['label'] . '</span>' : ''; |
| 243 | 254 | |
| 244 | 255 | // Can they add this member as a buddy? |
| 245 | - if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) |
|
| 246 | - echo ' |
|
| 256 | + if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) { |
|
| 257 | + echo ' |
|
| 247 | 258 | <br> |
| 248 | 259 | <a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], '</a>'; |
| 260 | + } |
|
| 249 | 261 | |
| 250 | 262 | echo ' |
| 251 | 263 | </span>'; |
| 252 | 264 | |
| 253 | - if (!$context['user']['is_owner'] && $context['can_send_pm']) |
|
| 254 | - echo ' |
|
| 265 | + if (!$context['user']['is_owner'] && $context['can_send_pm']) { |
|
| 266 | + echo ' |
|
| 255 | 267 | <a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>'; |
| 268 | + } |
|
| 256 | 269 | |
| 257 | 270 | echo ' |
| 258 | 271 | <a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>'; |
| 259 | 272 | |
| 260 | - if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) |
|
| 261 | - echo ' |
|
| 273 | + if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) { |
|
| 274 | + echo ' |
|
| 262 | 275 | <a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>'; |
| 276 | + } |
|
| 263 | 277 | |
| 264 | 278 | echo ' |
| 265 | 279 | <a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>'; |
@@ -268,17 +282,19 @@ discard block |
||
| 268 | 282 | if (!empty($context['print_custom_fields']['bottom_poster'])) |
| 269 | 283 | { |
| 270 | 284 | $fields = ''; |
| 271 | - foreach ($context['print_custom_fields']['bottom_poster'] as $field) |
|
| 272 | - if (!empty($field['output_html'])) |
|
| 285 | + foreach ($context['print_custom_fields']['bottom_poster'] as $field) { |
|
| 286 | + if (!empty($field['output_html'])) |
|
| 273 | 287 | $fields .= ' |
| 274 | 288 | <li>' . $field['output_html'] . '</li>'; |
| 289 | + } |
|
| 275 | 290 | |
| 276 | - if (!empty($fields)) |
|
| 277 | - echo ' |
|
| 291 | + if (!empty($fields)) { |
|
| 292 | + echo ' |
|
| 278 | 293 | <div class="custom_fields_bottom"> |
| 279 | 294 | <ul class="nolist">', $fields, ' |
| 280 | 295 | </ul> |
| 281 | 296 | </div>'; |
| 297 | + } |
|
| 282 | 298 | } |
| 283 | 299 | |
| 284 | 300 | echo ' |
@@ -287,30 +303,35 @@ discard block |
||
| 287 | 303 | <div id="detailedinfo"> |
| 288 | 304 | <dl class="settings">'; |
| 289 | 305 | |
| 290 | - if ($context['user']['is_owner'] || $context['user']['is_admin']) |
|
| 291 | - echo ' |
|
| 306 | + if ($context['user']['is_owner'] || $context['user']['is_admin']) { |
|
| 307 | + echo ' |
|
| 292 | 308 | <dt>', $txt['username'], ': </dt> |
| 293 | 309 | <dd>', $context['member']['username'], '</dd>'; |
| 310 | + } |
|
| 294 | 311 | |
| 295 | - if (!isset($context['disabled_fields']['posts'])) |
|
| 296 | - echo ' |
|
| 312 | + if (!isset($context['disabled_fields']['posts'])) { |
|
| 313 | + echo ' |
|
| 297 | 314 | <dt>', $txt['profile_posts'], ': </dt> |
| 298 | 315 | <dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>'; |
| 316 | + } |
|
| 299 | 317 | |
| 300 | - if ($context['member']['show_email']) |
|
| 301 | - echo ' |
|
| 318 | + if ($context['member']['show_email']) { |
|
| 319 | + echo ' |
|
| 302 | 320 | <dt>', $txt['email'], ': </dt> |
| 303 | 321 | <dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>'; |
| 322 | + } |
|
| 304 | 323 | |
| 305 | - if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) |
|
| 306 | - echo ' |
|
| 324 | + if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) { |
|
| 325 | + echo ' |
|
| 307 | 326 | <dt>', $txt['custom_title'], ': </dt> |
| 308 | 327 | <dd>', $context['member']['title'], '</dd>'; |
| 328 | + } |
|
| 309 | 329 | |
| 310 | - if (!empty($context['member']['blurb'])) |
|
| 311 | - echo ' |
|
| 330 | + if (!empty($context['member']['blurb'])) { |
|
| 331 | + echo ' |
|
| 312 | 332 | <dt>', $txt['personal_text'], ': </dt> |
| 313 | 333 | <dd>', $context['member']['blurb'], '</dd>'; |
| 334 | + } |
|
| 314 | 335 | |
| 315 | 336 | echo ' |
| 316 | 337 | <dt>', $txt['age'], ':</dt> |
@@ -324,19 +345,21 @@ discard block |
||
| 324 | 345 | { |
| 325 | 346 | $fields = array(); |
| 326 | 347 | |
| 327 | - foreach ($context['print_custom_fields']['standard'] as $field) |
|
| 328 | - if (!empty($field['output_html'])) |
|
| 348 | + foreach ($context['print_custom_fields']['standard'] as $field) { |
|
| 349 | + if (!empty($field['output_html'])) |
|
| 329 | 350 | $fields[] = $field; |
| 351 | + } |
|
| 330 | 352 | |
| 331 | 353 | if (count($fields) > 0) |
| 332 | 354 | { |
| 333 | 355 | echo ' |
| 334 | 356 | <dl class="settings">'; |
| 335 | 357 | |
| 336 | - foreach ($fields as $field) |
|
| 337 | - echo ' |
|
| 358 | + foreach ($fields as $field) { |
|
| 359 | + echo ' |
|
| 338 | 360 | <dt>', $field['name'], ':</dt> |
| 339 | 361 | <dd>', $field['output_html'], '</dd>'; |
| 362 | + } |
|
| 340 | 363 | |
| 341 | 364 | echo ' |
| 342 | 365 | </dl>'; |
@@ -355,9 +378,10 @@ discard block |
||
| 355 | 378 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>'; |
| 356 | 379 | |
| 357 | 380 | // Can we provide information on what this means? |
| 358 | - if (!empty($context['warning_status'])) |
|
| 359 | - echo ' |
|
| 381 | + if (!empty($context['warning_status'])) { |
|
| 382 | + echo ' |
|
| 360 | 383 | <span class="smalltext">(', $context['warning_status'], ')</span>'; |
| 384 | + } |
|
| 361 | 385 | |
| 362 | 386 | echo ' |
| 363 | 387 | </dd>'; |
@@ -367,11 +391,12 @@ discard block |
||
| 367 | 391 | if (!empty($context['activate_message']) || !empty($context['member']['bans'])) |
| 368 | 392 | { |
| 369 | 393 | // If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves. |
| 370 | - if (!empty($context['activate_message'])) |
|
| 371 | - echo ' |
|
| 394 | + if (!empty($context['activate_message'])) { |
|
| 395 | + echo ' |
|
| 372 | 396 | <dt class="clear"> |
| 373 | 397 | <span class="alert">', $context['activate_message'], '</span> (<a href="', $context['activate_link'], '"', ($context['activate_type'] == 4 ? ' class="you_sure" data-confirm="' . $txt['profileConfirm'] . '"' : ''), '>', $context['activate_link_text'], '</a>) |
| 374 | 398 | </dt>'; |
| 399 | + } |
|
| 375 | 400 | |
| 376 | 401 | // If the current member is banned, show a message and possibly a link to the ban. |
| 377 | 402 | if (!empty($context['member']['bans'])) |
@@ -383,10 +408,11 @@ discard block |
||
| 383 | 408 | <dt class="clear hidden" id="ban_info"> |
| 384 | 409 | <strong>', $txt['user_banned_by_following'], ':</strong>'; |
| 385 | 410 | |
| 386 | - foreach ($context['member']['bans'] as $ban) |
|
| 387 | - echo ' |
|
| 411 | + foreach ($context['member']['bans'] as $ban) { |
|
| 412 | + echo ' |
|
| 388 | 413 | <br> |
| 389 | 414 | <span class="smalltext">', $ban['explanation'], '</span>'; |
| 415 | + } |
|
| 390 | 416 | |
| 391 | 417 | echo ' |
| 392 | 418 | </dt>'; |
@@ -400,30 +426,34 @@ discard block |
||
| 400 | 426 | // If the person looking is allowed, they can check the members IP address and hostname. |
| 401 | 427 | if ($context['can_see_ip']) |
| 402 | 428 | { |
| 403 | - if (!empty($context['member']['ip'])) |
|
| 404 | - echo ' |
|
| 429 | + if (!empty($context['member']['ip'])) { |
|
| 430 | + echo ' |
|
| 405 | 431 | <dt>', $txt['ip'], ': </dt> |
| 406 | 432 | <dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>'; |
| 433 | + } |
|
| 407 | 434 | |
| 408 | - if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) |
|
| 409 | - echo ' |
|
| 435 | + if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) { |
|
| 436 | + echo ' |
|
| 410 | 437 | <dt>', $txt['hostname'], ': </dt> |
| 411 | 438 | <dd>', $context['member']['hostname'], '</dd>'; |
| 439 | + } |
|
| 412 | 440 | } |
| 413 | 441 | |
| 414 | 442 | echo ' |
| 415 | 443 | <dt>', $txt['local_time'], ':</dt> |
| 416 | 444 | <dd>', $context['member']['local_time'], '</dd>'; |
| 417 | 445 | |
| 418 | - if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) |
|
| 419 | - echo ' |
|
| 446 | + if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) { |
|
| 447 | + echo ' |
|
| 420 | 448 | <dt>', $txt['language'], ':</dt> |
| 421 | 449 | <dd>', $context['member']['language'], '</dd>'; |
| 450 | + } |
|
| 422 | 451 | |
| 423 | - if ($context['member']['show_last_login']) |
|
| 424 | - echo ' |
|
| 452 | + if ($context['member']['show_last_login']) { |
|
| 453 | + echo ' |
|
| 425 | 454 | <dt>', $txt['lastLoggedIn'], ': </dt> |
| 426 | 455 | <dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>'; |
| 456 | + } |
|
| 427 | 457 | |
| 428 | 458 | echo ' |
| 429 | 459 | </dl>'; |
@@ -432,42 +462,47 @@ discard block |
||
| 432 | 462 | if (!empty($context['print_custom_fields']['above_signature'])) |
| 433 | 463 | { |
| 434 | 464 | $fields = ''; |
| 435 | - foreach ($context['print_custom_fields']['above_signature'] as $field) |
|
| 436 | - if (!empty($field['output_html'])) |
|
| 465 | + foreach ($context['print_custom_fields']['above_signature'] as $field) { |
|
| 466 | + if (!empty($field['output_html'])) |
|
| 437 | 467 | $fields .= ' |
| 438 | 468 | <li>' . $field['output_html'] . '</li>'; |
| 469 | + } |
|
| 439 | 470 | |
| 440 | - if (!empty($fields)) |
|
| 441 | - echo ' |
|
| 471 | + if (!empty($fields)) { |
|
| 472 | + echo ' |
|
| 442 | 473 | <div class="custom_fields_above_signature"> |
| 443 | 474 | <ul class="nolist">', $fields, ' |
| 444 | 475 | </ul> |
| 445 | 476 | </div>'; |
| 477 | + } |
|
| 446 | 478 | } |
| 447 | 479 | |
| 448 | 480 | // Show the users signature. |
| 449 | - if ($context['signature_enabled'] && !empty($context['member']['signature'])) |
|
| 450 | - echo ' |
|
| 481 | + if ($context['signature_enabled'] && !empty($context['member']['signature'])) { |
|
| 482 | + echo ' |
|
| 451 | 483 | <div class="signature"> |
| 452 | 484 | <h5>', $txt['signature'], ':</h5> |
| 453 | 485 | ', $context['member']['signature'], ' |
| 454 | 486 | </div>'; |
| 487 | + } |
|
| 455 | 488 | |
| 456 | 489 | // Are there any custom profile fields for below the signature? |
| 457 | 490 | if (!empty($context['print_custom_fields']['below_signature'])) |
| 458 | 491 | { |
| 459 | 492 | $fields = ''; |
| 460 | - foreach ($context['print_custom_fields']['below_signature'] as $field) |
|
| 461 | - if (!empty($field['output_html'])) |
|
| 493 | + foreach ($context['print_custom_fields']['below_signature'] as $field) { |
|
| 494 | + if (!empty($field['output_html'])) |
|
| 462 | 495 | $fields .= ' |
| 463 | 496 | <li>' . $field['output_html'] . '</li>'; |
| 497 | + } |
|
| 464 | 498 | |
| 465 | - if (!empty($fields)) |
|
| 466 | - echo ' |
|
| 499 | + if (!empty($fields)) { |
|
| 500 | + echo ' |
|
| 467 | 501 | <div class="custom_fields_below_signature"> |
| 468 | 502 | <ul class="nolist">', $fields, ' |
| 469 | 503 | </ul> |
| 470 | 504 | </div>'; |
| 505 | + } |
|
| 471 | 506 | } |
| 472 | 507 | |
| 473 | 508 | echo ' |
@@ -509,62 +544,70 @@ discard block |
||
| 509 | 544 | </div> |
| 510 | 545 | <div class="list_posts">'; |
| 511 | 546 | |
| 512 | - if (!$post['approved']) |
|
| 513 | - echo ' |
|
| 547 | + if (!$post['approved']) { |
|
| 548 | + echo ' |
|
| 514 | 549 | <div class="approve_post"> |
| 515 | 550 | <em>', $txt['post_awaiting_approval'], '</em> |
| 516 | 551 | </div>'; |
| 552 | + } |
|
| 517 | 553 | |
| 518 | 554 | echo ' |
| 519 | 555 | ', $post['body'], ' |
| 520 | 556 | </div>'; |
| 521 | 557 | |
| 522 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
| 523 | - echo ' |
|
| 558 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
| 559 | + echo ' |
|
| 524 | 560 | <div class="floatright"> |
| 525 | 561 | <ul class="quickbuttons">'; |
| 562 | + } |
|
| 526 | 563 | |
| 527 | 564 | // If they *can* reply? |
| 528 | - if ($post['can_reply']) |
|
| 529 | - echo ' |
|
| 565 | + if ($post['can_reply']) { |
|
| 566 | + echo ' |
|
| 530 | 567 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
| 568 | + } |
|
| 531 | 569 | |
| 532 | 570 | // If they *can* quote? |
| 533 | - if ($post['can_quote']) |
|
| 534 | - echo ' |
|
| 571 | + if ($post['can_quote']) { |
|
| 572 | + echo ' |
|
| 535 | 573 | <li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
| 574 | + } |
|
| 536 | 575 | |
| 537 | 576 | // How about... even... remove it entirely?! |
| 538 | - if ($post['can_delete']) |
|
| 539 | - echo ' |
|
| 577 | + if ($post['can_delete']) { |
|
| 578 | + echo ' |
|
| 540 | 579 | <li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
| 580 | + } |
|
| 541 | 581 | |
| 542 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
| 543 | - echo ' |
|
| 582 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
| 583 | + echo ' |
|
| 544 | 584 | </ul> |
| 545 | 585 | </div><!-- .floatright -->'; |
| 586 | + } |
|
| 546 | 587 | |
| 547 | 588 | echo ' |
| 548 | 589 | </div><!-- $post[css_class] -->'; |
| 549 | 590 | } |
| 591 | + } else { |
|
| 592 | + template_show_list('attachments'); |
|
| 550 | 593 | } |
| 551 | - else |
|
| 552 | - template_show_list('attachments'); |
|
| 553 | 594 | |
| 554 | 595 | // No posts? Just end with a informative message. |
| 555 | - if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) |
|
| 556 | - echo ' |
|
| 596 | + if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) { |
|
| 597 | + echo ' |
|
| 557 | 598 | <div class="windowbg"> |
| 558 | 599 | ', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), ' |
| 559 | 600 | </div>'; |
| 601 | + } |
|
| 560 | 602 | |
| 561 | 603 | // Show more page numbers. |
| 562 | - if (!empty($context['page_index'])) |
|
| 563 | - echo ' |
|
| 604 | + if (!empty($context['page_index'])) { |
|
| 605 | + echo ' |
|
| 564 | 606 | <div class="pagesection"> |
| 565 | 607 | <div class="pagelinks">', $context['page_index'], '</div> |
| 566 | 608 | </div>'; |
| 567 | -} |
|
| 609 | + } |
|
| 610 | + } |
|
| 568 | 611 | |
| 569 | 612 | /** |
| 570 | 613 | * Template for showing alerts within the alerts popup |
@@ -574,11 +617,12 @@ discard block |
||
| 574 | 617 | global $context, $txt, $scripturl; |
| 575 | 618 | |
| 576 | 619 | // Do we have an update message? |
| 577 | - if (!empty($context['update_message'])) |
|
| 578 | - echo ' |
|
| 620 | + if (!empty($context['update_message'])) { |
|
| 621 | + echo ' |
|
| 579 | 622 | <div class="infobox"> |
| 580 | 623 | ', $context['update_message'], ' |
| 581 | 624 | </div>'; |
| 625 | + } |
|
| 582 | 626 | |
| 583 | 627 | echo ' |
| 584 | 628 | <div class="cat_bar"> |
@@ -587,18 +631,18 @@ discard block |
||
| 587 | 631 | </h3> |
| 588 | 632 | </div>'; |
| 589 | 633 | |
| 590 | - if (empty($context['alerts'])) |
|
| 591 | - echo ' |
|
| 634 | + if (empty($context['alerts'])) { |
|
| 635 | + echo ' |
|
| 592 | 636 | <div class="information"> |
| 593 | 637 | ', $txt['alerts_none'], ' |
| 594 | 638 | </div>'; |
| 595 | - |
|
| 596 | - else |
|
| 639 | + } else |
|
| 597 | 640 | { |
| 598 | 641 | // Start the form if checkboxes are in use |
| 599 | - if ($context['showCheckboxes']) |
|
| 600 | - echo ' |
|
| 642 | + if ($context['showCheckboxes']) { |
|
| 643 | + echo ' |
|
| 601 | 644 | <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;save" method="post" accept-charset="', $context['character_set'], '" id="mark_all">'; |
| 645 | + } |
|
| 602 | 646 | |
| 603 | 647 | echo ' |
| 604 | 648 | <table id="alerts" class="table_grid">'; |
@@ -617,9 +661,10 @@ discard block |
||
| 617 | 661 | <li><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;do=remove;aid=', $id, ';', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['delete'], '</a></li> |
| 618 | 662 | <li><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;do=', ($alert['is_read'] != 0 ? 'unread' : 'read'), ';aid=', $id, ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons ', $alert['is_read'] != 0 ? 'unread_button' : 'read_button', '"></span>', ($alert['is_read'] != 0 ? $txt['mark_unread'] : $txt['mark_read_short']), '</a></li>'; |
| 619 | 663 | |
| 620 | - if ($context['showCheckboxes']) |
|
| 621 | - echo ' |
|
| 664 | + if ($context['showCheckboxes']) { |
|
| 665 | + echo ' |
|
| 622 | 666 | <li><input type="checkbox" name="mark[', $id, ']" value="', $id, '"></li>'; |
| 667 | + } |
|
| 623 | 668 | |
| 624 | 669 | echo ' |
| 625 | 670 | </ul> |
@@ -634,8 +679,8 @@ discard block |
||
| 634 | 679 | ', $context['pagination'], ' |
| 635 | 680 | </div>'; |
| 636 | 681 | |
| 637 | - if ($context['showCheckboxes']) |
|
| 638 | - echo ' |
|
| 682 | + if ($context['showCheckboxes']) { |
|
| 683 | + echo ' |
|
| 639 | 684 | <div class="floatright"> |
| 640 | 685 | ', $txt['check_all'], ': <input type="checkbox" name="select_all" id="select_all"> |
| 641 | 686 | <select name="mark_as"> |
@@ -646,14 +691,16 @@ discard block |
||
| 646 | 691 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
| 647 | 692 | <input type="submit" name="req" value="', $txt['quick_mod_go'], '" class="button you_sure"> |
| 648 | 693 | </div>'; |
| 694 | + } |
|
| 649 | 695 | |
| 650 | 696 | echo ' |
| 651 | 697 | </div>'; |
| 652 | 698 | |
| 653 | - if ($context['showCheckboxes']) |
|
| 654 | - echo ' |
|
| 699 | + if ($context['showCheckboxes']) { |
|
| 700 | + echo ' |
|
| 655 | 701 | </form>'; |
| 656 | 702 | } |
| 703 | + } |
|
| 657 | 704 | } |
| 658 | 705 | |
| 659 | 706 | /** |
@@ -674,12 +721,12 @@ discard block |
||
| 674 | 721 | </div>' : ''; |
| 675 | 722 | |
| 676 | 723 | // No drafts? Just show an informative message. |
| 677 | - if (empty($context['drafts'])) |
|
| 678 | - echo ' |
|
| 724 | + if (empty($context['drafts'])) { |
|
| 725 | + echo ' |
|
| 679 | 726 | <div class="windowbg centertext"> |
| 680 | 727 | ', $txt['draft_none'], ' |
| 681 | 728 | </div>'; |
| 682 | - else |
|
| 729 | + } else |
|
| 683 | 730 | { |
| 684 | 731 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
| 685 | 732 | foreach ($context['drafts'] as $draft) |
@@ -691,13 +738,15 @@ discard block |
||
| 691 | 738 | <h5> |
| 692 | 739 | <strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> '; |
| 693 | 740 | |
| 694 | - if (!empty($draft['sticky'])) |
|
| 695 | - echo ' |
|
| 741 | + if (!empty($draft['sticky'])) { |
|
| 742 | + echo ' |
|
| 696 | 743 | <span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>'; |
| 744 | + } |
|
| 697 | 745 | |
| 698 | - if (!empty($draft['locked'])) |
|
| 699 | - echo ' |
|
| 746 | + if (!empty($draft['locked'])) { |
|
| 747 | + echo ' |
|
| 700 | 748 | <span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>'; |
| 749 | + } |
|
| 701 | 750 | |
| 702 | 751 | echo ' |
| 703 | 752 | </h5> |
@@ -730,13 +779,13 @@ discard block |
||
| 730 | 779 | { |
| 731 | 780 | global $context, $scripturl, $txt; |
| 732 | 781 | |
| 733 | - if (!empty($context['saved_successful'])) |
|
| 734 | - echo ' |
|
| 782 | + if (!empty($context['saved_successful'])) { |
|
| 783 | + echo ' |
|
| 735 | 784 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
| 736 | - |
|
| 737 | - elseif (!empty($context['saved_failed'])) |
|
| 738 | - echo ' |
|
| 785 | + } elseif (!empty($context['saved_failed'])) { |
|
| 786 | + echo ' |
|
| 739 | 787 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
| 788 | + } |
|
| 740 | 789 | |
| 741 | 790 | echo ' |
| 742 | 791 | <div id="edit_buddies"> |
@@ -751,14 +800,16 @@ discard block |
||
| 751 | 800 | <th scope="col" class="quarter_table buddy_link">', $txt['name'], '</th> |
| 752 | 801 | <th scope="col" class="buddy_status">', $txt['status'], '</th>'; |
| 753 | 802 | |
| 754 | - if ($context['can_moderate_forum']) |
|
| 755 | - echo ' |
|
| 803 | + if ($context['can_moderate_forum']) { |
|
| 804 | + echo ' |
|
| 756 | 805 | <th scope="col" class="buddy_email">', $txt['email'], '</th>'; |
| 806 | + } |
|
| 757 | 807 | |
| 758 | - if (!empty($context['custom_pf'])) |
|
| 759 | - foreach ($context['custom_pf'] as $column) |
|
| 808 | + if (!empty($context['custom_pf'])) { |
|
| 809 | + foreach ($context['custom_pf'] as $column) |
|
| 760 | 810 | echo ' |
| 761 | 811 | <th scope="col" class="buddy_custom_fields">', $column['label'], '</th>'; |
| 812 | + } |
|
| 762 | 813 | |
| 763 | 814 | echo ' |
| 764 | 815 | <th scope="col" class="buddy_remove">', $txt['remove'], '</th> |
@@ -767,13 +818,14 @@ discard block |
||
| 767 | 818 | <tbody>'; |
| 768 | 819 | |
| 769 | 820 | // If they don't have any buddies don't list them! |
| 770 | - if (empty($context['buddies'])) |
|
| 771 | - echo ' |
|
| 821 | + if (empty($context['buddies'])) { |
|
| 822 | + echo ' |
|
| 772 | 823 | <tr class="windowbg"> |
| 773 | 824 | <td colspan="', $context['can_moderate_forum'] ? '10' : '9', '"> |
| 774 | 825 | <strong>', $txt['no_buddies'], '</strong> |
| 775 | 826 | </td> |
| 776 | 827 | </tr>'; |
| 828 | + } |
|
| 777 | 829 | |
| 778 | 830 | // Now loop through each buddy showing info on each. |
| 779 | 831 | else |
@@ -787,17 +839,19 @@ discard block |
||
| 787 | 839 | <a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a> |
| 788 | 840 | </td>'; |
| 789 | 841 | |
| 790 | - if ($buddy['show_email']) |
|
| 791 | - echo ' |
|
| 842 | + if ($buddy['show_email']) { |
|
| 843 | + echo ' |
|
| 792 | 844 | <td class="buddy_email centertext"> |
| 793 | 845 | <a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a> |
| 794 | 846 | </td>'; |
| 847 | + } |
|
| 795 | 848 | |
| 796 | 849 | // Show the custom profile fields for this user. |
| 797 | - if (!empty($context['custom_pf'])) |
|
| 798 | - foreach ($context['custom_pf'] as $key => $column) |
|
| 850 | + if (!empty($context['custom_pf'])) { |
|
| 851 | + foreach ($context['custom_pf'] as $key => $column) |
|
| 799 | 852 | echo ' |
| 800 | 853 | <td class="lefttext buddy_custom_fields">', $buddy['options'][$key], '</td>'; |
| 854 | + } |
|
| 801 | 855 | |
| 802 | 856 | echo ' |
| 803 | 857 | <td class="centertext buddy_remove"> |
@@ -830,9 +884,10 @@ discard block |
||
| 830 | 884 | </dl> |
| 831 | 885 | </div>'; |
| 832 | 886 | |
| 833 | - if (!empty($context['token_check'])) |
|
| 834 | - echo ' |
|
| 887 | + if (!empty($context['token_check'])) { |
|
| 888 | + echo ' |
|
| 835 | 889 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 890 | + } |
|
| 836 | 891 | |
| 837 | 892 | echo ' |
| 838 | 893 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -858,13 +913,13 @@ discard block |
||
| 858 | 913 | { |
| 859 | 914 | global $context, $scripturl, $txt; |
| 860 | 915 | |
| 861 | - if (!empty($context['saved_successful'])) |
|
| 862 | - echo ' |
|
| 916 | + if (!empty($context['saved_successful'])) { |
|
| 917 | + echo ' |
|
| 863 | 918 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
| 864 | - |
|
| 865 | - elseif (!empty($context['saved_failed'])) |
|
| 866 | - echo ' |
|
| 919 | + } elseif (!empty($context['saved_failed'])) { |
|
| 920 | + echo ' |
|
| 867 | 921 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
| 922 | + } |
|
| 868 | 923 | |
| 869 | 924 | echo ' |
| 870 | 925 | <div id="edit_buddies"> |
@@ -879,9 +934,10 @@ discard block |
||
| 879 | 934 | <th scope="col" class="quarter_table buddy_link">', $txt['name'], '</th> |
| 880 | 935 | <th scope="col" class="buddy_status">', $txt['status'], '</th>'; |
| 881 | 936 | |
| 882 | - if ($context['can_moderate_forum']) |
|
| 883 | - echo ' |
|
| 937 | + if ($context['can_moderate_forum']) { |
|
| 938 | + echo ' |
|
| 884 | 939 | <th scope="col" class="buddy_email">', $txt['email'], '</th>'; |
| 940 | + } |
|
| 885 | 941 | |
| 886 | 942 | echo ' |
| 887 | 943 | <th scope="col" class="buddy_remove">', $txt['ignore_remove'], '</th> |
@@ -890,13 +946,14 @@ discard block |
||
| 890 | 946 | <tbody>'; |
| 891 | 947 | |
| 892 | 948 | // If they don't have anyone on their ignore list, don't list it! |
| 893 | - if (empty($context['ignore_list'])) |
|
| 894 | - echo ' |
|
| 949 | + if (empty($context['ignore_list'])) { |
|
| 950 | + echo ' |
|
| 895 | 951 | <tr class="windowbg"> |
| 896 | 952 | <td colspan="', $context['can_moderate_forum'] ? '4' : '3', '"> |
| 897 | 953 | <strong>', $txt['no_ignore'], '</strong> |
| 898 | 954 | </td> |
| 899 | 955 | </tr>'; |
| 956 | + } |
|
| 900 | 957 | |
| 901 | 958 | // Now loop through each buddy showing info on each. |
| 902 | 959 | foreach ($context['ignore_list'] as $member) |
@@ -908,11 +965,12 @@ discard block |
||
| 908 | 965 | <a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a> |
| 909 | 966 | </td>'; |
| 910 | 967 | |
| 911 | - if ($context['can_moderate_forum']) |
|
| 912 | - echo ' |
|
| 968 | + if ($context['can_moderate_forum']) { |
|
| 969 | + echo ' |
|
| 913 | 970 | <td class="centertext buddy_email"> |
| 914 | 971 | <a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a> |
| 915 | 972 | </td>'; |
| 973 | + } |
|
| 916 | 974 | echo ' |
| 917 | 975 | <td class="centertext buddy_remove"> |
| 918 | 976 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['ignore_remove'], '"></span></a> |
@@ -943,9 +1001,10 @@ discard block |
||
| 943 | 1001 | </dl> |
| 944 | 1002 | </div>'; |
| 945 | 1003 | |
| 946 | - if (!empty($context['token_check'])) |
|
| 947 | - echo ' |
|
| 1004 | + if (!empty($context['token_check'])) { |
|
| 1005 | + echo ' |
|
| 948 | 1006 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 1007 | + } |
|
| 949 | 1008 | |
| 950 | 1009 | echo ' |
| 951 | 1010 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -990,9 +1049,10 @@ discard block |
||
| 990 | 1049 | <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>'; |
| 991 | 1050 | |
| 992 | 1051 | // Second address detected? |
| 993 | - if (!empty($context['last_ip2'])) |
|
| 994 | - echo ' |
|
| 1052 | + if (!empty($context['last_ip2'])) { |
|
| 1053 | + echo ' |
|
| 995 | 1054 | , <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>'; |
| 1055 | + } |
|
| 996 | 1056 | |
| 997 | 1057 | echo ' |
| 998 | 1058 | </dd>'; |
@@ -1058,9 +1118,10 @@ discard block |
||
| 1058 | 1118 | </div> |
| 1059 | 1119 | <div class="windowbg">'; |
| 1060 | 1120 | |
| 1061 | - foreach ($context['whois_servers'] as $server) |
|
| 1062 | - echo ' |
|
| 1121 | + foreach ($context['whois_servers'] as $server) { |
|
| 1122 | + echo ' |
|
| 1063 | 1123 | <a href="', $server['url'], '" target="_blank" rel="noopener"', '>', $server['name'], '</a><br>'; |
| 1124 | + } |
|
| 1064 | 1125 | echo ' |
| 1065 | 1126 | </div> |
| 1066 | 1127 | <br>'; |
@@ -1072,13 +1133,12 @@ discard block |
||
| 1072 | 1133 | <h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3> |
| 1073 | 1134 | </div>'; |
| 1074 | 1135 | |
| 1075 | - if (empty($context['ips'])) |
|
| 1076 | - echo ' |
|
| 1136 | + if (empty($context['ips'])) { |
|
| 1137 | + echo ' |
|
| 1077 | 1138 | <p class="windowbg description"> |
| 1078 | 1139 | <em>', $txt['no_members_from_ip'], '</em> |
| 1079 | 1140 | </p>'; |
| 1080 | - |
|
| 1081 | - else |
|
| 1141 | + } else |
|
| 1082 | 1142 | { |
| 1083 | 1143 | echo ' |
| 1084 | 1144 | <table class="table_grid"> |
@@ -1091,12 +1151,13 @@ discard block |
||
| 1091 | 1151 | <tbody>'; |
| 1092 | 1152 | |
| 1093 | 1153 | // Loop through each of the members and display them. |
| 1094 | - foreach ($context['ips'] as $ip => $memberlist) |
|
| 1095 | - echo ' |
|
| 1154 | + foreach ($context['ips'] as $ip => $memberlist) { |
|
| 1155 | + echo ' |
|
| 1096 | 1156 | <tr class="windowbg"> |
| 1097 | 1157 | <td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td> |
| 1098 | 1158 | <td>', implode(', ', $memberlist), '</td> |
| 1099 | 1159 | </tr>'; |
| 1160 | + } |
|
| 1100 | 1161 | |
| 1101 | 1162 | echo ' |
| 1102 | 1163 | </tbody> |
@@ -1138,11 +1199,10 @@ discard block |
||
| 1138 | 1199 | </h3> |
| 1139 | 1200 | </div>'; |
| 1140 | 1201 | |
| 1141 | - if ($context['member']['has_all_permissions']) |
|
| 1142 | - echo ' |
|
| 1202 | + if ($context['member']['has_all_permissions']) { |
|
| 1203 | + echo ' |
|
| 1143 | 1204 | <div class="information">', $txt['showPermissions_all'], '</div>'; |
| 1144 | - |
|
| 1145 | - else |
|
| 1205 | + } else |
|
| 1146 | 1206 | { |
| 1147 | 1207 | echo ' |
| 1148 | 1208 | <div class="information">',$txt['showPermissions_help'], '</div> |
@@ -1157,9 +1217,10 @@ discard block |
||
| 1157 | 1217 | <div class="windowbg smalltext"> |
| 1158 | 1218 | ', $txt['showPermissions_restricted_boards_desc'], ':<br>'; |
| 1159 | 1219 | |
| 1160 | - foreach ($context['no_access_boards'] as $no_access_board) |
|
| 1161 | - echo ' |
|
| 1220 | + foreach ($context['no_access_boards'] as $no_access_board) { |
|
| 1221 | + echo ' |
|
| 1162 | 1222 | <a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', '; |
| 1223 | + } |
|
| 1163 | 1224 | echo ' |
| 1164 | 1225 | </div>'; |
| 1165 | 1226 | } |
@@ -1191,12 +1252,13 @@ discard block |
||
| 1191 | 1252 | </td> |
| 1192 | 1253 | <td class="smalltext">'; |
| 1193 | 1254 | |
| 1194 | - if ($permission['is_denied']) |
|
| 1195 | - echo ' |
|
| 1255 | + if ($permission['is_denied']) { |
|
| 1256 | + echo ' |
|
| 1196 | 1257 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
| 1197 | - else |
|
| 1198 | - echo ' |
|
| 1258 | + } else { |
|
| 1259 | + echo ' |
|
| 1199 | 1260 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
| 1261 | + } |
|
| 1200 | 1262 | |
| 1201 | 1263 | echo ' |
| 1202 | 1264 | </td> |
@@ -1207,10 +1269,10 @@ discard block |
||
| 1207 | 1269 | </table> |
| 1208 | 1270 | </div><!-- .tborder --> |
| 1209 | 1271 | <br>'; |
| 1210 | - } |
|
| 1211 | - else |
|
| 1212 | - echo ' |
|
| 1272 | + } else { |
|
| 1273 | + echo ' |
|
| 1213 | 1274 | <p class="windowbg">', $txt['showPermissions_none_general'], '</p>'; |
| 1275 | + } |
|
| 1214 | 1276 | |
| 1215 | 1277 | // Board permission section. |
| 1216 | 1278 | echo ' |
@@ -1221,14 +1283,16 @@ discard block |
||
| 1221 | 1283 | <select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();"> |
| 1222 | 1284 | <option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], '</option>'; |
| 1223 | 1285 | |
| 1224 | - if (!empty($context['boards'])) |
|
| 1225 | - echo ' |
|
| 1286 | + if (!empty($context['boards'])) { |
|
| 1287 | + echo ' |
|
| 1226 | 1288 | <option value="" disabled>---------------------------</option>'; |
| 1289 | + } |
|
| 1227 | 1290 | |
| 1228 | 1291 | // Fill the box with any local permission boards. |
| 1229 | - foreach ($context['boards'] as $board) |
|
| 1230 | - echo ' |
|
| 1292 | + foreach ($context['boards'] as $board) { |
|
| 1293 | + echo ' |
|
| 1231 | 1294 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>'; |
| 1295 | + } |
|
| 1232 | 1296 | |
| 1233 | 1297 | echo ' |
| 1234 | 1298 | </select> |
@@ -1257,13 +1321,13 @@ discard block |
||
| 1257 | 1321 | </td> |
| 1258 | 1322 | <td class="smalltext">'; |
| 1259 | 1323 | |
| 1260 | - if ($permission['is_denied']) |
|
| 1261 | - echo ' |
|
| 1324 | + if ($permission['is_denied']) { |
|
| 1325 | + echo ' |
|
| 1262 | 1326 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
| 1263 | - |
|
| 1264 | - else |
|
| 1265 | - echo ' |
|
| 1327 | + } else { |
|
| 1328 | + echo ' |
|
| 1266 | 1329 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
| 1330 | + } |
|
| 1267 | 1331 | |
| 1268 | 1332 | echo ' |
| 1269 | 1333 | </td> |
@@ -1272,10 +1336,10 @@ discard block |
||
| 1272 | 1336 | echo ' |
| 1273 | 1337 | </tbody> |
| 1274 | 1338 | </table>'; |
| 1275 | - } |
|
| 1276 | - else |
|
| 1277 | - echo ' |
|
| 1339 | + } else { |
|
| 1340 | + echo ' |
|
| 1278 | 1341 | <p class="windowbg">', $txt['showPermissions_none_board'], '</p>'; |
| 1342 | + } |
|
| 1279 | 1343 | echo ' |
| 1280 | 1344 | </div><!-- #permissions -->'; |
| 1281 | 1345 | } |
@@ -1299,12 +1363,13 @@ discard block |
||
| 1299 | 1363 | echo ' |
| 1300 | 1364 | <dt>', $txt['statPanel_' . $key], '</dt>'; |
| 1301 | 1365 | |
| 1302 | - if (!empty($stat['url'])) |
|
| 1303 | - echo ' |
|
| 1366 | + if (!empty($stat['url'])) { |
|
| 1367 | + echo ' |
|
| 1304 | 1368 | <dd><a href="', $stat['url'], '">', $stat['text'], '</a></dd>'; |
| 1305 | - else |
|
| 1306 | - echo ' |
|
| 1369 | + } else { |
|
| 1370 | + echo ' |
|
| 1307 | 1371 | <dd>', $stat['text'], '</dd>'; |
| 1372 | + } |
|
| 1308 | 1373 | } |
| 1309 | 1374 | |
| 1310 | 1375 | echo ' |
@@ -1321,9 +1386,10 @@ discard block |
||
| 1321 | 1386 | </div>'; |
| 1322 | 1387 | |
| 1323 | 1388 | // If they haven't post at all, don't draw the graph. |
| 1324 | - if (empty($context['posts_by_time'])) |
|
| 1325 | - echo ' |
|
| 1389 | + if (empty($context['posts_by_time'])) { |
|
| 1390 | + echo ' |
|
| 1326 | 1391 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
| 1392 | + } |
|
| 1327 | 1393 | |
| 1328 | 1394 | // Otherwise do! |
| 1329 | 1395 | else |
@@ -1332,8 +1398,8 @@ discard block |
||
| 1332 | 1398 | <ul class="activity_stats flow_hidden">'; |
| 1333 | 1399 | |
| 1334 | 1400 | // The labels. |
| 1335 | - foreach ($context['posts_by_time'] as $time_of_day) |
|
| 1336 | - echo ' |
|
| 1401 | + foreach ($context['posts_by_time'] as $time_of_day) { |
|
| 1402 | + echo ' |
|
| 1337 | 1403 | <li> |
| 1338 | 1404 | <div class="generic_bar vertical"> |
| 1339 | 1405 | <div class="bar" style="height: ', (int) $time_of_day['relative_percent'], '%;"> |
@@ -1342,6 +1408,7 @@ discard block |
||
| 1342 | 1408 | </div> |
| 1343 | 1409 | <span class="stats_hour">', $time_of_day['hour_format'], '</span> |
| 1344 | 1410 | </li>'; |
| 1411 | + } |
|
| 1345 | 1412 | |
| 1346 | 1413 | echo ' |
| 1347 | 1414 | </ul>'; |
@@ -1360,11 +1427,10 @@ discard block |
||
| 1360 | 1427 | </h3> |
| 1361 | 1428 | </div>'; |
| 1362 | 1429 | |
| 1363 | - if (empty($context['popular_boards'])) |
|
| 1364 | - echo ' |
|
| 1430 | + if (empty($context['popular_boards'])) { |
|
| 1431 | + echo ' |
|
| 1365 | 1432 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
| 1366 | - |
|
| 1367 | - else |
|
| 1433 | + } else |
|
| 1368 | 1434 | { |
| 1369 | 1435 | echo ' |
| 1370 | 1436 | <dl class="stats">'; |
@@ -1394,10 +1460,10 @@ discard block |
||
| 1394 | 1460 | </h3> |
| 1395 | 1461 | </div>'; |
| 1396 | 1462 | |
| 1397 | - if (empty($context['board_activity'])) |
|
| 1398 | - echo ' |
|
| 1463 | + if (empty($context['board_activity'])) { |
|
| 1464 | + echo ' |
|
| 1399 | 1465 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
| 1400 | - else |
|
| 1466 | + } else |
|
| 1401 | 1467 | { |
| 1402 | 1468 | echo ' |
| 1403 | 1469 | <dl class="stats">'; |
@@ -1448,90 +1514,97 @@ discard block |
||
| 1448 | 1514 | <h3 class="catbg profile_hd">'; |
| 1449 | 1515 | |
| 1450 | 1516 | // Don't say "Profile" if this isn't the profile... |
| 1451 | - if (!empty($context['profile_header_text'])) |
|
| 1452 | - echo ' |
|
| 1517 | + if (!empty($context['profile_header_text'])) { |
|
| 1518 | + echo ' |
|
| 1453 | 1519 | ', $context['profile_header_text']; |
| 1454 | - else |
|
| 1455 | - echo ' |
|
| 1520 | + } else { |
|
| 1521 | + echo ' |
|
| 1456 | 1522 | ', $txt['profile']; |
| 1523 | + } |
|
| 1457 | 1524 | |
| 1458 | 1525 | echo ' |
| 1459 | 1526 | </h3> |
| 1460 | 1527 | </div>'; |
| 1461 | 1528 | |
| 1462 | 1529 | // Have we some description? |
| 1463 | - if ($context['page_desc']) |
|
| 1464 | - echo ' |
|
| 1530 | + if ($context['page_desc']) { |
|
| 1531 | + echo ' |
|
| 1465 | 1532 | <p class="information">', $context['page_desc'], '</p>'; |
| 1533 | + } |
|
| 1466 | 1534 | |
| 1467 | 1535 | echo ' |
| 1468 | 1536 | <div class="roundframe">'; |
| 1469 | 1537 | |
| 1470 | 1538 | // Any bits at the start? |
| 1471 | - if (!empty($context['profile_prehtml'])) |
|
| 1472 | - echo ' |
|
| 1539 | + if (!empty($context['profile_prehtml'])) { |
|
| 1540 | + echo ' |
|
| 1473 | 1541 | <div>', $context['profile_prehtml'], '</div>'; |
| 1542 | + } |
|
| 1474 | 1543 | |
| 1475 | - if (!empty($context['profile_fields'])) |
|
| 1476 | - echo ' |
|
| 1544 | + if (!empty($context['profile_fields'])) { |
|
| 1545 | + echo ' |
|
| 1477 | 1546 | <dl class="settings">'; |
| 1547 | + } |
|
| 1478 | 1548 | |
| 1479 | 1549 | // Start the big old loop 'of love. |
| 1480 | 1550 | $lastItem = 'hr'; |
| 1481 | 1551 | foreach ($context['profile_fields'] as $key => $field) |
| 1482 | 1552 | { |
| 1483 | 1553 | // We add a little hack to be sure we never get more than one hr in a row! |
| 1484 | - if ($lastItem == 'hr' && $field['type'] == 'hr') |
|
| 1485 | - continue; |
|
| 1554 | + if ($lastItem == 'hr' && $field['type'] == 'hr') { |
|
| 1555 | + continue; |
|
| 1556 | + } |
|
| 1486 | 1557 | |
| 1487 | 1558 | $lastItem = $field['type']; |
| 1488 | - if ($field['type'] == 'hr') |
|
| 1489 | - echo ' |
|
| 1559 | + if ($field['type'] == 'hr') { |
|
| 1560 | + echo ' |
|
| 1490 | 1561 | </dl> |
| 1491 | 1562 | <hr> |
| 1492 | 1563 | <dl class="settings">'; |
| 1493 | - |
|
| 1494 | - elseif ($field['type'] == 'callback') |
|
| 1564 | + } elseif ($field['type'] == 'callback') |
|
| 1495 | 1565 | { |
| 1496 | 1566 | if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func'])) |
| 1497 | 1567 | { |
| 1498 | 1568 | $callback_func = 'template_profile_' . $field['callback_func']; |
| 1499 | 1569 | $callback_func(); |
| 1500 | 1570 | } |
| 1501 | - } |
|
| 1502 | - else |
|
| 1571 | + } else |
|
| 1503 | 1572 | { |
| 1504 | 1573 | echo ' |
| 1505 | 1574 | <dt> |
| 1506 | 1575 | <strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>'; |
| 1507 | 1576 | |
| 1508 | 1577 | // Does it have any subtext to show? |
| 1509 | - if (!empty($field['subtext'])) |
|
| 1510 | - echo ' |
|
| 1578 | + if (!empty($field['subtext'])) { |
|
| 1579 | + echo ' |
|
| 1511 | 1580 | <br> |
| 1512 | 1581 | <span class="smalltext">', $field['subtext'], '</span>'; |
| 1582 | + } |
|
| 1513 | 1583 | |
| 1514 | 1584 | echo ' |
| 1515 | 1585 | </dt> |
| 1516 | 1586 | <dd>'; |
| 1517 | 1587 | |
| 1518 | 1588 | // Want to put something infront of the box? |
| 1519 | - if (!empty($field['preinput'])) |
|
| 1520 | - echo ' |
|
| 1589 | + if (!empty($field['preinput'])) { |
|
| 1590 | + echo ' |
|
| 1521 | 1591 | ', $field['preinput']; |
| 1592 | + } |
|
| 1522 | 1593 | |
| 1523 | 1594 | // What type of data are we showing? |
| 1524 | - if ($field['type'] == 'label') |
|
| 1525 | - echo ' |
|
| 1595 | + if ($field['type'] == 'label') { |
|
| 1596 | + echo ' |
|
| 1526 | 1597 | ', $field['value']; |
| 1598 | + } |
|
| 1527 | 1599 | |
| 1528 | 1600 | // Maybe it's a text box - very likely! |
| 1529 | 1601 | elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url'))) |
| 1530 | 1602 | { |
| 1531 | - if ($field['type'] == 'int' || $field['type'] == 'float') |
|
| 1532 | - $type = 'number'; |
|
| 1533 | - else |
|
| 1534 | - $type = $field['type']; |
|
| 1603 | + if ($field['type'] == 'int' || $field['type'] == 'float') { |
|
| 1604 | + $type = 'number'; |
|
| 1605 | + } else { |
|
| 1606 | + $type = $field['type']; |
|
| 1607 | + } |
|
| 1535 | 1608 | $step = $field['type'] == 'float' ? ' step="0.1"' : ''; |
| 1536 | 1609 | |
| 1537 | 1610 | |
@@ -1539,10 +1612,11 @@ discard block |
||
| 1539 | 1612 | <input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>'; |
| 1540 | 1613 | } |
| 1541 | 1614 | // You "checking" me out? ;) |
| 1542 | - elseif ($field['type'] == 'check') |
|
| 1543 | - echo ' |
|
| 1615 | + elseif ($field['type'] == 'check') { |
|
| 1616 | + echo ' |
|
| 1544 | 1617 | <input type="hidden" name="', $key, '" value="0"> |
| 1545 | 1618 | <input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>'; |
| 1619 | + } |
|
| 1546 | 1620 | |
| 1547 | 1621 | // Always fun - select boxes! |
| 1548 | 1622 | elseif ($field['type'] == 'select') |
@@ -1553,14 +1627,16 @@ discard block |
||
| 1553 | 1627 | if (isset($field['options'])) |
| 1554 | 1628 | { |
| 1555 | 1629 | // Is this some code to generate the options? |
| 1556 | - if (!is_array($field['options'])) |
|
| 1557 | - $field['options'] = $field['options'](); |
|
| 1630 | + if (!is_array($field['options'])) { |
|
| 1631 | + $field['options'] = $field['options'](); |
|
| 1632 | + } |
|
| 1558 | 1633 | |
| 1559 | 1634 | // Assuming we now have some! |
| 1560 | - if (is_array($field['options'])) |
|
| 1561 | - foreach ($field['options'] as $value => $name) |
|
| 1635 | + if (is_array($field['options'])) { |
|
| 1636 | + foreach ($field['options'] as $value => $name) |
|
| 1562 | 1637 | echo ' |
| 1563 | 1638 | <option', is_numeric($value) ? ' value="" disabled' : ' value="' . $value . '"', $value === $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
| 1639 | + } |
|
| 1564 | 1640 | } |
| 1565 | 1641 | |
| 1566 | 1642 | echo ' |
@@ -1568,31 +1644,34 @@ discard block |
||
| 1568 | 1644 | } |
| 1569 | 1645 | |
| 1570 | 1646 | // Something to end with? |
| 1571 | - if (!empty($field['postinput'])) |
|
| 1572 | - echo ' |
|
| 1647 | + if (!empty($field['postinput'])) { |
|
| 1648 | + echo ' |
|
| 1573 | 1649 | ', $field['postinput']; |
| 1650 | + } |
|
| 1574 | 1651 | |
| 1575 | 1652 | echo ' |
| 1576 | 1653 | </dd>'; |
| 1577 | 1654 | } |
| 1578 | 1655 | } |
| 1579 | 1656 | |
| 1580 | - if (!empty($context['profile_fields'])) |
|
| 1581 | - echo ' |
|
| 1657 | + if (!empty($context['profile_fields'])) { |
|
| 1658 | + echo ' |
|
| 1582 | 1659 | </dl>'; |
| 1660 | + } |
|
| 1583 | 1661 | |
| 1584 | 1662 | // Are there any custom profile fields - if so print them! |
| 1585 | 1663 | if (!empty($context['custom_fields'])) |
| 1586 | 1664 | { |
| 1587 | - if ($lastItem != 'hr') |
|
| 1588 | - echo ' |
|
| 1665 | + if ($lastItem != 'hr') { |
|
| 1666 | + echo ' |
|
| 1589 | 1667 | <hr>'; |
| 1668 | + } |
|
| 1590 | 1669 | |
| 1591 | 1670 | echo ' |
| 1592 | 1671 | <dl class="settings">'; |
| 1593 | 1672 | |
| 1594 | - foreach ($context['custom_fields'] as $field) |
|
| 1595 | - echo ' |
|
| 1673 | + foreach ($context['custom_fields'] as $field) { |
|
| 1674 | + echo ' |
|
| 1596 | 1675 | <dt> |
| 1597 | 1676 | <strong>', $field['name'], ': </strong><br> |
| 1598 | 1677 | <span class="smalltext">', $field['desc'], '</span> |
@@ -1600,19 +1679,21 @@ discard block |
||
| 1600 | 1679 | <dd> |
| 1601 | 1680 | ', $field['input_html'], ' |
| 1602 | 1681 | </dd>'; |
| 1682 | + } |
|
| 1603 | 1683 | |
| 1604 | 1684 | echo ' |
| 1605 | 1685 | </dl>'; |
| 1606 | 1686 | } |
| 1607 | 1687 | |
| 1608 | 1688 | // Any closing HTML? |
| 1609 | - if (!empty($context['profile_posthtml'])) |
|
| 1610 | - echo ' |
|
| 1689 | + if (!empty($context['profile_posthtml'])) { |
|
| 1690 | + echo ' |
|
| 1611 | 1691 | <div>', $context['profile_posthtml'], '</div>'; |
| 1692 | + } |
|
| 1612 | 1693 | |
| 1613 | 1694 | // Only show the password box if it's actually needed. |
| 1614 | - if ($context['require_password']) |
|
| 1615 | - echo ' |
|
| 1695 | + if ($context['require_password']) { |
|
| 1696 | + echo ' |
|
| 1616 | 1697 | <dl class="settings"> |
| 1617 | 1698 | <dt> |
| 1618 | 1699 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br> |
@@ -1622,18 +1703,21 @@ discard block |
||
| 1622 | 1703 | <input type="password" name="oldpasswrd" id="oldpasswrd" size="20"> |
| 1623 | 1704 | </dd> |
| 1624 | 1705 | </dl>'; |
| 1706 | + } |
|
| 1625 | 1707 | |
| 1626 | 1708 | // The button shouldn't say "Change profile" unless we're changing the profile... |
| 1627 | - if (!empty($context['submit_button_text'])) |
|
| 1628 | - echo ' |
|
| 1709 | + if (!empty($context['submit_button_text'])) { |
|
| 1710 | + echo ' |
|
| 1629 | 1711 | <input type="submit" name="save" value="', $context['submit_button_text'], '" class="button floatright">'; |
| 1630 | - else |
|
| 1631 | - echo ' |
|
| 1712 | + } else { |
|
| 1713 | + echo ' |
|
| 1632 | 1714 | <input type="submit" name="save" value="', $txt['change_profile'], '" class="button floatright">'; |
| 1715 | + } |
|
| 1633 | 1716 | |
| 1634 | - if (!empty($context['token_check'])) |
|
| 1635 | - echo ' |
|
| 1717 | + if (!empty($context['token_check'])) { |
|
| 1718 | + echo ' |
|
| 1636 | 1719 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 1720 | + } |
|
| 1637 | 1721 | |
| 1638 | 1722 | echo ' |
| 1639 | 1723 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1643,10 +1727,11 @@ discard block |
||
| 1643 | 1727 | </form>'; |
| 1644 | 1728 | |
| 1645 | 1729 | // Any final spellchecking stuff? |
| 1646 | - if (!empty($context['show_spellchecking'])) |
|
| 1647 | - echo ' |
|
| 1730 | + if (!empty($context['show_spellchecking'])) { |
|
| 1731 | + echo ' |
|
| 1648 | 1732 | <form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value=""></form>'; |
| 1649 | -} |
|
| 1733 | + } |
|
| 1734 | + } |
|
| 1650 | 1735 | |
| 1651 | 1736 | /** |
| 1652 | 1737 | * Personal Message settings. |
@@ -1683,10 +1768,11 @@ discard block |
||
| 1683 | 1768 | <select name="pm_receive_from" id="pm_receive_from"> |
| 1684 | 1769 | <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>'; |
| 1685 | 1770 | |
| 1686 | - if (!empty($modSettings['enable_buddylist'])) |
|
| 1687 | - echo ' |
|
| 1771 | + if (!empty($modSettings['enable_buddylist'])) { |
|
| 1772 | + echo ' |
|
| 1688 | 1773 | <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option> |
| 1689 | 1774 | <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>'; |
| 1775 | + } |
|
| 1690 | 1776 | |
| 1691 | 1777 | echo ' |
| 1692 | 1778 | <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option> |
@@ -1729,11 +1815,12 @@ discard block |
||
| 1729 | 1815 | if (empty($setting) || !is_array($setting)) |
| 1730 | 1816 | { |
| 1731 | 1817 | // Insert a separator (unless this is the first item in the list) |
| 1732 | - if ($i !== $first_option_key) |
|
| 1733 | - echo ' |
|
| 1818 | + if ($i !== $first_option_key) { |
|
| 1819 | + echo ' |
|
| 1734 | 1820 | </dl> |
| 1735 | 1821 | <hr> |
| 1736 | 1822 | <dl class="settings">'; |
| 1823 | + } |
|
| 1737 | 1824 | |
| 1738 | 1825 | // Should we give a name to this section? |
| 1739 | 1826 | if (is_string($setting) && !empty($setting)) |
@@ -1742,51 +1829,55 @@ discard block |
||
| 1742 | 1829 | echo ' |
| 1743 | 1830 | <dt><strong>' . $setting . '</strong></dt> |
| 1744 | 1831 | <dd></dd>'; |
| 1832 | + } else { |
|
| 1833 | + $titled_section = false; |
|
| 1745 | 1834 | } |
| 1746 | - else |
|
| 1747 | - $titled_section = false; |
|
| 1748 | 1835 | |
| 1749 | 1836 | continue; |
| 1750 | 1837 | } |
| 1751 | 1838 | |
| 1752 | 1839 | // Is this disabled? |
| 1753 | - if (isset($setting['enabled']) && $setting['enabled'] === false) |
|
| 1754 | - continue; |
|
| 1840 | + if (isset($setting['enabled']) && $setting['enabled'] === false) { |
|
| 1841 | + continue; |
|
| 1842 | + } |
|
| 1755 | 1843 | |
| 1756 | 1844 | // Some of these may not be set... Set to defaults here |
| 1757 | 1845 | $opts = array('calendar_start_day', 'topics_per_page', 'messages_per_page', 'display_quick_mod'); |
| 1758 | - if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) |
|
| 1759 | - $context['member']['options'][$setting['id']] = 0; |
|
| 1760 | - |
|
| 1761 | - if (!isset($setting['type']) || $setting['type'] == 'bool') |
|
| 1762 | - $setting['type'] = 'checkbox'; |
|
| 1763 | - |
|
| 1764 | - elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') |
|
| 1765 | - $setting['type'] = 'number'; |
|
| 1846 | + if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) { |
|
| 1847 | + $context['member']['options'][$setting['id']] = 0; |
|
| 1848 | + } |
|
| 1766 | 1849 | |
| 1767 | - elseif ($setting['type'] == 'string') |
|
| 1768 | - $setting['type'] = 'text'; |
|
| 1850 | + if (!isset($setting['type']) || $setting['type'] == 'bool') { |
|
| 1851 | + $setting['type'] = 'checkbox'; |
|
| 1852 | + } elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') { |
|
| 1853 | + $setting['type'] = 'number'; |
|
| 1854 | + } elseif ($setting['type'] == 'string') { |
|
| 1855 | + $setting['type'] = 'text'; |
|
| 1856 | + } |
|
| 1769 | 1857 | |
| 1770 | - if (isset($setting['options'])) |
|
| 1771 | - $setting['type'] = 'list'; |
|
| 1858 | + if (isset($setting['options'])) { |
|
| 1859 | + $setting['type'] = 'list'; |
|
| 1860 | + } |
|
| 1772 | 1861 | |
| 1773 | 1862 | echo ' |
| 1774 | 1863 | <dt> |
| 1775 | 1864 | <label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>'; |
| 1776 | 1865 | |
| 1777 | - if (isset($setting['description'])) |
|
| 1778 | - echo ' |
|
| 1866 | + if (isset($setting['description'])) { |
|
| 1867 | + echo ' |
|
| 1779 | 1868 | <br> |
| 1780 | 1869 | <span class="smalltext">', $setting['description'], '</span>'; |
| 1870 | + } |
|
| 1781 | 1871 | echo ' |
| 1782 | 1872 | </dt> |
| 1783 | 1873 | <dd>'; |
| 1784 | 1874 | |
| 1785 | 1875 | // Display checkbox options |
| 1786 | - if ($setting['type'] == 'checkbox') |
|
| 1787 | - echo ' |
|
| 1876 | + if ($setting['type'] == 'checkbox') { |
|
| 1877 | + echo ' |
|
| 1788 | 1878 | <input type="hidden" name="default_options[' . $setting['id'] . ']" value="0"> |
| 1789 | 1879 | <input type="checkbox" name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', !empty($context['member']['options'][$setting['id']]) ? ' checked' : '', ' value="1">'; |
| 1880 | + } |
|
| 1790 | 1881 | |
| 1791 | 1882 | // How about selection lists, we all love them |
| 1792 | 1883 | elseif ($setting['type'] == 'list') |
@@ -1794,9 +1885,10 @@ discard block |
||
| 1794 | 1885 | echo ' |
| 1795 | 1886 | <select name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', '>'; |
| 1796 | 1887 | |
| 1797 | - foreach ($setting['options'] as $value => $label) |
|
| 1798 | - echo ' |
|
| 1888 | + foreach ($setting['options'] as $value => $label) { |
|
| 1889 | + echo ' |
|
| 1799 | 1890 | <option value="', $value, '"', $value == $context['member']['options'][$setting['id']] ? ' selected' : '', '>', $label, '</option>'; |
| 1891 | + } |
|
| 1800 | 1892 | |
| 1801 | 1893 | echo ' |
| 1802 | 1894 | </select>'; |
@@ -1812,14 +1904,13 @@ discard block |
||
| 1812 | 1904 | |
| 1813 | 1905 | echo ' |
| 1814 | 1906 | <input type="number"', $min . $max . $step; |
| 1815 | - } |
|
| 1816 | - elseif (isset($setting['type']) && $setting['type'] == 'url') |
|
| 1817 | - echo' |
|
| 1907 | + } elseif (isset($setting['type']) && $setting['type'] == 'url') { |
|
| 1908 | + echo' |
|
| 1818 | 1909 | <input type="url"'; |
| 1819 | - |
|
| 1820 | - else |
|
| 1821 | - echo ' |
|
| 1910 | + } else { |
|
| 1911 | + echo ' |
|
| 1822 | 1912 | <input type="text"'; |
| 1913 | + } |
|
| 1823 | 1914 | |
| 1824 | 1915 | echo ' name="default_options[', $setting['id'], ']" id="', $setting['id'], '" value="', isset($context['member']['options'][$setting['id']]) ? $context['member']['options'][$setting['id']] : $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : '', '>'; |
| 1825 | 1916 | } |
@@ -1856,8 +1947,8 @@ discard block |
||
| 1856 | 1947 | <dl class="settings">'; |
| 1857 | 1948 | |
| 1858 | 1949 | // Allow notification on announcements to be disabled? |
| 1859 | - if (!empty($modSettings['allow_disableAnnounce'])) |
|
| 1860 | - echo ' |
|
| 1950 | + if (!empty($modSettings['allow_disableAnnounce'])) { |
|
| 1951 | + echo ' |
|
| 1861 | 1952 | <dt> |
| 1862 | 1953 | <label for="notify_announcements">', $txt['notify_important_email'], '</label> |
| 1863 | 1954 | </dt> |
@@ -1865,15 +1956,17 @@ discard block |
||
| 1865 | 1956 | <input type="hidden" name="notify_announcements" value="0"> |
| 1866 | 1957 | <input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '> |
| 1867 | 1958 | </dd>'; |
| 1959 | + } |
|
| 1868 | 1960 | |
| 1869 | - if (!empty($modSettings['enable_ajax_alerts'])) |
|
| 1870 | - echo ' |
|
| 1961 | + if (!empty($modSettings['enable_ajax_alerts'])) { |
|
| 1962 | + echo ' |
|
| 1871 | 1963 | <dt> |
| 1872 | 1964 | <label for="notify_send_body">', $txt['notify_alert_timeout'], '</label> |
| 1873 | 1965 | </dt> |
| 1874 | 1966 | <dd> |
| 1875 | 1967 | <input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '"> |
| 1876 | 1968 | </dd>'; |
| 1969 | + } |
|
| 1877 | 1970 | |
| 1878 | 1971 | echo ' |
| 1879 | 1972 | </dl> |
@@ -1905,9 +1998,10 @@ discard block |
||
| 1905 | 1998 | |
| 1906 | 1999 | $label = $txt['alert_opt_' . $opts[1]]; |
| 1907 | 2000 | $label_pos = isset($opts['label']) ? $opts['label'] : ''; |
| 1908 | - if ($label_pos == 'before') |
|
| 1909 | - echo ' |
|
| 2001 | + if ($label_pos == 'before') { |
|
| 2002 | + echo ' |
|
| 1910 | 2003 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
| 2004 | + } |
|
| 1911 | 2005 | |
| 1912 | 2006 | $this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0; |
| 1913 | 2007 | switch ($opts[0]) |
@@ -1921,17 +2015,19 @@ discard block |
||
| 1921 | 2015 | echo ' |
| 1922 | 2016 | <select name="opt_', $opts[1], '" id="opt_', $opts[1], '">'; |
| 1923 | 2017 | |
| 1924 | - foreach ($opts['opts'] as $k => $v) |
|
| 1925 | - echo ' |
|
| 2018 | + foreach ($opts['opts'] as $k => $v) { |
|
| 2019 | + echo ' |
|
| 1926 | 2020 | <option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>'; |
| 2021 | + } |
|
| 1927 | 2022 | echo ' |
| 1928 | 2023 | </select>'; |
| 1929 | 2024 | break; |
| 1930 | 2025 | } |
| 1931 | 2026 | |
| 1932 | - if ($label_pos == 'after') |
|
| 1933 | - echo ' |
|
| 2027 | + if ($label_pos == 'after') { |
|
| 2028 | + echo ' |
|
| 1934 | 2029 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
| 2030 | + } |
|
| 1935 | 2031 | |
| 1936 | 2032 | echo ' |
| 1937 | 2033 | </td> |
@@ -2048,11 +2144,12 @@ discard block |
||
| 2048 | 2144 | <p class="information">', $txt['groupMembership_info'], '</p>'; |
| 2049 | 2145 | |
| 2050 | 2146 | // Do we have an update message? |
| 2051 | - if (!empty($context['update_message'])) |
|
| 2052 | - echo ' |
|
| 2147 | + if (!empty($context['update_message'])) { |
|
| 2148 | + echo ' |
|
| 2053 | 2149 | <div class="infobox"> |
| 2054 | 2150 | ', $context['update_message'], '. |
| 2055 | 2151 | </div>'; |
| 2152 | + } |
|
| 2056 | 2153 | |
| 2057 | 2154 | echo ' |
| 2058 | 2155 | <div id="groups">'; |
@@ -2074,8 +2171,7 @@ discard block |
||
| 2074 | 2171 | </div> |
| 2075 | 2172 | </div> |
| 2076 | 2173 | </div><!-- .groupmembership -->'; |
| 2077 | - } |
|
| 2078 | - else |
|
| 2174 | + } else |
|
| 2079 | 2175 | { |
| 2080 | 2176 | echo ' |
| 2081 | 2177 | <div class="title_bar"> |
@@ -2087,27 +2183,30 @@ discard block |
||
| 2087 | 2183 | echo ' |
| 2088 | 2184 | <div class="windowbg" id="primdiv_', $group['id'], '">'; |
| 2089 | 2185 | |
| 2090 | - if ($context['can_edit_primary']) |
|
| 2091 | - echo ' |
|
| 2186 | + if ($context['can_edit_primary']) { |
|
| 2187 | + echo ' |
|
| 2092 | 2188 | <input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '"', $group['is_primary'] ? ' checked' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');"', $group['can_be_primary'] ? '' : ' disabled', '>'; |
| 2189 | + } |
|
| 2093 | 2190 | |
| 2094 | 2191 | echo ' |
| 2095 | 2192 | <label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>'; |
| 2096 | 2193 | |
| 2097 | 2194 | // Can they leave their group? |
| 2098 | - if ($group['can_leave']) |
|
| 2099 | - echo ' |
|
| 2195 | + if ($group['can_leave']) { |
|
| 2196 | + echo ' |
|
| 2100 | 2197 | <a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>'; |
| 2198 | + } |
|
| 2101 | 2199 | |
| 2102 | 2200 | echo ' |
| 2103 | 2201 | </div><!-- .windowbg -->'; |
| 2104 | 2202 | } |
| 2105 | 2203 | |
| 2106 | - if ($context['can_edit_primary']) |
|
| 2107 | - echo ' |
|
| 2204 | + if ($context['can_edit_primary']) { |
|
| 2205 | + echo ' |
|
| 2108 | 2206 | <div class="padding righttext"> |
| 2109 | 2207 | <input type="submit" value="', $txt['make_primary'], '" class="button"> |
| 2110 | 2208 | </div>'; |
| 2209 | + } |
|
| 2111 | 2210 | |
| 2112 | 2211 | // Any groups they can join? |
| 2113 | 2212 | if (!empty($context['groups']['available'])) |
@@ -2123,17 +2222,16 @@ discard block |
||
| 2123 | 2222 | <div class="windowbg"> |
| 2124 | 2223 | <strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), ''; |
| 2125 | 2224 | |
| 2126 | - if ($group['type'] == 3) |
|
| 2127 | - echo ' |
|
| 2225 | + if ($group['type'] == 3) { |
|
| 2226 | + echo ' |
|
| 2128 | 2227 | <a href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '" class="button floatright">', $txt['join_group'], '</a>'; |
| 2129 | - |
|
| 2130 | - elseif ($group['type'] == 2 && $group['pending']) |
|
| 2131 | - echo ' |
|
| 2228 | + } elseif ($group['type'] == 2 && $group['pending']) { |
|
| 2229 | + echo ' |
|
| 2132 | 2230 | <span class="floatright">', $txt['approval_pending'], '</span>'; |
| 2133 | - |
|
| 2134 | - elseif ($group['type'] == 2) |
|
| 2135 | - echo ' |
|
| 2231 | + } elseif ($group['type'] == 2) { |
|
| 2232 | + echo ' |
|
| 2136 | 2233 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>'; |
| 2234 | + } |
|
| 2137 | 2235 | |
| 2138 | 2236 | echo ' |
| 2139 | 2237 | </div><!-- .windowbg -->'; |
@@ -2156,9 +2254,10 @@ discard block |
||
| 2156 | 2254 | |
| 2157 | 2255 | prevDiv.className = "windowbg"; |
| 2158 | 2256 | }'; |
| 2159 | - if (isset($context['groups']['member'][$context['primary_group']])) |
|
| 2160 | - echo ' |
|
| 2257 | + if (isset($context['groups']['member'][$context['primary_group']])) { |
|
| 2258 | + echo ' |
|
| 2161 | 2259 | highlightSelected("primdiv_' . $context['primary_group'] . '");'; |
| 2260 | + } |
|
| 2162 | 2261 | |
| 2163 | 2262 | echo ' |
| 2164 | 2263 | </script>'; |
@@ -2167,9 +2266,10 @@ discard block |
||
| 2167 | 2266 | echo ' |
| 2168 | 2267 | </div><!-- #groups -->'; |
| 2169 | 2268 | |
| 2170 | - if (!empty($context['token_check'])) |
|
| 2171 | - echo ' |
|
| 2269 | + if (!empty($context['token_check'])) { |
|
| 2270 | + echo ' |
|
| 2172 | 2271 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2272 | + } |
|
| 2173 | 2273 | |
| 2174 | 2274 | echo ' |
| 2175 | 2275 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2247,10 +2347,11 @@ discard block |
||
| 2247 | 2347 | |
| 2248 | 2348 | // Work out the starting warning. |
| 2249 | 2349 | $context['current_warning_mode'] = $context['warning_mode'][0]; |
| 2250 | - foreach ($context['warning_mode'] as $limit => $warning) |
|
| 2251 | - if ($context['member']['warning'] >= $limit) |
|
| 2350 | + foreach ($context['warning_mode'] as $limit => $warning) { |
|
| 2351 | + if ($context['member']['warning'] >= $limit) |
|
| 2252 | 2352 | $context['current_warning_mode'] = $warning; |
| 2253 | -} |
|
| 2353 | + } |
|
| 2354 | + } |
|
| 2254 | 2355 | |
| 2255 | 2356 | // Show all warnings of a user? |
| 2256 | 2357 | function template_viewWarning() |
@@ -2285,14 +2386,15 @@ discard block |
||
| 2285 | 2386 | </dd>'; |
| 2286 | 2387 | |
| 2287 | 2388 | // There's some impact of this? |
| 2288 | - if (!empty($context['level_effects'][$context['current_level']])) |
|
| 2289 | - echo ' |
|
| 2389 | + if (!empty($context['level_effects'][$context['current_level']])) { |
|
| 2390 | + echo ' |
|
| 2290 | 2391 | <dt> |
| 2291 | 2392 | <strong>', $txt['profile_viewwarning_impact'], ':</strong> |
| 2292 | 2393 | </dt> |
| 2293 | 2394 | <dd> |
| 2294 | 2395 | ', $context['level_effects'][$context['current_level']], ' |
| 2295 | 2396 | </dd>'; |
| 2397 | + } |
|
| 2296 | 2398 | |
| 2297 | 2399 | echo ' |
| 2298 | 2400 | </dl> |
@@ -2330,10 +2432,11 @@ discard block |
||
| 2330 | 2432 | |
| 2331 | 2433 | // Otherwise see what we can do...'; |
| 2332 | 2434 | |
| 2333 | - foreach ($context['notification_templates'] as $k => $type) |
|
| 2334 | - echo ' |
|
| 2435 | + foreach ($context['notification_templates'] as $k => $type) { |
|
| 2436 | + echo ' |
|
| 2335 | 2437 | if (index == ', $k, ') |
| 2336 | 2438 | document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";'; |
| 2439 | + } |
|
| 2337 | 2440 | |
| 2338 | 2441 | echo ' |
| 2339 | 2442 | } |
@@ -2343,10 +2446,11 @@ discard block |
||
| 2343 | 2446 | // Also set the right effect. |
| 2344 | 2447 | effectText = "";'; |
| 2345 | 2448 | |
| 2346 | - foreach ($context['level_effects'] as $limit => $text) |
|
| 2347 | - echo ' |
|
| 2449 | + foreach ($context['level_effects'] as $limit => $text) { |
|
| 2450 | + echo ' |
|
| 2348 | 2451 | if (slideAmount >= ', $limit, ') |
| 2349 | 2452 | effectText = "', $text, '";'; |
| 2453 | + } |
|
| 2350 | 2454 | |
| 2351 | 2455 | echo ' |
| 2352 | 2456 | setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\'); |
@@ -2361,32 +2465,35 @@ discard block |
||
| 2361 | 2465 | </h3> |
| 2362 | 2466 | </div>'; |
| 2363 | 2467 | |
| 2364 | - if (!$context['user']['is_owner']) |
|
| 2365 | - echo ' |
|
| 2468 | + if (!$context['user']['is_owner']) { |
|
| 2469 | + echo ' |
|
| 2366 | 2470 | <p class="information">', $txt['profile_warning_desc'], '</p>'; |
| 2471 | + } |
|
| 2367 | 2472 | |
| 2368 | 2473 | echo ' |
| 2369 | 2474 | <div class="windowbg"> |
| 2370 | 2475 | <dl class="settings">'; |
| 2371 | 2476 | |
| 2372 | - if (!$context['user']['is_owner']) |
|
| 2373 | - echo ' |
|
| 2477 | + if (!$context['user']['is_owner']) { |
|
| 2478 | + echo ' |
|
| 2374 | 2479 | <dt> |
| 2375 | 2480 | <strong>', $txt['profile_warning_name'], ':</strong> |
| 2376 | 2481 | </dt> |
| 2377 | 2482 | <dd> |
| 2378 | 2483 | <strong>', $context['member']['name'], '</strong> |
| 2379 | 2484 | </dd>'; |
| 2485 | + } |
|
| 2380 | 2486 | |
| 2381 | 2487 | echo ' |
| 2382 | 2488 | <dt> |
| 2383 | 2489 | <strong>', $txt['profile_warning_level'], ':</strong>'; |
| 2384 | 2490 | |
| 2385 | 2491 | // Is there only so much they can apply? |
| 2386 | - if ($context['warning_limit']) |
|
| 2387 | - echo ' |
|
| 2492 | + if ($context['warning_limit']) { |
|
| 2493 | + echo ' |
|
| 2388 | 2494 | <br> |
| 2389 | 2495 | <span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>'; |
| 2496 | + } |
|
| 2390 | 2497 | |
| 2391 | 2498 | echo ' |
| 2392 | 2499 | </dt> |
@@ -2441,9 +2548,10 @@ discard block |
||
| 2441 | 2548 | <option value="-1">', $txt['profile_warning_notify_template'], '</option> |
| 2442 | 2549 | <option value="-1" disabled>------------------------------</option>'; |
| 2443 | 2550 | |
| 2444 | - foreach ($context['notification_templates'] as $id_template => $template) |
|
| 2445 | - echo ' |
|
| 2551 | + foreach ($context['notification_templates'] as $id_template => $template) { |
|
| 2552 | + echo ' |
|
| 2446 | 2553 | <option value="', $id_template, '">', $template['title'], '</option>'; |
| 2554 | + } |
|
| 2447 | 2555 | |
| 2448 | 2556 | echo ' |
| 2449 | 2557 | </select> |
@@ -2456,9 +2564,10 @@ discard block |
||
| 2456 | 2564 | </dl> |
| 2457 | 2565 | <div class="righttext">'; |
| 2458 | 2566 | |
| 2459 | - if (!empty($context['token_check'])) |
|
| 2460 | - echo ' |
|
| 2567 | + if (!empty($context['token_check'])) { |
|
| 2568 | + echo ' |
|
| 2461 | 2569 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2570 | + } |
|
| 2462 | 2571 | |
| 2463 | 2572 | echo ' |
| 2464 | 2573 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2474,8 +2583,8 @@ discard block |
||
| 2474 | 2583 | echo ' |
| 2475 | 2584 | <script>'; |
| 2476 | 2585 | |
| 2477 | - if (!$context['user']['is_owner']) |
|
| 2478 | - echo ' |
|
| 2586 | + if (!$context['user']['is_owner']) { |
|
| 2587 | + echo ' |
|
| 2479 | 2588 | modifyWarnNotify(); |
| 2480 | 2589 | $(document).ready(function() { |
| 2481 | 2590 | $("#preview_button").click(function() { |
@@ -2514,6 +2623,7 @@ discard block |
||
| 2514 | 2623 | }); |
| 2515 | 2624 | return false; |
| 2516 | 2625 | }'; |
| 2626 | + } |
|
| 2517 | 2627 | |
| 2518 | 2628 | echo ' |
| 2519 | 2629 | </script>'; |
@@ -2536,17 +2646,19 @@ discard block |
||
| 2536 | 2646 | </div>'; |
| 2537 | 2647 | |
| 2538 | 2648 | // If deleting another account give them a lovely info box. |
| 2539 | - if (!$context['user']['is_owner']) |
|
| 2540 | - echo ' |
|
| 2649 | + if (!$context['user']['is_owner']) { |
|
| 2650 | + echo ' |
|
| 2541 | 2651 | <p class="information">', $txt['deleteAccount_desc'], '</p>'; |
| 2652 | + } |
|
| 2542 | 2653 | |
| 2543 | 2654 | echo ' |
| 2544 | 2655 | <div class="windowbg">'; |
| 2545 | 2656 | |
| 2546 | 2657 | // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;) |
| 2547 | - if ($context['needs_approval']) |
|
| 2548 | - echo ' |
|
| 2658 | + if ($context['needs_approval']) { |
|
| 2659 | + echo ' |
|
| 2549 | 2660 | <div class="errorbox">', $txt['deleteAccount_approval'], '</div>'; |
| 2661 | + } |
|
| 2550 | 2662 | |
| 2551 | 2663 | // If the user is deleting their own account warn them first - and require a password! |
| 2552 | 2664 | if ($context['user']['is_owner']) |
@@ -2558,9 +2670,10 @@ discard block |
||
| 2558 | 2670 | <input type="password" name="oldpasswrd" size="20"> |
| 2559 | 2671 | <input type="submit" value="', $txt['yes'], '" class="button">'; |
| 2560 | 2672 | |
| 2561 | - if (!empty($context['token_check'])) |
|
| 2562 | - echo ' |
|
| 2673 | + if (!empty($context['token_check'])) { |
|
| 2674 | + echo ' |
|
| 2563 | 2675 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2676 | + } |
|
| 2564 | 2677 | |
| 2565 | 2678 | echo ' |
| 2566 | 2679 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2590,10 +2703,11 @@ discard block |
||
| 2590 | 2703 | <option value="topics">', $txt['deleteAccount_topics'], '</option> |
| 2591 | 2704 | </select>'; |
| 2592 | 2705 | |
| 2593 | - if ($context['show_perma_delete']) |
|
| 2594 | - echo ' |
|
| 2706 | + if ($context['show_perma_delete']) { |
|
| 2707 | + echo ' |
|
| 2595 | 2708 | <br> |
| 2596 | 2709 | <label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>'; |
| 2710 | + } |
|
| 2597 | 2711 | |
| 2598 | 2712 | echo ' |
| 2599 | 2713 | </div>'; |
@@ -2606,9 +2720,10 @@ discard block |
||
| 2606 | 2720 | <div> |
| 2607 | 2721 | <input type="submit" value="', $txt['delete'], '" class="button">'; |
| 2608 | 2722 | |
| 2609 | - if (!empty($context['token_check'])) |
|
| 2610 | - echo ' |
|
| 2723 | + if (!empty($context['token_check'])) { |
|
| 2724 | + echo ' |
|
| 2611 | 2725 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2726 | + } |
|
| 2612 | 2727 | |
| 2613 | 2728 | echo ' |
| 2614 | 2729 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2634,8 +2749,8 @@ discard block |
||
| 2634 | 2749 | <hr>'; |
| 2635 | 2750 | |
| 2636 | 2751 | // Only show the password box if it's actually needed. |
| 2637 | - if ($context['require_password']) |
|
| 2638 | - echo ' |
|
| 2752 | + if ($context['require_password']) { |
|
| 2753 | + echo ' |
|
| 2639 | 2754 | <dl class="settings"> |
| 2640 | 2755 | <dt> |
| 2641 | 2756 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br> |
@@ -2645,13 +2760,15 @@ discard block |
||
| 2645 | 2760 | <input type="password" name="oldpasswrd" size="20"> |
| 2646 | 2761 | </dd> |
| 2647 | 2762 | </dl>'; |
| 2763 | + } |
|
| 2648 | 2764 | |
| 2649 | 2765 | echo ' |
| 2650 | 2766 | <div class="righttext">'; |
| 2651 | 2767 | |
| 2652 | - if (!empty($context['token_check'])) |
|
| 2653 | - echo ' |
|
| 2768 | + if (!empty($context['token_check'])) { |
|
| 2769 | + echo ' |
|
| 2654 | 2770 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2771 | + } |
|
| 2655 | 2772 | |
| 2656 | 2773 | echo ' |
| 2657 | 2774 | <input type="submit" value="', $txt['change_profile'], '" class="button"> |
@@ -2678,9 +2795,10 @@ discard block |
||
| 2678 | 2795 | <ul id="list_errors">'; |
| 2679 | 2796 | |
| 2680 | 2797 | // Cycle through each error and display an error message. |
| 2681 | - foreach ($context['post_errors'] as $error) |
|
| 2682 | - echo ' |
|
| 2798 | + foreach ($context['post_errors'] as $error) { |
|
| 2799 | + echo ' |
|
| 2683 | 2800 | <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>'; |
| 2801 | + } |
|
| 2684 | 2802 | |
| 2685 | 2803 | echo ' |
| 2686 | 2804 | </ul>'; |
@@ -2706,12 +2824,13 @@ discard block |
||
| 2706 | 2824 | <select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 && !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>'; |
| 2707 | 2825 | |
| 2708 | 2826 | // Fill the select box with all primary member groups that can be assigned to a member. |
| 2709 | - foreach ($context['member_groups'] as $member_group) |
|
| 2710 | - if (!empty($member_group['can_be_primary'])) |
|
| 2827 | + foreach ($context['member_groups'] as $member_group) { |
|
| 2828 | + if (!empty($member_group['can_be_primary'])) |
|
| 2711 | 2829 | echo ' |
| 2712 | 2830 | <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '> |
| 2713 | 2831 | ', $member_group['name'], ' |
| 2714 | 2832 | </option>'; |
| 2833 | + } |
|
| 2715 | 2834 | |
| 2716 | 2835 | echo ' |
| 2717 | 2836 | </select> |
@@ -2724,10 +2843,11 @@ discard block |
||
| 2724 | 2843 | <input type="hidden" name="additional_groups[]" value="0">'; |
| 2725 | 2844 | |
| 2726 | 2845 | // For each membergroup show a checkbox so members can be assigned to more than one group. |
| 2727 | - foreach ($context['member_groups'] as $member_group) |
|
| 2728 | - if ($member_group['can_be_additional']) |
|
| 2846 | + foreach ($context['member_groups'] as $member_group) { |
|
| 2847 | + if ($member_group['can_be_additional']) |
|
| 2729 | 2848 | echo ' |
| 2730 | 2849 | <label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked' : '', '> ', $member_group['name'], '</label><br>'; |
| 2850 | + } |
|
| 2731 | 2851 | |
| 2732 | 2852 | echo ' |
| 2733 | 2853 | </span> |
@@ -2787,9 +2907,10 @@ discard block |
||
| 2787 | 2907 | <span class="smalltext">', $txt['sig_info'], '</span><br> |
| 2788 | 2908 | <br>'; |
| 2789 | 2909 | |
| 2790 | - if ($context['show_spellchecking']) |
|
| 2791 | - echo ' |
|
| 2910 | + if ($context['show_spellchecking']) { |
|
| 2911 | + echo ' |
|
| 2792 | 2912 | <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">'; |
| 2913 | + } |
|
| 2793 | 2914 | |
| 2794 | 2915 | echo ' |
| 2795 | 2916 | </dt> |
@@ -2797,17 +2918,20 @@ discard block |
||
| 2797 | 2918 | <textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>'; |
| 2798 | 2919 | |
| 2799 | 2920 | // If there is a limit at all! |
| 2800 | - if (!empty($context['signature_limits']['max_length'])) |
|
| 2801 | - echo ' |
|
| 2921 | + if (!empty($context['signature_limits']['max_length'])) { |
|
| 2922 | + echo ' |
|
| 2802 | 2923 | <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>'; |
| 2924 | + } |
|
| 2803 | 2925 | |
| 2804 | - if (!empty($context['show_preview_button'])) |
|
| 2805 | - echo ' |
|
| 2926 | + if (!empty($context['show_preview_button'])) { |
|
| 2927 | + echo ' |
|
| 2806 | 2928 | <input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button floatright">'; |
| 2929 | + } |
|
| 2807 | 2930 | |
| 2808 | - if ($context['signature_warning']) |
|
| 2809 | - echo ' |
|
| 2931 | + if ($context['signature_warning']) { |
|
| 2932 | + echo ' |
|
| 2810 | 2933 | <span class="smalltext">', $context['signature_warning'], '</span>'; |
| 2934 | + } |
|
| 2811 | 2935 | |
| 2812 | 2936 | // Some javascript used to count how many characters have been used so far in the signature. |
| 2813 | 2937 | echo ' |
@@ -2838,38 +2962,43 @@ discard block |
||
| 2838 | 2962 | <label for="avatar_upload_box">', $txt['personal_picture'], '</label> |
| 2839 | 2963 | </strong>'; |
| 2840 | 2964 | |
| 2841 | - if (empty($modSettings['gravatarOverride'])) |
|
| 2842 | - echo ' |
|
| 2965 | + if (empty($modSettings['gravatarOverride'])) { |
|
| 2966 | + echo ' |
|
| 2843 | 2967 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_none" value="none"' . ($context['member']['avatar']['choice'] == 'none' ? ' checked="checked"' : '') . '> |
| 2844 | 2968 | <label for="avatar_choice_none"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '> |
| 2845 | 2969 | ' . $txt['no_avatar'] . ' |
| 2846 | 2970 | </label><br>'; |
| 2971 | + } |
|
| 2847 | 2972 | |
| 2848 | - if (!empty($context['member']['avatar']['allow_server_stored'])) |
|
| 2849 | - echo ' |
|
| 2973 | + if (!empty($context['member']['avatar']['allow_server_stored'])) { |
|
| 2974 | + echo ' |
|
| 2850 | 2975 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_server_stored" value="server_stored"' . ($context['member']['avatar']['choice'] == 'server_stored' ? ' checked="checked"' : '') . '> |
| 2851 | 2976 | <label for="avatar_choice_server_stored"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '> |
| 2852 | 2977 | ', $txt['choose_avatar_gallery'], ' |
| 2853 | 2978 | </label><br>'; |
| 2979 | + } |
|
| 2854 | 2980 | |
| 2855 | - if (!empty($context['member']['avatar']['allow_external'])) |
|
| 2856 | - echo ' |
|
| 2981 | + if (!empty($context['member']['avatar']['allow_external'])) { |
|
| 2982 | + echo ' |
|
| 2857 | 2983 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_external" value="external"' . ($context['member']['avatar']['choice'] == 'external' ? ' checked="checked"' : '') . '> |
| 2858 | 2984 | <label for="avatar_choice_external"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '> |
| 2859 | 2985 | ', $txt['my_own_pic'], ' |
| 2860 | 2986 | </label><br>'; |
| 2987 | + } |
|
| 2861 | 2988 | |
| 2862 | - if (!empty($context['member']['avatar']['allow_upload'])) |
|
| 2863 | - echo ' |
|
| 2989 | + if (!empty($context['member']['avatar']['allow_upload'])) { |
|
| 2990 | + echo ' |
|
| 2864 | 2991 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_upload" value="upload"' . ($context['member']['avatar']['choice'] == 'upload' ? ' checked="checked"' : '') . '> |
| 2865 | 2992 | <label for="avatar_choice_upload"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '> |
| 2866 | 2993 | ', $txt['avatar_will_upload'], ' |
| 2867 | 2994 | </label><br>'; |
| 2995 | + } |
|
| 2868 | 2996 | |
| 2869 | - if (!empty($context['member']['avatar']['allow_gravatar'])) |
|
| 2870 | - echo ' |
|
| 2997 | + if (!empty($context['member']['avatar']['allow_gravatar'])) { |
|
| 2998 | + echo ' |
|
| 2871 | 2999 | <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_gravatar" value="gravatar"' . ($context['member']['avatar']['choice'] == 'gravatar' ? ' checked="checked"' : '') . '> |
| 2872 | 3000 | <label for="avatar_choice_gravatar"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['use_gravatar'] . '</label>'; |
| 3001 | + } |
|
| 2873 | 3002 | |
| 2874 | 3003 | echo ' |
| 2875 | 3004 | </dt> |
@@ -2884,9 +3013,10 @@ discard block |
||
| 2884 | 3013 | <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">'; |
| 2885 | 3014 | |
| 2886 | 3015 | // This lists all the file categories. |
| 2887 | - foreach ($context['avatars'] as $avatar) |
|
| 2888 | - echo ' |
|
| 3016 | + foreach ($context['avatars'] as $avatar) { |
|
| 3017 | + echo ' |
|
| 2889 | 3018 | <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>'; |
| 3019 | + } |
|
| 2890 | 3020 | |
| 2891 | 3021 | echo ' |
| 2892 | 3022 | </select> |
@@ -2918,20 +3048,22 @@ discard block |
||
| 2918 | 3048 | } |
| 2919 | 3049 | |
| 2920 | 3050 | // If the user can link to an off server avatar, show them a box to input the address. |
| 2921 | - if (!empty($context['member']['avatar']['allow_external'])) |
|
| 2922 | - echo ' |
|
| 3051 | + if (!empty($context['member']['avatar']['allow_external'])) { |
|
| 3052 | + echo ' |
|
| 2923 | 3053 | <div id="avatar_external"> |
| 2924 | 3054 | <div class="smalltext">', $txt['avatar_by_url'], '</div>', !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_download_and_resize' ? template_max_size('external') : '', ' |
| 2925 | 3055 | <input type="text" name="userpicpersonal" size="45" value="', ((stristr($context['member']['avatar']['external'], 'http://') || stristr($context['member']['avatar']['external'], 'https://')) ? $context['member']['avatar']['external'] : 'http://'), '" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'external\');" onchange="if (typeof(previewExternalAvatar) != \'undefined\') previewExternalAvatar(this.value);"> |
| 2926 | 3056 | </div>'; |
| 3057 | + } |
|
| 2927 | 3058 | |
| 2928 | 3059 | // If the user is able to upload avatars to the server show them an upload box. |
| 2929 | - if (!empty($context['member']['avatar']['allow_upload'])) |
|
| 2930 | - echo ' |
|
| 3060 | + if (!empty($context['member']['avatar']['allow_upload'])) { |
|
| 3061 | + echo ' |
|
| 2931 | 3062 | <div id="avatar_upload"> |
| 2932 | 3063 | <input type="file" size="44" name="attachment" id="avatar_upload_box" value="" onchange="readfromUpload(this)" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'upload\');" accept="image/gif, image/jpeg, image/jpg, image/png">', template_max_size('upload'), ' |
| 2933 | 3064 | ', (!empty($context['member']['avatar']['id_attach']) ? '<br><img src="' . $context['member']['avatar']['href'] . (strpos($context['member']['avatar']['href'], '?') === false ? '?' : '&') . 'time=' . time() . '" alt="" id="attached_image"><input type="hidden" name="id_attach" value="' . $context['member']['avatar']['id_attach'] . '">' : ''), ' |
| 2934 | 3065 | </div>'; |
| 3066 | + } |
|
| 2935 | 3067 | |
| 2936 | 3068 | // if the user is able to use Gravatar avatars show then the image preview |
| 2937 | 3069 | if (!empty($context['member']['avatar']['allow_gravatar'])) |
@@ -2940,16 +3072,17 @@ discard block |
||
| 2940 | 3072 | <div id="avatar_gravatar"> |
| 2941 | 3073 | <img src="' . $context['member']['avatar']['href'] . '" alt="">'; |
| 2942 | 3074 | |
| 2943 | - if (empty($modSettings['gravatarAllowExtraEmail'])) |
|
| 2944 | - echo ' |
|
| 3075 | + if (empty($modSettings['gravatarAllowExtraEmail'])) { |
|
| 3076 | + echo ' |
|
| 2945 | 3077 | <div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>'; |
| 2946 | - else |
|
| 3078 | + } else |
|
| 2947 | 3079 | { |
| 2948 | 3080 | // Depending on other stuff, the stored value here might have some odd things in it from other areas. |
| 2949 | - if ($context['member']['avatar']['external'] == $context['member']['email']) |
|
| 2950 | - $textbox_value = ''; |
|
| 2951 | - else |
|
| 2952 | - $textbox_value = $context['member']['avatar']['external']; |
|
| 3081 | + if ($context['member']['avatar']['external'] == $context['member']['email']) { |
|
| 3082 | + $textbox_value = ''; |
|
| 3083 | + } else { |
|
| 3084 | + $textbox_value = $context['member']['avatar']['external']; |
|
| 3085 | + } |
|
| 2953 | 3086 | |
| 2954 | 3087 | echo ' |
| 2955 | 3088 | <div class="smalltext">', $txt['gravatar_alternateEmail'], '</div> |
@@ -3021,8 +3154,9 @@ discard block |
||
| 3021 | 3154 | $h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0; |
| 3022 | 3155 | |
| 3023 | 3156 | $suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : ''); |
| 3024 | - if (empty($suffix)) |
|
| 3025 | - return; |
|
| 3157 | + if (empty($suffix)) { |
|
| 3158 | + return; |
|
| 3159 | + } |
|
| 3026 | 3160 | |
| 3027 | 3161 | echo ' |
| 3028 | 3162 | <div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>'; |
@@ -3047,9 +3181,10 @@ discard block |
||
| 3047 | 3181 | <select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">'; |
| 3048 | 3182 | |
| 3049 | 3183 | // Help the user by showing a list of common time formats. |
| 3050 | - foreach ($context['easy_timeformats'] as $time_format) |
|
| 3051 | - echo ' |
|
| 3184 | + foreach ($context['easy_timeformats'] as $time_format) { |
|
| 3185 | + echo ' |
|
| 3052 | 3186 | <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>'; |
| 3187 | + } |
|
| 3053 | 3188 | |
| 3054 | 3189 | echo ' |
| 3055 | 3190 | </select> |
@@ -3087,9 +3222,10 @@ discard block |
||
| 3087 | 3222 | <dd> |
| 3088 | 3223 | <select name="smiley_set" id="smiley_set">'; |
| 3089 | 3224 | |
| 3090 | - foreach ($context['smiley_sets'] as $set) |
|
| 3091 | - echo ' |
|
| 3225 | + foreach ($context['smiley_sets'] as $set) { |
|
| 3226 | + echo ' |
|
| 3092 | 3227 | <option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>'; |
| 3228 | + } |
|
| 3093 | 3229 | |
| 3094 | 3230 | echo ' |
| 3095 | 3231 | </select> |
@@ -3111,17 +3247,17 @@ discard block |
||
| 3111 | 3247 | <div class="roundframe"> |
| 3112 | 3248 | <div>'; |
| 3113 | 3249 | |
| 3114 | - if (!empty($context['tfa_backup'])) |
|
| 3115 | - echo ' |
|
| 3250 | + if (!empty($context['tfa_backup'])) { |
|
| 3251 | + echo ' |
|
| 3116 | 3252 | <div class="smalltext error"> |
| 3117 | 3253 | ', $txt['tfa_backup_used_desc'], ' |
| 3118 | 3254 | </div>'; |
| 3119 | - |
|
| 3120 | - elseif ($modSettings['tfa_mode'] == 2) |
|
| 3121 | - echo ' |
|
| 3255 | + } elseif ($modSettings['tfa_mode'] == 2) { |
|
| 3256 | + echo ' |
|
| 3122 | 3257 | <div class="smalltext"> |
| 3123 | 3258 | <strong>', $txt['tfa_forced_desc'], '</strong> |
| 3124 | 3259 | </div>'; |
| 3260 | + } |
|
| 3125 | 3261 | |
| 3126 | 3262 | echo ' |
| 3127 | 3263 | <div class="smalltext"> |
@@ -3132,11 +3268,12 @@ discard block |
||
| 3132 | 3268 | <div class="block"> |
| 3133 | 3269 | <strong>', $txt['tfa_step1'], '</strong><br>'; |
| 3134 | 3270 | |
| 3135 | - if (!empty($context['tfa_pass_error'])) |
|
| 3136 | - echo ' |
|
| 3271 | + if (!empty($context['tfa_pass_error'])) { |
|
| 3272 | + echo ' |
|
| 3137 | 3273 | <div class="error smalltext"> |
| 3138 | 3274 | ', $txt['tfa_pass_invalid'], ' |
| 3139 | 3275 | </div>'; |
| 3276 | + } |
|
| 3140 | 3277 | |
| 3141 | 3278 | echo ' |
| 3142 | 3279 | <input type="password" name="passwd" size="25"', !empty($context['tfa_pass_error']) ? ' class="error"' : '', !empty($context['tfa_pass_value']) ? ' value="' . $context['tfa_pass_value'] . '"' : '', '> |
@@ -3149,11 +3286,12 @@ discard block |
||
| 3149 | 3286 | <div class="block"> |
| 3150 | 3287 | <strong>', $txt['tfa_step3'], '</strong><br>'; |
| 3151 | 3288 | |
| 3152 | - if (!empty($context['tfa_error'])) |
|
| 3153 | - echo ' |
|
| 3289 | + if (!empty($context['tfa_error'])) { |
|
| 3290 | + echo ' |
|
| 3154 | 3291 | <div class="error smalltext"> |
| 3155 | 3292 | ', $txt['tfa_code_invalid'], ' |
| 3156 | 3293 | </div>'; |
| 3294 | + } |
|
| 3157 | 3295 | |
| 3158 | 3296 | echo ' |
| 3159 | 3297 | <input type="text" name="tfa_code" size="25"', !empty($context['tfa_error']) ? ' class="error"' : '', !empty($context['tfa_value']) ? ' value="' . $context['tfa_value'] . '"' : '', '> |
@@ -3167,10 +3305,11 @@ discard block |
||
| 3167 | 3305 | <img src="', $context['tfa_qr_url'], '" alt=""> |
| 3168 | 3306 | </div>'; |
| 3169 | 3307 | |
| 3170 | - if (!empty($context['from_ajax'])) |
|
| 3171 | - echo ' |
|
| 3308 | + if (!empty($context['from_ajax'])) { |
|
| 3309 | + echo ' |
|
| 3172 | 3310 | <br> |
| 3173 | 3311 | <a href="javascript:self.close();"></a>'; |
| 3312 | + } |
|
| 3174 | 3313 | |
| 3175 | 3314 | echo ' |
| 3176 | 3315 | </div> |
@@ -3191,17 +3330,18 @@ discard block |
||
| 3191 | 3330 | <div class="roundframe"> |
| 3192 | 3331 | <form action="', $scripturl, '?action=profile;area=tfadisable" method="post">'; |
| 3193 | 3332 | |
| 3194 | - if ($context['user']['is_owner']) |
|
| 3195 | - echo ' |
|
| 3333 | + if ($context['user']['is_owner']) { |
|
| 3334 | + echo ' |
|
| 3196 | 3335 | <div class="block"> |
| 3197 | 3336 | <strong', (isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : ''), '>', $txt['current_password'], ': </strong><br> |
| 3198 | 3337 | <input type="password" name="oldpasswrd" size="20"> |
| 3199 | 3338 | </div>'; |
| 3200 | - else |
|
| 3201 | - echo ' |
|
| 3339 | + } else { |
|
| 3340 | + echo ' |
|
| 3202 | 3341 | <div class="smalltext"> |
| 3203 | 3342 | ', sprintf($txt['tfa_disable_for_user'], $context['user']['name']), ' |
| 3204 | 3343 | </div>'; |
| 3344 | + } |
|
| 3205 | 3345 | |
| 3206 | 3346 | echo ' |
| 3207 | 3347 | <input type="submit" name="save" value="', $txt['tfa_disable'], '" class="button floatright"> |
@@ -3244,17 +3384,16 @@ discard block |
||
| 3244 | 3384 | </dt> |
| 3245 | 3385 | <dd>'; |
| 3246 | 3386 | |
| 3247 | - if (!$context['tfa_enabled'] && $context['user']['is_owner']) |
|
| 3248 | - echo ' |
|
| 3387 | + if (!$context['tfa_enabled'] && $context['user']['is_owner']) { |
|
| 3388 | + echo ' |
|
| 3249 | 3389 | <a href="', !empty($modSettings['force_ssl']) ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>'; |
| 3250 | - |
|
| 3251 | - elseif (!$context['tfa_enabled']) |
|
| 3252 | - echo ' |
|
| 3390 | + } elseif (!$context['tfa_enabled']) { |
|
| 3391 | + echo ' |
|
| 3253 | 3392 | ', $txt['tfa_profile_disabled']; |
| 3254 | - |
|
| 3255 | - else |
|
| 3256 | - echo ' |
|
| 3393 | + } else { |
|
| 3394 | + echo ' |
|
| 3257 | 3395 | ', sprintf($txt['tfa_profile_enabled'], !empty($modSettings['force_ssl']) ? strtr($scripturl, array('http://' => 'https://')) : $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfadisable'); |
| 3396 | + } |
|
| 3258 | 3397 | |
| 3259 | 3398 | echo ' |
| 3260 | 3399 | </dd>'; |
@@ -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; |
@@ -68,8 +73,9 @@ discard block |
||
| 68 | 73 | |
| 69 | 74 | // Group management isn't actually a permission. But we need it to be for this, so we need a phantom permission. |
| 70 | 75 | // And we care about what the current user can do, not what the user whose profile it is. |
| 71 | - if ($user_info['mod_cache']['gq'] != '0=1') |
|
| 72 | - $user_info['permissions'][] = 'approve_group_requests'; |
|
| 76 | + if ($user_info['mod_cache']['gq'] != '0=1') { |
|
| 77 | + $user_info['permissions'][] = 'approve_group_requests'; |
|
| 78 | + } |
|
| 73 | 79 | |
| 74 | 80 | // If paid subscriptions are enabled, make sure we actually have at least one subscription available... |
| 75 | 81 | $context['subs_available'] = false; |
@@ -452,21 +458,25 @@ discard block |
||
| 452 | 458 | foreach ($section['areas'] as $area_id => $area) |
| 453 | 459 | { |
| 454 | 460 | // If it said no permissions that meant it wasn't valid! |
| 455 | - if (empty($area['permission'][$context['user']['is_owner'] ? 'own' : 'any'])) |
|
| 456 | - $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 | + } |
|
| 457 | 464 | // Otherwise pick the right set. |
| 458 | - else |
|
| 459 | - $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 | + } |
|
| 460 | 468 | |
| 461 | 469 | // Password required in most cases |
| 462 | - if (!empty($area['password'])) |
|
| 463 | - $context['password_areas'][] = $area_id; |
|
| 470 | + if (!empty($area['password'])) { |
|
| 471 | + $context['password_areas'][] = $area_id; |
|
| 472 | + } |
|
| 464 | 473 | } |
| 465 | 474 | } |
| 466 | 475 | |
| 467 | 476 | // Is there an updated message to show? |
| 468 | - if (isset($_GET['updated'])) |
|
| 469 | - $context['profile_updated'] = $txt['profile_updated_own']; |
|
| 477 | + if (isset($_GET['updated'])) { |
|
| 478 | + $context['profile_updated'] = $txt['profile_updated_own']; |
|
| 479 | + } |
|
| 470 | 480 | |
| 471 | 481 | // Set a few options for the menu. |
| 472 | 482 | $menuOptions = array( |
@@ -481,8 +491,9 @@ discard block |
||
| 481 | 491 | $profile_include_data = createMenu($profile_areas, $menuOptions); |
| 482 | 492 | |
| 483 | 493 | // No menu means no access. |
| 484 | - if (!$profile_include_data && (!$user_info['is_guest'] || validateSession())) |
|
| 485 | - fatal_lang_error('no_access', false); |
|
| 494 | + if (!$profile_include_data && (!$user_info['is_guest'] || validateSession())) { |
|
| 495 | + fatal_lang_error('no_access', false); |
|
| 496 | + } |
|
| 486 | 497 | |
| 487 | 498 | // Make a note of the Unique ID for this menu. |
| 488 | 499 | $context['profile_menu_id'] = $context['max_menu_id']; |
@@ -508,8 +519,9 @@ discard block |
||
| 508 | 519 | if ($current_area == $area_id) |
| 509 | 520 | { |
| 510 | 521 | // This can't happen - but is a security check. |
| 511 | - if ((isset($section['enabled']) && $section['enabled'] == false) || (isset($area['enabled']) && $area['enabled'] == false)) |
|
| 512 | - 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 | + } |
|
| 513 | 525 | |
| 514 | 526 | // Are we saving data in a valid area? |
| 515 | 527 | if (isset($area['sc']) && (isset($_REQUEST['save']) || $context['do_preview'])) |
@@ -528,12 +540,14 @@ discard block |
||
| 528 | 540 | } |
| 529 | 541 | |
| 530 | 542 | // Does this require session validating? |
| 531 | - if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner'])) |
|
| 532 | - $security_checks['validate'] = true; |
|
| 543 | + if (!empty($area['validate']) || (isset($_REQUEST['save']) && !$context['user']['is_owner'])) { |
|
| 544 | + $security_checks['validate'] = true; |
|
| 545 | + } |
|
| 533 | 546 | |
| 534 | 547 | // Permissions for good measure. |
| 535 | - if (!empty($profile_include_data['permission'])) |
|
| 536 | - $security_checks['permission'] = $profile_include_data['permission']; |
|
| 548 | + if (!empty($profile_include_data['permission'])) { |
|
| 549 | + $security_checks['permission'] = $profile_include_data['permission']; |
|
| 550 | + } |
|
| 537 | 551 | |
| 538 | 552 | // Either way got something. |
| 539 | 553 | $found_area = true; |
@@ -542,21 +556,26 @@ discard block |
||
| 542 | 556 | } |
| 543 | 557 | |
| 544 | 558 | // Oh dear, some serious security lapse is going on here... we'll put a stop to that! |
| 545 | - if (!$found_area) |
|
| 546 | - fatal_lang_error('no_access', false); |
|
| 559 | + if (!$found_area) { |
|
| 560 | + fatal_lang_error('no_access', false); |
|
| 561 | + } |
|
| 547 | 562 | |
| 548 | 563 | // Release this now. |
| 549 | 564 | unset($profile_areas); |
| 550 | 565 | |
| 551 | 566 | // Now the context is setup have we got any security checks to carry out additional to that above? |
| 552 | - if (isset($security_checks['session'])) |
|
| 553 | - checkSession($security_checks['session']); |
|
| 554 | - if (isset($security_checks['validate'])) |
|
| 555 | - validateSession(); |
|
| 556 | - if (isset($security_checks['validateToken'])) |
|
| 557 | - validateToken($token_name, $token_type); |
|
| 558 | - if (isset($security_checks['permission'])) |
|
| 559 | - 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 | + } |
|
| 560 | 579 | |
| 561 | 580 | // Create a token if needed. |
| 562 | 581 | if (isset($security_checks['needsToken']) || isset($security_checks['validateToken'])) |
@@ -566,8 +585,9 @@ discard block |
||
| 566 | 585 | } |
| 567 | 586 | |
| 568 | 587 | // File to include? |
| 569 | - if (isset($profile_include_data['file'])) |
|
| 570 | - require_once($sourcedir . '/' . $profile_include_data['file']); |
|
| 588 | + if (isset($profile_include_data['file'])) { |
|
| 589 | + require_once($sourcedir . '/' . $profile_include_data['file']); |
|
| 590 | + } |
|
| 571 | 591 | |
| 572 | 592 | // Build the link tree. |
| 573 | 593 | $context['linktree'][] = array( |
@@ -575,17 +595,19 @@ discard block |
||
| 575 | 595 | 'name' => sprintf($txt['profile_of_username'], $context['member']['name']), |
| 576 | 596 | ); |
| 577 | 597 | |
| 578 | - if (!empty($profile_include_data['label'])) |
|
| 579 | - $context['linktree'][] = array( |
|
| 598 | + if (!empty($profile_include_data['label'])) { |
|
| 599 | + $context['linktree'][] = array( |
|
| 580 | 600 | 'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'], |
| 581 | 601 | 'name' => $profile_include_data['label'], |
| 582 | 602 | ); |
| 603 | + } |
|
| 583 | 604 | |
| 584 | - if (!empty($profile_include_data['current_subsection']) && $profile_include_data['subsections'][$profile_include_data['current_subsection']][0] != $profile_include_data['label']) |
|
| 585 | - $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( |
|
| 586 | 607 | 'url' => $scripturl . '?action=profile' . ($memID != $user_info['id'] ? ';u=' . $memID : '') . ';area=' . $profile_include_data['current_area'] . ';sa=' . $profile_include_data['current_subsection'], |
| 587 | 608 | 'name' => $profile_include_data['subsections'][$profile_include_data['current_subsection']][0], |
| 588 | 609 | ); |
| 610 | + } |
|
| 589 | 611 | |
| 590 | 612 | // Set the template for this area and add the profile layer. |
| 591 | 613 | $context['sub_template'] = $profile_include_data['function']; |
@@ -611,12 +633,14 @@ discard block |
||
| 611 | 633 | if ($check_password) |
| 612 | 634 | { |
| 613 | 635 | // Check to ensure we're forcing SSL for authentication |
| 614 | - if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) |
|
| 615 | - fatal_lang_error('login_ssl_required'); |
|
| 636 | + if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) { |
|
| 637 | + fatal_lang_error('login_ssl_required'); |
|
| 638 | + } |
|
| 616 | 639 | |
| 617 | 640 | // You didn't even enter a password! |
| 618 | - if (trim($_POST['oldpasswrd']) == '') |
|
| 619 | - $post_errors[] = 'no_password'; |
|
| 641 | + if (trim($_POST['oldpasswrd']) == '') { |
|
| 642 | + $post_errors[] = 'no_password'; |
|
| 643 | + } |
|
| 620 | 644 | |
| 621 | 645 | // Since the password got modified due to all the $_POST cleaning, lets undo it so we can get the correct password |
| 622 | 646 | $_POST['oldpasswrd'] = un_htmlspecialchars($_POST['oldpasswrd']); |
@@ -625,50 +649,50 @@ discard block |
||
| 625 | 649 | $good_password = in_array(true, call_integration_hook('integrate_verify_password', array($cur_profile['member_name'], $_POST['oldpasswrd'], false)), true); |
| 626 | 650 | |
| 627 | 651 | // Bad password!!! |
| 628 | - if (!$good_password && !hash_verify_password($user_profile[$memID]['member_name'], un_htmlspecialchars(stripslashes($_POST['oldpasswrd'])), $user_info['passwd'])) |
|
| 629 | - $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 | + } |
|
| 630 | 655 | |
| 631 | 656 | // Warn other elements not to jump the gun and do custom changes! |
| 632 | - if (in_array('bad_password', $post_errors)) |
|
| 633 | - $context['password_auth_failed'] = true; |
|
| 657 | + if (in_array('bad_password', $post_errors)) { |
|
| 658 | + $context['password_auth_failed'] = true; |
|
| 659 | + } |
|
| 634 | 660 | } |
| 635 | 661 | |
| 636 | 662 | // Change the IP address in the database. |
| 637 | - if ($context['user']['is_owner']) |
|
| 638 | - $profile_vars['member_ip'] = $user_info['ip']; |
|
| 663 | + if ($context['user']['is_owner']) { |
|
| 664 | + $profile_vars['member_ip'] = $user_info['ip']; |
|
| 665 | + } |
|
| 639 | 666 | |
| 640 | 667 | // Now call the sub-action function... |
| 641 | 668 | if ($current_area == 'activateaccount') |
| 642 | 669 | { |
| 643 | - if (empty($post_errors)) |
|
| 644 | - activateAccount($memID); |
|
| 645 | - } |
|
| 646 | - elseif ($current_area == 'deleteaccount') |
|
| 670 | + if (empty($post_errors)) { |
|
| 671 | + activateAccount($memID); |
|
| 672 | + } |
|
| 673 | + } elseif ($current_area == 'deleteaccount') |
|
| 647 | 674 | { |
| 648 | 675 | if (empty($post_errors)) |
| 649 | 676 | { |
| 650 | 677 | deleteAccount2($memID); |
| 651 | 678 | redirectexit(); |
| 652 | 679 | } |
| 653 | - } |
|
| 654 | - elseif ($current_area == 'tfadisable') |
|
| 680 | + } elseif ($current_area == 'tfadisable') |
|
| 655 | 681 | { |
| 656 | 682 | // Already checked the password, token, permissions, and session. |
| 657 | 683 | $profile_vars += array( |
| 658 | 684 | 'tfa_secret' => '', |
| 659 | 685 | 'tfa_backup' => '', |
| 660 | 686 | ); |
| 661 | - } |
|
| 662 | - elseif ($current_area == 'groupmembership' && empty($post_errors)) |
|
| 687 | + } elseif ($current_area == 'groupmembership' && empty($post_errors)) |
|
| 663 | 688 | { |
| 664 | 689 | $msg = groupMembership2($profile_vars, $post_errors, $memID); |
| 665 | 690 | |
| 666 | 691 | // Whatever we've done, we have nothing else to do here... |
| 667 | 692 | redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=groupmembership' . (!empty($msg) ? ';msg=' . $msg : '')); |
| 668 | - } |
|
| 669 | - elseif (in_array($current_area, array('account', 'forumprofile', 'theme'))) |
|
| 670 | - saveProfileFields(); |
|
| 671 | - else |
|
| 693 | + } elseif (in_array($current_area, array('account', 'forumprofile', 'theme'))) { |
|
| 694 | + saveProfileFields(); |
|
| 695 | + } else |
|
| 672 | 696 | { |
| 673 | 697 | $force_redirect = true; |
| 674 | 698 | // Ensure we include this. |
@@ -684,34 +708,36 @@ discard block |
||
| 684 | 708 | // Load the language file so we can give a nice explanation of the errors. |
| 685 | 709 | loadLanguage('Errors'); |
| 686 | 710 | $context['post_errors'] = $post_errors; |
| 687 | - } |
|
| 688 | - elseif (!empty($profile_vars)) |
|
| 711 | + } elseif (!empty($profile_vars)) |
|
| 689 | 712 | { |
| 690 | 713 | // If we've changed the password, notify any integration that may be listening in. |
| 691 | - if (isset($profile_vars['passwd'])) |
|
| 692 | - call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2'])); |
|
| 714 | + if (isset($profile_vars['passwd'])) { |
|
| 715 | + call_integration_hook('integrate_reset_pass', array($cur_profile['member_name'], $cur_profile['member_name'], $_POST['passwrd2'])); |
|
| 716 | + } |
|
| 693 | 717 | |
| 694 | 718 | updateMemberData($memID, $profile_vars); |
| 695 | 719 | |
| 696 | 720 | // What if this is the newest member? |
| 697 | - if ($modSettings['latestMember'] == $memID) |
|
| 698 | - updateStats('member'); |
|
| 699 | - elseif (isset($profile_vars['real_name'])) |
|
| 700 | - updateSettings(array('memberlist_updated' => time())); |
|
| 721 | + if ($modSettings['latestMember'] == $memID) { |
|
| 722 | + updateStats('member'); |
|
| 723 | + } elseif (isset($profile_vars['real_name'])) { |
|
| 724 | + updateSettings(array('memberlist_updated' => time())); |
|
| 725 | + } |
|
| 701 | 726 | |
| 702 | 727 | // If the member changed his/her birthdate, update calendar statistics. |
| 703 | - if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name'])) |
|
| 704 | - updateSettings(array( |
|
| 728 | + if (isset($profile_vars['birthdate']) || isset($profile_vars['real_name'])) { |
|
| 729 | + updateSettings(array( |
|
| 705 | 730 | 'calendar_updated' => time(), |
| 706 | 731 | )); |
| 732 | + } |
|
| 707 | 733 | |
| 708 | 734 | // Anything worth logging? |
| 709 | 735 | if (!empty($context['log_changes']) && !empty($modSettings['modlog_enabled'])) |
| 710 | 736 | { |
| 711 | 737 | $log_changes = array(); |
| 712 | 738 | require_once($sourcedir . '/Logging.php'); |
| 713 | - foreach ($context['log_changes'] as $k => $v) |
|
| 714 | - $log_changes[] = array( |
|
| 739 | + foreach ($context['log_changes'] as $k => $v) { |
|
| 740 | + $log_changes[] = array( |
|
| 715 | 741 | 'action' => $k, |
| 716 | 742 | 'log_type' => 'user', |
| 717 | 743 | 'extra' => array_merge($v, array( |
@@ -719,14 +745,16 @@ discard block |
||
| 719 | 745 | 'member_affected' => $memID, |
| 720 | 746 | )), |
| 721 | 747 | ); |
| 748 | + } |
|
| 722 | 749 | |
| 723 | 750 | logActions($log_changes); |
| 724 | 751 | } |
| 725 | 752 | |
| 726 | 753 | // Have we got any post save functions to execute? |
| 727 | - if (!empty($context['profile_execute_on_save'])) |
|
| 728 | - foreach ($context['profile_execute_on_save'] as $saveFunc) |
|
| 754 | + if (!empty($context['profile_execute_on_save'])) { |
|
| 755 | + foreach ($context['profile_execute_on_save'] as $saveFunc) |
|
| 729 | 756 | $saveFunc(); |
| 757 | + } |
|
| 730 | 758 | |
| 731 | 759 | // Let them know it worked! |
| 732 | 760 | $context['profile_updated'] = $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $cur_profile['member_name']); |
@@ -740,27 +768,31 @@ discard block |
||
| 740 | 768 | if (!empty($post_errors)) |
| 741 | 769 | { |
| 742 | 770 | // Set all the errors so the template knows what went wrong. |
| 743 | - foreach ($post_errors as $error_type) |
|
| 744 | - $context['modify_error'][$error_type] = true; |
|
| 771 | + foreach ($post_errors as $error_type) { |
|
| 772 | + $context['modify_error'][$error_type] = true; |
|
| 773 | + } |
|
| 745 | 774 | } |
| 746 | 775 | // If it's you then we should redirect upon save. |
| 747 | - elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview']) |
|
| 748 | - redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated'); |
|
| 749 | - elseif (!empty($force_redirect)) |
|
| 750 | - redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area); |
|
| 776 | + elseif (!empty($profile_vars) && $context['user']['is_owner'] && !$context['do_preview']) { |
|
| 777 | + redirectexit('action=profile;area=' . $current_area . (!empty($current_sa) ? ';sa=' . $current_sa : '') . ';updated'); |
|
| 778 | + } elseif (!empty($force_redirect)) { |
|
| 779 | + redirectexit('action=profile' . ($context['user']['is_owner'] ? '' : ';u=' . $memID) . ';area=' . $current_area); |
|
| 780 | + } |
|
| 751 | 781 | |
| 752 | 782 | |
| 753 | 783 | // Get the right callable. |
| 754 | 784 | $call = call_helper($profile_include_data['function'], true); |
| 755 | 785 | |
| 756 | 786 | // Is it valid? |
| 757 | - if (!empty($call)) |
|
| 758 | - call_user_func($call, $memID); |
|
| 787 | + if (!empty($call)) { |
|
| 788 | + call_user_func($call, $memID); |
|
| 789 | + } |
|
| 759 | 790 | |
| 760 | 791 | // Set the page title if it's not already set... |
| 761 | - if (!isset($context['page_title'])) |
|
| 762 | - $context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : ''); |
|
| 763 | -} |
|
| 792 | + if (!isset($context['page_title'])) { |
|
| 793 | + $context['page_title'] = $txt['profile'] . (isset($txt[$current_area]) ? ' - ' . $txt[$current_area] : ''); |
|
| 794 | + } |
|
| 795 | + } |
|
| 764 | 796 | |
| 765 | 797 | /** |
| 766 | 798 | * Set up the requirements for the profile popup - the area that is shown as the popup menu for the current user. |
@@ -883,16 +915,18 @@ discard block |
||
| 883 | 915 | if (!allowedTo('admin_forum') && $area != 'register') |
| 884 | 916 | { |
| 885 | 917 | // If it's the owner they can see two types of private fields, regardless. |
| 886 | - if ($memID == $user_info['id']) |
|
| 887 | - $where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)'; |
|
| 888 | - else |
|
| 889 | - $where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0'; |
|
| 918 | + if ($memID == $user_info['id']) { |
|
| 919 | + $where .= $area == 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)'; |
|
| 920 | + } else { |
|
| 921 | + $where .= $area == 'summary' ? ' AND private < 2' : ' AND private = 0'; |
|
| 922 | + } |
|
| 890 | 923 | } |
| 891 | 924 | |
| 892 | - if ($area == 'register') |
|
| 893 | - $where .= ' AND show_reg != 0'; |
|
| 894 | - elseif ($area != 'summary') |
|
| 895 | - $where .= ' AND show_profile = {string:area}'; |
|
| 925 | + if ($area == 'register') { |
|
| 926 | + $where .= ' AND show_reg != 0'; |
|
| 927 | + } elseif ($area != 'summary') { |
|
| 928 | + $where .= ' AND show_profile = {string:area}'; |
|
| 929 | + } |
|
| 896 | 930 | |
| 897 | 931 | // Load all the relevant fields - and data. |
| 898 | 932 | $request = $smcFunc['db_query']('', ' |
@@ -920,8 +954,9 @@ discard block |
||
| 920 | 954 | $fieldOptions = explode(',', $row['field_options']); |
| 921 | 955 | foreach ($fieldOptions as $k => $v) |
| 922 | 956 | { |
| 923 | - if (empty($currentKey)) |
|
| 924 | - $currentKey = $v === $value ? $k : 0; |
|
| 957 | + if (empty($currentKey)) { |
|
| 958 | + $currentKey = $v === $value ? $k : 0; |
|
| 959 | + } |
|
| 925 | 960 | } |
| 926 | 961 | } |
| 927 | 962 | |
@@ -929,13 +964,15 @@ discard block |
||
| 929 | 964 | if (isset($_POST['customfield']) && isset($_POST['customfield'][$row['col_name']])) |
| 930 | 965 | { |
| 931 | 966 | $value = $smcFunc['htmlspecialchars']($_POST['customfield'][$row['col_name']]); |
| 932 | - if (in_array($row['field_type'], array('select', 'radio'))) |
|
| 933 | - $value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : ''; |
|
| 967 | + if (in_array($row['field_type'], array('select', 'radio'))) { |
|
| 968 | + $value = ($options = explode(',', $row['field_options'])) && isset($options[$value]) ? $options[$value] : ''; |
|
| 969 | + } |
|
| 934 | 970 | } |
| 935 | 971 | |
| 936 | 972 | // Don't show the "disabled" option for the "gender" field if we are on the "summary" area. |
| 937 | - if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'None') |
|
| 938 | - continue; |
|
| 973 | + if ($area == 'summary' && $row['col_name'] == 'cust_gender' && $value == 'None') { |
|
| 974 | + continue; |
|
| 975 | + } |
|
| 939 | 976 | |
| 940 | 977 | // HTML for the input form. |
| 941 | 978 | $output_html = $value; |
@@ -944,8 +981,7 @@ discard block |
||
| 944 | 981 | $true = (!$exists && $row['default_value']) || $value; |
| 945 | 982 | $input_html = '<input type="checkbox" name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"' . ($true ? ' checked' : '') . '>'; |
| 946 | 983 | $output_html = $true ? $txt['yes'] : $txt['no']; |
| 947 | - } |
|
| 948 | - elseif ($row['field_type'] == 'select') |
|
| 984 | + } elseif ($row['field_type'] == 'select') |
|
| 949 | 985 | { |
| 950 | 986 | $input_html = '<select name="customfield[' . $row['col_name'] . ']" id="customfield[' . $row['col_name'] . ']"><option value="-1"></option>'; |
| 951 | 987 | $options = explode(',', $row['field_options']); |
@@ -953,13 +989,13 @@ discard block |
||
| 953 | 989 | { |
| 954 | 990 | $true = (!$exists && $row['default_value'] == $v) || $value == $v; |
| 955 | 991 | $input_html .= '<option value="' . $k . '"' . ($true ? ' selected' : '') . '>' . $v . '</option>'; |
| 956 | - if ($true) |
|
| 957 | - $output_html = $v; |
|
| 992 | + if ($true) { |
|
| 993 | + $output_html = $v; |
|
| 994 | + } |
|
| 958 | 995 | } |
| 959 | 996 | |
| 960 | 997 | $input_html .= '</select>'; |
| 961 | - } |
|
| 962 | - elseif ($row['field_type'] == 'radio') |
|
| 998 | + } elseif ($row['field_type'] == 'radio') |
|
| 963 | 999 | { |
| 964 | 1000 | $input_html = '<fieldset>'; |
| 965 | 1001 | $options = explode(',', $row['field_options']); |
@@ -967,37 +1003,38 @@ discard block |
||
| 967 | 1003 | { |
| 968 | 1004 | $true = (!$exists && $row['default_value'] == $v) || $value == $v; |
| 969 | 1005 | $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>'; |
| 970 | - if ($true) |
|
| 971 | - $output_html = $v; |
|
| 1006 | + if ($true) { |
|
| 1007 | + $output_html = $v; |
|
| 1008 | + } |
|
| 972 | 1009 | } |
| 973 | 1010 | $input_html .= '</fieldset>'; |
| 974 | - } |
|
| 975 | - elseif ($row['field_type'] == 'text') |
|
| 1011 | + } elseif ($row['field_type'] == 'text') |
|
| 976 | 1012 | { |
| 977 | 1013 | $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' : '') . '>'; |
| 978 | - } |
|
| 979 | - else |
|
| 1014 | + } else |
|
| 980 | 1015 | { |
| 981 | 1016 | @list ($rows, $cols) = @explode(',', $row['default_value']); |
| 982 | 1017 | $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>'; |
| 983 | 1018 | } |
| 984 | 1019 | |
| 985 | 1020 | // Parse BBCode |
| 986 | - if ($row['bbc']) |
|
| 987 | - $output_html = parse_bbc($output_html); |
|
| 988 | - elseif ($row['field_type'] == 'textarea') |
|
| 989 | - // Allow for newlines at least |
|
| 1021 | + if ($row['bbc']) { |
|
| 1022 | + $output_html = parse_bbc($output_html); |
|
| 1023 | + } elseif ($row['field_type'] == 'textarea') { |
|
| 1024 | + // Allow for newlines at least |
|
| 990 | 1025 | $output_html = strtr($output_html, array("\n" => '<br>')); |
| 1026 | + } |
|
| 991 | 1027 | |
| 992 | 1028 | // Enclosing the user input within some other text? |
| 993 | - if (!empty($row['enclose']) && !empty($output_html)) |
|
| 994 | - $output_html = strtr($row['enclose'], array( |
|
| 1029 | + if (!empty($row['enclose']) && !empty($output_html)) { |
|
| 1030 | + $output_html = strtr($row['enclose'], array( |
|
| 995 | 1031 | '{SCRIPTURL}' => $scripturl, |
| 996 | 1032 | '{IMAGES_URL}' => $settings['images_url'], |
| 997 | 1033 | '{DEFAULT_IMAGES_URL}' => $settings['default_images_url'], |
| 998 | 1034 | '{INPUT}' => un_htmlspecialchars($output_html), |
| 999 | 1035 | '{KEY}' => $currentKey |
| 1000 | 1036 | )); |
| 1037 | + } |
|
| 1001 | 1038 | |
| 1002 | 1039 | $context['custom_fields'][] = array( |
| 1003 | 1040 | 'name' => $row['field_name'], |
@@ -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 | * This defines every profile field known to man. |
@@ -29,8 +30,9 @@ discard block |
||
| 29 | 30 | global $sourcedir, $profile_vars; |
| 30 | 31 | |
| 31 | 32 | // Don't load this twice! |
| 32 | - if (!empty($profile_fields) && !$force_reload) |
|
| 33 | - return; |
|
| 33 | + if (!empty($profile_fields) && !$force_reload) { |
|
| 34 | + return; |
|
| 35 | + } |
|
| 34 | 36 | |
| 35 | 37 | /* This horrific array defines all the profile fields in the whole world! |
| 36 | 38 | In general each "field" has one array - the key of which is the database column name associated with said field. Each item |
@@ -103,13 +105,14 @@ discard block |
||
| 103 | 105 | if (isset($_POST['bday2'], $_POST['bday3']) && $value > 0 && $_POST['bday2'] > 0) |
| 104 | 106 | { |
| 105 | 107 | // Set to blank? |
| 106 | - if ((int) $_POST['bday3'] == 1 && (int) $_POST['bday2'] == 1 && (int) $value == 1) |
|
| 107 | - $value = '1004-01-01'; |
|
| 108 | - else |
|
| 109 | - $value = checkdate($value, $_POST['bday2'], $_POST['bday3'] < 1004 ? 1004 : $_POST['bday3']) ? sprintf('%04d-%02d-%02d', $_POST['bday3'] < 1004 ? 1004 : $_POST['bday3'], $_POST['bday1'], $_POST['bday2']) : '1004-01-01'; |
|
| 108 | + if ((int) $_POST['bday3'] == 1 && (int) $_POST['bday2'] == 1 && (int) $value == 1) { |
|
| 109 | + $value = '1004-01-01'; |
|
| 110 | + } else { |
|
| 111 | + $value = checkdate($value, $_POST['bday2'], $_POST['bday3'] < 1004 ? 1004 : $_POST['bday3']) ? sprintf('%04d-%02d-%02d', $_POST['bday3'] < 1004 ? 1004 : $_POST['bday3'], $_POST['bday1'], $_POST['bday2']) : '1004-01-01'; |
|
| 112 | + } |
|
| 113 | + } else { |
|
| 114 | + $value = '1004-01-01'; |
|
| 110 | 115 | } |
| 111 | - else |
|
| 112 | - $value = '1004-01-01'; |
|
| 113 | 116 | |
| 114 | 117 | $profile_vars['birthdate'] = $value; |
| 115 | 118 | $cur_profile['birthdate'] = $value; |
@@ -127,8 +130,7 @@ discard block |
||
| 127 | 130 | { |
| 128 | 131 | $value = checkdate($dates[2], $dates[3], $dates[1] < 4 ? 4 : $dates[1]) ? sprintf('%04d-%02d-%02d', $dates[1] < 4 ? 4 : $dates[1], $dates[2], $dates[3]) : '1004-01-01'; |
| 129 | 132 | return true; |
| 130 | - } |
|
| 131 | - else |
|
| 133 | + } else |
|
| 132 | 134 | { |
| 133 | 135 | $value = empty($cur_profile['birthdate']) ? '1004-01-01' : $cur_profile['birthdate']; |
| 134 | 136 | return false; |
@@ -150,10 +152,11 @@ discard block |
||
| 150 | 152 | return $txt['invalid_registration'] . ' ' . strftime('%d %b %Y ' . (strpos($user_info['time_format'], '%H') !== false ? '%I:%M:%S %p' : '%H:%M:%S'), forum_time(false)); |
| 151 | 153 | } |
| 152 | 154 | // As long as it doesn't equal "N/A"... |
| 153 | - elseif ($value != $txt['not_applicable'] && $value != strtotime(strftime('%Y-%m-%d', $cur_profile['date_registered'] + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600))) |
|
| 154 | - $value = $value - ($user_info['time_offset'] + $modSettings['time_offset']) * 3600; |
|
| 155 | - else |
|
| 156 | - $value = $cur_profile['date_registered']; |
|
| 155 | + elseif ($value != $txt['not_applicable'] && $value != strtotime(strftime('%Y-%m-%d', $cur_profile['date_registered'] + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600))) { |
|
| 156 | + $value = $value - ($user_info['time_offset'] + $modSettings['time_offset']) * 3600; |
|
| 157 | + } else { |
|
| 158 | + $value = $cur_profile['date_registered']; |
|
| 159 | + } |
|
| 157 | 160 | |
| 158 | 161 | return true; |
| 159 | 162 | }, |
@@ -177,8 +180,9 @@ discard block |
||
| 177 | 180 | { |
| 178 | 181 | global $context, $old_profile, $profile_vars, $sourcedir, $modSettings; |
| 179 | 182 | |
| 180 | - if (strtolower($value) == strtolower($old_profile['email_address'])) |
|
| 181 | - return false; |
|
| 183 | + if (strtolower($value) == strtolower($old_profile['email_address'])) { |
|
| 184 | + return false; |
|
| 185 | + } |
|
| 182 | 186 | |
| 183 | 187 | $isValid = profileValidateEmail($value, $context['id_member']); |
| 184 | 188 | |
@@ -254,11 +258,11 @@ discard block |
||
| 254 | 258 | |
| 255 | 259 | if (isset($context['profile_languages'][$value])) |
| 256 | 260 | { |
| 257 | - if ($context['user']['is_owner'] && empty($context['password_auth_failed'])) |
|
| 258 | - $_SESSION['language'] = $value; |
|
| 261 | + if ($context['user']['is_owner'] && empty($context['password_auth_failed'])) { |
|
| 262 | + $_SESSION['language'] = $value; |
|
| 263 | + } |
|
| 259 | 264 | return true; |
| 260 | - } |
|
| 261 | - else |
|
| 265 | + } else |
|
| 262 | 266 | { |
| 263 | 267 | $value = $cur_profile['lngfile']; |
| 264 | 268 | return false; |
@@ -282,13 +286,14 @@ discard block |
||
| 282 | 286 | |
| 283 | 287 | // Maybe they are trying to change their password as well? |
| 284 | 288 | $resetPassword = true; |
| 285 | - if (isset($_POST['passwrd1']) && $_POST['passwrd1'] != '' && isset($_POST['passwrd2']) && $_POST['passwrd1'] == $_POST['passwrd2'] && validatePassword($_POST['passwrd1'], $value, array($cur_profile['real_name'], $user_info['username'], $user_info['name'], $user_info['email'])) == null) |
|
| 286 | - $resetPassword = false; |
|
| 289 | + if (isset($_POST['passwrd1']) && $_POST['passwrd1'] != '' && isset($_POST['passwrd2']) && $_POST['passwrd1'] == $_POST['passwrd2'] && validatePassword($_POST['passwrd1'], $value, array($cur_profile['real_name'], $user_info['username'], $user_info['name'], $user_info['email'])) == null) { |
|
| 290 | + $resetPassword = false; |
|
| 291 | + } |
|
| 287 | 292 | |
| 288 | 293 | // Do the reset... this will send them an email too. |
| 289 | - if ($resetPassword) |
|
| 290 | - resetPassword($context['id_member'], $value); |
|
| 291 | - elseif ($value !== null) |
|
| 294 | + if ($resetPassword) { |
|
| 295 | + resetPassword($context['id_member'], $value); |
|
| 296 | + } elseif ($value !== null) |
|
| 292 | 297 | { |
| 293 | 298 | validateUsername($context['id_member'], trim(preg_replace('~[\t\n\r \x0B\0' . ($context['utf8'] ? '\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}' : '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $value))); |
| 294 | 299 | updateMemberData($context['id_member'], array('member_name' => $value)); |
@@ -312,20 +317,23 @@ discard block |
||
| 312 | 317 | 'input_validate' => function(&$value) use ($sourcedir, $user_info, $smcFunc, $cur_profile) |
| 313 | 318 | { |
| 314 | 319 | // If we didn't try it then ignore it! |
| 315 | - if ($value == '') |
|
| 316 | - return false; |
|
| 320 | + if ($value == '') { |
|
| 321 | + return false; |
|
| 322 | + } |
|
| 317 | 323 | |
| 318 | 324 | // Do the two entries for the password even match? |
| 319 | - if (!isset($_POST['passwrd2']) || $value != $_POST['passwrd2']) |
|
| 320 | - return 'bad_new_password'; |
|
| 325 | + if (!isset($_POST['passwrd2']) || $value != $_POST['passwrd2']) { |
|
| 326 | + return 'bad_new_password'; |
|
| 327 | + } |
|
| 321 | 328 | |
| 322 | 329 | // Let's get the validation function into play... |
| 323 | 330 | require_once($sourcedir . '/Subs-Auth.php'); |
| 324 | 331 | $passwordErrors = validatePassword($value, $cur_profile['member_name'], array($cur_profile['real_name'], $user_info['username'], $user_info['name'], $user_info['email'])); |
| 325 | 332 | |
| 326 | 333 | // Were there errors? |
| 327 | - if ($passwordErrors != null) |
|
| 328 | - return 'password_' . $passwordErrors; |
|
| 334 | + if ($passwordErrors != null) { |
|
| 335 | + return 'password_' . $passwordErrors; |
|
| 336 | + } |
|
| 329 | 337 | |
| 330 | 338 | // Set up the new password variable... ready for storage. |
| 331 | 339 | $value = hash_password($cur_profile['member_name'], un_htmlspecialchars($value)); |
@@ -350,8 +358,9 @@ discard block |
||
| 350 | 358 | 'permission' => 'profile_blurb', |
| 351 | 359 | 'input_validate' => function(&$value) use ($smcFunc) |
| 352 | 360 | { |
| 353 | - if ($smcFunc['strlen']($value) > 50) |
|
| 354 | - return 'personal_text_too_long'; |
|
| 361 | + if ($smcFunc['strlen']($value) > 50) { |
|
| 362 | + return 'personal_text_too_long'; |
|
| 363 | + } |
|
| 355 | 364 | |
| 356 | 365 | return true; |
| 357 | 366 | }, |
@@ -386,10 +395,11 @@ discard block |
||
| 386 | 395 | 'permission' => 'moderate_forum', |
| 387 | 396 | 'input_validate' => function(&$value) |
| 388 | 397 | { |
| 389 | - if (!is_numeric($value)) |
|
| 390 | - return 'digits_only'; |
|
| 391 | - else |
|
| 392 | - $value = $value != '' ? strtr($value, array(',' => '', '.' => '', ' ' => '')) : 0; |
|
| 398 | + if (!is_numeric($value)) { |
|
| 399 | + return 'digits_only'; |
|
| 400 | + } else { |
|
| 401 | + $value = $value != '' ? strtr($value, array(',' => '', '.' => '', ' ' => '')) : 0; |
|
| 402 | + } |
|
| 393 | 403 | return true; |
| 394 | 404 | }, |
| 395 | 405 | ), |
@@ -405,15 +415,16 @@ discard block |
||
| 405 | 415 | { |
| 406 | 416 | $value = trim(preg_replace('~[\t\n\r \x0B\0' . ($context['utf8'] ? '\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}' : '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $value)); |
| 407 | 417 | |
| 408 | - if (trim($value) == '') |
|
| 409 | - return 'no_name'; |
|
| 410 | - elseif ($smcFunc['strlen']($value) > 60) |
|
| 411 | - return 'name_too_long'; |
|
| 412 | - elseif ($cur_profile['real_name'] != $value) |
|
| 418 | + if (trim($value) == '') { |
|
| 419 | + return 'no_name'; |
|
| 420 | + } elseif ($smcFunc['strlen']($value) > 60) { |
|
| 421 | + return 'name_too_long'; |
|
| 422 | + } elseif ($cur_profile['real_name'] != $value) |
|
| 413 | 423 | { |
| 414 | 424 | require_once($sourcedir . '/Subs-Members.php'); |
| 415 | - if (isReservedName($value, $context['id_member'])) |
|
| 416 | - return 'name_taken'; |
|
| 425 | + if (isReservedName($value, $context['id_member'])) { |
|
| 426 | + return 'name_taken'; |
|
| 427 | + } |
|
| 417 | 428 | } |
| 418 | 429 | return true; |
| 419 | 430 | }, |
@@ -471,8 +482,9 @@ discard block |
||
| 471 | 482 | 'selected' => $set == $context['member']['smiley_set']['id'] |
| 472 | 483 | ); |
| 473 | 484 | |
| 474 | - if ($context['smiley_sets'][$i]['selected']) |
|
| 475 | - $context['member']['smiley_set']['name'] = $set_names[$i]; |
|
| 485 | + if ($context['smiley_sets'][$i]['selected']) { |
|
| 486 | + $context['member']['smiley_set']['name'] = $set_names[$i]; |
|
| 487 | + } |
|
| 476 | 488 | } |
| 477 | 489 | return true; |
| 478 | 490 | }, |
@@ -481,8 +493,9 @@ discard block |
||
| 481 | 493 | global $modSettings; |
| 482 | 494 | |
| 483 | 495 | $smiley_sets = explode(',', $modSettings['smiley_sets_known']); |
| 484 | - if (!in_array($value, $smiley_sets) && $value != 'none') |
|
| 485 | - $value = ''; |
|
| 496 | + if (!in_array($value, $smiley_sets) && $value != 'none') { |
|
| 497 | + $value = ''; |
|
| 498 | + } |
|
| 486 | 499 | return true; |
| 487 | 500 | }, |
| 488 | 501 | ), |
@@ -497,8 +510,9 @@ discard block |
||
| 497 | 510 | loadLanguage('Settings'); |
| 498 | 511 | |
| 499 | 512 | $context['allow_no_censored'] = false; |
| 500 | - if ($user_info['is_admin'] || $context['user']['is_owner']) |
|
| 501 | - $context['allow_no_censored'] = !empty($modSettings['allow_no_censored']); |
|
| 513 | + if ($user_info['is_admin'] || $context['user']['is_owner']) { |
|
| 514 | + $context['allow_no_censored'] = !empty($modSettings['allow_no_censored']); |
|
| 515 | + } |
|
| 502 | 516 | |
| 503 | 517 | return true; |
| 504 | 518 | }, |
@@ -545,8 +559,9 @@ discard block |
||
| 545 | 559 | 'input_validate' => function($value) |
| 546 | 560 | { |
| 547 | 561 | $tz = smf_list_timezones(); |
| 548 | - if (!isset($tz[$value])) |
|
| 549 | - return 'bad_timezone'; |
|
| 562 | + if (!isset($tz[$value])) { |
|
| 563 | + return 'bad_timezone'; |
|
| 564 | + } |
|
| 550 | 565 | |
| 551 | 566 | return true; |
| 552 | 567 | }, |
@@ -561,8 +576,9 @@ discard block |
||
| 561 | 576 | 'enabled' => !empty($modSettings['titlesEnable']), |
| 562 | 577 | 'input_validate' => function(&$value) use ($smcFunc) |
| 563 | 578 | { |
| 564 | - if ($smcFunc['strlen']($value) > 50) |
|
| 565 | - return 'user_title_too_long'; |
|
| 579 | + if ($smcFunc['strlen']($value) > 50) { |
|
| 580 | + return 'user_title_too_long'; |
|
| 581 | + } |
|
| 566 | 582 | |
| 567 | 583 | return true; |
| 568 | 584 | }, |
@@ -584,10 +600,12 @@ discard block |
||
| 584 | 600 | // Fix the URL... |
| 585 | 601 | 'input_validate' => function(&$value) |
| 586 | 602 | { |
| 587 | - if (strlen(trim($value)) > 0 && strpos($value, '://') === false) |
|
| 588 | - $value = 'http://' . $value; |
|
| 589 | - if (strlen($value) < 8 || (substr($value, 0, 7) !== 'http://' && substr($value, 0, 8) !== 'https://')) |
|
| 590 | - $value = ''; |
|
| 603 | + if (strlen(trim($value)) > 0 && strpos($value, '://') === false) { |
|
| 604 | + $value = 'http://' . $value; |
|
| 605 | + } |
|
| 606 | + if (strlen($value) < 8 || (substr($value, 0, 7) !== 'http://' && substr($value, 0, 8) !== 'https://')) { |
|
| 607 | + $value = ''; |
|
| 608 | + } |
|
| 591 | 609 | $value = (string) validate_iri(sanitize_iri($value)); |
| 592 | 610 | return true; |
| 593 | 611 | }, |
@@ -602,16 +620,19 @@ discard block |
||
| 602 | 620 | foreach ($profile_fields as $key => $field) |
| 603 | 621 | { |
| 604 | 622 | // Do we have permission to do this? |
| 605 | - if (isset($field['permission']) && !allowedTo(($context['user']['is_owner'] ? array($field['permission'] . '_own', $field['permission'] . '_any') : $field['permission'] . '_any')) && !allowedTo($field['permission'])) |
|
| 606 | - unset($profile_fields[$key]); |
|
| 623 | + if (isset($field['permission']) && !allowedTo(($context['user']['is_owner'] ? array($field['permission'] . '_own', $field['permission'] . '_any') : $field['permission'] . '_any')) && !allowedTo($field['permission'])) { |
|
| 624 | + unset($profile_fields[$key]); |
|
| 625 | + } |
|
| 607 | 626 | |
| 608 | 627 | // Is it enabled? |
| 609 | - if (isset($field['enabled']) && !$field['enabled']) |
|
| 610 | - unset($profile_fields[$key]); |
|
| 628 | + if (isset($field['enabled']) && !$field['enabled']) { |
|
| 629 | + unset($profile_fields[$key]); |
|
| 630 | + } |
|
| 611 | 631 | |
| 612 | 632 | // Is it specifically disabled? |
| 613 | - if (in_array($key, $disabled_fields) || (isset($field['link_with']) && in_array($field['link_with'], $disabled_fields))) |
|
| 614 | - unset($profile_fields[$key]); |
|
| 633 | + if (in_array($key, $disabled_fields) || (isset($field['link_with']) && in_array($field['link_with'], $disabled_fields))) { |
|
| 634 | + unset($profile_fields[$key]); |
|
| 635 | + } |
|
| 615 | 636 | } |
| 616 | 637 | } |
| 617 | 638 | |
@@ -636,9 +657,10 @@ discard block |
||
| 636 | 657 | loadProfileFields(true); |
| 637 | 658 | |
| 638 | 659 | // First check for any linked sets. |
| 639 | - foreach ($profile_fields as $key => $field) |
|
| 640 | - if (isset($field['link_with']) && in_array($field['link_with'], $fields)) |
|
| 660 | + foreach ($profile_fields as $key => $field) { |
|
| 661 | + if (isset($field['link_with']) && in_array($field['link_with'], $fields)) |
|
| 641 | 662 | $fields[] = $key; |
| 663 | + } |
|
| 642 | 664 | |
| 643 | 665 | $i = 0; |
| 644 | 666 | $last_type = ''; |
@@ -650,38 +672,46 @@ discard block |
||
| 650 | 672 | $cur_field = &$profile_fields[$field]; |
| 651 | 673 | |
| 652 | 674 | // Does it have a preload and does that preload succeed? |
| 653 | - if (isset($cur_field['preload']) && !$cur_field['preload']()) |
|
| 654 | - continue; |
|
| 675 | + if (isset($cur_field['preload']) && !$cur_field['preload']()) { |
|
| 676 | + continue; |
|
| 677 | + } |
|
| 655 | 678 | |
| 656 | 679 | // If this is anything but complex we need to do more cleaning! |
| 657 | 680 | if ($cur_field['type'] != 'callback' && $cur_field['type'] != 'hidden') |
| 658 | 681 | { |
| 659 | - if (!isset($cur_field['label'])) |
|
| 660 | - $cur_field['label'] = isset($txt[$field]) ? $txt[$field] : $field; |
|
| 682 | + if (!isset($cur_field['label'])) { |
|
| 683 | + $cur_field['label'] = isset($txt[$field]) ? $txt[$field] : $field; |
|
| 684 | + } |
|
| 661 | 685 | |
| 662 | 686 | // Everything has a value! |
| 663 | - if (!isset($cur_field['value'])) |
|
| 664 | - $cur_field['value'] = isset($cur_profile[$field]) ? $cur_profile[$field] : ''; |
|
| 687 | + if (!isset($cur_field['value'])) { |
|
| 688 | + $cur_field['value'] = isset($cur_profile[$field]) ? $cur_profile[$field] : ''; |
|
| 689 | + } |
|
| 665 | 690 | |
| 666 | 691 | // Any input attributes? |
| 667 | 692 | $cur_field['input_attr'] = !empty($cur_field['input_attr']) ? implode(',', $cur_field['input_attr']) : ''; |
| 668 | 693 | } |
| 669 | 694 | |
| 670 | 695 | // Was there an error with this field on posting? |
| 671 | - if (isset($context['profile_errors'][$field])) |
|
| 672 | - $cur_field['is_error'] = true; |
|
| 696 | + if (isset($context['profile_errors'][$field])) { |
|
| 697 | + $cur_field['is_error'] = true; |
|
| 698 | + } |
|
| 673 | 699 | |
| 674 | 700 | // Any javascript stuff? |
| 675 | - if (!empty($cur_field['js_submit'])) |
|
| 676 | - $context['profile_onsubmit_javascript'] .= $cur_field['js_submit']; |
|
| 677 | - if (!empty($cur_field['js'])) |
|
| 678 | - $context['profile_javascript'] .= $cur_field['js']; |
|
| 701 | + if (!empty($cur_field['js_submit'])) { |
|
| 702 | + $context['profile_onsubmit_javascript'] .= $cur_field['js_submit']; |
|
| 703 | + } |
|
| 704 | + if (!empty($cur_field['js'])) { |
|
| 705 | + $context['profile_javascript'] .= $cur_field['js']; |
|
| 706 | + } |
|
| 679 | 707 | |
| 680 | 708 | // Any template stuff? |
| 681 | - if (!empty($cur_field['prehtml'])) |
|
| 682 | - $context['profile_prehtml'] .= $cur_field['prehtml']; |
|
| 683 | - if (!empty($cur_field['posthtml'])) |
|
| 684 | - $context['profile_posthtml'] .= $cur_field['posthtml']; |
|
| 709 | + if (!empty($cur_field['prehtml'])) { |
|
| 710 | + $context['profile_prehtml'] .= $cur_field['prehtml']; |
|
| 711 | + } |
|
| 712 | + if (!empty($cur_field['posthtml'])) { |
|
| 713 | + $context['profile_posthtml'] .= $cur_field['posthtml']; |
|
| 714 | + } |
|
| 685 | 715 | |
| 686 | 716 | // Finally put it into context? |
| 687 | 717 | if ($cur_field['type'] != 'hidden') |
@@ -714,12 +744,14 @@ discard block |
||
| 714 | 744 | }, false);' : ''), true); |
| 715 | 745 | |
| 716 | 746 | // Any onsubmit javascript? |
| 717 | - if (!empty($context['profile_onsubmit_javascript'])) |
|
| 718 | - addInlineJavaScript($context['profile_onsubmit_javascript'], true); |
|
| 747 | + if (!empty($context['profile_onsubmit_javascript'])) { |
|
| 748 | + addInlineJavaScript($context['profile_onsubmit_javascript'], true); |
|
| 749 | + } |
|
| 719 | 750 | |
| 720 | 751 | // Any totally custom stuff? |
| 721 | - if (!empty($context['profile_javascript'])) |
|
| 722 | - addInlineJavaScript($context['profile_javascript'], true); |
|
| 752 | + if (!empty($context['profile_javascript'])) { |
|
| 753 | + addInlineJavaScript($context['profile_javascript'], true); |
|
| 754 | + } |
|
| 723 | 755 | |
| 724 | 756 | // Free up some memory. |
| 725 | 757 | unset($profile_fields); |
@@ -740,8 +772,9 @@ discard block |
||
| 740 | 772 | |
| 741 | 773 | // This allows variables to call activities when they save - by default just to reload their settings |
| 742 | 774 | $context['profile_execute_on_save'] = array(); |
| 743 | - if ($context['user']['is_owner']) |
|
| 744 | - $context['profile_execute_on_save']['reload_user'] = 'profileReloadUser'; |
|
| 775 | + if ($context['user']['is_owner']) { |
|
| 776 | + $context['profile_execute_on_save']['reload_user'] = 'profileReloadUser'; |
|
| 777 | + } |
|
| 745 | 778 | |
| 746 | 779 | // Assume we log nothing. |
| 747 | 780 | $context['log_changes'] = array(); |
@@ -749,8 +782,9 @@ discard block |
||
| 749 | 782 | // Cycle through the profile fields working out what to do! |
| 750 | 783 | foreach ($profile_fields as $key => $field) |
| 751 | 784 | { |
| 752 | - if (!isset($_POST[$key]) || !empty($field['is_dummy']) || (isset($_POST['preview_signature']) && $key == 'signature')) |
|
| 753 | - continue; |
|
| 785 | + if (!isset($_POST[$key]) || !empty($field['is_dummy']) || (isset($_POST['preview_signature']) && $key == 'signature')) { |
|
| 786 | + continue; |
|
| 787 | + } |
|
| 754 | 788 | |
| 755 | 789 | // What gets updated? |
| 756 | 790 | $db_key = isset($field['save_key']) ? $field['save_key'] : $key; |
@@ -778,12 +812,13 @@ discard block |
||
| 778 | 812 | $field['cast_type'] = empty($field['cast_type']) ? $field['type'] : $field['cast_type']; |
| 779 | 813 | |
| 780 | 814 | // Finally, clean up certain types. |
| 781 | - if ($field['cast_type'] == 'int') |
|
| 782 | - $_POST[$key] = (int) $_POST[$key]; |
|
| 783 | - elseif ($field['cast_type'] == 'float') |
|
| 784 | - $_POST[$key] = (float) $_POST[$key]; |
|
| 785 | - elseif ($field['cast_type'] == 'check') |
|
| 786 | - $_POST[$key] = !empty($_POST[$key]) ? 1 : 0; |
|
| 815 | + if ($field['cast_type'] == 'int') { |
|
| 816 | + $_POST[$key] = (int) $_POST[$key]; |
|
| 817 | + } elseif ($field['cast_type'] == 'float') { |
|
| 818 | + $_POST[$key] = (float) $_POST[$key]; |
|
| 819 | + } elseif ($field['cast_type'] == 'check') { |
|
| 820 | + $_POST[$key] = !empty($_POST[$key]) ? 1 : 0; |
|
| 821 | + } |
|
| 787 | 822 | |
| 788 | 823 | // If we got here we're doing OK. |
| 789 | 824 | if ($field['type'] != 'hidden' && (!isset($old_profile[$key]) || $_POST[$key] != $old_profile[$key])) |
@@ -794,11 +829,12 @@ discard block |
||
| 794 | 829 | $cur_profile[$key] = $_POST[$key]; |
| 795 | 830 | |
| 796 | 831 | // Are we logging it? |
| 797 | - if (!empty($field['log_change']) && isset($old_profile[$key])) |
|
| 798 | - $context['log_changes'][$key] = array( |
|
| 832 | + if (!empty($field['log_change']) && isset($old_profile[$key])) { |
|
| 833 | + $context['log_changes'][$key] = array( |
|
| 799 | 834 | 'previous' => $old_profile[$key], |
| 800 | 835 | 'new' => $_POST[$key], |
| 801 | 836 | ); |
| 837 | + } |
|
| 802 | 838 | } |
| 803 | 839 | |
| 804 | 840 | // Logging group changes are a bit different... |
@@ -831,10 +867,11 @@ discard block |
||
| 831 | 867 | { |
| 832 | 868 | foreach ($groups as $id => $group) |
| 833 | 869 | { |
| 834 | - if (isset($context['member_groups'][$group])) |
|
| 835 | - $additional_groups[$type][$id] = $context['member_groups'][$group]['name']; |
|
| 836 | - else |
|
| 837 | - unset($additional_groups[$type][$id]); |
|
| 870 | + if (isset($context['member_groups'][$group])) { |
|
| 871 | + $additional_groups[$type][$id] = $context['member_groups'][$group]['name']; |
|
| 872 | + } else { |
|
| 873 | + unset($additional_groups[$type][$id]); |
|
| 874 | + } |
|
| 838 | 875 | } |
| 839 | 876 | $additional_groups[$type] = implode(', ', $additional_groups[$type]); |
| 840 | 877 | } |
@@ -845,10 +882,11 @@ discard block |
||
| 845 | 882 | } |
| 846 | 883 | |
| 847 | 884 | // @todo Temporary |
| 848 | - if ($context['user']['is_owner']) |
|
| 849 | - $changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own')); |
|
| 850 | - else |
|
| 851 | - $changeOther = allowedTo('profile_extra_any'); |
|
| 885 | + if ($context['user']['is_owner']) { |
|
| 886 | + $changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own')); |
|
| 887 | + } else { |
|
| 888 | + $changeOther = allowedTo('profile_extra_any'); |
|
| 889 | + } |
|
| 852 | 890 | if ($changeOther && empty($post_errors)) |
| 853 | 891 | { |
| 854 | 892 | makeThemeChanges($context['id_member'], isset($_POST['id_theme']) ? (int) $_POST['id_theme'] : $old_profile['id_theme']); |
@@ -856,8 +894,9 @@ discard block |
||
| 856 | 894 | { |
| 857 | 895 | $custom_fields_errors = makeCustomFieldChanges($context['id_member'], $_REQUEST['sa'], false, true); |
| 858 | 896 | |
| 859 | - if (!empty($custom_fields_errors)) |
|
| 860 | - $post_errors = array_merge($post_errors, $custom_fields_errors); |
|
| 897 | + if (!empty($custom_fields_errors)) { |
|
| 898 | + $post_errors = array_merge($post_errors, $custom_fields_errors); |
|
| 899 | + } |
|
| 861 | 900 | } |
| 862 | 901 | } |
| 863 | 902 | |
@@ -883,9 +922,9 @@ discard block |
||
| 883 | 922 | if ($context['user']['is_owner']) |
| 884 | 923 | { |
| 885 | 924 | $changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own', 'profile_website_any', 'profile_website_own', 'profile_signature_any', 'profile_signature_own')); |
| 925 | + } else { |
|
| 926 | + $changeOther = allowedTo(array('profile_extra_any', 'profile_website_any', 'profile_signature_any')); |
|
| 886 | 927 | } |
| 887 | - else |
|
| 888 | - $changeOther = allowedTo(array('profile_extra_any', 'profile_website_any', 'profile_signature_any')); |
|
| 889 | 928 | |
| 890 | 929 | // Arrays of all the changes - makes things easier. |
| 891 | 930 | $profile_bools = array(); |
@@ -896,22 +935,25 @@ discard block |
||
| 896 | 935 | 'ignore_boards', |
| 897 | 936 | ); |
| 898 | 937 | |
| 899 | - if (isset($_POST['sa']) && $_POST['sa'] == 'ignoreboards' && empty($_POST['ignore_brd'])) |
|
| 900 | - $_POST['ignore_brd'] = array(); |
|
| 938 | + if (isset($_POST['sa']) && $_POST['sa'] == 'ignoreboards' && empty($_POST['ignore_brd'])) { |
|
| 939 | + $_POST['ignore_brd'] = array(); |
|
| 940 | + } |
|
| 901 | 941 | |
| 902 | 942 | unset($_POST['ignore_boards']); // Whatever it is set to is a dirty filthy thing. Kinda like our minds. |
| 903 | 943 | if (isset($_POST['ignore_brd'])) |
| 904 | 944 | { |
| 905 | - if (!is_array($_POST['ignore_brd'])) |
|
| 906 | - $_POST['ignore_brd'] = array($_POST['ignore_brd']); |
|
| 945 | + if (!is_array($_POST['ignore_brd'])) { |
|
| 946 | + $_POST['ignore_brd'] = array($_POST['ignore_brd']); |
|
| 947 | + } |
|
| 907 | 948 | |
| 908 | 949 | foreach ($_POST['ignore_brd'] as $k => $d) |
| 909 | 950 | { |
| 910 | 951 | $d = (int) $d; |
| 911 | - if ($d != 0) |
|
| 912 | - $_POST['ignore_brd'][$k] = $d; |
|
| 913 | - else |
|
| 914 | - unset($_POST['ignore_brd'][$k]); |
|
| 952 | + if ($d != 0) { |
|
| 953 | + $_POST['ignore_brd'][$k] = $d; |
|
| 954 | + } else { |
|
| 955 | + unset($_POST['ignore_brd'][$k]); |
|
| 956 | + } |
|
| 915 | 957 | } |
| 916 | 958 | $_POST['ignore_boards'] = implode(',', $_POST['ignore_brd']); |
| 917 | 959 | unset($_POST['ignore_brd']); |
@@ -923,21 +965,26 @@ discard block |
||
| 923 | 965 | makeThemeChanges($memID, isset($_POST['id_theme']) ? (int) $_POST['id_theme'] : $old_profile['id_theme']); |
| 924 | 966 | //makeAvatarChanges($memID, $post_errors); |
| 925 | 967 | |
| 926 | - if (!empty($_REQUEST['sa'])) |
|
| 927 | - makeCustomFieldChanges($memID, $_REQUEST['sa'], false); |
|
| 968 | + if (!empty($_REQUEST['sa'])) { |
|
| 969 | + makeCustomFieldChanges($memID, $_REQUEST['sa'], false); |
|
| 970 | + } |
|
| 928 | 971 | |
| 929 | - foreach ($profile_bools as $var) |
|
| 930 | - if (isset($_POST[$var])) |
|
| 972 | + foreach ($profile_bools as $var) { |
|
| 973 | + if (isset($_POST[$var])) |
|
| 931 | 974 | $profile_vars[$var] = empty($_POST[$var]) ? '0' : '1'; |
| 932 | - foreach ($profile_ints as $var) |
|
| 933 | - if (isset($_POST[$var])) |
|
| 975 | + } |
|
| 976 | + foreach ($profile_ints as $var) { |
|
| 977 | + if (isset($_POST[$var])) |
|
| 934 | 978 | $profile_vars[$var] = $_POST[$var] != '' ? (int) $_POST[$var] : ''; |
| 935 | - foreach ($profile_floats as $var) |
|
| 936 | - if (isset($_POST[$var])) |
|
| 979 | + } |
|
| 980 | + foreach ($profile_floats as $var) { |
|
| 981 | + if (isset($_POST[$var])) |
|
| 937 | 982 | $profile_vars[$var] = (float) $_POST[$var]; |
| 938 | - foreach ($profile_strings as $var) |
|
| 939 | - if (isset($_POST[$var])) |
|
| 983 | + } |
|
| 984 | + foreach ($profile_strings as $var) { |
|
| 985 | + if (isset($_POST[$var])) |
|
| 940 | 986 | $profile_vars[$var] = $_POST[$var]; |
| 987 | + } |
|
| 941 | 988 | } |
| 942 | 989 | } |
| 943 | 990 | |
@@ -971,8 +1018,9 @@ discard block |
||
| 971 | 1018 | ); |
| 972 | 1019 | |
| 973 | 1020 | // Can't change reserved vars. |
| 974 | - if ((isset($_POST['options']) && count(array_intersect(array_keys($_POST['options']), $reservedVars)) != 0) || (isset($_POST['default_options']) && count(array_intersect(array_keys($_POST['default_options']), $reservedVars)) != 0)) |
|
| 975 | - fatal_lang_error('no_access', false); |
|
| 1021 | + if ((isset($_POST['options']) && count(array_intersect(array_keys($_POST['options']), $reservedVars)) != 0) || (isset($_POST['default_options']) && count(array_intersect(array_keys($_POST['default_options']), $reservedVars)) != 0)) { |
|
| 1022 | + fatal_lang_error('no_access', false); |
|
| 1023 | + } |
|
| 976 | 1024 | |
| 977 | 1025 | // Don't allow any overriding of custom fields with default or non-default options. |
| 978 | 1026 | $request = $smcFunc['db_query']('', ' |
@@ -984,8 +1032,9 @@ discard block |
||
| 984 | 1032 | ) |
| 985 | 1033 | ); |
| 986 | 1034 | $custom_fields = array(); |
| 987 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 988 | - $custom_fields[] = $row['col_name']; |
|
| 1035 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1036 | + $custom_fields[] = $row['col_name']; |
|
| 1037 | + } |
|
| 989 | 1038 | $smcFunc['db_free_result']($request); |
| 990 | 1039 | |
| 991 | 1040 | // These are the theme changes... |
@@ -994,33 +1043,39 @@ discard block |
||
| 994 | 1043 | { |
| 995 | 1044 | foreach ($_POST['options'] as $opt => $val) |
| 996 | 1045 | { |
| 997 | - if (in_array($opt, $custom_fields)) |
|
| 998 | - continue; |
|
| 1046 | + if (in_array($opt, $custom_fields)) { |
|
| 1047 | + continue; |
|
| 1048 | + } |
|
| 999 | 1049 | |
| 1000 | 1050 | // These need to be controlled. |
| 1001 | - if ($opt == 'topics_per_page' || $opt == 'messages_per_page') |
|
| 1002 | - $val = max(0, min($val, 50)); |
|
| 1051 | + if ($opt == 'topics_per_page' || $opt == 'messages_per_page') { |
|
| 1052 | + $val = max(0, min($val, 50)); |
|
| 1053 | + } |
|
| 1003 | 1054 | // We don't set this per theme anymore. |
| 1004 | - elseif ($opt == 'allow_no_censored') |
|
| 1005 | - continue; |
|
| 1055 | + elseif ($opt == 'allow_no_censored') { |
|
| 1056 | + continue; |
|
| 1057 | + } |
|
| 1006 | 1058 | |
| 1007 | 1059 | $themeSetArray[] = array($memID, $id_theme, $opt, is_array($val) ? implode(',', $val) : $val); |
| 1008 | 1060 | } |
| 1009 | 1061 | } |
| 1010 | 1062 | |
| 1011 | 1063 | $erase_options = array(); |
| 1012 | - if (isset($_POST['default_options']) && is_array($_POST['default_options'])) |
|
| 1013 | - foreach ($_POST['default_options'] as $opt => $val) |
|
| 1064 | + if (isset($_POST['default_options']) && is_array($_POST['default_options'])) { |
|
| 1065 | + foreach ($_POST['default_options'] as $opt => $val) |
|
| 1014 | 1066 | { |
| 1015 | 1067 | if (in_array($opt, $custom_fields)) |
| 1016 | 1068 | continue; |
| 1069 | + } |
|
| 1017 | 1070 | |
| 1018 | 1071 | // These need to be controlled. |
| 1019 | - if ($opt == 'topics_per_page' || $opt == 'messages_per_page') |
|
| 1020 | - $val = max(0, min($val, 50)); |
|
| 1072 | + if ($opt == 'topics_per_page' || $opt == 'messages_per_page') { |
|
| 1073 | + $val = max(0, min($val, 50)); |
|
| 1074 | + } |
|
| 1021 | 1075 | // Only let admins and owners change the censor. |
| 1022 | - elseif ($opt == 'allow_no_censored' && !$user_info['is_admin'] && !$context['user']['is_owner']) |
|
| 1023 | - continue; |
|
| 1076 | + elseif ($opt == 'allow_no_censored' && !$user_info['is_admin'] && !$context['user']['is_owner']) { |
|
| 1077 | + continue; |
|
| 1078 | + } |
|
| 1024 | 1079 | |
| 1025 | 1080 | $themeSetArray[] = array($memID, 1, $opt, is_array($val) ? implode(',', $val) : $val); |
| 1026 | 1081 | $erase_options[] = $opt; |
@@ -1056,8 +1111,9 @@ discard block |
||
| 1056 | 1111 | |
| 1057 | 1112 | // Admins can choose any theme, even if it's not enabled... |
| 1058 | 1113 | $themes = allowedTo('admin_forum') ? explode(',', $modSettings['knownThemes']) : explode(',', $modSettings['enableThemes']); |
| 1059 | - foreach ($themes as $t) |
|
| 1060 | - cache_put_data('theme_settings-' . $t . ':' . $memID, null, 60); |
|
| 1114 | + foreach ($themes as $t) { |
|
| 1115 | + cache_put_data('theme_settings-' . $t . ':' . $memID, null, 60); |
|
| 1116 | + } |
|
| 1061 | 1117 | } |
| 1062 | 1118 | } |
| 1063 | 1119 | |
@@ -1076,8 +1132,9 @@ discard block |
||
| 1076 | 1132 | if (isset($_POST['edit_notify_boards']) && !empty($_POST['notify_boards'])) |
| 1077 | 1133 | { |
| 1078 | 1134 | // Make sure only integers are deleted. |
| 1079 | - foreach ($_POST['notify_boards'] as $index => $id) |
|
| 1080 | - $_POST['notify_boards'][$index] = (int) $id; |
|
| 1135 | + foreach ($_POST['notify_boards'] as $index => $id) { |
|
| 1136 | + $_POST['notify_boards'][$index] = (int) $id; |
|
| 1137 | + } |
|
| 1081 | 1138 | |
| 1082 | 1139 | // id_board = 0 is reserved for topic notifications. |
| 1083 | 1140 | $_POST['notify_boards'] = array_diff($_POST['notify_boards'], array(0)); |
@@ -1096,8 +1153,9 @@ discard block |
||
| 1096 | 1153 | // We are editing topic notifications...... |
| 1097 | 1154 | elseif (isset($_POST['edit_notify_topics']) && !empty($_POST['notify_topics'])) |
| 1098 | 1155 | { |
| 1099 | - foreach ($_POST['notify_topics'] as $index => $id) |
|
| 1100 | - $_POST['notify_topics'][$index] = (int) $id; |
|
| 1156 | + foreach ($_POST['notify_topics'] as $index => $id) { |
|
| 1157 | + $_POST['notify_topics'][$index] = (int) $id; |
|
| 1158 | + } |
|
| 1101 | 1159 | |
| 1102 | 1160 | // Make sure there are no zeros left. |
| 1103 | 1161 | $_POST['notify_topics'] = array_diff($_POST['notify_topics'], array(0)); |
@@ -1111,16 +1169,18 @@ discard block |
||
| 1111 | 1169 | 'selected_member' => $memID, |
| 1112 | 1170 | ) |
| 1113 | 1171 | ); |
| 1114 | - foreach ($_POST['notify_topics'] as $topic) |
|
| 1115 | - setNotifyPrefs($memID, array('topic_notify_' . $topic => 0)); |
|
| 1172 | + foreach ($_POST['notify_topics'] as $topic) { |
|
| 1173 | + setNotifyPrefs($memID, array('topic_notify_' . $topic => 0)); |
|
| 1174 | + } |
|
| 1116 | 1175 | } |
| 1117 | 1176 | |
| 1118 | 1177 | // We are removing topic preferences |
| 1119 | 1178 | elseif (isset($_POST['remove_notify_topics']) && !empty($_POST['notify_topics'])) |
| 1120 | 1179 | { |
| 1121 | 1180 | $prefs = array(); |
| 1122 | - foreach ($_POST['notify_topics'] as $topic) |
|
| 1123 | - $prefs[] = 'topic_notify_' . $topic; |
|
| 1181 | + foreach ($_POST['notify_topics'] as $topic) { |
|
| 1182 | + $prefs[] = 'topic_notify_' . $topic; |
|
| 1183 | + } |
|
| 1124 | 1184 | deleteNotifyPrefs($memID, $prefs); |
| 1125 | 1185 | } |
| 1126 | 1186 | |
@@ -1128,8 +1188,9 @@ discard block |
||
| 1128 | 1188 | elseif (isset($_POST['remove_notify_board']) && !empty($_POST['notify_boards'])) |
| 1129 | 1189 | { |
| 1130 | 1190 | $prefs = array(); |
| 1131 | - foreach ($_POST['notify_boards'] as $board) |
|
| 1132 | - $prefs[] = 'board_notify_' . $board; |
|
| 1191 | + foreach ($_POST['notify_boards'] as $board) { |
|
| 1192 | + $prefs[] = 'board_notify_' . $board; |
|
| 1193 | + } |
|
| 1133 | 1194 | deleteNotifyPrefs($memID, $prefs); |
| 1134 | 1195 | } |
| 1135 | 1196 | } |
@@ -1150,8 +1211,9 @@ discard block |
||
| 1150 | 1211 | |
| 1151 | 1212 | $errors = array(); |
| 1152 | 1213 | |
| 1153 | - if ($sanitize && isset($_POST['customfield'])) |
|
| 1154 | - $_POST['customfield'] = htmlspecialchars__recursive($_POST['customfield']); |
|
| 1214 | + if ($sanitize && isset($_POST['customfield'])) { |
|
| 1215 | + $_POST['customfield'] = htmlspecialchars__recursive($_POST['customfield']); |
|
| 1216 | + } |
|
| 1155 | 1217 | |
| 1156 | 1218 | $where = $area == 'register' ? 'show_reg != 0' : 'show_profile = {string:area}'; |
| 1157 | 1219 | |
@@ -1177,26 +1239,29 @@ discard block |
||
| 1177 | 1239 | - The data is not invisible to users but editable by the owner (or if it is the user is not the owner) |
| 1178 | 1240 | - The area isn't registration, and if it is that the field is not supposed to be shown there. |
| 1179 | 1241 | */ |
| 1180 | - if ($row['private'] != 0 && !allowedTo('admin_forum') && ($memID != $user_info['id'] || $row['private'] != 2) && ($area != 'register' || $row['show_reg'] == 0)) |
|
| 1181 | - continue; |
|
| 1242 | + if ($row['private'] != 0 && !allowedTo('admin_forum') && ($memID != $user_info['id'] || $row['private'] != 2) && ($area != 'register' || $row['show_reg'] == 0)) { |
|
| 1243 | + continue; |
|
| 1244 | + } |
|
| 1182 | 1245 | |
| 1183 | 1246 | // Validate the user data. |
| 1184 | - if ($row['field_type'] == 'check') |
|
| 1185 | - $value = isset($_POST['customfield'][$row['col_name']]) ? 1 : 0; |
|
| 1186 | - elseif ($row['field_type'] == 'select' || $row['field_type'] == 'radio') |
|
| 1247 | + if ($row['field_type'] == 'check') { |
|
| 1248 | + $value = isset($_POST['customfield'][$row['col_name']]) ? 1 : 0; |
|
| 1249 | + } elseif ($row['field_type'] == 'select' || $row['field_type'] == 'radio') |
|
| 1187 | 1250 | { |
| 1188 | 1251 | $value = $row['default_value']; |
| 1189 | - foreach (explode(',', $row['field_options']) as $k => $v) |
|
| 1190 | - if (isset($_POST['customfield'][$row['col_name']]) && $_POST['customfield'][$row['col_name']] == $k) |
|
| 1252 | + foreach (explode(',', $row['field_options']) as $k => $v) { |
|
| 1253 | + if (isset($_POST['customfield'][$row['col_name']]) && $_POST['customfield'][$row['col_name']] == $k) |
|
| 1191 | 1254 | $value = $v; |
| 1255 | + } |
|
| 1192 | 1256 | } |
| 1193 | 1257 | // Otherwise some form of text! |
| 1194 | 1258 | else |
| 1195 | 1259 | { |
| 1196 | 1260 | $value = isset($_POST['customfield'][$row['col_name']]) ? $_POST['customfield'][$row['col_name']] : ''; |
| 1197 | 1261 | |
| 1198 | - if ($row['field_length']) |
|
| 1199 | - $value = $smcFunc['substr']($value, 0, $row['field_length']); |
|
| 1262 | + if ($row['field_length']) { |
|
| 1263 | + $value = $smcFunc['substr']($value, 0, $row['field_length']); |
|
| 1264 | + } |
|
| 1200 | 1265 | |
| 1201 | 1266 | // Any masks? |
| 1202 | 1267 | if ($row['field_type'] == 'text' && !empty($row['mask']) && $row['mask'] != 'none') |
@@ -1205,36 +1270,34 @@ discard block |
||
| 1205 | 1270 | $valueReference = un_htmlspecialchars($value); |
| 1206 | 1271 | |
| 1207 | 1272 | // Try and avoid some checks. '0' could be a valid non-empty value. |
| 1208 | - if (empty($value) && !is_numeric($value)) |
|
| 1209 | - $value = ''; |
|
| 1273 | + if (empty($value) && !is_numeric($value)) { |
|
| 1274 | + $value = ''; |
|
| 1275 | + } |
|
| 1210 | 1276 | |
| 1211 | 1277 | if ($row['mask'] == 'nohtml' && ($valueReference != strip_tags($valueReference) || $value != filter_var($value, FILTER_SANITIZE_STRING) || preg_match('/<(.+?)[\s]*\/?[\s]*>/si', $valueReference))) |
| 1212 | 1278 | { |
| 1213 | - if ($returnErrors) |
|
| 1214 | - $errors[] = 'custom_field_nohtml_fail'; |
|
| 1215 | - |
|
| 1216 | - else |
|
| 1217 | - $value = ''; |
|
| 1218 | - } |
|
| 1219 | - elseif ($row['mask'] == 'email' && (!filter_var($value, FILTER_VALIDATE_EMAIL) || strlen($value) > 255)) |
|
| 1279 | + if ($returnErrors) { |
|
| 1280 | + $errors[] = 'custom_field_nohtml_fail'; |
|
| 1281 | + } else { |
|
| 1282 | + $value = ''; |
|
| 1283 | + } |
|
| 1284 | + } elseif ($row['mask'] == 'email' && (!filter_var($value, FILTER_VALIDATE_EMAIL) || strlen($value) > 255)) |
|
| 1220 | 1285 | { |
| 1221 | - if ($returnErrors) |
|
| 1222 | - $errors[] = 'custom_field_mail_fail'; |
|
| 1223 | - |
|
| 1224 | - else |
|
| 1225 | - $value = ''; |
|
| 1226 | - } |
|
| 1227 | - elseif ($row['mask'] == 'number') |
|
| 1286 | + if ($returnErrors) { |
|
| 1287 | + $errors[] = 'custom_field_mail_fail'; |
|
| 1288 | + } else { |
|
| 1289 | + $value = ''; |
|
| 1290 | + } |
|
| 1291 | + } elseif ($row['mask'] == 'number') |
|
| 1228 | 1292 | { |
| 1229 | 1293 | $value = (int) $value; |
| 1230 | - } |
|
| 1231 | - elseif (substr($row['mask'], 0, 5) == 'regex' && trim($value) != '' && preg_match(substr($row['mask'], 5), $value) === 0) |
|
| 1294 | + } elseif (substr($row['mask'], 0, 5) == 'regex' && trim($value) != '' && preg_match(substr($row['mask'], 5), $value) === 0) |
|
| 1232 | 1295 | { |
| 1233 | - if ($returnErrors) |
|
| 1234 | - $errors[] = 'custom_field_regex_fail'; |
|
| 1235 | - |
|
| 1236 | - else |
|
| 1237 | - $value = ''; |
|
| 1296 | + if ($returnErrors) { |
|
| 1297 | + $errors[] = 'custom_field_regex_fail'; |
|
| 1298 | + } else { |
|
| 1299 | + $value = ''; |
|
| 1300 | + } |
|
| 1238 | 1301 | } |
| 1239 | 1302 | |
| 1240 | 1303 | unset($valueReference); |
@@ -1258,8 +1321,7 @@ discard block |
||
| 1258 | 1321 | { |
| 1259 | 1322 | $deletes = array('id_theme' => 1 , 'variable' => $row['col_name'], 'id_member' => $memID); |
| 1260 | 1323 | unset($user_profile[$memID]['options'][$row['col_name']]); |
| 1261 | - } |
|
| 1262 | - else |
|
| 1324 | + } else |
|
| 1263 | 1325 | { |
| 1264 | 1326 | $changes[] = array(1, $row['col_name'], $value, $memID); |
| 1265 | 1327 | $user_profile[$memID]['options'][$row['col_name']] = $value; |
@@ -1270,27 +1332,30 @@ discard block |
||
| 1270 | 1332 | |
| 1271 | 1333 | $hook_errors = call_integration_hook('integrate_save_custom_profile_fields', array(&$changes, &$log_changes, &$errors, $returnErrors, $memID, $area, $sanitize, &$deletes)); |
| 1272 | 1334 | |
| 1273 | - if (!empty($hook_errors) && is_array($hook_errors)) |
|
| 1274 | - $errors = array_merge($errors, $hook_errors); |
|
| 1335 | + if (!empty($hook_errors) && is_array($hook_errors)) { |
|
| 1336 | + $errors = array_merge($errors, $hook_errors); |
|
| 1337 | + } |
|
| 1275 | 1338 | |
| 1276 | 1339 | // Make those changes! |
| 1277 | 1340 | if ((!empty($changes) || !empty($deletes)) && empty($context['password_auth_failed']) && empty($errors)) |
| 1278 | 1341 | { |
| 1279 | - if (!empty($changes)) |
|
| 1280 | - $smcFunc['db_insert']('replace', |
|
| 1342 | + if (!empty($changes)) { |
|
| 1343 | + $smcFunc['db_insert']('replace', |
|
| 1281 | 1344 | '{db_prefix}themes', |
| 1282 | 1345 | array('id_theme' => 'int', 'variable' => 'string-255', 'value' => 'string-65534', 'id_member' => 'int'), |
| 1283 | 1346 | $changes, |
| 1284 | 1347 | array('id_theme', 'variable', 'id_member') |
| 1285 | 1348 | ); |
| 1286 | - if (!empty($deletes)) |
|
| 1287 | - $smcFunc['db_query']('',' |
|
| 1349 | + } |
|
| 1350 | + if (!empty($deletes)) { |
|
| 1351 | + $smcFunc['db_query']('',' |
|
| 1288 | 1352 | DELETE FROM {db_prefix}themes |
| 1289 | 1353 | WHERE id_theme = {int:id_theme} AND |
| 1290 | 1354 | variable = {string:variable} AND |
| 1291 | 1355 | id_member = {int:id_member}', |
| 1292 | 1356 | $deletes |
| 1293 | 1357 | ); |
| 1358 | + } |
|
| 1294 | 1359 | if (!empty($log_changes) && !empty($modSettings['modlog_enabled'])) |
| 1295 | 1360 | { |
| 1296 | 1361 | require_once($sourcedir . '/Logging.php'); |
@@ -1298,9 +1363,10 @@ discard block |
||
| 1298 | 1363 | } |
| 1299 | 1364 | } |
| 1300 | 1365 | |
| 1301 | - if ($returnErrors) |
|
| 1302 | - return $errors; |
|
| 1303 | -} |
|
| 1366 | + if ($returnErrors) { |
|
| 1367 | + return $errors; |
|
| 1368 | + } |
|
| 1369 | + } |
|
| 1304 | 1370 | |
| 1305 | 1371 | /** |
| 1306 | 1372 | * Show all the users buddies, as well as a add/delete interface. |
@@ -1312,8 +1378,9 @@ discard block |
||
| 1312 | 1378 | global $context, $txt, $modSettings; |
| 1313 | 1379 | |
| 1314 | 1380 | // Do a quick check to ensure people aren't getting here illegally! |
| 1315 | - if (!$context['user']['is_owner'] || empty($modSettings['enable_buddylist'])) |
|
| 1316 | - fatal_lang_error('no_access', false); |
|
| 1381 | + if (!$context['user']['is_owner'] || empty($modSettings['enable_buddylist'])) { |
|
| 1382 | + fatal_lang_error('no_access', false); |
|
| 1383 | + } |
|
| 1317 | 1384 | |
| 1318 | 1385 | // Can we email the user direct? |
| 1319 | 1386 | $context['can_moderate_forum'] = allowedTo('moderate_forum'); |
@@ -1343,9 +1410,10 @@ discard block |
||
| 1343 | 1410 | $context['sub_template'] = $subActions[$context['list_area']][0]; |
| 1344 | 1411 | $call = call_helper($subActions[$context['list_area']][0], true); |
| 1345 | 1412 | |
| 1346 | - if (!empty($call)) |
|
| 1347 | - call_user_func($call, $memID); |
|
| 1348 | -} |
|
| 1413 | + if (!empty($call)) { |
|
| 1414 | + call_user_func($call, $memID); |
|
| 1415 | + } |
|
| 1416 | + } |
|
| 1349 | 1417 | |
| 1350 | 1418 | /** |
| 1351 | 1419 | * Show all the users buddies, as well as a add/delete interface. |
@@ -1359,9 +1427,10 @@ discard block |
||
| 1359 | 1427 | |
| 1360 | 1428 | // For making changes! |
| 1361 | 1429 | $buddiesArray = explode(',', $user_profile[$memID]['buddy_list']); |
| 1362 | - foreach ($buddiesArray as $k => $dummy) |
|
| 1363 | - if ($dummy == '') |
|
| 1430 | + foreach ($buddiesArray as $k => $dummy) { |
|
| 1431 | + if ($dummy == '') |
|
| 1364 | 1432 | unset($buddiesArray[$k]); |
| 1433 | + } |
|
| 1365 | 1434 | |
| 1366 | 1435 | // Removing a buddy? |
| 1367 | 1436 | if (isset($_GET['remove'])) |
@@ -1373,10 +1442,11 @@ discard block |
||
| 1373 | 1442 | $_SESSION['prf-save'] = $txt['could_not_remove_person']; |
| 1374 | 1443 | |
| 1375 | 1444 | // Heh, I'm lazy, do it the easy way... |
| 1376 | - foreach ($buddiesArray as $key => $buddy) |
|
| 1377 | - if ($buddy == (int) $_GET['remove']) |
|
| 1445 | + foreach ($buddiesArray as $key => $buddy) { |
|
| 1446 | + if ($buddy == (int) $_GET['remove']) |
|
| 1378 | 1447 | { |
| 1379 | 1448 | unset($buddiesArray[$key]); |
| 1449 | + } |
|
| 1380 | 1450 | $_SESSION['prf-save'] = true; |
| 1381 | 1451 | } |
| 1382 | 1452 | |
@@ -1386,8 +1456,7 @@ discard block |
||
| 1386 | 1456 | |
| 1387 | 1457 | // Redirect off the page because we don't like all this ugly query stuff to stick in the history. |
| 1388 | 1458 | redirectexit('action=profile;area=lists;sa=buddies;u=' . $memID); |
| 1389 | - } |
|
| 1390 | - elseif (isset($_POST['new_buddy'])) |
|
| 1459 | + } elseif (isset($_POST['new_buddy'])) |
|
| 1391 | 1460 | { |
| 1392 | 1461 | checkSession(); |
| 1393 | 1462 | |
@@ -1400,8 +1469,9 @@ discard block |
||
| 1400 | 1469 | { |
| 1401 | 1470 | $new_buddies[$k] = strtr(trim($new_buddies[$k]), array('\'' => ''')); |
| 1402 | 1471 | |
| 1403 | - if (strlen($new_buddies[$k]) == 0 || in_array($new_buddies[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) |
|
| 1404 | - unset($new_buddies[$k]); |
|
| 1472 | + if (strlen($new_buddies[$k]) == 0 || in_array($new_buddies[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) { |
|
| 1473 | + unset($new_buddies[$k]); |
|
| 1474 | + } |
|
| 1405 | 1475 | } |
| 1406 | 1476 | |
| 1407 | 1477 | call_integration_hook('integrate_add_buddies', array($memID, &$new_buddies)); |
@@ -1421,16 +1491,18 @@ discard block |
||
| 1421 | 1491 | ) |
| 1422 | 1492 | ); |
| 1423 | 1493 | |
| 1424 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
| 1425 | - $_SESSION['prf-save'] = true; |
|
| 1494 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
| 1495 | + $_SESSION['prf-save'] = true; |
|
| 1496 | + } |
|
| 1426 | 1497 | |
| 1427 | 1498 | // Add the new member to the buddies array. |
| 1428 | 1499 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1429 | 1500 | { |
| 1430 | - if (in_array($row['id_member'], $buddiesArray)) |
|
| 1431 | - continue; |
|
| 1432 | - else |
|
| 1433 | - $buddiesArray[] = (int) $row['id_member']; |
|
| 1501 | + if (in_array($row['id_member'], $buddiesArray)) { |
|
| 1502 | + continue; |
|
| 1503 | + } else { |
|
| 1504 | + $buddiesArray[] = (int) $row['id_member']; |
|
| 1505 | + } |
|
| 1434 | 1506 | } |
| 1435 | 1507 | $smcFunc['db_free_result']($request); |
| 1436 | 1508 | |
@@ -1460,18 +1532,20 @@ discard block |
||
| 1460 | 1532 | |
| 1461 | 1533 | $context['custom_pf'] = array(); |
| 1462 | 1534 | $disabled_fields = isset($modSettings['disabled_profile_fields']) ? array_flip(explode(',', $modSettings['disabled_profile_fields'])) : array(); |
| 1463 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1464 | - if (!isset($disabled_fields[$row['col_name']])) |
|
| 1535 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1536 | + if (!isset($disabled_fields[$row['col_name']])) |
|
| 1465 | 1537 | $context['custom_pf'][$row['col_name']] = array( |
| 1466 | 1538 | 'label' => $row['field_name'], |
| 1467 | 1539 | 'type' => $row['field_type'], |
| 1468 | 1540 | 'bbc' => !empty($row['bbc']), |
| 1469 | 1541 | 'enclose' => $row['enclose'], |
| 1470 | 1542 | ); |
| 1543 | + } |
|
| 1471 | 1544 | |
| 1472 | 1545 | // Gotta disable the gender option. |
| 1473 | - if (isset($context['custom_pf']['cust_gender']) && $context['custom_pf']['cust_gender'] == 'None') |
|
| 1474 | - unset($context['custom_pf']['cust_gender']); |
|
| 1546 | + if (isset($context['custom_pf']['cust_gender']) && $context['custom_pf']['cust_gender'] == 'None') { |
|
| 1547 | + unset($context['custom_pf']['cust_gender']); |
|
| 1548 | + } |
|
| 1475 | 1549 | |
| 1476 | 1550 | $smcFunc['db_free_result']($request); |
| 1477 | 1551 | |
@@ -1488,8 +1562,9 @@ discard block |
||
| 1488 | 1562 | 'buddy_list_count' => substr_count($user_profile[$memID]['buddy_list'], ',') + 1, |
| 1489 | 1563 | ) |
| 1490 | 1564 | ); |
| 1491 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
| 1492 | - $buddies[] = $row['id_member']; |
|
| 1565 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
| 1566 | + $buddies[] = $row['id_member']; |
|
| 1567 | + } |
|
| 1493 | 1568 | $smcFunc['db_free_result']($result); |
| 1494 | 1569 | } |
| 1495 | 1570 | |
@@ -1517,30 +1592,32 @@ discard block |
||
| 1517 | 1592 | continue; |
| 1518 | 1593 | } |
| 1519 | 1594 | |
| 1520 | - if ($column['bbc'] && !empty($context['buddies'][$buddy]['options'][$key])) |
|
| 1521 | - $context['buddies'][$buddy]['options'][$key] = strip_tags(parse_bbc($context['buddies'][$buddy]['options'][$key])); |
|
| 1522 | - |
|
| 1523 | - elseif ($column['type'] == 'check') |
|
| 1524 | - $context['buddies'][$buddy]['options'][$key] = $context['buddies'][$buddy]['options'][$key] == 0 ? $txt['no'] : $txt['yes']; |
|
| 1595 | + if ($column['bbc'] && !empty($context['buddies'][$buddy]['options'][$key])) { |
|
| 1596 | + $context['buddies'][$buddy]['options'][$key] = strip_tags(parse_bbc($context['buddies'][$buddy]['options'][$key])); |
|
| 1597 | + } elseif ($column['type'] == 'check') { |
|
| 1598 | + $context['buddies'][$buddy]['options'][$key] = $context['buddies'][$buddy]['options'][$key] == 0 ? $txt['no'] : $txt['yes']; |
|
| 1599 | + } |
|
| 1525 | 1600 | |
| 1526 | 1601 | // Enclosing the user input within some other text? |
| 1527 | - if (!empty($column['enclose']) && !empty($context['buddies'][$buddy]['options'][$key])) |
|
| 1528 | - $context['buddies'][$buddy]['options'][$key] = strtr($column['enclose'], array( |
|
| 1602 | + if (!empty($column['enclose']) && !empty($context['buddies'][$buddy]['options'][$key])) { |
|
| 1603 | + $context['buddies'][$buddy]['options'][$key] = strtr($column['enclose'], array( |
|
| 1529 | 1604 | '{SCRIPTURL}' => $scripturl, |
| 1530 | 1605 | '{IMAGES_URL}' => $settings['images_url'], |
| 1531 | 1606 | '{DEFAULT_IMAGES_URL}' => $settings['default_images_url'], |
| 1532 | 1607 | '{INPUT}' => $context['buddies'][$buddy]['options'][$key], |
| 1533 | 1608 | )); |
| 1609 | + } |
|
| 1534 | 1610 | } |
| 1535 | 1611 | } |
| 1536 | 1612 | } |
| 1537 | 1613 | |
| 1538 | 1614 | if (isset($_SESSION['prf-save'])) |
| 1539 | 1615 | { |
| 1540 | - if ($_SESSION['prf-save'] === true) |
|
| 1541 | - $context['saved_successful'] = true; |
|
| 1542 | - else |
|
| 1543 | - $context['saved_failed'] = $_SESSION['prf-save']; |
|
| 1616 | + if ($_SESSION['prf-save'] === true) { |
|
| 1617 | + $context['saved_successful'] = true; |
|
| 1618 | + } else { |
|
| 1619 | + $context['saved_failed'] = $_SESSION['prf-save']; |
|
| 1620 | + } |
|
| 1544 | 1621 | |
| 1545 | 1622 | unset($_SESSION['prf-save']); |
| 1546 | 1623 | } |
@@ -1560,9 +1637,10 @@ discard block |
||
| 1560 | 1637 | |
| 1561 | 1638 | // For making changes! |
| 1562 | 1639 | $ignoreArray = explode(',', $user_profile[$memID]['pm_ignore_list']); |
| 1563 | - foreach ($ignoreArray as $k => $dummy) |
|
| 1564 | - if ($dummy == '') |
|
| 1640 | + foreach ($ignoreArray as $k => $dummy) { |
|
| 1641 | + if ($dummy == '') |
|
| 1565 | 1642 | unset($ignoreArray[$k]); |
| 1643 | + } |
|
| 1566 | 1644 | |
| 1567 | 1645 | // Removing a member from the ignore list? |
| 1568 | 1646 | if (isset($_GET['remove'])) |
@@ -1572,10 +1650,11 @@ discard block |
||
| 1572 | 1650 | $_SESSION['prf-save'] = $txt['could_not_remove_person']; |
| 1573 | 1651 | |
| 1574 | 1652 | // Heh, I'm lazy, do it the easy way... |
| 1575 | - foreach ($ignoreArray as $key => $id_remove) |
|
| 1576 | - if ($id_remove == (int) $_GET['remove']) |
|
| 1653 | + foreach ($ignoreArray as $key => $id_remove) { |
|
| 1654 | + if ($id_remove == (int) $_GET['remove']) |
|
| 1577 | 1655 | { |
| 1578 | 1656 | unset($ignoreArray[$key]); |
| 1657 | + } |
|
| 1579 | 1658 | $_SESSION['prf-save'] = true; |
| 1580 | 1659 | } |
| 1581 | 1660 | |
@@ -1585,8 +1664,7 @@ discard block |
||
| 1585 | 1664 | |
| 1586 | 1665 | // Redirect off the page because we don't like all this ugly query stuff to stick in the history. |
| 1587 | 1666 | redirectexit('action=profile;area=lists;sa=ignore;u=' . $memID); |
| 1588 | - } |
|
| 1589 | - elseif (isset($_POST['new_ignore'])) |
|
| 1667 | + } elseif (isset($_POST['new_ignore'])) |
|
| 1590 | 1668 | { |
| 1591 | 1669 | checkSession(); |
| 1592 | 1670 | // Prepare the string for extraction... |
@@ -1598,8 +1676,9 @@ discard block |
||
| 1598 | 1676 | { |
| 1599 | 1677 | $new_entries[$k] = strtr(trim($new_entries[$k]), array('\'' => ''')); |
| 1600 | 1678 | |
| 1601 | - if (strlen($new_entries[$k]) == 0 || in_array($new_entries[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) |
|
| 1602 | - unset($new_entries[$k]); |
|
| 1679 | + if (strlen($new_entries[$k]) == 0 || in_array($new_entries[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) { |
|
| 1680 | + unset($new_entries[$k]); |
|
| 1681 | + } |
|
| 1603 | 1682 | } |
| 1604 | 1683 | |
| 1605 | 1684 | $_SESSION['prf-save'] = $txt['could_not_add_person']; |
@@ -1617,16 +1696,18 @@ discard block |
||
| 1617 | 1696 | ) |
| 1618 | 1697 | ); |
| 1619 | 1698 | |
| 1620 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
| 1621 | - $_SESSION['prf-save'] = true; |
|
| 1699 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
| 1700 | + $_SESSION['prf-save'] = true; |
|
| 1701 | + } |
|
| 1622 | 1702 | |
| 1623 | 1703 | // Add the new member to the buddies array. |
| 1624 | 1704 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1625 | 1705 | { |
| 1626 | - if (in_array($row['id_member'], $ignoreArray)) |
|
| 1627 | - continue; |
|
| 1628 | - else |
|
| 1629 | - $ignoreArray[] = (int) $row['id_member']; |
|
| 1706 | + if (in_array($row['id_member'], $ignoreArray)) { |
|
| 1707 | + continue; |
|
| 1708 | + } else { |
|
| 1709 | + $ignoreArray[] = (int) $row['id_member']; |
|
| 1710 | + } |
|
| 1630 | 1711 | } |
| 1631 | 1712 | $smcFunc['db_free_result']($request); |
| 1632 | 1713 | |
@@ -1655,8 +1736,9 @@ discard block |
||
| 1655 | 1736 | 'ignore_list_count' => substr_count($user_profile[$memID]['pm_ignore_list'], ',') + 1, |
| 1656 | 1737 | ) |
| 1657 | 1738 | ); |
| 1658 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
| 1659 | - $ignored[] = $row['id_member']; |
|
| 1739 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
| 1740 | + $ignored[] = $row['id_member']; |
|
| 1741 | + } |
|
| 1660 | 1742 | $smcFunc['db_free_result']($result); |
| 1661 | 1743 | } |
| 1662 | 1744 | |
@@ -1675,10 +1757,11 @@ discard block |
||
| 1675 | 1757 | |
| 1676 | 1758 | if (isset($_SESSION['prf-save'])) |
| 1677 | 1759 | { |
| 1678 | - if ($_SESSION['prf-save'] === true) |
|
| 1679 | - $context['saved_successful'] = true; |
|
| 1680 | - else |
|
| 1681 | - $context['saved_failed'] = $_SESSION['prf-save']; |
|
| 1760 | + if ($_SESSION['prf-save'] === true) { |
|
| 1761 | + $context['saved_successful'] = true; |
|
| 1762 | + } else { |
|
| 1763 | + $context['saved_failed'] = $_SESSION['prf-save']; |
|
| 1764 | + } |
|
| 1682 | 1765 | |
| 1683 | 1766 | unset($_SESSION['prf-save']); |
| 1684 | 1767 | } |
@@ -1694,8 +1777,9 @@ discard block |
||
| 1694 | 1777 | global $context, $txt; |
| 1695 | 1778 | |
| 1696 | 1779 | loadThemeOptions($memID); |
| 1697 | - if (allowedTo(array('profile_identity_own', 'profile_identity_any', 'profile_password_own', 'profile_password_any'))) |
|
| 1698 | - loadCustomFields($memID, 'account'); |
|
| 1780 | + if (allowedTo(array('profile_identity_own', 'profile_identity_any', 'profile_password_own', 'profile_password_any'))) { |
|
| 1781 | + loadCustomFields($memID, 'account'); |
|
| 1782 | + } |
|
| 1699 | 1783 | |
| 1700 | 1784 | $context['sub_template'] = 'edit_options'; |
| 1701 | 1785 | $context['page_desc'] = $txt['account_info']; |
@@ -1722,8 +1806,9 @@ discard block |
||
| 1722 | 1806 | global $context, $txt; |
| 1723 | 1807 | |
| 1724 | 1808 | loadThemeOptions($memID); |
| 1725 | - if (allowedTo(array('profile_forum_own', 'profile_forum_any'))) |
|
| 1726 | - loadCustomFields($memID, 'forumprofile'); |
|
| 1809 | + if (allowedTo(array('profile_forum_own', 'profile_forum_any'))) { |
|
| 1810 | + loadCustomFields($memID, 'forumprofile'); |
|
| 1811 | + } |
|
| 1727 | 1812 | |
| 1728 | 1813 | $context['sub_template'] = 'edit_options'; |
| 1729 | 1814 | $context['page_desc'] = $txt['forumProfile_info']; |
@@ -1756,18 +1841,21 @@ discard block |
||
| 1756 | 1841 | $dirs = array(); |
| 1757 | 1842 | $files = array(); |
| 1758 | 1843 | |
| 1759 | - if (!$dir) |
|
| 1760 | - return array(); |
|
| 1844 | + if (!$dir) { |
|
| 1845 | + return array(); |
|
| 1846 | + } |
|
| 1761 | 1847 | |
| 1762 | 1848 | while ($line = $dir->read()) |
| 1763 | 1849 | { |
| 1764 | - if (in_array($line, array('.', '..', 'blank.png', 'index.php'))) |
|
| 1765 | - continue; |
|
| 1850 | + if (in_array($line, array('.', '..', 'blank.png', 'index.php'))) { |
|
| 1851 | + continue; |
|
| 1852 | + } |
|
| 1766 | 1853 | |
| 1767 | - if (is_dir($modSettings['avatar_directory'] . '/' . $directory . (!empty($directory) ? '/' : '') . $line)) |
|
| 1768 | - $dirs[] = $line; |
|
| 1769 | - else |
|
| 1770 | - $files[] = $line; |
|
| 1854 | + if (is_dir($modSettings['avatar_directory'] . '/' . $directory . (!empty($directory) ? '/' : '') . $line)) { |
|
| 1855 | + $dirs[] = $line; |
|
| 1856 | + } else { |
|
| 1857 | + $files[] = $line; |
|
| 1858 | + } |
|
| 1771 | 1859 | } |
| 1772 | 1860 | $dir->close(); |
| 1773 | 1861 | |
@@ -1788,14 +1876,15 @@ discard block |
||
| 1788 | 1876 | foreach ($dirs as $line) |
| 1789 | 1877 | { |
| 1790 | 1878 | $tmp = getAvatars($directory . (!empty($directory) ? '/' : '') . $line, $level + 1); |
| 1791 | - if (!empty($tmp)) |
|
| 1792 | - $result[] = array( |
|
| 1879 | + if (!empty($tmp)) { |
|
| 1880 | + $result[] = array( |
|
| 1793 | 1881 | 'filename' => $smcFunc['htmlspecialchars']($line), |
| 1794 | 1882 | 'checked' => strpos($context['member']['avatar']['server_pic'], $line . '/') !== false, |
| 1795 | 1883 | 'name' => '[' . $smcFunc['htmlspecialchars'](str_replace('_', ' ', $line)) . ']', |
| 1796 | 1884 | 'is_dir' => true, |
| 1797 | 1885 | 'files' => $tmp |
| 1798 | 1886 | ); |
| 1887 | + } |
|
| 1799 | 1888 | unset($tmp); |
| 1800 | 1889 | } |
| 1801 | 1890 | |
@@ -1805,8 +1894,9 @@ discard block |
||
| 1805 | 1894 | $extension = substr(strrchr($line, '.'), 1); |
| 1806 | 1895 | |
| 1807 | 1896 | // Make sure it is an image. |
| 1808 | - if (strcasecmp($extension, 'gif') != 0 && strcasecmp($extension, 'jpg') != 0 && strcasecmp($extension, 'jpeg') != 0 && strcasecmp($extension, 'png') != 0 && strcasecmp($extension, 'bmp') != 0) |
|
| 1809 | - continue; |
|
| 1897 | + if (strcasecmp($extension, 'gif') != 0 && strcasecmp($extension, 'jpg') != 0 && strcasecmp($extension, 'jpeg') != 0 && strcasecmp($extension, 'png') != 0 && strcasecmp($extension, 'bmp') != 0) { |
|
| 1898 | + continue; |
|
| 1899 | + } |
|
| 1810 | 1900 | |
| 1811 | 1901 | $result[] = array( |
| 1812 | 1902 | 'filename' => $smcFunc['htmlspecialchars']($line), |
@@ -1814,8 +1904,9 @@ discard block |
||
| 1814 | 1904 | 'name' => $smcFunc['htmlspecialchars'](str_replace('_', ' ', $filename)), |
| 1815 | 1905 | 'is_dir' => false |
| 1816 | 1906 | ); |
| 1817 | - if ($level == 1) |
|
| 1818 | - $context['avatar_list'][] = $directory . '/' . $line; |
|
| 1907 | + if ($level == 1) { |
|
| 1908 | + $context['avatar_list'][] = $directory . '/' . $line; |
|
| 1909 | + } |
|
| 1819 | 1910 | } |
| 1820 | 1911 | |
| 1821 | 1912 | return $result; |
@@ -1837,8 +1928,9 @@ discard block |
||
| 1837 | 1928 | call_integration_hook('integrate_theme_options'); |
| 1838 | 1929 | |
| 1839 | 1930 | loadThemeOptions($memID); |
| 1840 | - if (allowedTo(array('profile_extra_own', 'profile_extra_any'))) |
|
| 1841 | - loadCustomFields($memID, 'theme'); |
|
| 1931 | + if (allowedTo(array('profile_extra_own', 'profile_extra_any'))) { |
|
| 1932 | + loadCustomFields($memID, 'theme'); |
|
| 1933 | + } |
|
| 1842 | 1934 | |
| 1843 | 1935 | $context['sub_template'] = 'edit_options'; |
| 1844 | 1936 | $context['page_desc'] = $txt['theme_info']; |
@@ -1892,16 +1984,19 @@ discard block |
||
| 1892 | 1984 | { |
| 1893 | 1985 | global $txt, $context, $modSettings, $smcFunc, $sourcedir; |
| 1894 | 1986 | |
| 1895 | - if (!isset($context['token_check'])) |
|
| 1896 | - $context['token_check'] = 'profile-nt' . $memID; |
|
| 1987 | + if (!isset($context['token_check'])) { |
|
| 1988 | + $context['token_check'] = 'profile-nt' . $memID; |
|
| 1989 | + } |
|
| 1897 | 1990 | |
| 1898 | 1991 | is_not_guest(); |
| 1899 | - if (!$context['user']['is_owner']) |
|
| 1900 | - isAllowedTo('profile_extra_any'); |
|
| 1992 | + if (!$context['user']['is_owner']) { |
|
| 1993 | + isAllowedTo('profile_extra_any'); |
|
| 1994 | + } |
|
| 1901 | 1995 | |
| 1902 | 1996 | // Set the post action if we're coming from the profile... |
| 1903 | - if (!isset($context['action'])) |
|
| 1904 | - $context['action'] = 'action=profile;area=notification;sa=alerts;u=' . $memID; |
|
| 1997 | + if (!isset($context['action'])) { |
|
| 1998 | + $context['action'] = 'action=profile;area=notification;sa=alerts;u=' . $memID; |
|
| 1999 | + } |
|
| 1905 | 2000 | |
| 1906 | 2001 | // What options are set |
| 1907 | 2002 | loadThemeOptions($memID); |
@@ -1988,28 +2083,34 @@ discard block |
||
| 1988 | 2083 | ); |
| 1989 | 2084 | |
| 1990 | 2085 | // There are certain things that are disabled at the group level. |
| 1991 | - if (empty($modSettings['cal_enabled'])) |
|
| 1992 | - unset($alert_types['calendar']); |
|
| 2086 | + if (empty($modSettings['cal_enabled'])) { |
|
| 2087 | + unset($alert_types['calendar']); |
|
| 2088 | + } |
|
| 1993 | 2089 | |
| 1994 | 2090 | // Disable paid subscriptions at group level if they're disabled |
| 1995 | - if (empty($modSettings['paid_enabled'])) |
|
| 1996 | - unset($alert_types['paidsubs']); |
|
| 2091 | + if (empty($modSettings['paid_enabled'])) { |
|
| 2092 | + unset($alert_types['paidsubs']); |
|
| 2093 | + } |
|
| 1997 | 2094 | |
| 1998 | 2095 | // Disable membergroup requests at group level if they're disabled |
| 1999 | - if (empty($modSettings['show_group_membership'])) |
|
| 2000 | - unset($alert_types['groupr'], $alert_types['members']['request_group']); |
|
| 2096 | + if (empty($modSettings['show_group_membership'])) { |
|
| 2097 | + unset($alert_types['groupr'], $alert_types['members']['request_group']); |
|
| 2098 | + } |
|
| 2001 | 2099 | |
| 2002 | 2100 | // Disable mentions if they're disabled |
| 2003 | - if (empty($modSettings['enable_mentions'])) |
|
| 2004 | - unset($alert_types['msg']['msg_mention']); |
|
| 2101 | + if (empty($modSettings['enable_mentions'])) { |
|
| 2102 | + unset($alert_types['msg']['msg_mention']); |
|
| 2103 | + } |
|
| 2005 | 2104 | |
| 2006 | 2105 | // Disable likes if they're disabled |
| 2007 | - if (empty($modSettings['enable_likes'])) |
|
| 2008 | - unset($alert_types['msg']['msg_like']); |
|
| 2106 | + if (empty($modSettings['enable_likes'])) { |
|
| 2107 | + unset($alert_types['msg']['msg_like']); |
|
| 2108 | + } |
|
| 2009 | 2109 | |
| 2010 | 2110 | // Disable buddy requests if they're disabled |
| 2011 | - if (empty($modSettings['enable_buddylist'])) |
|
| 2012 | - unset($alert_types['members']['buddy_request']); |
|
| 2111 | + if (empty($modSettings['enable_buddylist'])) { |
|
| 2112 | + unset($alert_types['members']['buddy_request']); |
|
| 2113 | + } |
|
| 2013 | 2114 | |
| 2014 | 2115 | // Now, now, we could pass this through global but we should really get into the habit of |
| 2015 | 2116 | // passing content to hooks, not expecting hooks to splatter everything everywhere. |
@@ -2037,15 +2138,17 @@ discard block |
||
| 2037 | 2138 | $perms_cache['manage_membergroups'] = in_array($memID, $members); |
| 2038 | 2139 | } |
| 2039 | 2140 | |
| 2040 | - if (!($perms_cache['manage_membergroups'] || $can_mod != 0)) |
|
| 2041 | - unset($alert_types['members']['request_group']); |
|
| 2141 | + if (!($perms_cache['manage_membergroups'] || $can_mod != 0)) { |
|
| 2142 | + unset($alert_types['members']['request_group']); |
|
| 2143 | + } |
|
| 2042 | 2144 | |
| 2043 | 2145 | foreach ($alert_types as $group => $items) |
| 2044 | 2146 | { |
| 2045 | 2147 | foreach ($items as $alert_key => $alert_value) |
| 2046 | 2148 | { |
| 2047 | - if (!isset($alert_value['permission'])) |
|
| 2048 | - continue; |
|
| 2149 | + if (!isset($alert_value['permission'])) { |
|
| 2150 | + continue; |
|
| 2151 | + } |
|
| 2049 | 2152 | if (!isset($perms_cache[$alert_value['permission']['name']])) |
| 2050 | 2153 | { |
| 2051 | 2154 | $in_board = !empty($alert_value['permission']['is_board']) ? 0 : null; |
@@ -2053,12 +2156,14 @@ discard block |
||
| 2053 | 2156 | $perms_cache[$alert_value['permission']['name']] = in_array($memID, $members); |
| 2054 | 2157 | } |
| 2055 | 2158 | |
| 2056 | - if (!$perms_cache[$alert_value['permission']['name']]) |
|
| 2057 | - unset ($alert_types[$group][$alert_key]); |
|
| 2159 | + if (!$perms_cache[$alert_value['permission']['name']]) { |
|
| 2160 | + unset ($alert_types[$group][$alert_key]); |
|
| 2161 | + } |
|
| 2058 | 2162 | } |
| 2059 | 2163 | |
| 2060 | - if (empty($alert_types[$group])) |
|
| 2061 | - unset ($alert_types[$group]); |
|
| 2164 | + if (empty($alert_types[$group])) { |
|
| 2165 | + unset ($alert_types[$group]); |
|
| 2166 | + } |
|
| 2062 | 2167 | } |
| 2063 | 2168 | } |
| 2064 | 2169 | |
@@ -2090,9 +2195,9 @@ discard block |
||
| 2090 | 2195 | $update_prefs[$this_option[1]] = !empty($_POST['opt_' . $this_option[1]]) ? 1 : 0; |
| 2091 | 2196 | break; |
| 2092 | 2197 | case 'select': |
| 2093 | - if (isset($_POST['opt_' . $this_option[1]], $this_option['opts'][$_POST['opt_' . $this_option[1]]])) |
|
| 2094 | - $update_prefs[$this_option[1]] = $_POST['opt_' . $this_option[1]]; |
|
| 2095 | - else |
|
| 2198 | + if (isset($_POST['opt_' . $this_option[1]], $this_option['opts'][$_POST['opt_' . $this_option[1]]])) { |
|
| 2199 | + $update_prefs[$this_option[1]] = $_POST['opt_' . $this_option[1]]; |
|
| 2200 | + } else |
|
| 2096 | 2201 | { |
| 2097 | 2202 | // We didn't have a sane value. Let's grab the first item from the possibles. |
| 2098 | 2203 | $keys = array_keys($this_option['opts']); |
@@ -2112,23 +2217,28 @@ discard block |
||
| 2112 | 2217 | $this_value = 0; |
| 2113 | 2218 | foreach ($context['alert_bits'] as $type => $bitvalue) |
| 2114 | 2219 | { |
| 2115 | - if ($this_options[$type] == 'yes' && !empty($_POST[$type . '_' . $item_key]) || $this_options[$type] == 'always') |
|
| 2116 | - $this_value |= $bitvalue; |
|
| 2220 | + if ($this_options[$type] == 'yes' && !empty($_POST[$type . '_' . $item_key]) || $this_options[$type] == 'always') { |
|
| 2221 | + $this_value |= $bitvalue; |
|
| 2222 | + } |
|
| 2223 | + } |
|
| 2224 | + if (!isset($context['alert_prefs'][$item_key]) || $context['alert_prefs'][$item_key] != $this_value) { |
|
| 2225 | + $update_prefs[$item_key] = $this_value; |
|
| 2117 | 2226 | } |
| 2118 | - if (!isset($context['alert_prefs'][$item_key]) || $context['alert_prefs'][$item_key] != $this_value) |
|
| 2119 | - $update_prefs[$item_key] = $this_value; |
|
| 2120 | 2227 | } |
| 2121 | 2228 | } |
| 2122 | 2229 | |
| 2123 | - if (!empty($_POST['opt_alert_timeout'])) |
|
| 2124 | - $update_prefs['alert_timeout'] = $context['member']['alert_timeout'] = (int) $_POST['opt_alert_timeout']; |
|
| 2230 | + if (!empty($_POST['opt_alert_timeout'])) { |
|
| 2231 | + $update_prefs['alert_timeout'] = $context['member']['alert_timeout'] = (int) $_POST['opt_alert_timeout']; |
|
| 2232 | + } |
|
| 2125 | 2233 | |
| 2126 | - if (!empty($_POST['notify_announcements'])) |
|
| 2127 | - $update_prefs['announcements'] = $context['member']['notify_announcements'] = (int) $_POST['notify_announcements']; |
|
| 2234 | + if (!empty($_POST['notify_announcements'])) { |
|
| 2235 | + $update_prefs['announcements'] = $context['member']['notify_announcements'] = (int) $_POST['notify_announcements']; |
|
| 2236 | + } |
|
| 2128 | 2237 | |
| 2129 | 2238 | setNotifyPrefs((int) $memID, $update_prefs); |
| 2130 | - foreach ($update_prefs as $pref => $value) |
|
| 2131 | - $context['alert_prefs'][$pref] = $value; |
|
| 2239 | + foreach ($update_prefs as $pref => $value) { |
|
| 2240 | + $context['alert_prefs'][$pref] = $value; |
|
| 2241 | + } |
|
| 2132 | 2242 | |
| 2133 | 2243 | makeNotificationChanges($memID); |
| 2134 | 2244 | |
@@ -2158,8 +2268,9 @@ discard block |
||
| 2158 | 2268 | |
| 2159 | 2269 | // Now we're all set up. |
| 2160 | 2270 | is_not_guest(); |
| 2161 | - if (!$context['user']['is_owner']) |
|
| 2162 | - fatal_error('no_access'); |
|
| 2271 | + if (!$context['user']['is_owner']) { |
|
| 2272 | + fatal_error('no_access'); |
|
| 2273 | + } |
|
| 2163 | 2274 | |
| 2164 | 2275 | checkSession('get'); |
| 2165 | 2276 | |
@@ -2191,8 +2302,9 @@ discard block |
||
| 2191 | 2302 | { |
| 2192 | 2303 | global $smcFunc; |
| 2193 | 2304 | |
| 2194 | - if (empty($toMark) || empty($memID)) |
|
| 2195 | - return false; |
|
| 2305 | + if (empty($toMark) || empty($memID)) { |
|
| 2306 | + return false; |
|
| 2307 | + } |
|
| 2196 | 2308 | |
| 2197 | 2309 | $toMark = (array) $toMark; |
| 2198 | 2310 | |
@@ -2226,8 +2338,9 @@ discard block |
||
| 2226 | 2338 | { |
| 2227 | 2339 | global $smcFunc; |
| 2228 | 2340 | |
| 2229 | - if (empty($toDelete)) |
|
| 2230 | - return false; |
|
| 2341 | + if (empty($toDelete)) { |
|
| 2342 | + return false; |
|
| 2343 | + } |
|
| 2231 | 2344 | |
| 2232 | 2345 | $toDelete = (array) $toDelete; |
| 2233 | 2346 | |
@@ -2262,8 +2375,9 @@ discard block |
||
| 2262 | 2375 | { |
| 2263 | 2376 | global $smcFunc; |
| 2264 | 2377 | |
| 2265 | - if (empty($memID)) |
|
| 2266 | - return false; |
|
| 2378 | + if (empty($memID)) { |
|
| 2379 | + return false; |
|
| 2380 | + } |
|
| 2267 | 2381 | |
| 2268 | 2382 | $request = $smcFunc['db_query']('', ' |
| 2269 | 2383 | SELECT id_alert |
@@ -2340,8 +2454,9 @@ discard block |
||
| 2340 | 2454 | { |
| 2341 | 2455 | $link = $topic['link']; |
| 2342 | 2456 | |
| 2343 | - if ($topic['new']) |
|
| 2344 | - $link .= ' <a href="' . $topic['new_href'] . '" class="new_posts">' . $txt['new'] . '</a>'; |
|
| 2457 | + if ($topic['new']) { |
|
| 2458 | + $link .= ' <a href="' . $topic['new_href'] . '" class="new_posts">' . $txt['new'] . '</a>'; |
|
| 2459 | + } |
|
| 2345 | 2460 | |
| 2346 | 2461 | $link .= '<br><span class="smalltext"><em>' . $txt['in'] . ' ' . $topic['board_link'] . '</em></span>'; |
| 2347 | 2462 | |
@@ -2492,8 +2607,9 @@ discard block |
||
| 2492 | 2607 | { |
| 2493 | 2608 | $link = $board['link']; |
| 2494 | 2609 | |
| 2495 | - if ($board['new']) |
|
| 2496 | - $link .= ' <a href="' . $board['href'] . '" class="new_posts">' . $txt['new'] . '</a>'; |
|
| 2610 | + if ($board['new']) { |
|
| 2611 | + $link .= ' <a href="' . $board['href'] . '" class="new_posts">' . $txt['new'] . '</a>'; |
|
| 2612 | + } |
|
| 2497 | 2613 | |
| 2498 | 2614 | return $link; |
| 2499 | 2615 | }, |
@@ -2693,8 +2809,8 @@ discard block |
||
| 2693 | 2809 | ) |
| 2694 | 2810 | ); |
| 2695 | 2811 | $notification_boards = array(); |
| 2696 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 2697 | - $notification_boards[] = array( |
|
| 2812 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 2813 | + $notification_boards[] = array( |
|
| 2698 | 2814 | 'id' => $row['id_board'], |
| 2699 | 2815 | 'name' => $row['name'], |
| 2700 | 2816 | 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', |
@@ -2702,6 +2818,7 @@ discard block |
||
| 2702 | 2818 | 'new' => $row['board_read'] < $row['id_msg_updated'], |
| 2703 | 2819 | 'notify_pref' => isset($prefs['board_notify_' . $row['id_board']]) ? $prefs['board_notify_' . $row['id_board']] : (!empty($prefs['board_notify']) ? $prefs['board_notify'] : 0), |
| 2704 | 2820 | ); |
| 2821 | + } |
|
| 2705 | 2822 | $smcFunc['db_free_result']($request); |
| 2706 | 2823 | |
| 2707 | 2824 | return $notification_boards; |
@@ -2716,17 +2833,18 @@ discard block |
||
| 2716 | 2833 | { |
| 2717 | 2834 | global $context, $options, $cur_profile, $smcFunc; |
| 2718 | 2835 | |
| 2719 | - if (isset($_POST['default_options'])) |
|
| 2720 | - $_POST['options'] = isset($_POST['options']) ? $_POST['options'] + $_POST['default_options'] : $_POST['default_options']; |
|
| 2836 | + if (isset($_POST['default_options'])) { |
|
| 2837 | + $_POST['options'] = isset($_POST['options']) ? $_POST['options'] + $_POST['default_options'] : $_POST['default_options']; |
|
| 2838 | + } |
|
| 2721 | 2839 | |
| 2722 | 2840 | if ($context['user']['is_owner']) |
| 2723 | 2841 | { |
| 2724 | 2842 | $context['member']['options'] = $options; |
| 2725 | - if (isset($_POST['options']) && is_array($_POST['options'])) |
|
| 2726 | - foreach ($_POST['options'] as $k => $v) |
|
| 2843 | + if (isset($_POST['options']) && is_array($_POST['options'])) { |
|
| 2844 | + foreach ($_POST['options'] as $k => $v) |
|
| 2727 | 2845 | $context['member']['options'][$k] = $v; |
| 2728 | - } |
|
| 2729 | - else |
|
| 2846 | + } |
|
| 2847 | + } else |
|
| 2730 | 2848 | { |
| 2731 | 2849 | $request = $smcFunc['db_query']('', ' |
| 2732 | 2850 | SELECT id_member, variable, value |
@@ -2747,8 +2865,9 @@ discard block |
||
| 2747 | 2865 | continue; |
| 2748 | 2866 | } |
| 2749 | 2867 | |
| 2750 | - if (isset($_POST['options'][$row['variable']])) |
|
| 2751 | - $row['value'] = $_POST['options'][$row['variable']]; |
|
| 2868 | + if (isset($_POST['options'][$row['variable']])) { |
|
| 2869 | + $row['value'] = $_POST['options'][$row['variable']]; |
|
| 2870 | + } |
|
| 2752 | 2871 | $context['member']['options'][$row['variable']] = $row['value']; |
| 2753 | 2872 | } |
| 2754 | 2873 | $smcFunc['db_free_result']($request); |
@@ -2756,8 +2875,9 @@ discard block |
||
| 2756 | 2875 | // Load up the default theme options for any missing. |
| 2757 | 2876 | foreach ($temp as $k => $v) |
| 2758 | 2877 | { |
| 2759 | - if (!isset($context['member']['options'][$k])) |
|
| 2760 | - $context['member']['options'][$k] = $v; |
|
| 2878 | + if (!isset($context['member']['options'][$k])) { |
|
| 2879 | + $context['member']['options'][$k] = $v; |
|
| 2880 | + } |
|
| 2761 | 2881 | } |
| 2762 | 2882 | } |
| 2763 | 2883 | } |
@@ -2772,8 +2892,9 @@ discard block |
||
| 2772 | 2892 | global $context, $modSettings, $smcFunc, $cur_profile, $sourcedir; |
| 2773 | 2893 | |
| 2774 | 2894 | // Have the admins enabled this option? |
| 2775 | - if (empty($modSettings['allow_ignore_boards'])) |
|
| 2776 | - fatal_lang_error('ignoreboards_disallowed', 'user'); |
|
| 2895 | + if (empty($modSettings['allow_ignore_boards'])) { |
|
| 2896 | + fatal_lang_error('ignoreboards_disallowed', 'user'); |
|
| 2897 | + } |
|
| 2777 | 2898 | |
| 2778 | 2899 | // Find all the boards this user is allowed to see. |
| 2779 | 2900 | $request = $smcFunc['db_query']('order_by_board_order', ' |
@@ -2793,12 +2914,13 @@ discard block |
||
| 2793 | 2914 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 2794 | 2915 | { |
| 2795 | 2916 | // This category hasn't been set up yet.. |
| 2796 | - if (!isset($context['categories'][$row['id_cat']])) |
|
| 2797 | - $context['categories'][$row['id_cat']] = array( |
|
| 2917 | + if (!isset($context['categories'][$row['id_cat']])) { |
|
| 2918 | + $context['categories'][$row['id_cat']] = array( |
|
| 2798 | 2919 | 'id' => $row['id_cat'], |
| 2799 | 2920 | 'name' => $row['cat_name'], |
| 2800 | 2921 | 'boards' => array() |
| 2801 | 2922 | ); |
| 2923 | + } |
|
| 2802 | 2924 | |
| 2803 | 2925 | // Set this board up, and let the template know when it's a child. (indent them..) |
| 2804 | 2926 | $context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array( |
@@ -2828,18 +2950,20 @@ discard block |
||
| 2828 | 2950 | } |
| 2829 | 2951 | |
| 2830 | 2952 | $max_boards = ceil(count($temp_boards) / 2); |
| 2831 | - if ($max_boards == 1) |
|
| 2832 | - $max_boards = 2; |
|
| 2953 | + if ($max_boards == 1) { |
|
| 2954 | + $max_boards = 2; |
|
| 2955 | + } |
|
| 2833 | 2956 | |
| 2834 | 2957 | // Now, alternate them so they can be shown left and right ;). |
| 2835 | 2958 | $context['board_columns'] = array(); |
| 2836 | 2959 | for ($i = 0; $i < $max_boards; $i++) |
| 2837 | 2960 | { |
| 2838 | 2961 | $context['board_columns'][] = $temp_boards[$i]; |
| 2839 | - if (isset($temp_boards[$i + $max_boards])) |
|
| 2840 | - $context['board_columns'][] = $temp_boards[$i + $max_boards]; |
|
| 2841 | - else |
|
| 2842 | - $context['board_columns'][] = array(); |
|
| 2962 | + if (isset($temp_boards[$i + $max_boards])) { |
|
| 2963 | + $context['board_columns'][] = $temp_boards[$i + $max_boards]; |
|
| 2964 | + } else { |
|
| 2965 | + $context['board_columns'][] = array(); |
|
| 2966 | + } |
|
| 2843 | 2967 | } |
| 2844 | 2968 | |
| 2845 | 2969 | loadThemeOptions($memID); |
@@ -2908,8 +3032,9 @@ discard block |
||
| 2908 | 3032 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 2909 | 3033 | { |
| 2910 | 3034 | // We should skip the administrator group if they don't have the admin_forum permission! |
| 2911 | - if ($row['id_group'] == 1 && !allowedTo('admin_forum')) |
|
| 2912 | - continue; |
|
| 3035 | + if ($row['id_group'] == 1 && !allowedTo('admin_forum')) { |
|
| 3036 | + continue; |
|
| 3037 | + } |
|
| 2913 | 3038 | |
| 2914 | 3039 | $context['member_groups'][$row['id_group']] = array( |
| 2915 | 3040 | 'id' => $row['id_group'], |
@@ -2955,16 +3080,17 @@ discard block |
||
| 2955 | 3080 | $context['max_signature_length'] = $context['signature_limits']['max_length']; |
| 2956 | 3081 | // Warning message for signature image limits? |
| 2957 | 3082 | $context['signature_warning'] = ''; |
| 2958 | - if ($context['signature_limits']['max_image_width'] && $context['signature_limits']['max_image_height']) |
|
| 2959 | - $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_size'], $context['signature_limits']['max_image_width'], $context['signature_limits']['max_image_height']); |
|
| 2960 | - elseif ($context['signature_limits']['max_image_width'] || $context['signature_limits']['max_image_height']) |
|
| 2961 | - $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_' . ($context['signature_limits']['max_image_width'] ? 'width' : 'height')], $context['signature_limits'][$context['signature_limits']['max_image_width'] ? 'max_image_width' : 'max_image_height']); |
|
| 3083 | + if ($context['signature_limits']['max_image_width'] && $context['signature_limits']['max_image_height']) { |
|
| 3084 | + $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_size'], $context['signature_limits']['max_image_width'], $context['signature_limits']['max_image_height']); |
|
| 3085 | + } elseif ($context['signature_limits']['max_image_width'] || $context['signature_limits']['max_image_height']) { |
|
| 3086 | + $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_' . ($context['signature_limits']['max_image_width'] ? 'width' : 'height')], $context['signature_limits'][$context['signature_limits']['max_image_width'] ? 'max_image_width' : 'max_image_height']); |
|
| 3087 | + } |
|
| 2962 | 3088 | |
| 2963 | 3089 | $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && (function_exists('pspell_new') || (function_exists('enchant_broker_init') && ($txt['lang_character_set'] == 'UTF-8' || function_exists('iconv')))); |
| 2964 | 3090 | |
| 2965 | - if (empty($context['do_preview'])) |
|
| 2966 | - $context['member']['signature'] = empty($cur_profile['signature']) ? '' : str_replace(array('<br>', '<', '>', '"', '\''), array("\n", '<', '>', '"', '''), $cur_profile['signature']); |
|
| 2967 | - else |
|
| 3091 | + if (empty($context['do_preview'])) { |
|
| 3092 | + $context['member']['signature'] = empty($cur_profile['signature']) ? '' : str_replace(array('<br>', '<', '>', '"', '\''), array("\n", '<', '>', '"', '''), $cur_profile['signature']); |
|
| 3093 | + } else |
|
| 2968 | 3094 | { |
| 2969 | 3095 | $signature = !empty($_POST['signature']) ? $_POST['signature'] : ''; |
| 2970 | 3096 | $validation = profileValidateSignature($signature); |
@@ -2974,8 +3100,9 @@ discard block |
||
| 2974 | 3100 | $context['post_errors'] = array(); |
| 2975 | 3101 | } |
| 2976 | 3102 | $context['post_errors'][] = 'signature_not_yet_saved'; |
| 2977 | - if ($validation !== true && $validation !== false) |
|
| 2978 | - $context['post_errors'][] = $validation; |
|
| 3103 | + if ($validation !== true && $validation !== false) { |
|
| 3104 | + $context['post_errors'][] = $validation; |
|
| 3105 | + } |
|
| 2979 | 3106 | |
| 2980 | 3107 | censorText($context['member']['signature']); |
| 2981 | 3108 | $context['member']['current_signature'] = $context['member']['signature']; |
@@ -2985,8 +3112,9 @@ discard block |
||
| 2985 | 3112 | } |
| 2986 | 3113 | |
| 2987 | 3114 | // Load the spell checker? |
| 2988 | - if ($context['show_spellchecking']) |
|
| 2989 | - loadJavaScriptFile('spellcheck.js', array('defer' => false, 'minimize' => true), 'smf_spellcheck'); |
|
| 3115 | + if ($context['show_spellchecking']) { |
|
| 3116 | + loadJavaScriptFile('spellcheck.js', array('defer' => false, 'minimize' => true), 'smf_spellcheck'); |
|
| 3117 | + } |
|
| 2990 | 3118 | |
| 2991 | 3119 | return true; |
| 2992 | 3120 | } |
@@ -3020,8 +3148,7 @@ discard block |
||
| 3020 | 3148 | 'external' => $cur_profile['avatar'] == 'gravatar://' || empty($modSettings['gravatarAllowExtraEmail']) || !empty($modSettings['gravatarOverride']) ? $cur_profile['email_address'] : substr($cur_profile['avatar'], 11) |
| 3021 | 3149 | ); |
| 3022 | 3150 | $context['member']['avatar']['href'] = get_gravatar_url($context['member']['avatar']['external']); |
| 3023 | - } |
|
| 3024 | - elseif ($cur_profile['avatar'] == '' && $cur_profile['id_attach'] > 0 && $context['member']['avatar']['allow_upload']) |
|
| 3151 | + } elseif ($cur_profile['avatar'] == '' && $cur_profile['id_attach'] > 0 && $context['member']['avatar']['allow_upload']) |
|
| 3025 | 3152 | { |
| 3026 | 3153 | $context['member']['avatar'] += array( |
| 3027 | 3154 | 'choice' => 'upload', |
@@ -3031,33 +3158,34 @@ discard block |
||
| 3031 | 3158 | $context['member']['avatar']['href'] = empty($cur_profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $cur_profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $cur_profile['filename']; |
| 3032 | 3159 | } |
| 3033 | 3160 | // Use "avatar_original" here so we show what the user entered even if the image proxy is enabled |
| 3034 | - elseif ((stristr($cur_profile['avatar'], 'http://') || stristr($cur_profile['avatar'], 'https://')) && $context['member']['avatar']['allow_external']) |
|
| 3035 | - $context['member']['avatar'] += array( |
|
| 3161 | + elseif ((stristr($cur_profile['avatar'], 'http://') || stristr($cur_profile['avatar'], 'https://')) && $context['member']['avatar']['allow_external']) { |
|
| 3162 | + $context['member']['avatar'] += array( |
|
| 3036 | 3163 | 'choice' => 'external', |
| 3037 | 3164 | 'server_pic' => 'blank.png', |
| 3038 | 3165 | 'external' => $cur_profile['avatar_original'] |
| 3039 | 3166 | ); |
| 3040 | - elseif ($cur_profile['avatar'] != '' && file_exists($modSettings['avatar_directory'] . '/' . $cur_profile['avatar']) && $context['member']['avatar']['allow_server_stored']) |
|
| 3041 | - $context['member']['avatar'] += array( |
|
| 3167 | + } elseif ($cur_profile['avatar'] != '' && file_exists($modSettings['avatar_directory'] . '/' . $cur_profile['avatar']) && $context['member']['avatar']['allow_server_stored']) { |
|
| 3168 | + $context['member']['avatar'] += array( |
|
| 3042 | 3169 | 'choice' => 'server_stored', |
| 3043 | 3170 | 'server_pic' => $cur_profile['avatar'] == '' ? 'blank.png' : $cur_profile['avatar'], |
| 3044 | 3171 | 'external' => 'http://' |
| 3045 | 3172 | ); |
| 3046 | - else |
|
| 3047 | - $context['member']['avatar'] += array( |
|
| 3173 | + } else { |
|
| 3174 | + $context['member']['avatar'] += array( |
|
| 3048 | 3175 | 'choice' => 'none', |
| 3049 | 3176 | 'server_pic' => 'blank.png', |
| 3050 | 3177 | 'external' => 'http://' |
| 3051 | 3178 | ); |
| 3179 | + } |
|
| 3052 | 3180 | |
| 3053 | 3181 | // Get a list of all the avatars. |
| 3054 | 3182 | if ($context['member']['avatar']['allow_server_stored']) |
| 3055 | 3183 | { |
| 3056 | 3184 | $context['avatar_list'] = array(); |
| 3057 | 3185 | $context['avatars'] = is_dir($modSettings['avatar_directory']) ? getAvatars('', 0) : array(); |
| 3186 | + } else { |
|
| 3187 | + $context['avatars'] = array(); |
|
| 3058 | 3188 | } |
| 3059 | - else |
|
| 3060 | - $context['avatars'] = array(); |
|
| 3061 | 3189 | |
| 3062 | 3190 | // Second level selected avatar... |
| 3063 | 3191 | $context['avatar_selected'] = substr(strrchr($context['member']['avatar']['server_pic'], '/'), 1); |
@@ -3086,19 +3214,22 @@ discard block |
||
| 3086 | 3214 | ) |
| 3087 | 3215 | ); |
| 3088 | 3216 | $protected_groups = array(1); |
| 3089 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 3090 | - $protected_groups[] = $row['id_group']; |
|
| 3217 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 3218 | + $protected_groups[] = $row['id_group']; |
|
| 3219 | + } |
|
| 3091 | 3220 | $smcFunc['db_free_result']($request); |
| 3092 | 3221 | |
| 3093 | 3222 | $protected_groups = array_unique($protected_groups); |
| 3094 | 3223 | } |
| 3095 | 3224 | |
| 3096 | 3225 | // The account page allows the change of your id_group - but not to a protected group! |
| 3097 | - if (empty($protected_groups) || count(array_intersect(array((int) $value, $old_profile['id_group']), $protected_groups)) == 0) |
|
| 3098 | - $value = (int) $value; |
|
| 3226 | + if (empty($protected_groups) || count(array_intersect(array((int) $value, $old_profile['id_group']), $protected_groups)) == 0) { |
|
| 3227 | + $value = (int) $value; |
|
| 3228 | + } |
|
| 3099 | 3229 | // ... otherwise it's the old group sir. |
| 3100 | - else |
|
| 3101 | - $value = $old_profile['id_group']; |
|
| 3230 | + else { |
|
| 3231 | + $value = $old_profile['id_group']; |
|
| 3232 | + } |
|
| 3102 | 3233 | |
| 3103 | 3234 | // Find the additional membergroups (if any) |
| 3104 | 3235 | if (isset($_POST['additional_groups']) && is_array($_POST['additional_groups'])) |
@@ -3107,16 +3238,18 @@ discard block |
||
| 3107 | 3238 | foreach ($_POST['additional_groups'] as $group_id) |
| 3108 | 3239 | { |
| 3109 | 3240 | $group_id = (int) $group_id; |
| 3110 | - if (!empty($group_id) && (empty($protected_groups) || !in_array($group_id, $protected_groups))) |
|
| 3111 | - $additional_groups[] = $group_id; |
|
| 3241 | + if (!empty($group_id) && (empty($protected_groups) || !in_array($group_id, $protected_groups))) { |
|
| 3242 | + $additional_groups[] = $group_id; |
|
| 3243 | + } |
|
| 3112 | 3244 | } |
| 3113 | 3245 | |
| 3114 | 3246 | // Put the protected groups back in there if you don't have permission to take them away. |
| 3115 | 3247 | $old_additional_groups = explode(',', $old_profile['additional_groups']); |
| 3116 | 3248 | foreach ($old_additional_groups as $group_id) |
| 3117 | 3249 | { |
| 3118 | - if (!empty($protected_groups) && in_array($group_id, $protected_groups)) |
|
| 3119 | - $additional_groups[] = $group_id; |
|
| 3250 | + if (!empty($protected_groups) && in_array($group_id, $protected_groups)) { |
|
| 3251 | + $additional_groups[] = $group_id; |
|
| 3252 | + } |
|
| 3120 | 3253 | } |
| 3121 | 3254 | |
| 3122 | 3255 | if (implode(',', $additional_groups) !== $old_profile['additional_groups']) |
@@ -3148,18 +3281,20 @@ discard block |
||
| 3148 | 3281 | list ($another) = $smcFunc['db_fetch_row']($request); |
| 3149 | 3282 | $smcFunc['db_free_result']($request); |
| 3150 | 3283 | |
| 3151 | - if (empty($another)) |
|
| 3152 | - fatal_lang_error('at_least_one_admin', 'critical'); |
|
| 3284 | + if (empty($another)) { |
|
| 3285 | + fatal_lang_error('at_least_one_admin', 'critical'); |
|
| 3286 | + } |
|
| 3153 | 3287 | } |
| 3154 | 3288 | } |
| 3155 | 3289 | |
| 3156 | 3290 | // If we are changing group status, update permission cache as necessary. |
| 3157 | 3291 | if ($value != $old_profile['id_group'] || isset($profile_vars['additional_groups'])) |
| 3158 | 3292 | { |
| 3159 | - if ($context['user']['is_owner']) |
|
| 3160 | - $_SESSION['mc']['time'] = 0; |
|
| 3161 | - else |
|
| 3162 | - updateSettings(array('settings_updated' => time())); |
|
| 3293 | + if ($context['user']['is_owner']) { |
|
| 3294 | + $_SESSION['mc']['time'] = 0; |
|
| 3295 | + } else { |
|
| 3296 | + updateSettings(array('settings_updated' => time())); |
|
| 3297 | + } |
|
| 3163 | 3298 | } |
| 3164 | 3299 | |
| 3165 | 3300 | // Announce to any hooks that we have changed groups, but don't allow them to change it. |
@@ -3180,8 +3315,9 @@ discard block |
||
| 3180 | 3315 | global $modSettings, $sourcedir, $smcFunc, $profile_vars, $cur_profile, $context; |
| 3181 | 3316 | |
| 3182 | 3317 | $memID = $context['id_member']; |
| 3183 | - if (empty($memID) && !empty($context['password_auth_failed'])) |
|
| 3184 | - return false; |
|
| 3318 | + if (empty($memID) && !empty($context['password_auth_failed'])) { |
|
| 3319 | + return false; |
|
| 3320 | + } |
|
| 3185 | 3321 | |
| 3186 | 3322 | require_once($sourcedir . '/ManageAttachments.php'); |
| 3187 | 3323 | |
@@ -3192,8 +3328,9 @@ discard block |
||
| 3192 | 3328 | $downloadedExternalAvatar = false; |
| 3193 | 3329 | if ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && strlen($_POST['userpicpersonal']) > 7 && !empty($modSettings['avatar_download_external'])) |
| 3194 | 3330 | { |
| 3195 | - if (!is_writable($uploadDir)) |
|
| 3196 | - fatal_lang_error('attachments_no_write', 'critical'); |
|
| 3331 | + if (!is_writable($uploadDir)) { |
|
| 3332 | + fatal_lang_error('attachments_no_write', 'critical'); |
|
| 3333 | + } |
|
| 3197 | 3334 | |
| 3198 | 3335 | $url = parse_url($_POST['userpicpersonal']); |
| 3199 | 3336 | $contents = fetch_web_data($url['scheme'] . '://' . $url['host'] . (empty($url['port']) ? '' : ':' . $url['port']) . str_replace(' ', '%20', trim($url['path']))); |
@@ -3235,19 +3372,18 @@ discard block |
||
| 3235 | 3372 | |
| 3236 | 3373 | // Get rid of their old avatar. (if uploaded.) |
| 3237 | 3374 | removeAttachments(array('id_member' => $memID)); |
| 3238 | - } |
|
| 3239 | - elseif ($value == 'gravatar' && !empty($modSettings['gravatarEnabled'])) |
|
| 3375 | + } elseif ($value == 'gravatar' && !empty($modSettings['gravatarEnabled'])) |
|
| 3240 | 3376 | { |
| 3241 | 3377 | // One wasn't specified, or it's not allowed to use extra email addresses, or it's not a valid one, reset to default Gravatar. |
| 3242 | - if (empty($_POST['gravatarEmail']) || empty($modSettings['gravatarAllowExtraEmail']) || !filter_var($_POST['gravatarEmail'], FILTER_VALIDATE_EMAIL)) |
|
| 3243 | - $profile_vars['avatar'] = 'gravatar://'; |
|
| 3244 | - else |
|
| 3245 | - $profile_vars['avatar'] = 'gravatar://' . ($_POST['gravatarEmail'] != $cur_profile['email_address'] ? $_POST['gravatarEmail'] : ''); |
|
| 3378 | + if (empty($_POST['gravatarEmail']) || empty($modSettings['gravatarAllowExtraEmail']) || !filter_var($_POST['gravatarEmail'], FILTER_VALIDATE_EMAIL)) { |
|
| 3379 | + $profile_vars['avatar'] = 'gravatar://'; |
|
| 3380 | + } else { |
|
| 3381 | + $profile_vars['avatar'] = 'gravatar://' . ($_POST['gravatarEmail'] != $cur_profile['email_address'] ? $_POST['gravatarEmail'] : ''); |
|
| 3382 | + } |
|
| 3246 | 3383 | |
| 3247 | 3384 | // Get rid of their old avatar. (if uploaded.) |
| 3248 | 3385 | removeAttachments(array('id_member' => $memID)); |
| 3249 | - } |
|
| 3250 | - elseif ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && empty($modSettings['avatar_download_external'])) |
|
| 3386 | + } elseif ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && empty($modSettings['avatar_download_external'])) |
|
| 3251 | 3387 | { |
| 3252 | 3388 | // We need these clean... |
| 3253 | 3389 | $cur_profile['id_attach'] = 0; |
@@ -3259,11 +3395,13 @@ discard block |
||
| 3259 | 3395 | |
| 3260 | 3396 | $profile_vars['avatar'] = str_replace(' ', '%20', preg_replace('~action(?:=|%3d)(?!dlattach)~i', 'action-', $_POST['userpicpersonal'])); |
| 3261 | 3397 | |
| 3262 | - if ($profile_vars['avatar'] == 'http://' || $profile_vars['avatar'] == 'http:///') |
|
| 3263 | - $profile_vars['avatar'] = ''; |
|
| 3398 | + if ($profile_vars['avatar'] == 'http://' || $profile_vars['avatar'] == 'http:///') { |
|
| 3399 | + $profile_vars['avatar'] = ''; |
|
| 3400 | + } |
|
| 3264 | 3401 | // Trying to make us do something we'll regret? |
| 3265 | - elseif (substr($profile_vars['avatar'], 0, 7) != 'http://' && substr($profile_vars['avatar'], 0, 8) != 'https://') |
|
| 3266 | - return 'bad_avatar_invalid_url'; |
|
| 3402 | + elseif (substr($profile_vars['avatar'], 0, 7) != 'http://' && substr($profile_vars['avatar'], 0, 8) != 'https://') { |
|
| 3403 | + return 'bad_avatar_invalid_url'; |
|
| 3404 | + } |
|
| 3267 | 3405 | // Should we check dimensions? |
| 3268 | 3406 | elseif (!empty($modSettings['avatar_max_height_external']) || !empty($modSettings['avatar_max_width_external'])) |
| 3269 | 3407 | { |
@@ -3273,9 +3411,9 @@ discard block |
||
| 3273 | 3411 | if (is_array($sizes) && (($sizes[0] > $modSettings['avatar_max_width_external'] && !empty($modSettings['avatar_max_width_external'])) || ($sizes[1] > $modSettings['avatar_max_height_external'] && !empty($modSettings['avatar_max_height_external'])))) |
| 3274 | 3412 | { |
| 3275 | 3413 | // Houston, we have a problem. The avatar is too large!! |
| 3276 | - if ($modSettings['avatar_action_too_large'] == 'option_refuse') |
|
| 3277 | - return 'bad_avatar_too_large'; |
|
| 3278 | - elseif ($modSettings['avatar_action_too_large'] == 'option_download_and_resize') |
|
| 3414 | + if ($modSettings['avatar_action_too_large'] == 'option_refuse') { |
|
| 3415 | + return 'bad_avatar_too_large'; |
|
| 3416 | + } elseif ($modSettings['avatar_action_too_large'] == 'option_download_and_resize') |
|
| 3279 | 3417 | { |
| 3280 | 3418 | // @todo remove this if appropriate |
| 3281 | 3419 | require_once($sourcedir . '/Subs-Graphics.php'); |
@@ -3285,26 +3423,27 @@ discard block |
||
| 3285 | 3423 | $cur_profile['id_attach'] = $modSettings['new_avatar_data']['id']; |
| 3286 | 3424 | $cur_profile['filename'] = $modSettings['new_avatar_data']['filename']; |
| 3287 | 3425 | $cur_profile['attachment_type'] = $modSettings['new_avatar_data']['type']; |
| 3426 | + } else { |
|
| 3427 | + return 'bad_avatar'; |
|
| 3288 | 3428 | } |
| 3289 | - else |
|
| 3290 | - return 'bad_avatar'; |
|
| 3291 | 3429 | } |
| 3292 | 3430 | } |
| 3293 | 3431 | } |
| 3294 | - } |
|
| 3295 | - elseif (($value == 'upload' && allowedTo('profile_upload_avatar')) || $downloadedExternalAvatar) |
|
| 3432 | + } elseif (($value == 'upload' && allowedTo('profile_upload_avatar')) || $downloadedExternalAvatar) |
|
| 3296 | 3433 | { |
| 3297 | 3434 | if ((isset($_FILES['attachment']['name']) && $_FILES['attachment']['name'] != '') || $downloadedExternalAvatar) |
| 3298 | 3435 | { |
| 3299 | 3436 | // Get the dimensions of the image. |
| 3300 | 3437 | if (!$downloadedExternalAvatar) |
| 3301 | 3438 | { |
| 3302 | - if (!is_writable($uploadDir)) |
|
| 3303 | - fatal_lang_error('attachments_no_write', 'critical'); |
|
| 3439 | + if (!is_writable($uploadDir)) { |
|
| 3440 | + fatal_lang_error('attachments_no_write', 'critical'); |
|
| 3441 | + } |
|
| 3304 | 3442 | |
| 3305 | 3443 | $new_filename = $uploadDir . '/' . getAttachmentFilename('avatar_tmp_' . $memID, false, null, true); |
| 3306 | - if (!move_uploaded_file($_FILES['attachment']['tmp_name'], $new_filename)) |
|
| 3307 | - fatal_lang_error('attach_timeout', 'critical'); |
|
| 3444 | + if (!move_uploaded_file($_FILES['attachment']['tmp_name'], $new_filename)) { |
|
| 3445 | + fatal_lang_error('attach_timeout', 'critical'); |
|
| 3446 | + } |
|
| 3308 | 3447 | |
| 3309 | 3448 | $_FILES['attachment']['tmp_name'] = $new_filename; |
| 3310 | 3449 | } |
@@ -3417,17 +3556,19 @@ discard block |
||
| 3417 | 3556 | $profile_vars['avatar'] = ''; |
| 3418 | 3557 | |
| 3419 | 3558 | // Delete any temporary file. |
| 3420 | - if (file_exists($_FILES['attachment']['tmp_name'])) |
|
| 3421 | - @unlink($_FILES['attachment']['tmp_name']); |
|
| 3559 | + if (file_exists($_FILES['attachment']['tmp_name'])) { |
|
| 3560 | + @unlink($_FILES['attachment']['tmp_name']); |
|
| 3561 | + } |
|
| 3422 | 3562 | } |
| 3423 | 3563 | // Selected the upload avatar option and had one already uploaded before or didn't upload one. |
| 3424 | - else |
|
| 3564 | + else { |
|
| 3565 | + $profile_vars['avatar'] = ''; |
|
| 3566 | + } |
|
| 3567 | + } elseif ($value == 'gravatar' && allowedTo('profile_gravatar_avatar')) { |
|
| 3568 | + $profile_vars['avatar'] = 'gravatar://www.gravatar.com/avatar/' . md5(strtolower(trim($cur_profile['email_address']))); |
|
| 3569 | + } else { |
|
| 3425 | 3570 | $profile_vars['avatar'] = ''; |
| 3426 | 3571 | } |
| 3427 | - elseif ($value == 'gravatar' && allowedTo('profile_gravatar_avatar')) |
|
| 3428 | - $profile_vars['avatar'] = 'gravatar://www.gravatar.com/avatar/' . md5(strtolower(trim($cur_profile['email_address']))); |
|
| 3429 | - else |
|
| 3430 | - $profile_vars['avatar'] = ''; |
|
| 3431 | 3572 | |
| 3432 | 3573 | // Setup the profile variables so it shows things right on display! |
| 3433 | 3574 | $cur_profile['avatar'] = $profile_vars['avatar']; |
@@ -3475,9 +3616,9 @@ discard block |
||
| 3475 | 3616 | $smiley_parsed = $unparsed_signature; |
| 3476 | 3617 | parsesmileys($smiley_parsed); |
| 3477 | 3618 | $smiley_count = substr_count(strtolower($smiley_parsed), '<img') - substr_count(strtolower($unparsed_signature), '<img'); |
| 3478 | - if (!empty($sig_limits[4]) && $sig_limits[4] == -1 && $smiley_count > 0) |
|
| 3479 | - return 'signature_allow_smileys'; |
|
| 3480 | - elseif (!empty($sig_limits[4]) && $sig_limits[4] > 0 && $smiley_count > $sig_limits[4]) |
|
| 3619 | + if (!empty($sig_limits[4]) && $sig_limits[4] == -1 && $smiley_count > 0) { |
|
| 3620 | + return 'signature_allow_smileys'; |
|
| 3621 | + } elseif (!empty($sig_limits[4]) && $sig_limits[4] > 0 && $smiley_count > $sig_limits[4]) |
|
| 3481 | 3622 | { |
| 3482 | 3623 | $txt['profile_error_signature_max_smileys'] = sprintf($txt['profile_error_signature_max_smileys'], $sig_limits[4]); |
| 3483 | 3624 | return 'signature_max_smileys'; |
@@ -3490,14 +3631,15 @@ discard block |
||
| 3490 | 3631 | { |
| 3491 | 3632 | $limit_broke = 0; |
| 3492 | 3633 | // Attempt to allow all sizes of abuse, so to speak. |
| 3493 | - if ($matches[2][$ind] == 'px' && $size > $sig_limits[7]) |
|
| 3494 | - $limit_broke = $sig_limits[7] . 'px'; |
|
| 3495 | - elseif ($matches[2][$ind] == 'pt' && $size > ($sig_limits[7] * 0.75)) |
|
| 3496 | - $limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt'; |
|
| 3497 | - elseif ($matches[2][$ind] == 'em' && $size > ((float) $sig_limits[7] / 16)) |
|
| 3498 | - $limit_broke = ((float) $sig_limits[7] / 16) . 'em'; |
|
| 3499 | - elseif ($matches[2][$ind] != 'px' && $matches[2][$ind] != 'pt' && $matches[2][$ind] != 'em' && $sig_limits[7] < 18) |
|
| 3500 | - $limit_broke = 'large'; |
|
| 3634 | + if ($matches[2][$ind] == 'px' && $size > $sig_limits[7]) { |
|
| 3635 | + $limit_broke = $sig_limits[7] . 'px'; |
|
| 3636 | + } elseif ($matches[2][$ind] == 'pt' && $size > ($sig_limits[7] * 0.75)) { |
|
| 3637 | + $limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt'; |
|
| 3638 | + } elseif ($matches[2][$ind] == 'em' && $size > ((float) $sig_limits[7] / 16)) { |
|
| 3639 | + $limit_broke = ((float) $sig_limits[7] / 16) . 'em'; |
|
| 3640 | + } elseif ($matches[2][$ind] != 'px' && $matches[2][$ind] != 'pt' && $matches[2][$ind] != 'em' && $sig_limits[7] < 18) { |
|
| 3641 | + $limit_broke = 'large'; |
|
| 3642 | + } |
|
| 3501 | 3643 | |
| 3502 | 3644 | if ($limit_broke) |
| 3503 | 3645 | { |
@@ -3539,24 +3681,26 @@ discard block |
||
| 3539 | 3681 | $width = -1; $height = -1; |
| 3540 | 3682 | |
| 3541 | 3683 | // Does it have predefined restraints? Width first. |
| 3542 | - if ($matches[6][$key]) |
|
| 3543 | - $matches[2][$key] = $matches[6][$key]; |
|
| 3684 | + if ($matches[6][$key]) { |
|
| 3685 | + $matches[2][$key] = $matches[6][$key]; |
|
| 3686 | + } |
|
| 3544 | 3687 | if ($matches[2][$key] && $sig_limits[5] && $matches[2][$key] > $sig_limits[5]) |
| 3545 | 3688 | { |
| 3546 | 3689 | $width = $sig_limits[5]; |
| 3547 | 3690 | $matches[4][$key] = $matches[4][$key] * ($width / $matches[2][$key]); |
| 3691 | + } elseif ($matches[2][$key]) { |
|
| 3692 | + $width = $matches[2][$key]; |
|
| 3548 | 3693 | } |
| 3549 | - elseif ($matches[2][$key]) |
|
| 3550 | - $width = $matches[2][$key]; |
|
| 3551 | 3694 | // ... and height. |
| 3552 | 3695 | if ($matches[4][$key] && $sig_limits[6] && $matches[4][$key] > $sig_limits[6]) |
| 3553 | 3696 | { |
| 3554 | 3697 | $height = $sig_limits[6]; |
| 3555 | - if ($width != -1) |
|
| 3556 | - $width = $width * ($height / $matches[4][$key]); |
|
| 3698 | + if ($width != -1) { |
|
| 3699 | + $width = $width * ($height / $matches[4][$key]); |
|
| 3700 | + } |
|
| 3701 | + } elseif ($matches[4][$key]) { |
|
| 3702 | + $height = $matches[4][$key]; |
|
| 3557 | 3703 | } |
| 3558 | - elseif ($matches[4][$key]) |
|
| 3559 | - $height = $matches[4][$key]; |
|
| 3560 | 3704 | |
| 3561 | 3705 | // If the dimensions are still not fixed - we need to check the actual image. |
| 3562 | 3706 | if (($width == -1 && $sig_limits[5]) || ($height == -1 && $sig_limits[6])) |
@@ -3574,21 +3718,24 @@ discard block |
||
| 3574 | 3718 | if ($sizes[1] > $sig_limits[6] && $sig_limits[6]) |
| 3575 | 3719 | { |
| 3576 | 3720 | $height = $sig_limits[6]; |
| 3577 | - if ($width == -1) |
|
| 3578 | - $width = $sizes[0]; |
|
| 3721 | + if ($width == -1) { |
|
| 3722 | + $width = $sizes[0]; |
|
| 3723 | + } |
|
| 3579 | 3724 | $width = $width * ($height / $sizes[1]); |
| 3725 | + } elseif ($width != -1) { |
|
| 3726 | + $height = $sizes[1]; |
|
| 3580 | 3727 | } |
| 3581 | - elseif ($width != -1) |
|
| 3582 | - $height = $sizes[1]; |
|
| 3583 | 3728 | } |
| 3584 | 3729 | } |
| 3585 | 3730 | |
| 3586 | 3731 | // Did we come up with some changes? If so remake the string. |
| 3587 | - if ($width != -1 || $height != -1) |
|
| 3588 | - $replaces[$image] = '[img' . ($width != -1 ? ' width=' . round($width) : '') . ($height != -1 ? ' height=' . round($height) : '') . ']' . $matches[7][$key] . '[/img]'; |
|
| 3732 | + if ($width != -1 || $height != -1) { |
|
| 3733 | + $replaces[$image] = '[img' . ($width != -1 ? ' width=' . round($width) : '') . ($height != -1 ? ' height=' . round($height) : '') . ']' . $matches[7][$key] . '[/img]'; |
|
| 3734 | + } |
|
| 3735 | + } |
|
| 3736 | + if (!empty($replaces)) { |
|
| 3737 | + $value = str_replace(array_keys($replaces), array_values($replaces), $value); |
|
| 3589 | 3738 | } |
| 3590 | - if (!empty($replaces)) |
|
| 3591 | - $value = str_replace(array_keys($replaces), array_values($replaces), $value); |
|
| 3592 | 3739 | } |
| 3593 | 3740 | } |
| 3594 | 3741 | |
@@ -3632,10 +3779,12 @@ discard block |
||
| 3632 | 3779 | $email = strtr($email, array(''' => '\'')); |
| 3633 | 3780 | |
| 3634 | 3781 | // Check the name and email for validity. |
| 3635 | - if (trim($email) == '') |
|
| 3636 | - return 'no_email'; |
|
| 3637 | - if (!filter_var($email, FILTER_VALIDATE_EMAIL)) |
|
| 3638 | - return 'bad_email'; |
|
| 3782 | + if (trim($email) == '') { |
|
| 3783 | + return 'no_email'; |
|
| 3784 | + } |
|
| 3785 | + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
| 3786 | + return 'bad_email'; |
|
| 3787 | + } |
|
| 3639 | 3788 | |
| 3640 | 3789 | // Email addresses should be and stay unique. |
| 3641 | 3790 | $request = $smcFunc['db_query']('', ' |
@@ -3650,8 +3799,9 @@ discard block |
||
| 3650 | 3799 | ) |
| 3651 | 3800 | ); |
| 3652 | 3801 | |
| 3653 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
| 3654 | - return 'email_taken'; |
|
| 3802 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
| 3803 | + return 'email_taken'; |
|
| 3804 | + } |
|
| 3655 | 3805 | $smcFunc['db_free_result']($request); |
| 3656 | 3806 | |
| 3657 | 3807 | return true; |
@@ -3664,8 +3814,9 @@ discard block |
||
| 3664 | 3814 | { |
| 3665 | 3815 | global $modSettings, $context, $cur_profile; |
| 3666 | 3816 | |
| 3667 | - if (isset($_POST['passwrd2']) && $_POST['passwrd2'] != '') |
|
| 3668 | - setLoginCookie(60 * $modSettings['cookieTime'], $context['id_member'], hash_salt($_POST['passwrd1'], $cur_profile['password_salt'])); |
|
| 3817 | + if (isset($_POST['passwrd2']) && $_POST['passwrd2'] != '') { |
|
| 3818 | + setLoginCookie(60 * $modSettings['cookieTime'], $context['id_member'], hash_salt($_POST['passwrd1'], $cur_profile['password_salt'])); |
|
| 3819 | + } |
|
| 3669 | 3820 | |
| 3670 | 3821 | loadUserSettings(); |
| 3671 | 3822 | writeLog(); |
@@ -3681,8 +3832,9 @@ discard block |
||
| 3681 | 3832 | require_once($sourcedir . '/Subs-Post.php'); |
| 3682 | 3833 | |
| 3683 | 3834 | // Shouldn't happen but just in case. |
| 3684 | - if (empty($profile_vars['email_address'])) |
|
| 3685 | - return; |
|
| 3835 | + if (empty($profile_vars['email_address'])) { |
|
| 3836 | + return; |
|
| 3837 | + } |
|
| 3686 | 3838 | |
| 3687 | 3839 | $replacements = array( |
| 3688 | 3840 | 'ACTIVATIONLINK' => $scripturl . '?action=activate;u=' . $context['id_member'] . ';code=' . $profile_vars['validation_code'], |
@@ -3705,8 +3857,9 @@ discard block |
||
| 3705 | 3857 | $_SESSION['log_time'] = 0; |
| 3706 | 3858 | $_SESSION['login_' . $cookiename] = $smcFunc['json_encode'](array(0, '', 0)); |
| 3707 | 3859 | |
| 3708 | - if (isset($_COOKIE[$cookiename])) |
|
| 3709 | - $_COOKIE[$cookiename] = ''; |
|
| 3860 | + if (isset($_COOKIE[$cookiename])) { |
|
| 3861 | + $_COOKIE[$cookiename] = ''; |
|
| 3862 | + } |
|
| 3710 | 3863 | |
| 3711 | 3864 | loadUserSettings(); |
| 3712 | 3865 | |
@@ -3739,11 +3892,13 @@ discard block |
||
| 3739 | 3892 | $groups[] = $curMember['id_group']; |
| 3740 | 3893 | |
| 3741 | 3894 | // Ensure the query doesn't croak! |
| 3742 | - if (empty($groups)) |
|
| 3743 | - $groups = array(0); |
|
| 3895 | + if (empty($groups)) { |
|
| 3896 | + $groups = array(0); |
|
| 3897 | + } |
|
| 3744 | 3898 | // Just to be sure... |
| 3745 | - foreach ($groups as $k => $v) |
|
| 3746 | - $groups[$k] = (int) $v; |
|
| 3899 | + foreach ($groups as $k => $v) { |
|
| 3900 | + $groups[$k] = (int) $v; |
|
| 3901 | + } |
|
| 3747 | 3902 | |
| 3748 | 3903 | // Get all the membergroups they can join. |
| 3749 | 3904 | $request = $smcFunc['db_query']('', ' |
@@ -3773,12 +3928,14 @@ discard block |
||
| 3773 | 3928 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 3774 | 3929 | { |
| 3775 | 3930 | // Can they edit their primary group? |
| 3776 | - if (($row['id_group'] == $context['primary_group'] && $row['group_type'] > 1) || ($row['hidden'] != 2 && $context['primary_group'] == 0 && in_array($row['id_group'], $groups))) |
|
| 3777 | - $context['can_edit_primary'] = true; |
|
| 3931 | + if (($row['id_group'] == $context['primary_group'] && $row['group_type'] > 1) || ($row['hidden'] != 2 && $context['primary_group'] == 0 && in_array($row['id_group'], $groups))) { |
|
| 3932 | + $context['can_edit_primary'] = true; |
|
| 3933 | + } |
|
| 3778 | 3934 | |
| 3779 | 3935 | // If they can't manage (protected) groups, and it's not publically joinable or already assigned, they can't see it. |
| 3780 | - if (((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) && $row['id_group'] != $context['primary_group']) |
|
| 3781 | - continue; |
|
| 3936 | + if (((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) && $row['id_group'] != $context['primary_group']) { |
|
| 3937 | + continue; |
|
| 3938 | + } |
|
| 3782 | 3939 | |
| 3783 | 3940 | $context['groups'][in_array($row['id_group'], $groups) ? 'member' : 'available'][$row['id_group']] = array( |
| 3784 | 3941 | 'id' => $row['id_group'], |
@@ -3807,13 +3964,15 @@ discard block |
||
| 3807 | 3964 | ); |
| 3808 | 3965 | |
| 3809 | 3966 | // No changing primary one unless you have enough groups! |
| 3810 | - if (count($context['groups']['member']) < 2) |
|
| 3811 | - $context['can_edit_primary'] = false; |
|
| 3967 | + if (count($context['groups']['member']) < 2) { |
|
| 3968 | + $context['can_edit_primary'] = false; |
|
| 3969 | + } |
|
| 3812 | 3970 | |
| 3813 | 3971 | // In the special case that someone is requesting membership of a group, setup some special context vars. |
| 3814 | - if (isset($_REQUEST['request']) && isset($context['groups']['available'][(int) $_REQUEST['request']]) && $context['groups']['available'][(int) $_REQUEST['request']]['type'] == 2) |
|
| 3815 | - $context['group_request'] = $context['groups']['available'][(int) $_REQUEST['request']]; |
|
| 3816 | -} |
|
| 3972 | + if (isset($_REQUEST['request']) && isset($context['groups']['available'][(int) $_REQUEST['request']]) && $context['groups']['available'][(int) $_REQUEST['request']]['type'] == 2) { |
|
| 3973 | + $context['group_request'] = $context['groups']['available'][(int) $_REQUEST['request']]; |
|
| 3974 | + } |
|
| 3975 | + } |
|
| 3817 | 3976 | |
| 3818 | 3977 | /** |
| 3819 | 3978 | * This function actually makes all the group changes |
@@ -3828,10 +3987,12 @@ discard block |
||
| 3828 | 3987 | global $user_info, $context, $user_profile, $modSettings, $smcFunc; |
| 3829 | 3988 | |
| 3830 | 3989 | // Let's be extra cautious... |
| 3831 | - if (!$context['user']['is_owner'] || empty($modSettings['show_group_membership'])) |
|
| 3832 | - isAllowedTo('manage_membergroups'); |
|
| 3833 | - if (!isset($_REQUEST['gid']) && !isset($_POST['primary'])) |
|
| 3834 | - fatal_lang_error('no_access', false); |
|
| 3990 | + if (!$context['user']['is_owner'] || empty($modSettings['show_group_membership'])) { |
|
| 3991 | + isAllowedTo('manage_membergroups'); |
|
| 3992 | + } |
|
| 3993 | + if (!isset($_REQUEST['gid']) && !isset($_POST['primary'])) { |
|
| 3994 | + fatal_lang_error('no_access', false); |
|
| 3995 | + } |
|
| 3835 | 3996 | |
| 3836 | 3997 | checkSession(isset($_GET['gid']) ? 'get' : 'post'); |
| 3837 | 3998 | |
@@ -3850,8 +4011,9 @@ discard block |
||
| 3850 | 4011 | $foundTarget = $changeType == 'primary' && $group_id == 0 ? true : false; |
| 3851 | 4012 | |
| 3852 | 4013 | // Sanity check!! |
| 3853 | - if ($group_id == 1) |
|
| 3854 | - isAllowedTo('admin_forum'); |
|
| 4014 | + if ($group_id == 1) { |
|
| 4015 | + isAllowedTo('admin_forum'); |
|
| 4016 | + } |
|
| 3855 | 4017 | // Protected groups too! |
| 3856 | 4018 | else |
| 3857 | 4019 | { |
@@ -3868,8 +4030,9 @@ discard block |
||
| 3868 | 4030 | list ($is_protected) = $smcFunc['db_fetch_row']($request); |
| 3869 | 4031 | $smcFunc['db_free_result']($request); |
| 3870 | 4032 | |
| 3871 | - if ($is_protected == 1) |
|
| 3872 | - isAllowedTo('admin_forum'); |
|
| 4033 | + if ($is_protected == 1) { |
|
| 4034 | + isAllowedTo('admin_forum'); |
|
| 4035 | + } |
|
| 3873 | 4036 | } |
| 3874 | 4037 | |
| 3875 | 4038 | // What ever we are doing, we need to determine if changing primary is possible! |
@@ -3891,36 +4054,43 @@ discard block |
||
| 3891 | 4054 | $group_name = $row['group_name']; |
| 3892 | 4055 | |
| 3893 | 4056 | // Does the group type match what we're doing - are we trying to request a non-requestable group? |
| 3894 | - if ($changeType == 'request' && $row['group_type'] != 2) |
|
| 3895 | - fatal_lang_error('no_access', false); |
|
| 4057 | + if ($changeType == 'request' && $row['group_type'] != 2) { |
|
| 4058 | + fatal_lang_error('no_access', false); |
|
| 4059 | + } |
|
| 3896 | 4060 | // What about leaving a requestable group we are not a member of? |
| 3897 | - elseif ($changeType == 'free' && $row['group_type'] == 2 && $old_profile['id_group'] != $row['id_group'] && !isset($addGroups[$row['id_group']])) |
|
| 3898 | - fatal_lang_error('no_access', false); |
|
| 3899 | - elseif ($changeType == 'free' && $row['group_type'] != 3 && $row['group_type'] != 2) |
|
| 3900 | - fatal_lang_error('no_access', false); |
|
| 4061 | + elseif ($changeType == 'free' && $row['group_type'] == 2 && $old_profile['id_group'] != $row['id_group'] && !isset($addGroups[$row['id_group']])) { |
|
| 4062 | + fatal_lang_error('no_access', false); |
|
| 4063 | + } elseif ($changeType == 'free' && $row['group_type'] != 3 && $row['group_type'] != 2) { |
|
| 4064 | + fatal_lang_error('no_access', false); |
|
| 4065 | + } |
|
| 3901 | 4066 | |
| 3902 | 4067 | // We can't change the primary group if this is hidden! |
| 3903 | - if ($row['hidden'] == 2) |
|
| 3904 | - $canChangePrimary = false; |
|
| 4068 | + if ($row['hidden'] == 2) { |
|
| 4069 | + $canChangePrimary = false; |
|
| 4070 | + } |
|
| 3905 | 4071 | } |
| 3906 | 4072 | |
| 3907 | 4073 | // If this is their old primary, can we change it? |
| 3908 | - if ($row['id_group'] == $old_profile['id_group'] && ($row['group_type'] > 1 || $context['can_manage_membergroups']) && $canChangePrimary !== false) |
|
| 3909 | - $canChangePrimary = 1; |
|
| 4074 | + if ($row['id_group'] == $old_profile['id_group'] && ($row['group_type'] > 1 || $context['can_manage_membergroups']) && $canChangePrimary !== false) { |
|
| 4075 | + $canChangePrimary = 1; |
|
| 4076 | + } |
|
| 3910 | 4077 | |
| 3911 | 4078 | // If we are not doing a force primary move, don't do it automatically if current primary is not 0. |
| 3912 | - if ($changeType != 'primary' && $old_profile['id_group'] != 0) |
|
| 3913 | - $canChangePrimary = false; |
|
| 4079 | + if ($changeType != 'primary' && $old_profile['id_group'] != 0) { |
|
| 4080 | + $canChangePrimary = false; |
|
| 4081 | + } |
|
| 3914 | 4082 | |
| 3915 | 4083 | // If this is the one we are acting on, can we even act? |
| 3916 | - if ((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) |
|
| 3917 | - $canChangePrimary = false; |
|
| 4084 | + if ((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) { |
|
| 4085 | + $canChangePrimary = false; |
|
| 4086 | + } |
|
| 3918 | 4087 | } |
| 3919 | 4088 | $smcFunc['db_free_result']($request); |
| 3920 | 4089 | |
| 3921 | 4090 | // Didn't find the target? |
| 3922 | - if (!$foundTarget) |
|
| 3923 | - fatal_lang_error('no_access', false); |
|
| 4091 | + if (!$foundTarget) { |
|
| 4092 | + fatal_lang_error('no_access', false); |
|
| 4093 | + } |
|
| 3924 | 4094 | |
| 3925 | 4095 | // Final security check, don't allow users to promote themselves to admin. |
| 3926 | 4096 | if ($context['can_manage_membergroups'] && !allowedTo('admin_forum')) |
@@ -3940,8 +4110,9 @@ discard block |
||
| 3940 | 4110 | list ($disallow) = $smcFunc['db_fetch_row']($request); |
| 3941 | 4111 | $smcFunc['db_free_result']($request); |
| 3942 | 4112 | |
| 3943 | - if ($disallow) |
|
| 3944 | - isAllowedTo('admin_forum'); |
|
| 4113 | + if ($disallow) { |
|
| 4114 | + isAllowedTo('admin_forum'); |
|
| 4115 | + } |
|
| 3945 | 4116 | } |
| 3946 | 4117 | |
| 3947 | 4118 | // If we're requesting, add the note then return. |
@@ -3959,8 +4130,9 @@ discard block |
||
| 3959 | 4130 | 'status_open' => 0, |
| 3960 | 4131 | ) |
| 3961 | 4132 | ); |
| 3962 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
| 3963 | - fatal_lang_error('profile_error_already_requested_group'); |
|
| 4133 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
| 4134 | + fatal_lang_error('profile_error_already_requested_group'); |
|
| 4135 | + } |
|
| 3964 | 4136 | $smcFunc['db_free_result']($request); |
| 3965 | 4137 | |
| 3966 | 4138 | // Log the request. |
@@ -3994,10 +4166,11 @@ discard block |
||
| 3994 | 4166 | // Are we leaving? |
| 3995 | 4167 | if ($old_profile['id_group'] == $group_id || isset($addGroups[$group_id])) |
| 3996 | 4168 | { |
| 3997 | - if ($old_profile['id_group'] == $group_id) |
|
| 3998 | - $newPrimary = 0; |
|
| 3999 | - else |
|
| 4000 | - unset($addGroups[$group_id]); |
|
| 4169 | + if ($old_profile['id_group'] == $group_id) { |
|
| 4170 | + $newPrimary = 0; |
|
| 4171 | + } else { |
|
| 4172 | + unset($addGroups[$group_id]); |
|
| 4173 | + } |
|
| 4001 | 4174 | } |
| 4002 | 4175 | // ... if not, must be joining. |
| 4003 | 4176 | else |
@@ -4005,36 +4178,42 @@ discard block |
||
| 4005 | 4178 | // Can we change the primary, and do we want to? |
| 4006 | 4179 | if ($canChangePrimary) |
| 4007 | 4180 | { |
| 4008 | - if ($old_profile['id_group'] != 0) |
|
| 4009 | - $addGroups[$old_profile['id_group']] = -1; |
|
| 4181 | + if ($old_profile['id_group'] != 0) { |
|
| 4182 | + $addGroups[$old_profile['id_group']] = -1; |
|
| 4183 | + } |
|
| 4010 | 4184 | $newPrimary = $group_id; |
| 4011 | 4185 | } |
| 4012 | 4186 | // Otherwise it's an additional group... |
| 4013 | - else |
|
| 4014 | - $addGroups[$group_id] = -1; |
|
| 4187 | + else { |
|
| 4188 | + $addGroups[$group_id] = -1; |
|
| 4189 | + } |
|
| 4015 | 4190 | } |
| 4016 | 4191 | } |
| 4017 | 4192 | // Finally, we must be setting the primary. |
| 4018 | 4193 | elseif ($canChangePrimary) |
| 4019 | 4194 | { |
| 4020 | - if ($old_profile['id_group'] != 0) |
|
| 4021 | - $addGroups[$old_profile['id_group']] = -1; |
|
| 4022 | - if (isset($addGroups[$group_id])) |
|
| 4023 | - unset($addGroups[$group_id]); |
|
| 4195 | + if ($old_profile['id_group'] != 0) { |
|
| 4196 | + $addGroups[$old_profile['id_group']] = -1; |
|
| 4197 | + } |
|
| 4198 | + if (isset($addGroups[$group_id])) { |
|
| 4199 | + unset($addGroups[$group_id]); |
|
| 4200 | + } |
|
| 4024 | 4201 | $newPrimary = $group_id; |
| 4025 | 4202 | } |
| 4026 | 4203 | |
| 4027 | 4204 | // Finally, we can make the changes! |
| 4028 | - foreach ($addGroups as $id => $dummy) |
|
| 4029 | - if (empty($id)) |
|
| 4205 | + foreach ($addGroups as $id => $dummy) { |
|
| 4206 | + if (empty($id)) |
|
| 4030 | 4207 | unset($addGroups[$id]); |
| 4208 | + } |
|
| 4031 | 4209 | $addGroups = implode(',', array_flip($addGroups)); |
| 4032 | 4210 | |
| 4033 | 4211 | // Ensure that we don't cache permissions if the group is changing. |
| 4034 | - if ($context['user']['is_owner']) |
|
| 4035 | - $_SESSION['mc']['time'] = 0; |
|
| 4036 | - else |
|
| 4037 | - updateSettings(array('settings_updated' => time())); |
|
| 4212 | + if ($context['user']['is_owner']) { |
|
| 4213 | + $_SESSION['mc']['time'] = 0; |
|
| 4214 | + } else { |
|
| 4215 | + updateSettings(array('settings_updated' => time())); |
|
| 4216 | + } |
|
| 4038 | 4217 | |
| 4039 | 4218 | updateMemberData($memID, array('id_group' => $newPrimary, 'additional_groups' => $addGroups)); |
| 4040 | 4219 | |
@@ -4057,8 +4236,9 @@ discard block |
||
| 4057 | 4236 | if (empty($user_settings['tfa_secret']) && $context['user']['is_owner']) |
| 4058 | 4237 | { |
| 4059 | 4238 | // Check to ensure we're forcing SSL for authentication |
| 4060 | - if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) |
|
| 4061 | - fatal_lang_error('login_ssl_required'); |
|
| 4239 | + if (!empty($modSettings['force_ssl']) && empty($maintenance) && !httpsOn()) { |
|
| 4240 | + fatal_lang_error('login_ssl_required'); |
|
| 4241 | + } |
|
| 4062 | 4242 | |
| 4063 | 4243 | // In some cases (forced 2FA or backup code) they would be forced to be redirected here, |
| 4064 | 4244 | // we do not want too much AJAX to confuse them. |
@@ -4095,8 +4275,7 @@ discard block |
||
| 4095 | 4275 | $context['sub_template'] = 'tfasetup_backup'; |
| 4096 | 4276 | |
| 4097 | 4277 | return; |
| 4098 | - } |
|
| 4099 | - else |
|
| 4278 | + } else |
|
| 4100 | 4279 | { |
| 4101 | 4280 | $context['tfa_secret'] = $_SESSION['tfa_secret']; |
| 4102 | 4281 | $context['tfa_error'] = !$valid_code; |
@@ -4104,8 +4283,7 @@ discard block |
||
| 4104 | 4283 | $context['tfa_pass_value'] = $_POST['passwd']; |
| 4105 | 4284 | $context['tfa_value'] = $_POST['tfa_code']; |
| 4106 | 4285 | } |
| 4107 | - } |
|
| 4108 | - else |
|
| 4286 | + } else |
|
| 4109 | 4287 | { |
| 4110 | 4288 | $totp = new \TOTP\Auth(); |
| 4111 | 4289 | $secret = $totp->generateCode(); |
@@ -4115,10 +4293,10 @@ discard block |
||
| 4115 | 4293 | } |
| 4116 | 4294 | |
| 4117 | 4295 | $context['tfa_qr_url'] = $totp->getQrCodeUrl($context['forum_name'] . ':' . $user_info['name'], $context['tfa_secret']); |
| 4296 | + } else { |
|
| 4297 | + redirectexit('action=profile;area=account;u=' . $memID); |
|
| 4298 | + } |
|
| 4118 | 4299 | } |
| 4119 | - else |
|
| 4120 | - redirectexit('action=profile;area=account;u=' . $memID); |
|
| 4121 | -} |
|
| 4122 | 4300 | |
| 4123 | 4301 | /** |
| 4124 | 4302 | * Provides interface to disable two-factor authentication in SMF |
@@ -4132,17 +4310,19 @@ discard block |
||
| 4132 | 4310 | if (!empty($user_settings['tfa_secret'])) |
| 4133 | 4311 | { |
| 4134 | 4312 | // Bail if we're forcing SSL for authentication and the network connection isn't secure. |
| 4135 | - if (!empty($modSettings['force_ssl']) && !httpsOn()) |
|
| 4136 | - fatal_lang_error('login_ssl_required', false); |
|
| 4313 | + if (!empty($modSettings['force_ssl']) && !httpsOn()) { |
|
| 4314 | + fatal_lang_error('login_ssl_required', false); |
|
| 4315 | + } |
|
| 4137 | 4316 | |
| 4138 | 4317 | // The admin giveth... |
| 4139 | - elseif ($modSettings['tfa_mode'] == 3 && $context['user']['is_owner']) |
|
| 4140 | - fatal_lang_error('cannot_disable_tfa', false); |
|
| 4141 | - elseif ($modSettings['tfa_mode'] == 2 && $context['user']['is_owner']) |
|
| 4318 | + elseif ($modSettings['tfa_mode'] == 3 && $context['user']['is_owner']) { |
|
| 4319 | + fatal_lang_error('cannot_disable_tfa', false); |
|
| 4320 | + } elseif ($modSettings['tfa_mode'] == 2 && $context['user']['is_owner']) |
|
| 4142 | 4321 | { |
| 4143 | 4322 | $groups = array($user_settings['id_group']); |
| 4144 | - if (!empty($user_settings['additional_groups'])) |
|
| 4145 | - $groups = array_unique(array_merge($groups, explode(',', $user_settings['additional_groups']))); |
|
| 4323 | + if (!empty($user_settings['additional_groups'])) { |
|
| 4324 | + $groups = array_unique(array_merge($groups, explode(',', $user_settings['additional_groups']))); |
|
| 4325 | + } |
|
| 4146 | 4326 | |
| 4147 | 4327 | $request = $smcFunc['db_query']('', ' |
| 4148 | 4328 | SELECT id_group |
@@ -4155,13 +4335,14 @@ discard block |
||
| 4155 | 4335 | ) |
| 4156 | 4336 | ); |
| 4157 | 4337 | // They belong to a membergroup that requires tfa. |
| 4158 | - if (!empty($smcFunc['db_num_rows']($request))) |
|
| 4159 | - fatal_lang_error('cannot_disable_tfa2', false); |
|
| 4338 | + if (!empty($smcFunc['db_num_rows']($request))) { |
|
| 4339 | + fatal_lang_error('cannot_disable_tfa2', false); |
|
| 4340 | + } |
|
| 4160 | 4341 | $smcFunc['db_free_result']($request); |
| 4161 | 4342 | } |
| 4343 | + } else { |
|
| 4344 | + redirectexit('action=profile;area=account;u=' . $memID); |
|
| 4345 | + } |
|
| 4162 | 4346 | } |
| 4163 | - else |
|
| 4164 | - redirectexit('action=profile;area=account;u=' . $memID); |
|
| 4165 | -} |
|
| 4166 | 4347 | |
| 4167 | 4348 | ?> |
| 4168 | 4349 | \ No newline at end of file |