| <?php |
| /******************************************************************************* |
| * Copyright (c) 2015 Eclipse Foundation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Denis Roy (Eclipse Foundation) - Initial implementation |
| * Christopher Guindon (Eclipse Foundation) |
| *******************************************************************************/ |
| |
| $mainDownloadFile = $app->getPubDownloadServerUrl() . $_file; |
| $target = ""; |
| $mirror_id_prev = 0; |
| $ccode_prev = ""; |
| |
| $mir_count = 0; |
| $mir_internal_count = 0; |
| |
| $strFileName = $filename_fileonly; |
| $strlength = strlen($strFileName); |
| if ($strlength > 57) { |
| $strFileName = substr($strFileName, 0, 30) . "..." . substr($strFileName, $strlength-30, 30); |
| } |
| |
| $friends_html = getFriendsHTML(); |
| |
| $download_link = array( |
| 'url' => 'download.php?file=' . $_file, |
| 'text' => '', |
| 'icon' => '', |
| 'suffix' => '' |
| ); |
| |
| # Load up distros program if file selected is a Galileo/SDK package |
| $packageName = getPackageFromFilename($_file, "mars"); |
| $osName = getOsFromFilename($_file); |
| $companies = array(); |
| |
| if ($packageName != "") { |
| include("distros/distros.php"); |
| $companies = getCompanyArrayByPackage($packageName); |
| } |
| |
| $mirror_id_list = array(); |
| $mirror_is_available = TRUE; |
| |
| $commiter_link = ''; |
| if (!$Session->getIsLoggedIn()) { |
| $commiter_link = " Eclipse Committers can <a href='" . $Session->getLoginPageURL() . "'>log in</a> for faster download."; |
| } |
| |
| if ($Friend->getIsBenefit()) { |
| // Friends of Eclipse |
| $download_link['url'] .= "&mirror_id=2"; |
| $download_link['text'] = 'Friends of Eclipse Mirror'; |
| $download_link['icon'] = '<i class="fa fa-star orange"></i>'; |
| } |
| elseif ($_country_code != "xx" && $myrow = mysql_fetch_assoc($rs)) { |
| // Preferred mirror |
| $download_link['url'] .= "&mirror_id=" . $myrow['mirror_id']; |
| $download_link['text'] = '' . $myrow['country_desc'] .' - ' . $myrow['organization'] .' (' . $myrow['protocol'] . ')'; |
| } |
| else { |
| // No mirrors :( |
| $mirror_is_available = FALSE; |
| if ($Friend->getIsCommitter()) { |
| $download_link['url'] .= '&file_id=' . $file_id; |
| $download_link['text'] = 'Canada - Committers & Friends fast download from Eclipse.org'; |
| } |
| else { |
| $download_link['url'] .= '&mirror_id=1'; |
| $download_link['text'] = 'Canada - Main Eclipse.org downloads area'; |
| } |
| } |
| |
| $mirrors_internal = array(); |
| $mirrors = array(); |
| while ($myrow = mysql_fetch_assoc($rs)) { |
| $mirror_link = array(); |
| $internal_mirror_flag = FALSE; |
| if (!is_numeric(array_search($myrow['mirror_id'], $mirror_id_list))) { |
| $mirror_id_list[count($mirror_id_list)] = $myrow['mirror_id']; |
| $path = "download.php?file=" . $_file . "&mirror_id=" . $myrow['mirror_id']; |
| |
| if ($myrow['is_internal'] == 1 && $_file != "") { |
| # Bypass stats for internal mirrors |
| $path = $myrow['base_path'] . getPath($myrow['drop_id'], $_drop_id, $myrow['rel_path_override'], $myrow['our_path'], $myrow['our_path2']); |
| $internal_mirror_flag = TRUE; |
| } |
| |
| $mirror_link = array( |
| 'path' => $path, |
| 'country' =>$myrow['country_desc'], |
| 'target' => $target, |
| 'protocol' => $myrow['protocol'], |
| 'organization' => $myrow['organization'] |
| ); |
| |
| if ($internal_mirror_flag) { |
| $mirrors_internal[$myrow['continent_desc']][$myrow['mirror_id']][] = $mirror_link; |
| } |
| else{ |
| $mirrors[$myrow['continent_desc']][$myrow['mirror_id']][] = $mirror_link; |
| } |
| } |
| } |
| |
| function _print_mirror_list($mirrors = array()) { |
| $html = ''; |
| foreach ($mirrors as $mid_mirrors) { |
| $html .= '<li>'; |
| foreach($mid_mirrors as $key => $m) { |
| $link = '<a href="' . $m['path'] . '" target="' . $m['target']. '">'; |
| if ($key == 0) { |
| $html .= $m['country'] . ' - '; |
| //$html .= $link . $m['organization'] .' ('. $m['protocol'] .')</a>'; |
| $html .= $link . $m['organization'] .'</a>'; |
| } |
| else{ |
| $html .= '   (' . $link . $m['protocol'] . '</a>)'; |
| } |
| } |
| $html .= '</li>'. PHP_EOL; |
| } |
| return $html; |
| } |
| |
| function getFriendsHTML() { |
| |
| $friendsHTML = ""; |
| global $Friend, $Session; |
| |
| if(!$Friend->getIsBenefit()) { |
| $loginstring = ""; |
| if($Session->getGID() == "") { |
| $loginstring = ' <i class="fa fa-star orange"></i> <a href="http://dev.eclipse.org/site_login">Friends login</a>'; |
| } |
| $friendsHTML .= <<<EOHTML |
| <div class="choose-mirror"> |
| <h3>Friends of Eclipse Mirror</h3> |
| <ul class="list-unstyled"> |
| <li><i class="fa fa-star orange"></i> Canada - Friends of Eclipse Mirror <i class="fa fa-star orange"></i> |
| <a href="/donate">Become a Friend!</a>$loginstring |
| </li> |
| </ul> |
| </div> |
| EOHTML; |
| } |
| return $friendsHTML; |
| } |
| $mirror_html = ''; |
| if (!empty($mirrors)) { |
| ob_start(); |
| ?> |
| <div class="choose-mirror"> |
| <h2>Choose a mirror close to you</h2> |
| <?php $x = 0; ?> |
| <?php foreach ($mirrors as $continent => $mir):?> |
| <?php $x++; ?> |
| <div class="mirror-continent mirror-section-<?php print $x;?>"> |
| <h3><?php print $continent?></h3> |
| <ul class="list-unstyled"> |
| <?php print _print_mirror_list($mir);?> |
| </ul> |
| </div> |
| <?php endforeach;?> |
| <a class="btn btn-sm btn-primary" id="show_all_mirrors" href="#show_all_mirrors">Show all</a> |
| </div> |
| <hr/> |
| |
| <?php if (count($companies) > 0) :?> |
| <?php print $friends_html;?> |
| <?php endif;?> |
| |
| <div class="choose-mirror"> |
| <h3>Main Download Site</h3> |
| <ul class="list-unstyled"> |
| <li>Canada - <a href="download.php?file=<?print $_file; ?>&mirror_id=1">Main eclipse.org downloads area</a></li> |
| </ul> |
| </div> |
| <?php |
| $mirror_html = ob_get_clean(); |
| } |
| $members_html = ""; |
| ob_start(); |
| if (count($companies) > 0) {?> |
| <h2>Get It Faster from our Members</h2> |
| <?php if (count($companies) > 0) :?> |
| <?php foreach($companies as $company) :?> |
| <?php $link = $company->linkTo . "@" . strtoupper($packageName . "-" . $osName);?> |
| <div class="row-item"> |
| <div class="row"> |
| <div class="col-sm-3"> |
| <a href="<?php print $link;?>"> |
| <img src="distros/images/<?php print $company->companyLogo;?>" align="left" class="img-responsive"/> |
| </a> |
| </div> |
| <div class="col-sm-16"> |
| <h3> |
| <a href="<?php print $link;?>"><?php print $company->companyName;?></a> |
| </h3> |
| <p><?php print $company->companyBlurb;?></p> |
| </div> |
| <div class="col-sm-5 member-btn-download"> |
| <a href="<?php print $link;?>" class="btn btn-sm btn-warning">Download</a> |
| </div> |
| </div> |
| </div> |
| <?php endforeach;?> |
| <?php endif;?> |
| <?php |
| } |
| $members_html = ob_get_clean(); |
| ?> |
| |
| |
| <div class="col-md-18"> |
| <h1><?php print $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.</p> |
| <div class="row"> |
| <div class="col-md-9 left-sidebar"> |
| <div class="well well-installer margin-top-25"> |
| <div class="download-or background-orange hidden-sm"> |
| OR <i class="fa fa-chevron-right"></i> |
| </div> |
| <?php if (!$mirror_is_available) :?> |
| <p><strong>There are no mirrors for this file.</strong><?php print $commiter_link;?></p> |
| <?php endif;?> |
| <?php //@todo: Add human friendly name to a file (Eclipse Installer). |
| if ($packageName != "") :?> |
| <!--<h3>Eclipse Installer</h3>--> |
| <?php endif;?> |
| <p>Download from: <?php print $download_link['icon'];?> <a href="<?php print $download_link['url'];?>" class=""><?php print $download_link['text'];?></a><?php print $download_link['suffix'];?></p> |
| <p><strong>File:</strong> <?php print $strFileName;?></p> |
| <?php if ($md5sum != "" || $sha1sum != "" || $sha512sum != "") :?> |
| <div role="tabpanel"> |
| <!-- Nav tabs --> |
| <ul role="tablist" class="checksums-options list-inline"> |
| <li><strong>Checksums: </strong></li> |
| <?php if ($md5sum != "") :?> |
| <li role="presentation"> |
| <a class="btn-ajax-checksum" data-checksum-file="<?php print $_file;?>" data-checksum-type="md5" data-toggle="tab" role="tab" aria-controls="profile" href="#btn-ajax-checksum-md5">MD5</a> |
| </li> |
| <?php endif;?> |
| <?php if ($sha1sum != "") :?> |
| <li role="presentation"> |
| <a class="btn-ajax-checksum" data-checksum-file="<?php print $_file;?>" data-checksum-type="sha1" data-toggle="tab" role="tab" aria-controls="messages" href="#btn-ajax-checksum-sha1">SHA1</a> |
| </li> |
| <?php endif;?> |
| <?php if ($sha512sum != "") :?> |
| <li role="presentation"> |
| <a class="btn-ajax-checksum" data-checksum-file="<?php print $_file;?>" data-checksum-type="sha512" data-toggle="tab" role="tab" aria-controls="settings" href="#btn-ajax-checksum-sha512">SHA-512</a> |
| </li> |
| <?php endif;?> |
| </ul> |
| <!-- Tab panes --> |
| <div class="tab-content"> |
| <?php if ($md5sum != "") :?> |
| <div id="btn-ajax-checksum-md5" class="tab-pane fade" role="tabpanel"> |
| <div class="well"> |
| <p></p> |
| </div> |
| </div> |
| <?php endif;?> |
| <?php if ($sha1sum != "") :?> |
| <div id="btn-ajax-checksum-sha1" class="tab-pane fade" role="tabpanel"> |
| <div class="well"> |
| <p></p> |
| </div> |
| </div> |
| <?php endif;?> |
| <?php if ($sha512sum != "") :?> |
| <div id="btn-ajax-checksum-sha512" class="tab-pane fade" role="tabpanel"> |
| <div class="well"> |
| <p></p> |
| </div> |
| </div> |
| <?php endif;?> |
| </div> |
| </div> |
| <?php endif;?> |
| <a href="<?php print $download_link['url'];?>" class="btn btn-warning margin-bottom-15"><i class="fa fa-download"></i> Download</a> |
| </div> |
| <?php if (!empty($members_html)) :?> |
| <?php print $mirror_html; ?> |
| <?php endif;?> |
| </div> |
| <div class="download-faster col-md-15"> |
| <?php if (empty($members_html)) :?> |
| <?php print $mirror_html; ?> |
| <?php print $friends_html; ?> |
| <?php else:?> |
| <?php print $members_html;?> |
| <?php endif;?> |
| <?php if (!empty($mirrors_internal)) :?> |
| <div class="choose-mirror"> |
| <h2>The following Internal Mirrors should be used for this file</h2> |
| <?php foreach ($mirrors_internal as $continent => $mir):?> |
| <h3><?php print $continent?></h3> |
| <ul class="list-unstyled"> |
| <?php print _print_mirror_list($mir);?> |
| </ul> |
| <?php endforeach;?> |
| </div> |
| <?php endif;?> |
| </div> |
| </div> |
| </div> |
| <div id="rightcolumn"> |
| <div class="padding-top-10"> |
| <?php print chooseRandomPromo();?> |
| </div> |
| <div class="sideitem"> |
| <h6>Other options for this file</h6> |
| <ul> |
| <li><a href="download.php?file=<?print $_file; ?>">All mirrors</a> (<a href="download.php?file=<?print $_file; ?>&format=xml">xml</a>)</li> |
| <li><a href="download.php?file=<?print $_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> |
| <div class="text-center padding-top-15 padding-bottom-10 col-md-24 clearfix"> |
| <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="//pagead2.googlesyndication.com/pagead/show_ads.js"></script> |
| </div> |