]> git.mxchange.org Git - friendica.git/blob - mod/allfriends.php
Bugfix: The user id wasn't fetched correctly.
[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 .= replace_macros(get_markup_template("section_title.tpl"),array(
37                 '$title' => sprintf( t('Friends of %s'), $c[0]['name'])
38         ));
39
40
41         $r = all_friends(local_user(),$cid);
42
43         if(! count($r)) {
44                 $o .= t('No friends to display.');
45                 return $o;
46         }
47
48         $tpl = get_markup_template('common_friends.tpl');
49
50         foreach($r as $rr) {
51                         
52                 $o .= replace_macros($tpl,array(
53                         '$url' => $rr['url'],
54                         '$name' => $rr['name'],
55                         '$photo' => $rr['photo'],
56                         '$tags' => ''
57                 ));
58         }
59
60         $o .= cleardiv();
61 //      $o .= paginate($a);
62         return $o;
63 }