You are here

protected function UbercartEncryption::applyFudgeFactor in Ubercart 7.3

Returns an adjustment value based on the contents of $fudgefactor.

2 calls to UbercartEncryption::applyFudgeFactor()
UbercartEncryption::decrypt in uc_store/classes/encrypt.inc
Decrypts cyphertext.
UbercartEncryption::encrypt in uc_store/classes/encrypt.inc
Encrypts plaintext.

File

uc_store/classes/encrypt.inc, line 188
Utility class definition.

Class

UbercartEncryption
Handles encryption of credit-card information.

Code

protected function applyFudgeFactor(&$fudgefactor) {
  static $alerted = FALSE;
  if (!is_array($fudgefactor)) {
    $fudge = 0;
    if (!$alerted) {

      // Throw an error that makes sense so this stops getting reported.
      $this->errors[] = t('No encryption key was found.');
      drupal_set_message(t('Ubercart cannot find a necessary encryption key. Refer to the store admin <a href="@url">dashboard</a> to isolate which one.', array(
        '@url' => url('admin/store'),
      )), 'error');
      $alerted = TRUE;
    }
  }
  else {
    $fudge = array_shift($fudgefactor);
  }
  $fudge = $fudge + $this->adj;
  $fudgefactor[] = $fudge;
  if (!empty($this->mod)) {
    if ($fudge % $this->mod == 0) {
      $fudge = $fudge * -1;
    }
  }
  return $fudge;
}