You are here

function uc_encryption_class::_applyFudgeFactor in Ubercart 5

2 calls to uc_encryption_class::_applyFudgeFactor()
uc_encryption_class::decrypt in uc_store/uc_store.module
uc_encryption_class::encrypt in uc_store/uc_store.module

File

uc_store/uc_store.module, line 2774
Contains global Ubercart functions and store administration functionality.

Class

uc_encryption_class
Trimmed down version of GPL class by Tony Marston. Details available at http://www.tonymarston.co.uk/php-mysql/encryption.html

Code

function _applyFudgeFactor(&$fudgefactor) {
  static $alerted = FALSE;
  if (!is_array($fudgefactor)) {
    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;
}