Commit | Line | Data |
---|---|---|
e586807d H |
1 | |
2 | <?php | |
3 | function smarty_function_get_userlist($params,&$smarty) { | |
4 | global $db,$node; | |
5 | if (is_numeric($params['node_id'])) $node_id=$params['node_id']; | |
6 | else $node_id=$node['node_id']; | |
7 | if ($params['vector']) { | |
8 | $vector=AddSlashes($params['vector']); | |
9 | } | |
10 | if ($_SESSION['cube_vector']) { | |
11 | $vector=$_SESSION['cube_vector']; | |
12 | } | |
13 | ||
14 | $q="select user_action,user_action_id,(UNIX_TIMESTAMP()-UNIX_TIMESTAMP(last_action)) as idle,login,user_id from users where "; | |
15 | if ($vector) $q.=" user_location_vector like '$vector%' and "; | |
16 | $q.=" user_action_id IS NOT NULL order by login"; | |
17 | ||
18 | $set=$db->query($q); | |
19 | ||
20 | ||
21 | while ($set->next()) { | |
22 | ||
23 | if (!empty($_SESSION['friends'][$set->getString('user_id')])) { | |
24 | $array=$set->getRecord(); | |
25 | $array['idle_time_minutes']=floor($array['idle']/60); | |
26 | $array['idle_time_seconds']=$array['idle']%60; | |
27 | $active_friends[]=$array; | |
28 | ||
29 | } | |
30 | else { | |
31 | $array=$set->getRecord(); | |
32 | $array['idle_time_minutes']=floor($array['idle']/60); | |
33 | $array['idle_time_seconds']=$array['idle']%60; | |
34 | $active_users[]=$array; | |
35 | ||
36 | } | |
37 | } | |
38 | ||
39 | $smarty->assign('active_users',$active_users); | |
40 | ||
41 | $smarty->assign('active_friends',$active_friends); | |
42 | ||
43 | ||
44 | ||
45 | } | |
46 | ?> |