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

Copyright (C) 2006  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
****************************************************************************************/

include ("../inc/config.inc.php");
?>
<?php require ("../inc/func.inc.php") ?>
<?php require ("../inc/func_log.inc.php") ?>
<?php require ("../inc/fic.inc.php") ?>

<?PHP
	Archivelog(@$HTTP_SESSION_VARS["code_log"]);

	$aff_form = FALSE;

	if ((@$_GET['name'] <> "") AND ((@$_GET['td'] == 0) OR (@$_GET['td'] == 1)))
	{
		$nom_ficdir = strtolower(@$_GET['name']);
		if (substr($nom_ficdir, 0, 1) <> '.') // Contrôle de hack
		{
			$typdde = @$_GET['td'];

			$chemin_complet = $url_gfc."/".$nom_ficdir;
			
			switch ($typdde)
			{
				case 0 :
					if (is_dir($chemin_complet))
						$aff_form = TRUE;
					break;
				case 1 :
					if (is_file($chemin_complet))
						$aff_form = TRUE;
					break;
				default :
					break;
			}
		}
	}
	else
	{
		$msg = "Syntaxe incorrecte";
	}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SMI - ESPACE PRIVE : Nommage fichier/r&eacute;pertoire</title>

<!-- Feuille de style pour les affichages courants -->
<link href="../inc/smi.css" rel="stylesheet" type="text/css">

<!-- Feuille de style & Script pour le menu -->
<link href="../inc/menu.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../coolmenus/coolmenus4.js"></script>

<!-- Scripts Javascript pour validation des formulaires -->
<script language="JavaScript" src="../inc/validator.js"></script>

<!-- Scripts Javascript pour affichages -->
<script language="JavaScript" src="../inc/aff.js"></script>

</head>

<body>
<?PHP
if ($aff_form == TRUE)
{
?>
	<p align="center"> <span class="titrepage">NOMMAGE FICHIER/REPERTOIRE</span></p>
	<br>
	<br>
	<br>
	<!--- Formulaire de renommage des fichiers ou répertoires -->
	<form action="fdren_enr.php" method="POST" enctype="multipart/form-data" name="fdren" id="fdren" onsubmit="return v.exec()">
		<input type="hidden" name="td" id="td" value="<?PHP echo @$_GET['td'] ?>"> 
		<table width="80%" border="0" cellpadding="0" cellspacing="0" align="center">
		<tr>
			<td nowrap class="tfvNormal" align="right" class="annot_std_gras" valign="middle" id="f_chemin">
			Chemin : 
			</td>
			<td nowrap valign="middle">
				<input style="margin-left:5px;" name="nom" type="text" id="nom" value="<?PHP echo @$_GET['name'] ?>"  maxlength="255" size="80" readonly="1">
				<br>
				<span class="annot_petit_it" style="margin-left:5px;">
				<?PHP
				if ($typddde == 0)
					echo "(Nota : C'est un répertoire)";
				else
					echo "(Nota : C'est un fichier)";
				?>
				</span>
			</td>
		</tr>
		<tr>
			<td nowrap class="tfvNormal" align="right" class="annot_std_gras" valign="middle" id="f_desc">
			Nom &agrave; affecter : 
			</td>
			<td nowrap valign="middle">
				<input style="margin-left:5px;" type="text" name="desc" maxlength="100" size="80"> 
			</td>
		</tr>
		</table>
		<p align="center">
		<input name="create" type="submit" id="create" value="Valider">
		<input name="init" type="reset" id="init" value="R&eacute;initialiser">
		<input name="annul" type="button" id="annul" value="Quitter" onclick="javascript:; self.close('fscomp');">
		</p>
	</form>
	<!--- Fin du Formulaire de création de répertoire -->
	<script>
	// form fields description structure
	var a_fields = {
		'desc':{'l':'Nom à affecter','r':true,'t':'f_desc','mx':100}
	},
	
	o_config = {
		'to_disable' : ['create', 'init'],
		'alert' : 1
	}
	
	// validator constructor call
	var v = new validator('fdren', a_fields, o_config);
	</script>
<?PHP
}
else
{
?>
	<p align="center" class="annot_gras_it"><?PHP echo $msg ?></p>

	<p align="center" class="annot_std_it">Retour à la liste des fichiers dans 5 secondes...</p>
	<!-- Fermeture temporisée -->
	<script type="text/javascript">
		window.opener.location.reload();
		setTimeout("self.close('fscomp');",5000)
	</script>
<?PHP
}
?>
<p align="center">Sinon, <a href="javascript:void(0)" onClick="javascript:; window.opener.location.reload(); self.close('fscomp');">cliquez ici</a> </p>


</body>
</html>
