Commit | Line | Data |
---|---|---|
e586807d H |
1 | <?php |
2 | ||
3 | function smarty_function_get_last($params,&$smarty) { | |
4 | ||
e586807d H |
5 | if ($params['listing_amount']=='all') $listing_amount='-1'; |
6 | else $listing_amount=addslashes($params['listing_amount']); | |
7 | if (empty($params['offset'])) $offset=0; | |
8 | else $offset=addslashes($params['offset']); | |
9 | ||
10 | global $db,$node; | |
b42b2bf9 H |
11 | |
12 | if ($node['node_id']==23) { | |
13 | $interval=" nodes.node_created>NOW()-INTERVAL 23 HOUR and"; | |
14 | $params['vector']="00"; | |
15 | } | |
16 | ||
17 | else { | |
18 | $vector=$node['node_vector']; | |
19 | $interval=" nodes.node_created>NOW()-INTERVAL 42 DAY and"; | |
20 | } | |
21 | ||
e586807d H |
22 | $node_id=$node['node_id']; |
23 | $user_id=$_SESSION['user_id']; | |
b42b2bf9 H |
24 | $q="select parent.node_name as parent_name,users.*,nodes.* from nodes |
25 | left join nodes as parent on parent.node_id=nodes.node_parent | |
26 | left join users on users.user_id=nodes.node_creator where $interval | |
27 | nodes.node_vector like '$vector%' and | |
28 | nodes.node_system_access!='private' order by nodes.node_id desc LIMIT $offset,$listing_amount "; | |
29 | ||
e586807d H |
30 | $set=$db->query($q); |
31 | while ($set->next()) $pole[]=$set->getRecord(); | |
32 | $smarty->assign('get_last',$pole); | |
33 | ||
34 | } | |
35 | ?> |