| 1 | <?php |
| 2 | function smarty_function_get_temp_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 COUNT(I.node_id) as count,length(concat(nodes.node_vector)) as vector_depth,nodes.*,nodes.node_creator as node_owner_id,creator.node_name as owner, |
| 18 | node_parent.node_name as node_parent_name |
| 19 | from I left join nodes on nodes.node_id=I.node_id |
| 20 | left join nodes as creator on creator.node_id=nodes.node_creator |
| 21 | left join nodes as node_parent on nodes.node_parent=node_parent.node_id |
| 22 | where cas>NOW()-INTERVAL $interval HOUR and nodes.node_system_access='public' |
| 23 | and nodes.node_vector like '$vector%' |
| 24 | GROUP BY I.node_id ORDER BY count desc"; |
| 25 | |
| 26 | $set=$db->query($q); |
| 27 | while ($set->next()) { |
| 28 | $k_array[]=$set->getRecord(); |
| 29 | } |
| 30 | |
| 31 | $smarty->assign('get_temp_k',$k_array); |
| 32 | |
| 33 | |
| 34 | |
| 35 | } |
| 36 | ?> |
| 37 | |