Пример #1
0
    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());
        $st->setFile($file->id());
        $st->setSoftware($item->id());
        $st->setUid($xoopsUser ? $xoopsUser->uid() : 0);
        $st->setIp($_SERVER['REMOTE_ADDR']);
        $st->save();
        $item->addHit();
        $file->addHit();
        unset($_SESSION['dttoken']);
        header('location: ' . $file->file());
        die;
    } else {
        $dir = str_replace(XOOPS_ROOT_PATH, XOOPS_URL, $mc['directory_insecure']);
        $dir = str_replace("\\", "/", $dir);
        $dir = rtrim($dir, '/');
        $path = $mc['directory_insecure'];
        $path = str_replace("\\", "/", $path);
        $path = rtrim($path, '/');
        if (!file_exists($path . '/' . $file->file())) {
            redirect_header(DT_URL . '/report.php?item=' . $item->id() . "&error=0", 2, __('We\'re sorry but specified file does not exists!', 'dtransport'));
        }
        $st = new DTStatistics();
        $st->setDate(time());