[ Index ]
 

Code source de SPIP 1.8.3

Accédez au Source d'autres logiciels libres | Soutenez Angelica Josefina !

title

Body

[fermer]

/ecrire/ -> articles_tous.php3 (source)

   1  <?php
   2  
   3  /***************************************************************************\
   4   *  SPIP, Systeme de publication pour l'internet                           *
   5   *                                                                         *
   6   *  Copyright (c) 2001-2005                                                *
   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  
  14  include  ("inc.php3");
  15  
  16  if (count($aff_art) > 0) $aff_art = join(',', $aff_art);
  17  else $aff_art = 'prop,publie';
  18  
  19  $statut_art = "'".join("','", explode(",", $aff_art))."'";
  20  
  21  debut_page(_T('titre_page_articles_tous'), "asuivre", "tout-site");
  22  debut_gauche();
  23  
  24  
  25  // Recuperer la direction globale de la langue
  26  $direction_generale = $spip_dir_lang;
  27  
  28  
  29  // Recuperer toutes les rubriques 
  30  $query = "SELECT id_rubrique, titre, id_parent FROM spip_rubriques ORDER BY 0+titre,titre";
  31  $result = spip_query($query);
  32  while ($row = spip_fetch_array($result)) {
  33      $id_rubrique = $row['id_rubrique'];
  34      $titre = typo($row['titre']);
  35      $id_parent = $row['id_parent'];
  36      
  37      $les_rubriques[] = "rubrique$id_rubrique";
  38      
  39      $nom_block = "rubrique$id_rubrique";
  40      if (!$numero_block["$nom_block"] > 0){
  41          $compteur_block++;
  42          $numero_block["$nom_block"] = $compteur_block;
  43  
  44          if (!$first_couche) $first_couche = $compteur_block;
  45          $last_couche = $compteur_block;
  46      }
  47  
  48      if ($id_parent == '0') {
  49          $rubrique[$id_rubrique] = "$titre";
  50      }
  51      else {
  52          $rubrique[$id_rubrique] =  "$titre";
  53      }
  54  
  55      $enfant[$id_parent][] = $id_rubrique;        
  56  }
  57  
  58  $query = "SELECT DISTINCT id_rubrique FROM spip_articles";
  59  $result = spip_query($query);
  60  while ($row = spip_fetch_array($result)) {
  61      $id_rubrique = $row['id_rubrique'];
  62      $rubriques_actives[$id_rubrique] = $id_rubrique;
  63  }
  64  
  65  // Recuperer tous les articles
  66  if (is_array($sel_lang)) {
  67      while (list(,$l) = each($sel_lang))
  68          $sel[$l] = $l;
  69      $sel_lang = $sel;
  70  }
  71  $sel_lang[$spip_lang] = $spip_lang;
  72  
  73  if ($connect_statut == "0minirezo") $query = "SELECT articles.id_article, articles.titre, articles.statut, articles.id_rubrique, articles.lang, articles.id_trad, articles.date_modif FROM spip_articles AS articles ORDER BY date DESC";
  74  else $query = "SELECT articles.id_article, articles.titre, articles.statut, articles.id_rubrique, articles.lang, articles.id_trad, articles.date_modif FROM spip_articles AS articles, spip_auteurs_articles AS lien WHERE (articles.statut = 'publie' OR articles.statut = 'prop' OR (articles.statut = 'prepa' AND articles.id_article = lien.id_article AND lien.id_auteur = $connect_id_auteur)) GROUP BY id_article ORDER BY articles.date DESC";
  75  
  76  //$query = "SELECT id_rubrique, id_article, titre, statut FROM spip_articles WHERE statut IN ($statut_art) ORDER BY titre";
  77  $result = spip_query($query);
  78  while($row = spip_fetch_array($result)) {
  79      $id_rubrique=$row['id_rubrique'];
  80      $id_article = $row['id_article'];
  81      $titre = typo($row['titre']);
  82      $statut = $row['statut'];
  83      $lang = $row['lang'];
  84      $id_trad = $row['id_trad'];
  85      $date_modif = $row['date_modif'];
  86      
  87      $aff_statut["$statut"] = true;
  88      $aff_lang["$lang"] = true;
  89      $text_article[$id_article]["titre"] = "$titre";
  90      $text_article[$id_article]["statut"] = $statut;
  91      $text_article[$id_article]["lang"] = $lang;
  92      $text_article[$id_article]["id_trad"] = $id_trad;
  93      $text_article[$id_article]["date_modif"] = $date_modif;
  94      $GLOBALS['langues_utilisees'][$lang] = true;
  95  
  96  
  97          $langues = explode(',', lire_meta('langues_multilingue'));
  98          if ((lire_meta('multi_rubriques') == 'oui' OR lire_meta('multi_articles') == 'oui') AND lire_meta('gerer_trad') == 'oui') {
  99              if (count($langues) > 1) {
 100                  while (list(, $l) = each ($langues)) {
 101                      if ($sel_lang[$l]) $text_article[$id_article]["trad"]["$l"] =  "<span class='creer'>$l</span>";
 102                  }
 103              }
 104          }
 105      
 106      
 107      if ($id_trad == $id_article OR $id_trad == 0) {
 108          $text_article[$id_article]["trad"]["$lang"] = "<span class='lang_base'$direction_generale>$lang</span>";
 109      }
 110          
 111      if (ereg("'$statut'","$statut_art")) {
 112          $article[$id_rubrique][] = $id_article;
 113      }
 114  }
 115  
 116  $tmp = $text_article;
 117  
 118  if ($tmp) {
 119      for (reset($tmp); $id_article = key($tmp); next($tmp)) {
 120          $id_trad = $tmp[$id_article]["id_trad"];
 121          $date = $tmp[$id_article]['date'];
 122          $date_modif = $tmp[$id_article]['date_modif'];
 123          $lang = $tmp[$id_article]['lang'];
 124                  
 125              
 126          if ($id_trad > 0 AND $id_trad != $id_article AND $sel_lang[$lang]) {
 127              if ($text_article[$id_trad]["date_modif"] < $text_article[$id_article]["date_modif"]) {
 128                  $text_article[$id_trad]["trad"]["$lang"] = "<a class='foncee' href='articles.php3?id_article=$id_article'>$lang</a>";
 129              } else {
 130                  $text_article[$id_trad]["trad"]["$lang"] = "<a class='claire' href='articles.php3?id_article=$id_article'>$lang</a>";
 131              }
 132          }
 133      }
 134  }
 135  
 136  echo "<form action='articles_tous.php3' method='get'>";
 137  echo "<input type='hidden' name='aff_art[]' value='x'>";
 138  
 139  debut_boite_info();
 140  
 141  echo "<B>"._T('titre_cadre_afficher_article')."&nbsp;:</B><BR>";
 142  
 143  if ($aff_statut['prepa'])
 144      echo http_label_img('prepa',
 145                  strpos($aff_art, 'prepa'),
 146                  'aff_art',
 147                  'puce-blanche-breve.gif',
 148                  _T('texte_statut_en_cours_redaction'));
 149  
 150  if ($aff_statut['prop'])
 151      echo http_label_img('prop',
 152                  strpos($aff_art, 'prop'),
 153                  'aff_art',
 154                  'puce-orange-breve.gif',
 155                  _T('texte_statut_attente_validation'));
 156      
 157  if ($aff_statut['publie'])
 158      echo http_label_img('publie',
 159                  strpos($aff_art, 'publie'),
 160                  'aff_art',
 161                  'puce-verte-breve.gif',
 162                  _T('texte_statut_publies'));
 163  
 164  if ($aff_statut['refuse'])
 165      echo http_label_img('refuse',
 166                  strpos($aff_art, 'refuse'),
 167                  'aff_art',
 168                  'puce-rouge-breve.gif',
 169                  _T('texte_statut_refuses'));
 170  
 171  if ($aff_statut['poubelle'])
 172      echo http_label_img('poubelle',
 173                  strpos($aff_art, 'poubelle'),
 174                  'aff_art',
 175                  'puce-poubelle-breve.gif',
 176                  _T('texte_statut_poubelle'));
 177  
 178  echo "<div align='$spip_lang_right'><INPUT TYPE='submit' NAME='Changer' CLASS='fondo' VALUE='"._T('bouton_changer')."'></div>";
 179  
 180  
 181  // GERER LE MULTILINGUISME
 182  if ((lire_meta('multi_rubriques') == 'oui' OR lire_meta('multi_articles') == 'oui') AND lire_meta('gerer_trad') == 'oui') {
 183  
 184      // bloc legende
 185      $lf = lire_meta('langue_site');
 186      echo "<hr /><div class='verdana2'>";
 187      echo _T('info_tout_site6');
 188      echo "<div><span class='lang_base'>$lf</span> ". _T('info_tout_site5') ." </div>";
 189      echo "<div><span class='creer'>$lf</span> ". _T('info_tout_site2') ." </div>";
 190      echo "<div><a class='claire'>$lf</a> ". _T('info_tout_site3'). " </div>";
 191      echo "<div><a class='foncee'>$lf</a> ". _T('info_tout_site4'). " </div>";
 192      echo "</div>\n";
 193  
 194      // bloc choix de langue
 195      $langues = explode(',', lire_meta('langues_multilingue'));
 196      if (count($langues) > 1) {
 197          sort($langues);
 198          echo "<br /><div class='verdana2'><b>"._T('titre_cadre_afficher_traductions')."</b><br />";
 199          echo "<SELECT STYLE='width:100%' NAME='sel_lang[]' size='".count($langues)."' ORDERED MULTIPLE>";
 200          while (list(, $l) = each ($langues)) {
 201              if ($sel_lang[$l])
 202                  echo "<option value='$l' selected>".traduire_nom_langue($l)."</option>\n"; 
 203              else
 204                  echo "<option value='$l'>".traduire_nom_langue($l)."</option>\n"; 
 205          }
 206          echo "</select></div>\n";
 207  
 208          echo "<div align='$spip_lang_right'><INPUT TYPE='submit' NAME='Changer' CLASS='fondo' VALUE='"._T('bouton_changer')."'></div>";
 209      }
 210  
 211  }
 212  
 213  
 214  
 215  
 216  fin_boite_info();
 217  echo "</form>";
 218  
 219  
 220  
 221  
 222  debut_droite();
 223  
 224  
 225  
 226  function afficher_rubriques_filles($id_parent) {
 227      global $rubrique, $enfant, $article, $text_article;
 228      global $spip_lang_left, $spip_lang_right, $spip_lang, $direction_generale;
 229      global $couleur_claire;
 230      global $decal;
 231      
 232      
 233  
 234      
 235      $decal = $decal + 1;
 236      $droite = 500 - (10 * $decal);
 237      
 238      if ($enfant[$id_parent]) {
 239          while (list(,$id_rubrique) = each($enfant[$id_parent]) ) {
 240              
 241              if ($id_parent == 0) {
 242                  $icone = "secteur-24.gif";
 243                  $bgcolor = " background-color: $couleur_claire;";
 244              }
 245              else {
 246                  $icone = "rubrique-24.gif";
 247                  $bgcolor = "";
 248              }
 249              
 250              echo "<div style='padding-top: 5px; padding-bottom: 5px; padding-$spip_lang_left: 28px; background: url(" . _DIR_IMG_PACK . "$icone) $spip_lang_left center no-repeat;$bgcolor'>";
 251              
 252              if ($enfant[$id_rubrique] OR $article[$id_rubrique]) echo bouton_block_invisible("rubrique$id_rubrique");
 253              
 254              echo "<b class='verdana2'><a href='naviguer.php3?id_rubrique=$id_rubrique'>";
 255              echo $rubrique[$id_rubrique];
 256              echo "</b></a></div>\n";
 257              
 258  
 259              if ($enfant[$id_rubrique] OR $article[$id_rubrique]) {
 260                  echo debut_block_invisible("rubrique$id_rubrique");            
 261  
 262                  echo "<div class='plan-rubrique'>";
 263                  if ($article[$id_rubrique]) {
 264                      echo "<div class='plan-articles'>";
 265                      while(list(,$zarticle) = each($article[$id_rubrique]) ) {
 266                          $zelang = $text_article[$zarticle]["lang"];
 267                          $text_article[$zarticle]["trad"]["$zelang"] = "";
 268                          if (count($text_article[$zarticle]["trad"]) > 0) {
 269                              ksort($text_article[$zarticle]["trad"]);
 270                              $traductions = join ($text_article[$zarticle]["trad"], "");
 271                          } else {
 272                              $traductions = "";
 273                          }
 274                          if ($text_article[$zarticle]["id_trad"] == 0 OR $text_article[$zarticle]["id_trad"] == $zarticle) {
 275                              //echo "<div style='position: relative;'$direction_generale>";
 276                              if (strlen($traductions)>0) echo "<div class='trad_float'>$traductions</div>";
 277                              echo "<a class='".$text_article[$zarticle]["statut"]."' href='articles.php3?id_article=$zarticle'>";
 278                              if ((lire_meta('multi_rubriques') == 'oui' OR lire_meta('multi_articles') == 'oui') AND lire_meta('gerer_trad') == 'oui') echo "<span class='lang_base'$direction_generale>".$text_article[$zarticle]["lang"]."</span> ";
 279                              echo "<span>".$text_article[$zarticle]["titre"]."</span></a>";    
 280                              //echo "</div>\n";
 281                          }
 282                      }
 283                      echo "</div>";
 284                                  
 285                  }
 286  
 287                  afficher_rubriques_filles($id_rubrique);    
 288                  echo "</div>";
 289                  echo fin_block();
 290              }
 291              
 292          if ($id_parent == 0) echo "<div>&nbsp;</div>";
 293          }
 294      }
 295      $decal = $decal-1;
 296      
 297  }
 298  
 299  
 300  
 301  $javasc_ouvrir = "manipuler_couches('ouvrir','$spip_lang_rtl',$first_couche,$last_couche, '" . _DIR_IMG_PACK . "')";
 302  $javasc_fermer = "manipuler_couches('fermer','$spip_lang_rtl',$first_couche,$last_couche, '" . _DIR_IMG_PACK . "')";
 303  
 304  // Demarrer l'affichage
 305  if ($les_rubriques AND $browser_layer) {
 306      $les_rubriques = join($les_rubriques,",");
 307      echo "<div>&nbsp;</div>";
 308      echo "<b class='verdana3'>";
 309      echo "<a href=\"javascript:$javasc_ouvrir\">";
 310      echo _T('lien_tout_deplier');
 311      echo "</a>";
 312      echo "</b>";
 313      echo " | ";
 314      echo "<b class='verdana3'>";
 315      echo "<a href=\"javascript:$javasc_fermer\">";
 316      echo _T('lien_tout_replier');
 317      echo "</a>";
 318      echo "</b>";
 319      echo "<div>&nbsp;</div>";
 320  }
 321  
 322  afficher_rubriques_filles(0);
 323  
 324  
 325  fin_page();
 326  
 327  ?>


Généré le : Thu Feb 22 22:27:47 2007 par Balluche grâce à PHPXref 0.7