mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-28 01:29:05 +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
|
* mailbox => (string) // the mailbox where message is stored
|
||||||
* passphrase => (string) // smime private key passphrase
|
* passphrase => (string) // smime private key passphrase
|
||||||
* certAttachedPartID => (int) // partID of attached smime certificate
|
* certAttachedPartID => (int) // partID of attached smime certificate
|
||||||
|
* fetchAttachmentWithPartID => (int) // PartID of requested attachment to be fetched
|
||||||
* )
|
* )
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
@ -2365,8 +2366,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
|||||||
// passphrase is required to decrypt the message
|
// passphrase is required to decrypt the message
|
||||||
if (isset($_message['password_required']))
|
if (isset($_message['password_required']))
|
||||||
{
|
{
|
||||||
$data = $_message;
|
return $_message;
|
||||||
return $data;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2390,6 +2390,21 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
|||||||
if (!Mail\Smime::isSmimeSignatureOnly($params['mimeType']))
|
if (!Mail\Smime::isSmimeSignatureOnly($params['mimeType']))
|
||||||
{
|
{
|
||||||
$dec_attachments = $this->mail_bo->getMessageAttachments($params['uid'],$params['partID'],$message_parts,true,false,true,$params['mailbox']);
|
$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(
|
$result = array(
|
||||||
@ -2495,6 +2510,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
|||||||
$attachmentHTML[$key]['mail_id'] = $rowID;
|
$attachmentHTML[$key]['mail_id'] = $rowID;
|
||||||
$attachmentHTML[$key]['winmailFlag']=$value['is_winmail'];
|
$attachmentHTML[$key]['winmailFlag']=$value['is_winmail'];
|
||||||
$attachmentHTML[$key]['classSaveAllPossiblyDisabled'] = "mail_DisplayNone";
|
$attachmentHTML[$key]['classSaveAllPossiblyDisabled'] = "mail_DisplayNone";
|
||||||
|
$attachmentHTML[$key]['smime_type'] = $value['smime_type'];
|
||||||
// reset mode array as it should be considered differently for
|
// reset mode array as it should be considered differently for
|
||||||
// each attachment
|
// each attachment
|
||||||
$mode = array();
|
$mode = array();
|
||||||
@ -2544,8 +2560,9 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
|||||||
'menuaction' => 'mail.mail_ui.getAttachment',
|
'menuaction' => 'mail.mail_ui.getAttachment',
|
||||||
'id' => $rowID,
|
'id' => $rowID,
|
||||||
'part' => $value['partID'],
|
'part' => $value['partID'],
|
||||||
'is_winmail' => $value['is_winmail'],
|
'is_winmail'=> $value['is_winmail'],
|
||||||
'mailbox' => base64_encode($mailbox),
|
'mailbox' => base64_encode($mailbox),
|
||||||
|
'smime_type' => $value['smime_type']
|
||||||
) , $mode);
|
) , $mode);
|
||||||
$windowName = 'displayAttachment_'. $uid;
|
$windowName = 'displayAttachment_'. $uid;
|
||||||
$reg = '800x600';
|
$reg = '800x600';
|
||||||
@ -2574,6 +2591,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
|||||||
'part' => $value['partID'],
|
'part' => $value['partID'],
|
||||||
'is_winmail' => $value['is_winmail'],
|
'is_winmail' => $value['is_winmail'],
|
||||||
'mailbox' => base64_encode($mailbox),
|
'mailbox' => base64_encode($mailbox),
|
||||||
|
'smime_type' => $value['smime_type']
|
||||||
);
|
);
|
||||||
$linkView = "window.location.href = '".Egw::link('/index.php',$linkData)."';";
|
$linkView = "window.location.href = '".Egw::link('/index.php',$linkData)."';";
|
||||||
break;
|
break;
|
||||||
@ -2599,6 +2617,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
|||||||
'part' => $value['partID'],
|
'part' => $value['partID'],
|
||||||
'is_winmail' => $value['is_winmail'],
|
'is_winmail' => $value['is_winmail'],
|
||||||
'mailbox' => base64_encode($mailbox),
|
'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>";
|
$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'];
|
$uid = $hA['msgUID'];
|
||||||
$mailbox = $hA['folder'];
|
$mailbox = $hA['folder'];
|
||||||
$icServerID = $hA['profileID'];
|
$icServerID = $hA['profileID'];
|
||||||
|
$smime_type = $_GET['smime_type'];
|
||||||
$rememberServerID = $this->mail_bo->profileID;
|
$rememberServerID = $this->mail_bo->profileID;
|
||||||
if ($icServerID && $icServerID != $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;
|
$is_winmail = $_GET['is_winmail'] ? $_GET['is_winmail'] : 0;
|
||||||
|
|
||||||
$this->mail_bo->reopen($mailbox);
|
$this->mail_bo->reopen($mailbox);
|
||||||
|
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);
|
$attachment = $this->mail_bo->getAttachment($uid,$part,$is_winmail,false);
|
||||||
|
}
|
||||||
$this->mail_bo->closeConnection();
|
$this->mail_bo->closeConnection();
|
||||||
if ($rememberServerID != $this->mail_bo->profileID)
|
if ($rememberServerID != $this->mail_bo->profileID)
|
||||||
{
|
{
|
||||||
|
@ -2878,6 +2878,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
url += '&id='+mailid;
|
url += '&id='+mailid;
|
||||||
url += '&part='+attgrid.partID;
|
url += '&part='+attgrid.partID;
|
||||||
url += '&is_winmail='+attgrid.winmailFlag;
|
url += '&is_winmail='+attgrid.winmailFlag;
|
||||||
|
url += '&smime_type='+ (attgrid.smime_type?attgrid.smime_type:'');
|
||||||
this.et2._inst.download(url);
|
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');
|
mailid = this.mail_currentlyFocussed;//this.et2.getArrayMgr("content").getEntry('mail_id');
|
||||||
var p = widget.getParent();
|
var p = widget.getParent();
|
||||||
var cont = p.getArrayMgr("content").data;
|
var cont = p.getArrayMgr("content").data;
|
||||||
attgrid = cont[widget.id.replace(/\[save\]/,'')];
|
attgrid = cont[widget.id.replace(/\[save_zip\]/,'')];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2901,6 +2902,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
url += 'menuaction=mail.mail_ui.download_zip'; // todo compose for Draft folder
|
url += 'menuaction=mail.mail_ui.download_zip'; // todo compose for Draft folder
|
||||||
url += '&mode=save';
|
url += '&mode=save';
|
||||||
url += '&id='+mailid;
|
url += '&id='+mailid;
|
||||||
|
url += '&smime_type='+ (attgrid.smime_type?attgrid.smime_type:'');
|
||||||
this.et2._inst.download(url);
|
this.et2._inst.download(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -2931,6 +2933,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
url += '&type='+attgrid.type.toLowerCase();
|
url += '&type='+attgrid.type.toLowerCase();
|
||||||
url += '&method=mail.mail_ui.vfsSaveAttachment';
|
url += '&method=mail.mail_ui.vfsSaveAttachment';
|
||||||
url += '&label='+egw.lang('Save');
|
url += '&label='+egw.lang('Save');
|
||||||
|
url += '&smime_type='+ (attgrid.smime_type?attgrid.smime_type:'');
|
||||||
egw_openWindowCentered(url,windowName,width,height);
|
egw_openWindowCentered(url,windowName,width,height);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -2957,6 +2960,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
url += '&mode=select-dir';
|
url += '&mode=select-dir';
|
||||||
url += '&method=mail.mail_ui.vfsSaveAttachment';
|
url += '&method=mail.mail_ui.vfsSaveAttachment';
|
||||||
url += '&label='+egw.lang('Save all');
|
url += '&label='+egw.lang('Save all');
|
||||||
|
url += '&smime_type='+ (attgrid.smime_type?attgrid.smime_type:'');
|
||||||
for (var i=0;i<attgrid.length;i++)
|
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;
|
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)
|
set_smimeAttachments:function (_attachments)
|
||||||
{
|
{
|
||||||
var attachmentArea = this.et2.getWidgetById(egw(window).is_popup()?'mail_displayattachments':'previewAttachmentArea');
|
var attachmentArea = this.et2.getWidgetById(egw(window).is_popup()?'mail_displayattachments':'previewAttachmentArea');
|
||||||
|
var content = this.et2.getArrayMgr('content');
|
||||||
if (attachmentArea && _attachments && _attachments.length > 0)
|
if (attachmentArea && _attachments && _attachments.length > 0)
|
||||||
{
|
{
|
||||||
|
content.data[attachmentArea.id] = _attachments;
|
||||||
|
this.et2.setArrayMgr('contnet', content);
|
||||||
attachmentArea.set_value({content:_attachments});
|
attachmentArea.set_value({content:_attachments});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user