function uc_credit_encrypt_existing in Ubercart 5
1 string reference to 'uc_credit_encrypt_existing'
- uc_credit_menu in payment/uc_credit/uc_credit.module
- Implementation of hook_menu().
File
- payment/uc_credit/uc_credit.module, line 1556
- Defines the credit card payment method and hooks in payment gateways.
Code
function uc_credit_encrypt_existing() {
if (($key = uc_credit_encryption_key()) === FALSE) {
return t('You must first setup your credit card encryption key filepath.');
}
if (variable_get('uc_credit_existing_cc_encrypted', FALSE)) {
return t('This action may not be repeated.');
}
if (arg(5) !== 'process') {
return t('Existing credit card numbers should be encrypted for future usage. The encryption process may take a few moments if you have a lot of data that needs to be encrypted. Click <a href="!url">this link</a> to update them now.', array(
'!url' => url('admin/store/settings/payment/cc_encrypt/process'),
));
}
$crypt = new uc_encryption_class();
$result = db_query("SELECT * FROM {uc_payment_credit} WHERE cc_number REGEXP ('[0-9]')");
while ($row = db_fetch_array($result)) {
_save_cc_data_to_order($row, $row['order_id']);
db_query("DELETE FROM {uc_payment_credit} WHERE credit_id = %d", $row['credit_id']);
}
uc_store_encryption_errors($crypt, 'uc_credit');
variable_set('uc_credit_existing_cc_encrypted', TRUE);
drupal_set_message(t('Your existing credit card data has been encrypted.'));
drupal_goto('admin/store/settings/payment/cc_encrypt');
}