@@ -54,7 +54,7 @@ |
||
| 54 | 54 | $currentServers = $this->memcached->getServerList(); |
| 55 | 55 | foreach ($servers as $server) |
| 56 | 56 | { |
| 57 | - if (strpos($server,'/') !== false) |
|
| 57 | + if (strpos($server, '/') !== false) |
|
| 58 | 58 | $tempServer = array($server, 0); |
| 59 | 59 | else |
| 60 | 60 | { |
@@ -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('Hacking attempt...'); |
| 16 | +} |
|
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * Our Cache API class |
@@ -34,8 +35,9 @@ discard block |
||
| 34 | 35 | |
| 35 | 36 | $supported = class_exists('memcached'); |
| 36 | 37 | |
| 37 | - if ($test) |
|
| 38 | - return $supported; |
|
| 38 | + if ($test) { |
|
| 39 | + return $supported; |
|
| 40 | + } |
|
| 39 | 41 | return parent::isSupported() && $supported && !empty($cache_memcached); |
| 40 | 42 | } |
| 41 | 43 | |
@@ -53,9 +55,9 @@ discard block |
||
| 53 | 55 | $currentServers = $this->memcached->getServerList(); |
| 54 | 56 | foreach ($servers as $server) |
| 55 | 57 | { |
| 56 | - if (strpos($server,'/') !== false) |
|
| 57 | - $tempServer = array($server, 0); |
|
| 58 | - else |
|
| 58 | + if (strpos($server,'/') !== false) { |
|
| 59 | + $tempServer = array($server, 0); |
|
| 60 | + } else |
|
| 59 | 61 | { |
| 60 | 62 | $server = explode(':', $server); |
| 61 | 63 | $tempServer = array($server[0], isset($server[1]) ? $server[1] : 11211); |
@@ -73,8 +75,9 @@ discard block |
||
| 73 | 75 | } |
| 74 | 76 | |
| 75 | 77 | // Found it? |
| 76 | - if (empty($foundServer)) |
|
| 77 | - $this->memcached->addServer($tempServer[0], $tempServer[1]); |
|
| 78 | + if (empty($foundServer)) { |
|
| 79 | + $this->memcached->addServer($tempServer[0], $tempServer[1]); |
|
| 80 | + } |
|
| 78 | 81 | } |
| 79 | 82 | |
| 80 | 83 | // Best guess is this worked. |
@@ -91,8 +94,9 @@ discard block |
||
| 91 | 94 | $value = $this->memcached->get($key); |
| 92 | 95 | |
| 93 | 96 | // $value should return either data or false (from failure, key not found or empty array). |
| 94 | - if ($value === false) |
|
| 95 | - return null; |
|
| 97 | + if ($value === false) { |
|
| 98 | + return null; |
|
| 99 | + } |
|
| 96 | 100 | return $value; |
| 97 | 101 | } |
| 98 | 102 | |
@@ -135,8 +139,9 @@ discard block |
||
| 135 | 139 | $config_vars[] = $txt['cache_memcache_settings']; |
| 136 | 140 | $config_vars[] = array('cache_memcached', $txt['cache_memcache_servers'], 'file', 'text', 0, 'cache_memcached', 'postinput' => '<br><div class="smalltext"><em>' . $txt['cache_memcache_servers_subtext'] . '</em></div>'); |
| 137 | 141 | |
| 138 | - if (!isset($context['settings_post_javascript'])) |
|
| 139 | - $context['settings_post_javascript'] = ''; |
|
| 142 | + if (!isset($context['settings_post_javascript'])) { |
|
| 143 | + $context['settings_post_javascript'] = ''; |
|
| 144 | + } |
|
| 140 | 145 | |
| 141 | 146 | $context['settings_post_javascript'] .= ' |
| 142 | 147 | $("#cache_accelerator").change(function (e) { |
@@ -555,7 +555,7 @@ |
||
| 555 | 555 | 'subject' => $row_liked_message['subject'], |
| 556 | 556 | 'num' => $row_liked_message['likes'], |
| 557 | 557 | 'href' => $scripturl . '?msg=' . $row_liked_message['id_msg'], |
| 558 | - 'link' => '<a href="' . $scripturl . '?msg=' . $row_liked_message['id_msg'] .'">' . $row_liked_message['subject'] . '</a>' |
|
| 558 | + 'link' => '<a href="' . $scripturl . '?msg=' . $row_liked_message['id_msg'] . '">' . $row_liked_message['subject'] . '</a>' |
|
| 559 | 559 | ); |
| 560 | 560 | |
| 561 | 561 | if ($max_liked_message < $row_liked_message['likes']) |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Display some useful/interesting board statistics. |
@@ -30,8 +31,9 @@ discard block |
||
| 30 | 31 | |
| 31 | 32 | isAllowedTo('view_stats'); |
| 32 | 33 | // Page disabled - redirect them out |
| 33 | - if (empty($modSettings['trackStats'])) |
|
| 34 | - fatal_lang_error('feature_disabled', true); |
|
| 34 | + if (empty($modSettings['trackStats'])) { |
|
| 35 | + fatal_lang_error('feature_disabled', true); |
|
| 36 | + } |
|
| 35 | 37 | |
| 36 | 38 | if (!empty($_REQUEST['expand'])) |
| 37 | 39 | { |
@@ -39,31 +41,34 @@ discard block |
||
| 39 | 41 | |
| 40 | 42 | $month = (int) substr($_REQUEST['expand'], 4); |
| 41 | 43 | $year = (int) substr($_REQUEST['expand'], 0, 4); |
| 42 | - if ($year > 1900 && $year < 2200 && $month >= 1 && $month <= 12) |
|
| 43 | - $_SESSION['expanded_stats'][$year][] = $month; |
|
| 44 | - } |
|
| 45 | - elseif (!empty($_REQUEST['collapse'])) |
|
| 44 | + if ($year > 1900 && $year < 2200 && $month >= 1 && $month <= 12) { |
|
| 45 | + $_SESSION['expanded_stats'][$year][] = $month; |
|
| 46 | + } |
|
| 47 | + } elseif (!empty($_REQUEST['collapse'])) |
|
| 46 | 48 | { |
| 47 | 49 | $context['robot_no_index'] = true; |
| 48 | 50 | |
| 49 | 51 | $month = (int) substr($_REQUEST['collapse'], 4); |
| 50 | 52 | $year = (int) substr($_REQUEST['collapse'], 0, 4); |
| 51 | - if (!empty($_SESSION['expanded_stats'][$year])) |
|
| 52 | - $_SESSION['expanded_stats'][$year] = array_diff($_SESSION['expanded_stats'][$year], array($month)); |
|
| 53 | + if (!empty($_SESSION['expanded_stats'][$year])) { |
|
| 54 | + $_SESSION['expanded_stats'][$year] = array_diff($_SESSION['expanded_stats'][$year], array($month)); |
|
| 55 | + } |
|
| 53 | 56 | } |
| 54 | 57 | |
| 55 | 58 | // Handle the XMLHttpRequest. |
| 56 | 59 | if (isset($_REQUEST['xml'])) |
| 57 | 60 | { |
| 58 | 61 | // Collapsing stats only needs adjustments of the session variables. |
| 59 | - if (!empty($_REQUEST['collapse'])) |
|
| 60 | - obExit(false); |
|
| 62 | + if (!empty($_REQUEST['collapse'])) { |
|
| 63 | + obExit(false); |
|
| 64 | + } |
|
| 61 | 65 | |
| 62 | 66 | $context['sub_template'] = 'stats'; |
| 63 | 67 | $context['yearly'] = array(); |
| 64 | 68 | |
| 65 | - if (empty($month) || empty($year)) |
|
| 66 | - return; |
|
| 69 | + if (empty($month) || empty($year)) { |
|
| 70 | + return; |
|
| 71 | + } |
|
| 67 | 72 | |
| 68 | 73 | getDailyStats('YEAR(date) = {int:year} AND MONTH(date) = {int:month}', array('year' => $year, 'month' => $month)); |
| 69 | 74 | $context['yearly'][$year]['months'][$month]['date'] = array( |
@@ -221,8 +226,9 @@ discard block |
||
| 221 | 226 | 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>' |
| 222 | 227 | ); |
| 223 | 228 | |
| 224 | - if ($max_num_posts < $row_members['posts']) |
|
| 225 | - $max_num_posts = $row_members['posts']; |
|
| 229 | + if ($max_num_posts < $row_members['posts']) { |
|
| 230 | + $max_num_posts = $row_members['posts']; |
|
| 231 | + } |
|
| 226 | 232 | } |
| 227 | 233 | $smcFunc['db_free_result']($members_result); |
| 228 | 234 | |
@@ -258,8 +264,9 @@ discard block |
||
| 258 | 264 | 'link' => '<a href="' . $scripturl . '?board=' . $row_board['id_board'] . '.0">' . $row_board['name'] . '</a>' |
| 259 | 265 | ); |
| 260 | 266 | |
| 261 | - if ($max_num_posts < $row_board['num_posts']) |
|
| 262 | - $max_num_posts = $row_board['num_posts']; |
|
| 267 | + if ($max_num_posts < $row_board['num_posts']) { |
|
| 268 | + $max_num_posts = $row_board['num_posts']; |
|
| 269 | + } |
|
| 263 | 270 | } |
| 264 | 271 | $smcFunc['db_free_result']($boards_result); |
| 265 | 272 | |
@@ -285,12 +292,13 @@ discard block |
||
| 285 | 292 | ) |
| 286 | 293 | ); |
| 287 | 294 | $topic_ids = array(); |
| 288 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 289 | - $topic_ids[] = $row['id_topic']; |
|
| 295 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 296 | + $topic_ids[] = $row['id_topic']; |
|
| 297 | + } |
|
| 290 | 298 | $smcFunc['db_free_result']($request); |
| 299 | + } else { |
|
| 300 | + $topic_ids = array(); |
|
| 291 | 301 | } |
| 292 | - else |
|
| 293 | - $topic_ids = array(); |
|
| 294 | 302 | |
| 295 | 303 | // Topic replies top 10. |
| 296 | 304 | $topic_reply_result = $smcFunc['db_query']('', ' |
@@ -330,8 +338,9 @@ discard block |
||
| 330 | 338 | 'link' => '<a href="' . $scripturl . '?topic=' . $row_topic_reply['id_topic'] . '.0">' . $row_topic_reply['subject'] . '</a>' |
| 331 | 339 | ); |
| 332 | 340 | |
| 333 | - if ($max_num_replies < $row_topic_reply['num_replies']) |
|
| 334 | - $max_num_replies = $row_topic_reply['num_replies']; |
|
| 341 | + if ($max_num_replies < $row_topic_reply['num_replies']) { |
|
| 342 | + $max_num_replies = $row_topic_reply['num_replies']; |
|
| 343 | + } |
|
| 335 | 344 | } |
| 336 | 345 | $smcFunc['db_free_result']($topic_reply_result); |
| 337 | 346 | |
@@ -355,12 +364,13 @@ discard block |
||
| 355 | 364 | ) |
| 356 | 365 | ); |
| 357 | 366 | $topic_ids = array(); |
| 358 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 359 | - $topic_ids[] = $row['id_topic']; |
|
| 367 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 368 | + $topic_ids[] = $row['id_topic']; |
|
| 369 | + } |
|
| 360 | 370 | $smcFunc['db_free_result']($request); |
| 371 | + } else { |
|
| 372 | + $topic_ids = array(); |
|
| 361 | 373 | } |
| 362 | - else |
|
| 363 | - $topic_ids = array(); |
|
| 364 | 374 | |
| 365 | 375 | // Topic views top 10. |
| 366 | 376 | $topic_view_result = $smcFunc['db_query']('', ' |
@@ -400,8 +410,9 @@ discard block |
||
| 400 | 410 | 'link' => '<a href="' . $scripturl . '?topic=' . $row_topic_views['id_topic'] . '.0">' . $row_topic_views['subject'] . '</a>' |
| 401 | 411 | ); |
| 402 | 412 | |
| 403 | - if ($max_num < $row_topic_views['num_views']) |
|
| 404 | - $max_num = $row_topic_views['num_views']; |
|
| 413 | + if ($max_num < $row_topic_views['num_views']) { |
|
| 414 | + $max_num = $row_topic_views['num_views']; |
|
| 415 | + } |
|
| 405 | 416 | } |
| 406 | 417 | $smcFunc['db_free_result']($topic_view_result); |
| 407 | 418 | |
@@ -426,15 +437,17 @@ discard block |
||
| 426 | 437 | ) |
| 427 | 438 | ); |
| 428 | 439 | $members = array(); |
| 429 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 430 | - $members[$row['id_member_started']] = $row['hits']; |
|
| 440 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 441 | + $members[$row['id_member_started']] = $row['hits']; |
|
| 442 | + } |
|
| 431 | 443 | $smcFunc['db_free_result']($request); |
| 432 | 444 | |
| 433 | 445 | cache_put_data('stats_top_starters', $members, 360); |
| 434 | 446 | } |
| 435 | 447 | |
| 436 | - if (empty($members)) |
|
| 437 | - $members = array(0 => 0); |
|
| 448 | + if (empty($members)) { |
|
| 449 | + $members = array(0 => 0); |
|
| 450 | + } |
|
| 438 | 451 | |
| 439 | 452 | // Topic poster top 10. |
| 440 | 453 | $members_result = $smcFunc['db_query']('', ' |
@@ -459,8 +472,9 @@ discard block |
||
| 459 | 472 | 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>' |
| 460 | 473 | ); |
| 461 | 474 | |
| 462 | - if ($max_num < $members[$row_members['id_member']]) |
|
| 463 | - $max_num = $members[$row_members['id_member']]; |
|
| 475 | + if ($max_num < $members[$row_members['id_member']]) { |
|
| 476 | + $max_num = $members[$row_members['id_member']]; |
|
| 477 | + } |
|
| 464 | 478 | } |
| 465 | 479 | ksort($context['stats_blocks']['starters']); |
| 466 | 480 | $smcFunc['db_free_result']($members_result); |
@@ -489,8 +503,9 @@ discard block |
||
| 489 | 503 | while ($row_members = $smcFunc['db_fetch_assoc']($members_result)) |
| 490 | 504 | { |
| 491 | 505 | $temp2[] = (int) $row_members['id_member']; |
| 492 | - if (count($context['stats_blocks']['time_online']) >= 10) |
|
| 493 | - continue; |
|
| 506 | + if (count($context['stats_blocks']['time_online']) >= 10) { |
|
| 507 | + continue; |
|
| 508 | + } |
|
| 494 | 509 | |
| 495 | 510 | // Figure out the days, hours and minutes. |
| 496 | 511 | $timeDays = floor($row_members['total_time_logged_in'] / 86400); |
@@ -498,10 +513,12 @@ discard block |
||
| 498 | 513 | |
| 499 | 514 | // Figure out which things to show... (days, hours, minutes, etc.) |
| 500 | 515 | $timelogged = ''; |
| 501 | - if ($timeDays > 0) |
|
| 502 | - $timelogged .= $timeDays . $txt['totalTimeLogged5']; |
|
| 503 | - if ($timeHours > 0) |
|
| 504 | - $timelogged .= $timeHours . $txt['totalTimeLogged6']; |
|
| 516 | + if ($timeDays > 0) { |
|
| 517 | + $timelogged .= $timeDays . $txt['totalTimeLogged5']; |
|
| 518 | + } |
|
| 519 | + if ($timeHours > 0) { |
|
| 520 | + $timelogged .= $timeHours . $txt['totalTimeLogged6']; |
|
| 521 | + } |
|
| 505 | 522 | $timelogged .= floor(($row_members['total_time_logged_in'] % 3600) / 60) . $txt['totalTimeLogged7']; |
| 506 | 523 | |
| 507 | 524 | $context['stats_blocks']['time_online'][] = array( |
@@ -513,17 +530,20 @@ discard block |
||
| 513 | 530 | 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>' |
| 514 | 531 | ); |
| 515 | 532 | |
| 516 | - if ($max_time_online < $row_members['total_time_logged_in']) |
|
| 517 | - $max_time_online = $row_members['total_time_logged_in']; |
|
| 533 | + if ($max_time_online < $row_members['total_time_logged_in']) { |
|
| 534 | + $max_time_online = $row_members['total_time_logged_in']; |
|
| 535 | + } |
|
| 518 | 536 | } |
| 519 | 537 | $smcFunc['db_free_result']($members_result); |
| 520 | 538 | |
| 521 | - foreach ($context['stats_blocks']['time_online'] as $i => $member) |
|
| 522 | - $context['stats_blocks']['time_online'][$i]['percent'] = round(($member['seconds_online'] * 100) / $max_time_online); |
|
| 539 | + foreach ($context['stats_blocks']['time_online'] as $i => $member) { |
|
| 540 | + $context['stats_blocks']['time_online'][$i]['percent'] = round(($member['seconds_online'] * 100) / $max_time_online); |
|
| 541 | + } |
|
| 523 | 542 | |
| 524 | 543 | // Cache the ones we found for a bit, just so we don't have to look again. |
| 525 | - if ($temp !== $temp2) |
|
| 526 | - cache_put_data('stats_total_time_members', $temp2, 480); |
|
| 544 | + if ($temp !== $temp2) { |
|
| 545 | + cache_put_data('stats_total_time_members', $temp2, 480); |
|
| 546 | + } |
|
| 527 | 547 | |
| 528 | 548 | // Likes. |
| 529 | 549 | if (!empty($modSettings['enable_likes'])) |
@@ -559,13 +579,15 @@ discard block |
||
| 559 | 579 | 'link' => '<a href="' . $scripturl . '?msg=' . $row_liked_message['id_msg'] .'">' . $row_liked_message['subject'] . '</a>' |
| 560 | 580 | ); |
| 561 | 581 | |
| 562 | - if ($max_liked_message < $row_liked_message['likes']) |
|
| 563 | - $max_liked_message = $row_liked_message['likes']; |
|
| 582 | + if ($max_liked_message < $row_liked_message['likes']) { |
|
| 583 | + $max_liked_message = $row_liked_message['likes']; |
|
| 584 | + } |
|
| 564 | 585 | } |
| 565 | 586 | $smcFunc['db_free_result']($liked_messages); |
| 566 | 587 | |
| 567 | - foreach ($context['stats_blocks']['liked_messages'] as $i => $liked_messages) |
|
| 568 | - $context['stats_blocks']['liked_messages'][$i]['percent'] = round(($liked_messages['num'] * 100) / $max_liked_message); |
|
| 588 | + foreach ($context['stats_blocks']['liked_messages'] as $i => $liked_messages) { |
|
| 589 | + $context['stats_blocks']['liked_messages'][$i]['percent'] = round(($liked_messages['num'] * 100) / $max_liked_message); |
|
| 590 | + } |
|
| 569 | 591 | |
| 570 | 592 | // Liked users top 10. |
| 571 | 593 | $context['stats_blocks']['liked_users'] = array(); |
@@ -596,14 +618,16 @@ discard block |
||
| 596 | 618 | 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_liked_users['liked_user'] . '">' . $row_liked_users['real_name'] . '</a>', |
| 597 | 619 | ); |
| 598 | 620 | |
| 599 | - if ($max_liked_users < $row_liked_users['count']) |
|
| 600 | - $max_liked_users = $row_liked_users['count']; |
|
| 621 | + if ($max_liked_users < $row_liked_users['count']) { |
|
| 622 | + $max_liked_users = $row_liked_users['count']; |
|
| 623 | + } |
|
| 601 | 624 | } |
| 602 | 625 | |
| 603 | 626 | $smcFunc['db_free_result']($liked_users); |
| 604 | 627 | |
| 605 | - foreach ($context['stats_blocks']['liked_users'] as $i => $liked_users) |
|
| 606 | - $context['stats_blocks']['liked_users'][$i]['percent'] = round(($liked_users['num'] * 100) / $max_liked_users); |
|
| 628 | + foreach ($context['stats_blocks']['liked_users'] as $i => $liked_users) { |
|
| 629 | + $context['stats_blocks']['liked_users'][$i]['percent'] = round(($liked_users['num'] * 100) / $max_liked_users); |
|
| 630 | + } |
|
| 607 | 631 | } |
| 608 | 632 | |
| 609 | 633 | // Activity by month. |
@@ -621,8 +645,8 @@ discard block |
||
| 621 | 645 | $ID_MONTH = $row_months['stats_year'] . sprintf('%02d', $row_months['stats_month']); |
| 622 | 646 | $expanded = !empty($_SESSION['expanded_stats'][$row_months['stats_year']]) && in_array($row_months['stats_month'], $_SESSION['expanded_stats'][$row_months['stats_year']]); |
| 623 | 647 | |
| 624 | - if (!isset($context['yearly'][$row_months['stats_year']])) |
|
| 625 | - $context['yearly'][$row_months['stats_year']] = array( |
|
| 648 | + if (!isset($context['yearly'][$row_months['stats_year']])) { |
|
| 649 | + $context['yearly'][$row_months['stats_year']] = array( |
|
| 626 | 650 | 'year' => $row_months['stats_year'], |
| 627 | 651 | 'new_topics' => 0, |
| 628 | 652 | 'new_posts' => 0, |
@@ -634,6 +658,7 @@ discard block |
||
| 634 | 658 | 'expanded' => false, |
| 635 | 659 | 'current_year' => $row_months['stats_year'] == date('Y'), |
| 636 | 660 | ); |
| 661 | + } |
|
| 637 | 662 | |
| 638 | 663 | $context['yearly'][$row_months['stats_year']]['months'][(int) $row_months['stats_month']] = array( |
| 639 | 664 | 'id' => $ID_MONTH, |
@@ -679,29 +704,33 @@ discard block |
||
| 679 | 704 | $context['yearly'][$year]['hits'] = comma_format($data['hits']); |
| 680 | 705 | |
| 681 | 706 | // Keep a list of collapsed years. |
| 682 | - if (!$data['expanded'] && !$data['current_year']) |
|
| 683 | - $context['collapsed_years'][] = $year; |
|
| 707 | + if (!$data['expanded'] && !$data['current_year']) { |
|
| 708 | + $context['collapsed_years'][] = $year; |
|
| 709 | + } |
|
| 684 | 710 | } |
| 685 | 711 | |
| 686 | 712 | // Custom stats (just add a template_layer to add it to the template!) |
| 687 | 713 | call_integration_hook('integrate_forum_stats'); |
| 688 | 714 | |
| 689 | - if (empty($_SESSION['expanded_stats'])) |
|
| 690 | - return; |
|
| 715 | + if (empty($_SESSION['expanded_stats'])) { |
|
| 716 | + return; |
|
| 717 | + } |
|
| 691 | 718 | |
| 692 | 719 | $condition_text = array(); |
| 693 | 720 | $condition_params = array(); |
| 694 | - foreach ($_SESSION['expanded_stats'] as $year => $months) |
|
| 695 | - if (!empty($months)) |
|
| 721 | + foreach ($_SESSION['expanded_stats'] as $year => $months) { |
|
| 722 | + if (!empty($months)) |
|
| 696 | 723 | { |
| 697 | 724 | $condition_text[] = 'YEAR(date) = {int:year_' . $year . '} AND MONTH(date) IN ({array_int:months_' . $year . '})'; |
| 725 | + } |
|
| 698 | 726 | $condition_params['year_' . $year] = $year; |
| 699 | 727 | $condition_params['months_' . $year] = $months; |
| 700 | 728 | } |
| 701 | 729 | |
| 702 | 730 | // No daily stats to even look at? |
| 703 | - if (empty($condition_text)) |
|
| 704 | - return; |
|
| 731 | + if (empty($condition_text)) { |
|
| 732 | + return; |
|
| 733 | + } |
|
| 705 | 734 | |
| 706 | 735 | getDailyStats(implode(' OR ', $condition_text), $condition_params); |
| 707 | 736 | } |
@@ -724,8 +753,8 @@ discard block |
||
| 724 | 753 | ORDER BY stats_day ASC', |
| 725 | 754 | $condition_parameters |
| 726 | 755 | ); |
| 727 | - while ($row_days = $smcFunc['db_fetch_assoc']($days_result)) |
|
| 728 | - $context['yearly'][$row_days['stats_year']]['months'][(int) $row_days['stats_month']]['days'][] = array( |
|
| 756 | + while ($row_days = $smcFunc['db_fetch_assoc']($days_result)) { |
|
| 757 | + $context['yearly'][$row_days['stats_year']]['months'][(int) $row_days['stats_month']]['days'][] = array( |
|
| 729 | 758 | 'day' => sprintf('%02d', $row_days['stats_day']), |
| 730 | 759 | 'month' => sprintf('%02d', $row_days['stats_month']), |
| 731 | 760 | 'year' => $row_days['stats_year'], |
@@ -735,6 +764,7 @@ discard block |
||
| 735 | 764 | 'most_members_online' => comma_format($row_days['most_on']), |
| 736 | 765 | 'hits' => comma_format($row_days['hits']) |
| 737 | 766 | ); |
| 767 | + } |
|
| 738 | 768 | $smcFunc['db_free_result']($days_result); |
| 739 | 769 | } |
| 740 | 770 | |
@@ -752,16 +782,19 @@ discard block |
||
| 752 | 782 | global $modSettings, $user_info, $forum_version, $sourcedir; |
| 753 | 783 | |
| 754 | 784 | // First, is it disabled? |
| 755 | - if (empty($modSettings['enable_sm_stats']) || empty($modSettings['sm_stats_key'])) |
|
| 756 | - die(); |
|
| 785 | + if (empty($modSettings['enable_sm_stats']) || empty($modSettings['sm_stats_key'])) { |
|
| 786 | + die(); |
|
| 787 | + } |
|
| 757 | 788 | |
| 758 | 789 | // Are we saying who we are, and are we right? (OR an admin) |
| 759 | - if (!$user_info['is_admin'] && (!isset($_GET['sid']) || $_GET['sid'] != $modSettings['sm_stats_key'])) |
|
| 760 | - die(); |
|
| 790 | + if (!$user_info['is_admin'] && (!isset($_GET['sid']) || $_GET['sid'] != $modSettings['sm_stats_key'])) { |
|
| 791 | + die(); |
|
| 792 | + } |
|
| 761 | 793 | |
| 762 | 794 | // Verify the referer... |
| 763 | - if (!$user_info['is_admin'] && (!isset($_SERVER['HTTP_REFERER']) || md5($_SERVER['HTTP_REFERER']) != '746cb59a1a0d5cf4bd240e5a67c73085')) |
|
| 764 | - die(); |
|
| 795 | + if (!$user_info['is_admin'] && (!isset($_SERVER['HTTP_REFERER']) || md5($_SERVER['HTTP_REFERER']) != '746cb59a1a0d5cf4bd240e5a67c73085')) { |
|
| 796 | + die(); |
|
| 797 | + } |
|
| 765 | 798 | |
| 766 | 799 | // Get some server versions. |
| 767 | 800 | require_once($sourcedir . '/Subs-Admin.php'); |
@@ -787,16 +820,17 @@ discard block |
||
| 787 | 820 | ); |
| 788 | 821 | |
| 789 | 822 | // Encode all the data, for security. |
| 790 | - foreach ($stats_to_send as $k => $v) |
|
| 791 | - $stats_to_send[$k] = urlencode($k) . '=' . urlencode($v); |
|
| 823 | + foreach ($stats_to_send as $k => $v) { |
|
| 824 | + $stats_to_send[$k] = urlencode($k) . '=' . urlencode($v); |
|
| 825 | + } |
|
| 792 | 826 | |
| 793 | 827 | // Turn this into the query string! |
| 794 | 828 | $stats_to_send = implode('&', $stats_to_send); |
| 795 | 829 | |
| 796 | 830 | // If we're an admin, just plonk them out. |
| 797 | - if ($user_info['is_admin']) |
|
| 798 | - echo $stats_to_send; |
|
| 799 | - else |
|
| 831 | + if ($user_info['is_admin']) { |
|
| 832 | + echo $stats_to_send; |
|
| 833 | + } else |
|
| 800 | 834 | { |
| 801 | 835 | // Connect to the collection script. |
| 802 | 836 | $fp = @fsockopen('www.simplemachines.org', 80, $errno, $errstr); |
@@ -1799,9 +1799,9 @@ |
||
| 1799 | 1799 | } |
| 1800 | 1800 | |
| 1801 | 1801 | /** |
| 1802 | - * Callback for createList(). |
|
| 1803 | - * @return int The total number of warning templates |
|
| 1804 | - */ |
|
| 1802 | + * Callback for createList(). |
|
| 1803 | + * @return int The total number of warning templates |
|
| 1804 | + */ |
|
| 1805 | 1805 | function list_getWarningTemplateCount() |
| 1806 | 1806 | { |
| 1807 | 1807 | global $smcFunc, $user_info; |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Entry point for the moderation center. |
@@ -26,8 +27,9 @@ discard block |
||
| 26 | 27 | global $smcFunc, $txt, $context, $scripturl, $modSettings, $user_info, $sourcedir, $options; |
| 27 | 28 | |
| 28 | 29 | // Don't run this twice... and don't conflict with the admin bar. |
| 29 | - if (isset($context['admin_area'])) |
|
| 30 | - return; |
|
| 30 | + if (isset($context['admin_area'])) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 31 | 33 | |
| 32 | 34 | $context['can_moderate_boards'] = $user_info['mod_cache']['bq'] != '0=1'; |
| 33 | 35 | $context['can_moderate_groups'] = $user_info['mod_cache']['gq'] != '0=1'; |
@@ -35,8 +37,9 @@ discard block |
||
| 35 | 37 | $context['can_moderate_users'] = allowedTo('moderate_forum'); |
| 36 | 38 | |
| 37 | 39 | // Everyone using this area must be allowed here! |
| 38 | - if (!$context['can_moderate_boards'] && !$context['can_moderate_groups'] && !$context['can_moderate_approvals'] && !$context['can_moderate_users']) |
|
| 39 | - isAllowedTo('access_mod_center'); |
|
| 40 | + if (!$context['can_moderate_boards'] && !$context['can_moderate_groups'] && !$context['can_moderate_approvals'] && !$context['can_moderate_users']) { |
|
| 41 | + isAllowedTo('access_mod_center'); |
|
| 42 | + } |
|
| 40 | 43 | |
| 41 | 44 | // We're gonna want a menu of some kind. |
| 42 | 45 | require_once($sourcedir . '/Subs-Menu.php'); |
@@ -195,8 +198,9 @@ discard block |
||
| 195 | 198 | unset($moderation_areas); |
| 196 | 199 | |
| 197 | 200 | // We got something - didn't we? DIDN'T WE! |
| 198 | - if ($mod_include_data == false) |
|
| 199 | - fatal_lang_error('no_access', false); |
|
| 201 | + if ($mod_include_data == false) { |
|
| 202 | + fatal_lang_error('no_access', false); |
|
| 203 | + } |
|
| 200 | 204 | |
| 201 | 205 | // Retain the ID information in case required by a subaction. |
| 202 | 206 | $context['moderation_menu_id'] = $context['max_menu_id']; |
@@ -219,22 +223,25 @@ discard block |
||
| 219 | 223 | 'url' => $scripturl . '?action=moderate', |
| 220 | 224 | 'name' => $txt['moderation_center'], |
| 221 | 225 | ); |
| 222 | - if (isset($mod_include_data['current_area']) && $mod_include_data['current_area'] != 'index') |
|
| 223 | - $context['linktree'][] = array( |
|
| 226 | + if (isset($mod_include_data['current_area']) && $mod_include_data['current_area'] != 'index') { |
|
| 227 | + $context['linktree'][] = array( |
|
| 224 | 228 | 'url' => $scripturl . '?action=moderate;area=' . $mod_include_data['current_area'], |
| 225 | 229 | 'name' => $mod_include_data['label'], |
| 226 | 230 | ); |
| 227 | - if (!empty($mod_include_data['current_subsection']) && $mod_include_data['subsections'][$mod_include_data['current_subsection']][0] != $mod_include_data['label']) |
|
| 228 | - $context['linktree'][] = array( |
|
| 231 | + } |
|
| 232 | + if (!empty($mod_include_data['current_subsection']) && $mod_include_data['subsections'][$mod_include_data['current_subsection']][0] != $mod_include_data['label']) { |
|
| 233 | + $context['linktree'][] = array( |
|
| 229 | 234 | 'url' => $scripturl . '?action=moderate;area=' . $mod_include_data['current_area'] . ';sa=' . $mod_include_data['current_subsection'], |
| 230 | 235 | 'name' => $mod_include_data['subsections'][$mod_include_data['current_subsection']][0], |
| 231 | 236 | ); |
| 237 | + } |
|
| 232 | 238 | |
| 233 | 239 | // Now - finally - the bit before the encore - the main performance of course! |
| 234 | 240 | if (!$dont_call) |
| 235 | 241 | { |
| 236 | - if (isset($mod_include_data['file'])) |
|
| 237 | - require_once($sourcedir . '/' . $mod_include_data['file']); |
|
| 242 | + if (isset($mod_include_data['file'])) { |
|
| 243 | + require_once($sourcedir . '/' . $mod_include_data['file']); |
|
| 244 | + } |
|
| 238 | 245 | |
| 239 | 246 | call_helper($mod_include_data['function']); |
| 240 | 247 | } |
@@ -259,8 +266,9 @@ discard block |
||
| 259 | 266 | // Load what blocks the user actually can see... |
| 260 | 267 | $valid_blocks = array(); |
| 261 | 268 | |
| 262 | - if ($context['can_moderate_groups']) |
|
| 263 | - $valid_blocks['g'] = 'GroupRequests'; |
|
| 269 | + if ($context['can_moderate_groups']) { |
|
| 270 | + $valid_blocks['g'] = 'GroupRequests'; |
|
| 271 | + } |
|
| 264 | 272 | if ($context['can_moderate_boards']) |
| 265 | 273 | { |
| 266 | 274 | $valid_blocks['r'] = 'ReportedPosts'; |
@@ -269,8 +277,9 @@ discard block |
||
| 269 | 277 | if ($context['can_moderate_users']) |
| 270 | 278 | { |
| 271 | 279 | // This falls under the category of moderating users as well... |
| 272 | - if (!$context['can_moderate_boards']) |
|
| 273 | - $valid_blocks['w'] = 'WatchedUsers'; |
|
| 280 | + if (!$context['can_moderate_boards']) { |
|
| 281 | + $valid_blocks['w'] = 'WatchedUsers'; |
|
| 282 | + } |
|
| 274 | 283 | |
| 275 | 284 | $valid_blocks['rm'] = 'ReportedMembers'; |
| 276 | 285 | } |
@@ -281,8 +290,9 @@ discard block |
||
| 281 | 290 | foreach ($valid_blocks as $k => $block) |
| 282 | 291 | { |
| 283 | 292 | $block = 'ModBlock' . $block; |
| 284 | - if (function_exists($block)) |
|
| 285 | - $context['mod_blocks'][] = $block(); |
|
| 293 | + if (function_exists($block)) { |
|
| 294 | + $context['mod_blocks'][] = $block(); |
|
| 295 | + } |
|
| 286 | 296 | } |
| 287 | 297 | |
| 288 | 298 | $context['admin_prefs'] = !empty($options['admin_preferences']) ? $smcFunc['json_decode']($options['admin_preferences'], true) : array(); |
@@ -309,8 +319,9 @@ discard block |
||
| 309 | 319 | ) |
| 310 | 320 | ); |
| 311 | 321 | $watched_users = array(); |
| 312 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 313 | - $watched_users[] = $row; |
|
| 322 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 323 | + $watched_users[] = $row; |
|
| 324 | + } |
|
| 314 | 325 | $smcFunc['db_free_result']($request); |
| 315 | 326 | |
| 316 | 327 | cache_put_data('recent_user_watches', $watched_users, 240); |
@@ -402,8 +413,9 @@ discard block |
||
| 402 | 413 | $note_owner = $smcFunc['db_num_rows']($get_owner); |
| 403 | 414 | $smcFunc['db_free_result']($get_owner); |
| 404 | 415 | |
| 405 | - if (empty($note_owner)) |
|
| 406 | - fatal_lang_error('mc_notes_delete_own', false); |
|
| 416 | + if (empty($note_owner)) { |
|
| 417 | + fatal_lang_error('mc_notes_delete_own', false); |
|
| 418 | + } |
|
| 407 | 419 | } |
| 408 | 420 | |
| 409 | 421 | // Lets delete it. |
@@ -460,12 +472,14 @@ discard block |
||
| 460 | 472 | ) |
| 461 | 473 | ); |
| 462 | 474 | $moderator_notes = array(); |
| 463 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 464 | - $moderator_notes[] = $row; |
|
| 475 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 476 | + $moderator_notes[] = $row; |
|
| 477 | + } |
|
| 465 | 478 | $smcFunc['db_free_result']($request); |
| 466 | 479 | |
| 467 | - if ($offset == 0) |
|
| 468 | - cache_put_data('moderator_notes', $moderator_notes, 240); |
|
| 480 | + if ($offset == 0) { |
|
| 481 | + cache_put_data('moderator_notes', $moderator_notes, 240); |
|
| 482 | + } |
|
| 469 | 483 | } |
| 470 | 484 | |
| 471 | 485 | // Lets construct a page index. |
@@ -504,8 +518,9 @@ discard block |
||
| 504 | 518 | // Got the info already? |
| 505 | 519 | $cachekey = md5($smcFunc['json_encode']($user_info['mod_cache']['bq'])); |
| 506 | 520 | $context['reported_posts'] = array(); |
| 507 | - if ($user_info['mod_cache']['bq'] == '0=1') |
|
| 508 | - return 'reported_posts_block'; |
|
| 521 | + if ($user_info['mod_cache']['bq'] == '0=1') { |
|
| 522 | + return 'reported_posts_block'; |
|
| 523 | + } |
|
| 509 | 524 | |
| 510 | 525 | if (($reported_posts = cache_get_data('reported_posts_' . $cachekey, 90)) === null) |
| 511 | 526 | { |
@@ -529,8 +544,9 @@ discard block |
||
| 529 | 544 | ) |
| 530 | 545 | ); |
| 531 | 546 | $reported_posts = array(); |
| 532 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 533 | - $reported_posts[] = $row; |
|
| 547 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 548 | + $reported_posts[] = $row; |
|
| 549 | + } |
|
| 534 | 550 | $smcFunc['db_free_result']($request); |
| 535 | 551 | |
| 536 | 552 | // Cache it. |
@@ -568,8 +584,9 @@ discard block |
||
| 568 | 584 | |
| 569 | 585 | $context['group_requests'] = array(); |
| 570 | 586 | // Make sure they can even moderate someone! |
| 571 | - if ($user_info['mod_cache']['gq'] == '0=1') |
|
| 572 | - return 'group_requests_block'; |
|
| 587 | + if ($user_info['mod_cache']['gq'] == '0=1') { |
|
| 588 | + return 'group_requests_block'; |
|
| 589 | + } |
|
| 573 | 590 | |
| 574 | 591 | // What requests are outstanding? |
| 575 | 592 | $request = $smcFunc['db_query']('', ' |
@@ -618,8 +635,9 @@ discard block |
||
| 618 | 635 | // Got the info already? |
| 619 | 636 | $cachekey = md5($smcFunc['json_encode']((int) allowedTo('moderate_forum'))); |
| 620 | 637 | $context['reported_users'] = array(); |
| 621 | - if (!allowedTo('moderate_forum')) |
|
| 622 | - return 'reported_users_block'; |
|
| 638 | + if (!allowedTo('moderate_forum')) { |
|
| 639 | + return 'reported_users_block'; |
|
| 640 | + } |
|
| 623 | 641 | |
| 624 | 642 | if (($reported_users = cache_get_data('reported_users_' . $cachekey, 90)) === null) |
| 625 | 643 | { |
@@ -642,8 +660,9 @@ discard block |
||
| 642 | 660 | ) |
| 643 | 661 | ); |
| 644 | 662 | $reported_users = array(); |
| 645 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 646 | - $reported_users[] = $row; |
|
| 663 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 664 | + $reported_users[] = $row; |
|
| 665 | + } |
|
| 647 | 666 | $smcFunc['db_free_result']($request); |
| 648 | 667 | |
| 649 | 668 | // Cache it. |
@@ -742,15 +761,15 @@ discard block |
||
| 742 | 761 | // Time to update. |
| 743 | 762 | updateSettings(array('last_mod_report_action' => time())); |
| 744 | 763 | recountOpenReports('members'); |
| 745 | - } |
|
| 746 | - elseif (isset($_POST['close']) && isset($_POST['close_selected'])) |
|
| 764 | + } elseif (isset($_POST['close']) && isset($_POST['close_selected'])) |
|
| 747 | 765 | { |
| 748 | 766 | checkSession(); |
| 749 | 767 | |
| 750 | 768 | // All the ones to update... |
| 751 | 769 | $toClose = array(); |
| 752 | - foreach ($_POST['close'] as $rid) |
|
| 753 | - $toClose[] = (int) $rid; |
|
| 770 | + foreach ($_POST['close'] as $rid) { |
|
| 771 | + $toClose[] = (int) $rid; |
|
| 772 | + } |
|
| 754 | 773 | |
| 755 | 774 | if (!empty($toClose)) |
| 756 | 775 | { |
@@ -903,8 +922,9 @@ discard block |
||
| 903 | 922 | global $context, $user_info; |
| 904 | 923 | |
| 905 | 924 | // You need to be allowed to moderate groups... |
| 906 | - if ($user_info['mod_cache']['gq'] == '0=1') |
|
| 907 | - isAllowedTo('manage_membergroups'); |
|
| 925 | + if ($user_info['mod_cache']['gq'] == '0=1') { |
|
| 926 | + isAllowedTo('manage_membergroups'); |
|
| 927 | + } |
|
| 908 | 928 | |
| 909 | 929 | // Load the group templates. |
| 910 | 930 | loadTemplate('ModerationCenter'); |
@@ -915,8 +935,9 @@ discard block |
||
| 915 | 935 | 'view' => 'ViewGroups', |
| 916 | 936 | ); |
| 917 | 937 | |
| 918 | - if (!isset($_GET['sa']) || !isset($subActions[$_GET['sa']])) |
|
| 919 | - $_GET['sa'] = 'view'; |
|
| 938 | + if (!isset($_GET['sa']) || !isset($subActions[$_GET['sa']])) { |
|
| 939 | + $_GET['sa'] = 'view'; |
|
| 940 | + } |
|
| 920 | 941 | $context['sub_action'] = $_GET['sa']; |
| 921 | 942 | |
| 922 | 943 | // Call the relevant function. |
@@ -946,8 +967,9 @@ discard block |
||
| 946 | 967 | 'id_notice' => $id_notice, |
| 947 | 968 | ) |
| 948 | 969 | ); |
| 949 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
| 950 | - fatal_lang_error('no_access', false); |
|
| 970 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
| 971 | + fatal_lang_error('no_access', false); |
|
| 972 | + } |
|
| 951 | 973 | list ($context['notice_body'], $context['notice_subject']) = $smcFunc['db_fetch_row']($request); |
| 952 | 974 | $smcFunc['db_free_result']($request); |
| 953 | 975 | |
@@ -984,18 +1006,20 @@ discard block |
||
| 984 | 1006 | checkSession(!is_array($_REQUEST['delete']) ? 'get' : 'post'); |
| 985 | 1007 | |
| 986 | 1008 | $toDelete = array(); |
| 987 | - if (!is_array($_REQUEST['delete'])) |
|
| 988 | - $toDelete[] = (int) $_REQUEST['delete']; |
|
| 989 | - else |
|
| 990 | - foreach ($_REQUEST['delete'] as $did) |
|
| 1009 | + if (!is_array($_REQUEST['delete'])) { |
|
| 1010 | + $toDelete[] = (int) $_REQUEST['delete']; |
|
| 1011 | + } else { |
|
| 1012 | + foreach ($_REQUEST['delete'] as $did) |
|
| 991 | 1013 | $toDelete[] = (int) $did; |
| 1014 | + } |
|
| 992 | 1015 | |
| 993 | 1016 | if (!empty($toDelete)) |
| 994 | 1017 | { |
| 995 | 1018 | require_once($sourcedir . '/RemoveTopic.php'); |
| 996 | 1019 | // If they don't have permission we'll let it error - either way no chance of a security slip here! |
| 997 | - foreach ($toDelete as $did) |
|
| 998 | - removeMessage($did); |
|
| 1020 | + foreach ($toDelete as $did) { |
|
| 1021 | + removeMessage($did); |
|
| 1022 | + } |
|
| 999 | 1023 | } |
| 1000 | 1024 | } |
| 1001 | 1025 | |
@@ -1004,20 +1028,21 @@ discard block |
||
| 1004 | 1028 | { |
| 1005 | 1029 | $approve_query = ''; |
| 1006 | 1030 | $delete_boards = array(); |
| 1007 | - } |
|
| 1008 | - else |
|
| 1031 | + } else |
|
| 1009 | 1032 | { |
| 1010 | 1033 | // Still obey permissions! |
| 1011 | 1034 | $approve_boards = boardsAllowedTo('approve_posts'); |
| 1012 | 1035 | $delete_boards = boardsAllowedTo('delete_any'); |
| 1013 | 1036 | |
| 1014 | - if ($approve_boards == array(0)) |
|
| 1015 | - $approve_query = ''; |
|
| 1016 | - elseif (!empty($approve_boards)) |
|
| 1017 | - $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
| 1037 | + if ($approve_boards == array(0)) { |
|
| 1038 | + $approve_query = ''; |
|
| 1039 | + } elseif (!empty($approve_boards)) { |
|
| 1040 | + $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')'; |
|
| 1041 | + } |
|
| 1018 | 1042 | // Nada, zip, etc... |
| 1019 | - else |
|
| 1020 | - $approve_query = ' AND 1=0'; |
|
| 1043 | + else { |
|
| 1044 | + $approve_query = ' AND 1=0'; |
|
| 1045 | + } |
|
| 1021 | 1046 | } |
| 1022 | 1047 | |
| 1023 | 1048 | require_once($sourcedir . '/Subs-List.php'); |
@@ -1116,10 +1141,11 @@ discard block |
||
| 1116 | 1141 | 'data' => array( |
| 1117 | 1142 | 'function' => function($member) use ($scripturl) |
| 1118 | 1143 | { |
| 1119 | - if ($member['last_post_id']) |
|
| 1120 | - return '<a href="' . $scripturl . '?msg=' . $member['last_post_id'] . '">' . $member['last_post'] . '</a>'; |
|
| 1121 | - else |
|
| 1122 | - return $member['last_post']; |
|
| 1144 | + if ($member['last_post_id']) { |
|
| 1145 | + return '<a href="' . $scripturl . '?msg=' . $member['last_post_id'] . '">' . $member['last_post'] . '</a>'; |
|
| 1146 | + } else { |
|
| 1147 | + return $member['last_post']; |
|
| 1148 | + } |
|
| 1123 | 1149 | }, |
| 1124 | 1150 | ), |
| 1125 | 1151 | ), |
@@ -1247,8 +1273,9 @@ discard block |
||
| 1247 | 1273 | ) |
| 1248 | 1274 | ); |
| 1249 | 1275 | $latest_posts = array(); |
| 1250 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1251 | - $latest_posts[$row['id_member']] = $row['last_post_id']; |
|
| 1276 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1277 | + $latest_posts[$row['id_member']] = $row['last_post_id']; |
|
| 1278 | + } |
|
| 1252 | 1279 | |
| 1253 | 1280 | if (!empty($latest_posts)) |
| 1254 | 1281 | { |
@@ -1439,15 +1466,17 @@ discard block |
||
| 1439 | 1466 | // Setup the direction stuff... |
| 1440 | 1467 | $context['order'] = isset($_REQUEST['sort']) && isset($sort_types[$_REQUEST['sort']]) ? $_REQUEST['sort'] : 'member'; |
| 1441 | 1468 | |
| 1442 | - if (!isset($search_params['string']) || (!empty($_REQUEST['search']) && $search_params['string'] != $_REQUEST['search'])) |
|
| 1443 | - $search_params_string = empty($_REQUEST['search']) ? '' : $_REQUEST['search']; |
|
| 1444 | - else |
|
| 1445 | - $search_params_string = $search_params['string']; |
|
| 1469 | + if (!isset($search_params['string']) || (!empty($_REQUEST['search']) && $search_params['string'] != $_REQUEST['search'])) { |
|
| 1470 | + $search_params_string = empty($_REQUEST['search']) ? '' : $_REQUEST['search']; |
|
| 1471 | + } else { |
|
| 1472 | + $search_params_string = $search_params['string']; |
|
| 1473 | + } |
|
| 1446 | 1474 | |
| 1447 | - if (isset($_REQUEST['search_type']) || empty($search_params['type']) || !isset($searchTypes[$search_params['type']])) |
|
| 1448 | - $search_params_type = isset($_REQUEST['search_type']) && isset($searchTypes[$_REQUEST['search_type']]) ? $_REQUEST['search_type'] : (isset($searchTypes[$context['order']]) ? $context['order'] : 'member'); |
|
| 1449 | - else |
|
| 1450 | - $search_params_type = $search_params['type']; |
|
| 1475 | + if (isset($_REQUEST['search_type']) || empty($search_params['type']) || !isset($searchTypes[$search_params['type']])) { |
|
| 1476 | + $search_params_type = isset($_REQUEST['search_type']) && isset($searchTypes[$_REQUEST['search_type']]) ? $_REQUEST['search_type'] : (isset($searchTypes[$context['order']]) ? $context['order'] : 'member'); |
|
| 1477 | + } else { |
|
| 1478 | + $search_params_type = $search_params['type']; |
|
| 1479 | + } |
|
| 1451 | 1480 | |
| 1452 | 1481 | $search_params = array( |
| 1453 | 1482 | 'string' => $search_params_string, |
@@ -1530,9 +1559,10 @@ discard block |
||
| 1530 | 1559 | ' . $rowData['reason'] . ' |
| 1531 | 1560 | </div>'; |
| 1532 | 1561 | |
| 1533 | - if (!empty($rowData['id_notice'])) |
|
| 1534 | - $output .= ' |
|
| 1562 | + if (!empty($rowData['id_notice'])) { |
|
| 1563 | + $output .= ' |
|
| 1535 | 1564 | <a href="' . $scripturl . '?action=moderate;area=notice;nid=' . $rowData['id_notice'] . '" onclick="window.open(this.href, \'\', \'scrollbars=yes,resizable=yes,width=400,height=250\');return false;" target="_blank" rel="noopener" title="' . $txt['profile_warning_previous_notice'] . '"><span class="generic_icons filter centericon"></span></a>'; |
| 1565 | + } |
|
| 1536 | 1566 | return $output; |
| 1537 | 1567 | }, |
| 1538 | 1568 | ), |
@@ -1650,9 +1680,9 @@ discard block |
||
| 1650 | 1680 | global $smcFunc, $modSettings, $context, $txt, $scripturl, $sourcedir, $user_info; |
| 1651 | 1681 | |
| 1652 | 1682 | // Submitting a new one? |
| 1653 | - if (isset($_POST['add'])) |
|
| 1654 | - return ModifyWarningTemplate(); |
|
| 1655 | - elseif (isset($_POST['delete']) && !empty($_POST['deltpl'])) |
|
| 1683 | + if (isset($_POST['add'])) { |
|
| 1684 | + return ModifyWarningTemplate(); |
|
| 1685 | + } elseif (isset($_POST['delete']) && !empty($_POST['deltpl'])) |
|
| 1656 | 1686 | { |
| 1657 | 1687 | checkSession(); |
| 1658 | 1688 | validateToken('mod-wt'); |
@@ -1671,8 +1701,9 @@ discard block |
||
| 1671 | 1701 | 'current_member' => $user_info['id'], |
| 1672 | 1702 | ) |
| 1673 | 1703 | ); |
| 1674 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1675 | - logAction('delete_warn_template', array('template' => $row['recipient_name'])); |
|
| 1704 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1705 | + logAction('delete_warn_template', array('template' => $row['recipient_name'])); |
|
| 1706 | + } |
|
| 1676 | 1707 | $smcFunc['db_free_result']($request); |
| 1677 | 1708 | |
| 1678 | 1709 | // Do the deletes. |
@@ -1963,16 +1994,18 @@ discard block |
||
| 1963 | 1994 | ); |
| 1964 | 1995 | |
| 1965 | 1996 | // If it wasn't visible and now is they've effectively added it. |
| 1966 | - if ($context['template_data']['personal'] && !$recipient_id) |
|
| 1967 | - logAction('add_warn_template', array('template' => $_POST['template_title'])); |
|
| 1997 | + if ($context['template_data']['personal'] && !$recipient_id) { |
|
| 1998 | + logAction('add_warn_template', array('template' => $_POST['template_title'])); |
|
| 1999 | + } |
|
| 1968 | 2000 | // Conversely if they made it personal it's a delete. |
| 1969 | - elseif (!$context['template_data']['personal'] && $recipient_id) |
|
| 1970 | - logAction('delete_warn_template', array('template' => $_POST['template_title'])); |
|
| 2001 | + elseif (!$context['template_data']['personal'] && $recipient_id) { |
|
| 2002 | + logAction('delete_warn_template', array('template' => $_POST['template_title'])); |
|
| 2003 | + } |
|
| 1971 | 2004 | // Otherwise just an edit. |
| 1972 | - else |
|
| 1973 | - logAction('modify_warn_template', array('template' => $_POST['template_title'])); |
|
| 1974 | - } |
|
| 1975 | - else |
|
| 2005 | + else { |
|
| 2006 | + logAction('modify_warn_template', array('template' => $_POST['template_title'])); |
|
| 2007 | + } |
|
| 2008 | + } else |
|
| 1976 | 2009 | { |
| 1977 | 2010 | $smcFunc['db_insert']('', |
| 1978 | 2011 | '{db_prefix}log_comments', |
@@ -1992,17 +2025,18 @@ discard block |
||
| 1992 | 2025 | |
| 1993 | 2026 | // Get out of town... |
| 1994 | 2027 | redirectexit('action=moderate;area=warnings;sa=templates'); |
| 1995 | - } |
|
| 1996 | - else |
|
| 2028 | + } else |
|
| 1997 | 2029 | { |
| 1998 | 2030 | $context['warning_errors'] = array(); |
| 1999 | 2031 | $context['template_data']['title'] = !empty($_POST['template_title']) ? $_POST['template_title'] : ''; |
| 2000 | 2032 | $context['template_data']['body'] = !empty($_POST['template_body']) ? $_POST['template_body'] : $txt['mc_warning_template_body_default']; |
| 2001 | 2033 | $context['template_data']['personal'] = !empty($_POST['make_personal']); |
| 2002 | - if (empty($_POST['template_title'])) |
|
| 2003 | - $context['warning_errors'][] = $txt['mc_warning_template_error_no_title']; |
|
| 2004 | - if (empty($_POST['template_body'])) |
|
| 2005 | - $context['warning_errors'][] = $txt['mc_warning_template_error_no_body']; |
|
| 2034 | + if (empty($_POST['template_title'])) { |
|
| 2035 | + $context['warning_errors'][] = $txt['mc_warning_template_error_no_title']; |
|
| 2036 | + } |
|
| 2037 | + if (empty($_POST['template_body'])) { |
|
| 2038 | + $context['warning_errors'][] = $txt['mc_warning_template_error_no_body']; |
|
| 2039 | + } |
|
| 2006 | 2040 | } |
| 2007 | 2041 | } |
| 2008 | 2042 | |
@@ -2047,8 +2081,9 @@ discard block |
||
| 2047 | 2081 | // Now check other options! |
| 2048 | 2082 | $pref_binary = 0; |
| 2049 | 2083 | |
| 2050 | - if ($context['can_moderate_approvals'] && !empty($_POST['mod_notify_approval'])) |
|
| 2051 | - $pref_binary |= 4; |
|
| 2084 | + if ($context['can_moderate_approvals'] && !empty($_POST['mod_notify_approval'])) { |
|
| 2085 | + $pref_binary |= 4; |
|
| 2086 | + } |
|
| 2052 | 2087 | |
| 2053 | 2088 | // Put it all together. |
| 2054 | 2089 | $mod_prefs = '0||' . $pref_binary; |
@@ -2072,9 +2107,10 @@ discard block |
||
| 2072 | 2107 | unset($_SESSION['moderate_time']); |
| 2073 | 2108 | |
| 2074 | 2109 | // Clean any moderator tokens as well. |
| 2075 | - foreach ($_SESSION['token'] as $key => $token) |
|
| 2076 | - if (strpos($key, '-mod') !== false) |
|
| 2110 | + foreach ($_SESSION['token'] as $key => $token) { |
|
| 2111 | + if (strpos($key, '-mod') !== false) |
|
| 2077 | 2112 | unset($_SESSION['token'][$key]); |
| 2113 | + } |
|
| 2078 | 2114 | |
| 2079 | 2115 | redirectexit(); |
| 2080 | 2116 | } |
@@ -273,7 +273,6 @@ |
||
| 273 | 273 | * Modify any setting related to topics. |
| 274 | 274 | * Requires the admin_forum permission. |
| 275 | 275 | * Accessed from ?action=admin;area=postsettings;sa=topics. |
| 276 | - |
|
| 277 | 276 | * @param bool $return_config Whether or not to return the config_vars array (used for admin search) |
| 278 | 277 | * @return void|array Returns nothing or returns $config_vars if $return_config is true |
| 279 | 278 | * @uses Admin template, edit_topic_settings sub-template. |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * The main entrance point for the 'Posts and topics' screen. |
@@ -98,23 +99,23 @@ discard block |
||
| 98 | 99 | { |
| 99 | 100 | $_POST['censortext'] = explode("\n", strtr($_POST['censortext'], array("\r" => ''))); |
| 100 | 101 | |
| 101 | - foreach ($_POST['censortext'] as $c) |
|
| 102 | - list ($censored_vulgar[], $censored_proper[]) = array_pad(explode('=', trim($c)), 2, ''); |
|
| 103 | - } |
|
| 104 | - elseif (isset($_POST['censor_vulgar'], $_POST['censor_proper'])) |
|
| 102 | + foreach ($_POST['censortext'] as $c) { |
|
| 103 | + list ($censored_vulgar[], $censored_proper[]) = array_pad(explode('=', trim($c)), 2, ''); |
|
| 104 | + } |
|
| 105 | + } elseif (isset($_POST['censor_vulgar'], $_POST['censor_proper'])) |
|
| 105 | 106 | { |
| 106 | 107 | if (is_array($_POST['censor_vulgar'])) |
| 107 | 108 | { |
| 108 | 109 | foreach ($_POST['censor_vulgar'] as $i => $value) |
| 109 | 110 | { |
| 110 | - if (trim(strtr($value, '*', ' ')) == '') |
|
| 111 | - unset($_POST['censor_vulgar'][$i], $_POST['censor_proper'][$i]); |
|
| 111 | + if (trim(strtr($value, '*', ' ')) == '') { |
|
| 112 | + unset($_POST['censor_vulgar'][$i], $_POST['censor_proper'][$i]); |
|
| 113 | + } |
|
| 112 | 114 | } |
| 113 | 115 | |
| 114 | 116 | $censored_vulgar = $_POST['censor_vulgar']; |
| 115 | 117 | $censored_proper = $_POST['censor_proper']; |
| 116 | - } |
|
| 117 | - else |
|
| 118 | + } else |
|
| 118 | 119 | { |
| 119 | 120 | $censored_vulgar = explode("\n", strtr($_POST['censor_vulgar'], array("\r" => ''))); |
| 120 | 121 | $censored_proper = explode("\n", strtr($_POST['censor_proper'], array("\r" => ''))); |
@@ -151,12 +152,14 @@ discard block |
||
| 151 | 152 | $context['censored_words'] = array(); |
| 152 | 153 | for ($i = 0, $n = count($censor_vulgar); $i < $n; $i++) |
| 153 | 154 | { |
| 154 | - if (empty($censor_vulgar[$i])) |
|
| 155 | - continue; |
|
| 155 | + if (empty($censor_vulgar[$i])) { |
|
| 156 | + continue; |
|
| 157 | + } |
|
| 156 | 158 | |
| 157 | 159 | // Skip it, it's either spaces or stars only. |
| 158 | - if (trim(strtr($censor_vulgar[$i], '*', ' ')) == '') |
|
| 159 | - continue; |
|
| 160 | + if (trim(strtr($censor_vulgar[$i], '*', ' ')) == '') { |
|
| 161 | + continue; |
|
| 162 | + } |
|
| 160 | 163 | |
| 161 | 164 | $context['censored_words'][$smcFunc['htmlspecialchars'](trim($censor_vulgar[$i]))] = isset($censor_proper[$i]) ? $smcFunc['htmlspecialchars']($censor_proper[$i]) : ''; |
| 162 | 165 | } |
@@ -187,10 +190,11 @@ discard block |
||
| 187 | 190 | |
| 188 | 191 | // Make an inline conditional a little shorter... |
| 189 | 192 | $can_spell_check = false; |
| 190 | - if (function_exists('pspell_new')) |
|
| 191 | - $can_spell_check = true; |
|
| 192 | - elseif (function_exists('enchant_broker_init') && ($txt['lang_character_set'] == 'UTF-8' || function_exists('iconv'))) |
|
| 193 | - $can_spell_check = true; |
|
| 193 | + if (function_exists('pspell_new')) { |
|
| 194 | + $can_spell_check = true; |
|
| 195 | + } elseif (function_exists('enchant_broker_init') && ($txt['lang_character_set'] == 'UTF-8' || function_exists('iconv'))) { |
|
| 196 | + $can_spell_check = true; |
|
| 197 | + } |
|
| 194 | 198 | |
| 195 | 199 | // All the settings... |
| 196 | 200 | $config_vars = array( |
@@ -220,8 +224,9 @@ discard block |
||
| 220 | 224 | |
| 221 | 225 | call_integration_hook('integrate_modify_post_settings', array(&$config_vars)); |
| 222 | 226 | |
| 223 | - if ($return_config) |
|
| 224 | - return $config_vars; |
|
| 227 | + if ($return_config) { |
|
| 228 | + return $config_vars; |
|
| 229 | + } |
|
| 225 | 230 | |
| 226 | 231 | // We'll want this for our easy save. |
| 227 | 232 | require_once($sourcedir . '/ManageServer.php'); |
@@ -241,17 +246,20 @@ discard block |
||
| 241 | 246 | db_extend('packages'); |
| 242 | 247 | |
| 243 | 248 | $colData = $smcFunc['db_list_columns']('{db_prefix}messages', true); |
| 244 | - foreach ($colData as $column) |
|
| 245 | - if ($column['name'] == 'body') |
|
| 249 | + foreach ($colData as $column) { |
|
| 250 | + if ($column['name'] == 'body') |
|
| 246 | 251 | $body_type = $column['type']; |
| 252 | + } |
|
| 247 | 253 | |
| 248 | - if (isset($body_type) && ($_POST['max_messageLength'] > 65535 || $_POST['max_messageLength'] == 0) && $body_type == 'text') |
|
| 249 | - fatal_lang_error('convert_to_mediumtext', false, array($scripturl . '?action=admin;area=maintain;sa=database')); |
|
| 254 | + if (isset($body_type) && ($_POST['max_messageLength'] > 65535 || $_POST['max_messageLength'] == 0) && $body_type == 'text') { |
|
| 255 | + fatal_lang_error('convert_to_mediumtext', false, array($scripturl . '?action=admin;area=maintain;sa=database')); |
|
| 256 | + } |
|
| 250 | 257 | } |
| 251 | 258 | |
| 252 | 259 | // If we're changing the post preview length let's check its valid |
| 253 | - if (!empty($_POST['preview_characters'])) |
|
| 254 | - $_POST['preview_characters'] = (int) min(max(0, $_POST['preview_characters']), 512); |
|
| 260 | + if (!empty($_POST['preview_characters'])) { |
|
| 261 | + $_POST['preview_characters'] = (int) min(max(0, $_POST['preview_characters']), 512); |
|
| 262 | + } |
|
| 255 | 263 | |
| 256 | 264 | call_integration_hook('integrate_save_post_settings'); |
| 257 | 265 | |
@@ -312,8 +320,9 @@ discard block |
||
| 312 | 320 | |
| 313 | 321 | call_integration_hook('integrate_modify_topic_settings', array(&$config_vars)); |
| 314 | 322 | |
| 315 | - if ($return_config) |
|
| 316 | - return $config_vars; |
|
| 323 | + if ($return_config) { |
|
| 324 | + return $config_vars; |
|
| 325 | + } |
|
| 317 | 326 | |
| 318 | 327 | // Get the settings template ready. |
| 319 | 328 | require_once($sourcedir . '/ManageServer.php'); |
@@ -366,8 +375,9 @@ discard block |
||
| 366 | 375 | array('int', 'drafts_autosave_frequency', 'postinput' => $txt['manageposts_seconds'], 'subtext' => $txt['drafts_autosave_frequency_subnote']), |
| 367 | 376 | ); |
| 368 | 377 | |
| 369 | - if ($return_config) |
|
| 370 | - return $config_vars; |
|
| 378 | + if ($return_config) { |
|
| 379 | + return $config_vars; |
|
| 380 | + } |
|
| 371 | 381 | |
| 372 | 382 | // Get the settings template ready. |
| 373 | 383 | require_once($sourcedir . '/ManageServer.php'); |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | $server = trim($servers[array_rand($servers)]); |
| 62 | 62 | |
| 63 | 63 | // Normal host names do not contain slashes, while e.g. unix sockets do. Assume alternative transport pipe with port 0. |
| 64 | - if (strpos($server,'/') !== false) |
|
| 64 | + if (strpos($server, '/') !== false) |
|
| 65 | 65 | $host = $server; |
| 66 | 66 | else |
| 67 | 67 | { |
@@ -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('Hacking attempt...'); |
| 16 | +} |
|
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * Our Cache API class |
@@ -34,8 +35,9 @@ discard block |
||
| 34 | 35 | |
| 35 | 36 | $supported = class_exists('memcache'); |
| 36 | 37 | |
| 37 | - if ($test) |
|
| 38 | - return $supported; |
|
| 38 | + if ($test) { |
|
| 39 | + return $supported; |
|
| 40 | + } |
|
| 39 | 41 | return parent::isSupported() && $supported && !empty($cache_memcached); |
| 40 | 42 | } |
| 41 | 43 | |
@@ -61,9 +63,9 @@ discard block |
||
| 61 | 63 | $server = trim($servers[array_rand($servers)]); |
| 62 | 64 | |
| 63 | 65 | // Normal host names do not contain slashes, while e.g. unix sockets do. Assume alternative transport pipe with port 0. |
| 64 | - if (strpos($server,'/') !== false) |
|
| 65 | - $host = $server; |
|
| 66 | - else |
|
| 66 | + if (strpos($server,'/') !== false) { |
|
| 67 | + $host = $server; |
|
| 68 | + } else |
|
| 67 | 69 | { |
| 68 | 70 | $server = explode(':', $server); |
| 69 | 71 | $host = $server[0]; |
@@ -71,10 +73,11 @@ discard block |
||
| 71 | 73 | } |
| 72 | 74 | |
| 73 | 75 | // Don't wait too long: yes, we want the server, but we might be able to run the query faster! |
| 74 | - if (empty($db_persist)) |
|
| 75 | - $connected = $this->memcache->connect($host, $port); |
|
| 76 | - else |
|
| 77 | - $connected = $this->memcache->pconnect($host, $port); |
|
| 76 | + if (empty($db_persist)) { |
|
| 77 | + $connected = $this->memcache->connect($host, $port); |
|
| 78 | + } else { |
|
| 79 | + $connected = $this->memcache->pconnect($host, $port); |
|
| 80 | + } |
|
| 78 | 81 | } |
| 79 | 82 | |
| 80 | 83 | return $connected; |
@@ -90,8 +93,9 @@ discard block |
||
| 90 | 93 | $value = $this->memcache->get($key); |
| 91 | 94 | |
| 92 | 95 | // $value should return either data or false (from failure, key not found or empty array). |
| 93 | - if ($value === false) |
|
| 94 | - return null; |
|
| 96 | + if ($value === false) { |
|
| 97 | + return null; |
|
| 98 | + } |
|
| 95 | 99 | return $value; |
| 96 | 100 | } |
| 97 | 101 | |
@@ -132,8 +136,9 @@ discard block |
||
| 132 | 136 | $config_vars[] = $txt['cache_memcache_settings']; |
| 133 | 137 | $config_vars[] = array('cache_memcached', $txt['cache_memcache_servers'], 'file', 'text', 0, 'cache_memcached', 'postinput' => '<br><div class="smalltext"><em>' . $txt['cache_memcache_servers_subtext'] . '</em></div>'); |
| 134 | 138 | |
| 135 | - if (!isset($context['settings_post_javascript'])) |
|
| 136 | - $context['settings_post_javascript'] = ''; |
|
| 139 | + if (!isset($context['settings_post_javascript'])) { |
|
| 140 | + $context['settings_post_javascript'] = ''; |
|
| 141 | + } |
|
| 137 | 142 | |
| 138 | 143 | $context['settings_post_javascript'] .= ' |
| 139 | 144 | $("#cache_accelerator").change(function (e) { |
@@ -19,10 +19,10 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class GroupAct_Notify_Background extends SMF_BackgroundTask |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed. |
|
| 24 | - * @return bool Always returns true |
|
| 25 | - */ |
|
| 22 | + /** |
|
| 23 | + * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed. |
|
| 24 | + * @return bool Always returns true |
|
| 25 | + */ |
|
| 26 | 26 | public function execute() |
| 27 | 27 | { |
| 28 | 28 | global $sourcedir, $smcFunc, $language, $modSettings; |
@@ -132,8 +132,9 @@ discard block |
||
| 132 | 132 | 'GROUPNAME' => $user['group_name'], |
| 133 | 133 | ); |
| 134 | 134 | |
| 135 | - if (!empty($custom_reason)) |
|
| 136 | - $replacements['REASON'] = $custom_reason; |
|
| 135 | + if (!empty($custom_reason)) { |
|
| 136 | + $replacements['REASON'] = $custom_reason; |
|
| 137 | + } |
|
| 137 | 138 | |
| 138 | 139 | $emaildata = loadEmailTemplate($email_template_name, $replacements, $user['language']); |
| 139 | 140 | |
@@ -142,8 +143,8 @@ discard block |
||
| 142 | 143 | } |
| 143 | 144 | |
| 144 | 145 | // Insert the alerts if any |
| 145 | - if (!empty($alert_rows)) |
|
| 146 | - $smcFunc['db_insert']('', |
|
| 146 | + if (!empty($alert_rows)) { |
|
| 147 | + $smcFunc['db_insert']('', |
|
| 147 | 148 | '{db_prefix}user_alerts', |
| 148 | 149 | array( |
| 149 | 150 | 'alert_time' => 'int', 'id_member' => 'int', 'content_type' => 'string', |
@@ -152,6 +153,7 @@ discard block |
||
| 152 | 153 | $alert_rows, |
| 153 | 154 | array() |
| 154 | 155 | ); |
| 156 | + } |
|
| 155 | 157 | } |
| 156 | 158 | |
| 157 | 159 | return true; |
@@ -32,8 +32,9 @@ discard block |
||
| 32 | 32 | $members = membersAllowedTo('calendar_view'); |
| 33 | 33 | |
| 34 | 34 | // Don't alert the event creator |
| 35 | - if (!empty($this->_details['sender_id'])) |
|
| 36 | - $members = array_diff($members, array($this->_details['sender_id'])); |
|
| 35 | + if (!empty($this->_details['sender_id'])) { |
|
| 36 | + $members = array_diff($members, array($this->_details['sender_id'])); |
|
| 37 | + } |
|
| 37 | 38 | |
| 38 | 39 | // Having successfully figured this out, now let's get the preferences of everyone. |
| 39 | 40 | require_once($sourcedir . '/Subs-Notify.php'); |
@@ -44,10 +45,11 @@ discard block |
||
| 44 | 45 | if (!empty($this->_details['sender_id']) && empty($this->_details['sender_name'])) |
| 45 | 46 | { |
| 46 | 47 | loadMemberData($this->_details['sender_id'], 'minimal'); |
| 47 | - if (!empty($user_profile[$this->_details['sender_id']])) |
|
| 48 | - $this->_details['sender_name'] = $user_profile[$this->_details['sender_id']]['real_name']; |
|
| 49 | - else |
|
| 50 | - $this->_details['sender_id'] = 0; |
|
| 48 | + if (!empty($user_profile[$this->_details['sender_id']])) { |
|
| 49 | + $this->_details['sender_name'] = $user_profile[$this->_details['sender_id']]['real_name']; |
|
| 50 | + } else { |
|
| 51 | + $this->_details['sender_id'] = 0; |
|
| 52 | + } |
|
| 51 | 53 | } |
| 52 | 54 | |
| 53 | 55 | // So now we find out who wants what. |
@@ -59,9 +61,10 @@ discard block |
||
| 59 | 61 | |
| 60 | 62 | foreach ($prefs as $member => $pref_option) |
| 61 | 63 | { |
| 62 | - foreach ($alert_bits as $type => $bitvalue) |
|
| 63 | - if ($pref_option['event_new'] & $bitvalue) |
|
| 64 | + foreach ($alert_bits as $type => $bitvalue) { |
|
| 65 | + if ($pref_option['event_new'] & $bitvalue) |
|
| 64 | 66 | $notifies[$type][] = $member; |
| 67 | + } |
|
| 65 | 68 | } |
| 66 | 69 | |
| 67 | 70 | // Firstly, anyone who wants alerts. |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | class EventNew_Notify_Background extends SMF_BackgroundTask |
| 21 | 21 | { |
| 22 | 22 | /** |
| 23 | - * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed. |
|
| 23 | + * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed. |
|
| 24 | 24 | * @return bool Always returns true |
| 25 | 25 | */ |
| 26 | 26 | public function execute() |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | 'content_action' => empty($this->_details['sender_id']) ? 'new_guest' : 'new', |
| 82 | 82 | 'is_read' => 0, |
| 83 | 83 | 'extra' => $smcFunc['json_encode']( |
| 84 | - array( |
|
| 85 | - "event_id" => $this->_details['event_id'], |
|
| 84 | + array( |
|
| 85 | + "event_id" => $this->_details['event_id'], |
|
| 86 | 86 | "event_title" => $this->_details['event_title'] |
| 87 | 87 | ) |
| 88 | 88 | ), |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | class MsgReportReply_Notify_Background extends SMF_BackgroundTask |
| 21 | 21 | { |
| 22 | 22 | /** |
| 23 | - * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed. |
|
| 23 | + * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed. |
|
| 24 | 24 | * @return bool Always returns true. |
| 25 | 25 | */ |
| 26 | 26 | public function execute() |
@@ -40,8 +40,9 @@ discard block |
||
| 40 | 40 | 'last_comment' => $this->_details['comment_id'], |
| 41 | 41 | ) |
| 42 | 42 | ); |
| 43 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
| 44 | - $possible_members[] = $row[0]; |
|
| 43 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
| 44 | + $possible_members[] = $row[0]; |
|
| 45 | + } |
|
| 45 | 46 | $smcFunc['db_free_result']($request); |
| 46 | 47 | |
| 47 | 48 | // Presumably, there are some people? |
@@ -50,8 +51,9 @@ discard block |
||
| 50 | 51 | $possible_members = array_flip(array_flip($possible_members)); |
| 51 | 52 | $possible_members = array_diff($possible_members, array($this->_details['sender_id'])); |
| 52 | 53 | } |
| 53 | - if (empty($possible_members)) |
|
| 54 | - return true; |
|
| 54 | + if (empty($possible_members)) { |
|
| 55 | + return true; |
|
| 56 | + } |
|
| 55 | 57 | |
| 56 | 58 | // We need to know who can moderate this board - and therefore who can see this report. |
| 57 | 59 | // First up, people who have moderate_board in the board this topic was in. |
@@ -67,8 +69,9 @@ discard block |
||
| 67 | 69 | 'current_board' => $this->_details['board_id'], |
| 68 | 70 | ) |
| 69 | 71 | ); |
| 70 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 71 | - $members[] = $row['id_member']; |
|
| 72 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 73 | + $members[] = $row['id_member']; |
|
| 74 | + } |
|
| 72 | 75 | $smcFunc['db_free_result']($request); |
| 73 | 76 | |
| 74 | 77 | // Thirdly, anyone assigned to be a moderator of this group as a group->board moderator. |
@@ -85,8 +88,9 @@ discard block |
||
| 85 | 88 | ) |
| 86 | 89 | ); |
| 87 | 90 | |
| 88 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 89 | - $members[] = $row['id_member']; |
|
| 91 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 92 | + $members[] = $row['id_member']; |
|
| 93 | + } |
|
| 90 | 94 | $smcFunc['db_free_result']($request); |
| 91 | 95 | |
| 92 | 96 | // So now we have two lists: the people who replied to a report in the past, |
@@ -108,8 +112,9 @@ discard block |
||
| 108 | 112 | { |
| 109 | 113 | foreach ($alert_bits as $type => $bitvalue) |
| 110 | 114 | { |
| 111 | - if ($pref_option['msg_report_reply'] & $bitvalue) |
|
| 112 | - $notifies[$type][] = $member; |
|
| 115 | + if ($pref_option['msg_report_reply'] & $bitvalue) { |
|
| 116 | + $notifies[$type][] = $member; |
|
| 117 | + } |
|
| 113 | 118 | } |
| 114 | 119 | } |
| 115 | 120 | |
@@ -170,8 +175,9 @@ discard block |
||
| 170 | 175 | ); |
| 171 | 176 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 172 | 177 | { |
| 173 | - if (empty($row['lngfile'])) |
|
| 174 | - $row['lngfile'] = $language; |
|
| 178 | + if (empty($row['lngfile'])) { |
|
| 179 | + $row['lngfile'] = $language; |
|
| 180 | + } |
|
| 175 | 181 | $emails[$row['lngfile']][$row['id_member']] = $row['email_address']; |
| 176 | 182 | } |
| 177 | 183 | $smcFunc['db_free_result']($request); |
@@ -203,8 +209,9 @@ discard block |
||
| 203 | 209 | $emaildata = loadEmailTemplate('reply_to_moderator', $replacements, empty($modSettings['userLanguage']) ? $language : $this_lang); |
| 204 | 210 | |
| 205 | 211 | // And do the actual sending... |
| 206 | - foreach ($recipients as $id_member => $email_address) |
|
| 207 | - sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'rptrpy' . $this->_details['comment_id'], $emaildata['is_html'], 3); |
|
| 212 | + foreach ($recipients as $id_member => $email_address) { |
|
| 213 | + sendmail($email_address, $emaildata['subject'], $emaildata['body'], null, 'rptrpy' . $this->_details['comment_id'], $emaildata['is_html'], 3); |
|
| 214 | + } |
|
| 208 | 215 | } |
| 209 | 216 | } |
| 210 | 217 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | class Buddy_Notify_Background extends SMF_BackgroundTask |
| 20 | 20 | { |
| 21 | 21 | /** |
| 22 | - * This executes the task - loads up the info, sets the alerts and loads up the email queue. |
|
| 22 | + * This executes the task - loads up the info, sets the alerts and loads up the email queue. |
|
| 23 | 23 | * @return bool Always returns true |
| 24 | 24 | */ |
| 25 | 25 | public function execute() |