Compare commits

...

4 Commits
2.0.6 ... 2.0.7

Author SHA1 Message Date
Michael Kaufmann
80e442e396 set version to 2.0.7
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-01-10 22:15:57 +01:00
Michael Kaufmann
489ad375bd ensure latest userdata.inc.php layout for updaters/users of old format
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-01-10 16:54:20 +01:00
Michael Kaufmann
c420196e73 check explicitly for template existence and try to use default theme as fallback; fixes #1071
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-01-10 16:53:36 +01:00
Michael Kaufmann
cc6d8d5f8b fix login if non-standard ports are used for froxlor vhost
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-01-10 12:43:04 +01:00
6 changed files with 59 additions and 9 deletions

View File

@@ -696,7 +696,7 @@ opcache.validate_timestamps'),
('system', 'distribution', ''), ('system', 'distribution', ''),
('system', 'update_channel', 'stable'), ('system', 'update_channel', 'stable'),
('system', 'updatecheck_data', ''), ('system', 'updatecheck_data', ''),
('system', 'update_notify_last', '2.0.6'), ('system', 'update_notify_last', '2.0.7'),
('system', 'traffictool', 'goaccess'), ('system', 'traffictool', 'goaccess'),
('api', 'enabled', '0'), ('api', 'enabled', '0'),
('2fa', 'enabled', '1'), ('2fa', 'enabled', '1'),
@@ -740,7 +740,7 @@ opcache.validate_timestamps'),
('panel', 'logo_overridetheme', '0'), ('panel', 'logo_overridetheme', '0'),
('panel', 'logo_overridecustom', '0'), ('panel', 'logo_overridecustom', '0'),
('panel', 'settings_mode', '0'), ('panel', 'settings_mode', '0'),
('panel', 'version', '2.0.6'), ('panel', 'version', '2.0.7'),
('panel', 'db_version', '202212060'); ('panel', 'db_version', '202212060');

View File

@@ -291,3 +291,13 @@ if (Froxlor::isFroxlorVersion('2.0.5')) {
Froxlor::updateToVersion('2.0.6'); Froxlor::updateToVersion('2.0.6');
} }
if (Froxlor::isFroxlorVersion('2.0.6')) {
Update::showUpdateStep("Updating from 2.0.6 to 2.0.7", false);
Update::showUpdateStep("Correcting allowed_mysqlserver for customers");
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `allowed_mysqlserver` = '[0]' WHERE `allowed_mysqlserver` = ''");
Update::lastStepStatus(0);
Froxlor::updateToVersion('2.0.7');
}

View File

@@ -28,6 +28,7 @@ namespace Froxlor\Database;
use Exception; use Exception;
use Froxlor\FileDir; use Froxlor\FileDir;
use Froxlor\Froxlor; use Froxlor\Froxlor;
use Froxlor\PhpHelper;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\UI\Panel\UI; use Froxlor\UI\Panel\UI;
use PDO; use PDO;
@@ -137,7 +138,7 @@ class Database
require Froxlor::getInstallDir() . "/lib/userdata.inc.php"; require Froxlor::getInstallDir() . "/lib/userdata.inc.php";
// le format // le format
if (isset($sql['root_user']) && isset($sql['root_password']) && !is_array($sql_root)) { if (isset($sql['root_user']) && isset($sql['root_password']) && empty($sql_root)) {
$sql_root = [ $sql_root = [
0 => [ 0 => [
'caption' => 'Default', 'caption' => 'Default',
@@ -147,12 +148,20 @@ class Database
'password' => $sql['root_password'] 'password' => $sql['root_password']
] ]
]; ];
unset($sql['root_user']);
unset($sql['root_password']);
// write new layout so this won't happen again
self::generateNewUserData($sql, $sql_root);
// re-read file
require Froxlor::getInstallDir() . "/lib/userdata.inc.php";
} }
$substitutions = [ $substitutions = [
$sql['password'] => 'DB_UNPRIV_PWD', $sql['password'] => 'DB_UNPRIV_PWD',
$sql_root[0]['password'] => 'DB_ROOT_PWD'
]; ];
foreach ($sql_root as $dbserver => $sql_root_data) {
$substitutions[$sql_root_data[$dbserver]]['password'] = 'DB_ROOT_PWD';
}
// hide username/password in messages // hide username/password in messages
$error_message = $error->getMessage(); $error_message = $error->getMessage();
@@ -408,7 +417,7 @@ class Database
require Froxlor::getInstallDir() . "/lib/userdata.inc.php"; require Froxlor::getInstallDir() . "/lib/userdata.inc.php";
// le format // le format
if (self::$needroot == true && isset($sql['root_user']) && isset($sql['root_password']) && (!isset($sql_root) || !is_array($sql_root))) { if (isset($sql['root_user']) && isset($sql['root_password']) && (!isset($sql_root) || !is_array($sql_root))) {
$sql_root = [ $sql_root = [
0 => [ 0 => [
'caption' => 'Default', 'caption' => 'Default',
@@ -420,6 +429,10 @@ class Database
]; ];
unset($sql['root_user']); unset($sql['root_user']);
unset($sql['root_password']); unset($sql['root_password']);
// write new layout so this won't happen again
self::generateNewUserData($sql, $sql_root);
// re-read file
require Froxlor::getInstallDir() . "/lib/userdata.inc.php";
} }
// either root or unprivileged user // either root or unprivileged user
@@ -582,4 +595,22 @@ class Database
} }
return $result; return $result;
} }
/**
* write new userdata.inc.php file
*/
private static function generateNewUserData(array $sql, array $sql_root)
{
$content = PhpHelper::parseArrayToPhpFile(
['sql' => $sql, 'sql_root' => $sql_root],
'automatically generated userdata.inc.php for froxlor'
);
chmod(Froxlor::getInstallDir() . "/lib/userdata.inc.php", 0700);
file_put_contents(Froxlor::getInstallDir() . "/lib/userdata.inc.php", $content);
chmod(Froxlor::getInstallDir() . "/lib/userdata.inc.php", 0400);
clearstatcache();
if (function_exists('opcache_invalidate')) {
@opcache_invalidate(Froxlor::getInstallDir() . "/lib/userdata.inc.php", true);
}
}
} }

