2 require_once('include/diaspora.php');
4 function contact_profile_assign($current,$foreign_net) {
8 $disabled = (($foreign_net) ? ' disabled="true" ' : '');
10 $o .= "<select id=\"contact-profile-selector\" class=\"form-control\" $disabled name=\"profile-assign\" />\r\n";
12 $r = q("SELECT `id`, `profile-name`, `is-default` FROM `profile` WHERE `uid` = %d",
13 intval($_SESSION['uid']));
15 if (dbm::is_result($r)) {
17 $selected = (($rr['id'] == $current || ($current == 0 && $rr['is-default'] == 1)) ? " selected=\"selected\" " : "");
18 $o .= "<option value=\"{$rr['id']}\" $selected >{$rr['profile-name']}</option>\r\n";
21 $o .= "</select>\r\n";
26 function contact_reputation($current) {
29 $o .= "<select id=\"contact-reputation-selector\" name=\"reputation\" />\r\n";
32 0 => t('Unknown | Not categorised'),
33 1 => t('Block immediately'),
34 2 => t('Shady, spammer, self-marketer'),
35 3 => t('Known to me, but no opinion'),
36 4 => t('OK, probably harmless'),
37 5 => t('Reputable, has my trust')
40 foreach ($rep as $k => $v) {
41 $selected = (($k == $current) ? " selected=\"selected\" " : "");
42 $o .= "<option value=\"$k\" $selected >$v</option>\r\n";
44 $o .= "</select>\r\n";
49 function contact_poll_interval($current, $disabled = false) {
51 $dis = (($disabled) ? ' disabled="disabled" ' : '');
53 $o .= "<select id=\"contact-poll-interval\" name=\"poll\" $dis />" . "\r\n";
58 2 => t('Twice daily'),
64 foreach ($rep as $k => $v) {
65 $selected = (($k == $current) ? " selected=\"selected\" " : "");
66 $o .= "<option value=\"$k\" $selected >$v</option>\r\n";
68 $o .= "</select>\r\n";
73 function network_to_name($s, $profile = "") {
76 NETWORK_DFRN => t('Friendica'),
77 NETWORK_OSTATUS => t('OStatus'),
78 NETWORK_FEED => t('RSS/Atom'),
79 NETWORK_MAIL => t('Email'),
80 NETWORK_DIASPORA => t('Diaspora'),
81 NETWORK_FACEBOOK => t('Facebook'),
82 NETWORK_ZOT => t('Zot!'),
83 NETWORK_LINKEDIN => t('LinkedIn'),
84 NETWORK_XMPP => t('XMPP/IM'),
85 NETWORK_MYSPACE => t('MySpace'),
86 NETWORK_MAIL2 => t('Email'),
87 NETWORK_GPLUS => t('Google+'),
88 NETWORK_PUMPIO => t('pump.io'),
89 NETWORK_TWITTER => t('Twitter'),
90 NETWORK_DIASPORA2 => t('Diaspora Connector'),
91 NETWORK_STATUSNET => t('GNU Social Connector'),
92 NETWORK_PNUT => t('pnut'),
93 NETWORK_APPNET => t('App.net')
96 call_hooks('network_to_name', $nets);
98 $search = array_keys($nets);
99 $replace = array_values($nets);
101 $networkname = str_replace($search, $replace, $s);
103 if ((in_array($s, array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) AND ($profile != "")) {
104 $r = q("SELECT `gserver`.`platform` FROM `gcontact`
105 INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url`
106 WHERE `gcontact`.`nurl` = '%s' AND `platform` != ''",
107 dbesc(normalise_link($profile)));
108 if (dbm::is_result($r)) {
109 $networkname = $r[0]["platform"];