Compare commits

...

3 Commits

Author SHA1 Message Date
osaajani b12738073b Realease v3.0.8 with command bad type comparaison fix 2021-02-23 00:45:52 +01:00
osaajani 3f84622cbe Remove risky fix on PHPCsFixer + fix bad command interpretation 2021-02-23 00:40:59 +01:00
osaajani 3b662c1153 fix style 2021-02-23 00:31:54 +01:00
27 changed files with 60 additions and 61 deletions

1
.gitignore vendored
View File

@ -4,6 +4,7 @@
.credentials .credentials
.credentials* .credentials*
vendor/ vendor/
scripts/
composer.lock composer.lock
env.* env.*
phinx.* phinx.*

View File

@ -1 +1 @@
v3.0.7 v3.0.8

View File

@ -39,8 +39,8 @@ namespace adapters;
public static function meta_uid(): string; public static function meta_uid(): string;
/** /**
* Should this adapter be hidden in user interface for phone creation and * Should this adapter be hidden in user interface for phone creation and
* available to creation through API only * available to creation through API only.
*/ */
public static function meta_hidden(): bool; public static function meta_hidden(): bool;

View File

@ -59,7 +59,7 @@ namespace adapters;
/** /**
* Should this adapter be hidden in user interface for phone creation and * Should this adapter be hidden in user interface for phone creation and
* available to creation through API only * available to creation through API only.
*/ */
public static function meta_hidden(): bool public static function meta_hidden(): bool
{ {

View File

@ -54,14 +54,13 @@ namespace adapters;
/** /**
* Should this adapter be hidden in user interface for phone creation and * Should this adapter be hidden in user interface for phone creation and
* available to creation through API only * available to creation through API only.
*/ */
public static function meta_hidden(): bool public static function meta_hidden(): bool
{ {
return false; return false;
} }
/** /**
* Name of the adapter. * Name of the adapter.
* It should probably be the name of the service it adapt (e.g : Gammu SMSD, OVH SMS, SIM800L, etc.). * It should probably be the name of the service it adapt (e.g : Gammu SMSD, OVH SMS, SIM800L, etc.).

View File

@ -50,7 +50,7 @@ class OctopushShortcodeAdapter implements AdapterInterface
* Adapter constructor, called when instanciated by RaspiSMS. * Adapter constructor, called when instanciated by RaspiSMS.
* *
* @param string $number : Phone number the adapter is used for * @param string $number : Phone number the adapter is used for
* @param json string $data : JSON string of the data to configure interaction with the implemented service * @param json string $data : JSON string of the data to configure interaction with the implemented service
*/ */
public function __construct(string $data) public function __construct(string $data)
{ {
@ -80,7 +80,7 @@ class OctopushShortcodeAdapter implements AdapterInterface
/** /**
* Should this adapter be hidden in user interface for phone creation and * Should this adapter be hidden in user interface for phone creation and
* available to creation through API only * available to creation through API only.
*/ */
public static function meta_hidden(): bool public static function meta_hidden(): bool
{ {

View File

@ -55,7 +55,7 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
* Adapter constructor, called when instanciated by RaspiSMS. * Adapter constructor, called when instanciated by RaspiSMS.
* *
* @param string $number : Phone number the adapter is used for * @param string $number : Phone number the adapter is used for
* @param json string $data : JSON string of the data to configure interaction with the implemented service * @param json string $data : JSON string of the data to configure interaction with the implemented service
*/ */
public function __construct(string $data) public function __construct(string $data)
{ {
@ -86,7 +86,7 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
/** /**
* Should this adapter be hidden in user interface for phone creation and * Should this adapter be hidden in user interface for phone creation and
* available to creation through API only * available to creation through API only.
*/ */
public static function meta_hidden(): bool public static function meta_hidden(): bool
{ {

View File

@ -32,7 +32,7 @@ namespace adapters;
* Adapter constructor, called when instanciated by RaspiSMS. * Adapter constructor, called when instanciated by RaspiSMS.
* *
* @param string $number : Phone number the adapter is used for * @param string $number : Phone number the adapter is used for
* @param json string $data : JSON string of the data to configure interaction with the implemented service * @param json string $data : JSON string of the data to configure interaction with the implemented service
*/ */
public function __construct(string $data) public function __construct(string $data)
{ {
@ -65,7 +65,7 @@ namespace adapters;
/** /**
* Should this adapter be hidden in user interface for phone creation and * Should this adapter be hidden in user interface for phone creation and
* available to creation through API only * available to creation through API only.
*/ */
public static function meta_hidden(): bool public static function meta_hidden(): bool
{ {

View File

@ -77,7 +77,7 @@ namespace adapters;
/** /**
* Should this adapter be hidden in user interface for phone creation and * Should this adapter be hidden in user interface for phone creation and
* available to creation through API only * available to creation through API only.
*/ */
public static function meta_hidden(): bool public static function meta_hidden(): bool
{ {

View File

@ -64,7 +64,7 @@ namespace adapters;
/** /**
* Should this adapter be hidden in user interface for phone creation and * Should this adapter be hidden in user interface for phone creation and
* available to creation through API only * available to creation through API only.
*/ */
public static function meta_hidden(): bool public static function meta_hidden(): bool
{ {

View File

@ -42,7 +42,7 @@ class TwilioVirtualNumberAdapter implements AdapterInterface
* Adapter constructor, called when instanciated by RaspiSMS. * Adapter constructor, called when instanciated by RaspiSMS.
* *
* @param string $number : Phone number the adapter is used for * @param string $number : Phone number the adapter is used for
* @param json string $data : JSON string of the data to configure interaction with the implemented service * @param json string $data : JSON string of the data to configure interaction with the implemented service
*/ */
public function __construct(string $data) public function __construct(string $data)
{ {
@ -76,7 +76,7 @@ class TwilioVirtualNumberAdapter implements AdapterInterface
/** /**
* Should this adapter be hidden in user interface for phone creation and * Should this adapter be hidden in user interface for phone creation and
* available to creation through API only * available to creation through API only.
*/ */
public static function meta_hidden(): bool public static function meta_hidden(): bool
{ {

View File

@ -99,7 +99,7 @@ namespace controllers\internals;
//Check for user //Check for user
$internal_user = new \controllers\internals\User($this->bdd); $internal_user = new \controllers\internals\User($this->bdd);
$user = $internal_user->check_credentials($decode_message['login'], $decode_message['password']); $user = $internal_user->check_credentials($decode_message['login'], $decode_message['password']);
if (!$user || $user['id'] !== $id_user) if (!$user || (int) $user['id'] !== $id_user)
{ {
return false; return false;
} }

View File

@ -71,8 +71,6 @@ namespace controllers\internals;
* Check if a user exists based on email. * Check if a user exists based on email.
* *
* @param string $email : User email * @param string $email : User email
*
* @return void : exit code 1 on false, 0 else
*/ */
public function user_exists(string $email) public function user_exists(string $email)
{ {

View File

@ -59,7 +59,7 @@ namespace controllers\internals;
* @param int $id_user : User id * @param int $id_user : User id
* @param string $number : Contact number * @param string $number : Contact number
* @param string $name : Contact name * @param string $name : Contact name
* @param string $data : Contact data * @param string $data : Contact data
* *
* @return mixed bool|int : False if cannot create contact, id of the new contact else * @return mixed bool|int : False if cannot create contact, id of the new contact else
*/ */
@ -91,7 +91,7 @@ namespace controllers\internals;
* @param int $id : Contact id * @param int $id : Contact id
* @param string $number : Contact number * @param string $number : Contact number
* @param string $name : Contact name * @param string $name : Contact name
* @param ?string $data : Contact data * @param ?string $data : Contact data
* *
* @return int : number of modified rows * @return int : number of modified rows
*/ */
@ -135,7 +135,7 @@ namespace controllers\internals;
//Padding line with '' entries to make sure its same length as head //Padding line with '' entries to make sure its same length as head
//this allow to mix users with data with users without data //this allow to mix users with data with users without data
$line = array_pad($line, count($head), ''); $line = array_pad($line, \count($head), '');
$line = array_combine($head, $line); $line = array_combine($head, $line);
if (false === $line) if (false === $line)
@ -282,12 +282,13 @@ namespace controllers\internals;
$data = json_decode($contact['data'], true); $data = json_decode($contact['data'], true);
$line = [$contact['name'], $contact['number']]; $line = [$contact['name'], $contact['number']];
foreach (array_slice($columns, 2) as $column) //ignore first two columns as it's alway name & number foreach (\array_slice($columns, 2) as $column)
{ { //ignore first two columns as it's alway name & number
//If their is no data for this column key, we set '' to ignore //If their is no data for this column key, we set '' to ignore
if (!isset($data[$column])) if (!isset($data[$column]))
{ {
$line[] = ''; $line[] = '';
continue; continue;
} }

View File

@ -100,7 +100,7 @@ class Mailer extends \descartes\Controller
* *
* @param string $destination : email address to send email to * @param string $destination : email address to send email to
* @param array $settings : Email settings * @param array $settings : Email settings
* @param array $data : Data to inject into email template * @param array $data : Data to inject into email template
* *
* @return bool : true on success, false on error * @return bool : true on success, false on error
*/ */

View File

@ -55,9 +55,9 @@ namespace controllers\internals;
/** /**
* Create a phone. * Create a phone.
* *
* @param int $id_user : User to insert phone for * @param int $id_user : User to insert phone for
* @param string $name : The name of the phone * @param string $name : The name of the phone
* @param string $adapter : The adapter to use the phone * @param string $adapter : The adapter to use the phone
* @param string json $adapter_data : A JSON string representing adapter's data (for example credentials for an api) * @param string json $adapter_data : A JSON string representing adapter's data (for example credentials for an api)
* *
* @return bool|int : false on error, new id on success * @return bool|int : false on error, new id on success
@ -77,10 +77,10 @@ namespace controllers\internals;
/** /**
* Update a phone. * Update a phone.
* *
* @param int $id_user : User to insert phone for * @param int $id_user : User to insert phone for
* @param int $id : Phone id * @param int $id : Phone id
* @param string $name : The name of the phone * @param string $name : The name of the phone
* @param string $adapter : The adapter to use the phone * @param string $adapter : The adapter to use the phone
* @param array $adapter_data : An array of the data of the adapter (for example credentials for an api) * @param array $adapter_data : An array of the data of the adapter (for example credentials for an api)
* *
* @return bool : false on error, true on success * @return bool : false on error, true on success

View File

@ -35,7 +35,7 @@ use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
* Verify if a condition is valid. i.e we can evaluate it without error. * Verify if a condition is valid. i.e we can evaluate it without error.
* *
* @param string $condition : The condition to evaluate * @param string $condition : The condition to evaluate
* @param array $data : The data to made available to condition * @param array $data : The data to made available to condition
* *
* @return bool : false if invalid, true else * @return bool : false if invalid, true else
*/ */
@ -61,7 +61,7 @@ use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
* Evaluate a condition. * Evaluate a condition.
* *
* @param string $condition : The condition to evaluate * @param string $condition : The condition to evaluate
* @param array $data : The data to made available to condition * @param array $data : The data to made available to condition
* *
* @return ?bool : false if invalid, true else, null only on error * @return ?bool : false if invalid, true else, null only on error
*/ */

View File

@ -57,7 +57,7 @@ namespace controllers\internals;
* Render a string as a twig template. * Render a string as a twig template.
* *
* @param string $template : Template string * @param string $template : Template string
* @param array $data : Data to pass to the template * @param array $data : Data to pass to the template
* *
* @return array : keys, success, error, result * @return array : keys, success, error, result
*/ */

View File

@ -309,8 +309,8 @@ namespace controllers\publics;
/** /**
* Create a new phone. * Create a new phone.
* *
* @param string $_POST['name'] : Phone name * @param string $_POST['name'] : Phone name
* @param string $_POST['adapter'] : Phone adapter * @param string $_POST['adapter'] : Phone adapter
* @param array $_POST['adapter_data'] : Phone adapter data * @param array $_POST['adapter_data'] : Phone adapter data
* *
* @return int : id phone the new phone on success * @return int : id phone the new phone on success

View File

@ -157,8 +157,8 @@ class Phone extends \descartes\Controller
* Create a new phone. * Create a new phone.
* *
* @param $csrf : CSRF token * @param $csrf : CSRF token
* @param string $_POST['name'] : Phone name * @param string $_POST['name'] : Phone name
* @param string $_POST['adapter'] : Phone adapter * @param string $_POST['adapter'] : Phone adapter
* @param array $_POST['adapter_data'] : Phone adapter data * @param array $_POST['adapter_data'] : Phone adapter data
*/ */
public function create($csrf) public function create($csrf)

View File

@ -96,8 +96,8 @@ namespace controllers\publics;
/** /**
* Cette fonction retourne la page d'ajout d'un scheduled. * Cette fonction retourne la page d'ajout d'un scheduled.
* *
* @param array? int $contacts_ids : Ids of contacts to prefilled * @param array? int $contacts_ids : Ids of contacts to prefilled
* @param array? int $groups_ids : Ids of groups to prefilled * @param array? int $groups_ids : Ids of groups to prefilled
* @param array? int $conditional_groups_ids : Ids of conditional groups to prefilled * @param array? int $conditional_groups_ids : Ids of conditional groups to prefilled
* @param $prefilled : If we have prefilled some fields (possible values : 'contacts', 'groups', 'conditional_groups', false) * @param $prefilled : If we have prefilled some fields (possible values : 'contacts', 'groups', 'conditional_groups', false)
*/ */
@ -112,9 +112,9 @@ namespace controllers\publics;
$contacts = $this->internal_contact->gets_for_user($id_user); $contacts = $this->internal_contact->gets_for_user($id_user);
$phones = $this->internal_phone->gets_for_user($id_user); $phones = $this->internal_phone->gets_for_user($id_user);
$contact_ids = (isset($_GET['contact_ids']) && is_array($_GET['contact_ids'])) ? $_GET['contact_ids'] : []; $contact_ids = (isset($_GET['contact_ids']) && \is_array($_GET['contact_ids'])) ? $_GET['contact_ids'] : [];
$group_ids = (isset($_GET['group_ids']) && is_array($_GET['group_ids'])) ? $_GET['group_ids'] : []; $group_ids = (isset($_GET['group_ids']) && \is_array($_GET['group_ids'])) ? $_GET['group_ids'] : [];
$conditional_group_ids = (isset($_GET['conditional_group_ids']) && is_array($_GET['conditional_group_ids'])) ? $_GET['conditional_group_ids'] : []; $conditional_group_ids = (isset($_GET['conditional_group_ids']) && \is_array($_GET['conditional_group_ids'])) ? $_GET['conditional_group_ids'] : [];
$prefilled_contacts = []; $prefilled_contacts = [];
$prefilled_groups = []; $prefilled_groups = [];

View File

@ -188,7 +188,7 @@ namespace models;
* *
* @param int $id_user : User id * @param int $id_user : User id
* @param int $id : Entry id * @param int $id : Entry id
* @param array $data : data to update * @param array $data : data to update
* *
* @return int : number of modified rows * @return int : number of modified rows
*/ */

View File

@ -154,7 +154,7 @@ namespace models;
* *
* @param int $id_user : User id * @param int $id_user : User id
* @param int $id : Entry id * @param int $id : Entry id
* @param array $data : data to update * @param array $data : data to update
* *
* @return int : number of modified rows * @return int : number of modified rows
*/ */
@ -166,7 +166,7 @@ namespace models;
/** /**
* Update a entry by his id. * Update a entry by his id.
* *
* @param int $id : Entry id * @param int $id : Entry id
* @param array $data : data to update * @param array $data : data to update
* *
* @return int : number of modified rows * @return int : number of modified rows

View File

@ -95,7 +95,7 @@ namespace models;
/** /**
* Update a user using his is. * Update a user using his is.
* *
* @param int $id : User id * @param int $id : User id
* @param array $data : Data to update * @param array $data : Data to update
* *
* @return int : number of modified rows * @return int : number of modified rows

View File

@ -25,7 +25,7 @@ $config = PhpCsFixer\Config::create()
'@PHP56Migration' => true, '@PHP56Migration' => true,
'@PHPUnit60Migration:risky' => true, '@PHPUnit60Migration:risky' => true,
'@PhpCsFixer' => true, '@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true, '@PhpCsFixer:risky' => false,
'header_comment' => ['header' => $header], 'header_comment' => ['header' => $header],
'list_syntax' => ['syntax' => 'long'], 'list_syntax' => ['syntax' => 'long'],
'array_syntax' => ['syntax' => 'short'], 'array_syntax' => ['syntax' => 'short'],