Skip to:
Content

BuddyPress.org

Changeset 10654


Ignore:
Timestamp:
03/16/2016 07:39:50 PM (10 years ago)
Author:
djpaul
Message:

Support secure cookies.

If the site is served over HTTPS, mark our cookies as secure.

Fixes #6961

Props DJPaul, w3dzign

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-avatars.php

    r10641 r10654  
    10391039                $bp->template_message      = false;
    10401040                $bp->template_message_type = false;
    1041                 @setcookie( 'bp-message', false, time() - 1000, COOKIEPATH );
    1042                 @setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH );
     1041
     1042                @setcookie( 'bp-message', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
     1043                @setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
    10431044        }
    10441045
  • trunk/src/bp-core/bp-core-functions.php

    r10647 r10654  
    12681268
    12691269        // Send the values to the cookie for page reload display.
    1270         @setcookie( 'bp-message',      $message, time() + 60 * 60 * 24, COOKIEPATH );
    1271         @setcookie( 'bp-message-type', $type,    time() + 60 * 60 * 24, COOKIEPATH );
     1270        @setcookie( 'bp-message',      $message, time() + 60 * 60 * 24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
     1271        @setcookie( 'bp-message-type', $type,    time() + 60 * 60 * 24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
    12721272
    12731273        // Get BuddyPress.
     
    13121312
    13131313        if ( isset( $_COOKIE['bp-message'] ) ) {
    1314                 @setcookie( 'bp-message', false, time() - 1000, COOKIEPATH );
     1314                @setcookie( 'bp-message', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
    13151315        }
    13161316
    13171317        if ( isset( $_COOKIE['bp-message-type'] ) ) {
    1318                 @setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH );
     1318                @setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
    13191319        }
    13201320}
  • trunk/src/bp-groups/bp-groups-actions.php

    r10487 r10654  
    123123                unset( $bp->groups->completed_create_steps );
    124124
    125                 setcookie( 'bp_new_group_id', false, time() - 1000, COOKIEPATH );
    126                 setcookie( 'bp_completed_create_steps', false, time() - 1000, COOKIEPATH );
     125                setcookie( 'bp_new_group_id', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
     126                setcookie( 'bp_completed_create_steps', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
    127127
    128128                $reset_steps = true;
     
    253253
    254254                // Reset cookie info.
    255                 setcookie( 'bp_new_group_id', $bp->groups->new_group_id, time()+60*60*24, COOKIEPATH );
    256                 setcookie( 'bp_completed_create_steps', base64_encode( json_encode( $bp->groups->completed_create_steps ) ), time()+60*60*24, COOKIEPATH );
     255                setcookie( 'bp_new_group_id', $bp->groups->new_group_id, time()+60*60*24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
     256                setcookie( 'bp_completed_create_steps', base64_encode( json_encode( $bp->groups->completed_create_steps ) ), time()+60*60*24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
    257257
    258258                // If we have completed all steps and hit done on the final step we
     
    263263                        unset( $bp->groups->completed_create_steps );
    264264
    265                         setcookie( 'bp_new_group_id', false, time() - 3600, COOKIEPATH );
    266                         setcookie( 'bp_completed_create_steps', false, time() - 3600, COOKIEPATH );
     265                        setcookie( 'bp_new_group_id', false, time() - 3600, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
     266                        setcookie( 'bp_completed_create_steps', false, time() - 3600, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
    267267
    268268                        // Once we completed all steps, record the group creation in the activity stream.
  • trunk/src/bp-messages/bp-messages-functions.php

    r10585 r10654  
    336336 */
    337337function messages_add_callback_values( $recipients, $subject, $content ) {
    338         @setcookie( 'bp_messages_send_to', $recipients, time() + 60 * 60 * 24, COOKIEPATH );
    339         @setcookie( 'bp_messages_subject', $subject,    time() + 60 * 60 * 24, COOKIEPATH );
    340         @setcookie( 'bp_messages_content', $content,    time() + 60 * 60 * 24, COOKIEPATH );
     338        @setcookie( 'bp_messages_send_to', $recipients, time() + 60 * 60 * 24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
     339        @setcookie( 'bp_messages_subject', $subject,    time() + 60 * 60 * 24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
     340        @setcookie( 'bp_messages_content', $content,    time() + 60 * 60 * 24, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
    341341}
    342342
     
    347347 */
    348348function messages_remove_callback_values() {
    349         @setcookie( 'bp_messages_send_to', false, time() - 1000, COOKIEPATH );
    350         @setcookie( 'bp_messages_subject', false, time() - 1000, COOKIEPATH );
    351         @setcookie( 'bp_messages_content', false, time() - 1000, COOKIEPATH );
     349        @setcookie( 'bp_messages_send_to', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
     350        @setcookie( 'bp_messages_subject', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
     351        @setcookie( 'bp_messages_content', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
    352352}
    353353
  • trunk/src/bp-templates/bp-legacy/js/buddypress.js

    r10379 r10654  
    266266                /* Reset the page */
    267267                jq.cookie( 'bp-activity-oldestpage', 1, {
    268                         path: '/'
     268                        path: '/',
     269                        secure: ( 'https:' === window.location.protocol )
    269270                } );
    270271
     
    439440                        if ( null === jq.cookie('bp-activity-oldestpage') ) {
    440441                                jq.cookie('bp-activity-oldestpage', 1, {
    441                                         path: '/'
     442                                        path: '/',
     443                                        secure: ( 'https:' === window.location.protocol )
    442444                                } );
    443445                        }
     
    468470                                jq('#buddypress li.load-more').removeClass('loading');
    469471                                jq.cookie( 'bp-activity-oldestpage', oldest_page, {
    470                                         path: '/'
     472                                        path: '/',
     473                                        secure: ( 'https:' === window.location.protocol )
    471474                                } );
    472475                                jq('#buddypress ul.activity-list').append(response.contents);
     
    17571760        jq('#wp-admin-bar-logout, a.logout').on( 'click', function() {
    17581761                jq.removeCookie('bp-activity-scope', {
    1759                         path: '/'
     1762                        path: '/',
     1763                        secure: ( 'https:' === window.location.protocol )
    17601764                });
    17611765                jq.removeCookie('bp-activity-filter', {
    1762                         path: '/'
     1766                        path: '/',
     1767                        secure: ( 'https:' === window.location.protocol )
    17631768                });
    17641769                jq.removeCookie('bp-activity-oldestpage', {
    1765                         path: '/'
     1770                        path: '/',
     1771                        secure: ( 'https:' === window.location.protocol )
    17661772                });
    17671773
     
    17691775                jq(objects).each( function(i) {
    17701776                        jq.removeCookie('bp-' + objects[i] + '-scope', {
    1771                                 path: '/'
     1777                                path: '/',
     1778                                secure: ( 'https:' === window.location.protocol )
    17721779                        } );
    17731780                        jq.removeCookie('bp-' + objects[i] + '-filter', {
    1774                                 path: '/'
     1781                                path: '/',
     1782                                secure: ( 'https:' === window.location.protocol )
    17751783                        } );
    17761784                        jq.removeCookie('bp-' + objects[i] + '-extras', {
    1777                                 path: '/'
     1785                                path: '/',
     1786                                secure: ( 'https:' === window.location.protocol )
    17781787                        } );
    17791788                });
     
    18511860        /* Reset the page */
    18521861        jq.cookie( 'bp-activity-oldestpage', 1, {
    1853                 path: '/'
     1862                path: '/',
     1863                secure: ( 'https:' === window.location.protocol )
    18541864        } );
    18551865
     
    18951905        /* Save the settings we want to remain persistent to a cookie */
    18961906        jq.cookie( 'bp-' + object + '-scope', scope, {
    1897                 path: '/'
     1907                path: '/',
     1908                secure: ( 'https:' === window.location.protocol )
    18981909        } );
    18991910        jq.cookie( 'bp-' + object + '-filter', filter, {
    1900                 path: '/'
     1911                path: '/',
     1912                secure: ( 'https:' === window.location.protocol )
    19011913        } );
    19021914        jq.cookie( 'bp-' + object + '-extras', extras, {
    1903                 path: '/'
     1915                path: '/',
     1916                secure: ( 'https:' === window.location.protocol )
    19041917        } );
    19051918
     
    19591972        if ( null !== scope ) {
    19601973                jq.cookie( 'bp-activity-scope', scope, {
    1961                         path: '/'
     1974                        path: '/',
     1975                        secure: ( 'https:' === window.location.protocol )
    19621976                } );
    19631977        }
    19641978        if ( null !== filter ) {
    19651979                jq.cookie( 'bp-activity-filter', filter, {
    1966                         path: '/'
     1980                        path: '/',
     1981                        secure: ( 'https:' === window.location.protocol )
    19671982                } );
    19681983        }
    19691984        jq.cookie( 'bp-activity-oldestpage', 1, {
    1970                 path: '/'
     1985                path: '/',
     1986                secure: ( 'https:' === window.location.protocol )
    19711987        } );
    19721988
Note: See TracChangeset for help on using the changeset viewer.