]> git.mxchange.org Git - friendica.git/blob - include/contact_selectors.php
Merge remote branch 'upstream/master'
[friendica.git] / include / contact_selectors.php
1 <?php
2
3
4 function contact_profile_assign($current,$foreign_net) {
5
6         $o = '';
7
8         $disabled = (($foreign_net) ? ' disabled="true" ' : '');
9
10         $o .= "<select id=\"contact-profile-selector\" $disabled name=\"profile-assign\" />\r\n";
11
12         $r = q("SELECT `id`, `profile-name` FROM `profile` WHERE `uid` = %d",
13                         intval($_SESSION['uid']));
14
15         if(count($r)) {
16                 foreach($r as $rr) {
17                         $selected = (($rr['id'] == $current) ? " selected=\"selected\" " : "");
18                         $o .= "<option value=\"{$rr['id']}\" $selected >{$rr['profile-name']}</option>\r\n";
19                 }
20         }
21         $o .= "</select>\r\n";
22         return $o;
23 }
24
25
26 function contact_reputation($current) {
27
28         $o = '';
29         $o .= "<select id=\"contact-reputation-selector\" name=\"reputation\" />\r\n";
30
31         $rep = array(
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')
38         );
39
40         foreach($rep as $k => $v) {
41                 $selected = (($k == $current) ? " selected=\"selected\" " : "");
42                 $o .= "<option value=\"$k\" $selected >$v</option>\r\n";
43         }
44         $o .= "</select>\r\n";
45         return $o;
46 }
47
48
49 function contact_poll_interval($current, $disabled = false) {
50
51         $dis = (($disabled) ? ' disabled="disabled" ' : '');
52         $o = '';
53         $o .= "<select id=\"contact-poll-interval\" name=\"poll\" $dis />" . "\r\n";
54
55         $rep = array(
56                 0 => t('Frequently'),
57                 1 => t('Hourly'),
58                 2 => t('Twice daily'),
59                 3 => t('Daily'),
60                 4 => t('Weekly'),
61                 5 => t('Monthly')
62         );
63
64         foreach($rep as $k => $v) {
65                 $selected = (($k == $current) ? " selected=\"selected\" " : "");
66                 $o .= "<option value=\"$k\" $selected >$v</option>\r\n";
67         }
68         $o .= "</select>\r\n";
69         return $o;
70 }
71
72
73 function network_to_name($s) {
74
75         call_hooks('network_to_name', $s);
76
77         return str_replace(array(NETWORK_DFRN,NETWORK_OSTATUS,NETWORK_FEED,NETWORK_MAIL,NETWORK_DIASPORA,NETWORK_FACEBOOK,NETWORK_ZOT),
78                 array(t('Friendika'),t('OStatus'),t('RSS/Atom'),t('Email'),t('Diaspora'),t('Facebook'),t('Zot!')),$s);
79
80 }