diff options
Diffstat (limited to 'include')
-rwxr-xr-x | include/diaspora.php | 12 | ||||
-rwxr-xr-x | include/items.php | 8 | ||||
-rw-r--r-- | include/message.php | 16 | ||||
-rw-r--r-- | include/text.php | 10 |
4 files changed, 26 insertions, 20 deletions
diff --git a/include/diaspora.php b/include/diaspora.php index 1e04b6b44..fc7dbfa18 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1704,9 +1704,9 @@ function diaspora_conversation($importer,$xml,$msg) { } if($subject) - $subject = base64url_encode($subject); + $subject = str_rot47(base64url_encode($subject)); if($body) - $body = base64url_encode($body); + $body = str_rot47(base64url_encode($body)); q("insert into mail ( `channel_id`, `convid`, `from_xchan`,`to_xchan`,`title`,`body`,`mail_flags`,`mid`,`parent_mid`,`created`) values ( %d, %d, '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s')", intval($importer['channel_id']), @@ -1836,9 +1836,9 @@ function diaspora_message($importer,$xml,$msg) { $key = get_config('system','pubkey'); if($subject) - $subject = base64url_encode($subject); + $subject = str_rot47(base64url_encode($subject)); if($body) - $body = base64url_encode($body); + $body = str_rot47(base64url_encode($body)); q("insert into mail ( `channel_id`, `convid`, `from_xchan`,`to_xchan`,`title`,`body`,`mail_flags`,`mid`,`parent_mid`,`created`) values ( %d, %d, '%s', '%s', '%s', '%s', '%d','%s','%s','%s')", intval($importer['channel_id']), @@ -2861,9 +2861,9 @@ function diaspora_send_mail($item,$owner,$contact) { if(array_key_exists('mail_flags',$item) && ($item['mail_flags'] & MAIL_OBSCURED)) { if($item['title']) - $item['title'] = base64url_decode($item['title']); + $item['title'] = base64url_decode(str_rot47($item['title'])); if($item['body']) - $item['body'] = base64url_decode($item['body']); + $item['body'] = base64url_decode(str_rot47($item['body'])); } diff --git a/include/items.php b/include/items.php index ce0c2461a..ea98c1a6f 100755 --- a/include/items.php +++ b/include/items.php @@ -1400,9 +1400,9 @@ function encode_mail($item) { if(array_key_exists('mail_flags',$item) && ($item['mail_flags'] & MAIL_OBSCURED)) { if($item['title']) - $item['title'] = base64url_decode($item['title']); + $item['title'] = base64url_decode(str_rot47($item['title'])); if($item['body']) - $item['body'] = base64url_decode($item['body']); + $item['body'] = base64url_decode(str_rot47($item['body'])); } $x['message_id'] = $item['mid']; @@ -1455,12 +1455,12 @@ function get_mail_elements($x) { $key = get_config('system','pubkey'); $arr['mail_flags'] |= MAIL_OBSCURED; if($arr['body']) { - $arr['body'] = base64url_encode($arr['body']); + $arr['body'] = str_rot47(base64url_encode($arr['body'])); $arr['body'] = htmlspecialchars($arr['body'],ENT_COMPAT,'UTF-8',false); } if($arr['title']) { - $arr['title'] = base64url_encode($arr['title']); + $arr['title'] = str_rot47(base64url_encode($arr['title'])); $arr['title'] = htmlspecialchars($arr['title'],ENT_COMPAT,'UTF-8',false); } if($arr['created'] > datetime_convert()) diff --git a/include/message.php b/include/message.php index 82c48ba85..8f1430e64 100644 --- a/include/message.php +++ b/include/message.php @@ -164,9 +164,9 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto=' $jattach = (($attachments) ? json_encode($attachments) : ''); if($subject) - $subject = base64url_encode($subject); + $subject = str_rot47(base64url_encode($subject)); if($body) - $body = base64url_encode($body); + $body = str_rot47(base64url_encode($body)); @@ -286,9 +286,9 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) { $r[$k]['seen'] = (($rr['mail_flags'] & MAIL_SEEN) ? 1 : 0); if($r[$k]['mail_flags'] & MAIL_OBSCURED) { if($r[$k]['title']) - $r[$k]['title'] = base64url_decode($r[$k]['title']); + $r[$k]['title'] = base64url_decode(str_rot47($r[$k]['title'])); if($r[$k]['body']) - $r[$k]['body'] = base64url_decode($r[$k]['body']); + $r[$k]['body'] = base64url_decode(str_rot47($r[$k]['body'])); } } @@ -324,9 +324,9 @@ function private_messages_fetch_message($channel_id, $messageitem_id, $updatesee $messages[$k]['to'] = find_xchan_in_array($message['to_xchan'],$c); if($messages[$k]['mail_flags'] & MAIL_OBSCURED) { if($messages[$k]['title']) - $messages[$k]['title'] = base64url_decode($messages[$k]['title']); + $messages[$k]['title'] = base64url_decode(str_rot47($messages[$k]['title'])); if($messages[$k]['body']) - $messages[$k]['body'] = base64url_decode($messages[$k]['body']); + $messages[$k]['body'] = base64url_decode(str_rot47($messages[$k]['body'])); } } @@ -411,9 +411,9 @@ function private_messages_fetch_conversation($channel_id, $messageitem_id, $upda $messages[$k]['to'] = find_xchan_in_array($message['to_xchan'],$c); if($messages[$k]['mail_flags'] & MAIL_OBSCURED) { if($messages[$k]['title']) - $messages[$k]['title'] = base64url_decode($messages[$k]['title']); + $messages[$k]['title'] = base64url_decode(str_rot47($messages[$k]['title'])); if($messages[$k]['body']) - $messages[$k]['body'] = base64url_decode($messages[$k]['body']); + $messages[$k]['body'] = base64url_decode(str_rot47($messages[$k]['body'])); } } diff --git a/include/text.php b/include/text.php index 5b9b35c16..f2d9f3e69 100644 --- a/include/text.php +++ b/include/text.php @@ -1199,9 +1199,9 @@ function unobscure(&$item) { function unobscure_mail(&$item) { if(array_key_exists('mail_flags',$item) && ($item['mail_flags'] & MAIL_OBSCURED)) { if($item['title']) - $item['title'] = base64url_decode($item['title']); + $item['title'] = base64url_decode(str_rot47($item['title'])); if($item['body']) - $item['body'] = base64url_decode($item['body']); + $item['body'] = base64url_decode(str_rot47($item['body'])); } } @@ -2557,3 +2557,9 @@ function userReadableSize($size) { return $ret; } + +function str_rot47($str) { + return strtr($str, + '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~', + 'PQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO'); +} |