Skip to content

Commit b3c3e8f

Browse files
committed
style: formattazione stile codice
1 parent 9f13a96 commit b3c3e8f

146 files changed

Lines changed: 1678 additions & 1688 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/index.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,20 @@ function serverError()
3333
}
3434

3535
// Gestione degli errori
36-
set_error_handler('serverError');
37-
register_shutdown_function('serverError');
36+
set_error_handler(serverError(...));
37+
register_shutdown_function(serverError(...));
3838

3939
include_once __DIR__.'/../core.php';
4040

4141
// Rate limiting per API (se abilitato)
42-
if (($config['rate_limiting']['enabled'] ?? false)) {
43-
[$ok] = \Security\LaravelRateLimiter::enforce('api', $config);
42+
if ($config['rate_limiting']['enabled'] ?? false) {
43+
[$ok] = Security\LaravelRateLimiter::enforce('api', $config);
4444
if (!$ok) {
4545
http_response_code(429);
4646
exit('Too Many Requests');
4747
}
4848
}
4949

50-
5150
// Permesso di accesso all'API da ogni dispositivo
5251
header('Access-Control-Allow-Origin: *');
5352
header('Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS');
@@ -70,20 +69,20 @@ function serverError()
7069

7170
$result = json_decode((string) $response, true);
7271
$level = ($result['status'] == '200' ? 'info' : 'error');
73-
$type = [ 'GET' => 'retrieve', 'POST' => 'create', 'PUT' => 'update', 'DELETE' => 'delete', ];
72+
$type = ['GET' => 'retrieve', 'POST' => 'create', 'PUT' => 'update', 'DELETE' => 'delete'];
7473

75-
//Ricavo l'id della richiesta API
74+
// Ricavo l'id della richiesta API
7675
$api = $dbo->table('zz_api_resources')
7776
->where('resource', $info['resource'])
7877
->where('type', $type[$_SERVER['REQUEST_METHOD']])
7978
->first();
8079

81-
//Salvataggio del log dell'operazione
80+
// Salvataggio del log dell'operazione
8281
OperationLog::setInfo('id_module', $info['id_module']);
8382
OperationLog::setInfo('id_api', $api->id);
8483
OperationLog::setInfo('level', $level);
8584

86-
//Aggiungo il contenuto della richiesta
85+
// Aggiungo il contenuto della richiesta
8786
$context = [
8887
'token' => get('token'),
8988
'resource' => get('resource'),
@@ -92,19 +91,19 @@ function serverError()
9291
];
9392
OperationLog::setInfo('context', json_encode($context));
9493

95-
//Aggiungo al log il messaggio completo di risposta
96-
if( ($result['status']=='200' && setting('Log risposte API')=='debug') || $result['status']!='200' ){
94+
// Aggiungo al log il messaggio completo di risposta
95+
if (($result['status'] == '200' && setting('Log risposte API') == 'debug') || $result['status'] != '200') {
9796
$message = json_encode($result);
9897
OperationLog::setInfo('message', $message);
9998
}
10099

101-
//Salvo l'id_record se presente nella risposta
102-
if( !empty($result['id']) ){
100+
// Salvo l'id_record se presente nella risposta
101+
if (!empty($result['id'])) {
103102
OperationLog::setInfo('id_record', $result['id']);
104103
}
105104

106105
$op = ($result['op'] ?: $type[$_SERVER['REQUEST_METHOD']]);
107-
$result['op'] = ($op=='create' ? 'add' : ($op=='retrieve' ? 'read' : $op));
106+
$result['op'] = ($op == 'create' ? 'add' : ($op == 'retrieve' ? 'read' : $op));
108107
OperationLog::build($result['op']);
109108

110109
json_decode((string) $response);

config.example.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
// Configura il limite di tempo di esecuzione del file cron.php
7272
$php_time_limit = '';
7373

74-
7574
// Integrazione con Laravel per Rate limiting
7675
$rate_limiting = [
7776
'enabled' => false,

include/common/riga.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,18 @@ function aggiorna_guadagno() {
259259
{[ "type": "date", "label": "'.tr('Data fine competenza').'", "name": "data_fine_competenza", "value": "'.$result['data_fine_competenza'].'" ]}
260260
</div>';
261261

262-
if (isset($result['type']) && isset($result['id'])) {
263-
$riga = $result['type']::find($result['id']);
264-
if ($riga->hasDifferentOriginalDateCompetenza()) {
265-
echo '
262+
if (isset($result['type']) && isset($result['id'])) {
263+
$riga = $result['type']::find($result['id']);
264+
if ($riga->hasDifferentOriginalDateCompetenza()) {
265+
echo '
266266
<div class="col-md-4">
267267
<div class="alert alert-danger">
268268
<i class="fa fa-warning"></i> '.tr('Attenzione! Le date di competenza non coincidono con le date della riga di origine.').'
269269
</div>
270270
</div>';
271-
}
272-
}
273-
echo '
271+
}
272+
}
273+
echo '
274274
</div>';
275275

276276
// Data prevista evasione (per ordini)
@@ -427,4 +427,4 @@ function controlla_sconto() {
427427
}
428428
});
429429
});
430-
</script>';
430+
</script>';

include/init/requirements.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@
418418
$cron_check = [];
419419
if ($database->isInstalled()) {
420420
try {
421-
$ultima_esecuzione = \Models\Cache::where('name', 'Ultima esecuzione del cron')->first()->content;
421+
$ultima_esecuzione = Models\Cache::where('name', 'Ultima esecuzione del cron')->first()->content;
422422

423423
if (!$ultima_esecuzione) {
424424
$cron_status = 0;
@@ -491,7 +491,7 @@
491491
foreach ($statuses as $status) {
492492
$general_status &= $status;
493493
if (!$status) {
494-
$error_count++;
494+
++$error_count;
495495
}
496496
}
497497

include/top.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,8 @@
506506
507507
<!-- Main Sidebar Container -->
508508
<aside class="main-sidebar '.$theme.' elevation-4">
509-
<a href="'.tr('https://www.openstamanager.com').'" class="brand-link" title="'.tr("Il gestionale open source per l'assistenza tecnica e la fatturazione elettronica"). '" target="_blank">
510-
<img src="' . App::getPaths()['img'] . '/'.(!empty($hide_sidebar) ? 'logo.png' : 'logo_completo.png').'" class="brand-image" alt="'.tr("Il gestionale open source per l'assistenza tecnica e la fatturazione elettronica").'" id="sidebar-logo">
509+
<a href="'.tr('https://www.openstamanager.com').'" class="brand-link" title="'.tr("Il gestionale open source per l'assistenza tecnica e la fatturazione elettronica").'" target="_blank">
510+
<img src="'.App::getPaths()['img'].'/'.(!empty($hide_sidebar) ? 'logo.png' : 'logo_completo.png').'" class="brand-image" alt="'.tr("Il gestionale open source per l'assistenza tecnica e la fatturazione elettronica").'" id="sidebar-logo">
511511
<span class="brand-text font-weight-light">&nbsp;</span>
512512
513513
</a>

info.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
echo '
3030
<div class="card">
3131
<div class="card-header">
32-
<img src="' . App::getPaths()['img'] . '/logo_completo.png" class="pull-left img-responsive" width="300" alt="'.tr('OSM Logo').'">
32+
<img src="'.App::getPaths()['img'].'/logo_completo.png" class="pull-left img-responsive" width="300" alt="'.tr('OSM Logo').'">
3333
<div class="float-right d-none d-sm-inline">
3434
<i class="fa fa-info"></i> '.tr('Informazioni').'
3535
</div>

lib/util.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ function adjustBrightness($hexCode, $adjustPercent)
585585
$hexCode = $hexCode[0].$hexCode[0].$hexCode[1].$hexCode[1].$hexCode[2].$hexCode[2];
586586
}
587587

588-
$hexCode = array_map('hexdec', str_split($hexCode, 2));
588+
$hexCode = array_map(hexdec(...), str_split($hexCode, 2));
589589

590590
foreach ($hexCode as &$color) {
591591
$adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;

modules/aggiornamenti/actions.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@
143143
echo $versione ?: 'none';
144144
} catch (Exception $e) {
145145
// Log dell'errore per debug
146-
error_log('Errore verifica aggiornamenti: ' . $e->getMessage());
146+
error_log('Errore verifica aggiornamenti: '.$e->getMessage());
147147

148148
// Restituisce un messaggio di errore specifico
149149
http_response_code(500);
150150
echo json_encode([
151151
'error' => true,
152-
'message' => tr('Errore durante la verifica degli aggiornamenti: _ERROR_', ['_ERROR_' => $e->getMessage()])
152+
'message' => tr('Errore durante la verifica degli aggiornamenti: _ERROR_', ['_ERROR_' => $e->getMessage()]),
153153
]);
154154
}
155155

@@ -273,13 +273,13 @@
273273

274274
// Recupera l'ultima esecuzione da zz_operations
275275
// Cerca nel campo options che contiene JSON con controllo_name
276-
$query = "SELECT created_at, id_utente FROM zz_operations WHERE options LIKE ? ORDER BY created_at DESC LIMIT 1";
277-
$operation = $database->fetchOne($query, ['%"controllo_name":"' . $nome_controllo . '"%']);
276+
$query = 'SELECT created_at, id_utente FROM zz_operations WHERE options LIKE ? ORDER BY created_at DESC LIMIT 1';
277+
$operation = $database->fetchOne($query, ['%"controllo_name":"'.$nome_controllo.'"%']);
278278

279279
// Recupera il nome dell'utente se disponibile
280280
$user_name = null;
281281
if ($operation && $operation['id_utente']) {
282-
$user_query = "SELECT username FROM zz_users WHERE id = ?";
282+
$user_query = 'SELECT username FROM zz_users WHERE id = ?';
283283
$user = $database->fetchOne($user_query, [$operation['id_utente']]);
284284
$user_name = $user ? $user['username'] : null;
285285
}

0 commit comments

Comments
 (0)