3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2011 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
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 \***************************************************************************/
13 if (!defined('_ECRIRE_INC_VERSION')) return;
14 include_spip('inc/afficher_objets');
15 // Fonction appelee dans une boucle, calculer les invariants au premier appel.
17 // http://doc.spip.org/@inc_formater_article_dist
18 function inc_formater_article_dist($row, $own='')
20 global $spip_lang_right, $spip_display;
22 static $chercher_logo, $img_admin, $formater_auteur, $nb, $langue_defaut, $afficher_langue, $puce_statut;
24 $id_article = $row['id_article'];
26 if (!autoriser('voir','article',$id_article)) return '';
29 $chercher_logo = ($spip_display != 1 AND $spip_display != 4 AND $GLOBALS['meta']['image_process'] != "non");
31 $chercher_logo = charger_fonction('chercher_logo', 'inc');
32 $formater_auteur = charger_fonction('formater_auteur', 'inc');
33 $img_admin = http_img_pack("admin-12.gif", "", " width='12' height='12'", _T('titre_image_admin_article'));
35 if (($GLOBALS['meta']['multi_rubriques'] == 'oui' AND (!isset($GLOBALS['id_rubrique']))) OR $GLOBALS['meta']['multi_articles'] == 'oui') {
36 $afficher_langue = true;
37 $langue_defaut = !isset($GLOBALS['langue_rubrique'])
38 ?
$GLOBALS['meta']['langue_site']
39 : $GLOBALS['langue_rubrique'];
41 $puce_statut = charger_fonction('puce_statut', 'inc');
46 if ($logo = $chercher_logo($id_article, 'id_article', 'on')) {
47 list($fid, $dir, $nom, $format) = $logo;
48 include_spip('inc/filtres_images_mini');
49 $logo = image_reduire("<img src='$fid' alt='' />", 26, 20);
53 $titre = sinon($row['titre'], _T('ecrire:info_sans_titre'));
54 $id_rubrique = $row['id_rubrique'];
56 $statut = $row['statut'];
57 $descriptif = $row['descriptif'];
58 $lang_dir = lang_dir(($lang = $row['lang']) ?
changer_typo($lang):'');
62 . generer_url_ecrire("articles","id_article=$id_article")
64 . (!$descriptif ?
'' :
65 (' title="'.attribut_html(typo($descriptif)).'"'))
68 ("<span style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>" . $logo . "</span>"))
69 . (acces_restreint_rubrique($id_rubrique) ?
$img_admin : '')
70 . typo(supprime_img($titre,''))
71 . (!($afficher_langue AND $lang != $GLOBALS['meta']['langue_site'] AND strlen($lang)) ?
'' :
72 (" <span class='spip_xx-small' style='color: #666666' dir='$lang_dir'>(".traduire_nom_langue($lang).")</span>"))
73 . (!$row['petition'] ?
'' :
74 ("</a> <a href='" . generer_url_ecrire('controle_petition', "id_article=$id_article") . "' class='spip_xx-small' style='color: red'>"._T('lien_petitions')))
78 if ($spip_display == 4) return array($lien);
80 $puce = $puce_statut($id_article, $statut, $id_rubrique,'article');
82 $auteurs = auteurs_article($id_article);
83 foreach ($auteurs as $k => $r) {
84 list(, $mail, $nom,,) = $formater_auteur($r['id_auteur']);
85 $auteurs[$k]= "$mail $nom";
88 $date = affdate_jourcourt($date);
89 if (!$date) $date = ' ';
91 $num = afficher_numero_edit($id_article, 'id_article', 'article');
93 // Afficher le numero (JMB)
95 return array($puce, $lien, join('<br />', $auteurs), $date, $num);