Correzione percorsi

This commit is contained in:
Dasc3er 2021-02-19 14:35:42 +01:00 committed by Thomas Zilio
parent 9b09258261
commit e6e508b96f
13 changed files with 195 additions and 20 deletions

View File

@ -1083,6 +1083,50 @@ div.tip {
opacity: 0.5;
}
/* Porting da AdminLTE 3 */
.bg-light {
background-color: #e8e9ea !important;
}
a.bg-light:hover, a.bg-light:focus,
button.bg-light:hover,
button.bg-light:focus {
background-color: #dae0e5 !important;
}
.brand-image {
float: left;
line-height: .8;
margin-left: .8rem;
margin-right: .5rem;
margin-top: -3px;
max-height: 33px;
width: auto;
}
.brand-link {
display: block;
font-size: 1.25rem;
line-height: 1.5;
padding: .8125rem .5rem;
transition: width .3s ease-in-out;
white-space: nowrap
}
.brand-link:hover {
color: #fff;
text-decoration: none
}
.text-sm .brand-link {
font-size: inherit
}
.brand-link {
border-bottom: 1px solid #4b545c;
color: rgba(255, 255, 255, .8)
}
/* Stile Fullcalendar per weekend */
.fc-sat, .fc-sun {
background-color: rgba(255, 99, 71, 0.6) !important;

View File

@ -493,7 +493,7 @@ if (auth()->check()) {
<!-- /.sidebar -->
</aside>';
if (string_contains($_SERVER['SCRIPT_FILENAME'], 'editor.php')) {
if (string_contains($_SERVER['REQUEST_URI'], 'editor.php')) {
// Menu laterale per la visualizzazione dei plugin
echo '
<aside class="control-sidebar control-sidebar-light">
@ -562,9 +562,9 @@ if (auth()->check()) {
<section class="content">
<div class="row">';
if (string_contains($_SERVER['SCRIPT_FILENAME'], 'editor.php')) {
if (string_contains($_SERVER['REQUEST_URI'], 'editor.php')) {
$location = 'editor_right';
} elseif (string_contains($_SERVER['SCRIPT_FILENAME'], 'controller.php')) {
} elseif (string_contains($_SERVER['REQUEST_URI'], 'controller.php')) {
$location = 'controller_right';
}

View File

@ -362,7 +362,7 @@ function isMobile()
*/
function getURLPath()
{
$path = $_SERVER['SCRIPT_FILENAME'];
$path = $_SERVER['REQUEST_URI'];
$prefix = rtrim($_SERVER['DOCUMENT_ROOT'], '/\\');
if (substr($path, 0, strlen($prefix)) == $prefix) {
@ -434,7 +434,7 @@ function base_url()
*/
function base_dir()
{
return base_url().'/legacy/';
return base_path().DIRECTORY_SEPARATOR.'legacy'.DIRECTORY_SEPARATOR;
}
/**

View File

@ -47,7 +47,6 @@ class AppLegacy
'app.min.css',
'style.min.css',
'themes.min.css',
'dropzone.min.css',
],
// Print CSS
@ -60,7 +59,6 @@ class AppLegacy
'app.min.js',
'functions.min.js',
'custom.min.js',
'dropzone.min.js',
'i18n/parsleyjs/|lang|.min.js',
'i18n/select2/|lang|.min.js',
'i18n/moment/|lang|.min.js',
@ -184,7 +182,6 @@ class AppLegacy
];
$assets = [];
foreach ($sections as $section => $dir) {
$result = array_unique(array_merge(
self::$assets[$section],
@ -195,13 +192,18 @@ class AppLegacy
$base = str_replace(base_url(), '', $paths[$dir]);
$element = $base.'/'.$element;
$assets_element = null;
foreach ($lang_replace as $replace) {
$name = str_replace('|lang|', $replace, $element);
$assets_element = asset($name);
if (file_exists(base_path('public'.$name))) {
$assets_element = asset($name);
}
}
$result[$key] = $assets_element.'?v='.$version;
if (!empty($assets_element)) {
$result[$key] = $assets_element.'?v='.$version;
}
}
$assets[$section] = $result;

View File

@ -24,6 +24,7 @@ use Models\User;
* Classe per la gestione delle utenze.
*
* @since 2.3
* @deprecated
*/
class Auth extends \Util\Singleton
{

View File

@ -22,6 +22,7 @@ namespace Models;
use Common\SimpleModelTrait;
use Illuminate\Database\Eloquent\Model;
use Traits\LocalPoolTrait;
use Respect\Validation\Validator as v;
class Setting extends Model
{
@ -49,4 +50,108 @@ class Setting extends Model
return $value;
}
public static function getPoolNameColumn()
{
return 'nome';
}
/**
* Imposta il valore dell'impostazione indicata.
*
* @param mixed $value
*
* @return bool
*/
public function setValue($value)
{
// Trasformazioni
// Boolean (checkbox)
if ($this->tipo == 'boolean') {
$value = (empty($value) || $value == 'off') ? false : true;
}
// Validazioni
// integer
if ($this->tipo == 'integer') {
$validator = v::intVal();
}
// list
// verifico che il valore scelto sia nella lista enumerata nel db
elseif (preg_match("/list\[(.+?)\]/", $this->tipo, $m)) {
$validator = v::in(explode(',', $m[1]));
}
// Boolean (checkbox)
elseif ($this->tipo == 'boolean') {
$validator = v::boolType();
}
if (empty($validator) || $validator->validate($value)) {
$this->valore = $value;
$this->save();
return true;
}
return false;
}
/**
* Genera l'input HTML per la modifica dell'impostazione.
*
* @param bool $required
*
* @return string
*/
public function input($required = false)
{
// Lista predefinita
if (preg_match("/list\[(.+?)\]/", $this->tipo, $m)) {
$values = explode(',', $m[1]);
$list = [];
foreach ($values as $value) {
$list[] = [
'id' => $value,
'text' => $value,
];
}
$result = '
{[ "type": "select", "label": '.json_encode($this->nome).', "name": "setting['.$this->id.']", "values": '.json_encode($list).', "value": "'.$this->valore.'", "required": "'.intval($required).'", "help": "'.$this->help.'" ]}';
}
// Lista da query
elseif (preg_match('/^query=(.+?)$/', $this->tipo, $m)) {
$result = '
{[ "type": "select", "label": '.json_encode($this->nome).', "name": "setting['.$this->id.']", "values": "'.str_replace('"', '\"', $this->tipo).'", "value": "'.$this->valore.'", "required": "'.intval($required).'", "help": "'.$this->help.'" ]}';
}
// Boolean (checkbox)
elseif ($this->tipo == 'boolean') {
$result = '
{[ "type": "checkbox", "label": '.json_encode($this->nome).', "name": "setting['.$this->id.']", "placeholder": "'.tr('Attivo').'", "value": "'.$this->valore.'", "required": "'.intval($required).'", "help": "'.$this->help.'" ]}';
}
// Campi di default
elseif (in_array($this->tipo, ['textarea', 'ckeditor', 'timestamp', 'date', 'time'])) {
$result = '
{[ "type": "'.$this->tipo.'", "label": '.json_encode($this->nome).', "name": "setting['.$this->id.']", "value": '.json_encode($this->valore).', "required": "'.intval($required).'", "help": "'.$this->help.'" ]}';
}
// Campo di testo
else {
$numerico = in_array($this->tipo, ['integer', 'decimal']);
$tipo = preg_match('/password/i', $this->nome, $m) ? 'password' : $this->tipo;
$tipo = $numerico ? 'number' : 'text';
$result = '
{[ "type": "'.$tipo.'", "label": '.json_encode($this->nome).', "name": "setting['.$this->id.']", "value": "'.$this->valore.'"'.($numerico && $this->tipo == 'integer' ? ', "decimals": 0' : '').', "required": "'.intval($required).'", "help": "'.$this->help.'" ]}';
}
return $result;
}
}

View File

@ -24,6 +24,7 @@ use Util\Query;
* Classe per la gestione delle informazioni relative ai moduli installati.
*
* @since 2.3
* @deprecated
*/
class Modules
{

View File

@ -21,6 +21,7 @@
* Classe per gestire i permessi di accesso alle diverse sezioni del progetto.
*
* @since 2.3
* @deprecated
*/
class Permissions
{

View File

@ -23,6 +23,7 @@ use Models\Plugin;
* Classe per la gestione delle informazioni relative ai plugin installati.
*
* @since 2.3
* @deprecated
*/
class Plugins
{

View File

@ -24,6 +24,7 @@ use Respect\Validation\Validator as v;
* Classe per la gestione dell impostazioni del progetto.
*
* @since 2.3
* @deprecated
*/
class Settings
{

View File

@ -31,10 +31,25 @@ trait LocalPoolTrait
/** @var int Identificatore dell'oggetto in utilizzo */
protected static $current;
/** @var string Nome della colonna "id" (Primary Key) */
protected static $id = 'id';
/** @var string Nome della colonna "name" */
protected static $name = 'name';
/**
* Nome della colonna "id" (Primary Key).
*
* @return string
*/
public static function getPoolIDColumn()
{
return 'id';
}
/**
* Nome della colonna "name".
*
* @return string
*/
public static function getPoolNameColumn()
{
return 'name';
}
/**
* Restituisce tutti gli oggetti.
@ -61,14 +76,17 @@ trait LocalPoolTrait
*/
public static function pool($identifier)
{
$id_column = self::getPoolIDColumn();
$name_column = self::getPoolNameColumn();
// Inizializzazione
if (!isset(self::$collection)) {
self::$collection = collect();
}
// Ricerca
$result = self::$collection->first(function ($item) use ($identifier) {
return $item->{self::$name} == $identifier || $item->{self::$id} == $identifier;
$result = self::$collection->first(function ($item) use ($identifier, $id_column, $name_column) {
return $item->{$name_column} == $identifier || $item->{$id_column} == $identifier;
});
if (!empty($result)) {
@ -76,8 +94,8 @@ trait LocalPoolTrait
}
// Consultazione Database
$result = self::where(self::$id, '=', $identifier)
->orWhere(self::$name, '=', $identifier)
$result = self::where($id_column, $identifier)
->orWhere($name_column, $identifier)
->first();
if (!empty($result)) {

View File

@ -23,6 +23,7 @@ use Models\Upload;
* Classe per la gestione degli upload del progetto.
*
* @since 2.4.1
* @deprecated
*/
class Uploads
{

View File

@ -20,7 +20,7 @@
namespace Util;
use Carbon\Carbon;
use Illuminate\Database\Capsule\Manager;
use Illuminate\Support\Facades\DB;
/**
* Classe dedicata alla gestione e all'interpretazione delle stringhe personalizzate.
@ -201,7 +201,7 @@ class Generator
$maschera = Generator::complete($maschera, [], $date);
$maschera = str_replace('#', '%', $maschera);
$query = Manager::table($table)->select($field)->where($field, 'like', $maschera)->orderByRaw($order);
$query = DB::table($table)->select($field)->where($field, 'like', $maschera)->orderByRaw($order);
foreach ($where as $and) {
$query->whereRaw($and);