database support for client side e2ee for private mail
This commit is contained in:
parent
f36e384ed7
commit
7d5ee81628
@ -113,18 +113,18 @@ class Mail extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
if($preview) {
|
if($preview) {
|
||||||
$mail = [
|
$mail = [
|
||||||
'mailbox' => 'outbox',
|
'mailbox' => 'outbox',
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'mid' => 'M0',
|
'mid' => 'M0',
|
||||||
'from_name' => $channel['xchan_name'],
|
'from_name' => $channel['xchan_name'],
|
||||||
'from_url' => $channel['xchan_url'],
|
'from_url' => $channel['xchan_url'],
|
||||||
'from_photo' => $channel['xchan_photo_s'],
|
'from_photo' => $channel['xchan_photo_s'],
|
||||||
'subject' => zidify_links(smilies(bbcode($subject))),
|
'subject' => zidify_links(smilies(bbcode($subject))),
|
||||||
'body' => zidify_links(smilies(bbcode($body))),
|
'body' => zidify_links(smilies(bbcode($body))),
|
||||||
'attachments' => '',
|
'attachments' => '',
|
||||||
'can_recall' => false,
|
'can_recall' => false,
|
||||||
'is_recalled' => '',
|
'is_recalled' => '',
|
||||||
'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'], 'c')
|
'date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'], 'c')
|
||||||
];
|
];
|
||||||
|
|
||||||
echo replace_macros(get_markup_template('mail_conv.tpl'), [ '$mail' => $mail ] );
|
echo replace_macros(get_markup_template('mail_conv.tpl'), [ '$mail' => $mail ] );
|
||||||
|
2
boot.php
2
boot.php
@ -52,7 +52,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
|
|||||||
define ( 'STD_VERSION', '2.3.4' );
|
define ( 'STD_VERSION', '2.3.4' );
|
||||||
define ( 'ZOT_REVISION', '1.2' );
|
define ( 'ZOT_REVISION', '1.2' );
|
||||||
|
|
||||||
define ( 'DB_UPDATE_VERSION', 1189 );
|
define ( 'DB_UPDATE_VERSION', 1190 );
|
||||||
|
|
||||||
define ( 'PROJECT_BASE', __DIR__ );
|
define ( 'PROJECT_BASE', __DIR__ );
|
||||||
|
|
||||||
|
@ -188,9 +188,10 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep
|
|||||||
$body = str_rot47(base64url_encode($body));
|
$body = str_rot47(base64url_encode($body));
|
||||||
|
|
||||||
$sig = ''; // placeholder
|
$sig = ''; // placeholder
|
||||||
|
$mimetype = ''; //placeholder
|
||||||
|
|
||||||
$r = q("INSERT INTO mail ( account_id, conv_guid, mail_obscured, channel_id, from_xchan, to_xchan, title, body, sig, attach, mid, parent_mid, created, expires, mail_isreply )
|
$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 )
|
||||||
VALUES ( %d, '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d )",
|
VALUES ( %d, '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d )",
|
||||||
intval($channel['channel_account_id']),
|
intval($channel['channel_account_id']),
|
||||||
dbesc($conv_guid),
|
dbesc($conv_guid),
|
||||||
intval(1),
|
intval(1),
|
||||||
@ -198,6 +199,7 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep
|
|||||||
dbesc($channel['channel_hash']),
|
dbesc($channel['channel_hash']),
|
||||||
dbesc($recipient),
|
dbesc($recipient),
|
||||||
dbesc($subject),
|
dbesc($subject),
|
||||||
|
dbesc(($mimetype)? $mimetype : 'text/bbcode'),
|
||||||
dbesc($body),
|
dbesc($body),
|
||||||
dbesc($sig),
|
dbesc($sig),
|
||||||
dbesc($jattach),
|
dbesc($jattach),
|
||||||
|
@ -763,6 +763,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
|
|||||||
`to_xchan` char(255) NOT NULL DEFAULT '',
|
`to_xchan` char(255) NOT NULL DEFAULT '',
|
||||||
`account_id` int(10) unsigned NOT NULL DEFAULT '0',
|
`account_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
`channel_id` int(10) unsigned NOT NULL DEFAULT '0',
|
`channel_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`mail_mimetype` char(64) NOT NULL DEFAULT 'text/bbcode',
|
||||||
`title` text NOT NULL,
|
`title` text NOT NULL,
|
||||||
`body` mediumtext NOT NULL,
|
`body` mediumtext NOT NULL,
|
||||||
`sig` text NOT NULL,
|
`sig` text NOT NULL,
|
||||||
@ -775,6 +776,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
|
|||||||
`mail_seen` tinyint(4) NOT NULL DEFAULT '0',
|
`mail_seen` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
`mail_recalled` tinyint(4) NOT NULL DEFAULT '0',
|
`mail_recalled` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
`mail_obscured` smallint(6) NOT NULL DEFAULT '0',
|
`mail_obscured` smallint(6) NOT NULL DEFAULT '0',
|
||||||
|
`mail_raw` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||||
`expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
`expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
|
@ -751,6 +751,7 @@ CREATE TABLE "mail" (
|
|||||||
"to_xchan" text NOT NULL DEFAULT '',
|
"to_xchan" text NOT NULL DEFAULT '',
|
||||||
"account_id" bigint NOT NULL DEFAULT '0',
|
"account_id" bigint NOT NULL DEFAULT '0',
|
||||||
"channel_id" bigint NOT NULL DEFAULT '0',
|
"channel_id" bigint NOT NULL DEFAULT '0',
|
||||||
|
"mail_mimetype char(64) NOT NULL DEFAULT '0',
|
||||||
"title" text NOT NULL,
|
"title" text NOT NULL,
|
||||||
"body" text NOT NULL,
|
"body" text NOT NULL,
|
||||||
"sig" text NOT NULL,
|
"sig" text NOT NULL,
|
||||||
@ -763,6 +764,7 @@ CREATE TABLE "mail" (
|
|||||||
"mail_seen" smallint NOT NULL DEFAULT '0',
|
"mail_seen" smallint NOT NULL DEFAULT '0',
|
||||||
"mail_recalled" smallint NOT NULL DEFAULT '0',
|
"mail_recalled" smallint NOT NULL DEFAULT '0',
|
||||||
"mail_obscured" smallint NOT NULL DEFAULT '0',
|
"mail_obscured" smallint NOT NULL DEFAULT '0',
|
||||||
|
"mail_raw" smallint NOT NULL DEFAULT '0',
|
||||||
"created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
|
"created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||||
"expires" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
|
"expires" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1189 );
|
define( 'UPDATE_VERSION' , 1190 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -2521,3 +2521,14 @@ function update_r1188() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_r1189() {
|
||||||
|
|
||||||
|
$r1 = q("alter table mail add mail_mimetype char(64) not null default 'text/bbcode' ");
|
||||||
|
$r2 = q("alter table mail add mail_raw int(4) not null default '0' ");
|
||||||
|
|
||||||
|
if($r1 && $r2)
|
||||||
|
return UPDATE_SUCCESS;
|
||||||
|
return UPDATE_FAILED;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user