[ Index ]
 

Code source de SPIP 1.9.2c

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/ecrire/exec/ -> message_edit.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/date');
  17  
  18  
  19  // http://doc.spip.org/@exec_message_edit_dist
  20  function exec_message_edit_dist()
  21  {
  22      global  $connect_id_auteur, $connect_statut,   $spip_lang_rtl;
  23  
  24      $id_message =  intval(_request('id_message'));
  25      $dest = intval(_request('dest'));
  26  
  27      if (_request('new')=='oui') {
  28          $onfocus = "\nonfocus=\"if(!antifocus){this.value='';antifocus=true;}\"";
  29      } else $onfocus = '';
  30  
  31      $row = spip_fetch_array(spip_query("SELECT * FROM spip_messages WHERE id_message=$id_message"));
  32  
  33      $id_message = $row['id_message'];
  34      $date_heure = $row["date_heure"];
  35      $date_fin = $row["date_fin"];
  36      $titre = entites_html($row["titre"]);
  37      $texte = entites_html($row["texte"]);
  38      $type = $row["type"];
  39      $statut = $row["statut"];
  40      $rv = $row["rv"];
  41      $expediteur = $row["id_auteur"];
  42  
  43      if (!($expediteur == $connect_id_auteur OR ($type == 'affich' AND $connect_statut == '0minirezo'))) {
  44          echo minipres(_T('avis_non_acces_message'));
  45          exit;
  46      }
  47  
  48      $commencer_page = charger_fonction('commencer_page', 'inc');
  49      echo $commencer_page(_T('titre_page_message_edit'), "accueil", "messagerie");
  50  
  51      if ($type == 'normal') {
  52        $le_type = _T('bouton_envoi_message_02');
  53        $logo = "message";
  54      }
  55      if ($type == 'pb') {
  56        $le_type = _T('bouton_pense_bete');
  57        $logo = "pense-bete";
  58      }
  59      if ($type == 'affich') {
  60        $le_type = _T('bouton_annonce');
  61        $logo = "annonce";
  62      }
  63  
  64  
  65      debut_gauche();
  66      
  67      if($type == 'normal' AND $dest) {
  68          $nom = spip_fetch_array(spip_query("SELECT nom, email FROM spip_auteurs WHERE id_auteur=$dest"));
  69          if (strlen($nom['email']) > 3) {
  70              echo "<div align='center'>";
  71              icone(_T('info_envoyer_message_prive'), "mailto:".$nom['email'], "envoi-message-24.gif");
  72              echo "</div>";
  73          }
  74      }
  75  
  76      debut_droite();
  77  
  78      $res =  "<div class='arial2'>"
  79      . "<span style='color:green' class='verdana1 spip_small'><b>$le_type</b></span>";
  80      if ($type == "affich")
  81          $res .="<p style='color:red;' class='verdana1 spip_x-small'>" . _T('texte_message_edit')."</p>";
  82      
  83      $res .= '<br /><br />' . _T('texte_titre_obligatoire')."<br />\n";
  84      $res .="<input type='text' class='formo' name='titre' value=\"$titre\" size='40' $onfocus />";
  85  
  86      if (!$dest) {
  87          if ($type == 'normal') {
  88            $res .="<br /><b>"._T('info_nom_destinataire')."</b><br />\n";
  89            $res .="<input type='text' class='formo' name='cherche_auteur' value='' size='40'/>";
  90          }
  91      } else {
  92          $nom = spip_fetch_array(spip_query("SELECT nom FROM spip_auteurs WHERE id_auteur=$dest"));
  93          $res .="<br /><b>" .
  94            _T('info_nom_destinataire') .
  95            "</b>&nbsp;:&nbsp;&nbsp; " .
  96            $nom['nom'] .
  97            "<br /><br />\n";
  98      }
  99      $res .= '<br />';
 100  
 101      //////////////////////////////////////////////////////
 102      // Fixer rendez-vous?
 103      //
 104      if ($rv == "oui") $fonction = "rv.gif";    else $fonction = "";
 105      $res .= debut_cadre_trait_couleur($logo.".gif", true, $fonction, _T('titre_rendez_vous'));
 106      $res .= afficher_si_rdv($date_heure, $date_fin, ($rv == "oui")); 
 107      $res .= fin_cadre_trait_couleur(true);
 108  
 109      $res .= "\n<p><b>"._T('info_texte_message_02')."</b><br />";
 110      $res .= "<textarea name='texte' rows='20' class='formo' cols='40'>";
 111      $res .= $texte;
 112      $res .= "</textarea></p><br />\n";
 113  
 114      $res .= "\n<div align='right'><input type='submit' value='"._T('bouton_valider')."' class='fondo'/></div>"    
 115      . "\n</div>";
 116  
 117      echo redirige_action_auteur('editer_message', $id_message, 'message',"id_message=$id_message", $res, " method='post'");
 118  
 119      echo fin_gauche(), fin_page();
 120  }
 121  
 122  // http://doc.spip.org/@afficher_si_rdv
 123  function afficher_si_rdv($date_heure, $date_fin, $choix)
 124  {
 125      global $spip_lang_rtl;
 126  
 127      $heures_debut = heures($date_heure);
 128      $minutes_debut = minutes($date_heure);
 129      $heures_fin = heures($date_fin);
 130      $minutes_fin = minutes($date_fin);
 131    
 132      if ($date_fin == "0000-00-00 00:00:00") {
 133          $date_fin = $date_heure;
 134          $heures_fin = $heures_debut + 1;
 135      }
 136    
 137      if ($heures_fin >=24){
 138          $heures_fin = 23;
 139          $minutes_fin = 59;
 140      }
 141              
 142      $lib = _T('item_non_afficher_calendrier');
 143      if (!$choix)  $lib = "<b>$lib</b>";
 144  
 145      $res = "\n<div><input type='radio' name='rv' value='non' id='rv_off'" .
 146          (!$choix ? " checked='checked' " : '')
 147          . "\nonclick=\"changeVisible(this.checked, 'heure-rv', 'none', 'block');\"/>"
 148          . "<label for='rv_off'>"
 149          . $lib
 150          . "</label>"
 151          . "</div>";
 152  
 153      $lib = _T('item_afficher_calendrier');
 154      if ($choix)  $lib = "<b>$lib</b>";
 155  
 156      $res .= "\n<div><input type='radio' name='rv' value='oui' id='rv_on' " .
 157          ($choix ? " checked='checked' " : '') .
 158          "\nonclick=\"changeVisible(this.checked, 'heure-rv', 'block', 'none');\"/>" . 
 159          "<label for='rv_on'>"
 160          . $lib
 161          . "</label>"
 162        . '</div>';
 163      
 164      $display = ($choix ? "block" : "none");
 165      
 166      return $res .
 167       "\n<div id='heure-rv' style='display: $display; padding-top: 4px; padding-left: 24px;'>" .
 168        afficher_jour_mois_annee_h_m($date_heure, $heures_debut, $minutes_debut) .
 169        "\n<br /><img src='puce$spip_lang_rtl.gif' alt=' '/> &nbsp; " .
 170        afficher_jour_mois_annee_h_m($date_fin, $heures_fin, $minutes_fin, '_fin') .
 171        "</div>";
 172  }
 173  
 174  ?>


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