Esempio n. 1
0
        } elseif (!isset($_GET['method']) || isset($_GET['method']) && $_GET['method'] == 'view') {
            $index = 1;
            $title = __('View Package');
        } else {
            httpinfo(405);
            exit;
        }
    } else {
        httpinfo(405);
        exit;
    }
} elseif (!isset($_GET['method'])) {
    $index = 0;
    $title = $release_origin;
} else {
    httpinfo(405);
    exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title><?php 
echo $title;
?>
</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta name="apple-mobile-web-app-title" content="<?php 
echo $release_origin;
?>
" />
Esempio n. 2
0
function _downFile($fileName, $fancyName = '', $forceDownload = true, $speedLimit = DCRM_SPEED_LIMIT, $contentType = '')
{
    if (!is_readable($fileName)) {
        httpinfo(404);
        return false;
    }
    $fileStat = stat($fileName);
    $lastModified = $fileStat['mtime'];
    $md5 = md5($fileStat['mtime'] . '=' . $fileStat['ino'] . '=' . $fileStat['size']);
    $etag = '"' . $md5 . '-' . crc32($md5) . '"';
    header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $lastModified) . ' GMT');
    header("ETag: {$etag}");
    if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $lastModified) {
        httpinfo(304);
        return true;
    }
    if (isset($_SERVER['HTTP_IF_UNMODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_UNMODIFIED_SINCE']) < $lastModified) {
        httpinfo(304);
        return true;
    }
    if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag) {
        httpinfo(304);
        return true;
    }
    if (empty($fancyName)) {
        $fancyName = basename($fileName);
    }
    if (empty($contentType)) {
        $contentType = 'application/octet-stream';
    }
    $fileSize = $fileStat['size'];
    $contentLength = $fileSize;
    if (isset($_SERVER['HTTP_RANGE'])) {
        //if (preg_match('/^bytes=(d*)-(d*)$/', $_SERVER['HTTP_RANGE'], $matches)) {
        $match = str_replace('=', '-', $_SERVER['HTTP_RANGE']);
        $matches = explode('-', $match);
        $startPos = trim($matches[1]);
        $endPos = trim($matches[2]);
        if (empty($startPos) && empty($endPos)) {
            return false;
        }
        if (empty($startPos)) {
            $startPos = $fileSize - $endPos;
            $endPos = $fileSize - 1;
        } elseif (empty($endPos)) {
            $endPos = $fileSize - 1;
        }
        $startPos = $startPos < 0 ? 0 : $startPos;
        $endPos = $endPos > $fileSize - 1 ? $fileSize - 1 : $endPos;
        $length = $endPos - $startPos + 1;
        if ($length < 0) {
            return false;
        }
        $contentLength = $length;
        header('HTTP/1.1 206 Partial Content');
        header('Content-Range: bytes ' . $startPos . '-' . $endPos . '/' . $fileSize);
        //}
    } else {
        header("HTTP/1.1 200 OK");
        $startPos = 0;
        $endPos = $contentLength - 1;
    }
    header('Pragma: public');
    header('Cache-Control: public, must-revalidate, max-age=0');
    header('Accept-Ranges: bytes');
    header('Content-type: ' . $contentType);
    header('Content-Length: ' . $contentLength);
    if ($forceDownload) {
        header('Content-Disposition: attachment; filename="' . rawurlencode($fancyName) . '"');
    }
    header("Content-Transfer-Encoding: binary");
    $bufferSize = 2048;
    if ($speedLimit != 0) {
        $packetTime = floor($bufferSize * 1000000 / $speedLimit);
    }
    $bytesSent = 0;
    $fp = fopen($fileName, "rb");
    fseek($fp, $startPos);
    while ($bytesSent < $contentLength && !feof($fp) && connection_status() == 0) {
        if ($speedLimit != 0) {
            list($usec, $sec) = explode(' ', microtime());
            $outputTimeStart = (double) $usec + (double) $sec;
        }
        $readBufferSize = $contentLength - $bytesSent < $bufferSize ? $contentLength - $bytesSent : $bufferSize;
        $buffer = fread($fp, $readBufferSize);
        echo $buffer;
        ob_flush();
        flush();
        $bytesSent += $readBufferSize;
        if ($speedLimit != 0) {
            list($usec, $sec) = explode(' ', microtime());
            $outputTimeEnd = (double) $usec + (double) $sec;
            $useTime = ((double) $outputTimeEnd - (double) $outputTimeStart) * 1000000;
            $sleepTime = round($packetTime - $useTime);
            if ($sleepTime > 0) {
                usleep($sleepTime);
            }
        }
    }
    return true;
}
Esempio n. 3
0
                        } elseif (function_exists('apache_get_modules')) {
                            $Mods = apache_get_modules();
                            if (in_array('mod_xsendfile', $Mods)) {
                                xsendfile_header('X-sendfile', false);
                            }
                        }
                        if (file_exists(ROOT . 'downloads/.htaccess')) {
                            unlink(ROOT . 'downloads/.htaccess');
                        }
                        break;
                    case 'Lighttpd':
                        if ($module_enabled == 2) {
                            xsendfile_header('X-LIGHTTPD-send-file');
                        }
                        break;
                        // IIS? Hehe
                        //case 'IIS':
                }
                header('Location: ' . SITE_URL . $download_path);
                exit;
            }
        } else {
            httpinfo(404);
        }
        exit;
    } else {
        httpinfo(500);
    }
} else {
    httpinfo(400);
}
Esempio n. 4
0
            $f_Package .= $m_key . ": " . trim(str_replace("\n", "\n ", $m_value)) . "\n";
        }
    }
    $protection_status = check_commercial_tag($m_array['Tag']);
    $package = $m_array['Package'];
    ?>
			<div class="alert alert-info">
<?php 
    echo nl2br(htmlspecialchars($f_Package));
    ?>
			</div>
<?php 
}
$m_query = DB::query("SELECT * FROM `" . DCRM_CON_PREFIX . "ScreenShots` WHERE `PID` = '" . $request_id . "'");
if (!$m_query) {
    httpinfo(500);
    exit;
}
if (DB::affected_rows() <= 0) {
    ?>
			<div class="alert" id="tips">
				<?php 
    _e('This package no screenshot.');
    ?>
<br />
			</div>
<?php 
} else {
    ?>
			<div class="alert alert-success" id="tips">
				<?php