[ Index ]
 

Code source de SPIP 1.9.2c

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/ecrire/inc/ -> sites_voir.php (source)

   1  <?php
   2  
   3  /***************************************************************************\
   4   *  SPIP, Systeme de publication pour l'internet                           *
   5   *                                                                         *
   6   *  Copyright (c) 2001-2007                                                *
   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  if (!defined("_ECRIRE_INC_VERSION")) return;
  14  
  15  include_spip('inc/actions');
  16  
  17  // http://doc.spip.org/@afficher_sites
  18  function afficher_sites($titre_table, $requete)
  19  {
  20      global $couleur_claire;
  21  
  22      $tmp_var = 't_' . substr(md5(join(' ',$requete)), 0, 4);
  23  
  24      return affiche_tranche_bandeau($requete, "site-24.gif", $couleur_claire, "black", $tmp_var, $titre_table, false,  array('','',''), array('arial11', 'arial1', 'arial1'), 'afficher_sites_boucle');
  25  }
  26  
  27  // http://doc.spip.org/@afficher_sites_boucle
  28  function afficher_sites_boucle($row, &$tous_id, $voir_logo, $bof)
  29  {
  30      global $spip_lang_right;
  31      $vals = '';
  32      $id_syndic=$row["id_syndic"];
  33      if (autoriser('voir','site',$id_syndic)){
  34          $id_rubrique=$row["id_rubrique"];
  35          $nom_site=sinon(typo($row["nom_site"]), _T('info_sans_titre'));
  36          $url_site=$row["url_site"];
  37          $url_syndic=$row["url_syndic"];
  38          $syndication=$row["syndication"];
  39          $statut=$row["statut"];
  40                  
  41          $tous_id[] = $id_syndic;
  42      
  43          switch ($statut) {
  44              case 'publie':
  45                      if (acces_restreint_rubrique($id_rubrique))
  46                          $puce = 'puce-verte-anim.gif';
  47                      else
  48                          $puce='puce-verte-breve.gif';
  49                      $title = _T('info_site_reference');
  50                      break;
  51                  case 'prop':
  52                      if (acces_restreint_rubrique($id_rubrique))
  53                          $puce = 'puce-orange-anim.gif';
  54                      else
  55                          $puce='puce-orange-breve.gif';
  56                      $title = _T('info_site_attente');
  57                      break;
  58                  case 'refuse':
  59                      if (acces_restreint_rubrique($id_rubrique))
  60                          $puce = 'puce-poubelle-anim.gif';
  61                      else
  62                          $puce='puce-poubelle-breve.gif';
  63                      $title = _T('info_site_refuse');
  64                      break;
  65          }
  66          if ($syndication == 'off' OR $syndication == 'sus') {
  67                      $puce = 'puce-orange-anim.gif';
  68                      $title = _T('info_panne_site_syndique');
  69                  }
  70      
  71          $s = "<a href=\"".generer_url_ecrire("sites","id_syndic=$id_syndic")."\" title=\"$title\">";
  72      
  73          if ($voir_logo) {
  74              $chercher_logo = charger_fonction('chercher_logo', 'inc');
  75              if ($logo = $chercher_logo($id_syndic, 'id_syndic', 'on'))  {
  76                  list($fid, $dir, $nom, $format) = $logo;
  77                  include_spip('inc/filtres_images');
  78                  $logo = image_reduire("<img src='$fid' alt='' />", 26, 20);
  79                  if ($logo)
  80                      $s .= "<span style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>$logo</span>";
  81              }
  82          }
  83      
  84          $s .= http_img_pack($puce, $statut, "class='puce'") ."&nbsp;&nbsp;";
  85                  
  86          $s .= typo($nom_site);
  87          
  88          $s .= "</a> &nbsp;&nbsp; <span class='spip_xx-small'>[<a href='$url_site'>"._T('lien_visite_site')."</a>]</span>";
  89          $vals[] = $s;
  90                  
  91          $s = "";
  92      
  93          if ($syndication == 'off' OR $syndication == 'sus') {
  94              $s .= "<span style='color: red;'>"._T('info_probleme_grave')." </span>";
  95          }
  96          if ($syndication == "oui" or $syndication == "off" OR $syndication == 'sus'){
  97              $s .= "<span style='color: red;'>"._T('info_syndication')."</span>";
  98          }
  99          $vals[] = $s;
 100      
 101          if ($syndication == "oui" OR $syndication == "off" OR $syndication == "sus") {
 102              $total_art = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_syndic_articles WHERE id_syndic='$id_syndic'"));
 103              $s = " " . $total_art['n'] . " " . _T('info_syndication_articles');
 104          } else {
 105                  $s = "&nbsp;";
 106          }
 107          $vals[] = $s;
 108      }
 109  
 110      return $vals;
 111  }
 112  
 113  // http://doc.spip.org/@afficher_syndic_articles
 114  function afficher_syndic_articles($titre_table, $requete, $id = 0) {
 115      global $connect_statut, $spip_lang_right;
 116  
 117      $col = (($connect_statut == '0minirezo') ? 3 :  2) + ($id==0);
 118      $tmp_var = 't_' . substr(md5(join(' ',$requete)), 0, 4);
 119  
 120      if (!$requete['FROM']) $requete['FROM']= 'spip_syndic_articles';
 121  
 122      if (!$id) {
 123              $largeurs = array(7, '', '100');
 124              $styles = array('','arial11', 'arial1');
 125      } else {
 126              $largeurs = array(7, '');
 127              $styles = array('','arial11');
 128      }
 129      if ($connect_statut == '0minirezo') {
 130              $largeurs[] = '80';
 131              $styles[] = 'arial1';
 132      }
 133  
 134      return affiche_tranche_bandeau($requete, "site-24.gif", "#999999", "white", $tmp_var, $titre_table, $obligatoire, $largeurs, $styles, 'afficher_syndic_articles_boucle', array($tmp_var, $id));
 135  }
 136  
 137  // http://doc.spip.org/@afficher_syndic_articles_boucle
 138  function afficher_syndic_articles_boucle($row, &$my_sites, $bof, $redirect)
 139  {
 140      global  $connect_statut, $spip_lang_right;
 141  
 142      $vals = '';
 143  
 144      $id_syndic_article=$row["id_syndic_article"];
 145      $id_syndic=$row["id_syndic"];
 146      if (autoriser('voir','site',$id_syndic)){
 147          $titre=safehtml($row["titre"]);
 148          $url=$row["url"];
 149          $date=$row["date"];
 150          $lesauteurs=typo($row["lesauteurs"]);
 151          $statut=$row["statut"];
 152          $descriptif=safehtml($row["descriptif"]);
 153      
 154          if ($statut=='publie') {
 155                  $puce='puce-verte.gif';
 156          }
 157          else if ($statut == "refuse") {
 158                  $puce = 'puce-poubelle.gif';
 159          }
 160      
 161          else if ($statut == "dispo") { // moderation : a valider
 162                  $puce = 'puce-rouge.gif';
 163          }
 164      
 165          else if ($statut == "off") { // feed d'un site en mode "miroir"
 166                  $puce = 'puce-rouge-anim.gif';
 167          }
 168      
 169          $vals[] = http_img_pack($puce, $statut, "class='puce'");
 170      
 171          $s = "<a href='$url'>$titre</a>";
 172      
 173          $date = affdate_court($date);
 174          if (strlen($lesauteurs) > 0) $date = $lesauteurs.', '.$date;
 175          $s.= " ($date)";
 176      
 177          // Tags : d'un cote les enclosures, de l'autre les liens
 178          if($e = afficher_enclosures($row['tags']))
 179              $s .= ' '.$e;
 180      
 181          // descriptif
 182          if (strlen($descriptif) > 0) {
 183              // couper un texte vraiment tres long
 184              if (strlen($descriptif) > 10000)
 185                  $descriptif = safehtml(spip_substr($descriptif, 0, 6000)).' (...)';
 186              else
 187                  $descriptif = safehtml($descriptif);
 188              $s .= '<div class="arial1">'
 189                  # 385px = largeur de la colonne ou s'affiche le texte
 190                  . filtrer('image_reduire',$descriptif, 385, 550)
 191                  . '</div>';
 192          }
 193      
 194          // tags
 195          if ($tags = afficher_tags($row['tags']))
 196              $s .= "<div style='float:$spip_lang_right;'>&nbsp;<em>"
 197                  . $tags . '</em></div>';
 198      
 199          // source
 200          if (strlen($row['url_source']))
 201              $s .= "<div style='float:$spip_lang_right;'>"
 202              . propre("[".$row['source']."->".$row['url_source']."]")
 203              . "</div>";
 204          else if (strlen($row['source']))
 205              $s .= "<div style='float:$spip_lang_right;'>"
 206              . typo($row['source'])
 207              . "</div>";
 208      
 209          $vals[] = $s;
 210      
 211          // on n'affiche pas la colonne 'site' lorsqu'on regarde un site precis
 212          if ($GLOBALS['exec'] != 'sites') {
 213              // $my_sites cache les resultats des requetes sur les sites
 214              if (!$my_sites[$id_syndic])
 215                  $my_sites[$id_syndic] = spip_fetch_array(spip_query("SELECT nom_site, moderation, miroir FROM spip_syndic WHERE id_syndic=$id_syndic"));
 216      
 217              $aff = $my_sites[$id_syndic]['nom_site'];
 218              if ($my_sites[$id_syndic]['moderation'] == 'oui')
 219                  $aff = "<i>$aff</i>";
 220                  
 221              $s = "<a href='" . generer_url_ecrire("sites","id_syndic=$id_syndic") . "'>$aff</a>";
 222      
 223              $vals[] = $s;
 224          }
 225                      
 226          if ($connect_statut == '0minirezo'){
 227              list($tmp_var, $id) = $redirect;
 228              $redirect = ($tmp_var . '=' . intval(_request($tmp_var)))
 229              . (!$id ? '' : "&id_syndic=$id");
 230      
 231              if ($statut == "publie"){
 232                $s =  "[<a href='". redirige_action_auteur('instituer_syndic',"$id_syndic_article-refuse", $GLOBALS['exec'], $redirect) . "'><span style='color: black'>"._T('info_bloquer_lien')."</span></a>]";
 233              
 234              }
 235              else if ($statut == "refuse"){
 236                $s =  "[<a href='". redirige_action_auteur('instituer_syndic',"$id_syndic_article-publie", $GLOBALS['exec'], $redirect) . "'>"._T('info_retablir_lien')."</a>]";
 237              }
 238              else if ($statut == "off"
 239              AND $my_sites[$id_syndic]['miroir'] == 'oui') {
 240                  $s = '('._T('syndic_lien_obsolete').')';
 241              }
 242              else /* 'dispo' ou 'off' (dans le cas ancien site 'miroir') */
 243              {
 244                $s = "[<a href='". redirige_action_auteur('instituer_syndic',"$id_syndic_article-publie", $GLOBALS['exec'], $redirect) . "'>"._T('info_valider_lien')."</a>]";
 245              }
 246              $vals[] = $s;
 247          }
 248      }
 249  
 250      return $vals;
 251  }
 252  ?>


Généré le : Wed Nov 21 10:20:27 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics