diff --git a/Core/Frameworks/Baikal/Model/User.php b/Core/Frameworks/Baikal/Model/User.php index df91ea8..5e7649e 100644 --- a/Core/Frameworks/Baikal/Model/User.php +++ b/Core/Frameworks/Baikal/Model/User.php @@ -286,6 +286,6 @@ class User extends \Flake\Core\Model\Db { $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "config.yaml"); } catch (\Exception $e) {} - return md5($this->get("username") . ':' . $config['parameters']['BAIKAL_AUTH_REALM'] . ':' . $sPassword); + return md5($this->get("username") . ':' . $config['parameters']['baikal_auth_realm'] . ':' . $sPassword); } } diff --git a/Core/Frameworks/BaikalAdmin/Controller/Dashboard.php b/Core/Frameworks/BaikalAdmin/Controller/Dashboard.php index a20699d..7ac2ca7 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Dashboard.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Dashboard.php @@ -42,8 +42,8 @@ class Dashboard extends \Flake\Core\Controller { $oView->setData("BAIKAL_VERSION", BAIKAL_VERSION); # Services status - $oView->setData("BAIKAL_CAL_ENABLED", $config['parameters']['BAIKAL_CAL_ENABLED']); - $oView->setData("BAIKAL_CARD_ENABLED", $config['parameters']['BAIKAL_CARD_ENABLED']); + $oView->setData("BAIKAL_CAL_ENABLED", $config['parameters']['baikal_cal_enabled']); + $oView->setData("BAIKAL_CARD_ENABLED", $config['parameters']['baikal_card_enabled']); # Statistics: Users $iNbUsers = \Baikal\Model\User::getBaseRequester()->count(); diff --git a/Core/Frameworks/BaikalAdmin/Controller/Install/UpgradeConfirmation.php b/Core/Frameworks/BaikalAdmin/Controller/Install/UpgradeConfirmation.php index 5dd20da..d0c26d7 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Install/UpgradeConfirmation.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Install/UpgradeConfirmation.php @@ -41,8 +41,8 @@ class UpgradeConfirmation extends \Flake\Core\Controller { $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "config.yaml"); } catch (\Exception $e) {} - if (isset($config['parameters']['BAIKAL_CONFIGURED_VERSION']) && $config['parameters']['BAIKAL_CONFIGURED_VERSION'] === BAIKAL_VERSION) { - $sMessage = "Your system is configured to use version " . $config['parameters']['BAIKAL_CONFIGURED_VERSION'] . ".
There's no upgrade to be done."; + if (isset($config['parameters']['baikal_configured_version']) && $config['parameters']['baikal_configured_version'] === BAIKAL_VERSION) { + $sMessage = "Your system is configured to use version " . $config['parameters']['baikal_configured_version'] . ".
There's no upgrade to be done."; } else { $sMessage = "Upgrading Baïkal from version " . "Unknown" . " to version " . BAIKAL_VERSION . ""; } diff --git a/Core/Frameworks/BaikalAdmin/Controller/Settings/System.php b/Core/Frameworks/BaikalAdmin/Controller/Settings/System.php index 031d61e..e23445b 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Settings/System.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Settings/System.php @@ -71,7 +71,7 @@ class System extends \Flake\Core\Controller { try { $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "system.yaml"); } catch (\Exception $e) {} - $bMySQL = $config['parameters']['PROJECT_DB_MYSQL'] ?? true; + $bMySQL = $config['parameters']['project_db_mysql'] ?? true; } if ($bMySQL === true) { diff --git a/Core/Frameworks/BaikalAdmin/Core/Auth.php b/Core/Frameworks/BaikalAdmin/Core/Auth.php index 57b053b..1eb1f08 100644 --- a/Core/Frameworks/BaikalAdmin/Core/Auth.php +++ b/Core/Frameworks/BaikalAdmin/Core/Auth.php @@ -34,7 +34,7 @@ class Auth { $config = Yaml::parseFile(PROJECT_PATH_CONFIG . "config.yaml"); - if (isset($_SESSION["baikaladminauth"]) && $_SESSION["baikaladminauth"] === md5($config['parameters']['BAIKAL_ADMIN_PASSWORDHASH'])) { + if (isset($_SESSION["baikaladminauth"]) && $_SESSION["baikaladminauth"] === md5($config['parameters']['baikal_admin_passwordhash'])) { return true; } @@ -56,8 +56,8 @@ class Auth { } catch (\Exception $e) { } - if ($sUser === "admin" && $sPassHash === $config['parameters']['BAIKAL_ADMIN_PASSWORDHASH']) { - $_SESSION["baikaladminauth"] = md5($config['parameters']['BAIKAL_ADMIN_PASSWORDHASH']); + if ($sUser === "admin" && $sPassHash === $config['parameters']['baikal_admin_passwordhash']) { + $_SESSION["baikaladminauth"] = md5($config['parameters']['baikal_admin_passwordhash']); return true; } @@ -76,7 +76,7 @@ class Auth { } catch (\Exception $e) { } # Fallback to default value; useful when initializing App, as all constants are not set yet - $sAuthRealm = $config['parameters']['BAIKAL_AUTH_REALM'] ?? "BaikalDAV"; + $sAuthRealm = $config['parameters']['baikal_auth_realm'] ?? "BaikalDAV"; return md5('admin:' . $sAuthRealm . ':' . $sPassword); } diff --git a/Core/Frameworks/BaikalAdmin/WWWRoot/install/index.php b/Core/Frameworks/BaikalAdmin/WWWRoot/install/index.php index fd7035e..c87ce46 100644 --- a/Core/Frameworks/BaikalAdmin/WWWRoot/install/index.php +++ b/Core/Frameworks/BaikalAdmin/WWWRoot/install/index.php @@ -74,15 +74,15 @@ try { $configSystem = Yaml::parseFile(PROJECT_PATH_CONFIG . "system.yaml"); } catch (\Exception $e) { $configSystem = null; } -if (!$configSystem || !isset($configSystem['parameters']["BAIKAL_CONFIGURED_VERSION"])) { +if (!$configSystem || !isset($configSystem['parameters']["baikal_configured_version"])) { # we have to upgrade Baïkal (existing installation) $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Install\Initialize()); -} elseif (!$config || !isset($config['parameters']["BAIKAL_ADMIN_PASSWORDHASH"])) { +} elseif (!$config || !isset($config['parameters']["baikal_admin_passwordhash"])) { # we have to set an admin password $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Install\Initialize()); } else { - if ($configSystem['parameters']["BAIKAL_CONFIGURED_VERSION"] !== BAIKAL_VERSION) { + if ($configSystem['parameters']["baikal_configured_version"] !== BAIKAL_VERSION) { # we have to upgrade Baïkal if (\Flake\Util\Tools::GET("upgradeConfirmed")) { $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Install\VersionUpgrade()); diff --git a/Core/Frameworks/Flake/Framework.php b/Core/Frameworks/Flake/Framework.php index 10ca51e..33ab054 100644 --- a/Core/Frameworks/Flake/Framework.php +++ b/Core/Frameworks/Flake/Framework.php @@ -220,10 +220,10 @@ class Framework extends \Flake\Core\Framework { return true; } # Dont init db on install, but in normal mode and when upgrading - if (defined("BAIKAL_CONTEXT_INSTALL") && (!isset($config['parameters']['BAIKAL_CONFIGURED_VERSION']) || $config['parameters']['BAIKAL_CONFIGURED_VERSION'] === BAIKAL_VERSION)) { + if (defined("BAIKAL_CONTEXT_INSTALL") && (!isset($config['parameters']['baikal_configured_version']) || $config['parameters']['baikal_configured_version'] === BAIKAL_VERSION)) { return true; } - if ($config['parameters']['PROJECT_DB_MYSQL'] === true) { + if ($config['parameters']['project_db_mysql'] === true) { self::initDbMysql($config); } else { self::initDbSqlite($config); @@ -232,22 +232,22 @@ class Framework extends \Flake\Core\Framework { protected static function initDbSqlite(array $config) { # Asserting DB filepath is set - if (!$config['parameters']['PROJECT_SQLITE_FILE']) { + if (!$config['parameters']['project_sqlite_file']) { return false; } # Asserting DB file is writable - if (file_exists($config['parameters']['PROJECT_SQLITE_FILE']) && !is_writable($config['parameters']['PROJECT_SQLITE_FILE'])) { - die("

DB file is not writable. Please give write permissions on file '" . $config['parameters']['PROJECT_SQLITE_FILE'] . "'

"); + if (file_exists($config['parameters']['project_sqlite_file']) && !is_writable($config['parameters']['project_sqlite_file'])) { + die("

DB file is not writable. Please give write permissions on file '" . $config['parameters']['project_sqlite_file'] . "'

"); } # Asserting DB directory is writable - if (!is_writable(dirname($config['parameters']['PROJECT_SQLITE_FILE']))) { - die("

The FOLDER containing the DB file is not writable, and it has to.
Please give write permissions on folder '" . dirname($config['parameters']['PROJECT_SQLITE_FILE']) . "'

"); + if (!is_writable(dirname($config['parameters']['project_sqlite_file']))) { + die("

The FOLDER containing the DB file is not writable, and it has to.
Please give write permissions on folder '" . dirname($config['parameters']['project_sqlite_file']) . "'

"); } - if (file_exists($config['parameters']['PROJECT_SQLITE_FILE']) && is_readable($config['parameters']['PROJECT_SQLITE_FILE']) && !isset($GLOBALS["DB"])) { - $GLOBALS["DB"] = new \Flake\Core\Database\Sqlite($config['parameters']['PROJECT_SQLITE_FILE']); + if (file_exists($config['parameters']['project_sqlite_file']) && is_readable($config['parameters']['project_sqlite_file']) && !isset($GLOBALS["DB"])) { + $GLOBALS["DB"] = new \Flake\Core\Database\Sqlite($config['parameters']['project_sqlite_file']); return true; } @@ -256,28 +256,28 @@ class Framework extends \Flake\Core\Framework { protected static function initDbMysql(array $config) { - if (!$config['parameters']['PROJECT_DB_MYSQL_HOST']) { + if (!$config['parameters']['project_db_mysql_host']) { die("

The constant PROJECT_DB_MYSQL_HOST, containing the MySQL host name, is not set.
You should set it in config/system.yaml

"); } - if (!$config['parameters']['PROJECT_DB_MYSQL_DBNAME']) { + if (!$config['parameters']['project_db_mysql_dbname']) { die("

The constant PROJECT_DB_MYSQL_DBNAME, containing the MySQL database name, is not set.
You should set it in config/system.yaml

"); } - if (!$config['parameters']['PROJECT_DB_MYSQL_USERNAME']) { + if (!$config['parameters']['project_db_mysql_username']) { die("

The constant PROJECT_DB_MYSQL_USERNAME, containing the MySQL database username, is not set.
You should set it in config/system.yaml

"); } - if (!$config['parameters']['PROJECT_DB_MYSQL_PASSWORD']) { + if (!$config['parameters']['project_db_mysql_password']) { die("

The constant PROJECT_DB_MYSQL_PASSWORD, containing the MySQL database password, is not set.
You should set it in config/system.yaml

"); } try { $GLOBALS["DB"] = new \Flake\Core\Database\Mysql( - $config['parameters']['PROJECT_DB_MYSQL_HOST'], - $config['parameters']['PROJECT_DB_MYSQL_DBNAME'], - $config['parameters']['PROJECT_DB_MYSQL_USERNAME'], - $config['parameters']['PROJECT_DB_MYSQL_PASSWORD'] + $config['parameters']['project_db_mysql_host'], + $config['parameters']['project_db_mysql_dbname'], + $config['parameters']['project_db_mysql_username'], + $config['parameters']['project_db_mysql_password'] ); # We now setup t6he connexion to use UTF8 diff --git a/config/config.yaml.dist b/config/config.yaml.dist index 314efe1..e71b59f 100644 --- a/config/config.yaml.dist +++ b/config/config.yaml.dist @@ -1,8 +1,8 @@ parameters: - PROJECT_TIMEZONE: 'Europe/Paris' - BAIKAL_CARD_ENABLED: true - BAIKAL_CAL_ENABLED: true - BAIKAL_INVITE_FROM: 'noreply@localhost' - BAIKAL_DAV_AUTH_TYPE: 'Digest' - BAIKAL_ADMIN_PASSWORDHASH: 5fe794627e1f841f8debba065e2c807a - BAIKAL_AUTH_REALM: BaikalDAV \ No newline at end of file + project_timezone: 'Europe/Paris' + baikal_card_enabled: true + baikal_cal_enabled: true + baikal_invite_from: 'noreply@localhost' + baikal_dav_auth_type: 'Digest' + baikal_admin_passwordhash: 5fe794627e1f841f8debba065e2c807a + baikal_auth_realm: BaikalDAV \ No newline at end of file diff --git a/config/system.yaml.dist b/config/system.yaml.dist index a03b7db..0ce1b68 100644 --- a/config/system.yaml.dist +++ b/config/system.yaml.dist @@ -1,9 +1,9 @@ parameters: - PROJECT_SQLITE_FILE: "absolute/path/to/Specific/db/db.sqlite" - PROJECT_DB_MYSQL: true - PROJECT_DB_MYSQL_HOST: 'localhost' - PROJECT_DB_MYSQL_DBNAME: 'baikal' - PROJECT_DB_MYSQL_USERNAME: 'baikal' - PROJECT_DB_MYSQL_PASSWORD: 'baikal' - BAIKAL_ENCRYPTION_KEY: '5d3f0fa0192e3058ea70f1bb20924add' - BAIKAL_CONFIGURED_VERSION: '0.7.0' \ No newline at end of file + project_sqlite_file: "absolute/path/to/Specific/db/db.sqlite" + project_db_mysql: true + project_db_mysql_host: 'localhost' + project_db_mysql_dbname: 'baikal' + project_db_mysql_username: 'baikal' + project_db_mysql_password: 'baikal' + baikal_encryption_key: '5d3f0fa0192e3058ea70f1bb20924add' + baikal_configured_version: '0.7.0' \ No newline at end of file diff --git a/html/cal.php b/html/cal.php index 682de32..1f818b4 100644 --- a/html/cal.php +++ b/html/cal.php @@ -59,15 +59,15 @@ try { die('

Incomplete installation

Baïkal is missing its configuration file, or its configuration file is unreadable.'); } -if (!isset($config['parameters']["BAIKAL_CAL_ENABLED"]) || $config['parameters']["BAIKAL_CAL_ENABLED"] !== true) { +if (!isset($config['parameters']["baikal_cal_enabled"]) || $config['parameters']["baikal_cal_enabled"] !== true) { throw new ErrorException("Baikal CalDAV is disabled.", 0, 255, __FILE__, __LINE__); } $server = new \Baikal\Core\Server( - $config['parameters']["BAIKAL_CAL_ENABLED"], - $config['parameters']["BAIKAL_CARD_ENABLED"], - $config['parameters']["BAIKAL_DAV_AUTH_TYPE"], - $config['parameters']["BAIKAL_AUTH_REALM"], + $config['parameters']["baikal_cal_enabled"], + $config['parameters']["baikal_card_enabled"], + $config['parameters']["baikal_dav_auth_type"], + $config['parameters']["baikal_auth_realm"], $GLOBALS['DB']->getPDO(), PROJECT_BASEURI . 'cal.php/' ); diff --git a/html/card.php b/html/card.php index 9946066..ae55ece 100644 --- a/html/card.php +++ b/html/card.php @@ -60,15 +60,15 @@ try { die('

Incomplete installation

Baïkal is missing its configuration file, or its configuration file is unreadable.'); } -if (!isset($config['parameters']["BAIKAL_CARD_ENABLED"]) || $config['parameters']["BAIKAL_CARD_ENABLED"] !== true) { +if (!isset($config['parameters']["baikal_card_enabled"]) || $config['parameters']["baikal_card_enabled"] !== true) { throw new ErrorException("Baikal CardDAV is disabled.", 0, 255, __FILE__, __LINE__); } $server = new \Baikal\Core\Server( - $config['parameters']["BAIKAL_CAL_ENABLED"], - $config['parameters']["BAIKAL_CARD_ENABLED"], - $config['parameters']["BAIKAL_DAV_AUTH_TYPE"], - $config['parameters']["BAIKAL_AUTH_REALM"], + $config['parameters']["baikal_cal_enabled"], + $config['parameters']["baikal_card_enabled"], + $config['parameters']["baikal_dav_auth_type"], + $config['parameters']["baikal_auth_realm"], $GLOBALS['DB']->getPDO(), PROJECT_BASEURI . 'card.php/' ); diff --git a/html/dav.php b/html/dav.php index dfd43d0..b6f8a9d 100644 --- a/html/dav.php +++ b/html/dav.php @@ -59,10 +59,10 @@ try { } $server = new \Baikal\Core\Server( - $config['parameters']["BAIKAL_CAL_ENABLED"], - $config['parameters']["BAIKAL_CARD_ENABLED"], - $config['parameters']["BAIKAL_DAV_AUTH_TYPE"], - $config['parameters']["BAIKAL_AUTH_REALM"], + $config['parameters']["baikal_cal_enabled"], + $config['parameters']["baikal_card_enabled"], + $config['parameters']["baikal_dav_auth_type"], + $config['parameters']["baikal_auth_realm"], $GLOBALS['DB']->getPDO(), PROJECT_BASEURI . 'dav.php/' );