3 function follow_widget() {
5 return replace_macros(get_markup_template('follow.tpl'),array(
6 '$connect' => t('Add New Contact'),
7 '$desc' => t('Enter address or web location'),
8 '$hint' => t('Example: bob@example.com, http://example.com/barbara'),
9 '$follow' => t('Connect')
14 function findpeople_widget() {
15 require_once('include/Contact.php');
19 if(get_config('system','invitation_only')) {
20 $x = get_pconfig(local_user(),'system','invites_remaining');
21 if($x || is_site_admin()) {
22 $a->page['aside'] .= '<div class="side-link" id="side-invite-remain">'
23 . sprintf( tt('%d invitation available','%d invitations available',$x), $x)
28 return replace_macros(get_markup_template('peoplefind.tpl'),array(
29 '$findpeople' => t('Find People'),
30 '$desc' => t('Enter name or interest'),
31 '$label' => t('Connect/Follow'),
32 '$hint' => t('Examples: Robert Morgenstein, Fishing'),
33 '$findthem' => t('Find'),
34 '$suggest' => t('Friend Suggestions'),
35 '$similar' => t('Similar Interests'),
36 '$random' => t('Random Profile'),
37 '$inv' => t('Invite Friends')
43 function networks_widget($baseurl,$selected = '') {
50 if(! feature_enabled(local_user(),'networks'))
53 $r = q("select distinct(network) from contact where uid = %d and self = 0",
59 require_once('include/contact_selectors.php');
62 $nets[] = array('ref' => $rr['network'], 'name' => network_to_name($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' ));
69 return replace_macros(get_markup_template('nets.tpl'),array(
70 '$title' => t('Networks'),
72 '$sel_all' => (($selected == '') ? 'selected' : ''),
73 '$all' => t('All Networks'),
80 function fileas_widget($baseurl,$selected = '') {
85 if(! feature_enabled(local_user(),'filing'))
88 $saved = get_pconfig(local_user(),'system','filetags');
94 $cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
96 foreach($matches as $mtch) {
97 $unescaped = xmlify(file_tag_decode($mtch[1]));
98 $terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
102 return replace_macros(get_markup_template('fileas_widget.tpl'),array(
103 '$title' => t('Saved Folders'),
105 '$sel_all' => (($selected == '') ? 'selected' : ''),
106 '$all' => t('Everything'),
113 function categories_widget($baseurl,$selected = '') {
117 if(! feature_enabled($a->profile['profile_uid'],'categories'))
120 $saved = get_pconfig($a->profile['profile_uid'],'system','filetags');
126 $cnt = preg_match_all('/<(.*?)>/',$saved,$matches,PREG_SET_ORDER);
128 foreach($matches as $mtch) {
129 $unescaped = xmlify(file_tag_decode($mtch[1]));
130 $terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
134 return replace_macros(get_markup_template('categories_widget.tpl'),array(
135 '$title' => t('Categories'),
137 '$sel_all' => (($selected == '') ? 'selected' : ''),
138 '$all' => t('Everything'),
145 function common_friends_visitor_widget($profile_uid) {
149 if(local_user() == $profile_uid)
154 if(is_array($_SESSION['remote'])) {
155 foreach($_SESSION['remote'] as $visitor) {
156 if($visitor['uid'] == $profile_uid) {
157 $cid = $visitor['cid'];
165 $r = q("select id from contact where nurl = '%s' and uid = %d limit 1",
166 dbesc(normalise_link(get_my_url())),
172 $r = q("select id from gcontact where nurl = '%s' limit 1",
173 dbesc(normalise_link(get_my_url()))
181 if($cid == 0 && $zcid == 0)
184 require_once('include/socgraph.php');
187 $t = count_common_friends($profile_uid,$cid);
189 $t = count_common_friends_zcid($profile_uid,$zcid);
194 $r = common_friends($profile_uid,$cid,0,5,true);
196 $r = common_friends_zcid($profile_uid,$zcid,0,5,true);
198 return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
199 '$desc' => sprintf( tt("%d contact in common", "%d contacts in common", $t), $t),
200 '$base' => $a->get_baseurl(),
201 '$uid' => $profile_uid,
202 '$cid' => (($cid) ? $cid : '0'),
203 '$linkmore' => (($t > 5) ? 'true' : ''),
204 '$more' => t('show more'),