mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
W.I.P. SMIME:
- First approach to get attachment content - Adopt save actions in attachment area for smime encrypted attachments
This commit is contained in:
parent
472a3a242e
commit
f436538797
@ -2328,6 +2328,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
||||
* mailbox => (string) // the mailbox where message is stored
|
||||
* passphrase => (string) // smime private key passphrase
|
||||
* certAttachedPartID => (int) // partID of attached smime certificate
|
||||
* fetchAttachmentWithPartID => (int) // PartID of requested attachment to be fetched
|
||||
* )
|
||||
*
|
||||
* @return array
|
||||
@ -2365,8 +2366,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
||||
// passphrase is required to decrypt the message
|
||||
if (isset($_message['password_required']))
|
||||
{
|
||||
$data = $_message;
|
||||
return $data;
|
||||
return $_message;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2390,6 +2390,21 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
||||
if (!Mail\Smime::isSmimeSignatureOnly($params['mimeType']))
|
||||
{
|
||||
$dec_attachments = $this->mail_bo->getMessageAttachments($params['uid'],$params['partID'],$message_parts,true,false,true,$params['mailbox']);
|
||||
// mark attachments as smime encrypted
|
||||
array_walk ($dec_attachments,function (&$_attachment, $_index, $_mimeType){
|
||||
$_attachment['smime_type'] = $_mimeType;
|
||||
},$params['mimeType']);
|
||||
|
||||
// fetch requested attachment's content
|
||||
if (!empty($params['fetchAttachmentWithPartID']) && is_array($dec_attachments))
|
||||
{
|
||||
return array(
|
||||
'type' => $message_parts[$params['fetchAttachmentWithPartID']]->getType(),
|
||||
'charset' => $message_parts[$params['fetchAttachmentWithPartID']]->getContentTypeParameter('charset'),
|
||||
'filename' => $message_parts[$params['fetchAttachmentWithPartID']]->getName(),
|
||||
'attachment' => $message_parts[$params['fetchAttachmentWithPartID']]->getContents()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$result = array(
|
||||
@ -2495,6 +2510,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
||||
$attachmentHTML[$key]['mail_id'] = $rowID;
|
||||
$attachmentHTML[$key]['winmailFlag']=$value['is_winmail'];
|
||||
$attachmentHTML[$key]['classSaveAllPossiblyDisabled'] = "mail_DisplayNone";
|
||||
$attachmentHTML[$key]['smime_type'] = $value['smime_type'];
|
||||
// reset mode array as it should be considered differently for
|
||||
// each attachment
|
||||
$mode = array();
|
||||
@ -2544,8 +2560,9 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
||||
'menuaction' => 'mail.mail_ui.getAttachment',
|
||||
'id' => $rowID,
|
||||
'part' => $value['partID'],
|
||||
'is_winmail' => $value['is_winmail'],
|
||||
'is_winmail'=> $value['is_winmail'],
|
||||
'mailbox' => base64_encode($mailbox),
|
||||
'smime_type' => $value['smime_type']
|
||||
) , $mode);
|
||||
$windowName = 'displayAttachment_'. $uid;
|
||||
$reg = '800x600';
|
||||
@ -2574,6 +2591,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
||||
'part' => $value['partID'],
|
||||
'is_winmail' => $value['is_winmail'],
|
||||
'mailbox' => base64_encode($mailbox),
|
||||
'smime_type' => $value['smime_type']
|
||||
);
|
||||
$linkView = "window.location.href = '".Egw::link('/index.php',$linkData)."';";
|
||||
break;
|
||||
@ -2599,6 +2617,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
||||
'part' => $value['partID'],
|
||||
'is_winmail' => $value['is_winmail'],
|
||||
'mailbox' => base64_encode($mailbox),
|
||||
'smime_type' => $value['smime_type']
|
||||
);
|
||||
$attachmentHTML[$key]['link_save'] ="<a href='".Egw::link('/index.php',$linkData)."' title='".$attachmentHTML[$key]['filename']."'>".Api\Html::image('mail','fileexport')."</a>";
|
||||
|
||||
@ -2783,6 +2802,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
||||
$uid = $hA['msgUID'];
|
||||
$mailbox = $hA['folder'];
|
||||
$icServerID = $hA['profileID'];
|
||||
$smime_type = $_GET['smime_type'];
|
||||
$rememberServerID = $this->mail_bo->profileID;
|
||||
if ($icServerID && $icServerID != $this->mail_bo->profileID)
|
||||
{
|
||||
@ -2793,7 +2813,24 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
||||
$is_winmail = $_GET['is_winmail'] ? $_GET['is_winmail'] : 0;
|
||||
|
||||
$this->mail_bo->reopen($mailbox);
|
||||
$attachment = $this->mail_bo->getAttachment($uid,$part,$is_winmail,false);
|
||||
if ($smime_type)
|
||||
{
|
||||
$attachment = $this->resolveSmimeMessage(
|
||||
$this->mail_bo->getMessageRawBody($uid, null, $mailbox),
|
||||
array(
|
||||
'mimeType' => $smime_type,
|
||||
'uid' => $uid,
|
||||
'partID' => 0,
|
||||
'mailbox' => $mailbox,
|
||||
'fetchAttachmentWithPartID' => $part
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$attachment = $this->mail_bo->getAttachment($uid,$part,$is_winmail,false);
|
||||
}
|
||||
$this->mail_bo->closeConnection();
|
||||
if ($rememberServerID != $this->mail_bo->profileID)
|
||||
{
|
||||
|
@ -2878,6 +2878,7 @@ app.classes.mail = AppJS.extend(
|
||||
url += '&id='+mailid;
|
||||
url += '&part='+attgrid.partID;
|
||||
url += '&is_winmail='+attgrid.winmailFlag;
|
||||
url += '&smime_type='+ (attgrid.smime_type?attgrid.smime_type:'');
|
||||
this.et2._inst.download(url);
|
||||
},
|
||||
|
||||
@ -2890,7 +2891,7 @@ app.classes.mail = AppJS.extend(
|
||||
mailid = this.mail_currentlyFocussed;//this.et2.getArrayMgr("content").getEntry('mail_id');
|
||||
var p = widget.getParent();
|
||||
var cont = p.getArrayMgr("content").data;
|
||||
attgrid = cont[widget.id.replace(/\[save\]/,'')];
|
||||
attgrid = cont[widget.id.replace(/\[save_zip\]/,'')];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2901,6 +2902,7 @@ app.classes.mail = AppJS.extend(
|
||||
url += 'menuaction=mail.mail_ui.download_zip'; // todo compose for Draft folder
|
||||
url += '&mode=save';
|
||||
url += '&id='+mailid;
|
||||
url += '&smime_type='+ (attgrid.smime_type?attgrid.smime_type:'');
|
||||
this.et2._inst.download(url);
|
||||
},
|
||||
|
||||
@ -2931,6 +2933,7 @@ app.classes.mail = AppJS.extend(
|
||||
url += '&type='+attgrid.type.toLowerCase();
|
||||
url += '&method=mail.mail_ui.vfsSaveAttachment';
|
||||
url += '&label='+egw.lang('Save');
|
||||
url += '&smime_type='+ (attgrid.smime_type?attgrid.smime_type:'');
|
||||
egw_openWindowCentered(url,windowName,width,height);
|
||||
},
|
||||
|
||||
@ -2957,6 +2960,7 @@ app.classes.mail = AppJS.extend(
|
||||
url += '&mode=select-dir';
|
||||
url += '&method=mail.mail_ui.vfsSaveAttachment';
|
||||
url += '&label='+egw.lang('Save all');
|
||||
url += '&smime_type='+ (attgrid.smime_type?attgrid.smime_type:'');
|
||||
for (var i=0;i<attgrid.length;i++)
|
||||
{
|
||||
if (attgrid[i] != null) url += '&id['+i+']='+mailid+'::'+attgrid[i].partID+'::'+attgrid[i].winmailFlag+'::'+attgrid[i].filename;
|
||||
@ -5743,8 +5747,11 @@ app.classes.mail = AppJS.extend(
|
||||
set_smimeAttachments:function (_attachments)
|
||||
{
|
||||
var attachmentArea = this.et2.getWidgetById(egw(window).is_popup()?'mail_displayattachments':'previewAttachmentArea');
|
||||
var content = this.et2.getArrayMgr('content');
|
||||
if (attachmentArea && _attachments && _attachments.length > 0)
|
||||
{
|
||||
content.data[attachmentArea.id] = _attachments;
|
||||
this.et2.setArrayMgr('contnet', content);
|
||||
attachmentArea.set_value({content:_attachments});
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user