BuddyPress - Version 1.1.2

Version Description

Download this release

Release Info

Developer apeatling
Plugin Icon 128x128 BuddyPress
Version 1.1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.1.2

Files changed (52) hide show
  1. bp-activity/bp-activity-filters.php +2 -0
  2. bp-activity/bp-activity-templatetags.php +4 -2
  3. bp-blogs.php +69 -61
  4. bp-blogs/bp-blogs-classes.php +2 -2
  5. bp-core.php +35 -4
  6. bp-core/bp-core-classes.php +2 -2
  7. bp-core/bp-core-settings.php +3 -35
  8. bp-core/bp-core-signup.php +0 -2
  9. bp-forums/bbpress/bb-admin/admin-base.php +5 -1
  10. bp-forums/bbpress/bb-admin/admin.php +9 -1
  11. bp-forums/bbpress/bb-admin/includes/class.bb-install.php +3 -0
  12. bp-forums/bbpress/bb-admin/includes/defaults.bb-schema.php +43 -27
  13. bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php +21 -2
  14. bp-forums/bbpress/bb-admin/includes/functions.bb-recount.php +262 -0
  15. bp-forums/bbpress/bb-admin/includes/functions.bb-upgrade.php +20 -7
  16. bp-forums/bbpress/bb-admin/index.php +22 -18
  17. bp-forums/bbpress/bb-admin/tools-recount.php +27 -132
  18. bp-forums/bbpress/bb-cron.php +11 -14
  19. bp-forums/bbpress/bb-includes/backpress/functions.formatting.php +6 -4
  20. bp-forums/bbpress/bb-includes/backpress/functions.kses.php +705 -64
  21. bp-forums/bbpress/bb-includes/class.bp-options.php +0 -3
  22. bp-forums/bbpress/bb-includes/functions.bb-core.php +66 -31
  23. bp-forums/bbpress/bb-includes/functions.bb-deprecated.php +5 -2
  24. bp-forums/bbpress/bb-includes/functions.bb-meta.php +1 -1
  25. bp-forums/bbpress/bb-includes/functions.bb-pluggable.php +15 -14
  26. bp-forums/bbpress/bb-includes/functions.bb-posts.php +1 -0
  27. bp-forums/bbpress/bb-includes/functions.bb-template.php +8 -9
  28. bp-forums/bbpress/bb-includes/functions.bb-users.php +78 -40
  29. bp-forums/bbpress/bb-includes/js/jquery/interface.js +2 -1
  30. bp-forums/bbpress/bb-login.php +104 -60
  31. bp-forums/bbpress/bb-templates/kakumei-blue/style.css +2 -0
  32. bp-forums/bbpress/bb-templates/kakumei/favorites.php +1 -1
  33. bp-forums/bbpress/bb-templates/kakumei/forum.php +2 -2
  34. bp-forums/bbpress/bb-templates/kakumei/front-page.php +2 -2
  35. bp-forums/bbpress/bb-templates/kakumei/post-form.php +2 -2
  36. bp-forums/bbpress/bb-templates/kakumei/style.css +16 -1
  37. bp-forums/bbpress/bb-templates/kakumei/tag-single.php +1 -1
  38. bp-forums/bbpress/bb-templates/kakumei/view.php +2 -2
  39. bp-forums/bbpress/rss.php +1 -1
  40. bp-friends/bp-friends-classes.php +3 -3
  41. bp-groups/bp-groups-classes.php +10 -10
  42. bp-groups/bp-groups-templatetags.php +2 -2
  43. bp-loader.php +2 -2
  44. bp-themes/bp-default/style.css +1 -1
  45. bp-themes/bp-sn-parent/_inc/js/ajax.js +6 -36
  46. bp-themes/bp-sn-parent/style.css +1 -1
  47. bp-themes/bp-sn-parent/wire/post-form.php +0 -1
  48. bp-themes/bp-sn-parent/wire/post-list.php +2 -1
  49. bp-xprofile.php +7 -7
  50. bp-xprofile/bp-xprofile-templatetags.php +2 -2
  51. bp-xprofile/deprecated/bp-xprofile-deprecated.php +0 -2
  52. readme.txt +1 -1
