Changeset 4842
- Timestamp:
- 07/24/2011 10:51:38 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-messages/bp-messages-actions.php
r4825 r4842 10 10 11 11 function messages_action_view_message() { 12 global $ bp, $thread_id;12 global $thread_id; 13 13 14 if ( $bp->current_component != $bp->messages->slug || $bp->current_action != 'view')14 if ( !bp_is_messages_component() || !bp_is_current_action( 'view' ) ) 15 15 return false; 16 16 17 $thread_id = 0; 18 if ( !empty( $bp->action_variables[0] ) ) 19 $thread_id = $bp->action_variables[0]; 20 21 if ( !$thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access($thread_id) && !is_super_admin() ) ) 22 bp_core_redirect( $bp->displayed_user->domain . $bp->current_component ); 17 $thread_id = (int)bp_action_variable( 0 ); 18 19 if ( !$thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access( $thread_id ) && !is_super_admin() ) ) 20 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() ); 23 21 24 22 // Check if a new reply has been submitted … … 34 32 bp_core_add_message( __( 'There was a problem sending your reply, please try again', 'buddypress' ), 'error' ); 35 33 36 bp_core_redirect( $bp->displayed_user->domain . $bp->current_component. '/view/' . $thread_id . '/' );34 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . $thread_id . '/' ); 37 35 } 38 36 … … 50 48 'name' => sprintf( __( 'From: %s', 'buddypress' ), BP_Messages_Thread::get_last_sender( $thread_id ) ), 51 49 'slug' => 'view', 52 'parent_url' => $bp->loggedin_user->domain . $bp->messages->slug . '/',53 'parent_slug' => $bp->messages->slug,50 'parent_url' => trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() ), 51 'parent_slug' => bp_get_messages_slug(), 54 52 'screen_function' => true, 55 53 'position' => 40, 56 54 'user_has_access' => bp_is_my_profile(), 57 'link' => $bp->loggedin_user->domain . $bp->messages->slug. '/view/' . (int) $thread_id55 'link' => bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . (int) $thread_id 58 56 ) ); 59 57 … … 63 61 64 62 function messages_action_delete_message() { 65 global $ bp, $thread_id;63 global $thread_id; 66 64 67 if ( $bp->current_component != $bp->messages->slug || 'notices' == $bp->current_action || empty( $bp->action_variables[0] ) || 'delete' != $bp->action_variables[0])65 if ( !bp_is_messages_component() || bp_is_current_action( 'notices' ) || !bp_is_action_variable( 'delete', 0 ) ) 68 66 return false; 69 67 70 $thread_id = $bp->action_variables[1];71 72 if ( !$thread_id || !is_numeric( $thread_id) || !messages_check_thread_access($thread_id) ) {73 bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action);68 $thread_id = bp_action_variable( 1 ); 69 70 if ( !$thread_id || !is_numeric( $thread_id ) || !messages_check_thread_access( $thread_id ) ) { 71 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ); 74 72 } else { 75 73 if ( !check_admin_referer( 'messages_delete_thread' ) ) … … 77 75 78 76 // Delete message 79 if ( !messages_delete_thread( $thread_id) ) {77 if ( !messages_delete_thread( $thread_id ) ) { 80 78 bp_core_add_message( __('There was an error deleting that message.', 'buddypress'), 'error' ); 81 79 } else { 82 80 bp_core_add_message( __('Message deleted.', 'buddypress') ); 83 81 } 84 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action);82 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ); 85 83 } 86 84 } … … 88 86 89 87 function messages_action_bulk_delete() { 90 global $ bp, $thread_ids;88 global $thread_ids; 91 89 92 if ( $bp->current_component != $bp->messages->slug || empty( $bp->action_variables[0] ) || 'bulk-delete' != $bp->action_variables[0])90 if ( !bp_is_messages_component() || !bp_is_action_variable( 'bulk-delete', 0 ) ) 93 91 return false; 94 92 95 93 $thread_ids = $_POST['thread_ids']; 96 94 97 if ( !$thread_ids || !messages_check_thread_access( $thread_ids) ) {98 bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/' . $bp->current_action);95 if ( !$thread_ids || !messages_check_thread_access( $thread_ids ) ) { 96 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ); 99 97 } else { 100 98 if ( !check_admin_referer( 'messages_delete_thread' ) ) … … 106 104 bp_core_add_message( __('Messages deleted.', 'buddypress') ); 107 105 108 bp_core_redirect( $bp->loggedin_user->domain . $bp->current_component . '/' . $bp->current_action);106 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ); 109 107 } 110 108 } -
trunk/bp-messages/bp-messages-screens.php
r4825 r4842 12 12 global $bp; 13 13 14 if ( !empty( $bp->action_variables) ) {14 if ( bp_action_variables() ) { 15 15 bp_do_404(); 16 16 return; … … 24 24 global $bp; 25 25 26 if ( !empty( $bp->action_variables) ) {26 if ( bp_action_variables() ) { 27 27 bp_do_404(); 28 28 return; … … 36 36 global $bp; 37 37 38 if ( !empty( $bp->action_variables) ) {38 if ( bp_action_variables() ) { 39 39 bp_do_404(); 40 40 return; … … 86 86 87 87 function messages_screen_notices() { 88 global $ bp, $notice_id;88 global $notice_id; 89 89 90 90 if ( !is_super_admin() ) 91 91 return false; 92 92 93 $notice_id = isset( $bp->action_variables[1] ) ? $bp->action_variables[1] : 0;94 93 $notice_id = (int)bp_action_variable( 1 ); 94 95 95 if ( !empty( $notice_id ) && is_numeric( $notice_id ) ) { 96 96 $notice = new BP_Messages_Notice( $notice_id ); 97 97 98 if ( 'deactivate' == $bp->action_variables[0]) {98 if ( bp_is_action_variable( 'deactivate', 0 ) ) { 99 99 if ( !$notice->deactivate() ) { 100 100 bp_core_add_message( __('There was a problem deactivating that notice.', 'buddypress'), 'error' ); … … 102 102 bp_core_add_message( __('Notice deactivated.', 'buddypress') ); 103 103 } 104 } else if ( 'activate' == $bp->action_variables[0]) {104 } else if ( bp_is_action_variable( 'activate', 0 ) ) { 105 105 if ( !$notice->activate() ) { 106 106 bp_core_add_message( __('There was a problem activating that notice.', 'buddypress'), 'error' ); … … 108 108 bp_core_add_message( __('Notice activated.', 'buddypress') ); 109 109 } 110 } else if ( 'delete' == $bp->action_variables[0]) {110 } else if ( bp_is_action_variable( 'delete' ) ) { 111 111 if ( !$notice->delete() ) { 112 112 bp_core_add_message( __('There was a problem deleting that notice.', 'buddypress'), 'buddypress' ); … … 115 115 } 116 116 } 117 bp_core_redirect( $bp->loggedin_user->domain . $bp->messages->slug. '/notices' );117 bp_core_redirect( bp_loggedin_user_domain() . bp_get_messages_slug() . '/notices' ); 118 118 } 119 119 120 if ( !empty( $bp->action_variables) ) {120 if ( bp_action_variables() ) { 121 121 bp_do_404(); 122 122 return; … … 131 131 global $bp; 132 132 133 if ( !empty( $bp->action_variables) ) {133 if ( bp_action_variables() ) { 134 134 bp_do_404(); 135 135 return; -
trunk/bp-messages/bp-messages-template.php
r4829 r4842 344 344 } 345 345 346 /** 347 * Echoes the form action for Messages HTML forms 348 * 349 * @package BuddyPress 350 */ 346 351 function bp_messages_form_action() { 347 352 echo bp_get_messages_form_action(); 348 353 } 354 /** 355 * Returns the form action for Messages HTML forms 356 * 357 * @package BuddyPress 358 * 359 * @return str The form action 360 */ 349 361 function bp_get_messages_form_action() { 350 global $bp; 351 352 if ( isset( $bp->action_variables[0] ) ) 353 $av = $bp->action_variables[0]; 354 else 355 $av = ''; 356 357 return apply_filters( 'bp_get_messages_form_action', trailingslashit( $bp->loggedin_user->domain . $bp->messages->slug . '/' . $bp->current_action . '/' . $av . '/' ) ); 362 return apply_filters( 'bp_get_messages_form_action', trailingslashit( bp_loggedin_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/' . bp_action_variable( 0 ) ) ); 358 363 } 359 364 … … 719 724 720 725 if ( !$thread_id && bp_is_current_component( 'messages' ) && bp_is_current_action( 'view' ) ) 721 $thread_id = (int) $bp->action_variables[0];726 $thread_id = (int)bp_action_variable( 0 ); 722 727 723 728 $thread_template = new BP_Messages_Thread_Template( $thread_id, $order ); -
trunk/bp-settings/bp-settings-actions.php
r4826 r4842 8 8 global $bp; 9 9 10 if ( !empty( $bp->action_variables) ) {10 if ( bp_action_variables() ) { 11 11 bp_do_404(); 12 12 return; … … 118 118 global $bp; 119 119 120 if ( !empty( $bp->action_variables) ) {120 if ( bp_action_variables() ) { 121 121 bp_do_404(); 122 122 return; … … 146 146 global $bp; 147 147 148 if ( !empty( $bp->action_variables) ) {148 if ( bp_action_variables() ) { 149 149 bp_do_404(); 150 150 return;
Note: See TracChangeset
for help on using the changeset viewer.