function webform_encrypt_uninstall in Webform Encrypt 6
Same name and namespace in other branches
- 8 webform_encrypt.install \webform_encrypt_uninstall()
- 7 webform_encrypt.install \webform_encrypt_uninstall()
Implementation of hook_uninstall().
File
- ./
webform_encrypt.install, line 21 - Contains install- and update-related functions for the Webform Encrypt module.
Code
function webform_encrypt_uninstall() {
variable_del('webform_encrypt_match_user');
// Decrypt all encrypted form values.
$components = array();
$query = db_query('SELECT nid, cid, extra FROM {webform_component}');
while ($row = db_fetch_object($query)) {
$components[$row->nid . ':' . $row->cid] = unserialize($row->extra);
}
$query = db_query('SELECT nid, sid, cid, no, data FROM {webform_submitted_data}');
while ($row = db_fetch_object($query)) {
$key = $row->nid . ':' . $row->cid;
if (!empty($components[$key]['encrypt']) && is_array(@unserialize($row->data))) {
$row->data = decrypt($row->data, array(
'base64' => TRUE,
));
drupal_write_record('webform_submitted_data', $row, array(
'nid',
'sid',
'cid',
'no',
));
}
}
}