From bc65e083c84a8d133ff6b6526f515459491e0a69 Mon Sep 17 00:00:00 2001
From: Kevin Cristiano <kcristiano@tadpole.cc>
Date: Thu, 26 Jul 2018 07:44:25 -0400
Subject: [PATCH] civicrm 5.3.2 release

Signed-off-by: Kevin Cristiano <kcristiano@tadpole.cc>
---
 assets/templates/civicrm.shortcode.php        |   2 +-
 civicrm.php                                   |  11 +-
 civicrm/CRM/Contact/Form/Contact.php          |   4 +-
 civicrm/CRM/Event/Form/Registration.php       |   2 +-
 civicrm/CRM/Member/Form/Membership.php        |   2 +-
 .../Upgrade/Incremental/sql/5.3.2.mysql.tpl   |   1 +
 civicrm/api/v3/Contact.php                    |   2 +-
 .../bower_components/jquery-ui/.bower.json    |   2 +-
 civicrm/civicrm-version.php                   |   2 +-
 civicrm/release-notes/5.3.1.md                |   1 +
 civicrm/release-notes/5.3.2.md                |  42 +++++
 civicrm/sql/civicrm_data.mysql                |   2 +-
 civicrm/sql/civicrm_generated.mysql           |   2 +-
 .../templates/CRM/Contact/Form/Contact.tpl    | 144 +++++++++++++-----
 civicrm/templates/CRM/Contact/Form/Merge.tpl  |   6 +-
 civicrm/vendor/autoload.php                   |   2 +-
 civicrm/vendor/composer/autoload_real.php     |  14 +-
 civicrm/vendor/composer/autoload_static.php   |  10 +-
 civicrm/xml/version.xml                       |   2 +-
 includes/civicrm.basepage.php                 |   2 +-
 includes/civicrm.shortcodes.modal.php         |   2 +-
 includes/civicrm.shortcodes.php               |  12 +-
 includes/civicrm.users.php                    |   2 +-
 languages/civicrm.pot                         |   2 +-
 uninstall.php                                 |   2 +-
 wp-cli/civicrm.php                            |   2 +-
 26 files changed, 187 insertions(+), 90 deletions(-)
 create mode 100644 civicrm/CRM/Upgrade/Incremental/sql/5.3.2.mysql.tpl
 create mode 100644 civicrm/release-notes/5.3.2.md

