<?php

/*
 * Squelette : plugins-dist/medias/modeles/file.html
 * Date :      Tue, 12 May 2026 08:29:50 GMT
 * Compile :   Fri, 26 Jun 2026 14:36:29 GMT
 * Boucles :   _file
 */ 

function BOUCLE_filehtml_ee71c4486ede76de4f6b49cfd4b93dec(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {

	static $command = array();
	static $connect;
	$command['connect'] = $connect = '';
	if (!isset($command['table'])) {
		$command['table'] = 'documents';
		$command['id'] = '_file';
		$command['from'] = array('documents' => 'spip_documents','L1' => 'spip_types_documents');
		$command['type'] = array();
		$command['groupby'] = array();
		$command['select'] = array("documents.media",
		"documents.id_document",
		"documents.largeur",
		"documents.hauteur",
		"L1.titre AS type_document",
		"documents.taille",
		"documents.titre",
		"L1.mime_type",
		"documents.extension");
		$command['orderby'] = array();
		$command['join'] = array('L1' => array('documents','extension'));
		$command['limit'] = '';
		$command['having'] = 
			array();
	}
	$command['where'] = 
			array(
			array('(documents.taille > 0 OR documents.distant=\'oui\')'), 
			array('=', 'documents.id_document', sql_quote(retablir_echappements_modeles(interdire_scripts(entites_html(sinon(table_valeur($Pile[0]??[], (string)'id', null), (interdire_scripts(entites_html(table_valeur($Pile[0]??[], (string)'id_document', null),true)))),true))), '', 'bigint NOT NULL AUTO_INCREMENT')));
	if (defined("_BOUCLE_PROFILER")) $timer = time()+(float)microtime();
	$t0 = "";
	// REQUETE
	$iter = Spip\Compilateur\Iterateur\Factory::create(
		"SQL",
		$command,
		array('plugins-dist/medias/modeles/file.html','html_ee71c4486ede76de4f6b49cfd4b93dec','_file',1,$GLOBALS['spip_lang'])
	);
	if (!$iter->err()) {
	$SP++;
	// RESULTATS
	while ($Pile[$SP]=$iter->fetch()) {

		$t0 .= (
'
' .
(($t1 = strval(retablir_echappements_modeles(interdire_scripts(((($Pile[$SP]['media'] == 'image')) ?' ' :'')))))!=='' ?
		($t1 . (	'
	' .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'fichier'] = (vider_url(urlencode_1738(generer_objet_url($Pile[$SP]['id_document'], 'document_fichier', '', '', true)))))) .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'width'] = (interdire_scripts($Pile[$SP]['largeur'])))) .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'height'] = (interdire_scripts($Pile[$SP]['hauteur'])))) .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'url'] = (interdire_scripts(entites_html(table_valeur($Pile[0]??[], (string)'lien', null),true))))))) :
		'') .
(($t1 = strval(retablir_echappements_modeles(interdire_scripts(((($Pile[$SP]['media'] == 'image')) ?'' :' ')))))!=='' ?
		($t1 . (	'
	' .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'image'] = (quete_logo_document(quete_document($Pile[$SP]['id_document'], ''), '', '', '', 0, 0, '')))) .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'fichier'] = (extraire_attribut(table_valeur($Pile["vars"]??[], (string)'image', null),'src')))) .
	'
	' .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'width'] = (extraire_attribut(table_valeur($Pile["vars"]??[], (string)'image', null),'width')))) .
	'
	' .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'height'] = (extraire_attribut(table_valeur($Pile["vars"]??[], (string)'image', null),'height')))) .
	'
	' .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'url'] = (interdire_scripts(entites_html(sinon(table_valeur($Pile[0]??[], (string)'lien', null), (vider_url(urlencode_1738(generer_objet_url($Pile[$SP]['id_document'], 'document', '', '', true))))),true))))))) :
		'') .
(($t1 = strval(retablir_echappements_modeles('')))!=='' ?
		('<!--' . $t1 . '


	Si largeur ou hauteur fournit en parametre, redimensionner

-->') :
		'') .
(($t1 = strval(retablir_echappements_modeles(interdire_scripts((((entites_html(sinon(table_valeur($Pile[0]??[], (string)'largeur', null), '0'),true)) OR ((interdire_scripts(entites_html(sinon(table_valeur($Pile[0]??[], (string)'hauteur', null), '0'),true))))) ?' ' :'')))))!=='' ?
		('
' . $t1 . (	'
	' .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'fichier'] = (filtrer('image_graver',filtrer('image_reduire',table_valeur($Pile["vars"]??[], (string)'fichier', null),(interdire_scripts(entites_html(sinon(table_valeur($Pile[0]??[], (string)'largeur', null), '0'),true))),(interdire_scripts(entites_html(sinon(table_valeur($Pile[0]??[], (string)'hauteur', null), '0'),true)))))))) .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'width'] = (largeur(table_valeur($Pile["vars"]??[], (string)'fichier', null))))) .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'height'] = (hauteur(table_valeur($Pile["vars"]??[], (string)'fichier', null))))) .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'fichier'] = (extraire_attribut(table_valeur($Pile["vars"]??[], (string)'fichier', null),'src')))))) :
		'') .
'
' .
retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'title'] = (($t2 = strval((interdire_scripts($Pile[$SP]['type_document']))))!=='' ?
			($t2 . (	' - ' .
		(interdire_scripts(taille_en_octets($Pile[$SP]['taille']))))) :
			''))) .
'
' .
retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'legende'] = (trim(recuperer_fond( 'modeles/document_legende' , array_merge($Pile[0],array()), array('compil'=>array('plugins-dist/medias/modeles/file.html','html_ee71c4486ede76de4f6b49cfd4b93dec','_file',0,$GLOBALS['spip_lang'])), _request('connect') ?? ''))))) .
'
' .
(($t1 = strval(retablir_echappements_modeles(interdire_scripts(((($Pile[$SP]['media'] == 'image')) ?' ' :'')))))!=='' ?
		($t1 . (	' ' .
	retablir_echappements_modeles(vide($Pile['vars'][$_zzz=(string)'title'] = (interdire_scripts(((($a = supprimer_numero(typo($Pile[$SP]['titre'], "TYPO", $connect, $Pile[0]))) OR (is_string($a) AND strlen($a))) ? $a : (table_valeur($Pile["vars"]??[], (string)'title', null))))))))) :
		'') .
'
<div
  class="' .
(($t1 = strval(retablir_echappements_modeles(filtre_medias_modele_document_standard_classes_dist($Pile,$Pile[$SP]['id_document'],'file'))))!=='' ?
		($t1 . ' ') :
		'') .
'spip_lien_ok"' .
(($t1 = strval(retablir_echappements_modeles(filtre_medias_modele_document_standard_attributs_dist($Pile,$Pile[$SP]['id_document'],'file'))))!=='' ?
		('
  ' . $t1 . '
') :
		'') .
'>
<figure class="spip_doc_inner">
' .
(($t1 = strval(retablir_echappements_modeles(attribut_url(table_valeur($Pile["vars"]??[], (string)'url', null)))))!=='' ?
		('<a href="' . $t1 . (	'"' .
	(($t2 = strval(retablir_echappements_modeles(interdire_scripts(attribut_html(concat(entites_html(table_valeur($Pile[0]??[], (string)'lien_class', null),true),' spip_doc_lien'))))))!=='' ?
			('
	class="' . $t2 . '"') :
			'') .
	' title=\'' .
	retablir_echappements_modeles(attribut_html(table_valeur($Pile["vars"]??[], (string)'title', null))) .
	'\'' .
	(($t2 = strval(retablir_echappements_modeles(interdire_scripts((entites_html(table_valeur($Pile[0]??[], (string)'lien', null),true) ? '':(	'type="' .
		(interdire_scripts(medias_mime_type_document($Pile[$SP]['id_document'], $Pile[$SP]['extension']))) .
		'"'))))))!=='' ?
			('
	' . $t2) :
			'') .
	'>')) :
		'') .
'<img src=\'' .
retablir_echappements_modeles(attribut_url(table_valeur($Pile["vars"]??[], (string)'fichier', null))) .
'\' width=\'' .
retablir_echappements_modeles(attribut_html(table_valeur($Pile["vars"]??[], (string)'width', null))) .
'\' height=\'' .
retablir_echappements_modeles(attribut_html(table_valeur($Pile["vars"]??[], (string)'height', null))) .
'\' alt=\'\' />' .
retablir_echappements_modeles((table_valeur($Pile["vars"]??[], (string)'url', null) ? '</a>':'')) .
'
' .
retablir_echappements_modeles(table_valeur($Pile["vars"]??[], (string)'legende', null)) .
'</figure>
</div>
');
	}
	$iter->free();
	}
	if (defined("_BOUCLE_PROFILER")
	AND 1000*($timer = (time()+(float)microtime())-$timer) > _BOUCLE_PROFILER)
		spip_log(intval(1000*$timer)."ms BOUCLE_file @ plugins-dist/medias/modeles/file.html","profiler"._LOG_AVERTISSEMENT);
	return $t0;
}

//
// Fonction principale du squelette plugins-dist/medias/modeles/file.html
// Temps de compilation total: 14.746 ms
//

function html_ee71c4486ede76de4f6b49cfd4b93dec($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) {

	if (isset($Pile[0]["doublons"]) AND is_array($Pile[0]["doublons"]))
		$doublons = nettoyer_env_doublons($Pile[0]["doublons"]);

	$connect = '';
	$page = (
BOUCLE_filehtml_ee71c4486ede76de4f6b49cfd4b93dec($Cache, $Pile, $doublons, $Numrows, $SP) .
'
' .
retablir_echappements_modeles('<' . '?php header("X-Spip-Filtre: '.'trim' . '"); ?'.'>'));

	return analyse_resultat_skel('html_ee71c4486ede76de4f6b49cfd4b93dec', $Cache, $page, 'plugins-dist/medias/modeles/file.html');
}
