Correzioni minori di stile

This commit is contained in:
Dasc3er 2021-02-19 11:52:34 +01:00 committed by Thomas Zilio
parent a72c68909a
commit 9b09258261
20 changed files with 82 additions and 90 deletions

View File

@ -45,7 +45,7 @@ switch (filter('op')) {
}
if (!$found) {
$_SESSION[$array[0]][$array[1]][] = $value;
$_SESSION[$array[0]][$array[1]][] = $value;
}
// print_r($_SESSION[$array[0]][$array[1]]);

View File

@ -606,3 +606,17 @@ function apriTab(link) {
parent.find(".tab-pane").removeClass("active");
parent.find(".tab-pane#" + tab).addClass("active");
}
/**
*
* @param xhr
* @param error
* @param thrown
*/
function ajaxError(xhr, error, thrown) {
swal({
title: globals.translations.errorTitle,
html: globals.translations.errorMessage + (xhr.responseJSON ? ".<br><i>" + xhr.responseJSON.exception[0].message + "</i>" : ''),
type: "error",
});
}

View File

@ -88,8 +88,7 @@ if (filter('op') == 'send') {
}
redirect_legacy(base_url().'/bug.php');
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
}
$pageTitle = tr('Bug');

View File

@ -30,8 +30,7 @@ if (version_compare(phpversion(), $minimum) < 0) {
<p>Stai utilizzando la versione PHP '.phpversion().', non compatibile con OpenSTAManager.</p>
<p>Aggiorna PHP alla versione >= '.$minimum.'.</p>';
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
}
// Caricamento delle impostazioni personalizzabili
@ -55,8 +54,7 @@ $config = AppLegacy::getConfig();
if (!empty($config['redirectHTTPS']) && !isHTTPS(true)) {
header('HTTP/1.1 301 Moved Permanently');
header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
}
/* GESTIONE DEGLI ERRORI */
@ -167,7 +165,7 @@ if (!$continue && getURLPath() != slashes(base_url().'/index.php') && !Permissio
}
redirect_legacy(base_url().'/index.php');
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
}
/* INIZIALIZZAZIONE GENERALE */

View File

@ -110,8 +110,7 @@ if (post('db_host') !== null) {
}
echo $state;
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
}
// Creazione della configurazione
@ -196,7 +195,7 @@ if (post('db_host') !== null) {
"generated" : "true",
"icons" : [
{
"src": "assets/dist/img/logo_completo.png",
"src": "assets/img/logo.png",
"type": "image/png",
"sizes": "489x91"
}
@ -205,8 +204,7 @@ if (post('db_host') !== null) {
file_put_contents('manifest.json', $manifest);
redirect_legacy(base_url().'/index.php');
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
}
}
}
@ -611,5 +609,4 @@ if (empty($creation) && (!file_exists('config.inc.php') || !$valid_config)) {
include_once AppLegacy::filepath('include|custom|', 'bottom.php');
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();

View File

@ -115,8 +115,7 @@ if (post('action') == 'init') {
}
redirect_legacy(base_url(), 'js');
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
}
$img = AppLegacy::getPaths()['img'];
@ -263,5 +262,4 @@ echo '
include_once AppLegacy::filepath('include|custom|', 'bottom.php');
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();

View File

