$row = $db->fetch_assoc($result); $my->p = $slog->Permissions($row['board']); $uppath = 'uploads/topics/' . $row['file']; if ($db->num_rows($result) != 1) { $thumb->create_error('#2 ' . $lang->phrase('thumb_error')); } if ($my->p['forum'] == 0 || $my->p['downloadfiles'] == 0) { $thumb->create_error('#3 ' . $lang->phrase('thumb_error')); } if (!file_exists($uppath)) { $thumb->create_error('#4 ' . $lang->phrase('thumb_error')); } $chachepath = 'uploads/topics/thumbnails/' . $row['id'] . get_extension($uppath); $thumb->set_cacheuri($chachepath); if (file_exists($chachepath) == FALSE) { $thumbnail_source = $thumb->create_thumbnail($uppath); $thumb->create_image($thumbnail_source); } $thumb->get_image(); exit; } } elseif ($_GET['action'] == "attachment") { if ($_GET['id'] < 1) { echo $tpl->parse("header"); error($lang->phrase('no_id_given')); } else { $result = $db->query(' SELECT u.tid, u.file, t.board FROM ' . $db->pre . 'uploads AS u LEFT JOIN ' . $db->pre . 'topics AS t ON t.id = u.tid WHERE u.id = ' . $_GET['id'] . ' AND u.tid > 0 LIMIT 1