diff --git a/assets/templates/civicrm.shortcode.php b/assets/templates/civicrm.shortcode.php
index 02f45e08df..c590390b01 100644
--- a/assets/templates/civicrm.shortcode.php
+++ b/assets/templates/civicrm.shortcode.php
@@ -2,7 +2,7 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
diff --git a/civicrm.php b/civicrm.php
index d16013a9eb..dcf3e8deaa 100644
--- a/civicrm.php
+++ b/civicrm.php
@@ -2,11 +2,10 @@
 /*
 Plugin Name: CiviCRM
 Description: CiviCRM - Growing and Sustaining Relationships
-Version: 5.3.1
+Version: 5.3.2
 Author: CiviCRM LLC
 Author URI: https://civicrm.org/
 Plugin URI: https://wiki.civicrm.org/confluence/display/CRMDOC/Installing+CiviCRM+for+WordPress
-GitLab Plugin URI: https://develop.tadpole.cc/plugins/civicrm
 License: AGPL3
 Text Domain: civicrm
 Domain Path: /languages
@@ -15,7 +14,7 @@ Domain Path: /languages
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
@@ -71,7 +70,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
 
 
 // set version here: when it changes, will force JS to reload
-define( 'CIVICRM_PLUGIN_VERSION', '5' );
+define( 'CIVICRM_PLUGIN_VERSION', '4.7' );
 
 // store reference to this file
 if (!defined('CIVICRM_PLUGIN_FILE')) {
@@ -309,9 +308,7 @@ class CiviCRM_For_WordPress {
     if ( $this->civicrm_in_wordpress() ) {
       // this is required for AJAX calls in WordPress admin
       $_GET['noheader'] = TRUE;
-    }
-
-    if ( !CIVICRM_INSTALLED && !$this->civicrm_in_wordpress() ) {
+    } else {
       $_GET['civicrm_install_type'] = 'wordpress';
     }
 
diff --git a/civicrm/CRM/Contact/Form/Contact.php b/civicrm/CRM/Contact/Form/Contact.php
index 7f1d039b1a..9239530190 100644
--- a/civicrm/CRM/Contact/Form/Contact.php
+++ b/civicrm/CRM/Contact/Form/Contact.php
@@ -714,7 +714,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
     }
 
     // Check for duplicate contact if it wasn't already handled by ajax or disabled
-    if (!Civi::settings()->get('contact_ajax_check_similar')) {
+    if (!Civi::settings()->get('contact_ajax_check_similar') || !empty($fields['_qf_Contact_refresh_dedupe'])) {
       self::checkDuplicateContacts($fields, $errors, $contactId, $contactType);
     }
 
@@ -760,7 +760,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
     $className::buildQuickForm($this);
 
     // Ajax duplicate checking
-    $checkSimilar = $this->_action == CRM_Core_Action::ADD && Civi::settings()->get('contact_ajax_check_similar');
+    $checkSimilar = Civi::settings()->get('contact_ajax_check_similar');
     $this->assign('checkSimilar', $checkSimilar);
     if ($checkSimilar == 1) {
       $ruleParams = array('used' => 'Supervised', 'contact_type' => $this->_contactType);
diff --git a/civicrm/CRM/Event/Form/Registration.php b/civicrm/CRM/Event/Form/Registration.php
index 7c10574c60..e284d2daf1 100644
--- a/civicrm/CRM/Event/Form/Registration.php
+++ b/civicrm/CRM/Event/Form/Registration.php
@@ -196,7 +196,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
    */
   public function preProcess() {
     $this->_eventId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
-    $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
+    $this->_action = CRM_Utils_Request::retrieve('action', 'Alphanumeric', $this, FALSE, CRM_Core_Action::ADD);
 
     //CRM-4320
     $this->_participantId = CRM_Utils_Request::retrieve('participantId', 'Positive', $this);
diff --git a/civicrm/CRM/Member/Form/Membership.php b/civicrm/CRM/Member/Form/Membership.php
index 32018d525d..b81bc5ec3b 100644
--- a/civicrm/CRM/Member/Form/Membership.php
+++ b/civicrm/CRM/Member/Form/Membership.php
@@ -947,7 +947,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
    * the selected override option is not 'until date'.
    */
   private function setOverrideDateValue() {
-    if (!CRM_Member_StatusOverrideTypes::isUntilDate($this->_params['is_override'])) {
+    if (!CRM_Member_StatusOverrideTypes::isUntilDate(CRM_Utils_Array::value('is_override', $this->_params))) {
       $this->_params['status_override_end_date'] = '';
     }
   }
diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.3.2.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.3.2.mysql.tpl
new file mode 100644
index 0000000000..3caad28f74
--- /dev/null
+++ b/civicrm/CRM/Upgrade/Incremental/sql/5.3.2.mysql.tpl
@@ -0,0 +1 @@
+{* file to handle db changes in 5.3.2 during upgrade *}
diff --git a/civicrm/api/v3/Contact.php b/civicrm/api/v3/Contact.php
index 5d3ecc7af1..d2785fc372 100644
--- a/civicrm/api/v3/Contact.php
+++ b/civicrm/api/v3/Contact.php
@@ -1360,7 +1360,7 @@ function civicrm_api3_contact_duplicatecheck($params) {
     $params['match'],
     $params['match']['contact_type'],
     $params['rule_type'],
-    array(),
+    CRM_Utils_Array::value('exclude', $params, []),
     CRM_Utils_Array::value('check_permissions', $params),
     CRM_Utils_Array::value('dedupe_rule_id', $params)
   );
diff --git a/civicrm/bower_components/jquery-ui/.bower.json b/civicrm/bower_components/jquery-ui/.bower.json
index 69ba102964..2373c86bc6 100644
--- a/civicrm/bower_components/jquery-ui/.bower.json
+++ b/civicrm/bower_components/jquery-ui/.bower.json
@@ -16,6 +16,6 @@
     "commit": "dec4c50123193d4f7c8ae6cd0bff45478e1ad276"
   },
   "_source": "https://github.com/components/jqueryui.git",
-  "_target": ">=1.9",
+  "_target": "~1.12",
   "_originalSource": "jquery-ui"
 }
