PluginProbe
bbPress / 2.6.17
bbPress v2.6.17
2.6.19 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 All 74 releases
← All changes | includes/admin/converters/MyBB.php +25 -11 trunk → 2.6.17 View file →
@@ -9,9 +9,9 @@
9 9
10 10 /**
11 11 * Implementation of MyBB Forum converter.
12 12 *
13 - * @since 2.5.0 bbPress (r5141)
13 + * @since 2.5.0 bbPress (r5140)
14 14 *
15 15 * @link Codex Docs https://codex.bbpress.org/import-forums/mybb
16 16 */
17 17 class MyBB extends BBP_Converter_Base {
@@ -16,8 +16,16 @@
16 16 */
17 17 class MyBB 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
@@ -106,24 +114,24 @@
106 114 // Forum dates.
107 115 $this->field_map[] = array(
108 116 'to_type' => 'forum',
109 117 'to_fieldname' => 'post_date',
110 - 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore
118 + 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
111 119 );
112 120 $this->field_map[] = array(
113 121 'to_type' => 'forum',
114 122 'to_fieldname' => 'post_date_gmt',
115 - 'default' => gmdate( 'Y-m-d H:i:s' )
123 + 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
116 124 );
117 125 $this->field_map[] = array(
118 126 'to_type' => 'forum',
119 127 'to_fieldname' => 'post_modified',
120 - 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore
128 + 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
121 129 );
122 130 $this->field_map[] = array(
123 131 'to_type' => 'forum',
124 132 'to_fieldname' => 'post_modified_gmt',
125 - 'default' => gmdate( 'Y-m-d H:i:s' )
133 + 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
126 134 );
127 135
128 136 /** Topic Section *****************************************************/
129 137
@@ -404,9 +412,9 @@
404 412 );
405 413
406 414 // User password verify class (Stored in usermeta for verifying password)
407 415 $this->field_map[] = array(
408 - 'to_type' => 'user',
416 + 'to_type' => 'users',
409 417 'to_fieldname' => '_bbp_class',
410 418 'default' => 'MyBB'
411 419 );
412 420
@@ -516,9 +524,9 @@
516 524 */
517 525 public function callback_savepass( $field, $row ) {
518 526 $pass_array = array(
519 527 'hash' => $field,
520 - 'salt' => isset( $row['salt'] ) ? wp_slash( (string) $row['salt'] ) : ''
528 + 'salt' => $row['salt']
521 529 );
522 530
523 531 return $pass_array;
524 532 }
@@ -529,12 +537,18 @@
529 537 */
530 538 public function authenticate_pass( $password, $serialized_pass ) {
531 539
532 540 // Unserialize the password, with safeguards
533 - $pass_array = $this->unserialize_pass( $serialized_pass );
541 + $pass_array = unserialize(
542 + $serialized_pass,
543 + array(
544 + 'allowed_classes' => false,
545 + 'max_depth' => 1
546 + )
547 + );
534 548
535 - // Bail if missing or invalid values
536 - if ( ! is_array( $pass_array ) || ! isset( $pass_array['hash'], $pass_array['salt'] ) || ! is_string( $pass_array['hash'] ) || ! is_string( $pass_array['salt'] ) ) {
549 + // Bail if missing values
550 + if ( ! is_array( $pass_array ) || ! isset( $pass_array['hash'], $pass_array['salt'] ) ) {
537 551 return false;
538 552 }
539 553
540 554 // Return comparison
@@ -539,9 +553,9 @@
539 553
540 554 // Return comparison
541 555 return hash_equals(
542 556 $pass_array['hash'],
543 - md5( md5( $pass_array['salt'] ) . md5( $password ) )
557 + md5( md5( $password ) . $pass_array['salt'] )
544 558 );
545 559 }
546 560
547 561 /**