<?php
/****************************************************************************************
SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV

Version 0.9.7

Copyright (C) 2006-2007  Sylvain FATOME
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
(in the directory docs); 
if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
Boston, MA  02110-1301, USA.

Contact : galawa@free.fr

Web : http://smitst.homelinux.com
****************************************************************************************/


// Vérification des tentatives de hack
$pos=strpos($_SERVER['PHP_SELF'],"inc.php");
if ($pos===FALSE)
	$ok_inc=TRUE;
else
	$ok_inc=FALSE;
if ($ok_inc==FALSE) header("Location: ../index.php");
?>

<br>
<div id="pas_upl" style="display:block">
	<a href="javascript:;" onclick="display('upl','block');display('pas_upl','none');")><img src="../img/view+.gif" title="T&eacute;l&eacute;charger un fichier" width="22" height="22" border="0" align="absmiddle"></a> 
	<a href="javascript:;" onclick="display('upl','block');display('pas_upl','none');"> T&eacute;l&eacute;charger un fichier</a>
</div>
<div id="upl"  style="display:none">
	<a href="javascript:;" onclick="display('pas_upl','block');display('upl','none');")><img src="../img/view-.gif" title="R&eacute;duire" width="22" height="22" border="0" align="absmiddle"></a> 
	<a href="javascript:;" onclick="display('pas_upl','block');display('upl','none');"> R&eacute;duire </a>
	<!--- Formulaire d'Upload des Fichiers Internes -->
	<div id="pas_wait" style="display:block;" align="center">
	<span class="titre_gras_soul">T&eacute;l&eacute;charger un fichier</span>
	<form action="upl_enr.php" method="POST" enctype="multipart/form-data" name="upl_maj" id="upl_maj" onSubmit="javascript:; return (verif_upl(this,tab1_champ,'',''));">
	<?PHP 
		switch ($niv_util)
		{
		case 9 :
				$max_size = $taille_maxi_admin; // Taille maximum autorisée pour téléchargement
				break;
		case 5 :
				$max_size = $taille_maxi_cge; // Taille maximum autorisée pour téléchargement
				break;
		case 4 :
				$max_size = $taille_maxi_age; // Taille maximum autorisée pour téléchargement
				break;
		case 3 :
				$max_size = $taille_maxi_tec; // Taille maximum autorisée pour téléchargement
				break;
		default : break;
		}
		$taille_maxi = sprintf("%d",($max_size/1024)/1000)." Mo";
	?>
		<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_size; ?>"><br>
		<input name="dir" type="hidden" id="dir" value="<?PHP echo @$_GET['dir'] ?>">
		<input name="ope" type="hidden" id="ope" value="<?PHP echo @$_GET['ope'] ?>">
		<input name="date" type="hidden" id="date" value="<?PHP echo @$_GET['date'] ?>">
		<input name="search" type="hidden" id="search" value="<?PHP echo @$_GET['search'] ?>">
	
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td class="rubfrm" nowrap align="right" valign="top" id="f_upload">
			<label for="upload">
			Fichier &agrave; t&eacute;l&eacute;charger
			<span class="annot_petit_it">(Dans le r&eacute;pertoire courant) </span>
			: 
			</label>
			</td>
			<td nowrap align="left">
				<input  style="margin-left:5px;" type="file" name="upload" size="100"> <br>
				<span class="annot_petit_it" style="margin-left:200px;">
				Taille maximum : 
				<?PHP
					echo  $taille_maxi;
				?>
				</span>
			</td>
		</tr>
		<tr>
			<td nowrap class="rubfrm" align="right" valign="top" id="f_name">
			<label for="name">
			Nom du fichier sur le serveur
			<span class="annot_petit_it">(Ne pas saisir d'extension) </span>
			: 
			</label>
			</td>
			<td nowrap align="left">
				<input style="margin-left:5px;" type="text" name="name" size="50"> 
				<br>
				<span class="annot_petit_it">(Sera converti en minuscules, espaces remplac&eacute;s par des &quot;&mdash;&quot;)</span>
			</td>
		</tr>
		<tr>
			<td nowrap class="rubfrm" align="right" valign="middle" id="f_desc">
			Nom complet : 
			</td>
			<td nowrap valign="middle" align="left">
				<input style="margin-left:5px;" type="text" name="desc" size="50"> 
			</td>
		</tr>
		<tr>
			<td nowrap class="rubfrm" align="right" valign="top" id="f_detail">Descriptif : </td>
			<td nowrap align="left">
			<textarea style="margin-left:5px;" name="detail" cols="90" rows="10" id="detail"></textarea>
			</td>
		</tr>						
		<tr>
			<td nowrap align="right" class="annot_std_gras" valign="middle">
			<label for="replace">Remplacer sur le serveur :		</label>
			</td>
			<td nowrap align="left">
			<?PHP
			if ($niv_util <> 9)
			{
			?>
				<input type="checkbox" name="replace" value="y" style="background : #FFFFFF;" disabled="disabled">
			<?PHP
			}
			else
			{
			?>
				<input type="checkbox" name="replace" value="y" style="background : #FFFFFF;">
			<?PHP
			}
			?>
			</td>
		</tr>
		<tr>
			<td nowrap align="right" class="annot_std_gras" valign="middle">
			<label for="check">
			V&eacute;rifier le nom du fichier :
			</label>
			</td>
			<td nowrap valign="middle" align="left">
			<?PHP
			if ($niv_util <> 9)
			{
			?>
				<input name="check" type="checkbox" value="y" style="background : #FFFFFF;" checked disabled="disabled">
			<?PHP
			}
			else
			{
			?>
				<input name="check" type="checkbox" value="y" style="background : #FFFFFF;" checked>
			<?PHP
			}
			?>
			</td>
		</tr>
		<tr>
			<td nowrap>&nbsp;</td>
			<td nowrap align="left">
				<input name="ok" type="submit" class="bton_fmarr_std" id="ok" value="Envoyer">
				<input name="RAZ" type="reset" class="bton_fmarr_std" id="RAZ" value="R&eacute;initialiser">
			</td>
		</tr>
		</table>
	</form>
	</div>
	<div id="wait" style="display:none" align="center">
	<p class="annot_gras_it" align="center">T&eacute;l&eacute;chargement en cours...</p>
	<script language="javascript">
	var barwait=createBar(300,15,'white',1,'#00FFFF','blue',85,7,0,'');
	</script>
	</div>
	<!--- Fin du Formulaire d'upload -->
</div>