<?php
/**
* File : file_iframe.php
*
* Frame to show the file to index (index_file.php)
*
* @package Maarch PeopleBox 1.0
* @version 2.0
* @since 06/2006
* @license GPL
* @author Claire Figueras <hide@address.com>
* @author Laurent Giovannoni <hide@address.com>
*/
session_name('PeopleBox');
session_start();
require_once($_SESSION['pathtocoreclass']."class_functions.php");
require_once($_SESSION['pathtocoreclass']."class_db.php");
$func = new functions();
require_once($_SESSION['pathtocoreclass']."class_core_tools.php");
$core_tools = new core_tools();
//here we loading the lang vars
$core_tools->test_user();
$core_tools->load_lang();
require_once($_SESSION['pathtomodules']."indexing_searching".$_SESSION['slash_env']."class".$_SESSION['slash_env']."class_modules_tools.php");
$is = new indexing_searching();
$show_file = $is->show_index_frame($_SESSION['upfile']['format']);
$ext_list = $is->filetypes_showed_indexation();
if($_SESSION['origin'] == "scan")
{
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: ".$_SESSION['upfile']['mime']);
header("Content-Disposition: inline; filename=".basename('maarch').";");
header("Content-Transfer-Encoding: binary");
$ext = strtolower($_SESSION['upfile']['format']);
if(file_exists('tmp/tmp_file_'.$_SESSION['upfile']['md5'].'.'.$ext))
{
$loc = 'tmp/tmp_file_'.$_SESSION['upfile']['md5'].'.'.$ext;
readfile($loc);
}
else
{
echo "PROBLEM DURING FILE SEND";
}
exit();
}
elseif(isset($_SESSION['upfile']['mime']) && !empty($_SESSION['upfile']['mime']) && isset($_SESSION['upfile']['format']) && !empty($_SESSION['upfile']['format']) && $_SESSION['upfile']['error'] <> 1)
{
if($show_file)
{
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: ".$_SESSION['upfile']['mime']);
header("Content-Disposition: inline; filename=".basename('maarch').";");
header("Content-Transfer-Encoding: binary");
$ext = strtolower($_SESSION['upfile']['format']);
if(file_exists($_SESSION['config']['tmppath'].'/tmp_file_'.$_SESSION['user']['UserId'].'.'.$ext))
{
$loc = $_SESSION['config']['MaarchUrl'].$_SESSION['config']['tmppath'].'/tmp_file_'.$_SESSION['user']['UserId'].'.'.$ext;
readfile($loc);
}
exit();
}
else
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $_SESSION['config']['lang'] ?>" lang="<?php echo $_SESSION['config']['lang'] ?>">
<head>
<title><?php echo $_SESSION['config']['applicationname']; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="<?php echo $_SESSION['config']['lang'] ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['config']['css']; ?>" media="screen" />
<!--[if lt IE 7.0]> <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['config']['css_IE']; ?>" media="screen" /> <![endif]-->
<!--[if gte IE 7.0]> <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['config']['css_IE7']; ?>" media="screen" /> <![endif]-->
<script type="text/javascript" src="js/functions.js"></script>
</head>
<body background="img/bg_home_home.gif" style="background-repeat:no-repeat;background-position:center">
<?php
$ext = strtolower($_SESSION['upfile']['format']);
if(file_exists($_SESSION['config']['tmppath'].'/tmp_file_'.$_SESSION['user']['UserId'].'.'.$ext))
{
echo "<br/><br/><div class=\"error\">"._FILE_LOADED_BUT_NOT_VISIBLE. _ONLY_FILETYPES_AUTHORISED." <br/><ul>";
for($i=0; $i< count($ext_list); $i++)
{
echo "<li>".$ext_list[$i]."</li>";
}
echo "</ul></div>";
}
else
{
echo "<br/><br/><div class=\"error\">"._PROBLEM_LOADING_FILE_TMP_DIR.".</div>";
}
?>
</body>
</html>
<?php
}
}
else
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $_SESSION['config']['lang'] ?>" lang="<?php echo $_SESSION['config']['lang'] ?>">
<head>
<title><?php echo $_SESSION['config']['applicationname']; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="<?php echo $_SESSION['config']['lang'] ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['config']['css']; ?>" media="screen" />
<!--[if lt IE 7.0]> <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['config']['css_IE']; ?>" media="screen" /> <![endif]-->
<!--[if gte IE 7.0]> <link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['config']['css_IE7']; ?>" media="screen" /> <![endif]-->
<script type="text/javascript" src="js/functions.js"></script>
</head>
<body background="img/bg_home_home.gif" style="background-repeat:no-repeat;background-position:center">
<?php
if($_SESSION['upfile']['error'] == 1)
{
$filesize = $func->return_bytes(ini_get("upload_max_filesize"));
echo "<br/><br/><div class=\"error\">"._MAX_SIZE_UPLOAD_REACHED." (".round($filesize/1024,2)."Ko Max)</div>";
}
else
{
echo "<br/><br/><div class=\"advertissement\">".$_SESSION['error'].""._ONLY_FILETYPES_AUTHORISED." <br/><ul>";
for($i=0; $i< count($ext_list); $i++)
{
$displayed_ext_list .= $ext_list[$i].", ";
}
echo "<li>".substr($displayed_ext_list, 0 ,-2)."</li>";
echo "</ul></div>";
}
$_SESSION['error'] ='';
?>
</body>
</html>
<?php
}
?>