51ff3226 |
1 | <?php |
2 | |
3 | function smarty_function_get_last($params,&$smarty) { |
4 | |
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; |
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 | |
22 | $node_id=$node['node_id']; |
23 | $user_id=$_SESSION['user_id']; |
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 | |
30 | $set=$db->query($q); |
31 | while ($set->next()) $pole[]=$set->getRecord(); |
32 | $smarty->assign('get_last',$pole); |
33 | |
34 | } |
35 | ?> |