mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-06-07 07:06:26 +02:00
fix style
This commit is contained in:
parent
cc233f726a
commit
aac464704e
34 changed files with 147 additions and 107 deletions
|
@ -307,18 +307,18 @@ namespace controllers\publics;
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a new phone
|
||||
*
|
||||
* @param string $_POST['name'] : Phone name
|
||||
* @param string $_POST['adapter'] : Phone adapter
|
||||
* @param array $_POST['adapter_datas'] : Phone adapter datas
|
||||
* Create a new phone.
|
||||
*
|
||||
* @param string $_POST['name'] : Phone name
|
||||
* @param string $_POST['adapter'] : Phone adapter
|
||||
* @param array $_POST['adapter_datas'] : Phone adapter datas
|
||||
*
|
||||
* @return int : id phone the new phone on success
|
||||
*/
|
||||
public function post_phone()
|
||||
{
|
||||
$return = self::DEFAULT_RETURN;
|
||||
|
||||
|
||||
$name = $_POST['name'] ?? false;
|
||||
$adapter = $_POST['adapter'] ?? false;
|
||||
$adapter_datas = !empty($_POST['adapter_datas']) ? $_POST['adapter_datas'] : [];
|
||||
|
@ -331,7 +331,7 @@ namespace controllers\publics;
|
|||
|
||||
return $this->json($return);
|
||||
}
|
||||
|
||||
|
||||
if (!$adapter)
|
||||
{
|
||||
$return['error'] = self::ERROR_CODES['MISSING_PARAMETER'];
|
||||
|
@ -409,7 +409,7 @@ namespace controllers\publics;
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$return['error'] = self::ERROR_CODES['INVALID_PARAMETER'];
|
||||
$return['message'] = self::ERROR_MESSAGES['INVALID_PARAMETER'] . ' field ' . $field['name'] . ' is not a valid phone number.';
|
||||
$this->auto_http_code(false);
|
||||
|
@ -434,7 +434,7 @@ namespace controllers\publics;
|
|||
}
|
||||
|
||||
$phone_id = $this->internal_phone->create($this->user['id'], $name, $adapter, $adapter_datas);
|
||||
if ($phone_id === false)
|
||||
if (false === $phone_id)
|
||||
{
|
||||
$return['error'] = self::ERROR_CODES['CANNOT_CREATE'];
|
||||
$return['message'] = self::ERROR_MESSAGES['CANNOT_CREATE'];
|
||||
|
@ -445,10 +445,10 @@ namespace controllers\publics;
|
|||
|
||||
$return['response'] = $phone_id;
|
||||
$this->auto_http_code(true);
|
||||
|
||||
|
||||
return $this->json($return);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a phone.
|
||||
*
|
||||
|
|
|
@ -52,6 +52,7 @@ use Monolog\Logger;
|
|||
http_response_code(401);
|
||||
echo json_encode(['error' => 'Invalid API key. You must provide a valid GET or POST api_key param.']);
|
||||
$this->logger->error('Callback call failed with invalid api key : ' . $api_key);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ namespace controllers\publics;
|
|||
{
|
||||
$this->render('command/list');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return commands as json
|
||||
* Return commands as json.
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
|
|
@ -48,9 +48,9 @@ namespace controllers\publics;
|
|||
{
|
||||
$this->render('conditional_group/list');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return conditionnals groups as json
|
||||
* Return conditionnals groups as json.
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
|
|
@ -42,9 +42,9 @@ namespace controllers\publics;
|
|||
{
|
||||
return $this->render('contact/list');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return contacts as json
|
||||
* Return contacts as json.
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
@ -288,16 +288,19 @@ namespace controllers\publics;
|
|||
|
||||
//Try to import file
|
||||
$invalid_type = false;
|
||||
|
||||
switch ($read_file['mime_type'])
|
||||
{
|
||||
case 'text/csv':
|
||||
$result = $this->internal_contact->import_csv($id_user, $read_file['content']);
|
||||
|
||||
break;
|
||||
|
||||
case 'application/json':
|
||||
$result = $this->internal_contact->import_json($id_user, $read_file['content']);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$invalid_type = true;
|
||||
}
|
||||
|
@ -338,16 +341,19 @@ namespace controllers\publics;
|
|||
|
||||
//Try to export contacts
|
||||
$invalid_type = false;
|
||||
|
||||
switch ($format)
|
||||
{
|
||||
case 'csv':
|
||||
$result = $this->internal_contact->export_csv($id_user);
|
||||
|
||||
break;
|
||||
|
||||
case 'json':
|
||||
$result = $this->internal_contact->export_json($id_user);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$invalid_type = true;
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ namespace controllers\publics;
|
|||
{
|
||||
$this->render('discussion/list');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return discussions as json
|
||||
* Return discussions as json.
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace controllers\publics;
|
|||
}
|
||||
|
||||
/**
|
||||
* Return events as json
|
||||
* Return events as json.
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ namespace controllers\publics;
|
|||
|
||||
return $this->redirect(\descartes\Router::url('Event', 'list'));
|
||||
}
|
||||
|
||||
|
||||
if (!\controllers\internals\Tool::is_admin())
|
||||
{
|
||||
\FlashMessage\FlashMessage::push('danger', 'Vous devez être administrateur pour supprimer un event !');
|
||||
|
|
|
@ -44,10 +44,9 @@ namespace controllers\publics;
|
|||
{
|
||||
$this->render('group/list');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return groups as json
|
||||
* Return groups as json.
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
|
|
@ -73,7 +73,7 @@ class Phone extends \descartes\Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Return phones as json with additionnals datas about callbacks
|
||||
* Return phones as json with additionnals datas about callbacks.
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
|
|
@ -43,9 +43,9 @@ namespace controllers\publics;
|
|||
{
|
||||
$this->render('received/list', ['is_unread' => false]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return received as json
|
||||
* Return received as json.
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
@ -66,9 +66,9 @@ namespace controllers\publics;
|
|||
{
|
||||
$this->render('received/list', ['is_unread' => true]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return unred received as json
|
||||
* Return unred received as json.
|
||||
*/
|
||||
public function list_unread_json()
|
||||
{
|
||||
|
@ -83,15 +83,15 @@ namespace controllers\publics;
|
|||
}
|
||||
|
||||
/**
|
||||
* Mark messages as
|
||||
* Mark messages as.
|
||||
*
|
||||
* @param string $status : New status of the message, read or unread
|
||||
* @param string $status : New status of the message, read or unread
|
||||
* @param array int $_GET['ids'] : Ids of receiveds to delete
|
||||
* @param mixed $csrf
|
||||
*
|
||||
* @return boolean;
|
||||
*/
|
||||
public function mark_as ($status, $csrf)
|
||||
public function mark_as($status, $csrf)
|
||||
{
|
||||
if (!$this->verify_csrf($csrf))
|
||||
{
|
||||
|
@ -99,15 +99,15 @@ namespace controllers\publics;
|
|||
|
||||
return $this->redirect(\descartes\Router::url('Received', 'list'));
|
||||
}
|
||||
|
||||
|
||||
$ids = $_GET['ids'] ?? [];
|
||||
foreach ($ids as $id)
|
||||
{
|
||||
if ($status === \models\Received::STATUS_UNREAD)
|
||||
if (\models\Received::STATUS_UNREAD === $status)
|
||||
{
|
||||
$this->internal_received->mark_as_unread_for_user($_SESSION['user']['id'], $id);
|
||||
}
|
||||
elseif ($status === \models\Received::STATUS_READ)
|
||||
elseif (\models\Received::STATUS_READ === $status)
|
||||
{
|
||||
$this->internal_received->mark_as_read_for_user($_SESSION['user']['id'], $id);
|
||||
}
|
||||
|
|
|
@ -49,9 +49,9 @@ namespace controllers\publics;
|
|||
{
|
||||
$this->render('scheduled/list');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return scheduleds as json
|
||||
* Return scheduleds as json.
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace controllers\publics;
|
|||
}
|
||||
|
||||
/**
|
||||
* Return sendeds as json
|
||||
* Return sendeds as json.
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
@ -59,7 +59,6 @@ namespace controllers\publics;
|
|||
header('Content-Type: application/json');
|
||||
echo json_encode(['data' => $entities]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cette fonction va supprimer une liste de sendeds.
|
||||
|
|
|
@ -41,9 +41,9 @@ namespace controllers\publics;
|
|||
{
|
||||
$this->render('smsstop/list');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return smsstops as json
|
||||
* Return smsstops as json.
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
|
|
@ -70,8 +70,7 @@ namespace controllers\publics;
|
|||
|
||||
//Add metas of contact by adding contact without datas
|
||||
$metas = $contact;
|
||||
unset($metas['datas']);
|
||||
unset($metas['id_user']);
|
||||
unset($metas['datas'], $metas['id_user']);
|
||||
|
||||
$datas = [
|
||||
'contact' => $contact['datas'],
|
||||
|
|
|
@ -44,9 +44,9 @@ class User extends \descartes\Controller
|
|||
{
|
||||
$this->render('user/list');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return users as json
|
||||
* Return users as json.
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
|
|
@ -38,9 +38,9 @@ namespace controllers\publics;
|
|||
{
|
||||
$this->render('webhook/list');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return commands as json
|
||||
* Return commands as json.
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue