Location: PHPKode > projects > OpenBizMap > obm2007.1/odb_tempfile.php
<?php
/*
OpenDataBag - Data Web Interface
Copyright (C) 2004 Nawara

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

include('./odb_config.php');

$tmp_file_name=$_GET['odb_file'];

if(file_exists(cfg_data_path.'/temp/tempfile/'.$tmp_file_name))
{
  $last_mod=gmdate('D, d M Y H:i:s',time()). ' GMT';
  header("Pragma: "); // clearing "no-cache"
  header("Cache-Control: max-age=1, must-revalidate");
  header('Last-Modified: ' . $last_mod);
  header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 1000000) . ' GMT');

  $content=file_get_contents(cfg_data_path.'/temp/tempfile/'.$tmp_file_name);
  
  header('Content-Type: text/xml');
  header('Content-Disposition: inline; filename="'.$tmp_file_name.'.xml"'); //attachement couses too much dialog boxes /inline
  header('Content-Length: '.strlen($content));
  
  echo $content;
  
  unlink(cfg_data_path.'/temp/tempfile/'.$tmp_file_name);
}
else
{
  //echo '304'; exit;
  header('HTTP/1.0 304 Not Modified');
  header('Content-Length: 0');
  // header('Status: 304 Not Modified');
  exit();
}


?>
Return current item: OpenBizMap