Changeset 447
- Timestamp:
- 10/02/2006 05:57:12 PM (20 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
bb-admin/upgrade.php (modified) (2 diffs)
-
bb-includes/pluggable.php (modified) (2 diffs)
-
profile-edit.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bb-admin/upgrade.php
r385 r447 115 115 /* 116 116 upgrade_150(); 117 */ 118 119 // Reversibly break Passwords of blocked users Oct 2nd, 2006. 120 /* 121 upgrade_160(); 117 122 */ 118 123 … … 228 233 } 229 234 235 // Reversibly break passwords of blocked users. 236 function upgrade_160() { 237 require_once('admin-functions.php'); 238 $blocked = get_ids_by_role( 'blocked' ); 239 foreach ( $blocked as $b ) 240 bb_break_password( $b ); 241 } 242 230 243 function deslash($content) { 231 244 // Note: \\\ inside a regex denotes a single backslash. -
trunk/bb-includes/pluggable.php
r421 r447 22 22 if ( !$already_md5 ) { 23 23 $pass = user_sanitize( md5( $pass ) ); 24 return $bbdb->get_row("SELECT * FROM $bbdb->users WHERE user_login = '$user' AND user_pass= '$pass'");24 return $bbdb->get_row("SELECT * FROM $bbdb->users WHERE user_login = '$user' AND SUBSTRING_INDEX( user_pass, '---', 1 ) = '$pass'"); 25 25 } else { 26 26 return $bbdb->get_row("SELECT * FROM $bbdb->users WHERE user_login = '$user' AND MD5( user_pass ) = '$pass'"); … … 199 199 } 200 200 endif; 201 202 if ( !function_exists('bb_break_password') ) : 203 function bb_break_password( $user_id ) { 204 global $bbdb; 205 $user_id = (int) $user_id; 206 if ( !$user = bb_get_user( $user_id ) ) 207 return false; 208 $secret = substr(wp_hash( 'bb_break_password' ), 0, 13); 209 if ( false === strpos( $user->user_pass, '---' ) ) 210 return $bbdb->query("UPDATE $bbdb->users SET user_pass = CONCAT(user_pass, '---', '$secret') WHERE ID = '$user_id'"); 211 else 212 return true; 213 } 214 endif; 215 216 if ( !function_exists('bb_fix_password') ) : 217 function bb_fix_password( $user_id ) { 218 global $bbdb; 219 $user_id = (int) $user_id; 220 if ( !$user = bb_get_user( $user_id ) ) 221 return false; 222 if ( false === strpos( $user->user_pass, '---' ) ) 223 return true; 224 else 225 return $bbdb->query("UPDATE $bbdb->users SET user_pass = SUBSTRING_INDEX(user_pass, '---', 1) WHERE ID = '$user_id'"); 226 } 227 endif; 201 228 ?> -
trunk/profile-edit.php
r422 r447 75 75 if ( bb_current_user_can('edit_users') ) : 76 76 $user_obj = new BB_User( $user->ID ); 77 if ( !array_key_exists($role, $user->capabilities) && array_key_exists($role, $bb_roles->roles) ) 77 if ( !array_key_exists($role, $user->capabilities) && array_key_exists($role, $bb_roles->roles) ) { 78 $old_role = $user_obj->roles[0]; 78 79 $user_obj->set_role($role); // Only support one role for now 80 if ( 'blocked' == $role && 'blocked' != $old_role ) 81 bb_break_password( $user->ID ); 82 elseif ( 'blocked' != $role && 'blocked' == $old_role ) 83 bb_fix_password( $user->ID ); 84 } 79 85 if ( isset($user_status) && $user_status != $user->user_status ) 80 86 update_user_status( $user->ID, $user_status );
Note: See TracChangeset
for help on using the changeset viewer.