@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | * @version 2.1 Beta 3 |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -if (!defined('SMF')) |
|
| 17 | +if (!defined('SMF')) { |
|
| 18 | 18 | die('No direct access...'); |
| 19 | +} |
|
| 19 | 20 | |
| 20 | 21 | /** |
| 21 | 22 | * Prepares the information from the moderation log for viewing. |
@@ -32,14 +33,16 @@ discard block |
||
| 32 | 33 | |
| 33 | 34 | // Are we looking at the moderation log or the administration log. |
| 34 | 35 | $context['log_type'] = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'adminlog' ? 3 : 1; |
| 35 | - if ($context['log_type'] == 3) |
|
| 36 | - isAllowedTo('admin_forum'); |
|
| 36 | + if ($context['log_type'] == 3) { |
|
| 37 | + isAllowedTo('admin_forum'); |
|
| 38 | + } |
|
| 37 | 39 | |
| 38 | 40 | // These change dependant on whether we are viewing the moderation or admin log. |
| 39 | - if ($context['log_type'] == 3 || $_REQUEST['action'] == 'admin') |
|
| 40 | - $context['url_start'] = '?action=admin;area=logs;sa=' . ($context['log_type'] == 3 ? 'adminlog' : 'modlog') . ';type=' . $context['log_type']; |
|
| 41 | - else |
|
| 42 | - $context['url_start'] = '?action=moderate;area=modlog;type=' . $context['log_type']; |
|
| 41 | + if ($context['log_type'] == 3 || $_REQUEST['action'] == 'admin') { |
|
| 42 | + $context['url_start'] = '?action=admin;area=logs;sa=' . ($context['log_type'] == 3 ? 'adminlog' : 'modlog') . ';type=' . $context['log_type']; |
|
| 43 | + } else { |
|
| 44 | + $context['url_start'] = '?action=moderate;area=modlog;type=' . $context['log_type']; |
|
| 45 | + } |
|
| 43 | 46 | |
| 44 | 47 | $context['can_delete'] = allowedTo('admin_forum'); |
| 45 | 48 | |
@@ -67,8 +70,7 @@ discard block |
||
| 67 | 70 | $log_type = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'adminlog' ? 'admin' : 'moderate'; |
| 68 | 71 | logAction('clearlog_' . $log_type, array(), $log_type); |
| 69 | 72 | |
| 70 | - } |
|
| 71 | - elseif (!empty($_POST['remove']) && isset($_POST['delete']) && $context['can_delete']) |
|
| 73 | + } elseif (!empty($_POST['remove']) && isset($_POST['delete']) && $context['can_delete']) |
|
| 72 | 74 | { |
| 73 | 75 | checkSession(); |
| 74 | 76 | validateToken('mod-ml'); |
@@ -114,15 +116,17 @@ discard block |
||
| 114 | 116 | 'ip' => array('sql' => 'lm.ip', 'label' => $txt['modlog_ip']) |
| 115 | 117 | ); |
| 116 | 118 | |
| 117 | - if (!isset($search_params['string']) || (!empty($_REQUEST['search']) && $search_params['string'] != $_REQUEST['search'])) |
|
| 118 | - $search_params_string = empty($_REQUEST['search']) ? '' : $_REQUEST['search']; |
|
| 119 | - else |
|
| 120 | - $search_params_string = $search_params['string']; |
|
| 119 | + if (!isset($search_params['string']) || (!empty($_REQUEST['search']) && $search_params['string'] != $_REQUEST['search'])) { |
|
| 120 | + $search_params_string = empty($_REQUEST['search']) ? '' : $_REQUEST['search']; |
|
| 121 | + } else { |
|
| 122 | + $search_params_string = $search_params['string']; |
|
| 123 | + } |
|
| 121 | 124 | |
| 122 | - if (isset($_REQUEST['search_type']) || empty($search_params['type']) || !isset($searchTypes[$search_params['type']])) |
|
| 123 | - $search_params_type = isset($_REQUEST['search_type']) && isset($searchTypes[$_REQUEST['search_type']]) ? $_REQUEST['search_type'] : (isset($searchTypes[$context['order']]) ? $context['order'] : 'member'); |
|
| 124 | - else |
|
| 125 | - $search_params_type = $search_params['type']; |
|
| 125 | + if (isset($_REQUEST['search_type']) || empty($search_params['type']) || !isset($searchTypes[$search_params['type']])) { |
|
| 126 | + $search_params_type = isset($_REQUEST['search_type']) && isset($searchTypes[$_REQUEST['search_type']]) ? $_REQUEST['search_type'] : (isset($searchTypes[$context['order']]) ? $context['order'] : 'member'); |
|
| 127 | + } else { |
|
| 128 | + $search_params_type = $search_params['type']; |
|
| 129 | + } |
|
| 126 | 130 | |
| 127 | 131 | $search_params_column = $searchTypes[$search_params_type]['sql']; |
| 128 | 132 | $search_params = array( |
@@ -297,13 +301,14 @@ discard block |
||
| 297 | 301 | $context['sub_template'] = 'show_list'; |
| 298 | 302 | $context['default_list'] = 'moderation_log_list'; |
| 299 | 303 | |
| 300 | - if (isset($context['moderation_menu_name'])) |
|
| 301 | - $context[$context['moderation_menu_name']]['tab_data'] = array( |
|
| 304 | + if (isset($context['moderation_menu_name'])) { |
|
| 305 | + $context[$context['moderation_menu_name']]['tab_data'] = array( |
|
| 302 | 306 | 'title' => $txt['modlog_' . ($context['log_type'] == 3 ? 'admin' : 'moderation') . '_log'], |
| 303 | 307 | 'help' => $context['log_type'] == 3 ? 'adminlog' : 'modlog', |
| 304 | 308 | 'description' => $txt['modlog_' . ($context['log_type'] == 3 ? 'admin' : 'moderation') . '_log_desc'] |
| 305 | 309 | ); |
| 306 | -} |
|
| 310 | + } |
|
| 311 | + } |
|
| 307 | 312 | |
| 308 | 313 | /** |
| 309 | 314 | * Get the number of mod log entries. |
@@ -407,30 +412,35 @@ discard block |
||
| 407 | 412 | // Add on some of the column stuff info |
| 408 | 413 | if (!empty($row['id_board'])) |
| 409 | 414 | { |
| 410 | - if ($row['action'] == 'move') |
|
| 411 | - $row['extra']['board_to'] = $row['id_board']; |
|
| 412 | - else |
|
| 413 | - $row['extra']['board'] = $row['id_board']; |
|
| 415 | + if ($row['action'] == 'move') { |
|
| 416 | + $row['extra']['board_to'] = $row['id_board']; |
|
| 417 | + } else { |
|
| 418 | + $row['extra']['board'] = $row['id_board']; |
|
| 419 | + } |
|
| 414 | 420 | } |
| 415 | 421 | |
| 416 | - if (!empty($row['id_topic'])) |
|
| 417 | - $row['extra']['topic'] = $row['id_topic']; |
|
| 418 | - if (!empty($row['id_msg'])) |
|
| 419 | - $row['extra']['message'] = $row['id_msg']; |
|
| 422 | + if (!empty($row['id_topic'])) { |
|
| 423 | + $row['extra']['topic'] = $row['id_topic']; |
|
| 424 | + } |
|
| 425 | + if (!empty($row['id_msg'])) { |
|
| 426 | + $row['extra']['message'] = $row['id_msg']; |
|
| 427 | + } |
|
| 420 | 428 | |
| 421 | 429 | // Is this associated with a topic? |
| 422 | - if (isset($row['extra']['topic'])) |
|
| 423 | - $topics[(int) $row['extra']['topic']][] = $row['id_action']; |
|
| 424 | - if (isset($row['extra']['new_topic'])) |
|
| 425 | - $topics[(int) $row['extra']['new_topic']][] = $row['id_action']; |
|
| 430 | + if (isset($row['extra']['topic'])) { |
|
| 431 | + $topics[(int) $row['extra']['topic']][] = $row['id_action']; |
|
| 432 | + } |
|
| 433 | + if (isset($row['extra']['new_topic'])) { |
|
| 434 | + $topics[(int) $row['extra']['new_topic']][] = $row['id_action']; |
|
| 435 | + } |
|
| 426 | 436 | |
| 427 | 437 | // How about a member? |
| 428 | 438 | if (isset($row['extra']['member'])) |
| 429 | 439 | { |
| 430 | 440 | // Guests don't have names! |
| 431 | - if (empty($row['extra']['member'])) |
|
| 432 | - $row['extra']['member'] = $txt['modlog_parameter_guest']; |
|
| 433 | - else |
|
| 441 | + if (empty($row['extra']['member'])) { |
|
| 442 | + $row['extra']['member'] = $txt['modlog_parameter_guest']; |
|
| 443 | + } else |
|
| 434 | 444 | { |
| 435 | 445 | // Try to find it... |
| 436 | 446 | $members[(int) $row['extra']['member']][] = $row['id_action']; |
@@ -438,35 +448,42 @@ discard block |
||
| 438 | 448 | } |
| 439 | 449 | |
| 440 | 450 | // Associated with a board? |
| 441 | - if (isset($row['extra']['board_to'])) |
|
| 442 | - $boards[(int) $row['extra']['board_to']][] = $row['id_action']; |
|
| 443 | - if (isset($row['extra']['board_from'])) |
|
| 444 | - $boards[(int) $row['extra']['board_from']][] = $row['id_action']; |
|
| 445 | - if (isset($row['extra']['board'])) |
|
| 446 | - $boards[(int) $row['extra']['board']][] = $row['id_action']; |
|
| 451 | + if (isset($row['extra']['board_to'])) { |
|
| 452 | + $boards[(int) $row['extra']['board_to']][] = $row['id_action']; |
|
| 453 | + } |
|
| 454 | + if (isset($row['extra']['board_from'])) { |
|
| 455 | + $boards[(int) $row['extra']['board_from']][] = $row['id_action']; |
|
| 456 | + } |
|
| 457 | + if (isset($row['extra']['board'])) { |
|
| 458 | + $boards[(int) $row['extra']['board']][] = $row['id_action']; |
|
| 459 | + } |
|
| 447 | 460 | |
| 448 | 461 | // A message? |
| 449 | - if (isset($row['extra']['message'])) |
|
| 450 | - $messages[(int) $row['extra']['message']][] = $row['id_action']; |
|
| 462 | + if (isset($row['extra']['message'])) { |
|
| 463 | + $messages[(int) $row['extra']['message']][] = $row['id_action']; |
|
| 464 | + } |
|
| 451 | 465 | |
| 452 | 466 | // IP Info? |
| 453 | - if (isset($row['extra']['ip_range'])) |
|
| 454 | - if ($seeIP) |
|
| 467 | + if (isset($row['extra']['ip_range'])) { |
|
| 468 | + if ($seeIP) |
|
| 455 | 469 | $row['extra']['ip_range'] = '<a href="' . $scripturl . '?action=trackip;searchip=' . $row['extra']['ip_range'] . '">' . $row['extra']['ip_range'] . '</a>'; |
| 456 | - else |
|
| 457 | - $row['extra']['ip_range'] = $txt['logged']; |
|
| 470 | + } else { |
|
| 471 | + $row['extra']['ip_range'] = $txt['logged']; |
|
| 472 | + } |
|
| 458 | 473 | |
| 459 | 474 | // Email? |
| 460 | - if (isset($row['extra']['email'])) |
|
| 461 | - $row['extra']['email'] = '<a href="mailto:' . $row['extra']['email'] . '">' . $row['extra']['email'] . '</a>'; |
|
| 475 | + if (isset($row['extra']['email'])) { |
|
| 476 | + $row['extra']['email'] = '<a href="mailto:' . $row['extra']['email'] . '">' . $row['extra']['email'] . '</a>'; |
|
| 477 | + } |
|
| 462 | 478 | |
| 463 | 479 | // Bans are complex. |
| 464 | 480 | if ($row['action'] == 'ban' || $row['action'] == 'banremove') |
| 465 | 481 | { |
| 466 | 482 | $row['action_text'] = $txt['modlog_ac_ban' . ($row['action'] == 'banremove' ? '_remove' : '')]; |
| 467 | - foreach (array('member', 'email', 'ip_range', 'hostname') as $type) |
|
| 468 | - if (isset($row['extra'][$type])) |
|
| 483 | + foreach (array('member', 'email', 'ip_range', 'hostname') as $type) { |
|
| 484 | + if (isset($row['extra'][$type])) |
|
| 469 | 485 | $row['action_text'] .= $txt['modlog_ac_ban_trigger_' . $type]; |
| 486 | + } |
|
| 470 | 487 | } |
| 471 | 488 | |
| 472 | 489 | // The array to go to the template. Note here that action is set to a "default" value of the action doesn't match anything in the descriptions. Allows easy adding of logging events with basic details. |
@@ -502,12 +519,13 @@ discard block |
||
| 502 | 519 | foreach ($boards[$row['id_board']] as $action) |
| 503 | 520 | { |
| 504 | 521 | // Make the board number into a link - dealing with moving too. |
| 505 | - if (isset($entries[$action]['extra']['board_to']) && $entries[$action]['extra']['board_to'] == $row['id_board']) |
|
| 506 | - $entries[$action]['extra']['board_to'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'; |
|
| 507 | - elseif (isset($entries[$action]['extra']['board_from']) && $entries[$action]['extra']['board_from'] == $row['id_board']) |
|
| 508 | - $entries[$action]['extra']['board_from'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'; |
|
| 509 | - elseif (isset($entries[$action]['extra']['board']) && $entries[$action]['extra']['board'] == $row['id_board']) |
|
| 510 | - $entries[$action]['extra']['board'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'; |
|
| 522 | + if (isset($entries[$action]['extra']['board_to']) && $entries[$action]['extra']['board_to'] == $row['id_board']) { |
|
| 523 | + $entries[$action]['extra']['board_to'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'; |
|
| 524 | + } elseif (isset($entries[$action]['extra']['board_from']) && $entries[$action]['extra']['board_from'] == $row['id_board']) { |
|
| 525 | + $entries[$action]['extra']['board_from'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'; |
|
| 526 | + } elseif (isset($entries[$action]['extra']['board']) && $entries[$action]['extra']['board'] == $row['id_board']) { |
|
| 527 | + $entries[$action]['extra']['board'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'; |
|
| 528 | + } |
|
| 511 | 529 | } |
| 512 | 530 | } |
| 513 | 531 | $smcFunc['db_free_result']($request); |
@@ -541,10 +559,11 @@ discard block |
||
| 541 | 559 | ); |
| 542 | 560 | |
| 543 | 561 | // Make the topic number into a link - dealing with splitting too. |
| 544 | - if (isset($this_action['extra']['topic']) && $this_action['extra']['topic'] == $row['id_topic']) |
|
| 545 | - $this_action['extra']['topic'] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.' . (isset($this_action['extra']['message']) ? 'msg' . $this_action['extra']['message'] . '#msg' . $this_action['extra']['message'] : '0') . '">' . $row['subject'] . '</a>'; |
|
| 546 | - elseif (isset($this_action['extra']['new_topic']) && $this_action['extra']['new_topic'] == $row['id_topic']) |
|
| 547 | - $this_action['extra']['new_topic'] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.' . (isset($this_action['extra']['message']) ? 'msg' . $this_action['extra']['message'] . '#msg' . $this_action['extra']['message'] : '0') . '">' . $row['subject'] . '</a>'; |
|
| 562 | + if (isset($this_action['extra']['topic']) && $this_action['extra']['topic'] == $row['id_topic']) { |
|
| 563 | + $this_action['extra']['topic'] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.' . (isset($this_action['extra']['message']) ? 'msg' . $this_action['extra']['message'] . '#msg' . $this_action['extra']['message'] : '0') . '">' . $row['subject'] . '</a>'; |
|
| 564 | + } elseif (isset($this_action['extra']['new_topic']) && $this_action['extra']['new_topic'] == $row['id_topic']) { |
|
| 565 | + $this_action['extra']['new_topic'] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.' . (isset($this_action['extra']['message']) ? 'msg' . $this_action['extra']['message'] . '#msg' . $this_action['extra']['message'] : '0') . '">' . $row['subject'] . '</a>'; |
|
| 566 | + } |
|
| 548 | 567 | } |
| 549 | 568 | } |
| 550 | 569 | $smcFunc['db_free_result']($request); |
@@ -577,8 +596,9 @@ discard block |
||
| 577 | 596 | ); |
| 578 | 597 | |
| 579 | 598 | // Make the message number into a link. |
| 580 | - if (isset($this_action['extra']['message']) && $this_action['extra']['message'] == $row['id_msg']) |
|
| 581 | - $this_action['extra']['message'] = '<a href="' . $scripturl . '?msg=' . $row['id_msg'] . '">' . $row['subject'] . '</a>'; |
|
| 599 | + if (isset($this_action['extra']['message']) && $this_action['extra']['message'] == $row['id_msg']) { |
|
| 600 | + $this_action['extra']['message'] = '<a href="' . $scripturl . '?msg=' . $row['id_msg'] . '">' . $row['subject'] . '</a>'; |
|
| 601 | + } |
|
| 582 | 602 | } |
| 583 | 603 | } |
| 584 | 604 | $smcFunc['db_free_result']($request); |
@@ -618,25 +638,29 @@ discard block |
||
| 618 | 638 | foreach ($entries as $k => $entry) |
| 619 | 639 | { |
| 620 | 640 | // Make any message info links so its easier to go find that message. |
| 621 | - if (isset($entry['extra']['message']) && (empty($entry['message']) || empty($entry['message']['id']))) |
|
| 622 | - $entries[$k]['extra']['message'] = '<a href="' . $scripturl . '?msg=' . $entry['extra']['message'] . '">' . $entry['extra']['message'] . '</a>'; |
|
| 641 | + if (isset($entry['extra']['message']) && (empty($entry['message']) || empty($entry['message']['id']))) { |
|
| 642 | + $entries[$k]['extra']['message'] = '<a href="' . $scripturl . '?msg=' . $entry['extra']['message'] . '">' . $entry['extra']['message'] . '</a>'; |
|
| 643 | + } |
|
| 623 | 644 | |
| 624 | 645 | // Mark up any deleted members, topics and boards. |
| 625 | - foreach (array('board', 'board_from', 'board_to', 'member', 'topic', 'new_topic') as $type) |
|
| 626 | - if (!empty($entry['extra'][$type]) && is_numeric($entry['extra'][$type])) |
|
| 646 | + foreach (array('board', 'board_from', 'board_to', 'member', 'topic', 'new_topic') as $type) { |
|
| 647 | + if (!empty($entry['extra'][$type]) && is_numeric($entry['extra'][$type])) |
|
| 627 | 648 | $entries[$k]['extra'][$type] = sprintf($txt['modlog_id'], $entry['extra'][$type]); |
| 649 | + } |
|
| 628 | 650 | |
| 629 | 651 | if (isset($entry['extra']['report'])) |
| 630 | 652 | { |
| 631 | 653 | // Member profile reports go in a different area |
| 632 | - if (stristr($entry['action'], 'user_report')) |
|
| 633 | - $entries[$k]['extra']['report'] = '<a href="' . $scripturl . '?action=moderate;area=reportedmembers;sa=details;rid=' . $entry['extra']['report'] . '">' . $txt['modlog_report'] . '</a>'; |
|
| 634 | - else |
|
| 635 | - $entries[$k]['extra']['report'] = '<a href="' . $scripturl . '?action=moderate;area=reportedposts;sa=details;rid=' . $entry['extra']['report'] . '">' . $txt['modlog_report'] . '</a>'; |
|
| 654 | + if (stristr($entry['action'], 'user_report')) { |
|
| 655 | + $entries[$k]['extra']['report'] = '<a href="' . $scripturl . '?action=moderate;area=reportedmembers;sa=details;rid=' . $entry['extra']['report'] . '">' . $txt['modlog_report'] . '</a>'; |
|
| 656 | + } else { |
|
| 657 | + $entries[$k]['extra']['report'] = '<a href="' . $scripturl . '?action=moderate;area=reportedposts;sa=details;rid=' . $entry['extra']['report'] . '">' . $txt['modlog_report'] . '</a>'; |
|
| 658 | + } |
|
| 636 | 659 | } |
| 637 | 660 | |
| 638 | - if (empty($entries[$k]['action_text'])) |
|
| 639 | - $entries[$k]['action_text'] = isset($txt['modlog_ac_' . $entry['action']]) ? $txt['modlog_ac_' . $entry['action']] : $entry['action']; |
|
| 661 | + if (empty($entries[$k]['action_text'])) { |
|
| 662 | + $entries[$k]['action_text'] = isset($txt['modlog_ac_' . $entry['action']]) ? $txt['modlog_ac_' . $entry['action']] : $entry['action']; |
|
| 663 | + } |
|
| 640 | 664 | $entries[$k]['action_text'] = preg_replace_callback('~\{([A-Za-z\d_]+)\}~i', |
| 641 | 665 | function ($matches) use ($entries, $k) |
| 642 | 666 | { |
@@ -11,8 +11,9 @@ discard block |
||
| 11 | 11 | * @version 2.1 Beta 3 |
| 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 | * Class browser_detector |
@@ -55,20 +56,25 @@ discard block |
||
| 55 | 56 | $this->_browsers['needs_size_fix'] = false; |
| 56 | 57 | |
| 57 | 58 | // One at a time, one at a time, and in this order too |
| 58 | - if ($this->isOpera()) |
|
| 59 | - $this->setupOpera(); |
|
| 59 | + if ($this->isOpera()) { |
|
| 60 | + $this->setupOpera(); |
|
| 61 | + } |
|
| 60 | 62 | // Meh... |
| 61 | - elseif ($this->isEdge()) |
|
| 62 | - $this->setupEdge(); |
|
| 63 | + elseif ($this->isEdge()) { |
|
| 64 | + $this->setupEdge(); |
|
| 65 | + } |
|
| 63 | 66 | // Them webkits need to be set up too |
| 64 | - elseif ($this->isWebkit()) |
|
| 65 | - $this->setupWebkit(); |
|
| 67 | + elseif ($this->isWebkit()) { |
|
| 68 | + $this->setupWebkit(); |
|
| 69 | + } |
|
| 66 | 70 | // We may have work to do on Firefox... |
| 67 | - elseif ($this->isFirefox()) |
|
| 68 | - $this->setupFirefox(); |
|
| 71 | + elseif ($this->isFirefox()) { |
|
| 72 | + $this->setupFirefox(); |
|
| 73 | + } |
|
| 69 | 74 | // Old friend, old frenemy |
| 70 | - elseif ($this->isIe()) |
|
| 71 | - $this->setupIe(); |
|
| 75 | + elseif ($this->isIe()) { |
|
| 76 | + $this->setupIe(); |
|
| 77 | + } |
|
| 72 | 78 | |
| 73 | 79 | // Just a few mobile checks |
| 74 | 80 | $this->isOperaMini(); |
@@ -84,11 +90,12 @@ discard block |
||
| 84 | 90 | $this->_browsers['possibly_robot'] = !empty($user_info['possibly_robot']); |
| 85 | 91 | |
| 86 | 92 | // Robots shouldn't be logging in or registering. So, they aren't a bot. Better to be wrong than sorry (or people won't be able to log in!), anyway. |
| 87 | - if ((isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('login', 'login2', 'register', 'signup'))) || !$user_info['is_guest']) |
|
| 88 | - $this->_browsers['possibly_robot'] = false; |
|
| 93 | + if ((isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('login', 'login2', 'register', 'signup'))) || !$user_info['is_guest']) { |
|
| 94 | + $this->_browsers['possibly_robot'] = false; |
|
| 95 | + } |
|
| 96 | + } else { |
|
| 97 | + $this->_browsers['possibly_robot'] = false; |
|
| 89 | 98 | } |
| 90 | - else |
|
| 91 | - $this->_browsers['possibly_robot'] = false; |
|
| 92 | 99 | |
| 93 | 100 | // Fill out the historical array as needed to support old mods that don't use isBrowser |
| 94 | 101 | $this->fillInformation(); |
@@ -106,8 +113,9 @@ discard block |
||
| 106 | 113 | */ |
| 107 | 114 | function isOpera() |
| 108 | 115 | { |
| 109 | - if (!isset($this->_browsers['is_opera'])) |
|
| 110 | - $this->_browsers['is_opera'] = strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false; |
|
| 116 | + if (!isset($this->_browsers['is_opera'])) { |
|
| 117 | + $this->_browsers['is_opera'] = strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false; |
|
| 118 | + } |
|
| 111 | 119 | return $this->_browsers['is_opera']; |
| 112 | 120 | } |
| 113 | 121 | |
@@ -118,8 +126,9 @@ discard block |
||
| 118 | 126 | function isIe() |
| 119 | 127 | { |
| 120 | 128 | // I'm IE, Yes I'm the real IE; All you other IEs are just imitating. |
| 121 | - if (!isset($this->_browsers['is_ie'])) |
|
| 122 | - $this->_browsers['is_ie'] = !$this->isOpera() && !$this->isGecko() && !$this->isWebTv() && preg_match('~MSIE \d+~', $_SERVER['HTTP_USER_AGENT']) === 1; |
|
| 129 | + if (!isset($this->_browsers['is_ie'])) { |
|
| 130 | + $this->_browsers['is_ie'] = !$this->isOpera() && !$this->isGecko() && !$this->isWebTv() && preg_match('~MSIE \d+~', $_SERVER['HTTP_USER_AGENT']) === 1; |
|
| 131 | + } |
|
| 123 | 132 | return $this->_browsers['is_ie']; |
| 124 | 133 | } |
| 125 | 134 | |
@@ -131,8 +140,9 @@ discard block |
||
| 131 | 140 | { |
| 132 | 141 | // IE11 is a bit different than earlier versions |
| 133 | 142 | // The isGecko() part is to ensure we get this right... |
| 134 | - if (!isset($this->_browsers['is_ie11'])) |
|
| 135 | - $this->_browsers['is_ie11'] = strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false && $this->isGecko(); |
|
| 143 | + if (!isset($this->_browsers['is_ie11'])) { |
|
| 144 | + $this->_browsers['is_ie11'] = strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false && $this->isGecko(); |
|
| 145 | + } |
|
| 136 | 146 | return $this->_browsers['is_ie11']; |
| 137 | 147 | } |
| 138 | 148 | |
@@ -142,8 +152,9 @@ discard block |
||
| 142 | 152 | */ |
| 143 | 153 | function isEdge() |
| 144 | 154 | { |
| 145 | - if (!isset($this->_browsers['is_edge'])) |
|
| 146 | - $this->_browsers['is_edge'] = strpos($_SERVER['HTTP_USER_AGENT'], 'Edge') !== false; |
|
| 155 | + if (!isset($this->_browsers['is_edge'])) { |
|
| 156 | + $this->_browsers['is_edge'] = strpos($_SERVER['HTTP_USER_AGENT'], 'Edge') !== false; |
|
| 157 | + } |
|
| 147 | 158 | return $this->_browsers['is_edge']; |
| 148 | 159 | } |
| 149 | 160 | |
@@ -153,8 +164,9 @@ discard block |
||
| 153 | 164 | */ |
| 154 | 165 | function isWebkit() |
| 155 | 166 | { |
| 156 | - if (!isset($this->_browsers['is_webkit'])) |
|
| 157 | - $this->_browsers['is_webkit'] = strpos($_SERVER['HTTP_USER_AGENT'], 'AppleWebKit') !== false; |
|
| 167 | + if (!isset($this->_browsers['is_webkit'])) { |
|
| 168 | + $this->_browsers['is_webkit'] = strpos($_SERVER['HTTP_USER_AGENT'], 'AppleWebKit') !== false; |
|
| 169 | + } |
|
| 158 | 170 | return $this->_browsers['is_webkit']; |
| 159 | 171 | } |
| 160 | 172 | |
@@ -164,8 +176,9 @@ discard block |
||
| 164 | 176 | */ |
| 165 | 177 | function isFirefox() |
| 166 | 178 | { |
| 167 | - if (!isset($this->_browsers['is_firefox'])) |
|
| 168 | - $this->_browsers['is_firefox'] = preg_match('~(?:Firefox|Ice[wW]easel|IceCat|Shiretoko|Minefield)/~', $_SERVER['HTTP_USER_AGENT']) === 1 && $this->isGecko(); |
|
| 179 | + if (!isset($this->_browsers['is_firefox'])) { |
|
| 180 | + $this->_browsers['is_firefox'] = preg_match('~(?:Firefox|Ice[wW]easel|IceCat|Shiretoko|Minefield)/~', $_SERVER['HTTP_USER_AGENT']) === 1 && $this->isGecko(); |
|
| 181 | + } |
|
| 169 | 182 | return $this->_browsers['is_firefox']; |
| 170 | 183 | } |
| 171 | 184 | |
@@ -175,8 +188,9 @@ discard block |
||
| 175 | 188 | */ |
| 176 | 189 | function isWebTv() |
| 177 | 190 | { |
| 178 | - if (!isset($this->_browsers['is_web_tv'])) |
|
| 179 | - $this->_browsers['is_web_tv'] = strpos($_SERVER['HTTP_USER_AGENT'], 'WebTV') !== false; |
|
| 191 | + if (!isset($this->_browsers['is_web_tv'])) { |
|
| 192 | + $this->_browsers['is_web_tv'] = strpos($_SERVER['HTTP_USER_AGENT'], 'WebTV') !== false; |
|
| 193 | + } |
|
| 180 | 194 | return $this->_browsers['is_web_tv']; |
| 181 | 195 | } |
| 182 | 196 | |
@@ -186,8 +200,9 @@ discard block |
||
| 186 | 200 | */ |
| 187 | 201 | function isKonqueror() |
| 188 | 202 | { |
| 189 | - if (!isset($this->_browsers['is_konqueror'])) |
|
| 190 | - $this->_browsers['is_konqueror'] = strpos($_SERVER['HTTP_USER_AGENT'], 'Konqueror') !== false; |
|
| 203 | + if (!isset($this->_browsers['is_konqueror'])) { |
|
| 204 | + $this->_browsers['is_konqueror'] = strpos($_SERVER['HTTP_USER_AGENT'], 'Konqueror') !== false; |
|
| 205 | + } |
|
| 191 | 206 | return $this->_browsers['is_konqueror']; |
| 192 | 207 | } |
| 193 | 208 | |
@@ -197,8 +212,9 @@ discard block |
||
| 197 | 212 | */ |
| 198 | 213 | function isGecko() |
| 199 | 214 | { |
| 200 | - if (!isset($this->_browsers['is_gecko'])) |
|
| 201 | - $this->_browsers['is_gecko'] = strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false && !$this->isWebkit() && !$this->isKonqueror(); |
|
| 215 | + if (!isset($this->_browsers['is_gecko'])) { |
|
| 216 | + $this->_browsers['is_gecko'] = strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false && !$this->isWebkit() && !$this->isKonqueror(); |
|
| 217 | + } |
|
| 202 | 218 | return $this->_browsers['is_gecko']; |
| 203 | 219 | } |
| 204 | 220 | |
@@ -208,10 +224,12 @@ discard block |
||
| 208 | 224 | */ |
| 209 | 225 | function isOperaMini() |
| 210 | 226 | { |
| 211 | - if (!isset($this->_browsers['is_opera_mini'])) |
|
| 212 | - $this->_browsers['is_opera_mini'] = (isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) || stripos($_SERVER['HTTP_USER_AGENT'], 'opera mini') !== false); |
|
| 213 | - if ($this->_browsers['is_opera_mini']) |
|
| 214 | - $this->_is_mobile = true; |
|
| 227 | + if (!isset($this->_browsers['is_opera_mini'])) { |
|
| 228 | + $this->_browsers['is_opera_mini'] = (isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) || stripos($_SERVER['HTTP_USER_AGENT'], 'opera mini') !== false); |
|
| 229 | + } |
|
| 230 | + if ($this->_browsers['is_opera_mini']) { |
|
| 231 | + $this->_is_mobile = true; |
|
| 232 | + } |
|
| 215 | 233 | return $this->_browsers['is_opera_mini']; |
| 216 | 234 | } |
| 217 | 235 | |
@@ -221,10 +239,12 @@ discard block |
||
| 221 | 239 | */ |
| 222 | 240 | function isOperaMobi() |
| 223 | 241 | { |
| 224 | - if (!isset($this->_browsers['is_opera_mobi'])) |
|
| 225 | - $this->_browsers['is_opera_mobi'] = stripos($_SERVER['HTTP_USER_AGENT'], 'opera mobi') !== false; |
|
| 226 | - if ($this->_browsers['is_opera_mobi']) |
|
| 227 | - $this->_is_mobile = true; |
|
| 242 | + if (!isset($this->_browsers['is_opera_mobi'])) { |
|
| 243 | + $this->_browsers['is_opera_mobi'] = stripos($_SERVER['HTTP_USER_AGENT'], 'opera mobi') !== false; |
|
| 244 | + } |
|
| 245 | + if ($this->_browsers['is_opera_mobi']) { |
|
| 246 | + $this->_is_mobile = true; |
|
| 247 | + } |
|
| 228 | 248 | return $this->_browsers['is_opera_mini']; |
| 229 | 249 | } |
| 230 | 250 | |
@@ -244,8 +264,9 @@ discard block |
||
| 244 | 264 | ); |
| 245 | 265 | |
| 246 | 266 | // blackberry, playbook, iphone, nokia, android and ipods set a mobile flag |
| 247 | - if ($this->_browsers['is_iphone'] || $this->_browsers['is_blackberry'] || $this->_browsers['is_android'] || $this->_browsers['is_nokia']) |
|
| 248 | - $this->_is_mobile = true; |
|
| 267 | + if ($this->_browsers['is_iphone'] || $this->_browsers['is_blackberry'] || $this->_browsers['is_android'] || $this->_browsers['is_nokia']) { |
|
| 268 | + $this->_is_mobile = true; |
|
| 269 | + } |
|
| 249 | 270 | |
| 250 | 271 | // @todo what to do with the blaPad? ... for now leave it detected as Safari ... |
| 251 | 272 | $this->_browsers['is_safari'] = strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== false && !$this->_browsers['is_chrome'] && !$this->_browsers['is_iphone']; |
@@ -254,15 +275,17 @@ discard block |
||
| 254 | 275 | // if Chrome, get the major version |
| 255 | 276 | if ($this->_browsers['is_chrome']) |
| 256 | 277 | { |
| 257 | - if (preg_match('~chrome[/]([0-9][0-9]?[.])~i', $_SERVER['HTTP_USER_AGENT'], $match) === 1) |
|
| 258 | - $this->_browsers['is_chrome' . (int) $match[1]] = true; |
|
| 278 | + if (preg_match('~chrome[/]([0-9][0-9]?[.])~i', $_SERVER['HTTP_USER_AGENT'], $match) === 1) { |
|
| 279 | + $this->_browsers['is_chrome' . (int) $match[1]] = true; |
|
| 280 | + } |
|
| 259 | 281 | } |
| 260 | 282 | |
| 261 | 283 | // or if Safari get its major version |
| 262 | 284 | if ($this->_browsers['is_safari']) |
| 263 | 285 | { |
| 264 | - if (preg_match('~version/?(.*)safari.*~i', $_SERVER['HTTP_USER_AGENT'], $match) === 1) |
|
| 265 | - $this->_browsers['is_safari' . (int) trim($match[1])] = true; |
|
| 286 | + if (preg_match('~version/?(.*)safari.*~i', $_SERVER['HTTP_USER_AGENT'], $match) === 1) { |
|
| 287 | + $this->_browsers['is_safari' . (int) trim($match[1])] = true; |
|
| 288 | + } |
|
| 266 | 289 | } |
| 267 | 290 | } |
| 268 | 291 | |
@@ -291,8 +314,9 @@ discard block |
||
| 291 | 314 | $this->_browsers['is_ie' . ((int) $trident_match[1] + 4)] = true; |
| 292 | 315 | |
| 293 | 316 | // If trident is set, see the (if any) msie tag in the user agent matches ... if not its in some compatibility view |
| 294 | - if (isset($msie_match[1]) && ($msie_match[1] < $trident_match[1] + 4)) |
|
| 295 | - $this->_browsers['is_ie_compat_view'] = true; |
|
| 317 | + if (isset($msie_match[1]) && ($msie_match[1] < $trident_match[1] + 4)) { |
|
| 318 | + $this->_browsers['is_ie_compat_view'] = true; |
|
| 319 | + } |
|
| 296 | 320 | } |
| 297 | 321 | |
| 298 | 322 | // Detect true IE6 and IE7 and not IE in compat mode. |
@@ -326,8 +350,9 @@ discard block |
||
| 326 | 350 | */ |
| 327 | 351 | private function setupFirefox() |
| 328 | 352 | { |
| 329 | - if (preg_match('~(?:Firefox|Ice[wW]easel|IceCat|Shiretoko|Minefield)[\/ \(]([^ ;\)]+)~', $_SERVER['HTTP_USER_AGENT'], $match) === 1) |
|
| 330 | - $this->_browsers['is_firefox' . (int) $match[1]] = true; |
|
| 353 | + if (preg_match('~(?:Firefox|Ice[wW]easel|IceCat|Shiretoko|Minefield)[\/ \(]([^ ;\)]+)~', $_SERVER['HTTP_USER_AGENT'], $match) === 1) { |
|
| 354 | + $this->_browsers['is_firefox' . (int) $match[1]] = true; |
|
| 355 | + } |
|
| 331 | 356 | } |
| 332 | 357 | |
| 333 | 358 | /** |
@@ -338,11 +363,13 @@ discard block |
||
| 338 | 363 | private function setupOpera() |
| 339 | 364 | { |
| 340 | 365 | // Opera 10+ uses the version tag at the end of the string |
| 341 | - if (preg_match('~\sVersion/([0-9]+)\.[0-9]+(?:\s*|$)~', $_SERVER['HTTP_USER_AGENT'], $match)) |
|
| 342 | - $this->_browsers['is_opera' . (int) $match[1]] = true; |
|
| 366 | + if (preg_match('~\sVersion/([0-9]+)\.[0-9]+(?:\s*|$)~', $_SERVER['HTTP_USER_AGENT'], $match)) { |
|
| 367 | + $this->_browsers['is_opera' . (int) $match[1]] = true; |
|
| 368 | + } |
|
| 343 | 369 | // Opera pre 10 is supposed to uses the Opera tag alone, as do some spoofers |
| 344 | - elseif (preg_match('~Opera[ /]([0-9]+)(?!\\.[89])~', $_SERVER['HTTP_USER_AGENT'], $match)) |
|
| 345 | - $this->_browsers['is_opera' . (int) $match[1]] = true; |
|
| 370 | + elseif (preg_match('~Opera[ /]([0-9]+)(?!\\.[89])~', $_SERVER['HTTP_USER_AGENT'], $match)) { |
|
| 371 | + $this->_browsers['is_opera' . (int) $match[1]] = true; |
|
| 372 | + } |
|
| 346 | 373 | |
| 347 | 374 | // Needs size fix? |
| 348 | 375 | $this->_browsers['needs_size_fix'] = !empty($this->_browsers['is_opera6']); |
@@ -353,8 +380,9 @@ discard block |
||
| 353 | 380 | */ |
| 354 | 381 | private function setupEdge() |
| 355 | 382 | { |
| 356 | - if (preg_match('~Edge[\/]([0-9][0-9]?[\.][0-9][0-9])~i', $_SERVER['HTTP_USER_AGENT'], $match) === 1) |
|
| 357 | - $this->_browsers['is_edge' . (int) $match[1]] = true; |
|
| 383 | + if (preg_match('~Edge[\/]([0-9][0-9]?[\.][0-9][0-9])~i', $_SERVER['HTTP_USER_AGENT'], $match) === 1) { |
|
| 384 | + $this->_browsers['is_edge' . (int) $match[1]] = true; |
|
| 385 | + } |
|
| 358 | 386 | } |
| 359 | 387 | |
| 360 | 388 | /** |
@@ -367,9 +395,9 @@ discard block |
||
| 367 | 395 | { |
| 368 | 396 | global $context; |
| 369 | 397 | |
| 370 | - if ($this->_is_mobile) |
|
| 371 | - $context['browser_body_id'] = 'mobile'; |
|
| 372 | - else |
|
| 398 | + if ($this->_is_mobile) { |
|
| 399 | + $context['browser_body_id'] = 'mobile'; |
|
| 400 | + } else |
|
| 373 | 401 | { |
| 374 | 402 | // add in any specific detection conversions here if you want a special body id e.g. 'is_opera9' => 'opera9' |
| 375 | 403 | $browser_priority = array( |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 3 |
| 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 | * Add the file functions to the $smcFunc array. |
@@ -23,28 +24,32 @@ discard block |
||
| 23 | 24 | { |
| 24 | 25 | global $smcFunc; |
| 25 | 26 | |
| 26 | - if (!isset($smcFunc['db_search_query']) || $smcFunc['db_search_query'] != 'smf_db_search_query') |
|
| 27 | - $smcFunc += array( |
|
| 27 | + if (!isset($smcFunc['db_search_query']) || $smcFunc['db_search_query'] != 'smf_db_search_query') { |
|
| 28 | + $smcFunc += array( |
|
| 28 | 29 | 'db_search_query' => 'smf_db_search_query', |
| 29 | 30 | 'db_search_support' => 'smf_db_search_support', |
| 30 | 31 | 'db_create_word_search' => 'smf_db_create_word_search', |
| 31 | 32 | 'db_support_ignore' => false, |
| 32 | 33 | ); |
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | db_extend(); |
| 35 | 37 | |
| 36 | 38 | //pg 9.5 got ignore support |
| 37 | 39 | $version = $smcFunc['db_get_version'](); |
| 38 | 40 | // if we got a Beta Version |
| 39 | - if (stripos($version, 'beta') !== false) |
|
| 40 | - $version = substr($version, 0, stripos($version, 'beta')).'.0'; |
|
| 41 | + if (stripos($version, 'beta') !== false) { |
|
| 42 | + $version = substr($version, 0, stripos($version, 'beta')).'.0'; |
|
| 43 | + } |
|
| 41 | 44 | // or RC |
| 42 | - if (stripos($version, 'rc') !== false) |
|
| 43 | - $version = substr($version, 0, stripos($version, 'rc')).'.0'; |
|
| 45 | + if (stripos($version, 'rc') !== false) { |
|
| 46 | + $version = substr($version, 0, stripos($version, 'rc')).'.0'; |
|
| 47 | + } |
|
| 44 | 48 | |
| 45 | - if (version_compare($version,'9.5.0','>=')) |
|
| 46 | - $smcFunc['db_support_ignore'] = true; |
|
| 47 | -} |
|
| 49 | + if (version_compare($version,'9.5.0','>=')) { |
|
| 50 | + $smcFunc['db_support_ignore'] = true; |
|
| 51 | + } |
|
| 52 | + } |
|
| 48 | 53 | |
| 49 | 54 | /** |
| 50 | 55 | * This function will tell you whether this database type supports this search type. |
@@ -103,16 +108,16 @@ discard block |
||
| 103 | 108 | ), |
| 104 | 109 | ); |
| 105 | 110 | |
| 106 | - if (isset($replacements[$identifier])) |
|
| 107 | - $db_string = preg_replace(array_keys($replacements[$identifier]), array_values($replacements[$identifier]), $db_string); |
|
| 111 | + if (isset($replacements[$identifier])) { |
|
| 112 | + $db_string = preg_replace(array_keys($replacements[$identifier]), array_values($replacements[$identifier]), $db_string); |
|
| 113 | + } |
|
| 108 | 114 | if (preg_match('~^\s*INSERT\sIGNORE~i', $db_string) != 0) |
| 109 | 115 | { |
| 110 | 116 | $db_string = preg_replace('~^\s*INSERT\sIGNORE~i', 'INSERT', $db_string); |
| 111 | 117 | if ($smcFunc['db_support_ignore']){ |
| 112 | 118 | //pg style "INSERT INTO.... ON CONFLICT DO NOTHING" |
| 113 | 119 | $db_string = $db_string.' ON CONFLICT DO NOTHING'; |
| 114 | - } |
|
| 115 | - else |
|
| 120 | + } else |
|
| 116 | 121 | { |
| 117 | 122 | // Don't error on multi-insert. |
| 118 | 123 | $db_values['db_error_skip'] = true; |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | * @version 2.1 Beta 3 |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -if (!defined('SMF')) |
|
| 18 | +if (!defined('SMF')) { |
|
| 19 | 19 | die('No direct access...'); |
| 20 | +} |
|
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | 23 | * Main dispatcher. This function checks permissions and passes control through to the relevant section. |
@@ -245,8 +246,9 @@ discard block |
||
| 245 | 246 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 246 | 247 | { |
| 247 | 248 | // Private PM/email subjects and similar shouldn't be shown in the mailbox area. |
| 248 | - if (!empty($row['private'])) |
|
| 249 | - $row['subject'] = $txt['personal_message']; |
|
| 249 | + if (!empty($row['private'])) { |
|
| 250 | + $row['subject'] = $txt['personal_message']; |
|
| 251 | + } |
|
| 250 | 252 | |
| 251 | 253 | $mails[] = $row; |
| 252 | 254 | } |
@@ -300,8 +302,9 @@ discard block |
||
| 300 | 302 | $element = substr($key, strrpos($key, '_') + 1); |
| 301 | 303 | $processedBirthdayEmails[$index][$element] = $value; |
| 302 | 304 | } |
| 303 | - foreach ($processedBirthdayEmails as $index => $dummy) |
|
| 304 | - $emails[$index] = $index; |
|
| 305 | + foreach ($processedBirthdayEmails as $index => $dummy) { |
|
| 306 | + $emails[$index] = $index; |
|
| 307 | + } |
|
| 305 | 308 | |
| 306 | 309 | $config_vars = array( |
| 307 | 310 | // Mail queue stuff, this rocks ;) |
@@ -322,8 +325,9 @@ discard block |
||
| 322 | 325 | |
| 323 | 326 | call_integration_hook('integrate_modify_mail_settings', array(&$config_vars)); |
| 324 | 327 | |
| 325 | - if ($return_config) |
|
| 326 | - return $config_vars; |
|
| 328 | + if ($return_config) { |
|
| 329 | + return $config_vars; |
|
| 330 | + } |
|
| 327 | 331 | |
| 328 | 332 | // Saving? |
| 329 | 333 | if (isset($_GET['save'])) |
@@ -398,9 +402,9 @@ discard block |
||
| 398 | 402 | ); |
| 399 | 403 | list ($_GET['te']) = $smcFunc['db_fetch_row']($request); |
| 400 | 404 | $smcFunc['db_free_result']($request); |
| 405 | + } else { |
|
| 406 | + $_GET['te'] = (int) $_GET['te']; |
|
| 401 | 407 | } |
| 402 | - else |
|
| 403 | - $_GET['te'] = (int) $_GET['te']; |
|
| 404 | 408 | |
| 405 | 409 | $_GET['sent'] = isset($_GET['sent']) ? (int) $_GET['sent'] : 0; |
| 406 | 410 | |
@@ -424,12 +428,14 @@ discard block |
||
| 424 | 428 | |
| 425 | 429 | // Try get more time... |
| 426 | 430 | @set_time_limit(600); |
| 427 | - if (function_exists('apache_reset_timeout')) |
|
| 428 | - @apache_reset_timeout(); |
|
| 431 | + if (function_exists('apache_reset_timeout')) { |
|
| 432 | + @apache_reset_timeout(); |
|
| 433 | + } |
|
| 429 | 434 | |
| 430 | 435 | // Have we already used our maximum time? |
| 431 | - if (time() - array_sum(explode(' ', $time_start)) < 5) |
|
| 432 | - return; |
|
| 436 | + if (time() - array_sum(explode(' ', $time_start)) < 5) { |
|
| 437 | + return; |
|
| 438 | + } |
|
| 433 | 439 | |
| 434 | 440 | $context['continue_get_data'] = '?action=admin;area=mailqueue;sa=clear;te=' . $_GET['te'] . ';sent=' . $_GET['sent'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
| 435 | 441 | $context['page_title'] = $txt['not_done_title']; |
@@ -459,8 +465,9 @@ discard block |
||
| 459 | 465 | { |
| 460 | 466 | global $txt; |
| 461 | 467 | |
| 462 | - if ($time_diff < 0) |
|
| 463 | - $time_diff = 0; |
|
| 468 | + if ($time_diff < 0) { |
|
| 469 | + $time_diff = 0; |
|
| 470 | + } |
|
| 464 | 471 | |
| 465 | 472 | // Just do a bit of an if fest... |
| 466 | 473 | if ($time_diff > 86400) |
@@ -481,8 +488,9 @@ discard block |
||
| 481 | 488 | return sprintf($minutes == 1 ? $txt['mq_minute'] : $txt['mq_minutes'], $minutes); |
| 482 | 489 | } |
| 483 | 490 | // Otherwise must be second |
| 484 | - else |
|
| 485 | - return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
| 486 | -} |
|
| 491 | + else { |
|
| 492 | + return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
| 493 | + } |
|
| 494 | + } |
|
| 487 | 495 | |
| 488 | 496 | ?> |
@@ -18,8 +18,9 @@ discard block |
||
| 18 | 18 | * @version 2.1 Beta 3 |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | -if (!defined('SMF')) |
|
| 21 | +if (!defined('SMF')) { |
|
| 22 | 22 | die('No direct access...'); |
| 23 | +} |
|
| 23 | 24 | |
| 24 | 25 | /** |
| 25 | 26 | * downloads a file from a url and stores it locally for avatar use by id_member. |
@@ -44,8 +45,9 @@ discard block |
||
| 44 | 45 | $destName = 'avatar_' . $memID . '_' . time() . '.' . $ext; |
| 45 | 46 | |
| 46 | 47 | // Just making sure there is a non-zero member. |
| 47 | - if (empty($memID)) |
|
| 48 | - return false; |
|
| 48 | + if (empty($memID)) { |
|
| 49 | + return false; |
|
| 50 | + } |
|
| 49 | 51 | |
| 50 | 52 | require_once($sourcedir . '/ManageAttachments.php'); |
| 51 | 53 | removeAttachments(array('id_member' => $memID)); |
@@ -76,10 +78,11 @@ discard block |
||
| 76 | 78 | $destName = $modSettings['custom_avatar_dir'] . '/' . $destName . '.tmp'; |
| 77 | 79 | |
| 78 | 80 | // Resize it. |
| 79 | - if (!empty($modSettings['avatar_download_png'])) |
|
| 80 | - $success = resizeImageFile($url, $destName, $max_width, $max_height, 3); |
|
| 81 | - else |
|
| 82 | - $success = resizeImageFile($url, $destName, $max_width, $max_height); |
|
| 81 | + if (!empty($modSettings['avatar_download_png'])) { |
|
| 82 | + $success = resizeImageFile($url, $destName, $max_width, $max_height, 3); |
|
| 83 | + } else { |
|
| 84 | + $success = resizeImageFile($url, $destName, $max_width, $max_height); |
|
| 85 | + } |
|
| 83 | 86 | |
| 84 | 87 | // Remove the .tmp extension. |
| 85 | 88 | $destName = substr($destName, 0, -4); |
@@ -108,11 +111,10 @@ discard block |
||
| 108 | 111 | ) |
| 109 | 112 | ); |
| 110 | 113 | return true; |
| 114 | + } else { |
|
| 115 | + return false; |
|
| 111 | 116 | } |
| 112 | - else |
|
| 113 | - return false; |
|
| 114 | - } |
|
| 115 | - else |
|
| 117 | + } else |
|
| 116 | 118 | { |
| 117 | 119 | $smcFunc['db_query']('', ' |
| 118 | 120 | DELETE FROM {db_prefix}attachments |
@@ -144,17 +146,18 @@ discard block |
||
| 144 | 146 | $destName = $source . '_thumb.tmp'; |
| 145 | 147 | |
| 146 | 148 | // Do the actual resize. |
| 147 | - if (!empty($modSettings['attachment_thumb_png'])) |
|
| 148 | - $success = resizeImageFile($source, $destName, $max_width, $max_height, 3); |
|
| 149 | - else |
|
| 150 | - $success = resizeImageFile($source, $destName, $max_width, $max_height); |
|
| 149 | + if (!empty($modSettings['attachment_thumb_png'])) { |
|
| 150 | + $success = resizeImageFile($source, $destName, $max_width, $max_height, 3); |
|
| 151 | + } else { |
|
| 152 | + $success = resizeImageFile($source, $destName, $max_width, $max_height); |
|
| 153 | + } |
|
| 151 | 154 | |
| 152 | 155 | // Okay, we're done with the temporary stuff. |
| 153 | 156 | $destName = substr($destName, 0, -4); |
| 154 | 157 | |
| 155 | - if ($success && @rename($destName . '.tmp', $destName)) |
|
| 156 | - return true; |
|
| 157 | - else |
|
| 158 | + if ($success && @rename($destName . '.tmp', $destName)) { |
|
| 159 | + return true; |
|
| 160 | + } else |
|
| 158 | 161 | { |
| 159 | 162 | @unlink($destName . '.tmp'); |
| 160 | 163 | @touch($destName); |
@@ -176,18 +179,21 @@ discard block |
||
| 176 | 179 | { |
| 177 | 180 | if (!resizeImageFile($fileName, $fileName . '.tmp', null, null, $preferred_format)) |
| 178 | 181 | { |
| 179 | - if (file_exists($fileName . '.tmp')) |
|
| 180 | - unlink($fileName . '.tmp'); |
|
| 182 | + if (file_exists($fileName . '.tmp')) { |
|
| 183 | + unlink($fileName . '.tmp'); |
|
| 184 | + } |
|
| 181 | 185 | |
| 182 | 186 | return false; |
| 183 | 187 | } |
| 184 | 188 | |
| 185 | - if (!unlink($fileName)) |
|
| 186 | - return false; |
|
| 189 | + if (!unlink($fileName)) { |
|
| 190 | + return false; |
|
| 191 | + } |
|
| 187 | 192 | |
| 188 | - if (!rename($fileName . '.tmp', $fileName)) |
|
| 189 | - return false; |
|
| 190 | -} |
|
| 193 | + if (!rename($fileName . '.tmp', $fileName)) { |
|
| 194 | + return false; |
|
| 195 | + } |
|
| 196 | + } |
|
| 191 | 197 | |
| 192 | 198 | /** |
| 193 | 199 | * Searches through the file to see if there's potentially harmful non-binary content. |
@@ -200,8 +206,9 @@ discard block |
||
| 200 | 206 | function checkImageContents($fileName, $extensiveCheck = false) |
| 201 | 207 | { |
| 202 | 208 | $fp = fopen($fileName, 'rb'); |
| 203 | - if (!$fp) |
|
| 204 | - fatal_lang_error('attach_timeout'); |
|
| 209 | + if (!$fp) { |
|
| 210 | + fatal_lang_error('attach_timeout'); |
|
| 211 | + } |
|
| 205 | 212 | |
| 206 | 213 | $prev_chunk = ''; |
| 207 | 214 | while (!feof($fp)) |
@@ -217,8 +224,7 @@ discard block |
||
| 217 | 224 | fclose($fp); |
| 218 | 225 | return false; |
| 219 | 226 | } |
| 220 | - } |
|
| 221 | - else |
|
| 227 | + } else |
|
| 222 | 228 | { |
| 223 | 229 | // Check for potential infection |
| 224 | 230 | if (preg_match('~(iframe|(?<!cellTextIs)html|eval|body|script\W|[CF]WS[\x01-\x0C])~i', $prev_chunk . $cur_chunk) === 1) |
@@ -245,8 +251,9 @@ discard block |
||
| 245 | 251 | global $gd2; |
| 246 | 252 | |
| 247 | 253 | // Check to see if GD is installed and what version. |
| 248 | - if (($extensionFunctions = get_extension_funcs('gd')) === false) |
|
| 249 | - return false; |
|
| 254 | + if (($extensionFunctions = get_extension_funcs('gd')) === false) { |
|
| 255 | + return false; |
|
| 256 | + } |
|
| 250 | 257 | |
| 251 | 258 | // Also determine if GD2 is installed and store it in a global. |
| 252 | 259 | $gd2 = in_array('imagecreatetruecolor', $extensionFunctions) && function_exists('imagecreatetruecolor'); |
@@ -318,8 +325,9 @@ discard block |
||
| 318 | 325 | global $sourcedir; |
| 319 | 326 | |
| 320 | 327 | // Nothing to do without GD or IM/MW |
| 321 | - if (!checkGD() && !checkImagick() && !checkMagickWand()) |
|
| 322 | - return false; |
|
| 328 | + if (!checkGD() && !checkImagick() && !checkMagickWand()) { |
|
| 329 | + return false; |
|
| 330 | + } |
|
| 323 | 331 | |
| 324 | 332 | static $default_formats = array( |
| 325 | 333 | '1' => 'gif', |
@@ -341,38 +349,39 @@ discard block |
||
| 341 | 349 | fclose($fp_destination); |
| 342 | 350 | |
| 343 | 351 | $sizes = @getimagesize($destination); |
| 344 | - } |
|
| 345 | - elseif ($fp_destination) |
|
| 352 | + } elseif ($fp_destination) |
|
| 346 | 353 | { |
| 347 | 354 | $sizes = @getimagesize($source); |
| 348 | 355 | |
| 349 | 356 | $fp_source = fopen($source, 'rb'); |
| 350 | 357 | if ($fp_source !== false) |
| 351 | 358 | { |
| 352 | - while (!feof($fp_source)) |
|
| 353 | - fwrite($fp_destination, fread($fp_source, 8192)); |
|
| 359 | + while (!feof($fp_source)) { |
|
| 360 | + fwrite($fp_destination, fread($fp_source, 8192)); |
|
| 361 | + } |
|
| 354 | 362 | fclose($fp_source); |
| 363 | + } else { |
|
| 364 | + $sizes = array(-1, -1, -1); |
|
| 355 | 365 | } |
| 356 | - else |
|
| 357 | - $sizes = array(-1, -1, -1); |
|
| 358 | 366 | fclose($fp_destination); |
| 359 | 367 | } |
| 360 | 368 | // We can't get to the file. |
| 361 | - else |
|
| 362 | - $sizes = array(-1, -1, -1); |
|
| 369 | + else { |
|
| 370 | + $sizes = array(-1, -1, -1); |
|
| 371 | + } |
|
| 363 | 372 | |
| 364 | 373 | // See if we have -or- can get the needed memory for this operation |
| 365 | 374 | // ImageMagick isn't subject to PHP's memory limits :) |
| 366 | - if (!(checkIMagick() || checkMagickWand()) && checkGD() && !imageMemoryCheck($sizes)) |
|
| 367 | - return false; |
|
| 375 | + if (!(checkIMagick() || checkMagickWand()) && checkGD() && !imageMemoryCheck($sizes)) { |
|
| 376 | + return false; |
|
| 377 | + } |
|
| 368 | 378 | |
| 369 | 379 | // A known and supported format? |
| 370 | 380 | // @todo test PSD and gif. |
| 371 | 381 | if ((checkImagick() || checkMagickWand()) && isset($default_formats[$sizes[2]])) |
| 372 | 382 | { |
| 373 | 383 | return resizeImage(null, $destination, null, null, $max_width, $max_height, true, $preferred_format); |
| 374 | - } |
|
| 375 | - elseif (checkGD() && isset($default_formats[$sizes[2]]) && function_exists('imagecreatefrom' . $default_formats[$sizes[2]])) |
|
| 384 | + } elseif (checkGD() && isset($default_formats[$sizes[2]]) && function_exists('imagecreatefrom' . $default_formats[$sizes[2]])) |
|
| 376 | 385 | { |
| 377 | 386 | $imagecreatefrom = 'imagecreatefrom' . $default_formats[$sizes[2]]; |
| 378 | 387 | if ($src_img = @$imagecreatefrom($destination)) |
@@ -425,14 +434,14 @@ discard block |
||
| 425 | 434 | $dest_width = empty($max_width) ? $src_width : $max_width; |
| 426 | 435 | $dest_height = empty($max_height) ? $src_height : $max_height; |
| 427 | 436 | |
| 428 | - if ($default_formats[$preferred_format] == 'jpeg') |
|
| 429 | - $imagick->setCompressionQuality(!empty($modSettings['avatar_jpeg_quality']) ? $modSettings['avatar_jpeg_quality'] : 82); |
|
| 437 | + if ($default_formats[$preferred_format] == 'jpeg') { |
|
| 438 | + $imagick->setCompressionQuality(!empty($modSettings['avatar_jpeg_quality']) ? $modSettings['avatar_jpeg_quality'] : 82); |
|
| 439 | + } |
|
| 430 | 440 | |
| 431 | 441 | $imagick->setImageFormat($default_formats[$preferred_format]); |
| 432 | 442 | $imagick->resizeImage($dest_width, $dest_height, Imagick::FILTER_LANCZOS, 1, true); |
| 433 | 443 | $success = $imagick->writeImage($destName); |
| 434 | - } |
|
| 435 | - else |
|
| 444 | + } else |
|
| 436 | 445 | { |
| 437 | 446 | $magick_wand = newMagickWand(); |
| 438 | 447 | MagickReadImage($magick_wand, $destName); |
@@ -441,8 +450,9 @@ discard block |
||
| 441 | 450 | $dest_width = empty($max_width) ? $src_width : $max_width; |
| 442 | 451 | $dest_height = empty($max_height) ? $src_height : $max_height; |
| 443 | 452 | |
| 444 | - if ($default_formats[$preferred_format] == 'jpeg') |
|
| 445 | - MagickSetCompressionQuality($magick_wand, !empty($modSettings['avatar_jpeg_quality']) ? $modSettings['avatar_jpeg_quality'] : 82); |
|
| 453 | + if ($default_formats[$preferred_format] == 'jpeg') { |
|
| 454 | + MagickSetCompressionQuality($magick_wand, !empty($modSettings['avatar_jpeg_quality']) ? $modSettings['avatar_jpeg_quality'] : 82); |
|
| 455 | + } |
|
| 446 | 456 | |
| 447 | 457 | MagickSetImageFormat($magick_wand, $default_formats[$preferred_format]); |
| 448 | 458 | MagickResizeImage($magick_wand, $dest_width, $dest_height, MW_LanczosFilter, 1, true); |
@@ -450,8 +460,7 @@ discard block |
||
| 450 | 460 | } |
| 451 | 461 | |
| 452 | 462 | return !empty($success); |
| 453 | - } |
|
| 454 | - elseif (checkGD()) |
|
| 463 | + } elseif (checkGD()) |
|
| 455 | 464 | { |
| 456 | 465 | $success = false; |
| 457 | 466 | |
@@ -462,8 +471,7 @@ discard block |
||
| 462 | 471 | { |
| 463 | 472 | $dst_width = $max_width; |
| 464 | 473 | $dst_height = round($src_height * $max_width / $src_width); |
| 465 | - } |
|
| 466 | - elseif (!empty($max_height)) |
|
| 474 | + } elseif (!empty($max_height)) |
|
| 467 | 475 | { |
| 468 | 476 | $dst_width = round($src_width * $max_height / $src_height); |
| 469 | 477 | $dst_height = $max_height; |
@@ -481,44 +489,48 @@ discard block |
||
| 481 | 489 | if ((!empty($preferred_format)) && ($preferred_format == 3)) |
| 482 | 490 | { |
| 483 | 491 | imagealphablending($dst_img, false); |
| 484 | - if (function_exists('imagesavealpha')) |
|
| 485 | - imagesavealpha($dst_img, true); |
|
| 492 | + if (function_exists('imagesavealpha')) { |
|
| 493 | + imagesavealpha($dst_img, true); |
|
| 494 | + } |
|
| 486 | 495 | } |
| 496 | + } else { |
|
| 497 | + $dst_img = imagecreate($dst_width, $dst_height); |
|
| 487 | 498 | } |
| 488 | - else |
|
| 489 | - $dst_img = imagecreate($dst_width, $dst_height); |
|
| 490 | 499 | |
| 491 | 500 | // Resize it! |
| 492 | - if ($gd2) |
|
| 493 | - imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
|
| 494 | - else |
|
| 495 | - imagecopyresamplebicubic($dst_img, $src_img, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
|
| 501 | + if ($gd2) { |
|
| 502 | + imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
|
| 503 | + } else { |
|
| 504 | + imagecopyresamplebicubic($dst_img, $src_img, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height); |
|
| 505 | + } |
|
| 506 | + } else { |
|
| 507 | + $dst_img = $src_img; |
|
| 496 | 508 | } |
| 497 | - else |
|
| 498 | - $dst_img = $src_img; |
|
| 509 | + } else { |
|
| 510 | + $dst_img = $src_img; |
|
| 499 | 511 | } |
| 500 | - else |
|
| 501 | - $dst_img = $src_img; |
|
| 502 | 512 | |
| 503 | 513 | // Save the image as ... |
| 504 | - if (!empty($preferred_format) && ($preferred_format == 3) && function_exists('imagepng')) |
|
| 505 | - $success = imagepng($dst_img, $destName); |
|
| 506 | - elseif (!empty($preferred_format) && ($preferred_format == 1) && function_exists('imagegif')) |
|
| 507 | - $success = imagegif($dst_img, $destName); |
|
| 508 | - elseif (function_exists('imagejpeg')) |
|
| 509 | - $success = imagejpeg($dst_img, $destName, !empty($modSettings['avatar_jpeg_quality']) ? $modSettings['avatar_jpeg_quality'] : 82); |
|
| 514 | + if (!empty($preferred_format) && ($preferred_format == 3) && function_exists('imagepng')) { |
|
| 515 | + $success = imagepng($dst_img, $destName); |
|
| 516 | + } elseif (!empty($preferred_format) && ($preferred_format == 1) && function_exists('imagegif')) { |
|
| 517 | + $success = imagegif($dst_img, $destName); |
|
| 518 | + } elseif (function_exists('imagejpeg')) { |
|
| 519 | + $success = imagejpeg($dst_img, $destName, !empty($modSettings['avatar_jpeg_quality']) ? $modSettings['avatar_jpeg_quality'] : 82); |
|
| 520 | + } |
|
| 510 | 521 | |
| 511 | 522 | // Free the memory. |
| 512 | 523 | imagedestroy($src_img); |
| 513 | - if ($dst_img != $src_img) |
|
| 514 | - imagedestroy($dst_img); |
|
| 524 | + if ($dst_img != $src_img) { |
|
| 525 | + imagedestroy($dst_img); |
|
| 526 | + } |
|
| 515 | 527 | |
| 516 | 528 | return $success; |
| 517 | - } |
|
| 518 | - else |
|
| 519 | - // Without GD, no image resizing at all. |
|
| 529 | + } else { |
|
| 530 | + // Without GD, no image resizing at all. |
|
| 520 | 531 | return false; |
| 521 | -} |
|
| 532 | + } |
|
| 533 | + } |
|
| 522 | 534 | |
| 523 | 535 | /** |
| 524 | 536 | * Copy image. |
@@ -572,8 +584,9 @@ discard block |
||
| 572 | 584 | $color = imagecolorresolve($dst_img, $red, $green, $blue); |
| 573 | 585 | if ($color == -1) |
| 574 | 586 | { |
| 575 | - if ($palsize++ < 256) |
|
| 576 | - imagecolorallocate($dst_img, $red, $green, $blue); |
|
| 587 | + if ($palsize++ < 256) { |
|
| 588 | + imagecolorallocate($dst_img, $red, $green, $blue); |
|
| 589 | + } |
|
| 577 | 590 | $color = imagecolorclosest($dst_img, $red, $green, $blue); |
| 578 | 591 | } |
| 579 | 592 | |
@@ -603,13 +616,15 @@ discard block |
||
| 603 | 616 | $header = unpack('vtype/Vsize/Vreserved/Voffset', fread($fp, 14)); |
| 604 | 617 | $info = unpack('Vsize/Vwidth/Vheight/vplanes/vbits/Vcompression/Vimagesize/Vxres/Vyres/Vncolor/Vcolorimportant', fread($fp, 40)); |
| 605 | 618 | |
| 606 | - if ($header['type'] != 0x4D42) |
|
| 607 | - return false; |
|
| 619 | + if ($header['type'] != 0x4D42) { |
|
| 620 | + return false; |
|
| 621 | + } |
|
| 608 | 622 | |
| 609 | - if ($gd2) |
|
| 610 | - $dst_img = imagecreatetruecolor($info['width'], $info['height']); |
|
| 611 | - else |
|
| 612 | - $dst_img = imagecreate($info['width'], $info['height']); |
|
| 623 | + if ($gd2) { |
|
| 624 | + $dst_img = imagecreatetruecolor($info['width'], $info['height']); |
|
| 625 | + } else { |
|
| 626 | + $dst_img = imagecreate($info['width'], $info['height']); |
|
| 627 | + } |
|
| 613 | 628 | |
| 614 | 629 | $palette_size = $header['offset'] - 54; |
| 615 | 630 | $info['ncolor'] = $palette_size / 4; |
@@ -635,8 +650,9 @@ discard block |
||
| 635 | 650 | fseek($fp, $header['offset'] + ($scan_line_size + $scan_line_align) * $l); |
| 636 | 651 | $scan_line = fread($fp, $scan_line_size); |
| 637 | 652 | |
| 638 | - if (strlen($scan_line) < $scan_line_size) |
|
| 639 | - continue; |
|
| 653 | + if (strlen($scan_line) < $scan_line_size) { |
|
| 654 | + continue; |
|
| 655 | + } |
|
| 640 | 656 | |
| 641 | 657 | if ($info['bits'] == 32) |
| 642 | 658 | { |
@@ -654,14 +670,14 @@ discard block |
||
| 654 | 670 | $color = imagecolorallocate($dst_img, $r, $g, $b); |
| 655 | 671 | |
| 656 | 672 | // Gah! Out of colors? Stupid GD 1... try anyhow. |
| 657 | - if ($color == -1) |
|
| 658 | - $color = imagecolorclosest($dst_img, $r, $g, $b); |
|
| 673 | + if ($color == -1) { |
|
| 674 | + $color = imagecolorclosest($dst_img, $r, $g, $b); |
|
| 675 | + } |
|
| 659 | 676 | } |
| 660 | 677 | |
| 661 | 678 | imagesetpixel($dst_img, $x, $y, $color); |
| 662 | 679 | } |
| 663 | - } |
|
| 664 | - elseif ($info['bits'] == 24) |
|
| 680 | + } elseif ($info['bits'] == 24) |
|
| 665 | 681 | { |
| 666 | 682 | $x = 0; |
| 667 | 683 | for ($j = 0; $j < $scan_line_size; $x++) |
@@ -676,14 +692,14 @@ discard block |
||
| 676 | 692 | $color = imagecolorallocate($dst_img, $r, $g, $b); |
| 677 | 693 | |
| 678 | 694 | // Gah! Out of colors? Stupid GD 1... try anyhow. |
| 679 | - if ($color == -1) |
|
| 680 | - $color = imagecolorclosest($dst_img, $r, $g, $b); |
|
| 695 | + if ($color == -1) { |
|
| 696 | + $color = imagecolorclosest($dst_img, $r, $g, $b); |
|
| 697 | + } |
|
| 681 | 698 | } |
| 682 | 699 | |
| 683 | 700 | imagesetpixel($dst_img, $x, $y, $color); |
| 684 | 701 | } |
| 685 | - } |
|
| 686 | - elseif ($info['bits'] == 16) |
|
| 702 | + } elseif ($info['bits'] == 16) |
|
| 687 | 703 | { |
| 688 | 704 | $x = 0; |
| 689 | 705 | for ($j = 0; $j < $scan_line_size; $x++) |
@@ -704,20 +720,20 @@ discard block |
||
| 704 | 720 | $color = imagecolorallocate($dst_img, $r, $g, $b); |
| 705 | 721 | |
| 706 | 722 | // Gah! Out of colors? Stupid GD 1... try anyhow. |
| 707 | - if ($color == -1) |
|
| 708 | - $color = imagecolorclosest($dst_img, $r, $g, $b); |
|
| 723 | + if ($color == -1) { |
|
| 724 | + $color = imagecolorclosest($dst_img, $r, $g, $b); |
|
| 725 | + } |
|
| 709 | 726 | } |
| 710 | 727 | |
| 711 | 728 | imagesetpixel($dst_img, $x, $y, $color); |
| 712 | 729 | } |
| 713 | - } |
|
| 714 | - elseif ($info['bits'] == 8) |
|
| 730 | + } elseif ($info['bits'] == 8) |
|
| 715 | 731 | { |
| 716 | 732 | $x = 0; |
| 717 | - for ($j = 0; $j < $scan_line_size; $x++) |
|
| 718 | - imagesetpixel($dst_img, $x, $y, $palette[ord($scan_line{$j++})]); |
|
| 719 | - } |
|
| 720 | - elseif ($info['bits'] == 4) |
|
| 733 | + for ($j = 0; $j < $scan_line_size; $x++) { |
|
| 734 | + imagesetpixel($dst_img, $x, $y, $palette[ord($scan_line{$j++})]); |
|
| 735 | + } |
|
| 736 | + } elseif ($info['bits'] == 4) |
|
| 721 | 737 | { |
| 722 | 738 | $x = 0; |
| 723 | 739 | for ($j = 0; $j < $scan_line_size; $x++) |
@@ -725,11 +741,11 @@ discard block |
||
| 725 | 741 | $byte = ord($scan_line{$j++}); |
| 726 | 742 | |
| 727 | 743 | imagesetpixel($dst_img, $x, $y, $palette[(int) ($byte / 16)]); |
| 728 | - if (++$x < $info['width']) |
|
| 729 | - imagesetpixel($dst_img, $x, $y, $palette[$byte & 15]); |
|
| 744 | + if (++$x < $info['width']) { |
|
| 745 | + imagesetpixel($dst_img, $x, $y, $palette[$byte & 15]); |
|
| 746 | + } |
|
| 730 | 747 | } |
| 731 | - } |
|
| 732 | - elseif ($info['bits'] == 1) |
|
| 748 | + } elseif ($info['bits'] == 1) |
|
| 733 | 749 | { |
| 734 | 750 | $x = 0; |
| 735 | 751 | for ($j = 0; $j < $scan_line_size; $x++) |
@@ -738,7 +754,9 @@ discard block |
||
| 738 | 754 | |
| 739 | 755 | imagesetpixel($dst_img, $x, $y, $palette[(($byte) & 128) != 0]); |
| 740 | 756 | for ($shift = 1; $shift < 8; $shift++) { |
| 741 | - if (++$x < $info['width']) imagesetpixel($dst_img, $x, $y, $palette[(($byte << $shift) & 128) != 0]); |
|
| 757 | + if (++$x < $info['width']) { |
|
| 758 | + imagesetpixel($dst_img, $x, $y, $palette[(($byte << $shift) & 128) != 0]); |
|
| 759 | + } |
|
| 742 | 760 | } |
| 743 | 761 | } |
| 744 | 762 | } |
@@ -762,15 +780,18 @@ discard block |
||
| 762 | 780 | */ |
| 763 | 781 | function gif_outputAsPng($gif, $lpszFileName, $background_color = -1) |
| 764 | 782 | { |
| 765 | - if (!isset($gif) || @get_class($gif) != 'cgif' || !$gif->loaded || $lpszFileName == '') |
|
| 766 | - return false; |
|
| 783 | + if (!isset($gif) || @get_class($gif) != 'cgif' || !$gif->loaded || $lpszFileName == '') { |
|
| 784 | + return false; |
|
| 785 | + } |
|
| 767 | 786 | |
| 768 | 787 | $fd = $gif->get_png_data($background_color); |
| 769 | - if (strlen($fd) <= 0) |
|
| 770 | - return false; |
|
| 788 | + if (strlen($fd) <= 0) { |
|
| 789 | + return false; |
|
| 790 | + } |
|
| 771 | 791 | |
| 772 | - if (!($fh = @fopen($lpszFileName, 'wb'))) |
|
| 773 | - return false; |
|
| 792 | + if (!($fh = @fopen($lpszFileName, 'wb'))) { |
|
| 793 | + return false; |
|
| 794 | + } |
|
| 774 | 795 | |
| 775 | 796 | @fwrite($fh, $fd, strlen($fd)); |
| 776 | 797 | @fflush($fh); |
@@ -797,8 +818,9 @@ discard block |
||
| 797 | 818 | // What type are we going to be doing? |
| 798 | 819 | $imageType = $modSettings['visual_verification_type']; |
| 799 | 820 | // Special case to allow the admin center to show samples. |
| 800 | - if ($user_info['is_admin'] && isset($_GET['type'])) |
|
| 801 | - $imageType = (int) $_GET['type']; |
|
| 821 | + if ($user_info['is_admin'] && isset($_GET['type'])) { |
|
| 822 | + $imageType = (int) $_GET['type']; |
|
| 823 | + } |
|
| 802 | 824 | |
| 803 | 825 | // Some quick references for what we do. |
| 804 | 826 | // Do we show no, low or high noise? |
@@ -832,25 +854,28 @@ discard block |
||
| 832 | 854 | $character_spacing = 1; |
| 833 | 855 | |
| 834 | 856 | // What color is the background - generally white unless we're on "hard". |
| 835 | - if ($simpleBGColor) |
|
| 836 | - $background_color = array(255, 255, 255); |
|
| 837 | - else |
|
| 838 | - $background_color = isset($settings['verification_background']) ? $settings['verification_background'] : array(236, 237, 243); |
|
| 857 | + if ($simpleBGColor) { |
|
| 858 | + $background_color = array(255, 255, 255); |
|
| 859 | + } else { |
|
| 860 | + $background_color = isset($settings['verification_background']) ? $settings['verification_background'] : array(236, 237, 243); |
|
| 861 | + } |
|
| 839 | 862 | |
| 840 | 863 | // The color of the characters shown (red, green, blue). |
| 841 | - if ($simpleFGColor) |
|
| 842 | - $foreground_color = array(0, 0, 0); |
|
| 843 | - else |
|
| 864 | + if ($simpleFGColor) { |
|
| 865 | + $foreground_color = array(0, 0, 0); |
|
| 866 | + } else |
|
| 844 | 867 | { |
| 845 | 868 | $foreground_color = array(64, 101, 136); |
| 846 | 869 | |
| 847 | 870 | // Has the theme author requested a custom color? |
| 848 | - if (isset($settings['verification_foreground'])) |
|
| 849 | - $foreground_color = $settings['verification_foreground']; |
|
| 871 | + if (isset($settings['verification_foreground'])) { |
|
| 872 | + $foreground_color = $settings['verification_foreground']; |
|
| 873 | + } |
|
| 850 | 874 | } |
| 851 | 875 | |
| 852 | - if (!is_dir($settings['default_theme_dir'] . '/fonts')) |
|
| 853 | - return false; |
|
| 876 | + if (!is_dir($settings['default_theme_dir'] . '/fonts')) { |
|
| 877 | + return false; |
|
| 878 | + } |
|
| 854 | 879 | |
| 855 | 880 | // Get a list of the available fonts. |
| 856 | 881 | $font_dir = dir($settings['default_theme_dir'] . '/fonts'); |
@@ -861,25 +886,28 @@ discard block |
||
| 861 | 886 | { |
| 862 | 887 | if (preg_match('~^(.+)\.gdf$~', $entry, $matches) === 1) |
| 863 | 888 | { |
| 864 | - if ($endian ^ (strpos($entry, '_end.gdf') === false)) |
|
| 865 | - $font_list[] = $entry; |
|
| 889 | + if ($endian ^ (strpos($entry, '_end.gdf') === false)) { |
|
| 890 | + $font_list[] = $entry; |
|
| 891 | + } |
|
| 892 | + } elseif (preg_match('~^(.+)\.ttf$~', $entry, $matches) === 1) { |
|
| 893 | + $ttfont_list[] = $entry; |
|
| 866 | 894 | } |
| 867 | - elseif (preg_match('~^(.+)\.ttf$~', $entry, $matches) === 1) |
|
| 868 | - $ttfont_list[] = $entry; |
|
| 869 | 895 | } |
| 870 | 896 | |
| 871 | - if (empty($font_list)) |
|
| 872 | - return false; |
|
| 897 | + if (empty($font_list)) { |
|
| 898 | + return false; |
|
| 899 | + } |
|
| 873 | 900 | |
| 874 | 901 | // For non-hard things don't even change fonts. |
| 875 | 902 | if (!$varyFonts) |
| 876 | 903 | { |
| 877 | 904 | $font_list = array($font_list[0]); |
| 878 | 905 | // Try use Screenge if we can - it looks good! |
| 879 | - if (in_array('AnonymousPro.ttf', $ttfont_list)) |
|
| 880 | - $ttfont_list = array('AnonymousPro.ttf'); |
|
| 881 | - else |
|
| 882 | - $ttfont_list = empty($ttfont_list) ? array() : array($ttfont_list[0]); |
|
| 906 | + if (in_array('AnonymousPro.ttf', $ttfont_list)) { |
|
| 907 | + $ttfont_list = array('AnonymousPro.ttf'); |
|
| 908 | + } else { |
|
| 909 | + $ttfont_list = empty($ttfont_list) ? array() : array($ttfont_list[0]); |
|
| 910 | + } |
|
| 883 | 911 | |
| 884 | 912 | } |
| 885 | 913 | |
@@ -897,14 +925,16 @@ discard block |
||
| 897 | 925 | } |
| 898 | 926 | |
| 899 | 927 | // Load all fonts and determine the maximum font height. |
| 900 | - foreach ($loaded_fonts as $font_index => $dummy) |
|
| 901 | - $loaded_fonts[$font_index] = imageloadfont($settings['default_theme_dir'] . '/fonts/' . $font_list[$font_index]); |
|
| 928 | + foreach ($loaded_fonts as $font_index => $dummy) { |
|
| 929 | + $loaded_fonts[$font_index] = imageloadfont($settings['default_theme_dir'] . '/fonts/' . $font_list[$font_index]); |
|
| 930 | + } |
|
| 902 | 931 | |
| 903 | 932 | // Determine the dimensions of each character. |
| 904 | - if ($imageType == 4 || $imageType == 5) |
|
| 905 | - $extra = 80; |
|
| 906 | - else |
|
| 907 | - $extra = 45; |
|
| 933 | + if ($imageType == 4 || $imageType == 5) { |
|
| 934 | + $extra = 80; |
|
| 935 | + } else { |
|
| 936 | + $extra = 45; |
|
| 937 | + } |
|
| 908 | 938 | |
| 909 | 939 | $total_width = $character_spacing * strlen($code) + $extra; |
| 910 | 940 | $max_height = 0; |
@@ -925,13 +955,15 @@ discard block |
||
| 925 | 955 | imagefilledrectangle($code_image, 0, 0, $total_width - 1, $max_height - 1, $bg_color); |
| 926 | 956 | |
| 927 | 957 | // Randomize the foreground color a little. |
| 928 | - for ($i = 0; $i < 3; $i++) |
|
| 929 | - $foreground_color[$i] = mt_rand(max($foreground_color[$i] - 3, 0), min($foreground_color[$i] + 3, 255)); |
|
| 958 | + for ($i = 0; $i < 3; $i++) { |
|
| 959 | + $foreground_color[$i] = mt_rand(max($foreground_color[$i] - 3, 0), min($foreground_color[$i] + 3, 255)); |
|
| 960 | + } |
|
| 930 | 961 | $fg_color = imagecolorallocate($code_image, $foreground_color[0], $foreground_color[1], $foreground_color[2]); |
| 931 | 962 | |
| 932 | 963 | // Color for the dots. |
| 933 | - for ($i = 0; $i < 3; $i++) |
|
| 934 | - $dotbgcolor[$i] = $background_color[$i] < $foreground_color[$i] ? mt_rand(0, max($foreground_color[$i] - 20, 0)) : mt_rand(min($foreground_color[$i] + 20, 255), 255); |
|
| 964 | + for ($i = 0; $i < 3; $i++) { |
|
| 965 | + $dotbgcolor[$i] = $background_color[$i] < $foreground_color[$i] ? mt_rand(0, max($foreground_color[$i] - 20, 0)) : mt_rand(min($foreground_color[$i] + 20, 255), 255); |
|
| 966 | + } |
|
| 935 | 967 | $randomness_color = imagecolorallocate($code_image, $dotbgcolor[0], $dotbgcolor[1], $dotbgcolor[2]); |
| 936 | 968 | |
| 937 | 969 | // Some squares/rectanges for new extreme level |
@@ -957,10 +989,11 @@ discard block |
||
| 957 | 989 | $can_do_ttf = function_exists('imagettftext'); |
| 958 | 990 | |
| 959 | 991 | // How much rotation will we give? |
| 960 | - if ($rotationType == 'none') |
|
| 961 | - $angle = 0; |
|
| 962 | - else |
|
| 963 | - $angle = mt_rand(-100, 100) / ($rotationType == 'high' ? 6 : 10); |
|
| 992 | + if ($rotationType == 'none') { |
|
| 993 | + $angle = 0; |
|
| 994 | + } else { |
|
| 995 | + $angle = mt_rand(-100, 100) / ($rotationType == 'high' ? 6 : 10); |
|
| 996 | + } |
|
| 964 | 997 | |
| 965 | 998 | // What color shall we do it? |
| 966 | 999 | if ($fontColorType == 'cyclic') |
@@ -974,51 +1007,56 @@ discard block |
||
| 974 | 1007 | array(0, 0, 0), |
| 975 | 1008 | array(143, 39, 31), |
| 976 | 1009 | ); |
| 977 | - if (!isset($last_index)) |
|
| 978 | - $last_index = -1; |
|
| 1010 | + if (!isset($last_index)) { |
|
| 1011 | + $last_index = -1; |
|
| 1012 | + } |
|
| 979 | 1013 | $new_index = $last_index; |
| 980 | - while ($last_index == $new_index) |
|
| 981 | - $new_index = mt_rand(0, count($colors) - 1); |
|
| 1014 | + while ($last_index == $new_index) { |
|
| 1015 | + $new_index = mt_rand(0, count($colors) - 1); |
|
| 1016 | + } |
|
| 982 | 1017 | $char_fg_color = $colors[$new_index]; |
| 983 | 1018 | $last_index = $new_index; |
| 1019 | + } elseif ($fontColorType == 'random') { |
|
| 1020 | + $char_fg_color = array(mt_rand(max($foreground_color[0] - 2, 0), $foreground_color[0]), mt_rand(max($foreground_color[1] - 2, 0), $foreground_color[1]), mt_rand(max($foreground_color[2] - 2, 0), $foreground_color[2])); |
|
| 1021 | + } else { |
|
| 1022 | + $char_fg_color = array($foreground_color[0], $foreground_color[1], $foreground_color[2]); |
|
| 984 | 1023 | } |
| 985 | - elseif ($fontColorType == 'random') |
|
| 986 | - $char_fg_color = array(mt_rand(max($foreground_color[0] - 2, 0), $foreground_color[0]), mt_rand(max($foreground_color[1] - 2, 0), $foreground_color[1]), mt_rand(max($foreground_color[2] - 2, 0), $foreground_color[2])); |
|
| 987 | - else |
|
| 988 | - $char_fg_color = array($foreground_color[0], $foreground_color[1], $foreground_color[2]); |
|
| 989 | 1024 | |
| 990 | 1025 | if (!empty($can_do_ttf)) |
| 991 | 1026 | { |
| 992 | 1027 | // GD2 handles font size differently. |
| 993 | - if ($fontSizeRandom) |
|
| 994 | - $font_size = $gd2 ? mt_rand(17, 19) : mt_rand(18, 25); |
|
| 995 | - else |
|
| 996 | - $font_size = $gd2 ? 18 : 24; |
|
| 1028 | + if ($fontSizeRandom) { |
|
| 1029 | + $font_size = $gd2 ? mt_rand(17, 19) : mt_rand(18, 25); |
|
| 1030 | + } else { |
|
| 1031 | + $font_size = $gd2 ? 18 : 24; |
|
| 1032 | + } |
|
| 997 | 1033 | |
| 998 | 1034 | // Work out the sizes - also fix the character width cause TTF not quite so wide! |
| 999 | 1035 | $font_x = $fontHorSpace == 'minus' && $cur_x > 0 ? $cur_x - 3 : $cur_x + 5; |
| 1000 | 1036 | $font_y = $max_height - ($fontVerPos == 'vrandom' ? mt_rand(2, 8) : ($fontVerPos == 'random' ? mt_rand(3, 5) : 5)); |
| 1001 | 1037 | |
| 1002 | 1038 | // What font face? |
| 1003 | - if (!empty($ttfont_list)) |
|
| 1004 | - $fontface = $settings['default_theme_dir'] . '/fonts/' . $ttfont_list[mt_rand(0, count($ttfont_list) - 1)]; |
|
| 1039 | + if (!empty($ttfont_list)) { |
|
| 1040 | + $fontface = $settings['default_theme_dir'] . '/fonts/' . $ttfont_list[mt_rand(0, count($ttfont_list) - 1)]; |
|
| 1041 | + } |
|
| 1005 | 1042 | |
| 1006 | 1043 | // What color are we to do it in? |
| 1007 | 1044 | $is_reverse = $showReverseChars ? mt_rand(0, 1) : false; |
| 1008 | 1045 | $char_color = function_exists('imagecolorallocatealpha') && $fontTrans ? imagecolorallocatealpha($code_image, $char_fg_color[0], $char_fg_color[1], $char_fg_color[2], 50) : imagecolorallocate($code_image, $char_fg_color[0], $char_fg_color[1], $char_fg_color[2]); |
| 1009 | 1046 | |
| 1010 | 1047 | $fontcord = @imagettftext($code_image, $font_size, $angle, $font_x, $font_y, $char_color, $fontface, $character['id']); |
| 1011 | - if (empty($fontcord)) |
|
| 1012 | - $can_do_ttf = false; |
|
| 1013 | - elseif ($is_reverse) |
|
| 1048 | + if (empty($fontcord)) { |
|
| 1049 | + $can_do_ttf = false; |
|
| 1050 | + } elseif ($is_reverse) |
|
| 1014 | 1051 | { |
| 1015 | 1052 | imagefilledpolygon($code_image, $fontcord, 4, $fg_color); |
| 1016 | 1053 | // Put the character back! |
| 1017 | 1054 | imagettftext($code_image, $font_size, $angle, $font_x, $font_y, $randomness_color, $fontface, $character['id']); |
| 1018 | 1055 | } |
| 1019 | 1056 | |
| 1020 | - if ($can_do_ttf) |
|
| 1021 | - $cur_x = max($fontcord[2], $fontcord[4]) + ($angle == 0 ? 0 : 3); |
|
| 1057 | + if ($can_do_ttf) { |
|
| 1058 | + $cur_x = max($fontcord[2], $fontcord[4]) + ($angle == 0 ? 0 : 3); |
|
| 1059 | + } |
|
| 1022 | 1060 | } |
| 1023 | 1061 | |
| 1024 | 1062 | if (!$can_do_ttf) |
@@ -1037,8 +1075,9 @@ discard block |
||
| 1037 | 1075 | } |
| 1038 | 1076 | |
| 1039 | 1077 | // Sorry, no rotation available. |
| 1040 | - else |
|
| 1041 | - imagechar($code_image, $loaded_fonts[$character['font']], $cur_x, floor(($max_height - $character['height']) / 2), $character['id'], imagecolorallocate($code_image, $char_fg_color[0], $char_fg_color[1], $char_fg_color[2])); |
|
| 1078 | + else { |
|
| 1079 | + imagechar($code_image, $loaded_fonts[$character['font']], $cur_x, floor(($max_height - $character['height']) / 2), $character['id'], imagecolorallocate($code_image, $char_fg_color[0], $char_fg_color[1], $char_fg_color[2])); |
|
| 1080 | + } |
|
| 1042 | 1081 | $cur_x += $character['width'] + $character_spacing; |
| 1043 | 1082 | } |
| 1044 | 1083 | } |
@@ -1051,17 +1090,22 @@ discard block |
||
| 1051 | 1090 | } |
| 1052 | 1091 | |
| 1053 | 1092 | // Make the background color transparent on the hard image. |
| 1054 | - if (!$simpleBGColor) |
|
| 1055 | - imagecolortransparent($code_image, $bg_color); |
|
| 1056 | - if ($hasBorder) |
|
| 1057 | - imagerectangle($code_image, 0, 0, $total_width - 1, $max_height - 1, $fg_color); |
|
| 1093 | + if (!$simpleBGColor) { |
|
| 1094 | + imagecolortransparent($code_image, $bg_color); |
|
| 1095 | + } |
|
| 1096 | + if ($hasBorder) { |
|
| 1097 | + imagerectangle($code_image, 0, 0, $total_width - 1, $max_height - 1, $fg_color); |
|
| 1098 | + } |
|
| 1058 | 1099 | |
| 1059 | 1100 | // Add some noise to the background? |
| 1060 | 1101 | if ($noiseType != 'none') |
| 1061 | 1102 | { |
| 1062 | - for ($i = mt_rand(0, 2); $i < $max_height; $i += mt_rand(1, 2)) |
|
| 1063 | - for ($j = mt_rand(0, 10); $j < $total_width; $j += mt_rand(1, 10)) |
|
| 1064 | - imagesetpixel($code_image, $j, $i, mt_rand(0, 1) ? $fg_color : $randomness_color); |
|
| 1103 | + for ($i = mt_rand(0, 2); $i < $max_height; $i += mt_rand(1, 2)) { |
|
| 1104 | + for ($j = mt_rand(0, 10); |
|
| 1105 | + } |
|
| 1106 | + $j < $total_width; $j += mt_rand(1, 10)) { |
|
| 1107 | + imagesetpixel($code_image, $j, $i, mt_rand(0, 1) ? $fg_color : $randomness_color); |
|
| 1108 | + } |
|
| 1065 | 1109 | |
| 1066 | 1110 | // Put in some lines too? |
| 1067 | 1111 | if ($noiseType != 'extreme') |
@@ -1074,8 +1118,7 @@ discard block |
||
| 1074 | 1118 | $x1 = mt_rand(0, $total_width); |
| 1075 | 1119 | $x2 = mt_rand(0, $total_width); |
| 1076 | 1120 | $y1 = 0; $y2 = $max_height; |
| 1077 | - } |
|
| 1078 | - else |
|
| 1121 | + } else |
|
| 1079 | 1122 | { |
| 1080 | 1123 | $y1 = mt_rand(0, $max_height); |
| 1081 | 1124 | $y2 = mt_rand(0, $max_height); |
@@ -1084,8 +1127,7 @@ discard block |
||
| 1084 | 1127 | imagesetthickness($code_image, mt_rand(1, 2)); |
| 1085 | 1128 | imageline($code_image, $x1, $y1, $x2, $y2, mt_rand(0, 1) ? $fg_color : $randomness_color); |
| 1086 | 1129 | } |
| 1087 | - } |
|
| 1088 | - else |
|
| 1130 | + } else |
|
| 1089 | 1131 | { |
| 1090 | 1132 | // Put in some ellipse |
| 1091 | 1133 | $num_ellipse = $noiseType == 'extreme' ? mt_rand(6, 12) : mt_rand(2, 6); |
@@ -1105,8 +1147,7 @@ discard block |
||
| 1105 | 1147 | { |
| 1106 | 1148 | header('Content-type: image/gif'); |
| 1107 | 1149 | imagegif($code_image); |
| 1108 | - } |
|
| 1109 | - else |
|
| 1150 | + } else |
|
| 1110 | 1151 | { |
| 1111 | 1152 | header('Content-type: image/png'); |
| 1112 | 1153 | imagepng($code_image); |
@@ -1129,25 +1170,29 @@ discard block |
||
| 1129 | 1170 | { |
| 1130 | 1171 | global $settings; |
| 1131 | 1172 | |
| 1132 | - if (!is_dir($settings['default_theme_dir'] . '/fonts')) |
|
| 1133 | - return false; |
|
| 1173 | + if (!is_dir($settings['default_theme_dir'] . '/fonts')) { |
|
| 1174 | + return false; |
|
| 1175 | + } |
|
| 1134 | 1176 | |
| 1135 | 1177 | // Get a list of the available font directories. |
| 1136 | 1178 | $font_dir = dir($settings['default_theme_dir'] . '/fonts'); |
| 1137 | 1179 | $font_list = array(); |
| 1138 | - while ($entry = $font_dir->read()) |
|
| 1139 | - if ($entry[0] !== '.' && is_dir($settings['default_theme_dir'] . '/fonts/' . $entry) && file_exists($settings['default_theme_dir'] . '/fonts/' . $entry . '.gdf')) |
|
| 1180 | + while ($entry = $font_dir->read()) { |
|
| 1181 | + if ($entry[0] !== '.' && is_dir($settings['default_theme_dir'] . '/fonts/' . $entry) && file_exists($settings['default_theme_dir'] . '/fonts/' . $entry . '.gdf')) |
|
| 1140 | 1182 | $font_list[] = $entry; |
| 1183 | + } |
|
| 1141 | 1184 | |
| 1142 | - if (empty($font_list)) |
|
| 1143 | - return false; |
|
| 1185 | + if (empty($font_list)) { |
|
| 1186 | + return false; |
|
| 1187 | + } |
|
| 1144 | 1188 | |
| 1145 | 1189 | // Pick a random font. |
| 1146 | 1190 | $random_font = $font_list[array_rand($font_list)]; |
| 1147 | 1191 | |
| 1148 | 1192 | // Check if the given letter exists. |
| 1149 | - if (!file_exists($settings['default_theme_dir'] . '/fonts/' . $random_font . '/' . $letter . '.png')) |
|
| 1150 | - return false; |
|
| 1193 | + if (!file_exists($settings['default_theme_dir'] . '/fonts/' . $random_font . '/' . $letter . '.png')) { |
|
| 1194 | + return false; |
|
| 1195 | + } |
|
| 1151 | 1196 | |
| 1152 | 1197 | // Include it! |
| 1153 | 1198 | header('Content-type: image/png'); |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | * @version 2.1 Beta 3 |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | -if (!defined('SMF')) |
|
| 17 | +if (!defined('SMF')) { |
|
| 18 | 18 | die('No direct access...'); |
| 19 | +} |
|
| 19 | 20 | |
| 20 | 21 | /** |
| 21 | 22 | * Entrance point for the registration center, it checks permissions and forwards |
@@ -31,8 +32,9 @@ discard block |
||
| 31 | 32 | global $context, $txt; |
| 32 | 33 | |
| 33 | 34 | // Old templates might still request this. |
| 34 | - if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'browse') |
|
| 35 | - redirectexit('action=admin;area=viewmembers;sa=browse' . (isset($_REQUEST['type']) ? ';type=' . $_REQUEST['type'] : '')); |
|
| 35 | + if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'browse') { |
|
| 36 | + redirectexit('action=admin;area=viewmembers;sa=browse' . (isset($_REQUEST['type']) ? ';type=' . $_REQUEST['type'] : '')); |
|
| 37 | + } |
|
| 36 | 38 | |
| 37 | 39 | $subActions = array( |
| 38 | 40 | 'register' => array('AdminRegister', 'moderate_forum'), |
@@ -99,9 +101,10 @@ discard block |
||
| 99 | 101 | checkSession(); |
| 100 | 102 | validateToken('admin-regc'); |
| 101 | 103 | |
| 102 | - foreach ($_POST as $key => $value) |
|
| 103 | - if (!is_array($_POST[$key])) |
|
| 104 | + foreach ($_POST as $key => $value) { |
|
| 105 | + if (!is_array($_POST[$key])) |
|
| 104 | 106 | $_POST[$key] = htmltrim__recursive(str_replace(array("\n", "\r"), '', $_POST[$key])); |
| 107 | + } |
|
| 105 | 108 | |
| 106 | 109 | $regOptions = array( |
| 107 | 110 | 'interface' => 'admin', |
@@ -161,12 +164,13 @@ discard block |
||
| 161 | 164 | ) |
| 162 | 165 | ); |
| 163 | 166 | $context['member_groups'] = array(0 => $txt['admin_register_group_none']); |
| 164 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 165 | - $context['member_groups'][$row['id_group']] = $row['group_name']; |
|
| 167 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 168 | + $context['member_groups'][$row['id_group']] = $row['group_name']; |
|
| 169 | + } |
|
| 166 | 170 | $smcFunc['db_free_result']($request); |
| 171 | + } else { |
|
| 172 | + $context['member_groups'] = array(); |
|
| 167 | 173 | } |
| 168 | - else |
|
| 169 | - $context['member_groups'] = array(); |
|
| 170 | 174 | |
| 171 | 175 | // Basic stuff. |
| 172 | 176 | $context['sub_template'] = 'admin_register'; |
@@ -207,8 +211,9 @@ discard block |
||
| 207 | 211 | { |
| 208 | 212 | $context['editable_agreements']['.' . $lang['filename']] = $lang['name']; |
| 209 | 213 | // Are we editing this? |
| 210 | - if (isset($_POST['agree_lang']) && $_POST['agree_lang'] == '.' . $lang['filename']) |
|
| 211 | - $context['current_agreement'] = '.' . $lang['filename']; |
|
| 214 | + if (isset($_POST['agree_lang']) && $_POST['agree_lang'] == '.' . $lang['filename']) { |
|
| 215 | + $context['current_agreement'] = '.' . $lang['filename']; |
|
| 216 | + } |
|
| 212 | 217 | } |
| 213 | 218 | } |
| 214 | 219 | |
@@ -223,10 +228,11 @@ discard block |
||
| 223 | 228 | |
| 224 | 229 | updateSettings(array('requireAgreement' => !empty($_POST['requireAgreement']))); |
| 225 | 230 | |
| 226 | - if ($bytes == strlen($to_write)) |
|
| 227 | - $context['saved_successful'] = true; |
|
| 228 | - else |
|
| 229 | - $context['could_not_save'] = true; |
|
| 231 | + if ($bytes == strlen($to_write)) { |
|
| 232 | + $context['saved_successful'] = true; |
|
| 233 | + } else { |
|
| 234 | + $context['could_not_save'] = true; |
|
| 235 | + } |
|
| 230 | 236 | } |
| 231 | 237 | |
| 232 | 238 | $context['agreement'] = file_exists($boarddir . '/agreement' . $context['current_agreement'] . '.txt') ? $smcFunc['htmlspecialchars'](file_get_contents($boarddir . '/agreement' . $context['current_agreement'] . '.txt')) : ''; |
@@ -310,8 +316,9 @@ discard block |
||
| 310 | 316 | |
| 311 | 317 | call_integration_hook('integrate_modify_registration_settings', array(&$config_vars)); |
| 312 | 318 | |
| 313 | - if ($return_config) |
|
| 314 | - return $config_vars; |
|
| 319 | + if ($return_config) { |
|
| 320 | + return $config_vars; |
|
| 321 | + } |
|
| 315 | 322 | |
| 316 | 323 | // Setup the template |
| 317 | 324 | $context['sub_template'] = 'show_settings'; |
@@ -322,8 +329,9 @@ discard block |
||
| 322 | 329 | checkSession(); |
| 323 | 330 | |
| 324 | 331 | // Are there some contacts missing? |
| 325 | - if (!empty($_POST['coppaAge']) && !empty($_POST['coppaType']) && empty($_POST['coppaPost']) && empty($_POST['coppaFax'])) |
|
| 326 | - fatal_lang_error('admin_setting_coppa_require_contact'); |
|
| 332 | + if (!empty($_POST['coppaAge']) && !empty($_POST['coppaType']) && empty($_POST['coppaPost']) && empty($_POST['coppaFax'])) { |
|
| 333 | + fatal_lang_error('admin_setting_coppa_require_contact'); |
|
| 334 | + } |
|
| 327 | 335 | |
| 328 | 336 | // Post needs to take into account line breaks. |
| 329 | 337 | $_POST['coppaPost'] = str_replace("\n", '<br>', empty($_POST['coppaPost']) ? '' : $_POST['coppaPost']); |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 3 |
| 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 dispatcher; doesn't do anything, just delegates. |
@@ -92,18 +93,19 @@ discard block |
||
| 92 | 93 | checkSession('get'); |
| 93 | 94 | validateToken('admin-bm-' . (int) $_REQUEST['src_board'], 'request'); |
| 94 | 95 | |
| 95 | - if ($_REQUEST['move_to'] === 'top') |
|
| 96 | - $boardOptions = array( |
|
| 96 | + if ($_REQUEST['move_to'] === 'top') { |
|
| 97 | + $boardOptions = array( |
|
| 97 | 98 | 'move_to' => $_REQUEST['move_to'], |
| 98 | 99 | 'target_category' => (int) $_REQUEST['target_cat'], |
| 99 | 100 | 'move_first_child' => true, |
| 100 | 101 | ); |
| 101 | - else |
|
| 102 | - $boardOptions = array( |
|
| 102 | + } else { |
|
| 103 | + $boardOptions = array( |
|
| 103 | 104 | 'move_to' => $_REQUEST['move_to'], |
| 104 | 105 | 'target_board' => (int) $_REQUEST['target_board'], |
| 105 | 106 | 'move_first_child' => true, |
| 106 | 107 | ); |
| 108 | + } |
|
| 107 | 109 | modifyBoard((int) $_REQUEST['src_board'], $boardOptions); |
| 108 | 110 | } |
| 109 | 111 | |
@@ -148,15 +150,16 @@ discard block |
||
| 148 | 150 | $security = $context['session_var'] . '=' . $context['session_id'] . ';' . $context['admin-bm-' . $context['move_board'] . '_token_var'] . '=' . $context['admin-bm-' . $context['move_board'] . '_token']; |
| 149 | 151 | foreach ($boardList[$catid] as $boardid) |
| 150 | 152 | { |
| 151 | - if (!isset($context['categories'][$catid]['move_link'])) |
|
| 152 | - $context['categories'][$catid]['move_link'] = array( |
|
| 153 | + if (!isset($context['categories'][$catid]['move_link'])) { |
|
| 154 | + $context['categories'][$catid]['move_link'] = array( |
|
| 153 | 155 | 'child_level' => 0, |
| 154 | 156 | 'label' => $txt['mboards_order_before'] . ' \'' . $smcFunc['htmlspecialchars']($boards[$boardid]['name']) . '\'', |
| 155 | 157 | 'href' => $scripturl . '?action=admin;area=manageboards;sa=move;src_board=' . $context['move_board'] . ';target_board=' . $boardid . ';move_to=before;' . $security, |
| 156 | 158 | ); |
| 159 | + } |
|
| 157 | 160 | |
| 158 | - if (!$context['categories'][$catid]['boards'][$boardid]['move']) |
|
| 159 | - $context['categories'][$catid]['boards'][$boardid]['move_links'] = array( |
|
| 161 | + if (!$context['categories'][$catid]['boards'][$boardid]['move']) { |
|
| 162 | + $context['categories'][$catid]['boards'][$boardid]['move_links'] = array( |
|
| 160 | 163 | array( |
| 161 | 164 | 'child_level' => $boards[$boardid]['level'], |
| 162 | 165 | 'label' => $txt['mboards_order_after'] . '\'' . $smcFunc['htmlspecialchars']($boards[$boardid]['name']) . '\'', |
@@ -170,34 +173,39 @@ discard block |
||
| 170 | 173 | 'class' => 'here', |
| 171 | 174 | ), |
| 172 | 175 | ); |
| 176 | + } |
|
| 173 | 177 | |
| 174 | 178 | $difference = $boards[$boardid]['level'] - $prev_child_level; |
| 175 | - if ($difference == 1) |
|
| 176 | - array_push($stack, !empty($context['categories'][$catid]['boards'][$prev_board]['move_links']) ? array_shift($context['categories'][$catid]['boards'][$prev_board]['move_links']) : null); |
|
| 177 | - elseif ($difference < 0) |
|
| 179 | + if ($difference == 1) { |
|
| 180 | + array_push($stack, !empty($context['categories'][$catid]['boards'][$prev_board]['move_links']) ? array_shift($context['categories'][$catid]['boards'][$prev_board]['move_links']) : null); |
|
| 181 | + } elseif ($difference < 0) |
|
| 178 | 182 | { |
| 179 | - if (empty($context['categories'][$catid]['boards'][$prev_board]['move_links'])) |
|
| 180 | - $context['categories'][$catid]['boards'][$prev_board]['move_links'] = array(); |
|
| 181 | - for ($i = 0; $i < -$difference; $i++) |
|
| 182 | - if (($temp = array_pop($stack)) != null) |
|
| 183 | + if (empty($context['categories'][$catid]['boards'][$prev_board]['move_links'])) { |
|
| 184 | + $context['categories'][$catid]['boards'][$prev_board]['move_links'] = array(); |
|
| 185 | + } |
|
| 186 | + for ($i = 0; $i < -$difference; $i++) { |
|
| 187 | + if (($temp = array_pop($stack)) != null) |
|
| 183 | 188 | array_unshift($context['categories'][$catid]['boards'][$prev_board]['move_links'], $temp); |
| 189 | + } |
|
| 184 | 190 | } |
| 185 | 191 | |
| 186 | 192 | $prev_board = $boardid; |
| 187 | 193 | $prev_child_level = $boards[$boardid]['level']; |
| 188 | 194 | |
| 189 | 195 | } |
| 190 | - if (!empty($stack) && !empty($context['categories'][$catid]['boards'][$prev_board]['move_links'])) |
|
| 191 | - $context['categories'][$catid]['boards'][$prev_board]['move_links'] = array_merge($stack, $context['categories'][$catid]['boards'][$prev_board]['move_links']); |
|
| 192 | - elseif (!empty($stack)) |
|
| 193 | - $context['categories'][$catid]['boards'][$prev_board]['move_links'] = $stack; |
|
| 196 | + if (!empty($stack) && !empty($context['categories'][$catid]['boards'][$prev_board]['move_links'])) { |
|
| 197 | + $context['categories'][$catid]['boards'][$prev_board]['move_links'] = array_merge($stack, $context['categories'][$catid]['boards'][$prev_board]['move_links']); |
|
| 198 | + } elseif (!empty($stack)) { |
|
| 199 | + $context['categories'][$catid]['boards'][$prev_board]['move_links'] = $stack; |
|
| 200 | + } |
|
| 194 | 201 | |
| 195 | - if (empty($boardList[$catid])) |
|
| 196 | - $context['categories'][$catid]['move_link'] = array( |
|
| 202 | + if (empty($boardList[$catid])) { |
|
| 203 | + $context['categories'][$catid]['move_link'] = array( |
|
| 197 | 204 | 'child_level' => 0, |
| 198 | 205 | 'label' => $txt['mboards_order_before'] . ' \'' . $smcFunc['htmlspecialchars']($tree['node']['name']) . '\'', |
| 199 | 206 | 'href' => $scripturl . '?action=admin;area=manageboards;sa=move;src_board=' . $context['move_board'] . ';target_cat=' . $catid . ';move_to=top;' . $security, |
| 200 | 207 | ); |
| 208 | + } |
|
| 201 | 209 | } |
| 202 | 210 | } |
| 203 | 211 | |
@@ -253,9 +261,9 @@ discard block |
||
| 253 | 261 | ); |
| 254 | 262 | } |
| 255 | 263 | // Category doesn't exist, man... sorry. |
| 256 | - elseif (!isset($cat_tree[$_REQUEST['cat']])) |
|
| 257 | - redirectexit('action=admin;area=manageboards'); |
|
| 258 | - else |
|
| 264 | + elseif (!isset($cat_tree[$_REQUEST['cat']])) { |
|
| 265 | + redirectexit('action=admin;area=manageboards'); |
|
| 266 | + } else |
|
| 259 | 267 | { |
| 260 | 268 | $context['category'] = array( |
| 261 | 269 | 'id' => $_REQUEST['cat'], |
@@ -267,30 +275,31 @@ discard block |
||
| 267 | 275 | 'is_empty' => empty($cat_tree[$_REQUEST['cat']]['children']) |
| 268 | 276 | ); |
| 269 | 277 | |
| 270 | - foreach ($boardList[$_REQUEST['cat']] as $child_board) |
|
| 271 | - $context['category']['children'][] = str_repeat('-', $boards[$child_board]['level']) . ' ' . $boards[$child_board]['name']; |
|
| 278 | + foreach ($boardList[$_REQUEST['cat']] as $child_board) { |
|
| 279 | + $context['category']['children'][] = str_repeat('-', $boards[$child_board]['level']) . ' ' . $boards[$child_board]['name']; |
|
| 280 | + } |
|
| 272 | 281 | } |
| 273 | 282 | |
| 274 | 283 | $prevCat = 0; |
| 275 | 284 | foreach ($cat_tree as $catid => $tree) |
| 276 | 285 | { |
| 277 | - if ($catid == $_REQUEST['cat'] && $prevCat > 0) |
|
| 278 | - $context['category_order'][$prevCat]['selected'] = true; |
|
| 279 | - elseif ($catid != $_REQUEST['cat']) |
|
| 280 | - $context['category_order'][$catid] = array( |
|
| 286 | + if ($catid == $_REQUEST['cat'] && $prevCat > 0) { |
|
| 287 | + $context['category_order'][$prevCat]['selected'] = true; |
|
| 288 | + } elseif ($catid != $_REQUEST['cat']) { |
|
| 289 | + $context['category_order'][$catid] = array( |
|
| 281 | 290 | 'id' => $catid, |
| 282 | 291 | 'name' => $txt['mboards_order_after'] . $tree['node']['name'], |
| 283 | 292 | 'selected' => false, |
| 284 | 293 | 'true_name' => $tree['node']['name'] |
| 285 | 294 | ); |
| 295 | + } |
|
| 286 | 296 | $prevCat = $catid; |
| 287 | 297 | } |
| 288 | 298 | if (!isset($_REQUEST['delete'])) |
| 289 | 299 | { |
| 290 | 300 | $context['sub_template'] = 'modify_category'; |
| 291 | 301 | $context['page_title'] = $_REQUEST['sa'] == 'newcat' ? $txt['mboards_new_cat_name'] : $txt['catEdit']; |
| 292 | - } |
|
| 293 | - else |
|
| 302 | + } else |
|
| 294 | 303 | { |
| 295 | 304 | $context['sub_template'] = 'confirm_category_delete'; |
| 296 | 305 | $context['page_title'] = $txt['mboards_delete_cat']; |
@@ -327,8 +336,9 @@ discard block |
||
| 327 | 336 | { |
| 328 | 337 | $catOptions = array(); |
| 329 | 338 | |
| 330 | - if (isset($_POST['cat_order'])) |
|
| 331 | - $catOptions['move_after'] = (int) $_POST['cat_order']; |
|
| 339 | + if (isset($_POST['cat_order'])) { |
|
| 340 | + $catOptions['move_after'] = (int) $_POST['cat_order']; |
|
| 341 | + } |
|
| 332 | 342 | |
| 333 | 343 | // Change "This & That" to "This & That" but don't change "¢" to "&cent;"... |
| 334 | 344 | $catOptions['cat_name'] = parse_bbc($smcFunc['htmlspecialchars']($_POST['cat_name']), false, '', $context['description_allowed_tags']); |
@@ -336,10 +346,11 @@ discard block |
||
| 336 | 346 | |
| 337 | 347 | $catOptions['is_collapsible'] = isset($_POST['collapse']); |
| 338 | 348 | |
| 339 | - if (isset($_POST['add'])) |
|
| 340 | - createCategory($catOptions); |
|
| 341 | - else |
|
| 342 | - modifyCategory($_POST['cat'], $catOptions); |
|
| 349 | + if (isset($_POST['add'])) { |
|
| 350 | + createCategory($catOptions); |
|
| 351 | + } else { |
|
| 352 | + modifyCategory($_POST['cat'], $catOptions); |
|
| 353 | + } |
|
| 343 | 354 | } |
| 344 | 355 | // If they want to delete - first give them confirmation. |
| 345 | 356 | elseif (isset($_POST['delete']) && !isset($_POST['confirmation']) && !isset($_POST['empty'])) |
@@ -353,13 +364,14 @@ discard block |
||
| 353 | 364 | // First off - check if we are moving all the current boards first - before we start deleting! |
| 354 | 365 | if (isset($_POST['delete_action']) && $_POST['delete_action'] == 1) |
| 355 | 366 | { |
| 356 | - if (empty($_POST['cat_to'])) |
|
| 357 | - fatal_lang_error('mboards_delete_error'); |
|
| 367 | + if (empty($_POST['cat_to'])) { |
|
| 368 | + fatal_lang_error('mboards_delete_error'); |
|
| 369 | + } |
|
| 358 | 370 | |
| 359 | 371 | deleteCategories(array($_POST['cat']), (int) $_POST['cat_to']); |
| 372 | + } else { |
|
| 373 | + deleteCategories(array($_POST['cat'])); |
|
| 360 | 374 | } |
| 361 | - else |
|
| 362 | - deleteCategories(array($_POST['cat'])); |
|
| 363 | 375 | } |
| 364 | 376 | |
| 365 | 377 | redirectexit('action=admin;area=manageboards'); |
@@ -404,8 +416,9 @@ discard block |
||
| 404 | 416 | if ($_REQUEST['sa'] == 'newboard') |
| 405 | 417 | { |
| 406 | 418 | // Category doesn't exist, man... sorry. |
| 407 | - if (empty($_REQUEST['cat'])) |
|
| 408 | - redirectexit('action=admin;area=manageboards'); |
|
| 419 | + if (empty($_REQUEST['cat'])) { |
|
| 420 | + redirectexit('action=admin;area=manageboards'); |
|
| 421 | + } |
|
| 409 | 422 | |
| 410 | 423 | // Some things that need to be setup for a new board. |
| 411 | 424 | $curBoard = array( |
@@ -429,8 +442,7 @@ discard block |
||
| 429 | 442 | 'category' => (int) $_REQUEST['cat'], |
| 430 | 443 | 'no_children' => true, |
| 431 | 444 | ); |
| 432 | - } |
|
| 433 | - else |
|
| 445 | + } else |
|
| 434 | 446 | { |
| 435 | 447 | // Just some easy shortcuts. |
| 436 | 448 | $curBoard = &$boards[$_REQUEST['boardid']]; |
@@ -478,8 +490,9 @@ discard block |
||
| 478 | 490 | ); |
| 479 | 491 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 480 | 492 | { |
| 481 | - if ($_REQUEST['sa'] == 'newboard' && $row['min_posts'] == -1) |
|
| 482 | - $curBoard['member_groups'][] = $row['id_group']; |
|
| 493 | + if ($_REQUEST['sa'] == 'newboard' && $row['min_posts'] == -1) { |
|
| 494 | + $curBoard['member_groups'][] = $row['id_group']; |
|
| 495 | + } |
|
| 483 | 496 | |
| 484 | 497 | $context['groups'][(int) $row['id_group']] = array( |
| 485 | 498 | 'id' => $row['id_group'], |
@@ -492,8 +505,9 @@ discard block |
||
| 492 | 505 | $smcFunc['db_free_result']($request); |
| 493 | 506 | |
| 494 | 507 | // Category doesn't exist, man... sorry. |
| 495 | - if (!isset($boardList[$curBoard['category']])) |
|
| 496 | - redirectexit('action=admin;area=manageboards'); |
|
| 508 | + if (!isset($boardList[$curBoard['category']])) { |
|
| 509 | + redirectexit('action=admin;area=manageboards'); |
|
| 510 | + } |
|
| 497 | 511 | |
| 498 | 512 | foreach ($boardList[$curBoard['category']] as $boardid) |
| 499 | 513 | { |
@@ -507,8 +521,7 @@ discard block |
||
| 507 | 521 | 'is_child' => false, |
| 508 | 522 | 'selected' => true |
| 509 | 523 | ); |
| 510 | - } |
|
| 511 | - else |
|
| 524 | + } else |
|
| 512 | 525 | { |
| 513 | 526 | $context['board_order'][] = array( |
| 514 | 527 | 'id' => $boardid, |
@@ -525,19 +538,21 @@ discard block |
||
| 525 | 538 | $context['can_move_children'] = false; |
| 526 | 539 | $context['children'] = $boards[$_REQUEST['boardid']]['tree']['children']; |
| 527 | 540 | |
| 528 | - foreach ($context['board_order'] as $lBoard) |
|
| 529 | - if ($lBoard['is_child'] == false && $lBoard['selected'] == false) |
|
| 541 | + foreach ($context['board_order'] as $lBoard) { |
|
| 542 | + if ($lBoard['is_child'] == false && $lBoard['selected'] == false) |
|
| 530 | 543 | $context['can_move_children'] = true; |
| 544 | + } |
|
| 531 | 545 | } |
| 532 | 546 | |
| 533 | 547 | // Get other available categories. |
| 534 | 548 | $context['categories'] = array(); |
| 535 | - foreach ($cat_tree as $catID => $tree) |
|
| 536 | - $context['categories'][] = array( |
|
| 549 | + foreach ($cat_tree as $catID => $tree) { |
|
| 550 | + $context['categories'][] = array( |
|
| 537 | 551 | 'id' => $catID == $curBoard['category'] ? 0 : $catID, |
| 538 | 552 | 'name' => $tree['node']['name'], |
| 539 | 553 | 'selected' => $catID == $curBoard['category'] |
| 540 | 554 | ); |
| 555 | + } |
|
| 541 | 556 | |
| 542 | 557 | $request = $smcFunc['db_query']('', ' |
| 543 | 558 | SELECT mem.id_member, mem.real_name |
@@ -549,14 +564,16 @@ discard block |
||
| 549 | 564 | ) |
| 550 | 565 | ); |
| 551 | 566 | $context['board']['moderators'] = array(); |
| 552 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 553 | - $context['board']['moderators'][$row['id_member']] = $row['real_name']; |
|
| 567 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 568 | + $context['board']['moderators'][$row['id_member']] = $row['real_name']; |
|
| 569 | + } |
|
| 554 | 570 | $smcFunc['db_free_result']($request); |
| 555 | 571 | |
| 556 | 572 | $context['board']['moderator_list'] = empty($context['board']['moderators']) ? '' : '"' . implode('", "', $context['board']['moderators']) . '"'; |
| 557 | 573 | |
| 558 | - if (!empty($context['board']['moderators'])) |
|
| 559 | - list ($context['board']['last_moderator_id']) = array_slice(array_keys($context['board']['moderators']), -1); |
|
| 574 | + if (!empty($context['board']['moderators'])) { |
|
| 575 | + list ($context['board']['last_moderator_id']) = array_slice(array_keys($context['board']['moderators']), -1); |
|
| 576 | + } |
|
| 560 | 577 | |
| 561 | 578 | // Get all the groups assigned as moderators |
| 562 | 579 | $request = $smcFunc['db_query']('', ' |
@@ -568,14 +585,16 @@ discard block |
||
| 568 | 585 | ) |
| 569 | 586 | ); |
| 570 | 587 | $context['board']['moderator_groups'] = array(); |
| 571 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 572 | - $context['board']['moderator_groups'][$row['id_group']] = $context['groups'][$row['id_group']]['name']; |
|
| 588 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 589 | + $context['board']['moderator_groups'][$row['id_group']] = $context['groups'][$row['id_group']]['name']; |
|
| 590 | + } |
|
| 573 | 591 | $smcFunc['db_free_result']($request); |
| 574 | 592 | |
| 575 | 593 | $context['board']['moderator_groups_list'] = empty($context['board']['moderator_groups']) ? '' : '"' . implode('", &qout;', $context['board']['moderator_groups']) . '"'; |
| 576 | 594 | |
| 577 | - if (!empty($context['board']['moderator_groups'])) |
|
| 578 | - list ($context['board']['last_moderator_group_id']) = array_slice(array_keys($context['board']['moderator_groups']), -1); |
|
| 595 | + if (!empty($context['board']['moderator_groups'])) { |
|
| 596 | + list ($context['board']['last_moderator_group_id']) = array_slice(array_keys($context['board']['moderator_groups']), -1); |
|
| 597 | + } |
|
| 579 | 598 | |
| 580 | 599 | // Get all the themes... |
| 581 | 600 | $request = $smcFunc['db_query']('', ' |
@@ -587,8 +606,9 @@ discard block |
||
| 587 | 606 | ) |
| 588 | 607 | ); |
| 589 | 608 | $context['themes'] = array(); |
| 590 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 591 | - $context['themes'][] = $row; |
|
| 609 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 610 | + $context['themes'][] = $row; |
|
| 611 | + } |
|
| 592 | 612 | $smcFunc['db_free_result']($request); |
| 593 | 613 | |
| 594 | 614 | if (!isset($_REQUEST['delete'])) |
@@ -596,8 +616,7 @@ discard block |
||
| 596 | 616 | $context['sub_template'] = 'modify_board'; |
| 597 | 617 | $context['page_title'] = $txt['boardsEdit']; |
| 598 | 618 | loadJavaScriptFile('suggest.js', array('defer' => false), 'smf_suggest'); |
| 599 | - } |
|
| 600 | - else |
|
| 619 | + } else |
|
| 601 | 620 | { |
| 602 | 621 | $context['sub_template'] = 'confirm_board_delete'; |
| 603 | 622 | $context['page_title'] = $txt['mboards_delete_board']; |
@@ -641,8 +660,9 @@ discard block |
||
| 641 | 660 | // Change the boardorder of this board? |
| 642 | 661 | elseif (!empty($_POST['placement']) && !empty($_POST['board_order'])) |
| 643 | 662 | { |
| 644 | - if (!in_array($_POST['placement'], array('before', 'after', 'child'))) |
|
| 645 | - fatal_lang_error('mangled_post', false); |
|
| 663 | + if (!in_array($_POST['placement'], array('before', 'after', 'child'))) { |
|
| 664 | + fatal_lang_error('mangled_post', false); |
|
| 665 | + } |
|
| 646 | 666 | |
| 647 | 667 | $boardOptions['move_to'] = $_POST['placement']; |
| 648 | 668 | $boardOptions['target_board'] = (int) $_POST['board_order']; |
@@ -655,13 +675,14 @@ discard block |
||
| 655 | 675 | $boardOptions['access_groups'] = array(); |
| 656 | 676 | $boardOptions['deny_groups'] = array(); |
| 657 | 677 | |
| 658 | - if (!empty($_POST['groups'])) |
|
| 659 | - foreach ($_POST['groups'] as $group => $action) |
|
| 678 | + if (!empty($_POST['groups'])) { |
|
| 679 | + foreach ($_POST['groups'] as $group => $action) |
|
| 660 | 680 | { |
| 661 | 681 | if ($action == 'allow') |
| 662 | 682 | $boardOptions['access_groups'][] = (int) $group; |
| 663 | - elseif ($action == 'deny') |
|
| 664 | - $boardOptions['deny_groups'][] = (int) $group; |
|
| 683 | + } elseif ($action == 'deny') { |
|
| 684 | + $boardOptions['deny_groups'][] = (int) $group; |
|
| 685 | + } |
|
| 665 | 686 | } |
| 666 | 687 | |
| 667 | 688 | // People with manage-boards are special. |
@@ -673,8 +694,9 @@ discard block |
||
| 673 | 694 | // Secondly, make sure those with super cow powers (like apt-get, or in this case manage boards) are upgraded. |
| 674 | 695 | $boardOptions['access_groups'] = array_unique(array_merge($boardOptions['access_groups'], $board_managers)); |
| 675 | 696 | |
| 676 | - if (strlen(implode(',', $boardOptions['access_groups'])) > 255 || strlen(implode(',', $boardOptions['deny_groups'])) > 255) |
|
| 677 | - fatal_lang_error('too_many_groups', false); |
|
| 697 | + if (strlen(implode(',', $boardOptions['access_groups'])) > 255 || strlen(implode(',', $boardOptions['deny_groups'])) > 255) { |
|
| 698 | + fatal_lang_error('too_many_groups', false); |
|
| 699 | + } |
|
| 678 | 700 | |
| 679 | 701 | // Do not allow HTML tags. Parse the string. |
| 680 | 702 | $boardOptions['board_name'] = parse_bbc($smcFunc['htmlspecialchars']($_POST['board_name']), false, '', $context['description_allowed_tags']); |
@@ -685,8 +707,9 @@ discard block |
||
| 685 | 707 | if (isset($_POST['moderator_list']) && is_array($_POST['moderator_list'])) |
| 686 | 708 | { |
| 687 | 709 | $moderators = array(); |
| 688 | - foreach ($_POST['moderator_list'] as $moderator) |
|
| 689 | - $moderators[(int) $moderator] = (int) $moderator; |
|
| 710 | + foreach ($_POST['moderator_list'] as $moderator) { |
|
| 711 | + $moderators[(int) $moderator] = (int) $moderator; |
|
| 712 | + } |
|
| 690 | 713 | $boardOptions['moderators'] = $moderators; |
| 691 | 714 | } |
| 692 | 715 | |
@@ -695,8 +718,9 @@ discard block |
||
| 695 | 718 | if (isset($_POST['moderator_group_list']) && is_array($_POST['moderator_group_list'])) |
| 696 | 719 | { |
| 697 | 720 | $moderator_groups = array(); |
| 698 | - foreach ($_POST['moderator_group_list'] as $moderator_group) |
|
| 699 | - $moderator_groups[(int) $moderator_group] = (int) $moderator_group; |
|
| 721 | + foreach ($_POST['moderator_group_list'] as $moderator_group) { |
|
| 722 | + $moderator_groups[(int) $moderator_group] = (int) $moderator_group; |
|
| 723 | + } |
|
| 700 | 724 | $boardOptions['moderator_groups'] = $moderator_groups; |
| 701 | 725 | } |
| 702 | 726 | |
@@ -722,56 +746,62 @@ discard block |
||
| 722 | 746 | $smcFunc['db_free_result']($request); |
| 723 | 747 | |
| 724 | 748 | // If we're turning redirection on check the board doesn't have posts in it - if it does don't make it a redirection board. |
| 725 | - if ($boardOptions['redirect'] && empty($oldRedirect) && $numPosts) |
|
| 726 | - unset($boardOptions['redirect']); |
|
| 749 | + if ($boardOptions['redirect'] && empty($oldRedirect) && $numPosts) { |
|
| 750 | + unset($boardOptions['redirect']); |
|
| 751 | + } |
|
| 727 | 752 | // Reset the redirection count when switching on/off. |
| 728 | - elseif (empty($boardOptions['redirect']) != empty($oldRedirect)) |
|
| 729 | - $boardOptions['num_posts'] = 0; |
|
| 753 | + elseif (empty($boardOptions['redirect']) != empty($oldRedirect)) { |
|
| 754 | + $boardOptions['num_posts'] = 0; |
|
| 755 | + } |
|
| 730 | 756 | // Resetting the count? |
| 731 | - elseif ($boardOptions['redirect'] && !empty($_POST['reset_redirect'])) |
|
| 732 | - $boardOptions['num_posts'] = 0; |
|
| 757 | + elseif ($boardOptions['redirect'] && !empty($_POST['reset_redirect'])) { |
|
| 758 | + $boardOptions['num_posts'] = 0; |
|
| 759 | + } |
|
| 733 | 760 | } |
| 734 | 761 | |
| 735 | 762 | // Create a new board... |
| 736 | 763 | if (isset($_POST['add'])) |
| 737 | 764 | { |
| 738 | 765 | // New boards by default go to the bottom of the category. |
| 739 | - if (empty($_POST['new_cat'])) |
|
| 740 | - $boardOptions['target_category'] = (int) $_POST['cur_cat']; |
|
| 741 | - if (!isset($boardOptions['move_to'])) |
|
| 742 | - $boardOptions['move_to'] = 'bottom'; |
|
| 766 | + if (empty($_POST['new_cat'])) { |
|
| 767 | + $boardOptions['target_category'] = (int) $_POST['cur_cat']; |
|
| 768 | + } |
|
| 769 | + if (!isset($boardOptions['move_to'])) { |
|
| 770 | + $boardOptions['move_to'] = 'bottom'; |
|
| 771 | + } |
|
| 743 | 772 | |
| 744 | 773 | createBoard($boardOptions); |
| 745 | 774 | } |
| 746 | 775 | |
| 747 | 776 | // ...or update an existing board. |
| 748 | - else |
|
| 749 | - modifyBoard($_POST['boardid'], $boardOptions); |
|
| 750 | - } |
|
| 751 | - elseif (isset($_POST['delete']) && !isset($_POST['confirmation']) && !isset($_POST['no_children'])) |
|
| 777 | + else { |
|
| 778 | + modifyBoard($_POST['boardid'], $boardOptions); |
|
| 779 | + } |
|
| 780 | + } elseif (isset($_POST['delete']) && !isset($_POST['confirmation']) && !isset($_POST['no_children'])) |
|
| 752 | 781 | { |
| 753 | 782 | EditBoard(); |
| 754 | 783 | return; |
| 755 | - } |
|
| 756 | - elseif (isset($_POST['delete'])) |
|
| 784 | + } elseif (isset($_POST['delete'])) |
|
| 757 | 785 | { |
| 758 | 786 | // First off - check if we are moving all the current child boards first - before we start deleting! |
| 759 | 787 | if (isset($_POST['delete_action']) && $_POST['delete_action'] == 1) |
| 760 | 788 | { |
| 761 | - if (empty($_POST['board_to'])) |
|
| 762 | - fatal_lang_error('mboards_delete_board_error'); |
|
| 789 | + if (empty($_POST['board_to'])) { |
|
| 790 | + fatal_lang_error('mboards_delete_board_error'); |
|
| 791 | + } |
|
| 763 | 792 | |
| 764 | 793 | deleteBoards(array($_POST['boardid']), (int) $_POST['board_to']); |
| 794 | + } else { |
|
| 795 | + deleteBoards(array($_POST['boardid']), 0); |
|
| 765 | 796 | } |
| 766 | - else |
|
| 767 | - deleteBoards(array($_POST['boardid']), 0); |
|
| 768 | 797 | } |
| 769 | 798 | |
| 770 | - if (isset($_REQUEST['rid']) && $_REQUEST['rid'] == 'permissions') |
|
| 771 | - redirectexit('action=admin;area=permissions;sa=board;' . $context['session_var'] . '=' . $context['session_id']); |
|
| 772 | - else |
|
| 773 | - redirectexit('action=admin;area=manageboards'); |
|
| 774 | -} |
|
| 799 | + if (isset($_REQUEST['rid']) && $_REQUEST['rid'] == 'permissions') { |
|
| 800 | + redirectexit('action=admin;area=permissions;sa=board;' . $context['session_var'] . '=' . $context['session_id']); |
|
| 801 | + } else { |
|
| 802 | + redirectexit('action=admin;area=manageboards'); |
|
| 803 | + } |
|
| 804 | + } |
|
| 775 | 805 | |
| 776 | 806 | /** |
| 777 | 807 | * Used to retrieve data for modifying a board category |
@@ -808,8 +838,9 @@ discard block |
||
| 808 | 838 | $smcFunc['db_free_result']($request); |
| 809 | 839 | |
| 810 | 840 | // This would probably never happen, but just to be sure. |
| 811 | - if ($cat .= $allowed_sa[1]) |
|
| 812 | - die(str_replace(',', ' to', $cat)); |
|
| 841 | + if ($cat .= $allowed_sa[1]) { |
|
| 842 | + die(str_replace(',', ' to', $cat)); |
|
| 843 | + } |
|
| 813 | 844 | |
| 814 | 845 | redirectexit(); |
| 815 | 846 | } |
@@ -835,8 +866,9 @@ discard block |
||
| 835 | 866 | 'empty_string' => '', |
| 836 | 867 | ) |
| 837 | 868 | ); |
| 838 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 839 | - $recycle_boards[$row['id_board']] = $row['cat_name'] . ' - ' . $row['board_name']; |
|
| 869 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 870 | + $recycle_boards[$row['id_board']] = $row['cat_name'] . ' - ' . $row['board_name']; |
|
| 871 | + } |
|
| 840 | 872 | $smcFunc['db_free_result']($request); |
| 841 | 873 | |
| 842 | 874 | require_once($sourcedir . '/Subs-Boards.php'); |
@@ -860,8 +892,9 @@ discard block |
||
| 860 | 892 | |
| 861 | 893 | call_integration_hook('integrate_modify_board_settings', array(&$config_vars)); |
| 862 | 894 | |
| 863 | - if ($return_config) |
|
| 864 | - return $config_vars; |
|
| 895 | + if ($return_config) { |
|
| 896 | + return $config_vars; |
|
| 897 | + } |
|
| 865 | 898 | |
| 866 | 899 | // Needed for the settings template. |
| 867 | 900 | require_once($sourcedir . '/ManageServer.php'); |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 3 |
| 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 | * Main dispatcher, the maintenance access point. |
@@ -96,14 +97,16 @@ discard block |
||
| 96 | 97 | call_integration_hook('integrate_manage_maintenance', array(&$subActions)); |
| 97 | 98 | |
| 98 | 99 | // Yep, sub-action time! |
| 99 | - if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) |
|
| 100 | - $subAction = $_REQUEST['sa']; |
|
| 101 | - else |
|
| 102 | - $subAction = 'routine'; |
|
| 100 | + if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) { |
|
| 101 | + $subAction = $_REQUEST['sa']; |
|
| 102 | + } else { |
|
| 103 | + $subAction = 'routine'; |
|
| 104 | + } |
|
| 103 | 105 | |
| 104 | 106 | // Doing something special? |
| 105 | - if (isset($_REQUEST['activity']) && isset($subActions[$subAction]['activities'][$_REQUEST['activity']])) |
|
| 106 | - $activity = $_REQUEST['activity']; |
|
| 107 | + if (isset($_REQUEST['activity']) && isset($subActions[$subAction]['activities'][$_REQUEST['activity']])) { |
|
| 108 | + $activity = $_REQUEST['activity']; |
|
| 109 | + } |
|
| 107 | 110 | |
| 108 | 111 | // Set a few things. |
| 109 | 112 | $context['page_title'] = $txt['maintain_title']; |
@@ -114,12 +117,14 @@ discard block |
||
| 114 | 117 | call_helper($subActions[$subAction]['function']); |
| 115 | 118 | |
| 116 | 119 | // Any special activity? |
| 117 | - if (isset($activity)) |
|
| 118 | - call_helper($subActions[$subAction]['activities'][$activity]); |
|
| 120 | + if (isset($activity)) { |
|
| 121 | + call_helper($subActions[$subAction]['activities'][$activity]); |
|
| 122 | + } |
|
| 119 | 123 | |
| 120 | 124 | //converted to UTF-8? show a small maintenance info |
| 121 | - if (isset($_GET['done']) && $_GET['done'] == 'convertutf8') |
|
| 122 | - $context['maintenance_finished'] = $txt['utf8_title']; |
|
| 125 | + if (isset($_GET['done']) && $_GET['done'] == 'convertutf8') { |
|
| 126 | + $context['maintenance_finished'] = $txt['utf8_title']; |
|
| 127 | + } |
|
| 123 | 128 | |
| 124 | 129 | // Create a maintenance token. Kinda hard to do it any other way. |
| 125 | 130 | createToken('admin-maint'); |
@@ -141,19 +146,22 @@ discard block |
||
| 141 | 146 | db_extend('packages'); |
| 142 | 147 | |
| 143 | 148 | $colData = $smcFunc['db_list_columns']('{db_prefix}messages', true); |
| 144 | - foreach ($colData as $column) |
|
| 145 | - if ($column['name'] == 'body') |
|
| 149 | + foreach ($colData as $column) { |
|
| 150 | + if ($column['name'] == 'body') |
|
| 146 | 151 | $body_type = $column['type']; |
| 152 | + } |
|
| 147 | 153 | |
| 148 | 154 | $context['convert_to'] = $body_type == 'text' ? 'mediumtext' : 'text'; |
| 149 | 155 | $context['convert_to_suggest'] = ($body_type != 'text' && !empty($modSettings['max_messageLength']) && $modSettings['max_messageLength'] < 65536); |
| 150 | 156 | } |
| 151 | 157 | |
| 152 | - if (isset($_GET['done']) && $_GET['done'] == 'convertutf8') |
|
| 153 | - $context['maintenance_finished'] = $txt['utf8_title']; |
|
| 154 | - if (isset($_GET['done']) && $_GET['done'] == 'convertentities') |
|
| 155 | - $context['maintenance_finished'] = $txt['entity_convert_title']; |
|
| 156 | -} |
|
| 158 | + if (isset($_GET['done']) && $_GET['done'] == 'convertutf8') { |
|
| 159 | + $context['maintenance_finished'] = $txt['utf8_title']; |
|
| 160 | + } |
|
| 161 | + if (isset($_GET['done']) && $_GET['done'] == 'convertentities') { |
|
| 162 | + $context['maintenance_finished'] = $txt['entity_convert_title']; |
|
| 163 | + } |
|
| 164 | + } |
|
| 157 | 165 | |
| 158 | 166 | /** |
| 159 | 167 | * Supporting function for the routine maintenance area. |
@@ -162,9 +170,10 @@ discard block |
||
| 162 | 170 | { |
| 163 | 171 | global $context, $txt; |
| 164 | 172 | |
| 165 | - if (isset($_GET['done']) && $_GET['done'] == 'recount') |
|
| 166 | - $context['maintenance_finished'] = $txt['maintain_recount']; |
|
| 167 | -} |
|
| 173 | + if (isset($_GET['done']) && $_GET['done'] == 'recount') { |
|
| 174 | + $context['maintenance_finished'] = $txt['maintain_recount']; |
|
| 175 | + } |
|
| 176 | + } |
|
| 168 | 177 | |
| 169 | 178 | /** |
| 170 | 179 | * Supporting function for the members maintenance area. |
@@ -195,8 +204,9 @@ discard block |
||
| 195 | 204 | } |
| 196 | 205 | $smcFunc['db_free_result']($result); |
| 197 | 206 | |
| 198 | - if (isset($_GET['done']) && $_GET['done'] == 'recountposts') |
|
| 199 | - $context['maintenance_finished'] = $txt['maintain_recountposts']; |
|
| 207 | + if (isset($_GET['done']) && $_GET['done'] == 'recountposts') { |
|
| 208 | + $context['maintenance_finished'] = $txt['maintain_recountposts']; |
|
| 209 | + } |
|
| 200 | 210 | |
| 201 | 211 | loadJavaScriptFile('suggest.js', array('defer' => false), 'smf_suggest'); |
| 202 | 212 | } |
@@ -222,11 +232,12 @@ discard block |
||
| 222 | 232 | $context['categories'] = array(); |
| 223 | 233 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
| 224 | 234 | { |
| 225 | - if (!isset($context['categories'][$row['id_cat']])) |
|
| 226 | - $context['categories'][$row['id_cat']] = array( |
|
| 235 | + if (!isset($context['categories'][$row['id_cat']])) { |
|
| 236 | + $context['categories'][$row['id_cat']] = array( |
|
| 227 | 237 | 'name' => $row['cat_name'], |
| 228 | 238 | 'boards' => array() |
| 229 | 239 | ); |
| 240 | + } |
|
| 230 | 241 | |
| 231 | 242 | $context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array( |
| 232 | 243 | 'id' => $row['id_board'], |
@@ -239,11 +250,12 @@ discard block |
||
| 239 | 250 | require_once($sourcedir . '/Subs-Boards.php'); |
| 240 | 251 | sortCategories($context['categories']); |
| 241 | 252 | |
| 242 | - if (isset($_GET['done']) && $_GET['done'] == 'purgeold') |
|
| 243 | - $context['maintenance_finished'] = $txt['maintain_old']; |
|
| 244 | - elseif (isset($_GET['done']) && $_GET['done'] == 'massmove') |
|
| 245 | - $context['maintenance_finished'] = $txt['move_topics_maintenance']; |
|
| 246 | -} |
|
| 253 | + if (isset($_GET['done']) && $_GET['done'] == 'purgeold') { |
|
| 254 | + $context['maintenance_finished'] = $txt['maintain_old']; |
|
| 255 | + } elseif (isset($_GET['done']) && $_GET['done'] == 'massmove') { |
|
| 256 | + $context['maintenance_finished'] = $txt['move_topics_maintenance']; |
|
| 257 | + } |
|
| 258 | + } |
|
| 247 | 259 | |
| 248 | 260 | /** |
| 249 | 261 | * Find and fix all errors on the forum. |
@@ -351,15 +363,17 @@ discard block |
||
| 351 | 363 | // Show me your badge! |
| 352 | 364 | isAllowedTo('admin_forum'); |
| 353 | 365 | |
| 354 | - if ($db_type != 'mysql' && $db_type != 'mysqli') |
|
| 355 | - return; |
|
| 366 | + if ($db_type != 'mysql' && $db_type != 'mysqli') { |
|
| 367 | + return; |
|
| 368 | + } |
|
| 356 | 369 | |
| 357 | 370 | db_extend('packages'); |
| 358 | 371 | |
| 359 | 372 | $colData = $smcFunc['db_list_columns']('{db_prefix}messages', true); |
| 360 | - foreach ($colData as $column) |
|
| 361 | - if ($column['name'] == 'body') |
|
| 373 | + foreach ($colData as $column) { |
|
| 374 | + if ($column['name'] == 'body') |
|
| 362 | 375 | $body_type = $column['type']; |
| 376 | + } |
|
| 363 | 377 | |
| 364 | 378 | $context['convert_to'] = $body_type == 'text' ? 'mediumtext' : 'text'; |
| 365 | 379 | |
@@ -369,19 +383,22 @@ discard block |
||
| 369 | 383 | validateToken('admin-maint'); |
| 370 | 384 | |
| 371 | 385 | // Make it longer so we can do their limit. |
| 372 | - if ($body_type == 'text') |
|
| 373 | - $smcFunc['db_change_column']('{db_prefix}messages', 'body', array('type' => 'mediumtext')); |
|
| 386 | + if ($body_type == 'text') { |
|
| 387 | + $smcFunc['db_change_column']('{db_prefix}messages', 'body', array('type' => 'mediumtext')); |
|
| 388 | + } |
|
| 374 | 389 | // Shorten the column so we can have a bit (literally per record) less space occupied |
| 375 | - else |
|
| 376 | - $smcFunc['db_change_column']('{db_prefix}messages', 'body', array('type' => 'text')); |
|
| 390 | + else { |
|
| 391 | + $smcFunc['db_change_column']('{db_prefix}messages', 'body', array('type' => 'text')); |
|
| 392 | + } |
|
| 377 | 393 | |
| 378 | 394 | // 3rd party integrations may be interested in knowning about this. |
| 379 | 395 | call_integration_hook('integrate_convert_msgbody', array($body_type)); |
| 380 | 396 | |
| 381 | 397 | $colData = $smcFunc['db_list_columns']('{db_prefix}messages', true); |
| 382 | - foreach ($colData as $column) |
|
| 383 | - if ($column['name'] == 'body') |
|
| 398 | + foreach ($colData as $column) { |
|
| 399 | + if ($column['name'] == 'body') |
|
| 384 | 400 | $body_type = $column['type']; |
| 401 | + } |
|
| 385 | 402 | |
| 386 | 403 | $context['maintenance_finished'] = $txt[$context['convert_to'] . '_title']; |
| 387 | 404 | $context['convert_to'] = $body_type == 'text' ? 'mediumtext' : 'text'; |
@@ -389,14 +406,14 @@ discard block |
||
| 389 | 406 | |
| 390 | 407 | return; |
| 391 | 408 | redirectexit('action=admin;area=maintain;sa=database'); |
| 392 | - } |
|
| 393 | - elseif ($body_type != 'text' && (!isset($_POST['do_conversion']) || isset($_POST['cont']))) |
|
| 409 | + } elseif ($body_type != 'text' && (!isset($_POST['do_conversion']) || isset($_POST['cont']))) |
|
| 394 | 410 | { |
| 395 | 411 | checkSession(); |
| 396 | - if (empty($_REQUEST['start'])) |
|
| 397 | - validateToken('admin-maint'); |
|
| 398 | - else |
|
| 399 | - validateToken('admin-convertMsg'); |
|
| 412 | + if (empty($_REQUEST['start'])) { |
|
| 413 | + validateToken('admin-maint'); |
|
| 414 | + } else { |
|
| 415 | + validateToken('admin-convertMsg'); |
|
| 416 | + } |
|
| 400 | 417 | |
| 401 | 418 | $context['page_title'] = $txt['not_done_title']; |
| 402 | 419 | $context['continue_post_data'] = ''; |
@@ -428,8 +445,9 @@ discard block |
||
| 428 | 445 | 'increment' => $increment - 1, |
| 429 | 446 | ) |
| 430 | 447 | ); |
| 431 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 432 | - $id_msg_exceeding[] = $row['id_msg']; |
|
| 448 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 449 | + $id_msg_exceeding[] = $row['id_msg']; |
|
| 450 | + } |
|
| 433 | 451 | $smcFunc['db_free_result']($request); |
| 434 | 452 | |
| 435 | 453 | $_REQUEST['start'] += $increment; |
@@ -458,9 +476,9 @@ discard block |
||
| 458 | 476 | { |
| 459 | 477 | $query_msg = array_slice($id_msg_exceeding, 0, 100); |
| 460 | 478 | $context['exceeding_messages_morethan'] = sprintf($txt['exceeding_messages_morethan'], count($id_msg_exceeding)); |
| 479 | + } else { |
|
| 480 | + $query_msg = $id_msg_exceeding; |
|
| 461 | 481 | } |
| 462 | - else |
|
| 463 | - $query_msg = $id_msg_exceeding; |
|
| 464 | 482 | |
| 465 | 483 | $context['exceeding_messages'] = array(); |
| 466 | 484 | $request = $smcFunc['db_query']('', ' |
@@ -471,8 +489,9 @@ discard block |
||
| 471 | 489 | 'messages' => $query_msg, |
| 472 | 490 | ) |
| 473 | 491 | ); |
| 474 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 475 | - $context['exceeding_messages'][] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>'; |
|
| 492 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 493 | + $context['exceeding_messages'][] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>'; |
|
| 494 | + } |
|
| 476 | 495 | $smcFunc['db_free_result']($request); |
| 477 | 496 | } |
| 478 | 497 | } |
@@ -496,8 +515,9 @@ discard block |
||
| 496 | 515 | isAllowedTo('admin_forum'); |
| 497 | 516 | |
| 498 | 517 | // Check to see if UTF-8 is currently the default character set. |
| 499 | - if ($modSettings['global_character_set'] !== 'UTF-8' || !isset($db_character_set) || $db_character_set !== 'utf8') |
|
| 500 | - fatal_lang_error('entity_convert_only_utf8'); |
|
| 518 | + if ($modSettings['global_character_set'] !== 'UTF-8' || !isset($db_character_set) || $db_character_set !== 'utf8') { |
|
| 519 | + fatal_lang_error('entity_convert_only_utf8'); |
|
| 520 | + } |
|
| 501 | 521 | |
| 502 | 522 | // Some starting values. |
| 503 | 523 | $context['table'] = empty($_REQUEST['table']) ? 0 : (int) $_REQUEST['table']; |
@@ -559,8 +579,9 @@ discard block |
||
| 559 | 579 | // Make sure we keep stuff unique! |
| 560 | 580 | $primary_keys = array(); |
| 561 | 581 | |
| 562 | - if (function_exists('apache_reset_timeout')) |
|
| 563 | - @apache_reset_timeout(); |
|
| 582 | + if (function_exists('apache_reset_timeout')) { |
|
| 583 | + @apache_reset_timeout(); |
|
| 584 | + } |
|
| 564 | 585 | |
| 565 | 586 | // Get a list of text columns. |
| 566 | 587 | $columns = array(); |
@@ -571,9 +592,10 @@ discard block |
||
| 571 | 592 | 'cur_table' => $cur_table, |
| 572 | 593 | ) |
| 573 | 594 | ); |
| 574 | - while ($column_info = $smcFunc['db_fetch_assoc']($request)) |
|
| 575 | - if (strpos($column_info['Type'], 'text') !== false || strpos($column_info['Type'], 'char') !== false) |
|
| 595 | + while ($column_info = $smcFunc['db_fetch_assoc']($request)) { |
|
| 596 | + if (strpos($column_info['Type'], 'text') !== false || strpos($column_info['Type'], 'char') !== false) |
|
| 576 | 597 | $columns[] = strtolower($column_info['Field']); |
| 598 | + } |
|
| 577 | 599 | |
| 578 | 600 | // Get the column with the (first) primary key. |
| 579 | 601 | $request = $smcFunc['db_query']('', ' |
@@ -587,8 +609,9 @@ discard block |
||
| 587 | 609 | { |
| 588 | 610 | if ($row['Key_name'] === 'PRIMARY') |
| 589 | 611 | { |
| 590 | - if (empty($primary_key) || ($row['Seq_in_index'] == 1 && !in_array(strtolower($row['Column_name']), $columns))) |
|
| 591 | - $primary_key = $row['Column_name']; |
|
| 612 | + if (empty($primary_key) || ($row['Seq_in_index'] == 1 && !in_array(strtolower($row['Column_name']), $columns))) { |
|
| 613 | + $primary_key = $row['Column_name']; |
|
| 614 | + } |
|
| 592 | 615 | |
| 593 | 616 | $primary_keys[] = $row['Column_name']; |
| 594 | 617 | } |
@@ -597,8 +620,9 @@ discard block |
||
| 597 | 620 | |
| 598 | 621 | // No primary key, no glory. |
| 599 | 622 | // Same for columns. Just to be sure we've work to do! |
| 600 | - if (empty($primary_key) || empty($columns)) |
|
| 601 | - continue; |
|
| 623 | + if (empty($primary_key) || empty($columns)) { |
|
| 624 | + continue; |
|
| 625 | + } |
|
| 602 | 626 | |
| 603 | 627 | // Get the maximum value for the primary key. |
| 604 | 628 | $request = $smcFunc['db_query']('', ' |
@@ -612,8 +636,9 @@ discard block |
||
| 612 | 636 | list($max_value) = $smcFunc['db_fetch_row']($request); |
| 613 | 637 | $smcFunc['db_free_result']($request); |
| 614 | 638 | |
| 615 | - if (empty($max_value)) |
|
| 616 | - continue; |
|
| 639 | + if (empty($max_value)) { |
|
| 640 | + continue; |
|
| 641 | + } |
|
| 617 | 642 | |
| 618 | 643 | while ($context['start'] <= $max_value) |
| 619 | 644 | { |
@@ -637,10 +662,11 @@ discard block |
||
| 637 | 662 | { |
| 638 | 663 | $insertion_variables = array(); |
| 639 | 664 | $changes = array(); |
| 640 | - foreach ($row as $column_name => $column_value) |
|
| 641 | - if ($column_name !== $primary_key && strpos($column_value, '&#') !== false) |
|
| 665 | + foreach ($row as $column_name => $column_value) { |
|
| 666 | + if ($column_name !== $primary_key && strpos($column_value, '&#') !== false) |
|
| 642 | 667 | { |
| 643 | 668 | $changes[] = $column_name . ' = {string:changes_' . $column_name . '}'; |
| 669 | + } |
|
| 644 | 670 | $insertion_variables['changes_' . $column_name] = preg_replace_callback('~&#(\d{1,7}|x[0-9a-fA-F]{1,6});~', 'fixchar__callback', $column_value); |
| 645 | 671 | } |
| 646 | 672 | |
@@ -652,8 +678,8 @@ discard block |
||
| 652 | 678 | } |
| 653 | 679 | |
| 654 | 680 | // Update the row. |
| 655 | - if (!empty($changes)) |
|
| 656 | - $smcFunc['db_query']('', ' |
|
| 681 | + if (!empty($changes)) { |
|
| 682 | + $smcFunc['db_query']('', ' |
|
| 657 | 683 | UPDATE {db_prefix}' . $cur_table . ' |
| 658 | 684 | SET |
| 659 | 685 | ' . implode(', |
@@ -661,6 +687,7 @@ discard block |
||
| 661 | 687 | WHERE ' . implode(' AND ', $where), |
| 662 | 688 | $insertion_variables |
| 663 | 689 | ); |
| 690 | + } |
|
| 664 | 691 | } |
| 665 | 692 | $smcFunc['db_free_result']($request); |
| 666 | 693 | $context['start'] += 500; |
@@ -705,10 +732,11 @@ discard block |
||
| 705 | 732 | |
| 706 | 733 | checkSession('request'); |
| 707 | 734 | |
| 708 | - if (!isset($_SESSION['optimized_tables'])) |
|
| 709 | - validateToken('admin-maint'); |
|
| 710 | - else |
|
| 711 | - validateToken('admin-optimize', 'post', false); |
|
| 735 | + if (!isset($_SESSION['optimized_tables'])) { |
|
| 736 | + validateToken('admin-maint'); |
|
| 737 | + } else { |
|
| 738 | + validateToken('admin-optimize', 'post', false); |
|
| 739 | + } |
|
| 712 | 740 | |
| 713 | 741 | ignore_user_abort(true); |
| 714 | 742 | db_extend(); |
@@ -727,13 +755,15 @@ discard block |
||
| 727 | 755 | // Get a list of tables, as well as how many there are. |
| 728 | 756 | $temp_tables = $smcFunc['db_list_tables'](false, $real_prefix . '%'); |
| 729 | 757 | $tables = array(); |
| 730 | - foreach ($temp_tables as $table) |
|
| 731 | - $tables[] = array('table_name' => $table); |
|
| 758 | + foreach ($temp_tables as $table) { |
|
| 759 | + $tables[] = array('table_name' => $table); |
|
| 760 | + } |
|
| 732 | 761 | |
| 733 | 762 | // If there aren't any tables then I believe that would mean the world has exploded... |
| 734 | 763 | $context['num_tables'] = count($tables); |
| 735 | - if ($context['num_tables'] == 0) |
|
| 736 | - fatal_error('You appear to be running SMF in a flat file mode... fantastic!', false); |
|
| 764 | + if ($context['num_tables'] == 0) { |
|
| 765 | + fatal_error('You appear to be running SMF in a flat file mode... fantastic!', false); |
|
| 766 | + } |
|
| 737 | 767 | |
| 738 | 768 | $_REQUEST['start'] = empty($_REQUEST['start']) ? 0 : (int) $_REQUEST['start']; |
| 739 | 769 | |
@@ -744,8 +774,9 @@ discard block |
||
| 744 | 774 | $_SESSION['optimized_tables'] = !empty($_SESSION['optimized_tables']) ? $_SESSION['optimized_tables'] : array(); |
| 745 | 775 | for ($key=$_REQUEST['start']; $context['num_tables']-1; $key++) |
| 746 | 776 | { |
| 747 | - if (empty($tables[$key])) |
|
| 748 | - break; |
|
| 777 | + if (empty($tables[$key])) { |
|
| 778 | + break; |
|
| 779 | + } |
|
| 749 | 780 | |
| 750 | 781 | // Continue? |
| 751 | 782 | if (array_sum(explode(' ', microtime())) - array_sum(explode(' ', $time_start)) > 10) |
@@ -759,8 +790,9 @@ discard block |
||
| 759 | 790 | createToken('admin-optimize'); |
| 760 | 791 | $context['continue_post_data'] = '<input type="hidden" name="' . $context['admin-optimize_token_var'] . '" value="' . $context['admin-optimize_token'] . '">'; |
| 761 | 792 | |
| 762 | - if (function_exists('apache_reset_timeout')) |
|
| 763 | - apache_reset_timeout(); |
|
| 793 | + if (function_exists('apache_reset_timeout')) { |
|
| 794 | + apache_reset_timeout(); |
|
| 795 | + } |
|
| 764 | 796 | |
| 765 | 797 | return; |
| 766 | 798 | } |
@@ -768,11 +800,12 @@ discard block |
||
| 768 | 800 | // Optimize the table! We use backticks here because it might be a custom table. |
| 769 | 801 | $data_freed = $smcFunc['db_optimize_table']($tables[$key]['table_name']); |
| 770 | 802 | |
| 771 | - if ($data_freed > 0) |
|
| 772 | - $_SESSION['optimized_tables'][] = array( |
|
| 803 | + if ($data_freed > 0) { |
|
| 804 | + $_SESSION['optimized_tables'][] = array( |
|
| 773 | 805 | 'name' => $tables[$key]['table_name'], |
| 774 | 806 | 'data_freed' => $data_freed, |
| 775 | 807 | ); |
| 808 | + } |
|
| 776 | 809 | } |
| 777 | 810 | |
| 778 | 811 | // Number of tables, etc... |
@@ -807,10 +840,11 @@ discard block |
||
| 807 | 840 | checkSession('request'); |
| 808 | 841 | |
| 809 | 842 | // validate the request or the loop |
| 810 | - if (!isset($_REQUEST['step'])) |
|
| 811 | - validateToken('admin-maint'); |
|
| 812 | - else |
|
| 813 | - validateToken('admin-boardrecount'); |
|
| 843 | + if (!isset($_REQUEST['step'])) { |
|
| 844 | + validateToken('admin-maint'); |
|
| 845 | + } else { |
|
| 846 | + validateToken('admin-boardrecount'); |
|
| 847 | + } |
|
| 814 | 848 | |
| 815 | 849 | $context['page_title'] = $txt['not_done_title']; |
| 816 | 850 | $context['continue_post_data'] = ''; |
@@ -831,8 +865,9 @@ discard block |
||
| 831 | 865 | $smcFunc['db_free_result']($request); |
| 832 | 866 | |
| 833 | 867 | $increment = min(max(50, ceil($max_topics / 4)), 2000); |
| 834 | - if (empty($_REQUEST['start'])) |
|
| 835 | - $_REQUEST['start'] = 0; |
|
| 868 | + if (empty($_REQUEST['start'])) { |
|
| 869 | + $_REQUEST['start'] = 0; |
|
| 870 | + } |
|
| 836 | 871 | |
| 837 | 872 | $total_steps = 8; |
| 838 | 873 | |
@@ -859,8 +894,8 @@ discard block |
||
| 859 | 894 | 'max_id' => $_REQUEST['start'] + $increment, |
| 860 | 895 | ) |
| 861 | 896 | ); |
| 862 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 863 | - $smcFunc['db_query']('', ' |
|
| 897 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 898 | + $smcFunc['db_query']('', ' |
|
| 864 | 899 | UPDATE {db_prefix}topics |
| 865 | 900 | SET num_replies = {int:num_replies} |
| 866 | 901 | WHERE id_topic = {int:id_topic}', |
@@ -869,6 +904,7 @@ discard block |
||
| 869 | 904 | 'id_topic' => $row['id_topic'], |
| 870 | 905 | ) |
| 871 | 906 | ); |
| 907 | + } |
|
| 872 | 908 | $smcFunc['db_free_result']($request); |
| 873 | 909 | |
| 874 | 910 | // Recount unapproved messages |
@@ -887,8 +923,8 @@ discard block |
||
| 887 | 923 | 'max_id' => $_REQUEST['start'] + $increment, |
| 888 | 924 | ) |
| 889 | 925 | ); |
| 890 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 891 | - $smcFunc['db_query']('', ' |
|
| 926 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 927 | + $smcFunc['db_query']('', ' |
|
| 892 | 928 | UPDATE {db_prefix}topics |
| 893 | 929 | SET unapproved_posts = {int:unapproved_posts} |
| 894 | 930 | WHERE id_topic = {int:id_topic}', |
@@ -897,6 +933,7 @@ discard block |
||
| 897 | 933 | 'id_topic' => $row['id_topic'], |
| 898 | 934 | ) |
| 899 | 935 | ); |
| 936 | + } |
|
| 900 | 937 | $smcFunc['db_free_result']($request); |
| 901 | 938 | |
| 902 | 939 | $_REQUEST['start'] += $increment; |
@@ -919,8 +956,8 @@ discard block |
||
| 919 | 956 | // Update the post count of each board. |
| 920 | 957 | if ($_REQUEST['step'] <= 1) |
| 921 | 958 | { |
| 922 | - if (empty($_REQUEST['start'])) |
|
| 923 | - $smcFunc['db_query']('', ' |
|
| 959 | + if (empty($_REQUEST['start'])) { |
|
| 960 | + $smcFunc['db_query']('', ' |
|
| 924 | 961 | UPDATE {db_prefix}boards |
| 925 | 962 | SET num_posts = {int:num_posts} |
| 926 | 963 | WHERE redirect = {string:redirect}', |
@@ -929,6 +966,7 @@ discard block |
||
| 929 | 966 | 'redirect' => '', |
| 930 | 967 | ) |
| 931 | 968 | ); |
| 969 | + } |
|
| 932 | 970 | |
| 933 | 971 | while ($_REQUEST['start'] < $max_topics) |
| 934 | 972 | { |
@@ -945,8 +983,8 @@ discard block |
||
| 945 | 983 | 'is_approved' => 1, |
| 946 | 984 | ) |
| 947 | 985 | ); |
| 948 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 949 | - $smcFunc['db_query']('', ' |
|
| 986 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 987 | + $smcFunc['db_query']('', ' |
|
| 950 | 988 | UPDATE {db_prefix}boards |
| 951 | 989 | SET num_posts = num_posts + {int:real_num_posts} |
| 952 | 990 | WHERE id_board = {int:id_board}', |
@@ -955,6 +993,7 @@ discard block |
||
| 955 | 993 | 'real_num_posts' => $row['real_num_posts'], |
| 956 | 994 | ) |
| 957 | 995 | ); |
| 996 | + } |
|
| 958 | 997 | $smcFunc['db_free_result']($request); |
| 959 | 998 | |
| 960 | 999 | $_REQUEST['start'] += $increment; |
@@ -977,14 +1016,15 @@ discard block |
||
| 977 | 1016 | // Update the topic count of each board. |
| 978 | 1017 | if ($_REQUEST['step'] <= 2) |
| 979 | 1018 | { |
| 980 | - if (empty($_REQUEST['start'])) |
|
| 981 | - $smcFunc['db_query']('', ' |
|
| 1019 | + if (empty($_REQUEST['start'])) { |
|
| 1020 | + $smcFunc['db_query']('', ' |
|
| 982 | 1021 | UPDATE {db_prefix}boards |
| 983 | 1022 | SET num_topics = {int:num_topics}', |
| 984 | 1023 | array( |
| 985 | 1024 | 'num_topics' => 0, |
| 986 | 1025 | ) |
| 987 | 1026 | ); |
| 1027 | + } |
|
| 988 | 1028 | |
| 989 | 1029 | while ($_REQUEST['start'] < $max_topics) |
| 990 | 1030 | { |
@@ -1001,8 +1041,8 @@ discard block |
||
| 1001 | 1041 | 'id_topic_max' => $_REQUEST['start'] + $increment, |
| 1002 | 1042 | ) |
| 1003 | 1043 | ); |
| 1004 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1005 | - $smcFunc['db_query']('', ' |
|
| 1044 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1045 | + $smcFunc['db_query']('', ' |
|
| 1006 | 1046 | UPDATE {db_prefix}boards |
| 1007 | 1047 | SET num_topics = num_topics + {int:real_num_topics} |
| 1008 | 1048 | WHERE id_board = {int:id_board}', |
@@ -1011,6 +1051,7 @@ discard block |
||
| 1011 | 1051 | 'real_num_topics' => $row['real_num_topics'], |
| 1012 | 1052 | ) |
| 1013 | 1053 | ); |
| 1054 | + } |
|
| 1014 | 1055 | $smcFunc['db_free_result']($request); |
| 1015 | 1056 | |
| 1016 | 1057 | $_REQUEST['start'] += $increment; |
@@ -1033,14 +1074,15 @@ discard block |
||
| 1033 | 1074 | // Update the unapproved post count of each board. |
| 1034 | 1075 | if ($_REQUEST['step'] <= 3) |
| 1035 | 1076 | { |
| 1036 | - if (empty($_REQUEST['start'])) |
|
| 1037 | - $smcFunc['db_query']('', ' |
|
| 1077 | + if (empty($_REQUEST['start'])) { |
|
| 1078 | + $smcFunc['db_query']('', ' |
|
| 1038 | 1079 | UPDATE {db_prefix}boards |
| 1039 | 1080 | SET unapproved_posts = {int:unapproved_posts}', |
| 1040 | 1081 | array( |
| 1041 | 1082 | 'unapproved_posts' => 0, |
| 1042 | 1083 | ) |
| 1043 | 1084 | ); |
| 1085 | + } |
|
| 1044 | 1086 | |
| 1045 | 1087 | while ($_REQUEST['start'] < $max_topics) |
| 1046 | 1088 | { |
@@ -1057,8 +1099,8 @@ discard block |
||
| 1057 | 1099 | 'is_approved' => 0, |
| 1058 | 1100 | ) |
| 1059 | 1101 | ); |
| 1060 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1061 | - $smcFunc['db_query']('', ' |
|
| 1102 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1103 | + $smcFunc['db_query']('', ' |
|
| 1062 | 1104 | UPDATE {db_prefix}boards |
| 1063 | 1105 | SET unapproved_posts = unapproved_posts + {int:unapproved_posts} |
| 1064 | 1106 | WHERE id_board = {int:id_board}', |
@@ -1067,6 +1109,7 @@ discard block |
||
| 1067 | 1109 | 'unapproved_posts' => $row['real_unapproved_posts'], |
| 1068 | 1110 | ) |
| 1069 | 1111 | ); |
| 1112 | + } |
|
| 1070 | 1113 | $smcFunc['db_free_result']($request); |
| 1071 | 1114 | |
| 1072 | 1115 | $_REQUEST['start'] += $increment; |
@@ -1089,14 +1132,15 @@ discard block |
||
| 1089 | 1132 | // Update the unapproved topic count of each board. |
| 1090 | 1133 | if ($_REQUEST['step'] <= 4) |
| 1091 | 1134 | { |
| 1092 | - if (empty($_REQUEST['start'])) |
|
| 1093 | - $smcFunc['db_query']('', ' |
|
| 1135 | + if (empty($_REQUEST['start'])) { |
|
| 1136 | + $smcFunc['db_query']('', ' |
|
| 1094 | 1137 | UPDATE {db_prefix}boards |
| 1095 | 1138 | SET unapproved_topics = {int:unapproved_topics}', |
| 1096 | 1139 | array( |
| 1097 | 1140 | 'unapproved_topics' => 0, |
| 1098 | 1141 | ) |
| 1099 | 1142 | ); |
| 1143 | + } |
|
| 1100 | 1144 | |
| 1101 | 1145 | while ($_REQUEST['start'] < $max_topics) |
| 1102 | 1146 | { |
@@ -1113,8 +1157,8 @@ discard block |
||
| 1113 | 1157 | 'id_topic_max' => $_REQUEST['start'] + $increment, |
| 1114 | 1158 | ) |
| 1115 | 1159 | ); |
| 1116 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1117 | - $smcFunc['db_query']('', ' |
|
| 1160 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1161 | + $smcFunc['db_query']('', ' |
|
| 1118 | 1162 | UPDATE {db_prefix}boards |
| 1119 | 1163 | SET unapproved_topics = unapproved_topics + {int:real_unapproved_topics} |
| 1120 | 1164 | WHERE id_board = {int:id_board}', |
@@ -1123,6 +1167,7 @@ discard block |
||
| 1123 | 1167 | 'real_unapproved_topics' => $row['real_unapproved_topics'], |
| 1124 | 1168 | ) |
| 1125 | 1169 | ); |
| 1170 | + } |
|
| 1126 | 1171 | $smcFunc['db_free_result']($request); |
| 1127 | 1172 | |
| 1128 | 1173 | $_REQUEST['start'] += $increment; |
@@ -1156,8 +1201,9 @@ discard block |
||
| 1156 | 1201 | 'is_not_deleted' => 0, |
| 1157 | 1202 | ) |
| 1158 | 1203 | ); |
| 1159 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1160 | - updateMemberData($row['id_member'], array('instant_messages' => $row['real_num'])); |
|
| 1204 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1205 | + updateMemberData($row['id_member'], array('instant_messages' => $row['real_num'])); |
|
| 1206 | + } |
|
| 1161 | 1207 | $smcFunc['db_free_result']($request); |
| 1162 | 1208 | |
| 1163 | 1209 | $request = $smcFunc['db_query']('', ' |
@@ -1172,8 +1218,9 @@ discard block |
||
| 1172 | 1218 | 'is_not_read' => 0, |
| 1173 | 1219 | ) |
| 1174 | 1220 | ); |
| 1175 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1176 | - updateMemberData($row['id_member'], array('unread_messages' => $row['real_num'])); |
|
| 1221 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1222 | + updateMemberData($row['id_member'], array('unread_messages' => $row['real_num'])); |
|
| 1223 | + } |
|
| 1177 | 1224 | $smcFunc['db_free_result']($request); |
| 1178 | 1225 | |
| 1179 | 1226 | if (array_sum(explode(' ', microtime())) - array_sum(explode(' ', $time_start)) > 3) |
@@ -1205,12 +1252,13 @@ discard block |
||
| 1205 | 1252 | ) |
| 1206 | 1253 | ); |
| 1207 | 1254 | $boards = array(); |
| 1208 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1209 | - $boards[$row['id_board']][] = $row['id_msg']; |
|
| 1255 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1256 | + $boards[$row['id_board']][] = $row['id_msg']; |
|
| 1257 | + } |
|
| 1210 | 1258 | $smcFunc['db_free_result']($request); |
| 1211 | 1259 | |
| 1212 | - foreach ($boards as $board_id => $messages) |
|
| 1213 | - $smcFunc['db_query']('', ' |
|
| 1260 | + foreach ($boards as $board_id => $messages) { |
|
| 1261 | + $smcFunc['db_query']('', ' |
|
| 1214 | 1262 | UPDATE {db_prefix}messages |
| 1215 | 1263 | SET id_board = {int:id_board} |
| 1216 | 1264 | WHERE id_msg IN ({array_int:id_msg_array})', |
@@ -1219,6 +1267,7 @@ discard block |
||
| 1219 | 1267 | 'id_board' => $board_id, |
| 1220 | 1268 | ) |
| 1221 | 1269 | ); |
| 1270 | + } |
|
| 1222 | 1271 | |
| 1223 | 1272 | $_REQUEST['start'] += $increment; |
| 1224 | 1273 | |
@@ -1248,8 +1297,9 @@ discard block |
||
| 1248 | 1297 | ) |
| 1249 | 1298 | ); |
| 1250 | 1299 | $realBoardCounts = array(); |
| 1251 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1252 | - $realBoardCounts[$row['id_board']] = $row['local_last_msg']; |
|
| 1300 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1301 | + $realBoardCounts[$row['id_board']] = $row['local_last_msg']; |
|
| 1302 | + } |
|
| 1253 | 1303 | $smcFunc['db_free_result']($request); |
| 1254 | 1304 | |
| 1255 | 1305 | $request = $smcFunc['db_query']('', ' |
@@ -1269,18 +1319,20 @@ discard block |
||
| 1269 | 1319 | krsort($resort_me); |
| 1270 | 1320 | |
| 1271 | 1321 | $lastModifiedMsg = array(); |
| 1272 | - foreach ($resort_me as $rows) |
|
| 1273 | - foreach ($rows as $row) |
|
| 1322 | + foreach ($resort_me as $rows) { |
|
| 1323 | + foreach ($rows as $row) |
|
| 1274 | 1324 | { |
| 1275 | 1325 | // The latest message is the latest of the current board and its children. |
| 1276 | 1326 | if (isset($lastModifiedMsg[$row['id_board']])) |
| 1277 | 1327 | $curLastModifiedMsg = max($row['local_last_msg'], $lastModifiedMsg[$row['id_board']]); |
| 1278 | - else |
|
| 1279 | - $curLastModifiedMsg = $row['local_last_msg']; |
|
| 1328 | + } |
|
| 1329 | + else { |
|
| 1330 | + $curLastModifiedMsg = $row['local_last_msg']; |
|
| 1331 | + } |
|
| 1280 | 1332 | |
| 1281 | 1333 | // If what is and what should be the latest message differ, an update is necessary. |
| 1282 | - if ($row['local_last_msg'] != $row['id_last_msg'] || $curLastModifiedMsg != $row['id_msg_updated']) |
|
| 1283 | - $smcFunc['db_query']('', ' |
|
| 1334 | + if ($row['local_last_msg'] != $row['id_last_msg'] || $curLastModifiedMsg != $row['id_msg_updated']) { |
|
| 1335 | + $smcFunc['db_query']('', ' |
|
| 1284 | 1336 | UPDATE {db_prefix}boards |
| 1285 | 1337 | SET id_last_msg = {int:id_last_msg}, id_msg_updated = {int:id_msg_updated} |
| 1286 | 1338 | WHERE id_board = {int:id_board}', |
@@ -1290,12 +1342,14 @@ discard block |
||
| 1290 | 1342 | 'id_board' => $row['id_board'], |
| 1291 | 1343 | ) |
| 1292 | 1344 | ); |
| 1345 | + } |
|
| 1293 | 1346 | |
| 1294 | 1347 | // Parent boards inherit the latest modified message of their children. |
| 1295 | - if (isset($lastModifiedMsg[$row['id_parent']])) |
|
| 1296 | - $lastModifiedMsg[$row['id_parent']] = max($row['local_last_msg'], $lastModifiedMsg[$row['id_parent']]); |
|
| 1297 | - else |
|
| 1298 | - $lastModifiedMsg[$row['id_parent']] = $row['local_last_msg']; |
|
| 1348 | + if (isset($lastModifiedMsg[$row['id_parent']])) { |
|
| 1349 | + $lastModifiedMsg[$row['id_parent']] = max($row['local_last_msg'], $lastModifiedMsg[$row['id_parent']]); |
|
| 1350 | + } else { |
|
| 1351 | + $lastModifiedMsg[$row['id_parent']] = $row['local_last_msg']; |
|
| 1352 | + } |
|
| 1299 | 1353 | } |
| 1300 | 1354 | |
| 1301 | 1355 | // Update all the basic statistics. |
@@ -1367,8 +1421,9 @@ discard block |
||
| 1367 | 1421 | require_once($sourcedir . '/Subs-Auth.php'); |
| 1368 | 1422 | $members = findMembers($_POST['to']); |
| 1369 | 1423 | |
| 1370 | - if (empty($members)) |
|
| 1371 | - fatal_lang_error('reattribute_cannot_find_member'); |
|
| 1424 | + if (empty($members)) { |
|
| 1425 | + fatal_lang_error('reattribute_cannot_find_member'); |
|
| 1426 | + } |
|
| 1372 | 1427 | |
| 1373 | 1428 | $memID = array_shift($members); |
| 1374 | 1429 | $memID = $memID['id']; |
@@ -1398,8 +1453,9 @@ discard block |
||
| 1398 | 1453 | validateToken('admin-maint'); |
| 1399 | 1454 | |
| 1400 | 1455 | $groups = array(); |
| 1401 | - foreach ($_POST['groups'] as $id => $dummy) |
|
| 1402 | - $groups[] = (int) $id; |
|
| 1456 | + foreach ($_POST['groups'] as $id => $dummy) { |
|
| 1457 | + $groups[] = (int) $id; |
|
| 1458 | + } |
|
| 1403 | 1459 | $time_limit = (time() - ($_POST['maxdays'] * 24 * 3600)); |
| 1404 | 1460 | $where_vars = array( |
| 1405 | 1461 | 'time_limit' => $time_limit, |
@@ -1408,9 +1464,9 @@ discard block |
||
| 1408 | 1464 | { |
| 1409 | 1465 | $where = 'mem.date_registered < {int:time_limit} AND mem.is_activated = {int:is_activated}'; |
| 1410 | 1466 | $where_vars['is_activated'] = 0; |
| 1467 | + } else { |
|
| 1468 | + $where = 'mem.last_login < {int:time_limit} AND (mem.last_login != 0 OR mem.date_registered < {int:time_limit})'; |
|
| 1411 | 1469 | } |
| 1412 | - else |
|
| 1413 | - $where = 'mem.last_login < {int:time_limit} AND (mem.last_login != 0 OR mem.date_registered < {int:time_limit})'; |
|
| 1414 | 1470 | |
| 1415 | 1471 | // Need to get *all* groups then work out which (if any) we avoid. |
| 1416 | 1472 | $request = $smcFunc['db_query']('', ' |
@@ -1429,8 +1485,7 @@ discard block |
||
| 1429 | 1485 | { |
| 1430 | 1486 | $where .= ' AND mem.id_post_group != {int:id_post_group_' . $row['id_group'] . '}'; |
| 1431 | 1487 | $where_vars['id_post_group_' . $row['id_group']] = $row['id_group']; |
| 1432 | - } |
|
| 1433 | - else |
|
| 1488 | + } else |
|
| 1434 | 1489 | { |
| 1435 | 1490 | $where .= ' AND mem.id_group != {int:id_group_' . $row['id_group'] . '} AND FIND_IN_SET({int:id_group_' . $row['id_group'] . '}, mem.additional_groups) = 0'; |
| 1436 | 1491 | $where_vars['id_group_' . $row['id_group']] = $row['id_group']; |
@@ -1457,8 +1512,9 @@ discard block |
||
| 1457 | 1512 | $members = array(); |
| 1458 | 1513 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1459 | 1514 | { |
| 1460 | - if (!$row['is_mod'] || !in_array(3, $groups)) |
|
| 1461 | - $members[] = $row['id_member']; |
|
| 1515 | + if (!$row['is_mod'] || !in_array(3, $groups)) { |
|
| 1516 | + $members[] = $row['id_member']; |
|
| 1517 | + } |
|
| 1462 | 1518 | } |
| 1463 | 1519 | $smcFunc['db_free_result']($request); |
| 1464 | 1520 | |
@@ -1505,8 +1561,9 @@ discard block |
||
| 1505 | 1561 | ) |
| 1506 | 1562 | ); |
| 1507 | 1563 | |
| 1508 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
| 1509 | - $drafts[] = (int) $row[0]; |
|
| 1564 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
| 1565 | + $drafts[] = (int) $row[0]; |
|
| 1566 | + } |
|
| 1510 | 1567 | $smcFunc['db_free_result']($request); |
| 1511 | 1568 | |
| 1512 | 1569 | // If we have old drafts, remove them |
@@ -1549,8 +1606,9 @@ discard block |
||
| 1549 | 1606 | $sticky = isset($_POST['move_type_sticky']) || isset($_GET['sticky']); |
| 1550 | 1607 | |
| 1551 | 1608 | // No boards then this is your stop. |
| 1552 | - if (empty($id_board_from) || empty($id_board_to)) |
|
| 1553 | - return; |
|
| 1609 | + if (empty($id_board_from) || empty($id_board_to)) { |
|
| 1610 | + return; |
|
| 1611 | + } |
|
| 1554 | 1612 | |
| 1555 | 1613 | // The big WHERE clause |
| 1556 | 1614 | $conditions = 'WHERE t.id_board = {int:id_board_from} |
@@ -1598,18 +1656,20 @@ discard block |
||
| 1598 | 1656 | ); |
| 1599 | 1657 | list ($total_topics) = $smcFunc['db_fetch_row']($request); |
| 1600 | 1658 | $smcFunc['db_free_result']($request); |
| 1659 | + } else { |
|
| 1660 | + $total_topics = (int) $_REQUEST['totaltopics']; |
|
| 1601 | 1661 | } |
| 1602 | - else |
|
| 1603 | - $total_topics = (int) $_REQUEST['totaltopics']; |
|
| 1604 | 1662 | |
| 1605 | 1663 | // Seems like we need this here. |
| 1606 | 1664 | $context['continue_get_data'] = '?action=admin;area=maintain;sa=topics;activity=massmove;id_board_from=' . $id_board_from . ';id_board_to=' . $id_board_to . ';totaltopics=' . $total_topics . ';max_days=' . $max_days; |
| 1607 | 1665 | |
| 1608 | - if ($locked) |
|
| 1609 | - $context['continue_get_data'] .= ';locked'; |
|
| 1666 | + if ($locked) { |
|
| 1667 | + $context['continue_get_data'] .= ';locked'; |
|
| 1668 | + } |
|
| 1610 | 1669 | |
| 1611 | - if ($sticky) |
|
| 1612 | - $context['continue_get_data'] .= ';sticky'; |
|
| 1670 | + if ($sticky) { |
|
| 1671 | + $context['continue_get_data'] .= ';sticky'; |
|
| 1672 | + } |
|
| 1613 | 1673 | |
| 1614 | 1674 | $context['continue_get_data'] .= ';start=' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
| 1615 | 1675 | |
@@ -1630,8 +1690,9 @@ discard block |
||
| 1630 | 1690 | |
| 1631 | 1691 | // Get the ids. |
| 1632 | 1692 | $topics = array(); |
| 1633 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1634 | - $topics[] = $row['id_topic']; |
|
| 1693 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1694 | + $topics[] = $row['id_topic']; |
|
| 1695 | + } |
|
| 1635 | 1696 | |
| 1636 | 1697 | // Just return if we don't have any topics left to move. |
| 1637 | 1698 | if (empty($topics)) |
@@ -1722,9 +1783,9 @@ discard block |
||
| 1722 | 1783 | // save it so we don't do this again for this task |
| 1723 | 1784 | list ($_SESSION['total_members']) = $smcFunc['db_fetch_row']($request); |
| 1724 | 1785 | $smcFunc['db_free_result']($request); |
| 1786 | + } else { |
|
| 1787 | + validateToken('admin-recountposts'); |
|
| 1725 | 1788 | } |
| 1726 | - else |
|
| 1727 | - validateToken('admin-recountposts'); |
|
| 1728 | 1789 | |
| 1729 | 1790 | // Lets get a group of members and determine their post count (from the boards that have post count enabled of course). |
| 1730 | 1791 | $request = $smcFunc['db_query']('', ' |
@@ -1770,8 +1831,9 @@ discard block |
||
| 1770 | 1831 | createToken('admin-recountposts'); |
| 1771 | 1832 | $context['continue_post_data'] = '<input type="hidden" name="' . $context['admin-recountposts_token_var'] . '" value="' . $context['admin-recountposts_token'] . '">'; |
| 1772 | 1833 | |
| 1773 | - if (function_exists('apache_reset_timeout')) |
|
| 1774 | - apache_reset_timeout(); |
|
| 1834 | + if (function_exists('apache_reset_timeout')) { |
|
| 1835 | + apache_reset_timeout(); |
|
| 1836 | + } |
|
| 1775 | 1837 | return; |
| 1776 | 1838 | } |
| 1777 | 1839 | |
@@ -1857,10 +1919,9 @@ discard block |
||
| 1857 | 1919 | checkSession('request'); |
| 1858 | 1920 | validateToken('admin-hook', 'request'); |
| 1859 | 1921 | |
| 1860 | - if ($_REQUEST['do'] == 'remove') |
|
| 1861 | - remove_integration_function($_REQUEST['hook'], urldecode($_REQUEST['function'])); |
|
| 1862 | - |
|
| 1863 | - else |
|
| 1922 | + if ($_REQUEST['do'] == 'remove') { |
|
| 1923 | + remove_integration_function($_REQUEST['hook'], urldecode($_REQUEST['function'])); |
|
| 1924 | + } else |
|
| 1864 | 1925 | { |
| 1865 | 1926 | $function_remove = urldecode($_REQUEST['function']) . (($_REQUEST['do'] == 'disable') ? '' : '!'); |
| 1866 | 1927 | $function_add = urldecode($_REQUEST['function']) . (($_REQUEST['do'] == 'disable') ? '!' : ''); |
@@ -1910,11 +1971,11 @@ discard block |
||
| 1910 | 1971 | // Show a nice icon to indicate this is an instance. |
| 1911 | 1972 | $instance = (!empty($data['instance']) ? '<span class="generic_icons news" title="'. $txt['hooks_field_function_method'] .'"></span> ' : ''); |
| 1912 | 1973 | |
| 1913 | - if (!empty($data['included_file'])) |
|
| 1914 | - return $instance . $txt['hooks_field_function'] . ': ' . $data['real_function'] . '<br>' . $txt['hooks_field_included_file'] . ': ' . $data['included_file']; |
|
| 1915 | - |
|
| 1916 | - else |
|
| 1917 | - return $instance . $data['real_function']; |
|
| 1974 | + if (!empty($data['included_file'])) { |
|
| 1975 | + return $instance . $txt['hooks_field_function'] . ': ' . $data['real_function'] . '<br>' . $txt['hooks_field_included_file'] . ': ' . $data['included_file']; |
|
| 1976 | + } else { |
|
| 1977 | + return $instance . $data['real_function']; |
|
| 1978 | + } |
|
| 1918 | 1979 | }, |
| 1919 | 1980 | ), |
| 1920 | 1981 | 'sort' => array( |
@@ -1979,11 +2040,12 @@ discard block |
||
| 1979 | 2040 | 'data' => array( |
| 1980 | 2041 | 'function' => function ($data) use ($txt, $scripturl, $context) |
| 1981 | 2042 | { |
| 1982 | - if (!$data['hook_exists']) |
|
| 1983 | - return ' |
|
| 2043 | + if (!$data['hook_exists']) { |
|
| 2044 | + return ' |
|
| 1984 | 2045 | <a href="' . $scripturl . '?action=admin;area=maintain;sa=hooks;do=remove;hook=' . $data['hook_name'] . ';function=' . urlencode($data['function_name']) . $context['filter_url'] . ';' . $context['admin-hook_token_var'] . '=' . $context['admin-hook_token'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" data-confirm="' . $txt['quickmod_confirm'] . '" class="you_sure"> |
| 1985 | 2046 | <span class="generic_icons delete" title="' . $txt['hooks_button_remove'] . '"></span> |
| 1986 | 2047 | </a>'; |
| 2048 | + } |
|
| 1987 | 2049 | }, |
| 1988 | 2050 | 'class' => 'centertext', |
| 1989 | 2051 | ), |
@@ -2018,10 +2080,11 @@ discard block |
||
| 2018 | 2080 | { |
| 2019 | 2081 | if ($file != '.' && $file != '..') |
| 2020 | 2082 | { |
| 2021 | - if (is_dir($dir_path . '/' . $file)) |
|
| 2022 | - $files = array_merge($files, get_files_recursive($dir_path . '/' . $file)); |
|
| 2023 | - else |
|
| 2024 | - $files[] = array('dir' => $dir_path, 'name' => $file); |
|
| 2083 | + if (is_dir($dir_path . '/' . $file)) { |
|
| 2084 | + $files = array_merge($files, get_files_recursive($dir_path . '/' . $file)); |
|
| 2085 | + } else { |
|
| 2086 | + $files[] = array('dir' => $dir_path, 'name' => $file); |
|
| 2087 | + } |
|
| 2025 | 2088 | } |
| 2026 | 2089 | } |
| 2027 | 2090 | } |
@@ -2070,16 +2133,16 @@ discard block |
||
| 2070 | 2133 | // I need to know if there is at least one function called in this file. |
| 2071 | 2134 | $temp_data['include'][$hookParsedData['pureFunc']] = array('hook' => $hook, 'function' => $hookParsedData['pureFunc']); |
| 2072 | 2135 | unset($temp_hooks[$hook][$rawFunc]); |
| 2073 | - } |
|
| 2074 | - elseif (strpos(str_replace(' (', '(', $fc), 'function ' . trim($hookParsedData['pureFunc']) . '(') !== false) |
|
| 2136 | + } elseif (strpos(str_replace(' (', '(', $fc), 'function ' . trim($hookParsedData['pureFunc']) . '(') !== false) |
|
| 2075 | 2137 | { |
| 2076 | 2138 | $hook_status[$hook][$hookParsedData['pureFunc']] = $hookParsedData; |
| 2077 | 2139 | $hook_status[$hook][$hookParsedData['pureFunc']]['exists'] = true; |
| 2078 | 2140 | $hook_status[$hook][$hookParsedData['pureFunc']]['in_file'] = (!empty($file['name']) ? $file['name'] : (!empty($hookParsedData['hookFile']) ? $hookParsedData['hookFile'] : '')); |
| 2079 | 2141 | |
| 2080 | 2142 | // Does the hook has its own file? |
| 2081 | - if (!empty($hookParsedData['hookFile'])) |
|
| 2082 | - $temp_data['include'][$hookParsedData['pureFunc']] = array('hook' => $hook, 'function' => $hookParsedData['pureFunc']); |
|
| 2143 | + if (!empty($hookParsedData['hookFile'])) { |
|
| 2144 | + $temp_data['include'][$hookParsedData['pureFunc']] = array('hook' => $hook, 'function' => $hookParsedData['pureFunc']); |
|
| 2145 | + } |
|
| 2083 | 2146 | |
| 2084 | 2147 | // I want to remember all the functions called within this file (to check later if they are enabled or disabled and decide if the integrare_*_include of that file can be disabled too) |
| 2085 | 2148 | $temp_data['function'][$file['name']][$hookParsedData['pureFunc']] = $hookParsedData['enabled']; |
@@ -2106,15 +2169,17 @@ discard block |
||
| 2106 | 2169 | $sort = array(); |
| 2107 | 2170 | $hooks_filters = array(); |
| 2108 | 2171 | |
| 2109 | - foreach ($hooks as $hook => $functions) |
|
| 2110 | - $hooks_filters[] = '<option' . ($context['current_filter'] == $hook ? ' selected ' : '') . ' value="' . $hook . '">' . $hook . '</option>'; |
|
| 2172 | + foreach ($hooks as $hook => $functions) { |
|
| 2173 | + $hooks_filters[] = '<option' . ($context['current_filter'] == $hook ? ' selected ' : '') . ' value="' . $hook . '">' . $hook . '</option>'; |
|
| 2174 | + } |
|
| 2111 | 2175 | |
| 2112 | - if (!empty($hooks_filters)) |
|
| 2113 | - $context['insert_after_template'] .= ' |
|
| 2176 | + if (!empty($hooks_filters)) { |
|
| 2177 | + $context['insert_after_template'] .= ' |
|
| 2114 | 2178 | <script> |
| 2115 | 2179 | var hook_name_header = document.getElementById(\'header_list_integration_hooks_hook_name\'); |
| 2116 | 2180 | hook_name_header.innerHTML += ' . JavaScriptEscape('<select style="margin-left:15px;" onchange="window.location=(\'' . $scripturl . '?action=admin;area=maintain;sa=hooks\' + (this.value ? \';filter=\' + this.value : \'\'));"><option value="">' . $txt['hooks_reset_filter'] . '</option>' . implode('', $hooks_filters) . '</select>'). '; |
| 2117 | 2181 | </script>'; |
| 2182 | + } |
|
| 2118 | 2183 | |
| 2119 | 2184 | $temp_data = array(); |
| 2120 | 2185 | $id = 0; |
@@ -2157,10 +2222,11 @@ discard block |
||
| 2157 | 2222 | |
| 2158 | 2223 | foreach ($temp_data as $data) |
| 2159 | 2224 | { |
| 2160 | - if (++$counter < $start) |
|
| 2161 | - continue; |
|
| 2162 | - elseif ($counter == $start + $per_page) |
|
| 2163 | - break; |
|
| 2225 | + if (++$counter < $start) { |
|
| 2226 | + continue; |
|
| 2227 | + } elseif ($counter == $start + $per_page) { |
|
| 2228 | + break; |
|
| 2229 | + } |
|
| 2164 | 2230 | |
| 2165 | 2231 | $hooks_data[] = $data; |
| 2166 | 2232 | } |
@@ -2182,13 +2248,15 @@ discard block |
||
| 2182 | 2248 | $hooks_count = 0; |
| 2183 | 2249 | |
| 2184 | 2250 | $context['filter'] = false; |
| 2185 | - if (isset($_GET['filter'])) |
|
| 2186 | - $context['filter'] = $_GET['filter']; |
|
| 2251 | + if (isset($_GET['filter'])) { |
|
| 2252 | + $context['filter'] = $_GET['filter']; |
|
| 2253 | + } |
|
| 2187 | 2254 | |
| 2188 | 2255 | foreach ($hooks as $hook => $functions) |
| 2189 | 2256 | { |
| 2190 | - if (empty($context['filter']) || (!empty($context['filter']) && $context['filter'] == $hook)) |
|
| 2191 | - $hooks_count += count($functions); |
|
| 2257 | + if (empty($context['filter']) || (!empty($context['filter']) && $context['filter'] == $hook)) { |
|
| 2258 | + $hooks_count += count($functions); |
|
| 2259 | + } |
|
| 2192 | 2260 | } |
| 2193 | 2261 | |
| 2194 | 2262 | return $hooks_count; |
@@ -2209,8 +2277,9 @@ discard block |
||
| 2209 | 2277 | $integration_hooks = array(); |
| 2210 | 2278 | foreach ($modSettings as $key => $value) |
| 2211 | 2279 | { |
| 2212 | - if (!empty($value) && substr($key, 0, 10) === 'integrate_') |
|
| 2213 | - $integration_hooks[$key] = explode(',', $value); |
|
| 2280 | + if (!empty($value) && substr($key, 0, 10) === 'integrate_') { |
|
| 2281 | + $integration_hooks[$key] = explode(',', $value); |
|
| 2282 | + } |
|
| 2214 | 2283 | } |
| 2215 | 2284 | } |
| 2216 | 2285 | |
@@ -2241,8 +2310,9 @@ discard block |
||
| 2241 | 2310 | ); |
| 2242 | 2311 | |
| 2243 | 2312 | // Meh... |
| 2244 | - if (empty($rawData)) |
|
| 2245 | - return $hookData; |
|
| 2313 | + if (empty($rawData)) { |
|
| 2314 | + return $hookData; |
|
| 2315 | + } |
|
| 2246 | 2316 | |
| 2247 | 2317 | // For convenience purposes only! |
| 2248 | 2318 | $modFunc = $rawData; |
@@ -2253,11 +2323,11 @@ discard block |
||
| 2253 | 2323 | list ($hookData['hookFile'], $modFunc) = explode('|', $modFunc); |
| 2254 | 2324 | |
| 2255 | 2325 | // Does the file exists? who knows! |
| 2256 | - if (empty($settings['theme_dir'])) |
|
| 2257 | - $hookData['absPath'] = strtr(trim($hookData['hookFile']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir)); |
|
| 2258 | - |
|
| 2259 | - else |
|
| 2260 | - $hookData['absPath'] = strtr(trim($hookData['hookFile']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir'])); |
|
| 2326 | + if (empty($settings['theme_dir'])) { |
|
| 2327 | + $hookData['absPath'] = strtr(trim($hookData['hookFile']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir)); |
|
| 2328 | + } else { |
|
| 2329 | + $hookData['absPath'] = strtr(trim($hookData['hookFile']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir, '$themedir' => $settings['theme_dir'])); |
|
| 2330 | + } |
|
| 2261 | 2331 | |
| 2262 | 2332 | $hookData['fileExists'] = file_exists($hookData['absPath']); |
| 2263 | 2333 | $hookData['hookFile'] = basename($hookData['hookFile']); |
@@ -2282,11 +2352,10 @@ discard block |
||
| 2282 | 2352 | { |
| 2283 | 2353 | list ($hookData['class'], $hookData['method']) = explode('::', $modFunc); |
| 2284 | 2354 | $hookData['pureFunc'] = $hookData['method']; |
| 2355 | + } else { |
|
| 2356 | + $hookData['pureFunc'] = $modFunc; |
|
| 2285 | 2357 | } |
| 2286 | 2358 | |
| 2287 | - else |
|
| 2288 | - $hookData['pureFunc'] = $modFunc; |
|
| 2289 | - |
|
| 2290 | 2359 | return $hookData; |
| 2291 | 2360 | } |
| 2292 | 2361 | |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 3 |
| 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 | * Updates a report with the given parameters. Logs each action via logAction() |
@@ -28,19 +29,20 @@ discard block |
||
| 28 | 29 | global $smcFunc, $user_info, $context; |
| 29 | 30 | |
| 30 | 31 | // Don't bother. |
| 31 | - if (empty($action) || empty($report_id)) |
|
| 32 | - return false; |
|
| 32 | + if (empty($action) || empty($report_id)) { |
|
| 33 | + return false; |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | // Add the "_all" thingy. |
| 35 | - if ($action == 'ignore') |
|
| 36 | - $action = 'ignore_all'; |
|
| 37 | + if ($action == 'ignore') { |
|
| 38 | + $action = 'ignore_all'; |
|
| 39 | + } |
|
| 37 | 40 | |
| 38 | 41 | // We don't need the board query for reported members |
| 39 | 42 | if ($context['report_type'] == 'members') |
| 40 | 43 | { |
| 41 | 44 | $board_query = ''; |
| 42 | - } |
|
| 43 | - else |
|
| 45 | + } else |
|
| 44 | 46 | { |
| 45 | 47 | $board_query = ' AND ' . $user_info['mod_cache']['bq']; |
| 46 | 48 | } |
@@ -76,17 +78,17 @@ discard block |
||
| 76 | 78 | ) |
| 77 | 79 | ); |
| 78 | 80 | |
| 79 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 80 | - $extra[$row['id_report']] = array( |
|
| 81 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 82 | + $extra[$row['id_report']] = array( |
|
| 81 | 83 | 'report' => $row['id_report'], |
| 82 | 84 | 'board' => $row['id_board'], |
| 83 | 85 | 'message' => $row['id_msg'], |
| 84 | 86 | 'topic' => $row['id_topic'], |
| 85 | 87 | ); |
| 88 | + } |
|
| 86 | 89 | |
| 87 | 90 | $smcFunc['db_free_result']($request); |
| 88 | - } |
|
| 89 | - else |
|
| 91 | + } else |
|
| 90 | 92 | { |
| 91 | 93 | $request = $smcFunc['db_query']('', ' |
| 92 | 94 | SELECT id_report, id_member, membername |
@@ -97,28 +99,32 @@ discard block |
||
| 97 | 99 | ) |
| 98 | 100 | ); |
| 99 | 101 | |
| 100 | - while($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 101 | - $extra[$row['id_report']] = array( |
|
| 102 | + while($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 103 | + $extra[$row['id_report']] = array( |
|
| 102 | 104 | 'report' => $row['id_report'], |
| 103 | 105 | 'member' => $row['id_member'], |
| 104 | 106 | ); |
| 107 | + } |
|
| 105 | 108 | |
| 106 | 109 | $smcFunc['db_free_result']($request); |
| 107 | 110 | } |
| 108 | 111 | |
| 109 | 112 | // Back to "ignore". |
| 110 | - if ($action == 'ignore_all') |
|
| 111 | - $action = 'ignore'; |
|
| 113 | + if ($action == 'ignore_all') { |
|
| 114 | + $action = 'ignore'; |
|
| 115 | + } |
|
| 112 | 116 | |
| 113 | 117 | $log_report = $action == 'ignore' ? (!empty($value) ? 'ignore' : 'unignore') : (!empty($value) ? 'close' : 'open'); |
| 114 | 118 | |
| 115 | - if ($context['report_type'] == 'members') |
|
| 116 | - $log_report .= '_user'; |
|
| 119 | + if ($context['report_type'] == 'members') { |
|
| 120 | + $log_report .= '_user'; |
|
| 121 | + } |
|
| 117 | 122 | |
| 118 | 123 | // Log this action. |
| 119 | - if (!empty($extra)) |
|
| 120 | - foreach ($extra as $report) |
|
| 124 | + if (!empty($extra)) { |
|
| 125 | + foreach ($extra as $report) |
|
| 121 | 126 | logAction($log_report . '_report', $report); |
| 127 | + } |
|
| 122 | 128 | |
| 123 | 129 | // Time to update. |
| 124 | 130 | updateSettings(array('last_mod_report_action' => time())); |
@@ -142,14 +148,12 @@ discard block |
||
| 142 | 148 | if ($context['report_type'] == 'members') |
| 143 | 149 | { |
| 144 | 150 | $and = 'lr.id_board = 0'; |
| 145 | - } |
|
| 146 | - else |
|
| 151 | + } else |
|
| 147 | 152 | { |
| 148 | 153 | if ($user_info['mod_cache']['bq'] == '1=1' || $user_info['mod_cache']['bq'] == '0=1') |
| 149 | 154 | { |
| 150 | 155 | $bq = $user_info['mod_cache']['bq']; |
| 151 | - } |
|
| 152 | - else |
|
| 156 | + } else |
|
| 153 | 157 | { |
| 154 | 158 | $bq = 'lr.' . $user_info['mod_cache']['bq']; |
| 155 | 159 | } |
@@ -205,8 +209,7 @@ discard block |
||
| 205 | 209 | 'max' => 10, |
| 206 | 210 | ) |
| 207 | 211 | ); |
| 208 | - } |
|
| 209 | - else |
|
| 212 | + } else |
|
| 210 | 213 | { |
| 211 | 214 | $request = $smcFunc['db_query']('', ' |
| 212 | 215 | SELECT lr.id_report, lr.id_msg, lr.id_topic, lr.id_board, lr.id_member, lr.subject, lr.body, |
@@ -254,8 +257,7 @@ discard block |
||
| 254 | 257 | 'href' => $scripturl . '?action=profile;u=' . $row['id_user'], |
| 255 | 258 | ), |
| 256 | 259 | ); |
| 257 | - } |
|
| 258 | - else |
|
| 260 | + } else |
|
| 259 | 261 | { |
| 260 | 262 | $report_boards_ids[] = $row['id_board']; |
| 261 | 263 | $extraDetails = array( |
@@ -295,14 +297,16 @@ discard block |
||
| 295 | 297 | ) |
| 296 | 298 | ); |
| 297 | 299 | |
| 298 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 299 | - $board_names[$row['id_board']] = $row['name']; |
|
| 300 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 301 | + $board_names[$row['id_board']] = $row['name']; |
|
| 302 | + } |
|
| 300 | 303 | |
| 301 | 304 | $smcFunc['db_free_result']($request); |
| 302 | 305 | |
| 303 | - foreach ($reports as $id_report => $report) |
|
| 304 | - if (!empty($board_names[$report['topic']['id_board']])) |
|
| 306 | + foreach ($reports as $id_report => $report) { |
|
| 307 | + if (!empty($board_names[$report['topic']['id_board']])) |
|
| 305 | 308 | $reports[$id_report]['topic']['board_name'] = $board_names[$report['topic']['id_board']]; |
| 309 | + } |
|
| 306 | 310 | } |
| 307 | 311 | |
| 308 | 312 | // Now get all the people who reported it. |
@@ -352,10 +356,11 @@ discard block |
||
| 352 | 356 | { |
| 353 | 357 | global $user_info, $smcFunc; |
| 354 | 358 | |
| 355 | - if ($type == 'members') |
|
| 356 | - $bq = ''; |
|
| 357 | - else |
|
| 358 | - $bq = ' AND ' . $user_info['mod_cache']['bq']; |
|
| 359 | + if ($type == 'members') { |
|
| 360 | + $bq = ''; |
|
| 361 | + } else { |
|
| 362 | + $bq = ' AND ' . $user_info['mod_cache']['bq']; |
|
| 363 | + } |
|
| 359 | 364 | |
| 360 | 365 | $request = $smcFunc['db_query']('', ' |
| 361 | 366 | SELECT COUNT(*) |
@@ -394,8 +399,9 @@ discard block |
||
| 394 | 399 | { |
| 395 | 400 | global $smcFunc, $user_info, $context; |
| 396 | 401 | |
| 397 | - if (empty($report_id)) |
|
| 398 | - return false; |
|
| 402 | + if (empty($report_id)) { |
|
| 403 | + return false; |
|
| 404 | + } |
|
| 399 | 405 | |
| 400 | 406 | // We don't need all this info if we're only getting user info |
| 401 | 407 | if ($context['report_type'] == 'members') |
@@ -413,8 +419,7 @@ discard block |
||
| 413 | 419 | 'id_report' => $report_id, |
| 414 | 420 | ) |
| 415 | 421 | ); |
| 416 | - } |
|
| 417 | - else |
|
| 422 | + } else |
|
| 418 | 423 | { |
| 419 | 424 | // Get the report details, need this so we can limit access to a particular board. |
| 420 | 425 | $request = $smcFunc['db_query']('', ' |
@@ -433,8 +438,9 @@ discard block |
||
| 433 | 438 | } |
| 434 | 439 | |
| 435 | 440 | // So did we find anything? |
| 436 | - if (!$smcFunc['db_num_rows']($request)) |
|
| 437 | - return false; |
|
| 441 | + if (!$smcFunc['db_num_rows']($request)) { |
|
| 442 | + return false; |
|
| 443 | + } |
|
| 438 | 444 | |
| 439 | 445 | // Woohoo we found a report and they can see it! |
| 440 | 446 | $row = $smcFunc['db_fetch_assoc']($request); |
@@ -453,8 +459,9 @@ discard block |
||
| 453 | 459 | { |
| 454 | 460 | global $smcFunc, $scripturl, $user_info, $txt; |
| 455 | 461 | |
| 456 | - if (empty($report_id)) |
|
| 457 | - return false; |
|
| 462 | + if (empty($report_id)) { |
|
| 463 | + return false; |
|
| 464 | + } |
|
| 458 | 465 | |
| 459 | 466 | $report = array( |
| 460 | 467 | 'comments' => array(), |
@@ -537,8 +544,9 @@ discard block |
||
| 537 | 544 | |
| 538 | 545 | $comment = array(); |
| 539 | 546 | |
| 540 | - if (empty($comment_id)) |
|
| 541 | - return false; |
|
| 547 | + if (empty($comment_id)) { |
|
| 548 | + return false; |
|
| 549 | + } |
|
| 542 | 550 | |
| 543 | 551 | $request = $smcFunc['db_query']('', ' |
| 544 | 552 | SELECT id_comment, id_notice, log_time, body, id_member |
@@ -555,8 +563,9 @@ discard block |
||
| 555 | 563 | $smcFunc['db_free_result']($request); |
| 556 | 564 | |
| 557 | 565 | // Add the permission |
| 558 | - if (!empty($comment)) |
|
| 559 | - $comment['can_edit'] = allowedTo('admin_forum') || (($user_info['id'] == $comment['id_member'])); |
|
| 566 | + if (!empty($comment)) { |
|
| 567 | + $comment['can_edit'] = allowedTo('admin_forum') || (($user_info['id'] == $comment['id_member'])); |
|
| 568 | + } |
|
| 560 | 569 | |
| 561 | 570 | return $comment; |
| 562 | 571 | } |
@@ -572,8 +581,9 @@ discard block |
||
| 572 | 581 | { |
| 573 | 582 | global $smcFunc, $user_info, $context; |
| 574 | 583 | |
| 575 | - if (empty($data)) |
|
| 576 | - return false; |
|
| 584 | + if (empty($data)) { |
|
| 585 | + return false; |
|
| 586 | + } |
|
| 577 | 587 | |
| 578 | 588 | $data = array_merge(array($user_info['id'], $user_info['name'], 'reportc', ''), $data); |
| 579 | 589 | |
@@ -602,8 +612,7 @@ discard block |
||
| 602 | 612 | 'comment_id' => $last_comment, |
| 603 | 613 | 'time' => time(), |
| 604 | 614 | ); |
| 605 | - } |
|
| 606 | - else |
|
| 615 | + } else |
|
| 607 | 616 | { |
| 608 | 617 | $prefix = 'Msg'; |
| 609 | 618 | $data = array( |
@@ -619,14 +628,15 @@ discard block |
||
| 619 | 628 | } |
| 620 | 629 | |
| 621 | 630 | // And get ready to notify people. |
| 622 | - if (!empty($report)) |
|
| 623 | - $smcFunc['db_insert']('insert', |
|
| 631 | + if (!empty($report)) { |
|
| 632 | + $smcFunc['db_insert']('insert', |
|
| 624 | 633 | '{db_prefix}background_tasks', |
| 625 | 634 | array('task_file' => 'string', 'task_class' => 'string', 'task_data' => 'string', 'claimed_time' => 'int'), |
| 626 | 635 | array('$sourcedir/tasks/' . $prefix . 'ReportReply-Notify.php', $prefix . 'ReportReply_Notify_Background', json_encode($data), 0), |
| 627 | 636 | array('id_task') |
| 628 | 637 | ); |
| 629 | -} |
|
| 638 | + } |
|
| 639 | + } |
|
| 630 | 640 | |
| 631 | 641 | /** |
| 632 | 642 | * Saves the new information whenever a moderator comment is edited. |
@@ -639,8 +649,9 @@ discard block |
||
| 639 | 649 | { |
| 640 | 650 | global $smcFunc; |
| 641 | 651 | |
| 642 | - if (empty($comment_id) || empty($edited_comment)) |
|
| 643 | - return false; |
|
| 652 | + if (empty($comment_id) || empty($edited_comment)) { |
|
| 653 | + return false; |
|
| 654 | + } |
|
| 644 | 655 | |
| 645 | 656 | $smcFunc['db_query']('', ' |
| 646 | 657 | UPDATE {db_prefix}log_comments |
@@ -663,8 +674,9 @@ discard block |
||
| 663 | 674 | { |
| 664 | 675 | global $smcFunc; |
| 665 | 676 | |
| 666 | - if (empty($comment_id)) |
|
| 667 | - return false; |
|
| 677 | + if (empty($comment_id)) { |
|
| 678 | + return false; |
|
| 679 | + } |
|
| 668 | 680 | |
| 669 | 681 | $smcFunc['db_query']('', ' |
| 670 | 682 | DELETE FROM {db_prefix}log_comments |