From b2750c151c4410f3e0f497ca336348275b21a38a Mon Sep 17 00:00:00 2001
From: "tofulm@gmail.com" <>
Date: Wed, 16 Dec 2015 20:52:56 +0000
Subject: [PATCH] fin de vie de sms_spip qui devient le trunk de sms
---
.gitattributes | 9 +++
classes/smsfactor/AccuseReceptionSMSClass.php | 49 +++++++++++++
classes/smsfactor/sendSMSclass.php | 70 +++++++++++++++++++
formulaires/configurer_sms.html | 46 ++++++++++++
lang/paquet-sms_fr.php | 12 ++++
lang/sms_fr.php | 36 ++++++++++
paquet.xml | 16 +++++
prive/squelettes/contenu/configurer_sms.html | 7 ++
sms_fonctions.php | 47 +++++++++++++
9 files changed, 292 insertions(+)
create mode 100644 .gitattributes
create mode 100644 classes/smsfactor/AccuseReceptionSMSClass.php
create mode 100644 classes/smsfactor/sendSMSclass.php
create mode 100644 formulaires/configurer_sms.html
create mode 100644 lang/paquet-sms_fr.php
create mode 100644 lang/sms_fr.php
create mode 100644 paquet.xml
create mode 100644 prive/squelettes/contenu/configurer_sms.html
create mode 100644 sms_fonctions.php
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..de1d053
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,9 @@
+* text=auto !eol
+classes/smsfactor/AccuseReceptionSMSClass.php -text
+classes/smsfactor/sendSMSclass.php -text
+formulaires/configurer_sms.html -text
+lang/paquet-sms_fr.php -text
+lang/sms_fr.php -text
+/paquet.xml -text
+prive/squelettes/contenu/configurer_sms.html -text
+/sms_fonctions.php -text
diff --git a/classes/smsfactor/AccuseReceptionSMSClass.php b/classes/smsfactor/AccuseReceptionSMSClass.php
new file mode 100644
index 0000000..a83a387
--- /dev/null
+++ b/classes/smsfactor/AccuseReceptionSMSClass.php
@@ -0,0 +1,49 @@
+username = $username;
+ $this->password = $password;
+ $this->ticket = $ticket;
+
+ // (POST /dr) get recipient, url + dr
+ $host = "https://api.smsfactor.com/dr";
+
+ $this->prepareXMLdata();
+
+ $this->response = $this->do_post_request($host,$this->request_data);
+ return $this->response;
+ }
+
+ function prepareXMLdata()
+ {
+ $xmldata = "" . $this->username . "" . $this->password . "" . $this->ticket . "";
+ $this->request_data = 'XML=' . $xmldata;
+ }
+
+ function do_post_request($url, $postdata, $optional_headers = null)
+ {
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
+ $response = curl_exec($ch);
+ curl_close($ch);
+ return $response;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/classes/smsfactor/sendSMSclass.php b/classes/smsfactor/sendSMSclass.php
new file mode 100644
index 0000000..334b302
--- /dev/null
+++ b/classes/smsfactor/sendSMSclass.php
@@ -0,0 +1,70 @@
+username = $username;
+ $this->password = $password;
+ $this->sender = $sender;
+ $this->message = $message;
+ $this->inputgsmnumbers = $inputgsmnumbers;
+
+ $this->host = "https://api.smsfactor.com";
+
+ $this->convertGSMnumberstoXML();
+ $this->prepareXMLdata();
+
+ $this->response = $this->do_post_request($this->host,$this->request_data);
+ return $this->response;
+ }
+
+ function convertGSMnumberstoXML()
+ {
+ $gsmcount = count($this->inputgsmnumbers); #counts gsm numbers
+
+ for ( $i = 0; $i < $gsmcount; $i++ )
+ {
+ $this->XMLgsmnumbers .= "" . $this->inputgsmnumbers[$i] . "";
+ }
+ }
+
+ function prepareXMLdata()
+ {
+ $this->xmldata = "" . $this->username . "" . $this->password . "" . $this->sender . "" . $this->message . "" . $this->XMLgsmnumbers . "";
+ $this->request_data = 'XML=' . $this->xmldata;
+ }
+
+
+ function do_post_request($url, $postdata, $optional_headers = null)
+ {
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
+ $response = curl_exec($ch);
+ curl_close($ch);
+ return $response;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/formulaires/configurer_sms.html b/formulaires/configurer_sms.html
new file mode 100644
index 0000000..945cda8
--- /dev/null
+++ b/formulaires/configurer_sms.html
@@ -0,0 +1,46 @@
+
diff --git a/lang/paquet-sms_fr.php b/lang/paquet-sms_fr.php
new file mode 100644
index 0000000..ac9825a
--- /dev/null
+++ b/lang/paquet-sms_fr.php
@@ -0,0 +1,12 @@
+ 'API pour envoyer des sms simplement',
+ 'sms_nom' => 'SMS SPIP',
+ 'sms_slogan' => '',
+);
diff --git a/lang/sms_fr.php b/lang/sms_fr.php
new file mode 100644
index 0000000..20787ca
--- /dev/null
+++ b/lang/sms_fr.php
@@ -0,0 +1,36 @@
+ 'Aucun',
+ // S
+ 'sms_titre' => 'SMS SPIP',
+
+ // C
+ 'cfg_exemple' => 'Exemple',
+ 'cfg_exemple_explication' => 'Explication de cet exemple',
+ 'cfg_titre_parametrages' => 'Paramétrages',
+ 'choix_prestataire' => 'Choix du prestataire',
+
+ // E
+ 'expediteur' => 'Expéditeur',
+ 'explication_expediteur' => 'Personnalisation de l’expéditeur avec du texte (11 caractères Max.)
+ N° de Téléphone non pris en charge en France.',
+ 'explication_smsfactor' => 'Identifiant de votre compte en ligne',
+
+ // L
+ 'login' => 'Login',
+
+ // M
+ 'mot_de_passe' => 'Mot de passe',
+
+ // S
+ 'sms_titre' => 'SMS SPIP',
+
+ // T
+ 'titre_page_configurer_sms' => 'Configuration de l\'API SMS',
+);
diff --git a/paquet.xml b/paquet.xml
new file mode 100644
index 0000000..b61b174
--- /dev/null
+++ b/paquet.xml
@@ -0,0 +1,16 @@
+
+ SMS SPIP
+
+ tofulm
+
+ GNU/GPL
+
+
diff --git a/prive/squelettes/contenu/configurer_sms.html b/prive/squelettes/contenu/configurer_sms.html
new file mode 100644
index 0000000..0294ef1
--- /dev/null
+++ b/prive/squelettes/contenu/configurer_sms.html
@@ -0,0 +1,7 @@
+[(#AUTORISER{configurer,_sms}|sinon_interdire_acces)]
+
+<:sms:titre_page_configurer_sms:>
+
+
+ #FORMULAIRE_CONFIGURER_SMS
+
\ No newline at end of file
diff --git a/sms_fonctions.php b/sms_fonctions.php
new file mode 100644
index 0000000..14f7472
--- /dev/null
+++ b/sms_fonctions.php
@@ -0,0 +1,47 @@
+SendSMS($username,$password,$sender,$message,$destinataire);
+
+ $reponse = new SimpleXMLElement($retour);
+ if ( $reponse->message == "OK" ){
+ return true;
+ }else{
+ return false;
+ }
+}