+ return $arr;
+ }
+
+ /**
+ * @brief Format the notification query in an usable array
+ *
+ * @param array $intros The array from the db query
+ * @return array with the introductions
+ */
+ private function formatIntros($intros) {
+ $knowyou = '';
+
+ foreach($intros as $it) {
+ // There are two kind of introduction. Contacts suggested by other contacts and normal connection requests.
+ // We have to distinguish between these two because they use different data.
+
+ // Contact suggestions
+ if($it['fid']) {
+
+ $return_addr = bin2hex($this->a->user['nickname'] . '@' . $this->a->get_hostname() . (($this->a->path) ? '/' . $this->a->path : ''));
+
+ $intro = array(
+ 'label' => 'friend_suggestion',
+ 'notify_type' => t('Friend Suggestion'),
+ 'intro_id' => $it['intro_id'],
+ 'madeby' => $it['name'],
+ 'contact_id' => $it['contact-id'],
+ 'photo' => ((x($it,'fphoto')) ? proxy_url($it['fphoto'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
+ 'name' => $it['fname'],
+ 'url' => zrl($it['furl']),
+ 'hidden' => $it['hidden'] == 1,
+ 'post_newfriend' => (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0),
+
+ 'knowyou' => $knowyou,
+ 'note' => $it['note'],
+ 'request' => $it['frequest'] . '?addr=' . $return_addr,
+
+ );
+
+ // Normal connection requests
+ } else {
+
+ // Probe the contact url to get missing data
+ $ret = probe_url($it["url"]);
+
+ if ($it['gnetwork'] == "")
+ $it['gnetwork'] = $ret["network"];
+
+ // Don't show these data until you are connected. Diaspora is doing the same.
+ if($it['gnetwork'] === NETWORK_DIASPORA) {
+ $it['glocation'] = "";
+ $it['gabout'] = "";
+ $it['ggender'] = "";
+ }
+ $intro = array(
+ 'label' => (($it['network'] !== NETWORK_OSTATUS) ? 'friend_request' : 'follower'),
+ 'notify_type' => (($it['network'] !== NETWORK_OSTATUS) ? t('Friend/Connect Request') : t('New Follower')),
+ 'dfrn_id' => $it['issued-id'],
+ 'uid' => $_SESSION['uid'],
+ 'intro_id' => $it['intro_id'],
+ 'contact_id' => $it['contact-id'],
+ 'photo' => ((x($it,'photo')) ? proxy_url($it['photo'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
+ 'name' => $it['name'],
+ 'location' => bbcode($it['glocation'], false, false),
+ 'about' => bbcode($it['gabout'], false, false),
+ 'keywords' => $it['gkeywords'],
+ 'gender' => $it['ggender'],
+ 'hidden' => $it['hidden'] == 1,
+ 'post_newfriend' => (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0),
+ 'url' => $it['url'],
+ 'zrl' => zrl($it['url']),
+ 'addr' => $ret['addr'],
+ 'network' => $it['gnetwork'],
+ 'knowyou' => $it['knowyou'],
+ 'note' => $it['note'],
+ );
+ }
+
+ $arr[] = $intro;