]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_notify.php
template for photo display
[friendica.git] / mod / dfrn_notify.php
index f447b54533b06b7bbc3aed7020f155414f9ebebe..eb9d71fe3f3cb5d5093f6e1c7c08a488e6bf70b0 100644 (file)
@@ -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];
 
@@ -385,8 +400,12 @@ function dfrn_notify_post(&$a) {
                                                                '$body' => html_entity_decode(strip_tags(bbcode(stripslashes($datarray['body']))), ENT_QUOTES, 'UTF-8')
                                                        ));
        
-                                                       $res = mail($importer['email'], $from . t(' commented on an item at ') . $a->config['sitename'],
-                                                               $email_tpl, "From: " . t('Administrator') . '@' . $a->get_hostname() );
+                                                       $res = mail($importer['email'], sprintf(t('%s commented on an item at %s'), $from , $a->config['sitename']),
+                                                               $email_tpl, 
+                                                               'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+                                                               . 'Content-type: text/plain; charset=UTF-8' . "\n"
+                                                               . 'Content-transfer-encoding: 8bit' );
+
                                                }
                                        }
                                        xml_status(0);
@@ -471,9 +490,12 @@ function dfrn_notify_post(&$a) {
                                                                '$body' => html_entity_decode(strip_tags(bbcode(stripslashes($datarray['body']))), ENT_QUOTES, 'UTF-8')
                                                        ));
 
-                                                       $res = mail($importer['email'], $from . t(" commented on an item at ") 
-                                                               . $a->config['sitename'],
-                                                               $email_tpl,t("From: Administrator@") . $a->get_hostname() );
+                                                       $res = mail($importer['email'], sprintf( t("%s commented on an item at %s") , $from ,$a->config['sitename']),
+                                                               $email_tpl, 
+                                                               'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+                                                               . 'Content-type: text/plain; charset=UTF-8' . "\n"
+                                                               . 'Content-transfer-encoding: 8bit' );
+
                                                        break;
                                                }
                                        }