Fix php error

This commit is contained in:
osaajani 2020-01-17 18:36:53 +01:00
parent b8bd067dc7
commit 9de6697752
11 changed files with 20 additions and 9 deletions

View File

@ -92,7 +92,7 @@ namespace controllers\internals;
unlink($media['path']);
return $this->get_model()->delete_for_user($id_user, $id);
return $this->get_model()->delete_for_user($id_user, $id_media);
}
/**

View File

@ -13,6 +13,8 @@ namespace controllers\internals;
abstract class StandardController extends \descartes\InternalController
{
protected $bdd;
public function __construct(\PDO $bdd)
{
$this->bdd = $bdd;

View File

@ -18,6 +18,7 @@ namespace controllers\internals;
{
private $model_user;
private $internal_event;
private $internal_setting;
public function __construct(\PDO $bdd)
{

View File

@ -13,6 +13,7 @@ namespace controllers\internals;
class Webhook extends StandardController
{
protected $bdd;
protected $model;
/**

View File

@ -43,8 +43,10 @@ namespace controllers\publics;
private $internal_phone;
private $internal_received;
private $internal_sended;
private $internal_scheduled;
private $internal_contact;
private $internal_group;
private $internal_conditional_group;
private $user;
/**
@ -92,7 +94,7 @@ namespace controllers\publics;
* @param string $entry_type : Type of entries we want to list ['sended', 'received', 'scheduled', 'contact', 'group', 'conditional_group', 'phone']
* @param int $page : Pagination number, Default = 0. Group of 25 results.
*
* @return List of entries
* @return : List of entries
*/
public function get_entries(string $entry_type, int $page = 0)
{
@ -165,7 +167,7 @@ namespace controllers\publics;
* @param string $_POST['groups'] : Array of ids of groups to send message to
* @param string $_POST['conditional_groups'] : Array of ids of conditional groups to send message to
*
* @return Id of scheduled created
* @return : Id of scheduled created
*/
public function post_scheduled()
{
@ -225,7 +227,7 @@ namespace controllers\publics;
return false;
}
if ($origin && !$this->internal_phone->get_by_number_and_user($id_user, $origin))
if ($origin && !$this->internal_phone->get_by_number_and_user($this->user['id'], $origin))
{
$return = self::DEFAULT_RETURN;
$return['error'] = self::ERROR_CODES['INVALID_PARAMETER'];
@ -258,6 +260,7 @@ namespace controllers\publics;
* Delete a scheduled message.
*
* @param int $id : Id of scheduled message to delete
* @return bool : void
*/
public function delete_scheduled(int $id)
{
@ -271,5 +274,6 @@ namespace controllers\publics;
}
$this->auto_http_code(true);
return true;
}
}

View File

@ -34,7 +34,7 @@ namespace controllers\publics;
$this->internal_conditional_group = new \controllers\internals\ConditionalGroup($bdd);
$this->internal_contact = new \controllers\internals\Contact($bdd);
$this->internal_event = new \controllers\internals\Event($bdd);
$this->internal_ruler = new \controllers\internals\Ruler($bdd);
$this->internal_ruler = new \controllers\internals\Ruler();
\controllers\internals\Tool::verifyconnect();
}
@ -183,7 +183,7 @@ namespace controllers\publics;
*
* @param string $_POST['condition'] : Condition to apply
*
* @return json string
* @return mixed : False on error, json string ['success' => bool, 'result' => String with contacts]
*/
public function contacts_preview()
{

View File

@ -23,7 +23,7 @@ class Phone extends \descartes\Controller
{
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
$this->internal_phone = new \controllers\internals\Phone($bdd);
$this->internal_adapter = new \controllers\internals\Adapter($bdd);
$this->internal_adapter = new \controllers\internals\Adapter();
\controllers\internals\Tool::verifyconnect();
}

View File

@ -37,7 +37,7 @@ namespace controllers\publics;
* @param string $_POST['template'] : Template string
* @param int $_POST['id_contact'] : Id of the contact to render the template for
*
* @return json string
* @return mixed : False or json string ['success' => bool, 'result' => message]
*/
public function render_preview()
{

View File

@ -20,6 +20,7 @@ abstract class AbstractDaemon
protected $uniq;
protected $logger;
protected $no_parent;
protected $pid_dir;
private $is_running = true;
private $signals = [
SIGTERM,

View File

@ -118,7 +118,7 @@ class Phone extends AbstractDaemon
if (!$success && MSG_ENOMSG !== $error_code)
{
$this->logger->critical('Error reading MSG SEND Queue, error code : '.$error);
$this->logger->critical('Error reading MSG SEND Queue, error code : '.$error_code);
return false;
}

View File

@ -13,6 +13,8 @@
$analyse_commands = [
'php ' . __DIR__ . '/phpstan.phar analyse --configuration="'. __DIR__ .'/config.neon" --autoload-file=' . __DIR__ . '/../../descartes/load.php ' . __DIR__ . '/../../controllers/',
'php ' . __DIR__ . '/phpstan.phar analyse --configuration="'. __DIR__ .'/config.neon" --autoload-file=' . __DIR__ . '/../../descartes/load.php ' . __DIR__ . '/../../models/',
'php ' . __DIR__ . '/phpstan.phar analyse --configuration="'. __DIR__ .'/config.neon" --autoload-file=' . __DIR__ . '/../../descartes/load.php ' . __DIR__ . '/../../adapters/',
'php ' . __DIR__ . '/phpstan.phar analyse --configuration="'. __DIR__ .'/config.neon" --autoload-file=' . __DIR__ . '/../../descartes/load.php ' . __DIR__ . '/../../daemons/',
];