diff --git a/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config.php b/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config.php index bb0be08..a19a227 100755 --- a/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config.php +++ b/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config.php @@ -98,15 +98,15 @@ abstract class Config extends \Flake\Core\Model\NoDb { break; } } - + + $aRes[$sConstant] = $sValue; + } elseif($iNbRes > 1) { throw new \Exception("Baikal\Model\Config->parseConfig(): constant '" . $sConstant . "' has been found multiple times in the config file; stopping execution"); } else { # $iNbRes === 0 # We do nothing, to keep the default value (the one already set in $aData) } - - $aRes[$sConstant] = $sValue; } reset($aRes); @@ -143,12 +143,12 @@ abstract class Config extends \Flake\Core\Model\NoDb { foreach(array_keys($this->aData) as $prop) { $iLines = count($aLines); $sPattern = '/\s*define\(\s*["|\']' . $prop . '["|\']\s*\,\s*(.*?)\s*\);\s*/ix'; - + $sValue = $this->aData[$prop]; + for($k = ($iLines - 1); $k >= 0; $k--) { if(preg_match($sPattern, $aLines[$k])) { # Found the last matching line - - $sValue = $this->aData[$prop]; + $bCalculated = (isset($this->aConstants[$prop]["type"]["calculated"]) && $this->aConstants[$prop]["type"]["calculated"] === TRUE); switch($this->aConstants[$prop]["type"]) { @@ -181,6 +181,9 @@ abstract class Config extends \Flake\Core\Model\NoDb { } $aLines[$k] = "define(\"" . $prop . "\", " . $sValue . ");"; + } else { + # Adding line at the end of the file + $aLines[] = "\n" . "# " . $this->aConstants[$prop]["comment"] . "\n" . define(\"" . $prop . "\", " . $sValue . ");" } } } diff --git a/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config/Distrib.php b/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config/Distrib.php index b1b6745..e9b37ba 100644 --- a/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config/Distrib.php +++ b/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config/Distrib.php @@ -31,12 +31,15 @@ class Distrib extends \Baikal\Model\Config { protected $aConstants = array( "BAIKAL_VERSION" => array( "type" => "string", + "comment" => "The version of the packaged system" ), "BAIKAL_HOMEPAGE" => array( "type" => "string", + "comment" => "The URL to the project homepage", ), "PROJECT_PACKAGE" => array( "type" => "string", + "comment" => "The type of the current package (one of 'flat', 'regular')" ), ); diff --git a/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config/Standard.php b/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config/Standard.php index 98047ec..8d8b130 100755 --- a/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config/Standard.php +++ b/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config/Standard.php @@ -31,21 +31,27 @@ class Standard extends \Baikal\Model\Config { protected $aConstants = array( "PROJECT_TIMEZONE" => array( "type" => "string", - ), - "BAIKAL_ADMIN_ENABLED" => array( - "type" => "boolean", - ), - "BAIKAL_ADMIN_AUTOLOCKENABLED" => array( - "type" => "boolean", - ), - "BAIKAL_CAL_ENABLED" => array( - "type" => "boolean", + "comment" => "Timezone of your users, if unsure, check http://en.wikipedia.org/wiki/List_of_tz_database_time_zones", ), "BAIKAL_CARD_ENABLED" => array( "type" => "boolean", + "comment" => "CardDAV ON/OFF switch; default TRUE", + ), + "BAIKAL_CAL_ENABLED" => array( + "type" => "boolean", + "comment" => "CalDAV ON/OFF switch; default TRUE", + ), + "BAIKAL_ADMIN_ENABLED" => array( + "type" => "boolean", + "comment" => "Baïkal Web Admin ON/OFF switch; default TRUE", + ), + "BAIKAL_ADMIN_AUTOLOCKENABLED" => array( + "type" => "boolean", + "comment" => "Baïkal Web Admin autolock ON/OFF switch; default FALSE", ), "BAIKAL_ADMIN_PASSWORDHASH" => array( "type" => "string", + "comment" => "Baïkal Web admin password hash; Set via Baïkal Web Admin", ) ); diff --git a/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config/System.php b/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config/System.php index e0aa0af..71e35d9 100755 --- a/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config/System.php +++ b/CoreVersions/0.2.1/Frameworks/Baikal/Model/Config/System.php @@ -29,61 +29,79 @@ namespace Baikal\Model\Config; class System extends \Baikal\Model\Config { protected $aConstants = array( - "BAIKAL_PATH_SABREDAV" => array( - "type" => "litteral", - ), - "BAIKAL_AUTH_REALM" => array( - "type" => "string", - ), - "BAIKAL_CARD_BASEURI" => array( - "type" => "litteral", - ), - "BAIKAL_CAL_BASEURI" => array( - "type" => "litteral", - ), "BAIKAL_STANDALONE_ALLOWED" => array( "type" => "boolean", + "comment" => "Standalone Server, allowed or not; default FALSE", ), "BAIKAL_STANDALONE_PORT" => array( "type" => "integer", + "comment" => "Standalone Server, port number; default 8888"; + ), + "BAIKAL_PATH_SABREDAV" => array( + "type" => "litteral", + "comment" => "PATH to SabreDAV", + ), + "BAIKAL_AUTH_REALM" => array( + "type" => "string", + "comment" => "If you change this value, you'll have to re-generate passwords for all your users", + ), + "BAIKAL_CARD_BASEURI" => array( + "type" => "litteral", + "comment" => 'Should begin and end with a "/"', + ), + "BAIKAL_CAL_BASEURI" => array( + "type" => "litteral", + "comment" => 'Should begin and end with a "/"', ), "PROJECT_SQLITE_FILE" => array( "type" => "litteral", + "comment" => "Define path to Baïkal Database SQLite file", ), "PROJECT_DB_MYSQL" => array( "type" => "boolean", + "comment" => "MySQL > Use mysql instead of SQLite ?", ), "PROJECT_DB_MYSQL_HOST" => array( "type" => "string", + "comment" => "MySQL > Host, including ':portnumber' if port is not the default one (3306)" ), "PROJECT_DB_MYSQL_DBNAME" => array( "type" => "string", + "comment" => "MySQL > Database name", ), "PROJECT_DB_MYSQL_USERNAME" => array( "type" => "string", + "comment" => "MySQL > Username", ), "PROJECT_DB_MYSQL_PASSWORD" => array( "type" => "string", + "comment" => "MySQL > Password", + ), + "BAIKAL_ENCRYPTION_KEY" => array( + "type" => "string", + "comment" => "A random 32 bytes key that will be used to encrypt data", ), "BAIKAL_CONFIGURED_VERSION" => array( "type" => "string", + "comment" => "The currently configured Baïkal version", ), ); # Default values protected $aData = array( + "BAIKAL_STANDALONE_ALLOWED" => FALSE, + "BAIKAL_STANDALONE_PORT" => 8888, "BAIKAL_PATH_SABREDAV" => 'PROJECT_PATH_FRAMEWORKS . "SabreDAV/lib/Sabre/"', "BAIKAL_AUTH_REALM" => "BaikalDAV", "BAIKAL_CARD_BASEURI" => 'PROJECT_BASEURI . "card.php/"', "BAIKAL_CAL_BASEURI" => 'PROJECT_BASEURI . "cal.php/"', - "BAIKAL_STANDALONE_ALLOWED" => FALSE, - "BAIKAL_STANDALONE_PORT" => 8888, "PROJECT_SQLITE_FILE" => 'PROJECT_PATH_SPECIFIC . "db/db.sqlite"', "PROJECT_DB_MYSQL" => FALSE, "PROJECT_DB_MYSQL_HOST" => "", "PROJECT_DB_MYSQL_DBNAME" => "", "PROJECT_DB_MYSQL_USERNAME" => "", "PROJECT_DB_MYSQL_PASSWORD" => "", + "BAIKAL_ENCRYPTION_KEY" => "", "BAIKAL_CONFIGURED_VERSION" => "", ); diff --git a/CoreVersions/0.2.1/Frameworks/BaikalAdmin/Controller/Install/Initialize.php b/CoreVersions/0.2.1/Frameworks/BaikalAdmin/Controller/Install/Initialize.php index 4c521fc..56b26e1 100755 --- a/CoreVersions/0.2.1/Frameworks/BaikalAdmin/Controller/Install/Initialize.php +++ b/CoreVersions/0.2.1/Frameworks/BaikalAdmin/Controller/Install/Initialize.php @@ -162,7 +162,7 @@ define("BAIKAL_ADMIN_ENABLED", TRUE); # Baïkal Web Admin autolock ON/OFF switch; default FALSE define("BAIKAL_ADMIN_AUTOLOCKENABLED", FALSE); -# Baïkal Web admin password hash; Set by Core/Scripts/adminpassword.php or via Baïkal Web Admin +# Baïkal Web admin password hash; Set via Baïkal Web Admin define("BAIKAL_ADMIN_PASSWORDHASH", ""); CODE; $sCode = trim($sCode); @@ -201,7 +201,7 @@ define("BAIKAL_CAL_BASEURI", PROJECT_BASEURI . "cal.php/"); # Define path to Baïkal Database SQLite file define("PROJECT_SQLITE_FILE", PROJECT_PATH_SPECIFIC . "db/db.sqlite"); -# Mysql > Use mysql instead of SQLite ? +# MySQL > Use mysql instead of SQLite ? define("PROJECT_DB_MYSQL", FALSE); # MySQL > Host, including ':portnumber' if port is not the default one (3306) diff --git a/CoreVersions/0.2.1/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php b/CoreVersions/0.2.1/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php index 6471917..4a011aa 100755 --- a/CoreVersions/0.2.1/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php +++ b/CoreVersions/0.2.1/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php @@ -106,6 +106,12 @@ HTML; } protected function updateConfiguredVersion($sVersionTo) { + + # Create new settings + $oConfig = new \Baikal\Model\Config\Standard(PROJECT_PATH_SPECIFIC . "config.php"); + $oConfig->persist(); + + # Update BAIKAL_CONFIGURED_VERSION $oConfig = new \Baikal\Model\Config\System(PROJECT_PATH_SPECIFIC . "config.system.php"); $oConfig->set("BAIKAL_CONFIGURED_VERSION", $sVersionTo); $oConfig->persist();