From d002ff668aee672d7a49cd744d6797eb616b9152 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 28 Jul 2013 21:04:03 -0700 Subject: encrypt private messages on disk - there are still a couple of places where the text is leaked in the logs during processing. --- mod/item.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index c504c77e1..1a27cbe57 100644 --- a/mod/item.php +++ b/mod/item.php @@ -580,6 +580,19 @@ function item_post(&$a) { } + if(array_key_exists('item_private',$datarray) && $datarray['item_private']) { + logger('Encrypting local storage'); + $key = get_config('system','pubkey'); + $datarray['item_flags'] = $datarray['item_flags'] | ITEM_OBSCURED; + if($datarray['title']) + $datarray['title'] = json_encode(aes_encapsulate($datarray['title'],$key)); + if($datarray['body']) + $datarray['body'] = json_encode(aes_encapsulate($datarray['body'],$key)); + } + + + + if($orig_post) { $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `attach` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", dbesc($datarray['title']), @@ -602,6 +615,23 @@ function item_post(&$a) { ); + if(count($post_tags)) { + foreach($post_tags as $tag) { + if(strlen(trim($tag['term']))) { + q("insert into term (uid,oid,otype,type,term,url) values (%d,%d,%d,%d,'%s','%s')", + intval($tag['uid']), + intval($post_id), + intval($tag['otype']), + intval($tag['type']), + dbesc(trim($tag['term'])), + dbesc(trim($tag['url'])) + ); + } + } + } + + + proc_run('php', "include/notifier.php", 'edit_post', $post_id); if((x($_REQUEST,'return')) && strlen($return_path)) { logger('return: ' . $return_path); -- cgit v1.2.3