@@ -11,8 +11,9 @@ discard block |
||
| 11 | 11 | * @version 2.1 Beta 4 |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if (!defined('SMF')) |
|
| 14 | +if (!defined('SMF')) { |
|
| 15 | 15 | die('No direct access...'); |
| 16 | +} |
|
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * View a summary. |
@@ -23,8 +24,9 @@ discard block |
||
| 23 | 24 | global $context, $memberContext, $txt, $modSettings, $user_profile, $sourcedir, $scripturl, $smcFunc; |
| 24 | 25 | |
| 25 | 26 | // Attempt to load the member's profile data. |
| 26 | - if (!loadMemberContext($memID) || !isset($memberContext[$memID])) |
|
| 27 | - fatal_lang_error('not_a_user', false, 404); |
|
| 27 | + if (!loadMemberContext($memID) || !isset($memberContext[$memID])) { |
|
| 28 | + fatal_lang_error('not_a_user', false, 404); |
|
| 29 | + } |
|
| 28 | 30 | |
| 29 | 31 | // Set up the stuff and load the user. |
| 30 | 32 | $context += array( |
@@ -49,19 +51,21 @@ discard block |
||
| 49 | 51 | |
| 50 | 52 | // See if they have broken any warning levels... |
| 51 | 53 | list ($modSettings['warning_enable'], $modSettings['user_limit']) = explode(',', $modSettings['warning_settings']); |
| 52 | - if (!empty($modSettings['warning_mute']) && $modSettings['warning_mute'] <= $context['member']['warning']) |
|
| 53 | - $context['warning_status'] = $txt['profile_warning_is_muted']; |
|
| 54 | - elseif (!empty($modSettings['warning_moderate']) && $modSettings['warning_moderate'] <= $context['member']['warning']) |
|
| 55 | - $context['warning_status'] = $txt['profile_warning_is_moderation']; |
|
| 56 | - elseif (!empty($modSettings['warning_watch']) && $modSettings['warning_watch'] <= $context['member']['warning']) |
|
| 57 | - $context['warning_status'] = $txt['profile_warning_is_watch']; |
|
| 54 | + if (!empty($modSettings['warning_mute']) && $modSettings['warning_mute'] <= $context['member']['warning']) { |
|
| 55 | + $context['warning_status'] = $txt['profile_warning_is_muted']; |
|
| 56 | + } elseif (!empty($modSettings['warning_moderate']) && $modSettings['warning_moderate'] <= $context['member']['warning']) { |
|
| 57 | + $context['warning_status'] = $txt['profile_warning_is_moderation']; |
|
| 58 | + } elseif (!empty($modSettings['warning_watch']) && $modSettings['warning_watch'] <= $context['member']['warning']) { |
|
| 59 | + $context['warning_status'] = $txt['profile_warning_is_watch']; |
|
| 60 | + } |
|
| 58 | 61 | |
| 59 | 62 | // They haven't even been registered for a full day!? |
| 60 | 63 | $days_registered = (int) ((time() - $user_profile[$memID]['date_registered']) / (3600 * 24)); |
| 61 | - if (empty($user_profile[$memID]['date_registered']) || $days_registered < 1) |
|
| 62 | - $context['member']['posts_per_day'] = $txt['not_applicable']; |
|
| 63 | - else |
|
| 64 | - $context['member']['posts_per_day'] = comma_format($context['member']['real_posts'] / $days_registered, 3); |
|
| 64 | + if (empty($user_profile[$memID]['date_registered']) || $days_registered < 1) { |
|
| 65 | + $context['member']['posts_per_day'] = $txt['not_applicable']; |
|
| 66 | + } else { |
|
| 67 | + $context['member']['posts_per_day'] = comma_format($context['member']['real_posts'] / $days_registered, 3); |
|
| 68 | + } |
|
| 65 | 69 | |
| 66 | 70 | // Set the age... |
| 67 | 71 | if (empty($context['member']['birth_date']) || substr($context['member']['birth_date'], 0, 4) < 1002) |
@@ -70,8 +74,7 @@ discard block |
||
| 70 | 74 | 'age' => $txt['not_applicable'], |
| 71 | 75 | 'today_is_birthday' => false |
| 72 | 76 | ); |
| 73 | - } |
|
| 74 | - else |
|
| 77 | + } else |
|
| 75 | 78 | { |
| 76 | 79 | list ($birth_year, $birth_month, $birth_day) = sscanf($context['member']['birth_date'], '%d-%d-%d'); |
| 77 | 80 | $datearray = getdate(forum_time()); |
@@ -84,15 +87,16 @@ discard block |
||
| 84 | 87 | if (allowedTo('moderate_forum')) |
| 85 | 88 | { |
| 86 | 89 | // Make sure it's a valid ip address; otherwise, don't bother... |
| 87 | - if (preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $memberContext[$memID]['ip']) == 1 && empty($modSettings['disableHostnameLookup'])) |
|
| 88 | - $context['member']['hostname'] = host_from_ip($memberContext[$memID]['ip']); |
|
| 89 | - else |
|
| 90 | - $context['member']['hostname'] = ''; |
|
| 90 | + if (preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $memberContext[$memID]['ip']) == 1 && empty($modSettings['disableHostnameLookup'])) { |
|
| 91 | + $context['member']['hostname'] = host_from_ip($memberContext[$memID]['ip']); |
|
| 92 | + } else { |
|
| 93 | + $context['member']['hostname'] = ''; |
|
| 94 | + } |
|
| 91 | 95 | |
| 92 | 96 | $context['can_see_ip'] = true; |
| 97 | + } else { |
|
| 98 | + $context['can_see_ip'] = false; |
|
| 93 | 99 | } |
| 94 | - else |
|
| 95 | - $context['can_see_ip'] = false; |
|
| 96 | 100 | |
| 97 | 101 | // Are they hidden? |
| 98 | 102 | $context['member']['is_hidden'] = empty($user_profile[$memID]['show_online']); |
@@ -103,8 +107,9 @@ discard block |
||
| 103 | 107 | include_once($sourcedir . '/Who.php'); |
| 104 | 108 | $action = determineActions($user_profile[$memID]['url']); |
| 105 | 109 | |
| 106 | - if ($action !== false) |
|
| 107 | - $context['member']['action'] = $action; |
|
| 110 | + if ($action !== false) { |
|
| 111 | + $context['member']['action'] = $action; |
|
| 112 | + } |
|
| 108 | 113 | } |
| 109 | 114 | |
| 110 | 115 | // If the user is awaiting activation, and the viewer has permission - setup some activation context messages. |
@@ -167,13 +172,15 @@ discard block |
||
| 167 | 172 | { |
| 168 | 173 | // Work out what restrictions we actually have. |
| 169 | 174 | $ban_restrictions = array(); |
| 170 | - foreach (array('access', 'login', 'post') as $type) |
|
| 171 | - if ($row['cannot_' . $type]) |
|
| 175 | + foreach (array('access', 'login', 'post') as $type) { |
|
| 176 | + if ($row['cannot_' . $type]) |
|
| 172 | 177 | $ban_restrictions[] = $txt['ban_type_' . $type]; |
| 178 | + } |
|
| 173 | 179 | |
| 174 | 180 | // No actual ban in place? |
| 175 | - if (empty($ban_restrictions)) |
|
| 176 | - continue; |
|
| 181 | + if (empty($ban_restrictions)) { |
|
| 182 | + continue; |
|
| 183 | + } |
|
| 177 | 184 | |
| 178 | 185 | // Prepare the link for context. |
| 179 | 186 | $ban_explanation = sprintf($txt['user_cannot_due_to'], implode(', ', $ban_restrictions), '<a href="' . $scripturl . '?action=admin;area=ban;sa=edit;bg=' . $row['id_ban_group'] . '">' . $row['name'] . '</a>'); |
@@ -195,9 +202,10 @@ discard block |
||
| 195 | 202 | $context['print_custom_fields'] = array(); |
| 196 | 203 | |
| 197 | 204 | // Any custom profile fields? |
| 198 | - if (!empty($context['custom_fields'])) |
|
| 199 | - foreach ($context['custom_fields'] as $custom) |
|
| 205 | + if (!empty($context['custom_fields'])) { |
|
| 206 | + foreach ($context['custom_fields'] as $custom) |
|
| 200 | 207 | $context['print_custom_fields'][$context['cust_profile_fields_placement'][$custom['placement']]][] = $custom; |
| 208 | + } |
|
| 201 | 209 | |
| 202 | 210 | } |
| 203 | 211 | |
@@ -241,14 +249,16 @@ discard block |
||
| 241 | 249 | $row['extra'] = !empty($row['extra']) ? $smcFunc['json_decode']($row['extra'], true) : array(); |
| 242 | 250 | $alerts[$id_alert] = $row; |
| 243 | 251 | |
| 244 | - if (!empty($row['sender_id'])) |
|
| 245 | - $senders[] = $row['sender_id']; |
|
| 252 | + if (!empty($row['sender_id'])) { |
|
| 253 | + $senders[] = $row['sender_id']; |
|
| 254 | + } |
|
| 246 | 255 | } |
| 247 | 256 | $smcFunc['db_free_result']($request); |
| 248 | 257 | |
| 249 | 258 | $senders = loadMemberData($senders); |
| 250 | - foreach ($senders as $member) |
|
| 251 | - loadMemberContext($member); |
|
| 259 | + foreach ($senders as $member) { |
|
| 260 | + loadMemberContext($member); |
|
| 261 | + } |
|
| 252 | 262 | |
| 253 | 263 | // Now go through and actually make with the text. |
| 254 | 264 | loadLanguage('Alerts'); |
@@ -262,12 +272,15 @@ discard block |
||
| 262 | 272 | $msgs = array(); |
| 263 | 273 | foreach ($alerts as $id_alert => $alert) |
| 264 | 274 | { |
| 265 | - if (isset($alert['extra']['board'])) |
|
| 266 | - $boards[$alert['extra']['board']] = $txt['board_na']; |
|
| 267 | - if (isset($alert['extra']['topic'])) |
|
| 268 | - $topics[$alert['extra']['topic']] = $txt['topic_na']; |
|
| 269 | - if ($alert['content_type'] == 'msg') |
|
| 270 | - $msgs[$alert['content_id']] = $txt['topic_na']; |
|
| 275 | + if (isset($alert['extra']['board'])) { |
|
| 276 | + $boards[$alert['extra']['board']] = $txt['board_na']; |
|
| 277 | + } |
|
| 278 | + if (isset($alert['extra']['topic'])) { |
|
| 279 | + $topics[$alert['extra']['topic']] = $txt['topic_na']; |
|
| 280 | + } |
|
| 281 | + if ($alert['content_type'] == 'msg') { |
|
| 282 | + $msgs[$alert['content_id']] = $txt['topic_na']; |
|
| 283 | + } |
|
| 271 | 284 | } |
| 272 | 285 | |
| 273 | 286 | // Having figured out what boards etc. there are, let's now get the names of them if we can see them. If not, there's already a fallback set up. |
@@ -282,8 +295,9 @@ discard block |
||
| 282 | 295 | 'boards' => array_keys($boards), |
| 283 | 296 | ) |
| 284 | 297 | ); |
| 285 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 286 | - $boards[$row['id_board']] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'; |
|
| 298 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 299 | + $boards[$row['id_board']] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'; |
|
| 300 | + } |
|
| 287 | 301 | } |
| 288 | 302 | if (!empty($topics)) |
| 289 | 303 | { |
@@ -298,8 +312,9 @@ discard block |
||
| 298 | 312 | 'topics' => array_keys($topics), |
| 299 | 313 | ) |
| 300 | 314 | ); |
| 301 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 302 | - $topics[$row['id_topic']] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['subject'] . '</a>'; |
|
| 315 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 316 | + $topics[$row['id_topic']] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['subject'] . '</a>'; |
|
| 317 | + } |
|
| 303 | 318 | } |
| 304 | 319 | if (!empty($msgs)) |
| 305 | 320 | { |
@@ -314,26 +329,33 @@ discard block |
||
| 314 | 329 | 'msgs' => array_keys($msgs), |
| 315 | 330 | ) |
| 316 | 331 | ); |
| 317 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 318 | - $msgs[$row['id_msg']] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>'; |
|
| 332 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 333 | + $msgs[$row['id_msg']] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>'; |
|
| 334 | + } |
|
| 319 | 335 | } |
| 320 | 336 | |
| 321 | 337 | // Now to go back through the alerts, reattach this extra information and then try to build the string out of it (if a hook didn't already) |
| 322 | 338 | foreach ($alerts as $id_alert => $alert) |
| 323 | 339 | { |
| 324 | - if (!empty($alert['text'])) |
|
| 325 | - continue; |
|
| 326 | - if (isset($alert['extra']['board'])) |
|
| 327 | - $alerts[$id_alert]['extra']['board_msg'] = $boards[$alert['extra']['board']]; |
|
| 328 | - if (isset($alert['extra']['topic'])) |
|
| 329 | - $alerts[$id_alert]['extra']['topic_msg'] = $topics[$alert['extra']['topic']]; |
|
| 330 | - if ($alert['content_type'] == 'msg') |
|
| 331 | - $alerts[$id_alert]['extra']['msg_msg'] = $msgs[$alert['content_id']]; |
|
| 332 | - if ($alert['content_type'] == 'profile') |
|
| 333 | - $alerts[$id_alert]['extra']['profile_msg'] = '<a href="' . $scripturl . '?action=profile;u=' . $alerts[$id_alert]['content_id'] . '">' . $alerts[$id_alert]['extra']['user_name'] . '</a>'; |
|
| 334 | - |
|
| 335 | - if (!empty($memberContext[$alert['sender_id']])) |
|
| 336 | - $alerts[$id_alert]['sender'] = &$memberContext[$alert['sender_id']]; |
|
| 340 | + if (!empty($alert['text'])) { |
|
| 341 | + continue; |
|
| 342 | + } |
|
| 343 | + if (isset($alert['extra']['board'])) { |
|
| 344 | + $alerts[$id_alert]['extra']['board_msg'] = $boards[$alert['extra']['board']]; |
|
| 345 | + } |
|
| 346 | + if (isset($alert['extra']['topic'])) { |
|
| 347 | + $alerts[$id_alert]['extra']['topic_msg'] = $topics[$alert['extra']['topic']]; |
|
| 348 | + } |
|
| 349 | + if ($alert['content_type'] == 'msg') { |
|
| 350 | + $alerts[$id_alert]['extra']['msg_msg'] = $msgs[$alert['content_id']]; |
|
| 351 | + } |
|
| 352 | + if ($alert['content_type'] == 'profile') { |
|
| 353 | + $alerts[$id_alert]['extra']['profile_msg'] = '<a href="' . $scripturl . '?action=profile;u=' . $alerts[$id_alert]['content_id'] . '">' . $alerts[$id_alert]['extra']['user_name'] . '</a>'; |
|
| 354 | + } |
|
| 355 | + |
|
| 356 | + if (!empty($memberContext[$alert['sender_id']])) { |
|
| 357 | + $alerts[$id_alert]['sender'] = &$memberContext[$alert['sender_id']]; |
|
| 358 | + } |
|
| 337 | 359 | |
| 338 | 360 | $string = 'alert_' . $alert['content_type'] . '_' . $alert['content_action']; |
| 339 | 361 | if (isset($txt[$string])) |
@@ -421,11 +443,11 @@ discard block |
||
| 421 | 443 | checkSession('request'); |
| 422 | 444 | |
| 423 | 445 | // Call it! |
| 424 | - if ($action == 'remove') |
|
| 425 | - alert_delete($toMark, $memID); |
|
| 426 | - |
|
| 427 | - else |
|
| 428 | - alert_mark($memID, $toMark, $action == 'read' ? 1 : 0); |
|
| 446 | + if ($action == 'remove') { |
|
| 447 | + alert_delete($toMark, $memID); |
|
| 448 | + } else { |
|
| 449 | + alert_mark($memID, $toMark, $action == 'read' ? 1 : 0); |
|
| 450 | + } |
|
| 429 | 451 | |
| 430 | 452 | // Set a nice update message. |
| 431 | 453 | $_SESSION['update_message'] = true; |
@@ -475,23 +497,27 @@ discard block |
||
| 475 | 497 | ); |
| 476 | 498 | |
| 477 | 499 | // Set the page title |
| 478 | - if (isset($_GET['sa']) && array_key_exists($_GET['sa'], $title)) |
|
| 479 | - $context['page_title'] = $txt['show' . $title[$_GET['sa']]]; |
|
| 480 | - else |
|
| 481 | - $context['page_title'] = $txt['showPosts']; |
|
| 500 | + if (isset($_GET['sa']) && array_key_exists($_GET['sa'], $title)) { |
|
| 501 | + $context['page_title'] = $txt['show' . $title[$_GET['sa']]]; |
|
| 502 | + } else { |
|
| 503 | + $context['page_title'] = $txt['showPosts']; |
|
| 504 | + } |
|
| 482 | 505 | |
| 483 | 506 | $context['page_title'] .= ' - ' . $user_profile[$memID]['real_name']; |
| 484 | 507 | |
| 485 | 508 | // Is the load average too high to allow searching just now? |
| 486 | - if (!empty($context['load_average']) && !empty($modSettings['loadavg_show_posts']) && $context['load_average'] >= $modSettings['loadavg_show_posts']) |
|
| 487 | - fatal_lang_error('loadavg_show_posts_disabled', false); |
|
| 509 | + if (!empty($context['load_average']) && !empty($modSettings['loadavg_show_posts']) && $context['load_average'] >= $modSettings['loadavg_show_posts']) { |
|
| 510 | + fatal_lang_error('loadavg_show_posts_disabled', false); |
|
| 511 | + } |
|
| 488 | 512 | |
| 489 | 513 | // If we're specifically dealing with attachments use that function! |
| 490 | - if (isset($_GET['sa']) && $_GET['sa'] == 'attach') |
|
| 491 | - return showAttachments($memID); |
|
| 514 | + if (isset($_GET['sa']) && $_GET['sa'] == 'attach') { |
|
| 515 | + return showAttachments($memID); |
|
| 516 | + } |
|
| 492 | 517 | // Instead, if we're dealing with unwatched topics (and the feature is enabled) use that other function. |
| 493 | - elseif (isset($_GET['sa']) && $_GET['sa'] == 'unwatchedtopics') |
|
| 494 | - return showUnwatched($memID); |
|
| 518 | + elseif (isset($_GET['sa']) && $_GET['sa'] == 'unwatchedtopics') { |
|
| 519 | + return showUnwatched($memID); |
|
| 520 | + } |
|
| 495 | 521 | |
| 496 | 522 | // Are we just viewing topics? |
| 497 | 523 | $context['is_topics'] = isset($_GET['sa']) && $_GET['sa'] == 'topics' ? true : false; |
@@ -514,27 +540,30 @@ discard block |
||
| 514 | 540 | $smcFunc['db_free_result']($request); |
| 515 | 541 | |
| 516 | 542 | // Trying to remove a message that doesn't exist. |
| 517 | - if (empty($info)) |
|
| 518 | - redirectexit('action=profile;u=' . $memID . ';area=showposts;start=' . $_GET['start']); |
|
| 543 | + if (empty($info)) { |
|
| 544 | + redirectexit('action=profile;u=' . $memID . ';area=showposts;start=' . $_GET['start']); |
|
| 545 | + } |
|
| 519 | 546 | |
| 520 | 547 | // We can be lazy, since removeMessage() will check the permissions for us. |
| 521 | 548 | require_once($sourcedir . '/RemoveTopic.php'); |
| 522 | 549 | removeMessage((int) $_GET['delete']); |
| 523 | 550 | |
| 524 | 551 | // Add it to the mod log. |
| 525 | - if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id'])) |
|
| 526 | - logAction('delete', array('topic' => $info[2], 'subject' => $info[0], 'member' => $info[1], 'board' => $info[3])); |
|
| 552 | + if (allowedTo('delete_any') && (!allowedTo('delete_own') || $info[1] != $user_info['id'])) { |
|
| 553 | + logAction('delete', array('topic' => $info[2], 'subject' => $info[0], 'member' => $info[1], 'board' => $info[3])); |
|
| 554 | + } |
|
| 527 | 555 | |
| 528 | 556 | // Back to... where we are now ;). |
| 529 | 557 | redirectexit('action=profile;u=' . $memID . ';area=showposts;start=' . $_GET['start']); |
| 530 | 558 | } |
| 531 | 559 | |
| 532 | 560 | // Default to 10. |
| 533 | - if (empty($_REQUEST['viewscount']) || !is_numeric($_REQUEST['viewscount'])) |
|
| 534 | - $_REQUEST['viewscount'] = '10'; |
|
| 561 | + if (empty($_REQUEST['viewscount']) || !is_numeric($_REQUEST['viewscount'])) { |
|
| 562 | + $_REQUEST['viewscount'] = '10'; |
|
| 563 | + } |
|
| 535 | 564 | |
| 536 | - if ($context['is_topics']) |
|
| 537 | - $request = $smcFunc['db_query']('', ' |
|
| 565 | + if ($context['is_topics']) { |
|
| 566 | + $request = $smcFunc['db_query']('', ' |
|
| 538 | 567 | SELECT COUNT(*) |
| 539 | 568 | FROM {db_prefix}topics AS t' . ($user_info['query_see_board'] == '1=1' ? '' : ' |
| 540 | 569 | INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board AND {query_see_board})') . ' |
@@ -547,8 +576,8 @@ discard block |
||
| 547 | 576 | 'board' => $board, |
| 548 | 577 | ) |
| 549 | 578 | ); |
| 550 | - else |
|
| 551 | - $request = $smcFunc['db_query']('', ' |
|
| 579 | + } else { |
|
| 580 | + $request = $smcFunc['db_query']('', ' |
|
| 552 | 581 | SELECT COUNT(*) |
| 553 | 582 | FROM {db_prefix}messages AS m' . ($user_info['query_see_board'] == '1=1' ? '' : ' |
| 554 | 583 | INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board AND {query_see_board})') . ' |
@@ -561,6 +590,7 @@ discard block |
||
| 561 | 590 | 'board' => $board, |
| 562 | 591 | ) |
| 563 | 592 | ); |
| 593 | + } |
|
| 564 | 594 | list ($msgCount) = $smcFunc['db_fetch_row']($request); |
| 565 | 595 | $smcFunc['db_free_result']($request); |
| 566 | 596 | |
@@ -581,10 +611,11 @@ discard block |
||
| 581 | 611 | |
| 582 | 612 | $range_limit = ''; |
| 583 | 613 | |
| 584 | - if ($context['is_topics']) |
|
| 585 | - $maxPerPage = empty($modSettings['disableCustomPerPage']) && !empty($options['topics_per_page']) ? $options['topics_per_page'] : $modSettings['defaultMaxTopics']; |
|
| 586 | - else |
|
| 587 | - $maxPerPage = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) ? $options['messages_per_page'] : $modSettings['defaultMaxMessages']; |
|
| 614 | + if ($context['is_topics']) { |
|
| 615 | + $maxPerPage = empty($modSettings['disableCustomPerPage']) && !empty($options['topics_per_page']) ? $options['topics_per_page'] : $modSettings['defaultMaxTopics']; |
|
| 616 | + } else { |
|
| 617 | + $maxPerPage = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) ? $options['messages_per_page'] : $modSettings['defaultMaxMessages']; |
|
| 618 | + } |
|
| 588 | 619 | |
| 589 | 620 | $maxIndex = $maxPerPage; |
| 590 | 621 | |
@@ -610,9 +641,9 @@ discard block |
||
| 610 | 641 | { |
| 611 | 642 | $margin *= 5; |
| 612 | 643 | $range_limit = $reverse ? 't.id_first_msg < ' . ($min_msg_member + $margin) : 't.id_first_msg > ' . ($max_msg_member - $margin); |
| 644 | + } else { |
|
| 645 | + $range_limit = $reverse ? 'm.id_msg < ' . ($min_msg_member + $margin) : 'm.id_msg > ' . ($max_msg_member - $margin); |
|
| 613 | 646 | } |
| 614 | - else |
|
| 615 | - $range_limit = $reverse ? 'm.id_msg < ' . ($min_msg_member + $margin) : 'm.id_msg > ' . ($max_msg_member - $margin); |
|
| 616 | 647 | } |
| 617 | 648 | |
| 618 | 649 | // Find this user's posts. The left join on categories somehow makes this faster, weird as it looks. |
@@ -644,8 +675,7 @@ discard block |
||
| 644 | 675 | 'max' => $maxIndex, |
| 645 | 676 | ) |
| 646 | 677 | ); |
| 647 | - } |
|
| 648 | - else |
|
| 678 | + } else |
|
| 649 | 679 | { |
| 650 | 680 | $request = $smcFunc['db_query']('', ' |
| 651 | 681 | SELECT |
@@ -674,8 +704,9 @@ discard block |
||
| 674 | 704 | } |
| 675 | 705 | |
| 676 | 706 | // Make sure we quit this loop. |
| 677 | - if ($smcFunc['db_num_rows']($request) === $maxIndex || $looped) |
|
| 678 | - break; |
|
| 707 | + if ($smcFunc['db_num_rows']($request) === $maxIndex || $looped) { |
|
| 708 | + break; |
|
| 709 | + } |
|
| 679 | 710 | $looped = true; |
| 680 | 711 | $range_limit = ''; |
| 681 | 712 | } |
@@ -719,19 +750,21 @@ discard block |
||
| 719 | 750 | 'css_class' => $row['approved'] ? 'windowbg' : 'approvebg', |
| 720 | 751 | ); |
| 721 | 752 | |
| 722 | - if ($user_info['id'] == $row['id_member_started']) |
|
| 723 | - $board_ids['own'][$row['id_board']][] = $counter; |
|
| 753 | + if ($user_info['id'] == $row['id_member_started']) { |
|
| 754 | + $board_ids['own'][$row['id_board']][] = $counter; |
|
| 755 | + } |
|
| 724 | 756 | $board_ids['any'][$row['id_board']][] = $counter; |
| 725 | 757 | } |
| 726 | 758 | $smcFunc['db_free_result']($request); |
| 727 | 759 | |
| 728 | 760 | // All posts were retrieved in reverse order, get them right again. |
| 729 | - if ($reverse) |
|
| 730 | - $context['posts'] = array_reverse($context['posts'], true); |
|
| 761 | + if ($reverse) { |
|
| 762 | + $context['posts'] = array_reverse($context['posts'], true); |
|
| 763 | + } |
|
| 731 | 764 | |
| 732 | 765 | // These are all the permissions that are different from board to board.. |
| 733 | - if ($context['is_topics']) |
|
| 734 | - $permissions = array( |
|
| 766 | + if ($context['is_topics']) { |
|
| 767 | + $permissions = array( |
|
| 735 | 768 | 'own' => array( |
| 736 | 769 | 'post_reply_own' => 'can_reply', |
| 737 | 770 | ), |
@@ -739,8 +772,8 @@ discard block |
||
| 739 | 772 | 'post_reply_any' => 'can_reply', |
| 740 | 773 | ) |
| 741 | 774 | ); |
| 742 | - else |
|
| 743 | - $permissions = array( |
|
| 775 | + } else { |
|
| 776 | + $permissions = array( |
|
| 744 | 777 | 'own' => array( |
| 745 | 778 | 'post_reply_own' => 'can_reply', |
| 746 | 779 | 'delete_own' => 'can_delete', |
@@ -750,6 +783,7 @@ discard block |
||
| 750 | 783 | 'delete_any' => 'can_delete', |
| 751 | 784 | ) |
| 752 | 785 | ); |
| 786 | + } |
|
| 753 | 787 | |
| 754 | 788 | // For every permission in the own/any lists... |
| 755 | 789 | foreach ($permissions as $type => $list) |
@@ -760,19 +794,22 @@ discard block |
||
| 760 | 794 | $boards = boardsAllowedTo($permission); |
| 761 | 795 | |
| 762 | 796 | // Hmm, they can do it on all boards, can they? |
| 763 | - if (!empty($boards) && $boards[0] == 0) |
|
| 764 | - $boards = array_keys($board_ids[$type]); |
|
| 797 | + if (!empty($boards) && $boards[0] == 0) { |
|
| 798 | + $boards = array_keys($board_ids[$type]); |
|
| 799 | + } |
|
| 765 | 800 | |
| 766 | 801 | // Now go through each board they can do the permission on. |
| 767 | 802 | foreach ($boards as $board_id) |
| 768 | 803 | { |
| 769 | 804 | // There aren't any posts displayed from this board. |
| 770 | - if (!isset($board_ids[$type][$board_id])) |
|
| 771 | - continue; |
|
| 805 | + if (!isset($board_ids[$type][$board_id])) { |
|
| 806 | + continue; |
|
| 807 | + } |
|
| 772 | 808 | |
| 773 | 809 | // Set the permission to true ;). |
| 774 | - foreach ($board_ids[$type][$board_id] as $counter) |
|
| 775 | - $context['posts'][$counter][$allowed] = true; |
|
| 810 | + foreach ($board_ids[$type][$board_id] as $counter) { |
|
| 811 | + $context['posts'][$counter][$allowed] = true; |
|
| 812 | + } |
|
| 776 | 813 | } |
| 777 | 814 | } |
| 778 | 815 | } |
@@ -803,8 +840,9 @@ discard block |
||
| 803 | 840 | $boardsAllowed = boardsAllowedTo('view_attachments'); |
| 804 | 841 | |
| 805 | 842 | // Make sure we can't actually see anything... |
| 806 | - if (empty($boardsAllowed)) |
|
| 807 | - $boardsAllowed = array(-1); |
|
| 843 | + if (empty($boardsAllowed)) { |
|
| 844 | + $boardsAllowed = array(-1); |
|
| 845 | + } |
|
| 808 | 846 | |
| 809 | 847 | require_once($sourcedir . '/Subs-List.php'); |
| 810 | 848 | |
@@ -955,8 +993,8 @@ discard block |
||
| 955 | 993 | ) |
| 956 | 994 | ); |
| 957 | 995 | $attachments = array(); |
| 958 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 959 | - $attachments[] = array( |
|
| 996 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 997 | + $attachments[] = array( |
|
| 960 | 998 | 'id' => $row['id_attach'], |
| 961 | 999 | 'filename' => $row['filename'], |
| 962 | 1000 | 'downloads' => $row['downloads'], |
@@ -968,6 +1006,7 @@ discard block |
||
| 968 | 1006 | 'board_name' => $row['name'], |
| 969 | 1007 | 'approved' => $row['approved'], |
| 970 | 1008 | ); |
| 1009 | + } |
|
| 971 | 1010 | |
| 972 | 1011 | $smcFunc['db_free_result']($request); |
| 973 | 1012 | |
@@ -1022,8 +1061,9 @@ discard block |
||
| 1022 | 1061 | global $txt, $user_info, $scripturl, $modSettings, $context, $sourcedir; |
| 1023 | 1062 | |
| 1024 | 1063 | // Only the owner can see the list (if the function is enabled of course) |
| 1025 | - if ($user_info['id'] != $memID) |
|
| 1026 | - return; |
|
| 1064 | + if ($user_info['id'] != $memID) { |
|
| 1065 | + return; |
|
| 1066 | + } |
|
| 1027 | 1067 | |
| 1028 | 1068 | require_once($sourcedir . '/Subs-List.php'); |
| 1029 | 1069 | |
@@ -1169,8 +1209,9 @@ discard block |
||
| 1169 | 1209 | ); |
| 1170 | 1210 | |
| 1171 | 1211 | $topics = array(); |
| 1172 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1173 | - $topics[] = $row['id_topic']; |
|
| 1212 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1213 | + $topics[] = $row['id_topic']; |
|
| 1214 | + } |
|
| 1174 | 1215 | |
| 1175 | 1216 | $smcFunc['db_free_result']($request); |
| 1176 | 1217 | |
@@ -1190,8 +1231,9 @@ discard block |
||
| 1190 | 1231 | 'topics' => $topics, |
| 1191 | 1232 | ) |
| 1192 | 1233 | ); |
| 1193 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1194 | - $topicsInfo[] = $row; |
|
| 1234 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1235 | + $topicsInfo[] = $row; |
|
| 1236 | + } |
|
| 1195 | 1237 | $smcFunc['db_free_result']($request); |
| 1196 | 1238 | } |
| 1197 | 1239 | |
@@ -1239,8 +1281,9 @@ discard block |
||
| 1239 | 1281 | $context['page_title'] = $txt['statPanel_showStats'] . ' ' . $user_profile[$memID]['real_name']; |
| 1240 | 1282 | |
| 1241 | 1283 | // Is the load average too high to allow searching just now? |
| 1242 | - if (!empty($context['load_average']) && !empty($modSettings['loadavg_userstats']) && $context['load_average'] >= $modSettings['loadavg_userstats']) |
|
| 1243 | - fatal_lang_error('loadavg_userstats_disabled', false); |
|
| 1284 | + if (!empty($context['load_average']) && !empty($modSettings['loadavg_userstats']) && $context['load_average'] >= $modSettings['loadavg_userstats']) { |
|
| 1285 | + fatal_lang_error('loadavg_userstats_disabled', false); |
|
| 1286 | + } |
|
| 1244 | 1287 | |
| 1245 | 1288 | // General user statistics. |
| 1246 | 1289 | $timeDays = floor($user_profile[$memID]['total_time_logged_in'] / 86400); |
@@ -1398,11 +1441,13 @@ discard block |
||
| 1398 | 1441 | } |
| 1399 | 1442 | $smcFunc['db_free_result']($result); |
| 1400 | 1443 | |
| 1401 | - if ($maxPosts > 0) |
|
| 1402 | - for ($hour = 0; $hour < 24; $hour++) |
|
| 1444 | + if ($maxPosts > 0) { |
|
| 1445 | + for ($hour = 0; |
|
| 1446 | + } |
|
| 1447 | + $hour < 24; $hour++) |
|
| 1403 | 1448 | { |
| 1404 | - if (!isset($context['posts_by_time'][$hour])) |
|
| 1405 | - $context['posts_by_time'][$hour] = array( |
|
| 1449 | + if (!isset($context['posts_by_time'][$hour])) { |
|
| 1450 | + $context['posts_by_time'][$hour] = array( |
|
| 1406 | 1451 | 'hour' => $hour, |
| 1407 | 1452 | 'hour_format' => stripos($user_info['time_format'], '%p') === false ? $hour : date('g a', mktime($hour)), |
| 1408 | 1453 | 'posts' => 0, |
@@ -1410,7 +1455,7 @@ discard block |
||
| 1410 | 1455 | 'relative_percent' => 0, |
| 1411 | 1456 | 'is_last' => $hour == 23, |
| 1412 | 1457 | ); |
| 1413 | - else |
|
| 1458 | + } else |
|
| 1414 | 1459 | { |
| 1415 | 1460 | $context['posts_by_time'][$hour]['posts_percent'] = round(($context['posts_by_time'][$hour]['posts'] * 100) / $realPosts); |
| 1416 | 1461 | $context['posts_by_time'][$hour]['relative_percent'] = round(($context['posts_by_time'][$hour]['posts'] * 100) / $maxPosts); |
@@ -1443,8 +1488,9 @@ discard block |
||
| 1443 | 1488 | |
| 1444 | 1489 | foreach ($subActions as $sa => $action) |
| 1445 | 1490 | { |
| 1446 | - if (!allowedTo($action[2])) |
|
| 1447 | - unset($subActions[$sa]); |
|
| 1491 | + if (!allowedTo($action[2])) { |
|
| 1492 | + unset($subActions[$sa]); |
|
| 1493 | + } |
|
| 1448 | 1494 | } |
| 1449 | 1495 | |
| 1450 | 1496 | // Create the tabs for the template. |
@@ -1462,15 +1508,18 @@ discard block |
||
| 1462 | 1508 | ); |
| 1463 | 1509 | |
| 1464 | 1510 | // Moderation must be on to track edits. |
| 1465 | - if (empty($modSettings['userlog_enabled'])) |
|
| 1466 | - unset($context[$context['profile_menu_name']]['tab_data']['edits'], $subActions['edits']); |
|
| 1511 | + if (empty($modSettings['userlog_enabled'])) { |
|
| 1512 | + unset($context[$context['profile_menu_name']]['tab_data']['edits'], $subActions['edits']); |
|
| 1513 | + } |
|
| 1467 | 1514 | |
| 1468 | 1515 | // Group requests must be active to show it... |
| 1469 | - if (empty($modSettings['show_group_membership'])) |
|
| 1470 | - unset($context[$context['profile_menu_name']]['tab_data']['groupreq'], $subActions['groupreq']); |
|
| 1516 | + if (empty($modSettings['show_group_membership'])) { |
|
| 1517 | + unset($context[$context['profile_menu_name']]['tab_data']['groupreq'], $subActions['groupreq']); |
|
| 1518 | + } |
|
| 1471 | 1519 | |
| 1472 | - if (empty($subActions)) |
|
| 1473 | - fatal_lang_error('no_access', false); |
|
| 1520 | + if (empty($subActions)) { |
|
| 1521 | + fatal_lang_error('no_access', false); |
|
| 1522 | + } |
|
| 1474 | 1523 | |
| 1475 | 1524 | $keys = array_keys($subActions); |
| 1476 | 1525 | $default = array_shift($keys); |
@@ -1483,9 +1532,10 @@ discard block |
||
| 1483 | 1532 | $context['sub_template'] = $subActions[$context['tracking_area']][0]; |
| 1484 | 1533 | $call = call_helper($subActions[$context['tracking_area']][0], true); |
| 1485 | 1534 | |
| 1486 | - if (!empty($call)) |
|
| 1487 | - call_user_func($call, $memID); |
|
| 1488 | -} |
|
| 1535 | + if (!empty($call)) { |
|
| 1536 | + call_user_func($call, $memID); |
|
| 1537 | + } |
|
| 1538 | + } |
|
| 1489 | 1539 | |
| 1490 | 1540 | /** |
| 1491 | 1541 | * Handles tracking a user's activity |
@@ -1501,8 +1551,9 @@ discard block |
||
| 1501 | 1551 | isAllowedTo('moderate_forum'); |
| 1502 | 1552 | |
| 1503 | 1553 | $context['last_ip'] = $user_profile[$memID]['member_ip']; |
| 1504 | - if ($context['last_ip'] != $user_profile[$memID]['member_ip2']) |
|
| 1505 | - $context['last_ip2'] = $user_profile[$memID]['member_ip2']; |
|
| 1554 | + if ($context['last_ip'] != $user_profile[$memID]['member_ip2']) { |
|
| 1555 | + $context['last_ip2'] = $user_profile[$memID]['member_ip2']; |
|
| 1556 | + } |
|
| 1506 | 1557 | $context['member']['name'] = $user_profile[$memID]['real_name']; |
| 1507 | 1558 | |
| 1508 | 1559 | // Set the options for the list component. |
@@ -1668,8 +1719,9 @@ discard block |
||
| 1668 | 1719 | ) |
| 1669 | 1720 | ); |
| 1670 | 1721 | $message_members = array(); |
| 1671 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1672 | - $message_members[] = $row['id_member']; |
|
| 1722 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1723 | + $message_members[] = $row['id_member']; |
|
| 1724 | + } |
|
| 1673 | 1725 | $smcFunc['db_free_result']($request); |
| 1674 | 1726 | |
| 1675 | 1727 | // Fetch their names, cause of the GROUP BY doesn't like giving us that normally. |
@@ -1684,8 +1736,9 @@ discard block |
||
| 1684 | 1736 | 'ip_list' => $ips, |
| 1685 | 1737 | ) |
| 1686 | 1738 | ); |
| 1687 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1688 | - $context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
| 1739 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1740 | + $context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
| 1741 | + } |
|
| 1689 | 1742 | $smcFunc['db_free_result']($request); |
| 1690 | 1743 | } |
| 1691 | 1744 | |
@@ -1699,8 +1752,9 @@ discard block |
||
| 1699 | 1752 | 'ip_list' => $ips, |
| 1700 | 1753 | ) |
| 1701 | 1754 | ); |
| 1702 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1703 | - $context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
| 1755 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1756 | + $context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
| 1757 | + } |
|
| 1704 | 1758 | $smcFunc['db_free_result']($request); |
| 1705 | 1759 | } |
| 1706 | 1760 | } |
@@ -1760,8 +1814,8 @@ discard block |
||
| 1760 | 1814 | )) |
| 1761 | 1815 | ); |
| 1762 | 1816 | $error_messages = array(); |
| 1763 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1764 | - $error_messages[] = array( |
|
| 1817 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1818 | + $error_messages[] = array( |
|
| 1765 | 1819 | 'ip' => inet_dtop($row['ip']), |
| 1766 | 1820 | 'member_link' => $row['id_member'] > 0 ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['display_name'] . '</a>' : $row['display_name'], |
| 1767 | 1821 | 'message' => strtr($row['message'], array('<span class="remove">' => '', '</span>' => '')), |
@@ -1769,6 +1823,7 @@ discard block |
||
| 1769 | 1823 | 'time' => timeformat($row['log_time']), |
| 1770 | 1824 | 'timestamp' => forum_time(true, $row['log_time']), |
| 1771 | 1825 | ); |
| 1826 | + } |
|
| 1772 | 1827 | $smcFunc['db_free_result']($request); |
| 1773 | 1828 | |
| 1774 | 1829 | return $error_messages; |
@@ -1831,8 +1886,8 @@ discard block |
||
| 1831 | 1886 | )) |
| 1832 | 1887 | ); |
| 1833 | 1888 | $messages = array(); |
| 1834 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1835 | - $messages[] = array( |
|
| 1889 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1890 | + $messages[] = array( |
|
| 1836 | 1891 | 'ip' => inet_dtop($row['poster_ip']), |
| 1837 | 1892 | 'member_link' => empty($row['id_member']) ? $row['display_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['display_name'] . '</a>', |
| 1838 | 1893 | 'board' => array( |
@@ -1845,6 +1900,7 @@ discard block |
||
| 1845 | 1900 | 'time' => timeformat($row['poster_time']), |
| 1846 | 1901 | 'timestamp' => forum_time(true, $row['poster_time']) |
| 1847 | 1902 | ); |
| 1903 | + } |
|
| 1848 | 1904 | $smcFunc['db_free_result']($request); |
| 1849 | 1905 | |
| 1850 | 1906 | return $messages; |
@@ -1871,19 +1927,20 @@ discard block |
||
| 1871 | 1927 | $context['sub_template'] = 'trackIP'; |
| 1872 | 1928 | $context['page_title'] = $txt['profile']; |
| 1873 | 1929 | $context['base_url'] = $scripturl . '?action=trackip'; |
| 1874 | - } |
|
| 1875 | - else |
|
| 1930 | + } else |
|
| 1876 | 1931 | { |
| 1877 | 1932 | $context['ip'] = $user_profile[$memID]['member_ip']; |
| 1878 | 1933 | $context['base_url'] = $scripturl . '?action=profile;area=tracking;sa=ip;u=' . $memID; |
| 1879 | 1934 | } |
| 1880 | 1935 | |
| 1881 | 1936 | // Searching? |
| 1882 | - if (isset($_REQUEST['searchip'])) |
|
| 1883 | - $context['ip'] = trim($_REQUEST['searchip']); |
|
| 1937 | + if (isset($_REQUEST['searchip'])) { |
|
| 1938 | + $context['ip'] = trim($_REQUEST['searchip']); |
|
| 1939 | + } |
|
| 1884 | 1940 | |
| 1885 | - if (isValidIP($context['ip']) === false) |
|
| 1886 | - fatal_lang_error('invalid_tracking_ip', false); |
|
| 1941 | + if (isValidIP($context['ip']) === false) { |
|
| 1942 | + fatal_lang_error('invalid_tracking_ip', false); |
|
| 1943 | + } |
|
| 1887 | 1944 | |
| 1888 | 1945 | //mysql didn't support like search with varbinary |
| 1889 | 1946 | //$ip_var = str_replace('*', '%', $context['ip']); |
@@ -1891,8 +1948,9 @@ discard block |
||
| 1891 | 1948 | $ip_var = $context['ip']; |
| 1892 | 1949 | $ip_string = '= {inet:ip_address}'; |
| 1893 | 1950 | |
| 1894 | - if (empty($context['tracking_area'])) |
|
| 1895 | - $context['page_title'] = $txt['trackIP'] . ' - ' . $context['ip']; |
|
| 1951 | + if (empty($context['tracking_area'])) { |
|
| 1952 | + $context['page_title'] = $txt['trackIP'] . ' - ' . $context['ip']; |
|
| 1953 | + } |
|
| 1896 | 1954 | |
| 1897 | 1955 | $request = $smcFunc['db_query']('', ' |
| 1898 | 1956 | SELECT id_member, real_name AS display_name, member_ip |
@@ -1903,8 +1961,9 @@ discard block |
||
| 1903 | 1961 | ) |
| 1904 | 1962 | ); |
| 1905 | 1963 | $context['ips'] = array(); |
| 1906 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1907 | - $context['ips'][inet_dtop($row['member_ip'])][] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['display_name'] . '</a>'; |
|
| 1964 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1965 | + $context['ips'][inet_dtop($row['member_ip'])][] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['display_name'] . '</a>'; |
|
| 1966 | + } |
|
| 1908 | 1967 | $smcFunc['db_free_result']($request); |
| 1909 | 1968 | |
| 1910 | 1969 | ksort($context['ips']); |
@@ -2133,8 +2192,9 @@ discard block |
||
| 2133 | 2192 | foreach ($context['whois_servers'] as $whois) |
| 2134 | 2193 | { |
| 2135 | 2194 | // Strip off the "decimal point" and anything following... |
| 2136 | - if (in_array((int) $context['ip'], $whois['range'])) |
|
| 2137 | - $context['auto_whois_server'] = $whois; |
|
| 2195 | + if (in_array((int) $context['ip'], $whois['range'])) { |
|
| 2196 | + $context['auto_whois_server'] = $whois; |
|
| 2197 | + } |
|
| 2138 | 2198 | } |
| 2139 | 2199 | } |
| 2140 | 2200 | } |
@@ -2151,10 +2211,11 @@ discard block |
||
| 2151 | 2211 | // Gonna want this for the list. |
| 2152 | 2212 | require_once($sourcedir . '/Subs-List.php'); |
| 2153 | 2213 | |
| 2154 | - if ($memID == 0) |
|
| 2155 | - $context['base_url'] = $scripturl . '?action=trackip'; |
|
| 2156 | - else |
|
| 2157 | - $context['base_url'] = $scripturl . '?action=profile;area=tracking;sa=ip;u=' . $memID; |
|
| 2214 | + if ($memID == 0) { |
|
| 2215 | + $context['base_url'] = $scripturl . '?action=trackip'; |
|
| 2216 | + } else { |
|
| 2217 | + $context['base_url'] = $scripturl . '?action=profile;area=tracking;sa=ip;u=' . $memID; |
|
| 2218 | + } |
|
| 2158 | 2219 | |
| 2159 | 2220 | // Start with the user messages. |
| 2160 | 2221 | $listOptions = array( |
@@ -2264,12 +2325,13 @@ discard block |
||
| 2264 | 2325 | ) |
| 2265 | 2326 | ); |
| 2266 | 2327 | $logins = array(); |
| 2267 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 2268 | - $logins[] = array( |
|
| 2328 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 2329 | + $logins[] = array( |
|
| 2269 | 2330 | 'time' => timeformat($row['time']), |
| 2270 | 2331 | 'ip' => inet_dtop($row['ip']), |
| 2271 | 2332 | 'ip2' => inet_dtop($row['ip2']), |
| 2272 | 2333 | ); |
| 2334 | + } |
|
| 2273 | 2335 | $smcFunc['db_free_result']($request); |
| 2274 | 2336 | |
| 2275 | 2337 | return $logins; |
@@ -2294,11 +2356,12 @@ discard block |
||
| 2294 | 2356 | ) |
| 2295 | 2357 | ); |
| 2296 | 2358 | $context['custom_field_titles'] = array(); |
| 2297 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 2298 | - $context['custom_field_titles']['customfield_' . $row['col_name']] = array( |
|
| 2359 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 2360 | + $context['custom_field_titles']['customfield_' . $row['col_name']] = array( |
|
| 2299 | 2361 | 'title' => $row['field_name'], |
| 2300 | 2362 | 'parse_bbc' => $row['bbc'], |
| 2301 | 2363 | ); |
| 2364 | + } |
|
| 2302 | 2365 | $smcFunc['db_free_result']($request); |
| 2303 | 2366 | |
| 2304 | 2367 | // Set the options for the error lists. |
@@ -2437,19 +2500,22 @@ discard block |
||
| 2437 | 2500 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 2438 | 2501 | { |
| 2439 | 2502 | $extra = $smcFunc['json_decode']($row['extra'], true); |
| 2440 | - if (!empty($extra['applicator'])) |
|
| 2441 | - $members[] = $extra['applicator']; |
|
| 2503 | + if (!empty($extra['applicator'])) { |
|
| 2504 | + $members[] = $extra['applicator']; |
|
| 2505 | + } |
|
| 2442 | 2506 | |
| 2443 | 2507 | // Work out what the name of the action is. |
| 2444 | - if (isset($txt['trackEdit_action_' . $row['action']])) |
|
| 2445 | - $action_text = $txt['trackEdit_action_' . $row['action']]; |
|
| 2446 | - elseif (isset($txt[$row['action']])) |
|
| 2447 | - $action_text = $txt[$row['action']]; |
|
| 2508 | + if (isset($txt['trackEdit_action_' . $row['action']])) { |
|
| 2509 | + $action_text = $txt['trackEdit_action_' . $row['action']]; |
|
| 2510 | + } elseif (isset($txt[$row['action']])) { |
|
| 2511 | + $action_text = $txt[$row['action']]; |
|
| 2512 | + } |
|
| 2448 | 2513 | // Custom field? |
| 2449 | - elseif (isset($context['custom_field_titles'][$row['action']])) |
|
| 2450 | - $action_text = $context['custom_field_titles'][$row['action']]['title']; |
|
| 2451 | - else |
|
| 2452 | - $action_text = $row['action']; |
|
| 2514 | + elseif (isset($context['custom_field_titles'][$row['action']])) { |
|
| 2515 | + $action_text = $context['custom_field_titles'][$row['action']]['title']; |
|
| 2516 | + } else { |
|
| 2517 | + $action_text = $row['action']; |
|
| 2518 | + } |
|
| 2453 | 2519 | |
| 2454 | 2520 | // Parse BBC? |
| 2455 | 2521 | $parse_bbc = isset($context['custom_field_titles'][$row['action']]) && $context['custom_field_titles'][$row['action']]['parse_bbc'] ? true : false; |
@@ -2481,13 +2547,15 @@ discard block |
||
| 2481 | 2547 | ) |
| 2482 | 2548 | ); |
| 2483 | 2549 | $members = array(); |
| 2484 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 2485 | - $members[$row['id_member']] = $row['real_name']; |
|
| 2550 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 2551 | + $members[$row['id_member']] = $row['real_name']; |
|
| 2552 | + } |
|
| 2486 | 2553 | $smcFunc['db_free_result']($request); |
| 2487 | 2554 | |
| 2488 | - foreach ($edits as $key => $value) |
|
| 2489 | - if (isset($members[$value['id_member']])) |
|
| 2555 | + foreach ($edits as $key => $value) { |
|
| 2556 | + if (isset($members[$value['id_member']])) |
|
| 2490 | 2557 | $edits[$key]['member_link'] = '<a href="' . $scripturl . '?action=profile;u=' . $value['id_member'] . '">' . $members[$value['id_member']] . '</a>'; |
| 2558 | + } |
|
| 2491 | 2559 | } |
| 2492 | 2560 | |
| 2493 | 2561 | return $edits; |
@@ -2688,10 +2756,11 @@ discard block |
||
| 2688 | 2756 | $context['board'] = $board; |
| 2689 | 2757 | |
| 2690 | 2758 | // Determine which groups this user is in. |
| 2691 | - if (empty($user_profile[$memID]['additional_groups'])) |
|
| 2692 | - $curGroups = array(); |
|
| 2693 | - else |
|
| 2694 | - $curGroups = explode(',', $user_profile[$memID]['additional_groups']); |
|
| 2759 | + if (empty($user_profile[$memID]['additional_groups'])) { |
|
| 2760 | + $curGroups = array(); |
|
| 2761 | + } else { |
|
| 2762 | + $curGroups = explode(',', $user_profile[$memID]['additional_groups']); |
|
| 2763 | + } |
|
| 2695 | 2764 | $curGroups[] = $user_profile[$memID]['id_group']; |
| 2696 | 2765 | $curGroups[] = $user_profile[$memID]['id_post_group']; |
| 2697 | 2766 | |
@@ -2711,28 +2780,30 @@ discard block |
||
| 2711 | 2780 | $context['no_access_boards'] = array(); |
| 2712 | 2781 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 2713 | 2782 | { |
| 2714 | - if (count(array_intersect($curGroups, explode(',', $row['member_groups']))) === 0 && !$row['is_mod']) |
|
| 2715 | - $context['no_access_boards'][] = array( |
|
| 2783 | + if (count(array_intersect($curGroups, explode(',', $row['member_groups']))) === 0 && !$row['is_mod']) { |
|
| 2784 | + $context['no_access_boards'][] = array( |
|
| 2716 | 2785 | 'id' => $row['id_board'], |
| 2717 | 2786 | 'name' => $row['name'], |
| 2718 | 2787 | 'is_last' => false, |
| 2719 | 2788 | ); |
| 2720 | - elseif ($row['id_profile'] != 1 || $row['is_mod']) |
|
| 2721 | - $context['boards'][$row['id_board']] = array( |
|
| 2789 | + } elseif ($row['id_profile'] != 1 || $row['is_mod']) { |
|
| 2790 | + $context['boards'][$row['id_board']] = array( |
|
| 2722 | 2791 | 'id' => $row['id_board'], |
| 2723 | 2792 | 'name' => $row['name'], |
| 2724 | 2793 | 'selected' => $board == $row['id_board'], |
| 2725 | 2794 | 'profile' => $row['id_profile'], |
| 2726 | 2795 | 'profile_name' => $context['profiles'][$row['id_profile']]['name'], |
| 2727 | 2796 | ); |
| 2797 | + } |
|
| 2728 | 2798 | } |
| 2729 | 2799 | $smcFunc['db_free_result']($request); |
| 2730 | 2800 | |
| 2731 | 2801 | require_once($sourcedir . '/Subs-Boards.php'); |
| 2732 | 2802 | sortBoards($context['boards']); |
| 2733 | 2803 | |
| 2734 | - if (!empty($context['no_access_boards'])) |
|
| 2735 | - $context['no_access_boards'][count($context['no_access_boards']) - 1]['is_last'] = true; |
|
| 2804 | + if (!empty($context['no_access_boards'])) { |
|
| 2805 | + $context['no_access_boards'][count($context['no_access_boards']) - 1]['is_last'] = true; |
|
| 2806 | + } |
|
| 2736 | 2807 | |
| 2737 | 2808 | $context['member']['permissions'] = array( |
| 2738 | 2809 | 'general' => array(), |
@@ -2741,8 +2812,9 @@ discard block |
||
| 2741 | 2812 | |
| 2742 | 2813 | // If you're an admin we know you can do everything, we might as well leave. |
| 2743 | 2814 | $context['member']['has_all_permissions'] = in_array(1, $curGroups); |
| 2744 | - if ($context['member']['has_all_permissions']) |
|
| 2745 | - return; |
|
| 2815 | + if ($context['member']['has_all_permissions']) { |
|
| 2816 | + return; |
|
| 2817 | + } |
|
| 2746 | 2818 | |
| 2747 | 2819 | $denied = array(); |
| 2748 | 2820 | |
@@ -2761,21 +2833,24 @@ discard block |
||
| 2761 | 2833 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
| 2762 | 2834 | { |
| 2763 | 2835 | // We don't know about this permission, it doesn't exist :P. |
| 2764 | - if (!isset($txt['permissionname_' . $row['permission']])) |
|
| 2765 | - continue; |
|
| 2836 | + if (!isset($txt['permissionname_' . $row['permission']])) { |
|
| 2837 | + continue; |
|
| 2838 | + } |
|
| 2766 | 2839 | |
| 2767 | - if (empty($row['add_deny'])) |
|
| 2768 | - $denied[] = $row['permission']; |
|
| 2840 | + if (empty($row['add_deny'])) { |
|
| 2841 | + $denied[] = $row['permission']; |
|
| 2842 | + } |
|
| 2769 | 2843 | |
| 2770 | 2844 | // Permissions that end with _own or _any consist of two parts. |
| 2771 | - if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)])) |
|
| 2772 | - $name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']]; |
|
| 2773 | - else |
|
| 2774 | - $name = $txt['permissionname_' . $row['permission']]; |
|
| 2845 | + if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)])) { |
|
| 2846 | + $name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']]; |
|
| 2847 | + } else { |
|
| 2848 | + $name = $txt['permissionname_' . $row['permission']]; |
|
| 2849 | + } |
|
| 2775 | 2850 | |
| 2776 | 2851 | // Add this permission if it doesn't exist yet. |
| 2777 | - if (!isset($context['member']['permissions']['general'][$row['permission']])) |
|
| 2778 | - $context['member']['permissions']['general'][$row['permission']] = array( |
|
| 2852 | + if (!isset($context['member']['permissions']['general'][$row['permission']])) { |
|
| 2853 | + $context['member']['permissions']['general'][$row['permission']] = array( |
|
| 2779 | 2854 | 'id' => $row['permission'], |
| 2780 | 2855 | 'groups' => array( |
| 2781 | 2856 | 'allowed' => array(), |
@@ -2785,6 +2860,7 @@ discard block |
||
| 2785 | 2860 | 'is_denied' => false, |
| 2786 | 2861 | 'is_global' => true, |
| 2787 | 2862 | ); |
| 2863 | + } |
|
| 2788 | 2864 | |
| 2789 | 2865 | // Add the membergroup to either the denied or the allowed groups. |
| 2790 | 2866 | $context['member']['permissions']['general'][$row['permission']]['groups'][empty($row['add_deny']) ? 'denied' : 'allowed'][] = $row['id_group'] == 0 ? $txt['membergroups_members'] : $row['group_name']; |
@@ -2818,18 +2894,20 @@ discard block |
||
| 2818 | 2894 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 2819 | 2895 | { |
| 2820 | 2896 | // We don't know about this permission, it doesn't exist :P. |
| 2821 | - if (!isset($txt['permissionname_' . $row['permission']])) |
|
| 2822 | - continue; |
|
| 2897 | + if (!isset($txt['permissionname_' . $row['permission']])) { |
|
| 2898 | + continue; |
|
| 2899 | + } |
|
| 2823 | 2900 | |
| 2824 | 2901 | // The name of the permission using the format 'permission name' - 'own/any topic/event/etc.'. |
| 2825 | - if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)])) |
|
| 2826 | - $name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']]; |
|
| 2827 | - else |
|
| 2828 | - $name = $txt['permissionname_' . $row['permission']]; |
|
| 2902 | + if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)])) { |
|
| 2903 | + $name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']]; |
|
| 2904 | + } else { |
|
| 2905 | + $name = $txt['permissionname_' . $row['permission']]; |
|
| 2906 | + } |
|
| 2829 | 2907 | |
| 2830 | 2908 | // Create the structure for this permission. |
| 2831 | - if (!isset($context['member']['permissions']['board'][$row['permission']])) |
|
| 2832 | - $context['member']['permissions']['board'][$row['permission']] = array( |
|
| 2909 | + if (!isset($context['member']['permissions']['board'][$row['permission']])) { |
|
| 2910 | + $context['member']['permissions']['board'][$row['permission']] = array( |
|
| 2833 | 2911 | 'id' => $row['permission'], |
| 2834 | 2912 | 'groups' => array( |
| 2835 | 2913 | 'allowed' => array(), |
@@ -2839,6 +2917,7 @@ discard block |
||
| 2839 | 2917 | 'is_denied' => false, |
| 2840 | 2918 | 'is_global' => empty($board), |
| 2841 | 2919 | ); |
| 2920 | + } |
|
| 2842 | 2921 | |
| 2843 | 2922 | $context['member']['permissions']['board'][$row['permission']]['groups'][empty($row['add_deny']) ? 'denied' : 'allowed'][$row['id_group']] = $row['id_group'] == 0 ? $txt['membergroups_members'] : $row['group_name']; |
| 2844 | 2923 | |
@@ -2857,8 +2936,9 @@ discard block |
||
| 2857 | 2936 | global $modSettings, $context, $sourcedir, $txt, $scripturl; |
| 2858 | 2937 | |
| 2859 | 2938 | // Firstly, can we actually even be here? |
| 2860 | - if (!($context['user']['is_owner'] && allowedTo('view_warning_own')) && !allowedTo('view_warning_any') && !allowedTo('issue_warning') && !allowedTo('moderate_forum')) |
|
| 2861 | - fatal_lang_error('no_access', false); |
|
| 2939 | + if (!($context['user']['is_owner'] && allowedTo('view_warning_own')) && !allowedTo('view_warning_any') && !allowedTo('issue_warning') && !allowedTo('moderate_forum')) { |
|
| 2940 | + fatal_lang_error('no_access', false); |
|
| 2941 | + } |
|
| 2862 | 2942 | |
| 2863 | 2943 | // Make sure things which are disabled stay disabled. |
| 2864 | 2944 | $modSettings['warning_watch'] = !empty($modSettings['warning_watch']) ? $modSettings['warning_watch'] : 110; |
@@ -2945,9 +3025,10 @@ discard block |
||
| 2945 | 3025 | $modSettings['warning_mute'] => $txt['profile_warning_effect_own_muted'], |
| 2946 | 3026 | ); |
| 2947 | 3027 | $context['current_level'] = 0; |
| 2948 | - foreach ($context['level_effects'] as $limit => $dummy) |
|
| 2949 | - if ($context['member']['warning'] >= $limit) |
|
| 3028 | + foreach ($context['level_effects'] as $limit => $dummy) { |
|
| 3029 | + if ($context['member']['warning'] >= $limit) |
|
| 2950 | 3030 | $context['current_level'] = $limit; |
| 2951 | -} |
|
| 3031 | + } |
|
| 3032 | + } |
|
| 2952 | 3033 | |
| 2953 | 3034 | ?> |
| 2954 | 3035 | \ No newline at end of file |