function BOUCLE_documenthtml_b8a8020987dd01f8087ad24f961857eb(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; $in = array(); if (!is_array($a = @$Pile[0]['mode'])) { $in[] = $a; } else { $in = array_merge($in, $a); } if (!isset($command['table'])) { $command['table'] = 'documents'; $command['id'] = '_document'; $command['from'] = array('documents' => 'spip_documents', 'L1' => 'spip_types_documents'); $command['type'] = array(); $command['groupby'] = array(); $command['select'] = array("documents.id_document", "L1.titre AS type_document", "documents.taille", "documents.mode", "documents.largeur", "documents.hauteur", "documents.titre", "L1.mime_type"); $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(@$Pile[0]['id_document'], '', 'bigint(21) NOT NULL AUTO_INCREMENT')), !(is_array(@$Pile[0]['mode']) ? count(@$Pile[0]['mode']) : strlen(@$Pile[0]['mode'])) ? '' : (is_array(@$Pile[0]['mode']) ? sql_in('documents.mode', sql_quote($in)) : array('=', 'documents.mode', sql_quote(@$Pile[0]['mode'], '', 'varchar(10) NOT NULL DEFAULT \'document\'')))); if (defined("_BOUCLE_PROFILER")) { $timer = time() + microtime(); } $t0 = ""; // REQUETE $iter = IterFactory::create("SQL", $command, array('plugins-dist/medias/modeles/img.html', 'html_b8a8020987dd01f8087ad24f961857eb', '_document', 1, $GLOBALS['spip_lang'])); if (!$iter->err()) { $SP++; // RESULTATS while ($Pile[$SP] = $iter->fetch()) { $t0 .= ' ' . vide($Pile['vars'][$_zzz = (string) 'image'] = interdire_scripts(($a = match(entites_html(sinon(table_valeur(@$Pile[0], (string) 'mode_force', null), interdire_scripts($Pile[$SP]['mode'])), true), 'image|vignette') or is_string($a) and strlen($a)) ? $a : interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'embed', null), true)) ? ' ' : '')) . (($t1 = strval(table_valeur($Pile["vars"], (string) 'image', null))) !== '' ? $t1 . (' <span class=\'spip_document_' . $Pile[$SP]['id_document'] . ' spip_documents' . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'align', null), true)))) !== '' ? ' spip_documents_' . $t2 : '') . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'class', null), true)))) !== '' ? ' ' . $t2 : '') . ' spip_lien_ok\'' . (($t2 = strval(interdire_scripts(match(entites_html(table_valeur(@$Pile[0], (string) 'align', null), true), 'left|right')))) !== '' ? ' style=\'float:' . $t2 . ';\'' : '') . '> ' . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lien', null), true)))) !== '' ? '<a href="' . $t2 . ('"' . (($t3 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lien_class', null), true)))) !== '' ? ' class="' . $t3 . '"' : '') . '>') : '') . '<img src=\'' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_document'], 'document', '', '', true))) . '\'' . (($t2 = strval(interdire_scripts($Pile[$SP]['largeur']))) !== '' ? ' width="' . $t2 . '"' : '') . (($t2 = strval(interdire_scripts($Pile[$SP]['hauteur']))) !== '' ? ' height="' . $t2 . '"' : '') . ' alt="' . interdire_scripts(texte_backend(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))) . '"' . (($t2 = strval(interdire_scripts(texte_backend(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))))) !== '' ? ' title="' . $t2 . '"' : '') . ' />' . interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lien', null), true) ? '</a>' : '') . '</span> ') : '') . (!table_valeur($Pile["vars"], (string) 'image', null) ? ' ' . (' ' . vide($Pile['vars'][$_zzz = (string) 'fichier'] = extraire_attribut(quete_logo_document(quete_document($Pile[$SP]['id_document'], ''), '', '', '', 0, 0, ''), 'src')) . ' ' . vide($Pile['vars'][$_zzz = (string) 'width'] = extraire_attribut(quete_logo_document(quete_document($Pile[$SP]['id_document'], ''), '', '', '', 0, 0, ''), 'width')) . ' ' . vide($Pile['vars'][$_zzz = (string) 'height'] = extraire_attribut(quete_logo_document(quete_document($Pile[$SP]['id_document'], ''), '', '', '', 0, 0, ''), 'height')) . ' <span class=\'spip_document_' . $Pile[$SP]['id_document'] . ' spip_documents' . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'align', null), true)))) !== '' ? ' spip_documents_' . $t2 : '') . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'class', null), true)))) !== '' ? ' ' . $t2 : '') . ' spip_lien_ok\'' . (($t2 = strval(interdire_scripts(match(entites_html(table_valeur(@$Pile[0], (string) 'align', null), true), 'left|right')))) !== '' ? ' style=\'float:' . $t2 . (';' . (($t3 = strval(table_valeur($Pile["vars"], (string) 'width', null))) !== '' ? ' width:' . $t3 . 'px;' : '') . '\'') : '') . '><a href="' . interdire_scripts(($a = entites_html(table_valeur(@$Pile[0], (string) 'lien', null), true) or is_string($a) and strlen($a)) ? $a : vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_document'], 'document', '', '', true)))) . '"' . (($t2 = strval(interdire_scripts(entites_html(table_valeur(@$Pile[0], (string) 'lien', null), true) ? '' : 'type="' . interdire_scripts($Pile[$SP]['mime_type']) . '"'))) !== '' ? ' ' . $t2 : '') . (($t2 = strval(interdire_scripts(texte_backend(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))))) !== '' ? ' title="' . $t2 . '"' : '') . '><img src=\'' . table_valeur($Pile["vars"], (string) 'fichier', null) . '\' width=\'' . table_valeur($Pile["vars"], (string) 'width', null) . '\' height=\'' . table_valeur($Pile["vars"], (string) 'height', null) . '\' alt=\'' . interdire_scripts(attribut_html(strlen(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0])) ? interdire_scripts(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0])) . ' {' . interdire_scripts($Pile[$SP]['type_document']) . '}' : interdire_scripts($Pile[$SP]['type_document']))) . '\' /></a></span> ') : ''); } $iter->free(); } if (defined("_BOUCLE_PROFILER") and 1000 * ($timer = time() + microtime() - $timer) > _BOUCLE_PROFILER) { spip_log(intval(1000 * $timer) . "ms BOUCLE_document @ plugins-dist/medias/modeles/img.html", "profiler" . _LOG_AVERTISSEMENT); } return $t0; }
function tags2dcsubject($tags) { $subjects = ''; foreach (extraire_balises($tags, 'a') as $e) { if (extraire_attribut($e, rel) == 'tag') { $subjects .= '<dc:subject>' . texte_backend(textebrut($e)) . '</dc:subject>' . "\n"; } } return $subjects; }
function inc_lien_dist($lien, $texte='', $class='', $title='', $hlang='', $rel='', $connect='') { // Si une langue est demandee sur un raccourci d'article, chercher // la traduction ; // - [{en}->art2] => traduction anglaise de l'article 2, sinon art 2 // - [{}->art2] => traduction en langue courante de l'art 2, sinon art 2 if ($hlang AND $match = typer_raccourci($lien)) { @list($type,,$id,,$args,,$ancre) = $match; if ($id_trad = sql_getfetsel('id_trad', 'spip_articles', "id_article=$id") AND $id_dest = sql_getfetsel('id_article', 'spip_articles', "id_trad=$id_trad AND statut<>'refuse' AND lang=" . sql_quote($hlang)) ) $lien = "$type$id_dest"; else $hlang = ''; } $mode = ($texte AND $class) ? 'url' : 'tout'; $lien = calculer_url($lien, $texte, $mode, $connect); if ($mode === 'tout') { $texte = $lien['titre']; if (!$class AND isset($lien['class'])) $class = $lien['class']; $lang = isset($lien['lang']) ?$lien['lang'] : ''; $mime = isset($lien['mime']) ? " type='".$lien['mime']."'" : ""; $lien = $lien['url']; } if (substr($lien,0,1) == '#') # ancres pures (internes a la page) $class = 'spip_ancre'; elseif (preg_match('/^\s*mailto:/',$lien)) # pseudo URL de mail $class = "spip_mail"; elseif (preg_match('/^<html>/',$texte)) # cf traiter_lien_explicite $class = "spip_url spip_out"; elseif (!$class) { # spip_out sur les URLs externes if (preg_match(',^\w+://,iS', $lien) AND strncasecmp($lien, url_de_base(), strlen(url_de_base())) ) $class = "spip_out"; # si pas spip_in|spip_glossaire } // Si l'objet n'est pas de la langue courante, on ajoute hreflang if (!$hlang AND $lang!==$GLOBALS['spip_lang']) $hlang = $lang; $lang = ($hlang ? " hreflang='$hlang'" : ''); if ($title) $title = ' title="'.texte_backend($title).'"'; else $title = ''; // $title peut etre 'false' // rel=external pour les liens externes if (preg_match(',^https?://,S', $lien) AND false === strpos("$lien/", url_de_base())) $rel = trim("$rel external"); if ($rel) $rel = " rel='$rel'"; $lien = "<a href=\"".str_replace('"', '"', $lien)."\" class='$class'$lang$title$rel$mime>$texte</a>"; # ceci s'execute heureusement avant les tableaux et leur "|". # Attention, le texte initial est deja echappe mais pas forcement # celui retourne par calculer_url. # Penser au cas [<imgXX|right>->URL], qui exige typo('<a>...</a>') return typo($lien, true, $connect); }
function crayons_boutons($boutons = array()) { $crayonsImgPath = dirname(url_absolue(find_in_path('images/cancel.png'))); $boutons['submit'] = array('ok', texte_backend(_T('bouton_enregistrer'))); $boutons['cancel'] = array('cancel', texte_backend(_T('crayons:annuler'))); $html = ''; foreach ($boutons as $bnam => $bdef) if ($bdef) { $html .= '<button type="button" class="crayon-' . $bnam . '" title="' . $bdef[1] . '">' . $bdef[1] . '</button>'; } if ($html) return '<div class="crayon-boutons"><div>'.$html.'</div></div>'; }
/** * Fabriquer les boutons du formulaire * * @param array $boutons * Le tableau des boutons * @return string * Le html des boutons */ function crayons_boutons($boutons = array()) { $boutons['submit'] = array('ok', texte_backend(_T('bouton_enregistrer'))); $boutons['cancel'] = array('cancel', texte_backend(_T('crayons:annuler'))); $html = ''; foreach ($boutons as $bnam => $bdef) { if ($bdef) { $html .= '<button type="button" class="crayon-' . $bnam . '" title="' . $bdef[1] . '">' . $bdef[1] . '</button>'; } } if ($html) { return '<div class="crayon-boutons"><div>' . $html . '</div></div>'; } }
function liste_archive_taille($files) { $res = ''; foreach ($files as $nom => $file) { $date = date_interface(date("Y-m-d H:i:s", $file['mtime'])); $taille = taille_en_octets($file['size']); $res .= "<li title=\"".texte_backend($title)."\"><b>$nom</b> – $taille<br /> $date</li>\n"; } return $res; }