@ -109,8 +109,7 @@ if (filter('action') == 'do_update') {
</a>';
}
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
} elseif (Update::isUpdateAvailable()) {
// Controllo se l'aggiornamento è in esecuzione
if (Update::isUpdateLocked() && filter('force') === null) {
@ -132,8 +131,7 @@ if (filter('action') == 'do_update') {
include_once AppLegacy::filepath('include|custom|', 'bottom.php');
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
}
$firstuse = !$dbo->isInstalled() ? 'true' : 'false';

View File

@ -32,10 +32,10 @@ switch ($op) {
$password = post('password');
$user = User::where('username', $username)->first();
if (!empty($user) && Hash::check($password, $user->getAuthPassword())){
if (!empty($user) && Hash::check($password, $user->getAuthPassword())) {
auth()->loginUsingId($user->id, true);
// Rimozione log vecchi
// Rimozione log vecchi
//$dbo->query('DELETE FROM `zz_operations` WHERE DATE_ADD(`created_at`, INTERVAL 30*24*60*60 SECOND) <= NOW()');
} else {
$status = auth()->user();
@ -43,8 +43,7 @@ switch ($op) {
//flash()->error(auth()->getStatus()[$status]['message']);
redirect_legacy(base_url().'/index.php');
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
}
break;
@ -53,9 +52,7 @@ switch ($op) {
auth()->logout();
redirect_legacy(base_url().'/index.php');
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
break;
}
@ -67,8 +64,7 @@ if (auth()->check() && isset($dbo) && $dbo->isConnected() && $dbo->isInstalled()
} else {
redirect_legacy(base_url().'/index.php?op=logout');
}
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
}
// Procedura di installazione

View File

@ -323,8 +323,7 @@ function redirectOperation($id_module, $id_record)
redirect_legacy(base_url().'/controller.php?id_module='.$id_module.$hash);
}
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
}
}

View File

@ -33,7 +33,7 @@ use Models\Module;
*/
function database()
{
if (!app()->has(Database::class)){
if (!app()->has(Database::class)) {
app()->instance(Database::class, new Database());
}
@ -137,7 +137,7 @@ function flash()
*/
function formatter()
{
if (!app()->has(Formatter::class)){
if (!app()->has(Formatter::class)) {
$formatter = new Formatter(
app()->getLocale(),
empty($options['timestamp']) ? 'd/m/Y H:i' : $options['timestamp'],
@ -149,12 +149,12 @@ function formatter()
] : $options['number']
);
$formatter->setPrecision(auth()->check() ? setting('Cifre decimali per importi') : 2);
//$formatter->setPrecision(auth()->check() ? setting('Cifre decimali per importi') : 2);
$formatter->setPrecision(2);
app()->instance(Formatter::class, $formatter);
}
return app()->get(Formatter::class);
}
@ -176,15 +176,14 @@ function tr($string, $parameters = [], $operations = [])
return replace($result, $parameters);
}
// Retrocompatibilità (con la funzione gettext)
// Retro-compatibilità (con la funzione gettext)
if (!function_exists('_')) {
function _($string, $parameters = [], $operations = [])
{
return _i($string, $parameters);
return tr($string, $parameters);
}
}
/**
* Restituisce il numero indicato formattato secondo la configurazione del sistema.
*

View File

@ -35,9 +35,9 @@ switch (filter('op')) {
$stati = session('dashboard.idstatiintervento', ["'-1'"]);
$stati[] = prepare('');
$tipi = session('dashboard.idtipiintervento', ["'-1'"]);
$zone = session('dashboard.idzone', ["'-1'"]);
$tecnici = session('dashboard.idtecnici', ["'-1'"]);
$tipi = session('dashboard.idtipiintervento', ["'-1'"]);
$zone = session('dashboard.idzone', ["'-1'"]);
$tecnici = session('dashboard.idtecnici', ["'-1'"]);
$query = 'SELECT
in_interventi_tecnici.id,

View File

@ -26,8 +26,7 @@ if (get('anteprima') !== null) {
if (empty($rs)) {
echo tr('Intervento inesistente!');
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
}
// Gestione della stampa

View File

@ -47,8 +47,7 @@ switch (filter('op')) {
echo json_encode([
'id' => 1,
]);
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
} else {
$content = file_get_contents($temp_name);

View File

@ -60,8 +60,7 @@ switch (post('op')) {
}
redirect_legacy(base_url().'/index.php');
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
break;
case 'update':
@ -78,8 +77,7 @@ switch (post('op')) {
flash()->info(tr('Password cambiata!'));
redirect_legacy(base_url().'/index.php');
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
break;
}

View File

@ -27,6 +27,10 @@ use Util\Messages;
*/
class AppLegacy
{
/**
* @var \Intl\Formatter
*/
public static $formatter;
/** @var string Simbolo della valuta corrente */
protected static $currency;
@ -63,10 +67,6 @@ class AppLegacy
'i18n/fullcalendar/|lang|.min.js',
],
];
/**
* @var \Intl\Formatter
*/
public static $formatter;
/**
* Restituisce la configurazione dell'installazione in utilizzo del progetto.
@ -164,7 +164,7 @@ class AppLegacy
// Impostazione dei percorsi
$paths = self::getPaths();
$lang = App::getLocale();;
$lang = App::getLocale();
// Sezioni: nome - percorso
$sections = [
@ -188,7 +188,7 @@ class AppLegacy
foreach ($sections as $section => $dir) {
$result = array_unique(array_merge(
self::$assets[$section],
isset($config['assets']) ? ($config['assets'][$section] ?:[]) :[]
isset($config['assets']) ? ($config['assets'][$section] ?: []) : []
));
foreach ($result as $key => $element) {
@ -286,6 +286,25 @@ class AppLegacy
return slashes($result);
}
/**
* Restituisce il simbolo della valuta del gestione.
*
* @since 2.4.9
*
* @return string
*/
public static function getCurrency()
{
if (!isset(self::$currency)) {
$id = setting('Valuta');
$valuta = database()->fetchOne('SELECT symbol FROM zz_currencies WHERE id = '.prepare($id));
self::$currency = $valuta['symbol'];
}
return self::$currency;
}
/**
* Restituisce la configurazione di default del progetto.
*
@ -316,24 +335,4 @@ class AppLegacy
return get_defined_vars();
}
/**
* Restituisce il simbolo della valuta del gestione.
*
* @since 2.4.9
*
* @return string
*/
public static function getCurrency()
{
if (!isset(self::$currency)) {
$id = setting('Valuta');
$valuta = database()->fetchOne('SELECT symbol FROM zz_currencies WHERE id = '.prepare($id));
self::$currency = $valuta['symbol'];
}
return self::$currency;
}
}

