blob: 772ca435161e0fe103843b978171cdbaa9bd032c [file] [log] [blame]
<?php
$mainDownloadFile = $app->getPubDownloadServerUrl() . $_file;
$target = "";
$mirror_id_prev = 0;
$ccode_prev = "";
$mir_count = 0;
$mir_internal_count = 0;
$strFileName = $filename_fileonly;
$mirror_id_list = array();
$documentRoot = $_SERVER['DOCUMENT_ROOT'];
require_once ($documentRoot . "/membership/promo/promos.php");
# Load up distros program if file selected is a Galileo/SDK package
$packageName = getPackageFromFilename($_file, "juno");
$osName = getOsFromFilename($_file);
$companies = array();
$aws = "";
if($packageName != "") {
include("distros/distros.php");
$companies = getCompanyArrayByPackage($packageName);
# Amazon AWS, worldwide 'continent'
# $aws = <<<EOHTML
# <ul><li><b>[Worldwide]</b> <a href="/downloads/download.php?file=$_file&mirror_id=999&url=http://d2u376ub0heus3.cloudfront.net$_file">Download from AWS</a> &#160; <a href="http://aws.amazon.com/solutions/featured-partners/eclipse-aws/" target="_new">(Learn more ...)</a></li></ul>
#EOHTML;
}
$html = <<<EOHTML
<style> .filename { color:#000; } .distrologo { padding-right: 15px; } </style>
<div id="midcolumn">
<h1>$pageTitle</h1>
<p>All downloads are provided under the terms and conditions of the <a href="/legal/epl/notice.php">Eclipse Foundation
Software User Agreement</a> unless otherwise specified.<br /><br />
EOHTML;
# Torrent available for this file
$torrentstr = "";
# Torrent available for this file
$sumstr = "";
if($md5sum != "" && $sha1sum != "") {
$sumstr = '<br />Checksums: [<a href="https://www.eclipse.org/downloads/sums.php?file=' . $_file . '&type=md5">MD5</a>] &#160; [<a href="https://www.eclipse.org/downloads/sums.php?file=' . $_file . '&type=sha1">SHA1</a>]';
}
if($torrentname != "") {
$sumstr .= ' &#160; <a href="http://build.eclipse.org/technology/phoenix/torrents/' . $torrentname . '"><img src="http://dev.eclipse.org/small_icons/categories/applications-internet.png" alt="Torrent" /><font size="+1"> &#160;BitTorrent</a><br />';
}
if($sumstr != "") {
$sumstr .= "<br />";
}
# Friends mirror
if($Friend->getIsBenefit()) {
$path = "download.php?file=" . $_file . "&mirror_id=2";
$html .= <<<EOHTML
<a href="$path"><img align="left" src="/donate/images/mirrorImage.png" alt="Download" /></a
&#160;&#160;<font size="+1"><b>Download from:</b> <a href="$path">Friends of Eclipse Mirror</a></font> <img src="/donate/images/starbullet.jpg" /><br />
$sumstr
<br />&#160;&#160;&#160;&#160;...or pick a local mirror site below.
EOHTML;
}
else {
# Preferred mirror
if($_country_code != "xx") {
if($myrow = mysql_fetch_assoc($rs)) {
$strlength = strlen($strFileName);
if ($strlength > 57) {
$strFileName = substr($strFileName, 0, 30) . "..." . substr($strFileName, $strlength-30, 30);
}
$path = $myrow['base_path'];
$path .= getPath($myrow['drop_id'], $_drop_id, $myrow['rel_path_override'], $myrow['our_path'], $myrow['our_path2']);
$path = "download.php?file=" . $_file . "&mirror_id=" . $myrow['mirror_id'];
$country_desc = $myrow['country_desc'];
$organization = $myrow['organization'];
$protocol = $myrow['protocol'];
$html .= <<<EOHTML
<font size="+1"><b>Download</b> <span class="filename">$strFileName</span> <b>from:</b></font><br /><br />
<a href="$path"><img align="left" src="http://dev.eclipse.org/huge_icons/actions/go-bottom.png" alt="Download" /></a>
<a href="$path">[$country_desc] $organization ($protocol)</a><br />
$sumstr
<br />...or pick a mirror site below.
EOHTML;
}
else {
# No mirrors at all!
$str = "";
if(!$Session->getIsLoggedIn()) {
$str = " Eclipse Committers can <a href='" . $Session->getLoginPageURL() . "'>log in</a> for faster download.";
}
$html .= "<font size='+1'><b>There are no mirrors for this file.</b>$str</font><br /><br />";
# If user is logged in and is a committer, offer a faster download
if($Friend->getIsCommitter()) {
$html .= <<<EOHTML
<a href="?file_id=$file_id"><img align="left" src="http://dev.eclipse.org/huge_icons/actions/go-bottom.png" alt="Download" /></a>
<b>[Canada]</b> <a href="?file_id=$file_id">Committers & Friends fast download from Eclipse.org</a><br />
$sumstr
EOHTML;
}
else {
$html .= <<<EOHTML
<a href="download.php?file=$_file&mirror_id=1"><img align="left" src="http://dev.eclipse.org/huge_icons/actions/go-bottom.png" alt="Download" /></a>
<b>[Canada]</b> <a href="download.php?file=$_file&mirror_id=1">Main Eclipse.org downloads area</a><br />
$sumstr
EOHTML;
}
}
}
}
$html .= "</p><br />";
# Distros program (if any). Otherwise, show Friends.
if(count($companies) > 0) {
# randomize $companies array here, or in distros.php
$string = "";
foreach($companies as $company) {
# Put the distros stuff in here.
$link = $company->linkTo . "@" . strtoupper($packageName . "-" . $osName);
$string .= "<tr class='tableData'><td valign='top'><a href='$link'><img class='distrologo' src='distros/images/" . $company->companyLogo . "' align='left' /></a></td><td valign='top'><a href='$link'><b>" . $company->companyName . "</b></a><br />" . $company->companyBlurb . "</td></tr>";
}
$html .= <<<EOHTML
<link rel="stylesheet" type="text/css" href="downlode.css" media="screen" />
<div class="homeitem3col">
<h3>Get It Faster Here</h3>
<table class="contentTable">
$string
</table>
</div>
EOHTML;
}
else {
$html .= getFriendsHTML();
}
# Location of Friends Nag (moved below for Galileo)
# Location of Google Ad (moved below for Galileo)
if($aws != "") {
$html .= <<<EOHTML
<div class="homeitem3col" style="float:center;">
<h3>Download from Amazon Web Services</h3>
EOHTML;
$html .= $aws;
$html .= "</div>";
}
else {
while ($myrow = mysql_fetch_assoc($rs)) {
if(!is_numeric(array_search($myrow['mirror_id'], $mirror_id_list))) {
$mirror_id_list[count($mirror_id_list)] = $myrow['mirror_id'];
$path = $myrow['base_path'];
$path .= getPath($myrow['drop_id'], $_drop_id, $myrow['rel_path_override'], $myrow['our_path'], $myrow['our_path2']);
# Override path to re-call download.php
$path = "download.php?file=" . $_file . "&mirror_id=" . $myrow['mirror_id'];
if($myrow['is_internal'] == 1 && $mir_internal_count == 0 && $_file != "") {
$html .= <<<EOHTML
<div class="homeitem3col">
<h3>The following Internal Mirrors should be used for this file</h3>
EOHTML;
$mir_internal_count++;
# Bypass stats for internal mirrors
$path = $myrow['base_path'];
$path .= getPath($myrow['drop_id'], $_drop_id, $myrow['rel_path_override'], $myrow['our_path'], $myrow['our_path2']);
}
if($myrow['is_internal'] != 1 && $_file != "" && ($mir_count == 0 || $mir_internal_count > 0)) {
if($mir_internal_count > 0) {
$html .= "</div>";
$mir_internal_count = 0;
$ccode_prev = "";
$mir_count = 0;
}
$html .= <<<EOHTML
<div class="homeitem3col" style="float:center;">
<h3>Please choose a mirror close to you</h3>
EOHTML;
# $html .= $aws;
}
if($myrow['continent_desc'] != $ccode_prev) {
if($mir_count > 0) {
$html .= "</ul>";
}
$html .= "\n";
$html .= "<h4>" . $myrow['continent_desc'] . "</h4>";
$html .= "<ul>";
}
if($myrow['mirror_id'] == $mirror_id_prev) {
$html .= " &#160; (<a href='" . $path . "' " . $target . ">" . $myrow['protocol'] . "</a>)";
}
else {
if($mir_count > 0 && $myrow['ccode'] == $ccode_prev) {
$html .= "</li>";
}
$html .= "<li>[" . $myrow['country_desc'] . "] <a href=\"" . $path . "\" target='$target'>" . $myrow['organization'] . " (" . $myrow['protocol'] . ")</a>";
}
$mir_count++;
$mirror_id_prev = $myrow['mirror_id'];
$ccode_prev = $myrow['continent_desc'];
}
}
}
if($mir_count > 0 || $mir_internal_count > 0) {
$html .= "</div>";
}
# Friends here.
if(count($companies) > 0) {
$html .= getFriendsHTML();
}
# Never remove the main download site!
# some files are not mirrored.
$html .= <<<EOHTML
<div class="homeitem3col">
<h3>Main Download Site</h3>
<h4>Canada</h4>
<ul><li><a href="download.php?file=$_file&mirror_id=1">Main eclipse.org downloads area (http)</a></li></ul>
</div>
EOHTML;
# Google ad.
$html .= <<<EOHTML
<br><div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-6797025590085056";
/* 468x60, created 5/28/08 */
google_ad_slot = "9054930060";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div><br>
EOHTML;
$html .= <<<EOHTML
<hr class="clearer" />
</div>
<div id="rightcolumn">
EOHTML;
//Ad Space
$html .= '<br><br>' . chooseRandomPromo();
$html .= <<<EOHTML
<div class="sideitem">
<h6>Other options for this file</h6>
<ul><li><a href="download.php?file=$_file&protocol=http">HTTP mirrors only</a> (<a href="download.php?file=$_file&protocol=http&format=xml">xml</a>)</li>
<li><a href="download.php?file=$_file&protocol=ftp">FTP mirrors only</a> (<a href="download.php?file=$_file&protocol=ftp&format=xml">xml</a>)</li>
<li><a href="download.php?file=$_file">All mirrors</a> (<a href="download.php?file=$_file&format=xml">xml</a>)</li>
<li><a href="download.php?file=$_file&r=1">Direct link to file</a> (download starts immediately from best mirror)</li>
</ul>
</div>
<div class="sideitem">
<h6>Related Links</h6>
<ul><li><a href="/donate">Friends of Eclipse</a></li><li><a href="mir_request.php">Becoming a mirror site</a></li><li><a href="http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-129.htm">Updating and installing Eclipse components</a></li><li><a href="/newsgroups">Eclipse newsgroups</a></li></ul>
</div>
</div>
EOHTML;
function getFriendsHTML() {
$friendsHTML = "";
global $Friend, $Session;
if(!$Friend->getIsBenefit()) {
$loginstring = "";
if($Session->getGID() == "") {
$loginstring = ' <img src="/donate/images/starbullet.jpg" /> <a href="http://dev.eclipse.org/site_login">Friends login</a>';
}
$friendsHTML .= <<<EOHTML
<div class="homeitem3col">
<h3>Friends of Eclipse Mirror</h3><h4>Canada</h4>
<ul><li style="list-style-image:url(/donate/images/starbullet.jpg);">Friends of Eclipse Mirror <img src="/donate/images/starbullet.jpg" /> <a href="/donate">Become a Friend!</a>$loginstring</li></ul>
</div>
EOHTML;
return $friendsHTML;
}
}
?>