Ajout du réglages sur l'internationalisation des numéros. Unification des réglages. Fix des labels sur les numéros (retrait de l'avertissement sur l'internationalisation)
This commit is contained in:
parent
965c62dbe5
commit
66dfb04f7f
|
@ -28,12 +28,13 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* Cette fonction permet de mettre à jour l'activation ou la désactivation du transfer des SMS
|
||||
* Cette fonction permet de mettre à jour un réglage
|
||||
* @param string $settingName : Le nom du réglage à modifier
|
||||
* @param $csrf : Le jeton CSRF
|
||||
* @param string $_POST['transfer'] : Le nouveau transfer
|
||||
* @return void;
|
||||
* @param string $_POST['settingValue'] : La nouvelle valeur du réglage
|
||||
* @return boolean
|
||||
*/
|
||||
public function changeTransfer($csrf)
|
||||
public function change($settingName, $csrf)
|
||||
{
|
||||
//On vérifie que le jeton csrf est bon
|
||||
if (!internalTools::verifyCSRF($csrf))
|
||||
|
@ -43,99 +44,17 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
//Creation de l'object de base de données
|
||||
//On vérifie que la valeur est définie
|
||||
if (!isset($_POST['settingValue']))
|
||||
{
|
||||
$_SESSION['errormessage'] = 'Vous devez fournir une valeur pour le réglage !';
|
||||
header('Location: ' . $this->generateUrl('settings'));
|
||||
return false;
|
||||
}
|
||||
|
||||
global $db;
|
||||
|
||||
if (!isset($_POST['transfer']))
|
||||
{
|
||||
$_SESSION['errormessage'] = 'Vous devez renseigner un valeur';
|
||||
header('Location: ' . $this->generateUrl('settings'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$transfer = (int)$_POST['transfer'];
|
||||
|
||||
if (!$db->updateTableWhere('settings', ['value' => $transfer], ['name' => 'transfer']))
|
||||
{
|
||||
$_SESSION['errormessage'] = 'Impossible de mettre les données à jour.';
|
||||
header('Location: ' . $this->generateUrl('settings'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$_SESSION['successmessage'] = 'Les données ont été mises à jour.';
|
||||
header('Location: ' . $this->generateUrl('settings'));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cette fonction permet de mettre à jour l'activation ou la désactivation de SMS-STOP
|
||||
* @param $csrf : Le jeton CSRF
|
||||
* @param string $_POST['stop'] : Le nouveau stop
|
||||
* @return void;
|
||||
*/
|
||||
public function changeSmsStop($csrf)
|
||||
{
|
||||
//On vérifie que le jeton csrf est bon
|
||||
if (!internalTools::verifyCSRF($csrf))
|
||||
{
|
||||
$_SESSION['errormessage'] = 'Jeton CSRF invalide !';
|
||||
header('Location: ' . $this->generateUrl('settings'));
|
||||
return false;
|
||||
}
|
||||
|
||||
//Creation de l'object de base de données
|
||||
global $db;
|
||||
|
||||
if (!isset($_POST['sms_stop']))
|
||||
{
|
||||
$_SESSION['errormessage'] = 'Vous devez renseigner un valeur';
|
||||
header('Location: ' . $this->generateUrl('settings'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$stop = (int)$_POST['sms_stop'];
|
||||
|
||||
if (!$db->updateTableWhere('settings', ['value' => $stop], ['name' => 'sms_stop']))
|
||||
{
|
||||
$_SESSION['errormessage'] = 'Impossible de mettre les données à jour.';
|
||||
header('Location: ' . $this->generateUrl('settings'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$_SESSION['successmessage'] = 'Les données ont été mises à jour.';
|
||||
header('Location: ' . $this->generateUrl('settings'));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cette fonction permet de mettre à jour l'activation ou la désactivation de la detection d'URL dans les discussions
|
||||
* @param $csrf : Le jeton CSRF
|
||||
* @param string $_POST['detect_url'] : Le nouveau stop
|
||||
* @return void;
|
||||
*/
|
||||
public function changeDetectionUrl($csrf)
|
||||
{
|
||||
//On vérifie que le jeton csrf est bon
|
||||
if (!internalTools::verifyCSRF($csrf))
|
||||
{
|
||||
$_SESSION['errormessage'] = 'Jeton CSRF invalide !';
|
||||
header('Location: ' . $this->generateUrl('settings'));
|
||||
return false;
|
||||
}
|
||||
|
||||
//Creation de l'object de base de données
|
||||
global $db;
|
||||
|
||||
if (!isset($_POST['detect_url']))
|
||||
{
|
||||
$_SESSION['errormessage'] = 'Vous devez renseigner un valeur';
|
||||
header('Location: ' . $this->generateUrl('settings'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$detectUrl = (int)$_POST['detect_url'];
|
||||
|
||||
if (!$db->updateTableWhere('settings', ['value' => $detectUrl], ['name' => 'detect_url']))
|
||||
if (!$db->updateTableWhere('settings', ['value' => $_POST['settingValue']], ['name' => $settingName]))
|
||||
{
|
||||
$_SESSION['errormessage'] = 'Impossible de mettre les données à jour.';
|
||||
header('Location: ' . $this->generateUrl('settings'));
|
||||
|
|
|
@ -6,7 +6,7 @@ USE raspisms;
|
|||
CREATE TABLE IF NOT EXISTS settings
|
||||
(
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
name VARCHAR(20) NOT NULL,
|
||||
name VARCHAR(50) NOT NULL,
|
||||
value VARCHAR(1000) NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE (name)
|
||||
|
@ -151,4 +151,6 @@ CREATE TABLE IF NOT EXISTS sms_stop
|
|||
INSERT INTO settings (name, value)
|
||||
VALUES ('transfer', '1'),
|
||||
('sms_stop', '1'),
|
||||
('detect_url', '1');
|
||||
('detect_url', '1'),
|
||||
('default_phone_country', 'fr'),
|
||||
('preferred_phone_country', 'fr,be,ca');
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Numéro de téléphone du contact<span class="italic small-text text-danger"> - Vous devriez utiliser un numéro international (Ex. : +33612345678)</span></label>
|
||||
<label>Numéro de téléphone du contact</label>
|
||||
<div class="form-group">
|
||||
<input name="" class="form-control" type="tel" id="phone-international-input">
|
||||
<input name="phone" type="hidden" id="phone-hidden-input" required>
|
||||
|
@ -66,8 +66,8 @@
|
|||
jQuery('document').ready(function($)
|
||||
{
|
||||
jQuery('#phone-international-input').intlTelInput({
|
||||
defaultCountry: 'fr',
|
||||
preferredCountries: ['fr', 'be', 'ca'],
|
||||
defaultCountry: '<?php secho(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>',
|
||||
preferredCountries: <?php secho(json_encode(explode(',', RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY)), false, false); ?>,
|
||||
nationalMode: true,
|
||||
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
|
||||
});
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Numéro de téléphone du contact<span class="italic small-text text-danger"> - Vous devriez utiliser un numéro international (Ex. : +33612345678)</span></label>
|
||||
<label>Numéro de téléphone du contact</label>
|
||||
<div class="form-group">
|
||||
<input name="" class="form-control phone-international-input" type="tel" contact-id="<?php secho($contact['id']); ?>" value="<?php secho($contact['number']); ?>">
|
||||
<input name="contacts[<?php secho($contact['id']); ?>][phone]" type="hidden" id="phone-hidden-input-<?php secho($contact['id']); ?>" required>
|
||||
|
@ -74,8 +74,8 @@
|
|||
jQuery('document').ready(function($)
|
||||
{
|
||||
jQuery('.phone-international-input').intlTelInput({
|
||||
defaultCountry: 'fr',
|
||||
preferredCountries: ['fr', 'be', 'ca'],
|
||||
defaultCountry: '<?php secho(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>',
|
||||
preferredCountries: <?php secho(json_encode(explode(',', RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY)), false, false); ?>,
|
||||
nationalMode: true,
|
||||
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
|
||||
});
|
||||
|
|
|
@ -97,8 +97,8 @@
|
|||
});
|
||||
|
||||
jQuery('.phone-international-input').intlTelInput({
|
||||
defaultCountry: 'fr',
|
||||
preferredCountries: ['fr', 'be', 'ca'],
|
||||
defaultCountry: '<?php secho(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>',
|
||||
preferredCountries: <?php secho(json_encode(explode(',', RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY)), false, false); ?>,
|
||||
nationalMode: true,
|
||||
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
|
||||
});
|
||||
|
@ -120,8 +120,8 @@
|
|||
jQuery(this).before(newScheduledsNumberGroup);
|
||||
|
||||
jQuery('.phone-international-input').intlTelInput({
|
||||
defaultCountry: 'fr',
|
||||
preferredCountries: ['fr', 'be', 'ca'],
|
||||
defaultCountry: '<?php secho(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>',
|
||||
preferredCountries: <?php secho(json_encode(explode(',', RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY)), false, false); ?>,
|
||||
nationalMode: true,
|
||||
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
|
||||
});
|
||||
|
|
|
@ -115,8 +115,8 @@
|
|||
});
|
||||
|
||||
jQuery('.phone-international-input').intlTelInput({
|
||||
defaultCountry: 'fr',
|
||||
preferredCountries: ['fr', 'be', 'ca'],
|
||||
defaultCountry: '<?php secho(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>',
|
||||
preferredCountries: <?php secho(json_encode(explode(',', RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY)), false, false); ?>,
|
||||
nationalMode: true,
|
||||
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
|
||||
});
|
||||
|
@ -139,8 +139,8 @@
|
|||
jQuery(this).before(newScheduledsNumberGroup);
|
||||
|
||||
jQuery('.phone-international-input').intlTelInput({
|
||||
defaultCountry: 'fr',
|
||||
preferredCountries: ['fr', 'be', 'ca'],
|
||||
defaultCountry: '<?php secho(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>',
|
||||
preferredCountries: <?php secho(json_encode(explode(',', RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY)), false, false); ?>,
|
||||
nationalMode: true,
|
||||
utilsScript: '<?php echo HTTP_PWD; ?>/js/intlTelInput/lib/libphonenumber/utils.js'
|
||||
});
|
||||
|
|
|
@ -40,10 +40,10 @@
|
|||
<h4 class="panel-title"><i class="fa fa-share fa-fw"></i> Transfert des SMS par e-mail</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="<?php echo $this->generateUrl('settings', 'changeTransfer', [$_SESSION['csrf']]); ?>" method="POST">
|
||||
<form action="<?php echo $this->generateUrl('settings', 'change', ['transfer', $_SESSION['csrf']]); ?>" method="POST">
|
||||
<div class="form-group">
|
||||
<label>Transfert activé : </label>
|
||||
<select name="transfer" class="form-control">
|
||||
<select name="settingValue" class="form-control">
|
||||
<option value="0">Non</option>
|
||||
<option value="1" <?php echo RASPISMS_SETTINGS_TRANSFER ? 'selected' : ''; ?>>Oui</option>
|
||||
</select>
|
||||
|
@ -59,10 +59,10 @@
|
|||
<h4 class="panel-title"><i class="fa fa-link fa-fw"></i> Détection des URL dans les discussions</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="<?php echo $this->generateUrl('settings', 'changeDetectionUrl', [$_SESSION['csrf']]); ?>" method="POST">
|
||||
<form action="<?php echo $this->generateUrl('settings', 'change', ['detection_url', $_SESSION['csrf']]); ?>" method="POST">
|
||||
<div class="form-group">
|
||||
<label>Détection activé : </label>
|
||||
<select name="detect_url" class="form-control">
|
||||
<select name="settingValue" class="form-control">
|
||||
<option value="0">Non</option>
|
||||
<option value="1" <?php echo RASPISMS_SETTINGS_DETECT_URL ? 'selected' : ''; ?>>Oui</option>
|
||||
</select>
|
||||
|
@ -73,6 +73,22 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title"><i class="fa fa-phone fa-fw"></i> Pays préférés numéros internationaux</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="<?php echo $this->generateUrl('settings', 'change', ['preferred_phone_country', $_SESSION['csrf']]); ?>" method="POST">
|
||||
<div class="form-group">
|
||||
<label>Code des pays (norme ISO 3166-1 alpha-2) séparés par des virgules : </label>
|
||||
<input name="settingValue" class="form-control" value="<?php secho(RASPISMS_SETTINGS_PREFERRED_PHONE_COUNTRY); ?>" />
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-success">Mettre à jour les données</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="panel panel-default">
|
||||
|
@ -80,10 +96,10 @@
|
|||
<h4 class="panel-title"><i class="fa fa-ban fa-fw"></i> Activation de SMS-STOP</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="<?php echo $this->generateUrl('settings', 'changeSmsStop', [$_SESSION['csrf']]); ?>" method="POST">
|
||||
<form action="<?php echo $this->generateUrl('settings', 'change', ['sms_stop', $_SESSION['csrf']]); ?>" method="POST">
|
||||
<div class="form-group">
|
||||
<label>SMS STOP activé : </label>
|
||||
<select name="sms_stop" class="form-control">
|
||||
<select name="settingValue" class="form-control">
|
||||
<option value="0">Non</option>
|
||||
<option value="1" <?php echo RASPISMS_SETTINGS_SMS_STOP ? 'selected' : ''; ?>>Oui</option>
|
||||
</select>
|
||||
|
@ -94,6 +110,22 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title"><i class="fa fa-phone fa-fw"></i> Pays par défaut numéros internationaux</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="<?php echo $this->generateUrl('settings', 'change', ['default_phone_country', $_SESSION['csrf']]); ?>" method="POST">
|
||||
<div class="form-group">
|
||||
<label>Code du pays (norme ISO 3166-1 alpha-2) : </label>
|
||||
<input name="settingValue" class="form-control" value="<?php secho(RASPISMS_SETTINGS_DEFAULT_PHONE_COUNTRY); ?>" />
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-success">Mettre à jour les données</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue