Skip to:
Content

BuddyPress.org

Changeset 2055


Ignore:
Timestamp:
10/26/2009 05:31:43 PM (15 years ago)
Author:
apeatling
Message:

Merging 1.1 branch with trunk

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-filters.php

    r1925 r2055  
    33/* Apply WordPress defined filters */
    44add_filter( 'bp_get_activity_content', 'bp_activity_filter_kses', 1 );
     5add_filter( 'bp_get_activity_content', 'bp_activity_filter_kses', 1 );
     6
    57add_filter( 'bp_get_activity_content', 'force_balance_tags' );
    68add_filter( 'bp_get_activity_content', 'wptexturize' );
  • trunk/bp-activity/bp-activity-templatetags.php

    r1980 r2055  
    352352            else
    353353                unset($selected);
     354           
     355            $component_name = attribute_escape( $component_name );
    354356
    355357            switch ( $style ) {
     
    379381            $translatable_component_names = array( __( 'profile', 'buddypress'), __( 'friends', 'buddypress' ), __( 'groups', 'buddypress' ), __( 'status', 'buddypress' ), __( 'blogs', 'buddypress' ) );
    380382           
    381             $component_links[] = $before . '<a href="' . $link . '">' . ucwords( __( $component_name, 'buddypress' ) ) . '</a>' . $after;
     383            $component_links[] = $before . '<a href="' . attribute_escape( $link ) . '">' . ucwords( __( $component_name, 'buddypress' ) ) . '</a>' . $after;
    382384        }
    383385
     
    385387
    386388        if ( isset( $_GET['afilter'] ) )
    387             $component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . $link . '"">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
     389            $component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . attribute_escape( $link ) . '"">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
    388390       
    389391        return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) );
  • trunk/bp-blogs.php

    r1995 r2055  
    309309}
    310310
    311 function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false ) {
     311function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = true ) {
    312312    global $bp;
    313313   
     
    329329   
    330330    /* Only record this activity if the blog is public */
    331     if ( (int)$_POST['blog_public'] && !$no_activity ) {   
     331    if ( (int)$_POST['blog_public'] || !$no_activity ) {
    332332        /* Record this in activity streams */
    333333        bp_blogs_record_activity( array(
     
    352352    if ( !$user_id )
    353353        $user_id = (int)$post->post_author;
    354 
    355354   
    356355    /* This is to stop infinate loops with Donncha's sitewide tags plugin */
    357     if ( (int)get_site_option('tags_blog_id') == (int)$blog_id )
     356    if ( (int)get_site_option( 'tags_blog_id' ) == (int)$blog_id )
    358357        return false;
    359358   
     
    375374            bp_blogs_update_blogmeta( $recorded_post->blog_id, 'last_activity', time() );
    376375
    377             $post_permalink = bp_post_get_permalink( $post, $blog_id );
    378 
    379             $activity_content = sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
    380             $activity_content .= "<blockquote>" . bp_create_excerpt( $post->post_content ) . "</blockquote>";
     376            if ( (int)get_blog_option( $blog_id, 'blog_public' ) ) {
     377                /* Record this in activity streams */
     378                $post_permalink = bp_post_get_permalink( $post, $blog_id );
     379
     380                $activity_content = sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
     381                $activity_content .= "<blockquote>" . bp_create_excerpt( $post->post_content ) . "</blockquote>";
    381382           
    382             /* Record this in activity streams */
    383             bp_blogs_record_activity( array(
    384                 'user_id' => (int)$post->post_author,
    385                 'content' => apply_filters( 'bp_blogs_activity_new_post', $activity_content, &$post, $post_permalink ),
    386                 'primary_link' => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
    387                 'component_action' => 'new_blog_post',
    388                 'item_id' => $recorded_post_id,
    389                 'recorded_time' => strtotime( $post->post_date )
    390             ) );
     383                bp_blogs_record_activity( array(
     384                    'user_id' => (int)$post->post_author,
     385                    'content' => apply_filters( 'bp_blogs_activity_new_post', $activity_content, &$post, $post_permalink ),
     386                    'primary_link' => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
     387                    'component_action' => 'new_blog_post',
     388                    'item_id' => $recorded_post_id,
     389                    'recorded_time' => strtotime( $post->post_date )
     390                ));
     391            }
    391392        }
    392393    } else {
     
    408409            bp_blogs_record_post( $post_id );               
    409410        }
    410        
    411         /* Now re-record the post in the activity streams */       
    412         $post_permalink = bp_post_get_permalink( $post, $blog_id );
    413        
    414 
    415         $activity_content = sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
    416         $activity_content .= "<blockquote>" . bp_create_excerpt( $post->post_content ) . "</blockquote>";
    417        
    418         /* Record this in activity streams */
    419         bp_blogs_record_activity( array(
    420             'user_id' => (int)$post->post_author,
    421             'content' => apply_filters( 'bp_blogs_activity_new_post', $activity_content, &$post, $post_permalink ),
    422             'primary_link' => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
    423             'component_action' => 'new_blog_post',
    424             'item_id' => $existing_post->id,
    425             'recorded_time' => strtotime( $post->post_date )
    426         ) );
     411
     412        if ( (int)get_blog_option( $blog_id, 'blog_public' ) ) {
     413            /* Now re-record the post in the activity streams */       
     414            $post_permalink = bp_post_get_permalink( $post, $blog_id );
     415
     416            $activity_content = sprintf( __( '%s wrote a new blog post: %s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
     417            $activity_content .= "<blockquote>" . bp_create_excerpt( $post->post_content ) . "</blockquote>";
     418       
     419            /* Record this in activity streams */
     420            bp_blogs_record_activity( array(
     421                'user_id' => (int)$post->post_author,
     422                'content' => apply_filters( 'bp_blogs_activity_new_post', $activity_content, &$post, $post_permalink ),
     423                'primary_link' => apply_filters( 'bp_blogs_activity_new_post_primary_link', $post_permalink, $post_id ),
     424                'component_action' => 'new_blog_post',
     425                'item_id' => $existing_post->id,
     426                'recorded_time' => strtotime( $post->post_date )
     427            ) );
     428        }
    427429    }
    428430
     
    458460    bp_blogs_update_blogmeta( $recorded_comment->blog_id, 'last_activity', time() );
    459461
    460     $comment_link = bp_post_get_permalink( $comment->post, $recorded_comment->blog_id );
    461     $activity_content = sprintf( __( '%s commented on the blog post %s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . $comment_link . '#comment-' . $comment->comment_ID . '">' . $comment->post->post_title . '</a>' );         
    462     $activity_content .= '<blockquote>' . bp_create_excerpt( $comment->comment_content ) . '</blockquote>';
    463 
    464     /* Record this in activity streams */
    465     bp_blogs_record_activity( array(
    466         'user_id' => $recorded_comment->user_id,
    467         'content' => apply_filters( 'bp_blogs_activity_new_comment', $activity_content, &$comment, &$recorded_comment, $comment_link ),
    468         'primary_link' => apply_filters( 'bp_blogs_activity_new_comment_primary_link', $comment_link, &$comment, &$recorded_comment ),
    469         'component_action' => 'new_blog_comment',
    470         'item_id' => $comment_id,
    471         'secondary_item_id' => $recorded_comment->blog_id,
    472         'recorded_time' =>  $recorded_comment->date_created
    473     ) );
    474    
     462    if ( (int)get_blog_option( $recorded_comment->blog_id, 'blog_public' ) ) {
     463        /* Record in activity streams */
     464        $comment_link = bp_post_get_permalink( $comment->post, $recorded_comment->blog_id );
     465        $activity_content = sprintf( __( '%s commented on the blog post %s', 'buddypress' ), bp_core_get_userlink( $user_id ), '<a href="' . $comment_link . '#comment-' . $comment->comment_ID . '">' . $comment->post->post_title . '</a>' );         
     466        $activity_content .= '<blockquote>' . bp_create_excerpt( $comment->comment_content ) . '</blockquote>';
     467
     468        /* Record this in activity streams */
     469        bp_blogs_record_activity( array(
     470            'user_id' => $recorded_comment->user_id,
     471            'content' => apply_filters( 'bp_blogs_activity_new_comment', $activity_content, &$comment, &$recorded_comment, $comment_link ),
     472            'primary_link' => apply_filters( 'bp_blogs_activity_new_comment_primary_link', $comment_link, &$comment, &$recorded_comment ),
     473            'component_action' => 'new_blog_comment',
     474            'item_id' => $comment_id,
     475            'secondary_item_id' => $recorded_comment->blog_id,
     476            'recorded_time' =>  $recorded_comment->date_created
     477        ) );
     478    }
     479
    475480    return $recorded_comment;
    476481}
     
    489494    bp_blogs_delete_activity( array( 'item_id' => $comment_id, 'secondary_item_id' => $recorded_comment->blog_id, 'component_name' => $bp->blogs->slug, 'component_action' => 'new_blog_comment' ) );
    490495
    491     $comment_link = bp_post_get_permalink( $comment->post, $recorded_comment->blog_id );
    492     $activity_content = sprintf( __( '%s commented on the blog post %s', 'buddypress' ), bp_core_get_userlink( $recorded_comment->user_id ), '<a href="' . $comment_link . '#comment-' . $comment->comment_ID . '">' . $comment->post->post_title . '</a>' );           
    493     $activity_content .= '<blockquote>' . bp_create_excerpt( $comment->comment_content ) . '</blockquote>';
    494 
    495     /* Record this in activity streams */
    496     bp_blogs_record_activity( array(
    497         'user_id' => $recorded_comment->user_id,
    498         'content' => apply_filters( 'bp_blogs_activity_new_comment', $activity_content, &$comment, &$recorded_comment, $comment_link ),
    499         'primary_link' => apply_filters( 'bp_blogs_activity_new_comment_primary_link', $comment_link, &$comment, &$recorded_comment ),
    500         'component_action' => 'new_blog_comment',
    501         'item_id' => $comment_id,
    502         'secondary_item_id' => $recorded_comment->blog_id,
    503         'recorded_time' =>  $recorded_comment->date_created
    504     ) );
     496    if ( (int)get_blog_option( $recorded_comment->blog_id, 'blog_public' ) ) {
     497        /* Record in activity streams */
     498        $comment_link = bp_post_get_permalink( $comment->post, $recorded_comment->blog_id );
     499        $activity_content = sprintf( __( '%s commented on the blog post %s', 'buddypress' ), bp_core_get_userlink( $recorded_comment->user_id ), '<a href="' . $comment_link . '#comment-' . $comment->comment_ID . '">' . $comment->post->post_title . '</a>' );           
     500        $activity_content .= '<blockquote>' . bp_create_excerpt( $comment->comment_content ) . '</blockquote>';
     501
     502        /* Record this in activity streams */
     503        bp_blogs_record_activity( array(
     504            'user_id' => $recorded_comment->user_id,
     505            'content' => apply_filters( 'bp_blogs_activity_new_comment', $activity_content, &$comment, &$recorded_comment, $comment_link ),
     506            'primary_link' => apply_filters( 'bp_blogs_activity_new_comment_primary_link', $comment_link, &$comment, &$recorded_comment ),
     507            'component_action' => 'new_blog_comment',
     508            'item_id' => $comment_id,
     509            'secondary_item_id' => $recorded_comment->blog_id,
     510            'recorded_time' =>  $recorded_comment->date_created
     511        ) );
     512    }
    505513}
    506514add_action( 'wp_set_comment_status', 'bp_blogs_approve_comment', 10, 2 );
     
    514522function bp_blogs_add_user_to_blog( $user_id, $role, $blog_id ) {
    515523    if ( $role != 'subscriber' ) {
    516         bp_blogs_record_blog( $blog_id, $user_id, $no_activity = true );
     524        bp_blogs_record_blog( $blog_id, $user_id );
    517525    }
    518526}
  • trunk/bp-blogs/bp-blogs-classes.php

    r1905 r2055  
    181181            bp_blogs_setup_globals();
    182182       
    183         like_escape($letter);
     183        $letter = like_escape( $wpdb->escape( $letter ) );
    184184               
    185185        if ( $limit && $page ) {
     
    199199            bp_blogs_setup_globals();
    200200       
    201         like_escape($filter);
     201        $filter = like_escape( $wpdb->escape( $filter ) );
    202202       
    203203        if ( $limit && $page ) {
  • trunk/bp-core.php

    r2035 r2055  
    6666if ( !defined( 'BP_HOME_BLOG_SLUG' ) )
    6767    define( 'BP_HOME_BLOG_SLUG', 'blog' );
     68   
     69/* Register BuddyPress themes contained within the theme folder */
     70if ( function_exists( 'register_theme_folder' ) )
     71    register_theme_folder( 'buddypress/bp-themes' );
    6872
    6973
     
    626630    );
    627631
     632    /***
     633     * If this nav item is hidden for the displayed user, and
     634     * the logged in user is not the displayed user
     635     * looking at their own profile, don't create the nav item.
     636     */
     637    if ( !$show_for_displayed_user && !bp_is_home() )
     638        return false;
     639       
    628640    /***
    629      * If we are not viewing a user, and this is a root component, don't attach the
    630      * default subnav function so we can display a directory or something else.
    631      */
     641     * If we are not viewing a user, and this is a root component, don't attach the
     642     * default subnav function so we can display a directory or something else.
     643     */
    632644    if ( bp_core_is_root_component( $slug ) && !$bp->displayed_user->id )
    633645        return;
  • trunk/bp-core/bp-core-classes.php

    r2005 r2055  
    220220            return false;
    221221       
    222         like_escape($letter);
     222        $letter = like_escape( $wpdb->escape( $letter ) );
    223223
    224224        $total_users_sql = apply_filters( 'bp_core_users_by_letter_count_sql', $wpdb->prepare( "SELECT DISTINCT count(u.ID) FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id LEFT JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pf.name = %s AND pd.value LIKE '$letter%%' ORDER BY pd.value ASC", BP_XPROFILE_FULLNAME_FIELD_NAME ), $letter );
     
    240240            $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
    241241       
    242         like_escape($search_terms);
     242        $search_terms = like_escape( $wpdb->escape( $search_terms ) ); 
    243243
    244244        $total_users_sql = apply_filters( 'bp_core_search_users_count_sql', "SELECT DISTINCT count(u.ID) as user_id FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id WHERE u.spam = 0 AND u.deleted = 0 AND u.user_status = 0 AND pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC", $search_terms );
  • trunk/bp-friends/bp-friends-classes.php

    r1905 r2055  
    150150            $user_id = $bp->loggedin_user->id;
    151151       
    152         like_escape($filter);
     152        $filter = like_escape( $wpdb->escape( $filter ) );
    153153       
    154154        if ( $limit && $page )
     
    222222        global $wpdb, $bp;
    223223       
    224         like_escape($filter);
     224        $filter = like_escape( $wpdb->escape( $filter ) );
    225225        $usermeta_table = $wpdb->base_prefix . 'usermeta';
    226226        $users_table = $wpdb->base_prefix . 'users';
     
    247247        global $wpdb, $bp;
    248248       
    249         like_escape($filter);
     249        $filter = like_escape( $wpdb->escape( $filter ) );
    250250        $usermeta_table = $wpdb->prefix . 'usermeta';
    251251        $users_table = $wpdb->base_prefix . 'users';
  • trunk/bp-groups/bp-groups-classes.php

    r1929 r2055  
    247247            $user_id = $bp->displayed_user->id;
    248248       
    249         like_escape($filter);
     249        $filter = like_escape( $wpdb->escape( $filter ) );
    250250       
    251251        if ( $limit && $page )
     
    269269        global $wpdb, $bp;
    270270       
    271         like_escape($filter);
     271        $filter = like_escape( $wpdb->escape( $filter ) );
    272272       
    273273        if ( $limit && $page )
     
    463463            $hidden_sql = $wpdb->prepare( " AND status != 'hidden'");
    464464       
    465         like_escape($letter);
    466                
     465        $letter = like_escape( $wpdb->escape( $letter ) );
     466
    467467        if ( $limit && $page ) {
    468468            $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
     
    699699
    700700        if ( $filter ) {
    701             like_escape($filter);
     701            $filter = like_escape( $wpdb->escape( $filter ) );
    702702            $filter_sql = " AND ( g.name LIKE '{$filter}%%' OR g.description LIKE '{$filter}%%' )";         
    703703        }
     
    719719
    720720        if ( $filter ) {
    721             like_escape($filter);
     721            like_escape( $wpdb->escape( $filter ) );
    722722            $filter_sql = " AND ( g.name LIKE '{$filter}%%' OR g.description LIKE '{$filter}%%' )";         
    723723        }
     
    739739           
    740740        if ( $filter ) {
    741             like_escape($filter);
     741            $filter = like_escape( $wpdb->escape( $filter ) );
    742742            $filter_sql = " AND ( g.name LIKE '{$filter}%%' OR g.description LIKE '{$filter}%%' )";         
    743743        }
     
    759759
    760760        if ( $filter ) {
    761             like_escape($filter);
     761            $filter = like_escape( $wpdb->escape( $filter ) );
    762762            $filter_sql = " AND ( g.name LIKE '{$filter}%%' OR g.description LIKE '{$filter}%%' )";         
    763763        }
     
    779779
    780780        if ( $filter ) {
    781             like_escape($filter);
     781            $filter = like_escape( $wpdb->escape( $filter ) );
    782782            $filter_sql = " AND ( g.name LIKE '{$filter}%%' OR g.description LIKE '{$filter}%%' )";         
    783783        }
     
    799799
    800800        if ( $filter ) {
    801             like_escape($filter);
     801            $filter = like_escape( $wpdb->escape( $filter ) );
    802802            $filter_sql = " AND ( g.name LIKE '{$filter}%%' OR g.description LIKE '{$filter}%%' )";         
    803803        }
  • trunk/bp-groups/bp-groups-templatetags.php

    r2032 r2055  
    16501650    function bp_get_new_group_description() {
    16511651        global $bp;
    1652         return apply_filters( 'bp_get_new_group_description', $bp->groups->current_group->name );
     1652        return apply_filters( 'bp_get_new_group_description', $bp->groups->current_group->description );
    16531653    }
    16541654
     
    16581658    function bp_get_new_group_news() {
    16591659        global $bp;
    1660         return apply_filters( 'bp_get_new_group_news', $bp->groups->current_group->name );
     1660        return apply_filters( 'bp_get_new_group_news', $bp->groups->current_group->news );
    16611661    }
    16621662
  • trunk/bp-themes/bp-sn-parent/_inc/js/ajax.js

    r2031 r2055  
    7979            page = page.split('upage=');
    8080           
    81             if ( !j("input#selected_letter").val() )
     81            if ( undefined === j("input#selected_letter").val() )
    8282                var letter = '';
    8383            else
    8484                var letter = j("input#selected_letter").val();
    8585                       
    86             if ( !j("input#search_terms").val() )
     86            if ( undefined === j("input#search_terms").val() )
    8787                var search_terms = '';
    8888            else
     
    333333            page = page.split('gpage=');
    334334           
    335             if ( !j("input#selected_letter").val() )
     335            if ( undefined === j("input#selected_letter").val() )
    336336                var letter = '';
    337337            else
    338338                var letter = j("input#selected_letter").val();
    339339                       
    340             if ( !j("input#search_terms").val() )
     340            if ( undefined === j("input#search_terms").val() )
    341341                var search_terms = '';
    342342            else
     
    973973    );
    974974
    975     j("form#status-update-form").livequery('submit',
    976         function() {
    977             j.post( ajaxurl, {
    978                 action: 'status_new_status',
    979                 'cookie': encodeURIComponent(document.cookie),
    980                 '_wpnonce': j('input#_wpnonce_add_status').val(),
    981                 'status-update-input': j('#status-update-input').val()
    982             },
    983             function(response) {
    984                 if ( response == "1" ) {           
    985                     j("div#user-status").slideUp(400,
    986                         function() {
    987                             j.post( ajaxurl, {
    988                                 action: 'status_show_status',
    989                                 'cookie': encodeURIComponent(document.cookie)
    990                             },
    991                             function(response) {               
    992                                 j("div#user-status").html(response);
    993                                 j("div#user-status").slideDown(400);
    994                                 j(window).unbind('click');
    995                             });
    996                         }
    997                     );
    998                 }
    999             });
    1000 
    1001             return false;
    1002         }
    1003     );
    1004 
    1005975    j("a#status-clear-status").livequery('click',
    1006976        function() {
     
    10941064            page = page.split('bpage=');
    10951065           
    1096             if ( !j("input#selected_letter").val() )
     1066            if ( undefined === j("input#selected_letter").val() )
    10971067                var letter = '';
    10981068            else
    10991069                var letter = j("input#selected_letter").val();
    11001070                       
    1101             if ( !j("input#search_terms").val() )
     1071            if ( undefined === j("input#search_terms").val() )
    11021072                var search_terms = '';
    11031073            else
  • trunk/bp-themes/bp-sn-parent/wire/post-form.php

    r1905 r2055  
    3838           
    3939            <input type="submit" name="wire-post-submit" id="wire-post-submit" value="<?php _e( 'Post &raquo;', 'buddypress' ) ?>" />
    40             <input type="hidden" name="bp_wire_item_id" id="bp_wire_item_id" value="<?php echo bp_get_wire_item_id() ?>" />
    4140
    4241            <?php wp_nonce_field( 'bp_wire_post' ) ?>
  • trunk/bp-themes/bp-sn-parent/wire/post-list.php

    r1905 r2055  
    5959       
    6060        <?php do_action( 'bp_after_wire_post_list' ) ?>
    61    
     61
     62        <input type="hidden" name="bp_wire_item_id" id="bp_wire_item_id" value="<?php echo bp_get_wire_item_id() ?>" />
    6263    </div>
    6364    <?php else: ?>
Note: See TracChangeset for help on using the changeset viewer.