Source for file download.php

Documentation is available at download.php

  1. <?
  2.  
  3. /**
  4.  *
  5.  * This does the download of a file based on the download_files table.
  6.  * @license http://www.knowledgetree.com/KPL KnowledgeTree Public License Version 1.1
  7.  * @package KTWEBSERVICE
  8.  */
  9.  
  10. /*
  11.  *
  12.  * The contents of this file are subject to the KnowledgeTree Public
  13.  * License Version 1.1 ("License"); You may not use this file except in
  14.  * compliance with the License. You may obtain a copy of the License at
  15.  * http://www.knowledgetree.com/KPL
  16.  * 
  17.  * Software distributed under the License is distributed on an "AS IS"
  18.  * basis,
  19.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  20.  * for the specific language governing rights and limitations under the
  21.  * License.
  22.  * 
  23.  * The Original Code is: KnowledgeTree Open Source
  24.  * 
  25.  * The Initial Developer of the Original Code is The Jam Warehouse Software
  26.  * (Pty) Ltd, trading as KnowledgeTree.
  27.  * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
  28.  * (C) 2007 The Jam Warehouse Software (Pty) Ltd;
  29.  * All Rights Reserved.
  30.  *
  31.  */
  32.  
  33. if (!array_key_exists('code',$_GET))
  34. {
  35.     $msg urlencode('Code not specified.');
  36.     print "status_code=1&msg=$msg";
  37.     exit;
  38. }
  39.  
  40. $hash $_GET['code'];
  41.  
  42. if (!array_key_exists('d',$_GET))
  43. {
  44.     $msg urlencode('Document not specified.');
  45.     print "status_code=2&msg=$msg";
  46.     exit;
  47. }
  48.  
  49. $document_id $_GET['d'];
  50.  
  51. if (!array_key_exists('u',$_GET))
  52. {
  53.     $msg urlencode('Session not specified.');
  54.     print "status_code=3&msg=$msg";
  55.     exit;
  56. }
  57.  
  58. $session $_GET['u'];
  59.  
  60. require_once('../config/dmsDefaults.php');
  61. require_once('../ktapi/ktapi.inc.php');
  62. require_once('KTDownloadManager.inc.php');
  63.  
  64. $download_manager new KTDownloadManager();
  65. $download_manager->set_session($session);
  66.  
  67. $response $download_manager->download($document_id$hash);
  68. if (PEAR::isError($response))
  69. {
  70.     $msg urlencode($response->getMessage());
  71.     print "status_code=4&msg=$msg";
  72.     exit;    
  73. }
  74.  
  75. ?>

Documentation generated on Sun, 22 Apr 2007 02:30:43 +0200 by phpDocumentor 1.3.2