Your IP : 216.73.216.59


Current Path : /home/quelfutuu/www/lchg/squelettes/
Upload File :
Current File : /home/quelfutuu/www/lchg/squelettes/article-Archivage.html

<BOUCLE_principale(ARTICLES) {id_article}>
<!DOCTYPE html>
<!--.html dir="#LANG_DIR" lang="#LANG" class="[(#LANG_DIR)][ (#LANG)] no-js"-->
<html dir="#LANG_DIR" lang="#LANG" class="[(#LANG_DIR)][ (#LANG)]">
<head>
    <meta charset="utf-8" />
	<script type='text/javascript'>/*<![CDATA[*/(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement);/*]]>*/</script>
	<title>[(#TITRE|couper{80}|textebrut) - ][(#NOM_SITE_SPIP|textebrut)]</title>
	<link rel="stylesheet" href="lchg/lchgstyle.css" type="text/css" />
    <script type="text/javascript" src="lchg/lchgscript.js" /></script>
	[<meta name="description" content="(#INTRODUCTION{150}|attribut_html)" />]
	[<link rel="canonical" href="(#URL_ARTICLE|url_absolue{#URL_SITE_SPIP})" />]
	<INCLURE{fond=inclure/head} />

</head>

<body class="pas_surlignable page_article">
<div class="page">

	<INCLURE{fond=inclure/header} />
	<INCLURE{fond=inclure/nav,env} />
	
	<main class="main" role="main" style="width:100%; padding: 0.1em 0 0 0.1em">
		[(#REM) Contenu principal : contenu de l'article]
		<div class="wrapper hfeed" style="width:100%; background-color:#e4f6ce">
		<div class="content hentry" id="content">
			<p class="arbo"><a href="#URL_SITE_SPIP/"><:accueil_site:></a><BOUCLE_ariane(HIERARCHIE){id_article}> &gt; <a href="#URL_RUBRIQUE">[(#TITRE|couper{80})]</a></BOUCLE_ariane>[ &gt; <strong class="on">(#TITRE|couper{80})</strong>]</p>
	
			<div class="cartouche clearfix">
				[<p class="#EDIT{surtitre} surtitre">(#SURTITRE)</p>]
				<h1 class="#EDIT{titre} surlignable entry-title">[(#LOGO_ARTICLE_RUBRIQUE|image_reduire{150,*}) ]#TITRE</h1>
				[<p class="#EDIT{soustitre} soustitre">(#SOUSTITRE)</p>]
				<!--.p class="info-publi"><abbr class="published" title="[(#DATE|date_iso)]">[(#DATE|nom_jour) ][(#DATE|affdate)]</abbr>[<span class="sep">, </span><span class="auteurs"><:par_auteur:> (#LESAUTEURS)</span>]</p-->
				[(#REM) Inclure le modele des liens de traductions ]
				#MODELE{article_traductions}
			</div>
			
			[<div class="#EDIT{chapo} chapo surlignable">(#CHAPO|image_reduire{672,*})</div>]
			
	
<!--. ===================================================================================================== -->		
			

<div id="form_supprime"></div>
<div id="form_renomme"></div>
<!--.p class="right"><b><a href="aide.html">Aide</a> - <a href="https://lchg.quelfutur.org/spip.php?article16">Retour</a></b></p-->  
<p class="right"><b><a href="aide.html">Aide</a></b></p>  
<!--.h2>Fichiers de <b><i>la Commune</i></b></h2-->
<h4>Ajouter un fichier</h4>
<?php
	setlocale(LC_TIME, 'fr_FR');
	$relPath = "lchg/depot/";
	$relTrashPath = "lchg/trash/";

	if (isset($_POST['fichier_a_supprimer'])) {
		$oldFullFilePath = $relPath . $_POST['fichier_a_supprimer'];
		$newFullFilePath = TrashPath($oldFullFilePath);
//		echo "old: " . $oldFullFilePath . ", new: $newFullFilePath";
//		$trashList = getFileList($relTrashPath);
		rename($oldFullFilePath, $newFullFilePath);
	}

	if (isset($_POST['fichier_a_renommer']) && isset($_POST['nouveau_nom'])) {
		$newFullFilePath = $relPath . SupprimeAccentsEtBlancs($_POST['nouveau_nom']);
		$oldFullFilePath = $relPath . $_POST['fichier_a_renommer'];
		rename($oldFullFilePath, $newFullFilePath);
	}

	//  display  file  upload  form
	if  (!isset($_POST['submit']))  { ?>
		<!--.form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']?>" method="post"-->
		<form enctype="multipart/form-data" action="#URL_SITE_SPIP/#URL_ARTICLE" method="post">
		<input type="hidden" name="MAX_FILE_SIZE" value="5000000" /> Choisir un fichier &agrave; t&eacute;l&eacute;verser
		<input type="file" name="data"/>    <!--.br /-->
		<input type="submit" name="submit" value="T&eacute;l&eacute;verser le fichier" />
		</form><br>
	<?php
	} 
	else  {
		foreach($_FILES as &$file) $file['name'] = SupprimeAccentsEtBlancs($file['name']);
		unset($file);
		// check for existing file
		$dirList = getFileList($relPath);
		foreach($dirList as $file) {
			if ($_FILES['data']['name'] == $file['basename']) my_die("\nERREUR: le fichier '".$file['basename']."' est d&eacute;j&agrave; pr&eacute;sent !"); 
		}
		//  check  uploaded  file  size
		if  ($_FILES['data']['size']  ==  0) my_die("\nERREUR: Absence de fichier, fichier vide ou fichier trop gros (> 5 Mo) !");
		//  check  if  file  type  is  allowed  (optional)
		$allowedFileTypes  =  array(
			"application/vnd.oasis.opendocument.spreadsheet",
			"application/vnd.oasis.opendocument.text",
			"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
			"application/msword",
			"image/jpg", "image/jpeg",
			"application/pdf",
			"text/plain"
			//		, "image/png", "image/gif",  "image/jpg",  "image/jpeg",  "image/pjpeg"
		);
		if  (!in_array($_FILES['data']['type'],  $allowedFileTypes)) {
			my_die("ERREUR: '".$file['basename']."',type de fichier non accept&eacute;.");
		} //  check  if  this  is  a  valid  upload	
		if  (!is_uploaded_file($_FILES['data']['tmp_name']))   {
			my_die("ERREUR: Le t&eacute;l&eacute;versement a &eacute;chou&eacute;");
		} //  set  the  name  of  the  target  directory
		move_uploaded_file($_FILES['data']['tmp_name'], $relPath.$_FILES['data']['name']) or my_die("Impossible de copier le fichier");
		echo  '- Fichier <i>'.$_FILES['data']['name'].'</i> correctement enregistr&eacute; : <b><a href="#URL_SITE_SPIP/#URL_ARTICLE"> Continuer...</a></b>';
 	}
// Liste des fichiers
	echo "<h4>Liste des fichiers</h4>";
	//IF THE sort FLAG HASN'T BEEN SET YET, SET THE DEFAULT
	$dirList = getFileList($relPath);
	if(!isset($_GET['triPar'])) {
   	$_GET['triPar'] = 'nom';
	}
	switch($_GET['triPar']) {
		case 'taille' : $sortres = usort($dirList, 'compsize'); break;
		case 'nom' : $sortres = usort($dirList, 'compname'); break;
		case 'date' : $sortres = usort($dirList, 'compdate'); break;
	}
	$sortOnName = '<a href="#URL_SITE_SPIP/#URL_ARTICLE?triPar=nom">Nom</a>';
	$sortOnDate = '<a href="#URL_SITE_SPIP/#URL_ARTICLE?triPar=date">Date de mise en ligne</a>';
	$sortOnSize = '<a href="#URL_SITE_SPIP/#URL_ARTICLE?triPar=taille">Taille</a>';
// output file list in HTML TABLE format
	echo "<table border=\"1\" style=width:100%>\n";
	echo "<thead>\n";
	echo "<tr><th>$sortOnName</th><th>$sortOnSize</th><th>$sortOnDate</th></tr>\n";
		echo "</thead>\n";
		echo "<tbody>\n";
		foreach($dirList as $file) {
			echo "<tr>\n";
			echo "<td><a href=\"$relPath{$file['basename']}\" type=\"{$file['type']}\">{$file['basename']}</a></td>\n";
			if ($file['size'] > 999999) $fsize = number_format($file['size']/1000000, 1, ',', ' ')." Mo";
			elseif ($file['size'] > 999) $fsize = number_format($file['size']/1000, 1, ',', ' ')." ko";
			else $fsize = $file['size']." octets";
			echo "<td class=\"center\">$fsize </td>";
			echo "<td > " . utf8_encode(strftime('%A %d %B %Y %H:%M', $file['lastmod'])) . "</td>\n";
			echo '<td> <div class="dropdown"> <button onclick="menudisplay(\'', $file['basename'], '\')" class="dropbtn"> Modifier </button>';
			echo '<div id="Menu-', $file['basename'], '" class="dropdown-content"> <a href="" onclick="renomme(\'', $file['basename'], '\', event)">Renommer</a>';
			echo '<a href="" onclick="supprime(\'', $file['basename'], '\', event)">Supprimer</a> </div>';
			echo '</div></td>'; 
			echo "</tr>\n";
		}
		echo "</tbody>\n";
		echo "</table>\n\n";

		function getFileList($dir) {
			// array to hold return value
			$retval = array();
			// add trailing slash if missing
			if(substr($dir, -1) != "/") $dir .= "/";
			// open pointer to directory and read list of files
			$d = @dir($dir) or my_die("ERREUR: r&eacute;pertoire inaccessible, contacter l'administrateur.");
			while(false !== ($entry = $d->read())) {
			// skip hidden files
			if($entry[0] == ".") continue;
			if(is_dir("$dir$entry")) {
				$retval[] = array(
					"name" => "$dir$entry",
					"basename" => basename("$dir$entry"),
					"type" => filetype("$dir$entry"),
					"size" => 0,
					"lastmod" => filemtime("$dir$entry")
				);
			} elseif(is_readable("$dir$entry")) {
				$retval[] = array(
					"name" => "$dir$entry",
					"basename" => basename("$dir$entry"),
					"type" => mime_content_type("$dir$entry"),
					"size" => filesize("$dir$entry"),
					"lastmod" => filemtime("$dir$entry")
				);
			}
		}
		$d->close();
		return $retval;
	}
	
	function compname($filea, $fileb) {
  		return(strcmp(mb_strtoupper($filea['basename']), mb_strtoupper($fileb['basename'])));
	}
	function compsize($filea, $fileb) {
 // 		return($filea['size'] > $fileb['size'] ? 0 : 1);
	 		return($filea['size'] <=> $fileb['size']);
	}
	function compdate($filea, $fileb) {
 // 		return($filea['lastmod'] > $fileb['lastmod'] ? 0 : 1);
  		return($filea['lastmod'] <=> $fileb['lastmod']);
	}
	function my_die($message) {
		die($message . ' <b><a href="' . $_SERVER['PHP_SELF'] . '">Retour...</a></b>');
	}
	
	function SupprimeAccentsEtBlancs($str, $encoding='utf-8') {
		$str = str_replace(" ", "_", $str);
		$str = str_replace("'", "_", $str);
		// transformer les caract&egrave;res accentu&eacute;s en entit&eacute;s HTML
   	$str = htmlentities($str, ENT_NOQUOTES, $encoding);
		$str = preg_replace('#&([A-za-z])(?:acute|grave|cedil|circ|orn|ring|slash|th|tilde|uml);#', '\1', $str);
		// Remplacer les ligatures tel que : Œ, &AElig; ...
		// Exemple "&oelig;" => "oe"
		$str = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $str);
		// Supprimer tout le reste
		$str = preg_replace('#&[^;]+;#', '', $str);
		return $str;
	}

	function TrashPath($fullFilePath) {
		global $relTrashPath;
		$trashList = getFileList($relTrashPath);
		$count = 1;
		$pathParts = pathinfo($fullFilePath);
		$newFullFilePath = $relTrashPath . $pathParts['basename'];
		while(FileExists($trashList, $newFullFilePath)) {
			$tempFileName = sprintf("%s (%d)", $pathParts['filename'], $count++);
			$newFullFilePath = $relTrashPath . $tempFileName;
		}
		return $newFullFilePath;
	}

	function FileExists($trashList, $fullFilePath) {
		foreach ($trashList as $file) {
			if ($fullFilePath == $file['name']) return true;
		}
		return false;
	}
?>

<!--. ===================================================================================================== -->				
			
			
			[<div class="#EDIT{texte} texte surlignable clearfix">(#TEXTE|image_reduire{672,*})</div>]
		
			[<hr /><p class="#EDIT{hyperlien} hyperlien"><:voir_en_ligne:> : <a href="(#URL_SITE)">[(#NOM_SITE|sinon{[(#URL_SITE|couper{80})]})]</a></p>]
			[<div class="#EDIT{ps} ps surlignable"><hr />(#PS|image_reduire{672,*})</div>]
		
			[(#REM) Gestion du portfolio et des documents ]
			[(#INCLURE{fond=inclure/documents,id_article,id_rubrique='',env})]
	
			[(#REM) Petition :
			La petition ayant une PAGINATION il faut absolument {env}
			et pourquoi pas ajax
			][(#PETITION|oui)<INCLURE{fond=inclure/petition,id_article,env,ajax} />]
			
			[<div class="notes"><hr />(#NOTES)</div>]
			
			[(#REM) Forum de l'article ]
			<INCLURE{fond=inclure/forum,id_article} />
			[<h2 class="forum-titre"><:forum:form_pet_message_commentaire:></h2>
			(#FORMULAIRE_FORUM)]
	
		</div><!--.content-->
		</div><!--.wrapper-->
	
	
		<!--.aside class="aside" role="complementary">
		
			<INCLURE{fond=inclure/navsub, id_rubrique} />
			#FORMULAIRE_RECHERCHE
	
			[(#REM) Articles dans la meme rubrique ] 
			<B_articles_rubrique>
			<div class="menu">
				<h2><:meme_rubrique:></h2>
				<ul>
					<BOUCLE_articles_rubrique(ARTICLES) {id_rubrique} {!par date} {0,10}>
					<li><a href="#URL_ARTICLE"[ class="(#EXPOSE)"]>#TITRE</a></li>
					</BOUCLE_articles_rubrique>
				</ul>
			</div>
			</B_articles_rubrique>
	
			[(#REM) Menu de navigation mots-cles ]
			#MODELE{article_mots}
			
		</aside><!--.aside-->
	</main><!--.main-->

	<INCLURE{fond=inclure/footer,self=#SELF} />

</div><!--.page-->
</body>
</html>
</BOUCLE_principale>