Beispiel #1
0
            $fileInfo = pathinfo(DATA_SERVER_PATH . '/uploads/items/' . $item['id'] . '/' . $item['main_file']);
            $mimeTypes = array('zip' => 'application/zip');
            if (isset($mimeTypes[$fileInfo['extension']])) {
                header('Content-Type: ' . $mimeTypes[$fileInfo['extension']]);
            } else {
                header('Content-Type: application/octet-stream');
            }
            header('Content-Disposition: attachment; filename="' . $item['main_file_name'] . '"');
            header("Content-Length:" . filesize(DATA_SERVER_PATH . '/uploads/items/' . $item['id'] . '/' . $item['main_file']));
            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
            header('Pragma: public');
            header("Content-Transfer-Encoding: binary");
            header('Expires: 0');
            header('Content-Description: ' . $config['domain'] . ' Download');
            @ob_clean();
            @flush();
            readfile(DATA_SERVER_PATH . '/uploads/items/' . $item['id'] . '/' . $item['main_file']) or die("ERROR!");
            die;
        }
    } else {
        header("HTTP/1.0 404 Not Found");
        header("Location: http://" . DOMAIN . "/" . $languageURL . "error");
    }
}
#加载作品
$items = $ordersClass->getAllBuyed(" `user_id` = '" . intval($_SESSION['user']['user_id']) . "' AND `paid` = 'true' ");
abr('items', $items);
$ratedItems = $itemsClass->getRates(str_replace('`id`', '`item_id`', $ordersClass->whereQuery));
abr('ratedItems', $ratedItems);
#面包屑
abr('breadcrumb', '<a href="/' . $languageURL . '" title="">' . $langArray['home'] . '</a> \\ <a href="/' . $languageURL . 'users/dashboard/" title="">' . $langArray['my_account'] . '</a> \\ <a href="/' . $languageURL . 'users/downloads/" title="">' . $langArray['downloads'] . '</a>');