Skip to:
Content

BuddyPress.org

Ticket #7155: 7155.diff

File 7155.diff, 1.4 KB (added by DJPaul, 9 years ago)
  • src/bp-xprofile/classes/class-bp-xprofile-field.php

    diff --git a/src/bp-xprofile/classes/class-bp-xprofile-field.php b/src/bp-xprofile/classes/class-bp-xprofile-field.php
    index 11c48fd..9128cc5 100644
    a b class BP_XProfile_Field { 
    263263                        $args = (array) $args;
    264264                }
    265265
     266                $int_fields = array(
     267                        'can_delete',
     268                        'field_order',
     269                        'group_id',
     270                        'id',
     271                        'is_default_option',
     272                        'is_required',
     273                        'option_order',
     274                        'parent_id',
     275                );
     276
    266277                foreach ( $args as $k => $v ) {
    267278                        if ( 'name' === $k || 'description' === $k ) {
    268279                                $v = stripslashes( $v );
     280                        } elseif ( in_array( $k, $int_fields, true ) ) {
     281                                $v = absint( $v );
    269282                        }
     283
    270284                        $this->{$k} = $v;
    271285                }
    272286
  • src/bp-xprofile/classes/class-bp-xprofile-group.php

    diff --git a/src/bp-xprofile/classes/class-bp-xprofile-group.php b/src/bp-xprofile/classes/class-bp-xprofile-group.php
    index 408d222..abd1db7 100644
    a b class BP_XProfile_Group { 
    553553                                // and add it to the cache.
    554554                                foreach ( (array) $queried_gdata as $gdata ) {
    555555
     556                                        // Enforce type.
     557                                        foreach ( $gdata as $k => &$v ) {
     558                                                if ( in_array( $k, array( 'can_delete', 'group_order', 'id', ), true ) ) {
     559                                                        $v = absint( $v );
     560                                                }
     561                                        }
     562
    556563                                        // Add group to groups array.
    557564                                        $groups[ $gdata->id ] = $gdata;
    558565