Révision abd6eaaa htdocs/epack/register.php
htdocs/epack/register.php | ||
---|---|---|
5 | 5 |
$message = ""; |
6 | 6 |
$send_mail = 0; //flag pour savoir s'il faut envoyer un mail (en bref a toute insertion ou update de base) |
7 | 7 |
|
8 |
function make_pdf($pass,$code,$datapost) { |
|
9 |
global $message; |
|
10 |
require_once('lib/odf.php'); |
|
11 |
$odf = new odf("abuledu-base_genere_automatiquement_enregistrement_epack.odp"); |
|
12 |
|
|
13 |
//1ere page |
|
14 |
setlocale(LC_TIME, "fr_FR.UTF-8"); |
|
15 |
// $odf->setVars('date', strftime("%A %e %B %Y")); |
|
16 |
$odf->setVars('date_installation', $datapost['IDATE']); |
|
17 |
$odf->setVars('date', date("d/m/Y")); |
|
18 |
|
|
19 |
//Le epack |
|
20 |
$odf->setVars('epack_pass', $pass); |
|
21 |
$odf->setVars('epack_code', $code); |
|
22 |
|
|
23 |
//Les mots de passes |
|
24 |
$odf->setVars('pass_root', $datapost['IROOT']); |
|
25 |
$odf->setVars('pass_abuladmin', $datapost['IABE']); |
|
26 |
|
|
27 |
//L'école |
|
28 |
$odf->setVars('ecole_nom', $datapost['INAME'], true, 'UTF-8'); |
|
29 |
$odf->setVars('ecole_adresse', $datapost['IADDRESS0'], true, 'UTF-8'); |
|
30 |
$odf->setVars('ecole_cp', $datapost['IPOSTALCODE'], true, 'UTF-8'); |
|
31 |
$odf->setVars('ecole_ville', $datapost['ICITY'], true, 'UTF-8'); |
|
32 |
$odf->setVars('ecole_pays', $datapost['ICOUNTRY'], true, 'UTF-8'); |
|
33 |
$odf->setVars('ecole_tel', $datapost['ITEL'], true, 'UTF-8'); |
|
34 |
$odf->setVars('ecole_email', $datapost['IEMAIL'], true, 'UTF-8'); |
|
35 |
|
|
36 |
//Le serveur |
|
37 |
$odf->setVars('srv_srv', $datapost['ISRV'], true, 'UTF-8'); |
|
38 |
$odf->setVars('srv_serial', $datapost['ISERIAL'], true, 'UTF-8'); |
|
39 |
$odf->setVars('srv_cpu', $datapost['CPU'], true, 'UTF-8'); |
|
40 |
$odf->setVars('srv_ram', $datapost['RAM'], true, 'UTF-8'); |
|
41 |
$odf->setVars('srv_hdd0', $datapost['HDD0'], true, 'UTF-8'); |
|
42 |
$odf->setVars('srv_hdd1', $datapost['HDD1'], true, 'UTF-8'); |
|
43 |
$odf->setVars('srv_eth0', $datapost['MAC0'], true, 'UTF-8'); |
|
44 |
$odf->setVars('srv_eth1', $datapost['MAC1'], true, 'UTF-8'); |
|
45 |
|
|
46 |
//L'admin local |
|
47 |
$odf->setVars('adm_prenom', $datapost['ADM_FIRSTNAME'], true, 'UTF-8'); |
|
48 |
$odf->setVars('adm_nom', $datapost['ADM_LASTNAME'], true, 'UTF-8'); |
|
49 |
$odf->setVars('adm_email', $datapost['ADM_EMAIL'], true, 'UTF-8'); |
|
50 |
|
|
51 |
//La personne ressource |
|
52 |
$odf->setVars('pr_prenom', $datapost['PR_FIRSTNAME'], true, 'UTF-8'); |
|
53 |
$odf->setVars('pr_nom', $datapost['PR_LASTNAME'], true, 'UTF-8'); |
|
54 |
$odf->setVars('pr_email', $datapost['PR_EMAIL'], true, 'UTF-8'); |
|
55 |
|
|
56 |
//L'anim TICE |
|
57 |
$odf->setVars('atice_prenom', $datapost['ATICE_FIRSTNAME'], true, 'UTF-8'); |
|
58 |
$odf->setVars('atice_nom', $datapost['ATICE_LASTNAME'], true, 'UTF-8'); |
|
59 |
$odf->setVars('atice_email', $datapost['ATICE_EMAIL'], true, 'UTF-8'); |
|
60 |
|
|
61 |
//Le revendeur |
|
62 |
$odf->setVars('rvd_code', $datapost['RCODE'], true, 'UTF-8'); |
|
63 |
$odf->setVars('rvd_nom', $datapost['RNAME'], true, 'UTF-8'); |
|
64 |
$odf->setVars('rvd_tel', $datapost['RTEL'], true, 'UTF-8'); |
|
65 |
$odf->setVars('rvd_email', $datapost['REMAIL'], true, 'UTF-8'); |
|
66 |
$odf->setVars('rvd_adresse', $datapost['RADDRESS'], true, 'UTF-8'); |
|
67 |
$odf->setVars('rvd_cp', $datapost['RCP'], true, 'UTF-8'); |
|
68 |
$odf->setVars('rvd_ville', $datapost['RVILLE'], true, 'UTF-8'); |
|
69 |
|
|
70 |
//On créé un fichier local pour archive ... |
|
71 |
$fichier="archives/" . date("Y-m-d") . "-epack-register-" . $code . ".odp"; |
|
72 |
$fichier_pdf="archives/" . date("Y-m-d") . "-epack-register-" . $code . ".pdf"; |
|
73 |
|
|
74 |
$odf->saveToDisk($fichier); |
|
75 |
$t = exec("unoconv --server localhost --port 2002 -f pdf " . $fichier); |
|
76 |
|
|
77 |
//Ensuite il faut l'envoyer par email ... |
|
78 |
$txtmail = "Bonjour, |
|
79 |
vous venez d'enregistrer un ePack d'installation AbulÉdu et nous vous en remercions. |
|
80 |
|
|
81 |
Vous trouverez ci-joint le document récapitulatif de votre enregistrement. |
|
82 |
|
|
83 |
-- |
|
84 |
RyXéo SARL |
|
85 |
contact@ryxeo.com |
|
86 |
Tel: 05 35 54 01 18"; |
|
87 |
$crlf = "\n"; |
|
88 |
$hdrs = array( |
|
89 |
'From' => 'contact@ryxeo.com', |
|
90 |
'Subject' => mb_encode_mimeheader("[AbulEdu] Fiche d'installation " . $datapost['INAME']), |
|
91 |
'BCC' => 'contact@ryxeo.com' |
|
92 |
); |
|
93 |
$mime = new Mail_mime($crlf); |
|
94 |
$mime->setTXTBody($txtmail); |
|
95 |
$mime->addAttachment($fichier_pdf, mime_content_type($fichier_pdf)); |
|
96 |
$body = $mime->get(array('text_charset' => 'utf-8')); |
|
97 |
$hdrs = $mime->headers($hdrs); |
|
98 |
$mail =& Mail::factory('mail'); |
|
99 |
$mail->send("eric.seigne@ryxeo.com", $hdrs, $body); |
|
100 |
} |
|
8 | 101 |
|
9 | 102 |
function send_mail_installation($pass,$code,$datapost) { |
10 | 103 |
$mail_content = " |
... | ... | |
43 | 136 |
|
44 | 137 |
Installateur: |
45 | 138 |
- Société: " . $datapost['RCODE'] . " |
139 |
- Adresse: " . $datapost['RADDRESS'] . " |
|
140 |
- Ville: " . $datapost['RCP'] . " " . $datapost['RVILLE'] . " |
|
46 | 141 |
- Nom: " . $datapost['RNAME'] . " |
47 | 142 |
- Téléphone: " . $datapost['RTEL'] . " |
48 | 143 |
- Email: " . $datapost['REMAIL'] . " |
... | ... | |
69 | 164 |
abuledu.net est un service de RyXéo SARL, société éditrice d'AbulÉdu |
70 | 165 |
|
71 | 166 |
"; |
72 |
ryxeo_mail("anet@ryxeo.com",$mail_content,"contact@ryxeo.com","Nouveau serveur dans la base abuledu.net"); |
|
167 |
|
|
168 |
if($code=="RYXEO-TESTS-2010") { |
|
169 |
ryxeo_mail("anet@ryxeo.com",$mail_content,"contact@ryxeo.com","[bricolage eric] Nouveau serveur dans la base abuledu.net"); |
|
170 |
} |
|
171 |
else { |
|
172 |
ryxeo_mail("anet@ryxeo.com",$mail_content,"contact@ryxeo.com","Nouveau serveur dans la base abuledu.net"); |
|
173 |
} |
|
73 | 174 |
} |
74 | 175 |
|
75 | 176 |
//Verifie si les donnees qu'on a en entree sont correctes sinon on saute ... direction webadmin/installation |
... | ... | |
280 | 381 |
include (GLPI_ROOT . "/inc/includes.php"); |
281 | 382 |
|
282 | 383 |
include ("ryxeo.php"); |
384 |
include('Mail.php'); |
|
385 |
include('Mail/mime.php'); |
|
283 | 386 |
|
284 | 387 |
//Si epack ryxeo |
285 | 388 |
if($code=="RYXEO-TESTS-2010") { |
286 |
$k = array_keys($datapost); |
|
287 |
for($i = 0; $i < count($k); $i++) { |
|
288 |
$key = $k[$i]; |
|
289 |
$debug .= $key . "=" . $datapost[$key] . "\n"; |
|
389 |
if(is_array($datapost)) { |
|
390 |
$k = array_keys($datapost); |
|
391 |
for($i = 0; $i < count($k); $i++) { |
|
392 |
$key = $k[$i]; |
|
393 |
$debug .= $key . "=" . $datapost[$key] . "\n"; |
|
394 |
} |
|
290 | 395 |
} |
291 |
|
|
396 |
|
|
292 | 397 |
if(isset($datapost["MINIWEBADMIN"])) { |
293 | 398 |
$message .= "<p>Vous pouvez maintenant passer à l'étape suivante: <a href=\"/maj/\">la 1ere mise à jour de votre serveur.</a></p>\n"; |
294 | 399 |
//le flag qui indique a miniwebadmin que le epack est enregistre |
295 | 400 |
$commande .= "\n touch /tmp/epack.ok \n"; |
296 | 401 |
} |
297 |
$message .= "<pre>
|
|
402 |
$message .= "<pre> |
|
298 | 403 |
$debug |
299 | 404 |
</pre>"; |
300 | 405 |
|
301 | 406 |
//On ne fait pas tout le bazaaar, on teste / valide la procedure uniquement |
407 |
make_pdf($pass,$code,$datapost); |
|
302 | 408 |
send_mail_installation($pass,$code,$datapost); |
303 | 409 |
|
304 | 410 |
$object = array(); |
Formats disponibles : Unified diff