| <?php | |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); | |
| class SDK { | |
| #***************************************************************************** | |
| # | |
| # sdk.class.php | |
| # | |
| # Author: Denis Roy | |
| # Date: 2006-09-28 | |
| # | |
| # Description: Functions and modules related an SDK file download object | |
| # | |
| # HISTORY: | |
| # | |
| #***************************************************************************** | |
| var $clientOS = ""; | |
| var $osDisplay = ""; | |
| var $baselink = ""; | |
| var $version = ""; | |
| var $version_suffix = ""; | |
| var $timestamp = ""; | |
| var $release = ""; | |
| var $fileext = ""; | |
| function getClientOS() { | |
| return $this->clientOS; | |
| } | |
| function getOSDisplay() { | |
| return $this->osDisplay; | |
| } | |
| function getBaseLink() { | |
| return $this->baselink; | |
| } | |
| function getVersion() { | |
| return $this->version; | |
| } | |
| function getVersionSuffix() { | |
| return $this->version_suffix; | |
| } | |
| function getTimestamp() { | |
| return $this->timestamp; | |
| } | |
| function getRelease() { | |
| return $this->release; | |
| } | |
| function getFileExt() { | |
| return $this->fileext; | |
| } | |
| function setClientOS($_ClientOS) { | |
| $this->clientOS = $_ClientOS; | |
| } | |
| function setOSDisplay($_OSDisplay) { | |
| $this->osDisplay = $_OSDisplay; | |
| } | |
| function setBaseLink($_BaseLink) { | |
| $this->baselink = $_BaseLink; | |
| } | |
| function setVersion($_Version) { | |
| $this->version = $_Version; | |
| } | |
| function setVersionSuffix($_VersionSuffix) { | |
| $this->version_suffix = $_VersionSuffix; | |
| } | |
| function setTimestamp($_TimeStamp) { | |
| $this->timestamp = $_TimeStamp; | |
| } | |
| function setRelease() { | |
| $this->release = "R-" . $this->getVersion() . "-" . $this->getTimestamp() . "/eclipse-SDK-" . $this->getVersion() . "-"; | |
| } | |
| function setFileExt() { | |
| if($this->getClientOS() != "win32" && $this->getClientOS() != "linux" && $this->getClientOS() != "macosx" && $this->getClientOS() != "hpux" && $this->getClientOS() != "solaris" && $this->getClientOS() != "aix" && $this->getClientOS() != "linux-x64" && $this->getClientOS() != "linux-ppc") { | |
| $this->setClientOS("win32"); | |
| } | |
| $this->fileext = ".zip"; | |
| if($this->getClientOS() == "macosx") { | |
| $this->setOSDisplay("Mac OS X"); | |
| $this->setVersionSuffix("-carbon"); | |
| $this->fileext = ".tar.gz"; | |
| } | |
| if($this->getClientOS() == "win32") { | |
| $this->setOSDisplay("Windows"); | |
| } | |
| if($this->getClientOS() == "linux") { | |
| $this->setVersionSuffix("-gtk"); | |
| $this->setOSDisplay("Linux"); | |
| $this->fileext = ".tar.gz"; | |
| } | |
| if($this->getClientOS() == "linux-x64") { | |
| $this->setVersionSuffix("-gtk-x86_64"); | |
| $this->setOSDisplay("Linux x86_64"); | |
| $this->setClientOS("linux"); | |
| $this->fileext = ".tar.gz"; | |
| } | |
| if($this->getClientOS() == "linux-ppc") { | |
| $this->setVersionSuffix("-gtk-ppc"); | |
| $this->setOSDisplay("Linux PPC"); | |
| $this->setClientOS("linux"); | |
| $this->fileext = ".tar.gz"; | |
| } | |
| if($this->getClientOS() == "hpux") { | |
| $this->setVersionSuffix("-motif"); | |
| $this->setOSDisplay("HP-UX"); | |
| } | |
| if($this->getClientOS() == "solaris") { | |
| $this->setVersionSuffix("-gtk"); | |
| $this->setOSDisplay("Solaris"); | |
| } | |
| if($this->getClientOS() == "solaris-x86") { | |
| $this->setVersionSuffix("-gtk-x86"); | |
| $this->setOSDisplay("Solaris"); | |
| } | |
| if($this->getClientOS() == "aix") { | |
| $this->setVersionSuffix("-motif"); | |
| $this->setOSDisplay("AIX"); | |
| } | |
| } | |
| function SDK() { | |
| # Default constructor | |
| # http://download.eclipse.org/eclipse/downloads/drops/R-3.2.2-200702121330/index.php | |
| $App = new App(); | |
| $this->setClientOS($App->getClientOS()); | |
| $this->setBaseLink("download.php?file=/eclipse/downloads/drops/"); | |
| $this->setVersion("3.2.2"); | |
| $this->setTimestamp("200702121330"); | |
| $this->setRelease(); | |
| $this->setFileExt(); | |
| } | |
| function getFileSize() { | |
| $App = new App(); | |
| $fileSize = "N/A"; | |
| $filesizebytes = filesize($App->getDownloadBasePath() . "/eclipse/downloads/drops/" . $this->getRelease() . $this->getClientOS() . $this->getVersionSuffix() . $this->getFileExt()); | |
| if($filesizebytes > 0) { | |
| $fileSize = floor($filesizebytes / 1048576) . " MB"; | |
| } | |
| return $fileSize; | |
| } | |
| function getDownloadLinkWithMirrors() { | |
| return $this->getBaseLink() . $this->getRelease() . $this->getClientOS() . $this->getVersionSuffix() . $this->getFileExt(); | |
| } | |
| function getDownloadLinkWithoutMirrors() { | |
| return $this->getDownloadLinkWithMirrors() . "&r=1"; | |
| } | |
| function getDownloadPage() { | |
| $App = new App(); | |
| return $App->getPubDownloadServerUrl() . "/eclipse/downloads/drops/R-" . $this->getVersion() . "-" . $this->getTimestamp() . "/"; | |
| } | |
| } | |
| ?> |