Ajout du support des SMS flash

This commit is contained in:
OsaAjani 2015-12-09 18:24:04 +01:00
parent 46444f5e69
commit 6fe2ab5193
6 changed files with 54 additions and 14 deletions

View File

@ -102,6 +102,7 @@
{ {
$id_scheduled = $scheduled['id']; $id_scheduled = $scheduled['id'];
$text_sms = escapeshellarg($scheduled['content']); $text_sms = escapeshellarg($scheduled['content']);
$flash = $scheduled['flash'];
//On initialise les numéros auxquelles envoyer le SMS //On initialise les numéros auxquelles envoyer le SMS
$numbers = array(); $numbers = array();
@ -167,6 +168,12 @@
//Commande qui envoie le SMS //Commande qui envoie le SMS
$commande_send_sms = 'gammu-smsd-inject TEXT ' . escapeshellarg($number) . ' -report -len ' . mb_strlen($text_sms) . ' -text ' . $text_sms; $commande_send_sms = 'gammu-smsd-inject TEXT ' . escapeshellarg($number) . ' -report -len ' . mb_strlen($text_sms) . ' -text ' . $text_sms;
if (RASPISMS_SETTINGS_SMS_FLASH && $flash)
{
$commande_send_sms .= ' -flash';
}
//Commande qui s'assure de passer le SMS dans ceux envoyés, et de lui donner le bon statut //Commande qui s'assure de passer le SMS dans ceux envoyés, et de lui donner le bon statut
//On va liée les deux commandes pour envoyer le SMS puis le passer en echec //On va liée les deux commandes pour envoyer le SMS puis le passer en echec

View File

@ -39,6 +39,7 @@ CREATE TABLE IF NOT EXISTS scheduleds
id INT NOT NULL AUTO_INCREMENT, id INT NOT NULL AUTO_INCREMENT,
at DATETIME NOT NULL, at DATETIME NOT NULL,
content VARCHAR(1000) NOT NULL, content VARCHAR(1000) NOT NULL,
flash BOOLEAN NOT NULL DEFAULT 0,
progress BOOLEAN NOT NULL DEFAULT 0, progress BOOLEAN NOT NULL DEFAULT 0,
PRIMARY KEY (id) PRIMARY KEY (id)
); );
@ -153,4 +154,5 @@ VALUES ('transfer', '1'),
('sms_stop', '1'), ('sms_stop', '1'),
('detect_url', '1'), ('detect_url', '1'),
('default_phone_country', 'fr'), ('default_phone_country', 'fr'),
('preferred_phone_country', 'fr,be,ca'); ('preferred_phone_country', 'fr,be,ca'),
('sms_flash', '0');

View File

@ -65,6 +65,15 @@
<label>Groupes cibles</label> <label>Groupes cibles</label>
<input class="add-groups form-control" name="groups[]"/> <input class="add-groups form-control" name="groups[]"/>
</div> </div>
<?php if (RASPISMS_SETTINGS_SMS_FLASH) { ?>
<div class="form-group">
<label>Envoyer comme un SMS Flash : </label>
<div class="form-group">
<input name="admin" type="radio" value="1" required /> Oui
<input name="admin" type="radio" value="0" required checked/> Non
</div>
</div>
<?php } ?>
<a class="btn btn-danger" href="<?php echo $this->generateUrl('scheduleds'); ?>">Annuler</a> <a class="btn btn-danger" href="<?php echo $this->generateUrl('scheduleds'); ?>">Annuler</a>
<input type="submit" class="btn btn-success" value="Enregistrer le SMS" /> <input type="submit" class="btn btn-success" value="Enregistrer le SMS" />
</form> </form>

View File

@ -71,6 +71,15 @@
<label>Groupes cibles</label> <label>Groupes cibles</label>
<input class="add-groups form-control" name="scheduleds[<?php secho($scheduled['id']); ?>][groups][]" value="<?php secho(json_encode($scheduled['groups'])); ?>" /> <input class="add-groups form-control" name="scheduleds[<?php secho($scheduled['id']); ?>][groups][]" value="<?php secho(json_encode($scheduled['groups'])); ?>" />
</div> </div>
<?php if (RASPISMS_SETTINGS_SMS_FLASH) { ?>
<div class="form-group">
<label>Envoyer comme un SMS Flash : </label>
<div class="form-group">
<input name="admin" type="radio" value="1" required <?php echo ($scheduled['flash'] ? 'checked' : ''); ?> /> Oui
<input name="admin" type="radio" value="0" required <?php echo ($scheduled['flash'] ? '' : 'checked'); ?> /> Non
</div>
</div>
<?php } ?>
<hr/> <hr/>
<?php <?php
} }

View File

@ -126,6 +126,25 @@
</form> </form>
</div> </div>
</div> </div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"><i class="fa fa-flash fa-fw"></i> Support des SMS Flash</h4>
</div>
<div class="panel-body">
<form action="<?php echo $this->generateUrl('settings', 'change', ['sms_flash', $_SESSION['csrf']]); ?>" method="POST">
<div class="form-group">
<label>SMS Flash activé : </label>
<select name="settingValue" class="form-control">
<option value="0">Non</option>
<option value="1" <?php echo RASPISMS_SETTINGS_SMS_FLASH ? 'selected' : ''; ?>>Oui</option>
</select>
</div>
<div class="text-center">
<button class="btn btn-success">Mettre à jour les données</button>
</div>
</form>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -52,10 +52,7 @@
<input name="email_confirm" class="form-control" type="email" placeholder="Confirmer l'adresse e-mail de l'utilisateur" required> <input name="email_confirm" class="form-control" type="email" placeholder="Confirmer l'adresse e-mail de l'utilisateur" required>
</div> </div>
</div> </div>
<?php <?php if (isset($_SESSION['admin']) && $_SESSION['admin']) { ?>
if (isset($_SESSION['admin']) && $_SESSION['admin'])
{
?>
<div class="form-group"> <div class="form-group">
<label>Niveau administrateur : </label> <label>Niveau administrateur : </label>
<div class="form-group"> <div class="form-group">
@ -63,10 +60,7 @@
<input name="admin" type="radio" value="0" required /> Non <input name="admin" type="radio" value="0" required /> Non
</div> </div>
</div> </div>
<?php <?php } ?>
}
?>
<a class="btn btn-danger" href="<?php echo $this->generateUrl('users'); ?>">Annuler</a> <a class="btn btn-danger" href="<?php echo $this->generateUrl('users'); ?>">Annuler</a>
<input type="submit" class="btn btn-success" value="Enregistrer le user" /> <input type="submit" class="btn btn-success" value="Enregistrer le user" />
</form> </form>