1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-06-05 22:09:38 +02:00

Formattazione codice

This commit is contained in:
Pek5892
2024-03-22 15:52:24 +01:00
parent bf34ae7051
commit 092e9880e8
472 changed files with 1968 additions and 2025 deletions

View File

@@ -19,9 +19,9 @@
include_once __DIR__.'/../../core.php';
use Models\User;
use Models\Module;
use Models\Group;
use Models\Module;
use Models\User;
$id_utente = filter('id_utente');
@@ -88,7 +88,7 @@ switch (filter('op')) {
$utente->password = $password;
}
} else {
$gruppo = Models\Group::find($id_record);
$gruppo = Group::find($id_record);
$utente = User::build($gruppo, $username, $email, $password);
}
@@ -151,10 +151,8 @@ switch (filter('op')) {
/* Controlla che non posso auto eliminarmi */
if (Auth::user()->id != $utente->id) {
/* Controlla che l'utente che voglio eliminare non presenti logs associati */
if (count($utente->logs)>0){
if (count($utente->logs) > 0) {
if ($dbo->query('DELETE FROM zz_users WHERE id='.prepare($id_utente))) {
flash()->info(tr('Utente eliminato!'));
@@ -162,27 +160,23 @@ switch (filter('op')) {
flash()->info(tr('Token eliminato!'));
}
}
}
else {
} else {
flash()->error(tr('L\'utente _USER_ presenta dei log attivi. Impossibile eliminare utente.', ['_USER_' => $utente->username]));
$dbo->update('zz_users', [
'enabled' => 0,
], ['id' => $id_utente]);
flash()->info(tr('Utente disabilitato!'));
if ($dbo->query('DELETE FROM zz_tokens WHERE id_utente='.prepare($id_utente))) {
flash()->info(tr('Token eliminato!'));
} flash()->info(tr('Token eliminato!'));
}
}else{
flash()->error(tr('L\'utente _USER_ è l\'utente attuale. Impossibile eliminare utente.', ['_USER_' => $utente->username]));
} else {
flash()->error(tr('L\'utente _USER_ è l\'utente attuale. Impossibile eliminare utente.', ['_USER_' => $utente->username]));
}
break;
// Abilita API utente

View File

@@ -21,7 +21,7 @@ include_once __DIR__.'/../../../core.php';
switch ($resource) {
case 'anagrafiche_utenti':
$query = 'SELECT `an_anagrafiche`.`idanagrafica` AS id, `an_anagrafiche`.`ragione_sociale` AS descrizione, `an_tipianagrafiche_lang`.`name` AS optgroup FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id`=`an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang`='.prepare(\Models\Locale::getDefault()->id).') INNER JOIN `an_tipianagrafiche_anagrafiche` ON `an_tipianagrafiche`.`id`=`an_tipianagrafiche_anagrafiche`.`idtipoanagrafica` INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` |where| ORDER BY `optgroup` ASC';
$query = 'SELECT `an_anagrafiche`.`idanagrafica` AS id, `an_anagrafiche`.`ragione_sociale` AS descrizione, `an_tipianagrafiche_lang`.`name` AS optgroup FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id`=`an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang`='.prepare(Models\Locale::getDefault()->id).') INNER JOIN `an_tipianagrafiche_anagrafiche` ON `an_tipianagrafiche`.`id`=`an_tipianagrafiche_anagrafiche`.`idtipoanagrafica` INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` |where| ORDER BY `optgroup` ASC';
$where[] = '`an_anagrafiche`.`deleted_at` IS NULL';
@@ -70,7 +70,7 @@ switch ($resource) {
LEFT JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `zz_users`.`idanagrafica`
INNER JOIN `an_tipianagrafiche_anagrafiche` ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica`
INNER JOIN `an_tipianagrafiche` ON `an_tipianagrafiche`.`id`=`an_tipianagrafiche_anagrafiche`.`idtipoanagrafica`
LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id`=`an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang`=".prepare(\Models\Locale::getDefault()->id).')
LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id`=`an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang`=".prepare(Models\Locale::getDefault()->id).')
|where|
ORDER BY
`optgroup` ASC';
@@ -117,7 +117,7 @@ switch ($resource) {
break;
case 'gruppi':
$query = 'SELECT `zz_groups`.`id`, `zz_groups_lang`.`name` AS descrizione FROM `zz_groups` LEFT JOIN `zz_groups_lang` ON `zz_groups`.`id`=`zz_groups_lang`.`id_record` AND `zz_groups_lang`.`id_lang`='.prepare(\Models\Locale::getDefault()->id).' |where| ORDER BY `name`';
$query = 'SELECT `zz_groups`.`id`, `zz_groups_lang`.`name` AS descrizione FROM `zz_groups` LEFT JOIN `zz_groups_lang` ON `zz_groups`.`id`=`zz_groups_lang`.`id_record` AND `zz_groups_lang`.`id_lang`='.prepare(Models\Locale::getDefault()->id).' |where| ORDER BY `name`';
foreach ($elements as $element) {
$filter[] = '`zz_groups`.`id`='.prepare($element);
@@ -129,7 +129,7 @@ switch ($resource) {
break;
case 'moduli_gruppo':
$query = 'SELECT `zz_modules`.`id`, `zz_modules_lang`.`title` AS descrizione FROM `zz_modules` LEFT JOIN `zz_modules_lang` ON `zz_modules`.`id`=`zz_modules_lang`.`id_record` AND `zz_modules_lang`.`id_lang`='.prepare(\Models\Locale::getDefault()->id).' LEFT JOIN `zz_permissions` ON `zz_permissions`.`idmodule`=`zz_modules`.`id` |where| GROUP BY `zz_modules`.`id` ORDER BY `title`';
$query = 'SELECT `zz_modules`.`id`, `zz_modules_lang`.`title` AS descrizione FROM `zz_modules` LEFT JOIN `zz_modules_lang` ON `zz_modules`.`id`=`zz_modules_lang`.`id_record` AND `zz_modules_lang`.`id_lang`='.prepare(Models\Locale::getDefault()->id).' LEFT JOIN `zz_permissions` ON `zz_permissions`.`idmodule`=`zz_modules`.`id` |where| GROUP BY `zz_modules`.`id` ORDER BY `title`';
$where[] = '`zz_modules`.`enabled`=1';

View File

@@ -18,8 +18,8 @@
*/
include_once __DIR__.'/../../core.php';
use Models\Module;
use Models\Group;
use Models\Module;
if (!empty(filter('idanagrafica'))) {
$utente['id_anagrafica'] = filter('idanagrafica');

View File

@@ -19,14 +19,14 @@
include_once __DIR__.'/../../core.php';
$utenti = $dbo->fetchArray('SELECT *, (SELECT `ragione_sociale` FROM `an_anagrafiche` WHERE `an_anagrafiche`.`idanagrafica`=`zz_users`.`idanagrafica` ) AS `ragione_sociale`, (SELECT GROUP_CONCAT(`name` SEPARATOR ", ") FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche_lang`.`id_record` = `an_tipianagrafiche`.`id` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(\Models\Locale::getDefault()->id).') INNER JOIN `an_tipianagrafiche_anagrafiche` ON `an_tipianagrafiche`.`id`=`an_tipianagrafiche_anagrafiche`.`idtipoanagrafica` WHERE `idanagrafica`=`zz_users`.`idanagrafica` GROUP BY `idanagrafica`) AS tipo FROM `zz_users` WHERE `idgruppo`='.prepare($record['id']));
$utenti = $dbo->fetchArray('SELECT *, (SELECT `ragione_sociale` FROM `an_anagrafiche` WHERE `an_anagrafiche`.`idanagrafica`=`zz_users`.`idanagrafica` ) AS `ragione_sociale`, (SELECT GROUP_CONCAT(`name` SEPARATOR ", ") FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche_lang`.`id_record` = `an_tipianagrafiche`.`id` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') INNER JOIN `an_tipianagrafiche_anagrafiche` ON `an_tipianagrafiche`.`id`=`an_tipianagrafiche_anagrafiche`.`idtipoanagrafica` WHERE `idanagrafica`=`zz_users`.`idanagrafica` GROUP BY `idanagrafica`) AS tipo FROM `zz_users` WHERE `idgruppo`='.prepare($record['id']));
echo '
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">'.tr('Utenti del gruppo: _GROUP_', [
'_GROUP_' => $group->getTranslation('name'),
]).'</h3>
'_GROUP_' => $group->getTranslation('name'),
]).'</h3>
</div>
<div class="panel-body">
@@ -171,8 +171,8 @@ echo '
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">'.tr('Permessi del gruppo: _GROUP_', [
'_GROUP_' => $record['nome'],
]).((empty($record['editable']) && ($record['nome'] != 'Amministratori')) ? '<a class=\'clickable btn-xs pull-right ask\' data-msg="'.tr('Verranno reimpostati i permessi di default per il gruppo \''.$record['nome'].'\' ').'." data-class="btn btn-lg btn-warning" data-button="'.tr('Reimposta permessi').'" data-op="restore_permission" >'.tr('Reimposta permessi').'</a>' : '').'</h3>
'_GROUP_' => $record['nome'],
]).((empty($record['editable']) && ($record['nome'] != 'Amministratori')) ? '<a class=\'clickable btn-xs pull-right ask\' data-msg="'.tr('Verranno reimpostati i permessi di default per il gruppo \''.$record['nome'].'\' ').'." data-class="btn btn-lg btn-warning" data-button="'.tr('Reimposta permessi').'" data-op="restore_permission" >'.tr('Reimposta permessi').'</a>' : '').'</h3>
</div>
<div class="panel-body">';

