edd52870be840e4b0bb1b74f4e2f7f3da7173377
[lhc/web/www.git] / www / ecrire / inc / informer.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2017 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
8 * *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
12
13 if (!defined('_ECRIRE_INC_VERSION')) {
14 return;
15 }
16
17 # Les information d'une rubrique selectionnee dans le mini navigateur
18
19 // http://code.spip.net/@inc_informer_dist
20 function inc_informer_dist($id, $col, $exclus, $rac, $type, $do = 'aff') {
21 include_spip('inc/texte');
22 $titre = $descriptif = '';
23 if ($type == "rubrique") {
24 $row = sql_fetsel("titre, descriptif", "spip_rubriques", "id_rubrique = " . intval($id));
25 if ($row) {
26 $titre = typo($row["titre"]);
27 $descriptif = propre($row["descriptif"]);
28 } else {
29 $titre = _T('info_racine_site');
30 }
31 }
32
33 $res = '';
34 if ($type == "rubrique" and $GLOBALS['spip_display'] != 1 and isset($GLOBALS['meta']['image_process'])) {
35 if ($GLOBALS['meta']['image_process'] != "non") {
36 $chercher_logo = charger_fonction('chercher_logo', 'inc');
37 if ($res = $chercher_logo($id, 'id_rubrique', 'on')) {
38 list($fid, $dir, $nom, $format) = $res;
39 include_spip('inc/filtres_images_mini');
40 $res = image_reduire("<img src='$fid' alt='' />", 100, 48);
41 if ($res) {
42 $res = "<div style='float: " . $GLOBALS['spip_lang_right'] . "; margin-" . $GLOBALS['spip_lang_right'] . ": -5px; margin-top: -5px;'>$res</div>";
43 }
44 }
45 }
46 }
47
48 $rac = spip_htmlentities($rac, ENT_QUOTES);
49 $do = spip_htmlentities($do, ENT_QUOTES);
50 $id = intval($id);
51
52 # ce lien provoque la selection (directe) de la rubrique cliquee
53 # et l'affichage de son titre dans le bandeau
54 $titre = strtr(str_replace("'", "&#8217;",
55 str_replace('"', "&#34;", textebrut($titre))),
56 "\n\r", " ");
57
58 $js_func = $do . '_selection_titre';
59
60 return "<div style='display: none;'>"
61 . "<input type='text' id='" . $rac . "_sel' value='$id' />"
62 . "<input type='text' id='" . $rac . "_sel2' value=\""
63 . entites_html($titre)
64 . "\" />"
65 . "</div>"
66 . "<div class='informer' style='padding: 5px; border-top: 0px;'>"
67 . (!$res ? '' : $res)
68 . "<p><b>" . safehtml($titre) . "</b></p>"
69 . (!$descriptif ? '' : "<div>" . safehtml($descriptif) . "</div>")
70 . "<div style='text-align: " . $GLOBALS['spip_lang_right'] . ";'>"
71 . "<input type='submit' class='fondo' value='"
72 . _T('bouton_choisir')
73 . "'\nonclick=\"$js_func('$titre',$id,'selection_rubrique','id_parent'); return false;\" />"
74 . "</div>"
75 . "</div>";
76 }