Merge branch 'dev' into 'dev'
Add signatures processing for private messages See merge request hubzilla/core!1670
This commit is contained in:
commit
3bc214e544
@ -25,6 +25,10 @@ class Mail extends \Zotlabs\Web\Controller {
|
||||
$expires = ((x($_REQUEST,'expires')) ? datetime_convert(date_default_timezone_get(),'UTC', $_REQUEST['expires']) : NULL_DATE);
|
||||
$raw = ((x($_REQUEST,'raw')) ? intval($_REQUEST['raw']) : 0);
|
||||
$mimetype = ((x($_REQUEST,'mimetype')) ? notags(trim($_REQUEST['mimetype'])) : 'text/bbcode');
|
||||
|
||||
$sig = ((x($_REQUEST,'signature')) ? trim($_REQUEST['signature']) : '');
|
||||
if(strpos($sig,'b64.') === 0)
|
||||
$sig = base64_decode(str_replace('b64.', '', $sig));
|
||||
|
||||
if($preview) {
|
||||
|
||||
@ -123,7 +127,7 @@ class Mail extends \Zotlabs\Web\Controller {
|
||||
|
||||
// We have a local_channel, let send_message use the session channel and save a lookup
|
||||
|
||||
$ret = send_message(0, $recipient, $body, $subject, $replyto, $expires, $mimetype, $raw);
|
||||
$ret = send_message(0, $recipient, $body, $subject, $replyto, $expires, $mimetype, $raw, $sig);
|
||||
|
||||
if($ret['success']) {
|
||||
xchan_mail_query($ret['mail']);
|
||||
@ -396,8 +400,9 @@ class Mail extends \Zotlabs\Web\Controller {
|
||||
'can_recall' => ($channel['channel_hash'] == $message['from_xchan']),
|
||||
'is_recalled' => (intval($message['mail_recalled']) ? t('Message has been recalled.') : ''),
|
||||
'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'], 'c'),
|
||||
'sig' => base64_encode($message['sig'])
|
||||
);
|
||||
|
||||
|
||||
$seen = $message['seen'];
|
||||
|
||||
}
|
||||
|
@ -1457,6 +1457,7 @@ function encode_mail($item,$extended = false) {
|
||||
$x['to'] = encode_item_xchan($item['to']);
|
||||
$x['raw'] = $item['mail_raw'];
|
||||
$x['mimetype'] = $item['mail_mimetype'];
|
||||
$x['sig'] = $item['sig'];
|
||||
|
||||
if($item['attach'])
|
||||
$x['attach'] = json_decode($item['attach'],true);
|
||||
@ -1516,6 +1517,9 @@ function get_mail_elements($x) {
|
||||
$arr['expires'] = datetime_convert('UTC','UTC',$x['expires']);
|
||||
|
||||
$arr['mail_flags'] = 0;
|
||||
|
||||
if(array_key_exists('sig',$x))
|
||||
$arr['sig'] = $x['sig'];
|
||||
|
||||
if($x['flags'] && is_array($x['flags'])) {
|
||||
if(in_array('recalled',$x['flags'])) {
|
||||
|
@ -19,7 +19,7 @@ function mail_prepare_binary($item) {
|
||||
// send a private message
|
||||
|
||||
|
||||
function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $replyto = '', $expires = NULL_DATE, $mimetype = 'text/bbcode', $raw = false) {
|
||||
function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $replyto = '', $expires = NULL_DATE, $mimetype = 'text/bbcode', $raw = false, $sig = '') {
|
||||
|
||||
$ret = array('success' => false);
|
||||
$is_reply = false;
|
||||
@ -175,8 +175,7 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep
|
||||
$subject = str_rot47(base64url_encode($subject));
|
||||
if(($body )&& (! $raw))
|
||||
$body = str_rot47(base64url_encode($body));
|
||||
|
||||
$sig = ''; // placeholder
|
||||
|
||||
$mimetype = ''; //placeholder
|
||||
|
||||
$r = q("INSERT INTO mail ( account_id, conv_guid, mail_obscured, channel_id, from_xchan, to_xchan, mail_mimetype, title, body, sig, attach, mid, parent_mid, created, expires, mail_isreply, mail_raw )
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div id="mail-{{$mail.id}}" class="mb-2 clearfix mail-conv-outside-wrapper">
|
||||
<div id="mail-{{$mail.id}}" class="mb-2 clearfix mail-conv-outside-wrapper"{{if $mail.sig}} data-sig="{{$mail.sig}}"{{/if}}>
|
||||
<div class="mb-2 clearfix wall-item-head">
|
||||
<div class="wall-item-info" >
|
||||
<a href="{{$mail.from_url}}"><img class="wall-item-photo" src="{{$mail.from_photo}}" alt="{{$mail.from_name}}" /></a>
|
||||
|
@ -11,6 +11,7 @@
|
||||
<input type="hidden" id="inp-prvmail-expires" name="expires" value="{{$defexpire}}" />
|
||||
<input type="hidden" name="media_str" id="jot-media" value="" />
|
||||
<input type="hidden" name="preview" id="mail-preview" value="0" />
|
||||
<input type="hidden" name="signature" id="mail-sig" value="" />
|
||||
{{if $new}}
|
||||
<div class="form-group">
|
||||
<label for="recip">{{$to}}</label>
|
||||
|
Reference in New Issue
Block a user