Changeset 1671

Show
Ignore:
Timestamp:
08/27/08 22:32:37 (3 months ago)
Author:
mdawaffe
Message:

PHP Notice and HTML Validation fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bb-admin/admin-functions.php

    r1664 r1671  
    176176        global $bb_current_menu, $bb_current_submenu; 
    177177        $title = bb_get_option('name') . ' › ' . $bb_current_menu[0] . ( $bb_current_submenu ? ' » ' . $bb_current_submenu[0] : '' ) . ' — bbPress'; 
    178         echo $title
     178        echo wp_specialchars( $title )
    179179} 
    180180 
     
    391391 
    392392        function results_are_paged() { 
    393                 if ( $this->paging_text ) 
     393                if ( isset($this->paging_text) && $this->paging_text ) 
    394394                        return true; 
    395395                return false; 
     
    10151015 
    10161016        $plugin_name = wp_specialchars( trim($plugin_name[1]) ); 
    1017         $plugin_uri = clean_url( trim($plugin_uri[1]) ); 
    1018         $author_name = wp_specialchars( trim($author_name[1]) ); 
    1019         $author_uri = clean_url( trim($author_uri[1]) ); 
    1020  
    1021         $description = trim($description[1]); 
    1022         $description = bb_encode_bad( $description ); 
    1023         $description = bb_code_trick( $description ); 
    1024         $description = force_balance_tags( $description ); 
    1025         $description = bb_filter_kses( $description ); 
    1026         $description = bb_autop( $description ); 
     1017 
     1018        if ( $plugin_uri ) 
     1019                $plugin_uri = clean_url( trim($plugin_uri[1]) ); 
     1020        else 
     1021                $plugin_uri = ''; 
     1022 
     1023        if ( $author_name ) 
     1024                $author_name = wp_specialchars( trim($author_name[1]) ); 
     1025        else 
     1026                $author_name = ''; 
     1027 
     1028        if ( $author_uri ) 
     1029                $author_uri = clean_url( trim($author_uri[1]) ); 
     1030        else 
     1031                $author_uri = ''; 
     1032 
     1033        if ( $description ) { 
     1034                $description = trim($description[1]); 
     1035                $description = bb_encode_bad( $description ); 
     1036                $description = bb_code_trick( $description ); 
     1037                $description = force_balance_tags( $description ); 
     1038                $description = bb_filter_kses( $description ); 
     1039                $description = bb_autop( $description ); 
     1040        } else { 
     1041                $description = ''; 
     1042        } 
    10271043 
    10281044        $plugin_file = str_replace( '\\', '/', $plugin_file ); 
     
    11111127        $theme = $name; 
    11121128 
    1113         if ( '' == $author_uri[1] ) { 
    1114                 $author = wp_specialchars( trim($author_name[1]) ); 
     1129        if ( $author_name || $author_uri ) { 
     1130                if ( empty($author_uri[1]) ) { 
     1131                        $author = wp_specialchars( trim($author_name[1]) ); 
     1132                } else { 
     1133                        $author = '<a href="' . clean_url( trim($author_uri[1]) ) . '" title="' . attribute_escape( __('Visit author homepage') ) . '">' . wp_specialchars( trim($author_name[1]) ) . '</a>'; 
     1134                } 
    11151135        } else { 
    1116                 $author = '<a href="' . clean_url( trim($author_uri[1]) ) . '" title="' . attribute_escape( __('Visit author homepage') ) . '">' . wp_specialchars( trim($author_name[1]) ) . '</a>'; 
    1117         } 
    1118  
    1119         if ( '' == $porter_uri[1] ) { 
    1120                 $porter = wp_specialchars( trim($porter_name[1]) ); 
     1136                $author = ''; 
     1137        } 
     1138 
     1139        if ( $porter_name || $porter_uri ) { 
     1140                if ( empty($porter_uri[1]) ) { 
     1141                        $porter = wp_specialchars( trim($porter_name[1]) ); 
     1142                } else { 
     1143                        $porter = '<a href="' . clean_url( trim($porter_uri[1]) ) . '" title="' . attribute_escape( __('Visit porter homepage') ) . '">' . wp_specialchars( trim($porter_name[1]) ) . '</a>'; 
     1144                } 
    11211145        } else { 
    1122                 $porter = '<a href="' . clean_url( trim($porter_uri[1]) ) . '" title="' . attribute_escape( __('Visit porter homepage') ) . '">' . wp_specialchars( trim($porter_name[1]) ) . '</a>'; 
     1146                $porter = ''; 
    11231147        } 
    11241148 
     
    11361160} 
    11371161 
     1162if ( !function_exists( 'checked' ) ) : 
     1163function checked( $checked, $current) { 
     1164        if ( $checked == $current) 
     1165                echo ' checked="checked"'; 
     1166} 
     1167endif; 
     1168 
     1169if ( !function_exists( 'selected' ) ) : 
     1170function selected( $selected, $current) { 
     1171        if ( $selected == $current) 
     1172                echo ' selected="selected"'; 
     1173} 
     1174endif; 
     1175 
    11381176?> 
  • trunk/bb-admin/content-posts.php

    r1333 r1671  
    3131        $h2_noun = __('Posts'); 
    3232else 
    33         $h2_noun = sprintf( __( '%1$sposts'), $stati[$h2_status], $topic_open[$h2_open] ); 
     33        $h2_noun = sprintf( __( '%1$sposts'), $stati[$h2_status] ); 
    3434 
    3535printf( __( '%1$s%2$s%3$s%4$s%5$s' ), $h2_noun, $h2_search, $h2_forum, $h2_tag, $h2_author ); 
  • trunk/bb-admin/options-general.php

    r1602 r1671  
    22require_once('admin.php'); 
    33 
    4 if ($_POST['action'] == 'update') { 
     4if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && $_POST['action'] == 'update') { 
    55         
    66        bb_check_admin_referer( 'options-general-update' ); 
     
    3232} 
    3333 
    34 if ($_GET['updated']) { 
     34if ( !empty($_GET['updated']) ) { 
    3535        bb_admin_notice( __('Settings saved.') ); 
    3636} 
     
    8585                        <div> 
    8686                                <select name="mod_rewrite" id="mod_rewrite"> 
    87 <?php 
    88 $selected = array(); 
    89 $selected[bb_get_option('mod_rewrite')] = ' selected="selected"'; 
    90 ?> 
    91                                         <option value="0"<?php echo $selected[0]; ?>><?php _e('None'); ?>&nbsp;&nbsp;&nbsp;.../forums.php?id=1</option> 
    92                                         <option value="1"<?php echo $selected[1]; ?>><?php _e('Numeric'); ?>&nbsp;&nbsp;&nbsp;.../forums/1</option> 
    93                                         <option value="slugs"<?php echo $selected['slugs']; ?>><?php _e('Name based'); ?>&nbsp;&nbsp;&nbsp;.../forums/first-forum</option> 
    94 <?php 
    95 unset($selected); 
    96 ?> 
     87                                        <option value="0"<?php selected( bb_get_option('mod_rewrite'), 0 ); ?>><?php _e('None'); ?>&nbsp;&nbsp;&nbsp;.../forums.php?id=1</option> 
     88                                        <option value="1"<?php selected( bb_get_option('mod_rewrite'), 1 ); ?>><?php _e('Numeric'); ?>&nbsp;&nbsp;&nbsp;.../forums/1</option> 
     89                                        <option value="slugs"<?php selected( bb_get_option('mod_rewrite'), 'slugs' ); ?>><?php _e('Name based'); ?>&nbsp;&nbsp;&nbsp;.../forums/first-forum</option> 
    9790                                </select> 
    9891                                <p><?php printf(__('If you activate "Numeric" or "Name based" permalinks, you will need to create a file at <code>%s</code> containing the url rewriting rules <a href="%s">provided here</a>.'), BB_PATH . '.htaccess', bb_get_uri('bb-admin/rewrite-rules.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN)); ?></p> 
     
    170163                        </label> 
    171164                        <div> 
    172 <?php 
    173 $checked = array(); 
    174 $checked[bb_get_option('avatars_show')] = ' checked="checked"'; 
    175 ?> 
    176                                 <input type="checkbox" class="checkbox" name="avatars_show" id="avatars_show" value="1"<?php echo $checked[1]; ?> /> 
    177 <?php 
    178 unset($checked); 
    179 ?> 
    180                         </div> 
    181                 </div> 
     165                                <input type="checkbox" class="checkbox" name="avatars_show" id="avatars_show" value="1"<?php checked( bb_get_option('avatars_show'), 1 ); ?> /> 
     166                        </div> 
     167                </div> 
     168<?php 
     169        $bb_get_option_avatars_show = create_function( '$a', 'return 1;' ); 
     170        add_filter( 'bb_get_option_avatars_show', $bb_get_option_avatars_show ); 
     171?> 
    182172                <div> 
    183173                        <label for="avatars_default"> 
     
    186176                        <div> 
    187177                                <select name="avatars_default" id="avatars_default"> 
    188 <?php 
    189 $selected = array(); 
    190 $selected[bb_get_option('avatars_default')] = ' selected="selected"'; 
    191 ?> 
    192                                         <option value="default"<?php echo $selected['default']; ?>><?php _e('Default'); ?></option> 
    193                                         <option value="logo"<?php echo $selected['logo']; ?>><?php _e('Gravatar Logo'); ?></option> 
    194                                         <option value="monsterid"<?php echo $selected['monsterid']; ?>><?php _e('MonsterID'); ?></option> 
    195                                         <option value="wavatar"<?php echo $selected['wavatar']; ?>><?php _e('Wavatar'); ?></option> 
    196                                         <option value="identicon"<?php echo $selected['identicon']; ?>><?php _e('Identicon'); ?></option> 
    197 <?php 
    198 unset($selected); 
    199 ?> 
     178                                        <option value="default"<?php selected( bb_get_option('avatars_default'), 'default' ); ?>><?php _e('Default'); ?></option> 
     179                                        <option value="logo"<?php selected( bb_get_option('avatars_default'), 'logo' ); ?>><?php _e('Gravatar Logo'); ?></option> 
     180                                        <option value="monsterid"<?php selected( bb_get_option('avatars_default'), 'monsterid' ); ?>><?php _e('MonsterID'); ?></option> 
     181                                        <option value="wavatar"<?php selected( bb_get_option('avatars_default'), 'wavatar' ); ?>><?php _e('Wavatar'); ?></option> 
     182                                        <option value="identicon"<?php selected( bb_get_option('avatars_default'), 'identicon' ); ?>><?php _e('Identicon'); ?></option> 
    200183                                </select> 
    201184                                <p>Select what style of avatar to display to users without a Gravatar</p> 
     
    217200                        </div> 
    218201                </div> 
     202<?php 
     203        remove_filter( 'bb_get_option_avatars_show', $bb_get_option_avatars_show ); 
     204?> 
    219205                <div> 
    220206                        <label for="avatars_rating"> 
     
    223209                        <div> 
    224210                                <select name="avatars_rating" id="avatars_rating"> 
    225 <?php 
    226 $selected = array(); 
    227 $selected[bb_get_option('avatars_rating')] = ' selected="selected"'; 
    228 ?> 
    229                                         <option value="0"<?php echo $selected[0]; ?>><?php _e('None'); ?></option> 
    230                                         <option value="x"<?php echo $selected['x']; ?>><?php _e('X'); ?></option> 
    231                                         <option value="r"<?php echo $selected['r']; ?>><?php _e('R'); ?></option> 
    232                                         <option value="pg"<?php echo $selected['pg']; ?>><?php _e('PG'); ?></option> 
    233                                         <option value="g"<?php echo $selected['g']; ?>><?php _e('G'); ?></option> 
    234 <?php 
    235 unset($selected); 
    236 ?> 
     211                                        <option value="0"<?php selected( bb_get_option('avatars_rating'), 0 ); ?>><?php _e('None'); ?></option> 
     212                                        <option value="x"<?php selected( bb_get_option('avatars_rating'), 'x' ); ?>><?php _e('X'); ?></option> 
     213                                        <option value="r"<?php selected( bb_get_option('avatars_rating'), 'r' ); ?>><?php _e('R'); ?></option> 
     214                                        <option value="pg"<?php selected( bb_get_option('avatars_rating'), 'pg' ); ?>><?php _e('PG'); ?></option> 
     215                                        <option value="g"<?php selected( bb_get_option('avatars_rating'), 'g' ); ?>><?php _e('G'); ?></option> 
    237216                                </select> 
    238217                                <p class="gravatarRating"> 
  • trunk/bb-admin/options-wordpress.php

    r1606 r1671  
    22require_once('admin.php'); 
    33 
    4 $action = $_POST['action']; 
     4if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) ) 
     5        $action = @$_POST['action']; 
     6else 
     7        $action = false; 
    58 
    69if ( in_array( $action, array('update-users', 'update-options') ) ) { 
     
    3639} 
    3740 
    38 switch ($_GET['updated']) { 
     41switch (@$_GET['updated']) { 
    3942        case 'update-users': 
    4043                bb_admin_notice( __('User role mapping saved.') ); 
     
    167170                </div> 
    168171                <script type="text/javascript" charset="utf-8"> 
     172/* <![CDATA[ */ 
    169173                        function updateWordPressOptionURL () { 
    170174                                var siteURLInputValue = document.getElementById('wp_siteurl').value; 
     
    193197                        siteURLInput.onclick = updateWordPressOptionURL; 
    194198                        siteURLInput.onchange = updateWordPressOptionURL; 
     199/* ]]> */ 
    195200                </script> 
    196201<?php 
     
    247252                        </label> 
    248253<?php 
    249 $advanced_display = 'none'; 
    250254if ( bb_get_option('user_bbdb_advanced') ) { 
    251255        $advanced_display = 'block'; 
    252256        $checked = ' checked="checked"'; 
    253 
     257} else { 
     258        $advanced_display = 'none'; 
     259        $checked = ''; 
     260
     261         
    254262?> 
    255263                        <script type="text/javascript" charset="utf-8"> 
  • trunk/bb-admin/themes.php

    r1603 r1671  
    5656        $activation_url = clean_url( bb_nonce_url( $activation_url, 'switch-theme' ) ); 
    5757?> 
    58         <li<?php alt_class( 'theme', $class ); ?>> 
     58        <li<?php alt_class( 'theme' ); ?>> 
    5959                <div class="screen-shot"><?php if ( $screen_shot ) : ?><a href="<?php echo $activation_url; ?>" title="<?php echo attribute_escape( __('Click to activate') ); ?>"><img alt="<?php echo attribute_escape( $theme_data['Title'] ); ?>" src="<?php echo $screen_shot; ?>" /></a><?php endif; ?></div> 
    6060                <div class="description"> 
  • trunk/bb-admin/users-blocked.php

    r1299 r1671  
    33 
    44// Query the users 
    5 $bb_blocked_users = new BB_Users_By_Role( array('inactive', 'blocked'), $_GET['userspage'] ); 
     5$bb_blocked_users = new BB_Users_By_Role( array('inactive', 'blocked'), @$_GET['userspage'] ); 
    66 
    77bb_get_admin_header(); 
  • trunk/bb-admin/users-moderators.php

    r1299 r1671  
    33 
    44// Query the users 
    5 $bb_moderators = new BB_Users_By_Role( bb_trusted_roles(), $_GET['userspage'] ); 
     5$bb_moderators = new BB_Users_By_Role( bb_trusted_roles(), @$_GET['userspage'] ); 
    66 
    77bb_get_admin_header(); 
  • trunk/bb-admin/users.php

    r1299 r1671  
    33 
    44// Query the users 
    5 $bb_user_search = new BB_User_Search($_GET['usersearch'], $_GET['userspage']); 
     5$bb_user_search = new BB_User_Search(@$_GET['usersearch'], @$_GET['userspage']); 
    66 
    77bb_get_admin_header(); 
  • trunk/bb-includes/class-bb-taxonomy.php

    r1618 r1671  
    159159                } else { 
    160160                        $t = $this->get_taxonomy($taxonomies[0]); 
    161                         if ( is_array($t->args) ) 
     161                        if ( isset($t->args) && is_array($t->args) ) 
    162162                                $args = array_merge($args, $t->args); 
    163163                } 
  • trunk/bb-includes/classes.php

    r1528 r1671  
    279279                // Only one FULLTEXT search per query please 
    280280                if ( $array['search'] ) 
    281                         unset($array['post_text'])
     281                        $array['post_text'] = false
    282282 
    283283                return $array; 
     
    11081108 
    11091109                // Walk the tree. 
    1110                 if ( !empty($this->previous_element) && ($element->$parent_field == $this->previous_element->$id_field) ) { 
     1110                if ( !empty($element) && !empty($this->previous_element) && $element->$parent_field == $this->previous_element->$id_field ) { 
    11111111                        // Previous element is my parent. Descend a level. 
    11121112                        array_unshift($this->parents, $this->previous_element); 
     
    11191119                        } 
    11201120                        $this->depth++; //always do this so when we start the element further down, we know where we are 
    1121                 } else if ( $element->$parent_field == $this->previous_element->$parent_field) { 
     1121                } else if ( !empty($element) && !empty($this->previous_element) && $element->$parent_field == $this->previous_element->$parent_field) { 
    11221122                        // On the same level as previous element. 
    11231123                        if ( !$to_depth || ($this->depth <= $to_depth) ) { 
     
    11401140                                        call_user_func_array(array(&$this, 'end_el'), $cb_args); 
    11411141                                } 
    1142                                 if ( isset($this->parents[0]) && $element->$parent_field == $this->parents[0]->$id_field ) { 
     1142                                if ( !empty($element) && isset($this->parents[0]) && $element->$parent_field == $this->parents[0]->$id_field ) { 
    11431143                                        break; 
    11441144                                } 
     
    11541154                // Start the element. 
    11551155                if ( !$to_depth || ($this->depth <= $to_depth) ) { 
    1156                         if ( $element->$id_field != 0 ) { 
     1156                        if ( !empty($element) && $element->$id_field != 0 ) { 
    11571157                                $cb_args = array_merge( array(&$output, $element, $this->depth - 1), $args); 
    11581158                                call_user_func_array(array(&$this, 'start_el'), $cb_args); 
     
    12001200 
    12011201        function &start( $elements, $walker = 'BB_Walker_Blank' ) { 
     1202                $null = null; 
    12021203                $a = new BB_Loop( $elements ); 
    12031204                if ( !$a->elements ) 
    1204                         return null; 
     1205                        return $null; 
    12051206                $a->walker = new $walker; 
    12061207                return $a; 
     
    12451246 
    12461247                foreach ( $array as $key ) 
    1247                         $this->_preserve[$key] = $GLOBALS[$key]; 
     1248                        if ( isset($GLOBALS[$key]) ) 
     1249                                $this->_preserve[$key] = $GLOBALS[$key]; 
    12481250        } 
    12491251 
     
    12701272                        end($this->elements); 
    12711273 
    1272                 if ( $next->{$this->walker->db_fields['parent']} == $current->{$this->walker->db_fields['id']} ) 
     1274                if ( !empty($next) && $next->{$this->walker->db_fields['parent']} == $current->{$this->walker->db_fields['id']} ) 
    12731275                        $classes[] = 'bb-parent'; 
    1274                 elseif ( $next->{$this->walker->db_fields['parent']} == $current->{$this->walker->db_fields['parent']} ) 
     1276                elseif ( !empty($next) && $next->{$this->walker->db_fields['parent']} == $current->{$this->walker->db_fields['parent']} ) 
    12751277                        $classes[] = 'bb-precedes-sibling'; 
    12761278                else 
    12771279                        $classes[] = 'bb-last-child'; 
    12781280 
    1279                 if ( $current->{$this->walker->db_fields['parent']} == $prev->{$this->walker->db_fields['id']} ) 
     1281                if ( !empty($prev) && $current->{$this->walker->db_fields['parent']} == $prev->{$this->walker->db_fields['id']} ) 
    12801282                        $classes[] = 'bb-first-child'; 
    1281                 elseif ( $current->{$this->walker->db_fields['parent']} == $prev->{$this->walker->db_fields['parent']} ) 
     1283                elseif ( !empty($prev) && $current->{$this->walker->db_fields['parent']} == $prev->{$this->walker->db_fields['parent']} ) 
    12821284                        $classes[] = 'bb-follows-sibling'; 
    12831285                elseif ( $prev ) 
  • trunk/bb-includes/default-filters.php

    r1669 r1671  
    2525 
    2626// Format Strings for Display 
    27 $filters = array( 'get_forum_name', 'topic_title' ); 
     27$filters = array( 'get_forum_name', 'topic_title', 'bb_title', 'bb_option_name' ); 
    2828foreach ( $filters as $filter ) { 
    2929        add_filter( $filter, 'wp_specialchars' ); 
  • trunk/bb-includes/functions.php

    r1663 r1671  
    309309        if ( $cache ) { 
    310310                wp_cache_set( $topic->topic_id, $topic, 'bb_topic' ); 
    311                 wp_cache_add( $topic->topic_slug, $topic_id, 'bb_topic_slug' ); 
     311                wp_cache_add( $topic->topic_slug, $topic->topic_id, 'bb_topic_slug' ); 
    312312        } 
    313313 
     
    16001600function get_user_favorites( $user_id, $topics = false ) { 
    16011601        $user = bb_get_user( $user_id ); 
    1602         if ( $user->favorites ) { 
     1602        if ( !empty($user->favorites) ) { 
    16031603                if ( $topics ) 
    16041604                        $query = new BB_Query( 'topic', array('favorites' => $user_id, 'append_meta' => 0), 'get_user_favorites' ); 
     
    16211621                return; 
    16221622 
    1623         return in_array($topic->topic_id, explode(',', $user->favorites)); 
     1623        if ( isset($user->favorites) ) 
     1624                return in_array($topic->topic_id, explode(',', $user->favorites)); 
     1625        return false; 
    16241626} 
    16251627 
     
    16641666 
    16651667function bb_option( $option ) { 
    1666         echo bb_get_option( $option )
     1668        echo apply_filters( 'bb_option_' . $option, bb_get_option( $option ) )
    16671669} 
    16681670 
     
    18821884                $resource = $_resource; 
    18831885                $_query = wp_parse_args($_query); 
    1884         } 
    1885          
    1886         // Make sure $_query is an array for array_merge() 
    1887         if (!$_query) { 
     1886        } else { 
     1887                // Make sure $_query is an array for array_merge() 
    18881888                $_query = array(); 
    18891889        } 
     
    20382038 */ 
    20392039function bb_is_ssl() { 
    2040         return ( 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false; 
     2040        return ( 'on' == strtolower(@$_SERVER['HTTPS']) ) ? true : false; 
    20412041} 
    20422042 
     
    23892389// GMT -> Local 
    23902390// in future versions this could eaily become a user option. 
    2391 function bb_offset_time( $time, $args = '' ) { 
    2392         if ( 'since' == $args['format'] ) 
     2391function bb_offset_time( $time, $args = null ) { 
     2392        if ( isset($args['format']) && 'since' == $args['format'] ) 
    23932393                return $time; 
    23942394        if ( !is_numeric($time) ) { 
     
    30953095                        $sql_terms[] = "$field LIKE ('%$likeit%')"; 
    30963096 
    3097         if ( $user_meta_ids ) 
     3097        if ( isset($user_meta_ids) && $user_meta_ids ) 
    30983098                $sql_terms[] = "ID IN (". join(',', $user_meta_ids) . ")"; 
    30993099 
  • trunk/bb-includes/template-functions.php

    r1661 r1671  
    135135        global $page, $topic, $forum; 
    136136         
    137         if ($forum->forum_is_category
     137        if ( isset($forum->forum_is_category) && $forum->forum_is_category
    138138                return; 
    139139         
     
    148148        } 
    149149 
    150         $last_page = get_page_number( $topic->topic_posts + $add ); 
     150        $last_page = get_page_number( ( isset($topic->topic_posts) ? $topic->topic_posts : 0 ) + $add ); 
    151151 
    152152        if ( !empty($h2) ) { 
     
    158158        do_action('pre_post_form'); 
    159159 
    160         if ( ( is_topic() && bb_current_user_can( 'write_post', $topic->topic_id ) && $page == $last_page ) || ( !is_topic() && bb_current_user_can( 'write_topic', $forum->forum_id ) ) ) { 
     160        if ( ( is_topic() && bb_current_user_can( 'write_post', $topic->topic_id ) && $page == $last_page ) || ( !is_topic() && bb_current_user_can( 'write_topic', isset($forum->forum_id) ? $forum->forum_id : 0 ) ) ) { 
    161161                echo '<form class="postform post-form" id="postform" method="post" action="' . bb_get_uri('bb-post.php', null, BB_URI_CONTEXT_FORM_ACTION) . '">' . "\n"; 
    162162                echo '<fieldset>' . "\n"; 
     
    578578function bb_get_forum_is_category( $forum_id = 0 ) { 
    579579        $forum = get_forum( get_forum_id( $forum_id ) ); 
    580         return apply_filters( 'bb_get_forum_is_category', $forum->forum_is_category, $forum->forum_id ); 
     580        return apply_filters( 'bb_get_forum_is_category', isset($forum->forum_is_category) ? $forum->forum_is_category : false, $forum->forum_id ); 
    581581} 
    582582 
     
    602602        global $page; 
    603603        $forum = get_forum( get_forum_id( $forum_id ) ); 
    604         echo apply_filters( 'forum_pages', get_page_number_links( $page, $forum->topics ), $forum->forum_topics ); 
     604        echo apply_filters( 'forum_pages', get_page_number_links( $page, $forum->topics ), $forum->topics ); 
    605605} 
    606606 
     
    676676        } 
    677677        $current_trail_forum_id = $trail_forum->forum_id; 
    678         while ($trail_forum->forum_id > 0) { 
     678        while ( $trail_forum && $trail_forum->forum_id > 0 ) { 
    679679                $crumb = $separator; 
    680680                if ($current_trail_forum_id != $trail_forum->forum_id || !is_forum()) { 
     
    735735                return $bb_forums_loop->elements; 
    736736        } 
    737         return false; 
     737        $false = false; 
     738        return $false; 
    738739} 
    739740 
     
    790791        else 
    791792                $_topic =& $topic; 
    792         return $_topic->topic_id; 
     793        if ( !isset($topic->topic_id) ) 
     794                return 0; 
     795 
     796        return (int) $_topic->topic_id; 
    793797} 
    794798 
     
    875879function get_topic_deleted_posts( $id = 0 ) { 
    876880        $topic = get_topic( get_topic_id( $id ) ); 
    877         return apply_filters( 'get_topic_deleted_posts', $topic->deleted_posts, $topic->topic_id ); 
     881        return apply_filters( 'get_topic_deleted_posts', isset($topic->deleted_posts) ? $topic->deleted_posts : 0, $topic->topic_id ); 
    878882} 
    879883 
     
    958962function topic_pages_add( $id = 0 ) { 
    959963        $topic = get_topic( get_topic_id( $id ) ); 
    960         if ( isset($_GET['view']) && 'all' == $_GET['view'] && bb_current_user_can('browse_deleted') ) 
    961                 $add += $topic->deleted_posts; 
    962         return apply_filters( 'topic_pages_add', $add, $topic->topic_id ); 
     964        if ( isset($_GET['view']) && 'all' == $_GET['view'] && bb_current_user_can('browse_deleted') && isset( $topic->deleted_posts ) ) 
     965                $add = $topic->deleteted_posts; 
     966        else 
     967                $add = 0; 
     968        return apply_filters( 'topic_pages_add', $add, isset($topic->topic_id) ? $topic->topic_id : 0 ); 
    963969} 
    964970 
     
    10741080        $uri = attribute_escape( bb_nonce_url( $uri, 'close-topic_' . $topic->topic_id ) ); 
    10751081         
    1076         return $before . '<a href="' . $uri . '" onclick="return confirm(\'' . js_escape( $confirm ) . '\');">' . $display . '</a>' . $after; 
     1082        return $before . '<a href="' . $uri . '">' . $display . '</a>' . $after; 
    10771083} 
    10781084 
     
    16621668        if ( is_array( $profile_info_keys ) ) { 
    16631669                foreach ( $profile_info_keys as $key => $label ) { 
    1664                         if ( in_array($key, array('first_name', 'last_name', 'display_name'))
     1670                        if ( in_array($key, array('first_name', 'last_name', 'display_name')) || !isset($user->$key)
    16651671                                continue; 
    16661672                        $val = 'user_url' == $key ? get_user_link( $user->ID ) : $user->$key; 
    16671673                        if ( 
    16681674                                ( 'user_email' != $key || ( 'user_email' == $key && bb_current_user_can( 'edit_users' ) ) ) 
    1669                                 && isset( $user->$key ) 
    16701675                                && $val 
    16711676                                && 'http://' != $val 
     
    17271732                                $message = "<p class='error'>$message</p>"; 
    17281733                        } else { 
    1729                                 $value = $user->$key
     1734                                $value = isset( $user->$key ) ? $user->$key : ''
    17301735                                $message = ''; 
    17311736                        } 
     
    17461751                                //$public_display['display_nickname'] = $user->nickname; 
    17471752                                $public_display['display_username'] = $user->user_login; 
    1748                                 $public_display['display_firstname'] = $user->first_name; 
    1749                                 $public_display['display_firstlast'] = $user->first_name.' '.$user->last_name; 
    1750                                 $public_display['display_lastfirst'] = $user->last_name.' '.$user->first_name; 
     1753                                if ( isset($user->first_name) ) { 
     1754                                        $public_display['display_firstname'] = $user->first_name; 
     1755                                        if ( isset($user->last_name) ) { 
     1756                                                $public_display['display_firstlast'] = $user->first_name.' '.$user->last_name; 
     1757                                                $public_display['display_lastfirst'] = $user->last_name.' '.$user->first_name; 
     1758                                        } 
     1759                                } 
     1760                                if ( isset($user->last_name) ) 
     1761                                        $public_display['display_lastname'] = $user->last_name; 
     1762                                 
    17511763                                $public_display = array_unique(array_filter(array_map('trim', $public_display))); 
    17521764                                 
     
    18821894                                        $value = $label[3]; 
    18831895                                } else { 
    1884                                         $value = $user->$key
     1896                                        $value = isset($user->$key) ? $user->$key : ''
    18851897                                } 
    18861898                                $message = ''; 
     
    21162128        else 
    21172129                $_tag =& $tag; 
    2118         return $_tag->raw_tag; 
     2130        if ( is_object($_tag) ) 
     2131                return $_tag->raw_tag; 
     2132        return ''; 
    21192133} 
    21202134 
     
    24182432        while ( $depth = bb_forum() ) : 
    24192433                global $forum; // Globals + References = Pain 
    2420                 if ($disable_categories && $forum->forum_is_category) { 
     2434                if ( $disable_categories && isset($forum->forum_is_category) && $forum->forum_is_category ) { 
    24212435                        $options[] = array( 
    24222436                                'value' => 0,