ryxeo-glpi-git / plugins / anet_epacks / front / plugin_sms_send.php @ ca88a1a9
Historique | Voir | Annoter | Télécharger (2,15 ko)
1 | 0c00bf18 | Eric Seigne | <?php
|
---|---|---|---|
2 | /*
|
||
3 | *
|
||
4 | * plate-forme d'expedition automatique de SMS ...
|
||
5 | *
|
||
6 | */
|
||
7 | //ovh stuff ==========================
|
||
8 | $nic=""; |
||
9 | $pass=""; |
||
10 | $sms_compte=""; |
||
11 | $from=""; |
||
12 | //ovh stuff ==========================
|
||
13 | //tout ceci est configure dans le fichier suivant qui n'est pas versionne ... merci mon mot de passe
|
||
14 | include_once ("plugin_sms_config.php"); |
||
15 | |||
16 | if(!defined('GLPI_ROOT')){ |
||
17 | define('GLPI_ROOT', '../../..'); |
||
18 | } |
||
19 | include_once (GLPI_ROOT . "/inc/includes.php"); |
||
20 | |||
21 | global $DB; |
||
22 | |||
23 | //on récupère les packs activés et dont l'entitée finale est connue
|
||
24 | $query = "SELECT mobile from `glpi_users` WHERE name='" . trim($_GET['dest']) . "'"; |
||
25 | $result = $DB->query($query); |
||
26 | if($data=$DB->fetch_array($result)) { |
||
27 | $to = $data[0]; |
||
28 | $message=str_split($_GET['message'],138); |
||
29 | try
|
||
30 | { |
||
31 | $soap = new SoapClient("https://www.ovh.com/soapi/soapi-re-1.8.wsdl"); |
||
32 | $session = $soap->login("$nic", "$pass","fr", false); |
||
33 | //echo "login successfull\n";
|
||
34 | $result = $soap->telephonySmsSend($session, "$sms_compte", "$from", "$to", $message[0], "", "1", "", ""); |
||
35 | //echo "telephonySmsSend successfull\n";
|
||
36 | $soap->logout($session); |
||
37 | //echo "logout successfull\n";
|
||
38 | |||
39 | |||
40 | //on double d'un mail ...
|
||
41 | |||
42 | $mail_body = " |
||
43 | SMS Envoyé à " . $_GET['dest'] . " - $to |
||
44 | Message: " . $_GET['message'] . " |
||
45 |
|
||
46 | --
|
||
47 | Script d'envoi automatique de SMS
|
||
48 | ";
|
||
49 | |||
50 | include('Mail.php'); |
||
51 | include('Mail/mime.php'); |
||
52 | //$text = $mail_body;
|
||
53 | $html = "<html> |
||
54 | <head>
|
||
55 | <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">
|
||
56 | </head>
|
||
57 | <body>
|
||
58 | <pre>" . $mail_body . "</pre> |
||
59 | </body>
|
||
60 | </html>\n";
|
||
61 | $crlf = "\n"; |
||
62 | $hdrs = array( 'From' => 'supportteam@ryxeo.com', |
||
63 | 'Subject' => "[SMS] Nouveau SMS Envoyé a : " . $_GET['dest'] , |
||
64 | 'Content-Type' => 'text/html; charset="UTF-8"' |
||
65 | ); |
||
66 | |||
67 | $mime = new Mail_mime($crlf); |
||
68 | //$mime->setTXTBody($text);
|
||
69 | $mime->setHTMLBody($html); |
||
70 | $body = $mime->get(array('text_charset' => 'utf-8', 'html_charset' => 'utf-8')); |
||
71 | $hdrs = $mime->headers($hdrs); |
||
72 | $mail =& Mail::factory('mail'); |
||
73 | $mail->send('supportteam@ryxeo.com', $hdrs, $body); |
||
74 | |||
75 | |||
76 | } |
||
77 | catch(SoapFault $fault) |
||
78 | { |
||
79 | // affichage des erreurs
|
||
80 | echo $fault; |
||
81 | } |
||
82 | } |
||
83 | else {
|
||
84 | print "erreur"; |
||
85 | } |
||
86 | ?> |