summaryrefslogtreecommitdiff
path: root/appli_3_alpha_old/app/sendmail.php
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2018-06-30 11:10:17 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2018-06-30 11:10:17 +0200
commit1269889704386de951d7f91eb169eb1e1bb36cc0 (patch)
treeff0b0fbcf5d6cc6cb769ef25924721e348f339a5 /appli_3_alpha_old/app/sendmail.php
parentc93c261a461c9a2359bdcd75f7136fcb05237106 (diff)
download2007-AWOR-1269889704386de951d7f91eb169eb1e1bb36cc0.tar.gz
2007-AWOR-1269889704386de951d7f91eb169eb1e1bb36cc0.tar.bz2
2007-AWOR-1269889704386de951d7f91eb169eb1e1bb36cc0.zip
Sous-dossier app entre old4 et old5
Diffstat (limited to 'appli_3_alpha_old/app/sendmail.php')
-rw-r--r--appli_3_alpha_old/app/sendmail.php194
1 files changed, 194 insertions, 0 deletions
diff --git a/appli_3_alpha_old/app/sendmail.php b/appli_3_alpha_old/app/sendmail.php
new file mode 100644
index 0000000..b371aa1
--- /dev/null
+++ b/appli_3_alpha_old/app/sendmail.php
@@ -0,0 +1,194 @@
+<?php
+require('include/ludo/session_verify.inc.php');
+require_once('include/ludo/html_elements.inc.php');
+require_once('include/connect.inc.php');
+
+
+
+generate_html_doctype_and_head("Envoi de courriel");
+echo "<body>\n";
+generate_html_divs_menu();
+?>
+ <div id="sous_menu">
+ <p class="arbre">
+ &gt; <a href="index.php">Accueil</a>
+ &gt; <a href="index.php">R&eacute;unions</a>
+ &gt; Envoi de courriel
+ </p>
+ </div>
+<?php generate_html_div_help();
+if( isset($_POST['idR']) )
+{
+ $idR=addslashes($_POST['idR']);
+}
+else
+{
+?>
+ <div id="errmsg">
+ Erreur lors de l'émission de l'email : Paramètre manquant ou érroné
+ </div></body></html>
+<?php
+ exit();
+}
+
+if( isset($_POST['envoi']) )
+{
+ include 'include/ludo/config.inc.php';
+
+ if ( !isset($_POST['msgObject']) || !isset($_POST['msgText']) || !is_array($_POST['dataParticipants']) )
+ {
+ $errmsg = "Erreur lors de l'émission de l'email : Paramètre manquant ou érroné";
+ }
+ else
+ {
+ if ( !isset($CONFIG['automatedMail']) )
+ {
+ $errmsg = "Erreur lors de l'émission de l'email : Erreur de configuration par l'administrateur";
+ }
+ else
+ {
+ // Potentiellement dangereux...
+ $query='SELECT nomP, prenomP, courrielP FROM Personne WHERE idP=\'' . implode("' OR idP='", $_POST['dataParticipants']) . "'";
+ //~ echo " DEBUG : QUERY : $query\n";
+ $result = mysql_query($query);
+ if ( ! $result )
+ {
+ $errmsg = "Erreur lors de l'émission de l'email : Erreur de base de données";
+ }
+ else
+ {
+ $to=array();
+ while ( list($nomP, $prenomP, $courrielP) = mysql_fetch_row($result) )
+ {
+ $to[]="$nomP $prenomP <$courrielP>";
+ }
+ $to=implode(', ',$to);
+
+
+ if ( ! mail ( $to, $_POST['msgObject'], $_POST['msgText'], 'From: ' . $CONFIG['automatedMail'] . "\r\n" ) )
+ {
+ $errmsg = "Erreur lors de l'émission de l'email : Erreur inconnue";
+ }
+ }
+ }
+ }
+
+ if ( isset($errmsg) )
+ {
+ echo '<div id="errmsg">' . $errmsg .'</div></body></html>';
+ }
+ else
+ {
+ echo '<div id="contenu">Le courriel à bien été envoyé<br />';
+ echo '<a href="details_reunion.php?idR=' . $idR . '">Retour au détail de la réunion</a></div></body></html>';
+ }
+ exit();
+}
+
+
+$result = mysql_query("SELECT idL FROM Reunion WHERE idR='$idR'");
+if (mysql_num_rows($result)===1)
+{
+ list($idL) = mysql_fetch_array($result);
+}
+else
+{
+ $errmsg="";
+}
+
+
+ if ( isset($errmsg) )
+ {
+ echo '<div id="errmsg">' . $errmsg .'</div></body></html>';
+ exit();
+ }
+
+?>
+
+ <div id="contenu">
+ <form id="formmail" action="sendmail.php" method="post" onsubmit="return dataListe('participants','dataParticipants');">
+ <table>
+ <tbody>
+ <tr>
+ <td>Contacts disponibles</td>
+ <td>&nbsp;</td>
+ <td>Destinataires</td>
+ </tr>
+ <tr>
+ <td>
+ <select name="contactDispo" size="10" id="contactDispo">
+<?php
+ $personnes = array();
+ $req = 'SELECT P.idP , P.courrielP , P.nomP , P.prenomP FROM Personne P, Appartenir A WHERE P.idP=A.idP AND A.idL=' . $idL;
+ $result = mysql_query($req) ;
+
+ if (mysql_num_rows($result)>0)
+ {
+ for($i=0;$i<mysql_num_rows($result);$i++)
+ {
+ list($idP, $courrielP, $nomP, $prenomP) = mysql_fetch_array($result);
+ $personnes[$idP]=array($courrielP, $nomP, $prenomP);
+ echo '<option value="'.$idP.'" ondblclick="addPers(this.form);">';
+ echo $nomP . " " . $prenomP;
+ echo "</option>\n";
+ }
+ }
+
+?>
+ </select>
+ </td>
+ <td>
+ <input name="AjouterParticipant" id="AjouterParticipant" value="Ajouter" onclick="addPers(this.form);" type="button" />
+ <br />
+ <br />
+ <input name="supprimerParticipant" id="supprimerParticipant" value="Retirer" onclick="removePers(this.form);" type="button" />
+ </td>
+ <td>
+ <select name="participants" size="10" id="participants">
+<?php
+ foreach( $personnes as $idP=>$p)
+ {
+ if ( isset($_POST['mail_idP' . $idP] ) )
+ {
+ echo '<option value="'.$idP.'">';
+ echo $p[1] . " " . $p[2];
+ echo "</option>\n";
+ }
+ }
+?>
+ </select>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <div>
+ Modèle :&nbsp;
+<?php
+ echo '<select name="modelsList" id="modelsList" onchange="loadlist(\'include/ludo/mail_textarea.php?idR=';
+ echo $idR . "&amp;model=','modelsList','divMsg');\">\n";
+?>
+ <option value="empty">Vierge</option>
+ <option value="cree">Nouvelle Réunion</option>
+ <option value="modif">Réunion modifiée</option>
+ <option value="annul">Réunion annulée</option>
+ <option value="fixee">Réunion fixée</option>
+ </select>
+ </div>
+ <div>
+ Objet :&nbsp;<input name="msgObject" type="text" size="40" value="AWOR : Courriel de notification" />
+ </div>
+ <div id='divMsg'>
+<?php include 'include/ludo/mail_textarea.php'; ?>
+ </div>
+ <div>
+ <?php
+ echo '<input name="idR" type="hidden" value="' . $idR . '" />' . "\n";
+ ?>
+ <input name="envoi" type="hidden" value="1" />
+ <input type="submit" value="Envoyer" />
+ </div>
+ </form>
+ </div>
+</body>
+</html>
+