{$MOD.TITLE_COMPOSE_MAIL}
{literal}
5.3.0/mail.php 0000777 0000000 0000000 00000000000 12167173727 016414 2../modules/Emails/mail.php ustar root root 5.3.0/Webmails.tpl 0000777 0000000 0000000 00000000000 12167173727 020471 2../Smarty/templates/Webmails.tpl ustar root root 5.3.0/ComposeEmail.tpl 0000777 0000000 0000000 00000000000 12167173727 022115 2../Smarty/templates/ComposeEmail.tpl ustar root root 5.3.0/mail.php.new 0000700 0000060 0000060 00000045625 12205112304 013145 0 ustar apache apache println("To id => '".$to_email."'\nSubject ==>'".$subject."'\nContents ==> '".$contents."'");
//Get the email id of assigned_to user -- pass the value and name, name must be "user_name" or "id"(field names of vtiger_users vtiger_table)
//$to_email = getUserEmailId('id',$assigned_user_id);
//if module is HelpDesk then from_email will come based on support email id
if($from_email == '') {
//if from email is not defined, then use the useremailid as the from address
$from_email = getUserEmailId('user_name',$from_name);
}
//if the newly defined from email field is set, then use this email address as the from address
//and use the username as the reply-to address
$query = "select * from vtiger_systems where server_type=?";
$params = array('email');
$result = $adb->pquery($query,$params);
$from_email_field = $adb->query_result($result,0,'from_email_field');
if(isUserInitiated()) {
$replyToEmail = $from_email;
} else {
$replyToEmail = $from_email_field;
}
if(isset($from_email_field) && $from_email_field!=''){
//setting from _email to the defined email address in the outgoing server configuration
$from_email = $from_email_field;
}
if($module != "Calendar")
$contents = addSignature($contents,$from_name);
$mail = new PHPMailer();
setMailerProperties($mail,$subject,$contents,$from_email,$from_name,trim($to_email,","),$attachment,$emailid,$module,$logo);
setCCAddress($mail,'cc',$cc);
setCCAddress($mail,'bcc',$bcc);
if(!empty($replyToEmail)) {
$mail->AddReplyTo($replyToEmail);
}
// vtmailscanner customization: If Support Reply to is defined use it.
global $HELPDESK_SUPPORT_EMAIL_REPLY_ID;
if($HELPDESK_SUPPORT_EMAIL_REPLY_ID && $HELPDESK_SUPPORT_EMAIL_ID != $HELPDESK_SUPPORT_EMAIL_REPLY_ID) {
$mail->AddReplyTo($HELPDESK_SUPPORT_EMAIL_REPLY_ID);
}
// END
// Fix: Return immediately if Outgoing server not configured
if(empty($mail->Host)) {
return 0;
}
// END
$mail_status = MailSend($mail);
if($mail_status != 1)
{
$mail_error = getMailError($mail,$mail_status,$mailto);
}
else
{
$mail_error = $mail_status;
}
return $mail_error;
}
/** Function to get the user Email id based on column name and column value
* $name -- column name of the vtiger_users vtiger_table
* $val -- column value
*/
function getUserEmailId($name,$val)
{
global $adb;
$adb->println("Inside the function getUserEmailId. --- ".$name." = '".$val."'");
if($val != '')
{
//done to resolve the PHP5 specific behaviour
$sql = "SELECT email1, email2, secondaryemail from vtiger_users WHERE status='Active' AND ". $adb->sql_escape_string($name)." = ?";
$res = $adb->pquery($sql, array($val));
$email = $adb->query_result($res,0,'email1');
if($email == '')
{
$email = $adb->query_result($res,0,'email2');
if($email == '')
{
$email = $adb->query_result($res,0,'secondaryemail ');
}
}
$adb->println("Email id is selected => '".$email."'");
return $email;
}
else
{
$adb->println("User id is empty. so return value is ''");
return '';
}
}
/** Funtion to add the user's signature with the content passed
* $contents -- where we want to add the signature
* $fromname -- which user's signature will be added to the contents
*/
function addSignature($contents, $fromname)
{
global $adb;
$adb->println("Inside the function addSignature");
$sign = nl2br($adb->query_result($adb->pquery("select signature from vtiger_users where user_name=?", array($fromname)),0,"signature"));
if($sign != '')
{
$contents .= '
'.$sign;
$adb->println("Signature is added with the body => '.".$sign."'");
}
else
{
$adb->println("Signature is empty for the user => '".$fromname."'");
}
return $contents;
}
/** Function to set all the Mailer properties
* $mail -- reference of the mail object
* $subject -- subject of the email you want to send
* $contents -- body of the email you want to send
* $from_email -- from email id which will be displayed in the mail
* $from_name -- from name which will be displayed in the mail
* $to_email -- to email address -- This can be an email in a single string, a comma separated
* list of emails or an array of email addresses
* $attachment -- whether we want to attach the currently selected file or all vtiger_files.
[values = current,all] - optional
* $emailid -- id of the email object which will be used to get the vtiger_attachments - optional
*/
function setMailerProperties($mail,$subject,$contents,$from_email,$from_name,$to_email,$attachment='',$emailid='',$module='',$logo='')
{
global $adb;
$adb->println("Inside the function setMailerProperties");
if($module == "Support" || $logo ==1)
$mail->AddEmbeddedImage('themes/images/logo_mail.jpg', 'logo', 'logo.jpg',"base64","image/jpg");
$mail->Subject = $subject;
$mail->Body = $contents;
//$mail->Body = html_entity_decode(nl2br($contents)); //if we get html tags in mail then we will use this line
$mail->AltBody = strip_tags(preg_replace(array("/
/i","/ /i","/ /i"),array("\n","\n","\n"),$contents));
$mail->IsSMTP(); //set mailer to use SMTP
//$mail->Host = "smtp1.example.com;smtp2.example.com"; // specify main and backup server
setMailServerProperties($mail);
//Handle the from name and email for HelpDesk
$mail->From = $from_email;
$rs = $adb->pquery("select first_name,last_name from vtiger_users where user_name=?", array($from_name));
if($adb->num_rows($rs) > 0)
$from_name = $adb->query_result($rs,0,"first_name")." ".$adb->query_result($rs,0,"last_name");
$mail->FromName = decode_html($from_name);
if($to_email != '')
{
if(is_array($to_email)) {
for($j=0,$num=count($to_email);$j<$num;$j++) {
$mail->addAddress($to_email[$j]);
}
} else {
$_tmp = explode(",",$to_email);
for($j=0,$num=count($_tmp);$j<$num;$j++) {
$mail->addAddress($_tmp[$j]);
}
}
}
//commented so that it does not add from_email in reply to
//$mail->AddReplyTo($from_email);
$mail->WordWrap = 50;
//If we want to add the currently selected file only then we will use the following function
if($attachment == 'current' && $emailid != '')
{
if (isset($_REQUEST['filename_hidden'])) {
$file_name = $_REQUEST['filename_hidden'];
} else {
$file_name = $_FILES['filename']['name'];
}
addAttachment($mail,$file_name,$emailid);
}
//This will add all the vtiger_files which are related to this record or email
if($attachment == 'all' && $emailid != '')
{
addAllAttachments($mail,$emailid);
}
$mail->IsHTML(true); // set email format to HTML
return;
}
/** Function to set the Mail Server Properties in the object passed
* $mail -- reference of the mailobject
*/
function setMailServerProperties($mail)
{
global $adb;
$adb->println("Inside the function setMailServerProperties");
$res = $adb->pquery("select * from vtiger_systems where server_type=?", array('email'));
if(isset($_REQUEST['server']))
$server = $_REQUEST['server'];
else
$server = $adb->query_result($res,0,'server');
if(isset($_REQUEST['server_username']))
$username = $_REQUEST['server_username'];
else
$username = $adb->query_result($res,0,'server_username');
if(isset($_REQUEST['server_password']))
$password = $_REQUEST['server_password'];
else
$password = $adb->query_result($res,0,'server_password');
// Prasad: First time read smtp_auth from the request
if(isset($_REQUEST['smtp_auth']))
{
$smtp_auth = $_REQUEST['smtp_auth'];
if($smtp_auth == 'on')
$smtp_auth = 'true';
}
else if (isset($_REQUEST['module']) && $_REQUEST['module'] == 'Settings' && (!isset($_REQUEST['smtp_auth'])))
{
//added to avoid issue while editing the values in the outgoing mail server.
$smtp_auth = 'false';
}
else
$smtp_auth = $adb->query_result($res,0,'smtp_auth');
$adb->println("Mail server name,username & password => '".$server."','".$username."','".$password."'");
if($smtp_auth == "true"){
$mail->SMTPAuth = true; // turn on SMTP authentication
}
$mail->Host = $server; // specify main and backup server
$mail->Username = $username ; // SMTP username
$mail->Password = $password ; // SMTP password
return;
}
/** Function to add the file as attachment with the mail object
* $mail -- reference of the mail object
* $filename -- filename which is going to added with the mail
* $record -- id of the record - optional
*/
function addAttachment($mail,$filename,$record)
{
global $adb, $root_directory;
$adb->println("Inside the function addAttachment");
$adb->println("The file name is => '".$filename."'");
//This is the file which has been selected in Email EditView
if(is_file($filename) && $filename != '')
{
$mail->AddAttachment($root_directory."test/upload/".$filename);
}
}
/** Function to add all the vtiger_files as attachment with the mail object
* $mail -- reference of the mail object
* $record -- email id ie., record id which is used to get the all vtiger_attachments from database
*/
function addAllAttachments($mail,$record)
{
global $adb,$log, $root_directory;
$adb->println("Inside the function addAllAttachments");
//Retrieve the vtiger_files from database where avoid the file which has been currently selected
$sql = "select vtiger_attachments.* from vtiger_attachments inner join vtiger_seattachmentsrel on vtiger_attachments.attachmentsid = vtiger_seattachmentsrel.attachmentsid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_attachments.attachmentsid where vtiger_crmentity.deleted=0 and vtiger_seattachmentsrel.crmid=?";
$res = $adb->pquery($sql, array($record));
$count = $adb->num_rows($res);
for($i=0;$i<$count;$i++)
{
$fileid = $adb->query_result($res,$i,'attachmentsid');
$filename = decode_html($adb->query_result($res,$i,'name'));
$filepath = $adb->query_result($res,$i,'path');
$filewithpath = $root_directory.$filepath.$fileid."_".$filename;
//if the file is exist in test/upload directory then we will add directly
//else get the contents of the file and write it as a file and then attach (this will occur when we unlink the file)
if(is_file($filewithpath))
{
$mail->AddAttachment($filewithpath,$filename);
}
}
}
/** Function to set the CC or BCC addresses in the mail
* $mail -- reference of the mail object
* $cc_mod -- mode to set the address ie., cc or bcc
* $cc_val -- addresss with comma seperated to set as CC or BCC in the mail
*/
function setCCAddress($mail,$cc_mod,$cc_val)
{
global $adb;
$adb->println("Inside the functin setCCAddress");
if($cc_mod == 'cc')
$method = 'AddCC';
if($cc_mod == 'bcc')
$method = 'AddBCC';
if($cc_val != '')
{
$ccmail = explode(",",trim($cc_val,","));
for($i=0;$i");
}
if($ccmail[$i] != '')
$mail->$method($addr,$cc_name);
}
}
}
/** Function to send the mail which will be called after set all the mail object values
* $mail -- reference of the mail object
*/
function MailSend($mail)
{
global $log;
$log->info("Inside of Send Mail function.");
if(!$mail->Send())
{
$log->debug("Error in Mail Sending : Error log = '".$mail->ErrorInfo."'");
return $mail->ErrorInfo;
}
else
{
$log->info("Mail has been sent from the vtigerCRM system : Status : '".$mail->ErrorInfo."'");
return 1;
}
}
/** Function to get the Parent email id from HelpDesk to send the details about the ticket via email
* $returnmodule -- Parent module value. Contact or Account for send email about the ticket details
* $parentid -- id of the parent ie., contact or vtiger_account
*/
function getParentMailId($parentmodule,$parentid)
{
global $adb;
$adb->println("Inside the function getParentMailId. \n parent module and id => ".$parentmodule."&".$parentid);
if($parentmodule == 'Contacts')
{
$tablename = 'vtiger_contactdetails';
$idname = 'contactid';
$first_email = 'email';
$second_email = 'secondaryemail';
}
if($parentmodule == 'Accounts')
{
$tablename = 'vtiger_account';
$idname = 'accountid';
$first_email = 'email1';
$second_email = 'email2';
}
if($parentid != '')
{
//$query = 'select * from '.$tablename.' where '.$idname.' = '.$parentid;
$query = 'select * from '.$tablename.' where '. $idname.' = ?';
$res = $adb->pquery($query, array($parentid));
$mailid = $adb->query_result($res,0,$first_email);
$mailid2 = $adb->query_result($res,0,$second_email);
}
if($mailid == '' && $mailid2 != '')
$mailid = $mailid2;
return $mailid;
}
/** Function to parse and get the mail error
* $mail -- reference of the mail object
* $mail_status -- status of the mail which is sent or not
* $to -- the email address to whom we sent the mail and failes
* return -- Mail error occured during the mail sending process
*/
function getMailError($mail,$mail_status,$to)
{
//Error types in class.phpmailer.php
/*
provide_address, mailer_not_supported, execute, instantiate, file_access, file_open, encoding, data_not_accepted, authenticate,
connect_host, recipients_failed, from_failed
*/
global $adb;
$adb->println("Inside the function getMailError");
$msg = array_search($mail_status,$mail->language);
$adb->println("Error message ==> ".$msg);
if($msg == 'connect_host')
{
$error_msg = $msg;
}
elseif(strstr($msg,'from_failed'))
{
$error_msg = $msg;
}
elseif(strstr($msg,'recipients_failed'))
{
$error_msg = $msg;
}
else
{
$adb->println("Mail error is not as connect_host or from_failed or recipients_failed");
//$error_msg = $msg;
}
$adb->println("return error => ".$error_msg);
return $error_msg;
}
/** Function to get the mail status string (string of sent mail status)
* $mail_status_str -- concatenated string with all the error messages with &&& seperation
* return - the error status as a encoded string
*/
function getMailErrorString($mail_status_str)
{
global $adb;
$adb->println("Inside getMailErrorString function.\nMail status string ==> ".$mail_status_str);
$mail_status_str = trim($mail_status_str,"&&&");
$mail_status_array = explode("&&&",$mail_status_str);
$adb->println("All Mail status ==>\n".$mail_status_str."\n");
foreach($mail_status_array as $key => $val)
{
$list = explode("=",$val);
$adb->println("Mail id & status ==> ".$list[0]." = ".$list[1]);
if($list[1] == 0)
{
$mail_error_str .= $list[0]."=".$list[1]."&&&";
}
}
$adb->println("Mail error string => '".$mail_error_str."'");
if($mail_error_str != '')
{
$mail_error_str = 'mail_error='.base64_encode($mail_error_str);
}
return $mail_error_str;
}
/** Function to parse the error string
* $mail_error_str -- base64 encoded string which contains the mail sending errors as concatenated with &&&
* return - Error message to display
*/
function parseEmailErrorString($mail_error_str)
{
//TODO -- we can modify this function for better email error handling in future
global $adb, $mod_strings;
$adb->println("Inside the parseEmailErrorString function.\n encoded mail error string ==> ".$mail_error_str);
$mail_error = base64_decode($mail_error_str);
$adb->println("Original error string => ".$mail_error);
$mail_status = explode("&&&",trim($mail_error,"&&&"));
foreach($mail_status as $key => $val)
{
$status_str = explode("=",$val);
$adb->println('Mail id => "'.$status_str[0].'".........status => "'.$status_str[1].'"');
if($status_str[1] != 1 && $status_str[1] != '')
{
$adb->println("Error in mail sending");
if($status_str[1] == 'connect_host')
{
$adb->println("if part - Mail sever is not configured");
$errorstr .= ' '.$mod_strings['MESSAGE_CHECK_MAIL_SERVER_NAME'].'';
break;
}
elseif($status_str[1] == '0')
{
$adb->println("first elseif part - status will be 0 which is the case of assigned to vtiger_users's email is empty.");
$errorstr .= ' '.$mod_strings['MESSAGE_MAIL_COULD_NOT_BE_SEND'].' '.$mod_strings['MESSAGE_PLEASE_CHECK_FROM_THE_MAILID'].'';
//Added to display the message about the CC && BCC mail sending status
if($status_str[0] == 'cc_success')
{
$cc_msg = 'But the mail has been sent to CC & BCC addresses.';
$errorstr .= ' '.$cc_msg.'';
}
}
elseif(strstr($status_str[1],'from_failed'))
{
$adb->println("second elseif part - from email id is failed.");
$from = explode('from_failed',$status_str[1]);
$errorstr .= " ".$mod_strings['MESSAGE_PLEASE_CHECK_THE_FROM_MAILID']." '".$from[1]."'";
}
else
{
$adb->println("else part - mail send process failed due to the following reason.");
$errorstr .= " ".$mod_strings['MESSAGE_MAIL_COULD_NOT_BE_SEND_TO_THIS_EMAILID']." '".$status_str[0]."'. ".$mod_strings['PLEASE_CHECK_THIS_EMAILID']."";
}
}
}
$adb->println("Return Error string => ".$errorstr);
return $errorstr;
}
function isUserInitiated() {
return (($_REQUEST['module'] == 'Emails' || $_REQUEST['module'] == 'Webmails') &&
($_REQUEST['action'] == 'mailsend' || $_REQUEST['action'] == 'webmailsend' || $_REQUEST['action'] == 'Save'));
}
?>
5.3.0/Webmails.tpl.new 0000700 0000060 0000060 00000025344 12205112304 013772 0 ustar apache apache {**}
{include file='Buttons_List1.tpl'}
';
//test ended by Richie
imap_close($MailBox->mbox);
?>
export.png 0000777 0000000 0000000 00000000000 12204472333 014407 2wee/export.png ustar root root gpgconfig-vtiger.php 0000700 0000060 0000060 00000016053 12366324123 014236 0 ustar apache apache .
*
**************************************************************/
// essential checks (do not remove!)
if (! isset ($SECURE_CONNECTION)){
$SECURE_CONNECTION = "yes";
}
if (! isset ($APACHE)){
$APACHE = 48;
}
if($_SERVER['HTTPS'] != "on") {
die ("
This connection is not secured by SSL. Aborting.
");
}
if ((! isset($AUTHREQUIRED)) or ($AUTHREQUIRED == "yes")) {
require_once('wee-auth.php');
}
// the $GPGDIR may have changed as a result of user authentication in wee-auth.php
if (! is_dir($GPGDIR)){
die ("
Directory $GPGDIR does not exist.
");
} else {
if (fileowner($GPGDIR) != $APACHE){
echo "
");
}
}
}
// GLOBAL FUNCTIONS
function unix($command)
{
// Executing a System Command with output
$handle = popen("$command 2>&1", 'r');
$text = fread($handle, 2000000);
pclose($handle);
return $text;
}
function unix2($command,$dir)
{
// Executing a System Command with very large output but no input
$rndhandle = fopen("/dev/urandom","r");
$RND = fread($rndhandle,20);
fclose($rndhandle);
$FILENAME = $dir."/".sha1($RND);
$handle = popen("$command > ".$FILENAME." 2> ".$FILENAME, 'r');
$res = fread($handle, 20000000);
pclose($handle);
$handle = fopen($FILENAME, "r");
$text = fread($handle,20000000);
fclose($handle);
// destroy content of the plain text file
unix("dd if=/dev/zero of=".$FILENAME." bs=1 count=".strlen($text));
unix("sync");
unix("rm ".$FILENAME);
return $text;
}
function unixpipe($command,$input)
{
// Executing a System Command with no output to STDOUT but reading $input
$handle = popen("$command 2>&1", 'w');
fwrite($handle, $input);
pclose($handle);
}
function checkinput($input,$mode)
{
if ($mode == "none") {
return $input;
}
else {
if ($mode == "noscript") {
//return addslashes($input);
$filter = array('"'=>'', '\\'=>'', '\''=>'', ';'=>'', '('=>'', ')'=>'', '{'=>'', '}'=>'', '$'=>'');
return strtr($input, $filter);
}
if ($mode == "html") {
return htmlentities($input);
}
if ($mode == "url") {
return rawurlencode($input);
}
}
return "none";
}
if (! isset($INPUT)){
$INPUT = "textarea";
}
if (! isset($INPUTNAME)){
$INPUTNAME = "message";
}
if (! isset($INPUTID)){
$INPUTID = "message";
}
if (! isset($ENCRYPTIONTEXTAREA)){
$ENCRYPTIONTEXTAREA = "messagearea";
}
if (! isset($DECRYPTIONINPUT)){
$DECRYPTIONINPUT = "textarea";
}
if (! isset($DECRYPTIONINPUTNAME)){
$DECRYPTIONINPUTNAME = "message";
}
if (! isset($DECRYPTIONINPUTID)){
$DECRYPTIONINPUTID = "message";
}
if (! isset($DECRYPTIONTEXTAREA)){
$DECRYPTIONTEXTAREA = "messagearea";
}
if (! isset($SIGINPUT)){
$SIGINPUT = "textarea";
}
if (! isset($SIGINPUTNAME)){
$SIGINPUTNAME = "message";
}
if (! isset($SIGINPUTID)){
$SIGINPUTID = "message";
}
if (! isset($SIGTEXTAREA)){
$SIGTEXTAREA = "messagearea";
}
if (! isset($VERIFYINPUT)){
$VERIFYINPUT = "textarea";
}
if (! isset($VERIFYINPUTNAME)){
$VERIFYINPUTNAME = "message";
}
if (! isset($VERIFYINPUTID)){
$VERIFYINPUTID = "message";
}
if (! isset($VERIFYTEXTAREA)){
$VERIFYTEXTAREA = "messagearea";
}
if (! isset($KEYSREADONLY)){
$KEYSREADONLY = "yes";
}
if (! isset($KEYCREATION)){
$KEYCREATION = "no";
}
if (! isset($DELETESECRETKEY)){
$DELETESECRETKEY = "no";
}
if (! isset($FLEXIBLE)){
$FLEXIBLE = "no";
}
if (! isset($ADDPRE)){
$ADDPRE = "no";
}
if (! isset($FORYOUREYESONLY)){
$FORYOUREYESONLY = "no";
}
if (! isset($REMOVEBR)){
$REMOVEBR = "no";
}
/*
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
iQIVAwUBU9mDxPv24sKOnJjdAQJ+Ag//U+sKA5V7jBFCuymkIEz9tw6NRrrmdqWe
WZNJSEoMMWe4NgpCs7uiwhsxPYHwVq2X8GhGEObGtLbhbtuZW7KDgVXB1aTslIn9
Bf90bu3EqluVO4nzwlRJ+tAFJk57cCKI6eMP0m8FUMl/ksQduNLam2d5yBE/IWr5
pq8oCW+ZzwpMT4wUM4JkEDojpO9yVD9d9aNHEjGO7VhAPXON5gUg7jkjDJmWI9JY
nhtvEb2/Js5FVDZo5QF6j3CMWGtlfWy5hMFAcOPHtz8AC1eaqBohYclie0YntiK7
0eZ6nyQGylR7ll6xq1FMdQ4f+YYMmx9FbTGfT+iwcTFhhVz26zevxk/0StxzN7q7
yPMQ8gM/BebOC3ydNbiSYp9qho1XDt1v/YqN+atmHNvNm/IizbSEhyxBwrQ+SuzV
br73L4vqoc+aJwu4jdrW+frxQMcStVIuC5XV4ggopFNvjtmm2ytt+wuHRO0khAoo
ODT+ctIAI2C5CLXzQ6F3+5Ygg/ZJkJnxI8Pkd9DxaCkjdMbPAcnuWq2v7QB+/TUT
7KlEH/HfmeNce+pFnwwCrGxgo7HimXonJE5xsNkhojNCmGX+CP7qbh3CiFnETPia
B9DHoZLFBCaB8aBQTBtfo/zQ4dDkHgIm5L8mCsMmj545/m0AaHL5+GwuruWF/Yjg
DWx/gJviG9k=
=LRJl
-----END PGP SIGNATURE-----
*/?>
gpgconfig.php 0000700 0000060 0000060 00000016053 12366324111 012735 0 ustar apache apache .
*
**************************************************************/
// essential checks (do not remove!)
if (! isset ($SECURE_CONNECTION)){
$SECURE_CONNECTION = "yes";
}
if (! isset ($APACHE)){
$APACHE = 48;
}
if($_SERVER['HTTPS'] != "on") {
die ("
This connection is not secured by SSL. Aborting.
");
}
if ((! isset($AUTHREQUIRED)) or ($AUTHREQUIRED == "yes")) {
require_once('wee-auth.php');
}
// the $GPGDIR may have changed as a result of user authentication in wee-auth.php
if (! is_dir($GPGDIR)){
die ("
Directory $GPGDIR does not exist.
");
} else {
if (fileowner($GPGDIR) != $APACHE){
echo "