} else {
            $dl_icon = "nofile.gif";
            $dl_link = '';
            $dl_desc = $locale['PDP046'];
        }
    }
    echo '
<tr class="tbl' . (++$count % 2 + 1) . '">
	<td><a href="' . $dl_link . '" target="_blank">' . pdp_icon($dl_icon, $dl_desc) . '</a></td>
	<td><a href="' . FUSION_SELF . '?did=' . $download->id . '&amp;file_id=' . $fid . '#edit">' . pdp_icon('edit', $locale['pdp_edit']) . '</a></td>
	<td>' . $file['file_version'] . '</td>
	<td>' . $file['file_desc'] . '</td>
	<td>' . showdate('shortdate', $file['file_timestamp']) . '</td>
	<td>' . pdp_cleanup_filename($file['file_url']) . '</td>
	<td>' . $file['file_size'] . '</td>
	<td><a href="' . FUSION_SELF . '?did=' . $download->id . '&amp;file_id=' . $fid . '&amp;askdel=1">' . pdp_icon('editdelete', $locale['pdp_edit']) . '</a></td>
</tr>';
    //	echo "<tr><td class='tbl1'></td><td class='tbl1' colspan='5'>".$file['file_url']."</td></tr>\n";
}
if (dbrows($res)) {
    echo '
</tbody>
</table>

<p>
	<img src="icons/nofile.gif" alt=""> ' . $locale['PDP046'] . '
	<img src="icons/download.gif" alt=""> ' . $locale['PDP218'] . '
	<img src="icons/external.gif" alt=""> ' . $locale['PDP127'] . '
</p>';
}
pdp_close_tab();
	<th width="16"></th>
	<th>' . $locale['PDP025'] . ' [<a href="' . FUSION_SELF . '?did=' . $download->id . '#edit">' . $locale['pdp_new'] . '</a>]</th>
	<th>' . $locale['PDP217'] . '</th>
	<th width="16"></th>
</tr>
</thead>
<tbody>';
$count = 1;
while ($data = dbarray($res)) {
    $id = $data['pic_id'];
    echo '
<tr class="tbl' . (++$count % 2 + 1) . '">
	<td><a href="' . FUSION_SELF . '?did=' . $download->id . '&amp;pic_id=' . $id . '#edit">' . pdp_icon('edit', $locale['pdp_edit']) . '</a></td>
	<td>' . $data['pic_desc'] . '</td>
	<td><a href="' . $pdp->settings['upload_image'] . $data['pic_url'] . '">' . $data['pic_url'] . '</a></td>
	<td><a href="' . FUSION_SELF . '?did=' . $download->id . '&amp;pic_id=' . $id . '&amp;ask_del=1">' . pdp_icon('editdelete', $locale['pdp_delete']) . '</a></td>
</tr>';
}
echo '
</tbody>
</table>';
// ftp files
if (iPDP_MOD) {
    $files = array();
    $handle = opendir($pdp->settings['upload_image']);
    while (false !== ($file = readdir($handle))) {
        if (in_array($file, array(".", "..", "/", "index.php"))) {
            continue;
        }
        if (!is_dir($pdp->settings['upload_file'] . $file)) {
            $files[] = $file;
        $text = $cdata['comment_text'];
    }
    $name = $cdata['comment_user_name'];
    if ($cdata['user_id']) {
        $name = "<a href='profile.php?id=" . $cdata['user_id'] . "'>" . $name . "</a>";
    }
    echo '
<tr>
	<td class="tbl1" align="center" valign="top" rowspan="2">
		<input type="checkbox" name="comment[' . $id . ']">
	</td>
	<td class="tbl2">
		' . $name . ' - ' . showdate('longdate', $cdata['comment_timestamp']) . ' - ' . $locale['PDP380'] . ': ' . $cdata['comment_ip'] . '
	</td>
	<td width="16" class="tbl2">
		<a href="' . FUSION_SELF . '?did=' . $download->id . '&amp;id=' . $id . '">' . pdp_icon('edit', $locale['pdp_edit']) . '</a>
	</td>
</tr>
	<td class="tbl1" colspan="2">' . parseubb($text) . '</td>
</tr>';
}
if (dbrows($res)) {
    echo '
</tbody>
</table>

<p>
<input type="checkbox" name="delete_comments">
<label>' . $locale['PDP008'] . '</label>

<p>
<input type="submit" class="button" name="check_download" value="' . $locale['PDP502'] . '">
</form>';
        } else {
            echo '
<form method="post" action="edit_misc.php?did=' . $download->id . '">
<input type="hidden" name="oh_yeah" value="jip">
<input type="submit" class="button" name="check_download" value="' . $locale['PDP505'] . '">
</form>';
        }
    }
    echo '
	</td>';
    if (iPDP_ADMIN) {
        echo '
	<td colspan="2" style="text-align:right;">
		<a href="admin/admin.php">' . pdp_icon('configure', $locale['PDP016']) . ' ' . $locale['PDP016'] . '</a>
	</td>';
    }
    echo '
