PluginProbe
bbPress / 2.6.17
bbPress v2.6.17
2.6.18 2.6.17 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 All 73 releases
← All changes | includes/admin/converters/XMB.php +44 -12 trunk2.6.17 View file →
@@ -16,8 +16,16 @@
16 16 */
17 17 class XMB 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
@@ -124,24 +132,24 @@
124 132 // Forum dates.
125 133 $this->field_map[] = array(
126 134 'to_type' => 'forum',
127 135 'to_fieldname' => 'post_date',
128 - 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore
136 + 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
129 137 );
130 138 $this->field_map[] = array(
131 139 'to_type' => 'forum',
132 140 'to_fieldname' => 'post_date_gmt',
133 - 'default' => gmdate( 'Y-m-d H:i:s' )
141 + 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
134 142 );
135 143 $this->field_map[] = array(
136 144 'to_type' => 'forum',
137 145 'to_fieldname' => 'post_modified',
138 - 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore
146 + 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
139 147 );
140 148 $this->field_map[] = array(
141 149 'to_type' => 'forum',
142 150 'to_fieldname' => 'post_modified_gmt',
143 - 'default' => gmdate( 'Y-m-d H:i:s' )
151 + 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
144 152 );
145 153
146 154 /** Topic Section *****************************************************/
147 155
@@ -476,11 +484,19 @@
476 484 'to_fieldname' => '_bbp_password',
477 485 'callback_method' => 'callback_savepass'
478 486 );
479 487
488 + // Store old User Salt (This is only used for the SELECT row info for the above password save)
489 +// $this->field_map[] = array(
490 +// 'from_tablename' => 'members',
491 +// 'from_fieldname' => 'salt',
492 +// 'to_type' => 'user',
493 +// 'to_fieldname' => ''
494 +// );
495 +
480 496 // User password verify class (Stored in usermeta for verifying password)
481 497 $this->field_map[] = array(
482 - 'to_type' => 'user',
498 + 'to_type' => 'members',
483 499 'to_fieldname' => '_bbp_class',
484 500 'default' => 'XMB'
485 501 );
486 502
@@ -608,13 +624,19 @@
608 624 return '';
609 625 }
610 626
611 627 /**
612 - * Store the old password hash as an array. Array values are auto
613 - * sanitized by WordPress.
628 + * This method is to save the salt and password together. That
629 + * way when we authenticate it we can get it out of the database
630 + * as one value. Array values are auto sanitized by WordPress.
614 631 */
615 632 public function callback_savepass( $field, $row ) {
616 - return array( 'hash' => $field );
633 + $pass_array = array(
634 + 'hash' => $field,
635 + 'salt' => $row['salt']
636 + );
637 +
638 + return $pass_array;
617 639 }
618 640
619 641 /**
620 642 * This method is to take the pass out of the database and compare
@@ -622,16 +644,26 @@
622 644 */
623 645 public function authenticate_pass( $password, $serialized_pass ) {
624 646
625 647 // Unserialize the password, with safeguards
626 - $pass_array = $this->unserialize_pass( $serialized_pass );
648 + $pass_array = unserialize(
649 + $serialized_pass,
650 + array(
651 + 'allowed_classes' => false,
652 + 'max_depth' => 1
653 + )
654 + );
627 655
628 - // Bail if missing or invalid values
629 - if ( ! is_string( $password ) || ! is_array( $pass_array ) || ! isset( $pass_array['hash'] ) || ! is_string( $pass_array['hash'] ) ) {
656 + // Bail if missing values
657 + if ( ! is_array( $pass_array ) || ! isset( $pass_array['hash'], $pass_array['salt'] ) ) {
630 658 return false;
631 659 }
632 660
633 - return hash_equals( $pass_array['hash'], md5( $password ) );
661 + // Return comparison
662 + return hash_equals(
663 + $pass_array['hash'],
664 + md5( md5( $password ) . $pass_array['salt'] )
665 + );
634 666 }
635 667
636 668 /**
637 669 * Translate the forum type from XMB v1.9.11.13 Capitalised case to WordPress's non-capatilise case strings.