$oldpw = $this->GetPreference('masterpass'); if ($oldpw) { $oldpw = StripeGate\Utils::unfusc($oldpw); } $newpw = trim($params['masterpass']); if ($oldpw != $newpw) { //update all data which uses current password $pre = cms_db_prefix(); $sql = 'SELECT account_id,privtoken,testprivtoken FROM ' . $pre . 'module_sgt_account'; $rst = $db->Execute($sql); if ($rst) { $sql = 'UPDATE ' . $pre . 'module_sgt_account SET privtoken=?,testprivtoken=? WHERE account_id=?'; while (!$rst->EOF) { $t = StripeGate\Utils::decrypt_value($mod, $rst->fields[1], $oldpw); $t = $newpw ? StripeGate\Utils::encrypt_value($mod, $t, $newpw) : StripeGate\Utils::fusc($t); $t2 = StripeGate\Utils::decrypt_value($mod, $rst->fields[2], $oldpw); $t2 = $newpw ? StripeGate\Utils::encrypt_value($mod, $t2, $newpw) : StripeGate\Utils::fusc($t2); $db->Execute($sql, array($t, $t2, $rst->fields[0])); if (!$rst->MoveNext()) { break; } } $rst->Close(); } //TODO if record-table data is encrypted if ($newpw) { $newpw = StripeGate\Utils::fusc($newpw); } $this->SetPreference('masterpass', $newpw); } }
} /* U.S. businesses can accept Visa, MasterCard, American Express, JCB, Discover, Diners Club. Australian, Canadian, European, and Japanese businesses can accept Visa, MasterCard, American Express. */ if ($row['usetest']) { if ($row['testprivtoken']) { $privkey = StripeGate\Utils::decrypt_value($this, $row['testprivtoken']); } else { $privkey = FALSE; } } else { if ($row['privtoken']) { $privkey = StripeGate\Utils::decrypt_value($this, $row['privtoken']); } else { $privkey = FALSE; } } if (!$privkey) { echo $this->Lang('err_parameter'); return; } $account = Stripe\Account::retrieve($privkey); if ($account) { $data = $account->__toArray(); switch ($data['country']) { case 'AU': case 'CA': case 'JP':
$oneset->input = $this->CreateInputText($id, 'pubtoken', $row['pubtoken'], 32, 48); // $oneset->help = $this->Lang(''); $settings[] = $oneset; $oneset = new stdClass(); $oneset->title = $this->Lang('title_privtoken'); $oneset->input = $this->CreateInputText($id, 'privtoken', StripeGate\Utils::decrypt_value($this, $row['privtoken']), 32, 48); // $oneset->help = $this->Lang(''); $settings[] = $oneset; $oneset = new stdClass(); $oneset->title = $this->Lang('title_testpubtoken'); $oneset->input = $this->CreateInputText($id, 'testpubtoken', $row['testpubtoken'], 32, 48); // $oneset->help = $this->Lang(''); $settings[] = $oneset; $oneset = new stdClass(); $oneset->title = $this->Lang('title_testprivtoken'); $oneset->input = $this->CreateInputText($id, 'testprivtoken', StripeGate\Utils::decrypt_value($this, $row['testprivtoken']), 32, 48); //$oneset->help = $this->Lang(''); $settings[] = $oneset; $oneset = new stdClass(); $oneset->title = $this->Lang('title_usetest'); $oneset->input = $this->CreateInputCheckbox($id, 'usetest', 1, $row['usetest']); // $oneset->help = $this->Lang(''); $settings[] = $oneset; $none = '<' . $this->Lang('none') . '>'; $choices = array($none => 0); //CMSMS function check_permission() is buggy, always returns false for //everyone other than the current user, so we replicate its backend operation here $pref = cms_db_prefix(); $sql = <<<EOS SELECT DISTINCT U.user_id,U.username,U.first_name,U.last_name FROM {$pref}users U JOIN {$pref}user_groups UG ON U.user_id = UG.user_id