</tr>
<tr>
	' . $items2 . '
</tr>
</tbody>
</table>';
    echo '
<hr />';
}
function pdp_process_errno($errno)
{
    global $locale;
        fallback(FUSION_SELF . "?new=1");
    }
    echo "<p>" . $locale['PDP825'];
}
foreach ($cats_for_table as $cid => $data) {
    $edit_icon = '<a href="' . FUSION_SELF . '?id=' . $cid . '&amp;edit=1">' . pdp_icon('edit', $locale['pdp_edit']) . '</a>';
    $sorting = explode(' ', $data['sorting']);
    $dl_count = ff_db_count('(*)', DB_PDP_DOWNLOADS, "(cat_id='{$cid}')");
    $child_cats = ff_db_count('(*)', DB_PDP_CATS, "(top_cat='{$cid}')");
    if ($dl_count || $child_cats) {
        $del_icon = pdp_icon('nodelete.gif', $locale['pdp_nodelete']);
    } else {
        $del_icon = "<a href='" . FUSION_SELF . "?id={$cid}&amp;del=1'" . " title='" . $locale['pdp_delete'] . "'>" . pdp_icon('editdelete', $locale['pdp_delete']) . '</a>';
    }
    if ($dl_count) {
        $view_icon = '<a href="downloads.php?show=cat&amp;id=' . $cid . '">' . pdp_icon('viewmag', $locale['pdp_view']) . '</a>';
    } else {
        $view_icon = '';
    }
    //	$order_cols = "<td class='$tbl'>".str_repeat("&nbsp;", $data['level']*5)
    //		.$data['order'].":".$data['level']."</td>";
    $order_cols = "";
    for ($i = 0; $i < $data['level']; ++$i) {
        $order_cols .= "<td></td>";
    }
    $order_cols .= "<td>" . $data['order'] . "</td>";
    for ($i = $data['level'] + 1; $i < $maxlevel; ++$i) {
        $order_cols .= "<td></td>";
    }
    echo '
<tr class="tbl' . (1 + ++$count % 2) . '">
    $id = $data['license_id'];
    $count = ff_db_count("(*)", DB_PDP_DOWNLOADS, "(license_id='{$id}')");
    if ($count) {
        $del_icon = pdp_icon('nodelete.gif', $locale['pdp_nodelete']);
    } else {
        $del_icon = '<a href="' . FUSION_SELF . '?id=' . $id . '&amp;del=1"' . " title='" . $locale['pdp_delete'] . "'>" . pdp_icon('editdelete', $locale['pdp_delete']) . '</a>';
    }
    if ($count) {
        $view_icon = '<a href="downloads.php?show=license&amp;id=' . $id . '">' . pdp_icon('viewmag', $locale['pdp_view']) . '</a>';
    } else {
        $view_icon = '';
    }
    echo '
<tr class="tbl' . (++$lcount % 2 + 1) . '">
	<td>
		<a href="' . FUSION_SELF . '?id=' . $id . '&amp;edit=1">' . pdp_icon('edit', $locale['pdp_edit']) . '</a>
	</td>
	<td>' . $data['license_name'] . '</td>
	<td>' . $data['length'] . '</td>
	<td width="16">' . $view_icon . '</td>
	<td>' . $count . '</td>
	<td>' . $del_icon . '</td>
</tr>';
}
if (dbrows($res)) {
    echo '
</tbody>
</table>';
}
closetable();
require_once '../include/die.php';
</tr>
</thead>
<tbody>';
}
$count = 1;
while ($data = dbarray($res)) {
    $id = $data['download_id'];
    echo '
<tr class="tbl' . (++$count % 2 + 1) . '">
	<td>' . $locale['PDP904'][$data['dl_status']] . '</td>
	<td><a href="../edit_desc.php?did=' . $id . '">' . pdp_icon('edit', $locale['pdp_edit']) . '</a></td>
	<td><a href="../download.php?did=' . $id . '">' . $data['dl_name'] . '</a></td>
	<td>' . $data['cat_name'] . '</td>
	<td align="center">
		<a href="../profile.php?id=' . $data['user_id'] . '">' . $data['user_name'] . '</a><br />' . showdate("shortdate", $data['dl_mtime']) . '</td>
	<td><a href="del_download.php?did=' . $id . '">' . pdp_icon('editdelete', $locale['pdp_delete']) . '</a></td>
</tr>';
}
if (dbrows($res)) {
    echo '
</tbody>
</table>';
}
if ($all_downloads > $pdp->settings['per_page']) {
    $link = FUSION_SELF . "?show={$show}&";
    if (($show == "cat" || $show == "license") && isset($_GET['id']) && isNum($_GET['id'])) {
        $link .= "id=" . $_GET['id'] . "&";
    }
    echo makePageNav($rowstart, $pdp->settings['per_page'], $all_downloads, $all_downloads, $link);
}
closetable();