3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2015
34 define('CRM_ENCRYPT', 1);
35 define('CRM_SETNULL', 2);
36 function encryptDB() {
38 'civicrm_contact' => array(
39 'first_name' => CRM_ENCRYPT
,
40 'last_name' => CRM_ENCRYPT
,
41 'organization_name' => CRM_ENCRYPT
,
42 'household_name' => CRM_ENCRYPT
,
43 'sort_name' => CRM_ENCRYPT
,
44 'display_name' => CRM_ENCRYPT
,
45 'legal_name' => CRM_ENCRYPT
,
47 'civicrm_address' => array(
48 'street_address' => CRM_ENCRYPT
,
49 'supplemental_address_1' => CRM_ENCRYPT
,
50 'supplemental_address_2' => CRM_ENCRYPT
,
51 'city' => CRM_ENCRYPT
,
52 'postal_code' => CRM_SETNULL
,
53 'postal_code_suffix' => CRM_SETNULL
,
54 'geo_code_1' => CRM_SETNULL
,
55 'geo_code_2' => CRM_SETNULL
,
57 'civicrm_website' => array(
60 'civicrm_email' => array(
61 'email' => CRM_ENCRYPT
,
63 'civicrm_phone' => array(
64 'phone' => CRM_ENCRYPT
,
68 foreach ($tables as $tableName => $fields) {
70 foreach ($fields as $fieldName => $action) {
71 if ($action == CRM_ENCRYPT
) {
72 $clauses[] = "$fieldName = md5($fieldName)";
74 elseif ($action == CRM_SETNULL
) {
75 $clauses[] = "$fieldName = null";
79 if (!empty($clauses)) {
80 $clause = implode(',', $clauses);
81 $query = "UPDATE $tableName SET $clause";
82 CRM_Core_DAO
::executeQuery($query);
90 require_once '../civicrm.config.php';
91 require_once 'CRM/Core/Config.php';
92 $config = CRM_Core_Config
::singleton();
94 // this does not return on failure
95 CRM_Utils_System
::authenticateScript(TRUE);