| 1 | <?php |
| 2 | |
| 3 | function smarty_function_get_tiamat($params,&$smarty) { |
| 4 | global $db, $error, $node; |
| 5 | |
| 6 | if ($params['listing_amount']=='all') $listing_amount='23232323232323323'; |
| 7 | elseif (is_numeric($params['listing_amount'])) $listing_amount=$params['listing_amount']; |
| 8 | else $listing_amount=DEFAULT_LISTING_AMOUNT; |
| 9 | |
| 10 | if (is_numeric($params['offset'])) $offset=$params['offset']; |
| 11 | elseif (is_numeric($_POST['offset'])) $offset=$_POST['offset']; |
| 12 | else $offset=0; |
| 13 | |
| 14 | |
| 15 | |
| 16 | if (is_numeric($params['node_id'])) { |
| 17 | $node_id=$params['node_id']; |
| 18 | $where=" and node_id = '$node_id'"; |
| 19 | } |
| 20 | |
| 21 | elseif ($params['all']) {} |
| 22 | |
| 23 | elseif ($params['node_vector']) { |
| 24 | $vector=$node['node_vector']; |
| 25 | $where=" and node_vector like '$vector%'"; |
| 26 | } |
| 27 | |
| 28 | else { |
| 29 | $node_id=$node['node_id']; |
| 30 | $where=" and node_id = '$node_id'"; |
| 31 | |
| 32 | } |
| 33 | $q="select users.login,tiamat.* from tiamat left join users on tiamat.node_destructor=users.user_id where node_system_access!='private' $where order by update_performed desc limit $offset , $listing_amount"; |
| 34 | echo $q; |
| 35 | $result=$db->query($q); |
| 36 | while ($result->next()) { |
| 37 | $array=$result->getRecord(); |
| 38 | $get_tiamat[]=$array; |
| 39 | |
| 40 | |
| 41 | } |
| 42 | $smarty->assign('get_tiamat',$get_tiamat); |
| 43 | |
| 44 | } |
| 45 | |
| 46 | ?> |