~george-edison55/jsstudio/addons_site

« back to all changes in this revision

Viewing changes to controllers/addons.php

  • Committer: Nathan Osman
  • Date: 2011-08-22 04:33:05 UTC
  • Revision ID: admin@quickmediasolutions.com-20110822043305-kk083pea9bjjq5ad
Added ability to download addons.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    public function index()
24
24
    {
25
25
        // Fetch the top 10 addons
26
 
        $this->SetViewVariable('message', 'Hello, World!');
 
26
        $this->SetViewVariable('addons', $this->model->Query());
 
27
    }
 
28
    
 
29
    public function download($addon_id)
 
30
    {
 
31
        // Make sure the ID is an integer
 
32
        if(!preg_match('/^\d+$/', $addon_id))
 
33
            throw new Exception('The addon ID specified is invalid.');
 
34
        
 
35
        // TODO: try to find that addon in the database
 
36
        
 
37
        // Just pass on the ID to the view
 
38
        $this->SetViewVariable('addon_id', $addon_id);
27
39
    }
28
40
}
29
41