| 1 | <?php |
| 2 | |
| 3 | function smarty_function_testm($params,&$smarty) { |
| 4 | |
| 5 | |
| 6 | $external_link=$params['external_link']; |
| 7 | if ($params['listing_amount']=='all') |
| 8 | $listing_amount='23232323232323323'; |
| 9 | elseif (is_numeric($params['listing_amount'])) |
| 10 | $listing_amount=$params['listing_amount']; |
| 11 | else $listing_amount=DEFAULT_LISTING_AMOUNT; |
| 12 | |
| 13 | if (empty($params['offset'])) $offset=0; |
| 14 | else $offset=$params['offset']; |
| 15 | |
| 16 | global $db,$node; |
| 17 | if (is_numeric($params['creator_id'])) $creator_id=$params['creator_id']; |
| 18 | else $creator_id=$node['node_id']; |
| 19 | if (is_numeric($params['template_id'])) $template_id=$params['template_id']; |
| 20 | else $template_id=DEFAULT_TEMPLATE; |
| 21 | |
| 22 | $user_id=$_SESSION['user_id']; |
| 23 | |
| 24 | $q="select parent.node_name as |
| 25 | parent_name,nodes.* from nodes |
| 26 | left join nodes as parent on parent.node_id=nodes.node_parent |
| 27 | where nodes.node_creator='$creator_id' and |
| 28 | nodes.external_link='$external_link' and |
| 29 | nodes.node_system_access!='private' order by |
| 30 | nodes.node_created desc LIMIT $offset,$listing_amount"; |
| 31 | |
| 32 | $set=$db->query($q); |
| 33 | while ($set->next()) $pole[]=$set->getRecord(); |
| 34 | $smarty->assign('testm',$pole); |
| 35 | } |
| 36 | ?> |