fix private message encryption since the input_filter mangled it

This commit is contained in:
friendica 2013-09-03 22:48:08 -07:00
parent ab1c9dc9c9
commit a0668c8bbb
2 changed files with 5 additions and 2 deletions

View File

@ -1398,15 +1398,15 @@ function item_store($arr,$allow_exec = false) {
$arr['item_flags'] = ((x($arr,'item_flags')) ? intval($arr['item_flags']) : 0 );
$arr['body'] = z_input_filter($arr['uid'],$arr['body'],$arr['mimetype']);
$arr['title'] = escape_tags($arr['title']);
// only detect language if we have text content, and if the post is private but not yet
// obscured, make it so.
if(! ($arr['item_flags'] & ITEM_OBSCURED)) {
$arr['lang'] = detect_language($arr['body']);
// apply the input filter here - if it is obscured it has been filtered already
$arr['body'] = z_input_filter($arr['uid'],$arr['body'],$arr['mimetype']);
$allowed_languages = get_pconfig($arr['uid'],'system','allowed_languages');

View File

@ -611,6 +611,9 @@ function item_post(&$a) {
$datarray['title'] = mb_substr($datarray['title'],0,255);
if(array_key_exists('item_private',$datarray) && $datarray['item_private']) {
$datarray['body'] = z_input_filter($datarray['uid'],$datarray['body'],$datarray['mimetype']);
logger('Encrypting local storage');
$key = get_config('system','pubkey');
$datarray['item_flags'] = $datarray['item_flags'] | ITEM_OBSCURED;