mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-21 08:56:27 +02:00
fix style
This commit is contained in:
parent
296fbd61e8
commit
3b662c1153
24 changed files with 57 additions and 58 deletions
|
@ -71,8 +71,6 @@ namespace controllers\internals;
|
|||
* Check if a user exists based on email.
|
||||
*
|
||||
* @param string $email : User email
|
||||
*
|
||||
* @return void : exit code 1 on false, 0 else
|
||||
*/
|
||||
public function user_exists(string $email)
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace controllers\internals;
|
|||
* @param int $id_user : User id
|
||||
* @param string $number : Contact number
|
||||
* @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
|
||||
*/
|
||||
|
@ -91,7 +91,7 @@ namespace controllers\internals;
|
|||
* @param int $id : Contact id
|
||||
* @param string $number : Contact number
|
||||
* @param string $name : Contact name
|
||||
* @param ?string $data : Contact data
|
||||
* @param ?string $data : Contact data
|
||||
*
|
||||
* @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
|
||||
//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);
|
||||
if (false === $line)
|
||||
|
@ -282,15 +282,16 @@ namespace controllers\internals;
|
|||
$data = json_decode($contact['data'], true);
|
||||
|
||||
$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 (!isset($data[$column]))
|
||||
{
|
||||
$line[] = '';
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$line[] = $data[$column];
|
||||
}
|
||||
$lines[] = $line;
|
||||
|
|
|
@ -27,7 +27,7 @@ class ExpressionProvider implements ExpressionFunctionProviderInterface
|
|||
{
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
//Exists must be personnalized because it inverse is_null
|
||||
$exists = new ExpressionFunction('exists', function ($str)
|
||||
{
|
||||
|
|
|
@ -100,7 +100,7 @@ class Mailer extends \descartes\Controller
|
|||
*
|
||||
* @param string $destination : email address to send email to
|
||||
* @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
|
||||
*/
|
||||
|
|
|
@ -55,9 +55,9 @@ namespace controllers\internals;
|
|||
/**
|
||||
* Create a phone.
|
||||
*
|
||||
* @param int $id_user : User to insert phone for
|
||||
* @param string $name : The name of the phone
|
||||
* @param string $adapter : The adapter to use the phone
|
||||
* @param int $id_user : User to insert phone for
|
||||
* @param string $name : The name of 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)
|
||||
*
|
||||
* @return bool|int : false on error, new id on success
|
||||
|
@ -77,10 +77,10 @@ namespace controllers\internals;
|
|||
/**
|
||||
* Update a phone.
|
||||
*
|
||||
* @param int $id_user : User to insert phone for
|
||||
* @param int $id : Phone id
|
||||
* @param string $name : The name of the phone
|
||||
* @param string $adapter : The adapter to use the phone
|
||||
* @param int $id_user : User to insert phone for
|
||||
* @param int $id : Phone id
|
||||
* @param string $name : The name of 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)
|
||||
*
|
||||
* @return bool : false on error, true on success
|
||||
|
|
|
@ -35,7 +35,7 @@ use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
|||
* Verify if a condition is valid. i.e we can evaluate it without error.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
|
@ -61,7 +61,7 @@ use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
|||
* Evaluate a condition.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace controllers\internals;
|
|||
* Render a string as a twig template.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
|
|
|
@ -126,10 +126,10 @@ class Webhook extends StandardController
|
|||
{
|
||||
$timestamp = time();
|
||||
$webhook_random_id = $timestamp . '-' . bin2hex(openssl_random_pseudo_bytes(16));
|
||||
|
||||
|
||||
//signature is hexa string representing hmac sha256 of webhook_random_id
|
||||
$webhook_signature = hash_hmac(self::HMAC_ALGO, $webhook_random_id, $user['api_key']);
|
||||
|
||||
|
||||
$message = [
|
||||
'url' => $webhook['url'],
|
||||
'data' => [
|
||||
|
|
|
@ -309,8 +309,8 @@ namespace controllers\publics;
|
|||
/**
|
||||
* Create a new phone.
|
||||
*
|
||||
* @param string $_POST['name'] : Phone name
|
||||
* @param string $_POST['adapter'] : Phone adapter
|
||||
* @param string $_POST['name'] : Phone name
|
||||
* @param string $_POST['adapter'] : Phone adapter
|
||||
* @param array $_POST['adapter_data'] : Phone adapter data
|
||||
*
|
||||
* @return int : id phone the new phone on success
|
||||
|
|
|
@ -157,8 +157,8 @@ class Phone extends \descartes\Controller
|
|||
* Create a new phone.
|
||||
*
|
||||
* @param $csrf : CSRF token
|
||||
* @param string $_POST['name'] : Phone name
|
||||
* @param string $_POST['adapter'] : Phone adapter
|
||||
* @param string $_POST['name'] : Phone name
|
||||
* @param string $_POST['adapter'] : Phone adapter
|
||||
* @param array $_POST['adapter_data'] : Phone adapter data
|
||||
*/
|
||||
public function create($csrf)
|
||||
|
|
|
@ -96,8 +96,8 @@ namespace controllers\publics;
|
|||
/**
|
||||
* Cette fonction retourne la page d'ajout d'un scheduled.
|
||||
*
|
||||
* @param array? int $contacts_ids : Ids of contacts to prefilled
|
||||
* @param array? int $groups_ids : Ids of groups 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 $conditional_groups_ids : Ids of conditional groups to prefilled
|
||||
* @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);
|
||||
$phones = $this->internal_phone->gets_for_user($id_user);
|
||||
|
||||
$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'] : [];
|
||||
$conditional_group_ids = (isset($_GET['conditional_group_ids']) && is_array($_GET['conditional_group_ids'])) ? $_GET['conditional_group_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'] : [];
|
||||
$conditional_group_ids = (isset($_GET['conditional_group_ids']) && \is_array($_GET['conditional_group_ids'])) ? $_GET['conditional_group_ids'] : [];
|
||||
|
||||
$prefilled_contacts = [];
|
||||
$prefilled_groups = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue