Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/22/2015 04:18:39 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Messages: Audit bp-messages-template.php output functions and add escaping and/or sanitization based on their anticipated results and usages.

Hat-tip boonebgorges. Props vnd.

For 2.4 (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/bp-messages-template.php

    r10059 r10060  
    657657 */
    658658function bp_message_thread_delete_link() {
    659         echo bp_get_message_thread_delete_link();
     659        echo esc_url( bp_get_message_thread_delete_link() );
    660660}
    661661        /**
     
    776776 */
    777777function bp_message_css_class() {
    778         echo bp_get_message_css_class();
     778        echo esc_attr( bp_get_message_css_class() );
    779779}
    780780        /**
     
    828828 */
    829829function bp_message_thread_unread_count() {
    830         echo bp_get_message_thread_unread_count();
     830        echo esc_html( bp_get_message_thread_unread_count() );
    831831}
    832832        /**
     
    11031103        }
    11041104
    1105         echo $message;
     1105        echo esc_html( $message );
    11061106}
    11071107
     
    11501150 */
    11511151function bp_messages_form_action() {
    1152         echo bp_get_messages_form_action();
     1152        echo esc_url( bp_get_messages_form_action() );
    11531153}
    11541154        /**
     
    11731173 */
    11741174function bp_messages_username_value() {
    1175         echo bp_get_messages_username_value();
     1175        echo esc_attr( bp_get_messages_username_value() );
    11761176}
    11771177        /**
     
    12041204 */
    12051205function bp_messages_subject_value() {
    1206         echo bp_get_messages_subject_value();
     1206        echo esc_attr( bp_get_messages_subject_value() );
    12071207}
    12081208        /**
     
    12151215         */
    12161216        function bp_get_messages_subject_value() {
     1217
     1218                // Sanitized in bp-messages-filters.php
    12171219                $subject = ! empty( $_POST['subject'] )
    12181220                        ? $_POST['subject']
     
    12331235 */
    12341236function bp_messages_content_value() {
    1235         echo bp_get_messages_content_value();
     1237        echo esc_textarea( bp_get_messages_content_value() );
    12361238}
    12371239        /**
     
    12451247        function bp_get_messages_content_value() {
    12461248
    1247                 $content = !empty( $_POST['content'] )
     1249                // Sanitized in bp-messages-filters.php
     1250                $content = ! empty( $_POST['content'] )
    12481251                        ? $_POST['content']
    12491252                        : '';
     
    13711374 */
    13721375function bp_message_notice_id() {
    1373         echo bp_get_message_notice_id();
     1376        echo (int) bp_get_message_notice_id();
    13741377}
    13751378        /**
     
    14671470 */
    14681471function bp_message_notice_delete_link() {
    1469         echo bp_get_message_notice_delete_link();
     1472        echo esc_url( bp_get_message_notice_delete_link() );
    14701473}
    14711474        /**
     
    14921495 */
    14931496function bp_message_activate_deactivate_link() {
    1494         echo bp_get_message_activate_deactivate_link();
     1497        echo esc_url( bp_get_message_activate_deactivate_link() );
    14951498}
    14961499        /**
     
    15221525 */
    15231526function bp_message_activate_deactivate_text() {
    1524         echo bp_get_message_activate_deactivate_text();
     1527        echo esc_html( bp_get_message_activate_deactivate_text() );
    15251528}
    15261529        /**
     
    16121615 */
    16131616function bp_send_private_message_link() {
    1614         echo bp_get_send_private_message_link();
     1617        echo esc_url( bp_get_send_private_message_link() );
    16151618}
    16161619        /**
     
    16891692 */
    16901693function bp_message_loading_image_src() {
    1691         echo bp_get_message_loading_image_src();
     1694        echo esc_url( bp_get_message_loading_image_src() );
    16921695}
    16931696        /**
     
    17371740 */
    17381741function bp_message_get_recipient_usernames() {
    1739         echo bp_get_message_get_recipient_usernames();
     1742        echo esc_attr( bp_get_message_get_recipient_usernames() );
    17401743}
    17411744        /**
     
    17451748         */
    17461749        function bp_get_message_get_recipient_usernames() {
    1747                 $recipients = isset( $_GET['r'] ) ? stripslashes( $_GET['r'] ) : '';
     1750
     1751                // Sanitized in bp-messages-filters.php
     1752                $recipients = isset( $_GET['r'] )
     1753                        ? $_GET['r']
     1754                        : '';
    17481755
    17491756                /**
     
    19821989 */
    19831990function bp_thread_messages_order() {
    1984         echo bp_get_thread_messages_order();
     1991        echo esc_attr( bp_get_thread_messages_order() );
    19851992}
    19861993        /**
     
    20202027 */
    20212028function bp_the_thread_id() {
    2022         echo bp_get_the_thread_id();
     2029        echo (int) bp_get_the_thread_id();
    20232030}
    20242031        /**
     
    20732080 * @return string
    20742081 */
    2075 function bp_get_the_thread_recipients(){
     2082function bp_get_the_thread_recipients() {
    20762083        if ( 5 <= bp_get_thread_recipients_count() ) {
    20772084                $recipients = sprintf( __( '%s recipients', 'buddypress' ), number_format_i18n( bp_get_thread_recipients_count() ) );
     
    21612168 */
    21622169function bp_the_thread_message_id() {
    2163         echo bp_get_the_thread_message_id();
     2170        echo (int) bp_get_the_thread_message_id();
    21642171}
    21652172        /**
     
    21932200 */
    21942201function bp_the_thread_message_css_class() {
    2195         echo bp_get_the_thread_message_css_class();
     2202        echo esc_attr( bp_get_the_thread_message_css_class() );
    21962203}
    21972204        /**
     
    22342241 */
    22352242function bp_the_thread_message_alt_class() {
    2236         echo bp_get_the_thread_message_alt_class();
     2243        echo esc_attr( bp_get_the_thread_message_alt_class() );
    22372244}
    22382245        /**
     
    22662273 */
    22672274function bp_the_thread_message_sender_id() {
    2268         echo bp_get_the_thread_message_sender_id();
     2275        echo (int) bp_get_the_thread_message_sender_id();
    22692276}
    22702277        /**
     
    23422349 */
    23432350function bp_the_thread_message_sender_link() {
    2344         echo bp_get_the_thread_message_sender_link();
     2351        echo esc_url( bp_get_the_thread_message_sender_link() );
    23452352}
    23462353        /**
     
    23662373 */
    23672374function bp_the_thread_message_sender_name() {
    2368         echo bp_get_the_thread_message_sender_name();
     2375        echo esc_html( bp_get_the_thread_message_sender_name() );
    23692376}
    23702377        /**
     
    23962403 */
    23972404function bp_the_thread_delete_link() {
    2398         echo bp_get_the_thread_delete_link();
     2405        echo esc_url( bp_get_the_thread_delete_link() );
    23992406}
    24002407        /**
Note: See TracChangeset for help on using the changeset viewer.