<?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.
*/
if($_SERVER["SERVER_PORT"]=='80')
$self='http://'.$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
elseif($_SERVER["SERVER_PORT"]=='443')
$self='https://'.$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
else
$self='http://'.$_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"];
$field=get('field');
$variable_name=substr(str_replace('_',' ',substr($field,0,strrpos($field,'_'))),4);
$sysId=substr($field,strrpos($field,'_')+1);
$line_array=search('sysId='.$sysId.'');
$variable_array=line2array($line_array[0]);
//USEREXIT OnDownload
$userexit='ondownload';
if(file_exists(cfg_data_path.'/config/userexit/exit_'.$userexit.'.txt'))
{
include(cfg_data_path.'/config/userexit/exit_'.$userexit.'.txt');
}
else
{
include(cfg_data_path.'/script/userexit/exit_'.$userexit.'.txt');
}
if(file_exists(cfg_data_path.'/script/odb_invitation_'.strtolower($variable_array['Language']).'.html'))
$content=file_get_contents(cfg_data_path.'/script/odb_invitation_'.strtolower($variable_array['Language']).'.html');
else
$content=file_get_contents(cfg_data_path.'/script/odb_invitation.html');
$content=str_replace('[User]',$variable_array['User'],$content);
$content=str_replace('[System]',cfg_skin_name,$content);
$content=str_replace('[Self]',$self,$content);
$content=str_replace('[Invitation]',$sysId,$content);
$content=str_replace('[USERNAME]',USERNAME,$content);
header('Content-Type: text/html');
header('Content-Disposition: attachment; filename="'.linkname(cfg_skin_name.' '.$variable_array['User']).'.invit.html"');
header('Content-Length: '.strlen($content));
echo $content;
exit;
?>