3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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-2013
36 define('CRM_ENCRYPT', 1);
37 define('CRM_SETNULL', 2);
38 function encryptDB() {
40 'civicrm_contact' => array(
41 'first_name' => CRM_ENCRYPT
,
42 'last_name' => CRM_ENCRYPT
,
43 'organization_name' => CRM_ENCRYPT
,
44 'household_name' => CRM_ENCRYPT
,
45 'sort_name' => CRM_ENCRYPT
,
46 'display_name' => CRM_ENCRYPT
,
47 'legal_name' => CRM_ENCRYPT
,
49 'civicrm_address' => array(
50 'street_address' => CRM_ENCRYPT
,
51 'supplemental_address_1' => CRM_ENCRYPT
,
52 'supplemental_address_2' => CRM_ENCRYPT
,
53 'city' => CRM_ENCRYPT
,
54 'postal_code' => CRM_SETNULL
,
55 'postal_code_suffix' => CRM_SETNULL
,
56 'geo_code_1' => CRM_SETNULL
,
57 'geo_code_2' => CRM_SETNULL
,
59 'civicrm_website' => array(
62 'civicrm_email' => array(
63 'email' => CRM_ENCRYPT
,
65 'civicrm_phone' => array(
66 'phone' => CRM_ENCRYPT
,
70 foreach ($tables as $tableName => $fields) {
72 foreach ($fields as $fieldName => $action) {
73 if ($action == CRM_ENCRYPT
) {
74 $clauses[] = "$fieldName = md5($fieldName)";
76 elseif ($action == CRM_SETNULL
) {
77 $clauses[] = "$fieldName = null";
81 if (!empty($clauses)) {
82 $clause = implode(',', $clauses);
83 $query = "UPDATE $tableName SET $clause";
84 CRM_Core_DAO
::executeQuery($query);
92 require_once '../civicrm.config.php';
93 require_once 'CRM/Core/Config.php';
94 $config = CRM_Core_Config
::singleton();
96 // this does not return on failure
97 CRM_Utils_System
::authenticateScript(TRUE);