zidify bodies of notification emails

This commit is contained in:
friendica 2013-06-17 16:21:03 -07:00
parent f4e8198335
commit 94c758080f
3 changed files with 24 additions and 8 deletions

View File

@ -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;

View File

@ -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"),
"<br />\n",$body))));
"<br />\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();

View File

@ -1 +1 @@
2013-06-16.346
2013-06-17.347