Changeset 5908
- Timestamp:
- 03/13/2012 08:33:06 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-themes/bp-default/_inc/ajax.php
r5822 r5908 86 86 function bp_dtheme_object_template_loader() { 87 87 88 // Bail if not a POST action 89 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 90 return; 91 88 92 /** 89 93 * AJAX requests happen too early to be seen by bp_update_is_directory() … … 117 121 // This function will load the activity loop template when activity is requested via AJAX 118 122 function bp_dtheme_activity_template_loader() { 123 124 // Bail if not a POST action 125 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 126 return; 119 127 120 128 $scope = ''; … … 157 165 function bp_dtheme_post_update() { 158 166 167 // Bail if not a POST action 168 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 169 return; 170 159 171 // Check the nonce 160 172 check_admin_referer( 'post_update', '_wpnonce_post_update' ); … … 197 209 /* AJAX activity comment posting */ 198 210 function bp_dtheme_new_activity_comment() { 211 212 // Bail if not a POST action 213 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 214 return; 199 215 200 216 // Check the nonce … … 254 270 function bp_dtheme_delete_activity() { 255 271 272 // Bail if not a POST action 273 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 274 return; 275 256 276 // Check the nonce 257 277 check_admin_referer( 'bp_activity_delete_link' ); … … 291 311 /* AJAX delete an activity comment */ 292 312 function bp_dtheme_delete_activity_comment() { 313 314 // Bail if not a POST action 315 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 316 return; 293 317 294 318 // Check the nonce … … 332 356 global $bp; 333 357 358 // Bail if not a POST action 359 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 360 return; 361 334 362 // Check that user is logged in, Activity Streams are enabled, and Akismet is present. 335 363 if ( !is_user_logged_in() || !bp_is_active( 'activity' ) || empty( $bp->activity->akismet ) ) { … … 374 402 function bp_dtheme_mark_activity_favorite() { 375 403 404 // Bail if not a POST action 405 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 406 return; 407 376 408 bp_activity_add_user_favorite( $_POST['id'] ); 377 409 _e( 'Remove Favorite', 'buddypress' ); … … 381 413 /* AJAX mark an activity as not a favorite */ 382 414 function bp_dtheme_unmark_activity_favorite() { 415 416 // Bail if not a POST action 417 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 418 return; 383 419 384 420 bp_activity_remove_user_favorite( $_POST['id'] ); … … 394 430 */ 395 431 function bp_dtheme_get_single_activity_content() { 432 // Bail if not a POST action 433 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 434 return; 435 396 436 $activity_array = bp_activity_get_specific( array( 397 437 'activity_ids' => $_POST['activity_id'], … … 401 441 $activity = !empty( $activity_array['activities'][0] ) ? $activity_array['activities'][0] : false; 402 442 403 if ( !$activity)443 if ( empty( $activity ) ) 404 444 exit(); // todo: error? 405 445 … … 417 457 /* AJAX invite a friend to a group functionality */ 418 458 function bp_dtheme_ajax_invite_user() { 459 460 // Bail if not a POST action 461 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 462 return; 419 463 420 464 check_ajax_referer( 'groups_invite_uninvite_user' ); … … 461 505 function bp_dtheme_ajax_addremove_friend() { 462 506 507 // Bail if not a POST action 508 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 509 return; 510 463 511 if ( 'is_friend' == BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $_POST['fid'] ) ) { 464 512 … … 490 538 /* AJAX accept a user as a friend when clicking the "accept" button */ 491 539 function bp_dtheme_ajax_accept_friendship() { 540 541 // Bail if not a POST action 542 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 543 return; 544 492 545 check_admin_referer( 'friends_accept_friendship' ); 493 546 … … 501 554 /* AJAX reject a user as a friend when clicking the "reject" button */ 502 555 function bp_dtheme_ajax_reject_friendship() { 556 // Bail if not a POST action 557 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 558 return; 559 503 560 check_admin_referer( 'friends_reject_friendship' ); 504 561 … … 512 569 /* AJAX join or leave a group when clicking the "join/leave" button */ 513 570 function bp_dtheme_ajax_joinleave_group() { 571 572 // Bail if not a POST action 573 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 574 return; 514 575 515 576 if ( groups_is_user_banned( bp_loggedin_user_id(), $_POST['gid'] ) ) … … 563 624 global $userdata; 564 625 626 // Bail if not a POST action 627 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 628 return; 629 565 630 if ( !isset( $_POST['notice_id'] ) ) { 566 631 echo "-1<div id='message' class='error'><p>" . __('There was a problem closing the notice.', 'buddypress') . '</p></div>'; … … 578 643 function bp_dtheme_ajax_messages_send_reply() { 579 644 global $bp; 645 646 // Bail if not a POST action 647 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 648 return; 580 649 581 650 check_ajax_referer( 'messages_send_message' ); … … 614 683 function bp_dtheme_ajax_message_markunread() { 615 684 685 // Bail if not a POST action 686 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 687 return; 688 616 689 if ( !isset($_POST['thread_ids']) ) { 617 690 echo "-1<div id='message' class='error'><p>" . __('There was a problem marking messages as unread.', 'buddypress' ) . '</p></div>'; … … 629 702 function bp_dtheme_ajax_message_markread() { 630 703 704 // Bail if not a POST action 705 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 706 return; 707 631 708 if ( !isset($_POST['thread_ids']) ) { 632 709 echo "-1<div id='message' class='error'><p>" . __('There was a problem marking messages as read.', 'buddypress' ) . '</p></div>'; … … 643 720 /* AJAX delete a private message or array of messages in your inbox */ 644 721 function bp_dtheme_ajax_messages_delete() { 722 723 // Bail if not a POST action 724 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) 725 return; 645 726 646 727 if ( !isset($_POST['thread_ids']) ) {
Note: See TracChangeset
for help on using the changeset viewer.