[ PHPXref.com ] [ Generated: Sun Jul 20 20:25:42 2008 ] [ SPIP 1.8.3 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ecrire/ -> inc_signatures.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  //
  15  // Ce fichier ne sera execute qu'une fois
  16  if (defined("_ECRIRE_INC_SIGNATURES")) return;
  17  define("_ECRIRE_INC_SIGNATURES", "1");
  18  
  19  include_ecrire('inc_urls.php3');
  20  
  21  function controle_signatures($script, $id, $debut, $where, $order, $limit=10) {
  22      global $couleur_foncee;
  23      
  24      $where = tronconne_signatures($script, $id, $debut, $where, $limit);
  25      $request = spip_query("SELECT * FROM spip_signatures " .
  26                    ($where ? " WHERE $where" : "") .
  27                    ($order ? " ORDER BY $order" : "") .
  28                    " LIMIT " . ($debut ? "$debut," : "") . $limit);
  29  
  30       while($row=spip_fetch_array($request)){
  31          $row = safehtml_sur_row($row);
  32          $id_signature = $row['id_signature'];
  33          $id_article = $row['id_article'];
  34          $date_time = $row['date_time'];
  35          $nom_email= typo(echapper_tags($row['nom_email']));
  36          $ad_email = echapper_tags($row['ad_email']);
  37          $nom_site = typo(echapper_tags($row['nom_site']));
  38          $url_site = echapper_tags($row['url_site']);
  39          $statut = $row['statut'];
  40          
  41          echo "<P>";
  42          
  43          if ($statut=="poubelle"){
  44              echo "<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=0 BORDER=0><TR><TD BGCOLOR='#FF0000'>";
  45          }
  46          
  47          echo "<TABLE WIDTH=100% CELLPADDING=3 CELLSPACING=0><TR><TD BGCOLOR='$couleur_foncee' class='verdana2' style='color: white;'><b>",
  48            ($nom_site ? "$nom_site / " : ""),
  49            $nom_email,
  50            "</b></TD></TR>",
  51            "<TR><TD BGCOLOR='#FFFFFF' class='serif'>";
  52                  
  53          if ($statut=="publie"){
  54              icone (_T('icone_supprimer_signature'), "$script?supp_petition=$id_signature&debut=$debut", "forum-interne-24.gif", "supprimer.gif", "right");
  55          }
  56          if ($statut=="poubelle"){
  57              icone (_T('icone_valider_signature'), "$script?add_petition=$id_signature&debut=$debut", "forum-interne-24.gif", "creer.gif", "right");
  58          }
  59          
  60          echo "<FONT SIZE=2>".date_relative($date_time)."</FONT><BR>";
  61          if ($statut=="poubelle"){
  62              echo "<FONT SIZE=1 COLOR='red'>"._T('info_message_efface')."</FONT><BR>";
  63          }
  64          if (strlen($url_site)>6 AND strlen($nom_site)>0){
  65              echo "<FONT SIZE=1>"._T('info_site_web')."</FONT> <A HREF='$url_site'>$nom_site</A><BR>";
  66          }
  67          if (strlen($ad_email)>0){
  68              echo "<FONT SIZE=1>"._T('info_adresse_email')."</FONT> <A HREF='mailto:$ad_email'>$ad_email</A><BR>";
  69          }
  70  
  71          echo "<p>",message_de_signature($row),"</p>";
  72          
  73          list($titre) = spip_fetch_array(spip_query("SELECT titre FROM spip_articles WHERE id_article=$id_article"));    
  74  
  75          if (!$id)
  76            echo "<span class='arial1' style='float: $spip_lang_right; color: black; padding-$spip_lang_left: 4px;'><b>",
  77              _T('info_numero_abbreviation'),
  78              $id_article,
  79              " </b></span>";
  80          
  81          echo "<a href='",
  82            (($statut == 'publie') ? 
  83             "../spip_redirect.php3" :
  84             "articles.php3"),
  85            "?id_article=$id_article",
  86            "'>",
  87            typo($titre),
  88            "</a>";
  89  
  90          echo "</TD></TR></TABLE>";
  91          
  92          if ($statut=="poubelle"){
  93              echo "</TD></TR></TABLE>";
  94          }
  95      }
  96  }
  97  
  98  function tronconne_signatures($script, $id_article, $debut, $where, $limit)
  99  {
 100      if ($id_article) {
 101          $script .= "?id_article=$id_article&";
 102          $where .= ($where ? " AND " : "") . "id_article=$id_article";
 103      }
 104      else $script .= '?';
 105  
 106      $res = spip_query("SELECT COUNT(*) AS cnt FROM spip_signatures WHERE $where AND date_time>DATE_SUB(NOW(),INTERVAL 180 DAY)");
 107  
 108      $total = ($row = spip_fetch_array($res)) ? $row['cnt'] : 0;
 109  
 110      if ($total > $limit) {
 111          for ($i = 0; $i < $total; $i += $limit){
 112              if ($i > 0) echo " | ";
 113              if ($i == $debut)
 114                  echo "<FONT SIZE=3><B>$i</B></FONT>";
 115              else
 116                echo "<A HREF='$script","debut=$i'>$i</A>";
 117          }
 118      }
 119      return $where;
 120  }
 121  
 122  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]