\ No newline at end of file
diff --git a/civicrm/civicrm-version.php b/civicrm/civicrm-version.php
index 3945983d4f..8a36ebdbb1 100644
--- a/civicrm/civicrm-version.php
+++ b/civicrm/civicrm-version.php
@@ -1,7 +1,7 @@
 <?php
 /** @deprecated */
 function civicrmVersion( ) {
-  return array( 'version'  => '5.3.1',
+  return array( 'version'  => '5.3.2',
                 'cms'      => 'Wordpress',
                 'revision' => '' );
 }
diff --git a/civicrm/release-notes/5.3.1.md b/civicrm/release-notes/5.3.1.md
index 5c919b7ade..02a224bb0b 100644
--- a/civicrm/release-notes/5.3.1.md
+++ b/civicrm/release-notes/5.3.1.md
@@ -16,4 +16,5 @@ Released July 18, 2018
 - **[CIVI-SA-2018-04](https://civicrm.org/advisory/civi-sa-2018-04-sql-injection-in-custom-groups)** SQL injection in Custom Groups
 - **[CIVI-SA-2018-05](https://civicrm.org/advisory/civi-sa-2018-05-reflected-xss-in-contact-merge-screen)** Reflected XSS in Contact Merge Screen
 - **[CIVI-SA-2018-06](https://civicrm.org/advisory/civi-sa-2018-06-reflected-xss-in-context-parameter)** Reflected XSS in "New Membership" Form
+- **[CIVI-SA-2018-07](https://civicrm.org/advisory/civi-sa-2018-07-remote-code-execution-in-quickform)** Remote Code Execution in QuickForm
 
diff --git a/civicrm/release-notes/5.3.2.md b/civicrm/release-notes/5.3.2.md
new file mode 100644
index 0000000000..f29b9f4307
--- /dev/null
+++ b/civicrm/release-notes/5.3.2.md
@@ -0,0 +1,42 @@
+# CiviCRM 5.3.2
+
+Released July 25, 2018
+
+- **[Synopsis](#synopsis)**
+- **[Bugs resolved](#bugs)**
+- **[Credits](#credits)**
+- **[Feedback](#feedback)**
+
+## <a name="synopsis"></a>Synopsis
+
+| *Does this version...?*                                         |         |
+|:--------------------------------------------------------------- |:-------:|
+| Fix security vulnerabilities?                                   |   no    |
+| Change the database schema?                                     |   no    |
+| Alter the API?                                                  |   no    |
+| Require attention to configuration options?                     |   no    |
+| Fix problems installing or upgrading to a previous version?     |   no    |
+| Introduce features?                                             |   no    |
+| **Fix bugs?**                                                   | **yes** |
+
+## <a name="bugs"></a>Bugs resolved
+
+- **Fix regression from 5.3.1 on merge screen for WordPress/Joomla ([12566](https://github.com/civicrm/civicrm-core/pull/12566))**
+- **Fix regression from 5.3.0 on PCP pages with events ([12532](https://github.com/civicrm/civicrm-core/pull/12532))**
+- **Fix regression in "Check for Matching Contact" ([12550](https://github.com/civicrm/civicrm-core/pull/12550))**
+- **Fix minor regression from 5.0.0 which displays enotice for new memberships ([12564](https://github.com/civicrm/civicrm-core/pull/12564))**
+- **Update release notes for 5.3.1 ([12513](https://github.com/civicrm/civicrm-core/pull/12513))**
+
+## <a name="credits"></a>Credits
+
+This release was developed by the following authors and reviewers:
+
+Australian Greens - Seamus Lee; CiviCRM - Coleman Watts, Tim Otten; JMA
+Consulting - Monish Deb; Semper IT - Karin Gerritsen; Tadpole Collective -
+Kevin Cristiano; Wikimedia Foundation - Eileen McNaughton
+
+## <a name="feedback"></a>Feedback
+
+These release notes are edited by Tim Otten and Andrew Hunt.  If you'd like to
+provide feedback on them, please login to https://chat.civicrm.org/civicrm and
+contact `@agh1`.
diff --git a/civicrm/sql/civicrm_data.mysql b/civicrm/sql/civicrm_data.mysql
index 8bce839dc0..6a787382a2 100644
--- a/civicrm/sql/civicrm_data.mysql
+++ b/civicrm/sql/civicrm_data.mysql
@@ -23964,4 +23964,4 @@ INSERT INTO `civicrm_report_instance`
     ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`)
 VALUES
     (  @domainID, 'Survey Details', 'survey/detail', 'Detailed report for canvassing, phone-banking, walk lists or other surveys.', 'access CiviReport', 'a:39:{s:6:"fields";a:2:{s:9:"sort_name";s:1:"1";s:6:"result";s:1:"1";}s:22:"assignee_contact_id_op";s:2:"eq";s:25:"assignee_contact_id_value";s:0:"";s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:12:"survey_id_op";s:2:"in";s:15:"survey_id_value";a:0:{}s:12:"status_id_op";s:2:"eq";s:15:"status_id_value";s:1:"1";s:11:"custom_1_op";s:2:"in";s:14:"custom_1_value";a:0:{}s:11:"custom_2_op";s:2:"in";s:14:"custom_2_value";a:0:{}s:17:"custom_3_relative";s:1:"0";s:13:"custom_3_from";s:0:"";s:11:"custom_3_to";s:0:"";s:11:"description";s:75:"Detailed report for canvassing, phone-banking, walk lists or other surveys.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviReport";s:6:"groups";s:0:"";s:9:"domain_id";i:1;}');
-UPDATE civicrm_domain SET version = '5.3.1';
+UPDATE civicrm_domain SET version = '5.3.2';
diff --git a/civicrm/sql/civicrm_generated.mysql b/civicrm/sql/civicrm_generated.mysql
index b9a9f2239e..7cb8891e14 100644
--- a/civicrm/sql/civicrm_generated.mysql
+++ b/civicrm/sql/civicrm_generated.mysql
@@ -399,7 +399,7 @@ UNLOCK TABLES;
 
 LOCK TABLES `civicrm_domain` WRITE;
 /*!40000 ALTER TABLE `civicrm_domain` DISABLE KEYS */;
-INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'5.3.1',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
+INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'5.3.2',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
 /*!40000 ALTER TABLE `civicrm_domain` ENABLE KEYS */;
 UNLOCK TABLES;
 
diff --git a/civicrm/templates/CRM/Contact/Form/Contact.tpl b/civicrm/templates/CRM/Contact/Form/Contact.tpl
index 7c0302360c..fc67bd80e0 100644
--- a/civicrm/templates/CRM/Contact/Form/Contact.tpl
+++ b/civicrm/templates/CRM/Contact/Form/Contact.tpl
@@ -112,7 +112,8 @@
   <script type="text/javascript" >
   CRM.$(function($) {
     var $form = $("form.{/literal}{$form.formClass}{literal}"),
-      action = {/literal}{$action|@json_encode}{literal},
+      action = {/literal}{$action|intval}{literal},
+      cid = {/literal}{$contactId|intval}{literal},
       _ = CRM._;
 
     $('.crm-accordion-body').each( function() {
@@ -128,7 +129,7 @@
         $(this).parents('.collapsed').crmAccordionToggle();
       }
     });
-    if (action == '2') {
+    if (action === 2) {
       $('.crm-accordion-wrapper').not('.crm-accordion-wrapper .crm-accordion-wrapper').each(function() {
         highlightTabs(this);
       });
@@ -274,6 +275,7 @@
       ruleFields = {},
       $ruleElements = $(),
       matchMessage,
+      dupeTpl = _.template($('#duplicates-msg-tpl').html()),
       runningCheck = 0;
     $.each(rules, function(i, field) {
       // Match regular fields
@@ -289,62 +291,126 @@
         $ruleElements = $ruleElements.add($el);
       }
     });
-    $ruleElements.on('change', checkMatches);
-    function checkMatches() {
-      if ($(this).is('input[type=text]') && $(this).val().length < 3) {
-        return;
-      }
+    // Check for matches on input when action == ADD
+    if (action === 1) {
+      $ruleElements.on('change', function () {
+        if ($(this).is('input[type=text]') && $(this).val().length < 3) {
+          return;
+        }
+        checkMatches().done(function (data) {
+          var params = {
+            title: data.count == 1 ? {/literal}"{ts escape='js'}Similar Contact Found{/ts}" : "{ts escape='js'}Similar Contacts Found{/ts}"{literal},
+            info: "{/literal}{ts escape='js'}If the contact you were trying to add is listed below, click their name to view or edit their record{/ts}{literal}:",
+            contacts: data.values
+          };
+          if (data.count) {
+            openDupeAlert(params);
+          }
+        });
+      });
+    }
+
+    // Call the api to check for matching contacts
+    function checkMatches(rule) {
       var match = {contact_type: contactType},
-        checkNum = ++runningCheck;
+        response = $.Deferred(),
+        checkNum = ++runningCheck,
+        params = {
+          options: {sort: 'sort_name'},
+          return: ['display_name', 'email']
+        };
       $.each(ruleFields, function(fieldName, ruleField) {
         if (ruleField.length > 1) {
           match[fieldName] = ruleField.filter(':checked').val();
         } else if (ruleField.is('input[type=text]')) {
           if (ruleField.val().length > 2) {
-            match[fieldName] = ruleField.val() + '%'; // Todo: remove wildcard when switching to contact.match api
+            match[fieldName] = ruleField.val() + (rule ? '' : '%');
           }
         } else {
           match[fieldName] = ruleField.val();
         }
       });
-      // CRM-20565 - Need a good default matching rule before using the dedupe engine for this. Using contact.get for now.
-      // CRM.api3('contact', 'duplicatecheck', {
-      //   match: match,
-      //   rule_type: 'Supervised',
-      //   options: {sort: 'sort_name'},
-      //   return: ['display_name', 'email']
-      // }).done(function(data) {
-      CRM.api3('contact', 'get', _.extend({
-        options: {sort: 'sort_name'},
-        return: ['display_name', 'email']
-      }, match)).done(function(data) {
+      // CRM-20565 - Need a good default matching rule before using the dedupe engine for checking on-the-fly.
+      // Defaulting to contact.get.
+      var action = rule ? 'duplicatecheck' : 'get';
+      if (rule) {
+        params.rule_type = rule;
+        params.match = match;
+        params.exclude = cid ? [cid] : [];
+      } else {
+        _.extend(params, match);
+      }
+      CRM.api3('contact', action, params).done(function(data) {
         // If a new request has started running, cancel this one.
         if (checkNum < runningCheck) {
-          return;
-        }
-        // Close msg if it exists
-        matchMessage && matchMessage.close && matchMessage.close();
-        var title = data.count == 1 ? {/literal}"{ts escape='js'}Similar Contact Found{/ts}" : "{ts escape='js'}Similar Contacts Found{/ts}"{literal},
-          msg = "<em>{/literal}{ts escape='js'}If the contact you were trying to add is listed below, click their name to view or edit their record{/ts}{literal}:</em>";
-        if (data.is_error == 1 || data.count == 0) {
-          return;
+          response.reject();
+        } else {
+          response.resolve(data);
         }
-        msg += '<ul class="matching-contacts-actions">';
-        $.each(data.values, function(i, contact) {
-          contact.email = contact.email || '';
-          msg += '<li><a href="'+ CRM.url('civicrm/contact/view', {reset: 1, cid: contact.id}) + '">'+ contact.display_name +'</a> '+contact.email+'</li>';
-        });
-        msg += '</ul>';
-        matchMessage = CRM.alert(msg, title);
-        $('.matching-contacts-actions a').click(function() {
-          // No confirmation dialog on click
-          $('[data-warn-changes=true]').attr('data-warn-changes', 'false');
-        });
       });
+      return response;
+    }
+
+    // Open an alert about possible duplicate contacts
+    function openDupeAlert(data, iconType) {
+      // Close msg if it exists
+      matchMessage && matchMessage.close && matchMessage.close();
+      matchMessage = CRM.alert(dupeTpl(data), _.escape(data.title), iconType, {expires: false});
+      $('.matching-contacts-actions', '#crm-notification-container').on('click', 'a', function() {
+        // No confirmation dialog on click
+        $('[data-warn-changes=true]').attr('data-warn-changes', 'false');
+      });
+    }
+
+    // Update the duplicate alert after getting results
+    function updateDupeAlert(data, iconType) {
+      var $alert = $('.matching-contacts-actions', '#crm-notification-container')
+        .closest('.ui-notify-message');
+      $alert
+        .removeClass('crm-msg-loading success info alert error')
+        .addClass(iconType)
+        .find('h1').text(data.title);
+      $alert
+        .find('.notify-content')
+        .html(dupeTpl(data));
     }
+
+    // Ajaxify the "Check for Matching Contact(s)" button
+    $('#_qf_Contact_refresh_dedupe').click(function(e) {
+      var placeholder = {{/literal}
+        title: "{ts escape='js'}Fetching Matches{/ts}",
+        info: "{ts escape='js'}Checking for similar contacts...{/ts}",
+        contacts: []
+      {literal}};
+      openDupeAlert(placeholder, 'crm-msg-loading');
+      checkMatches('Supervised').done(function(data) {
+        var params = {
+          title: data.count ? {/literal}"{ts escape='js'}Similar Contact Found{/ts}" : "{ts escape='js'}None Found{/ts}"{literal},
+          info: data.count ?
+            "{/literal}{ts escape='js'}If the contact you were trying to add is listed below, click their name to view or edit their record{/ts}{literal}:" :
+            "{/literal}{ts escape='js'}No matches found using the default Supervised deduping rule.{/ts}{literal}",
+          contacts: data.values
+        };
+        updateDupeAlert(params, data.count ? 'alert' : 'success');
+      });
+      e.preventDefault();
+    });
     {/literal}{/if}{literal}
   });
+</script>
 
+<script type="text/template" id="duplicates-msg-tpl">
+  <em><%- info %></em>
+  <ul class="matching-contacts-actions">
+    <% _.forEach(contacts, function(contact) { %>
+      <li>
+        <a href="<%= CRM.url('civicrm/contact/view', {reset: 1, cid: contact.id}) %>">
+          <%- contact.display_name %>
+        </a>
+        <%- contact.email %>
+      </li>
+    <% }); %>
+  </ul>
 </script>
 {/literal}
 
diff --git a/civicrm/templates/CRM/Contact/Form/Merge.tpl b/civicrm/templates/CRM/Contact/Form/Merge.tpl
index a8ff9106db..9769c2d224 100644
--- a/civicrm/templates/CRM/Contact/Form/Merge.tpl
+++ b/civicrm/templates/CRM/Contact/Form/Merge.tpl
@@ -47,9 +47,9 @@
   </div>
 
   <div class="action-link">
-    {if $prev}<a href="{$prev|escape}" class="crm-hover-button action-item"><i class="crm-i fa-chevron-left"></i> {ts}Previous{/ts}</a>{/if}
-    {if $next}<a href="{$next|escape}" class="crm-hover-button action-item">{ts}Next{/ts} <i class="crm-i fa-chevron-right"></i></a>{/if}
-    <a href="{$flip|escape}" class="action-item crm-hover-button">
+    {if $prev}<a href="{$prev}" class="crm-hover-button action-item"><i class="crm-i fa-chevron-left"></i> {ts}Previous{/ts}</a>{/if}
+    {if $next}<a href="{$next}" class="crm-hover-button action-item">{ts}Next{/ts} <i class="crm-i fa-chevron-right"></i></a>{/if}
+    <a href="{$flip}" class="action-item crm-hover-button">
       <i class="crm-i fa-random"></i>
       {ts}Flip between original and duplicate contacts.{/ts}
     </a>
diff --git a/civicrm/vendor/autoload.php b/civicrm/vendor/autoload.php
index af73ee5e6c..c18f803af6 100644
--- a/civicrm/vendor/autoload.php
+++ b/civicrm/vendor/autoload.php
@@ -4,4 +4,4 @@
 
 require_once __DIR__ . '/composer/autoload_real.php';
 
-return ComposerAutoloaderInitbbfe77676f41b60311acdd87c7a0fed6::getLoader();
+return ComposerAutoloaderInit99d4995414f340fcb5325a17584ee78c::getLoader();
diff --git a/civicrm/vendor/composer/autoload_real.php b/civicrm/vendor/composer/autoload_real.php
index af0e3fd2d4..3d4fb21e76 100644
--- a/civicrm/vendor/composer/autoload_real.php
+++ b/civicrm/vendor/composer/autoload_real.php
@@ -2,7 +2,7 @@
 
 // autoload_real.php @generated by Composer
 
-class ComposerAutoloaderInitbbfe77676f41b60311acdd87c7a0fed6
+class ComposerAutoloaderInit99d4995414f340fcb5325a17584ee78c
 {
     private static $loader;
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitbbfe77676f41b60311acdd87c7a0fed6
             return self::$loader;
         }
 
-        spl_autoload_register(array('ComposerAutoloaderInitbbfe77676f41b60311acdd87c7a0fed6', 'loadClassLoader'), true, true);
+        spl_autoload_register(array('ComposerAutoloaderInit99d4995414f340fcb5325a17584ee78c', 'loadClassLoader'), true, true);
         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
-        spl_autoload_unregister(array('ComposerAutoloaderInitbbfe77676f41b60311acdd87c7a0fed6', 'loadClassLoader'));
+        spl_autoload_unregister(array('ComposerAutoloaderInit99d4995414f340fcb5325a17584ee78c', 'loadClassLoader'));
 
         $includePaths = require __DIR__ . '/include_paths.php';
         $includePaths[] = get_include_path();
@@ -31,7 +31,7 @@ class ComposerAutoloaderInitbbfe77676f41b60311acdd87c7a0fed6
         if ($useStaticLoader) {
             require_once __DIR__ . '/autoload_static.php';
 
-            call_user_func(\Composer\Autoload\ComposerStaticInitbbfe77676f41b60311acdd87c7a0fed6::getInitializer($loader));
+            call_user_func(\Composer\Autoload\ComposerStaticInit99d4995414f340fcb5325a17584ee78c::getInitializer($loader));
         } else {
             $map = require __DIR__ . '/autoload_namespaces.php';
             foreach ($map as $namespace => $path) {
@@ -52,19 +52,19 @@ class ComposerAutoloaderInitbbfe77676f41b60311acdd87c7a0fed6
         $loader->register(true);
 
         if ($useStaticLoader) {
-            $includeFiles = Composer\Autoload\ComposerStaticInitbbfe77676f41b60311acdd87c7a0fed6::$files;
+            $includeFiles = Composer\Autoload\ComposerStaticInit99d4995414f340fcb5325a17584ee78c::$files;
         } else {
             $includeFiles = require __DIR__ . '/autoload_files.php';
         }
         foreach ($includeFiles as $fileIdentifier => $file) {
-            composerRequirebbfe77676f41b60311acdd87c7a0fed6($fileIdentifier, $file);
+            composerRequire99d4995414f340fcb5325a17584ee78c($fileIdentifier, $file);
         }
 
         return $loader;
     }
 }
 
-function composerRequirebbfe77676f41b60311acdd87c7a0fed6($fileIdentifier, $file)
+function composerRequire99d4995414f340fcb5325a17584ee78c($fileIdentifier, $file)
 {
     if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
         require $file;
diff --git a/civicrm/vendor/composer/autoload_static.php b/civicrm/vendor/composer/autoload_static.php
index 9f33a8888f..2266cbf316 100644
--- a/civicrm/vendor/composer/autoload_static.php
+++ b/civicrm/vendor/composer/autoload_static.php
@@ -4,7 +4,7 @@
 
 namespace Composer\Autoload;
 
-class ComposerStaticInitbbfe77676f41b60311acdd87c7a0fed6
+class ComposerStaticInit99d4995414f340fcb5325a17584ee78c
 {
     public static $files = array (
         'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
@@ -371,10 +371,10 @@ class ComposerStaticInitbbfe77676f41b60311acdd87c7a0fed6
     public static function getInitializer(ClassLoader $loader)
     {
         return \Closure::bind(function () use ($loader) {
-            $loader->prefixLengthsPsr4 = ComposerStaticInitbbfe77676f41b60311acdd87c7a0fed6::$prefixLengthsPsr4;
-            $loader->prefixDirsPsr4 = ComposerStaticInitbbfe77676f41b60311acdd87c7a0fed6::$prefixDirsPsr4;
-            $loader->prefixesPsr0 = ComposerStaticInitbbfe77676f41b60311acdd87c7a0fed6::$prefixesPsr0;
-            $loader->classMap = ComposerStaticInitbbfe77676f41b60311acdd87c7a0fed6::$classMap;
+            $loader->prefixLengthsPsr4 = ComposerStaticInit99d4995414f340fcb5325a17584ee78c::$prefixLengthsPsr4;
+            $loader->prefixDirsPsr4 = ComposerStaticInit99d4995414f340fcb5325a17584ee78c::$prefixDirsPsr4;
+            $loader->prefixesPsr0 = ComposerStaticInit99d4995414f340fcb5325a17584ee78c::$prefixesPsr0;
+            $loader->classMap = ComposerStaticInit99d4995414f340fcb5325a17584ee78c::$classMap;
 
         }, null, ClassLoader::class);
     }
diff --git a/civicrm/xml/version.xml b/civicrm/xml/version.xml
index fddde26e67..1cd4403134 100644
--- a/civicrm/xml/version.xml
+++ b/civicrm/xml/version.xml
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="iso-8859-1" ?>
 <version>
-  <version_no>5.3.1</version_no>
+  <version_no>5.3.2</version_no>
 </version>
diff --git a/includes/civicrm.basepage.php b/includes/civicrm.basepage.php
index a9d0b525de..78762ba068 100644
--- a/includes/civicrm.basepage.php
+++ b/includes/civicrm.basepage.php
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
diff --git a/includes/civicrm.shortcodes.modal.php b/includes/civicrm.shortcodes.modal.php
index 6f249e1e30..d606a8a0b4 100644
--- a/includes/civicrm.shortcodes.modal.php
+++ b/includes/civicrm.shortcodes.modal.php
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
diff --git a/includes/civicrm.shortcodes.php b/includes/civicrm.shortcodes.php
index 26e1b163cb..cf3068d5ff 100644
--- a/includes/civicrm.shortcodes.php
+++ b/includes/civicrm.shortcodes.php
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
@@ -246,16 +246,6 @@ class CiviCRM_For_WordPress_Shortcodes {
    * @return string HTML for output
    */
   public function render_single( $atts ) {
-    // Do not parse shortcodes in REST context for PUT, POST and DELETE methods
-    if(defined('REST_REQUEST') && REST_REQUEST && (isset($_PUT) || isset($_POST) || isset($_DELETE)) ){
-        // Return the original shortcode
-        $shortcode = '[civicrm';
-        foreach($atts as $att=>$val){
-            $shortcode.=' '.$att.'="'.$val.'"';
-        }
-        $shortcode.=']';
-        return $shortcode;
-    }
 
     // check if we've already parsed this shortcode
     global $post;
diff --git a/includes/civicrm.users.php b/includes/civicrm.users.php
index 800b8888eb..6c387d7818 100644
--- a/includes/civicrm.users.php
+++ b/includes/civicrm.users.php
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
diff --git a/languages/civicrm.pot b/languages/civicrm.pot
index 4e28eef654..22349420e7 100644
--- a/languages/civicrm.pot
+++ b/languages/civicrm.pot
@@ -2,7 +2,7 @@
 # This file is distributed under the same license as the CiviCRM package.
 msgid ""
 msgstr ""
-"Project-Id-Version: CiviCRM 5\n"
+"Project-Id-Version: CiviCRM 4.6\n"
 "Report-Msgid-Bugs-To: http://wordpress.org/tag/civicrm\n"
 "POT-Creation-Date: 2014-11-11 09:48:56+00:00\n"
 "MIME-Version: 1.0\n"
diff --git a/uninstall.php b/uninstall.php
index c73696a982..7579c21f70 100644
--- a/uninstall.php
+++ b/uninstall.php
@@ -2,7 +2,7 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
diff --git a/wp-cli/civicrm.php b/wp-cli/civicrm.php
index 4a02543027..cce0dbd360 100644
--- a/wp-cli/civicrm.php
+++ b/wp-cli/civicrm.php
@@ -2,7 +2,7 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
-- 
GitLab