View File

@@ -129,17 +129,17 @@ echo '
<div class="box-body">
<div>
<p>'.tr("Per _ANDROID_, scarica un'applicazione dedicata dal _LINK_", [
'_ANDROID_' => '<b>'.tr('Android').'</b>',
'_LINK_' => '<a href="https://play.google.com/store/search?q=iCalSync&c=apps" target="_blank">'.tr('Play Store').'</a>',
]).'.</p>
'_ANDROID_' => '<b>'.tr('Android').'</b>',
'_LINK_' => '<a href="https://play.google.com/store/search?q=iCalSync&c=apps" target="_blank">'.tr('Play Store').'</a>',
]).'.</p>
<p>'.tr("Per _APPLE_, puoi configurare un nuovo calendario dall'app standard del calendario", [
'_APPLE_' => '<b>'.tr('Apple').'</b>',
]).'.</p>
'_APPLE_' => '<b>'.tr('Apple').'</b>',
]).'.</p>
<p>'.tr('Per _PC_ e altri client di posta, considerare le relative funzionalità o eventuali plugin', [
'_PC_' => '<b>'.tr('PC').'</b>',
]).'.</p>
'_PC_' => '<b>'.tr('PC').'</b>',
]).'.</p>
</div>
</div>
</div>

View File

@@ -21,7 +21,7 @@ include_once __DIR__.'/../../core.php';
use Models\Group;
if (isset($id_record)) {
$record = $dbo->fetchOne('SELECT * FROM `zz_groups` LEFT JOIN `zz_groups_lang` ON (`zz_groups`.`id` = `zz_groups_lang`.`id_record` AND `zz_groups_lang`.`id_lang` = '.prepare(\Models\Locale::getDefault()->id).') WHERE `zz_groups`.`id`='.prepare($id_record));
$record = $dbo->fetchOne('SELECT * FROM `zz_groups` LEFT JOIN `zz_groups_lang` ON (`zz_groups`.`id` = `zz_groups_lang`.`id_record` AND `zz_groups_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `zz_groups`.`id`='.prepare($id_record));
$group = Group::find($id_record);
}

