Пример #1
0
$item = new DTSoftware($id);
if ($item->getVar('approved')) {
    $canview = true;
} else {
    $canview = $xoopsUser->isAdmin() || $xoopsUser->uid() == $item->getVar('uid');
}
if ($item->isNew() || !$canview) {
    redirect_header(DT_URL, 2, __('Specified item does not exists!', 'dtransport'));
    die;
}
if ($item->getVar('delete')) {
    redirect_header(DT_URL, 2, __('This item is not available for download at this moment!', 'dtransport'));
}
// Download default file
if ($action == 'download') {
    $file = $item->file();
    if (!$file) {
        redirect_header($item->permalink(), 0, __('Internal Error! Please try again later', 'dtransport'));
    }
    header("location: " . $file->permalink());
    die;
}
$xoopsOption['template_main'] = 'dtrans_item.html';
$xoopsOption['module_subpage'] = 'item';
include 'header.php';
$xoopsTpl->assign('dtrans_option', 'details');
$dtfunc->makeHeader();
$candownload = $item->canDownload($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS);
// Enlaces del elemento
$data = array();
$data['link'] = $item->permalink();