| @@ -16,8 +16,16 @@ | ||
| 16 | 16 | */ |
| 17 | 17 | class PunBB 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 | |
| @@ -114,24 +122,24 @@ | ||
| 114 | 122 | // Forum dates. |
| 115 | 123 | $this->field_map[] = array( |
| 116 | 124 | 'to_type' => 'forum', |
| 117 | 125 | 'to_fieldname' => 'post_date', |
| 118 | - 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore | |
| 126 | + 'default' => date('Y-m-d H:i:s') | |
| 119 | 127 | ); |
| 120 | 128 | $this->field_map[] = array( |
| 121 | 129 | 'to_type' => 'forum', |
| 122 | 130 | 'to_fieldname' => 'post_date_gmt', |
| 123 | - 'default' => gmdate( 'Y-m-d H:i:s' ) | |
| 131 | + 'default' => date('Y-m-d H:i:s') | |
| 124 | 132 | ); |
| 125 | 133 | $this->field_map[] = array( |
| 126 | 134 | 'to_type' => 'forum', |
| 127 | 135 | 'to_fieldname' => 'post_modified', |
| 128 | - 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore | |
| 136 | + 'default' => date('Y-m-d H:i:s') | |
| 129 | 137 | ); |
| 130 | 138 | $this->field_map[] = array( |
| 131 | 139 | 'to_type' => 'forum', |
| 132 | 140 | 'to_fieldname' => 'post_modified_gmt', |
| 133 | - 'default' => gmdate( 'Y-m-d H:i:s' ) | |
| 141 | + 'default' => date('Y-m-d H:i:s') | |
| 134 | 142 | ); |
| 135 | 143 | |
| 136 | 144 | /** Forum Subscriptions Section ***************************************/ |
| 137 | 145 | |
| @@ -662,13 +670,9 @@ | ||
| 662 | 670 | * way when we authenticate it we can get it out of the database |
| 663 | 671 | * as one value. Array values are auto sanitized by WordPress. |
| 664 | 672 | */ |
| 665 | 673 | public function callback_savepass( $field, $row ) { |
| 666 | - $pass_array = array( | |
| 667 | - 'hash' => $field, | |
| 668 | - 'salt' => $row['salt'] | |
| 669 | - ); | |
| 670 | - | |
| 674 | + $pass_array = array( 'hash' => $field, 'salt' => $row['salt'] ); | |
| 671 | 675 | return $pass_array; |
| 672 | 676 | } |
| 673 | 677 | |
| 674 | 678 | /** |
| @@ -675,28 +679,10 @@ | ||
| 675 | 679 | * This method is to take the pass out of the database and compare |
| 676 | 680 | * to a pass the user has typed in. |
| 677 | 681 | */ |
| 678 | 682 | public function authenticate_pass( $password, $serialized_pass ) { |
| 679 | - | |
| 680 | - // Unserialize the password, with safeguards | |
| 681 | - $pass_array = unserialize( | |
| 682 | - $serialized_pass, | |
| 683 | - array( | |
| 684 | - 'allowed_classes' => false, | |
| 685 | - 'max_depth' => 1, | |
| 686 | - ) | |
| 687 | - ); | |
| 688 | - | |
| 689 | - // Bail if missing values | |
| 690 | - if ( ! is_array( $pass_array ) || ! isset( $pass_array['hash'], $pass_array['salt'] ) ) { | |
| 691 | - return false; | |
| 692 | - } | |
| 693 | - | |
| 694 | - // Return comparison | |
| 695 | - return hash_equals( | |
| 696 | - $pass_array['hash'], | |
| 697 | - md5( md5( $password ) . $pass_array['salt'] ) | |
| 698 | - ); | |
| 683 | + $pass_array = unserialize( $serialized_pass ); | |
| 684 | + return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) ); | |
| 699 | 685 | } |
| 700 | 686 | |
| 701 | 687 | /** |
| 702 | 688 | * Translate the post status from PunBB v1.4.2 numerics to WordPress's strings. |