Kyberia v2.3 - 1st revision from SVN (Without patches of kyberia.sk team)
[mirrors/Kyberia-bloodline.git] / inc / smarty / node_methodz / function.get_userlist.php
1 <?php
2 function smarty_function_get_userlist($params,&$smarty) {
3 global $db,$node;
4 if (is_numeric($params['node_id'])) $node_id=$params['node_id'];
5
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.=" invisible != 'yes' and user_action_id IS NOT NULL order by login";
17
18 $set=$db->query($q);
19 while ($set->next()) {
20 if (!empty($_SESSION['friends'][$set->getString('user_id')])) {
21 $array=$set->getRecord();
22 $array['idle_time_minutes']=floor($array['idle']/60);
23 $array['idle_time_seconds']=$array['idle']%60;
24 $active_friends[]=$array;
25 }
26 else {
27 $array=$set->getRecord();
28 $array['idle_time_minutes']=floor($array['idle']/60);
29
30 $array['idle_time_seconds']=$array['idle']%60;
31 $active_users[]=$array;
32 }
33 }
34
35 $smarty->assign('active_users',$active_users);
36 $smarty->assign('active_friends',$active_friends);
37 }
38 ?>
This page took 0.262603 seconds and 4 git commands to generate.