Ticket #1728: errors.patch
File errors.patch, 16.6 KB (added by , 15 years ago) |
---|
-
bp-activity.php
7 7 global $bp, $wpdb, $current_blog; 8 8 9 9 if ( !defined( 'BP_ACTIVITY_SLUG' ) ) 10 define ( 'BP_ACTIVITY_SLUG', $bp->pages->activity->slug ); 10 if ( !empty( $bp->pages->activity->slug ) ) { 11 define ( 'BP_ACTIVITY_SLUG', $bp->pages->activity->slug ); 12 } else { 13 define ( 'BP_ACTIVITY_SLUG', '' ); 14 } 11 15 12 16 /* For internal identification */ 13 17 $bp->activity->id = 'activity'; 14 $bp->activity->name = $bp->pages->activity->name; 18 if ( !empty( $bp->pages->activity->name ) ) { 19 $bp->activity->name = $bp->pages->activity->name; 20 } else { 21 $bp->activity->name = ''; 22 } 15 23 $bp->activity->slug = BP_ACTIVITY_SLUG; 16 24 17 25 $bp->activity->table_name = $wpdb->base_prefix . 'bp_activity'; -
bp-core/bp-core-signup.php
546 546 547 547 /* Kill the wp-signup.php if custom registration signup templates are present */ 548 548 function bp_core_wpsignup_redirect() { 549 if ( false === strpos( $_SERVER['SCRIPT_NAME'], 'wp-signup.php') && $_GET['action'] != 'register')549 if ( false === strpos( $_SERVER['SCRIPT_NAME'], 'wp-signup.php') && (empty($_GET['action']) || $_GET['action'] != 'register') ) 550 550 return false; 551 551 552 552 if ( locate_template( array( 'registration/register.php' ), false ) || locate_template( array( 'register.php' ), false ) ) -
bp-core/bp-core-notifications.php
46 46 $grouped_notifications[$notification->component_name][$notification->component_action][] = $notification; 47 47 } 48 48 49 if ( !$grouped_notifications)49 if ( empty($grouped_notifications) ) 50 50 return false; 51 51 52 52 /* Calculated a renderable outcome for each notification type */ -
bp-core/admin/bp-core-upgrade.php
640 640 <h2>Upgrade Complete!</h2> 641 641 <?php endif; ?> 642 642 643 <?php?>644 643 <p><?php printf( __( "You've now completed all of the %s steps and BuddyPress is ready to be activated. Please hit the 'Finish & Activate' button to complete the %s procedure.", 'buddypress' ), $type, $type ) ?></p> 645 644 646 645 … … 677 676 check_admin_referer( 'bpwizard_components' ); 678 677 679 678 // Settings form submitted, now save the settings. 679 $disabled = array(); 680 680 foreach ( (array)$_POST['bp_components'] as $key => $value ) { 681 681 if ( !(int) $value ) 682 682 $disabled[$key] = 1; -
bp-core/admin/bp-core-admin.php
21 21 } 22 22 23 23 function bp_core_admin_settings() { 24 global $wpdb, $bp, $current_blog ;24 global $wpdb, $bp, $current_blog, $user_ID; 25 25 ?> 26 26 27 27 <?php … … 45 45 update_site_option( $key, $value ); 46 46 } 47 47 } 48 $ud = get_userdata($user_ID); 48 49 ?> 49 50 50 51 <div class="wrap"> -
bp-core/admin/bp-core-schema.php
2 2 function bp_core_set_charset() { 3 3 global $wpdb; 4 4 5 require_once( ABSPATH . 'wp-admin/ upgrade-functions.php' );5 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 6 6 7 7 /* BuddyPress component DB schema */ 8 8 if ( !empty($wpdb->charset) ) -
bp-core/bp-core-adminbar.php
6 6 if ( defined( 'BP_DISABLE_ADMIN_BAR' ) ) 7 7 return false; 8 8 9 if ( (int)$bp->site_options['hide-loggedout-adminbar']&& !is_user_logged_in() )9 if ( !empty($bp->site_options['hide-loggedout-adminbar']) && !is_user_logged_in() ) 10 10 return false; 11 11 12 12 $bp->doing_admin_bar = true; … … 76 76 77 77 foreach( (array)$bp->bp_options_nav[$nav_item['slug']] as $subnav_item ) { 78 78 $link = str_replace( $bp->displayed_user->domain, $bp->loggedin_user->domain, $subnav_item['link'] ); 79 $name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name'] ); 79 if ( !empty( $bp->displayed_user->userdata->user_login ) ) { 80 $name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name'] ); 81 } else { 82 $name = ''; 83 } 80 84 $alt = ( 0 == $sub_counter % 2 ) ? ' class="alt"' : ''; 81 85 echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $link . '">' . $name . '</a></li>'; 82 86 $sub_counter++; -
bp-core/bp-core-avatars.php
32 32 define( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 450 ); 33 33 34 34 if ( !defined( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE' ) ) { 35 if ( !$bp->site_options['fileupload_maxk'])35 if ( empty($bp->site_options['fileupload_maxk']) ) 36 36 define( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', 5120000 ); /* 5mb */ 37 37 else 38 38 define( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', $bp->site_options['fileupload_maxk'] * 1024 ); -
bp-core/bp-core-catchuri.php
94 94 $bp_unfiltered_uri = $bp_uri; 95 95 96 96 /* Find a match within registered BuddyPress controlled WP pages (check members first) */ 97 if (empty( $bp_pages )) { 98 return false; 99 } 100 $matches = array(); 97 101 foreach ( (array)$bp_pages as $page_key => $bp_page ) { 98 102 if ( in_array( $bp_page->name, (array)$bp_uri ) ) { 99 103 /* Match found, now match the slug to make sure. */ … … 120 124 } 121 125 122 126 /* This is not a BuddyPress page, so just return. */ 123 if ( in_array( 0, (array) $matches ) )127 if ( !$matches || in_array( 0, (array) $matches ) ) 124 128 return false; 125 129 126 130 /* Find the offset */ -
bp-xprofile/bp-xprofile-cssjs.php
6 6 add_action( 'admin_menu', 'xprofile_add_admin_css' ); 7 7 8 8 function xprofile_add_admin_js() { 9 if ( strpos( $_GET['page'], 'bp-profile-setup' ) !== false ) {9 if ( !empty( $_GET['page'] ) && strpos( $_GET['page'], 'bp-profile-setup' ) !== false ) { 10 10 wp_enqueue_script( 'jquery-ui-sortable' ); 11 11 wp_enqueue_script( 'xprofile-admin-js', BP_PLUGIN_URL . '/bp-xprofile/admin/js/admin.js', array( 'jquery', 'jquery-ui-sortable' ) ); 12 12 } -
bp-xprofile/bp-xprofile-admin.php
61 61 <div id="field-groups"> 62 62 <?php 63 63 if ( $groups ) : 64 foreach ( $groups as $ group ) { ?>64 foreach ( $groups as $j => $group ) { ?> 65 65 66 66 <table id="group_<?php echo $group->id; ?>" class="widefat field-group sortable"> 67 67 <thead> … … 99 99 </tfoot> 100 100 101 101 <tbody id="<?php echo $group->id ?>"> 102 <?php 102 <?php 103 103 if ( $group->fields ) : 104 104 foreach ( $group->fields as $field ) { 105 105 if ( 0 == $j % 2 ) … … 141 141 <p> 142 142 <a class="button" href="admin.php?page=bp-profile-setup&mode=add_group"><?php _e( 'Add New Field Group', 'buddypress' ); ?></a> 143 143 </p> 144 <?php 144 <?php 145 145 else : 146 146 ?> 147 147 -
bp-xprofile/bp-xprofile-classes.php
91 91 $r = wp_parse_args( $args, $defaults ); 92 92 extract( $r, EXTR_SKIP ); 93 93 94 $group_id_sql = ''; 94 95 if ( $profile_group_id ) 95 96 $group_id_sql = $wpdb->prepare( 'WHERE g.id = %d', $profile_group_id ); 96 97 -
bp-blogs.php
10 10 global $bp, $wpdb; 11 11 12 12 if ( !defined( 'BP_BLOGS_SLUG' ) ) 13 define ( 'BP_BLOGS_SLUG', $bp->pages->blogs->slug ); 13 if (empty( $bp->pages->blogs ) ) { 14 define ( 'BP_BLOGS_SLUG', '' ); 15 } else { 16 define ( 'BP_BLOGS_SLUG', $bp->pages->blogs->slug ); 17 $bp->blogs->name = $bp->pages->blogs->name; 18 } 14 19 15 20 /* For internal identification */ 16 21 $bp->blogs->id = 'blogs'; 17 $bp->blogs->name = $bp->pages->blogs->name;18 22 $bp->blogs->slug = BP_BLOGS_SLUG; 19 23 20 24 $bp->blogs->table_name = $wpdb->base_prefix . 'bp_user_blogs'; -
bp-messages.php
40 40 $messages_link = $bp->loggedin_user->domain . $bp->messages->slug . '/'; 41 41 42 42 /* Add the subnav items to the profile */ 43 if ( empty( $count_indicator ) ) { 44 $count_indicator = 0; 45 } 43 46 bp_core_new_subnav_item( array( 'name' => __( 'Inbox', 'buddypress' ) . $count_indicator, 'slug' => 'inbox', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_inbox', 'position' => 10, 'user_has_access' => bp_is_my_profile() ) ); 44 47 bp_core_new_subnav_item( array( 'name' => __( 'Sent Messages', 'buddypress' ), 'slug' => 'sentbox', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_sentbox', 'position' => 20, 'user_has_access' => bp_is_my_profile() ) ); 45 48 bp_core_new_subnav_item( array( 'name' => __( 'Compose', 'buddypress' ), 'slug' => 'compose', 'parent_url' => $messages_link, 'parent_slug' => $bp->messages->slug, 'screen_function' => 'messages_screen_compose', 'position' => 30, 'user_has_access' => bp_is_my_profile() ) ); -
bp-forums.php
13 13 global $bp; 14 14 15 15 if ( !defined( 'BP_FORUMS_SLUG' ) ) 16 define ( 'BP_FORUMS_SLUG', $bp->pages->forums->slug ); 16 if ( !empty( $bp->pages->forums->slug ) ) { 17 define ( 'BP_FORUMS_SLUG', $bp->pages->forums->slug ); 18 } else { 19 define ( 'BP_FORUMS_SLUG', '' ); 20 } 17 21 18 22 /* For internal identification */ 19 23 $bp->forums->id = 'forums'; 20 $bp->forums->name = $bp->pages->forums->name; 24 if ( !empty( $bp->pages->forums->name ) ) { 25 $bp->forums->name = $bp->pages->forums->name; 26 } else { 27 $bp->forums->name = ''; 28 } 21 29 $bp->forums->slug = BP_FORUMS_SLUG; 22 30 23 31 $bp->forums->image_base = BP_PLUGIN_URL . '/bp-forums/images'; … … 500 508 function bp_forums_filter_caps( $allcaps ) { 501 509 global $bp, $wp_roles, $bb_table_prefix; 502 510 511 if ( empty( $bp->loggedin_user ) ) { 512 return $allcaps; 513 } 514 503 515 $bb_cap = get_usermeta( $bp->loggedin_user->id, $bb_table_prefix . 'capabilities' ); 504 516 505 517 if ( empty( $bb_cap ) ) -
bp-groups.php
8 8 global $bp, $wpdb; 9 9 10 10 if ( !defined( 'BP_GROUPS_SLUG' ) ) 11 define ( 'BP_GROUPS_SLUG', $bp->pages->groups->slug ); 11 if ( !empty($bp->pages->groups->slug ) ) { 12 define ( 'BP_GROUPS_SLUG', $bp->pages->groups->slug ); 13 } else { 14 define ( 'BP_GROUPS_SLUG', '' ); 15 } 12 16 13 17 /* For internal identification */ 14 18 $bp->groups->id = 'groups'; 15 $bp->groups->name = $bp->pages->groups->name; 19 if ( !empty($bp->pages->groups->slug ) ) { 20 $bp->groups->name = $bp->pages->groups->name; 21 } else { 22 $bp->groups->name = ''; 23 } 16 24 $bp->groups->slug = BP_GROUPS_SLUG; 17 25 18 26 $bp->groups->table_name = $wpdb->base_prefix . 'bp_groups'; … … 142 150 } 143 151 } 144 152 145 do_action( 'groups_setup_nav', $bp->groups->current_group->user_has_access ); 153 if ( !empty( $bp->groups->current_group->user_has_access ) ) { 154 do_action( 'groups_setup_nav', $bp->groups->current_group->user_has_access ); 155 } 146 156 } 147 157 add_action( 'bp_setup_nav', 'groups_setup_nav' ); 148 158 … … 161 171 function groups_setup_adminbar_menu() { 162 172 global $bp; 163 173 164 if ( !$bp->groups->current_group)174 if ( empty($bp->groups->current_group) ) 165 175 return false; 166 176 167 177 /* Don't show this menu to non site admins or if you're viewing your own profile */ -
bp-forums/bp-forums-bbpress.php
65 65 66 66 /* This must be loaded before functionss.bb-admin.php otherwise we get a function conflict. */ 67 67 if ( !$tables_installed = (boolean) $bbdb->get_results( 'DESCRIBE `' . $bbdb->forums . '`;', ARRAY_A ) ) 68 require_once( ABSPATH . 'wp-admin/ upgrade-functions.php' );68 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 69 69 70 70 require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' ); 71 71 -
bp-core.php
7 7 */ 8 8 define( 'BP_PLUGIN_DIR', WP_PLUGIN_DIR . '/buddypress' ); 9 9 define( 'BP_PLUGIN_URL', plugins_url( $path = '/buddypress' ) ); 10 define( 'BP_SEARCH_SLUG', 'definition missing' ); 10 11 12 if (!defined('VHOST')) { 13 define('VHOST', 'Obsolete Constant'); 14 } 15 11 16 /* Load the WP abstraction file so BuddyPress can run on all WordPress setups. */ 12 17 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-wpabstraction.php' ); 13 18 … … 83 88 84 89 /* Set up the members id and active components entry */ 85 90 $bp->members->id = 'members'; 86 $bp->members->slug = $bp->pages->members->slug; 91 if ( empty( $bp->pages->members->slug ) ) { 92 $bp->members->slug = ''; 93 } else { 94 $bp->members->slug = $bp->pages->members->slug; 95 } 87 96 $bp->active_components[$bp->members->slug] = $bp->members->id; 88 97 89 98 /* The user ID of the user who is currently logged in. */ … … 124 133 125 134 /* The default component to use if none are set and someone visits: http://domain.com/members/andy */ 126 135 if ( !defined( 'BP_DEFAULT_COMPONENT' ) ) { 127 if ( isset( $bp->pages->activity ) ) 136 if ( isset( $bp->pages->activity ) ) { 128 137 $bp->default_component = $bp->pages->activity->name; 129 else138 } elseif ( !empty( $bp->pages->profile->name ) ) { 130 139 $bp->default_component = $bp->pages->profile->name; 140 } else { 141 $bp->default_component = ''; 142 } 131 143 } else { 132 144 $bp->default_component = BP_DEFAULT_COMPONENT; 133 145 } … … 142 154 $bp->bp_options_nav = array(); 143 155 144 156 /* Fetches the default Gravatar image to use if the user/group/blog has no avatar or gravatar */ 145 $bp->grav_default->user = apply_filters( 'bp_user_gravatar_default', $bp->site_options['user-avatar-default']);157 $bp->grav_default->user = apply_filters( 'bp_user_gravatar_default', !empty($bp->site_options['user-avatar-default']) ); 146 158 $bp->grav_default->group = apply_filters( 'bp_group_gravatar_default', 'identicon' ); 147 159 $bp->grav_default->blog = apply_filters( 'bp_blog_gravatar_default', 'identicon' ); 148 160 … … 180 192 function bp_core_define_slugs() { 181 193 global $bp; 182 194 183 if ( !defined( 'BP_MEMBERS_SLUG' ) ) 184 define( 'BP_MEMBERS_SLUG', $bp->pages->members->slug ); 195 if ( !defined( 'BP_MEMBERS_SLUG' ) ) { 196 if (!empty( $bp->pages->members->slug ) ) { 197 define( 'BP_MEMBERS_SLUG', $bp->pages->members->slug ); 198 } else { 199 define( 'BP_MEMBERS_SLUG', '' ); 200 } 201 } 185 202 186 203 if ( !defined( 'BP_REGISTER_SLUG' ) ) 187 define( 'BP_REGISTER_SLUG', $bp->pages->register->slug ); 204 if (!empty( $bp->pages->register->slug ) ) { 205 define( 'BP_REGISTER_SLUG', $bp->pages->register->slug ); 206 } else { 207 define( 'BP_REGISTER_SLUG', '' ); 208 } 188 209 189 210 if ( !defined( 'BP_ACTIVATION_SLUG' ) ) 190 define( 'BP_ACTIVATION_SLUG', $bp->pages->activate->slug ); 211 if (!empty( $bp->pages->activate->slug ) ) { 212 define( 'BP_ACTIVATION_SLUG', $bp->pages->activate->slug ); 213 } else { 214 define( 'BP_ACTIVATION_SLUG', ''); 215 } 191 216 } 192 217 add_action( 'bp_setup_globals', 'bp_core_define_slugs' ); 193 218 … … 960 985 if ( $bp->loggedin_user->id == $user_id ) 961 986 $ud = &$bp->loggedin_user->userdata; 962 987 963 if ( $bp->displayed_user->id == $user_id )988 if ( !empty($bp->displayed_user->id) && $bp->displayed_user->id == $user_id ) 964 989 $ud = &$bp->displayed_user->userdata; 965 990 966 991 if ( empty( $ud ) ) {