Changeset 5558 for trunk/src/includes/topics/template.php
- Timestamp:
- 11/10/2014 05:37:29 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/topics/template.php
r5513 r5558 3266 3266 3267 3267 // Post value is passed 3268 if ( bbp_is_ post_request() && isset( $_POST[ $r['select_id'] ] ) ) {3268 if ( bbp_is_topic_form_post_request() && isset( $_POST[ $r['select_id'] ] ) ) { 3269 3269 $r['selected'] = $_POST[ $r['select_id'] ]; 3270 3270 … … 3355 3355 3356 3356 // Post value is passed 3357 if ( bbp_is_ post_request() && isset( $_POST[ $r['select_id'] ] ) ) {3357 if ( bbp_is_topic_form_post_request() && isset( $_POST[ $r['select_id'] ] ) ) { 3358 3358 $r['selected'] = $_POST[ $r['select_id'] ]; 3359 3359 … … 3849 3849 3850 3850 // Get _POST data 3851 if ( bbp_is_ post_request() && isset( $_POST['bbp_topic_title'] ) ) {3852 $topic_title = $_POST['bbp_topic_title'];3851 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_topic_title'] ) ) { 3852 $topic_title = stripslashes( $_POST['bbp_topic_title'] ); 3853 3853 3854 3854 // Get edit data … … 3886 3886 3887 3887 // Get _POST data 3888 if ( bbp_is_ post_request() && isset( $_POST['bbp_topic_content'] ) ) {3888 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_topic_content'] ) ) { 3889 3889 $topic_content = stripslashes( $_POST['bbp_topic_content'] ); 3890 3890 … … 3933 3933 3934 3934 // Get _POST data 3935 if ( bbp_is_post_request() && isset( $_POST['bbp_topic_tags'] ) ) {3936 $topic_tags = $_POST['bbp_topic_tags'];3935 if ( ( bbp_is_topic_form_post_request() || bbp_is_reply_form_post_request() ) && isset( $_POST['bbp_topic_tags'] ) ) { 3936 $topic_tags = stripslashes( $_POST['bbp_topic_tags'] ); 3937 3937 3938 3938 // Get edit data … … 4016 4016 4017 4017 // Get _POST data 4018 if ( bbp_is_ post_request() && isset( $_POST['bbp_forum_id'] ) ) {4018 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_forum_id'] ) ) { 4019 4019 $topic_forum = (int) $_POST['bbp_forum_id']; 4020 4020 … … 4056 4056 4057 4057 // Get _POST data 4058 if ( bbp_is_ post_request() && isset( $_POST['bbp_topic_subscription'] ) ) {4058 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_topic_subscription'] ) ) { 4059 4059 $topic_subscribed = (bool) $_POST['bbp_topic_subscription']; 4060 4060 … … 4111 4111 4112 4112 // Get _POST data 4113 if ( bbp_is_ post_request() && isset( $_POST['bbp_log_topic_edit'] ) ) {4114 $topic_revision = ( int) $_POST['bbp_log_topic_edit'];4113 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_log_topic_edit'] ) ) { 4114 $topic_revision = (bool) $_POST['bbp_log_topic_edit']; 4115 4115 4116 4116 // No data 4117 4117 } else { 4118 $topic_revision = 1;4118 $topic_revision = true; 4119 4119 } 4120 4120 … … 4147 4147 4148 4148 // Get _POST data 4149 if ( bbp_is_ post_request() && isset( $_POST['bbp_topic_edit_reason'] ) ) {4150 $topic_edit_reason = $_POST['bbp_topic_edit_reason'];4149 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_topic_edit_reason'] ) ) { 4150 $topic_edit_reason = stripslashes( $_POST['bbp_topic_edit_reason'] ); 4151 4151 4152 4152 // No data … … 4155 4155 } 4156 4156 4157 return apply_filters( 'bbp_get_form_topic_edit_reason', esc_attr( $topic_edit_reason ) ); 4158 } 4157 return apply_filters( 'bbp_get_form_topic_edit_reason', $topic_edit_reason ); 4158 } 4159 4160 /** 4161 * Verify if a POST request came from a failed topic attempt. 4162 * 4163 * Used to avoid cross-site request forgeries when checking posted topic form 4164 * content. 4165 * 4166 * @see bbp_topic_form_fields() 4167 * 4168 * @since bbPress (r5558) 4169 * @return boolean True if is a post request with valid nonce 4170 */ 4171 function bbp_is_topic_form_post_request() { 4172 4173 // Bail if not a post request 4174 if ( ! bbp_is_post_request() ) { 4175 return false; 4176 } 4177 4178 // Creating a new topic 4179 if ( bbp_verify_nonce_request( 'bbp-new-topic' ) ) { 4180 return true; 4181 } 4182 4183 // Editing an existing topic 4184 if ( bbp_verify_nonce_request( 'bbp-edit-topic' ) ) { 4185 return true; 4186 } 4187 4188 return false; 4189 }
Note: See TracChangeset
for help on using the changeset viewer.