Skip to:
Content

BuddyPress.org

Changeset 5138


Ignore:
Timestamp:
09/09/2011 09:59:30 PM (8 years ago)
Author:
johnjamesjacoby
Message:

Cast activity ID's as absints. Props Harry & Glyn. (branch)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-activity/bp-activity-classes.php

    r4111 r5138  
    171171
    172172        if ( is_array( $activity_ids ) )
    173             $activity_ids = implode( ',', $activity_ids );
    174 
    175         $activity_ids = $wpdb->escape( $activity_ids );
     173            $activity_ids = implode ( ',', array_map( 'absint', $activity_ids ) );
     174        else
     175            $activity_ids = implode ( ',', array_map( 'absint', explode ( ',', $activity_ids ) ) );
    176176
    177177        if ( empty( $activity_ids ) )
     
    320320        global $bp, $wpdb;
    321321
    322         if ( is_array($activity_ids) )
    323             $activity_ids = implode( ',', $activity_ids );
    324 
    325         $activity_ids = $wpdb->escape( $activity_ids );
     322        if ( is_array( $activity_ids ) )
     323            $activity_ids = implode ( ',', array_map( 'absint', $activity_ids ) );
     324        else
     325            $activity_ids = implode ( ',', array_map( 'absint', explode ( ',', $activity_ids ) ) );
    326326
    327327        return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND item_id IN ({$activity_ids})" ) );
     
    331331        global $bp, $wpdb;
    332332
    333         if ( is_array($activity_ids) )
    334             $activity_ids = implode( ',', $activity_ids );
    335 
    336         $activity_ids = $wpdb->escape( $activity_ids );
     333        if ( is_array( $activity_ids ) )
     334            $activity_ids = implode ( ',', array_map( 'absint', $activity_ids ) );
     335        else
     336            $activity_ids = implode ( ',', array_map( 'absint', explode ( ',', $activity_ids ) ) );
    337337
    338338        return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id IN ({$activity_ids})" ) );
Note: See TracChangeset for help on using the changeset viewer.