Ticket #6977: 6977.01.patch
File 6977.01.patch, 11.0 KB (added by , 9 years ago) |
---|
-
src/bp-blogs/classes/class-bp-blogs-blog.php
48 48 */ 49 49 public function __construct( $id = null ) { 50 50 if ( !empty( $id ) ) { 51 $this->id = $id;51 $this->id = (int) $id; 52 52 $this->populate(); 53 53 } 54 54 } … … 63 63 64 64 $blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->blogs->table_name} WHERE id = %d", $this->id ) ); 65 65 66 $this->user_id = $blog->user_id;67 $this->blog_id = $blog->blog_id;66 $this->user_id = (int) $blog->user_id; 67 $this->blog_id = (int) $blog->blog_id; 68 68 } 69 69 70 70 /** -
src/bp-core/classes/class-bp-user-query.php
591 591 // Match up to the user ids from the main query. 592 592 foreach ( $this->user_ids as $key => $uid ) { 593 593 if ( isset( $r[ $uid ] ) ) { 594 $r[ $uid ]->ID = (int) $uid; 595 $r[ $uid ]->user_status = (int) $r[ $uid ]->user_status; 596 594 597 $this->results[ $uid ] = $r[ $uid ]; 595 598 596 599 // The BP template functions expect an 'id' 597 600 // (as opposed to 'ID') property. 598 $this->results[ $uid ]->id = $uid;601 $this->results[ $uid ]->id = (int) $uid; 599 602 600 603 // Remove user ID from original user_ids property. 601 604 } else { -
src/bp-groups/classes/class-bp-groups-group.php
208 208 } 209 209 210 210 // Group found so setup the object variables. 211 $this->id = $group->id;212 $this->creator_id = $group->creator_id;211 $this->id = (int) $group->id; 212 $this->creator_id = (int) $group->creator_id; 213 213 $this->name = stripslashes( $group->name ); 214 214 $this->slug = $group->slug; 215 215 $this->description = stripslashes( $group->description ); 216 216 $this->status = $group->status; 217 $this->enable_forum = $group->enable_forum;217 $this->enable_forum = (int) $group->enable_forum; 218 218 $this->date_created = $group->date_created; 219 219 220 220 // Are we getting extra group data? … … 231 231 232 232 // Add admins and moderators to their respective arrays. 233 233 foreach ( (array) $admin_mods as $user ) { 234 $user->user_id = (int) $user->user_id; 235 $user->is_admin = (int) $user->is_admin; 236 $user->is_mod = (int) $user->is_mod; 237 234 238 if ( !empty( $user->is_admin ) ) { 235 239 $this->admins[] = $user; 236 240 } else { … … 241 245 // Set up some specific group vars from meta. Excluded 242 246 // from the bp_groups cache because it's cached independently. 243 247 $this->last_activity = groups_get_groupmeta( $this->id, 'last_activity' ); 244 $this->total_member_count = groups_get_groupmeta( $this->id, 'total_member_count' );248 $this->total_member_count = (int) groups_get_groupmeta( $this->id, 'total_member_count' ); 245 249 246 250 // Set user-specific data. 247 251 $user_id = bp_loggedin_user_id(); -
src/bp-groups/classes/class-bp-groups-member.php
185 185 $member = $wpdb->get_row($sql); 186 186 187 187 if ( !empty( $member ) ) { 188 $this->id = $member->id;189 $this->group_id = $member->group_id;190 $this->user_id = $member->user_id;191 $this->inviter_id = $member->inviter_id;192 $this->is_admin = $member->is_admin;193 $this->is_mod = $member->is_mod;194 $this->is_banned = $member->is_banned;188 $this->id = (int) $member->id; 189 $this->group_id = (int) $member->group_id; 190 $this->user_id = (int) $member->user_id; 191 $this->inviter_id = (int) $member->inviter_id; 192 $this->is_admin = (int) $member->is_admin; 193 $this->is_mod = (int) $member->is_mod; 194 $this->is_banned = (int) $member->is_banned; 195 195 $this->user_title = $member->user_title; 196 196 $this->date_modified = $member->date_modified; 197 $this->is_confirmed = $member->is_confirmed;197 $this->is_confirmed = (int) $member->is_confirmed; 198 198 $this->comments = $member->comments; 199 $this->invite_sent = $member->invite_sent;199 $this->invite_sent = (int) $member->invite_sent; 200 200 201 201 $this->user = new BP_Core_User( $this->user_id ); 202 202 } -
src/bp-messages/classes/class-bp-messages-message.php
88 88 $bp = buddypress(); 89 89 90 90 if ( $message = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->messages->table_name_messages} WHERE id = %d", $id ) ) ) { 91 $this->id = $message->id;92 $this->thread_id = $message->thread_id;93 $this->sender_id = $message->sender_id;91 $this->id = (int) $message->id; 92 $this->thread_id = (int) $message->thread_id; 93 $this->sender_id = (int) $message->sender_id; 94 94 $this->subject = $message->subject; 95 95 $this->message = $message->message; 96 96 $this->date_sent = $message->date_sent; -
src/bp-messages/classes/class-bp-messages-notice.php
62 62 */ 63 63 public function __construct( $id = null ) { 64 64 if ( $id ) { 65 $this->id = $id;65 $this->id = (int) $id; 66 66 $this->populate(); 67 67 } 68 68 } … … 85 85 $this->subject = $notice->subject; 86 86 $this->message = $notice->message; 87 87 $this->date_sent = $notice->date_sent; 88 $this->is_active = $notice->is_active;88 $this->is_active = (int) $notice->is_active; 89 89 } 90 90 } 91 91 -
src/bp-messages/classes/class-bp-messages-thread.php
166 166 } 167 167 168 168 $last_message_index = count( $this->messages ) - 1; 169 $this->last_message_id = $this->messages[ $last_message_index ]->id;169 $this->last_message_id = (int) $this->messages[ $last_message_index ]->id; 170 170 $this->last_message_date = $this->messages[ $last_message_index ]->date_sent; 171 $this->last_sender_id = $this->messages[ $last_message_index ]->sender_id;171 $this->last_sender_id = (int) $this->messages[ $last_message_index ]->sender_id; 172 172 $this->last_message_subject = $this->messages[ $last_message_index ]->subject; 173 173 $this->last_message_content = $this->messages[ $last_message_index ]->message; 174 174 175 175 foreach ( (array) $this->messages as $key => $message ) { 176 $this->sender_ids[ $message->sender_id ] = $message->sender_id;176 $this->sender_ids[ $message->sender_id ] = (int) $message->sender_id; 177 177 } 178 178 179 179 // Fetch the recipients. … … 181 181 182 182 // Get the unread count for the logged in user. 183 183 if ( isset( $this->recipients[ $r['user_id'] ] ) ) { 184 $this->unread_count = $this->recipients[ $r['user_id'] ]->unread_count;184 $this->unread_count = (int) $this->recipients[ $r['user_id'] ]->unread_count; 185 185 } 186 186 187 187 // Grab all message meta. -
src/bp-notifications/classes/class-bp-notifications-notification.php
97 97 */ 98 98 public function __construct( $id = 0 ) { 99 99 if ( ! empty( $id ) ) { 100 $this->id = $id;100 $this->id = (int) $id; 101 101 $this->populate(); 102 102 } 103 103 } … … 188 188 189 189 // Setup the notification data. 190 190 if ( ! empty( $notification ) && ! is_wp_error( $notification ) ) { 191 $this->item_id = $notification->item_id;192 $this->secondary_item_id = $notification->secondary_item_id;193 $this->user_id = $notification->user_id;191 $this->item_id = (int) $notification->item_id; 192 $this->secondary_item_id = (int) $notification->secondary_item_id; 193 $this->user_id = (int) $notification->user_id; 194 194 $this->component_name = $notification->component_name; 195 195 $this->component_action = $notification->component_action; 196 196 $this->date_notified = $notification->date_notified; 197 $this->is_new = $notification->is_new;197 $this->is_new = (int) $notification->is_new; 198 198 } 199 199 } 200 200 -
src/bp-xprofile/classes/class-bp-xprofile-field.php
260 260 $args = (array) $args; 261 261 } 262 262 263 // Omitting 'group_id' due to unit test failures. 264 // Omitting 'parent_id' for safety. 265 $int_fields = array( 266 'id', 'is_required', 'is_default_option', 267 'field_order', 'option_order', 'can_delete' 268 ); 269 263 270 foreach ( $args as $k => $v ) { 264 271 if ( 'name' === $k || 'description' === $k ) { 265 272 $v = stripslashes( $v ); 266 273 } 274 275 // Cast numeric strings as integers. 276 if ( true === in_array( $k, $int_fields ) ) { 277 $v = (int) $v; 278 } 279 267 280 $this->{$k} = $v; 268 281 } 269 282 -
src/bp-xprofile/classes/class-bp-xprofile-group.php
103 103 $group = reset( $group ); 104 104 105 105 // Set object properties. 106 $this->id = $group->id;106 $this->id = (int) $group->id; 107 107 $this->name = $group->name; 108 108 $this->description = $group->description; 109 $this->can_delete = $group->can_delete;110 $this->group_order = $group->group_order;109 $this->can_delete = (int) $group->can_delete; 110 $this->group_order = (int) $group->group_order; 111 111 } 112 112 113 113 /** -
src/bp-xprofile/classes/class-bp-xprofile-profiledata.php
88 88 } 89 89 90 90 if ( $profiledata ) { 91 $this->id = $profiledata->id;92 $this->user_id = $profiledata->user_id;93 $this->field_id = $profiledata->field_id;91 $this->id = (int) $profiledata->id; 92 $this->user_id = (int) $profiledata->user_id; 93 $this->field_id = (int) $profiledata->field_id; 94 94 $this->value = stripslashes( $profiledata->value ); 95 95 $this->last_updated = $profiledata->last_updated; 96 96 97 97 } else { 98 98 // When no row is found, we'll need to set these properties manually. 99 $this->field_id = $field_id;100 $this->user_id = $user_id;99 $this->field_id = (int) $field_id; 100 $this->user_id = (int) $user_id; 101 101 } 102 102 } 103 103