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/Example.php +24 -39 trunk2.6.6 View file →
@@ -16,8 +16,15 @@
16 16 */
17 17 class Example extends BBP_Converter_Base {
18 18
19 19 /**
20 + * Main Constructor
21 + */
22 + public function __construct() {
23 + parent::__construct();
24 + }
25 +
26 + /**
20 27 * Sets up the field mappings
21 28 */
22 29 public function setup_globals() {
23 30
@@ -80,9 +87,9 @@
80 87 'to_type' => 'forum',
81 88 'to_fieldname' => 'post_title'
82 89 );
83 90
84 - // Forum slug (Clean name to avoid conflicts)
91 + // Forum slug (Clean name to avoid confilcts)
85 92 $this->field_map[] = array(
86 93 'from_tablename' => 'forums_table',
87 94 'from_fieldname' => 'the_forum_slug',
88 95 'to_type' => 'forum',
@@ -126,26 +133,26 @@
126 133 );
127 134
128 135 // Forum dates.
129 136 $this->field_map[] = array(
130 - 'to_type' => 'forum',
131 - 'to_fieldname' => 'post_date',
132 - 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore
137 + 'to_type' => 'forum',
138 + 'to_fieldname' => 'post_date',
139 + 'default' => date('Y-m-d H:i:s')
133 140 );
134 141 $this->field_map[] = array(
135 - 'to_type' => 'forum',
136 - 'to_fieldname' => 'post_date_gmt',
137 - 'default' => gmdate( 'Y-m-d H:i:s' )
142 + 'to_type' => 'forum',
143 + 'to_fieldname' => 'post_date_gmt',
144 + 'default' => date('Y-m-d H:i:s')
138 145 );
139 146 $this->field_map[] = array(
140 - 'to_type' => 'forum',
141 - 'to_fieldname' => 'post_modified',
142 - 'default' => date( 'Y-m-d H:i:s' ) // phpcs:ignore
147 + 'to_type' => 'forum',
148 + 'to_fieldname' => 'post_modified',
149 + 'default' => date('Y-m-d H:i:s')
143 150 );
144 151 $this->field_map[] = array(
145 - 'to_type' => 'forum',
146 - 'to_fieldname' => 'post_modified_gmt',
147 - 'default' => gmdate( 'Y-m-d H:i:s' )
152 + 'to_type' => 'forum',
153 + 'to_fieldname' => 'post_modified_gmt',
154 + 'default' => date('Y-m-d H:i:s')
148 155 );
149 156
150 157 // Setup the table joins for the forum section
151 158 $this->field_map[] = array(
@@ -153,9 +160,9 @@
153 160 'from_fieldname' => 'forum_id',
154 161 'join_tablename' => 'forums_table',
155 162 'join_type' => 'INNER',
156 163 'join_expression' => 'USING groups_table.forum_id = forums_table.forum_id',
157 - // 'from_expression' => 'WHERE forums_table.forum_id != 1',
164 + // 'from_expression' => 'WHERE forums_table.forum_id != 1',
158 165 'to_type' => 'forum'
159 166 );
160 167
161 168 /** Forum Subscriptions Section ***************************************/
@@ -688,13 +695,9 @@
688 695 * way when we authenticate it we can get it out of the database
689 696 * as one value. Array values are auto sanitized by WordPress.
690 697 */
691 698 public function callback_savepass( $field, $row ) {
692 - $pass_array = array(
693 - 'hash' => $field,
694 - 'salt' => $row['salt']
695 - );
696 -
699 + $pass_array = array( 'hash' => $field, 'salt' => $row['salt'] );
697 700 return $pass_array;
698 701 }
699 702
700 703 /**
@@ -701,26 +704,8 @@
701 704 * This method is to take the pass out of the database and compare
702 705 * to a pass the user has typed in.
703 706 */
704 707 public function authenticate_pass( $password, $serialized_pass ) {
705 -
706 - // Unserialize the password, with safeguards
707 - $pass_array = unserialize(
708 - $serialized_pass,
709 - array(
710 - 'allowed_classes' => false,
711 - 'max_depth' => 1,
712 - )
713 - );
714 -
715 - // Bail if missing values
716 - if ( ! is_array( $pass_array ) || ! isset( $pass_array['hash'], $pass_array['salt'] ) ) {
717 - return false;
718 - }
719 -
720 - // Return comparison
721 - return hash_equals(
722 - $pass_array['hash'],
723 - md5( md5( $password ) . $pass_array['salt'] )
724 - );
708 + $pass_array = unserialize( $serialized_pass );
709 + return ( $pass_array['hash'] == md5( md5( $password ). $pass_array['salt'] ) );
725 710 }
726 711 }