aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/conversation.php35
-rw-r--r--include/enotify.php13
-rw-r--r--include/items.php13
3 files changed, 46 insertions, 15 deletions
diff --git a/include/conversation.php b/include/conversation.php
index 1b1d09d6b..a30a78271 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -902,29 +902,35 @@ function conv_sort($arr,$order) {
elseif(stristr($order,'commented'))
usort($parents,'sort_thr_commented');
- foreach($parents as $x)
- $x['children'] = array();
+ if(count($parents))
+ foreach($parents as $x)
+ $x['children'] = array();
foreach($arr as $x) {
if($x['id'] != $x['parent']) {
$p = find_thread_parent_index($parents,$x);
- $parents[$p]['children'][] = $x;
+ if($p !== false)
+ $parents[$p]['children'][] = $x;
}
}
- foreach($parents as $k => $v) {
- if(count($parents[$k]['children'])) {
- $y = $parents[$k]['children'];
- usort($y,'sort_thr_created_rev');
- $parents[$k]['children'] = $y;
- }
+ if(count($parents)) {
+ foreach($parents as $k => $v) {
+ if(count($parents[$k]['children'])) {
+ $y = $parents[$k]['children'];
+ usort($y,'sort_thr_created_rev');
+ $parents[$k]['children'] = $y;
+ }
+ }
}
$ret = array();
- foreach($parents as $x) {
- $ret[] = $x;
- if(count($x['children']))
- foreach($x['children'] as $y)
- $ret[] = $y;
+ if(count($parents)) {
+ foreach($parents as $x) {
+ $ret[] = $x;
+ if(count($x['children']))
+ foreach($x['children'] as $y)
+ $ret[] = $y;
+ }
}
return $ret;
@@ -947,4 +953,5 @@ function find_thread_parent_index($arr,$x) {
foreach($arr as $k => $v)
if($v['id'] == $x['parent'])
return $k;
+ return false;
} \ No newline at end of file
diff --git a/include/enotify.php b/include/enotify.php
index f6f291e5d..9df9b57e5 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -65,6 +65,19 @@ function notification($params) {
$itemlink = $params['link'];
}
+ if($params['type'] == NOTIFY_SUGGEST) {
+ $subject = sprintf( t('Friend suggestion received at %s'), $sitename);
+ $preamble = sprintf( t('You\'ve received a friend suggestion from \'%s\' at %s'), $params['source_name'], $sitename);
+ $body = t('Name:') . ' ' . $params['item']['name'] . "\n";
+ $body .= t('Photo:') . ' ' . $params['item']['photo'] . "\n";
+ $body .= sprintf( t('You may visit their profile at %s'),$params['item']['url']);
+
+ $sitelink = t('Please visit %s to approve or reject the suggestion.');
+ $tsitelink = sprintf( $sitelink, $siteurl );
+ $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
+ $itemlink = $params['link'];
+ }
+
if($params['type'] == NOTIFY_CONFIRM) {
}
diff --git a/include/items.php b/include/items.php
index 7f003ab57..9f006306f 100644
--- a/include/items.php
+++ b/include/items.php
@@ -1788,7 +1788,18 @@ function local_delivery($importer,$data) {
intval(0)
);
- // TODO - send email notify (which may require a new notification preference)
+ notification(array(
+ 'type' => NOTIFY_SUGGEST,
+ 'notify_flags' => $importer['notify-flags'],
+ 'language' => $importer['language'],
+ 'to_name' => $importer['username'],
+ 'to_email' => $importer['email'],
+ 'item' => $fsugg,
+ 'link' => $a->get_baseurl() . '/notifications/intros',
+ 'source_name' => $importer['name'],
+ 'source_link' => $importer['url'],
+ 'source_photo' => $importer['photo']
+ ));
return 0;
}