Newer
Older
/***************************************************************************\
* SPIP, Systeme de publication pour l'internet *
* *
* Copyright (c) 2001-2005 *
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
* *
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
\***************************************************************************/
//
// Ce fichier ne sera execute qu'une fois
if (defined("_ECRIRE_INC_PRESENTATION")) return;
define("_ECRIRE_INC_PRESENTATION", "1");
//
// 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", "m>", "width='14' height='7' border='0'", $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_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;'";
}
Fil
a validé
if ($accesskey <= 122) // z
{
$accesskey_c = chr($accesskey++);
$ret = "<a name='access-$accesskey_c' href='#access-$accesskey_c' accesskey='$accesskey_c'></a>";
}
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 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");
esj
a validé
$ret .= http_img_pack($fonction, "", "");
esj
a validé
else $ret .= http_img_pack("$icone", "", "");
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
$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;
}
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
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;
}
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
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", " ", "width='100' height='12' border='0'");
echo "</TD>";
}
echo "<TD WIDTH='90'>";
echo http_img_pack("rien.gif", " ", "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;'>" .
esj
a validé
http_img_pack("$logo", "", "") . "</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")
esj
a validé
http_img_pack("plus.gif", "+", "border='0'"). "</a> ";
ARNO*
a validé
else
return "<div style='float:$spip_lang_right; padding-top: 2px;'><a href='$lien'>" .
esj
a validé
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";
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
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, $tmp_var=false, $javascript=false) {
global $spip_lang_right, $spip_display;
$query = trim($query);
$query_count = eregi_replace('^(SELECT)[[:space:]].*[[:space:]](FROM)[[:space:]]', '\\1 COUNT(*) \\2 ', $query);
$query_count = eregi_replace('ORDER[[:space:]]+BY.*$', '', $query_count);
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 (preg_match('/LIMIT .*(,|OFFSET) *([0-9]+)/', $query, $regs)) {
if ($num_rows > $regs[2]) $num_rows = $regs[2];
}
$texte = "\n";
if ($num_rows > $nb_aff) {
if (!$tmp_var) $tmp_var = substr(md5($query), 0, 4);
$tmp_var = 't_'. $tmp_var;
$deb_aff = intval($GLOBALS[$tmp_var]);
if ($spip_display != 4) $texte .= "<tr style='background-color: #dddddd;'><td class=\"arial1\" 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));
if ($javascript) {
$jj = ereg_replace("::deb::", "&$tmp_var=$deb", $javascript);
$texte .= "<a onClick=\"$jj; return false;\" href=\"".$link->getUrl()."#a$ancre\">$deb</a>";
}
else $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);
if ($javascript) {
$jj = ereg_replace("::deb::", "&$tmp_var=-1", $javascript);
$texte .= "<a onClick=\"$jj; return false; \" href=\"".$link->getUrl()."#a$ancre\"><img src='img_pack/plus.gif' title='"._T('lien_tout_afficher')."' style='border: 0px;'></a>";
}
else $texte .= "<A HREF=\"".$link->getUrl()."#a$ancre\"><img src='img_pack/plus.gif' title='"._T('lien_tout_afficher')."' style='border: 0px;'></A>";
if ($spip_display != 4) $texte .= "</td>\n";
if ($spip_display != 4) $texte .= "</tr>\n";
if ($deb_aff != -1) {
if ($deb_aff > 0) $deb_aff --; // Correction de bug: si on affiche "de 1 a 10", alors LIMIT 0 OFFSET 10
$query = eregi_replace('LIMIT[[:space:]].*$', '', $query);
# $query .= " LIMIT $nb_aff OFFSET $deb_aff";
$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>";
}
function puce_statut_article($id, $statut, $id_rubrique) {
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
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' AND acces_rubrique($id_rubrique)) {
esj
a validé
// les versions de MSIE ne font pas toutes pareil sur alt/title
// la combinaison suivante semble ok pour tout le monde.
$titles = array(
"blanche" => _T('texte_statut_en_cours_redaction'),
"orange" => _T('texte_statut_propose_evaluation'),
"verte" => _T('texte_statut_publie'),
"rouge" => _T('texte_statut_refuse'),
"poubelle" => _T('texte_statut_poubelle'));
$action = "onmouseover=\"montrer('statutdecalarticle$id');\"";
$inser_puce = "<div class='puce_article' id='statut$id'$dir_lang>"
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
. "<div class='puce_article_fixe' $action>" .
http_img_pack("$puce", "", "id='imgstatutarticle$id' border='0' style='margin: 1px;'") ."</div>"
. "<div class='puce_article_popup' id='statutdecalarticle$id' onmouseout=\"cacher('statutdecalarticle$id');\" style=' margin-left: -".((11*$clip)+1)."px;'>"
. http_href_img("javascript:selec_statut($id, 'article', -1,'" . _DIR_IMG_PACK . "puce-blanche.gif', 'prepa');",
"puce-blanche.gif",
"title=\"$titles[blanche]\"",
"",'','',
$action)
. http_href_img("javascript:selec_statut($id, 'article', -12,'" . _DIR_IMG_PACK . "puce-orange.gif', 'prop');",
"puce-orange.gif",
"title=\"$titles[orange]\"",
"",'','',
$action)
. http_href_img("javascript:selec_statut($id, 'article', -23,'" . _DIR_IMG_PACK . "puce-verte.gif', 'publie');",
"puce-verte.gif",
"title=\"$titles[verte]\"",
"",'','',
$action)
. http_href_img("javascript:selec_statut($id, 'article', -34,'" . _DIR_IMG_PACK . "puce-rouge.gif', 'refuse');",
"puce-rouge.gif",
"title=\"$titles[rouge]\"",
"",'','',
$action)
. http_href_img("javascript:selec_statut($id, 'article', -45,'" . _DIR_IMG_PACK . "puce-poubelle.gif', 'poubelle');",
"puce-poubelle.gif",
"title=\"$titles[poubelle]\"",
"",'','',
$action)
$inser_puce = http_img_pack("$puce", "", "id='imgstatutarticle$id' border='0' style='margin: 1px;'");
function puce_statut_breve($id, $statut, $type, $droit) {
global $spip_lang_left, $dir_lang;
$puces = array(
0 => 'puce-orange-breve.gif',
1 => 'puce-verte-breve.gif',
2 => 'puce-rouge-breve.gif',
3 => 'puce-blanche-breve.gif');
switch ($statut) {
$title = _T('titre_breve_proposee');
break;
case 'publie':
$clip = 1;
$title = _T('titre_breve_publiee');
break;
case 'refuse':
$clip = 2;
default:
$clip = 0;
$puce = $puces[3];
$title = '';
}
$type1 = "statut$type$id";
$inser_puce = http_img_pack($puce, "", "id='img$type1' border='0' style='margin: 1px;'");
if (!$droit) return $inser_puce;
$type2 = "statutdecal$type$id";
$action = "onmouseover=\"montrer('$type2');\"\n";
esj
a validé
// les versions de MSIE ne font pas toutes pareil sur alt/title
// la combinaison suivante semble ok pour tout le monde.
return "<div class='puce_breve' id='$type1'$dir_lang>"
. "<div class='puce_breve_fixe' $action>"
. $inser_puce
. "</div>"
. "<div class='puce_breve_popup' id='$type2' onmouseout=\"cacher('$type2');\" style=' margin-left: -".((9*$clip)+1)."px;'>"
. http_href_img("javascript:selec_statut('$id', '$type', -1, '" . _DIR_IMG_PACK . $puces[0] . "', 'prop');",
$puces[0],
"title=\""._T('texte_statut_propose_evaluation')."\"",
'','','',
$action)
. http_href_img("javascript:selec_statut('$id', '$type', -10, '" . _DIR_IMG_PACK .$puces[1] . "', 'publie');",
$puces[1],
"title=\""._T('texte_statut_publie')."\"",
'','','',
$action)
. http_href_img("javascript:selec_statut('$id', '$type', -19, '" . _DIR_IMG_PACK .$puces[2] . "', 'refuse');",
$puces[2],
"title=\""._T('texte_statut_refuse')."\"",
'','','',
$action)
. "</div></div>";
//
// 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;
// Preparation pour basculter vers liens de traductions
$afficher_trad = (lire_meta('gerer_trad') == "oui");
if ($afficher_trad) {
$jjscript_trad["fonction"] = "afficher_articles_trad";
$jjscript_trad["titre_table"] = $titre_table;
$jjscript_trad["requete"] = $requete;
$jjscript_trad["afficher_visites"] = $afficher_visites;
$jjscript_trad["afficher_auteurs"] = $afficher_auteurs;
$jjscript_trad = addslashes(serialize($jjscript_trad));
$hash = "0x".substr(md5($connect_id_auteur.$jjscript_trad), 0, 16);
$div_trad = substr(md5($requete), 0, 4);
$res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 1");
if ($row = spip_fetch_array($res_proch)) {
$id_ajax_trad = $row["id_ajax_fonc"];
} else {
include_ecrire ("inc_abstract_sql.php3");
$id_ajax_trad = spip_abstract_insert("spip_ajax_fonc", "(id_auteur, variables, hash, date)", "($connect_id_auteur, '$jjscript_trad', $hash, NOW())");
}
}
$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['id_rubrique'] == 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;
$jjscript["fonction"] = "afficher_articles";
$jjscript["titre_table"] = $titre_table;
$jjscript["requete"] = $requete;
$jjscript["afficher_visites"] = $afficher_visites;
$jjscript["afficher_auteurs"] = $afficher_auteurs;
$jjscript = addslashes(serialize($jjscript));
$hash = "0x".substr(md5($connect_id_auteur.$jjscript), 0, 16);
$tmp_var = substr(md5($jjscript), 0, 4);
$javascript = "charger_id_url('ajax_page.php?id_ajax_fonc=::id_ajax_fonc::::deb::','$tmp_var')";
$tranches = afficher_tranches_requete($requete, $afficher_auteurs ? 4 + $ajout_col : 3 + $ajout_col, $tmp_var, $javascript);
$requete = str_replace("FROM spip_articles AS articles ", "FROM spip_articles AS articles LEFT JOIN spip_petitions AS petitions USING (id_article)", $requete);
$res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 1");
if ($row = spip_fetch_array($res_proch)) {
$id_ajax_fonc = $row["id_ajax_fonc"];
} else {
include_ecrire ("inc_abstract_sql.php3");
$id_ajax_fonc = spip_abstract_insert("spip_ajax_fonc", "(id_auteur, variables, hash, date)", "($connect_id_auteur, '$jjscript', $hash, NOW())");
}
if (!$GLOBALS["t_$tmp_var"]) {
if ($afficher_trad) {
$tmp_trad = substr(md5($requete_trad), 0, 4);
echo "<div id='$div_trad'>";
}
echo "<div style='height: 12px;'></div>";
echo "<div class='liste'>";
$id_img = "img_".$tmp_var;
$texte_img = http_img_pack("searching.gif", "*", "style='border: 0px; visibility: hidden; float: $spip_lang_right' id = '$id_img'");
$texte_img .= http_img_pack("searching.gif", "*", "style='border: 0px; visibility: hidden; float: $spip_lang_right' id = 'img_$div_trad'");
$texte_img .= "<div style='float: $spip_lang_right;'><a href=\"javascript:charger_id_url('ajax_page.php?id_ajax_fonc=$id_ajax_trad','$div_trad');\"><img src='img_pack/langues-12.gif' border='0' /></a></div>";
}
bandeau_titre_boite2($texte_img.$titre_table, "article-24.gif");
echo "<div id='$tmp_var'>";
}
//echo "<table width='100%' cellpadding='2' cellspacing='0' border='0'>";
echo afficher_liste_debut_tableau();
$tranches = ereg_replace("\:\:id\_ajax\_fonc\:\:", $id_ajax_fonc, $tranches);
$result = spip_query($requete);
while ($row = spip_fetch_array($result)) {
$vals = '';
$id_article = $row['id_article'];
$tous_id[] = $id_article;
Fil
a validé
$titre = sinon($row['titre'], _T('ecrire:info_sans_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, bio ".
"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'];
if ($bio = texte_backend(supprimer_tags(couper($row['bio'],50))))
$bio = " title=\"$bio\"";
$les_auteurs .= ", <a href='auteurs_edit.php3?id_auteur=$id_auteur'$bio>$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, $id_rubrique);
$s .= http_img_pack("admin-12.gif", "", "width='12' height='12'", _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");
$s .= "<div style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>";
$s .= reduire_image_logo(_DIR_IMG.$fichier, 26, 20);
$s .= "</div>";
}
$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;
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, 50);
$styles = array('', 'arial2', 'arial1', 'arial1', 'arial1');
} else {
$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>";
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
if (!$GLOBALS["t_$tmp_var"]) {
echo "</div>";
if ($afficher_trad) echo "</div>";
}
//if ($afficher_cadre) fin_cadre_gris_clair();
}
return $tous_id;
}
function afficher_articles_trad($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;
$langues_site = explode(',', lire_meta('langues_multilingue'));
// Preparation pour basculter vers liste normale
$jjscript_trad["fonction"] = "afficher_articles";
$jjscript_trad["titre_table"] = $titre_table;
$jjscript_trad["requete"] = $requete;
$jjscript_trad["afficher_visites"] = $afficher_visites;
$jjscript_trad["afficher_auteurs"] = $afficher_auteurs;
$jjscript_trad = addslashes(serialize($jjscript_trad));
$hash = "0x".substr(md5($connect_id_auteur.$jjscript_trad), 0, 16);
$div_trad = substr(md5($requete), 0, 4);
$res_proch = spip_query("SELECT id_ajax_fonc FROM spip_ajax_fonc WHERE hash=$hash AND id_auteur=$connect_id_auteur ORDER BY id_ajax_fonc DESC LIMIT 1");
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
if ($row = spip_fetch_array($res_proch)) {
$id_ajax_trad = $row["id_ajax_fonc"];
} else {
include_ecrire ("inc_abstract_sql.php3");
$id_ajax_trad = spip_abstract_insert("spip_ajax_fonc", "(id_auteur, variables, hash, date)", "($connect_id_auteur, '$jjscript_trad', $hash, NOW())");
}
$activer_messagerie = "oui";
$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, articles.id_trad, articles.lang";
$requete = $select . " FROM spip_articles AS articles " . $requete;
}
if ($options == "avancees") $ajout_col = 1;
else $ajout_col = 0;
$jjscript["fonction"] = "afficher_articles_trad";
$jjscript["titre_table"] = $titre_table;
$jjscript["requete"] = $requete;
$jjscript["afficher_visites"] = $afficher_visites;
$jjscript["afficher_auteurs"] = $afficher_auteurs;
$jjscript = addslashes(serialize($jjscript));
$hash = "0x".substr(md5($connect_id_auteur.$jjscript), 0, 16);
$tmp_var = substr(md5($jjscript), 0, 4);