Compare commits

...

2 Commits

Author SHA1 Message Date
osaajani bd3da73711 Change UTF8 to utf8mb4 to properly support utf8 in mysql 2021-12-29 02:54:21 +01:00
osaajani fadffdab10 extend suppression of smsstops to all users 2021-12-27 20:25:23 +01:00
8 changed files with 19 additions and 32 deletions

View File

@ -1 +1 @@
v3.2.4 v3.2.6

View File

@ -55,7 +55,7 @@ namespace controllers\internals;
*/ */
public function phone($id_phone) public function phone($id_phone)
{ {
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8'); $bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$internal_phone = new \controllers\internals\Phone($bdd); $internal_phone = new \controllers\internals\Phone($bdd);
$phone = $internal_phone->get($id_phone); $phone = $internal_phone->get($id_phone);
@ -74,7 +74,7 @@ namespace controllers\internals;
*/ */
public function user_exists(string $email) public function user_exists(string $email)
{ {
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8'); $bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$internal_user = new \controllers\internals\User($bdd); $internal_user = new \controllers\internals\User($bdd);
$user = $internal_user->get_by_email($email); $user = $internal_user->get_by_email($email);
@ -89,7 +89,7 @@ namespace controllers\internals;
*/ */
public function user_id_exists(string $id) public function user_id_exists(string $id)
{ {
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8'); $bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$internal_user = new \controllers\internals\User($bdd); $internal_user = new \controllers\internals\User($bdd);
$user = $internal_user->get($id); $user = $internal_user->get($id);
@ -111,7 +111,7 @@ namespace controllers\internals;
*/ */
public function create_update_user(string $email, string $password, bool $admin, ?string $api_key = null, string $status = \models\User::STATUS_ACTIVE, bool $encrypt_password = true) public function create_update_user(string $email, string $password, bool $admin, ?string $api_key = null, string $status = \models\User::STATUS_ACTIVE, bool $encrypt_password = true)
{ {
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8'); $bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$internal_user = new \controllers\internals\User($bdd); $internal_user = new \controllers\internals\User($bdd);
$user = $internal_user->get_by_email($email); $user = $internal_user->get_by_email($email);
@ -146,7 +146,7 @@ namespace controllers\internals;
*/ */
public function update_user_status(string $id, string $status) public function update_user_status(string $id, string $status)
{ {
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8'); $bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$internal_user = new \controllers\internals\User($bdd); $internal_user = new \controllers\internals\User($bdd);
$user = $internal_user->get($id); $user = $internal_user->get($id);
@ -167,7 +167,7 @@ namespace controllers\internals;
*/ */
public function delete_user(string $id) public function delete_user(string $id)
{ {
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8'); $bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$internal_user = new \controllers\internals\User($bdd); $internal_user = new \controllers\internals\User($bdd);
$success = $internal_user->delete($id); $success = $internal_user->delete($id);
@ -180,7 +180,7 @@ namespace controllers\internals;
*/ */
public function clean_unused_medias() public function clean_unused_medias()
{ {
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8'); $bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$internal_media = new \controllers\internals\Media($bdd); $internal_media = new \controllers\internals\Media($bdd);
$medias = $internal_media->gets_unused(); $medias = $internal_media->gets_unused();
@ -198,7 +198,7 @@ namespace controllers\internals;
*/ */
public function quota_limit_alerting() public function quota_limit_alerting()
{ {
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8'); $bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$internal_quota = new \controllers\internals\Quota($bdd); $internal_quota = new \controllers\internals\Quota($bdd);
$internal_quota->alerting_for_limit_close_and_reached(); $internal_quota->alerting_for_limit_close_and_reached();
} }
@ -208,7 +208,7 @@ namespace controllers\internals;
*/ */
public function renew_quotas() public function renew_quotas()
{ {
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8'); $bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$internal_quota = new \controllers\internals\Quota($bdd); $internal_quota = new \controllers\internals\Quota($bdd);
$internal_quota->renew_quotas(); $internal_quota->renew_quotas();
} }

View File

@ -74,13 +74,6 @@ namespace controllers\publics;
return $this->redirect(\descartes\Router::url('SmsStop', 'list')); return $this->redirect(\descartes\Router::url('SmsStop', 'list'));
} }
if (!\controllers\internals\Tool::is_admin())
{
\FlashMessage\FlashMessage::push('danger', 'Vous devez être administrateur pour pouvoir supprimer un "STOP Sms" !');
return $this->redirect(\descartes\Router::url('SmsStop', 'list'));
}
$ids = $_GET['ids'] ?? []; $ids = $_GET['ids'] ?? [];
foreach ($ids as $id) foreach ($ids as $id)
{ {

View File

@ -44,7 +44,7 @@ class Launcher extends AbstractDaemon
public function run() public function run()
{ {
//Create the internal controllers //Create the internal controllers
$this->bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8'); $this->bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$this->internal_phone = new \controllers\internals\Phone($this->bdd); $this->internal_phone = new \controllers\internals\Phone($this->bdd);
$this->start_sender_daemon(); $this->start_sender_daemon();

View File

@ -60,7 +60,7 @@ class Phone extends AbstractDaemon
$this->read_tick += 1; $this->read_tick += 1;
$this->bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8'); $this->bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
//Send smss in queue //Send smss in queue
$this->send_smss(); $this->send_smss();

View File

@ -94,7 +94,7 @@ class Sender extends AbstractDaemon
public function on_start() public function on_start()
{ {
$this->logger->info('Starting Sender with pid ' . getmypid()); $this->logger->info('Starting Sender with pid ' . getmypid());
$this->bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8'); $this->bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
} }
public function on_stop() public function on_stop()

View File

@ -12,6 +12,6 @@ environments:
user: '%APP_DATABASE_USER%' user: '%APP_DATABASE_USER%'
pass: '%APP_DATABASE_PASS%' pass: '%APP_DATABASE_PASS%'
port: 3306 port: 3306
charset: utf8 charset: utf8mb4
version_order: creation version_order: creation

View File

@ -40,9 +40,7 @@
<thead> <thead>
<tr> <tr>
<th>Numéro</th> <th>Numéro</th>
<?php if ($_SESSION['user']['admin'] ?? false) { ?>
<th class="checkcolumn"><input type="checkbox" id="check-all"/></th> <th class="checkcolumn"><input type="checkbox" id="check-all"/></th>
<?php } ?>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -50,12 +48,10 @@
</table> </table>
</div> </div>
<div> <div>
<?php if ($_SESSION['user']['admin'] ?? false) { ?>
<div class="text-right col-xs-12 no-padding"> <div class="text-right col-xs-12 no-padding">
<strong>Action pour la séléction :</strong> <strong>Action pour la séléction :</strong>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('SmsStop', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button> <button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('SmsStop', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div> </div>
<?php } ?>
</div> </div>
</form> </form>
</div> </div>
@ -87,14 +83,12 @@ jQuery(document).ready(function ()
{ {
data: 'number_formatted', data: 'number_formatted',
} }
<?php if ($_SESSION['user']['admin'] ?? false) { ?>
,{ ,{
data: 'id', data: 'id',
render: function (data, type, row, meta) { render: function (data, type, row, meta) {
return '<input name="ids[]" type="checkbox" value="' + data + '">'; return '<input name="ids[]" type="checkbox" value="' + data + '">';
}, },
}, },
<?php } ?>
], ],
"deferRender": true "deferRender": true
}); });