Skip to:
Content

BuddyPress.org

Changeset 1032 for trunk/bp-friends.php


Ignore:
Timestamp:
02/09/2009 06:52:51 AM (17 years ago)
Author:
apeatling
Message:

Added nonce security checks to all BuddyPress actions. Fixes #454

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-friends.php

    r1030 r1032  
    7373    if ( is_site_admin() ) {
    7474        /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    75         if ( ( false == $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->friends->table_name}%'") ) || ( get_site_option('bp-friends-db-version') < BP_FRIENDS_DB_VERSION )  )
     75        if ( ( !$wpdb->get_var( "SHOW TABLES LIKE '%{$bp->friends->table_name}%'") ) || ( get_site_option('bp-friends-db-version') < BP_FRIENDS_DB_VERSION )  )
    7676            friends_install();
    7777    }
     
    484484    global $bp;
    485485   
     486    /* Check the nonce */
     487    if ( !check_admin_referer( 'friends_add_friend' ) )
     488        return false;
     489   
    486490    $friendship = new BP_Friends_Friendship;
    487491   
     
    513517function friends_remove_friend( $initiator_userid, $friend_userid ) {
    514518    global $bp;
     519
     520    /* Check the nonce */
     521    if ( !check_admin_referer( 'friends_remove_friend' ) )
     522        return false;
    515523       
    516524    $friendship_id = BP_Friends_Friendship::get_friendship_id( $initiator_userid, $friend_userid );
     
    532540
    533541function friends_accept_friendship( $friendship_id ) {
     542    /* Check the nonce */
     543    if ( !check_admin_referer( 'friends_accept_friendship' ) )
     544        return false;
     545       
    534546    $friendship = new BP_Friends_Friendship( $friendship_id, true, false );
    535    
     547
    536548    if ( !$friendship->is_confirmed && BP_Friends_Friendship::accept( $friendship_id ) ) {
    537549        friends_update_friend_totals( $friendship->initiator_user_id, $friendship->friend_user_id );
     
    555567
    556568function friends_reject_friendship( $friendship_id ) {
     569    /* Check the nonce */
     570    if ( !check_admin_referer( 'friends_reject_friendship' ) )
     571        return false;
     572       
    557573    $friendship = new BP_Friends_Friendship( $friendship_id, true, false );
    558574
Note: See TracChangeset for help on using the changeset viewer.