]> git.mxchange.org Git - friendica.git/blob - mod/allfriends.php
Merge pull request #1618 from rabuzarus/vcard
[friendica.git] / mod / allfriends.php
1 <?php
2
3 require_once('include/socgraph.php');
4
5 function allfriends_content(&$a) {
6
7         $o = '';
8         if(! local_user()) {
9                 notice( t('Permission denied.') . EOL);
10                 return;
11         }
12
13         if($a->argc > 1)
14                 $cid = intval($a->argv[1]);
15         if(! $cid)
16                 return;
17
18         $c = q("select name, url, photo from contact where id = %d and uid = %d limit 1",
19                 intval($cid),
20                 intval(local_user())
21         );
22
23         $vcard_widget .= replace_macros(get_markup_template("vcard-widget.tpl"),array(
24                 '$name' => $c[0]['name'],
25                 '$photo' => $c[0]['photo'],
26                 'url' => z_root() . '/contacts/' . $cid
27                 ));
28
29         if(! x($a->page,'aside'))
30                 $a->page['aside'] = '';
31         $a->page['aside'] .= $vcard_widget;
32
33         if(! count($c))
34                 return;
35
36         $o .= '<h2>' . sprintf( t('Friends of %s'), $c[0]['name']) . '</h2>';
37
38
39         $r = all_friends(local_user(),$cid);
40
41         if(! count($r)) {
42                 $o .= t('No friends to display.');
43                 return $o;
44         }
45
46         $tpl = get_markup_template('common_friends.tpl');
47
48         foreach($r as $rr) {
49                         
50                 $o .= replace_macros($tpl,array(
51                         '$url' => $rr['url'],
52                         '$name' => $rr['name'],
53                         '$photo' => $rr['photo'],
54                         '$tags' => ''
55                 ));
56         }
57
58         $o .= cleardiv();
59 //      $o .= paginate($a);
60         return $o;
61 }