bp-activity/bp-activity-filters.php CHANGED
@@ -2,6 +2,8 @@
2
3
/* Apply WordPress defined filters */
4
add_filter( 'bp_get_activity_content', 'bp_activity_filter_kses', 1 );
5
add_filter( 'bp_get_activity_content', 'force_balance_tags' );
6
add_filter( 'bp_get_activity_content', 'wptexturize' );
7
add_filter( 'bp_get_activity_content', 'convert_smilies' );
2
3
/* Apply WordPress defined filters */
4
add_filter( 'bp_get_activity_content', 'bp_activity_filter_kses', 1 );
5
+ add_filter( 'bp_get_activity_content', 'bp_activity_filter_kses', 1 );
6
+
7
add_filter( 'bp_get_activity_content', 'force_balance_tags' );
8
add_filter( 'bp_get_activity_content', 'wptexturize' );
9
add_filter( 'bp_get_activity_content', 'convert_smilies' );
bp-activity/bp-activity-templatetags.php CHANGED
@@ -351,6 +351,8 @@ function bp_activity_filter_links( $args = false ) {
351
$selected = ' class="selected"';
352
else
353
unset($selected);
354
355
switch ( $style ) {
356
case 'list':
@@ -378,13 +380,13 @@ function bp_activity_filter_links( $args = false ) {
378
/* Make sure all core internal component names are translatable */
379
$translatable_component_names = array( __( 'profile', 'buddypress'), __( 'friends', 'buddypress' ), __( 'groups', 'buddypress' ), __( 'status', 'buddypress' ), __( 'blogs', 'buddypress' ) );
380
381
- $component_links[] = $before . '<a href="' . $link . '">' . ucwords( __( $component_name, 'buddypress' ) ) . '</a>' . $after;
382
}
383
384
$link = remove_query_arg( 'afilter' , $link );
385
386
if ( isset( $_GET['afilter'] ) )
387
- $component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . $link . '"">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
388
389
return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) );
390
}
351
$selected = ' class="selected"';
352
else
353
unset($selected);
354
+
355
+ $component_name = attribute_escape( $component_name );
356
357
switch ( $style ) {
358
case 'list':
380
/* Make sure all core internal component names are translatable */
381
$translatable_component_names = array( __( 'profile', 'buddypress'), __( 'friends', 'buddypress' ), __( 'groups', 'buddypress' ), __( 'status', 'buddypress' ), __( 'blogs', 'buddypress' ) );
382
383
+ $component_links[] = $before . '<a href="' . attribute_escape( $link ) . '">' . ucwords( __( $component_name, 'buddypress' ) ) . '</a>' . $after;
384
}
385
386
$link = remove_query_arg( 'afilter' , $link );
387
388
if ( isset( $_GET['afilter'] ) )
389
+ $component_links[] = '<' . $tag . ' id="afilter-clear"><a href="' . attribute_escape( $link ) . '"">' . __( 'Clear Filter', 'buddypress' ) . '</a></' . $tag . '>';
390
391
return apply_filters( 'bp_get_activity_filter_links', implode( "\n", $component_links ) );
392
}
bp-blogs.php CHANGED
@@ -308,7 +308,7 @@ function bp_blogs_record_existing_blogs() {
308
}
309
}
310
311
- function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false ) {
312
global $bp;
313
314
if ( !$user_id )
@@ -328,7 +328,7 @@ function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false ) {
328
bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'last_activity', time() );
329
330
/* Only record this activity if the blog is public */
331
- if ( (int)$_POST['blog_public'] && !$no_activity ) {
332
/* Record this in activity streams */
333
bp_blogs_record_activity( array(
334
'user_id' => $recorded_blog->user_id,
@@ -351,10 +351,9 @@ function bp_blogs_record_post( $post_id, $post, $user_id = false ) {
351
352
if ( !$user_id )
353
$user_id = (int)$post->post_author;
354
-
355
356
/* This is to stop infinate loops with Donncha's sitewide tags plugin */
357
- if ( (int)get_site_option('tags_blog_id') == (int)$blog_id )
358
return false;
359
360
/* Don't record this if it's not a post */
@@ -374,20 +373,22 @@ function bp_blogs_record_post( $post_id, $post, $user_id = false ) {
374
375
bp_blogs_update_blogmeta( $recorded_post->blog_id, 'last_activity', time() );
376
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>";
381
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
- ) );
391
}
392
} else {
393
$existing_post = new BP_Blogs_Post( null, $blog_id, $post_id );
@@ -407,23 +408,24 @@ function bp_blogs_record_post( $post_id, $post, $user_id = false ) {
407
// Re-record the post with the new author.
408
bp_blogs_record_post( $post_id );
409
}
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
- ) );
427
}
428
429
do_action( 'bp_blogs_new_blog_post', $existing_post, $is_private, $is_recorded );
@@ -457,21 +459,24 @@ function bp_blogs_record_comment( $comment_id, $is_approved ) {
457
458
bp_blogs_update_blogmeta( $recorded_comment->blog_id, 'last_activity', time() );
459
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
-
475
return $recorded_comment;
476
}
477
add_action( 'comment_post', 'bp_blogs_record_comment', 10, 2 );
@@ -488,20 +493,23 @@ function bp_blogs_approve_comment( $comment_id, $comment_status ) {
488
489
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' ) );
490
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
- ) );
505
}
506
add_action( 'wp_set_comment_status', 'bp_blogs_approve_comment', 10, 2 );
507
@@ -513,7 +521,7 @@ add_action( 'wp_set_comment_status', 'bp_blogs_unapprove_comment', 10, 2 );
513
514
function bp_blogs_add_user_to_blog( $user_id, $role, $blog_id ) {
515
if ( $role != 'subscriber' ) {
516
- bp_blogs_record_blog( $blog_id, $user_id, $no_activity = true );
517
}
518
}
519
add_action( 'add_user_to_blog', 'bp_blogs_add_user_to_blog', 10, 3 );
308
}
309
}
310
311
+ function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = true ) {
312
global $bp;
313
314
if ( !$user_id )
328
bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'last_activity', time() );
329
330
/* Only record this activity if the blog is public */
331
+ if ( (int)$_POST['blog_public'] || !$no_activity ) {
332
/* Record this in activity streams */
333
bp_blogs_record_activity( array(
334
'user_id' => $recorded_blog->user_id,
351
352
if ( !$user_id )
353
$user_id = (int)$post->post_author;
354
355
/* This is to stop infinate loops with Donncha's sitewide tags plugin */
356
+ if ( (int)get_site_option( 'tags_blog_id' ) == (int)$blog_id )
357
return false;
358
359
/* Don't record this if it's not a post */
373
374
bp_blogs_update_blogmeta( $recorded_post->blog_id, 'last_activity', time() );
375
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>";
382
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
+ }
392
}
393
} else {
394
$existing_post = new BP_Blogs_Post( null, $blog_id, $post_id );
408
// Re-record the post with the new author.
409
bp_blogs_record_post( $post_id );
410
}
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
+ }
429
}
430
431
do_action( 'bp_blogs_new_blog_post', $existing_post, $is_private, $is_recorded );
459
460
bp_blogs_update_blogmeta( $recorded_comment->blog_id, 'last_activity', time() );
461
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
+
480
return $recorded_comment;
481
}
482
add_action( 'comment_post', 'bp_blogs_record_comment', 10, 2 );
493
494
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' ) );
495
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
+ }
513
}
514
add_action( 'wp_set_comment_status', 'bp_blogs_approve_comment', 10, 2 );
515
521
522
function bp_blogs_add_user_to_blog( $user_id, $role, $blog_id ) {
523
if ( $role != 'subscriber' ) {
524
+ bp_blogs_record_blog( $blog_id, $user_id );
525
}
526
}
527
add_action( 'add_user_to_blog', 'bp_blogs_add_user_to_blog', 10, 3 );
bp-blogs/bp-blogs-classes.php CHANGED
@@ -180,7 +180,7 @@ Class BP_Blogs_Blog {
180
if ( !$bp->blogs )
181
bp_blogs_setup_globals();
182
183
- like_escape($letter);
184
185
if ( $limit && $page ) {
186
$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
@@ -198,7 +198,7 @@ Class BP_Blogs_Blog {
198
if ( !$bp->blogs )
199
bp_blogs_setup_globals();
200
201
- like_escape($filter);
202
203
if ( $limit && $page ) {
204
$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
180
if ( !$bp->blogs )
181
bp_blogs_setup_globals();
182
183
+ $letter = like_escape( $wpdb->escape( $letter ) );
184
185
if ( $limit && $page ) {
186
$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
198
if ( !$bp->blogs )
199
bp_blogs_setup_globals();
200
201
+ $filter = like_escape( $wpdb->escape( $filter ) );
202
203
if ( $limit && $page ) {
204
$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
bp-core.php CHANGED
@@ -65,6 +65,10 @@ if ( !defined( 'BP_SEARCH_SLUG' ) )
65
/* Define the slug for the search page */
66
if ( !defined( 'BP_HOME_BLOG_SLUG' ) )
67
define( 'BP_HOME_BLOG_SLUG', 'blog' );
68
69
70
/* "And now for something completely different" .... */
@@ -625,10 +629,18 @@ function bp_core_new_nav_item( $args = '' ) {
625
'position' => $position
626
);
627
628
- /***
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
*/
632
if ( bp_core_is_root_component( $slug ) && !$bp->displayed_user->id )
633
return;
634
@@ -1533,7 +1545,7 @@ function bp_core_delete_account( $user_id = false ) {
1533
$user_id = $bp->loggedin_user->id;
1534
1535
/* Make sure account deletion is not disabled */
1536
- if ( ( !(int) get_site_option( 'bp-disable-account-deletion' ) && !is_site_admin() ) )
1537
return false;
1538
1539
/* Site admins should not be allowed to be deleted */
@@ -1703,6 +1715,25 @@ function bp_core_add_admin_menu_page( $args = '' ) {
1703
return $hookname;
1704
}
1705
1706
1707
/**
1708
* bp_core_remove_data()
65
/* Define the slug for the search page */
66
if ( !defined( 'BP_HOME_BLOG_SLUG' ) )
67
define( 'BP_HOME_BLOG_SLUG', 'blog' );
68
+
69
+ /* Register BuddyPress themes contained within the theme folder */
70
+ if ( function_exists( 'register_theme_folder' ) )
71
+ register_theme_folder( 'buddypress/bp-themes' );
72
73
74
/* "And now for something completely different" .... */
629
'position' => $position
630
);
631
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
+
640
+ /***
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
+ */
644
if ( bp_core_is_root_component( $slug ) && !$bp->displayed_user->id )
645
return;
646
1545
$user_id = $bp->loggedin_user->id;
1546
1547
/* Make sure account deletion is not disabled */
1548
+ if ( ( '' != get_site_option( 'bp-disable-account-deletion' ) || (int) get_site_option( 'bp-disable-account-deletion' ) ) && !is_site_admin() )
1549
return false;
1550
1551
/* Site admins should not be allowed to be deleted */
1715
return $hookname;
1716
}
1717
1718
+ /**
1719
+ * bp_core_boot_spammer()
1720
+ *
1721
+ * When a user logs in, check if they have been marked as a spammer. If then simply
1722
+ * redirect them to the home page and stop them from logging in.
1723
+ *
1724
+ * @package BuddyPress Core
1725
+ * @param $username The username of the user
1726
+ * @uses delete_usermeta() deletes a row from the wp_usermeta table based on meta_key
1727
+ */
1728
+ function bp_core_boot_spammer( $auth_obj, $username ) {
1729
+ global $bp;
1730
+
1731
+ $user = get_userdatabylogin( $username );
1732
+
1733
+ if ( (int)$user->spam )
1734
+ bp_core_redirect( $bp->root_domain );
1735
+ }
1736
+ add_filter( 'authenticate', 'bp_core_boot_spammer', 11, 2 );
1737
1738
/**
1739
* bp_core_remove_data()
bp-core/bp-core-classes.php CHANGED
@@ -219,7 +219,7 @@ class BP_Core_User {
219
if ( strlen($letter) > 1 || is_numeric($letter) || !$letter )
220
return false;
221
222
- like_escape($letter);
223
224
$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 );
225
$paged_users_sql = apply_filters( 'bp_core_users_by_letter_sql', $wpdb->prepare( "SELECT DISTINCT u.ID as user_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{$pag_sql}", BP_XPROFILE_FULLNAME_FIELD_NAME ), $letter, $pag_sql );
@@ -239,7 +239,7 @@ class BP_Core_User {
239
if ( $limit && $page )
240
$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
241
242
- like_escape($search_terms);
243
244
$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 );
245
$paged_users_sql = apply_filters( 'bp_core_search_users_sql', "SELECT DISTINCT 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{$pag_sql}", $search_terms, $pag_sql );
219
if ( strlen($letter) > 1 || is_numeric($letter) || !$letter )
220
return false;
221
222
+ $letter = like_escape( $wpdb->escape( $letter ) );
223
224
$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 );
225
$paged_users_sql = apply_filters( 'bp_core_users_by_letter_sql', $wpdb->prepare( "SELECT DISTINCT u.ID as user_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{$pag_sql}", BP_XPROFILE_FULLNAME_FIELD_NAME ), $letter, $pag_sql );
239
if ( $limit && $page )
240
$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
241
242
+ $search_terms = like_escape( $wpdb->escape( $search_terms ) );
243
244
$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 );
245
$paged_users_sql = apply_filters( 'bp_core_search_users_sql', "SELECT DISTINCT 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{$pag_sql}", $search_terms, $pag_sql );
bp-core/bp-core-settings.php CHANGED
@@ -153,47 +153,15 @@ function bp_core_screen_notification_settings_content() {
153
154
/**** DELETE ACCOUNT ****/
155
156
- function bp_core_screen_delete_account() {
157
- global $current_user, $bp_settings_updated, $pass_error;
158
-
159
- if ( isset( $_POST['delete-account-button'] ) ) {
160
check_admin_referer( 'delete-account' );
161
-
162
// delete the users account
163
if ( bp_core_delete_account() )
164
bp_core_redirect( site_url() );
165
}
166
167
- $bp_settings_updated = false;
168
- $pass_error = false;
169
-
170
- if ( isset($_POST['submit']) ) {
171
- check_admin_referer('bp_settings_general');
172
-
173
- require_once( WPINC . '/registration.php' );
174
-
175
- // Form has been submitted and nonce checks out, lets do it.
176
-
177
- if ( $_POST['email'] != '' ) {
178
- $current_user->user_email = wp_specialchars( trim( $_POST['email'] ));
179
- }
180
-
181
- if ( $_POST['pass1'] != '' && $_POST['pass2'] != '' ) {
182
- if ( $_POST['pass1'] == $_POST['pass2'] && !strpos( " " . $_POST['pass1'], "\\" ) ) {
183
- $current_user->user_pass = $_POST['pass1'];
184
- } else {
185
- $pass_error = true;
186
- }
187
- } else if ( empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) || !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) {
188
- $pass_error = true;
189
- } else {
190
- unset( $current_user->user_pass );
191
- }
192
-
193
- if ( !$pass_error && wp_update_user( get_object_vars( $current_user ) ) )
194
- $bp_settings_updated = true;
195
- }
196
-
197
add_action( 'bp_template_title', 'bp_core_screen_delete_account_title' );
198
add_action( 'bp_template_content', 'bp_core_screen_delete_account_content' );
199
153
154
/**** DELETE ACCOUNT ****/
155
156
+ function bp_core_screen_delete_account() {
157
+ if ( isset( $_POST['delete-account-understand'] ) ) {
158
check_admin_referer( 'delete-account' );
159
+
160
// delete the users account
161
if ( bp_core_delete_account() )
162
bp_core_redirect( site_url() );
163
}
164
165
add_action( 'bp_template_title', 'bp_core_screen_delete_account_title' );
166
add_action( 'bp_template_content', 'bp_core_screen_delete_account_content' );
167
bp-core/bp-core-signup.php CHANGED
@@ -116,8 +116,6 @@ function bp_core_screen_signup() {
116
/* If the user decided to create a blog, save those details to usermeta */
117
if ( 'blog' == $active_signup || 'all' == $active_signup ) {
118
$usermeta['public'] = ( 'public' == $_POST['signup_blog_privacy'] ) ? true : false;
119
- $usermeta['blogname'] = $_POST['signup_blog_url'];
120
- $usermeta['blog_title'] = $_POST['signup_blog_title'];
121
}
122
123
$usermeta = apply_filters( 'bp_signup_usermeta', $usermeta );
116
/* If the user decided to create a blog, save those details to usermeta */
117
if ( 'blog' == $active_signup || 'all' == $active_signup ) {
118
$usermeta['public'] = ( 'public' == $_POST['signup_blog_privacy'] ) ? true : false;
119
}
120
121
$usermeta = apply_filters( 'bp_signup_usermeta', $usermeta );
bp-forums/bbpress/bb-admin/admin-base.php CHANGED
@@ -10,7 +10,11 @@ bb_get_admin_header();
10
11
<?php if ( is_callable($bb_admin_page) ) : call_user_func( $bb_admin_page ); else : ?>
12
13
- <p><?php _e('Nothing to see here.'); ?><p>
14
15
<?php endif; ?>
16
10
11
<?php if ( is_callable($bb_admin_page) ) : call_user_func( $bb_admin_page ); else : ?>
12
13
+ <h2><?php _e( 'Page not found' ); ?></h2>
14
+ <?php
15
+ bb_admin_notice( __( 'There is no administration page at the requested address. Please check the address you entered and try again.' ), 'error' );
16
+ do_action( 'bb_admin_notices' );
17
+ ?>
18
19
<?php endif; ?>
20
bp-forums/bbpress/bb-admin/admin.php CHANGED
@@ -16,8 +16,10 @@ require_once( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
16
17
$bb_admin_page = bb_find_filename( $_SERVER['PHP_SELF'] );
18
19
if ( $bb_admin_page == 'admin-base.php' ) {
20
- $bb_admin_page = $_GET['plugin'];
21
}
22
23
wp_enqueue_script( 'common' );
@@ -34,4 +36,10 @@ if ( isset( $_GET['foldmenu'] ) ) {
34
}
35
bb_admin_menu_generator();
36
bb_get_current_admin_menu();
37
?>
16
17
$bb_admin_page = bb_find_filename( $_SERVER['PHP_SELF'] );
18
19
+ $_check_callback = false;
20
if ( $bb_admin_page == 'admin-base.php' ) {
21
+ $bb_admin_page = (string) @$_GET['plugin'];
22
+ $_check_callback = true;
23
}
24
25
wp_enqueue_script( 'common' );
36
}
37
bb_admin_menu_generator();
38
bb_get_current_admin_menu();
39
+
40
+ if ( $_check_callback ) {
41
+ if ( empty( $bb_registered_plugin_callbacks ) || empty( $bb_admin_page ) || !in_array( $bb_admin_page, $bb_registered_plugin_callbacks ) ) {
42
+ unset( $bb_admin_page );
43
+ }
44
+ }
45
?>
bp-forums/bbpress/bb-admin/includes/class.bb-install.php CHANGED
@@ -309,6 +309,9 @@ class BB_Install
309
function get_languages()
310
{
311
foreach ( bb_glob( BB_LANG_DIR . '*.mo' ) as $language ) {
312
$language = str_replace( '.mo', '', basename( $language ) );
313
$this->languages[$language] = $language;
314
}
309
function get_languages()
310
{
311
foreach ( bb_glob( BB_LANG_DIR . '*.mo' ) as $language ) {
312
+ if ( substr( $language, 0, 18 ) === 'continents-cities-' ) {
313
+ continue;
314
+ }
315
$language = str_replace( '.mo', '', basename( $language ) );
316
$this->languages[$language] = $language;
317
}
bp-forums/bbpress/bb-admin/includes/defaults.bb-schema.php CHANGED
@@ -113,33 +113,37 @@ $bb_queries['topics'] = "CREATE TABLE IF NOT EXISTS `$bbdb->topics` (
113
KEY `stickies` (`topic_status`, `topic_sticky`, `topic_time`)
114
);";
115
116
- // users - 'user_login', 'user_nicename' and 'user_registered' indices are inconsistent with WordPress
117
- $bb_queries['users'] = "CREATE TABLE IF NOT EXISTS `$bbdb->users` (
118
- `ID` bigint(20) unsigned NOT NULL auto_increment,
119
- `user_login` varchar(60) NOT NULL default '',
120
- `user_pass` varchar(64) NOT NULL default '',
121
- `user_nicename` varchar(50) NOT NULL default '',
122
- `user_email` varchar(100) NOT NULL default '',
123
- `user_url` varchar(100) NOT NULL default '',
124
- `user_registered` datetime NOT NULL default '0000-00-00 00:00:00',
125
- `user_status` int(11) NOT NULL default 0,
126
- `display_name` varchar(250) NOT NULL default '',
127
- PRIMARY KEY (`ID`),
128
- UNIQUE KEY `user_login` (`user_login`),
129
- UNIQUE KEY `user_nicename` (`user_nicename`),
130
- KEY `user_registered` (`user_registered`)
131
- );";
132
-
133
- // usermeta
134
- $bb_queries['usermeta'] = "CREATE TABLE IF NOT EXISTS `$bbdb->usermeta` (
135
- `umeta_id` bigint(20) NOT NULL auto_increment,
136
- `user_id` bigint(20) NOT NULL default 0,
137
- `meta_key` varchar(255),
138
- `meta_value` longtext,
139
- PRIMARY KEY (`umeta_id`),
140
- KEY `user_id` (`user_id`),
141
- KEY `meta_key` (`meta_key`)
142
- );";
143
144
$bb_queries = apply_filters( 'bb_schema_pre_charset', $bb_queries );
145
@@ -212,6 +216,18 @@ if ( bb_get_option('wp_table_prefix') || ( defined( 'BB_SCHEMA_IGNORE_WP_USERS_K
212
$bb_schema_ignore = false;
213
}
214
215
$bb_schema_ignore = apply_filters( 'bb_schema_ignore', $bb_schema_ignore );
216
217
do_action( 'bb_schema_defined' );
113
KEY `stickies` (`topic_status`, `topic_sticky`, `topic_time`)
114
);";
115
116
+ if ( bb_get_option( 'wp_table_prefix' ) || ( defined( 'BB_SCHEMA_IGNORE_WP_USERS_TABLES' ) && BB_SCHEMA_IGNORE_WP_USERS_TABLES ) ) {
117
+ // Don't add user tables
118
+ } else {
119
+ // users - 'user_login', 'user_nicename' and 'user_registered' indices are inconsistent with WordPress
120
+ $bb_queries['users'] = "CREATE TABLE IF NOT EXISTS `$bbdb->users` (
121
+ `ID` bigint(20) unsigned NOT NULL auto_increment,
122
+ `user_login` varchar(60) NOT NULL default '',
123
+ `user_pass` varchar(64) NOT NULL default '',
124
+ `user_nicename` varchar(50) NOT NULL default '',
125
+ `user_email` varchar(100) NOT NULL default '',
126
+ `user_url` varchar(100) NOT NULL default '',
127
+ `user_registered` datetime NOT NULL default '0000-00-00 00:00:00',
128
+ `user_status` int(11) NOT NULL default 0,
129
+ `display_name` varchar(250) NOT NULL default '',
130
+ PRIMARY KEY (`ID`),
131
+ UNIQUE KEY `user_login` (`user_login`),
132
+ UNIQUE KEY `user_nicename` (`user_nicename`),
133
+ KEY `user_registered` (`user_registered`)
134
+ );";
135
+
136
+ // usermeta
137
+ $bb_queries['usermeta'] = "CREATE TABLE IF NOT EXISTS `$bbdb->usermeta` (
138
+ `umeta_id` bigint(20) NOT NULL auto_increment,
139
+ `user_id` bigint(20) NOT NULL default 0,
140
+ `meta_key` varchar(255),
141
+ `meta_value` longtext,
142
+ PRIMARY KEY (`umeta_id`),
143
+ KEY `user_id` (`user_id`),
144
+ KEY `meta_key` (`meta_key`)
145
+ );";
146
+ }
147
148
$bb_queries = apply_filters( 'bb_schema_pre_charset', $bb_queries );
149
216
$bb_schema_ignore = false;
217
}
218
219
+ if ( bb_get_option('wp_table_prefix') || ( defined( 'BB_SCHEMA_IGNORE_WP_USERS_TABLES' ) && BB_SCHEMA_IGNORE_WP_USERS_TABLES ) ) {
220
+ if ( $bb_schema_ignore ) {
221
+ $bb_schema_ignore['tables'] = array( $bbdb->users, $bbdb->usermeta );
222
+ } else {
223
+ $bb_schema_ignore = array(
224
+ 'tables' => array( $bbdb->users, $bbdb->usermeta ),
225
+ 'columns' => array(),
226
+ 'indices' => array()
227
+ );
228
+ }
229
+ }
230
+
231
$bb_schema_ignore = apply_filters( 'bb_schema_ignore', $bb_schema_ignore );
232
233
do_action( 'bb_schema_defined' );
bp-forums/bbpress/bb-admin/includes/functions.bb-admin.php CHANGED
@@ -117,6 +117,10 @@ function bb_admin_menu_generator()
117
function bb_admin_add_menu( $display_name, $capability, $file_name, $menu_position = false, $class = '', $id = '' )
118
{
119
global $bb_menu;
120
121
if ( $display_name && $capability && $file_name ) {
122
// Get an array of the keys
@@ -164,6 +168,10 @@ function bb_admin_add_menu( $display_name, $capability, $file_name, $menu_positi
164
$plugin_menu_next++;
165
}
166
167
// Add the menu item at the given key
168
$bb_menu[$plugin_menu_next] = array( $display_name, $capability, $file_name, $class, $id );
169
@@ -178,7 +186,15 @@ function bb_admin_add_menu( $display_name, $capability, $file_name, $menu_positi
178
function bb_admin_add_submenu( $display_name, $capability, $file_name, $parent = 'plugins.php' )
179
{
180
global $bb_submenu;
181
if ( $display_name && $capability && $file_name ) {
182
$bb_submenu[$parent][] = array( $display_name, $capability, $file_name );
183
ksort( $bb_submenu );
184
}
@@ -397,10 +413,13 @@ function bb_get_ids_by_role( $role = 'moderator', $sort = 0, $page = 1, $limit =
397
398
function bb_user_row( $user, $role = '', $email = false ) {
399
$actions = "<a href='" . esc_attr( get_user_profile_link( $user->ID ) ) . "'>" . __('View') . "</a>";
400
- if ( bb_current_user_can( 'edit_user', $user_id ) )
401
$actions .= " | <a href='" . esc_attr( get_profile_tab_link( $user->ID, 'edit' ) ) . "'>" . __('Edit') . "</a>";
402
$r = "\t<tr id='user-$user->ID'" . get_alt_class("user-$role") . ">\n";
403
- $r .= "\t\t<td class=\"user\">" . bb_get_avatar( $user->ID, 32 ) . "<span class=\"row-title\"><a href='" . get_user_profile_link( $user->ID ) . "'>" . get_user_name( $user->ID ) . "</a></span><div><span class=\"row-actions\">$actions</span>&nbsp;</div></td>\n";
404
$r .= "\t\t<td><a href='" . get_user_profile_link( $user->ID ) . "'>" . get_user_display_name( $user->ID ) . "</a></td>\n";
405
if ( $email ) {
406
$email = bb_get_user_email( $user->ID );
117
function bb_admin_add_menu( $display_name, $capability, $file_name, $menu_position = false, $class = '', $id = '' )
118
{
119
global $bb_menu;
120
+ global $bb_registered_plugin_callbacks;
121
+ if ( empty( $bb_registered_plugin_callbacks ) ) {
122
+ $bb_registered_plugin_callbacks = array();
123
+ }
124
125
if ( $display_name && $capability && $file_name ) {
126
// Get an array of the keys
168
$plugin_menu_next++;
169
}
170
171
+ if ( strpos( $file_name, '.php' ) === false ) {
172
+ $bb_registered_plugin_callbacks[] = $file_name;
173
+ }
174
+
175
// Add the menu item at the given key
176
$bb_menu[$plugin_menu_next] = array( $display_name, $capability, $file_name, $class, $id );
177
186
function bb_admin_add_submenu( $display_name, $capability, $file_name, $parent = 'plugins.php' )
187
{
188
global $bb_submenu;
189
+ global $bb_registered_plugin_callbacks;
190
+ if ( empty( $bb_registered_plugin_callbacks ) ) {
191
+ $bb_registered_plugin_callbacks = array();
192
+ }
193
+
194
if ( $display_name && $capability && $file_name ) {
195
+ if ( strpos( $file_name, '.php' ) === false ) {
196
+ $bb_registered_plugin_callbacks[] = $file_name;
197
+ }
198
$bb_submenu[$parent][] = array( $display_name, $capability, $file_name );
199
ksort( $bb_submenu );
200
}
413
414
function bb_user_row( $user, $role = '', $email = false ) {
415
$actions = "<a href='" . esc_attr( get_user_profile_link( $user->ID ) ) . "'>" . __('View') . "</a>";
416
+ $title = '';
417
+ if ( bb_current_user_can( 'edit_user', $user_id ) ) {
418
$actions .= " | <a href='" . esc_attr( get_profile_tab_link( $user->ID, 'edit' ) ) . "'>" . __('Edit') . "</a>";
419
+ $title = " title='" . esc_attr( sprintf( __( 'User ID: %d' ), $user->ID ) ) . "'";
420
+ }
421
$r = "\t<tr id='user-$user->ID'" . get_alt_class("user-$role") . ">\n";
422
+ $r .= "\t\t<td class=\"user\">" . bb_get_avatar( $user->ID, 32 ) . "<span class=\"row-title\"><a href='" . get_user_profile_link( $user->ID ) . "'" . $title . ">" . get_user_name( $user->ID ) . "</a></span><div><span class=\"row-actions\">$actions</span>&nbsp;</div></td>\n";
423
$r .= "\t\t<td><a href='" . get_user_profile_link( $user->ID ) . "'>" . get_user_display_name( $user->ID ) . "</a></td>\n";
424
if ( $email ) {
425
$email = bb_get_user_email( $user->ID );
bp-forums/bbpress/bb-admin/includes/functions.bb-recount.php ADDED
@@ -0,0 +1,262 @@
1
+ <?php
2
+
3
+ function bb_recount_topic_posts()
4
+ {
5
+ global $bbdb;
6
+
7
+ $statement = __( 'Counting the number of posts in each topic&hellip; %s' );
8
+ $result = __( 'Failed!' );
9
+
10
+ $sql = "INSERT INTO `$bbdb->topics` (`topic_id`, `topic_posts`) (SELECT `topic_id`, COUNT(`post_status`) as `topic_posts` FROM `$bbdb->posts` WHERE `post_status` = '0' GROUP BY `topic_id`) ON DUPLICATE KEY UPDATE `topic_posts` = VALUES(`topic_posts`);";
11
+ if ( is_wp_error( $bbdb->query( $sql ) ) ) {
12
+ return sprintf( $statement, $result );
13
+ }
14
+
15
+ $result = __( 'Complete!' );
16
+ return sprintf( $statement, $result );
17
+ }
18
+
19
+ function bb_recount_topic_voices()
20
+ {
21
+ global $bbdb;
22
+
23
+ $statement = __( 'Counting the number of voices in each topic&hellip; %s' );
24
+ $result = __( 'Failed!' );
25
+
26
+ $sql_delete = "DELETE FROM `$bbdb->meta` WHERE `object_type` = 'bb_topic' AND `meta_key` = 'voices_count';";
27
+ if ( is_wp_error( $bbdb->query( $sql_delete ) ) ) {
28
+ return sprintf( $statement, $result );
29
+ }
30
+
31
+ $sql = "INSERT INTO `$bbdb->meta` (`object_type`, `object_id`, `meta_key`, `meta_value`) (SELECT 'bb_topic', `topic_id`, 'voices_count', COUNT(DISTINCT `poster_id`) as `meta_value` FROM `$bbdb->posts` WHERE `post_status` = '0' GROUP BY `topic_id`);";
32
+ if ( is_wp_error( $bbdb->query( $sql ) ) ) {
33
+ return sprintf( $statement, $result );
34
+ }
35
+
36
+ $result = __( 'Complete!' );
37
+ return sprintf( $statement, $result );
38
+ }
39
+
40
+ function bb_recount_topic_deleted_posts()
41
+ {
42
+ global $bbdb;
43
+
44
+ $statement = __( 'Counting the number of deleted posts in each topic&hellip; %s' );
45
+ $result = __( 'Failed!' );
46
+
47
+ $sql_delete = "DELETE FROM `$bbdb->meta` WHERE `object_type` = 'bb_topic' AND `meta_key` = 'deleted_posts';";
48
+ if ( is_wp_error( $bbdb->query( $sql_delete ) ) ) {
49
+ return sprintf( $statement, $result );
50
+ }
51
+
52
+ $sql = "INSERT INTO `$bbdb->meta` (`object_type`, `object_id`, `meta_key`, `meta_value`) (SELECT 'bb_topic', `topic_id`, 'deleted_posts', COUNT(`post_status`) as `meta_value` FROM `$bbdb->posts` WHERE `post_status` != '0' GROUP BY `topic_id`);";
53
+ if ( is_wp_error( $bbdb->query( $sql ) ) ) {
54
+ return sprintf( $statement, $result );
55
+ }
56
+
57
+ $result = __( 'Complete!' );
58
+ return sprintf( $statement, $result );
59
+ }
60
+
61
+ function bb_recount_forum_topics()
62
+ {
63
+ global $bbdb;
64
+
65
+ $statement = __( 'Counting the number of topics in each forum&hellip; %s' );
66
+ $result = __( 'Failed!' );
67
+
68
+ $sql = "INSERT INTO `$bbdb->forums` (`forum_id`, `topics`) (SELECT `forum_id`, COUNT(`topic_status`) as `topics` FROM `$bbdb->topics` WHERE `topic_status` = '0' GROUP BY `forum_id`) ON DUPLICATE KEY UPDATE `topics` = VALUES(`topics`);";
69
+ if ( is_wp_error( $bbdb->query( $sql ) ) ) {
70
+ return sprintf( $statement, $result );
71
+ }
72
+
73
+ $result = __( 'Complete!' );
74
+ return sprintf( $statement, $result );
75
+ }
76
+
77
+ function bb_recount_forum_posts()
78
+ {
79
+ global $bbdb;
80
+
81
+ $statement = __( 'Counting the number of posts in each forum&hellip; %s' );
82
+ $result = __( 'Failed!' );
83
+
84
+ $sql = "INSERT INTO `$bbdb->forums` (`forum_id`, `posts`) (SELECT `forum_id`, COUNT(`post_status`) as `posts` FROM `$bbdb->posts` WHERE `post_status` = '0' GROUP BY `forum_id`) ON DUPLICATE KEY UPDATE `posts` = VALUES(`posts`);";
85
+ if ( is_wp_error( $bbdb->query( $sql ) ) ) {
86
+ return sprintf( $statement, $result );
87
+ }
88
+
89
+ $result = __( 'Complete!' );
90
+ return sprintf( $statement, $result );
91
+ }
92
+
93
+ function bb_recount_user_topics_replied()
94
+ {
95
+ global $bbdb;
96
+
97
+ $statement = __( 'Counting the number of topics to which each user has replied&hellip; %s' );
98
+ $result = __( 'Failed!' );
99
+
100
+ $sql_select = "SELECT `poster_id`, COUNT(DISTINCT `topic_id`) as `_count` FROM `$bbdb->posts` WHERE `post_status` = '0' GROUP BY `poster_id`;";
101
+ $insert_rows = $bbdb->get_results( $sql_select );
102
+
103
+ if ( is_wp_error( $insert_rows ) ) {
104
+ return sprintf( $statement, $result );
105
+ }
106
+
107
+ $meta_key = $bbdb->prefix . 'topics_replied';
108
+
109
+ $insert_values = array();
110
+ foreach ( $insert_rows as $insert_row ) {
111
+ $insert_values[] = "('$insert_row->poster_id', '$meta_key', '$insert_row->_count')";
112
+ }
113
+
114
+ if ( !count( $insert_values ) ) {
115
+ return sprintf( $statement, $result );
116
+ }
117
+
118
+ $sql_delete = "DELETE FROM `$bbdb->usermeta` WHERE `meta_key` = '$meta_key';";
119
+ if ( is_wp_error( $bbdb->query( $sql_delete ) ) ) {
120
+ return sprintf( $statement, $result );
121
+ }
122
+
123
+ $insert_values = array_chunk( $insert_values, 10000 );
124
+ foreach ( $insert_values as $chunk ) {
125
+ $chunk = "\n" . join( ",\n", $chunk );
126
+ $sql_insert = "INSERT INTO `$bbdb->usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES $chunk;";
127
+
128
+ if ( is_wp_error( $bbdb->query( $sql_insert ) ) ) {
129
+ return sprintf( $statement, $result );
130
+ }
131
+ }
132
+
133
+ $result = __( 'Complete!' );
134
+ return sprintf( $statement, $result );
135
+ }
136
+
137
+ // TODO - make fast - see #1146
138
+ function bb_recount_topic_tags()
139
+ {
140
+ // Reset tag count to zero
141
+ $bbdb->query( "UPDATE $bbdb->topics SET tag_count = 0" );
142
+
143
+ // Get all tags
144
+ $terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag' );
145
+
146
+ if ( !is_wp_error( $terms ) && is_array( $terms ) ) {
147
+ $message = __('Counted topic tags');
148
+ foreach ( $terms as $term ) {
149
+ $topic_ids = bb_get_tagged_topic_ids( $term->term_id );
150
+ if ( !is_wp_error( $topic_ids ) && is_array( $topic_ids ) ) {
151
+ $bbdb->query(
152
+ "UPDATE $bbdb->topics SET tag_count = tag_count + 1 WHERE topic_id IN (" . join( ',', $topic_ids ) . ")"
153
+ );
154
+ }
155
+ unset( $topic_ids );
156
+ }
157
+ }
158
+ unset( $terms, $term );
159
+
160
+ return $message;
161
+ }
162
+
163
+ // TODO - make fast - see #1146
164
+ function bb_recount_tag_topics()
165
+ {
166
+ // Get all tags
167
+ $terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag', array( 'hide_empty' => false ) );
168
+
169
+ if ( !is_wp_error( $terms ) && is_array( $terms ) ) {
170
+ $message = __('Counted tagged topics');
171
+ $_terms = array();
172
+ foreach ( $terms as $term ) {
173
+ $_terms[] = $term->term_id;
174
+ }
175
+ if ( count( $_terms ) ) {
176
+ $wp_taxonomy_object->update_term_count( $_terms, 'bb_topic_tag' );
177
+ }
178
+ }
179
+ unset( $term, $_terms );
180
+
181
+ return $message;
182
+ }
183
+
184
+ // TODO - make fast - see #1146
185
+ function bb_recount_tag_delete_empty()
186
+ {
187
+ // Get all tags
188
+ if ( !isset( $terms ) ) {
189
+ $terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag', array( 'hide_empty' => false ) );
190
+ }
191
+
192
+ if ( !is_wp_error( $terms ) && is_array( $terms ) ) {
193
+ $message = __('Deleted tags with no topics');
194
+ foreach ( $terms as $term ) {
195
+ $topic_ids = bb_get_tagged_topic_ids( $term->term_id );
196
+ if ( !is_wp_error( $topic_ids ) && is_array( $topic_ids ) ) {
197
+ if ( false === $topic_ids || ( is_array( $topic_ids ) && !count( $topic_ids ) ) ) {
198
+ bb_destroy_tag( $term->term_taxonomy_id );
199
+ }
200
+ }
201
+ unset( $topic_ids );
202
+ }
203
+ }
204
+ unset( $terms, $term );
205
+
206
+ return $message;
207
+ }
208
+
209
+ function bb_recount_clean_favorites()
210
+ {
211
+ global $bbdb;
212
+
213
+ $statement = __( 'Removing deleted topics from user favorites&hellip; %s' );
214
+ $result = __( 'Failed!' );
215
+
216
+ $meta_key = $bbdb->prefix . 'favorites';
217
+
218
+ $users = $bbdb->get_results( "SELECT `user_id`, `meta_value` AS `favorites` FROM `$bbdb->usermeta` WHERE `meta_key` = '$meta_key';" );
219
+ if ( is_wp_error( $users ) ) {
220
+ return sprintf( $statement, $result );
221
+ }
222
+
223
+ $topics = $bbdb->get_col( "SELECT `topic_id` FROM `$bbdb->topics` WHERE `topic_status` = '0';" );
224
+
225
+ if ( is_wp_error( $topics ) ) {
226
+ return sprintf( $statement, $result );
227
+ }
228
+
229
+ $values = array();
230
+ foreach ( $users as $user ) {
231
+ if ( empty( $user->favorites ) || !is_string( $user->favorites ) ) {
232
+ continue;
233
+ }
234
+ $favorites = explode( ',', $user->favorites );
235
+ if ( empty( $favorites ) || !is_array( $favorites ) ) {
236
+ continue;
237
+ }
238
+ $favorites = join( ',', array_intersect( $topics, $favorites ) );
239
+ $values[] = "('$user->user_id', '$meta_key', '$favorites')";
240
+ }
241
+
242
+ if ( !count( $values ) ) {
243
+ return sprintf( $statement, $result );
244
+ }
245
+
246
+ $sql_delete = "DELETE FROM `$bbdb->usermeta` WHERE `meta_key` = '$meta_key';";
247
+ if ( is_wp_error( $bbdb->query( $sql_delete ) ) ) {
248
+ return sprintf( $statement, $result );
249
+ }
250
+
251
+ $values = array_chunk( $values, 10000 );
252
+ foreach ( $values as $chunk ) {
253
+ $chunk = "\n" . join( ",\n", $chunk );
254
+ $sql_insert = "INSERT INTO `$bbdb->usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES $chunk;";
255
+ if ( is_wp_error( $bbdb->query( $sql_insert ) ) ) {
256
+ return sprintf( $statement, $result );
257
+ }
258
+ }
259
+
260
+ $result = __( 'Complete!' );
261
+ return sprintf( $statement, $result );
262
+ }
bp-forums/bbpress/bb-admin/includes/functions.bb-upgrade.php CHANGED
@@ -9,16 +9,25 @@ function bb_install() {
9
return array_filter($alterations);
10
}
11
12
- function bb_upgrade_all() {
13
- if ( !ini_get('safe_mode') )
14
set_time_limit(600);
15
16
$bb_upgrade = array();
17
18
// Pre DB Delta
19
- $bb_upgrade['messages'][] = bb_upgrade_160(); // Break blocked users
20
- $bb_upgrade['messages'][] = bb_upgrade_170(); // Escaping in usermeta
21
- $bb_upgrade['messages'][] = bb_upgrade_180(); // Delete users for real
22
$bb_upgrade['messages'][] = bb_upgrade_190(); // Move topic_resolved to topicmeta
23
$bb_upgrade['messages'][] = bb_upgrade_200(); // Indices
24
$bb_upgrade['messages'][] = bb_upgrade_210(); // Convert text slugs to varchar slugs
@@ -37,13 +46,17 @@ function bb_upgrade_all() {
37
// Post DB Delta
38
$bb_upgrade['messages'][] = bb_upgrade_1000(); // Make forum and topic slugs
39
$bb_upgrade['messages'][] = bb_upgrade_1010(); // Make sure all forums have a valid parent
40
- $bb_upgrade['messages'][] = bb_upgrade_1020(); // Add a user_nicename to existing users
41
$bb_upgrade['messages'][] = bb_upgrade_1030(); // Move admin_email option to from_email
42
$bb_upgrade['messages'][] = bb_upgrade_1040(); // Activate Akismet and bozo plugins and convert active plugins to new convention on upgrade only
43
$bb_upgrade['messages'][] = bb_upgrade_1050(); // Update active theme if present
44
$bb_upgrade['messages'][] = bb_upgrade_1070(); // trim whitespace from raw_tag
45
$bb_upgrade['messages'][] = bb_upgrade_1080(); // Convert tags to taxonomy
46
- $bb_upgrade['messages'][] = bb_upgrade_1090(); // Add display names
47
$bb_upgrade['messages'][] = bb_upgrade_1100(); // Replace forum_stickies index with stickies (#876)
48
$bb_upgrade['messages'][] = bb_upgrade_1110(); // Create plugin directory (#1083)
49
$bb_upgrade['messages'][] = bb_upgrade_1120(); // Create theme directory (#1083)
9
return array_filter($alterations);
10
}
11
12
+ function bb_upgrade_all()
13
+ {
14
+ if ( !ini_get( 'safe_mode' ) ) {
15
set_time_limit(600);
16
+ }
17
+
18
+ $_do_user_operations = true;
19
+ if ( bb_get_option( 'wp_table_prefix' ) || ( defined( 'BB_SCHEMA_IGNORE_WP_USERS_TABLES' ) && BB_SCHEMA_IGNORE_WP_USERS_TABLES ) ) {
20
+ $_do_user_operations = false;
21
+ }
22
23
$bb_upgrade = array();
24
25
// Pre DB Delta
26
+ if ( $_do_user_operations ) {
27
+ $bb_upgrade['messages'][] = bb_upgrade_160(); // Break blocked users
28
+ $bb_upgrade['messages'][] = bb_upgrade_170(); // Escaping in usermeta
29
+ $bb_upgrade['messages'][] = bb_upgrade_180(); // Delete users for real
30
+ }
31
$bb_upgrade['messages'][] = bb_upgrade_190(); // Move topic_resolved to topicmeta
32
$bb_upgrade['messages'][] = bb_upgrade_200(); // Indices
33
$bb_upgrade['messages'][] = bb_upgrade_210(); // Convert text slugs to varchar slugs
46
// Post DB Delta
47
$bb_upgrade['messages'][] = bb_upgrade_1000(); // Make forum and topic slugs
48
$bb_upgrade['messages'][] = bb_upgrade_1010(); // Make sure all forums have a valid parent
49
+ if ( $_do_user_operations ) {
50
+ $bb_upgrade['messages'][] = bb_upgrade_1020(); // Add a user_nicename to existing users
51
+ }
52
$bb_upgrade['messages'][] = bb_upgrade_1030(); // Move admin_email option to from_email
53
$bb_upgrade['messages'][] = bb_upgrade_1040(); // Activate Akismet and bozo plugins and convert active plugins to new convention on upgrade only
54
$bb_upgrade['messages'][] = bb_upgrade_1050(); // Update active theme if present
55
$bb_upgrade['messages'][] = bb_upgrade_1070(); // trim whitespace from raw_tag
56
$bb_upgrade['messages'][] = bb_upgrade_1080(); // Convert tags to taxonomy
57
+ if ( $_do_user_operations ) {
58
+ $bb_upgrade['messages'][] = bb_upgrade_1090(); // Add display names
59
+ }
60
$bb_upgrade['messages'][] = bb_upgrade_1100(); // Replace forum_stickies index with stickies (#876)
61
$bb_upgrade['messages'][] = bb_upgrade_1110(); // Create plugin directory (#1083)
62
$bb_upgrade['messages'][] = bb_upgrade_1120(); // Create theme directory (#1083)
bp-forums/bbpress/bb-admin/index.php CHANGED
@@ -29,6 +29,14 @@ $rn_users_average = sprintf(__ngettext('<span>%d</span> user', '<span>%d</span>
29
$rn_topic_tags_average = bb_get_topic_tags_per_day();
30
$rn_topic_tags_average = sprintf(__ngettext('<span>%d</span> tag', '<span>%d</span> tags', $rn_topic_tags_average), $rn_topic_tags_average);
31
32
$bb_admin_body_class = ' bb-admin-dashboard';
33
34
bb_get_admin_header();
@@ -48,28 +56,24 @@ bb_get_admin_header();
48
<th><?php _e( 'Per Day' ); ?></th>
49
</tr>
50
</thead>
51
<tbody>
52
<tr>
53
- <td><?php echo $rn_forums; ?></td>
54
- <td>-</td>
55
- </tr>
56
- <tr>
57
- <td><?php echo $rn_topics; ?></td>
58
- <td><?php echo $rn_topics_average; ?></td>
59
- </tr>
60
- <tr>
61
- <td><?php echo $rn_posts; ?></td>
62
- <td><?php echo $rn_posts_average; ?></td>
63
- </tr>
64
- <tr>
65
- <td><?php echo $rn_topic_tags; ?></td>
66
- <td><?php echo $rn_topic_tags_average; ?></td>
67
- </tr>
68
- <tr>
69
- <td><?php echo $rn_users; ?></td>
70
- <td><?php echo $rn_users_average; ?></td>
71
</tr>
72
</tbody>
73
</table>
74
</div>
75
29
$rn_topic_tags_average = bb_get_topic_tags_per_day();
30
$rn_topic_tags_average = sprintf(__ngettext('<span>%d</span> tag', '<span>%d</span> tags', $rn_topic_tags_average), $rn_topic_tags_average);
31
32
+ $rn = apply_filters( 'bb_admin_right_now', array(
33
+ 'forums' => array( $rn_forums, '-' ),
34
+ 'topics' => array( $rn_topics, $rn_topics_average ),
35
+ 'posts' => array( $rn_posts, $rn_posts_average ),
36
+ 'topic_tags' => array( $rn_topic_tags, $rn_topic_tags_average ),
37
+ 'users' => array( $rn_users, $rn_users_average )
38
+ ) );
39
+
40
$bb_admin_body_class = ' bb-admin-dashboard';
41
42
bb_get_admin_header();
56
<th><?php _e( 'Per Day' ); ?></th>
57
</tr>
58
</thead>
59
+ <?php
60
+ if ( !empty( $rn ) && is_array( $rn ) ) {
61
+ ?>
62
<tbody>
63
+ <?php
64
+ foreach ( $rn as $rn_row ) {
65
+ ?>
66
<tr>
67
+ <td><?php echo $rn_row[0]; ?></td>
68
+ <td><?php echo $rn_row[1]; ?></td>
69
</tr>
70
+ <?php
71
+ }
72
+ ?>
73
</tbody>
74
+ <?php
75
+ }
76
+ ?>
77
</table>
78
</div>
79
bp-forums/bbpress/bb-admin/tools-recount.php CHANGED
@@ -1,164 +1,59 @@
1
<?php
2
- require_once('admin.php');
3
4
if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) ) {
5
bb_check_admin_referer( 'do-counts' );
6
7
$messages = array();
8
- if ( isset($_POST['topic-posts']) && 1 == $_POST['topic-posts'] ) {
9
- if ( $topics = (array) $bbdb->get_results("SELECT topic_id, COUNT(post_id) AS count FROM $bbdb->posts WHERE post_status = '0' GROUP BY topic_id") ) {
10
- $messages[] = __('Counted posts');
11
- foreach ($topics as $topic) {
12
- $topic_id = (int) $topic->topic_id;
13
- $bbdb->query( $bbdb->prepare( "UPDATE $bbdb->topics SET topic_posts = %s WHERE topic_id = %s" ), $topic->count, $topic_id );
14
- }
15
- unset($topics, $topic, $topic_id);
16
- }
17
- }
18
19
- if ( isset($_POST['topic-voices']) && 1 == $_POST['topic-voices'] ) {
20
- if ( $topics = (array) $bbdb->get_results("SELECT topic_id FROM $bbdb->topics ORDER BY topic_id") ) {
21
- $messages[] = __('Counted voices');
22
- foreach ($topics as $topic) {
23
- $topic_id = (int) $topic->topic_id;
24
- if ( $voices = $bbdb->get_col( $bbdb->prepare( "SELECT DISTINCT poster_id FROM $bbdb->posts WHERE topic_id = %s AND post_status = '0';", $topic_id ) ) ) {
25
- $voices = count( $voices );
26
- bb_update_topicmeta( $topic_id, 'voices_count', $voices );
27
- }
28
- }
29
- unset($topics, $topic, $topic_id);
30
- }
31
}
32
33
- if ( isset($_POST['topic-deleted-posts']) && 1 == $_POST['topic-deleted-posts'] ) {
34
- $old = (array) $bbdb->get_col("SELECT object_id FROM $bbdb->meta WHERE object_type = 'bb_topics' AND meta_key = 'deleted_posts'");
35
- $old = array_flip($old);
36
- if ( $topics = (array) $bbdb->get_results("SELECT topic_id, COUNT(post_id) AS count FROM $bbdb->posts WHERE post_status != '0' GROUP BY topic_id") ) {
37
- $messages[] = __('Counting deleted posts&#8230;');
38
- foreach ( $topics as $topic ) {
39
- bb_update_topicmeta( $topic->topic_id, 'deleted_posts', $topic->count );
40
- unset($old[$topic->topic_id]);
41
- }
42
- unset($topics, $topic);
43
- }
44
- if ( $old ) {
45
- $old = join(',', array_flip($old));
46
- $bbdb->query("DELETE FROM $bbdb->meta WHERE object_type = 'bb_topic' AND object_id IN ($old) AND meta_key = 'deleted_posts'");
47
- $messages[] = __('&#8230;counted deleted posts');
48
- } else {
49
- $messages[] = __('&#8230;no deleted posts to count');
50
- }
51
}
52
53
- if ( isset($_POST['forums']) && 1 == $_POST['forums'] ) {
54
- if ( $all_forums = (array) $bbdb->get_col("SELECT forum_id FROM $bbdb->forums") ) {
55
- $messages[] = __('Counted forum topics and posts');
56
- $all_forums = array_flip( $all_forums );
57
- $forums = $bbdb->get_results("SELECT forum_id, COUNT(topic_id) AS topic_count, SUM(topic_posts) AS post_count FROM $bbdb->topics WHERE topic_status = 0 GROUP BY forum_id");
58
- foreach ( (array) $forums as $forum ) {
59
- $bbdb->query("UPDATE $bbdb->forums SET topics = '$forum->topic_count', posts = '$forum->post_count' WHERE forum_id = '$forum->forum_id'");
60
- unset($all_forums[$forum->forum_id]);
61
- }
62
- if ( $all_forums ) {
63
- $all_forums = implode(',', array_flip( $all_forums ) );
64
- $bbdb->query("UPDATE $bbdb->forums SET topics = 0, posts = 0 WHERE forum_id IN ($all_forums)");
65
- }
66
- unset($all_forums, $forums, $forum);
67
- }
68
}
69
70
- if ( isset($_POST['topics-replied']) && 1 == $_POST['topics-replied'] ) {
71
- if ( $users = (array) $bbdb->get_col("SELECT ID FROM $bbdb->users") ) {
72
- $messages[] = __('Counted topics to which each user has replied');
73
- foreach ( $users as $user )
74
- bb_update_topics_replied( $user );
75
- unset($users, $user);
76
- }
77
}
78
79
- if ( isset($_POST['topic-tag-count']) && 1 == $_POST['topic-tag-count'] ) {
80
- // Reset tag count to zero
81
- $bbdb->query( "UPDATE $bbdb->topics SET tag_count = 0" );
82
-
83
- // Get all tags
84
- $terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag' );
85
-
86
- if ( !is_wp_error( $terms ) && is_array( $terms ) ) {
87
- $messages[] = __('Counted topic tags');
88
- foreach ( $terms as $term ) {
89
- $topic_ids = bb_get_tagged_topic_ids( $term->term_id );
90
- if ( !is_wp_error( $topic_ids ) && is_array( $topic_ids ) ) {
91
- $bbdb->query(
92
- "UPDATE $bbdb->topics SET tag_count = tag_count + 1 WHERE topic_id IN (" . join( ',', $topic_ids ) . ")"
93
- );
94
- }
95
- unset( $topic_ids );
96
- }
97
- }
98
- unset( $terms, $term );
99
}
100
101
- if ( isset($_POST['tags-tag-count']) && 1 == $_POST['tags-tag-count'] ) {
102
- // Get all tags
103
- $terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag', array( 'hide_empty' => false ) );
104
-
105
- if ( !is_wp_error( $terms ) && is_array( $terms ) ) {
106
- $messages[] = __('Counted tagged topics');
107
- $_terms = array();
108
- foreach ( $terms as $term ) {
109
- $_terms[] = $term->term_id;
110
- }
111
- if ( count( $_terms ) ) {
112
- $wp_taxonomy_object->update_term_count( $_terms, 'bb_topic_tag' );
113
- }
114
- }
115
- unset( $term, $_terms );
116
}
117
118
- if ( isset($_POST['tags-delete-empty']) && 1 == $_POST['tags-delete-empty'] ) {
119
- // Get all tags
120
- if ( !isset( $terms ) ) {
121
- $terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag', array( 'hide_empty' => false ) );
122
- }
123
124
- if ( !is_wp_error( $terms ) && is_array( $terms ) ) {
125
- $messages[] = __('Deleted tags with no topics');
126
- foreach ( $terms as $term ) {
127
- $topic_ids = bb_get_tagged_topic_ids( $term->term_id );
128
- if ( !is_wp_error( $topic_ids ) && is_array( $topic_ids ) ) {
129
- if ( false === $topic_ids || ( is_array( $topic_ids ) && !count( $topic_ids ) ) ) {
130
- bb_destroy_tag( $term->term_taxonomy_id );
131
- }
132
- }
133
- unset( $topic_ids );
134
- }
135
- }
136
- unset( $terms, $term );
137
}
138
139
- if ( isset($_POST['clean-favorites']) && 1 == $_POST['clean-favorites'] ) {
140
- $favorites_key = $bbdb->prefix . 'favorites';
141
- if ( $users = $bbdb->get_results("SELECT user_id AS id, meta_value AS favorites FROM $bbdb->usermeta WHERE meta_key = '" . $favorites_key . "'") ) {
142
- $messages[] = __('Removed deleted topics from users\' favorites');
143
- $topics = $bbdb->get_col("SELECT topic_id FROM $bbdb->topics WHERE topic_status = '0'");
144
- foreach ( $users as $user ) {
145
- foreach ( explode(',', $user->favorites) as $favorite ) {
146
- if ( !in_array($favorite, $topics) ) {
147
- bb_remove_user_favorite( $user->id, $favorite );
148
- }
149
- }
150
- }
151
- unset($topics, $users, $user, $favorite);
152
- }
153
}
154
155
bb_recount_list();
156
foreach ( (array) $recount_list as $item ) {
157
if ( isset($item[2]) && isset($_POST[$item[0]]) && 1 == $_POST[$item[0]] && is_callable($item[2]) ) {
158
- call_user_func( $item[2] );
159
}
160
}
161
-
162
if ( count( $messages ) ) {
163
$messages = join( '</p>' . "\n" . '<p>', $messages );
164
bb_admin_notice( $messages );
1
<?php
2
+ require_once( 'admin.php' );
3
+ require_once( 'includes/functions.bb-recount.php' );
4
5
if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) ) {
6
bb_check_admin_referer( 'do-counts' );
7
8
+ // Stores messages
9
$messages = array();
10
11
+ if ( !empty( $_POST['topic-posts'] ) ) {
12
+ $messages[] = bb_recount_topic_posts();
13
}
14
15
+ if ( !empty( $_POST['topic-voices'] ) ) {
16
+ $messages[] = bb_recount_topic_voices();
17
}
18
19
+ if ( !empty( $_POST['topic-deleted-posts'] ) ) {
20
+ $messages[] = bb_recount_topic_deleted_posts();
21
}
22
23
+ if ( !empty( $_POST['forums'] ) ) {
24
+ $messages[] = bb_recount_forum_topics();
25
+ $messages[] = bb_recount_forum_posts();
26
}
27
28
+ if ( !empty( $_POST['topics-replied'] ) ) {
29
+ $messages[] = bb_recount_user_topics_replied();
30
}
31
32
+ if ( !empty( $_POST['topic-tag-count'] ) ) {
33
+ $messages[] = bb_recount_topic_tags();
34
}
35
36
+ if ( !empty( $_POST['tags-tag-count'] ) ) {
37
+ $messages[] = bb_recount_tag_topics();
38
+ }
39
40
+ if ( !empty( $_POST['tags-delete-empty'] ) ) {
41
+ $messages[] = bb_recount_tag_delete_empty();
42
}
43
44
+ if ( !empty( $_POST['clean-favorites'] ) ) {
45
+ $messages[] = bb_recount_clean_favorites();
46
}
47
48
bb_recount_list();
49
foreach ( (array) $recount_list as $item ) {
50
if ( isset($item[2]) && isset($_POST[$item[0]]) && 1 == $_POST[$item[0]] && is_callable($item[2]) ) {
51
+ $messages[] = call_user_func( $item[2] );
52
}
53
}
54
+
55
+ wp_cache_flush();
56
+
57
if ( count( $messages ) ) {
58
$messages = join( '</p>' . "\n" . '<p>', $messages );
59
bb_admin_notice( $messages );
bp-forums/bbpress/bb-cron.php CHANGED
@@ -11,6 +11,10 @@
11
12
ignore_user_abort( true );
13
14
/**
15
* Tell bbPress we are doing the CRON task.
16
*
@@ -21,24 +25,19 @@ define( 'DOING_CRON', true );
21
/** Setup bbPress environment */
22
require_once( './bb-load.php' );
23
24
- if ( $_GET['check'] != backpress_get_option( 'cron_check' ) ) {
25
- exit;
26
- }
27
-
28
- if ( bb_get_option( 'doing_cron' ) > time() ) {
29
- exit;
30
}
31
32
- bb_update_option( 'doing_cron', time() + 30 );
33
-
34
- $crons = _get_cron_array();
35
$keys = array_keys( $crons );
36
- if ( !is_array( $crons ) || $keys[0] > time() ) {
37
- return;
38
}
39
40
foreach ( $crons as $timestamp => $cronhooks ) {
41
- if ( $timestamp > time() ) {
42
break;
43
}
44
foreach ( $cronhooks as $hook => $keys ) {
@@ -53,5 +52,3 @@ foreach ( $crons as $timestamp => $cronhooks ) {
53
}
54
}
55
}
56
-
57
- bb_update_option( 'doing_cron', 0 );
11
12
ignore_user_abort( true );
13
14
+ if ( !empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) {
15
+ die();
16
+ }
17
+
18
/**
19
* Tell bbPress we are doing the CRON task.
20
*
25
/** Setup bbPress environment */
26
require_once( './bb-load.php' );
27
28
+ if ( false === $crons = _get_cron_array() ) {
29
+ die();
30
}
31
32
$keys = array_keys( $crons );
33
+ $local_time = time();
34
+
35
+ if ( !is_array( $crons ) || ( isset($keys[0]) && $keys[0] > $local_time ) ) {
36
+ die();
37
}
38
39
foreach ( $crons as $timestamp => $cronhooks ) {
40
+ if ( $timestamp > $local_time ) {
41
break;
42
}
43
foreach ( $cronhooks as $hook => $keys ) {
52
}
53
}
54
}
bp-forums/bbpress/bb-includes/backpress/functions.formatting.php CHANGED
@@ -1489,14 +1489,15 @@ if ( !function_exists('clean_url') ) :
1489
*
1490
* @param string $url The URL to be cleaned.
1491
* @param array $protocols Optional. An array of acceptable protocols.
1492
- * Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet' if not set.
1493
* @param string $context Optional. How the URL will be used. Default is 'display'.
1494
* @return string The cleaned $url after the 'cleaned_url' filter is applied.
1495
*/
1496
function clean_url( $url, $protocols = null, $context = 'display' ) {
1497
$original_url = $url;
1498
1499
- if ('' == $url) return $url;
1500
$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
1501
$strip = array('%0d', '%0a', '%0D', '%0A');
1502
$url = _deep_replace($strip, $url);
@@ -1511,12 +1512,13 @@ function clean_url( $url, $protocols = null, $context = 'display' ) {
1511
1512
// Replace ampersands and single quotes only when displaying.
1513
if ( 'display' == $context ) {
1514
- $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&#038;$1', $url);
1515
$url = str_replace( "'", '&#039;', $url );
1516
}
1517
1518
if ( !is_array($protocols) )
1519
- $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');
1520
if ( wp_kses_bad_protocol( $url, $protocols ) != $url )
1521
return '';
1522
1489
*
1490
* @param string $url The URL to be cleaned.
1491
* @param array $protocols Optional. An array of acceptable protocols.
1492
+ * Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn' if not set.
1493
* @param string $context Optional. How the URL will be used. Default is 'display'.
1494
* @return string The cleaned $url after the 'cleaned_url' filter is applied.
1495
*/
1496
function clean_url( $url, $protocols = null, $context = 'display' ) {
1497
$original_url = $url;
1498
1499
+ if ( '' == $url )
1500
+ return $url;
1501
$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
1502
$strip = array('%0d', '%0a', '%0D', '%0A');
1503
$url = _deep_replace($strip, $url);
1512
1513
// Replace ampersands and single quotes only when displaying.
1514
if ( 'display' == $context ) {
1515
+ $url = wp_kses_normalize_entities( $url );
1516
+ $url = str_replace( '&amp;', '&#038;', $url );
1517
$url = str_replace( "'", '&#039;', $url );
1518
}
1519
1520
if ( !is_array($protocols) )
1521
+ $protocols = array ('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn');
1522
if ( wp_kses_bad_protocol( $url, $protocols ) != $url )
1523
return '';
1524
bp-forums/bbpress/bb-includes/backpress/functions.kses.php CHANGED
@@ -1,30 +1,485 @@
1
<?php
2
- // Last sync [WP11537]
3
4
/**
5
- * HTML/XHTML filter that only allows some elements and attributes
6
*
7
* Added wp_ prefix to avoid conflicts with existing kses users
8
*
9
* @version 0.2.2
10
* @copyright (C) 2002, 2003, 2005
11
- * @author Ulf Harnhammar <metaur@users.sourceforge.net>
12
*
13
* @package External
14
* @subpackage KSES
15
*
16
- * @internal
17
- * *** CONTACT INFORMATION ***
18
- * E-mail: metaur at users dot sourceforge dot net
19
- * Web page: http://sourceforge.net/projects/kses
20
- * Paper mail: Ulf Harnhammar
21
- * Ymergatan 17 C
22
- * 753 25 Uppsala
23
- * SWEDEN
24
- *
25
- * [kses strips evil scripts!]
26
*/
27
28
29
/**
30
* Filters content and keeps only allowable HTML elements.
@@ -35,9 +490,9 @@
35
* call this function.
36
*
37
* The default allowed protocols are 'http', 'https', 'ftp', 'mailto', 'news',
38
- * 'irc', 'gopher', 'nntp', 'feed', and finally 'telnet. This covers all common
39
- * link protocols, except for 'javascript' which should not be allowed for
40
- * untrusted users.
41
*
42
* @since 1.0.0
43
*
@@ -46,7 +501,8 @@
46
* @param array $allowed_protocols Optional. Allowed protocol in links.
47
* @return string Filtered content with only allowed HTML elements
48
*/
49
- function wp_kses($string, $allowed_html, $allowed_protocols = array ('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet')) {
50
$string = wp_kses_no_null($string);
51
$string = wp_kses_js_entities($string);
52
$string = wp_kses_normalize_entities($string);
@@ -100,8 +556,18 @@ function wp_kses_split($string, $allowed_html, $allowed_protocols) {
100
global $pass_allowed_html, $pass_allowed_protocols;
101
$pass_allowed_html = $allowed_html;
102
$pass_allowed_protocols = $allowed_protocols;
103
- return preg_replace_callback('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%',
104
- create_function('$match', 'global $pass_allowed_html, $pass_allowed_protocols; return wp_kses_split2($match[1], $pass_allowed_html, $pass_allowed_protocols);'), $string);
105
}
106
107
/**
@@ -186,7 +652,7 @@ function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
186
# Is there a closing XHTML slash at the end of the attributes?
187
188
$xhtml_slash = '';
189
- if (preg_match('%\s/\s*$%', $attr))
190
$xhtml_slash = ' /';
191
192
# Are any attributes allowed at all for this element?
@@ -224,6 +690,19 @@ function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
224
break;
225
}
226
227
if ($ok)
228
$attr2 .= ' '.$arreach['whole']; # it passed them
229
} # if !is_array($current)
@@ -299,11 +778,11 @@ function wp_kses_hair($attr, $allowed_protocols) {
299
300
case 2 : # attribute value, a URL after href= for instance
301
302
- if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match))
303
# "value"
304
{
305
$thisval = $match[1];
306
- if ( in_array($attrname, $uris) )
307
$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
308
309
if(FALSE === array_key_exists($attrname, $attrarr)) {
@@ -315,11 +794,11 @@ function wp_kses_hair($attr, $allowed_protocols) {
315
break;
316
}
317
318
- if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match))
319
# 'value'
320
{
321
$thisval = $match[1];
322
- if ( in_array($attrname, $uris) )
323
$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
324
325
if(FALSE === array_key_exists($attrname, $attrarr)) {
@@ -331,11 +810,11 @@ function wp_kses_hair($attr, $allowed_protocols) {
331
break;
332
}
333
334
- if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match))
335
# value
336
{
337
$thisval = $match[1];
338
- if ( in_array($attrname, $uris) )
339
$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
340
341
if(FALSE === array_key_exists($attrname, $attrarr)) {
@@ -374,10 +853,10 @@ function wp_kses_hair($attr, $allowed_protocols) {
374
* @since 1.0.0
375
*
376
* @param string $value Attribute value
377
- * @param string $vless Whether the value is valueless or not. Use 'y' or 'n'
378
* @param string $checkname What $checkvalue is checking for.
379
* @param mixed $checkvalue What constraint the value should pass
380
- * @return bool Whether check passes (true) or not (false)
381
*/
382
function wp_kses_check_attr_val($value, $vless, $checkname, $checkvalue) {
383
$ok = true;
@@ -453,7 +932,6 @@ function wp_kses_check_attr_val($value, $vless, $checkname, $checkvalue) {
453
*/
454
function wp_kses_bad_protocol($string, $allowed_protocols) {
455
$string = wp_kses_no_null($string);
456
- $string = preg_replace('/\xad+/', '', $string); # deals with Opera "feature"
457
$string2 = $string.'a';
458
459
while ($string != $string2) {
@@ -559,14 +1037,9 @@ function wp_kses_html_error($string) {
559
* @return string Sanitized content
560
*/
561
function wp_kses_bad_protocol_once($string, $allowed_protocols) {
562
- global $_kses_allowed_protocols;
563
- $_kses_allowed_protocols = $allowed_protocols;
564
-
565
- $string2 = preg_split('/:|&#58;|&#x3a;/i', $string, 2);
566
- if ( isset($string2[1]) && !preg_match('%/\?%', $string2[0]) )
567
- $string = wp_kses_bad_protocol_once2($string2[0]) . trim($string2[1]);
568
- else
569
- $string = preg_replace_callback('/^((&[^;]*;|[\sA-Za-z0-9])*)'.'(:|&#58;|&#[Xx]3[Aa];)\s*/', 'wp_kses_bad_protocol_once2', $string);
570
571
return $string;
572
}
@@ -580,31 +1053,19 @@ function wp_kses_bad_protocol_once($string, $allowed_protocols) {
580
* @access private
581
* @since 1.0.0
582
*
583
- * @param mixed $matches string or preg_replace_callback() matches array to check for bad protocols
584
* @return string Sanitized content
585
*/
586
- function wp_kses_bad_protocol_once2($matches) {
587
- global $_kses_allowed_protocols;
588
-
589
- if ( is_array($matches) ) {
590
- if ( ! isset($matches[1]) || empty($matches[1]) )
591
- return '';
592
-
593
- $string = $matches[1];
594
- } else {
595
- $string = $matches;
596
- }
597
-
598
$string2 = wp_kses_decode_entities($string);
599
$string2 = preg_replace('/\s/', '', $string2);
600
$string2 = wp_kses_no_null($string2);
601
- $string2 = preg_replace('/\xad+/', '', $string2);
602
- # deals with Opera "feature"
603
$string2 = strtolower($string2);
604
605
$allowed = false;
606
- foreach ( (array) $_kses_allowed_protocols as $one_protocol)
607
- if (strtolower($one_protocol) == $string2) {
608
$allowed = true;
609
break;
610
}
@@ -633,13 +1094,34 @@ function wp_kses_normalize_entities($string) {
633
634
# Change back the allowed entities in our entity whitelist
635
636
- $string = preg_replace('/&amp;([A-Za-z][A-Za-z0-9]{0,19});/', '&\\1;', $string);
637
- $string = preg_replace_callback('/&amp;#0*([0-9]{1,5});/', 'wp_kses_normalize_entities2', $string);
638
- $string = preg_replace_callback('/&amp;#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/', 'wp_kses_normalize_entities3', $string);
639
640
return $string;
641
}
642
643
/**
644
* Callback for wp_kses_normalize_entities() regular expression.
645
*
@@ -653,11 +1135,18 @@ function wp_kses_normalize_entities($string) {
653
* @return string Correctly encoded entity
654
*/
655
function wp_kses_normalize_entities2($matches) {
656
- if ( ! isset($matches[1]) || empty($matches[1]) )
657
return '';
658
659
$i = $matches[1];
660
- return ( ( ! valid_unicode($i) ) || ($i > 65535) ? "&amp;#$i;" : "&#$i;" );
661
}
662
663
/**
@@ -672,11 +1161,11 @@ function wp_kses_normalize_entities2($matches) {
672
* @return string Correctly encoded entity
673
*/
674
function wp_kses_normalize_entities3($matches) {
675
- if ( ! isset($matches[2]) || empty($matches[2]) )
676
return '';
677
678
- $hexchars = $matches[2];
679
- return ( ( ! valid_unicode(hexdec($hexchars)) ) ? "&amp;#x$hexchars;" : "&#x$hexchars;" );
680
}
681
682
/**
@@ -705,8 +1194,160 @@ function valid_unicode($i) {
705
* @return string Content after decoded entities
706
*/
707
function wp_kses_decode_entities($string) {
708
- $string = preg_replace_callback('/&#([0-9]+);/', create_function('$match', 'return chr($match[1]);'), $string);
709
- $string = preg_replace_callback('/&#[Xx]([0-9A-Fa-f]+);/', create_function('$match', 'return chr(hexdec($match[1]));'), $string);
710
711
return $string;
712
}
1
<?php
2
+ // Last sync [WP17185]
3
4
/**
5
+ * kses 0.2.2 - HTML/XHTML filter that only allows some elements and attributes
6
+ * Copyright (C) 2002, 2003, 2005 Ulf Harnhammar
7
+ *
8
+ * This program is free software and open source software; you can redistribute
9
+ * it and/or modify it under the terms of the GNU General Public License as
10
+ * published by the Free Software Foundation; either version 2 of the License,
11
+ * or (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful, but WITHOUT
14
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16
+ * more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License along
19
+ * with this program; if not, write to the Free Software Foundation, Inc.,
20
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit
21
+ * http://www.gnu.org/licenses/gpl.html
22
+ *
23
+ * [kses strips evil scripts!]
24
*
25
* Added wp_ prefix to avoid conflicts with existing kses users
26
*
27
* @version 0.2.2
28
* @copyright (C) 2002, 2003, 2005
29
+ * @author Ulf Harnhammar <http://advogato.org/person/metaur/>
30
*
31
* @package External
32
* @subpackage KSES
33
*
34
*/
35
36
+ /**
37
+ * You can override this in a plugin.
38
+ *
39
+ * @since 1.2.0
40
+ */
41
+ if ( ! defined( 'BP_CUSTOM_TAGS' ) )
42
+ define( 'BP_CUSTOM_TAGS', false );
43
+
44
+ if ( ! BP_CUSTOM_TAGS ) {
45
+ /**
46
+ * Kses global for default allowable HTML tags.
47
+ *
48
+ * Can be override by using CUSTOM_TAGS constant.
49
+ *
50
+ * @global array $allowedposttags
51
+ * @since 2.0.0
52
+ */
53
+ $allowedposttags = array(
54
+ 'address' => array(),
55
+ 'a' => array(
56
+ 'class' => array (),
57
+ 'href' => array (),
58
+ 'id' => array (),
59
+ 'title' => array (),
60
+ 'rel' => array (),
61
+ 'rev' => array (),
62
+ 'name' => array (),
63
+ 'target' => array()),
64
+ 'abbr' => array(
65
+ 'class' => array (),
66
+ 'title' => array ()),
67
+ 'acronym' => array(
68
+ 'title' => array ()),
69
+ 'article' => array(
70
+ 'align' => array (),
71
+ 'class' => array (),
72
+ 'dir' => array (),
73
+ 'lang' => array(),
74
+ 'style' => array (),
75
+ 'xml:lang' => array(),
76
+ ),
77
+ 'aside' => array(
78
+ 'align' => array (),
79
+ 'class' => array (),
80
+ 'dir' => array (),
81
+ 'lang' => array(),
82
+ 'style' => array (),
83
+ 'xml:lang' => array(),
84
+ ),
85
+ 'b' => array(),
86
+ 'big' => array(),
87
+ 'blockquote' => array(
88
+ 'id' => array (),
89
+ 'cite' => array (),
90
+ 'class' => array(),
91
+ 'lang' => array(),
92
+ 'xml:lang' => array()),
93
+ 'br' => array (
94
+ 'class' => array ()),
95
+ 'button' => array(
96
+ 'disabled' => array (),
97
+ 'name' => array (),
98
+ 'type' => array (),
99
+ 'value' => array ()),
100
+ 'caption' => array(
101
+ 'align' => array (),
102
+ 'class' => array ()),
103
+ 'cite' => array (
104
+ 'class' => array(),
105
+ 'dir' => array(),
106
+ 'lang' => array(),
107
+ 'title' => array ()),
108
+ 'code' => array (
109
+ 'style' => array()),
110
+ 'col' => array(
111
+ 'align' => array (),
112
+ 'char' => array (),
113
+ 'charoff' => array (),
114
+ 'span' => array (),
115
+ 'dir' => array(),
116
+ 'style' => array (),
117
+ 'valign' => array (),
118
+ 'width' => array ()),
119
+ 'del' => array(
120
+ 'datetime' => array ()),
121
+ 'dd' => array(),
122
+ 'details' => array(
123
+ 'align' => array (),
124
+ 'class' => array (),
125
+ 'dir' => array (),
126
+ 'lang' => array(),
127
+ 'open' => array (),
128
+ 'style' => array (),
129
+ 'xml:lang' => array(),
130
+ ),
131
+ 'div' => array(
132
+ 'align' => array (),
133
+ 'class' => array (),
134
+ 'dir' => array (),
135
+ 'lang' => array(),
136
+ 'style' => array (),
137
+ 'xml:lang' => array()),
138
+ 'dl' => array(),
139
+ 'dt' => array(),
140
+ 'em' => array(),
141
+ 'fieldset' => array(),
142
+ 'figure' => array(
143
+ 'align' => array (),
144
+ 'class' => array (),
145
+ 'dir' => array (),
146
+ 'lang' => array(),
147
+ 'style' => array (),
148
+ 'xml:lang' => array(),
149
+ ),
150
+ 'figcaption' => array(
151
+ 'align' => array (),
152
+ 'class' => array (),
153
+ 'dir' => array (),
154
+ 'lang' => array(),
155
+ 'style' => array (),
156
+ 'xml:lang' => array(),
157
+ ),
158
+ 'font' => array(
159
+ 'color' => array (),
160
+ 'face' => array (),
161
+ 'size' => array ()),
162
+ 'footer' => array(
163
+ 'align' => array (),
164
+ 'class' => array (),
165
+ 'dir' => array (),
166
+ 'lang' => array(),
167
+ 'style' => array (),
168
+ 'xml:lang' => array(),
169
+ ),
170
+ 'form' => array(
171
+ 'action' => array (),
172
+ 'accept' => array (),
173
+ 'accept-charset' => array (),
174
+ 'enctype' => array (),
175
+ 'method' => array (),
176
+ 'name' => array (),
177
+ 'target' => array ()),
178
+ 'h1' => array(
179
+ 'align' => array (),
180
+ 'class' => array (),
181
+ 'id' => array (),
182
+ 'style' => array ()),
183
+ 'h2' => array (
184
+ 'align' => array (),
185
+ 'class' => array (),
186
+ 'id' => array (),
187
+ 'style' => array ()),
188
+ 'h3' => array (
189
+ 'align' => array (),
190
+ 'class' => array (),
191
+ 'id' => array (),
192
+ 'style' => array ()),
193
+ 'h4' => array (
194
+ 'align' => array (),
195
+ 'class' => array (),
196
+ 'id' => array (),
197
+ 'style' => array ()),
198
+ 'h5' => array (
199
+ 'align' => array (),
200
+ 'class' => array (),
201
+ 'id' => array (),
202
+ 'style' => array ()),
203
+ 'h6' => array (
204
+ 'align' => array (),
205
+ 'class' => array (),
206
+ 'id' => array (),
207
+ 'style' => array ()),
208
+ 'header' => array(
209
+ 'align' => array (),
210
+ 'class' => array (),
211
+ 'dir' => array (),
212
+ 'lang' => array(),
213
+ 'style' => array (),
214
+ 'xml:lang' => array(),
215
+ ),
216
+ 'hgroup' => array(
217
+ 'align' => array (),
218
+ 'class' => array (),
219
+ 'dir' => array (),
220
+ 'lang' => array(),
221
+ 'style' => array (),
222
+ 'xml:lang' => array(),
223
+ ),
224
+ 'hr' => array (
225
+ 'align' => array (),
226
+ 'class' => array (),
227
+ 'noshade' => array (),
228
+ 'size' => array (),
229
+ 'width' => array ()),
230
+ 'i' => array(),
231
+ 'img' => array(
232
+ 'alt' => array (),
233
+ 'align' => array (),
234
+ 'border' => array (),
235
+ 'class' => array (),
236
+ 'height' => array (),
237
+ 'hspace' => array (),
238
+ 'longdesc' => array (),
239
+ 'vspace' => array (),
240
+ 'src' => array (),
241
+ 'style' => array (),
242
+ 'width' => array ()),
243
+ 'ins' => array(
244
+ 'datetime' => array (),
245
+ 'cite' => array ()),
246
+ 'kbd' => array(),
247
+ 'label' => array(
248
+ 'for' => array ()),
249
+ 'legend' => array(
250
+ 'align' => array ()),
251
+ 'li' => array (
252
+ 'align' => array (),
253
+ 'class' => array ()),
254
+ 'menu' => array (
255
+ 'class' => array (),
256
+ 'style' => array (),
257
+ 'type' => array ()),
258
+ 'nav' => array(
259
+ 'align' => array (),
260
+ 'class' => array (),
261
+ 'dir' => array (),
262
+ 'lang' => array(),
263
+ 'style' => array (),
264
+ 'xml:lang' => array(),
265
+ ),
266
+ 'p' => array(
267
+ 'class' => array (),
268
+ 'align' => array (),
269
+ 'dir' => array(),
270
+ 'lang' => array(),
271
+ 'style' => array (),
272
+ 'xml:lang' => array()),
273
+ 'pre' => array(
274
+ 'style' => array(),
275
+ 'width' => array ()),
276
+ 'q' => array(
277
+ 'cite' => array ()),
278
+ 's' => array(),
279
+ 'span' => array (
280
+ 'class' => array (),
281
+ 'dir' => array (),
282
+ 'align' => array (),
283
+ 'lang' => array (),
284
+ 'style' => array (),
285
+ 'title' => array (),
286
+ 'xml:lang' => array()),
287
+ 'section' => array(
288
+ 'align' => array (),
289
+ 'class' => array (),
290
+ 'dir' => array (),
291
+ 'lang' => array(),
292
+ 'style' => array (),
293
+ 'xml:lang' => array(),
294
+ ),
295
+ 'strike' => array(),
296
+ 'strong' => array(),
297
+ 'sub' => array(),
298
+ 'summary' => array(
299
+ 'align' => array (),
300
+ 'class' => array (),
301
+ 'dir' => array (),
302
+ 'lang' => array(),
303
+ 'style' => array (),
304
+ 'xml:lang' => array(),
305
+ ),
306
+ 'sup' => array(),
307
+ 'table' => array(
308
+ 'align' => array (),
309
+ 'bgcolor' => array (),
310
+ 'border' => array (),
311
+ 'cellpadding' => array (),
312
+ 'cellspacing' => array (),
313
+ 'class' => array (),
314
+ 'dir' => array(),
315
+ 'id' => array(),
316
+ 'rules' => array (),
317
+ 'style' => array (),
318
+ 'summary' => array (),
319
+ 'width' => array ()),
320
+ 'tbody' => array(
321
+ 'align' => array (),
322
+ 'char' => array (),
323
+ 'charoff' => array (),
324
+ 'valign' => array ()),
325
+ 'td' => array(
326
+ 'abbr' => array (),
327
+ 'align' => array (),
328
+ 'axis' => array (),
329
+ 'bgcolor' => array (),
330
+ 'char' => array (),
331
+ 'charoff' => array (),
332
+ 'class' => array (),
333
+ 'colspan' => array (),
334
+ 'dir' => array(),
335
+ 'headers' => array (),
336
+ 'height' => array (),
337
+ 'nowrap' => array (),
338
+ 'rowspan' => array (),
339
+ 'scope' => array (),
340
+ 'style' => array (),
341
+ 'valign' => array (),
342
+ 'width' => array ()),
343
+ 'textarea' => array(
344
+ 'cols' => array (),
345
+ 'rows' => array (),
346
+ 'disabled' => array (),
347
+ 'name' => array (),
348
+ 'readonly' => array ()),
349
+ 'tfoot' => array(
350
+ 'align' => array (),
351
+ 'char' => array (),
352
+ 'class' => array (),
353
+ 'charoff' => array (),
354
+ 'valign' => array ()),
355
+ 'th' => array(
356
+ 'abbr' => array (),
357
+ 'align' => array (),
358
+ 'axis' => array (),
359
+ 'bgcolor' => array (),
360
+ 'char' => array (),
361
+ 'charoff' => array (),
362
+ 'class' => array (),
363
+ 'colspan' => array (),
364
+ 'headers' => array (),
365
+ 'height' => array (),
366
+ 'nowrap' => array (),
367
+ 'rowspan' => array (),
368
+ 'scope' => array (),
369
+ 'valign' => array (),
370
+ 'width' => array ()),
371
+ 'thead' => array(
372
+ 'align' => array (),
373
+ 'char' => array (),
374
+ 'charoff' => array (),
375
+ 'class' => array (),
376
+ 'valign' => array ()),
377
+ 'title' => array(),
378
+ 'tr' => array(
379
+ 'align' => array (),
380
+ 'bgcolor' => array (),
381
+ 'char' => array (),
382
+ 'charoff' => array (),
383
+ 'class' => array (),
384
+ 'style' => array (),
385
+ 'valign' => array ()),
386
+ 'tt' => array(),
387
+ 'u' => array(),
388
+ 'ul' => array (
389
+ 'class' => array (),
390
+ 'style' => array (),
391
+ 'type' => array ()),
392
+ 'ol' => array (
393
+ 'class' => array (),
394
+ 'start' => array (),
395
+ 'style' => array (),
396
+ 'type' => array ()),