Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/11/2012 09:32:04 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Breathing room for cast variables.

File:
1 edited

Legend:

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

    r5567 r5729  
    6666    extract( $r, EXTR_SKIP );
    6767
    68     return bb_update_forum( array( 'forum_id' => (int)$forum_id, 'forum_name' => stripslashes( $forum_name ), 'forum_desc' => stripslashes( $forum_desc ), 'forum_slug' => stripslashes( $forum_slug ), 'forum_parent' => $forum_parent_id, 'forum_order' => $forum_order, 'forum_is_category' => $forum_is_category ) );
     68    return bb_update_forum( array( 'forum_id' => (int) $forum_id, 'forum_name' => stripslashes( $forum_name ), 'forum_desc' => stripslashes( $forum_desc ), 'forum_slug' => stripslashes( $forum_slug ), 'forum_parent' => $forum_parent_id, 'forum_order' => $forum_order, 'forum_is_category' => $forum_is_category ) );
    6969}
    7070
     
    175175        $topic_slug = sanitize_title( $topic_title );
    176176
    177     if ( !$topic_id = bb_insert_topic( array( 'topic_title' => stripslashes( $topic_title ), 'topic_slug' => $topic_slug, 'topic_poster' => $topic_poster, 'topic_poster_name' => $topic_poster_name, 'topic_last_poster' => $topic_last_poster, 'topic_last_poster_name' => $topic_last_poster_name, 'topic_start_time' => $topic_start_time, 'topic_time' => $topic_time, 'topic_open' => $topic_open, 'forum_id' => (int)$forum_id, 'tags' => $topic_tags ) ) )
     177    if ( !$topic_id = bb_insert_topic( array( 'topic_title' => stripslashes( $topic_title ), 'topic_slug' => $topic_slug, 'topic_poster' => $topic_poster, 'topic_poster_name' => $topic_poster_name, 'topic_last_poster' => $topic_last_poster, 'topic_last_poster_name' => $topic_last_poster_name, 'topic_start_time' => $topic_start_time, 'topic_time' => $topic_time, 'topic_open' => $topic_open, 'forum_id' => (int) $forum_id, 'tags' => $topic_tags ) ) )
    178178        return false;
    179179
     
    293293        }
    294294        $count = $bbdb->get_results( $bbdb->prepare( "SELECT t.topic_id FROM {$bbdb->topics} AS t {$groups_table_sql} WHERE {$groups_where_sql}" ) );
    295         $count = count( (array)$count );
     295        $count = count( (array) $count );
    296296    } else {
    297297        $count = 0;
     
    426426
    427427    // Get the topic ids
    428     foreach ( (array)$topics as $topic ) $topic_ids[] = $topic->topic_id;
    429     $topic_ids = $wpdb->escape( join( ',', (array)$topic_ids ) );
     428    foreach ( (array) $topics as $topic ) $topic_ids[] = $topic->topic_id;
     429    $topic_ids = $wpdb->escape( join( ',', (array) $topic_ids ) );
    430430
    431431    // Fetch the topic's last poster details
    432432    $poster_details = $wpdb->get_results( $wpdb->prepare( "SELECT t.topic_id, t.topic_last_poster, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u, {$bbdb->topics} t WHERE u.ID = t.topic_last_poster AND t.topic_id IN ( {$topic_ids} )" ) );
    433433    for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) {
    434         foreach ( (array)$poster_details as $poster ) {
     434        foreach ( (array) $poster_details as $poster ) {
    435435            if ( $poster->topic_id == $topics[$i]->topic_id ) {
    436436                $topics[$i]->topic_last_poster_email       = $poster->user_email;
     
    446446        $poster_names = $wpdb->get_results( $wpdb->prepare( "SELECT t.topic_id, pd.value FROM {$bp->profile->table_name_data} pd, {$bbdb->topics} t WHERE pd.user_id = t.topic_last_poster AND pd.field_id = 1 AND t.topic_id IN ( {$topic_ids} )" ) );
    447447        for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) {
    448             foreach ( (array)$poster_names as $name ) {
     448            foreach ( (array) $poster_names as $name ) {
    449449                if ( $name->topic_id == $topics[$i]->topic_id )
    450450                    $topics[$i]->topic_last_poster_displayname = $name->value;
     
    455455    // Loop through to make sure that each topic has the proper values set. This covers the
    456456    // case of deleted users
    457     foreach ( (array)$topics as $key => $topic ) {
     457    foreach ( (array) $topics as $key => $topic ) {
    458458        if ( !isset( $topic->topic_last_poster_email ) )
    459459            $topics[$key]->topic_last_poster_email = '';
     
    565565
    566566    // Get the user ids
    567     foreach ( (array)$posts as $post ) $user_ids[] = $post->poster_id;
    568     $user_ids = $wpdb->escape( join( ',', (array)$user_ids ) );
     567    foreach ( (array) $posts as $post ) $user_ids[] = $post->poster_id;
     568    $user_ids = $wpdb->escape( join( ',', (array) $user_ids ) );
    569569
    570570    // Fetch the poster's user_email, user_nicename and user_login
     
    572572
    573573    for ( $i = 0, $count = count( $posts ); $i < $count; ++$i ) {
    574         foreach ( (array)$poster_details as $poster ) {
     574        foreach ( (array) $poster_details as $poster ) {
    575575            if ( $poster->user_id == $posts[$i]->poster_id ) {
    576576                $posts[$i]->poster_email    = $poster->user_email;
     
    586586        $poster_names = $wpdb->get_results( $wpdb->prepare( "SELECT pd.user_id, pd.value FROM {$bp->profile->table_name_data} pd WHERE pd.user_id IN ( {$user_ids} )" ) );
    587587        for ( $i = 0, $count = count( $posts ); $i < $count; ++$i ) {
    588             foreach ( (array)$poster_names as $name ) {
     588            foreach ( (array) $poster_names as $name ) {
    589589                if ( isset( $topics[$i] ) && $name->user_id == $topics[$i]->user_id )
    590590                $posts[$i]->poster_name = $poster->value;
Note: See TracChangeset for help on using the changeset viewer.