function uc_credit_settings_form_submit in Ubercart 5
Same name and namespace in other branches
- 6.2 payment/uc_credit/uc_credit.module \uc_credit_settings_form_submit()
- 7.3 payment/uc_credit/uc_credit.admin.inc \uc_credit_settings_form_submit()
File
- payment/
uc_credit/ uc_credit.module, line 900 - Defines the credit card payment method and hooks in payment gateways.
Code
function uc_credit_settings_form_submit($form_id, $form_values) {
if ($_SESSION['update_cc_encrypt_dir'] === TRUE) {
$dir = rtrim($form_values['uc_credit_encryption_path'], '/\\');
if (!empty($dir) && $dir !== t('Not configured, see below.')) {
if (!file_exists($dir . '/uc_credit.key')) {
if (!($file = fopen($dir . '/uc_credit.key', 'wb'))) {
$message = t('Credit card encryption key file creation failed. Check your filepath settings and directory permissions.');
drupal_set_message($message, 'error');
watchdog('uc_credit', $message, WATCHDOG_ERROR);
}
else {
// Replacement key generation suggested by Barry Jaspan for increased security.
fwrite($file, md5(drupal_get_token(serialize($_REQUEST) . serialize($_SERVER) . time())));
fclose($file);
$message = t('Credit card encryption key file generated. Card data will now be encrypted.');
drupal_set_message($message);
drupal_set_message(t('If you are updating from a previous version and have any pre-existing credit card data, you should <a href="!url">click here</a> to encrypt it before receiving any more credit card orders or the data may be lost.', array(
'!url' => url('admin/store/settings/payment/cc_encrypt'),
)));
watchdog('uc_credit', t('Credit card encryption key file generated.'));
}
}
}
}
if (!$form_values['uc_credit_checkout_process'] && !$form_values['uc_credit_debug']) {
drupal_set_message(t('You have chosen to not process credit card payments during checkout, but customer credit card data is not being stored once checkout is completed. This configuration is not recommended for a live site, as you will not be able to collect payment for your orders.'), 'error');
}
}