mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
Introduzione del componente Filesystem
Introduzione del componente Filesystem di Symfony per gestire in modo omogeneo il filesystem.
This commit is contained in:
@@ -29,7 +29,7 @@ if (filter('op') == 'link_file' || filter('op') == 'unlink_file') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Controllo sui permessi di scrittura per il file system
|
// Controllo sui permessi di scrittura per il file system
|
||||||
elseif ((!is_dir($upload_dir) && !create_dir($upload_dir)) || (is_dir($upload_dir) && !is_writable($upload_dir))) {
|
elseif (!directory($upload_dir)) {
|
||||||
$_SESSION['errors'][] = tr('Non hai i permessi di scrittura nella cartella _DIR_!', [
|
$_SESSION['errors'][] = tr('Non hai i permessi di scrittura nella cartella _DIR_!', [
|
||||||
'_DIR_' => '"files"',
|
'_DIR_' => '"files"',
|
||||||
]);
|
]);
|
||||||
@@ -192,7 +192,7 @@ if (filter('op') == 'link_file' || filter('op') == 'unlink_file') {
|
|||||||
|
|
||||||
$rs = $dbo->fetchArray('SELECT * FROM zz_files WHERE id_module='.prepare($id_module).' AND id='.prepare(filter('id')).' AND filename='.prepare($filename));
|
$rs = $dbo->fetchArray('SELECT * FROM zz_files WHERE id_module='.prepare($id_module).' AND id='.prepare(filter('id')).' AND filename='.prepare($filename));
|
||||||
|
|
||||||
if (unlink($upload_dir.'/'.$filename)) {
|
if (delete($upload_dir.'/'.$filename)) {
|
||||||
$query = 'DELETE FROM zz_files WHERE id_module='.prepare($id_module).' AND id='.prepare(filter('id')).' AND filename='.prepare($filename);
|
$query = 'DELETE FROM zz_files WHERE id_module='.prepare($id_module).' AND id='.prepare(filter('id')).' AND filename='.prepare($filename);
|
||||||
if ($dbo->query($query)) {
|
if ($dbo->query($query)) {
|
||||||
$_SESSION['infos'][] = tr('File _FILE_ eliminato!', [
|
$_SESSION['infos'][] = tr('File _FILE_ eliminato!', [
|
||||||
@@ -212,7 +212,7 @@ if (filter('op') == 'link_file' || filter('op') == 'unlink_file') {
|
|||||||
} elseif (filter('op') == 'download_file') {
|
} elseif (filter('op') == 'download_file') {
|
||||||
$rs = $dbo->fetchArray('SELECT * FROM zz_files WHERE id_module='.prepare($id_module).' AND id='.prepare(filter('id')).' AND filename='.prepare(filter('filename')));
|
$rs = $dbo->fetchArray('SELECT * FROM zz_files WHERE id_module='.prepare($id_module).' AND id='.prepare(filter('id')).' AND filename='.prepare(filter('filename')));
|
||||||
|
|
||||||
force_download($rs[0]['original'], $upload_dir.'/'.$rs[0]['filename']);
|
download($upload_dir.'/'.$rs[0]['filename'], $rs[0]['original']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Modules::getPermission($permesso) == 'rw') {
|
if (Modules::getPermission($permesso) == 'rw') {
|
||||||
|
@@ -555,11 +555,14 @@ div.DTS tbody th {
|
|||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-responsive th>input,
|
input.min-width {
|
||||||
.table-responsive td>input {
|
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input.small-width {
|
||||||
|
min-width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
table.table:not(.dataTable) th,
|
table.table:not(.dataTable) th,
|
||||||
table.table:not(.dataTable) td {
|
table.table:not(.dataTable) td {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
2
bug.php
2
bug.php
@@ -103,7 +103,7 @@ if (filter('op') == 'send') {
|
|||||||
$mail->SmtpClose();
|
$mail->SmtpClose();
|
||||||
|
|
||||||
if (!empty($post['sql'])) {
|
if (!empty($post['sql'])) {
|
||||||
unlink($backup_file);
|
delete($backup_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect($rootdir.'/bug.php');
|
redirect($rootdir.'/bug.php');
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
"paragonie/random_compat": "^2.0",
|
"paragonie/random_compat": "^2.0",
|
||||||
"phpmailer/phpmailer": "^5.2",
|
"phpmailer/phpmailer": "^5.2",
|
||||||
"spipu/html2pdf": "^5.0",
|
"spipu/html2pdf": "^5.0",
|
||||||
|
"symfony/filesystem": "^3.3",
|
||||||
"symfony/finder": "^3.3",
|
"symfony/finder": "^3.3",
|
||||||
"symfony/translation": "^3.3"
|
"symfony/translation": "^3.3"
|
||||||
},
|
},
|
||||||
|
@@ -32,7 +32,7 @@ switch ($op) {
|
|||||||
$_SESSION['infos'][] = tr('Backup saltato perché già esistente!');
|
$_SESSION['infos'][] = tr('Backup saltato perché già esistente!');
|
||||||
} elseif (empty($backup_dir)) {
|
} elseif (empty($backup_dir)) {
|
||||||
$_SESSION['errors'][] = tr('Non è possibile eseguire i backup poichè la cartella di backup non è stata impostata!!!');
|
$_SESSION['errors'][] = tr('Non è possibile eseguire i backup poichè la cartella di backup non è stata impostata!!!');
|
||||||
} elseif (file_exists($backup_dir) || create_dir($backup_dir)) {
|
} elseif (directory($backup_dir)) {
|
||||||
$_SESSION['infos'][] = tr('La cartella di backup è stata creata correttamente.');
|
$_SESSION['infos'][] = tr('La cartella di backup è stata creata correttamente.');
|
||||||
if (do_backup()) {
|
if (do_backup()) {
|
||||||
$_SESSION['infos'][] = tr('Backup automatico eseguito correttamente!');
|
$_SESSION['infos'][] = tr('Backup automatico eseguito correttamente!');
|
||||||
|
@@ -1023,3 +1023,34 @@ function filelist_and_upload($id_module, $id_record, $label = 'Nuovo allegato:',
|
|||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rimuove ricorsivamente una directory.
|
||||||
|
*
|
||||||
|
* @param unknown $path
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function deltree($path)
|
||||||
|
{
|
||||||
|
trigger_error('Funzione deprecata!', E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
$path = realpath($path);
|
||||||
|
|
||||||
|
if (is_dir($path)) {
|
||||||
|
$files = scandir($path);
|
||||||
|
if (empty($files)) {
|
||||||
|
$files = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($files as $file) {
|
||||||
|
if ($file != '.' && $file != '..') {
|
||||||
|
deltree($path.DIRECTORY_SEPARATOR.$file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rmdir($path);
|
||||||
|
} elseif (file_exists($path)) {
|
||||||
|
return unlink($path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -36,33 +36,39 @@ function sanitizeFilename($filename)
|
|||||||
return $filename;
|
return $filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
function delete($files)
|
||||||
* Rimuove ricorsivamente una directory.
|
|
||||||
*
|
|
||||||
* @param unknown $path
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
function deltree($path)
|
|
||||||
{
|
{
|
||||||
$path = realpath($path);
|
// Filesystem Symfony
|
||||||
|
$fs = new Symfony\Component\Filesystem\Filesystem();
|
||||||
|
|
||||||
if (is_dir($path)) {
|
// Eliminazione
|
||||||
$files = scandir($path);
|
try {
|
||||||
if (empty($files)) {
|
$fs->remove($files);
|
||||||
$files = [];
|
} catch (Symfony\Component\Filesystem\Exception\IOException $e) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($files as $file) {
|
return true;
|
||||||
if ($file != '.' && $file != '..') {
|
}
|
||||||
deltree($path.DIRECTORY_SEPARATOR.$file);
|
|
||||||
|
function directory($path)
|
||||||
|
{
|
||||||
|
if (is_dir($path) && is_writable($path)) {
|
||||||
|
return true;
|
||||||
|
} elseif (!is_dir($path)) {
|
||||||
|
// Filesystem Symfony
|
||||||
|
$fs = new Symfony\Component\Filesystem\Filesystem();
|
||||||
|
|
||||||
|
// Tentativo di creazione
|
||||||
|
try {
|
||||||
|
$fs->mkdir($path);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (Symfony\Component\Filesystem\Exception\IOException $e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rmdir($path);
|
return false;
|
||||||
} elseif (file_exists($path)) {
|
|
||||||
return unlink($path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,21 +105,13 @@ function copyr($source, $destination, $ignores = [])
|
|||||||
foreach ($finder as $file) {
|
foreach ($finder as $file) {
|
||||||
$filename = rtrim($destination, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$file->getRelativePathname();
|
$filename = rtrim($destination, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$file->getRelativePathname();
|
||||||
|
|
||||||
// Creazione della cartella di base
|
// Filesystem Symfony
|
||||||
if (!file_exists(dirname($filename))) {
|
$fs = new Symfony\Component\Filesystem\Filesystem();
|
||||||
create_dir(dirname($filename));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Simple copy for a file
|
// Copia
|
||||||
if (is_file($file)) {
|
try {
|
||||||
copy($file, $filename);
|
$fs->copy($file, $filename);
|
||||||
}
|
} catch (Symfony\Component\Filesystem\Exception\IOException $e) {
|
||||||
|
|
||||||
// If the source is a symlink
|
|
||||||
if (is_link($file)) {
|
|
||||||
$link_dest = readlink($file);
|
|
||||||
|
|
||||||
symlink($link_dest, $filename);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,8 +224,8 @@ function do_backup($path = null)
|
|||||||
|
|
||||||
$backup_name = 'OSM backup '.date('Y-m-d').' '.date('H_i_s');
|
$backup_name = 'OSM backup '.date('Y-m-d').' '.date('H_i_s');
|
||||||
if (
|
if (
|
||||||
(extension_loaded('zip') && (file_exists($backup_dir.'tmp') || create_dir($backup_dir.'tmp'))) ||
|
(extension_loaded('zip') && directory($backup_dir.'tmp')) ||
|
||||||
(!extension_loaded('zip') && (file_exists($backup_dir.$backup_name) || create_dir($backup_dir.$backup_name)))
|
(!extension_loaded('zip') && directory($backup_dir.$backup_name))
|
||||||
) {
|
) {
|
||||||
// Backup del database
|
// Backup del database
|
||||||
$database_file = $backup_dir.(extension_loaded('zip') ? 'tmp' : $backup_name).'/database.sql';
|
$database_file = $backup_dir.(extension_loaded('zip') ? 'tmp' : $backup_name).'/database.sql';
|
||||||
@@ -255,7 +253,7 @@ function do_backup($path = null)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rimozione cartella temporanea
|
// Rimozione cartella temporanea
|
||||||
unlink($database_file);
|
delete($database_file);
|
||||||
}
|
}
|
||||||
// Copia dei file di OSM
|
// Copia dei file di OSM
|
||||||
else {
|
else {
|
||||||
@@ -284,11 +282,7 @@ function do_backup($path = null)
|
|||||||
$cont = 1;
|
$cont = 1;
|
||||||
foreach ($backups as $backup) {
|
foreach ($backups as $backup) {
|
||||||
if ($cont > $max_backups) {
|
if ($cont > $max_backups) {
|
||||||
if (preg_match('/^OSM backup ([0-9\-]{10}) ([0-9_]{8})$/', $backup, $m)) {
|
delete($backup_dir.'/'.$backup);
|
||||||
deltree($backup_dir.'/'.$backup);
|
|
||||||
} elseif (preg_match('/^OSM backup ([0-9\-]{10}) ([0-9_]{8})\.zip$/', $backup, $m)) {
|
|
||||||
unlink($backup_dir.'/'.$backup);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
++$cont;
|
++$cont;
|
||||||
}
|
}
|
||||||
@@ -534,7 +528,7 @@ function create_thumbnails($tmp, $filename, $dir)
|
|||||||
$name = $infos['filename'];
|
$name = $infos['filename'];
|
||||||
$extension = strtolower($infos['extension']);
|
$extension = strtolower($infos['extension']);
|
||||||
|
|
||||||
if ((is_dir($dir) && !is_writable($dir)) || (!is_dir($dir) && !create_dir($dir))) {
|
if (!directory($dir)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -828,8 +822,3 @@ function redirectOperation($id_module, $id_record)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_dir($path)
|
|
||||||
{
|
|
||||||
return mkdir($path, 0777, true);
|
|
||||||
}
|
|
||||||
|
17
lib/util.php
17
lib/util.php
@@ -174,7 +174,7 @@ if (!function_exists('secure_random_string')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('force_download')) {
|
if (!function_exists('download')) {
|
||||||
/**
|
/**
|
||||||
* Transmit headers that force a browser to display the download file
|
* Transmit headers that force a browser to display the download file
|
||||||
* dialog. Cross browser compatible. Only fires if headers have not
|
* dialog. Cross browser compatible. Only fires if headers have not
|
||||||
@@ -190,9 +190,12 @@ if (!function_exists('force_download')) {
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function force_download($filename, $content = false)
|
function download($file, $filename = null)
|
||||||
{
|
{
|
||||||
if (!headers_sent()) {
|
if (!headers_sent()) {
|
||||||
|
$filename = !empty($filename) ? $filename : basename($file);
|
||||||
|
$content = !is_file($file) ? $file : file_get_contents($file);
|
||||||
|
|
||||||
// Required for some browsers
|
// Required for some browsers
|
||||||
if (ini_get('zlib.output_compression')) {
|
if (ini_get('zlib.output_compression')) {
|
||||||
@ini_set('zlib.output_compression', 'Off');
|
@ini_set('zlib.output_compression', 'Off');
|
||||||
@@ -209,20 +212,10 @@ if (!function_exists('force_download')) {
|
|||||||
header('Content-Type: application/force-download');
|
header('Content-Type: application/force-download');
|
||||||
header('Content-Transfer-Encoding: binary');
|
header('Content-Transfer-Encoding: binary');
|
||||||
|
|
||||||
if (empty($content) && is_file($filename)) {
|
|
||||||
$content = $filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_file($content)) {
|
|
||||||
$content = file_get_contents($content);
|
|
||||||
}
|
|
||||||
|
|
||||||
ob_clean();
|
ob_clean();
|
||||||
flush();
|
flush();
|
||||||
|
|
||||||
if ($content) {
|
|
||||||
echo $content;
|
echo $content;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -27,10 +27,11 @@ switch (post('op')) {
|
|||||||
include_once $uninstall_script;
|
include_once $uninstall_script;
|
||||||
}
|
}
|
||||||
|
|
||||||
deltree($docroot.'/modules/'.$module_dir.'/');
|
delete($docroot.'/modules/'.$module_dir.'/');
|
||||||
|
|
||||||
$_SESSION['infos'][] = tr('Modulo _MODULE_ disinstallato!', [
|
$_SESSION['infos'][] = tr('Modulo _MODULE_ disinstallato!', [
|
||||||
'_MODULE_' => '"'.$modulo.'"',
|
'_MODULE_' => '"'.$modulo.'"',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,9 +21,10 @@ if (!extension_loaded('zip')) {
|
|||||||
|
|
||||||
if ($zip->open($tmp)) {
|
if ($zip->open($tmp)) {
|
||||||
$tmpdir = 'tmp/';
|
$tmpdir = 'tmp/';
|
||||||
if (!file_exists($docroot.'/'.$tmpdir)) {
|
|
||||||
create_dir($docroot.'/'.$tmpdir, 0755, true);
|
// Controllo sulla cartella
|
||||||
}
|
directory($docroot.'/'.$tmpdir);
|
||||||
|
|
||||||
$zip->extractTo($docroot.'/'.$tmpdir);
|
$zip->extractTo($docroot.'/'.$tmpdir);
|
||||||
|
|
||||||
// AGGIORNAMENTO
|
// AGGIORNAMENTO
|
||||||
@@ -87,25 +88,18 @@ if (!extension_loaded('zip')) {
|
|||||||
// Sposto il file di versione nella root per forzare l'aggiornamento del db
|
// Sposto il file di versione nella root per forzare l'aggiornamento del db
|
||||||
file_put_contents($docroot.'/VERSION_'.$module_dir, $module_version);
|
file_put_contents($docroot.'/VERSION_'.$module_dir, $module_version);
|
||||||
|
|
||||||
// Sposto i file della cartella "share/" nella root
|
|
||||||
$share_dir = $docroot.'/modules/'.$module_dir.'/share/';
|
|
||||||
if (is_dir($share_dir)) {
|
|
||||||
copyr($share_dir, $docroot.'/share');
|
|
||||||
deltree($share_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sposto i file della cartella "lib/" nella root
|
// Sposto i file della cartella "lib/" nella root
|
||||||
$lib_dir = $docroot.'/modules/'.$module_dir.'/lib/';
|
$lib_dir = $docroot.'/modules/'.$module_dir.'/lib/';
|
||||||
if (is_dir($lib_dir)) {
|
if (is_dir($lib_dir)) {
|
||||||
copyr($lib_dir, $docroot.'/lib');
|
copyr($lib_dir, $docroot.'/lib');
|
||||||
deltree($lib_dir);
|
delete($lib_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sposto i file della cartella "files/" nella root
|
// Sposto i file della cartella "files/" nella root
|
||||||
$files_dir = $docroot.'/modules/'.$module_dir.'/files/';
|
$files_dir = $docroot.'/modules/'.$module_dir.'/files/';
|
||||||
if (is_dir($files_dir)) {
|
if (is_dir($files_dir)) {
|
||||||
copyr($files_dir, $docroot.'/files');
|
copyr($files_dir, $docroot.'/files');
|
||||||
deltree($files_dir);
|
delete($files_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inserimento delle voci del modulo nel db per ogni sezione [sezione]
|
// Inserimento delle voci del modulo nel db per ogni sezione [sezione]
|
||||||
@@ -114,7 +108,7 @@ if (!extension_loaded('zip')) {
|
|||||||
$n = $dbo->fetchNum($query);
|
$n = $dbo->fetchNum($query);
|
||||||
|
|
||||||
if ($n == 0) {
|
if ($n == 0) {
|
||||||
$query = 'INSERT INTO zz_modules(`name`, `title`, `directory`, `options`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`) VALUES('.prepare($module_name).', '.prepare($module_name).', '.prepare($module_dir).', '.prepare($module_info['module_options']).', '.prepare($module_info['module_icon']).', '.prepare($module_version).', '.prepare($module_info['module_compatibility']).', "100", '.prepare($module_info['module_parent']).", 0, 1)";
|
$query = 'INSERT INTO zz_modules(`name`, `title`, `directory`, `options`, `icon`, `version`, `compatibility`, `order`, `parent`, `default`, `enabled`) VALUES('.prepare($module_name).', '.prepare($module_name).', '.prepare($module_dir).', '.prepare($module_info['module_options']).', '.prepare($module_info['module_icon']).', '.prepare($module_version).', '.prepare($module_info['module_compatibility']).', "100", '.prepare($module_info['module_parent']).', 0, 1)';
|
||||||
$dbo->query($query);
|
$dbo->query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +121,7 @@ if (!extension_loaded('zip')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deltree($docroot.'/'.$tmpdir);
|
delete($docroot.'/'.$tmpdir);
|
||||||
} else {
|
} else {
|
||||||
$_SESSION['errors'][] = checkZip($tmp);
|
$_SESSION['errors'][] = checkZip($tmp);
|
||||||
}
|
}
|
||||||
|
@@ -90,9 +90,9 @@ switch (post('op')) {
|
|||||||
$filename = post('immagine01');
|
$filename = post('immagine01');
|
||||||
$f = pathinfo($filename);
|
$f = pathinfo($filename);
|
||||||
|
|
||||||
unlink($upload_dir.'/'.$f['filename'].'.'.$f['extension']);
|
delete($upload_dir.'/'.$f['filename'].'.'.$f['extension']);
|
||||||
unlink($upload_dir.'/'.$f['filename'].'_thumb100.'.$f['extension']);
|
delete($upload_dir.'/'.$f['filename'].'_thumb100.'.$f['extension']);
|
||||||
unlink($upload_dir.'/'.$f['filename'].'_thumb250.'.$f['extension']);
|
delete($upload_dir.'/'.$f['filename'].'_thumb250.'.$f['extension']);
|
||||||
|
|
||||||
$dbo->query("UPDATE mg_articoli SET immagine01 = '' WHERE id=".prepare($id_record));
|
$dbo->query("UPDATE mg_articoli SET immagine01 = '' WHERE id=".prepare($id_record));
|
||||||
}
|
}
|
||||||
|
@@ -6,13 +6,14 @@ switch (filter('op')) {
|
|||||||
case 'getfile':
|
case 'getfile':
|
||||||
$file = filter('file');
|
$file = filter('file');
|
||||||
|
|
||||||
force_download($file, file_get_contents($backup_dir.$file));
|
download($backup_dir.$file, $file);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'del':
|
case 'del':
|
||||||
$file = filter('file');
|
$file = filter('file');
|
||||||
deltree($backup_dir.$file);
|
|
||||||
|
delete($backup_dir.$file);
|
||||||
|
|
||||||
if (!file_exists($backup_dir.$file)) {
|
if (!file_exists($backup_dir.$file)) {
|
||||||
$_SESSION['infos'][] = tr('Backup _FILE_ eliminato!', [
|
$_SESSION['infos'][] = tr('Backup _FILE_ eliminato!', [
|
||||||
|
@@ -2,46 +2,55 @@
|
|||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
echo '<p>'.tr('Il backup è molto importante perchè permette di creare una copia della propria installazione con relativi dati per poterla ripristinare in seguito a errori, cancellazione di dati accidentale o guasti hardware').'.</p>
|
echo '<p>'.tr('Il backup è molto importante perchè permette di creare una copia della propria installazione con relativi dati per poterla ripristinare in seguito a errori, cancellazione di dati accidentale o guasti hardware').'.</p>';
|
||||||
|
|
||||||
<div class="row">
|
if (!extension_loaded('zip')) {
|
||||||
<div class="col-md-12 col-lg-6">
|
echo "
|
||||||
<div class="callout callout-success">
|
<div class='alert alert-warning'>
|
||||||
|
<i class='fa fa-times'></i> ".tr('Estensione zip non supportata!').'
|
||||||
|
'.tr('Il backup verrà eseguito ma non in formato zip e quindi scaricabile solo tramite ftp o con copia-incolla').'.
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<div class="callout callout-success">
|
||||||
<p>';
|
<p>';
|
||||||
|
|
||||||
if (!empty($backup_dir)) {
|
if (!empty($backup_dir)) {
|
||||||
echo tr('Il percorso di backup è attualmente in').': <b>'.slashes($backup_dir).'</b>';
|
echo tr('Il percorso di backup è attualmente in').': <b>'.slashes($backup_dir).'</b>';
|
||||||
} else {
|
} else {
|
||||||
echo tr('Sembra che tu non abbia ancora specificato un percorso per il backup').'.';
|
echo tr('Sembra che tu non abbia ancora specificato un percorso per il backup').'.';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</p>
|
</p>
|
||||||
<p><small>'.tr('Puoi modificare il percorso di backup dal tuo file _FILE_', [
|
<p><small>'.tr('Puoi modificare il percorso di backup dal tuo file _FILE_', [
|
||||||
'_FILE_' => '<b>config.inc.php</b>',
|
'_FILE_' => '<b>config.inc.php</b>',
|
||||||
]).'</small></p>';
|
]).'</small></p>';
|
||||||
if (strstr($backup_dir, $docroot)) {
|
|
||||||
|
if (starts_with($backup_dir, $docroot)) {
|
||||||
echo '
|
echo '
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
<i class="fa fa-warning"></i> '.tr('Per motivi di sicurezza si consiglia di modificare il percorso della cartella di backup al di fuori delle cartelle di OSM, possibilmente in una unità esterna').'.
|
<i class="fa fa-warning"></i> '.tr('Per motivi di sicurezza si consiglia di modificare il percorso della cartella di backup al di fuori delle cartelle di OSM, possibilmente in una unità esterna').'.
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_writable($backup_dir)) {
|
if (!is_writable($backup_dir)) {
|
||||||
echo '
|
echo '
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
<i class="fa fa-warning"></i> '.tr('La cartella di backup presente nella configurazione non è utilizzabile dal gestionale!').'. '.tr('Verificare che la cartella abbia i permessi di scrittura abilitati').'.
|
<i class="fa fa-warning"></i> '.tr('La cartella di backup presente nella configurazione non è utilizzabile dal gestionale!').'.
|
||||||
|
'.tr('Verificare che la cartella abbia i permessi di scrittura abilitati').'.
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
</div>';
|
</div>
|
||||||
|
|
||||||
echo '
|
<!-- PULSANTI -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 text-right">
|
||||||
|
<button type="button" class="btn btn-primary pull-right" onclick="continue_backup()"><i class="fa fa-database"></i> '.tr('Crea backup').'...</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>';
|
||||||
<div class="col-md-12 col-lg-6">';
|
|
||||||
|
|
||||||
// Se la cartella di backup non esiste provo a crearla
|
|
||||||
if (!file_exists($backup_dir)) {
|
|
||||||
create_dir($backup_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Lettura file di backup
|
//Lettura file di backup
|
||||||
if (file_exists($backup_dir)) {
|
if (file_exists($backup_dir)) {
|
||||||
@@ -61,12 +70,20 @@ if (file_exists($backup_dir)) {
|
|||||||
|
|
||||||
if (empty($backups_zip) && empty($backups_file)) {
|
if (empty($backups_zip) && empty($backups_file)) {
|
||||||
echo '
|
echo '
|
||||||
<div class="alert alert-warning"><i class="fa fa-warning"></i> '.tr('Non è ancora stato trovato alcun backup!').' '.tr('Se hai già inserito dei dati su OSM crealo il prima possibile...')."</div>\n";
|
<div class="alert alert-warning">
|
||||||
|
<i class="fa fa-warning"></i> '.tr('Non è ancora stato trovato alcun backup!').'
|
||||||
|
'.tr('Se hai già inserito dei dati su OSM crealo il prima possibile...').'
|
||||||
|
</div>';
|
||||||
} else {
|
} else {
|
||||||
// Ordino i backup dal più recente al più vecchio
|
// Ordino i backup dal più recente al più vecchio
|
||||||
arsort($backups_zip);
|
arsort($backups_zip);
|
||||||
arsort($backups_file);
|
arsort($backups_file);
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-md-6">
|
||||||
|
<h3>'.tr('Backup compressi').'</h3>';
|
||||||
|
|
||||||
if (!empty($backups_zip)) {
|
if (!empty($backups_zip)) {
|
||||||
foreach ($backups_zip as $backup) {
|
foreach ($backups_zip as $backup) {
|
||||||
$name = basename($backup);
|
$name = basename($backup);
|
||||||
@@ -90,12 +107,21 @@ if (file_exists($backup_dir)) {
|
|||||||
</a>
|
</a>
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
echo '
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
<i class="fa fa-warning"></i> '.tr('Non è stato trovato alcun backup di questa tipologia!').'
|
||||||
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-12 col-md-6">
|
||||||
|
<h3>'.tr('Backup non compressi').'</h3>';
|
||||||
|
|
||||||
// Backup non compressi e quindi non scaricabili
|
// Backup non compressi e quindi non scaricabili
|
||||||
if (!empty($backups_file)) {
|
if (!empty($backups_file)) {
|
||||||
echo '<hr><b>'.tr('Backup non compressi')."</b>\n";
|
|
||||||
|
|
||||||
foreach ($backups_file as $backup) {
|
foreach ($backups_file as $backup) {
|
||||||
$name = basename($backup);
|
$name = basename($backup);
|
||||||
preg_match('/^OSM backup ([0-9\-]{10}) ([0-9_]{8})$/', $name, $m);
|
preg_match('/^OSM backup ([0-9\-]{10}) ([0-9_]{8})$/', $name, $m);
|
||||||
@@ -118,25 +144,27 @@ if (file_exists($backup_dir)) {
|
|||||||
</a>
|
</a>
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
echo '
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
<i class="fa fa-warning"></i> '.tr('Non è stato trovato alcun backup di questa tipologia!').'
|
||||||
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo '
|
echo '
|
||||||
<div class="alert alert-danger">'.tr('La cartella di backup non esiste!').' '.tr('Non è possibile eseguire i backup!').'</div>';
|
<div class="alert alert-danger">'.tr('La cartella di backup non esiste!').' '.tr('Non è possibile eseguire i backup!').'</div>';
|
||||||
}
|
|
||||||
echo '
|
|
||||||
</div>
|
|
||||||
</div>';
|
|
||||||
|
|
||||||
if (!extension_loaded('zip')) {
|
|
||||||
echo "<div class='alert alert-warning'><i class='fa fa-times'></i> ".tr('Estensione zip non supportata!').' '.tr('Il backup verrà eseguito ma non in formato zip e quindi scaricabile solo tramite ftp o con copia-incolla').".</div>\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($backup_dir != '') {
|
if (!empty($backup_dir)) {
|
||||||
echo '
|
echo '
|
||||||
<button type="button" class="btn btn-primary" onclick="continue_backup()"><i class="fa fa-database"></i> '.tr('Crea backup').'...</button>
|
<button type="button" class="btn btn-primary" onclick="continue_backup()"><i class="fa fa-database"></i> '.tr('Crea backup').'...</button>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function continue_backup(){
|
function continue_backup(){
|
||||||
swal({
|
swal({
|
||||||
title: "'.tr('Nuovo backup').'",
|
title: "'.tr('Nuovo backup').'",
|
||||||
@@ -150,5 +178,5 @@ if ($backup_dir != '') {
|
|||||||
location.href = globals.rootdir + "/editor.php?id_module='.$id_module.'&op=backup";
|
location.href = globals.rootdir + "/editor.php?id_module='.$id_module.'&op=backup";
|
||||||
}, function(){});
|
}, function(){});
|
||||||
}
|
}
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@ switch (post('op')) {
|
|||||||
// Rimozione dei contenuti precedenti
|
// Rimozione dei contenuti precedenti
|
||||||
$files = glob($dir.'/*.zip');
|
$files = glob($dir.'/*.zip');
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
unlink($file);
|
delete($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Selezione delle fatture da stampare
|
// Selezione delle fatture da stampare
|
||||||
@@ -38,10 +38,10 @@ switch (post('op')) {
|
|||||||
create_zip($dir.'tmp/', $file);
|
create_zip($dir.'tmp/', $file);
|
||||||
|
|
||||||
// Invio al browser dello zip
|
// Invio al browser dello zip
|
||||||
force_download($file);
|
download($file);
|
||||||
|
|
||||||
// Rimozione dei contenuti
|
// Rimozione dei contenuti
|
||||||
deltree($dir.'tmp/');
|
delete($dir.'tmp/');
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@@ -48,7 +48,8 @@ switch (post('op')) {
|
|||||||
$nomefile = post('nomefile');
|
$nomefile = post('nomefile');
|
||||||
|
|
||||||
if (!empty($nomefile)) {
|
if (!empty($nomefile)) {
|
||||||
unlink($path.$nomefile);
|
delete($path.$nomefile);
|
||||||
|
|
||||||
$_SESSION['infos'][] = tr('File _FILE_ rimosso correttamente!', [
|
$_SESSION['infos'][] = tr('File _FILE_ rimosso correttamente!', [
|
||||||
'_FILE_' => "'".$nomefile."'",
|
'_FILE_' => "'".$nomefile."'",
|
||||||
]);
|
]);
|
||||||
|
@@ -306,7 +306,7 @@ switch (post('op')) {
|
|||||||
$rs = $dbo->fetchArray('SELECT filename FROM zz_files WHERE id_module='.prepare($id_module).' AND id='.prepare($id_record));
|
$rs = $dbo->fetchArray('SELECT filename FROM zz_files WHERE id_module='.prepare($id_module).' AND id='.prepare($id_record));
|
||||||
|
|
||||||
for ($i = 0; $i < count($rs); ++$i) {
|
for ($i = 0; $i < count($rs); ++$i) {
|
||||||
@unlink($docroot.'/files/interventi/'.$rs[$i]['filename']);
|
delete($docroot.'/files/interventi/'.$rs[$i]['filename']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dbo->query('DELETE FROM zz_files WHERE id_module='.prepare($id_module).' AND id='.prepare($id_record));
|
$dbo->query('DELETE FROM zz_files WHERE id_module='.prepare($id_module).' AND id='.prepare($id_record));
|
||||||
@@ -535,9 +535,7 @@ switch (post('op')) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'firma':
|
case 'firma':
|
||||||
$directory_exists = (file_exists($docroot.'/files/interventi') || create_dir($docroot.'/files/interventi'));
|
if (directory($docroot.'/files/interventi')) {
|
||||||
|
|
||||||
if ($directory_exists) {
|
|
||||||
if (post('firma_base64') != '') {
|
if (post('firma_base64') != '') {
|
||||||
// Salvataggio firma
|
// Salvataggio firma
|
||||||
$firma_file = 'firma_'.time().'.png';
|
$firma_file = 'firma_'.time().'.png';
|
||||||
|
@@ -129,7 +129,7 @@ if (!empty($rs2)) {
|
|||||||
<input type="hidden" name="orario_inizio['.$id.']" value="'.$orario_inizio.'">';
|
<input type="hidden" name="orario_inizio['.$id.']" value="'.$orario_inizio.'">';
|
||||||
} else {
|
} else {
|
||||||
echo '
|
echo '
|
||||||
{[ "type": "timestamp", "name": "orario_inizio['.$id.']", "id": "inizio_'.$id.'", "value": "'.$orario_inizio.'", "class": "orari" ]}';
|
{[ "type": "timestamp", "name": "orario_inizio['.$id.']", "id": "inizio_'.$id.'", "value": "'.$orario_inizio.'", "class": "orari min-width" ]}';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
</td>';
|
</td>';
|
||||||
@@ -143,7 +143,7 @@ if (!empty($rs2)) {
|
|||||||
<input type="hidden" name="orario_fine['.$id.']" value="'.$orario_fine.'">';
|
<input type="hidden" name="orario_fine['.$id.']" value="'.$orario_fine.'">';
|
||||||
} else {
|
} else {
|
||||||
echo '
|
echo '
|
||||||
{[ "type": "timestamp", "name": "orario_fine['.$id.']", "id": "fine_'.$id.'", "value": "'.$orario_fine.'", "class": "orari", "min-date": "'.$orario_inizio.'" ]}';
|
{[ "type": "timestamp", "name": "orario_fine['.$id.']", "id": "fine_'.$id.'", "value": "'.$orario_fine.'", "class": "orari min-width", "min-date": "'.$orario_inizio.'" ]}';
|
||||||
}
|
}
|
||||||
echo '
|
echo '
|
||||||
</td>';
|
</td>';
|
||||||
@@ -151,7 +151,7 @@ if (!empty($rs2)) {
|
|||||||
// ORE
|
// ORE
|
||||||
echo '
|
echo '
|
||||||
<td style="border-right:1px solid #aaa;">
|
<td style="border-right:1px solid #aaa;">
|
||||||
{[ "type": "number", "name": "ore['.$id.']", "value": "'.$ore.'", "disabled": 1 ]}
|
{[ "type": "number", "name": "ore['.$id.']", "value": "'.$ore.'", "disabled": 1, "class": "small-width" ]}
|
||||||
|
|
||||||
<div class="extra hide">
|
<div class="extra hide">
|
||||||
<table class="table table-condensed table-bordered">
|
<table class="table table-condensed table-bordered">
|
||||||
@@ -165,7 +165,7 @@ if (!empty($rs2)) {
|
|||||||
// KM
|
// KM
|
||||||
echo '
|
echo '
|
||||||
<td style="border-right:1px solid #aaa;">
|
<td style="border-right:1px solid #aaa;">
|
||||||
{[ "type": "number", "name": "km['.$id.']", "value": "'.$km.'" ]}
|
{[ "type": "number", "name": "km['.$id.']", "value": "'.$km.'", "class": "small-width" ]}
|
||||||
|
|
||||||
<div class="extra hide">
|
<div class="extra hide">
|
||||||
<table class="table table-condensed table-bordered">
|
<table class="table table-condensed table-bordered">
|
||||||
@@ -200,7 +200,7 @@ if (!empty($rs2)) {
|
|||||||
<td style="border-right:1px solid #aaa;">';
|
<td style="border-right:1px solid #aaa;">';
|
||||||
if ($user['idanagrafica'] == 0 || $show_costi) {
|
if ($user['idanagrafica'] == 0 || $show_costi) {
|
||||||
echo '
|
echo '
|
||||||
{[ "type": "number", "name": "sconto['.$id.']", "value": "'.$sconto_unitario.'", "icon-after": "choice|untprc|'.$tipo_sconto.'" ]}';
|
{[ "type": "number", "name": "sconto['.$id.']", "value": "'.$sconto_unitario.'", "icon-after": "choice|untprc|'.$tipo_sconto.'", "class": "small-width" ]}';
|
||||||
} else {
|
} else {
|
||||||
echo '
|
echo '
|
||||||
<input type="hidden" name="sconto['.$id.']" value="'.Translator::numberToLocale($sconto_unitario).'" />
|
<input type="hidden" name="sconto['.$id.']" value="'.Translator::numberToLocale($sconto_unitario).'" />
|
||||||
@@ -215,7 +215,7 @@ if (!empty($rs2)) {
|
|||||||
<td style="border-right:1px solid #aaa;">';
|
<td style="border-right:1px solid #aaa;">';
|
||||||
if ($user['idanagrafica'] == 0 || $show_costi) {
|
if ($user['idanagrafica'] == 0 || $show_costi) {
|
||||||
echo '
|
echo '
|
||||||
{[ "type": "number", "name": "scontokm['.$id.']", "value": "'.$scontokm_unitario.'", "icon-after": "choice|untprc|'.$tipo_scontokm.'" ]}';
|
{[ "type": "number", "name": "scontokm['.$id.']", "value": "'.$scontokm_unitario.'", "icon-after": "choice|untprc|'.$tipo_scontokm.'", "class": "small-width" ]}';
|
||||||
} else {
|
} else {
|
||||||
echo '
|
echo '
|
||||||
<input type="hidden" name="scontokm['.$id.']" value="'.Translator::numberToLocale($scontokm_unitario).'" />
|
<input type="hidden" name="scontokm['.$id.']" value="'.Translator::numberToLocale($scontokm_unitario).'" />
|
||||||
|
@@ -5,7 +5,7 @@ include_once __DIR__.'/../../core.php';
|
|||||||
unset($_SESSION['superselect']['idanagrafica']);
|
unset($_SESSION['superselect']['idanagrafica']);
|
||||||
$_SESSION['superselect']['idanagrafica'] = $records[0]['idanagrafica'];
|
$_SESSION['superselect']['idanagrafica'] = $records[0]['idanagrafica'];
|
||||||
|
|
||||||
if ($records[0]['firma_file'] == '') {
|
if (empty($records[0]['firma_file'])) {
|
||||||
$frase = tr('Anteprima e firma');
|
$frase = tr('Anteprima e firma');
|
||||||
$info_firma = '';
|
$info_firma = '';
|
||||||
} else {
|
} else {
|
||||||
@@ -13,7 +13,7 @@ if ($records[0]['firma_file'] == '') {
|
|||||||
$info_firma = '<span class="label label-success"><i class="fa fa-edit"></i> '.tr('Firmato il _DATE_ alle _TIME_ da _PERSON_', [
|
$info_firma = '<span class="label label-success"><i class="fa fa-edit"></i> '.tr('Firmato il _DATE_ alle _TIME_ da _PERSON_', [
|
||||||
'_DATE_' => Translator::dateToLocale($records[0]['firma_data']),
|
'_DATE_' => Translator::dateToLocale($records[0]['firma_data']),
|
||||||
'_TIME_' => Translator::timeToLocale($records[0]['firma_data']),
|
'_TIME_' => Translator::timeToLocale($records[0]['firma_data']),
|
||||||
'_NUM_' => '<b>'.$records[0]['firma_nome'].'</b>',
|
'_PERSON_' => '<b>'.$records[0]['firma_nome'].'</b>',
|
||||||
]).'</span>';
|
]).'</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ if ($records[0]['firma_file'] == '') {
|
|||||||
<div class="alert alert-success"><i class="fa fa-check"></i> '.tr('Firmato il _DATE_ alle _TIME_ da _PERSON_', [
|
<div class="alert alert-success"><i class="fa fa-check"></i> '.tr('Firmato il _DATE_ alle _TIME_ da _PERSON_', [
|
||||||
'_DATE_' => Translator::dateToLocale($records[0]['firma_data']),
|
'_DATE_' => Translator::dateToLocale($records[0]['firma_data']),
|
||||||
'_TIME_' => Translator::timeToLocale($records[0]['firma_data']),
|
'_TIME_' => Translator::timeToLocale($records[0]['firma_data']),
|
||||||
'_NUM_' => '<b>'.$records[0]['firma_nome'].'</b>',
|
'_PERSON_' => '<b>'.$records[0]['firma_nome'].'</b>',
|
||||||
]).'</div>';
|
]).'</div>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@@ -66,7 +66,7 @@ switch ($op) {
|
|||||||
// Eliminazione file
|
// Eliminazione file
|
||||||
if (post('delete_immagine') !== null) {
|
if (post('delete_immagine') !== null) {
|
||||||
$filename = basename(post('immagine'));
|
$filename = basename(post('immagine'));
|
||||||
unlink($upload_dir.'/'.$filename);
|
delete($upload_dir.'/'.$filename);
|
||||||
|
|
||||||
$dbo->query("UPDATE my_impianti SET immagine='' WHERE id=".prepare($id_record));
|
$dbo->query("UPDATE my_impianti SET immagine='' WHERE id=".prepare($id_record));
|
||||||
}
|
}
|
||||||
|
@@ -123,7 +123,7 @@ include $docroot.'/templates/replace.php';
|
|||||||
|
|
||||||
// Individuazione dellla configurazione
|
// Individuazione dellla configurazione
|
||||||
$directory = dirname($filename);
|
$directory = dirname($filename);
|
||||||
if (!empty($filename) && ((is_dir($directory) && !is_writable($directory)) || (!is_dir($directory) && !create_dir($directory)))) {
|
if (!empty($filename) && !directory($directory)) {
|
||||||
$error = tr('Non hai i permessi per creare directory e files in _DIRECTORY_', [
|
$error = tr('Non hai i permessi per creare directory e files in _DIRECTORY_', [
|
||||||
'_DIRECTORY_' => $directory,
|
'_DIRECTORY_' => $directory,
|
||||||
]);
|
]);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (file_exists($docroot.'/lib/jscripts/fullcalendar.min.js')) {
|
if (file_exists($docroot.'/lib/jscripts/fullcalendar.min.js')) {
|
||||||
@unlink($docroot.'/lib/jscripts/fullcalendar.min.js');
|
delete($docroot.'/lib/jscripts/fullcalendar.min.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Riporto su ogni riga della fattura la relativa rivalsa inps e ritenuta d'acconto se impostate
|
// Riporto su ogni riga della fattura la relativa rivalsa inps e ritenuta d'acconto se impostate
|
||||||
|
@@ -87,8 +87,11 @@ for ($i = 0; $i < sizeof($rs); ++$i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Eliminazione vecchi file
|
// Eliminazione vecchi file
|
||||||
@unlink($docroot.'/share/themes/default/css/font-awesome.css');
|
$files = [
|
||||||
@deltree($docroot.'/modules/preventivi/js/');
|
$docroot.'/share/themes/default/css/font-awesome.css',
|
||||||
|
$docroot.'/modules/preventivi/js/'
|
||||||
|
];
|
||||||
|
delete($files);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Spostamento agente di riferimento su nuova tabella an_anagrafiche_agenti
|
* Spostamento agente di riferimento su nuova tabella an_anagrafiche_agenti
|
||||||
|
@@ -59,23 +59,12 @@ $database->query('ALTER TABLE `zz_files` DROP `data`');
|
|||||||
* Rimozione file e cartelle deprecati
|
* Rimozione file e cartelle deprecati
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Cartelle deprecate
|
// File e cartelle deprecate
|
||||||
$dirs = [
|
$files = [
|
||||||
'lib/jscripts',
|
'lib/jscripts',
|
||||||
'lib/html2pdf',
|
'lib/html2pdf',
|
||||||
'widgets',
|
'widgets',
|
||||||
'share',
|
'share',
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($dirs as $dir) {
|
|
||||||
$dir = realpath($docroot.'/'.$dir);
|
|
||||||
if (is_dir($dir)) {
|
|
||||||
deltree($dir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// File deprecati
|
|
||||||
$files = [
|
|
||||||
'lib/class.phpmailer.php',
|
'lib/class.phpmailer.php',
|
||||||
'lib/class.pop3.php',
|
'lib/class.pop3.php',
|
||||||
'lib/class.smtp.php',
|
'lib/class.smtp.php',
|
||||||
@@ -99,13 +88,12 @@ $files = [
|
|||||||
'README',
|
'README',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $key => $value) {
|
||||||
$file = realpath($docroot.'/'.$file);
|
$files[$key] = realpath($docroot.'/'.$value);
|
||||||
if (file_exists($file)) {
|
|
||||||
unlink($file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete($files);
|
||||||
|
|
||||||
// File .html dei moduli di default
|
// File .html dei moduli di default
|
||||||
// Per un problema sulla lunghezza massima del path su glob è necessario dividere le cartelle dei moduli di default da pulire
|
// Per un problema sulla lunghezza massima del path su glob è necessario dividere le cartelle dei moduli di default da pulire
|
||||||
$dirs = [
|
$dirs = [
|
||||||
@@ -149,7 +137,5 @@ $pieces = array_chunk($dirs, 5);
|
|||||||
|
|
||||||
foreach ($pieces as $piece) {
|
foreach ($pieces as $piece) {
|
||||||
$files = glob($docroot.'/modules/{'.implode(',', $piece).'}/*.html', GLOB_BRACE);
|
$files = glob($docroot.'/modules/{'.implode(',', $piece).'}/*.html', GLOB_BRACE);
|
||||||
foreach ($files as $file) {
|
delete($files);
|
||||||
unlink($file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user