Ejemplo n.º 1
0
    if ($item->downloadsCount() >= $item->getVar('limits')) {
        redirect_header($item->permalink(), 1, __('You have reached your download limit for this file!', 'dtransport'));
    }
}
// Verificamos si la descarga se debe realizar
$token = isset($_SESSION['dttoken']) ? $_SESSION['dttoken'] : '';
if ($token == '' || !$xoopsSecurity->validateToken($token)) {
    $_SESSION['dttoken'] = $xoopsSecurity->createToken();
    $xoopsOption['template_main'] = 'dtrans_getfile.html';
    $xoopsOption['module_subpage'] = 'getfile';
    include 'header.php';
    $img = new RMImage();
    $img->load_from_params($item->getVar('image'));
    $xoopsTpl->assign('item', array('title' => $item->getVar('name'), 'image' => $img->get_smallest(), 'link' => $item->permalink()));
    $xoopsTpl->assign('lang_message', sprintf(__('Your %s download will start shortly...', 'dtransport'), '<a href="' . $item->permalink() . '">' . $item->getVar('name') . '</a>'));
    $xoopsTpl->assign('lang_problems', sprintf(__('Problems with the download? Please %s to download immediately.', 'dtransport'), '<a href="' . $file->permalink() . '">' . __('use this link', 'dtransport') . '</a>'));
    $tpl->add_style('main.css', 'dtransport');
    $tpl->add_local_script('main.js', 'dtransport');
    $tpl->add_head_script('var down_message = "' . sprintf(__('Your %s download will start in {x} seconds...', 'dtransport'), '<a href=\'' . $item->permalink() . '\'>' . $item->getVar('name') . '</a>') . '";');
    $tpl->add_head_script('var timeCounter = ' . $mc['pause'] . ";\nvar dlink = '" . $file->permalink() . "';");
    $dtfunc->makeHeader();
    include 'footer.php';
    die;
}
// Comprobamos si el archivo es seguro o no
if (!$item->getVar('secure')) {
    // Comprobamos si es un archivo remoto o uno local
    if ($file->remote()) {
        // Almacenamos las estadísticas
        $st = new DTStatistics();
        $st->setDate(time());