View File

@@ -32,13 +32,13 @@ switch ($name) {
['id', '<>', $id_record],
])->count() == 0;
$message = ($disponibile ? tr("L'username è disponibile") : tr("L'username _COD_ è già stato utilizzato", [ '_COD_' => $value ])).'.';
$message = ($disponibile ? tr("L'username è disponibile") : tr("L'username _COD_ è già stato utilizzato", ['_COD_' => $value])).'.';
$result = $disponibile;
// Lunghezza minima del nome utente (username)
$min_length_username = 4;
if (strlen($value) < $min_length_username) {
$message .= '<br>'.tr("Lunghezza dell'username non sufficiente: inserisci _MIN_ caratteri o più", ['_MIN_' => $min_length_username] ).'.';
$message .= '<br>'.tr("Lunghezza dell'username non sufficiente: inserisci _MIN_ caratteri o più", ['_MIN_' => $min_length_username]).'.';
$result = false;
}
@@ -55,7 +55,7 @@ switch ($name) {
// ['id', '<>', $id_record],
])->count() == 0;
$message = ($disponibile ? tr('Il nome del gruppo è disponibile') : tr('Il nome del gruppo _COD_ è già stato utilizzato', [ '_COD_' => $value ])).'.';
$message = ($disponibile ? tr('Il nome del gruppo è disponibile') : tr('Il nome del gruppo _COD_ è già stato utilizzato', ['_COD_' => $value])).'.';
$result = $disponibile;
$response = [
@@ -65,12 +65,11 @@ switch ($name) {
break;
case 'email':
$disponibile = User::where([
['email', $value],
['email', '<>', ''],
//['idanagrafica', '<>', $id_record],
// ['idanagrafica', '<>', $id_record],
])->count() == 0;
$result = $disponibile;
@@ -84,7 +83,6 @@ switch ($name) {
$errors[] = tr("L'email _COD_ non possiede un formato valido.", [
'_COD_' => $value,
]);
}
if (isset($check['smtp-check']) && empty($check['smtp-check'])) {