<!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][11457] branches/2.1: 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/11457">11457</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/11457","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:45:30 +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.1 branch.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches21srcbpmessagesbpmessagestemplatephp">branches/2.1/src/bp-messages/bp-messages-template.php</a></li>
<li><a href="#branches21srcbptemplatesbplegacybuddypressfunctionsphp">branches/2.1/src/bp-templates/bp-legacy/buddypress-functions.php</a></li>
<li><a href="#branches21srcbptemplatesbplegacyjsbuddypressjs">branches/2.1/src/bp-templates/bp-legacy/js/buddypress.js</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#branches21">branches/2.1/</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: branches/2.1
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- branches/2.1 2017-03-08 17:04:13 UTC (rev 11456)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/2.1 2017-03-08 17:45:30 UTC (rev 11457)
</ins><a id="branches21"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: branches/2.1</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/1.5:5187,5203,5210-5216,5220,5225,5247,5635
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/trunk:11449
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="branches21srcbpmessagesbpmessagestemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/2.1/src/bp-messages/bp-messages-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/2.1/src/bp-messages/bp-messages-template.php 2017-03-08 17:04:13 UTC (rev 11456)
+++ branches/2.1/src/bp-messages/bp-messages-template.php 2017-03-08 17:45:30 UTC (rev 11457)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -870,10 +870,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <a href="#" id="mark_as_read"><?php _ex('Mark as Read', 'Message management markup', 'buddypress') ?></a>
</span><span class="cx" style="display: block; padding: 0 10px"> <a href="#" id="mark_as_unread"><?php _ex('Mark as Unread', 'Message management markup', '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">@@ -1093,6 +1096,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="branches21srcbptemplatesbplegacybuddypressfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/2.1/src/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.1/src/bp-templates/bp-legacy/buddypress-functions.php 2017-03-08 17:04:13 UTC (rev 11456)
+++ branches/2.1/src/bp-templates/bp-legacy/buddypress-functions.php 2017-03-08 17:45:30 UTC (rev 11457)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -671,7 +671,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">@@ -938,6 +942,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">@@ -957,6 +965,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">@@ -1248,7 +1260,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">@@ -1329,7 +1343,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">@@ -1354,7 +1370,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">@@ -1379,7 +1397,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="branches21srcbptemplatesbplegacyjsbuddypressjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/2.1/src/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.1/src/bp-templates/bp-legacy/js/buddypress.js 2017-03-08 17:04:13 UTC (rev 11456)
+++ branches/2.1/src/bp-templates/bp-legacy/js/buddypress.js 2017-03-08 17:45:30 UTC (rev 11457)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -278,13 +278,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> type = target.hasClass('fav') ? 'fav' : 'unfav';
</span><span class="cx" style="display: block; padding: 0 10px"> parent = target.closest('.activity-item');
</span><span class="cx" style="display: block; padding: 0 10px"> 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">+ 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">@@ -1403,7 +1405,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> var checkboxes_tosend = '',
</span><span class="cx" style="display: block; padding: 0 10px"> checkboxes = jq('#message-threads tr td input[type="checkbox"]'),
</span><span class="cx" style="display: block; padding: 0 10px"> currentClass, newClass, unreadCount, inboxCount, unreadCountDisplay, action,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- inboxcount, thread_count;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ inboxcount, thread_count, nonce;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'mark_as_unread' === jq(this).attr('id') ) {
</span><span class="cx" style="display: block; padding: 0 10px"> currentClass = 'read';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1412,6 +1414,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> inboxCount = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> unreadCountDisplay = 'inline';
</span><span class="cx" style="display: block; padding: 0 10px"> action = 'messages_markunread';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 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"> currentClass = 'unread';
</span><span class="cx" style="display: block; padding: 0 10px"> newClass = 'read';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1419,6 +1422,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> inboxCount = 1;
</span><span class="cx" style="display: block; padding: 0 10px"> unreadCountDisplay = 'none';
</span><span class="cx" style="display: block; padding: 0 10px"> action = 'messages_markread';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 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">@@ -1444,7 +1448,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">@@ -1501,7 +1506,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">@@ -1532,7 +1538,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">@@ -1921,3 +1928,32 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // returns BP cookies as querystring
</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><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></pre>
</div>
</div>
</body>
</html>