Changeset 11028
- Timestamp:
- 08/22/2016 10:32:06 PM (8 years ago)
- Location:
- trunk/src/bp-messages/classes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/classes/class-bp-messages-message.php
r10421 r11028 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; … … 221 221 $bp = buddypress(); 222 222 223 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND thread_id = %d ORDER BY date_sent DESC LIMIT 1", bp_loggedin_user_id(), $thread_id ) ); 223 $query = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND thread_id = %d ORDER BY date_sent DESC LIMIT 1", bp_loggedin_user_id(), $thread_id ) ); 224 225 return is_numeric( $query ) ? (int) $query : $query; 224 226 } 225 227 … … 237 239 $bp = buddypress(); 238 240 239 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND id = %d", $user_id, $message_id ) ); 241 $query = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->messages->table_name_messages} WHERE sender_id = %d AND id = %d", $user_id, $message_id ) ); 242 243 return is_numeric( $query ) ? (int) $query : $query; 240 244 } 241 245 … … 251 255 $bp = buddypress(); 252 256 253 return $wpdb->get_var( $wpdb->prepare( "SELECT sender_id FROM {$bp->messages->table_name_messages} WHERE id = %d", $message_id ) ); 257 $query = $wpdb->get_var( $wpdb->prepare( "SELECT sender_id FROM {$bp->messages->table_name_messages} WHERE id = %d", $message_id ) ); 258 259 return is_numeric( $query ) ? (int) $query : $query; 254 260 } 255 261 } -
trunk/src/bp-messages/classes/class-bp-messages-notice.php
r10421 r11028 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 } … … 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 } … … 233 233 $notices = $wpdb->get_results( "SELECT * FROM {$bp->messages->table_name_notices} ORDER BY date_sent DESC {$limit_sql}" ); 234 234 235 // Integer casting. 236 foreach ( (array) $notices as $key => $data ) { 237 $notices[ $key ]->id = (int) $notices[ $key ]->id; 238 $notices[ $key ]->is_active = (int) $notices[ $key ]->is_active; 239 } 240 235 241 return $notices; 236 242 } -
trunk/src/bp-messages/classes/class-bp-messages-thread.php
r10417 r11028 255 255 } 256 256 257 // Cast all items from the messages DB table as integers. 258 foreach ( (array) $recipients as $key => $data ) { 259 $recipients[ $key ] = (object) array_map( 'intval', (array) $data ); 260 } 261 257 262 /** 258 263 * Filters the recipients of a message thread. … … 290 295 291 296 wp_cache_set( $thread_id, (array) $messages, 'bp_messages_threads' ); 297 } 298 299 // Integer casting. 300 foreach ( $messages as $key => $data ) { 301 $messages[ $key ]->id = (int) $messages[ $key ]->id; 302 $messages[ $key ]->thread_id = (int) $messages[ $key ]->thread_id; 303 $messages[ $key ]->sender_id = (int) $messages[ $key ]->sender_id; 292 304 } 293 305
Note: See TracChangeset
for help on using the changeset viewer.