Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/22/2011 07:42:53 PM (15 years ago)
Author:
johnjamesjacoby
Message:

Prepare queries in bp_core_get_root_options(). See #3503 and r5024.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-functions.php

    r5024 r5026  
    944944        $root_blog_options = apply_filters( 'bp_core_site_options', array(
    945945
    946         // BuddyPress core settings
    947         'bp-deactivated-components'       => serialize( array( ) ),
    948         'bp-blogs-first-install'          => '0',
    949         'bp-disable-blog-forum-comments'  => '0',
    950         'bp-xprofile-base-group-name'     => 'Base',
    951         'bp-xprofile-fullname-field-name' => 'Name',
    952         'bp-disable-profile-sync'         => '0',
    953         'bp-disable-avatar-uploads'       => '0',
    954         'bp-disable-account-deletion'     => '0',
    955         'bp-disable-blogforum-comments'   => '0',
    956         'bb-config-location'              => ABSPATH,
    957         'hide-loggedout-adminbar'         => '0',
    958 
    959         // Useful WordPress settings
    960         'registration'                    => '0',
    961         'avatar_default'                  => 'mysteryman'
     946                // BuddyPress core settings
     947                'bp-deactivated-components'       => serialize( array( ) ),
     948                'bp-blogs-first-install'          => '0',
     949                'bp-disable-blog-forum-comments'  => '0',
     950                'bp-xprofile-base-group-name'     => 'Base',
     951                'bp-xprofile-fullname-field-name' => 'Name',
     952                'bp-disable-profile-sync'         => '0',
     953                'bp-disable-avatar-uploads'       => '0',
     954                'bp-disable-account-deletion'     => '0',
     955                'bp-disable-blogforum-comments'   => '0',
     956                'bb-config-location'              => ABSPATH,
     957                'hide-loggedout-adminbar'         => '0',
     958
     959                // Useful WordPress settings
     960                'registration'                    => '0',
     961                'avatar_default'                  => 'mysteryman'
    962962        ) );
    963963
    964964        $root_blog_option_keys  = array_keys( $root_blog_options );
    965         $blog_options_keys      = implode( "', '", (array) $root_blog_option_keys );
    966         $blog_options_query     = sprintf( "SELECT option_name AS name, option_value AS value FROM {$wpdb->options} WHERE option_name IN ('%s')", $blog_options_keys );
     965        $blog_options_keys      = "'" . join( "', '", (array) $root_blog_option_keys ) . "'";
     966        $blog_options_query     = $wpdb->prepare( "SELECT option_name AS name, option_value AS value FROM {$wpdb->options} WHERE option_name IN ( {$blog_options_keys} )" );
    967967        $root_blog_options_meta = $wpdb->get_results( $blog_options_query );
    968968
    … …  
    975975                ) );
    976976
     977                $current_site           = get_current_site();
    977978                $network_option_keys    = array_keys( $network_options );
    978                 $sitemeta_options_keys  = implode( "','", (array) $network_option_keys );
    979                 $current_site           = get_current_site();
    980                 $sitemeta_options_query = sprintf( "SELECT meta_key AS name, meta_value AS value FROM {$wpdb->sitemeta} WHERE meta_key IN ('%s') AND site_id = %d", $sitemeta_options_keys, $current_site->id );
     979                $sitemeta_options_keys  = "'" . join( "', '", (array) $network_option_keys ) . "'";
     980                $sitemeta_options_query = $wpdb->prepare( "SELECT meta_key AS name, meta_value AS value FROM {$wpdb->sitemeta} WHERE meta_key IN ( {$sitemeta_options_keys} ) AND site_id = %d", $current_site->id );
    981981                $network_options_meta   = $wpdb->get_results( $sitemeta_options_query );
    982982
Note: See TracChangeset for help on using the changeset viewer.