[ Index ]
 

Code source de SPIP 1.9.2c

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/ecrire/exec/ -> articles_ortho.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/presentation');
  16  include_spip('inc/distant');
  17  include_spip('inc/ortho');
  18  
  19  // http://doc.spip.org/@exec_articles_ortho_dist
  20  function exec_articles_ortho_dist()
  21  {
  22    global $champs_extra, $chapo, $descriptif, $dir_lang, $id_article, $les_notes, $ps, $soustitre, $spip_lang_left, $spip_lang_right, $surtitre, $texte, $titre;
  23  
  24  
  25  //charset_texte('utf-8');
  26  
  27  //
  28  // Lire l'article
  29  //
  30    $id_article = intval($id_article);
  31    if (!autoriser('voir', 'article', $id_article))
  32            {include_spip('minipres');
  33          echo minipres();
  34          exit;
  35            }
  36  
  37    $result = spip_query("SELECT * FROM spip_articles WHERE id_article='$id_article'");
  38  
  39  
  40  if ($row = spip_fetch_array($result)) {
  41      $id_article = $row["id_article"];
  42      $surtitre = $row["surtitre"];
  43      $titre = $row["titre"];
  44      $soustitre = $row["soustitre"];
  45      $id_rubrique = $row["id_rubrique"];
  46      $descriptif = $row["descriptif"];
  47      $nom_site = $row["nom_site"];
  48      $url_site = $row["url_site"];
  49      $chapo = $row["chapo"];
  50      $texte = $row["texte"];
  51      $ps = $row["ps"];
  52      $date = $row["date"];
  53      $statut_article = $row["statut"];
  54      $maj = $row["maj"];
  55      $date_redac = $row["date_redac"];
  56      $visites = $row["visites"];
  57      $referers = $row["referers"];
  58      $extra = $row["extra"];
  59      $id_trad = $row["id_trad"];
  60      $lang_article = $row["lang"];
  61  }
  62  if (!$lang_article) $lang_article = $GLOBALS['meta']['langue_site'];
  63  changer_typo($lang_article); # pour l'affichage du texte
  64  
  65  // pour l'affichage du virtuel
  66  
  67  if (substr($chapo, 0, 1) == '=') {
  68      $virtuel = substr($chapo, 1);
  69      $chapo = "";
  70  }
  71  
  72  
  73  $echap = array();
  74  $ortho = "";
  75  
  76  
  77  // Gros hack IE pour le "position: fixed"
  78  $code_ie = "<!--[if IE]>
  79  <style type=\"text/css\" media=\"screen\">
  80      body {
  81          height: 100%; margin: 0px; padding: 0px;
  82          overflow: hidden;
  83      }
  84      .ortho-content {
  85          position: absolute; $spip_lang_left: 0px;
  86          height: 100%; margin: 0px; padding: 0px;
  87          width: 72%;
  88          overflow-y: auto;
  89      }
  90      #ortho-fixed {
  91          position: absolute; $spip_lang_right: 0px; width: 25%;
  92          height: 100%; margin: 0px; padding: 0px;
  93          overflow: hidden;
  94      }
  95      .ortho-padding {
  96          padding: 12px;
  97      }
  98  </style>
  99  <![endif]-->";
 100  
 101  debut_html(_T('ortho_orthographe').' &laquo;'.$titre.'&raquo;', $code_ie);
 102  
 103  
 104  // Ajouts et suppressions de mots par l'utilisateur
 105  gerer_dico_ortho($lang_article);
 106  
 107  //
 108  // Panneau de droite
 109  //
 110  echo "<div id='ortho-fixed'>";
 111  echo "<div class='ortho-padding serif'>";
 112  
 113  debut_cadre_enfonce();
 114  
 115  $champs = array('surtitre', 'titre', 'soustitre', 'descriptif', 'chapo', 'texte', 'ps');
 116  foreach ($champs as $champ) {
 117      $ortho .= $$champ." ";
 118  }
 119  $ortho = preparer_ortho($ortho, $lang_article);
 120  $result_ortho = corriger_ortho($ortho, $lang_article);
 121  if (is_array($result_ortho)) {
 122      $mots = $result_ortho['mauvais'];
 123      if ($erreur = $result_ortho['erreur']) {
 124          echo "<b>"._T('ortho_trop_de_fautes').aide('corrortho')."</b><p>\n";
 125          echo "<b>"._T('ortho_trop_de_fautes2')."</b><p>";
 126      }
 127      else {
 128          echo "<b>"._T('ortho_mode_demploi').aide('corrortho')."</b><br />\n";
 129      }
 130  
 131      echo panneau_ortho($result_ortho);
 132  }
 133  else {
 134      $erreur = $result_ortho;
 135      echo "<b>"._T('ortho_dico_absent').aide('corrortho')." (";
 136      echo traduire_nom_langue($lang_article);
 137      echo "). ";
 138      echo _T('ortho_verif_impossible')."</b>";
 139  }
 140  
 141  fin_cadre_enfonce();
 142  
 143  echo "</div>";
 144  echo "</div>";
 145  
 146  //
 147  // Colonne de gauche : textes de l'article
 148  //
 149  echo "<div class='ortho-content' id='ortho-content'>";
 150  echo "<div class='ortho-padding serif'>";
 151  
 152  // Traitement des champs : soulignement des mots mal orthographies
 153  foreach ($champs as $champ) {
 154      switch ($champ) {
 155      case 'texte':
 156      case 'chapo':
 157      case 'descriptif':
 158      case 'ps':
 159          // Mettre de cote les <code>, <cadre>, etc.
 160          $$champ = echappe_html($$champ,'ORTHO');
 161          $$champ = propre($$champ);
 162          break;
 163      default:
 164          $$champ = typo($$champ);
 165          break;
 166      }
 167      // On passe en UTF-8 juste pour la correction
 168      $$champ = preparer_ortho($$champ, $lang_article);
 169      if (is_array($result_ortho))
 170          $$champ = souligner_ortho($$champ, $lang_article, $result_ortho);
 171      // Et on repasse dans le charset original pour remettre les echappements
 172      $$champ = afficher_ortho($$champ);
 173      $$champ = echappe_retour($$champ, 'ORTHO');
 174  }
 175  // Traitement identique pour les notes de bas de page
 176  if ($les_notes) {
 177      $les_notes = preparer_ortho($les_notes, $lang_article);
 178      if (is_array($result_ortho))
 179          $les_notes = souligner_ortho($les_notes, $lang_article, $result_ortho);
 180      $les_notes = afficher_ortho($les_notes);
 181  }
 182  
 183  debut_cadre_relief();
 184  
 185  if ($surtitre) {
 186      echo "<span $dir_lang><span class='arial1 spip_medium'><b>", $surtitre, "</b></span></span>\n";
 187  }
 188  gros_titre($titre);
 189  
 190  if ($soustitre) {
 191      echo "<span $dir_lang><span class='arial1 spip_medium'><b>", $soustitre, "</b></span></span>\n";
 192  }
 193  
 194  if ($descriptif OR $url_site OR $nom_site) {
 195      echo "<div align='$spip_lang_left' style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #e4e4e4;' $dir_lang>";
 196      $t = ($descriptif) ? "{{"._T('info_descriptif')."}} $descriptif\n\n" : '';
 197      $t .= ($nom_site.$url_site) ? "{{"._T('info_urlref')."}} [".$nom_site."->".$url_site."]" : '';
 198      echo "<span class='verdana1 spip_small'>", $t, "</span>";
 199      echo "</div>";
 200  }
 201  
 202  
 203  // Corps de l'article
 204  
 205  echo "\n\n<div style='text-align: justify'>";
 206  
 207  if ($virtuel) {
 208      debut_boite_info();
 209      echo _T('info_renvoi_article'),
 210          propre("<span style='text-align: center'> [->$virtuel]</span>");
 211      fin_boite_info();
 212  }
 213  else {
 214      echo "<div $dir_lang><b>";
 215      echo $chapo;
 216      echo "</b></div>\n\n";
 217  
 218      echo "<div $dir_lang>";
 219      echo $texte;
 220      echo "</div>";
 221  
 222      if ($ps) {
 223          echo debut_cadre_enfonce();
 224          echo "<div $dir_lang class='verdana1 spip_small'>", "<b>"._T('info_ps')."</b>", $ps, "</div>";
 225          echo fin_cadre_enfonce();
 226      }
 227  
 228      if ($les_notes) {
 229          echo debut_cadre_relief();
 230          echo "<div $dir_lang><span class='spip_small'>", "<b>"._T('info_notes')."&nbsp;:</b> ".$les_notes, "</span></div>";
 231          echo fin_cadre_relief();
 232      }
 233  
 234      if ($champs_extra AND $extra) {
 235          include_spip('inc/extra');
 236          echo extra_affichage($extra, "articles");
 237      }
 238  }
 239  
 240  
 241  echo "</div>";
 242  
 243  
 244  fin_cadre_relief();
 245  
 246  // html_background();
 247  echo "</div></div></body></html>\n";
 248  
 249  }
 250  
 251  //
 252  // Affichage HTML
 253  //
 254  
 255  // http://doc.spip.org/@debut_html
 256  function debut_html($titre = "", $rubrique="") {
 257      include_spip('inc/headers');
 258  
 259      $nom_site_spip = entites_html(textebrut(typo($GLOBALS['meta']["nom_site"])));
 260      if (!$nom_site_spip) $nom_site_spip=  _T('info_mon_site_spip');
 261      $titre = textebrut(typo($titre));
 262  
 263      http_no_cache();
 264      echo _DOCTYPE_ECRIRE .
 265        html_lang_attributes(),
 266        "<head>\n" .
 267        "<title>[$nom_site_spip] $titre</title>\n";
 268      echo f_jQuery("");
 269      echo  $rubrique, "\n";
 270      echo envoi_link($nom_site_spip),
 271    http_script("$(document).ready(function(){
 272      verifForm();
 273      if(jQuery.browser.msie) document.getElementById('ortho-content').focus();
 274    });");
 275  
 276      // Fin des entetes
 277      echo "\n</head>\n";
 278      echo "<body", ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : ""), ">";
 279  }
 280  
 281  ?>


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