[ Index ]
 

Code source de SPIP Agora 1.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Agora1-4/ecrire/ -> controle_forum_old.php (source)

   1  <?php
   2  /*****************************************************
   3  * This file is part of Agora, web based content management system.
   4  *
   5  * Agora is free software; you can redistribute it and/or modify
   6  * it under the terms of the GNU General Public License as published by
   7  * the Free Software Foundation; version 2 of the License.
   8  *
   9  * Agora is distributed in the hope that it will be useful,
  10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  * GNU General Public License for more details (file "COPYING").
  13  *
  14  * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière.
  15  * List of authors detailed in "copyright_fr.html" file.
  16  * E-mail : agora@sig.premier-ministre.gouv.fr
  17  * Web site : http://www.agora.gouv.fr
  18  *****************************************************/
  19  include  ("inc.php");
  20  // Couche métier
  21  require_once (dirname(__FILE__). "/include/bd/inc_article_factory.php");
  22  require_once (dirname(__FILE__). "/include/bd/inc_breve_factory.php");
  23  require_once (dirname(__FILE__). "/include/bd/inc_forum_factory.php");
  24  
  25  debut_page(_T('titre_page_forum_suivi'), "suivi", "forum-controle");
  26  
  27  $requete_base_controle = "statut!='perso' AND statut != 'redac'";
  28  
  29  if (!$page)
  30      $page = "public";
  31  
  32  echo "<br><br><br>";
  33  gros_titre (_T('titre_forum_suivi'));
  34  
  35  barre_onglets("suivi_forum", $page);
  36  
  37  debut_gauche();
  38  
  39  debut_boite_info();
  40  
  41  echo "<FONT FACE='Verdana,Arial,Helvetica,sans-serif' SIZE=2>";
  42  echo _T('info_gauche_suivi_forum_2');
  43  
  44  echo aide("suiviforum");
  45  echo "</FONT>";
  46  
  47  fin_boite_info();
  48  
  49  //
  50  // Raccourcis
  51  //
  52  $activer_stats = lire_meta("activer_statistiques");
  53  $authorization = &recuperer_instance_authorization('afficherIconeStatistique', $GLOBALS['connect_id_auteur'],
  54                                                     array('connect_toutes_rubriques' => 0));
  55  
  56  if ($authorization->isAuthorizedAction()) {
  57      debut_raccourcis();
  58      icone_horizontale(_T('icone_evolution_visites_2'), "statistiques_visites.php", "statistiques-24.gif", "rien.gif");
  59      fin_raccourcis();
  60  }
  61  
  62  debut_droite();
  63  $mots_cles_forums = lire_meta("mots_cles_forums");
  64  
  65  function forum_parent ($id_forum) {
  66      $forumMetier = &recuperer_instance_forum();
  67      $loadOK = $forumMetier->load($id_forum);
  68  
  69      if (!PEAR::isError($loadOK)) {
  70          if ($forumMetier->getStatut() != "redac") {
  71              $id_forum         = $forumMetier->getForumId();
  72              $forum_id_parent = $forumMetier->getParentId();
  73              $forum_id_rubrique = $forumMetier->getRubriqueId();
  74              $forum_id_article = $forumMetier->getArticleId();
  75              $forum_id_breve = $forumMetier->getBreveId();
  76              $forum_id_syndic = $forumMetier->getSyndicId();
  77              $forum_date_heure = $forumMetier->getDateHeure();
  78              $titre             = $forumMetier->getTitre();
  79              $texte             = $forumMetier->getTexte();
  80              $auteur         = $forumMetier->getAuteur();
  81              $email_auteur     = $forumMetier->getEmailAuteur();
  82              $nom_site_forum = $forumMetier->getNomSite();
  83              $url_site         = $forumMetier->getUrlSite();
  84              $forum_stat     = $forumMetier->getStatut();
  85              $forum_ip         = $forumMetier->getIp();
  86              if ($forum_id_article > 0) {
  87                  $articleMetier = &recuperer_instance_article();
  88                  $loadOK = $articleMetier->loadLightWeight($forum_id_article);
  89  
  90                  if (PEAR::isError($loadOK)) {
  91                      die ($loadOK->getMessage());
  92                  }
  93                  else {
  94                      if (intval($articleMetier->getArticleId()) == $forum_id_article) {
  95                          $id_article = $articleMetier->getArticleId();
  96                          $titre = $articleMetier->getTitre();
  97                          $statut = $articleMetier->getStatut();
  98                      }
  99                  }
 100                  if ($forum_stat == "prive" OR $forum_stat == "privoff") {
 101                      return $retour."<B>"._T('item_reponse_article')
 102                      ." <A HREF='articles.php?id_article=$id_article'>$titre</A></B>";
 103                  }
 104                  else {
 105                      $retour .= "<a href='articles_forum.php?id_article=$id_article'>"
 106                              ."<font color='red'>" . _T('lien_forum_public'). "</font></a><br />\n";
 107                      return $retour."<B>"._T('lien_reponse_article')
 108                              ." <A HREF='".generer_url_article($id_article)."'>$titre</A></B>";
 109                  }
 110              }
 111              else if ($forum_id_rubrique > 0) {
 112                  $rubriqueMetier = &recuperer_instance_rubrique();
 113                  $loadOK = $rubriqueMetier->load($forum_id_rubrique);
 114  
 115                  if (PEAR::isError($loadOK)) {
 116                      die ($loadOK->getMessage());
 117                  }
 118                  else {
 119                      if (intval($rubriqueMetier->getRubriqueId()) == $forum_id_rubrique) {
 120                          $id_rubrique = $rubriqueMetier->getRubriqueId();
 121                          $titre = $rubriqueMetier->getTitre();
 122                      }
 123                  }
 124                  return "<B>"._T('lien_reponse_rubrique')." "
 125                        ."<A HREF='".generer_url_rubrique($id_rubrique)."'>$titre</A></B>";
 126              }
 127              else if ($forum_id_syndic > 0) {
 128                  $syndicMetier = &recuperer_instance_syndic();
 129                  $loadOK = $syndicMetier->load($forum_id_syndic);
 130  
 131                  if (PEAR::isError($loadOK)) {
 132                      die ($loadOK->getMessage());
 133                  }
 134                  else {
 135                      $id_rubique_fond = $syndicMetier->getRubriqueId();
 136                      $id_syndic = $syndicMetier->getSyndicId();
 137                      $titre = $syndicMetier->getNomSite();
 138                      $statut = $syndicMetier->getStatut();
 139                  }
 140                  return "<B>"._T('lien_reponse_site_reference')
 141                        ." <A HREF='sites.php?id_syndic=$id_syndic'>$titre</A></B>";
 142              }
 143              else if ($forum_id_breve > 0) {
 144                  $breveMetier = &recuperer_instance_breve();
 145                  $loadOK = $breveMetier->load($forum_id_breve);
 146  
 147                  if (PEAR::isError($loadOK)) {
 148                      die ($loadOK->getMessage());
 149                  }
 150                  else {
 151                      $id_breve = $breveMetier->getBreveId();
 152                      $date_heure = $breveMetier->getDateHeure();
 153                      $titre = $breveMetier->getTitre();
 154                  }
 155                  if ($forum_stat == "prive") {
 156                      return "<B>"._T('lien_reponse_breve')
 157                            ." <A HREF='breves_voir.php?id_breve=$id_breve'>$titre</A></B>";
 158                  }
 159                  else {
 160                      return "<B>"._T('lien_reponse_breve_2')
 161                            ." <A HREF='".generer_url_breve($id_breve)."'>$titre</A></B>";
 162                  }
 163              }
 164              else if ($forum_stat == "privadm") {
 165                  $retour = forum_parent($forum_id_parent);
 166                  if (strlen($retour) > 0)
 167                      return $retour;
 168                  else
 169                      return "<B>"._T('info_message')
 170                      ." <A HREF='forum_admin.php'>"._T('info_forum_administrateur')."</A></B>";
 171              }
 172              else {
 173                  $retour = forum_parent($forum_id_parent);
 174                  if (strlen($retour) > 0)
 175                      return $retour;
 176                  else
 177                      return "<B>"._T('info_message')." <A HREF='forum.php'>"._T('info_forum_interne')."</A></B>";
 178              }
 179          }
 180      }
 181  }
 182  
 183  function controle_forum ($row) {
 184      global $couleur_foncee;
 185      global $mots_cles_forums;
 186      global $controle_sans;
 187      global $debut, $page;
 188  
 189      $controle         = "<BR><BR>";
 190      $id_forum         = $row->getForumId();
 191      $forum_id_parent = $row->getParentId();
 192      $forum_id_rubrique = $row->getRubriqueId();
 193      $forum_id_article = $row->getArticleId();
 194      $forum_id_breve = $row->getBreveId();
 195      $forum_date_heure = $row->getDateHeure();
 196      $forum_titre     = echapper_tags($row->getTitre());
 197      $forum_texte     = echapper_tags($row->gettexte());
 198      $forum_auteur = echapper_tags($row->getAuteur());
 199      $forum_email_auteur = echapper_tags($row->getEmailAuteur());
 200      $forum_nom_site = echapper_tags($row->getNomSite());
 201      $forum_url_site = echapper_tags($row->getUrlSite);
 202      $forum_stat     = $row->getStatut();
 203      $forum_ip         = $row->getIp();
 204      $forum_id_auteur = $row->getAuteurId();
 205  
 206      if ($forum_stat == "off" OR $forum_stat == "privoff")
 207          $controle .= "<div style='border: 2px #ff0000 dashed; background-color: white;'>";
 208      else if ($forum_stat == "prop")
 209          $controle .= "<div style='border: 2px yellow solid; background-color: white;'>";
 210      else {
 211          $controle .= "<div style='border-right: 1px solid #cccccc; border-bottom: 1px solid #cccccc;'>";
 212          $controle .= "<div style='border: 1px #999999 dashed; background-color: white;'>";
 213      }
 214  
 215      $controle .= "<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>\n<TR>\n";
 216      $controle .= "<TD WIDTH=100% VALIGN='top'>";
 217  
 218      $controle .= "<TABLE WIDTH=100% CELLPADDING=5 CELLSPACING=0>\n<TR>\n"
 219                  ."<TD BGCOLOR='$couleur_foncee'><FONT FACE='Verdana,Arial,Helvetica,sans-serif' SIZE=2 COLOR='#FFFFFF'><B>" 
 220                  .typo($forum_titre)."</B></FONT></TD>\n</TR>\n";
 221      $controle .= "<TR>\n<TD>";
 222      $controle .= "<FONT SIZE=2 FACE='Georgia,Garamond,Times,serif'>";
 223      $controle .= "<FONT FACE='arial,helvetica'>".affdate_heure($forum_date_heure)."</FONT>";
 224  
 225      if ($forum_auteur) {
 226          if ($forum_email_auteur)
 227              $forum_auteur = "<A HREF=\"mailto:$forum_email_auteur?SUBJECT="
 228                              .rawurlencode($forum_titre)."\">$forum_auteur</A>";
 229          $controle .= "<FONT FACE='arial,helvetica'> / <B>$forum_auteur</B></FONT>";
 230      }
 231  
 232      if ($forum_stat != "off" AND $forum_stat != "privoff") {
 233          if ($forum_stat == "publie" OR $forum_stat == "prop")
 234              $controle .= icone(_T('icone_supprimer_message'),
 235                                 "controle_forum_old.php?supp_forum=$id_forum&debut=$debut$controle_sans&page=$page",
 236                                 "forum-interne-24.gif",
 237                                 "supprimer.gif",
 238                                 "right",
 239                                 'non');
 240          else if ($forum_stat == "prive" OR $forum_stat == "privrac" OR $forum_stat == "privadm")
 241              $controle .= icone(_T('icone_supprimer_message'),
 242                                 "controle_forum_old.php?supp_forum_priv=$id_forum&debut=$debut$controle_sans&page=$page",
 243                                 "forum-interne-24.gif",
 244                                 "supprimer.gif",
 245                                 "right",
 246                                 'non');
 247      }
 248      else {
 249          $controle .= "<BR><FONT COLOR='red'><B>" . _T('info_message_supprime'). " $forum_ip</B></FONT>";
 250          if ($forum_id_auteur > 0)
 251              $controle .= " - <A HREF='auteurs_edit.php?id_auteur=$forum_id_auteur'>"._T('lien_voir_auteur')."</A>";
 252      }
 253  
 254      if ($forum_stat == "prop")
 255          $controle .= icone(_T('icone_valider_message'),
 256                             "controle_forum_old.php?valid_forum=$id_forum&debut=$debut&page=$page", 
 257                              "forum-interne-24.gif", 
 258                              "creer.gif", 
 259                              "right", 
 260                              'non');
 261  
 262      $controle .= "<BR>".forum_parent($id_forum);
 263      $controle .= "<P align='justify'>".propre($forum_texte);
 264  
 265      if (strlen($forum_url_site) > 10 AND strlen($forum_nom_site) > 3)
 266          $controle .= "<P align='left'><FONT FACE='Verdana,Arial,Helvetica,sans-serif'><B>"
 267                      ."<A HREF='$forum_url_site'>$forum_nom_site</A></B></FONT>";
 268  
 269      if ($mots_cles_forums == "oui") {
 270          $motMetier = &recuperer_instance_mot();
 271          $allMots = $motMetier->getAllFromMotsAndAnotherTable("forum", "id_forum", $id_forum);
 272  
 273          if (PEAR::isError($allMots)) {
 274              die ($allMots->getMessage());
 275          }
 276  
 277          if (sizeOf($allMots) > 0)
 278              $ret .= "<p>" . _T('forum_avez_selectionne');
 279          while (list(, $motMetier) = each($allMots)) {
 280              $id_mot = $motMetier->getMotId();
 281              $titre_mot = propre($motMetier->getTitre());
 282              $type_mot = propre($motMetier->getType());
 283              $les_mots[$id_mot] = true;
 284              $presence_mots = true;
 285              $ret .= "<li> $type_mot&nbsp;: <b>$titre_mot</b>";
 286          }
 287      }
 288  
 289      $controle .= "</FONT></TD>\n";
 290      $controle .= "</TR>\n</TABLE>\n";
 291      $controle .= "</TD>\n</TR>\n</TABLE>\n\n";
 292  
 293      if (!($forum_stat == 'off' OR $forum_stat == 'privoff' OR $forum_stat == 'prop'))
 294          $controle .= "</div>";
 295  
 296      $controle .= "</div>";
 297  
 298      return $controle;
 299  }
 300  
 301  //
 302  // Debut de la page de controle
 303  //
 304  
 305  echo "<FONT SIZE=2 FACE='Georgia,Garamond,Times,serif'>";
 306  
 307  // reglages
 308  if (!$debut)
 309      $debut = 0;
 310  
 311  $pack         = 20;    // nb de forums affiches par page
 312  $enplus     = 200;     // intervalle affiche autour du debut
 313  $limitdeb     = ($debut > $enplus) ? $debut - $enplus : 0;
 314  $limitnb     = $debut + $enplus - $limitdeb;
 315  $wheretexte = $controle_sans ? "texte=''" : "texte!=''";
 316  $forumMetier = &recuperer_instance_forum();
 317  $allForums     = $forumMetier->getAllForForumType($page, $limitdeb, $limitnb);
 318  
 319  if (PEAR::isError($allForums)) {
 320      die ($allForums->getMessage());
 321  }
 322  
 323  $controle = '';
 324  $i = $limitdeb;
 325  if ($i > 0)
 326      echo "<A HREF='controle_forum_old.php?page=$page'>0</A> ... | ";
 327  
 328  while (list(, $monForum) = each($allForums)) {
 329      // est-ce que ce message doit s'afficher dans la liste ?
 330      $ok_controle = (($i >= $debut)AND ($i < $debut + $pack));
 331  
 332      // barre de navigation
 333      if ($i == $pack * floor($i / $pack)) {
 334          if ($i == $debut)
 335              echo "<FONT SIZE=3><B>$i</B></FONT>";
 336          else
 337              echo "<A HREF='controle_forum_old.php?debut=$i&page=$page'>$i</A>";
 338          echo " | ";
 339      }
 340  
 341      // elements a controler
 342      if ($ok_controle)
 343          $controle .= controle_forum($monForum);
 344      $i++;
 345  }
 346  
 347  echo "<A HREF='controle_forum_old.php?debut=$i&page=$page'>...</A>";
 348  
 349  echo $controle;
 350  
 351  echo "</FONT>";
 352  
 353  fin_page();
 354  
 355  ?>


Généré le : Sat Feb 24 14:40:03 2007 par Balluche grâce à PHPXref 0.7