From 94c758080ff0b957d7d728428de5821c39a583e9 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 17 Jun 2013 16:21:03 -0700 Subject: zidify bodies of notification emails --- boot.php | 14 ++++++++------ include/enotify.php | 16 +++++++++++++++- version.inc | 2 +- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/boot.php b/boot.php index c0473a23c..2f70f1d47 100755 --- a/boot.php +++ b/boot.php @@ -2061,6 +2061,8 @@ function get_my_url() { } function get_my_address() { + if(x($_SESSION,'zid_override')) + return $_SESSION['zid_override']; if(x($_SESSION,'my_address')) return $_SESSION['my_address']; return false; @@ -2098,12 +2100,12 @@ function zid_init(&$a) { } /** - * @function zid($s,$force = false) + * @function zid($s,$address = '') * Adds a zid parameter to a url * @param string $s * The url to accept the zid - * @param boolean $force - * Currently unused + * @param boolean $address + * $address to use instead of session environment * @return string * * @hooks 'zid' @@ -2113,7 +2115,7 @@ function zid_init(&$a) { */ -function zid($s,$force = false) { +function zid($s,$address = '') { if(! strlen($s) || strpos($s,'zid=')) return $s; $has_params = ((strpos($s,'?')) ? true : false); @@ -2123,9 +2125,9 @@ function zid($s,$force = false) { $achar = strpos($s,'?') ? '&' : '?'; $mine = get_my_url(); - $myaddr = get_my_address(); + $myaddr = (($address) ? $address : get_my_address()); - if($mine and ! link_compare($mine,$s)) + if($mine && $myaddr && (! link_compare($mine,$s))) $zurl = $s . (($num_slashes >= 3) ? '' : '/') . $achar . 'zid=' . urlencode($myaddr); else $zurl = $s; diff --git a/include/enotify.php b/include/enotify.php index 5728d054c..0a6befba1 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -354,8 +354,22 @@ function notification($params) { $textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r", "\\n"), "\n", $body))),ENT_QUOTES,'UTF-8')); + $htmlversion = html_entity_decode(bbcode(stripslashes(str_replace(array("\\r\\n", "\\r","\\n\\n" ,"\\n"), - "
\n",$body)))); + "
\n",$body))), ENT_QOUTES,'UTF-8'); + + + // use $_SESSION['zid_override'] to force zid() to use + // the recipient address instead of the current observer + + $_SESSION['zid_override'] = $recip['channel_address'] . '@' . $get_app()->get_hostname(); + + $textversion = zidify_links($textversion); + $htmlversion = zidify_links($htmlversion); + + // unset when done to revert to normal behaviour + + unset($_SESSION['zid_override']); $datarray = array(); diff --git a/version.inc b/version.inc index b47f8837e..b7f186fad 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-06-16.346 +2013-06-17.347 -- cgit v1.2.3