mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-05 10:17:30 +01:00
Merge branch 'master' of https://github.com/devcode-it/openstamanager
This commit is contained in:
commit
490aac16d6
@ -32,10 +32,9 @@
|
||||
</Files>
|
||||
|
||||
# Disable indexing of php, html, htm, pdf files
|
||||
ServerSignature Off
|
||||
<IfModule mod_headers.c>
|
||||
<FilesMatch "\.(php|html|htm|pdf|log)$">
|
||||
Header set X-Robots-Tag: "noindex"
|
||||
</FilesMatch>
|
||||
Header set X-Robots-Tag: "noindex,nofollow"
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
|
@ -9,6 +9,9 @@ function serverError()
|
||||
}
|
||||
}
|
||||
|
||||
// Impostazioni di Content-Type e Charset Header
|
||||
header('Content-Type: application/json; charset=UTF-8');
|
||||
|
||||
// Gestione degli errori
|
||||
set_error_handler('serverError');
|
||||
register_shutdown_function('serverError');
|
||||
|
@ -29,18 +29,18 @@
|
||||
"filp/whoops": "^2.1",
|
||||
"ifsnop/mysqldump-php": "^2.3",
|
||||
"intervention/image": "^2.3",
|
||||
"ircmaxell/password-compat": "^1.0",
|
||||
"league/csv": "^8.2",
|
||||
"maximebf/debugbar": "^1.15",
|
||||
"monolog/monolog": "^1.22",
|
||||
"mpdf/mpdf": "^7.1",
|
||||
"mpociot/vat-calculator": "^2.3",
|
||||
"paragonie/random_compat": "^2.0",
|
||||
"phpmailer/phpmailer": "^6.0",
|
||||
"respect/validation": "^1.1",
|
||||
"spipu/html2pdf": "^5.0",
|
||||
"symfony/filesystem": "^3.3",
|
||||
"symfony/finder": "^3.3",
|
||||
"symfony/polyfill-ctype": "^1.8",
|
||||
"symfony/polyfill-php70": "^1.8",
|
||||
"symfony/translation": "^3.3",
|
||||
"symfony/var-dumper": "^3.3"
|
||||
},
|
||||
|
9
core.php
9
core.php
@ -1,8 +1,7 @@
|
||||
<?php
|
||||
|
||||
// Impostazioni per la corretta interpretazione di UTF-8
|
||||
header('Content-Type: text/html; charset=UTF-8');
|
||||
ob_start();
|
||||
// Rimozione header X-Powered-By
|
||||
header_remove('X-Powered-By');
|
||||
|
||||
// Impostazioni di configurazione PHP
|
||||
date_default_timezone_set('Europe/Rome');
|
||||
@ -153,6 +152,9 @@ if (!$continue && getURLPath() != slashes(ROOTDIR.'/index.php') && !Permissions:
|
||||
|
||||
// Operazione aggiuntive (richieste non API)
|
||||
if (!API::isAPIRequest()) {
|
||||
// Impostazioni di Content-Type e Charset Header
|
||||
header('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
/*
|
||||
// Controllo CSRF
|
||||
if(!CSRF::getInstance()->validate()){
|
||||
@ -176,6 +178,7 @@ if (!API::isAPIRequest()) {
|
||||
|
||||
// Registrazione globale del template per gli input HTML
|
||||
register_shutdown_function('translateTemplate');
|
||||
ob_start();
|
||||
|
||||
// Impostazione della sessione di base
|
||||
$_SESSION['infos'] = isset($_SESSION['infos']) ? array_unique($_SESSION['infos']) : [];
|
||||
|
@ -9,7 +9,7 @@ if (Auth::check()) {
|
||||
</aside><!-- /.content-wrapper -->
|
||||
|
||||
<footer class="main-footer">
|
||||
<a class="hidden-xs" href="https://www.openstamanager.com" title="'.tr('Il gestionale open source per l\'assistenza tecnica e la fatturazione').'." target="_blank"><strong>'.tr('OpenSTAManager').'</strong></a>
|
||||
<a class="hidden-xs" href="https://www.openstamanager.com" title="'.tr("Il gestionale open source per l'assistenza tecnica e la fatturazione").'." target="_blank"><strong>'.tr('OpenSTAManager').'</strong></a>
|
||||
<span class="pull-right hidden-xs">
|
||||
<strong>'.tr('Versione').'</strong> '.$version.'
|
||||
<small class="text-muted">('.(!empty($revision) ? $revision : tr('In sviluppo')).')</small>
|
||||
|
@ -418,7 +418,7 @@ if (empty($creation) && (!file_exists('config.inc.php') || !$valid_config)) {
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-md-4 text-right">
|
||||
<button type="button" id="install" class="btn btn-success btn-block">
|
||||
<button type="submit" id="install" class="btn btn-success btn-block">
|
||||
<i class="fa fa-check"></i> '.tr('Installa').'
|
||||
</button>
|
||||
</div>
|
||||
|
@ -25,6 +25,10 @@ $settings = [
|
||||
'type' => 'ext',
|
||||
'description' => tr('Permette di leggere e scrivere gli archivi compressi ZIP e i file al loro interno'),
|
||||
],
|
||||
'mbstring' => [
|
||||
'type' => 'ext',
|
||||
'description' => tr('Permette di gestire i caratteri dello standard UTF-8'),
|
||||
],
|
||||
'pdo_mysql' => [
|
||||
'type' => 'ext',
|
||||
'description' => tr('Permette di effettuare la connessione al database MySQL'),
|
||||
|
@ -31,6 +31,8 @@ echo '<!DOCTYPE html>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
|
||||
<link href="'.$paths['img'].'/favicon.png" rel="icon" type="image/x-icon" />';
|
||||
|
||||
// CSS
|
||||
|
@ -5,7 +5,7 @@ include_once __DIR__.'/../../core.php';
|
||||
/**
|
||||
* Recupera il totale delle ore spese per un intervento.
|
||||
*
|
||||
* @param [type] $idintervento
|
||||
* @param int $idintervento
|
||||
*/
|
||||
function get_ore_intervento($idintervento)
|
||||
{
|
||||
@ -24,10 +24,10 @@ function get_ore_intervento($idintervento)
|
||||
/**
|
||||
* Funzione per collegare gli articoli, usati in un intervento, ai rispettivi impianti.
|
||||
*
|
||||
* @param [type] $idintervento
|
||||
* @param [type] $idimpianto
|
||||
* @param [type] $idarticolo
|
||||
* @param [type] $qta
|
||||
* @param int $idintervento
|
||||
* @param int $idimpianto
|
||||
* @param int $idarticolo
|
||||
* @param int $qta
|
||||
*/
|
||||
function link_componente_to_articolo($idintervento, $idimpianto, $idarticolo, $qta)
|
||||
{
|
||||
|
119
src/App.php
119
src/App.php
@ -38,7 +38,7 @@ class App
|
||||
];
|
||||
|
||||
/**
|
||||
* Restituisce l'identificativo del modulo attualmente in utilizzo.
|
||||
* Restituisce il modulo attualmente in utilizzo.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -68,7 +68,7 @@ class App
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce la configurazione di default del gestionale.
|
||||
* Restituisce la configurazione di default del progetto.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -82,7 +82,7 @@ class App
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce la configurazione dell'installazione.
|
||||
* Restituisce la configurazione dell'installazione in utilizzo del progetto.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -107,33 +107,36 @@ class App
|
||||
}
|
||||
|
||||
/**
|
||||
* Individuazione dei percorsi di base.
|
||||
* Individua i percorsi di base necessari per il funzionamento del gestionale.
|
||||
* <b>Attenzione<b>: questo metodo deve essere eseguito all'interno di un file nella cartella principale del progetto per permettere il corretto funzionamento degli URL.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function definePaths($docroot)
|
||||
{
|
||||
// Individuazione di $rootdir
|
||||
$rootdir = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/')).'/';
|
||||
if (strrpos($rootdir, '/'.basename($docroot).'/') !== false) {
|
||||
$rootdir = substr($rootdir, 0, strrpos($rootdir, '/'.basename($docroot).'/')).'/'.basename($docroot);
|
||||
} else {
|
||||
$rootdir = '/';
|
||||
if (!defined('DOCROOT')) {
|
||||
// Individuazione di $rootdir
|
||||
$rootdir = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/')).'/';
|
||||
if (strrpos($rootdir, '/'.basename($docroot).'/') !== false) {
|
||||
$rootdir = substr($rootdir, 0, strrpos($rootdir, '/'.basename($docroot).'/')).'/'.basename($docroot);
|
||||
} else {
|
||||
$rootdir = '/';
|
||||
}
|
||||
$rootdir = rtrim($rootdir, '/');
|
||||
$rootdir = str_replace('%2F', '/', rawurlencode($rootdir));
|
||||
|
||||
// Individuazione di $baseurl
|
||||
$baseurl = (isHTTPS(true) ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].$rootdir;
|
||||
|
||||
// Impostazione delle variabili globali
|
||||
define('DOCROOT', $docroot);
|
||||
define('ROOTDIR', $rootdir);
|
||||
define('BASEURL', $baseurl);
|
||||
}
|
||||
$rootdir = rtrim($rootdir, '/');
|
||||
$rootdir = str_replace('%2F', '/', rawurlencode($rootdir));
|
||||
|
||||
// Individuazione di $baseurl
|
||||
$baseurl = (isHTTPS(true) ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].$rootdir;
|
||||
|
||||
// Impostazione delle variabili globali
|
||||
define('DOCROOT', $docroot);
|
||||
define('ROOTDIR', $rootdir);
|
||||
define('BASEURL', $baseurl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce la configurazione dell'installazione.
|
||||
* Individua i percorsi principali del progetto.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -150,7 +153,7 @@ class App
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce la configurazione dell'installazione.
|
||||
* Restituisce l'elenco degli assets del progetto.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -212,6 +215,13 @@ class App
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interpreta lo standard modulare per l'individuazione delle query di un modulo/plugin del progetto.
|
||||
*
|
||||
* @param array $element
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function readNewQuery($element)
|
||||
{
|
||||
$fields = [];
|
||||
@ -265,6 +275,13 @@ class App
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Interpreta lo standard JSON per l'individuazione delle query di un modulo/plugin del progetto.
|
||||
*
|
||||
* @param array $element
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function readOldQuery($element)
|
||||
{
|
||||
$options = str_replace(["\r", "\n", "\t"], ' ', $element['option']);
|
||||
@ -303,6 +320,13 @@ class App
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce le singole componenti delle query per un determinato modulo/plugin.
|
||||
*
|
||||
* @param array $element
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function getViews($element)
|
||||
{
|
||||
$database = Database::getConnection();
|
||||
@ -319,6 +343,14 @@ class App
|
||||
return $views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sostituisce i valori previsti all'interno delle query di moduli/plugin.
|
||||
*
|
||||
* @param string $query
|
||||
* @param int $custom
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function replacePlaceholder($query, $custom = null)
|
||||
{
|
||||
$id_module = filter('id_module');
|
||||
@ -337,29 +369,36 @@ class App
|
||||
return $query;
|
||||
}
|
||||
|
||||
public static function load($file, $result, $options, $directory = null)
|
||||
/**
|
||||
* Restituisce il codice HTML per il form contenente il file indicato.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $result
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function load($file, $result, $options)
|
||||
{
|
||||
$module = self::getCurrentModule();
|
||||
$form = self::internalLoad('form.php', $result, $options);
|
||||
|
||||
$id_module = filter('id_module');
|
||||
$id_record = filter('id_record');
|
||||
$response = self::internalLoad($file, $result, $options);
|
||||
|
||||
$directory = empty($directory) ? 'include|custom|/common/' : $directory;
|
||||
$directory = str_contains($directory, DOCROOT) ? $directory : DOCROOT.'/'.$directory;
|
||||
|
||||
ob_start();
|
||||
|
||||
$require = self::filepath($directory, 'form.php');
|
||||
require $require;
|
||||
|
||||
$form = ob_get_clean();
|
||||
|
||||
$response = self::internalLoad($file, $result, $options, $directory);
|
||||
$form = str_replace('|response|', $response, $form);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce il codice HTML generato del file indicato.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $result
|
||||
* @param array $options
|
||||
* @param string $directory
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function internalLoad($file, $result, $options, $directory = null)
|
||||
{
|
||||
$module = self::getCurrentModule();
|
||||
@ -370,10 +409,7 @@ class App
|
||||
$directory = empty($directory) ? 'include|custom|/common/' : $directory;
|
||||
|
||||
ob_start();
|
||||
|
||||
$require = self::filepath($directory, $file);
|
||||
require $require;
|
||||
|
||||
include self::filepath($directory, $file);
|
||||
$response = ob_get_clean();
|
||||
|
||||
return $response;
|
||||
@ -383,6 +419,7 @@ class App
|
||||
* Individua il percorso per il file da includere considerando gli eventuali custom.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $file
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
|
@ -33,7 +33,7 @@ class Translator extends Util\Singleton
|
||||
/**
|
||||
* Ricerca e aggiunge le traduzioni presenti nei percorsi predefiniti (cartella locale sia nella root che nei diversi moduli).
|
||||
*
|
||||
* @param [type] $string
|
||||
* @param string $string
|
||||
*/
|
||||
public function addLocalePath($string)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user