<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][11458] branches/2.0: Improved nonce protection for some front-end AJAX endpoints.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/11458">11458</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/11458","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>boonebgorges</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2017-03-08 17:52:31 +0000 (Wed, 08 Mar 2017)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Improved nonce protection for some front-end AJAX endpoints.
Merge of <a href="http://buddypress.trac.wordpress.org/changeset/11449">[11449]</a> to the 2.0 branch.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches20bpmessagesbpmessagestemplatephp">branches/2.0/bp-messages/bp-messages-template.php</a></li>
<li><a href="#branches20bptemplatesbplegacybuddypressfunctionsphp">branches/2.0/bp-templates/bp-legacy/buddypress-functions.php</a></li>
<li><a href="#branches20bptemplatesbplegacyjsbuddypressjs">branches/2.0/bp-templates/bp-legacy/js/buddypress.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches20bpmessagesbpmessagestemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/2.0/bp-messages/bp-messages-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/2.0/bp-messages/bp-messages-template.php 2017-03-08 17:45:30 UTC (rev 11457)
+++ branches/2.0/bp-messages/bp-messages-template.php 2017-03-08 17:52:31 UTC (rev 11458)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -543,10 +543,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <a href="#" id="mark_as_read"><?php _e('Mark as Read', 'buddypress') ?></a>
</span><span class="cx" style="display: block; padding: 0 10px"> <a href="#" id="mark_as_unread"><?php _e('Mark as Unread', 'buddypress') ?></a>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php wp_nonce_field( 'bp_messages_mark_messages_read', 'mark-messages-read-nonce', false ); ?>
+ <?php wp_nonce_field( 'bp_messages_mark_messages_unread', 'mark-messages-unread-nonce', false ); ?>
+
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <a href="#" id="delete_<?php echo bp_current_action(); ?>_messages"><?php _e( 'Delete Selected', 'buddypress' ); ?></a>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php wp_nonce_field( 'bp_messages_delete_selected', 'delete-selected-nonce', false ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -707,6 +710,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <strong><?php echo stripslashes( wp_filter_kses( $notice->subject ) ) ?></strong><br />
</span><span class="cx" style="display: block; padding: 0 10px"> <?php echo stripslashes( wp_filter_kses( $notice->message) ) ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <a href="#" id="close-notice"><?php _e( 'Close', 'buddypress' ) ?></a>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php wp_nonce_field( 'bp_messages_close_notice', 'close-notice-nonce' ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> </p>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span></span></pre></div>
<a id="branches20bptemplatesbplegacybuddypressfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/2.0/bp-templates/bp-legacy/buddypress-functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/2.0/bp-templates/bp-legacy/buddypress-functions.php 2017-03-08 17:45:30 UTC (rev 11457)
+++ branches/2.0/bp-templates/bp-legacy/buddypress-functions.php 2017-03-08 17:52:31 UTC (rev 11458)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -652,7 +652,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> case 'mentions':
</span><span class="cx" style="display: block; padding: 0 10px"> $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- bp_activity_clear_new_mentions( bp_loggedin_user_id() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( isset( $_POST['_wpnonce_activity_filter'] ) && wp_verify_nonce( wp_unslash( $_POST['_wpnonce_activity_filter'] ), 'activity_filter' ) ) {
+ bp_activity_clear_new_mentions( bp_loggedin_user_id() );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> default:
</span><span class="cx" style="display: block; padding: 0 10px"> $feed_url = home_url( bp_get_activity_root_slug() . '/feed/' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -919,6 +923,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( wp_unslash( $_POST['nonce'] ), 'mark_favorite' ) ) {
+ return;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( bp_activity_add_user_favorite( $_POST['id'] ) )
</span><span class="cx" style="display: block; padding: 0 10px"> _e( 'Remove Favorite', 'buddypress' );
</span><span class="cx" style="display: block; padding: 0 10px"> else
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -938,6 +946,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( wp_unslash( $_POST['nonce'] ), 'unmark_favorite' ) ) {
+ return;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( bp_activity_remove_user_favorite( $_POST['id'] ) )
</span><span class="cx" style="display: block; padding: 0 10px"> _e( 'Favorite', 'buddypress' );
</span><span class="cx" style="display: block; padding: 0 10px"> else
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1229,7 +1241,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset( $_POST['notice_id'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $nonce_check = isset( $_POST['nonce'] ) && wp_verify_nonce( wp_unslash( $_POST['nonce'] ), 'bp_messages_close_notice' );
+
+ if ( ! $nonce_check || ! isset( $_POST['notice_id'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> echo "-1<div id='message' class='error'><p>" . __( 'There was a problem closing the notice.', 'buddypress' ) . '</p></div>';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1310,7 +1324,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset($_POST['thread_ids']) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $nonce_check = isset( $_POST['nonce'] ) & wp_verify_nonce( wp_unslash( $_POST['nonce'] ), 'bp_messages_mark_messages_unread' );
+
+ if ( ! $nonce_check || ! isset( $_POST['thread_ids'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> echo "-1<div id='message' class='error'><p>" . __( 'There was a problem marking messages as unread.', 'buddypress' ) . '</p></div>';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1335,7 +1351,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset($_POST['thread_ids']) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $nonce_check = isset( $_POST['nonce'] ) & wp_verify_nonce( wp_unslash( $_POST['nonce'] ), 'bp_messages_mark_messages_read' );
+
+ if ( ! $nonce_check || ! isset( $_POST['thread_ids'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> echo "-1<div id='message' class='error'><p>" . __('There was a problem marking messages as read.', 'buddypress' ) . '</p></div>';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1360,7 +1378,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset($_POST['thread_ids']) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $nonce_check = isset( $_POST['nonce'] ) & wp_verify_nonce( wp_unslash( $_POST['nonce'] ), 'bp_messages_delete_selected' );
+
+ if ( ! $nonce_check || ! isset($_POST['thread_ids']) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> echo "-1<div id='message' class='error'><p>" . __( 'There was a problem deleting messages.', 'buddypress' ) . '</p></div>';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span></span></pre></div>
<a id="branches20bptemplatesbplegacyjsbuddypressjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/2.0/bp-templates/bp-legacy/js/buddypress.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/2.0/bp-templates/bp-legacy/js/buddypress.js 2017-03-08 17:45:30 UTC (rev 11457)
+++ branches/2.0/bp-templates/bp-legacy/js/buddypress.js 2017-03-08 17:52:31 UTC (rev 11458)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -260,13 +260,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> var type = target.hasClass('fav') ? 'fav' : 'unfav';
</span><span class="cx" style="display: block; padding: 0 10px"> var parent = target.closest('.activity-item');
</span><span class="cx" style="display: block; padding: 0 10px"> var parent_id = parent.attr('id').substr( 9, parent.attr('id').length );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var nonce = bp_get_query_var( '_wpnonce', target.attr( 'href' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> target.addClass('loading');
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> jq.post( ajaxurl, {
</span><span class="cx" style="display: block; padding: 0 10px"> action: 'activity_mark_' + type,
</span><span class="cx" style="display: block; padding: 0 10px"> 'cookie': bp_get_cookies(),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'id': parent_id
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'id': parent_id,
+ nonce: nonce
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> function(response) {
</span><span class="cx" style="display: block; padding: 0 10px"> target.removeClass('loading');
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1330,6 +1332,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> var inboxCount = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> var unreadCountDisplay = 'inline';
</span><span class="cx" style="display: block; padding: 0 10px"> var action = 'messages_markunread';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var nonce = jq( '#mark-messages-unread-nonce' ).val();
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> var currentClass = 'unread'
</span><span class="cx" style="display: block; padding: 0 10px"> var newClass = 'read'
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1337,6 +1340,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> var inboxCount = 1;
</span><span class="cx" style="display: block; padding: 0 10px"> var unreadCountDisplay = 'none';
</span><span class="cx" style="display: block; padding: 0 10px"> var action = 'messages_markread';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var nonce = jq( '#mark-messages-read-nonce' ).val();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> checkboxes.each( function(i) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1362,7 +1366,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> jq.post( ajaxurl, {
</span><span class="cx" style="display: block; padding: 0 10px"> action: action,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'thread_ids': checkboxes_tosend
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'thread_ids': checkboxes_tosend,
+ nonce: nonce
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1418,7 +1423,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> jq.post( ajaxurl, {
</span><span class="cx" style="display: block; padding: 0 10px"> action: 'messages_delete',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'thread_ids': checkboxes_tosend
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'thread_ids': checkboxes_tosend,
+ nonce: jq( '#delete-selected-nonce' ).val()
</ins><span class="cx" style="display: block; padding: 0 10px"> }, function(response) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( response[0] + response[1] == "-1" ) {
</span><span class="cx" style="display: block; padding: 0 10px"> jq('#message-threads').prepend( response.substr( 2, response.length ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1449,7 +1455,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> jq.post( ajaxurl, {
</span><span class="cx" style="display: block; padding: 0 10px"> action: 'messages_close_notice',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'notice_id': jq('.notice').attr('rel').substr( 2, jq('.notice').attr('rel').length )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'notice_id': jq('.notice').attr('rel').substr( 2, jq('.notice').attr('rel').length ),
+ nonce: jq( '#close-notice-nonce' ).val()
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> function(response) {
</span><span class="cx" style="display: block; padding: 0 10px"> jq("#close-notice").removeClass('loading');
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1820,6 +1827,36 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return encodeURIComponent( jq.param(bpCookies) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Get a querystring parameter from a URL.
+ *
+ * @param {String} Query string parameter name.
+ * @param {String} URL to parse. Defaults to current URL.
+ */
+function bp_get_query_var( param, url ) {
+ var qs = {};
+
+ // Use current URL if no URL passed.
+ if ( typeof url === 'undefined' ) {
+ url = location.search.substr(1).split('&');
+ } else {
+ url = url.split('?')[1].split('&');
+ }
+
+ // Parse querystring into object props.
+ // http://stackoverflow.com/a/21152762
+ url.forEach(function(item) {
+ qs[item.split("=")[0]] = item.split("=")[1] && decodeURIComponent( item.split("=")[1] );
+ });
+
+ if ( qs.hasOwnProperty( param ) && qs[param] != null ) {
+ return qs[param];
+ } else {
+ return false;
+ }
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /* ScrollTo plugin - just inline and minified */
</span><span class="cx" style="display: block; padding: 0 10px"> ;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body')
;switch(typeof targ){case'number':case'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})
}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre>
</div>
</div>
</body>
</html>