51ff3226 |
1 | <?php |
2 | function smarty_function_get_image_link($params,&$smarty) { |
3 | global $db; |
4 | $id = $params['id']; |
5 | $img = SYSTEM_ROOT."/images/nodes/".substr($id,0,1)."/".substr($id,1,1)."/$id.gif"; |
6 | |
7 | if (file_exists($img)) { |
8 | echo "/images/nodes/".substr($id,0,1)."/".substr($id,1,1)."/$id.gif"; |
9 | } |
10 | else { |
11 | $set = $db->query("select user_id from users where user_id = $id"); |
1e66e7ac |
12 | if ($set->getNumRows() > 0) { |
13 | $imglink = "/images/nodes///.gif"; |
14 | } else { |
15 | $imglink = "/images/nodes/1/0/101.gif"; |
16 | } |
51ff3226 |
17 | echo $imglink; |
18 | } |
19 | } |
1e66e7ac |
20 | |
51ff3226 |
21 | ?> |