[ 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_petition.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  
  21  require_once (dirname(__FILE__). "/include/bd/inc_article_factory.php");
  22  require_once (dirname(__FILE__). "/include/bd/inc_signature_factory.php");
  23  
  24  debut_page(_T('titre_page_controle_petition'), "suivi", "suivi-petition");
  25  debut_gauche();
  26  
  27  //
  28  // Raccourcis
  29  //
  30  
  31  debut_droite();
  32  
  33  function controle_forum ($request, $adresse_retour) {
  34      global $debut;
  35      global $couleur_foncee;
  36  
  37      $nb_forum[$compteur_forum] = sizeOf($request);
  38      $i[$compteur_forum] = 1;
  39  
  40      while (list(, $maSignature) = each($request)) {
  41          $id_signature = $maSignature->getSignatureId();
  42          $id_article = $maSignature->getArticleId();
  43          $date_time     = $maSignature->getDateTime();
  44          $nom_email     = typo(echapper_tags($maSignature->getNomEmail()));
  45          $ad_email     = echapper_tags($maSignature->getAdEmail());
  46          $nom_site     = typo(echapper_tags($maSignature->getNomSite()));
  47          $url_site     = echapper_tags($maSignature->getUrlSite());
  48          $message     = propre(echapper_tags($maSignature->getMessage()));
  49          $statut     = $maSignature->getStatut();
  50  
  51          echo "<P>";
  52  
  53          if ($statut == "poubelle") {
  54              echo "<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=0 BORDER=0><TR><TD BGCOLOR='#FF0000'>";
  55          }
  56  
  57          echo "<TABLE WIDTH=100% CELLPADDING=3 CELLSPACING=0>\n<TR>\n"
  58              ."<TD BGCOLOR='$couleur_foncee' class='verdana2' style='color: white;'>"
  59              ."<B>$nom_site / $nom_email</B></TD>\n</TR>\n";
  60          echo "<TR>\n<TD BGCOLOR='#FFFFFF' class='serif'>";
  61  
  62          if ($statut == "publie") {
  63              icone(_T('icone_supprimer_signature'), 
  64                      "controle_petition.php?supp_petition=$id_signature&debut=$debut", 
  65                      "forum-interne-24.gif", 
  66                      "supprimer.gif", 
  67                      "right");
  68          }
  69  
  70          if ($statut == "poubelle") {
  71              icone(_T('icone_valider_signature'), 
  72                      "controle_petition.php?add_petition=$id_signature&debut=$debut", 
  73                      "forum-interne-24.gif", 
  74                      "creer.gif", 
  75                      "right");
  76          }
  77  
  78          echo "<FONT SIZE=2>" . affdate($date_time). "</FONT><BR>";
  79  
  80          if ($statut == "poubelle") {
  81              echo "<FONT SIZE=1 COLOR='red'>" . _T('info_message_efface'). "</FONT><BR>";
  82          }
  83  
  84          if (strlen($url_site) > 6 AND strlen($nom_site) > 0) {
  85              echo "<FONT SIZE=1>" . _T('info_site_web'). "</FONT> <A HREF='$url_site'>$nom_site</A><BR>";
  86          }
  87  
  88          if (strlen($ad_email) > 0) {
  89              echo "<FONT SIZE=1>" . _T('info_adresse_email'). "</FONT> <A HREF='mailto:$ad_email'>$ad_email</A><BR>";
  90          }
  91  
  92          if (strlen($message) > 0)
  93              echo "<P>$message";
  94  
  95          $articleMetier = &recuperer_instance_article();
  96          $res_query = $articleMetier->loadLightWeight($id_article);
  97  
  98          if (PEAR::isError($res_query)) {
  99              die ($res_query->getMessage());
 100          }
 101          else if (intval($articleMetier->getArticleId()) == $id_article) {
 102              $titre = $articleMetier->getTitre();
 103          }
 104  
 105          echo "<P align='right'><A HREF='../spip_redirect.php?id_article=$id_article&recalcul=oui'>$titre</A>";
 106          echo "</TD></TR></TABLE>";
 107  
 108          if ($statut == "poubelle") {
 109              echo "</TD></TR></TABLE>";
 110          }
 111      }
 112  }
 113  
 114  echo "<div class='serif2'>";
 115  echo "<FONT SIZE=2 FACE='Georgia,Garamond,Times,serif'>";
 116  $authorization = &recuperer_instance_authorization('gestionPetition', $GLOBALS['connect_id_auteur']);
 117  
 118  if ($authorization->isAuthorizedAction()) {
 119      gros_titre (_T('titre_suivi_petition'));
 120  
 121      if ($supp_petition) {
 122          $signatureMetier = &recuperer_instance_signature();
 123          $loadOK = $signatureMetier->load($supp_petition);
 124          if (PEAR::isError($loadOK)) {
 125              die ($loadOK->getMessage());
 126          }
 127          else {
 128              $signatureMetier->setStatut('poubelle');
 129              $updateOK = $signatureMetier->update();
 130              if (PEAR::isError($updateOK)) {
 131                  die ($updateOK->getMessage());
 132              }
 133          }
 134      }
 135  
 136      if ($add_petition) {
 137          $signatureMetier = &recuperer_instance_signature();
 138          $loadOK = $signatureMetier->load($add_petition);
 139          if (PEAR::isError($loadOK)) {
 140              die ($loadOK->getMessage());
 141          }
 142          else {
 143              $signatureMetier->setStatut('publie');
 144              $updateOK = $signatureMetier->update();
 145              if (PEAR::isError($updateOK)) {
 146                  die ($updateOK->getMessage());
 147              }
 148          }
 149      }
 150  
 151      if (!$debut)
 152          $debut = 0;
 153  
 154      $signatureMetier = &recuperer_instance_signature();
 155      $total = 0;
 156  
 157      if ($id_article) {
 158          $total = $signatureMetier->howManySignatureForStatutsAndDateTime('publie', 'poubelle', $id_article);
 159          $url_article = "&id_article=$id_article";
 160      }
 161      else {
 162          $total = $signatureMetier->howManySignatureForStatutsAndDateTime('publie', 'poubelle');
 163      }
 164  
 165      if (PEAR::isError($total)) {
 166          die ($total->getMessage());
 167      }
 168  
 169      if ($total > 10) {
 170          echo "<p>";
 171          for ($i = 0; $i < $total; $i = $i + 10){
 172              if ($i > 0) echo " | ";
 173              if ($i == $debut)
 174                  echo "<FONT SIZE=3><B>$i</B></FONT>";
 175              else
 176                  echo "<A HREF='controle_petition.php?debut=$i$url_article'>$i</A>";
 177          }
 178      }
 179  
 180      $signatureMetier = &recuperer_instance_signature();
 181      $deleteForStatutsAndDateTimeOK = $signatureMetier->deleteForStatutsAndDateTime('publie', 'poubelle');
 182  
 183      if(PEAR::isError($deleteForStatutsAndDateTimeOK)) {
 184          die($deleteForStatutsAndDateTimeOK->getMessage());
 185      }
 186  
 187      $signatureMetier = &recuperer_instance_signature();
 188      
 189      if ($id_article) {
 190          $allSignatures = &$signatureMetier->getAllForStatutsAndArticleId('publie', 'poubelle', $debut, $id_article);
 191      }
 192      else {
 193          $allSignatures = &$signatureMetier->getAllForStatutsAndArticleId('publie', 'poubelle', $debut);
 194      }
 195  
 196      if(PEAR::isError($allSignatures)) {
 197          die($allSignatures->getMessage());
 198      }
 199      
 200      controle_forum($allSignatures, "forum.php");
 201  }
 202  else {
 203      echo "<B>"._T('avis_non_acces_page')."</B>";
 204  }
 205  
 206  echo "</div>";
 207  
 208  fin_page();
 209  ?>


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