Changeset 660


Ignore:
Timestamp:
12/1/2008 3:39:27 AM (6 years ago)
Author:
lowjoel
Message:

Added support for local downloads, where the downloads are hosted on the Eraser website itself (sensitive stuff, like certificates etc.)

Location:
branches/website
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/website/download.php

    r648 r660  
    1616if (eregi('http(s{0,1})://)(.*)', $row['Link'])) 
    1717    header('location: ' . $row['Link']); 
    18 else 
    19     echo file_get_contents('./' . $row['Link']); 
     18else if (substr($row['Link'], 0, 1) == '?') 
     19{ 
     20    $fileName = substr($row['Link'], 1); 
     21    header("content-type: application/octet-stream"); 
     22    if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") !== false) 
     23    { 
     24        //IE browser 
     25        header('Content-Disposition: inline; filename="'.$fileName.'"'); 
     26        header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 
     27        header('Pragma: public'); 
     28    } 
     29    else 
     30    { 
     31        header('Content-Disposition: attachment; filename="'.$fileName.'"'); 
     32        header('Pragma: no-cache'); 
     33    } 
     34 
     35    echo file_get_contents('./downloads/' . $fileName); 
     36} 
    2037?> 
  • branches/website/downloads

    • Property svn:ignore set to
      *
  • branches/website/updates/index.php

    r646 r660  
    4545    } 
    4646 
     47    //Get the link to the download. We got three forms, relative, absolute and query. 
     48    //Relative links are mirrored by SF. 
     49    //Absolute links... are absolute links. 
     50    //Query links are prefixed with ?, they are handled by download.php on the Eraser website. 
     51    if (substr($row['Link'], 0, 1) == '?') 
     52        $link = $_SERVER['SERVER_NAME'] . '/download.php?id=' . $row['DownloadID']; 
     53    else 
     54        $link = $row['Link']; 
    4755    printf('        <item name="%s" version="%s" publisher="%s" architecture="%s" filesize="%d">%s</item> 
    4856', htmlentities($row['Name']), $row['Version'], htmlentities($row['PublisherName']), $row['Architecture'], 
    49             $row['Filesize'], htmlentities($row['Link'])); 
     57            $row['Filesize'], htmlentities($link)); 
    5058} 
    5159 
Note: See TracChangeset for help on using the changeset viewer.