mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-06-06 22:56:27 +02:00
Fix few bad var
This commit is contained in:
parent
73b82296a7
commit
89cb3db678
7 changed files with 25 additions and 21 deletions
|
@ -262,7 +262,7 @@ namespace controllers\internals;
|
|||
];
|
||||
|
||||
$internal_webhook = new Webhook($this->bdd);
|
||||
$internal_webhook->trigger($id_user, \models\Webhook::TYPE_RECEIVE, $sended);
|
||||
$internal_webhook->trigger($id_user, \models\Webhook::TYPE_RECEIVE, $received);
|
||||
|
||||
$internal_user = new User($this->bdd);
|
||||
$internal_user->transfer_received($id_user, $received);
|
||||
|
|
|
@ -15,8 +15,12 @@ namespace controllers\internals;
|
|||
{
|
||||
protected $bdd;
|
||||
|
||||
public function __construct(\PDO $bdd)
|
||||
public function __construct(?\PDO $bdd = null)
|
||||
{
|
||||
if ($bdd === null)
|
||||
{
|
||||
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
|
||||
}
|
||||
$this->bdd = $bdd;
|
||||
}
|
||||
|
||||
|
|
|
@ -222,23 +222,23 @@ namespace controllers\internals;
|
|||
'status' => $status,
|
||||
];
|
||||
|
||||
$new_user_id = $this->model_user->insert($user);
|
||||
$new_id_user = $this->model_user->insert($user);
|
||||
|
||||
if (!$new_user_id)
|
||||
if (!$new_id_user)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$success = $this->internal_setting->create_defaults_for_user($new_user_id);
|
||||
$success = $this->internal_setting->create_defaults_for_user($new_id_user);
|
||||
|
||||
if (!$success)
|
||||
{
|
||||
$this->delete($new_user_id);
|
||||
$this->delete($new_id_user);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $new_user_id;
|
||||
return $new_id_user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -265,10 +265,10 @@ namespace controllers\internals;
|
|||
*
|
||||
* @return bool : False if no transfer, true else
|
||||
*/
|
||||
public function transfer_received (int $id_user, array $received) :
|
||||
public function transfer_received (int $id_user, array $received) : bool
|
||||
{
|
||||
$internal_setting = new Setting($this->bdd);
|
||||
$settings = $internal_setting->gets_for_user($user_id);
|
||||
$settings = $internal_setting->gets_for_user($id_user);
|
||||
|
||||
if (!$settings['transfer'] ?? false)
|
||||
{
|
||||
|
|
|
@ -90,7 +90,7 @@ class Webhook extends StandardController
|
|||
|
||||
/**
|
||||
* Trigger a webhook and transmit the signal to webhook daemon if needed.
|
||||
* @param int $user_id : User to trigger the webhook for
|
||||
* @param int $id_user : User to trigger the webhook for
|
||||
* @param string $type : Type of webhook to trigger
|
||||
* @param array $sms : The sms [
|
||||
* int 'id' => SMS id,
|
||||
|
@ -101,10 +101,10 @@ class Webhook extends StandardController
|
|||
* ]
|
||||
* @return bool : False if no trigger, true else
|
||||
*/
|
||||
private function trigger (int $user_id, string $type, array $sms)
|
||||
public function trigger (int $id_user, string $type, array $sms)
|
||||
{
|
||||
$internal_setting = new Setting($this->bdd);
|
||||
$settings = $internal_setting->gets_for_user($user_id);
|
||||
$settings = $internal_setting->gets_for_user($id_user);
|
||||
|
||||
if (!$settings['webhook'] ?? false)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue