1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-01 16:36:45 +01:00
Risoluzione di alcuni bug relativi alla presenza di newline all'interno dei tag personalizzati del progetto e all'impostazione di backuo automatico all'accesso.
This commit is contained in:
Thomas Zilio 2017-09-11 18:12:41 +02:00
parent a89ad1feee
commit 3b7b590bfc
4 changed files with 13 additions and 11 deletions

View File

@ -122,7 +122,11 @@ $dbo = Database::getConnection();
$continue = $dbo->isInstalled() && !Update::isUpdateAvailable() && (Auth::check() || API::isAPIRequest());
if (!$continue && slashes($_SERVER['SCRIPT_FILENAME']) != slashes(DOCROOT.'/index.php')) {
redirect(ROOTDIR.'/index.php?op=logout');
if (Auth::check()) {
Auth::logout();
}
redirect(ROOTDIR.'/index.php');
exit();
}

View File

@ -32,13 +32,10 @@ switch ($op) {
$_SESSION['infos'][] = tr('Backup saltato perché già esistente!');
} elseif (empty($backup_dir)) {
$_SESSION['errors'][] = tr('Non è possibile eseguire i backup poichè la cartella di backup non è stata impostata!!!');
} elseif (directory($backup_dir)) {
$_SESSION['infos'][] = tr('La cartella di backup è stata creata correttamente.');
if (do_backup()) {
} elseif (directory($backup_dir) && do_backup()) {
$_SESSION['infos'][] = tr('Backup automatico eseguito correttamente!');
}
} else {
$_SESSION['errors'][] = tr('Non è stato possibile creare la cartella di backup!');
$_SESSION['errors'][] = tr('Errore durante la generazione del backup automatico!');
}
}
}

View File

@ -256,8 +256,6 @@ class Auth extends \Util\Singleton
$this->first_module = null;
session_unset();
session_destroy();
session_start();
session_regenerate_id();
$_SESSION['infos'] = [];

View File

@ -88,7 +88,7 @@ class HTMLBuilder
*/
public static function replace($html)
{
preg_match_all('/'.preg_quote(self::$open['manager']).'(.+?)'.preg_quote(self::$close['manager']).'/i', $html, $managers);
preg_match_all('/'.preg_quote(self::$open['manager']).'(.+?)'.preg_quote(self::$close['manager']).'/is', $html, $managers);
foreach ($managers[0] as $value) {
$json = self::decode($value, 'manager');
@ -97,7 +97,7 @@ class HTMLBuilder
$html = str_replace($value, !empty($class) ? $class->manage($json) : '', $html);
}
preg_match_all('/'.preg_quote(self::$open['handler']).'(.+?)'.preg_quote(self::$close['handler']).'/i', $html, $handlers);
preg_match_all('/'.preg_quote(self::$open['handler']).'(.+?)'.preg_quote(self::$close['handler']).'/is', $html, $handlers);
foreach ($handlers[0] as $value) {
$json = self::decode($value, 'handler');
@ -151,6 +151,9 @@ class HTMLBuilder
{
$string = '{'.substr($string, strlen(self::$open[$type]), -strlen(self::$close[$type])).'}';
// Fix per contenuti con newline integrate
$string = str_replace(["\n", "\r"], ['\\n', '\\r'], $string);
$json = (array) json_decode($string, true, 2);
return $json;