PluginProbe
bbPress / 2.6.6
bbPress v2.6.6
trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.2.2 All 71 releases
← All changes | includes/admin/converters/phpBB.php +32 -43 trunk2.6.6 View file →
@@ -16,8 +16,16 @@
16 16 */
17 17 class phpBB extends BBP_Converter_Base {
18 18
19 19 /**
20 + * Main Constructor
21 + *
22 + */
23 + public function __construct() {
24 + parent::__construct();
25 + }
26 +
27 + /**
20 28 * Sets up the field mappings
21 29 */
22 30 public function setup_globals() {
23 31
@@ -132,24 +140,24 @@
132 140 // Forum dates.
133 141 $this->field_map[] = array(
134 142 'to_type' => 'forum',
135 143 'to_fieldname' => 'post_date',
136 - 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore
144 + 'default' => date('Y-m-d H:i:s')
137 145 );
138 146 $this->field_map[] = array(
139 147 'to_type' => 'forum',
140 148 'to_fieldname' => 'post_date_gmt',
141 - 'default' => gmdate( 'Y-m-d H:i:s' )
149 + 'default' => date('Y-m-d H:i:s')
142 150 );
143 151 $this->field_map[] = array(
144 152 'to_type' => 'forum',
145 153 'to_fieldname' => 'post_modified',
146 - 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore
154 + 'default' => date('Y-m-d H:i:s')
147 155 );
148 156 $this->field_map[] = array(
149 157 'to_type' => 'forum',
150 158 'to_fieldname' => 'post_modified_gmt',
151 - 'default' => gmdate( 'Y-m-d H:i:s' )
159 + 'default' => date('Y-m-d H:i:s')
152 160 );
153 161
154 162 /** Forum Subscriptions Section ***************************************/
155 163
@@ -720,9 +728,9 @@
720 728 /**
721 729 * Check for correct password
722 730 *
723 731 * @param string $password The password in plain text
724 - * @param string $serialized_pass The stored password hash
732 + * @param string $hash The stored password hash
725 733 *
726 734 * @link Original source for password functions http://openwall.com/phpass/
727 735 * @link phpass is now included in WP Core https://core.trac.wordpress.org/browser/trunk/wp-includes/class-phpass.php
728 736 *
@@ -728,46 +736,25 @@
728 736 *
729 737 * @return bool Returns true if the password is correct, false if not.
730 738 */
731 739 public function authenticate_pass( $password, $serialized_pass ) {
732 -
733 - // Unserialize the password, with safeguards
734 - $pass_array = unserialize(
735 - $serialized_pass,
736 - array(
737 - 'allowed_classes' => false,
738 - 'max_depth' => 1,
739 - )
740 - );
741 -
742 - // Encrypted
743 - if ( strlen( $pass_array['hash'] ) === 34 ) {
744 -
745 - // ASCII
746 - $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
747 -
748 - // Compare using private crypt
749 - return hash_equals(
750 - $this->hash_crypt_private( $password, $pass_array['hash'], $itoa64 ),
751 - $pass_array['hash']
752 - );
740 + $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
741 + $pass_array = unserialize( $serialized_pass );
742 + if ( strlen( $pass_array['hash'] ) == 34 ) {
743 + return ( $this->_hash_crypt_private( $password, $pass_array['hash'], $itoa64 ) === $pass_array['hash'] ) ? true : false;
753 744 }
754 745
755 - // Unencrypted
756 - return hash_equals(
757 - md5( $password ),
758 - $pass_array['hash']
759 - );
746 + return ( md5( $password ) === $pass_array['hash'] ) ? true : false;
760 747 }
761 748
762 749 /**
763 750 * The crypt function/replacement
764 751 */
765 - private function hash_crypt_private( $password, $setting, &$itoa64 ) {
752 + private function _hash_crypt_private( $password, $setting, &$itoa64 ) {
766 753 $output = '*';
767 754
768 755 // Check for correct hash
769 - if ( substr( $setting, 0, 3 ) !== '$H$' ) {
756 + if ( substr( $setting, 0, 3 ) != '$H$' ) {
770 757 return $output;
771 758 }
772 759
773 760 $count_log2 = strpos( $itoa64, $setting[3] );
@@ -778,9 +765,9 @@
778 765
779 766 $count = 1 << $count_log2;
780 767 $salt = substr( $setting, 4, 8 );
781 768
782 - if ( strlen( $salt ) !== 8 ) {
769 + if ( strlen( $salt ) != 8 ) {
783 770 return $output;
784 771 }
785 772
786 773 /**
@@ -794,18 +781,20 @@
794 781 if ( floatval( phpversion() ) >= 5 ) {
795 782 $hash = md5( $salt . $password, true );
796 783 do {
797 784 $hash = md5( $hash . $password, true );
798 - } while ( --$count );
785 + }
786 + while ( --$count );
799 787 } else {
800 788 $hash = pack( 'H*', md5( $salt . $password ) );
801 789 do {
802 790 $hash = pack( 'H*', md5( $hash . $password ) );
803 - } while ( --$count );
791 + }
792 + while ( --$count );
804 793 }
805 794
806 - $output = substr( $setting, 0, 12 );
807 - $output .= $this->hash_encode64( $hash, 16, $itoa64 );
795 + $output = substr($setting, 0, 12);
796 + $output .= $this->_hash_encode64($hash, 16, $itoa64);
808 797
809 798 return $output;
810 799 }
811 800
@@ -811,9 +800,9 @@
811 800
812 801 /**
813 802 * Encode hash
814 803 */
815 - private function hash_encode64( $input, $count, &$itoa64 ) {
804 + private function _hash_encode64( $input, $count, &$itoa64 ) {
816 805 $output = '';
817 806 $i = 0;
818 807
819 808 do {
@@ -819,13 +808,13 @@
819 808 do {
820 809 $value = ord( $input[ $i++ ] );
821 810 $output .= $itoa64[ $value & 0x3f ];
822 811
823 - if ( $i < $count ) {
812 + if ($i < $count) {
824 813 $value |= ord( $input[ $i ] ) << 8;
825 814 }
826 815
827 - $output .= $itoa64[ ( $value >> 6 ) & 0x3f ];
816 + $output .= $itoa64[( $value >> 6 ) & 0x3f];
828 817
829 818 if ( $i++ >= $count ) {
830 819 break;
831 820 }
@@ -833,15 +822,15 @@
833 822 if ( $i < $count ) {
834 823 $value |= ord( $input[ $i ] ) << 16;
835 824 }
836 825
837 - $output .= $itoa64[ ( $value >> 12 ) & 0x3f ];
826 + $output .= $itoa64[( $value >> 12 ) & 0x3f];
838 827
839 828 if ( $i++ >= $count ) {
840 829 break;
841 830 }
842 831
843 - $output .= $itoa64[ ( $value >> 18 ) & 0x3f ];
832 + $output .= $itoa64[($value >> 18) & 0x3f];
844 833 } while ( $i < $count );
845 834
846 835 return $output;
847 836 }