Changeset 7379
- Timestamp:
- 11/24/2025 07:23:06 PM (4 weeks ago)
- Location:
- trunk
- Files:
-
- 34 edited
-
phpcs.xml.dist (modified) (8 diffs)
-
src/includes/admin/classes/class-bbp-admin.php (modified) (2 diffs)
-
src/includes/admin/classes/class-bbp-converter.php (modified) (2 diffs)
-
src/includes/admin/classes/class-bbp-topic-replies-list-table.php (modified) (1 diff)
-
src/includes/admin/converters/AEF.php (modified) (1 diff)
-
src/includes/admin/converters/FluxBB.php (modified) (1 diff)
-
src/includes/admin/converters/Kunena2.php (modified) (1 diff)
-
src/includes/admin/converters/MyBB.php (modified) (1 diff)
-
src/includes/admin/converters/PHPFox3.php (modified) (1 diff)
-
src/includes/admin/converters/Phorum.php (modified) (1 diff)
-
src/includes/admin/converters/XMB.php (modified) (1 diff)
-
src/includes/admin/converters/e107v1.php (modified) (1 diff)
-
src/includes/admin/replies.php (modified) (1 diff)
-
src/includes/admin/settings.php (modified) (1 diff)
-
src/includes/admin/tools/converter.php (modified) (1 diff)
-
src/includes/admin/topics.php (modified) (1 diff)
-
src/includes/common/ajax.php (modified) (2 diffs)
-
src/includes/common/engagements.php (modified) (7 diffs)
-
src/includes/common/formatting.php (modified) (1 diff)
-
src/includes/common/functions.php (modified) (3 diffs)
-
src/includes/common/locks.php (modified) (2 diffs)
-
src/includes/common/template.php (modified) (1 diff)
-
src/includes/common/widgets.php (modified) (2 diffs)
-
src/includes/core/template-loader.php (modified) (1 diff)
-
src/includes/extend/akismet.php (modified) (1 diff)
-
src/includes/extend/buddypress/functions.php (modified) (1 diff)
-
src/includes/extend/buddypress/groups.php (modified) (2 diffs)
-
src/includes/extend/buddypress/loader.php (modified) (1 diff)
-
src/includes/forums/functions.php (modified) (1 diff)
-
src/includes/forums/template.php (modified) (3 diffs)
-
src/includes/replies/functions.php (modified) (3 diffs)
-
src/includes/replies/template.php (modified) (3 diffs)
-
src/includes/topics/functions.php (modified) (8 diffs)
-
src/includes/topics/template.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpcs.xml.dist
r7378 r7379 218 218 </rule> 219 219 220 <rule ref="PEAR.Files.IncludingFile.UseRequire"> 221 <exclude-pattern>/bbpress\.php$</exclude-pattern> 222 <exclude-pattern>/src/*</exclude-pattern> 223 </rule> 224 220 225 <rule ref="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd"> 221 226 <exclude-pattern>/src/*</exclude-pattern> … … 224 229 <rule ref="Squiz.PHP.EmbeddedPhp.ContentBeforeOpen"> 225 230 <exclude-pattern>/src/*</exclude-pattern> 231 </rule> 232 233 <rule ref="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace"> 234 <exclude-pattern>/src/templates/*</exclude-pattern> 226 235 </rule> 227 236 … … 261 270 </rule> 262 271 263 <rule ref="PEAR.Files.IncludingFile.UseRequire">264 <exclude-pattern>/bbpress\.php$</exclude-pattern>265 <exclude-pattern>/src/*</exclude-pattern>266 </rule>267 268 272 <rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"> 269 273 <exclude-pattern>/src/*</exclude-pattern> … … 294 298 </rule> 295 299 296 <rule ref="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineDEFAULT">297 <exclude-pattern>/src/*</exclude-pattern>298 </rule>299 300 300 <rule ref="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonCASE"> 301 301 <exclude-pattern>/src/*</exclude-pattern> … … 306 306 </rule> 307 307 308 <rule ref="PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose">309 <exclude-pattern>/src/*</exclude-pattern>310 </rule>311 312 <rule ref="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace">313 <exclude-pattern>/src/*</exclude-pattern>314 </rule>315 316 308 <rule ref="Squiz.PHP.CommentedOutCode.Found"> 317 309 <exclude-pattern>/src/*</exclude-pattern> … … 322 314 </rule> 323 315 324 <rule ref="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure">325 <exclude-pattern>/src/*</exclude-pattern>326 </rule>327 328 316 <rule ref="Squiz.PHP.EmbeddedPhp.ContentAfterEnd"> 329 317 <exclude-pattern>/src/*</exclude-pattern> … … 334 322 </rule> 335 323 336 <rule ref="Squiz.PHP.EmbeddedPhp.MultipleStatements">337 <exclude-pattern>/src/*</exclude-pattern>338 </rule>339 340 324 <rule ref="Squiz.PHP.EmbeddedPhp.SpacingAfterOpen"> 341 325 <exclude-pattern>/src/*</exclude-pattern> 342 326 </rule> 343 327 344 <rule ref="Squiz.PHP.NonExecutableCode.Unreachable">345 <exclude-pattern>/src/*</exclude-pattern>346 </rule>347 348 328 <rule ref="Squiz.Strings.ConcatenationSpacing.PaddingFound"> 349 329 <exclude-pattern>/src/*</exclude-pattern> 350 330 </rule> 351 331 352 <rule ref="Universal.Arrays.DuplicateArrayKey.Found">353 <exclude-pattern>/src/*</exclude-pattern>354 </rule>355 356 <rule ref="Universal.ControlStructures.DisallowLonelyIf.Found">357 <exclude-pattern>/src/*</exclude-pattern>358 </rule>359 360 332 <rule ref="Universal.Files.SeparateFunctionsFromOO.Mixed"> 361 333 <exclude-pattern>/src/*</exclude-pattern> … … 398 370 </rule> 399 371 400 <rule ref="WordPress.PHP.NoSilencedErrors.Discouraged">401 <exclude-pattern>/src/*</exclude-pattern>402 </rule>403 404 372 <rule ref="WordPress.Security.EscapeOutput.OutputNotEscaped"> 405 373 <exclude-pattern>/src/*</exclude-pattern> 406 374 </rule> 407 375 408 <rule ref="WordPress.Security.EscapeOutput.UnsafePrintingFunction">409 <exclude-pattern>/src/*</exclude-pattern>410 </rule>411 412 376 <rule ref="WordPress.Security.NonceVerification.Missing"> 413 377 <exclude-pattern>/src/*</exclude-pattern> -
trunk/src/includes/admin/classes/class-bbp-admin.php
r7378 r7379 1434 1434 1435 1435 case 'show' : 1436 default : ?> 1436 default : 1437 ?> 1437 1438 1438 1439 <p><?php esc_html_e( 'You can update your forum through this page. Hit the link below to update.', 'bbpress' ); ?></p> … … 1563 1564 1564 1565 case 'show' : 1565 default : ?>1566 1566 default : 1567 ?> 1567 1568 <p><?php esc_html_e( 'You can update all the forums on your network through this page. It works by calling the update script of each site automatically. Hit the link below to update.', 'bbpress' ); ?></p> 1568 1569 <p><a class="button" href="update-core.php?page=bbpress-update&action=bbpress-update"><?php esc_html_e( 'Update Forums', 'bbpress' ); ?></a></p> -
trunk/src/includes/admin/classes/class-bbp-converter.php
r7378 r7379 270 270 271 271 // Get disabled PHP functions (to avoid using them) 272 $disabled = explode( ',', @ini_get( 'disable_functions' ) ); 272 $disabled = explode( ',', @ini_get( 'disable_functions' ) ); // phpcs:ignore 273 273 274 274 // Maybe avoid terminating when the client goes away (if function is not disabled) 275 275 if ( ! in_array( 'ignore_user_abort', $disabled, true ) ) { 276 @ignore_user_abort( true ); 276 @ignore_user_abort( true ); // phpcs:ignore 277 277 } 278 278 … … 280 280 if ( ! in_array( 'ini_set', $disabled, true ) ) { 281 281 foreach ( $r as $key => $value ) { 282 // phpcs:ignore WordPress.PHP.IniSet.Risky 283 @ini_set( $key, $value ); 282 @ini_set( $key, $value ); // phpcs:ignore 284 283 } 285 284 } -
trunk/src/includes/admin/classes/class-bbp-topic-replies-list-table.php
r7378 r7379 89 89 */ 90 90 public function get_bulk_actions() { 91 return array(); 92 93 // @todo cap checks 94 return array( 91 92 // Default bulk actions 93 $retval = array( 95 94 'unapprove' => esc_html__( 'Unapprove', 'bbpress' ), 96 95 'spam' => esc_html__( 'Spam', 'bbpress' ), 97 96 'trash' => esc_html__( 'Trash', 'bbpress' ) 98 97 ); 98 99 // Override to empty 100 $retval = array(); 101 102 // Return 103 return $retval; 99 104 } 100 105 -
trunk/src/includes/admin/converters/AEF.php
r7378 r7379 554 554 'to_fieldname' => '_bbp_aef_user_private_text' 555 555 ); 556 557 556 } 558 557 -
trunk/src/includes/admin/converters/FluxBB.php
r7378 r7379 576 576 'to_fieldname' => '_bbp_fluxbb_user_admin_note' 577 577 ); 578 579 578 } 580 579 -
trunk/src/includes/admin/converters/Kunena2.php
r7378 r7379 460 460 'to_fieldname' => 'display_name' 461 461 ); 462 463 462 } 464 463 -
trunk/src/includes/admin/converters/MyBB.php
r7378 r7379 500 500 'callback_method' => 'callback_html' 501 501 ); 502 503 502 } 504 503 -
trunk/src/includes/admin/converters/PHPFox3.php
r7378 r7379 490 490 'to_fieldname' => 'display_name' 491 491 ); 492 493 492 } 494 493 -
trunk/src/includes/admin/converters/Phorum.php
r7378 r7379 502 502 'callback_method' => 'callback_html' 503 503 ); 504 505 504 } 506 505 -
trunk/src/includes/admin/converters/XMB.php
r7378 r7379 609 609 'to_fieldname' => '_bbp_xmb_user_mood' 610 610 ); 611 612 611 } 613 612 -
trunk/src/includes/admin/converters/e107v1.php
r7378 r7379 586 586 if ( ! is_null( $row ) ) { 587 587 $this->map_userid[ $field ] = $row->value_id; 588 } elseif ( true === $this->convert_users ) { 589 $this->map_userid[ $field ] = 0; 588 590 } else { 589 if ( true === $this->convert_users ) { 590 $this->map_userid[ $field ] = 0; 591 } else { 592 $this->map_userid[ $field ] = $field; 593 } 591 $this->map_userid[ $field ] = $field; 594 592 } 595 593 } -
trunk/src/includes/admin/replies.php
r7378 r7379 987 987 988 988 // Bail if not viewing spam 989 if ( empty( $_GET['post_status'] ) || ( bbp_get_spam_status_id() !== $_GET['post_status'] ) && current_user_can( 'moderate' ) ) { 989 if ( 990 empty( $_GET['post_status'] ) 991 || 992 ( 993 ( bbp_get_spam_status_id() !== $_GET['post_status'] ) 994 && 995 current_user_can( 'moderate' ) 996 ) 997 ) { 990 998 return; 991 999 } -
trunk/src/includes/admin/settings.php
r7378 r7379 1602 1602 ?> 1603 1603 1604 <p><?php _e( 'Information about the database for your previous forums so they can be converted.', 'bbpress' ); ?></p>1604 <p><?php esc_html_e( 'Information about the database for your previous forums so they can be converted.', 'bbpress' ); ?></p> 1605 1605 1606 1606 <?php -
trunk/src/includes/admin/tools/converter.php
r7378 r7379 96 96 97 97 // Try to include the converter 98 // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 98 99 @include_once $converter_file; 99 100 -
trunk/src/includes/admin/topics.php
r7378 r7379 1181 1181 1182 1182 // Bail if not viewing spam 1183 if ( empty( $_GET['post_status'] ) || ( bbp_get_spam_status_id() !== $_GET['post_status'] ) && current_user_can( 'moderate' ) ) { 1183 if ( 1184 empty( $_GET['post_status'] ) 1185 || 1186 ( 1187 ( bbp_get_spam_status_id() !== $_GET['post_status'] ) 1188 && 1189 current_user_can( 'moderate' ) 1190 ) 1191 ) { 1184 1192 return; 1185 1193 } -
trunk/src/includes/common/ajax.php
r7361 r7379 122 122 123 123 // Set the header content type 124 @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );125 @header( 'X-Robots-Tag: noindex' );124 header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); 125 header( 'X-Robots-Tag: noindex' ); 126 126 127 127 // Disable content sniffing in browsers that support it … … 161 161 162 162 // Send back the JSON 163 @header( 'Content-type: application/json' );163 header( 'Content-type: application/json' ); 164 164 echo json_encode( $response ); 165 165 die(); -
trunk/src/includes/common/engagements.php
r7378 r7379 59 59 */ 60 60 public function add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = false ) { 61 61 // Intentionally empty 62 62 } 63 63 … … 75 75 */ 76 76 public function remove_user_from_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' ) { 77 77 // Intentionally empty 78 78 } 79 79 … … 90 90 */ 91 91 public function remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' ) { 92 92 // Intentionally empty 93 93 } 94 94 … … 106 106 */ 107 107 public function remove_object_from_all_users( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { 108 108 // Intentionally empty 109 109 } 110 110 … … 120 120 */ 121 121 public function remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' ) { 122 122 // Intentionally empty 123 123 } 124 124 … … 135 135 */ 136 136 public function get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { 137 137 // Intentionally empty 138 138 } 139 139 … … 150 150 */ 151 151 public function get_query( $args = array(), $context_key = '', $meta_key = '', $meta_type = 'post' ) { 152 152 // Intentionally empty 153 153 } 154 154 } -
trunk/src/includes/common/formatting.php
r7378 r7379 399 399 $ret = apply_filters( 'bbp_make_clickable', $ret, $text ); 400 400 $ret = substr( $ret, 1, -1 ); // Remove our whitespace padding. 401 $r .= $ret;401 $r .= $ret; 402 402 } 403 403 } -
trunk/src/includes/common/functions.php
r7378 r7379 1717 1717 * @global WP $wp 1718 1718 * @param string $where 1719 * @param WP_Query $ object1719 * @param WP_Query $query 1720 1720 * @return string 1721 1721 */ 1722 function bbp_query_post_parent__in( $where, $ object= '' ) {1722 function bbp_query_post_parent__in( $where, $query = '' ) { 1723 1723 global $wp; 1724 1724 … … 1729 1729 1730 1730 // Bail if no object passed 1731 if ( empty( $ object) ) {1731 if ( empty( $query ) ) { 1732 1732 return $where; 1733 1733 } 1734 1734 1735 1735 // Only 1 post_parent so return $where 1736 if ( is_numeric( $ object->query_vars['post_parent'] ) ) {1736 if ( is_numeric( $query->query_vars['post_parent'] ) ) { 1737 1737 return $where; 1738 1738 } … … 1742 1742 1743 1743 // Including specific post_parent's 1744 if ( ! empty( $ object->query_vars['post_parent__in'] ) ) {1745 $ids = implode( ',', wp_parse_id_list( $ object->query_vars['post_parent__in'] ) );1744 if ( ! empty( $query->query_vars['post_parent__in'] ) ) { 1745 $ids = implode( ',', wp_parse_id_list( $query->query_vars['post_parent__in'] ) ); 1746 1746 $where .= " AND {$bbp_db->posts}.post_parent IN ($ids)"; 1747 1747 1748 1748 // Excluding specific post_parent's 1749 } elseif ( ! empty( $ object->query_vars['post_parent__not_in'] ) ) {1750 $ids = implode( ',', wp_parse_id_list( $ object->query_vars['post_parent__not_in'] ) );1749 } elseif ( ! empty( $query->query_vars['post_parent__not_in'] ) ) { 1750 $ids = implode( ',', wp_parse_id_list( $query->query_vars['post_parent__not_in'] ) ); 1751 1751 $where .= " AND {$bbp_db->posts}.post_parent NOT IN ($ids)"; 1752 1752 } -
trunk/src/includes/common/locks.php
r7378 r7379 24 24 25 25 // Bail if no post 26 if ( ! $post = get_post( $post_id ) ) { 26 $post = get_post( $post_id ); 27 if ( empty( $post ) ) { 27 28 return false; 28 29 } 29 30 30 31 // Bail if no lock 31 if ( ! $lock = get_post_meta( $post->ID, '_edit_lock', true ) ) { 32 $lock = get_post_meta( $post->ID, '_edit_lock', true ); 33 if ( empty( $lock ) ) { 32 34 return false; 33 35 } … … 63 65 64 66 // Bail if no post 65 if ( ! $post = get_post( $post_id ) ) { 67 $post = get_post( $post_id ); 68 if ( empty( $post ) ) { 66 69 return false; 67 70 } 68 71 69 72 // Bail if no user 70 if ( 0 === ( $user_id = get_current_user_id() ) ) { 73 $user_id = get_current_user_id(); 74 if ( empty( $user_id ) ) { 71 75 return false; 72 76 } -
trunk/src/includes/common/template.php
r7378 r7379 2789 2789 2790 2790 // User "home" 2791 // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found 2791 2792 } else { 2792 2793 if ( true === $is_user_home ) { -
trunk/src/includes/common/widgets.php
r7378 r7379 571 571 <ul class="bbp-forums-widget"> 572 572 573 <?php while ( $widget_query->have_posts() ) : $widget_query->the_post(); ?> 573 <?php while ( $widget_query->have_posts() ) : 574 575 $widget_query->the_post(); ?> 574 576 575 577 <li <?php echo ( bbp_get_forum_id() === $widget_query->post->ID ? ' class="bbp-forum-widget-current-forum"' : '' ); ?>> … … 1186 1188 <ul class="bbp-replies-widget"> 1187 1189 1188 <?php while ( $widget_query->have_posts() ) : $widget_query->the_post(); ?> 1190 <?php while ( $widget_query->have_posts() ) : 1191 1192 $widget_query->the_post(); ?> 1189 1193 1190 1194 <li> -
trunk/src/includes/core/template-loader.php
r7378 r7379 29 29 function bbp_template_include_theme_supports( $template = '' ) { 30 30 31 // phpcs:disable Generic.CodeAnalysis.EmptyStatement.DetectedElseif31 // phpcs:disable 32 32 33 33 // Editing a user -
trunk/src/includes/extend/akismet.php
r7378 r7379 863 863 864 864 // Maybe HTTPS if not disabled 865 if ( empty( $ssl_disabled_time ) && ( $is_ssl = wp_http_supports( array( 'ssl' ) ) ) ) { 866 $akismet_url = set_url_scheme( $akismet_url, 'https' ); 865 if ( empty( $ssl_disabled_time ) ) { 866 $is_ssl = wp_http_supports( array( 'ssl' ) ); 867 868 // Use SSL 869 if ( ! empty( $is_ssl ) ) { 870 $akismet_url = set_url_scheme( $akismet_url, 'https' ); 871 } 867 872 } 868 873 -
trunk/src/includes/extend/buddypress/functions.php
r7378 r7379 834 834 835 835 // General component (bbpress/forums/other) 836 // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found 836 837 } else { 837 838 if ( 'topic' === $type ) { -
trunk/src/includes/extend/buddypress/groups.php
r7378 r7379 1732 1732 * @since 2.6.14 1733 1733 * 1734 * @param object object Verifiedobject1735 * @param string $type Type of variable to c heck with `is_a()`1736 * @return mixed $objectVerified object if valid, Default or null if invalid1737 */ 1738 public function rewrite_pagination( $ object, $type = '' ) {1734 * @param object $query Verified query object 1735 * @param string $type Type of variable to compare to 1736 * @return mixed Verified object if valid, Default or null if invalid 1737 */ 1738 public function rewrite_pagination( $query, $type = '' ) { 1739 1739 1740 1740 // Bail if wrong global 1741 1741 if ( 'wp_query' !== $type ) { 1742 return $ object;1742 return $query; 1743 1743 } 1744 1744 1745 1745 // Bail if not inside a BuddyPress Group 1746 1746 if ( ! bp_is_group() ) { 1747 return $ object;1747 return $query; 1748 1748 } 1749 1749 1750 1750 // Bail if not inside a BuddyPress Group Forum 1751 1751 if ( ! bp_is_current_action( 'forum' ) ) { 1752 return $ object;1752 return $query; 1753 1753 } 1754 1754 … … 1767 1767 } 1768 1768 1769 // Single Forum 1770 } else { 1771 1772 // Get the page number from 1st position 1773 if ( bp_is_action_variable( 'page', 0 ) ) { 1774 $page_number = bp_action_variable( 1 ); 1775 } 1769 // Default (Single Forum) 1770 } elseif ( bp_is_action_variable( 'page', 0 ) ) { 1771 $page_number = bp_action_variable( 1 ); 1776 1772 } 1777 1773 1778 1774 // Bail if no page number 1779 1775 if ( empty( $page_number ) ) { 1780 return $ object;1776 return $query; 1781 1777 } 1782 1778 1783 1779 // Set the 'paged' WP_Query var to the new action-based value 1784 $ object->set( 'paged', $page_number );1780 $query->set( 'paged', $page_number ); 1785 1781 1786 1782 // Return the filtered/modified object 1787 return $ object;1783 return $query; 1788 1784 } 1789 1785 -
trunk/src/includes/extend/buddypress/loader.php
r7378 r7379 95 95 // Require files if they exist 96 96 foreach ( $includes as $file ) { 97 98 // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 97 99 if ( @is_file( $this->path . $file ) ) { 98 100 require $this->path . $file; -
trunk/src/includes/forums/functions.php
r7378 r7379 1042 1042 $hidden_forums = new WP_Query( 1043 1043 array( 1044 'fields' => 'ids', 1045 'suppress_filters' => true, 1046 'post_type' => bbp_get_forum_post_type(), 1047 'post_status' => bbp_get_hidden_status_id(), 1048 'posts_per_page' => -1, 1044 'fields' => 'ids', 1045 'post_type' => bbp_get_forum_post_type(), 1046 'post_status' => bbp_get_hidden_status_id(), 1047 'posts_per_page' => -1, 1049 1048 1050 1049 // Performance -
trunk/src/includes/forums/template.php
r7378 r7379 2498 2498 $r['selected'] = sanitize_key( $_POST[ $r['select_id'] ] ); 2499 2499 2500 // No Post value was passed 2500 // Edit topic 2501 } elseif ( bbp_is_forum_edit() ) { 2502 $r['forum_id'] = bbp_get_forum_id( $r['forum_id'] ); 2503 $r['selected'] = bbp_get_forum_type( $r['forum_id'] ); 2504 2505 // New topic 2501 2506 } else { 2502 2503 // Edit topic 2504 if ( bbp_is_forum_edit() ) { 2505 $r['forum_id'] = bbp_get_forum_id( $r['forum_id'] ); 2506 $r['selected'] = bbp_get_forum_type( $r['forum_id'] ); 2507 2508 // New topic 2509 } else { 2510 $r['selected'] = bbp_get_public_status_id(); 2511 } 2507 $r['selected'] = bbp_get_public_status_id(); 2512 2508 } 2513 2509 } … … 2589 2585 $r['selected'] = sanitize_key( $_POST[ $r['select_id'] ] ); 2590 2586 2591 // No Post value was passed 2587 // Edit topic 2588 } elseif ( bbp_is_forum_edit() ) { 2589 $r['forum_id'] = bbp_get_forum_id( $r['forum_id'] ); 2590 $r['selected'] = bbp_get_forum_status( $r['forum_id'] ); 2591 2592 // New topic 2592 2593 } else { 2593 2594 // Edit topic 2595 if ( bbp_is_forum_edit() ) { 2596 $r['forum_id'] = bbp_get_forum_id( $r['forum_id'] ); 2597 $r['selected'] = bbp_get_forum_status( $r['forum_id'] ); 2598 2599 // New topic 2600 } else { 2601 $r['selected'] = bbp_get_public_status_id(); 2602 } 2594 $r['selected'] = bbp_get_public_status_id(); 2603 2595 } 2604 2596 } … … 2680 2672 $r['selected'] = sanitize_key( $_POST[ $r['select_id'] ] ); 2681 2673 2682 // No Post value was passed 2674 // Edit topic 2675 } elseif ( bbp_is_forum_edit() ) { 2676 $r['forum_id'] = bbp_get_forum_id( $r['forum_id'] ); 2677 $r['selected'] = bbp_get_forum_visibility( $r['forum_id'] ); 2678 2679 // New topic 2683 2680 } else { 2684 2685 // Edit topic 2686 if ( bbp_is_forum_edit() ) { 2687 $r['forum_id'] = bbp_get_forum_id( $r['forum_id'] ); 2688 $r['selected'] = bbp_get_forum_visibility( $r['forum_id'] ); 2689 2690 // New topic 2691 } else { 2692 $r['selected'] = bbp_get_public_status_id(); 2693 } 2681 $r['selected'] = bbp_get_public_status_id(); 2694 2682 } 2695 2683 } -
trunk/src/includes/replies/functions.php
r7378 r7379 571 571 return; 572 572 573 // Reply exists 573 // Check users ability to create new reply 574 } elseif ( ! bbp_is_reply_anonymous( $reply_id ) ) { 575 576 // User cannot edit this reply 577 if ( ! current_user_can( 'edit_reply', $reply_id ) ) { 578 bbp_add_error( 'bbp_edit_reply_permission', __( '<strong>Error</strong>: You do not have permission to edit that reply.', 'bbpress' ) ); 579 return; 580 } 581 582 // Set reply author 583 $reply_author = bbp_get_reply_author_id( $reply_id ); 584 585 // It is an anonymous post 574 586 } else { 575 587 576 // Check users ability to create new reply 577 if ( ! bbp_is_reply_anonymous( $reply_id ) ) { 578 579 // User cannot edit this reply 580 if ( ! current_user_can( 'edit_reply', $reply_id ) ) { 581 bbp_add_error( 'bbp_edit_reply_permission', __( '<strong>Error</strong>: You do not have permission to edit that reply.', 'bbpress' ) ); 582 return; 583 } 584 585 // Set reply author 586 $reply_author = bbp_get_reply_author_id( $reply_id ); 587 588 // It is an anonymous post 589 } else { 590 591 // Filter anonymous data 592 $anonymous_data = bbp_filter_anonymous_post_data(); 593 } 588 // Filter anonymous data 589 $anonymous_data = bbp_filter_anonymous_post_data(); 594 590 } 595 591 … … 1400 1396 case 'topic' : 1401 1397 default : 1402 1403 1398 // User needs to be able to publish topics 1404 1399 if ( current_user_can( 'publish_topics' ) ) { … … 2320 2315 2321 2316 <?php if ( bbp_has_replies( $replies_query ) ) : ?> 2322 <?php while ( bbp_replies() ) : bbp_the_reply(); ?> 2317 <?php while ( bbp_replies() ) : 2318 2319 bbp_the_reply(); ?> 2323 2320 2324 2321 <item> -
trunk/src/includes/replies/template.php
r7378 r7379 497 497 498 498 // Include pagination 499 // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found 499 500 } else { 500 501 … … 2546 2547 2547 2548 // We are including the lead topic 2549 // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found 2548 2550 } else { 2549 2551 … … 2866 2868 $r['selected'] = sanitize_key( $_POST[ $r['select_id'] ] ); 2867 2869 2868 // No Post value was passed 2870 // Edit reply 2871 } elseif ( bbp_is_reply_edit() ) { 2872 $r['reply_id'] = bbp_get_reply_id( $r['reply_id'] ); 2873 $r['selected'] = bbp_get_reply_status( $r['reply_id'] ); 2874 2875 // New reply 2869 2876 } else { 2870 2871 // Edit reply 2872 if ( bbp_is_reply_edit() ) { 2873 $r['reply_id'] = bbp_get_reply_id( $r['reply_id'] ); 2874 $r['selected'] = bbp_get_reply_status( $r['reply_id'] ); 2875 2876 // New reply 2877 } else { 2878 $r['selected'] = bbp_get_public_status_id(); 2879 } 2877 $r['selected'] = bbp_get_public_status_id(); 2880 2878 } 2881 2879 } -
trunk/src/includes/topics/functions.php
r7378 r7379 469 469 return; 470 470 471 // Topic exists 471 // Check users ability to create new topic 472 } elseif ( ! bbp_is_topic_anonymous( $topic_id ) ) { 473 474 // User cannot edit this topic 475 if ( ! current_user_can( 'edit_topic', $topic_id ) ) { 476 bbp_add_error( 'bbp_edit_topic_permission', __( '<strong>Error</strong>: You do not have permission to edit that topic.', 'bbpress' ) ); 477 } 478 479 // Set topic author 480 $topic_author = bbp_get_topic_author_id( $topic_id ); 481 482 // It is an anonymous post 472 483 } else { 473 484 474 // Check users ability to create new topic 475 if ( ! bbp_is_topic_anonymous( $topic_id ) ) { 476 477 // User cannot edit this topic 478 if ( ! current_user_can( 'edit_topic', $topic_id ) ) { 479 bbp_add_error( 'bbp_edit_topic_permission', __( '<strong>Error</strong>: You do not have permission to edit that topic.', 'bbpress' ) ); 480 } 481 482 // Set topic author 483 $topic_author = bbp_get_topic_author_id( $topic_id ); 484 485 // It is an anonymous post 486 } else { 487 488 // Filter anonymous data 489 $anonymous_data = bbp_filter_anonymous_post_data(); 490 } 485 // Filter anonymous data 486 $anonymous_data = bbp_filter_anonymous_post_data(); 491 487 } 492 488 … … 1175 1171 bbp_add_error( 'bbp_merge_topic_nonce', __( '<strong>Error</strong>: Are you sure you wanted to do that?', 'bbpress' ) ); 1176 1172 return; 1173 } 1174 1175 // Get source topic 1176 $source_topic = bbp_get_topic( $source_topic_id ); 1177 1177 1178 1178 // Source topic not found 1179 } elseif ( ! $source_topic = bbp_get_topic( $source_topic_id) ) {1179 if ( empty( $source_topic ) ) { 1180 1180 bbp_add_error( 'bbp_merge_topic_source_not_found', __( '<strong>Error</strong>: The topic you want to merge was not found.', 'bbpress' ) ); 1181 1181 return; … … 1197 1197 } 1198 1198 1199 // Get the destination topic 1200 $destination_topic = bbp_get_topic( $destination_topic_id ); 1201 1199 1202 // Destination topic not found 1200 if ( ! $destination_topic = bbp_get_topic( $destination_topic_id) ) {1203 if ( empty( $destination_topic ) ) { 1201 1204 bbp_add_error( 'bbp_merge_topic_destination_not_found', __( '<strong>Error</strong>: The topic you want to merge to was not found.', 'bbpress' ) ); 1202 1205 } … … 1507 1510 case 'reply' : 1508 1511 default : 1509 1510 1512 // User needs to be able to publish topics 1511 1513 if ( current_user_can( 'publish_topics' ) ) { … … 1812 1814 1813 1815 // No tag name was provided 1814 if ( empty( $_POST['tag-name'] ) || ! $name = $_POST['tag-name']) {1816 if ( empty( $_POST['tag-name'] ) || ! is_scalar( $_POST['tag-name'] ) ) { 1815 1817 bbp_add_error( 'bbp_manage_topic_tag_update_name', __( '<strong>Error</strong>: You need to enter a tag name.', 'bbpress' ) ); 1816 1818 return; … … 1818 1820 1819 1821 // Attempt to update the tag 1822 $name = $_POST['tag-name']; 1820 1823 $slug = ! empty( $_POST['tag-slug'] ) ? $_POST['tag-slug'] : ''; 1821 1824 $description = ! empty( $_POST['tag-description'] ) ? $_POST['tag-description'] : ''; … … 1861 1864 1862 1865 // No tag name was provided 1863 if ( empty( $_POST['tag-existing-name'] ) || ! $name = $_POST['tag-existing-name']) {1866 if ( empty( $_POST['tag-existing-name'] ) || ! is_scalar( $_POST['tag-existing-name'] ) ) { 1864 1867 bbp_add_error( 'bbp_manage_topic_tag_merge_name', __( '<strong>Error</strong>: You need to enter a tag name.', 'bbpress' ) ); 1865 1868 return; 1866 1869 } 1867 1870 1871 // Unsanitized name of existing tag 1872 $name = $_POST['tag-existing-name']; 1873 1868 1874 // If term does not exist, create it 1869 if ( ! $tag = term_exists( $name, bbp_get_topic_tag_tax_id() ) ) { 1875 $tag = term_exists( $name, bbp_get_topic_tag_tax_id() ); 1876 if ( empty( $tag ) ) { 1870 1877 $tag = wp_insert_term( $name, bbp_get_topic_tag_tax_id() ); 1871 1878 } … … 3931 3938 <?php if ( bbp_has_topics( $topics_query ) ) : ?> 3932 3939 3933 <?php while ( bbp_topics() ) : bbp_the_topic(); ?> 3940 <?php while ( bbp_topics() ) : 3941 3942 bbp_the_topic(); ?> 3934 3943 3935 3944 <item> -
trunk/src/includes/topics/template.php
r7378 r7379 3316 3316 $r['selected'] = sanitize_key( $_POST[ $r['select_id'] ] ); 3317 3317 3318 // No Post value passed 3319 } else { 3320 3321 // Edit topic 3322 if ( bbp_is_single_topic() || bbp_is_topic_edit() ) { 3323 3324 // Get current topic id 3325 $r['topic_id'] = bbp_get_topic_id( $r['topic_id'] ); 3326 3327 // Topic is super sticky 3328 if ( bbp_is_topic_super_sticky( $r['topic_id'] ) ) { 3329 $r['selected'] = 'super'; 3330 3331 // Topic is sticky or normal 3332 } else { 3333 $r['selected'] = bbp_is_topic_sticky( $r['topic_id'], false ) 3334 ? 'stick' 3335 : 'unstick'; 3336 } 3318 // Edit topic 3319 } elseif ( bbp_is_single_topic() || bbp_is_topic_edit() ) { 3320 3321 // Get current topic id 3322 $r['topic_id'] = bbp_get_topic_id( $r['topic_id'] ); 3323 3324 // Topic is super sticky 3325 if ( bbp_is_topic_super_sticky( $r['topic_id'] ) ) { 3326 $r['selected'] = 'super'; 3327 3328 // Topic is sticky or normal 3329 } else { 3330 $r['selected'] = bbp_is_topic_sticky( $r['topic_id'], false ) 3331 ? 'stick' 3332 : 'unstick'; 3337 3333 } 3338 3334 } … … 3409 3405 $r['selected'] = sanitize_key( $_POST[ $r['select_id'] ] ); 3410 3406 3411 // No Post value was passed 3407 // Edit topic 3408 } elseif ( bbp_is_topic_edit() ) { 3409 $r['topic_id'] = bbp_get_topic_id( $r['topic_id'] ); 3410 $r['selected'] = bbp_get_topic_status( $r['topic_id'] ); 3411 3412 // New topic 3412 3413 } else { 3413 3414 // Edit topic 3415 if ( bbp_is_topic_edit() ) { 3416 $r['topic_id'] = bbp_get_topic_id( $r['topic_id'] ); 3417 $r['selected'] = bbp_get_topic_status( $r['topic_id'] ); 3418 3419 // New topic 3420 } else { 3421 $r['selected'] = bbp_get_public_status_id(); 3422 } 3414 $r['selected'] = bbp_get_public_status_id(); 3423 3415 } 3424 3416 }
Note: See TracChangeset
for help on using the changeset viewer.