Changeset 1648


Ignore:
Timestamp:
01/22/10 07:13:22 (5 years ago)
Author:
lowjoel
Message:

Properly redirect users to an error page when we do have errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/website/download.php

    r1434 r1648  
    44if (!empty($_GET['id'])) 
    55{ 
    6     $download = Build::GetBuildFromID(intval($_GET['id'])); 
    7     if (empty($download)) 
    8         $download = new Download(intval($_GET['id'])); 
    9      
    10     //Check for supersedence 
    11     if ($download->Superseded) 
     6    try 
    127    { 
    13         header('location: ' . $_SERVER['PHP_SELF'] . '?error=' . urlencode('The requested download has been superseded with a newer version.')); 
    14         exit; 
     8        $download = Build::GetBuildFromID(intval($_GET['id'])); 
     9        if (empty($download)) 
     10            $download = new Download(intval($_GET['id'])); 
     11         
     12        //Check for supersedence 
     13        if ($download->Superseded) 
     14        { 
     15            header('location: ' . $_SERVER['PHP_SELF'] . '?error=' . urlencode('The requested download has been superseded with a newer version.')); 
     16            exit; 
     17        } 
     18         
     19        $download->InitiateDownload(); 
    1520    } 
    16      
    17     $download->InitiateDownload(); 
     21    catch (Exception $e) 
     22    { 
     23        header('location: ' . $_SERVER['PHP_SELF'] . '?error=' . urlencode($e->getMessage())); 
     24    } 
     25 
    1826    exit; 
    1927} 
Note: See TracChangeset for help on using the changeset viewer.