X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=mod%2Fdfrn_notify.php;h=eb9d71fe3f3cb5d5093f6e1c7c08a488e6bf70b0;hb=b3a5fccc9d4af4dc66ae8f0404817690a333c433;hp=2cc5a62f3c75f84bb3c4f00b2f9f3aa10ba087f9;hpb=7df8e18dd1917de9df359094e0ff486f47e4a08d;p=friendica.git diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 2cc5a62f3c..eb9d71fe3f 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -10,6 +10,12 @@ function dfrn_notify_post(&$a) { $data = ((x($_POST,'data')) ? $_POST['data'] : ''); $key = ((x($_POST,'key')) ? $_POST['key'] : ''); $dissolve = ((x($_POST,'dissolve')) ? intval($_POST['dissolve']) : 0); + $perm = ((x($_POST,'perm')) ? notags(trim($_POST['perm'])) : 'r'); + + $writable = (-1); + if($dfrn_version >= 2.21) { + $writable = (($perm === 'rw') ? 1 : 0); + } $direction = (-1); if(strpos($dfrn_id,':') == 1) { @@ -74,6 +80,14 @@ function dfrn_notify_post(&$a) { $importer = $r[0]; + if(($writable != (-1)) && ($writable != $importer['writable'])) { + q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d LIMIT 1", + intval($writable), + intval($importer['id']) + ); + $importer['writable'] = $writable; + } + logger('dfrn_notify: received notify from ' . $importer['name'] . ' for ' . $importer['username']); logger('dfrn_notify: data: ' . $data, LOGGER_DATA); @@ -118,8 +132,6 @@ function dfrn_notify_post(&$a) { } - - if($importer['readonly']) { // We aren't receiving stuff from this person. But we will quietly ignore them // rather than a blatant "go away" message. @@ -262,10 +274,13 @@ function dfrn_notify_post(&$a) { $when = datetime_convert('UTC','UTC','now','Y-m-d H:i:s'); } if($deleted) { - $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + + $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d AND `contact-id` = %d LIMIT 1", dbesc($uri), - intval($importer['importer_uid']) + intval($importer['importer_uid']), + intval($importer['id']) ); + if(count($r)) { $item = $r[0]; @@ -386,7 +401,11 @@ function dfrn_notify_post(&$a) { )); $res = mail($importer['email'], sprintf(t('%s commented on an item at %s'), $from , $a->config['sitename']), - $email_tpl, "From: " . t('Administrator') . '@' . $a->get_hostname() ); + $email_tpl, + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); + } } xml_status(0); @@ -472,7 +491,11 @@ function dfrn_notify_post(&$a) { )); $res = mail($importer['email'], sprintf( t("%s commented on an item at %s") , $from ,$a->config['sitename']), - $email_tpl, "From: ".t("Administrator") . "@". $a->get_hostname() ); + $email_tpl, + 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n" + . 'Content-type: text/plain; charset=UTF-8' . "\n" + . 'Content-transfer-encoding: 8bit' ); + break; } }