Newer
Older
//
// Ce fichier ne sera execute qu'une fois
if (defined("_ECRIRE_INC_PRESENTATION")) return;
define("_ECRIRE_INC_PRESENTATION", "1");
include_ecrire ("inc_lang.php3");
utiliser_langue_visiteur();
//
//
function aide($aide='') {
global $couleur_foncee, $spip_lang, $spip_lang_rtl, $spip_display;
if (!$aide OR $spip_display == 4) return;
return " <a class='aide' href=\"". _DIR_RESTREINT .
"aide_index.php3?aide=$aide&var_lang=$spip_lang\" target=\"spip_aide\" ".
"onclick=\"javascript:window.open(this.href, 'spip_aide', 'scrollbars=yes, ".
"resizable=yes, width=740, height=580'); return false;\">
<img ".
"src=\"". _DIR_IMG_PACK . "aide.gif\" alt=\""._T('info_image_aide')."\" ".
"title=\""._T('titre_image_aide')."\" width=\"12\" height=\"12\" border=\"0\" ".
"align=\"middle\"></a>";
}
//
// affiche un bouton imessage
//
function bouton_imessage($destinataire, $row = '') {
// si on passe "force" au lieu de $row, on affiche l'icone sans verification
global $connect_id_auteur;
$url = new Link("message_edit.php3");
// verifier que ce n'est pas un auto-message
if ($destinataire == $connect_id_auteur)
return;
// verifier que le destinataire a un login
if ($row != "force") {
$login_req = "select login, messagerie from spip_auteurs where id_auteur=$destinataire AND en_ligne>DATE_SUB(NOW(),INTERVAL 15 DAY)";
$row = spip_fetch_array(spip_query($login_req));
if (($row['login'] == "") OR ($row['messagerie'] == "non")) {
return;
}
}
$url->addVar('dest',$destinataire);
$url->addVar('new','oui');
$url->addVar('type','normal');
if ($destinataire) $title = _T('info_envoyer_message_prive');
else $title = _T('info_ecire_message_prive');
$texte_bouton = http_img_pack("m_envoi$spip_lang_rtl.gif", "width='14' height='7' border='0' alt='m>' title='$title'");
$ret .= "<a href='". $url->getUrl() ."' title=\"$title\">";
$ret .= "$texte_bouton</a>";
return $ret;
}
// Faux HR, avec controle de couleur
function hr($color, $retour = false) {
$ret = "<div style='height: 1px; margin-top: 5px; padding-top: 5px; border-top: 1px solid $color;'></div>";
if ($retour) return $ret;
else echo $ret;
}
//
//
function debut_cadrex($style, $icone = "", $fonction = "", $titre = "") {
global $browser_name;
static $accesskey = 97; // a
// accesskey pour accessibilite espace prive
$accesskey_c = chr($accesskey++);
$ret = "<a name='access-$accesskey_c' href='#access-$accesskey_c' accesskey='$accesskey_c'></a>";
$ret .= "<div style='position: relative; z-index: 1;'>";
if ($spip_display != 1 AND $spip_display != 4 AND strlen($icone) > 1) {
$style_gauche = " padding-$spip_lang_left: 38px;";
$ret .= "<div style='position: absolute; top: 0px; $spip_lang_left: 10px; z-index: 2;'>";
if ($fonction) {
$ret .= "<div " . http_style_background($icone, "no-repeat; padding: 0px; margin: 0px;'");
$ret .= http_img_pack($fonction, "alt=''");
else $ret .= http_img_pack("$icone", "alt=''");
$style_cadre = " style='position: relative; top: 15px; margin-bottom: 14px; z-index: 1;'";
if ($style == "e") {
$ret .= "<div class='cadre-e-noir'$style_cadre><div class='cadre-$style'>";
ARNO*
a validé
}
else {
ARNO*
a validé
}
if ($spip_display == 4) {
$ret .= "<h3 class='cadre-titre'>$titre</h3>";
} else {
$ret .= "<div class='cadre-titre' style='z-index: 1; margin: 0px;$style_gauche'>$titre</div>";
$ret .= "<div class='cadre-padding'>";
// Gaffe: hack MSIE, sinon les floats disparaissent
if ($browser_name == "MSIE") $ret .= "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>";
global $browser_name;
// Fermture du hack MSIE
if ($browser_name == "MSIE") $ret = "</td></tr></table>";
if ($style == "e") $ret .= "</div>";
if ($style != "forum" AND $style != "thread-forum") $ret .= "<div style='height: 5px;'></div>";
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
function debut_cadre($style, $icone = "", $fonction = "", $titre = "") {
global $browser_name;
global $spip_display, $spip_lang_left;
static $accesskey = 97; // a
if ($spip_display != 1 AND $spip_display != 4 AND strlen($icone) > 1) {
$style_gauche = " padding-$spip_lang_left: 38px;";
$style_cadre = " style='margin-top: 14px;'";
}
if ($style == "e") {
$ret .= "<div class='cadre-e-noir'$style_cadre><div class='cadre-$style'>";
}
else {
$ret .= "<div class='cadre-$style'$style_cadre>";
}
//$ret = "<div class='cadre-$style' style='$style_haut'>";
$ret .= "<div style='position: relative;'>";
if ($spip_display != 1 AND $spip_display != 4 AND strlen($icone) > 1) {
$ret .= "<div style='position: absolute; top: -16px; $spip_lang_left: 10px;'>";
if ($fonction) {
$ret .= "<div " . http_style_background($icone, "no-repeat; padding: 0px; margin: 0px;'");
$ret .= http_img_pack($fonction, "alt=''");
$ret .= "</div>";
}
else $ret .= http_img_pack("$icone", "alt=''");
$ret .= "</div>";
$style_cadre = " style='position: relative; top: 15px; margin-bottom: 14px;'";
}
if (strlen($titre) > 0) {
if ($spip_display == 4) {
$ret .= "<h3 class='cadre-titre'>$titre</h3>";
} else {
$ret .= "<div class='cadre-titre' style='margin: 0px;$style_gauche'>$titre</div>";
}
}
$ret .= "</div>";
$ret .= "<div class='cadre-padding'>";
return $ret;
}
function fin_cadre($style) {
$ret = "</div>";
$ret .= "</div>";
if ($style == "e") $ret .= "</div>";
if ($style != "forum" AND $style != "thread-forum") $ret .= "<div style='height: 5px;'></div>";
return $ret;
}
function debut_cadre_relief($icone='', $return = false, $fonction='', $titre = ''){
$retour_aff = debut_cadre('r', $icone, $fonction, $titre);
ARNO*
a validé
if ($return) return $retour_aff;
else echo $retour_aff;
}
function fin_cadre_relief($return = false){
ARNO*
a validé
if ($return) return $retour_aff;
else echo $retour_aff;
}
function debut_cadre_enfonce($icone='', $return = false, $fonction='', $titre = ''){
$retour_aff = debut_cadre('e', $icone, $fonction, $titre);
ARNO*
a validé
if ($return) return $retour_aff;
else echo $retour_aff;
}
function fin_cadre_enfonce($return = false){
$retour_aff = fin_cadre('e');
if ($return) return $retour_aff;
else echo $retour_aff;
}
function debut_cadre_sous_rub($icone='', $return = false, $fonction='', $titre = ''){
$retour_aff = debut_cadre('sous_rub', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
function fin_cadre_sous_rub($return = false){
$retour_aff = fin_cadre('sous_rub');
if ($return) return $retour_aff;
else echo $retour_aff;
}
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
function debut_cadre_forum($icone='', $return = false, $fonction='', $titre = ''){
$retour_aff = debut_cadre('forum', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
function fin_cadre_forum($return = false){
$retour_aff = fin_cadre('forum');
if ($return) return $retour_aff;
else echo $retour_aff;
}
function debut_cadre_thread_forum($icone='', $return = false, $fonction='', $titre = ''){
$retour_aff = debut_cadre('thread-forum', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
function fin_cadre_thread_forum($return = false){
$retour_aff = fin_cadre('thread-forum');
if ($return) return $retour_aff;
else echo $retour_aff;
}
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
function debut_cadre_gris_clair($icone='', $return = false, $fonction='', $titre = ''){
$retour_aff = debut_cadre('gris-clair', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
function fin_cadre_gris_clair($return = false){
$retour_aff = fin_cadre('gris-clair');
if ($return) return $retour_aff;
else echo $retour_aff;
}
function debut_cadre_couleur($icone='', $return = false, $fonction='', $titre=''){
$retour_aff = debut_cadre('couleur', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
function fin_cadre_couleur($return = false){
$retour_aff = fin_cadre('couleur');
if ($return) return $retour_aff;
else echo $retour_aff;
}
function debut_cadre_couleur_foncee($icone='', $return = false, $fonction='', $titre=''){
$retour_aff = debut_cadre('couleur-foncee', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
function fin_cadre_couleur_foncee($return = false){
$retour_aff = fin_cadre('couleur-foncee');
if ($return) return $retour_aff;
else echo $retour_aff;
}
function debut_cadre_trait_couleur($icone='', $return = false, $fonction='', $titre=''){
$retour_aff = debut_cadre('trait-couleur', $icone, $fonction, $titre);
if ($return) return $retour_aff;
else echo $retour_aff;
}
function fin_cadre_trait_couleur($return = false){
$retour_aff = fin_cadre('trait-couleur');
ARNO*
a validé
if ($return) return $retour_aff;
else echo $retour_aff;
}
//
// une boite alerte
//
function debut_boite_alerte() {
echo "<p><table cellpadding='6' border='0'><tr><td width='100%' bgcolor='red'>";
echo "<table width='100%' cellpadding='12' border='0'><tr><td width='100%' bgcolor='white'>";
}
function fin_boite_alerte() {
}
//
// une boite info
//
function debut_boite_info() {
echo " <p><div style='border: 1px dashed #666666;'><table cellpadding='5' cellspacing='0' border='0' width='100%' style='border-left: 1px solid $couleur_foncee; border-top: 1px solid $couleur_foncee; border-bottom: 1px solid white; border-bottom: 1px solid white' background=''>";
echo "<tr><td bgcolor='$couleur_claire' width='100%'>";
echo "<font face='Verdana,Arial,Sans,sans-serif' size='2' color='#333333'>";
}
function fin_boite_info() {
//echo "</font></td></tr></table></div>\n\n";
echo "</div>";
}
//
// une autre boite
//
function bandeau_titre_boite($titre, $afficher_auteurs, $boite_importante = true) {
global $couleur_foncee;
if ($boite_importante) {
$couleur_fond = $couleur_foncee;
$couleur_texte = '#FFFFFF';
}
else {
$couleur_fond = '#EEEECC';
$couleur_texte = '#000000';
}
echo "<tr bgcolor='$couleur_fond'><td width=\"100%\"><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3 COLOR='$couleur_texte'>";
echo "<B>$titre</B></FONT></TD>";
if ($afficher_auteurs){
echo "<TD WIDTH='100'>";
echo http_img_pack("rien.gif", "alt='' width='100' height='12' border='0'");
echo "</TD>";
}
echo "<TD WIDTH='90'>";
echo http_img_pack("rien.gif", "alt='' width='90' height='12' border='0'");
echo "</TD>";
echo "</TR>";
}
Fil
a validé
function bandeau_titre_boite2($titre, $logo="", $fond="white", $texte="black", $echo = true) {
Fil
a validé
$retour = '';
if (strlen($logo) > 0 AND $spip_display != 1 AND $spip_display != 4) {
Fil
a validé
$retour .= "<div style='position: relative;'>";
$retour .= "<div style='position: absolute; top: -12px; $spip_lang_left: 3px;'>" .
http_img_pack("$logo", "alt=''") . "</div>";
Fil
a validé
$retour .= "<div style='background-color: $fond; color: $texte; padding: 3px; padding-$spip_lang_left: 30px; border-bottom: 1px solid #444444;' class='verdana2'><b>$titre</b></div>";
Fil
a validé
$retour .= "</div>";
$retour .= "<h3 style='background-color: $fond; color: $texte; padding: 3px; border-bottom: 1px solid #444444; margin: 0px;' class='verdana2'><b>$titre</b></h3>";
Fil
a validé
if ($echo) echo $retour;
return $retour;
Antoine Pitrou
a validé
//
// La boite raccourcis
//
function debut_raccourcis() {
ARNO*
a validé
echo "<div> </div>";
Antoine Pitrou
a validé
debut_cadre_enfonce();
if ($spip_display != 4) {
echo "<font face='Verdana,Arial,Sans,sans-serif' size=1>";
echo "<b>"._T('titre_cadre_raccourcis')."</b><p />";
} else {
echo "<h3>"._T('titre_cadre_raccourcis')."</h3>";
echo "<ul>";
}
Antoine Pitrou
a validé
}
function fin_raccourcis() {
global $spip_display;
if ($spip_display != 4) echo "</font>";
else echo "</ul>";
Antoine Pitrou
a validé
fin_cadre_enfonce();
}
// Afficher un petit "+" pour lien vers autre page
function afficher_plus($lien) {
ARNO*
a validé
global $options, $spip_lang_right, $browser_name;
ARNO*
a validé
if ($options == "avancees" AND $spip_display != 4) {
if ($browser_name == "MSIE")
return "<a href='$lien'>" .
http_img_pack("plus.gif", "alt='+' border='0'"). "</a> ";
ARNO*
a validé
else
return "<div style='float:$spip_lang_right; padding-top: 2px;'><a href='$lien'>" .
http_img_pack("plus.gif", "border='0'") ."</a></div>";
ARNO*
a validé
}
//
// Fonctions d'affichage
//
function afficher_liste($largeurs, $table, $styles = '') {
global $couleur_claire;
global $spip_display;
global $spip_lang_left;
if (!is_array($table)) return;
reset($table);
echo "\n";
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
if ($spip_display != 4) {
while (list(, $t) = each($table)) {
if (eregi("msie", $browser_name)) $msover = " onMouseOver=\"changeclass(this,'tr_liste_over');\" onMouseOut=\"changeclass(this,'tr_liste');\"";
echo "<tr class='tr_liste'$msover>";
reset($largeurs);
if ($styles) reset($styles);
while (list(, $texte) = each($t)) {
$style = $largeur = "";
list(, $largeur) = each($largeurs);
if ($styles) list(, $style) = each($styles);
if (!trim($texte)) $texte .= " ";
echo "<td";
if ($largeur) echo " width=\"$largeur\"";
if ($style) echo " class=\"$style\"";
echo ">$texte</td>";
}
echo "</tr>\n";
}
} else {
echo "<ul style='text-align: $spip_lang_left;'>";
while (list(, $t) = each($table)) {
echo "<li>";
reset($largeurs);
if ($styles) reset($styles);
while (list(, $texte) = each($t)) {
$style = $largeur = "";
list(, $largeur) = each($largeurs);
if (!$largeur) {
echo $texte." ";
}
}
echo "</li>\n";
}
echo "</ul>";
}
echo "\n";
}
function afficher_tranches_requete(&$query, $colspan) {
global $spip_lang_right, $spip_display;
$query = trim($query);
$query_count = eregi_replace('^(SELECT)[[:space:]].*[[:space:]](FROM)[[:space:]]', '\\1 COUNT(*) \\2 ', $query);
list($num_rows) = spip_fetch_array(spip_query($query_count));
if (!$num_rows) return;
$nb_aff = 10;
// Ne pas couper pour trop peu
if ($num_rows <= 1.5 * $nb_aff) $nb_aff = $num_rows;
if (ereg('LIMIT .*,([0-9]+)', $query, $regs)) {
if ($num_rows > $regs[1]) $num_rows = $regs[1];
}
$texte = "\n";
if ($num_rows > $nb_aff) {
$tmp_var = 't_'.substr(md5($query), 0, 4);
$deb_aff = intval($GLOBALS[$tmp_var]);
if ($spip_display != 4) $texte .= "<tr style='background-color: #dddddd;'><td class=\"arial2\" style='border-bottom: 1px solid #444444;' colspan=\"".($colspan - 1)."\">";
for ($i = 0; $i < $num_rows; $i += $nb_aff){
$deb = $i + 1;
$fin = $i + $nb_aff;
if ($fin > $num_rows) $fin = $num_rows;
if ($deb_aff + 1 >= $deb AND $deb_aff + 1 <= $fin) {
}
else {
$link = new Link;
$link->addVar($tmp_var, strval($deb - 1));
$texte .= "<a href=\"".$link->getUrl()."#a$ancre\">$deb</a>";
}
}
if ($spip_display != 4) {
$texte .= "</td>\n";
$texte .= "<td class=\"arial2\" style='border-bottom: 1px solid #444444; text-align: $spip_lang_right;' colspan=\"1\" align=\"right\" valign=\"top\">";
} else {
$texte .= " | ";
}
if ($deb_aff == -1) {
$texte .= "<B>"._T('info_tout_afficher')."</B>";
} else {
$link = new Link;
$link->addVar($tmp_var, -1);
$texte .= "<A HREF=\"".$link->getUrl()."#a$ancre\">"._T('lien_tout_afficher')."</A>";
if ($spip_display != 4) $texte .= "</td>\n";
if ($spip_display != 4) $texte .= "</tr>\n";
if ($deb_aff != -1) {
$query = eregi_replace('LIMIT[[:space:]].*$', '', $query);
$query .= " LIMIT $deb_aff, $nb_aff";
}
}
return $texte;
}
function afficher_liste_debut_tableau() {
global $spip_display;
if ($spip_display != 4) return "<table width='100%' cellpadding='2' cellspacing='0' border='0'>";
}
function afficher_liste_fin_tableau() {
global $spip_display;
if ($spip_display != 4) return "</table>";
}
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
function puce_statut_article($id_article, $statut) {
global $spip_lang_left, $dir_lang, $connect_statut, $options, $browser_name;
switch ($statut) {
case 'publie':
$clip = 2;
$puce = 'verte';
$title = _T('info_article_publie');
break;
case 'prepa':
$clip = 0;
$puce = 'blanche';
$title = _T('info_article_redaction');
break;
case 'prop':
$clip = 1;
$puce = 'orange';
$title = _T('info_article_propose');
break;
case 'refuse':
$clip = 3;
$puce = 'rouge';
$title = _T('info_article_refuse');
break;
case 'poubelle':
$clip = 4;
$puce = 'poubelle';
$title = _T('info_article_supprime');
break;
}
$puce = "puce-$puce.gif";
if ($connect_statut == '0minirezo' AND $options == 'avancees') {
if ($browser_name == "MSIE") $alt = "alt";
else $alt = "title";
$inser_puce = "<div class='puce_article' id='statut$id_article'$dir_lang>"
. "<div class='puce_article_fixe' onmouseover=\"montrer('statutdecal$id_article');\">" .
http_img_pack("$puce", "id='imgstatut$id_article' border='0' style='margin: 1px;'") ."</div>"
. "<div class='puce_article_popup' id='statutdecal$id_article' onmouseout=\"cacher('statutdecal$id_article');\" style=' margin-left: -".((11*$clip)+1)."px;'>"
. "<a onmouseover=\"montrer('statutdecal$id_article');\" href=\"javascript:selec_statut_art($id_article, 0, 'prepa');\">" .
http_img_pack("puce-blanche.gif", "$alt=\""._T('texte_statut_en_cours_redaction')."\""). "</a>"
. "<a onmouseover=\"montrer('statutdecal$id_article');\" href=\"javascript:selec_statut_art($id_article, 1, 'prop');\">" .
http_img_pack("puce-orange.gif", "$alt=\""._T('texte_statut_propose_evaluation')."\"") . "</a>"
. "<a onmouseover=\"montrer('statutdecal$id_article');\" href=\"javascript:selec_statut_art($id_article, 2, 'publie');\">" .
http_img_pack("puce-verte.gif", "$alt=\""._T('texte_statut_publie')."\"")."</a>"
. "<a onmouseover=\"montrer('statutdecal$id_article');\" href=\"javascript:selec_statut_art($id_article, 3, 'refuse');\">" .
http_img_pack("puce-rouge.gif", "$alt=\""._T('texte_statut_refuse')."\""). "</a>"
. "<a onmouseover=\"montrer('statutdecal$id_article');\" href=\"javascript:selec_statut_art($id_article, 4, 'poubelle');\">" .
http_img_pack("puce-poubelle.gif", "$alt=\""._T('texte_statut_poubelle')."\""). "</a>"
$inser_puce = http_img_pack("$puce", "id='imgstatut$id_article' border='0' style='margin: 1px;'");
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
}
return $inser_puce;
}
function puce_statut_breve($id_breve, $statut) {
global $spip_lang_left, $dir_lang, $connect_statut, $options, $browser_name;
switch ($statut) {
case 'prop':
$clip = 0;
$puce = "orange";
$title = _T('titre_breve_proposee');
break;
case 'publie':
$clip = 1;
$puce = "verte";
$title = _T('titre_breve_publiee');
break;
case 'refuse':
$clip = 2;
$puce = "rouge";
$title = _T('titre_breve_refusee');
break;
}
$puce = "puce-$puce-breve.gif";
if ($connect_statut == '0minirezo' AND $options == 'avancees') {
if ($browser_name == "MSIE") $alt = "alt";
else $alt = "title";
$inser_puce = "<div class='puce_breve' id='statutbreve$id_breve'$dir_lang>"
. "<div class='puce_breve_fixe' onmouseover=\"montrer('statutdecalbreve$id_breve');\">" .
http_img_pack("$puce", "id='imgstatutbreve$id_breve' border='0' style='margin: 1px;'"). "</div>"
. "<div class='puce_breve_popup' id='statutdecalbreve$id_breve' onmouseout=\"cacher('statutdecalbreve$id_breve');\" style=' margin-left: -".((9*$clip)+1)."px;'>"
. "<a onmouseover=\"montrer('statutdecalbreve$id_breve');\" href=\"javascript:selec_statut_breve($id_breve, 0, 'prop');\">" .
http_img_pack("puce-orange-breve.gif", "$alt=\""._T('texte_statut_propose_evaluation')."\"") . "</a>"
. "<a onmouseover=\"montrer('statutdecalbreve$id_breve');\" href=\"javascript:selec_statut_breve($id_breve, 1, 'publie');\">" .
http_img_pack("puce-verte-breve.gif", "$alt=\""._T('texte_statut_publie')."\""). "</a>"
. "<a onmouseover=\"montrer('statutdecalbreve$id_breve');\" href=\"javascript:selec_statut_breve($id_breve, 2, 'refuse');\">" .
http_img_pack("puce-rouge-breve.gif", "$alt=\""._T('texte_statut_refuse')."\""). "</a>"
$inser_puce = http_img_pack("$puce", "id='imgstatut$id_article' border='0' style='margin: 1px;'");
//
// Afficher tableau d'articles
//
function afficher_articles($titre_table, $requete, $afficher_visites = false, $afficher_auteurs = true,
$toujours_afficher = false, $afficher_cadre = true, $afficher_descriptif = true) {
global $connect_id_auteur, $connect_statut, $dir_lang;
global $options, $spip_display;
global $spip_lang_left, $spip_lang_right;
$activer_statistiques = lire_meta("activer_statistiques");
$afficher_visites = ($afficher_visites AND $connect_statut == "0minirezo" AND $activer_statistiques != "non");
// Preciser la requete (alleger les requetes)
if (!ereg("^SELECT", $requete)) {
$select = "SELECT articles.id_article, articles.titre, articles.id_rubrique, articles.statut, articles.date";
if ((lire_meta('multi_rubriques') == 'oui' AND $GLOBALS['coll'] == 0) OR lire_meta('multi_articles') == 'oui') {
$afficher_langue = true;
if ($GLOBALS['langue_rubrique']) $langue_defaut = $GLOBALS['langue_rubrique'];
else $langue_defaut = lire_meta('langue_site');
$select .= ", articles.lang";
}
if ($afficher_visites)
$select .= ", articles.visites, articles.popularite";
if ($afficher_descriptif)
$select .= ", articles.descriptif";
$select .= ", petitions.id_article AS petition ";
$requete = $select . "FROM spip_articles AS articles " . $requete;
if ($options == "avancees") $ajout_col = 1;
else $ajout_col = 0;
$tranches = afficher_tranches_requete($requete, $afficher_auteurs ? 4 + $ajout_col : 3 + $ajout_col);
$requete = str_replace("FROM spip_articles AS articles ", "FROM spip_articles AS articles LEFT JOIN spip_petitions AS petitions USING (id_article)", $requete);
$result = spip_query($requete);
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
// if ($afficher_cadre) debut_cadre_gris_clair("article-24.gif");
echo "<div style='height: 12px;'></div>";
echo "<div class='liste'>";
bandeau_titre_boite2($titre_table, "article-24.gif");
//echo "<table width='100%' cellpadding='2' cellspacing='0' border='0'>";
echo afficher_liste_debut_tableau();
echo $tranches;
while ($row = spip_fetch_array($result)) {
$vals = '';
$id_article = $row['id_article'];
$tous_id[] = $id_article;
$titre = $row['titre'];
$id_rubrique = $row['id_rubrique'];
$date = $row['date'];
$statut = $row['statut'];
$visites = $row['visites'];
if ($lang = $row['lang']) changer_typo($lang);
$popularite = ceil(min(100,100 * $row['popularite'] / max(1, 0 + lire_meta('popularite_max'))));
$descriptif = $row['descriptif'];
if ($descriptif) $descriptif = ' title="'.attribut_html(typo($descriptif)).'"';
$petition = $row['petition'];
if ($afficher_auteurs) {
$les_auteurs = "";
$query2 = "SELECT auteurs.id_auteur, nom, messagerie, login, en_ligne ".
"FROM spip_auteurs AS auteurs, spip_auteurs_articles AS lien ".
"WHERE lien.id_article=$id_article AND auteurs.id_auteur=lien.id_auteur";
$result_auteurs = spip_query($query2);
while ($row = spip_fetch_array($result_auteurs)) {
$id_auteur = $row['id_auteur'];
$nom_auteur = typo($row['nom']);
$auteur_messagerie = $row['messagerie'];
$les_auteurs .= ", <a href='auteurs_edit.php3?id_auteur=$id_auteur'>$nom_auteur</a>";
if ($id_auteur != $connect_id_auteur AND $auteur_messagerie != "non") {
$les_auteurs .= " ".bouton_imessage($id_auteur, $row);
$les_auteurs = substr($les_auteurs, 2);
}
$les_auteurs = "$les_auteurs";
$vals[] = puce_statut_article($id_article, $statut);
$s .= http_img_pack("admin-12.gif", "alt='' width='12' height='12' title='"._T('titre_image_admin_article')."'") . "> ";
$s .= "<a href=\"articles.php3?id_article=$id_article\"$descriptif$dir_lang style=\"display:block;\">";
if ($spip_display != 1 AND $spip_display != 4 AND lire_meta('image_process') != "non") {
include_ecrire("inc_logos.php3");
$logo = decrire_logo("arton$id_article");
if ($logo) {
$fichier = $logo[0];
$taille = $logo[1];
$taille_x = $logo[3];
$taille_y = $logo[4];
$taille = image_ratio($taille_x, $taille_y, 26, 20);
$w = $taille[0];
$h = $taille[1];
$fid = $logo[2];
$hash = calculer_action_auteur ("reduire $w $h");
$s.= "<div style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>
<img src='../spip_image_reduite.php3?img="._DIR_IMG."$fichier&taille_x=$w&taille_y=$h&hash=$hash&hash_id_auteur=$connect_id_auteur' alt='' width='$w' height='$h' border='0'></div>";
}
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
$s .= typo($titre);
if ($afficher_langue AND $lang != $langue_defaut)
$s .= " <font size='1' color='#666666'$dir_lang>(".traduire_nom_langue($lang).")</font>";
if ($petition) $s .= " <font size=1 color='red'>"._T('lien_petitions')."</font>";
$s .= "</a>";
$s .= "</div>";
$vals[] = $s;
if ($afficher_auteurs) $vals[] = $les_auteurs;
$s = affdate_jourcourt($date);
if ($afficher_visites AND $visites > 0) {
$s .= "<br><font size=\"1\"><a href='statistiques_visites.php3?id_article=$id_article'>"._T('lien_visites', array('visites' => $visites))."</a></font>";
if ($popularite > 0) $s .= "<br><font size=\"1\"><a href='statistiques_visites.php3?id_article=$id_article'>"._T('lien_popularite', array('popularite' => $popularite))."</a></font>";
$s = "<div class='liste_clip' style='width: 100px;'>$s</div>";
}
$vals[] = $s;
if ($options == "avancees") {
$vals[] = "<b>"._T('info_numero_abbreviation')."$id_article</b>";
}
$table[] = $vals;
}
spip_free_result($result);
if ($options == "avancees") { // Afficher le numero (JMB)
if ($afficher_auteurs) {
$largeurs = array(11, '', 80, 100, 35);
$styles = array('', 'arial2', 'arial1', 'arial1', 'arial1');
} else {
$largeurs = array(11, '', 100, 35);
$styles = array('', 'arial2', 'arial1', 'arial1');
$largeurs = array(11, '', 100, 100);
$styles = array('', 'arial2', 'arial1', 'arial1');
$largeurs = array(11, '', 100);
$styles = array('', 'arial2', 'arial1');
}
}
afficher_liste($largeurs, $table, $styles);
//echo "</table>";
echo afficher_liste_fin_tableau();
echo "</div>";
//if ($afficher_cadre) fin_cadre_gris_clair();
}
return $tous_id;
}
//
// Afficher tableau de breves
//
function afficher_breves($titre_table, $requete, $affrub=false) {
global $connect_id_auteur, $spip_lang_right, $spip_lang_left, $dir_lang, $couleur_claire, $couleur_foncee;
global $options;
if ((lire_meta('multi_rubriques') == 'oui' AND $GLOBALS['coll'] == 0) OR lire_meta('multi_articles') == 'oui') {
$afficher_langue = true;
$requete = ereg_replace(" FROM", ", lang FROM", $requete);
if ($GLOBALS['langue_rubrique']) $langue_defaut = $GLOBALS['langue_rubrique'];
else $langue_defaut = lire_meta('langue_site');
if ($options == "avancees") $tranches = afficher_tranches_requete($requete, 4);
else $tranches = afficher_tranches_requete($requete, 3);
if (strlen($tranches)) {
//debut_cadre_relief("breve-24.gif");
if ($titre_table) echo "<div style='height: 12px;'></div>";
echo "<div class='liste'>";
if ($titre_table) {
bandeau_titre_boite2($titre_table, "breve-24.gif", $couleur_foncee, "white");
}
echo "<table width='100%' cellpadding='2' cellspacing='0' border='0' background=''>";
echo $tranches;
$result = spip_query($requete);
$table = '';
while ($row = spip_fetch_array($result)) {
$vals = '';
$id_breve = $row['id_breve'];
$tous_id[] = $id_breve;
$date_heure = $row['date_heure'];
$titre = $row['titre'];
$statut = $row['statut'];
if ($lang = $row['lang']) changer_typo($lang);
$vals[] = puce_statut_breve($id_breve, $statut);
$s .= "<a href='breves_voir.php3?id_breve=$id_breve'$dir_lang style=\"display:block;\">";
if ($spip_display != 1 AND $spip_display != 4 AND lire_meta('image_process') != "non") {
include_ecrire("inc_logos.php3");
$logo = decrire_logo("breveon$id_breve");
if ($logo) {
$fichier = $logo[0];
$taille = $logo[1];
$taille_x = $logo[3];
$taille_y = $logo[4];
$taille = image_ratio($taille_x, $taille_y, 26, 20);
$w = $taille[0];
$h = $taille[1];
$fid = $logo[2];
$hash = calculer_action_auteur ("reduire $w $h");
$s.= "<div style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>
<img src='../spip_image_reduite.php3?img="._DIR_IMG."$fichier&taille_x=$w&taille_y=$h&hash=$hash&hash_id_auteur=$connect_id_auteur' alt='' width='$w' height='$h' border='0'></div>";
$s .= typo($titre);
if ($afficher_langue AND $lang != $langue_defaut)
$s .= " <font size='1' color='#666666'$dir_lang>(".traduire_nom_langue($lang).")</font>";
$s .= "</a>";
$vals[] = $s;
$rub = spip_fetch_array(spip_query("SELECT id_rubrique, titre FROM spip_rubriques WHERE id_rubrique=$id_rubrique"));
$id_rubrique = $rub['id_rubrique'];
$s .= "<a href='naviguer.php3?coll=$id_rubrique' style=\"display:block;\">".typo($rub['titre'])."</a>";
$vals[] = $s;
if ($options == "avancees") {
$vals[] = "<b>"._T('info_numero_abbreviation')."$id_breve</b>";
}
$table[] = $vals;
}
if ($options == "avancees") {