[ Index ]
 

Code source de SPIP 1.8.3

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

title

Body

[fermer]

/ecrire/ -> naviguer.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  include_ecrire  ("inc_rubriques.php3");
  16  include_ecrire  ("inc_logos.php3");
  17  include_ecrire  ("inc_mots.php3");
  18  include_ecrire  ("inc_documents.php3");
  19  include_ecrire  ("inc_abstract_sql.php3");
  20  
  21  //
  22  // Gerer les modifications...
  23  //
  24  
  25  $id_parent = intval($id_parent);
  26  $id_rubrique = intval($id_rubrique);
  27  $flag_mots = lire_meta("articles_mots");
  28  $flag_editable = ($connect_statut == '0minirezo' AND (acces_rubrique($id_parent) OR acces_rubrique($id_rubrique))); // id_parent necessaire en cas de creation de sous-rubrique
  29  
  30  
  31  if (!$titre) {
  32      if ($modifier_rubrique == "oui") calculer_rubriques();
  33  }
  34  else {
  35      // creation, le cas echeant
  36      if ($new == 'oui' AND $flag_editable AND !$id_rubrique) {
  37          $id_rubrique = spip_abstract_insert("spip_rubriques", 
  38              "(titre, id_parent)",
  39              "('"._T('item_nouvelle_rubrique')."', '$id_parent')");
  40  
  41          // Modifier le lien de base pour qu'il prenne en compte le nouvel id
  42          unset($_POST['id_parent']);
  43          $_POST['id_rubrique'] = $id_rubrique;
  44          $clean_link = new Link();
  45      }
  46  
  47      // si c'est une rubrique-secteur contenant des breves, ne deplacer
  48      // que si $confirme_deplace == 'oui', et changer l'id_rubrique des
  49      // breves en question
  50      if ($GLOBALS['confirme_deplace'] == 'oui'
  51      AND $id_parent > 0) {
  52          list($id_secteur) = spip_fetch_array(spip_query(
  53              "SELECT id_secteur FROM spip_rubriques
  54              WHERE id_rubrique=$id_parent"));
  55          if ($id_secteur)
  56              spip_query("UPDATE spip_breves
  57                  SET id_rubrique=$id_secteur
  58                  WHERE id_rubrique=$id_rubrique");
  59      }
  60  
  61      if ($flag_editable) {
  62  
  63          if ($champs_extra) {
  64              include_ecrire ("inc_extra.php3");
  65              $champs_extra = ", extra = '".addslashes(extra_recup_saisie("rubriques"))."'";
  66          } 
  67          spip_query("UPDATE spip_rubriques SET " .
  68  (acces_rubrique($id_parent) ? "id_parent='$id_parent'," : "") . "
  69  titre='" . addslashes($titre) ."',
  70  descriptif='" . addslashes($descriptif) . "',
  71  texte='" . addslashes($texte) . "'
  72  $champs_extra
  73  WHERE id_rubrique=$id_rubrique");
  74      }
  75  
  76      calculer_rubriques();
  77      calculer_langues_rubriques();
  78  
  79      // invalider et reindexer
  80      if ($invalider_caches) {
  81          include_ecrire  ("inc_invalideur.php3");
  82          suivre_invalideur("id='id_rubrique/$id_rubrique'");
  83      }
  84      if (lire_meta('activer_moteur') == 'oui') {
  85          include_ecrire  ("inc_index.php3");
  86          marquer_indexer('rubrique', $id_rubrique);
  87      }
  88   }
  89  
  90  //
  91  // Appliquer le changement de langue
  92  //
  93  if ($changer_lang AND $id_rubrique>0 AND lire_meta('multi_rubriques') == 'oui' AND (lire_meta('multi_secteurs') == 'non' OR $id_parent == 0) AND $flag_editable) {
  94      if ($changer_lang != "herit")
  95          spip_query("UPDATE spip_rubriques SET lang='".addslashes($changer_lang)."', langue_choisie='oui' WHERE id_rubrique=$id_rubrique");
  96      else {
  97          if ($id_parent == 0)
  98              $langue_parent = lire_meta('langue_site');
  99          else {
 100              $row = spip_fetch_array(spip_query("SELECT lang FROM spip_rubriques WHERE id_rubrique=$id_parent"));
 101              $langue_parent = $row['lang'];
 102          }
 103          spip_query("UPDATE spip_rubriques SET lang='".addslashes($langue_parent)."', langue_choisie='non' WHERE id_rubrique=$id_rubrique");
 104      }
 105      calculer_langues_rubriques();
 106  }
 107  
 108  //
 109  // infos sur cette rubrique
 110  //
 111  
 112  if ($row=spip_fetch_array(spip_query("SELECT * FROM spip_rubriques WHERE id_rubrique='$id_rubrique'"))){
 113      $id_rubrique=$row['id_rubrique'];
 114      $id_parent=$row['id_parent'];
 115      $titre=$row['titre'];
 116      $descriptif=$row['descriptif'];
 117      $texte=$row['texte'];
 118      $statut = $row['statut'];
 119      $extra = $row["extra"];
 120      $langue_rubrique = $row['lang'];
 121  }
 122  
 123  if ($titre)
 124      $titre_page = "&laquo; ".textebrut(typo($titre))." &raquo;";
 125  else
 126      $titre_page = _T('titre_naviguer_dans_le_site');
 127  
 128  
 129  ///// debut de la page
 130  debut_page($titre_page, "documents", "rubriques");
 131  
 132  
 133  //////// parents
 134  
 135  
 136  debut_grand_cadre();
 137  
 138  if ($id_rubrique  > 0) {
 139      afficher_hierarchie($id_parent);
 140  }
 141  
 142  fin_grand_cadre();
 143  
 144  changer_typo('', 'rubrique'.$id_rubrique);
 145  
 146  
 147  debut_gauche();
 148  
 149  if ($spip_display != 4) {
 150      if ($id_rubrique > 0) {
 151          debut_boite_info();
 152          echo "<CENTER>";
 153          echo "<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=1><B>"._T('titre_numero_rubrique')."</B></FONT>";
 154          echo "<BR><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=6><B>$id_rubrique</B></FONT>";
 155          echo "</CENTER>";
 156      
 157          voir_en_ligne ('rubrique', $id_rubrique, $statut);
 158      
 159          fin_boite_info();
 160      }
 161      
 162      //
 163      // Logos de la rubrique
 164      //
 165      
 166      if ($connect_statut == '0minirezo' AND acces_rubrique($id_rubrique)) {
 167          if ($id_rubrique)
 168              afficher_boite_logo('rub', 'id_rubrique', $id_rubrique,
 169              _T('logo_rubrique')." ".aide ("rublogo"), _T('logo_survol'));
 170          else
 171              afficher_boite_logo('rub', 'id_rubrique', 0,
 172              _T('logo_standard_rubrique')." ".aide ("rublogo"),
 173              _T('logo_survol'));
 174      }
 175      
 176      
 177      //
 178      // Afficher les boutons de creation d'article et de breve
 179      //
 180      debut_raccourcis();
 181      
 182  
 183      icone_horizontale(_T('icone_tous_articles'), "articles_page.php3", "article-24.gif");
 184      
 185      if (spip_num_rows(spip_query("SELECT id_rubrique FROM spip_rubriques LIMIT 0,1")) > 0) {
 186          if ($id_rubrique > 0)
 187              icone_horizontale(_T('icone_ecrire_article'), "articles_edit.php3?id_rubrique=$id_rubrique&new=oui", "article-24.gif","creer.gif");
 188      
 189          $activer_breves = lire_meta("activer_breves");
 190          if ($activer_breves != "non" AND $id_parent == "0" AND $id_rubrique != "0") {
 191              icone_horizontale(_T('icone_nouvelle_breve'), "breves_edit.php3?id_rubrique=$id_rubrique&new=oui", "breve-24.gif","creer.gif");
 192          }
 193      }
 194      else {
 195          if ($connect_statut == '0minirezo') {
 196              echo "<p>"._T('info_creation_rubrique');
 197          }
 198      }
 199      
 200      fin_raccourcis();
 201  }
 202  
 203  
 204  debut_droite();
 205  
 206  
 207  if ($id_rubrique == 0) {
 208      $nom_site = lire_meta("nom_site");
 209      $titre = _T('info_racine_site').": ".$nom_site;
 210  }
 211  
 212  if ($id_rubrique ==  0) $ze_logo = "racine-site-24.gif";
 213  else if ($id_parent == 0) $ze_logo = "secteur-24.gif";
 214  else $ze_logo = "rubrique-24.gif";
 215  
 216  
 217  debut_cadre_relief($ze_logo);
 218  
 219  echo "\n<table cellpadding=0 cellspacing=0 border=0 width='100%'>";
 220  echo "<tr width='100%'><td width='100%' valign='top'>";
 221  gros_titre((!acces_restreint_rubrique($id_rubrique) ? '' :
 222         http_img_pack("admin-12.gif",'', "width='12' height='12'",
 223               _T('info_administrer_rubrique'))) .
 224         $titre);
 225  echo "</td>";
 226  
 227  if ($id_rubrique > 0 AND $flag_editable) {
 228      echo "<td>", http_img_pack("rien.gif", ' ', "width='5'") ."</td>\n";
 229      echo "<td  align='$spip_lang_right' valign='top'>";
 230      icone(_T('icone_modifier_rubrique'), "rubriques_edit.php3?id_rubrique=$id_rubrique&retour=nav", $ze_logo, "edit.gif");
 231      echo "</td>";
 232  }
 233  echo "</tr>\n";
 234  
 235  if (strlen($descriptif) > 1) {
 236      echo "<tr><td>\n";
 237      echo "<div align='$spip_lang_left' style='padding: 5px; border: 1px dashed #aaaaaa;'>";
 238      echo "<font size=2 face='Verdana,Arial,Sans,sans-serif'>";
 239      echo propre($descriptif."~");
 240      echo "</font>";
 241      echo "</div></td></tr>\n";
 242  }
 243  
 244  echo "</table>\n";
 245  
 246      if ($champs_extra AND $extra) {
 247          include_ecrire ("inc_extra.php3");
 248          extra_affichage($extra, "rubriques");
 249      }
 250  
 251  
 252  /// Mots-cles
 253  if ($flag_mots!= 'non' AND $flag_editable AND $options == 'avancees' AND $id_rubrique > 0) {
 254      echo "\n<p>";
 255      formulaire_mots('rubriques', $id_rubrique, $nouv_mot, $supp_mot, $cherche_mot, $flag_editable);
 256  }
 257  
 258  
 259  if (strlen($texte) > 1) {
 260      echo "\n<p><div align='justify'><font size=3 face='Verdana,Arial,Sans,sans-serif'>";
 261      echo justifier(propre($texte));
 262      echo "&nbsp;</font></div>";
 263  }
 264  
 265  
 266  //
 267  // Langue de la rubrique
 268  //
 269  if ($id_rubrique>0 AND lire_meta('multi_rubriques') == 'oui' AND (lire_meta('multi_secteurs') == 'non' OR $id_parent == 0) AND $flag_editable) {
 270  
 271      $row = spip_fetch_array(spip_query("SELECT lang, langue_choisie FROM spip_rubriques WHERE id_rubrique=$id_rubrique"));
 272      $langue_rubrique = $row['lang'];
 273      $langue_choisie_rubrique = $row['langue_choisie'];
 274      if ($id_parent) {
 275          $row = spip_fetch_array(spip_query("SELECT lang FROM spip_rubriques WHERE id_rubrique=$id_parent"));
 276          $langue_parent = $row[0];
 277      }
 278      else $langue_parent = lire_meta('langue_site');
 279  
 280      debut_cadre_enfonce('langues-24.gif');
 281      echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH=100% BACKGROUND=''><TR><TD BGCOLOR='#EEEECC' class='serif2'>";
 282      echo bouton_block_invisible('languesrubrique');
 283      echo "<B>";
 284      echo _T('titre_langue_rubrique');
 285      echo "&nbsp; (".traduire_nom_langue($langue_rubrique).")";
 286      echo "</B>";
 287      echo "</TD></TR></TABLE>";
 288  
 289      echo debut_block_invisible('languesrubrique');
 290      echo "<div class='verdana2' align='center'>";
 291      echo menu_langues('changer_lang', $langue_rubrique, '', $langue_parent);
 292      echo "</div>\n";
 293      echo fin_block();
 294  
 295      fin_cadre_enfonce();
 296  }
 297  
 298  
 299  fin_cadre_relief();
 300  
 301  
 302  ///// Afficher les rubriques 
 303  afficher_enfant_rub($id_rubrique, $flag_editable);
 304  
 305  
 306  
 307  //echo "<div align='$spip_lang_left'>";
 308  
 309  
 310  //////////  Vos articles en cours de redaction
 311  /////////////////////////
 312  
 313  echo "<P>";
 314  
 315  
 316  //
 317  // Verifier les boucles a mettre en relief
 318  //
 319  
 320  $relief = false;
 321  
 322  if (!$relief) {
 323      $query = "SELECT id_article FROM spip_articles AS articles WHERE id_rubrique='$id_rubrique' AND statut='prop'$vos_articles LIMIT 0,1";
 324      $result = spip_query($query);
 325      $relief = (spip_num_rows($result) > 0);
 326  }
 327  
 328  if (!$relief) {
 329      $query = "SELECT id_breve FROM spip_breves WHERE id_rubrique='$id_rubrique' AND (statut='prepa' OR statut='prop') LIMIT 0,1";
 330      $result = spip_query($query);
 331      $relief = (spip_num_rows($result) > 0);
 332  }
 333  
 334  if (!$relief AND lire_meta('activer_syndic') != 'non') {
 335      $query = "SELECT id_syndic FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND statut='prop' LIMIT 0,1";
 336      $result = spip_query($query);
 337      $relief = (spip_num_rows($result) > 0);
 338  }
 339  
 340  if (!$relief AND lire_meta('activer_syndic') != 'non' AND $connect_statut == '0minirezo' AND $connect_toutes_rubriques) {
 341      $query = "SELECT id_syndic FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND (syndication='off' OR syndication='sus') LIMIT 0,1";
 342      $result = spip_query($query);
 343      $relief = (spip_num_rows($result) > 0);
 344  }
 345  
 346  
 347  if ($relief) {
 348      echo "<p>";
 349      debut_cadre_couleur();
 350      echo "<div class='verdana2' style='color: black;'><b>"._T('texte_en_cours_validation')."</b></div><p>";
 351  
 352      //
 353      // Les articles a valider
 354      //
 355      afficher_articles(_T('info_articles_proposes'),
 356          "WHERE id_rubrique='$id_rubrique' AND statut='prop'$vos_articles ORDER BY date DESC");
 357  
 358      //
 359      // Les breves a valider
 360      //
 361      $query = "SELECT * FROM spip_breves WHERE id_rubrique='$id_rubrique' AND (statut='prepa' OR statut='prop') ORDER BY date_heure DESC";
 362      afficher_breves(_T('info_breves_valider'), $query, true);
 363  
 364      //
 365      // Les sites references a valider
 366      //
 367      if (lire_meta('activer_syndic') != 'non') {
 368          include_ecrire ("inc_sites.php3");
 369          afficher_sites(_T('info_site_valider'), "SELECT * FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND statut='prop' ORDER BY nom_site");
 370      }
 371  
 372      //
 373      // Les sites a probleme
 374      //
 375      if (lire_meta('activer_syndic') != 'non' AND $connect_statut == '0minirezo' AND $connect_toutes_rubriques) {
 376          include_ecrire ("inc_sites.php3");
 377          afficher_sites(_T('avis_sites_syndiques_probleme'),
 378              "SELECT * FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND (syndication='off' OR syndication='sus') AND statut='publie' ORDER BY nom_site");
 379      }
 380  
 381      // Les articles syndiques en attente de validation
 382      if ($id_rubrique == 0 AND $connect_statut == '0minirezo' AND $connect_toutes_rubriques) {
 383          $result = spip_query ("SELECT COUNT(*) AS compte FROM spip_syndic_articles WHERE statut='dispo'");
 384          if (($row = spip_fetch_array($result)) AND $row['compte'])
 385              echo "<br><small><a href='sites_tous.php3'>".$row['compte']." "._T('info_liens_syndiques_1')."</a> "._T('info_liens_syndiques_2')."</small>";
 386      }
 387  
 388      fin_cadre_couleur();
 389  }
 390  
 391  
 392  
 393  
 394  //////////  Les articles en cours de redaction
 395  /////////////////////////
 396  
 397  if ($connect_statut == "0minirezo" AND $options == 'avancees') {
 398      afficher_articles(_T('info_tous_articles_en_redaction'),
 399          "WHERE statut='prepa' AND id_rubrique='$id_rubrique' ORDER BY date DESC");
 400  }
 401  
 402  
 403  //////////  Les articles publies
 404  /////////////////////////
 405  
 406  afficher_articles(_T('info_tous_articles_presents'),
 407      "WHERE statut='publie' AND id_rubrique='$id_rubrique' ORDER BY date DESC", true);
 408  
 409  if ($id_rubrique > 0){
 410      echo "<div align='$spip_lang_right'>";
 411      icone(_T('icone_ecrire_article'), "articles_edit.php3?id_rubrique=$id_rubrique&new=oui", "article-24.gif", "creer.gif");
 412      echo "</div><p>";
 413  }
 414  
 415  //// Les breves
 416  
 417  afficher_breves(_T('icone_ecrire_nouvel_article'), "SELECT * FROM spip_breves WHERE id_rubrique='$id_rubrique' AND statut != 'prop' AND statut != 'prepa' ORDER BY date_heure DESC");
 418  
 419  $activer_breves=lire_meta("activer_breves");
 420  
 421  if ($id_parent == "0" AND $id_rubrique != "0" AND $activer_breves!="non"){
 422      echo "<div align='$spip_lang_right'>";
 423      icone(_T('icone_nouvelle_breve'), "breves_edit.php3?id_rubrique=$id_rubrique&new=oui", "breve-24.gif", "creer.gif");
 424      echo "</div><p>";
 425  }
 426  
 427  
 428  
 429  //// Les sites references
 430  
 431  if (lire_meta("activer_sites") == 'oui') {
 432      include_ecrire ("inc_sites.php3");
 433      afficher_sites(_T('titre_sites_references_rubrique'), "SELECT * FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND statut!='refuse' AND statut != 'prop' AND syndication NOT IN ('off','sus') ORDER BY nom_site");
 434  
 435      $proposer_sites=lire_meta("proposer_sites");
 436      if ($id_rubrique > 0 AND ($flag_editable OR $proposer_sites > 0)) {
 437          $link = new Link('sites_edit.php3');
 438          $link->addVar('id_rubrique', $id_rubrique);
 439          $link->addVar('target', 'sites.php3');
 440          $link->addVar('redirect', $clean_link->getUrl());
 441      
 442          echo "<div align='$spip_lang_right'>";
 443          icone(_T('info_sites_referencer'), $link->getUrl(), "site-24.gif", "creer.gif");
 444          echo "</div><p>";
 445      }
 446  }
 447  
 448  /// Documents associes a la rubrique
 449  
 450  if ($id_rubrique>0) {
 451      # modifs de la description d'un des docs joints
 452      if ($flag_editable) maj_documents($id_rubrique, 'rubrique');
 453       afficher_documents_non_inclus($id_rubrique, "rubrique", $flag_editable);
 454  }
 455  
 456  
 457  
 458  ////// Supprimer cette rubrique (si vide)
 459  
 460  if (($id_rubrique>0) AND tester_rubrique_vide($id_rubrique) AND $flag_editable) {
 461      $link = new Link('naviguer.php3');
 462      $link->addVar('id_rubrique', $id_parent);
 463      $link->addVar('supp_rubrique', $id_rubrique);
 464  
 465      echo "<p><div align='center'>";
 466      icone(_T('icone_supprimer_rubrique'), $link->getUrl(), "$ze_logo", "supprimer.gif");
 467      echo "</div><p>";
 468  
 469  
 470  }
 471  
 472  
 473  
 474  fin_page();
 475  
 476  ?>


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