3 use Friendica\Database\DBM;
4 use Friendica\Protocol\Diaspora;
6 function contact_profile_assign($current,$foreign_net) {
10 $disabled = (($foreign_net) ? ' disabled="true" ' : '');
12 $o .= "<select id=\"contact-profile-selector\" class=\"form-control\" $disabled name=\"profile-assign\" >\r\n";
14 $r = q("SELECT `id`, `profile-name`, `is-default` FROM `profile` WHERE `uid` = %d",
15 intval($_SESSION['uid']));
17 if (DBM::is_result($r)) {
19 $selected = (($rr['id'] == $current || ($current == 0 && $rr['is-default'] == 1)) ? " selected=\"selected\" " : "");
20 $o .= "<option value=\"{$rr['id']}\" $selected >{$rr['profile-name']}</option>\r\n";
23 $o .= "</select>\r\n";
28 function contact_reputation($current) {
31 $o .= "<select id=\"contact-reputation-selector\" name=\"reputation\" />\r\n";
34 0 => t('Unknown | Not categorised'),
35 1 => t('Block immediately'),
36 2 => t('Shady, spammer, self-marketer'),
37 3 => t('Known to me, but no opinion'),
38 4 => t('OK, probably harmless'),
39 5 => t('Reputable, has my trust')
42 foreach ($rep as $k => $v) {
43 $selected = (($k == $current) ? " selected=\"selected\" " : "");
44 $o .= "<option value=\"$k\" $selected >$v</option>\r\n";
46 $o .= "</select>\r\n";
51 function contact_poll_interval($current, $disabled = false) {
53 $dis = (($disabled) ? ' disabled="disabled" ' : '');
55 $o .= "<select id=\"contact-poll-interval\" name=\"poll\" $dis />" . "\r\n";
60 2 => t('Twice daily'),
66 foreach ($rep as $k => $v) {
67 $selected = (($k == $current) ? " selected=\"selected\" " : "");
68 $o .= "<option value=\"$k\" $selected >$v</option>\r\n";
70 $o .= "</select>\r\n";
75 function network_to_name($s, $profile = "") {
78 NETWORK_DFRN => t('Friendica'),
79 NETWORK_OSTATUS => t('OStatus'),
80 NETWORK_FEED => t('RSS/Atom'),
81 NETWORK_MAIL => t('Email'),
82 NETWORK_DIASPORA => t('Diaspora'),
83 NETWORK_FACEBOOK => t('Facebook'),
84 NETWORK_ZOT => t('Zot!'),
85 NETWORK_LINKEDIN => t('LinkedIn'),
86 NETWORK_XMPP => t('XMPP/IM'),
87 NETWORK_MYSPACE => t('MySpace'),
88 NETWORK_MAIL2 => t('Email'),
89 NETWORK_GPLUS => t('Google+'),
90 NETWORK_PUMPIO => t('pump.io'),
91 NETWORK_TWITTER => t('Twitter'),
92 NETWORK_DIASPORA2 => t('Diaspora Connector'),
93 NETWORK_STATUSNET => t('GNU Social Connector'),
94 NETWORK_PNUT => t('pnut'),
95 NETWORK_APPNET => t('App.net')
98 call_hooks('network_to_name', $nets);
100 $search = array_keys($nets);
101 $replace = array_values($nets);
103 $networkname = str_replace($search, $replace, $s);
105 if ((in_array($s, array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) && ($profile != "")) {
106 $r = dba::fetch_first("SELECT `gserver`.`platform` FROM `gcontact`
107 INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url`
108 WHERE `gcontact`.`nurl` = ? AND `platform` != ''", normalise_link($profile));
110 if (DBM::is_result($r)) {
111 $networkname = $r['platform'];