diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/contacts.php | 10 | ||||
-rw-r--r-- | mod/dfrn_poll.php | 1 | ||||
-rw-r--r-- | mod/follow.php | 9 | ||||
-rw-r--r-- | mod/item.php | 32 | ||||
-rw-r--r-- | mod/network.php | 2 | ||||
-rw-r--r-- | mod/profile.php | 2 |
6 files changed, 53 insertions, 3 deletions
diff --git a/mod/contacts.php b/mod/contacts.php index 177ca9973..4c627c88f 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -121,6 +121,15 @@ function contacts_content(&$a) { return; // NOTREACHED } + if($cmd === 'update') { + + // pull feed and consume it, which should subscribe to the hub. + + $php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); + proc_run($php_path,"include/poller.php","$contact_id"); + goaway($a->get_baseurl() . '/contacts/' . $contact_id); + // NOTREACHED + } if($cmd === 'block') { $blocked = (($orig_record[0]['blocked']) ? 0 : 1); @@ -248,6 +257,7 @@ function contacts_content(&$a) { '$last_update' => (($r[0]['last-update'] == '0000-00-00 00:00:00') ? t('Never') : datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, g:i A')), + '$udnow' => t('Update now'), '$profile_select' => contact_profile_assign($r[0]['profile-id'],(($r[0]['network'] !== 'dfrn') ? true : false)), '$contact_id' => $r[0]['id'], '$block_text' => (($r[0]['blocked']) ? t('Unblock this contact') : t('Block this contact') ), diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index 1061cdb89..85e7fc0af 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -26,6 +26,7 @@ function dfrn_poll_init(&$a) { } if(($dfrn_id === '') && (! x($_POST,'dfrn_id')) && ($a->argc > 1)) { + logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] ); header("Content-type: application/atom+xml"); $o = get_feed_for($a, '*', $a->argv[1],$last_update); echo $o; diff --git a/mod/follow.php b/mod/follow.php index a90ae3f51..62ba2585c 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -10,7 +10,9 @@ function follow_post(&$a) { // NOTREACHED } - $url = notags(trim($_POST['url'])); + $url = $orig_url = notags(trim($_POST['url'])); + + $email_conversant = false; if($url) { $links = lrdd($url); @@ -29,6 +31,11 @@ function follow_post(&$a) { } } + else { + if((strpos($orig_url,'@')) && validate_email($orig_url)) { + $email_conversant = true; + } + } } // If we find a DFRN site, send our subscriber to the other person's diff --git a/mod/item.php b/mod/item.php index 11e79a7ab..7125ae1f4 100644 --- a/mod/item.php +++ b/mod/item.php @@ -71,6 +71,7 @@ function item_post(&$a) { $location = notags(trim($_POST['location'])); $coord = notags(trim($_POST['coord'])); $verb = notags(trim($_POST['verb'])); + $emailcc = notags(trim($_POST['emailcc'])); if(! strlen($body)) { notice( t('Empty post discarded.') . EOL ); @@ -421,12 +422,39 @@ function item_post(&$a) { logger('mod_item: notifier invoked: ' . "\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &"); - proc_run($php_path, "include/notifier.php", $notify_type, "$post_id"); + proc_run($php_path, "include/notifier.php", $notify_type, "$post_id"); $datarray['id'] = $post_id; call_hooks('post_local_end', $datarray); - + + if(strlen($emailcc) && $profile_uid == local_user()) { + $erecips = explode(',', $emailcc); + if(count($erecips)) { + foreach($erecips as $recip) { + $addr = trim($recip); + if(! strlen($addr)) + continue; + $disclaimer = '<hr />' . t('This message was sent to you by ') . $a->user['username'] + . t(', a member of the Friendika social network.') . '<br />'; + $disclaimer .= t('You may visit them online at') . ' ' + . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '<br />'; + $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . '<br />'; + + $subject = '[Friendika]' . ' ' . $a->user['username'] . ' ' . t('posted an update.'); + $headers = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n"; + $headers .= 'MIME-Version: 1.0' . "\n"; + $headers .= 'Content-Type: text/html; charset=UTF-8' . "\n"; + $headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n"; + $link = '<a href="' . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />'; + $html = prepare_body($datarray); + $message = '<html><body>' . $link . $html . $disclaimer . '</body></html>'; + @mail($addr, $subject, $message, $headers); + } + } + } + + goaway($a->get_baseurl() . "/" . $_POST['return'] ); return; // NOTREACHED diff --git a/mod/network.php b/mod/network.php index 50d7134c1..80edca1d0 100644 --- a/mod/network.php +++ b/mod/network.php @@ -87,6 +87,8 @@ function network_content(&$a, $update = 0) { '$baseurl' => $a->get_baseurl(), '$defloc' => $a->user['default-location'], '$visitor' => 'block', + '$emailcc' => t('CC: email addresses'), + '$emtitle' => t('Example: bob@example.com, mary@example.com'), '$lockstate' => $lockstate, '$acl' => populate_acl((($group) ? $group_acl : $a->user), $celeb), '$bang' => (($group) ? '!' : ''), diff --git a/mod/profile.php b/mod/profile.php index c84b493c5..91c1ba6d8 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -144,6 +144,8 @@ function profile_content(&$a, $update = 0) { '$return_path' => $a->cmd, '$visitor' => (($is_owner || $commvisitor) ? 'block' : 'none'), '$lockstate' => $lockstate, + '$emailcc' => t('CC: email addresses'), + '$emtitle' => t('Example: bob@example.com, mary@example.com'), '$bang' => '', '$acl' => (($is_owner) ? populate_acl($a->user, $celeb) : ''), '$profile_uid' => $a->profile['profile_uid'], |