View File

@ -17,7 +17,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
@ -43,7 +42,6 @@ class Database
protected $mysql_version;
/**
*
* @since 2.3
*/
public function __construct()
@ -62,7 +60,6 @@ class Database
return DB::connection()->getPDO();
}
/**
* Controlla se la connessione è valida e andata a buon fine.
*
@ -74,9 +71,10 @@ class Database
{
try {
DB::connection()->getPdo();
return true;
} catch (\Exception $e) {
return false;
return false;
}
}

View File

@ -121,7 +121,7 @@ class HTMLBuilder
foreach ($managers[0] as $value) {
$json = self::decode($value, 'manager');
if (empty($json)){
if (empty($json)) {
continue;
}

View File

@ -87,8 +87,7 @@ class Permissions
if (!auth()->check() && getURLPath() == slashes(base_url().'/index.php')) {
redirect_legacy(base_url().'/index.php');
$result = false;
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
} else {
if (!empty(self::$permissions)) {
foreach (self::$permissions as $module) {

View File

@ -180,8 +180,7 @@ class Prints
echo '
<p align="center">'.$error.'</p>';
throw new \App\Exceptions\LegacyExitException;
throw new \App\Exceptions\LegacyExitException();
}
if (self::isCompletelyCustom($print)) {

View File

@ -28,7 +28,8 @@ use Illuminate\Support\Facades\Session;
*/
class Messages
{
public function __contruct($name){
public function __contruct($name)
{
}
public function info($message)
@ -46,14 +47,16 @@ class Messages
Session::push('messages.error', $message);
}
public function getMessage($type){
public function getMessage($type)
{
$messages = Session::get('messages.'.$type);
Session::remove('messages.'.$type);
return $messages;
}
public function getMessages(){
public function getMessages()
{
$messages = Session::get('messages');
Session::remove('messages');