// should not be sending this the values..
function initSetting($a)
{
- $dir = $this->getKeyDirectory();
-
if(empty($a)) {
return;
}
if(!$pub_key) {
return;
}
- openssl_public_encrypt($v, $cipher, $pub_key);
- return $cipher;
+ openssl_public_encrypt($v, $ciphertext, $pub_key);
+ return $ciphertext;
+ }
+
+ function decrypt($v)
+ {
+ $key_dir = "{$this->getKeyDirectory()}/pri.key";
+
+ if(!file_exists($key_dir)) {
+ print_r("Cannot find {$key_dir}");
+ exit;
+ }
+
+ $pri_key = file_get_contents($key_dir);
+ if(!$pri_key) {
+ return;
+ }
+
+ openssl_private_decrypt($v, $plaintext, $pri_key);
+ return $plaintext;
}
function checkWritable($cls_name,$func_name,$dir)
$this->updateOrCreateEmail($part, $opts, false);
}
- function updateOrCreateEmail($part='', $opts, $cm = false){
+ function updateOrCreateEmail($part='', $opts, $cm = false, $mapping = false){
// DB_DataObject::debugLevel(1);
$mailtext = str_replace('{outputBody():h}', $body, $mailtext);
}
+ if($mapping) {
+ foreach ($mapping as $k => $v) {
+ $mailtext = str_replace($k, $v, $mailtext);
+ }
+ }
+
require_once 'Mail/mimeDecode.php';
require_once 'Mail/RFC822.php';
}
- function initEmails($templateDir, $emails)
+ function initEmails($templateDir, $emails, $mapping = false)
{
HTML_FlexyFramework::get()->generateDataobjectsCache(true);
require_once 'Pman/Core/Import/Core_email.php';
$x = new Pman_Core_Import_Core_email();
- $x->updateOrCreateEmail('', $opts, $cm);
+ $x->updateOrCreateEmail('', $opts, $cm, $mapping);
echo "email: {$name} - CREATED\n";
}