4 |
david |
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 |
include ("inc.php3");
|
|
|
15 |
include_ecrire ("inc_date.php3");
|
|
|
16 |
include_ecrire ("inc_abstract_sql.php3");
|
|
|
17 |
|
|
|
18 |
// Droits
|
|
|
19 |
if ($new=='oui') {
|
|
|
20 |
switch ($type) {
|
|
|
21 |
case 'affich':
|
|
|
22 |
$ok = ($connect_statut == '0minirezo');
|
|
|
23 |
break;
|
|
|
24 |
case 'pb':
|
|
|
25 |
case 'rv':
|
|
|
26 |
case 'normal':
|
|
|
27 |
$ok = true;
|
|
|
28 |
break;
|
|
|
29 |
default:
|
|
|
30 |
$ok = false;
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
if (!$ok) {
|
|
|
34 |
debut_page(_T('info_acces_refuse'));
|
|
|
35 |
debut_gauche();
|
|
|
36 |
debut_droite();
|
|
|
37 |
echo "<b>"._T('avis_non_acces_message')."</b><p>";
|
|
|
38 |
fin_page();
|
|
|
39 |
exit;
|
|
|
40 |
}
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
function afficher_si_rdv($date_heure, $date_fin, $choix)
|
|
|
44 |
{
|
|
|
45 |
global $spip_lang_rtl;
|
|
|
46 |
|
|
|
47 |
$heures_debut = heures($date_heure);
|
|
|
48 |
$minutes_debut = minutes($date_heure);
|
|
|
49 |
$heures_fin = heures($date_fin);
|
|
|
50 |
$minutes_fin = minutes($date_fin);
|
|
|
51 |
|
|
|
52 |
if ($date_fin == "0000-00-00 00:00:00") {
|
|
|
53 |
$date_fin = $date_heure;
|
|
|
54 |
$heures_fin = $heures_debut + 1;
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
if ($heures_fin >=24){
|
|
|
58 |
$heures_fin = 23;
|
|
|
59 |
$minutes_fin = 59;
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
$res = "<div><input type='radio' name='rv' value='non' id='rv_off'" .
|
|
|
63 |
(!$choix ? "checked='checked' " : '') .
|
|
|
64 |
" onclick=\"changeVisible(this.checked, 'heure-rv', 'none', 'block');\"/>" .
|
|
|
65 |
"<label for='rv_off'>".
|
|
|
66 |
_T('item_non_afficher_calendrier').
|
|
|
67 |
"</label>";
|
|
|
68 |
echo ($choix ? $res : "<b>$res</b>") . "</div>";
|
|
|
69 |
|
|
|
70 |
$res = "<input type='radio' name='rv' value='oui' id='rv_on' " .
|
|
|
71 |
($choix ? "checked='checked' " : '') .
|
|
|
72 |
"onclick=\"changeVisible(this.checked, 'heure-rv', 'block', 'none');\"/>" .
|
|
|
73 |
"<label for='rv_on'>".
|
|
|
74 |
_T('item_afficher_calendrier').
|
|
|
75 |
"</label>";
|
|
|
76 |
echo '<div>' . (!$choix ? $res : "<b>$res</b>") . '</div>';
|
|
|
77 |
|
|
|
78 |
$display = ($choix ? "block" : "none");
|
|
|
79 |
|
|
|
80 |
echo "<div id='heure-rv' style='display: $display; padding-top: 4px; padding-left: 24px;'>",
|
|
|
81 |
afficher_jour_mois_annee_h_m($date_heure, $heures_debut, $minutes_debut),
|
|
|
82 |
" <br /><img src='puce$spip_lang_rtl.gif' alt=' '/> ",
|
|
|
83 |
afficher_jour_mois_annee_h_m($date_fin, $heures_fin, $minutes_fin, '_fin'),
|
|
|
84 |
"</div>";
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
if ($new == "oui") {
|
|
|
89 |
$mydate = date("YmdHis", time() - 2 * 24 * 3600);
|
|
|
90 |
$query = "DELETE FROM spip_messages WHERE (statut = 'redac') AND (date_heure < $mydate)";
|
|
|
91 |
$result = spip_query($query);
|
|
|
92 |
|
|
|
93 |
if ($type == 'pb') $statut = 'publie';
|
|
|
94 |
else $statut = 'redac';
|
|
|
95 |
|
|
|
96 |
$id_message = spip_abstract_insert("spip_messages",
|
|
|
97 |
"(titre, date_heure, statut, type, id_auteur)",
|
|
|
98 |
"('".addslashes(filtrer_entites(_T('texte_nouveau_message')))."', NOW(), '$statut', '$type', $connect_id_auteur)");
|
|
|
99 |
|
|
|
100 |
if ($rv) {
|
|
|
101 |
spip_query("UPDATE spip_messages SET rv='oui', date_heure='$rv 12:00:00', date_fin= '$rv 13:00:00' WHERE id_message = $id_message");
|
|
|
102 |
}
|
|
|
103 |
|
|
|
104 |
if ($type != "affich"){
|
|
|
105 |
spip_query("INSERT INTO spip_auteurs_messages (id_auteur,id_message,vu) VALUES ('$connect_id_auteur','$id_message','oui')");
|
|
|
106 |
if ($dest) {
|
|
|
107 |
spip_query("INSERT INTO spip_auteurs_messages (id_auteur,id_message,vu) VALUES ('$dest','$id_message','non')");
|
|
|
108 |
}
|
|
|
109 |
else if ($type == 'normal') $ajouter_auteur = true;
|
|
|
110 |
}
|
|
|
111 |
$onfocus = " onfocus=\"if(!antifocus){this.value='';antifocus=true;}\"";
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
$row = spip_fetch_array(spip_query("SELECT * FROM spip_messages WHERE id_message=$id_message"));
|
|
|
115 |
|
|
|
116 |
$id_message = $row['id_message'];
|
|
|
117 |
$date_heure = $row["date_heure"];
|
|
|
118 |
$date_fin = $row["date_fin"];
|
|
|
119 |
$titre = entites_html($row["titre"]);
|
|
|
120 |
$texte = entites_html($row["texte"]);
|
|
|
121 |
$type = $row["type"];
|
|
|
122 |
$statut = $row["statut"];
|
|
|
123 |
$page = $row["page"];
|
|
|
124 |
$rv = $row["rv"];
|
|
|
125 |
$expediteur = $row["id_auteur"];
|
|
|
126 |
|
|
|
127 |
debut_page(_T('titre_page_message_edit'), "redacteurs", "messagerie");
|
|
|
128 |
|
|
|
129 |
if (!($expediteur = $connect_id_auteur OR ($type == 'affich' AND $connect_statut == '0minirezo'))) die();
|
|
|
130 |
|
|
|
131 |
if ($type == 'normal') {
|
|
|
132 |
$le_type = _T('bouton_envoi_message_02');
|
|
|
133 |
$logo = "message";
|
|
|
134 |
}
|
|
|
135 |
if ($type == 'pb') {
|
|
|
136 |
$le_type = _T('bouton_pense_bete');
|
|
|
137 |
$logo = "pense-bete";
|
|
|
138 |
}
|
|
|
139 |
if ($type == 'affich') {
|
|
|
140 |
$le_type = _T('bouton_annonce');
|
|
|
141 |
$logo = "annonce";
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
echo "<form action='message.php3?id_message=$id_message' method='post'>";
|
|
|
145 |
|
|
|
146 |
debut_gauche();
|
|
|
147 |
|
|
|
148 |
debut_droite();
|
|
|
149 |
|
|
|
150 |
echo "<div class='arial2'>";
|
|
|
151 |
echo "<font face='Verdana,Arial,Sans,sans-serif' size='2' color='green'><b>$le_type</b></font><p>";
|
|
|
152 |
|
|
|
153 |
if ($type == "affich")
|
|
|
154 |
echo "<font face='Verdana,Arial,Sans,sans-serif' size='1' color='red'>"._T('texte_message_edit')."</font></p><p>";
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
echo "<input type='hidden' name='modifier_message' value='oui'/>";
|
|
|
158 |
echo "<input type='hidden' name='id_message' value='$id_message'/>";
|
|
|
159 |
echo "<input type='hidden' name='changer_rv' value='$id_message'/>";
|
|
|
160 |
echo _T('texte_titre_obligatoire')."<br />";
|
|
|
161 |
echo "<input type='text' class='formo' name='titre' value=\"$titre\" size='40' $onfocus />";
|
|
|
162 |
|
|
|
163 |
if ($ajouter_auteur) {
|
|
|
164 |
echo "</p><p><b>"._T('info_nom_destinataire')."</b><br />";
|
|
|
165 |
echo "<input type='text' class='formo' name='cherche_auteur' value='' size='40'/>";
|
|
|
166 |
}
|
|
|
167 |
|
|
|
168 |
echo "<p />";
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
//////////////////////////////////////////////////////
|
|
|
172 |
// Fixer rendez-vous?
|
|
|
173 |
//
|
|
|
174 |
if ($rv == "oui") $fonction = "rv.gif"; else $fonction = "";
|
|
|
175 |
debut_cadre_trait_couleur("$logo.gif", false, $fonction, _T('titre_rendez_vous'));
|
|
|
176 |
afficher_si_rdv($date_heure, $date_fin, ($rv == "oui"));
|
|
|
177 |
fin_cadre_trait_couleur();
|
|
|
178 |
|
|
|
179 |
echo "<p><b>"._T('info_texte_message_02')."</b><br />";
|
|
|
180 |
echo "<textarea name='texte' rows='20' class='formo' cols='40'>";
|
|
|
181 |
echo $texte;
|
|
|
182 |
echo "</textarea></p><br />\n";
|
|
|
183 |
|
|
|
184 |
echo "<p align='right'><input type='submit' name='valider' value='"._T('bouton_enregistrer')."' class='fondo'/></p>";
|
|
|
185 |
echo "</div>";
|
|
|
186 |
echo "</form>";
|
|
|
187 |
|
|
|
188 |
fin_page();
|
|
|
189 |
|
|
|
190 |
?>
|