51ff3226 |
1 | <?php |
2 | function smarty_function_get_k($params,&$smarty) { |
3 | |
4 | global $db,$node; |
5 | if (is_numeric($params['offset'])) $offset=$params['offset']; |
6 | else $offset=0; |
7 | if (is_numeric($params['listing_amount'])) $listing_amount=$params['listing_amount']; |
8 | else $listing_amount=DEFAULT_LISTING_AMOUNT; |
9 | if (!is_numeric($_POST['interval'])) $interval=1; |
10 | else $interval = $_POST['interval']; |
11 | if ($params['vector']) { |
12 | $vector=$params['vector']; |
13 | $interval=365; |
14 | } |
15 | else $vector="00"; |
16 | |
17 | $q="select nodes.*,parent.node_name as parent_name,users.login as creator |
18 | from nodes left join nodes as parent on nodes.node_parent=parent.node_id |
19 | left join users on users.user_id=nodes.node_creator where nodes.node_created>now()-interval $interval day |
20 | and nodes.node_vector like '$vector%' and nodes.k>0 and nodes.node_system_access!='private' order by nodes.k desc limit $offset,$listing_amount"; |
21 | |
22 | $set=$db->query($q); |
23 | while ($set->next()) { |
24 | $k_array[]=$set->getRecord(); |
25 | } |
26 | |
27 | $smarty->assign('get_k',$k_array); |
28 | |
29 | |
30 | |
31 | } |
32 | ?> |