Changeset 4551
- Timestamp:
- 12/06/2012 10:29:35 AM (13 years ago)
- Location:
- trunk/includes
- Files:
-
- 7 edited
-
core/actions.php (modified) (1 diff)
-
core/sub-actions.php (modified) (2 diffs)
-
extend/buddypress/group.php (modified) (1 diff)
-
forums/functions.php (modified) (4 diffs)
-
replies/functions.php (modified) (9 diffs)
-
topics/functions.php (modified) (14 diffs)
-
users/functions.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/core/actions.php
r4549 r4551 267 267 * bbPress needs to redirect the user around in a few different circumstances: 268 268 * 269 * 1. Form submission within a theme (new and edit)269 * 1. POST and GET requests 270 270 * 2. Accessing private or hidden content (forums/topics/replies) 271 271 * 3. Editing forums, topics, replies, users, and tags 272 272 * 4. bbPress specific AJAX requests 273 273 */ 274 add_action( 'bbp_template_redirect', 'bbp_forum_enforce_blocked', -1 ); 275 add_action( 'bbp_template_redirect', 'bbp_forum_enforce_hidden', -1 ); 276 add_action( 'bbp_template_redirect', 'bbp_forum_enforce_private', -1 ); 277 add_action( 'bbp_template_redirect', 'bbp_new_forum_handler', 10 ); 278 add_action( 'bbp_template_redirect', 'bbp_new_reply_handler', 10 ); 279 add_action( 'bbp_template_redirect', 'bbp_new_topic_handler', 10 ); 280 add_action( 'bbp_template_redirect', 'bbp_edit_topic_tag_handler', 1 ); 281 add_action( 'bbp_template_redirect', 'bbp_edit_user_handler', 1 ); 282 add_action( 'bbp_template_redirect', 'bbp_edit_forum_handler', 1 ); 283 add_action( 'bbp_template_redirect', 'bbp_edit_reply_handler', 1 ); 284 add_action( 'bbp_template_redirect', 'bbp_edit_topic_handler', 1 ); 285 add_action( 'bbp_template_redirect', 'bbp_merge_topic_handler', 1 ); 286 add_action( 'bbp_template_redirect', 'bbp_split_topic_handler', 1 ); 287 add_action( 'bbp_template_redirect', 'bbp_toggle_topic_handler', 1 ); 288 add_action( 'bbp_template_redirect', 'bbp_move_reply_handler', 1 ); 289 add_action( 'bbp_template_redirect', 'bbp_toggle_reply_handler', 1 ); 290 add_action( 'bbp_template_redirect', 'bbp_favorites_handler', 1 ); 291 add_action( 'bbp_template_redirect', 'bbp_subscriptions_handler', 1 ); 292 add_action( 'bbp_template_redirect', 'bbp_do_ajax', 1 ); 293 add_action( 'bbp_template_redirect', 'bbp_check_user_edit', 10 ); 294 add_action( 'bbp_template_redirect', 'bbp_check_forum_edit', 10 ); 295 add_action( 'bbp_template_redirect', 'bbp_check_topic_edit', 10 ); 296 add_action( 'bbp_template_redirect', 'bbp_check_reply_edit', 10 ); 297 add_action( 'bbp_template_redirect', 'bbp_check_topic_tag_edit', 10 ); 274 add_action( 'bbp_template_redirect', 'bbp_forum_enforce_blocked', 1 ); 275 add_action( 'bbp_template_redirect', 'bbp_forum_enforce_hidden', 1 ); 276 add_action( 'bbp_template_redirect', 'bbp_forum_enforce_private', 1 ); 277 add_action( 'bbp_template_redirect', 'bbp_post_request', 10 ); 278 add_action( 'bbp_template_redirect', 'bbp_get_request', 10 ); 279 add_action( 'bbp_template_redirect', 'bbp_check_user_edit', 10 ); 280 add_action( 'bbp_template_redirect', 'bbp_check_forum_edit', 10 ); 281 add_action( 'bbp_template_redirect', 'bbp_check_topic_edit', 10 ); 282 add_action( 'bbp_template_redirect', 'bbp_check_reply_edit', 10 ); 283 add_action( 'bbp_template_redirect', 'bbp_check_topic_tag_edit', 10 ); 284 285 // Theme-side POST requests 286 add_action( 'bbp_post_request', 'bbp_do_ajax', 1 ); 287 add_action( 'bbp_post_request', 'bbp_edit_topic_tag_handler', 1 ); 288 add_action( 'bbp_post_request', 'bbp_edit_user_handler', 1 ); 289 add_action( 'bbp_post_request', 'bbp_edit_forum_handler', 1 ); 290 add_action( 'bbp_post_request', 'bbp_edit_reply_handler', 1 ); 291 add_action( 'bbp_post_request', 'bbp_edit_topic_handler', 1 ); 292 add_action( 'bbp_post_request', 'bbp_merge_topic_handler', 1 ); 293 add_action( 'bbp_post_request', 'bbp_split_topic_handler', 1 ); 294 add_action( 'bbp_post_request', 'bbp_move_reply_handler', 1 ); 295 add_action( 'bbp_post_request', 'bbp_new_forum_handler', 10 ); 296 add_action( 'bbp_post_request', 'bbp_new_reply_handler', 10 ); 297 add_action( 'bbp_post_request', 'bbp_new_topic_handler', 10 ); 298 299 // Theme-side GET requests 300 add_action( 'bbp_get_request', 'bbp_toggle_topic_handler', 1 ); 301 add_action( 'bbp_get_request', 'bbp_toggle_reply_handler', 1 ); 302 add_action( 'bbp_get_request', 'bbp_favorites_handler', 1 ); 303 add_action( 'bbp_get_request', 'bbp_subscriptions_handler', 1 ); 298 304 299 305 // Maybe convert the users password -
trunk/includes/core/sub-actions.php
r4305 r4551 319 319 320 320 /** 321 * The main action used for handling theme-side POST requests 322 * 323 * @since bbPress (r4550) 324 * @uses do_action() 325 */ 326 function bbp_post_request() { 327 328 // Bail if not a POST action 329 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 330 return; 331 332 // Bail if action is not bbp-new-reply 333 if ( empty( $_POST['action'] ) ) 334 return; 335 336 do_action( 'bbp_post_request', $_POST['action'] ); 337 } 338 339 /** 340 * The main action used for handling theme-side GET requests 341 * 342 * @since bbPress (r4550) 343 * @uses do_action() 344 */ 345 function bbp_get_request() { 346 347 // Bail if not a POST action 348 if ( 'GET' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 349 return; 350 351 // Bail if action is not bbp-new-reply 352 if ( empty( $_GET['action'] ) ) 353 return; 354 355 do_action( 'bbp_get_request', $_GET['action'] ); 356 } 357 358 /** Filters *******************************************************************/ 359 360 /** 321 361 * Filter the plugin locale and domain. 322 362 * … … 329 369 return apply_filters( 'bbp_plugin_locale', $locale, $domain ); 330 370 } 331 332 /** Filters *******************************************************************/333 371 334 372 /** -
trunk/includes/extend/buddypress/group.php
r4544 r4551 55 55 $this->template_file = 'groups/single/plugins'; 56 56 $this->display_hook = 'bp_template_content'; 57 58 // Add handlers to bp_actions59 add_action( 'bp_actions', 'bbp_new_forum_handler' );60 add_action( 'bp_actions', 'bbp_new_topic_handler' );61 add_action( 'bp_actions', 'bbp_new_reply_handler' );62 add_action( 'bp_actions', 'bbp_edit_forum_handler' );63 add_action( 'bp_actions', 'bbp_edit_topic_handler' );64 add_action( 'bp_actions', 'bbp_edit_reply_handler' );65 57 66 58 // Possibly redirect -
trunk/includes/forums/functions.php
r4525 r4551 78 78 * Handles the front end forum submission 79 79 * 80 * @param string $action The requested action to compare this function to 80 81 * @uses bbPress:errors::add() To log various error messages 81 82 * @uses bbp_verify_nonce_request() To verify the nonce and check the request … … 107 108 * messages 108 109 */ 109 function bbp_new_forum_handler() { 110 111 // Bail if not a POST action 112 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 113 return; 110 function bbp_new_forum_handler( $action = '' ) { 114 111 115 112 // Bail if action is not bbp-new-forum 116 if ( empty( $_POST['action'] ) || ( 'bbp-new-forum' !== $_POST['action'] ))113 if ( 'bbp-new-forum' !== $action ) 117 114 return; 118 115 … … 339 336 * Handles the front end edit forum submission 340 337 * 338 * @param string $action The requested action to compare this function to 341 339 * @uses bbPress:errors::add() To log various error messages 342 340 * @uses bbp_get_forum() To get the forum … … 368 366 * messages 369 367 */ 370 function bbp_edit_forum_handler() { 371 372 // Bail if not a POST action 373 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 374 return; 368 function bbp_edit_forum_handler( $action = '' ) { 375 369 376 370 // Bail if action is not bbp-edit-forum 377 if ( empty( $_POST['action'] ) || ( 'bbp-edit-forum' !== $_POST['action'] ))371 if ( 'bbp-edit-forum' !== $action ) 378 372 return; 379 373 -
trunk/includes/replies/functions.php
r4522 r4551 78 78 * @since bbPress (r2574) 79 79 * 80 * @param string $action The requested action to compare this function to 80 81 * @uses bbp_add_error() To add an error message 81 82 * @uses bbp_verify_nonce_request() To verify the nonce and check the request … … 103 104 * message 104 105 */ 105 function bbp_new_reply_handler() { 106 107 // Bail if not a POST action 108 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 109 return; 106 function bbp_new_reply_handler( $action = '' ) { 110 107 111 108 // Bail if action is not bbp-new-reply 112 if ( empty( $_POST['action'] ) || ( 'bbp-new-reply' !== $_POST['action'] ))109 if ( 'bbp-new-reply' !== $action ) 113 110 return; 114 111 … … 349 346 * Handles the front end edit reply submission 350 347 * 348 * @param string $action The requested action to compare this function to 351 349 * @uses bbp_add_error() To add an error message 352 350 * @uses bbp_get_reply() To get the reply … … 376 374 * message 377 375 */ 378 function bbp_edit_reply_handler() { 379 380 // Bail if not a POST action 381 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 382 return; 376 function bbp_edit_reply_handler( $action = '' ) { 383 377 384 378 // Bail if action is not bbp-edit-reply 385 if ( empty( $_POST['action'] ) || ( 'bbp-edit-reply' !== $_POST['action'] ))379 if ( 'bbp-edit-reply' !== $action ) 386 380 return; 387 381 … … 1018 1012 * @since bbPress (r4521) 1019 1013 * 1014 * @param string $action The requested action to compare this function to 1020 1015 * @uses bbPress:errors::add() To log various error messages 1021 1016 * @uses bbp_get_reply() To get the reply … … 1043 1038 * @uses wp_safe_redirect() To redirect to the topic link 1044 1039 */ 1045 function bbp_move_reply_handler() { 1046 1047 // Bail if not a POST action 1048 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 1049 return; 1040 function bbp_move_reply_handler( $action = '' ) { 1050 1041 1051 1042 // Bail if action is not 'bbp-move-reply' 1052 if ( empty( $_POST['action'] ) || ( 'bbp-move-reply' !== $_POST['action'] ))1043 if ( 'bbp-move-reply' !== $action ) 1053 1044 return; 1054 1045 … … 1314 1305 * @since bbPress (r2740) 1315 1306 * 1307 * @param string $action The requested action to compare this function to 1316 1308 * @uses bbp_get_reply() To get the reply 1317 1309 * @uses current_user_can() To check if the user is capable of editing or … … 1332 1324 * @uses bbPress::errors:add() To log the error messages 1333 1325 */ 1334 function bbp_toggle_reply_handler() { 1335 1336 // Bail if not a GET action 1337 if ( 'GET' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 1338 return; 1326 function bbp_toggle_reply_handler( $action = '' ) { 1339 1327 1340 1328 // Bail if required GET actions aren't passed 1341 if ( empty( $_GET['reply_id'] ) || empty( $_GET['action'] ))1329 if ( empty( $_GET['reply_id'] ) ) 1342 1330 return; 1343 1331 … … 1349 1337 1350 1338 // Bail if actions aren't meant for this function 1351 if ( !in_array( $ _GET['action'], $possible_actions ) )1339 if ( !in_array( $action, $possible_actions ) ) 1352 1340 return; 1353 1341 1354 1342 $failure = ''; // Empty failure string 1355 1343 $view_all = false; // Assume not viewing all 1356 $action = $_GET['action']; // What action is taking place?1357 1344 $reply_id = (int) $_GET['reply_id']; // What's the reply id? 1358 1345 $success = false; // Flag -
trunk/includes/topics/functions.php
r4524 r4551 80 80 * Handles the front end topic submission 81 81 * 82 * @param string $action The requested action to compare this function to 82 83 * @uses bbPress:errors::add() To log various error messages 83 84 * @uses bbp_verify_nonce_request() To verify the nonce and check the referer … … 109 110 * messages 110 111 */ 111 function bbp_new_topic_handler() { 112 113 // Bail if not a POST action 114 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 115 return; 112 function bbp_new_topic_handler( $action = '' ) { 116 113 117 114 // Bail if action is not bbp-new-topic 118 if ( empty( $_POST['action'] ) || ( 'bbp-new-topic' !== $_POST['action'] ))115 if ( 'bbp-new-topic' !== $action ) 119 116 return; 120 117 … … 386 383 * Handles the front end edit topic submission 387 384 * 385 * @param string $action The requested action to compare this function to 388 386 * @uses bbPress:errors::add() To log various error messages 389 387 * @uses bbp_get_topic() To get the topic … … 417 415 * messages 418 416 */ 419 function bbp_edit_topic_handler() { 420 421 // Bail if not a POST action 422 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 423 return; 417 function bbp_edit_topic_handler( $action = '' ) { 424 418 425 419 // Bail if action is not bbp-edit-topic 426 if ( empty( $_POST['action'] ) || ( 'bbp-edit-topic' !== $_POST['action'] ))420 if ( 'bbp-edit-topic' !== $action ) 427 421 return; 428 422 … … 1033 1027 * @since bbPress (r2756) 1034 1028 * 1029 * @param string $action The requested action to compare this function to 1035 1030 * @uses bbPress:errors::add() To log various error messages 1036 1031 * @uses bbp_get_topic() To get the topics … … 1064 1059 * @uses wp_safe_redirect() To redirect to the topic link 1065 1060 */ 1066 function bbp_merge_topic_handler() { 1067 1068 // Bail if not a POST action 1069 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 1070 return; 1061 function bbp_merge_topic_handler( $action = '' ) { 1071 1062 1072 1063 // Bail if action is not bbp-merge-topic 1073 if ( empty( $_POST['action'] ) || ( 'bbp-merge-topic' !== $_POST['action'] ))1064 if ( 'bbp-merge-topic' !== $action ) 1074 1065 return; 1075 1066 … … 1318 1309 * @since bbPress (r2756) 1319 1310 * 1311 * @param string $action The requested action to compare this function to 1320 1312 * @uses bbPress:errors::add() To log various error messages 1321 1313 * @uses bbp_get_reply() To get the reply … … 1349 1341 * @uses wp_safe_redirect() To redirect to the topic link 1350 1342 */ 1351 function bbp_split_topic_handler() { 1352 1353 // Bail if not a POST action 1354 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 1355 return; 1343 function bbp_split_topic_handler( $action = '' ) { 1356 1344 1357 1345 // Bail if action is not 'bbp-split-topic' 1358 if ( empty( $_POST['action'] ) || ( 'bbp-split-topic' !== $_POST['action'] ))1346 if ( 'bbp-split-topic' !== $action ) 1359 1347 return; 1360 1348 … … 1689 1677 * @since bbPress (r2768) 1690 1678 * 1679 * @param string $action The requested action to compare this function to 1691 1680 * @uses bbp_verify_nonce_request() To verify the nonce and check the request 1692 1681 * @uses current_user_can() To check if the current user can edit/delete tags … … 1702 1691 * @uses wp_safe_redirect() To redirect to the url 1703 1692 */ 1704 function bbp_edit_topic_tag_handler() { 1705 1706 // Bail if not a POST action 1707 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 1708 return; 1693 function bbp_edit_topic_tag_handler( $action = '' ) { 1709 1694 1710 1695 // Bail if required POST actions aren't passed 1711 if ( empty( $_POST['tag-id'] ) || empty( $_POST['action'] ))1696 if ( empty( $_POST['tag-id'] ) ) 1712 1697 return; 1713 1698 … … 1720 1705 1721 1706 // Bail if actions aren't meant for this function 1722 if ( !in_array( $ _POST['action'], $possible_actions ) )1707 if ( !in_array( $action, $possible_actions ) ) 1723 1708 return; 1724 1709 1725 1710 // Setup vars 1726 $action = $_POST['action'];1727 1711 $tag_id = (int) $_POST['tag-id']; 1728 1712 $tag = get_term( $tag_id, bbp_get_topic_tag_tax_id() ); … … 1920 1904 * @since bbPress (r2727) 1921 1905 * 1906 * @param string $action The requested action to compare this function to 1922 1907 * @uses bbp_get_topic() To get the topic 1923 1908 * @uses current_user_can() To check if the user is capable of editing or … … 1945 1930 * @uses bbPress::errors:add() To log the error messages 1946 1931 */ 1947 function bbp_toggle_topic_handler() { 1948 1949 // Bail if not a GET action 1950 if ( 'GET' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 1951 return; 1932 function bbp_toggle_topic_handler( $action = '' ) { 1952 1933 1953 1934 // Bail if required GET actions aren't passed 1954 if ( empty( $_GET['topic_id'] ) || empty( $_GET['action'] ))1935 if ( empty( $_GET['topic_id'] ) ) 1955 1936 return; 1956 1937 … … 1964 1945 1965 1946 // Bail if actions aren't meant for this function 1966 if ( !in_array( $ _GET['action'], $possible_actions ) )1947 if ( !in_array( $action, $possible_actions ) ) 1967 1948 return; 1968 1949 1969 1950 $failure = ''; // Empty failure string 1970 1951 $view_all = false; // Assume not viewing all 1971 $action = $_GET['action']; // What action is taking place?1972 1952 $topic_id = (int) $_GET['topic_id']; // What's the topic id? 1973 1953 $success = false; // Flag -
trunk/includes/users/functions.php
r4346 r4551 417 417 * Handles the front end adding and removing of favorite topics 418 418 * 419 * @param string $action The requested action to compare this function to 419 420 * @uses bbp_get_user_id() To get the user id 420 421 * @uses bbp_verify_nonce_request() To verify the nonce and check the request … … 431 432 * @uses wp_safe_redirect() To redirect to the url 432 433 */ 433 function bbp_favorites_handler( ) {434 function bbp_favorites_handler( $action = '' ) { 434 435 435 436 if ( !bbp_is_favorites_active() ) 436 437 return false; 437 438 438 // Bail if not a GET action 439 if ( 'GET' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 440 return; 441 442 // Bail if required GET actions aren't passed 443 if ( empty( $_GET['topic_id'] ) || empty( $_GET['action'] ) ) 439 // Bail if no topic ID is passed 440 if ( empty( $_GET['topic_id'] ) ) 444 441 return; 445 442 … … 451 448 452 449 // Bail if actions aren't meant for this function 453 if ( !in_array( $ _GET['action'], $possible_actions ) )450 if ( !in_array( $action, $possible_actions ) ) 454 451 return; 455 452 456 453 // What action is taking place? 457 $action = $_GET['action'];458 454 $topic_id = intval( $_GET['topic_id'] ); 459 455 $user_id = bbp_get_user_id( 0, true, true ); … … 735 731 * Handles the front end subscribing and unsubscribing topics 736 732 * 733 * @param string $action The requested action to compare this function to 737 734 * @uses bbp_is_subscriptions_active() To check if the subscriptions are active 738 735 * @uses bbp_get_user_id() To get the user id … … 751 748 * @uses wp_safe_redirect() To redirect to the url 752 749 */ 753 function bbp_subscriptions_handler( ) {750 function bbp_subscriptions_handler( $action = '' ) { 754 751 755 752 if ( !bbp_is_subscriptions_active() ) 756 753 return false; 757 754 758 // Bail if not a GET action 759 if ( 'GET' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 760 return; 761 762 // Bail if required GET actions aren't passed 763 if ( empty( $_GET['topic_id'] ) || empty( $_GET['action'] ) ) 755 // Bail if no topic ID is passed 756 if ( empty( $_GET['topic_id'] ) ) 764 757 return; 765 758 … … 771 764 772 765 // Bail if actions aren't meant for this function 773 if ( !in_array( $ _GET['action'], $possible_actions ) )766 if ( !in_array( $action, $possible_actions ) ) 774 767 return; 775 768 776 769 // Get required data 777 $action = $_GET['action'];778 770 $user_id = bbp_get_user_id( 0, true, true ); 779 771 $topic_id = intval( $_GET['topic_id'] ); … … 841 833 * Handles the front end user editing 842 834 * 835 * @param string $action The requested action to compare this function to 843 836 * @uses is_multisite() To check if it's a multisite 844 837 * @uses bbp_is_user_home() To check if the user is at home (the display page … … 867 860 * @uses is_wp_error() To check if the value retrieved is a {@link WP_Error} 868 861 */ 869 function bbp_edit_user_handler() { 870 871 // Bail if not a POST action 872 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 873 return; 862 function bbp_edit_user_handler( $action = '' ) { 874 863 875 864 // Bail if action is not 'bbp-update-user' 876 if ( empty( $_POST['action'] ) || ( 'bbp-update-user' !== $_POST['action'] ))865 if ( 'bbp-update-user' !== $action ) 877 866 return; 878 867
Note: See TracChangeset
for help on using the changeset viewer.