]> git.mxchange.org Git - friendica.git/blob - mod/suggest.php
rev update
[friendica.git] / mod / suggest.php
1 <?php
2
3 require_once('include/socgraph.php');
4 require_once('include/contact_widgets.php');
5
6
7 function suggest_init(&$a) {
8         if(! local_user())
9                 return;
10
11         if(x($_GET,'ignore') && intval($_GET['ignore'])) {
12                 q("insert into gcign ( uid, gcid ) values ( %d, %d ) ",
13                         intval(local_user()),
14                         intval($_GET['ignore'])
15                 );
16         }
17
18 }
19                 
20
21
22
23
24 function suggest_content(&$a) {
25
26         $o = '';
27         if(! local_user()) {
28                 notice( t('Permission denied.') . EOL);
29                 return;
30         }
31
32         $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
33
34         $a->page['aside'] .= follow_widget();
35         $a->page['aside'] .= findpeople_widget();
36
37
38         $o .= '<h2>' . t('Friend Suggestions') . '</h2>';
39
40
41         $r = suggestion_query(local_user());
42
43         if(! count($r)) {
44                 $o .= t('No suggestions available. If this is a new site, please try again in 24 hours.');
45                 return $o;
46         }
47
48         $tpl = get_markup_template('suggest_friends.tpl');
49
50         foreach($r as $rr) {
51
52                 $connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']);                      
53
54                 $o .= replace_macros($tpl,array(
55                         '$url' => zrl($rr['url']),
56                         '$name' => $rr['name'],
57                         '$photo' => $rr['photo'],
58                         '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'],
59                         '$conntxt' => t('Connect'),
60                         '$connlnk' => $connlnk,
61                         '$ignore' => t('Ignore/Hide')
62                 ));
63         }
64
65         $o .= cleardiv();
66 //      $o .= paginate($a);
67         return $o;
68 }