@@ -56,7 +56,9 @@ discard block |
||
56 | 56 | |
57 | 57 | // We should have debug mode enabled, as well as something to display! |
58 | 58 | if ($db_show_debug !== true || !isset($this->_req->session->debug)) |
59 | - throw new Elk_Exception('no_access', false); |
|
59 | + { |
|
60 | + throw new Elk_Exception('no_access', false); |
|
61 | + } |
|
60 | 62 | |
61 | 63 | // Don't allow except for administrators. |
62 | 64 | isAllowedTo('admin_forum'); |
@@ -69,9 +71,12 @@ discard block |
||
69 | 71 | $debug->toggleViewQueries(); |
70 | 72 | |
71 | 73 | if (strpos($this->_req->session->old_url, 'action=viewquery') !== false) |
72 | - redirectexit(); |
|
73 | - else |
|
74 | - redirectexit($this->_req->session->old_url); |
|
74 | + { |
|
75 | + redirectexit(); |
|
76 | + } |
|
77 | + else { |
|
78 | + redirectexit($this->_req->session->old_url); |
|
79 | + } |
|
75 | 80 | } |
76 | 81 | |
77 | 82 | // Looking at a specific query? |
@@ -85,7 +85,9 @@ |
||
85 | 85 | |
86 | 86 | // Disable if invalid values would result |
87 | 87 | if (isset($this->_req->post->custom_avatar_enabled) && $this->_req->post->custom_avatar_enabled == 1 && (empty($this->_req->post->custom_avatar_dir) || empty($this->_req->post->custom_avatar_url))) |
88 | - $this->_req->post->custom_avatar_enabled = 0; |
|
88 | + { |
|
89 | + $this->_req->post->custom_avatar_enabled = 0; |
|
90 | + } |
|
89 | 91 | |
90 | 92 | $settingsForm->setConfigValues((array) $this->_req->post); |
91 | 93 | $settingsForm->save(); |
@@ -97,7 +97,9 @@ discard block |
||
97 | 97 | |
98 | 98 | // Some settings may not be enabled, disallow these from the tabs as appropriate. |
99 | 99 | if (empty($modSettings['messageIcons_enable'])) |
100 | - $context[$context['admin_menu_name']]['tab_data']['tabs']['editicons']['disabled'] = true; |
|
100 | + { |
|
101 | + $context[$context['admin_menu_name']]['tab_data']['tabs']['editicons']['disabled'] = true; |
|
102 | + } |
|
101 | 103 | |
102 | 104 | if (empty($modSettings['smiley_enable'])) |
103 | 105 | { |
@@ -141,7 +143,9 @@ discard block |
||
141 | 143 | |
142 | 144 | // Make sure that the smileys are in the right order after enabling them. |
143 | 145 | if (isset($this->_req->post->smiley_enable)) |
144 | - sortSmileyTable(); |
|
146 | + { |
|
147 | + sortSmileyTable(); |
|
148 | + } |
|
145 | 149 | |
146 | 150 | call_integration_hook('integrate_save_smiley_settings'); |
147 | 151 | |
@@ -220,12 +224,14 @@ discard block |
||
220 | 224 | $context['smiley_sets'] = explode(',', $modSettings['smiley_sets_known']); |
221 | 225 | $set_names = explode("\n", $modSettings['smiley_sets_names']); |
222 | 226 | foreach ($context['smiley_sets'] as $i => $set) |
223 | - $context['smiley_sets'][$i] = array( |
|
227 | + { |
|
228 | + $context['smiley_sets'][$i] = array( |
|
224 | 229 | 'id' => $i, |
225 | 230 | 'path' => htmlspecialchars($set, ENT_COMPAT, 'UTF-8'), |
226 | 231 | 'name' => htmlspecialchars(stripslashes($set_names[$i]), ENT_COMPAT, 'UTF-8'), |
227 | 232 | 'selected' => $set == $modSettings['smiley_sets_default'] |
228 | 233 | ); |
234 | + } |
|
229 | 235 | |
230 | 236 | // Importing any smileys from an existing set? |
231 | 237 | $this->_subActionImport(); |
@@ -362,7 +368,9 @@ discard block |
||
362 | 368 | foreach ($this->_req->post->smiley_set as $id => $val) |
363 | 369 | { |
364 | 370 | if (isset($set_paths[$id], $set_names[$id]) && !empty($id)) |
365 | - unset($set_paths[$id], $set_names[$id]); |
|
371 | + { |
|
372 | + unset($set_paths[$id], $set_names[$id]); |
|
373 | + } |
|
366 | 374 | } |
367 | 375 | |
368 | 376 | // Update the modsettings with the new values |
@@ -374,7 +382,9 @@ discard block |
||
374 | 382 | } |
375 | 383 | // Add a new smiley set. |
376 | 384 | elseif (!empty($this->_req->post->add)) |
377 | - $context['sub_action'] = 'modifyset'; |
|
385 | + { |
|
386 | + $context['sub_action'] = 'modifyset'; |
|
387 | + } |
|
378 | 388 | // Create or modify a smiley set. |
379 | 389 | elseif (isset($this->_req->post->set)) |
380 | 390 | { |
@@ -387,7 +397,9 @@ discard block |
||
387 | 397 | if ($set == -1 && isset($this->_req->post->smiley_sets_path)) |
388 | 398 | { |
389 | 399 | if (in_array($this->_req->post->smiley_sets_path, $set_paths)) |
390 | - throw new Elk_Exception('smiley_set_already_exists'); |
|
400 | + { |
|
401 | + throw new Elk_Exception('smiley_set_already_exists'); |
|
402 | + } |
|
391 | 403 | |
392 | 404 | updateSettings(array( |
393 | 405 | 'smiley_sets_known' => $modSettings['smiley_sets_known'] . ',' . $this->_req->post->smiley_sets_path, |
@@ -400,11 +412,15 @@ discard block |
||
400 | 412 | { |
401 | 413 | // Make sure the smiley set exists. |
402 | 414 | if (!isset($set_paths[$set]) || !isset($set_names[$set])) |
403 | - throw new Elk_Exception('smiley_set_not_found'); |
|
415 | + { |
|
416 | + throw new Elk_Exception('smiley_set_not_found'); |
|
417 | + } |
|
404 | 418 | |
405 | 419 | // Make sure the path is not yet used by another smileyset. |
406 | 420 | if (in_array($this->_req->post->smiley_sets_path, $set_paths) && $this->_req->post->smiley_sets_path != $set_paths[$set]) |
407 | - throw new Elk_Exception('smiley_set_path_already_used'); |
|
421 | + { |
|
422 | + throw new Elk_Exception('smiley_set_path_already_used'); |
|
423 | + } |
|
408 | 424 | |
409 | 425 | $set_paths[$set] = $this->_req->post->smiley_sets_path; |
410 | 426 | $set_names[$set] = $this->_req->post->smiley_sets_name; |
@@ -417,7 +433,9 @@ discard block |
||
417 | 433 | |
418 | 434 | // The user might have checked to also import smileys. |
419 | 435 | if (!empty($this->_req->post->smiley_sets_import)) |
420 | - $this->importSmileys($this->_req->post->smiley_sets_path); |
|
436 | + { |
|
437 | + $this->importSmileys($this->_req->post->smiley_sets_path); |
|
438 | + } |
|
421 | 439 | } |
422 | 440 | |
423 | 441 | // No matter what, reset the cache |
@@ -437,13 +455,15 @@ discard block |
||
437 | 455 | { |
438 | 456 | $set = $this->_req->getQuery('set', 'intval', -1); |
439 | 457 | if ($set == -1 || !isset($context['smiley_sets'][$set])) |
440 | - $context['current_set'] = array( |
|
458 | + { |
|
459 | + $context['current_set'] = array( |
|
441 | 460 | 'id' => '-1', |
442 | 461 | 'path' => '', |
443 | 462 | 'name' => '', |
444 | 463 | 'selected' => false, |
445 | 464 | 'is_new' => true, |
446 | 465 | ); |
466 | + } |
|
447 | 467 | else |
448 | 468 | { |
449 | 469 | $context['current_set'] = &$context['smiley_sets'][$set]; |
@@ -457,19 +477,25 @@ discard block |
||
457 | 477 | while ($entry = $dir->read()) |
458 | 478 | { |
459 | 479 | if (in_array(strrchr($entry, '.'), array('.jpg', '.gif', '.jpeg', '.png', '.webp'))) |
460 | - $smileys[strtolower($entry)] = $entry; |
|
480 | + { |
|
481 | + $smileys[strtolower($entry)] = $entry; |
|
482 | + } |
|
461 | 483 | } |
462 | 484 | $dir->close(); |
463 | 485 | |
464 | 486 | if (empty($smileys)) |
465 | - throw new Elk_Exception('smiley_set_dir_not_found', false, array($context['current_set']['name'])); |
|
487 | + { |
|
488 | + throw new Elk_Exception('smiley_set_dir_not_found', false, array($context['current_set']['name'])); |
|
489 | + } |
|
466 | 490 | |
467 | 491 | // Exclude the smileys that are already in the database. |
468 | 492 | $found = smileyExists($smileys); |
469 | 493 | foreach ($found as $smiley) |
470 | 494 | { |
471 | 495 | if (isset($smileys[$smiley])) |
472 | - unset($smileys[$smiley]); |
|
496 | + { |
|
497 | + unset($smileys[$smiley]); |
|
498 | + } |
|
473 | 499 | } |
474 | 500 | |
475 | 501 | $context['current_set']['can_import'] = count($smileys); |
@@ -487,12 +513,14 @@ discard block |
||
487 | 513 | while ($entry = $dir->read()) |
488 | 514 | { |
489 | 515 | if (!in_array($entry, array('.', '..')) && is_dir($modSettings['smileys_dir'] . '/' . $entry)) |
490 | - $context['smiley_set_dirs'][] = array( |
|
516 | + { |
|
517 | + $context['smiley_set_dirs'][] = array( |
|
491 | 518 | 'id' => $entry, |
492 | 519 | 'path' => $modSettings['smileys_dir'] . '/' . $entry, |
493 | 520 | 'selectable' => $entry == $context['current_set']['path'] || !in_array($entry, explode(',', $modSettings['smiley_sets_known'])), |
494 | 521 | 'current' => $entry == $context['current_set']['path'], |
495 | 522 | ); |
523 | + } |
|
496 | 524 | } |
497 | 525 | $dir->close(); |
498 | 526 | } |
@@ -516,7 +544,9 @@ discard block |
||
516 | 544 | |
517 | 545 | // Sanity check - then import. |
518 | 546 | if (isset($context['smiley_sets'][$set])) |
519 | - $this->importSmileys(un_htmlspecialchars($context['smiley_sets'][$set]['path'])); |
|
547 | + { |
|
548 | + $this->importSmileys(un_htmlspecialchars($context['smiley_sets'][$set]['path'])); |
|
549 | + } |
|
520 | 550 | |
521 | 551 | // Force the process to continue. |
522 | 552 | $context['sub_action'] = 'modifyset'; |
@@ -541,12 +571,14 @@ discard block |
||
541 | 571 | |
542 | 572 | $set_names = explode("\n", $modSettings['smiley_sets_names']); |
543 | 573 | foreach ($context['smiley_sets'] as $i => $set) |
544 | - $context['smiley_sets'][$i] = array( |
|
574 | + { |
|
575 | + $context['smiley_sets'][$i] = array( |
|
545 | 576 | 'id' => $i, |
546 | 577 | 'path' => htmlspecialchars($set, ENT_COMPAT, 'UTF-8'), |
547 | 578 | 'name' => htmlspecialchars(stripslashes($set_names[$i]), ENT_COMPAT, 'UTF-8'), |
548 | 579 | 'selected' => $set == $modSettings['smiley_sets_default'] |
549 | 580 | ); |
581 | + } |
|
550 | 582 | |
551 | 583 | // Submitting a form? |
552 | 584 | if (isset($this->_req->post->{$context['session_var']}, $this->_req->post->smiley_code)) |
@@ -563,11 +595,15 @@ discard block |
||
563 | 595 | |
564 | 596 | // Make sure some code was entered. |
565 | 597 | if (empty($this->_req->post->smiley_code)) |
566 | - throw new Elk_Exception('smiley_has_no_code'); |
|
598 | + { |
|
599 | + throw new Elk_Exception('smiley_has_no_code'); |
|
600 | + } |
|
567 | 601 | |
568 | 602 | // Check whether the new code has duplicates. It should be unique. |
569 | 603 | if (validateDuplicateSmiley($this->_req->post->smiley_code)) |
570 | - throw new Elk_Exception('smiley_not_unique'); |
|
604 | + { |
|
605 | + throw new Elk_Exception('smiley_not_unique'); |
|
606 | + } |
|
571 | 607 | |
572 | 608 | // If we are uploading - check all the smiley sets are writable! |
573 | 609 | if ($this->_req->post->method !== 'existing') |
@@ -576,39 +612,51 @@ discard block |
||
576 | 612 | foreach ($context['smiley_sets'] as $set) |
577 | 613 | { |
578 | 614 | if (!is_writable($context['smileys_dir'] . '/' . un_htmlspecialchars($set['path']))) |
579 | - $writeErrors[] = $set['path']; |
|
615 | + { |
|
616 | + $writeErrors[] = $set['path']; |
|
617 | + } |
|
580 | 618 | } |
581 | 619 | |
582 | 620 | if (!empty($writeErrors)) |
583 | - throw new Elk_Exception('smileys_upload_error_notwritable', true, array(implode(', ', $writeErrors))); |
|
621 | + { |
|
622 | + throw new Elk_Exception('smileys_upload_error_notwritable', true, array(implode(', ', $writeErrors))); |
|
623 | + } |
|
584 | 624 | } |
585 | 625 | |
586 | 626 | // Uploading just one smiley for all of them? |
587 | 627 | if (isset($this->_req->post->sameall) && isset($_FILES['uploadSmiley']['name']) && $_FILES['uploadSmiley']['name'] != '') |
588 | 628 | { |
589 | 629 | if (!is_uploaded_file($_FILES['uploadSmiley']['tmp_name']) || (ini_get('open_basedir') == '' && !file_exists($_FILES['uploadSmiley']['tmp_name']))) |
590 | - throw new Elk_Exception('smileys_upload_error'); |
|
630 | + { |
|
631 | + throw new Elk_Exception('smileys_upload_error'); |
|
632 | + } |
|
591 | 633 | |
592 | 634 | // Sorry, no spaces, dots, or anything else but letters allowed. |
593 | 635 | $_FILES['uploadSmiley']['name'] = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $_FILES['uploadSmiley']['name']); |
594 | 636 | |
595 | 637 | // We only allow image files - it's THAT simple - no messing around here... |
596 | 638 | if (!in_array(strtolower(substr(strrchr($_FILES['uploadSmiley']['name'], '.'), 1)), $allowedTypes)) |
597 | - throw new Elk_Exception('smileys_upload_error_types', false, array(implode(', ', $allowedTypes))); |
|
639 | + { |
|
640 | + throw new Elk_Exception('smileys_upload_error_types', false, array(implode(', ', $allowedTypes))); |
|
641 | + } |
|
598 | 642 | |
599 | 643 | // We only need the filename... |
600 | 644 | $destName = basename($_FILES['uploadSmiley']['name']); |
601 | 645 | |
602 | 646 | // Make sure they aren't trying to upload a nasty file - for their own good here! |
603 | 647 | if (in_array(strtolower($destName), $disabledFiles)) |
604 | - throw new Elk_Exception('smileys_upload_error_illegal'); |
|
648 | + { |
|
649 | + throw new Elk_Exception('smileys_upload_error_illegal'); |
|
650 | + } |
|
605 | 651 | |
606 | 652 | // Check if the file already exists... and if not move it to EVERY smiley set directory. |
607 | 653 | $i = 0; |
608 | 654 | |
609 | 655 | // Keep going until we find a set the file doesn't exist in. (or maybe it exists in all of them?) |
610 | 656 | while (isset($context['smiley_sets'][$i]) && file_exists($context['smileys_dir'] . '/' . un_htmlspecialchars($context['smiley_sets'][$i]['path']) . '/' . $destName)) |
611 | - $i++; |
|
657 | + { |
|
658 | + $i++; |
|
659 | + } |
|
612 | 660 | |
613 | 661 | // Okay, we're going to put the smiley right here, since it's not there yet! |
614 | 662 | if (isset($context['smiley_sets'][$i]['path'])) |
@@ -624,7 +672,9 @@ discard block |
||
624 | 672 | |
625 | 673 | // The file is already there! Don't overwrite it! |
626 | 674 | if (file_exists($currentPath)) |
627 | - continue; |
|
675 | + { |
|
676 | + continue; |
|
677 | + } |
|
628 | 678 | |
629 | 679 | // Okay, so copy the first one we made to here. |
630 | 680 | copy($smileyLocation, $currentPath); |
@@ -642,12 +692,18 @@ discard block |
||
642 | 692 | foreach ($_FILES as $name => $dummy) |
643 | 693 | { |
644 | 694 | if ($_FILES[$name]['name'] == '') |
645 | - throw new Elk_Exception('smileys_upload_error_blank'); |
|
695 | + { |
|
696 | + throw new Elk_Exception('smileys_upload_error_blank'); |
|
697 | + } |
|
646 | 698 | |
647 | 699 | if (empty($newName)) |
648 | - $newName = basename($_FILES[$name]['name']); |
|
700 | + { |
|
701 | + $newName = basename($_FILES[$name]['name']); |
|
702 | + } |
|
649 | 703 | elseif (basename($_FILES[$name]['name']) != $newName) |
650 | - throw new Elk_Exception('smileys_upload_error_name'); |
|
704 | + { |
|
705 | + throw new Elk_Exception('smileys_upload_error_name'); |
|
706 | + } |
|
651 | 707 | } |
652 | 708 | |
653 | 709 | foreach ($context['smiley_sets'] as $i => $set) |
@@ -656,30 +712,40 @@ discard block |
||
656 | 712 | $set['path'] = un_htmlspecialchars($set['path']); |
657 | 713 | |
658 | 714 | if (!isset($_FILES['individual_' . $set['name']]['name']) || $_FILES['individual_' . $set['name']]['name'] == '') |
659 | - continue; |
|
715 | + { |
|
716 | + continue; |
|
717 | + } |
|
660 | 718 | |
661 | 719 | // Got one... |
662 | 720 | if (!is_uploaded_file($_FILES['individual_' . $set['name']]['tmp_name']) || (ini_get('open_basedir') == '' && !file_exists($_FILES['individual_' . $set['name']]['tmp_name']))) |
663 | - throw new Elk_Exception('smileys_upload_error'); |
|
721 | + { |
|
722 | + throw new Elk_Exception('smileys_upload_error'); |
|
723 | + } |
|
664 | 724 | |
665 | 725 | // Sorry, no spaces, dots, or anything else but letters allowed. |
666 | 726 | $_FILES['individual_' . $set['name']]['name'] = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $_FILES['individual_' . $set['name']]['name']); |
667 | 727 | |
668 | 728 | // We only allow image files - it's THAT simple - no messing around here... |
669 | 729 | if (!in_array(strtolower(substr(strrchr($_FILES['individual_' . $set['name']]['name'], '.'), 1)), $allowedTypes)) |
670 | - throw new Elk_Exception('smileys_upload_error_types', false, array(implode(', ', $allowedTypes))); |
|
730 | + { |
|
731 | + throw new Elk_Exception('smileys_upload_error_types', false, array(implode(', ', $allowedTypes))); |
|
732 | + } |
|
671 | 733 | |
672 | 734 | // We only need the filename... |
673 | 735 | $destName = basename($_FILES['individual_' . $set['name']]['name']); |
674 | 736 | |
675 | 737 | // Make sure they aren't trying to upload a nasty file - for their own good here! |
676 | 738 | if (in_array(strtolower($destName), $disabledFiles)) |
677 | - throw new Elk_Exception('smileys_upload_error_illegal'); |
|
739 | + { |
|
740 | + throw new Elk_Exception('smileys_upload_error_illegal'); |
|
741 | + } |
|
678 | 742 | |
679 | 743 | // If the file exists - ignore it. |
680 | 744 | $smileyLocation = $context['smileys_dir'] . '/' . $set['path'] . '/' . $destName; |
681 | 745 | if (file_exists($smileyLocation)) |
682 | - continue; |
|
746 | + { |
|
747 | + continue; |
|
748 | + } |
|
683 | 749 | |
684 | 750 | // Finally - move the image! |
685 | 751 | move_uploaded_file($_FILES['individual_' . $set['name']]['tmp_name'], $smileyLocation); |
@@ -692,7 +758,9 @@ discard block |
||
692 | 758 | |
693 | 759 | // Also make sure a filename was given. |
694 | 760 | if (empty($this->_req->post->smiley_filename)) |
695 | - throw new Elk_Exception('smiley_has_no_filename'); |
|
761 | + { |
|
762 | + throw new Elk_Exception('smiley_has_no_filename'); |
|
763 | + } |
|
696 | 764 | |
697 | 765 | // Find the position on the right. |
698 | 766 | $smiley_order = '0'; |
@@ -702,7 +770,9 @@ discard block |
||
702 | 770 | $smiley_order = nextSmileyLocation($this->_req->post->smiley_location); |
703 | 771 | |
704 | 772 | if (empty($smiley_order)) |
705 | - $smiley_order = '0'; |
|
773 | + { |
|
774 | + $smiley_order = '0'; |
|
775 | + } |
|
706 | 776 | } |
707 | 777 | $param = array( |
708 | 778 | $this->_req->post->smiley_code, |
@@ -728,16 +798,20 @@ discard block |
||
728 | 798 | foreach ($context['smiley_sets'] as $smiley_set) |
729 | 799 | { |
730 | 800 | if (!file_exists($context['smileys_dir'] . '/' . un_htmlspecialchars($smiley_set['path']))) |
731 | - continue; |
|
801 | + { |
|
802 | + continue; |
|
803 | + } |
|
732 | 804 | |
733 | 805 | $dir = dir($context['smileys_dir'] . '/' . un_htmlspecialchars($smiley_set['path'])); |
734 | 806 | while ($entry = $dir->read()) |
735 | 807 | { |
736 | 808 | if (!in_array($entry, $context['filenames']) && in_array(strrchr($entry, '.'), array('.jpg', '.gif', '.jpeg', '.png', '.webp'))) |
737 | - $context['filenames'][strtolower($entry)] = array( |
|
809 | + { |
|
810 | + $context['filenames'][strtolower($entry)] = array( |
|
738 | 811 | 'id' => htmlspecialchars($entry, ENT_COMPAT, 'UTF-8'), |
739 | 812 | 'selected' => false, |
740 | 813 | ); |
814 | + } |
|
741 | 815 | } |
742 | 816 | $dir->close(); |
743 | 817 | } |
@@ -780,10 +854,14 @@ discard block |
||
780 | 854 | if (isset($this->_req->post->smiley_action) && !empty($this->_req->post->checked_smileys)) |
781 | 855 | { |
782 | 856 | foreach ($this->_req->post->checked_smileys as $id => $smiley_id) |
783 | - $this->_req->post->checked_smileys[$id] = (int) $smiley_id; |
|
857 | + { |
|
858 | + $this->_req->post->checked_smileys[$id] = (int) $smiley_id; |
|
859 | + } |
|
784 | 860 | |
785 | 861 | if ($this->_req->post->smiley_action == 'delete') |
786 | - deleteSmileys($this->_req->post->checked_smileys); |
|
862 | + { |
|
863 | + deleteSmileys($this->_req->post->checked_smileys); |
|
864 | + } |
|
787 | 865 | // Changing the status of the smiley? |
788 | 866 | else |
789 | 867 | { |
@@ -794,7 +872,9 @@ discard block |
||
794 | 872 | 'popup' => 2 |
795 | 873 | ); |
796 | 874 | if (isset($displayTypes[$this->_req->post->smiley_action])) |
797 | - updateSmileyDisplayType($this->_req->post->checked_smileys, $displayTypes[$this->_req->post->smiley_action]); |
|
875 | + { |
|
876 | + updateSmileyDisplayType($this->_req->post->checked_smileys, $displayTypes[$this->_req->post->smiley_action]); |
|
877 | + } |
|
798 | 878 | } |
799 | 879 | } |
800 | 880 | // Create/modify a smiley. |
@@ -804,7 +884,9 @@ discard block |
||
804 | 884 | |
805 | 885 | // Is it a delete? |
806 | 886 | if (!empty($this->_req->post->deletesmiley)) |
807 | - deleteSmileys(array($this->_req->post->smiley)); |
|
887 | + { |
|
888 | + deleteSmileys(array($this->_req->post->smiley)); |
|
889 | + } |
|
808 | 890 | // Otherwise an edit. |
809 | 891 | else |
810 | 892 | { |
@@ -814,15 +896,21 @@ discard block |
||
814 | 896 | |
815 | 897 | // Make sure some code was entered. |
816 | 898 | if (empty($this->_req->post->smiley_code)) |
817 | - throw new Elk_Exception('smiley_has_no_code'); |
|
899 | + { |
|
900 | + throw new Elk_Exception('smiley_has_no_code'); |
|
901 | + } |
|
818 | 902 | |
819 | 903 | // Also make sure a filename was given. |
820 | 904 | if (empty($this->_req->post->smiley_filename)) |
821 | - throw new Elk_Exception('smiley_has_no_filename'); |
|
905 | + { |
|
906 | + throw new Elk_Exception('smiley_has_no_filename'); |
|
907 | + } |
|
822 | 908 | |
823 | 909 | // Check whether the new code has duplicates. It should be unique. |
824 | 910 | if (validateDuplicateSmiley($this->_req->post->smiley_code, $this->_req->post->smiley)) |
825 | - throw new Elk_Exception('smiley_not_unique'); |
|
911 | + { |
|
912 | + throw new Elk_Exception('smiley_not_unique'); |
|
913 | + } |
|
826 | 914 | |
827 | 915 | $param = array( |
828 | 916 | 'smiley_location' => $this->_req->post->smiley_location, |
@@ -845,12 +933,14 @@ discard block |
||
845 | 933 | $context['smiley_sets'] = explode(',', $modSettings['smiley_sets_known']); |
846 | 934 | $set_names = explode("\n", $modSettings['smiley_sets_names']); |
847 | 935 | foreach ($context['smiley_sets'] as $i => $set) |
848 | - $context['smiley_sets'][$i] = array( |
|
936 | + { |
|
937 | + $context['smiley_sets'][$i] = array( |
|
849 | 938 | 'id' => $i, |
850 | 939 | 'path' => htmlspecialchars($set, ENT_COMPAT, 'UTF-8'), |
851 | 940 | 'name' => htmlspecialchars(stripslashes($set_names[$i]), ENT_COMPAT, 'UTF-8'), |
852 | 941 | 'selected' => $set == $modSettings['smiley_sets_default'] |
853 | 942 | ); |
943 | + } |
|
854 | 944 | |
855 | 945 | // Prepare overview of all (custom) smileys. |
856 | 946 | if ($context['sub_action'] == 'editsmileys') |
@@ -867,8 +957,10 @@ discard block |
||
867 | 957 | $smileyset_option_list = ' |
868 | 958 | <select name="set" onchange="changeSet(this.options[this.selectedIndex].value);">'; |
869 | 959 | foreach ($context['smiley_sets'] as $smiley_set) |
870 | - $smileyset_option_list .= ' |
|
960 | + { |
|
961 | + $smileyset_option_list .= ' |
|
871 | 962 | <option value="' . $smiley_set['path'] . '"' . ($modSettings['smiley_sets_default'] == $smiley_set['path'] ? ' selected="selected"' : '') . '>' . $smiley_set['name'] . '</option>'; |
963 | + } |
|
872 | 964 | $smileyset_option_list .= ' |
873 | 965 | </select>'; |
874 | 966 | |
@@ -932,11 +1024,16 @@ discard block |
||
932 | 1024 | global $txt; |
933 | 1025 | |
934 | 1026 | if (empty($rowData['hidden'])) |
935 | - return $txt['smileys_location_form']; |
|
1027 | + { |
|
1028 | + return $txt['smileys_location_form']; |
|
1029 | + } |
|
936 | 1030 | elseif ($rowData['hidden'] == 1) |
937 | - return $txt['smileys_location_hidden']; |
|
938 | - else |
|
939 | - return $txt['smileys_location_popup']; |
|
1031 | + { |
|
1032 | + return $txt['smileys_location_hidden']; |
|
1033 | + } |
|
1034 | + else { |
|
1035 | + return $txt['smileys_location_popup']; |
|
1036 | + } |
|
940 | 1037 | }, |
941 | 1038 | ), |
942 | 1039 | 'sort' => array( |
@@ -953,18 +1050,24 @@ discard block |
||
953 | 1050 | global $context, $txt, $modSettings; |
954 | 1051 | |
955 | 1052 | if (empty($modSettings['smileys_dir']) || !is_dir($modSettings['smileys_dir'])) |
956 | - return htmlspecialchars($rowData['description'], ENT_COMPAT, 'UTF-8'); |
|
1053 | + { |
|
1054 | + return htmlspecialchars($rowData['description'], ENT_COMPAT, 'UTF-8'); |
|
1055 | + } |
|
957 | 1056 | |
958 | 1057 | // Check if there are smileys missing in some sets. |
959 | 1058 | $missing_sets = array(); |
960 | 1059 | foreach ($context['smiley_sets'] as $smiley_set) |
961 | - if (!file_exists(sprintf('%1$s/%2$s/%3$s', $modSettings['smileys_dir'], $smiley_set['path'], $rowData['filename']))) |
|
1060 | + { |
|
1061 | + if (!file_exists(sprintf('%1$s/%2$s/%3$s', $modSettings['smileys_dir'], $smiley_set['path'], $rowData['filename']))) |
|
962 | 1062 | $missing_sets[] = $smiley_set['path']; |
1063 | + } |
|
963 | 1064 | |
964 | 1065 | $description = htmlspecialchars($rowData['description'], ENT_COMPAT, 'UTF-8'); |
965 | 1066 | |
966 | 1067 | if (!empty($missing_sets)) |
967 | - $description .= sprintf('<br /><span class="smalltext"><strong>%1$s:</strong> %2$s</span>', $txt['smileys_not_found_in_set'], implode(', ', $missing_sets)); |
|
1068 | + { |
|
1069 | + $description .= sprintf('<br /><span class="smalltext"><strong>%1$s:</strong> %2$s</span>', $txt['smileys_not_found_in_set'], implode(', ', $missing_sets)); |
|
1070 | + } |
|
968 | 1071 | |
969 | 1072 | return $description; |
970 | 1073 | }, |
@@ -1080,12 +1183,14 @@ discard block |
||
1080 | 1183 | $context['smiley_sets'] = explode(',', $modSettings['smiley_sets_known']); |
1081 | 1184 | $set_names = explode("\n", $modSettings['smiley_sets_names']); |
1082 | 1185 | foreach ($context['smiley_sets'] as $i => $set) |
1083 | - $context['smiley_sets'][$i] = array( |
|
1186 | + { |
|
1187 | + $context['smiley_sets'][$i] = array( |
|
1084 | 1188 | 'id' => $i, |
1085 | 1189 | 'path' => htmlspecialchars($set, ENT_COMPAT, 'UTF-8'), |
1086 | 1190 | 'name' => htmlspecialchars(stripslashes($set_names[$i]), ENT_COMPAT, 'UTF-8'), |
1087 | 1191 | 'selected' => $set == $modSettings['smiley_sets_default'] |
1088 | 1192 | ); |
1193 | + } |
|
1089 | 1194 | |
1090 | 1195 | $context['selected_set'] = $modSettings['smiley_sets_default']; |
1091 | 1196 | |
@@ -1096,16 +1201,20 @@ discard block |
||
1096 | 1201 | foreach ($context['smiley_sets'] as $smiley_set) |
1097 | 1202 | { |
1098 | 1203 | if (!file_exists($context['smileys_dir'] . '/' . un_htmlspecialchars($smiley_set['path']))) |
1099 | - continue; |
|
1204 | + { |
|
1205 | + continue; |
|
1206 | + } |
|
1100 | 1207 | |
1101 | 1208 | $dir = dir($context['smileys_dir'] . '/' . un_htmlspecialchars($smiley_set['path'])); |
1102 | 1209 | while ($entry = $dir->read()) |
1103 | 1210 | { |
1104 | 1211 | if (!in_array($entry, $context['filenames']) && in_array(strrchr($entry, '.'), array('.jpg', '.gif', '.jpeg', '.png', '.webp'))) |
1105 | - $context['filenames'][strtolower($entry)] = array( |
|
1212 | + { |
|
1213 | + $context['filenames'][strtolower($entry)] = array( |
|
1106 | 1214 | 'id' => htmlspecialchars($entry, ENT_COMPAT, 'UTF-8'), |
1107 | 1215 | 'selected' => false, |
1108 | 1216 | ); |
1217 | + } |
|
1109 | 1218 | } |
1110 | 1219 | $dir->close(); |
1111 | 1220 | } |
@@ -1119,7 +1228,9 @@ discard block |
||
1119 | 1228 | $context['current_smiley']['description'] = htmlspecialchars($context['current_smiley']['description'], ENT_COMPAT, 'UTF-8'); |
1120 | 1229 | |
1121 | 1230 | if (isset($context['filenames'][strtolower($context['current_smiley']['filename'])])) |
1122 | - $context['filenames'][strtolower($context['current_smiley']['filename'])]['selected'] = true; |
|
1231 | + { |
|
1232 | + $context['filenames'][strtolower($context['current_smiley']['filename'])]['selected'] = true; |
|
1233 | + } |
|
1123 | 1234 | } |
1124 | 1235 | } |
1125 | 1236 | |
@@ -1147,7 +1258,9 @@ discard block |
||
1147 | 1258 | { |
1148 | 1259 | $deleteIcons = array(); |
1149 | 1260 | foreach ($this->_req->post->checked_icons as $icon) |
1150 | - $deleteIcons[] = (int) $icon; |
|
1261 | + { |
|
1262 | + $deleteIcons[] = (int) $icon; |
|
1263 | + } |
|
1151 | 1264 | |
1152 | 1265 | // Do the actual delete! |
1153 | 1266 | deleteMessageIcons($deleteIcons); |
@@ -1159,36 +1272,50 @@ discard block |
||
1159 | 1272 | |
1160 | 1273 | // Do some preparation with the data... like check the icon exists *somewhere* |
1161 | 1274 | if (strpos($this->_req->post->icon_filename, '.png') !== false) |
1162 | - $this->_req->post->icon_filename = substr($this->_req->post->icon_filename, 0, -4); |
|
1275 | + { |
|
1276 | + $this->_req->post->icon_filename = substr($this->_req->post->icon_filename, 0, -4); |
|
1277 | + } |
|
1163 | 1278 | |
1164 | 1279 | if (!file_exists($settings['default_theme_dir'] . '/images/post/' . $this->_req->post->icon_filename . '.png')) |
1165 | - throw new Elk_Exception('icon_not_found'); |
|
1280 | + { |
|
1281 | + throw new Elk_Exception('icon_not_found'); |
|
1282 | + } |
|
1166 | 1283 | // There is a 16 character limit on message icons... |
1167 | 1284 | elseif (strlen($this->_req->post->icon_filename) > 16) |
1168 | - throw new Elk_Exception('icon_name_too_long'); |
|
1285 | + { |
|
1286 | + throw new Elk_Exception('icon_name_too_long'); |
|
1287 | + } |
|
1169 | 1288 | elseif ($this->_req->post->icon_location == $this->_req->query->icon && !empty($this->_req->query->icon)) |
1170 | - throw new Elk_Exception('icon_after_itself'); |
|
1289 | + { |
|
1290 | + throw new Elk_Exception('icon_after_itself'); |
|
1291 | + } |
|
1171 | 1292 | |
1172 | 1293 | // First do the sorting... if this is an edit reduce the order of everything after it by one ;) |
1173 | 1294 | if ($this->_req->query->icon != 0) |
1174 | 1295 | { |
1175 | 1296 | $oldOrder = $context['icons'][$this->_req->query->icon]['true_order']; |
1176 | 1297 | foreach ($context['icons'] as $id => $data) |
1177 | - if ($data['true_order'] > $oldOrder) |
|
1298 | + { |
|
1299 | + if ($data['true_order'] > $oldOrder) |
|
1178 | 1300 | $context['icons'][$id]['true_order']--; |
1301 | + } |
|
1179 | 1302 | } |
1180 | 1303 | |
1181 | 1304 | // If there are no existing icons and this is a new one, set the id to 1 (mainly for non-mysql) |
1182 | 1305 | if (empty($this->_req->query->icon) && empty($context['icons'])) |
1183 | - $this->_req->query->icon = 1; |
|
1306 | + { |
|
1307 | + $this->_req->query->icon = 1; |
|
1308 | + } |
|
1184 | 1309 | |
1185 | 1310 | // Get the new order. |
1186 | 1311 | $newOrder = $this->_req->post->icon_location == 0 ? 0 : $context['icons'][$this->_req->post->icon_location]['true_order'] + 1; |
1187 | 1312 | |
1188 | 1313 | // Do the same, but with the one that used to be after this icon, done to avoid conflict. |
1189 | 1314 | foreach ($context['icons'] as $id => $data) |
1190 | - if ($data['true_order'] >= $newOrder) |
|
1315 | + { |
|
1316 | + if ($data['true_order'] >= $newOrder) |
|
1191 | 1317 | $context['icons'][$id]['true_order']++; |
1318 | + } |
|
1192 | 1319 | |
1193 | 1320 | // Finally set the current icon's position! |
1194 | 1321 | $context['icons'][$this->_req->query->icon]['true_order'] = $newOrder; |
@@ -1204,15 +1331,20 @@ discard block |
||
1204 | 1331 | foreach ($context['icons'] as $id => $icon) |
1205 | 1332 | { |
1206 | 1333 | if ($id != 0) |
1207 | - $iconInsert[] = array($id, $icon['board_id'], $icon['title'], $icon['filename'], $icon['true_order']); |
|
1208 | - else |
|
1209 | - $iconInsert_new[] = array($icon['board_id'], $icon['title'], $icon['filename'], $icon['true_order']); |
|
1334 | + { |
|
1335 | + $iconInsert[] = array($id, $icon['board_id'], $icon['title'], $icon['filename'], $icon['true_order']); |
|
1336 | + } |
|
1337 | + else { |
|
1338 | + $iconInsert_new[] = array($icon['board_id'], $icon['title'], $icon['filename'], $icon['true_order']); |
|
1339 | + } |
|
1210 | 1340 | } |
1211 | 1341 | |
1212 | 1342 | updateMessageIcon($iconInsert); |
1213 | 1343 | |
1214 | 1344 | if (!empty($iconInsert_new)) |
1215 | - addMessageIcon($iconInsert_new); |
|
1345 | + { |
|
1346 | + addMessageIcon($iconInsert_new); |
|
1347 | + } |
|
1216 | 1348 | |
1217 | 1349 | // Flush the cache so the changes are reflected |
1218 | 1350 | Cache::instance()->remove('posting_icons-' . (int) $this->_req->post->icon_board); |
@@ -1223,7 +1355,9 @@ discard block |
||
1223 | 1355 | |
1224 | 1356 | // Unless we're adding a new thing, we'll escape |
1225 | 1357 | if (!isset($this->_req->post->add)) |
1226 | - redirectexit('action=admin;area=smileys;sa=editicons'); |
|
1358 | + { |
|
1359 | + redirectexit('action=admin;area=smileys;sa=editicons'); |
|
1360 | + } |
|
1227 | 1361 | } |
1228 | 1362 | |
1229 | 1363 | $context[$context['admin_menu_name']]['current_subsection'] = 'editicons'; |
@@ -1350,7 +1484,9 @@ discard block |
||
1350 | 1484 | |
1351 | 1485 | // Get the properties of the current icon from the icon list. |
1352 | 1486 | if (!$context['new_icon']) |
1353 | - $context['icon'] = $context['icons'][$this->_req->query->icon]; |
|
1487 | + { |
|
1488 | + $context['icon'] = $context['icons'][$this->_req->query->icon]; |
|
1489 | + } |
|
1354 | 1490 | |
1355 | 1491 | // Get a list of boards needed for assigning this icon to a specific board. |
1356 | 1492 | $boardListOptions = array( |
@@ -1380,7 +1516,9 @@ discard block |
||
1380 | 1516 | $this->_req->query->source = empty($this->_req->query->source) ? 0 : (int) $this->_req->query->source; |
1381 | 1517 | |
1382 | 1518 | if (empty($this->_req->query->source)) |
1383 | - throw new Elk_Exception('smiley_not_found'); |
|
1519 | + { |
|
1520 | + throw new Elk_Exception('smiley_not_found'); |
|
1521 | + } |
|
1384 | 1522 | |
1385 | 1523 | $smiley = array(); |
1386 | 1524 | |
@@ -1390,7 +1528,9 @@ discard block |
||
1390 | 1528 | |
1391 | 1529 | $smiley = getSmileyPosition($this->_req->query->location, $this->_req->query->after); |
1392 | 1530 | if (empty($smiley)) |
1393 | - throw new Elk_Exception('smiley_not_found'); |
|
1531 | + { |
|
1532 | + throw new Elk_Exception('smiley_not_found'); |
|
1533 | + } |
|
1394 | 1534 | } |
1395 | 1535 | else |
1396 | 1536 | { |
@@ -1407,13 +1547,15 @@ discard block |
||
1407 | 1547 | |
1408 | 1548 | // Make sure all rows are sequential. |
1409 | 1549 | foreach (array_keys($context['smileys']) as $location) |
1410 | - $context['smileys'][$location] = array( |
|
1550 | + { |
|
1551 | + $context['smileys'][$location] = array( |
|
1411 | 1552 | 'id' => $location, |
1412 | 1553 | 'title' => $location === 'postform' ? $txt['smileys_location_form'] : $txt['smileys_location_popup'], |
1413 | 1554 | 'description' => $location === 'postform' ? $txt['smileys_location_form_description'] : $txt['smileys_location_popup_description'], |
1414 | 1555 | 'last_row' => count($context['smileys'][$location]['rows']), |
1415 | 1556 | 'rows' => array_values($context['smileys'][$location]['rows']), |
1416 | 1557 | ); |
1558 | + } |
|
1417 | 1559 | |
1418 | 1560 | // Check & fix smileys that are not ordered properly in the database. |
1419 | 1561 | foreach (array_keys($context['smileys']) as $location) |
@@ -1430,8 +1572,10 @@ discard block |
||
1430 | 1572 | |
1431 | 1573 | // Make sure the smiley order is always sequential. |
1432 | 1574 | foreach ($smiley_row as $order_id => $smiley) |
1433 | - if ($order_id != $smiley['order']) |
|
1575 | + { |
|
1576 | + if ($order_id != $smiley['order']) |
|
1434 | 1577 | updateSmileyOrder($smiley['id'], $order_id); |
1578 | + } |
|
1435 | 1579 | } |
1436 | 1580 | } |
1437 | 1581 | |
@@ -1471,12 +1615,16 @@ discard block |
||
1471 | 1615 | |
1472 | 1616 | // Check that the smiley is from simplemachines.org, for now... maybe add mirroring later. |
1473 | 1617 | if (!isAuthorizedServer($this->_req->query->set_gz) == 0) |
1474 | - throw new Elk_Exception('not_valid_server'); |
|
1618 | + { |
|
1619 | + throw new Elk_Exception('not_valid_server'); |
|
1620 | + } |
|
1475 | 1621 | |
1476 | 1622 | $destination = BOARDDIR . '/packages/' . $base_name; |
1477 | 1623 | |
1478 | 1624 | if (file_exists($destination)) |
1479 | - throw new Elk_Exception('package_upload_error_exists'); |
|
1625 | + { |
|
1626 | + throw new Elk_Exception('package_upload_error_exists'); |
|
1627 | + } |
|
1480 | 1628 | |
1481 | 1629 | // Let's copy it to the packages directory |
1482 | 1630 | file_put_contents($destination, fetch_web_data($this->_req->query->set_gz)); |
@@ -1492,11 +1640,15 @@ discard block |
||
1492 | 1640 | } |
1493 | 1641 | |
1494 | 1642 | if (!file_exists($destination)) |
1495 | - throw new Elk_Exception('package_no_file', false); |
|
1643 | + { |
|
1644 | + throw new Elk_Exception('package_no_file', false); |
|
1645 | + } |
|
1496 | 1646 | |
1497 | 1647 | // Make sure temp directory exists and is empty. |
1498 | 1648 | if (file_exists(BOARDDIR . '/packages/temp')) |
1499 | - deltree(BOARDDIR . '/packages/temp', false); |
|
1649 | + { |
|
1650 | + deltree(BOARDDIR . '/packages/temp', false); |
|
1651 | + } |
|
1500 | 1652 | |
1501 | 1653 | if (!mktree(BOARDDIR . '/packages/temp', 0755)) |
1502 | 1654 | { |
@@ -1509,7 +1661,9 @@ discard block |
||
1509 | 1661 | |
1510 | 1662 | deltree(BOARDDIR . '/packages/temp', false); |
1511 | 1663 | if (!mktree(BOARDDIR . '/packages/temp', 0777)) |
1512 | - throw new Elk_Exception('package_cant_download', false); |
|
1664 | + { |
|
1665 | + throw new Elk_Exception('package_cant_download', false); |
|
1666 | + } |
|
1513 | 1667 | } |
1514 | 1668 | } |
1515 | 1669 | |
@@ -1517,7 +1671,9 @@ discard block |
||
1517 | 1671 | |
1518 | 1672 | // @todo needs to change the URL in the next line ;) |
1519 | 1673 | if (!$extracted) |
1520 | - throw new Elk_Exception('packageget_unable', false, array('http://custom.elkarte.net/index.php?action=search;type=12;basic_search=' . $name)); |
|
1674 | + { |
|
1675 | + throw new Elk_Exception('packageget_unable', false, array('http://custom.elkarte.net/index.php?action=search;type=12;basic_search=' . $name)); |
|
1676 | + } |
|
1521 | 1677 | |
1522 | 1678 | if ($extracted && !file_exists(BOARDDIR . '/packages/temp/package-info.xml')) |
1523 | 1679 | { |
@@ -1532,18 +1688,26 @@ discard block |
||
1532 | 1688 | } |
1533 | 1689 | |
1534 | 1690 | if (!isset($base_path)) |
1535 | - $base_path = ''; |
|
1691 | + { |
|
1692 | + $base_path = ''; |
|
1693 | + } |
|
1536 | 1694 | |
1537 | 1695 | if (!file_exists(BOARDDIR . '/packages/temp/' . $base_path . 'package-info.xml')) |
1538 | - throw new Elk_Exception('package_get_error_missing_xml', false); |
|
1696 | + { |
|
1697 | + throw new Elk_Exception('package_get_error_missing_xml', false); |
|
1698 | + } |
|
1539 | 1699 | |
1540 | 1700 | $smileyInfo = getPackageInfo($context['filename']); |
1541 | 1701 | if (!is_array($smileyInfo)) |
1542 | - throw new Elk_Exception($smileyInfo); |
|
1702 | + { |
|
1703 | + throw new Elk_Exception($smileyInfo); |
|
1704 | + } |
|
1543 | 1705 | |
1544 | 1706 | // See if it is installed? |
1545 | 1707 | if (isSmileySetInstalled($smileyInfo['id'])) |
1546 | - \Errors::instance()->fatal_lang_error('package_installed_warning1'); |
|
1708 | + { |
|
1709 | + \Errors::instance()->fatal_lang_error('package_installed_warning1'); |
|
1710 | + } |
|
1547 | 1711 | |
1548 | 1712 | // Everything is fine, now it's time to do something, first we test |
1549 | 1713 | $actions = parsePackageInfo($smileyInfo['xml'], true, 'install'); |
@@ -1561,9 +1725,13 @@ discard block |
||
1561 | 1725 | { |
1562 | 1726 | $type = 'package_' . $action['type']; |
1563 | 1727 | if (file_exists(BOARDDIR . '/packages/temp/' . $base_path . $action['filename'])) |
1564 | - $context[$type] = htmlspecialchars(trim(file_get_contents(BOARDDIR . '/packages/temp/' . $base_path . $action['filename']), "\n\r"), ENT_COMPAT, 'UTF-8'); |
|
1728 | + { |
|
1729 | + $context[$type] = htmlspecialchars(trim(file_get_contents(BOARDDIR . '/packages/temp/' . $base_path . $action['filename']), "\n\r"), ENT_COMPAT, 'UTF-8'); |
|
1730 | + } |
|
1565 | 1731 | elseif (file_exists($action['filename'])) |
1566 | - $context[$type] = htmlspecialchars(trim(file_get_contents($action['filename']), "\n\r"), ENT_COMPAT, 'UTF-8'); |
|
1732 | + { |
|
1733 | + $context[$type] = htmlspecialchars(trim(file_get_contents($action['filename']), "\n\r"), ENT_COMPAT, 'UTF-8'); |
|
1734 | + } |
|
1567 | 1735 | |
1568 | 1736 | if (!empty($action['parse_bbc'])) |
1569 | 1737 | { |
@@ -1571,8 +1739,9 @@ discard block |
||
1571 | 1739 | preparsecode($context[$type]); |
1572 | 1740 | $context[$type] = $bbc_parser->parsePackage($context[$type]); |
1573 | 1741 | } |
1574 | - else |
|
1575 | - $context[$type] = nl2br($context[$type]); |
|
1742 | + else { |
|
1743 | + $context[$type] = nl2br($context[$type]); |
|
1744 | + } |
|
1576 | 1745 | |
1577 | 1746 | continue; |
1578 | 1747 | } |
@@ -1597,7 +1766,9 @@ discard block |
||
1597 | 1766 | |
1598 | 1767 | // Show a description for the action if one is provided |
1599 | 1768 | if (empty($thisAction['description'])) |
1600 | - $thisAction['description'] = isset($action['description']) ? $action['description'] : ''; |
|
1769 | + { |
|
1770 | + $thisAction['description'] = isset($action['description']) ? $action['description'] : ''; |
|
1771 | + } |
|
1601 | 1772 | |
1602 | 1773 | $context['actions'][] = $thisAction; |
1603 | 1774 | } |
@@ -1656,10 +1827,14 @@ discard block |
||
1656 | 1827 | } |
1657 | 1828 | |
1658 | 1829 | if (file_exists(BOARDDIR . '/packages/temp')) |
1659 | - deltree(BOARDDIR . '/packages/temp'); |
|
1830 | + { |
|
1831 | + deltree(BOARDDIR . '/packages/temp'); |
|
1832 | + } |
|
1660 | 1833 | |
1661 | 1834 | if (!$testing) |
1662 | - redirectexit('action=admin;area=smileys'); |
|
1835 | + { |
|
1836 | + redirectexit('action=admin;area=smileys'); |
|
1837 | + } |
|
1663 | 1838 | } |
1664 | 1839 | |
1665 | 1840 | /** |
@@ -1675,7 +1850,9 @@ discard block |
||
1675 | 1850 | $smiley_context = array(); |
1676 | 1851 | |
1677 | 1852 | foreach ($smiley_sets as $i => $set) |
1678 | - $smiley_context[$set] = stripslashes($set_names[$i]); |
|
1853 | + { |
|
1854 | + $smiley_context[$set] = stripslashes($set_names[$i]); |
|
1855 | + } |
|
1679 | 1856 | |
1680 | 1857 | $this->_smiley_context = $smiley_context; |
1681 | 1858 | } |
@@ -1694,14 +1871,18 @@ discard block |
||
1694 | 1871 | require_once(SUBSDIR . '/Smileys.subs.php'); |
1695 | 1872 | |
1696 | 1873 | if (empty($modSettings['smileys_dir']) || !is_dir($modSettings['smileys_dir'] . '/' . $smileyPath)) |
1697 | - throw new Elk_Exception('smiley_set_unable_to_import'); |
|
1874 | + { |
|
1875 | + throw new Elk_Exception('smiley_set_unable_to_import'); |
|
1876 | + } |
|
1698 | 1877 | |
1699 | 1878 | $smileys = array(); |
1700 | 1879 | $dir = dir($modSettings['smileys_dir'] . '/' . $smileyPath); |
1701 | 1880 | while ($entry = $dir->read()) |
1702 | 1881 | { |
1703 | 1882 | if (in_array(strrchr($entry, '.'), array('.jpg', '.gif', '.jpeg', '.png', '.webp'))) |
1704 | - $smileys[strtolower($entry)] = $entry; |
|
1883 | + { |
|
1884 | + $smileys[strtolower($entry)] = $entry; |
|
1885 | + } |
|
1705 | 1886 | } |
1706 | 1887 | $dir->close(); |
1707 | 1888 | |
@@ -1711,15 +1892,19 @@ discard block |
||
1711 | 1892 | foreach ($duplicates as $duplicate) |
1712 | 1893 | { |
1713 | 1894 | if (isset($smileys[strtolower($duplicate)])) |
1714 | - unset($smileys[strtolower($duplicate)]); |
|
1895 | + { |
|
1896 | + unset($smileys[strtolower($duplicate)]); |
|
1897 | + } |
|
1715 | 1898 | } |
1716 | 1899 | |
1717 | 1900 | $smiley_order = getMaxSmileyOrder(); |
1718 | 1901 | |
1719 | 1902 | $new_smileys = array(); |
1720 | 1903 | foreach ($smileys as $smiley) |
1721 | - if (strlen($smiley) <= 48) |
|
1904 | + { |
|
1905 | + if (strlen($smiley) <= 48) |
|
1722 | 1906 | $new_smileys[] = array(':' . strtok($smiley, '.') . ':', $smiley, strtok($smiley, '.'), 0, ++$smiley_order); |
1907 | + } |
|
1723 | 1908 | |
1724 | 1909 | if (!empty($new_smileys)) |
1725 | 1910 | { |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | 'class' => 'centertext', |
256 | 256 | ), |
257 | 257 | 'data' => array( |
258 | - 'function' => function ($rowData) { |
|
258 | + 'function' => function($rowData) { |
|
259 | 259 | return $rowData['selected'] ? '<i class="icon i-check"></i>' : ''; |
260 | 260 | }, |
261 | 261 | 'class' => 'centertext', |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | 'class' => 'centertext', |
313 | 313 | ), |
314 | 314 | 'data' => array( |
315 | - 'function' => function ($rowData) { |
|
315 | + 'function' => function($rowData) { |
|
316 | 316 | return $rowData['id'] == 0 ? '' : sprintf('<input type="checkbox" name="smiley_set[%1$d]" class="input_check" />', $rowData['id']); |
317 | 317 | }, |
318 | 318 | 'class' => 'centertext', |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | 'value' => $txt['smileys_location'], |
929 | 929 | ), |
930 | 930 | 'data' => array( |
931 | - 'function' => function ($rowData) { |
|
931 | + 'function' => function($rowData) { |
|
932 | 932 | global $txt; |
933 | 933 | |
934 | 934 | if (empty($rowData['hidden'])) |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | 'value' => $txt['smileys_description'], |
950 | 950 | ), |
951 | 951 | 'data' => array( |
952 | - 'function' => function ($rowData) { |
|
952 | + 'function' => function($rowData) { |
|
953 | 953 | global $context, $txt, $modSettings; |
954 | 954 | |
955 | 955 | if (empty($modSettings['smileys_dir']) || !is_dir($modSettings['smileys_dir'])) |
@@ -100,7 +100,9 @@ discard block |
||
100 | 100 | |
101 | 101 | // If it's not got a sa set it must have come here for first time, pretend error log should be reversed. |
102 | 102 | if (!isset($this->_req->query->sa)) |
103 | - $this->_req->query->desc = true; |
|
103 | + { |
|
104 | + $this->_req->query->desc = true; |
|
105 | + } |
|
104 | 106 | |
105 | 107 | // Set up the action control |
106 | 108 | $action = new Action('manage_logs'); |
@@ -152,14 +154,17 @@ discard block |
||
152 | 154 | foreach ($config_vars as $index => $dummy) |
153 | 155 | { |
154 | 156 | if (!is_array($dummy) || $index == 'pruningOptions') |
155 | - continue; |
|
157 | + { |
|
158 | + continue; |
|
159 | + } |
|
156 | 160 | |
157 | 161 | $vals[] = empty($this->_req->post->{$dummy[1]}) || $this->_req->post->{$dummy[1]} < 0 ? 0 : $this->_req->getPost($dummy[1], 'intval'); |
158 | 162 | } |
159 | 163 | $_POST['pruningOptions'] = implode(',', $vals); |
160 | 164 | } |
161 | - else |
|
162 | - $_POST['pruningOptions'] = ''; |
|
165 | + else { |
|
166 | + $_POST['pruningOptions'] = ''; |
|
167 | + } |
|
163 | 168 | |
164 | 169 | $settingsForm->setConfigVars($savevar); |
165 | 170 | $settingsForm->setConfigValues((array) $_POST); |
@@ -173,9 +178,12 @@ discard block |
||
173 | 178 | |
174 | 179 | // Get the actual values |
175 | 180 | if (!empty($modSettings['pruningOptions'])) |
176 | - list ($modSettings['pruneErrorLog'], $modSettings['pruneModLog'], $modSettings['pruneBanLog'], $modSettings['pruneReportLog'], $modSettings['pruneScheduledTaskLog'], $modSettings['pruneBadbehaviorLog'], $modSettings['pruneSpiderHitLog']) = array_pad(explode(',', $modSettings['pruningOptions']), 7, 0); |
|
177 | - else |
|
178 | - $modSettings['pruneErrorLog'] = $modSettings['pruneModLog'] = $modSettings['pruneBanLog'] = $modSettings['pruneReportLog'] = $modSettings['pruneScheduledTaskLog'] = $modSettings['pruneBadbehaviorLog'] = $modSettings['pruneSpiderHitLog'] = 0; |
|
181 | + { |
|
182 | + list ($modSettings['pruneErrorLog'], $modSettings['pruneModLog'], $modSettings['pruneBanLog'], $modSettings['pruneReportLog'], $modSettings['pruneScheduledTaskLog'], $modSettings['pruneBadbehaviorLog'], $modSettings['pruneSpiderHitLog']) = array_pad(explode(',', $modSettings['pruningOptions']), 7, 0); |
|
183 | + } |
|
184 | + else { |
|
185 | + $modSettings['pruneErrorLog'] = $modSettings['pruneModLog'] = $modSettings['pruneBanLog'] = $modSettings['pruneReportLog'] = $modSettings['pruneScheduledTaskLog'] = $modSettings['pruneBadbehaviorLog'] = $modSettings['pruneSpiderHitLog'] = 0; |
|
186 | + } |
|
179 | 187 | |
180 | 188 | $settingsForm->prepare(); |
181 | 189 | } |
@@ -104,7 +104,9 @@ discard block |
||
104 | 104 | // Set an id if none was supplied |
105 | 105 | $id = $this->_req->getQuery('e_id', 'intval', 0); |
106 | 106 | if (empty($id) || $id <= 0) |
107 | - $id = 0; |
|
107 | + { |
|
108 | + $id = 0; |
|
109 | + } |
|
108 | 110 | |
109 | 111 | createToken('admin-ml', 'get'); |
110 | 112 | |
@@ -147,9 +149,12 @@ discard block |
||
147 | 149 | 'function' => function ($rowData) { |
148 | 150 | $error = $rowData['error_code']; |
149 | 151 | if ($error === 'error_pm_not_found') |
150 | - return '<span class="error">' . $rowData['error'] . '<span>'; |
|
151 | - else |
|
152 | - return $rowData['error']; |
|
152 | + { |
|
153 | + return '<span class="error">' . $rowData['error'] . '<span>'; |
|
154 | + } |
|
155 | + else { |
|
156 | + return $rowData['error']; |
|
157 | + } |
|
153 | 158 | }, |
154 | 159 | ), |
155 | 160 | 'sort' => array( |
@@ -222,16 +227,23 @@ discard block |
||
222 | 227 | |
223 | 228 | // Do we have a type? |
224 | 229 | if (empty($rowData['type'])) |
225 | - return $txt['not_applicable']; |
|
230 | + { |
|
231 | + return $txt['not_applicable']; |
|
232 | + } |
|
226 | 233 | // Personal? |
227 | 234 | elseif ($rowData['type'] === 'p') |
228 | - return $txt['personal_message']; |
|
235 | + { |
|
236 | + return $txt['personal_message']; |
|
237 | + } |
|
229 | 238 | // New Topic? |
230 | 239 | elseif ($rowData['type'] === 'x') |
231 | - return $txt['new_topic']; |
|
240 | + { |
|
241 | + return $txt['new_topic']; |
|
242 | + } |
|
232 | 243 | // Ah a Reply then |
233 | - else |
|
234 | - return $txt['topic'] . ' ' . $txt['reply']; |
|
244 | + else { |
|
245 | + return $txt['topic'] . ' ' . $txt['reply']; |
|
246 | + } |
|
235 | 247 | }, |
236 | 248 | ), |
237 | 249 | 'sort' => array( |
@@ -252,9 +264,12 @@ discard block |
||
252 | 264 | $security = $context['session_var'] . '=' . $context['session_id'] . ';' . $context['admin-ml_token_var'] . '=' . $context['admin-ml_token']; |
253 | 265 | |
254 | 266 | if ($rowData['error_code'] === 'error_pm_not_found') |
255 | - $commands[] = '<a href="?action=admin;area=maillist;sa=approve;item=' . $id . $security . '" onclick="return confirm(' . JavaScriptEscape($txt['pm_approve_warning']) . ') && submitThisOnce(this);"><i class="icon i-check" title="' . $txt['approve'] . '"></i></a> '; |
|
256 | - else |
|
257 | - $commands[] = '<a href="?action=admin;area=maillist;sa=approve;item=' . $id . $security . '"><i class="icon i-check" title="' . $txt['approve'] . '"></i></a> '; |
|
267 | + { |
|
268 | + $commands[] = '<a href="?action=admin;area=maillist;sa=approve;item=' . $id . $security . '" onclick="return confirm(' . JavaScriptEscape($txt['pm_approve_warning']) . ') && submitThisOnce(this);"><i class="icon i-check" title="' . $txt['approve'] . '"></i></a> '; |
|
269 | + } |
|
270 | + else { |
|
271 | + $commands[] = '<a href="?action=admin;area=maillist;sa=approve;item=' . $id . $security . '"><i class="icon i-check" title="' . $txt['approve'] . '"></i></a> '; |
|
272 | + } |
|
258 | 273 | |
259 | 274 | $commands[] = '<a href="?action=admin;area=maillist;sa=delete;item=' . $id . $security . '" onclick="return confirm(' . JavaScriptEscape($txt['delete_warning']) . ') && submitThisOnce(this);" accesskey="d"><i class="icon i-delete" title="' . $txt['delete'] . '"></i></a><br />'; |
260 | 275 | $commands[] = '<a href="?action=admin;area=maillist;sa=bounce;item=' . $id . $security . '"><i class="icon i-sign-out" title="' . $txt['bounce'] . '"></i></a> '; |
@@ -335,11 +350,13 @@ discard block |
||
335 | 350 | $email_to = $txt['private']; |
336 | 351 | } |
337 | 352 | } |
338 | - else |
|
339 | - $text = $txt['badid']; |
|
353 | + else { |
|
354 | + $text = $txt['badid']; |
|
355 | + } |
|
356 | + } |
|
357 | + else { |
|
358 | + $text = $txt['badid']; |
|
340 | 359 | } |
341 | - else |
|
342 | - $text = $txt['badid']; |
|
343 | 360 | |
344 | 361 | $parser = \BBC\ParserWrapper::instance(); |
345 | 362 | |
@@ -372,7 +389,9 @@ discard block |
||
372 | 389 | |
373 | 390 | // Remove this entry |
374 | 391 | if (!empty($id)) |
375 | - maillist_delete_error_entry($id); |
|
392 | + { |
|
393 | + maillist_delete_error_entry($id); |
|
394 | + } |
|
376 | 395 | |
377 | 396 | // Flush the cache |
378 | 397 | Cache::instance()->remove('num_menu_errors'); |
@@ -424,7 +443,9 @@ discard block |
||
424 | 443 | $check_emails = array_pad(explode('=>', $temp_email[0]['from']), 2, ''); |
425 | 444 | |
426 | 445 | if (!empty($check_emails[1])) |
427 | - $data = preg_replace('~(From: )(.*<)?(' . preg_quote(trim($check_emails[0])) . ')(>)?(\n)~i', '$1$2' . trim($check_emails[1]) . '$4$5', $data); |
|
446 | + { |
|
447 | + $data = preg_replace('~(From: )(.*<)?(' . preg_quote(trim($check_emails[0])) . ')(>)?(\n)~i', '$1$2' . trim($check_emails[1]) . '$4$5', $data); |
|
448 | + } |
|
428 | 449 | } |
429 | 450 | |
430 | 451 | // Lets TRY AGAIN to make a post! |
@@ -443,17 +464,21 @@ discard block |
||
443 | 464 | $_SESSION['email_error'] = $txt['approved']; |
444 | 465 | $_SESSION['email_error_type'] = 1; |
445 | 466 | } |
446 | - else |
|
447 | - $_SESSION['email_error'] = $txt['error_approved']; |
|
467 | + else { |
|
468 | + $_SESSION['email_error'] = $txt['error_approved']; |
|
469 | + } |
|
470 | + } |
|
471 | + else { |
|
472 | + $_SESSION['email_error'] = $txt['cant_approve']; |
|
448 | 473 | } |
449 | - else |
|
450 | - $_SESSION['email_error'] = $txt['cant_approve']; |
|
451 | 474 | } |
452 | - else |
|
453 | - $_SESSION['email_error'] = $txt['badid']; |
|
475 | + else { |
|
476 | + $_SESSION['email_error'] = $txt['badid']; |
|
477 | + } |
|
478 | + } |
|
479 | + else { |
|
480 | + $_SESSION['email_error'] = $txt['badid']; |
|
454 | 481 | } |
455 | - else |
|
456 | - $_SESSION['email_error'] = $txt['badid']; |
|
457 | 482 | |
458 | 483 | // back to the list we go |
459 | 484 | redirectexit('action=admin;area=maillist;sa=emaillist'); |
@@ -525,11 +550,13 @@ discard block |
||
525 | 550 | )); |
526 | 551 | } |
527 | 552 | } |
528 | - else |
|
529 | - $context['settings_message'] = $txt['badid']; |
|
553 | + else { |
|
554 | + $context['settings_message'] = $txt['badid']; |
|
555 | + } |
|
556 | + } |
|
557 | + else { |
|
558 | + $context['settings_message'] = $txt['badid']; |
|
530 | 559 | } |
531 | - else |
|
532 | - $context['settings_message'] = $txt['badid']; |
|
533 | 560 | |
534 | 561 | // Check if they are sending the notice |
535 | 562 | if (isset($this->_req->post->bounce) && isset($temp_email)) |
@@ -547,7 +574,9 @@ discard block |
||
547 | 574 | $body = trim($this->_req->post->warn_body); |
548 | 575 | |
549 | 576 | if (empty($body) || empty($subject)) |
550 | - $context['settings_message'] = $txt['bad_bounce']; |
|
577 | + { |
|
578 | + $context['settings_message'] = $txt['bad_bounce']; |
|
579 | + } |
|
551 | 580 | else |
552 | 581 | { |
553 | 582 | // Time for someone to get a we're so sorry message! |
@@ -876,7 +905,9 @@ discard block |
||
876 | 905 | // Needs to be an int! |
877 | 906 | $id = (int) $this->_req->query->f_id; |
878 | 907 | if (empty($id) || $id <= 0) |
879 | - throw new Elk_Exception('error_no_id_filter'); |
|
908 | + { |
|
909 | + throw new Elk_Exception('error_no_id_filter'); |
|
910 | + } |
|
880 | 911 | |
881 | 912 | // Load it up and set it as the current values |
882 | 913 | $row = maillist_load_filter_parser($id, 'filter'); |
@@ -1273,7 +1304,9 @@ discard block |
||
1273 | 1304 | // Needs to be an int! |
1274 | 1305 | $id = (int) $this->_req->query->f_id; |
1275 | 1306 | if (empty($id) || $id < 0) |
1276 | - throw new Elk_Exception('error_no_id_filter'); |
|
1307 | + { |
|
1308 | + throw new Elk_Exception('error_no_id_filter'); |
|
1309 | + } |
|
1277 | 1310 | |
1278 | 1311 | // Load this filter so we can edit it |
1279 | 1312 | $row = maillist_load_filter_parser($id, 'parser'); |
@@ -1425,7 +1458,9 @@ discard block |
||
1425 | 1458 | |
1426 | 1459 | // Be nice, show them we did something |
1427 | 1460 | if (isset($this->_req->query->saved)) |
1428 | - $context['settings_message'] = $txt['saved']; |
|
1461 | + { |
|
1462 | + $context['settings_message'] = $txt['saved']; |
|
1463 | + } |
|
1429 | 1464 | |
1430 | 1465 | // Templates and language |
1431 | 1466 | loadLanguage('Admin'); |
@@ -1463,11 +1498,17 @@ discard block |
||
1463 | 1498 | |
1464 | 1499 | // Basic checking of the email addresses |
1465 | 1500 | if (!Data_Validator::is_valid($this->_req->post, array('maillist_sitename_address' => 'valid_email'), array('maillist_sitename_address' => 'trim'))) |
1466 | - $email_error = $this->_req->post->maillist_sitename_address; |
|
1501 | + { |
|
1502 | + $email_error = $this->_req->post->maillist_sitename_address; |
|
1503 | + } |
|
1467 | 1504 | if (!Data_Validator::is_valid($this->_req->post, array('maillist_sitename_help' => 'valid_email'), array('maillist_sitename_help' => 'trim'))) |
1468 | - $email_error = $this->_req->post->maillist_sitename_help; |
|
1505 | + { |
|
1506 | + $email_error = $this->_req->post->maillist_sitename_help; |
|
1507 | + } |
|
1469 | 1508 | if (!Data_Validator::is_valid($this->_req->post, array('maillist_mail_from' => 'valid_email'), array('maillist_mail_from' => 'trim'))) |
1470 | - $email_error = $this->_req->post->maillist_mail_from; |
|
1509 | + { |
|
1510 | + $email_error = $this->_req->post->maillist_mail_from; |
|
1511 | + } |
|
1471 | 1512 | |
1472 | 1513 | // Inbound email set up then we need to check for both valid email and valid board |
1473 | 1514 | if (!$email_error && !empty($this->_req->post->emailfrom)) |
@@ -1507,9 +1548,13 @@ discard block |
||
1507 | 1548 | |
1508 | 1549 | // Check and set any errors or give the go ahead to save |
1509 | 1550 | if ($email_error) |
1510 | - $context['settings_message'] = sprintf($txt['email_not_valid'], $email_error); |
|
1551 | + { |
|
1552 | + $context['settings_message'] = sprintf($txt['email_not_valid'], $email_error); |
|
1553 | + } |
|
1511 | 1554 | elseif ($board_error) |
1512 | - $context['settings_message'] = sprintf($txt['board_not_valid'], $board_error); |
|
1555 | + { |
|
1556 | + $context['settings_message'] = sprintf($txt['board_not_valid'], $board_error); |
|
1557 | + } |
|
1513 | 1558 | else |
1514 | 1559 | { |
1515 | 1560 | // Clear the moderation count cache |
@@ -1517,7 +1562,9 @@ discard block |
||
1517 | 1562 | |
1518 | 1563 | // Should be off if mail posting is on, we ignore it anyway but this at least updates the ACP |
1519 | 1564 | if (!empty($this->_req->post->maillist_enabled)) |
1520 | - updateSettings(array('disallow_sendBody' => '')); |
|
1565 | + { |
|
1566 | + updateSettings(array('disallow_sendBody' => '')); |
|
1567 | + } |
|
1521 | 1568 | |
1522 | 1569 | updateSettings(array('maillist_receiving_address' => serialize($maillist_receiving_address))); |
1523 | 1570 | $settingsForm->setConfigValues((array) $this->_req->post); |
@@ -1534,7 +1581,9 @@ discard block |
||
1534 | 1581 | |
1535 | 1582 | // Create the board selection list |
1536 | 1583 | foreach ($board_list as $board_id => $board_name) |
1537 | - $script .= $i++ . ': {id:' . $board_id . ', name:' . JavaScriptEscape($board_name) . '},'; |
|
1584 | + { |
|
1585 | + $script .= $i++ . ': {id:' . $board_id . ', name:' . JavaScriptEscape($board_name) . '},'; |
|
1586 | + } |
|
1538 | 1587 | |
1539 | 1588 | addInlineJavascript(' |
1540 | 1589 | var sEmailParent = \'add_more_email_placeholder\', |
@@ -1596,13 +1645,15 @@ discard block |
||
1596 | 1645 | |
1597 | 1646 | // Imap? |
1598 | 1647 | if (!function_exists('imap_open')) |
1599 | - $config_vars = array_merge($config_vars, |
|
1648 | + { |
|
1649 | + $config_vars = array_merge($config_vars, |
|
1600 | 1650 | array( |
1601 | 1651 | array('title', 'maillist_imap_missing'), |
1602 | 1652 | ) |
1603 | 1653 | ); |
1604 | - else |
|
1605 | - $config_vars = array_merge($config_vars, |
|
1654 | + } |
|
1655 | + else { |
|
1656 | + $config_vars = array_merge($config_vars, |
|
1606 | 1657 | array( |
1607 | 1658 | array('title', 'maillist_imap'), |
1608 | 1659 | array('desc', 'maillist_imap_reason'), |
@@ -1624,6 +1675,7 @@ discard block |
||
1624 | 1675 | array('check', 'maillist_imap_cron', 20, 'subtext' => $txt['maillist_imap_cron_desc'], 'disabled' => !function_exists('imap_open')), |
1625 | 1676 | ) |
1626 | 1677 | ); |
1678 | + } |
|
1627 | 1679 | |
1628 | 1680 | call_integration_hook('integrate_modify_maillist_settings', array(&$config_vars)); |
1629 | 1681 | |
@@ -1658,7 +1710,9 @@ discard block |
||
1658 | 1710 | |
1659 | 1711 | // Submitting a new one or editing an existing one then pass this request off |
1660 | 1712 | if (isset($this->_req->post->add) || isset($this->_req->post->save) || isset($this->_req->query->tid)) |
1661 | - return $this->action_modify_bounce_templates(); |
|
1713 | + { |
|
1714 | + return $this->action_modify_bounce_templates(); |
|
1715 | + } |
|
1662 | 1716 | // Deleting and existing one |
1663 | 1717 | elseif (isset($this->_req->post->delete) && !empty($this->_req->post->deltpl)) |
1664 | 1718 | { |
@@ -1796,7 +1850,9 @@ discard block |
||
1796 | 1850 | |
1797 | 1851 | // If it's an edit load it. |
1798 | 1852 | if ($context['is_edit']) |
1799 | - modLoadTemplate($context['id_template'], 'bnctpl'); |
|
1853 | + { |
|
1854 | + modLoadTemplate($context['id_template'], 'bnctpl'); |
|
1855 | + } |
|
1800 | 1856 | |
1801 | 1857 | // Wait, we are saving? |
1802 | 1858 | if (isset($this->_req->post->save)) |
@@ -1834,13 +1890,18 @@ discard block |
||
1834 | 1890 | |
1835 | 1891 | // If it wasn't visible and now is they've effectively added it. |
1836 | 1892 | if ($context['template_data']['personal'] && !$recipient_id) |
1837 | - logAction('add_bounce_template', array('template' => $template_title)); |
|
1893 | + { |
|
1894 | + logAction('add_bounce_template', array('template' => $template_title)); |
|
1895 | + } |
|
1838 | 1896 | // Conversely if they made it personal it's a delete. |
1839 | 1897 | elseif (!$context['template_data']['personal'] && $recipient_id) |
1840 | - logAction('delete_bounce_template', array('template' => $template_title)); |
|
1898 | + { |
|
1899 | + logAction('delete_bounce_template', array('template' => $template_title)); |
|
1900 | + } |
|
1841 | 1901 | // Otherwise just an edit. |
1842 | - else |
|
1843 | - logAction('modify_bounce_template', array('template' => $template_title)); |
|
1902 | + else { |
|
1903 | + logAction('modify_bounce_template', array('template' => $template_title)); |
|
1904 | + } |
|
1844 | 1905 | } |
1845 | 1906 | else |
1846 | 1907 | { |
@@ -1859,10 +1920,14 @@ discard block |
||
1859 | 1920 | $context['template_data']['personal'] = !empty($this->_req->post->make_personal); |
1860 | 1921 | |
1861 | 1922 | if (empty($template_title)) |
1862 | - $context['warning_errors'][] = $txt['ml_bounce_template_error_no_title']; |
|
1923 | + { |
|
1924 | + $context['warning_errors'][] = $txt['ml_bounce_template_error_no_title']; |
|
1925 | + } |
|
1863 | 1926 | |
1864 | 1927 | if (empty($template_body)) |
1865 | - $context['warning_errors'][] = $txt['ml_bounce_template_error_no_body']; |
|
1928 | + { |
|
1929 | + $context['warning_errors'][] = $txt['ml_bounce_template_error_no_body']; |
|
1930 | + } |
|
1866 | 1931 | } |
1867 | 1932 | } |
1868 | 1933 |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | 'value' => $txt['error'], |
145 | 145 | ), |
146 | 146 | 'data' => array( |
147 | - 'function' => function ($rowData) { |
|
147 | + 'function' => function($rowData) { |
|
148 | 148 | $error = $rowData['error_code']; |
149 | 149 | if ($error === 'error_pm_not_found') |
150 | 150 | return '<span class="error">' . $rowData['error'] . '<span>'; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | 'value' => $txt['message_type'], |
218 | 218 | ), |
219 | 219 | 'data' => array( |
220 | - 'function' => function ($rowData) { |
|
220 | + 'function' => function($rowData) { |
|
221 | 221 | global $txt; |
222 | 222 | |
223 | 223 | // Do we have a type? |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | 'value' => $txt['message_action'], |
245 | 245 | ), |
246 | 246 | 'data' => array( |
247 | - 'function' => function ($rowData) { |
|
247 | + 'function' => function($rowData) { |
|
248 | 248 | global $context, $txt; |
249 | 249 | |
250 | 250 | $id = $rowData['id_email'] . ';'; |
@@ -1733,7 +1733,7 @@ discard block |
||
1733 | 1733 | 'class' => 'centertext', |
1734 | 1734 | ), |
1735 | 1735 | 'data' => array( |
1736 | - 'function' => function ($rowData) { |
|
1736 | + 'function' => function($rowData) { |
|
1737 | 1737 | return '<input type="checkbox" name="deltpl[]" value="' . $rowData['id_comment'] . '" class="input_check" />'; |
1738 | 1738 | }, |
1739 | 1739 | 'class' => 'centertext', |
@@ -42,11 +42,14 @@ discard block |
||
42 | 42 | |
43 | 43 | // Some code redundancy... and we only take this! |
44 | 44 | if (isset($activity) && $activity == 'file') |
45 | - // View the file with the error |
|
45 | + { |
|
46 | + // View the file with the error |
|
46 | 47 | $this->action_viewfile(); |
47 | - else |
|
48 | - // View error log |
|
48 | + } |
|
49 | + else { |
|
50 | + // View error log |
|
49 | 51 | $this->action_log(); |
52 | + } |
|
50 | 53 | } |
51 | 54 | |
52 | 55 | /** |
@@ -84,7 +87,9 @@ discard block |
||
84 | 87 | |
85 | 88 | // Go back to where we were. |
86 | 89 | if ($type == 'delete') |
87 | - redirectexit('action=admin;area=logs;sa=errorlog' . (isset($this->_req->query->desc) ? ';desc' : '') . ';start=' . $this->_req->query->start . (!empty($filter) ? ';filter=' . $this->_req->query->filter . ';value=' . $this->_req->query->value : '')); |
|
90 | + { |
|
91 | + redirectexit('action=admin;area=logs;sa=errorlog' . (isset($this->_req->query->desc) ? ';desc' : '') . ';start=' . $this->_req->query->start . (!empty($filter) ? ';filter=' . $this->_req->query->filter . ';value=' . $this->_req->query->value : '')); |
|
92 | + } |
|
88 | 93 | |
89 | 94 | redirectexit('action=admin;area=logs;sa=errorlog' . (isset($this->_req->query->desc) ? ';desc' : '')); |
90 | 95 | } |
@@ -94,11 +99,15 @@ discard block |
||
94 | 99 | |
95 | 100 | // If this filter is empty... |
96 | 101 | if ($num_errors == 0 && !empty($filter)) |
97 | - redirectexit('action=admin;area=logs;sa=errorlog' . (isset($this->_req->query->desc) ? ';desc' : '')); |
|
102 | + { |
|
103 | + redirectexit('action=admin;area=logs;sa=errorlog' . (isset($this->_req->query->desc) ? ';desc' : '')); |
|
104 | + } |
|
98 | 105 | |
99 | 106 | // Clean up start. |
100 | 107 | if (!isset($this->_req->query->start) || $this->_req->query->start < 0) |
101 | - $this->_req->query->start = 0; |
|
108 | + { |
|
109 | + $this->_req->query->start = 0; |
|
110 | + } |
|
102 | 111 | |
103 | 112 | // Do we want to reverse error listing? |
104 | 113 | $context['sort_direction'] = isset($this->_req->query->desc) ? 'down' : 'up'; |
@@ -139,9 +148,12 @@ discard block |
||
139 | 148 | |
140 | 149 | // Finally, work out what is the last tab! |
141 | 150 | if (isset($context['error_types'][$sum])) |
142 | - $context['error_types'][$sum]['is_last'] = true; |
|
143 | - else |
|
144 | - $context['error_types']['all']['is_last'] = true; |
|
151 | + { |
|
152 | + $context['error_types'][$sum]['is_last'] = true; |
|
153 | + } |
|
154 | + else { |
|
155 | + $context['error_types']['all']['is_last'] = true; |
|
156 | + } |
|
145 | 157 | |
146 | 158 | // And this is pretty basic ;). |
147 | 159 | $context['page_title'] = $txt['errlog']; |
@@ -255,7 +267,9 @@ discard block |
||
255 | 267 | ); |
256 | 268 | } |
257 | 269 | elseif (isset($this->_req->query->filter) || isset($this->_req->query->value)) |
258 | - unset($this->_req->query->filter, $this->_req->query->value); |
|
270 | + { |
|
271 | + unset($this->_req->query->filter, $this->_req->query->value); |
|
272 | + } |
|
259 | 273 | |
260 | 274 | return $filter; |
261 | 275 | } |
@@ -276,7 +290,9 @@ discard block |
||
276 | 290 | |
277 | 291 | // We can't help you if you don't spell it out loud :P |
278 | 292 | if (!isset($this->_req->query->file)) |
279 | - redirectexit(); |
|
293 | + { |
|
294 | + redirectexit(); |
|
295 | + } |
|
280 | 296 | |
281 | 297 | // Decode the file and get the line |
282 | 298 | $filename = base64_decode($this->_req->query->file); |
@@ -295,14 +311,18 @@ discard block |
||
295 | 311 | |
296 | 312 | // Not like we can look at just any old file |
297 | 313 | if ($ext !== '.php' || (strpos($file, $real_board) === false && strpos($file, $real_source) === false) || strpos($file, $real_cache) !== false || in_array($basename, $excluded) || !is_readable($file)) |
298 | - throw new Elk_Exception('error_bad_file', true, array(htmlspecialchars($filename, ENT_COMPAT, 'UTF-8'))); |
|
314 | + { |
|
315 | + throw new Elk_Exception('error_bad_file', true, array(htmlspecialchars($filename, ENT_COMPAT, 'UTF-8'))); |
|
316 | + } |
|
299 | 317 | |
300 | 318 | // Get the min and max lines |
301 | 319 | $min = $line - 16 <= 0 ? 1 : $line - 16; |
302 | 320 | $max = $line + 21; // One additional line to make everything work out correctly |
303 | 321 | |
304 | 322 | if ($max <= 0 || $min >= $max) |
305 | - throw new Elk_Exception('error_bad_line'); |
|
323 | + { |
|
324 | + throw new Elk_Exception('error_bad_line'); |
|
325 | + } |
|
306 | 326 | |
307 | 327 | $file_data = explode('<br />', highlight_php_code(htmlspecialchars(implode('', file($file)), ENT_COMPAT, 'UTF-8'))); |
308 | 328 |
@@ -71,7 +71,9 @@ discard block |
||
71 | 71 | |
72 | 72 | // Start displaying errors without fixing them. |
73 | 73 | if (isset($this->_req->query->fixErrors)) |
74 | - checkSession('get'); |
|
74 | + { |
|
75 | + checkSession('get'); |
|
76 | + } |
|
75 | 77 | |
76 | 78 | // Will want this. |
77 | 79 | loadForumTests(); |
@@ -98,7 +100,9 @@ discard block |
||
98 | 100 | $_SESSION['repairboards_to_fix2'] = null; |
99 | 101 | |
100 | 102 | if (empty($context['repair_errors'])) |
101 | - $context['repair_errors'][] = '???'; |
|
103 | + { |
|
104 | + $context['repair_errors'][] = '???'; |
|
105 | + } |
|
102 | 106 | } |
103 | 107 | } |
104 | 108 | else |
@@ -134,7 +138,9 @@ discard block |
||
134 | 138 | )); |
135 | 139 | |
136 | 140 | if (!empty($salvageBoardID)) |
137 | - $context['redirect_to_recount'] = true; |
|
141 | + { |
|
142 | + $context['redirect_to_recount'] = true; |
|
143 | + } |
|
138 | 144 | |
139 | 145 | $_SESSION['repairboards_to_fix'] = null; |
140 | 146 | $_SESSION['repairboards_to_fix2'] = null; |
@@ -88,16 +88,24 @@ discard block |
||
88 | 88 | |
89 | 89 | // One at a time, one at a time, and in this order too |
90 | 90 | if ($this->isOpera()) |
91 | - $this->_setupOpera(); |
|
91 | + { |
|
92 | + $this->_setupOpera(); |
|
93 | + } |
|
92 | 94 | // Them webkits need to be set up too |
93 | 95 | elseif ($this->isWebkit()) |
94 | - $this->_setupWebkit(); |
|
96 | + { |
|
97 | + $this->_setupWebkit(); |
|
98 | + } |
|
95 | 99 | // We may have work to do on Firefox... |
96 | 100 | elseif ($this->isFirefox()) |
97 | - $this->_setupFirefox(); |
|
101 | + { |
|
102 | + $this->_setupFirefox(); |
|
103 | + } |
|
98 | 104 | // Old friend, old frenemy |
99 | 105 | elseif ($this->isIe()) |
100 | - $this->_setupIe(); |
|
106 | + { |
|
107 | + $this->_setupIe(); |
|
108 | + } |
|
101 | 109 | |
102 | 110 | // Just a few mobile checks |
103 | 111 | $this->isOperaMini(); |
@@ -120,7 +128,9 @@ discard block |
||
120 | 128 | public function isOpera() |
121 | 129 | { |
122 | 130 | if (!isset($this->_browsers['is_opera'])) |
123 | - $this->_browsers['is_opera'] = strpos($this->_ua, 'Opera') !== false; |
|
131 | + { |
|
132 | + $this->_browsers['is_opera'] = strpos($this->_ua, 'Opera') !== false; |
|
133 | + } |
|
124 | 134 | |
125 | 135 | return $this->_browsers['is_opera']; |
126 | 136 | } |
@@ -134,7 +144,9 @@ discard block |
||
134 | 144 | { |
135 | 145 | // I'm IE, Yes I'm the real IE; All you other IEs are just imitating. |
136 | 146 | if (!isset($this->_browsers['is_ie'])) |
137 | - $this->_browsers['is_ie'] = !$this->isOpera() && !$this->isGecko() && !$this->isWebTv() && (preg_match('~Trident/\d+~', $this->_ua) === 1 || preg_match('~MSIE \d+~', $this->_ua) === 1); |
|
147 | + { |
|
148 | + $this->_browsers['is_ie'] = !$this->isOpera() && !$this->isGecko() && !$this->isWebTv() && (preg_match('~Trident/\d+~', $this->_ua) === 1 || preg_match('~MSIE \d+~', $this->_ua) === 1); |
|
149 | + } |
|
138 | 150 | |
139 | 151 | return $this->_browsers['is_ie']; |
140 | 152 | } |
@@ -147,7 +159,9 @@ discard block |
||
147 | 159 | public function isWebkit() |
148 | 160 | { |
149 | 161 | if (!isset($this->_browsers['is_webkit'])) |
150 | - $this->_browsers['is_webkit'] = strpos($this->_ua, 'AppleWebKit') !== false; |
|
162 | + { |
|
163 | + $this->_browsers['is_webkit'] = strpos($this->_ua, 'AppleWebKit') !== false; |
|
164 | + } |
|
151 | 165 | |
152 | 166 | return $this->_browsers['is_webkit']; |
153 | 167 | } |
@@ -160,7 +174,9 @@ discard block |
||
160 | 174 | public function isFirefox() |
161 | 175 | { |
162 | 176 | if (!isset($this->_browsers['is_firefox'])) |
163 | - $this->_browsers['is_firefox'] = preg_match('~(?:Firefox|Ice[wW]easel|IceCat|Shiretoko|Minefield)/~', $this->_ua) === 1 && $this->isGecko(); |
|
177 | + { |
|
178 | + $this->_browsers['is_firefox'] = preg_match('~(?:Firefox|Ice[wW]easel|IceCat|Shiretoko|Minefield)/~', $this->_ua) === 1 && $this->isGecko(); |
|
179 | + } |
|
164 | 180 | |
165 | 181 | return $this->_browsers['is_firefox']; |
166 | 182 | } |
@@ -173,7 +189,9 @@ discard block |
||
173 | 189 | public function isWebTv() |
174 | 190 | { |
175 | 191 | if (!isset($this->_browsers['is_web_tv'])) |
176 | - $this->_browsers['is_web_tv'] = strpos($this->_ua, 'WebTV') !== false; |
|
192 | + { |
|
193 | + $this->_browsers['is_web_tv'] = strpos($this->_ua, 'WebTV') !== false; |
|
194 | + } |
|
177 | 195 | |
178 | 196 | return $this->_browsers['is_web_tv']; |
179 | 197 | } |
@@ -186,7 +204,9 @@ discard block |
||
186 | 204 | public function isKonqueror() |
187 | 205 | { |
188 | 206 | if (!isset($this->_browsers['is_konqueror'])) |
189 | - $this->_browsers['is_konqueror'] = strpos($this->_ua, 'Konqueror') !== false; |
|
207 | + { |
|
208 | + $this->_browsers['is_konqueror'] = strpos($this->_ua, 'Konqueror') !== false; |
|
209 | + } |
|
190 | 210 | |
191 | 211 | return $this->_browsers['is_konqueror']; |
192 | 212 | } |
@@ -199,7 +219,9 @@ discard block |
||
199 | 219 | public function isGecko() |
200 | 220 | { |
201 | 221 | if (!isset($this->_browsers['is_gecko'])) |
202 | - $this->_browsers['is_gecko'] = strpos($this->_ua, 'Gecko') !== false && strpos($this->_ua, 'like Gecko') === false && !$this->isWebkit() && !$this->isKonqueror(); |
|
222 | + { |
|
223 | + $this->_browsers['is_gecko'] = strpos($this->_ua, 'Gecko') !== false && strpos($this->_ua, 'like Gecko') === false && !$this->isWebkit() && !$this->isKonqueror(); |
|
224 | + } |
|
203 | 225 | |
204 | 226 | return $this->_browsers['is_gecko']; |
205 | 227 | } |
@@ -212,9 +234,13 @@ discard block |
||
212 | 234 | public function isOperaMini() |
213 | 235 | { |
214 | 236 | if (!isset($this->_browsers['is_opera_mini'])) |
215 | - $this->_browsers['is_opera_mini'] = (isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) || stripos($this->_ua, 'opera mini') !== false); |
|
237 | + { |
|
238 | + $this->_browsers['is_opera_mini'] = (isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']) || stripos($this->_ua, 'opera mini') !== false); |
|
239 | + } |
|
216 | 240 | if ($this->_browsers['is_opera_mini']) |
217 | - $this->_is_mobile = true; |
|
241 | + { |
|
242 | + $this->_is_mobile = true; |
|
243 | + } |
|
218 | 244 | |
219 | 245 | return $this->_browsers['is_opera_mini']; |
220 | 246 | } |
@@ -227,9 +253,13 @@ discard block |
||
227 | 253 | public function isOperaMobi() |
228 | 254 | { |
229 | 255 | if (!isset($this->_browsers['is_opera_mobi'])) |
230 | - $this->_browsers['is_opera_mobi'] = stripos($this->_ua, 'opera mobi') !== false; |
|
256 | + { |
|
257 | + $this->_browsers['is_opera_mobi'] = stripos($this->_ua, 'opera mobi') !== false; |
|
258 | + } |
|
231 | 259 | if ($this->_browsers['is_opera_mobi']) |
232 | - $this->_is_mobile = true; |
|
260 | + { |
|
261 | + $this->_is_mobile = true; |
|
262 | + } |
|
233 | 263 | |
234 | 264 | return $this->_browsers['is_opera_mini']; |
235 | 265 | } |
@@ -246,16 +276,20 @@ discard block |
||
246 | 276 | // Be you robot or human? |
247 | 277 | if (!isset($this->_browsers['possibly_robot'])) |
248 | 278 | { |
249 | - if (isset($user_info['possibly_robot'])) { |
|
279 | + if (isset($user_info['possibly_robot'])) |
|
280 | + { |
|
250 | 281 | // This isn't meant to be reliable, it's just meant to catch most bots to prevent PHPSESSID from showing up. |
251 | 282 | $this->_browsers['possibly_robot'] = !empty($user_info['possibly_robot']); |
252 | 283 | |
253 | 284 | // 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. |
254 | 285 | if ((isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('login', 'login2', 'register'))) || !$user_info['is_guest']) |
255 | - $this->_browsers['possibly_robot'] = false; |
|
286 | + { |
|
287 | + $this->_browsers['possibly_robot'] = false; |
|
288 | + } |
|
289 | + } |
|
290 | + else { |
|
291 | + $this->_browsers['possibly_robot'] = false; |
|
256 | 292 | } |
257 | - else |
|
258 | - $this->_browsers['possibly_robot'] = false; |
|
259 | 293 | } |
260 | 294 | |
261 | 295 | return $this->_browsers['possibly_robot']; |
@@ -281,12 +315,16 @@ discard block |
||
281 | 315 | |
282 | 316 | // blackberry, playbook, iphone, nokia, android and ipods set a mobile flag |
283 | 317 | if ($this->_browsers['is_iphone'] || $this->_browsers['is_blackberry'] || $this->_browsers['is_android'] || $this->_browsers['is_nokia']) |
284 | - $this->_is_mobile = true; |
|
318 | + { |
|
319 | + $this->_is_mobile = true; |
|
320 | + } |
|
285 | 321 | |
286 | 322 | // iPad and droid tablets get a tablet flag |
287 | 323 | $this->_browsers['is_android_tablet'] = $this->_browsers['is_android'] && strpos($this->_ua, 'Mobile') === false; |
288 | 324 | if ($this->_browsers['is_ipad'] || $this->_browsers['is_android_tablet']) |
289 | - $this->_is_tablet = true; |
|
325 | + { |
|
326 | + $this->_is_tablet = true; |
|
327 | + } |
|
290 | 328 | |
291 | 329 | // Prevent some repetition here |
292 | 330 | $_chrome = strpos($this->_ua, 'Chrome'); |
@@ -312,27 +350,37 @@ discard block |
||
312 | 350 | if ($this->_browsers['is_chrome']) |
313 | 351 | { |
314 | 352 | if (preg_match('~chrome[/]([0-9][0-9]?[.])~i', $this->_ua, $match) === 1) |
315 | - $this->_browsers['is_chrome' . (int) $match[1]] = true; |
|
353 | + { |
|
354 | + $this->_browsers['is_chrome' . (int) $match[1]] = true; |
|
355 | + } |
|
316 | 356 | } |
317 | 357 | elseif ($this->_browsers['is_edge']) |
318 | 358 | { |
319 | 359 | $this->_browsers['is_webkit'] = false; |
320 | 360 | if (preg_match('~edge[/]([0-9][0-9]?[.])~i', $this->_ua, $match) === 1) |
321 | - $this->_browsers['is_edge' . (int) $match[1]] = true; |
|
361 | + { |
|
362 | + $this->_browsers['is_edge' . (int) $match[1]] = true; |
|
363 | + } |
|
322 | 364 | } |
323 | 365 | elseif ($this->_browsers['is_safari']) |
324 | 366 | { |
325 | 367 | if (preg_match('~version/?(.*)safari.*~i', $this->_ua, $match) === 1) |
326 | - $this->_browsers['is_safari' . (int) trim($match[1])] = true; |
|
368 | + { |
|
369 | + $this->_browsers['is_safari' . (int) trim($match[1])] = true; |
|
370 | + } |
|
327 | 371 | } |
328 | 372 | elseif ($this->_browsers['is_opera']) |
329 | 373 | { |
330 | 374 | if (preg_match('~OPR[/]([0-9][0-9]?[.])~i', $this->_ua, $match) === 1) |
331 | - $this->_browsers['is_opera' . (int) trim($match[1])] = true; |
|
375 | + { |
|
376 | + $this->_browsers['is_opera' . (int) trim($match[1])] = true; |
|
377 | + } |
|
332 | 378 | |
333 | 379 | // Since opera >= 15 wants to look like chrome, set the body to do just that |
334 | 380 | if (trim($match[1]) >= 15) |
335 | - $this->_browsers['is_chrome'] = true; |
|
381 | + { |
|
382 | + $this->_browsers['is_chrome'] = true; |
|
383 | + } |
|
336 | 384 | } |
337 | 385 | } |
338 | 386 | |
@@ -365,7 +413,9 @@ discard block |
||
365 | 413 | |
366 | 414 | // If trident is set, see the (if any) msie tag in the user agent matches ... if not its in some compatibility view |
367 | 415 | if (isset($msie_match[1]) && ($msie_match[1] < $trident_match[1] + 4)) |
368 | - $this->_browsers['is_ie_compat_view'] = true; |
|
416 | + { |
|
417 | + $this->_browsers['is_ie_compat_view'] = true; |
|
418 | + } |
|
369 | 419 | } |
370 | 420 | |
371 | 421 | // IE mobile, ... shucks why not |
@@ -394,7 +444,9 @@ discard block |
||
394 | 444 | private function _setupFirefox() |
395 | 445 | { |
396 | 446 | if (preg_match('~(?:Firefox|Ice[wW]easel|IceCat|Shiretoko|Minefield)[\/ \(]([^ ;\)]+)~', $this->_ua, $match) === 1) |
397 | - $this->_browsers['is_firefox' . (int) $match[1]] = true; |
|
447 | + { |
|
448 | + $this->_browsers['is_firefox' . (int) $match[1]] = true; |
|
449 | + } |
|
398 | 450 | |
399 | 451 | // Firefox mobile |
400 | 452 | if (strpos($this->_ua, 'Android; Mobile;') !== false) |
@@ -423,10 +475,14 @@ discard block |
||
423 | 475 | { |
424 | 476 | // Opera 10+ uses the version tag at the end of the string |
425 | 477 | if (preg_match('~\sVersion/([0-9]+)\.[0-9]+(?:\s*|$)~', $this->_ua, $match)) |
426 | - $this->_browsers['is_opera' . (int) $match[1]] = true; |
|
478 | + { |
|
479 | + $this->_browsers['is_opera' . (int) $match[1]] = true; |
|
480 | + } |
|
427 | 481 | // Opera pre 10 is supposed to uses the Opera tag alone, as do some spoofers |
428 | 482 | elseif (preg_match('~Opera[ /]([0-9]+)(?!\\.[89])~', $this->_ua, $match)) |
429 | - $this->_browsers['is_opera' . (int) $match[1]] = true; |
|
483 | + { |
|
484 | + $this->_browsers['is_opera' . (int) $match[1]] = true; |
|
485 | + } |
|
430 | 486 | } |
431 | 487 | |
432 | 488 | /** |
@@ -67,7 +67,9 @@ discard block |
||
67 | 67 | $this->_debug = $debug; |
68 | 68 | |
69 | 69 | if ($paths !== null) |
70 | - $this->newPath($paths); |
|
70 | + { |
|
71 | + $this->newPath($paths); |
|
72 | + } |
|
71 | 73 | } |
72 | 74 | |
73 | 75 | /** |
@@ -98,16 +100,22 @@ discard block |
||
98 | 100 | global $modSettings; |
99 | 101 | |
100 | 102 | if ($this->_debug !== null) |
101 | - $this->_debug->add('hooks', $hook); |
|
103 | + { |
|
104 | + $this->_debug->add('hooks', $hook); |
|
105 | + } |
|
102 | 106 | |
103 | 107 | $results = array(); |
104 | 108 | if (empty($modSettings[$hook])) |
105 | - return $results; |
|
109 | + { |
|
110 | + return $results; |
|
111 | + } |
|
106 | 112 | |
107 | 113 | // Loop through each function. |
108 | 114 | $functions = $this->_prepare_hooks($modSettings[$hook]); |
109 | 115 | foreach ($functions as $function => $call) |
110 | - $results[$function] = call_user_func_array($call, $parameters); |
|
116 | + { |
|
117 | + $results[$function] = call_user_func_array($call, $parameters); |
|
118 | + } |
|
111 | 119 | |
112 | 120 | return $results; |
113 | 121 | } |
@@ -128,25 +136,34 @@ discard block |
||
128 | 136 | $function = trim($function); |
129 | 137 | |
130 | 138 | if (strpos($function, '|') !== false) |
131 | - list ($call, $file) = explode('|', $function); |
|
132 | - else |
|
133 | - $call = $function; |
|
139 | + { |
|
140 | + list ($call, $file) = explode('|', $function); |
|
141 | + } |
|
142 | + else { |
|
143 | + $call = $function; |
|
144 | + } |
|
134 | 145 | |
135 | 146 | // OOP static method |
136 | 147 | if (strpos($call, '::') !== false) |
137 | - $call = explode('::', $call); |
|
148 | + { |
|
149 | + $call = explode('::', $call); |
|
150 | + } |
|
138 | 151 | |
139 | 152 | if (!empty($file)) |
140 | 153 | { |
141 | 154 | $absPath = strtr(trim($file), $this->_path_replacements); |
142 | 155 | |
143 | 156 | if (file_exists($absPath)) |
144 | - require_once($absPath); |
|
157 | + { |
|
158 | + require_once($absPath); |
|
159 | + } |
|
145 | 160 | } |
146 | 161 | |
147 | 162 | // Is it valid? |
148 | 163 | if (is_callable($call)) |
149 | - $returns[$function] = $call; |
|
164 | + { |
|
165 | + $returns[$function] = $call; |
|
166 | + } |
|
150 | 167 | } |
151 | 168 | |
152 | 169 | return $returns; |
@@ -162,7 +179,9 @@ discard block |
||
162 | 179 | global $modSettings; |
163 | 180 | |
164 | 181 | if ($this->_debug !== null) |
165 | - $this->_debug->add('hooks', $hook); |
|
182 | + { |
|
183 | + $this->_debug->add('hooks', $hook); |
|
184 | + } |
|
166 | 185 | |
167 | 186 | // Any file to include? |
168 | 187 | if (!empty($modSettings[$hook])) |
@@ -173,7 +192,9 @@ discard block |
||
173 | 192 | $include = strtr(trim($include), $this->_path_replacements); |
174 | 193 | |
175 | 194 | if (file_exists($include)) |
176 | - require_once($include); |
|
195 | + { |
|
196 | + require_once($include); |
|
197 | + } |
|
177 | 198 | } |
178 | 199 | } |
179 | 200 | } |
@@ -186,15 +207,21 @@ discard block |
||
186 | 207 | global $modSettings; |
187 | 208 | |
188 | 209 | if ($this->_debug !== null) |
189 | - $this->_debug->add('hooks', 'integrate_buffer'); |
|
210 | + { |
|
211 | + $this->_debug->add('hooks', 'integrate_buffer'); |
|
212 | + } |
|
190 | 213 | |
191 | 214 | if (empty($modSettings['integrate_buffer'])) |
192 | - return; |
|
215 | + { |
|
216 | + return; |
|
217 | + } |
|
193 | 218 | |
194 | 219 | $buffers = $this->_prepare_hooks($modSettings['integrate_buffer']); |
195 | 220 | |
196 | 221 | foreach ($buffers as $call) |
197 | - ob_start($call); |
|
222 | + { |
|
223 | + ob_start($call); |
|
224 | + } |
|
198 | 225 | } |
199 | 226 | |
200 | 227 | /** |
@@ -215,14 +242,18 @@ discard block |
||
215 | 242 | |
216 | 243 | // Is it going to be permanent? |
217 | 244 | if ($permanent) |
218 | - $this->_store($hook, $integration_call); |
|
245 | + { |
|
246 | + $this->_store($hook, $integration_call); |
|
247 | + } |
|
219 | 248 | |
220 | 249 | // Make current function list usable. |
221 | 250 | $functions = empty($modSettings[$hook]) ? array() : explode(',', $modSettings[$hook]); |
222 | 251 | |
223 | 252 | // Do nothing, if it's already there. |
224 | 253 | if (in_array($integration_call, $functions)) |
225 | - return; |
|
254 | + { |
|
255 | + return; |
|
256 | + } |
|
226 | 257 | |
227 | 258 | $functions[] = $integration_call; |
228 | 259 | $modSettings[$hook] = implode(',', $functions); |
@@ -242,10 +273,14 @@ discard block |
||
242 | 273 | $hooks = $class::register(); |
243 | 274 | |
244 | 275 | if (empty($hooks)) |
245 | - continue; |
|
276 | + { |
|
277 | + continue; |
|
278 | + } |
|
246 | 279 | |
247 | 280 | foreach ($hooks as $hook) |
248 | - $this->add($hook[0], $hook[1], isset($hook[2]) ? $hook[2] : '', false); |
|
281 | + { |
|
282 | + $this->add($hook[0], $hook[1], isset($hook[2]) ? $hook[2] : '', false); |
|
283 | + } |
|
249 | 284 | } |
250 | 285 | } |
251 | 286 | } |
@@ -264,10 +299,14 @@ discard block |
||
264 | 299 | $hooks = $class::settingsRegister(); |
265 | 300 | |
266 | 301 | if (empty($hooks)) |
267 | - continue; |
|
302 | + { |
|
303 | + continue; |
|
304 | + } |
|
268 | 305 | |
269 | 306 | foreach ($hooks as $hook) |
270 | - $this->add($hook[0], $hook[1], isset($hook[2]) ? $hook[2] : '', false); |
|
307 | + { |
|
308 | + $this->add($hook[0], $hook[1], isset($hook[2]) ? $hook[2] : '', false); |
|
309 | + } |
|
271 | 310 | } |
272 | 311 | } |
273 | 312 | } |
@@ -299,9 +338,11 @@ discard block |
||
299 | 338 | |
300 | 339 | // Already have the integration compose file, then use it, otherwise create one |
301 | 340 | if (file_exists($composer_file)) |
302 | - $composer_data = json_decode(file_get_contents($composer_file)); |
|
303 | - else |
|
304 | - $composer_data = json_decode('{ |
|
341 | + { |
|
342 | + $composer_data = json_decode(file_get_contents($composer_file)); |
|
343 | + } |
|
344 | + else { |
|
345 | + $composer_data = json_decode('{ |
|
305 | 346 | "name": "' . $name . '", |
306 | 347 | "description": "' . $name . '", |
307 | 348 | "version": "1.0.0", |
@@ -338,6 +379,7 @@ discard block |
||
338 | 379 | "setting_url": "" |
339 | 380 | } |
340 | 381 | }'); |
382 | + } |
|
341 | 383 | |
342 | 384 | $names[] = array( |
343 | 385 | 'id' => $name, |
@@ -390,9 +432,12 @@ discard block |
||
390 | 432 | global $modSettings; |
391 | 433 | |
392 | 434 | if (!empty($modSettings['autoload_integrate'])) |
393 | - $existing = explode(',', $modSettings['autoload_integrate']); |
|
394 | - else |
|
395 | - $existing = array(); |
|
435 | + { |
|
436 | + $existing = explode(',', $modSettings['autoload_integrate']); |
|
437 | + } |
|
438 | + else { |
|
439 | + $existing = array(); |
|
440 | + } |
|
396 | 441 | |
397 | 442 | return $existing; |
398 | 443 | } |
@@ -434,12 +479,15 @@ discard block |
||
434 | 479 | { |
435 | 480 | $current_functions = explode(',', $current_functions); |
436 | 481 | if (in_array($integration_call, $current_functions)) |
437 | - return; |
|
482 | + { |
|
483 | + return; |
|
484 | + } |
|
438 | 485 | |
439 | 486 | $permanent_functions = array_merge($current_functions, array($integration_call)); |
440 | 487 | } |
441 | - else |
|
442 | - $permanent_functions = array($integration_call); |
|
488 | + else { |
|
489 | + $permanent_functions = array($integration_call); |
|
490 | + } |
|
443 | 491 | |
444 | 492 | updateSettings(array($hook => implode(',', $permanent_functions))); |
445 | 493 | } |
@@ -484,7 +532,9 @@ discard block |
||
484 | 532 | { |
485 | 533 | updateSettings(array($hook => implode(',', array_diff($current_functions, array($integration_call))))); |
486 | 534 | if (empty($modSettings[$hook])) |
487 | - removeSettings($hook); |
|
535 | + { |
|
536 | + removeSettings($hook); |
|
537 | + } |
|
488 | 538 | } |
489 | 539 | } |
490 | 540 | |
@@ -493,7 +543,9 @@ discard block |
||
493 | 543 | |
494 | 544 | // You can only remove it if it's available. |
495 | 545 | if (!in_array($integration_call, $functions)) |
496 | - return; |
|
546 | + { |
|
547 | + return; |
|
548 | + } |
|
497 | 549 | |
498 | 550 | $functions = array_diff($functions, array($integration_call)); |
499 | 551 | $modSettings[$hook] = implode(',', $functions); |
@@ -509,10 +561,14 @@ discard block |
||
509 | 561 | public static function init($db = null, $debug = null, $paths = null) |
510 | 562 | { |
511 | 563 | if ($db === null) |
512 | - $db = database(); |
|
564 | + { |
|
565 | + $db = database(); |
|
566 | + } |
|
513 | 567 | |
514 | 568 | if ($debug === null) |
515 | - $debug = Debug::instance(); |
|
569 | + { |
|
570 | + $debug = Debug::instance(); |
|
571 | + } |
|
516 | 572 | |
517 | 573 | self::$_instance = new Hooks($db, $debug, $paths); |
518 | 574 | } |
@@ -529,9 +585,13 @@ discard block |
||
529 | 585 | public static function instance($db = null, $debug = null, $paths = null) |
530 | 586 | { |
531 | 587 | if (self::$_instance === null) |
532 | - self::init($db, $debug, $paths); |
|
588 | + { |
|
589 | + self::init($db, $debug, $paths); |
|
590 | + } |
|
533 | 591 | elseif ($paths !== null) |
534 | - self::$_instance->newPath($paths); |
|
592 | + { |
|
593 | + self::$_instance->newPath($paths); |
|
594 | + } |
|
535 | 595 | |
536 | 596 | return self::$_instance; |
537 | 597 | } |