View File

@@ -31,7 +31,7 @@ final class Froxlor
{ {
// Main version variable // Main version variable
const VERSION = '2.0.6'; const VERSION = '2.0.7';
// Database version (YYYYMMDDC where C is a daily counter) // Database version (YYYYMMDDC where C is a daily counter)
const DBVERSION = '202212060'; const DBVERSION = '202212060';

View File

@@ -95,7 +95,7 @@ class UI
session_set_cookie_params([ session_set_cookie_params([
'lifetime' => self::$install_mode ? 7200 : 600, // will be renewed based on settings in lib/init.php 'lifetime' => self::$install_mode ? 7200 : 600, // will be renewed based on settings in lib/init.php
'path' => '/', 'path' => '/',
'domain' => $_SERVER['HTTP_HOST'], 'domain' => $_SERVER['SERVER_NAME'],
'secure' => self::requestIsHttps(), 'secure' => self::requestIsHttps(),
'httponly' => true, 'httponly' => true,
'samesite' => 'Strict' 'samesite' => 'Strict'
@@ -260,8 +260,17 @@ class UI
*/ */
public static function twigBuffer($name, array $context = []) public static function twigBuffer($name, array $context = [])
{ {
$template_file = self::getTheme() . '/' . $name;
if (!file_exists(Froxlor::getInstallDir() . '/templates/' . $template_file)) {
PhpHelper::phpErrHandler(E_USER_WARNING, "Template '" . $template_file . "' could not be found, trying fallback theme", __FILE__, __LINE__);
$template_file = self::$default_theme . '/'. $name;
if (!file_exists(Froxlor::getInstallDir() . '/templates/' . $template_file)) {
PhpHelper::phpErrHandler(E_USER_ERROR, "Unknown template '" . $template_file . "'", __FILE__, __LINE__);
}
}
self::$twigbuf[] = [ self::$twigbuf[] = [
self::getTheme() . '/' . $name => $context $template_file => $context
]; ];
} }

View File

@@ -332,7 +332,7 @@ if (CurrentUser::hasSession()) {
$cookie_params = [ $cookie_params = [
'expires' => time() + Settings::Get('session.sessiontimeout'), 'expires' => time() + Settings::Get('session.sessiontimeout'),
'path' => '/', 'path' => '/',
'domain' => $_SERVER['HTTP_HOST'], 'domain' => $_SERVER['SERVER_NAME'],
'secure' => UI::requestIsHttps(), 'secure' => UI::requestIsHttps(),
'httponly' => true, 'httponly' => true,
'samesite' => 'Strict' 'samesite' => 'Strict'