parent
54ac9d0f64
commit
9c679bbe1c
7 changed files with 88 additions and 35 deletions
|
@ -87,6 +87,10 @@ define("BAIKAL_PATH_CORE", BAIKAL_PATH_ROOT . "Core/");
|
|||
define("BAIKAL_PATH_SPECIFIC", BAIKAL_PATH_ROOT . "Specific/");
|
||||
define("BAIKAL_PATH_FRAMEWORKS", BAIKAL_PATH_CORE . "Frameworks/");
|
||||
define("BAIKAL_PATH_WWWROOT", BAIKAL_PATH_CORE . "WWWRoot/");
|
||||
|
||||
# Define path to Baïkal SQLite file
|
||||
define("BAIKAL_SQLITE_FILE", BAIKAL_PATH_SPECIFIC . "db/baikal.sqlite");
|
||||
|
||||
require_once(BAIKAL_PATH_CORE . "Distrib.php");
|
||||
|
||||
# Determine BAIKAL_URI
|
||||
|
@ -99,6 +103,8 @@ define("BAIKAL_BASEURI", $sBaseUrl);
|
|||
define("BAIKAL_URI", $sProtocol . "://" . rmEndSlash($_SERVER["HTTP_HOST"]) . $sBaseUrl);
|
||||
unset($sScript); unset($sDirName); unset($sBaseUrl); unset($sProtocol); unset($aParts);
|
||||
|
||||
# Bootstrap Flake
|
||||
require_once(BAIKAL_PATH_FRAMEWORKS . "Flake/Core/Bootstrap.php");
|
||||
|
||||
# Check that a config file exists
|
||||
if(
|
||||
|
@ -129,9 +135,6 @@ if(
|
|||
}
|
||||
|
||||
\Baikal\Core\Tools::assertBaikalIsOk();
|
||||
|
||||
# Bootstrap Flake
|
||||
require_once(BAIKAL_PATH_FRAMEWORKS . "Flake/Core/Bootstrap.php");
|
||||
|
||||
# Establishing connection with database
|
||||
$GLOBALS["DB"] = new \Flake\Core\Database\Sqlite(BAIKAL_SQLITE_FILE);
|
||||
|
|
|
@ -41,9 +41,6 @@ class System extends \Baikal\Model\Config {
|
|||
"BAIKAL_CAL_BASEURI" => array(
|
||||
"type" => "litteral",
|
||||
),
|
||||
"BAIKAL_SQLITE_FILE" => array(
|
||||
"type" => "litteral",
|
||||
),
|
||||
"BAIKAL_STANDALONE_ALLOWED" => array(
|
||||
"type" => "boolean",
|
||||
),
|
||||
|
@ -57,7 +54,6 @@ class System extends \Baikal\Model\Config {
|
|||
"BAIKAL_AUTH_REALM" => "",
|
||||
"BAIKAL_CARD_BASEURI" => "",
|
||||
"BAIKAL_CAL_BASEURI" => "",
|
||||
"BAIKAL_SQLITE_FILE" => "",
|
||||
"BAIKAL_STANDALONE_ALLOWED" => "",
|
||||
"BAIKAL_STANDALONE_PORT" => "",
|
||||
);
|
||||
|
@ -100,14 +96,6 @@ class System extends \Baikal\Model\Config {
|
|||
)
|
||||
)));
|
||||
|
||||
$oMorpho->add(new \Formal\Element\Text(array(
|
||||
"prop" => "BAIKAL_SQLITE_FILE",
|
||||
"label" => "Path to SQLite DB",
|
||||
"inputclass" => "input-xxlarge",
|
||||
"validation" => "required",
|
||||
"help" => "The absolute server path to SQLite database."
|
||||
)));
|
||||
|
||||
$oMorpho->add(new \Formal\Element\Text(array(
|
||||
"prop" => "BAIKAL_AUTH_REALM",
|
||||
"label" => "Auth realm",
|
||||
|
@ -119,16 +107,18 @@ class System extends \Baikal\Model\Config {
|
|||
)
|
||||
)));
|
||||
|
||||
$oMorpho->add(new \Formal\Element\Checkbox(array(
|
||||
"prop" => "BAIKAL_STANDALONE_ALLOWED",
|
||||
"label" => "Allow Standalone Baïkal execution"
|
||||
)));
|
||||
|
||||
$oMorpho->add(new \Formal\Element\Text(array(
|
||||
"prop" => "BAIKAL_STANDALONE_PORT",
|
||||
"label" => "Standalone Baïkal port"
|
||||
)));
|
||||
|
||||
if(\Flake\Util\Frameworks::enabled("BaikalStandalone")) {
|
||||
$oMorpho->add(new \Formal\Element\Checkbox(array(
|
||||
"prop" => "BAIKAL_STANDALONE_ALLOWED",
|
||||
"label" => "Allow Standalone Baïkal execution"
|
||||
)));
|
||||
|
||||
$oMorpho->add(new \Formal\Element\Text(array(
|
||||
"prop" => "BAIKAL_STANDALONE_PORT",
|
||||
"label" => "Standalone Baïkal port"
|
||||
)));
|
||||
}
|
||||
|
||||
return $oMorpho;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,21 @@ class Initialize extends \Flake\Core\Controller {
|
|||
|
||||
if($this->oForm->persisted()) {
|
||||
$sContent = file_get_contents(BAIKAL_PATH_SPECIFIC . "config.system.php");
|
||||
$sContent .= "\n\ndefine(\"BAIKAL_CONFIGURED_VERSION\", \"" . BAIKAL_VERSION . "\");\n";
|
||||
file_put_contents(BAIKAL_PATH_SPECIFIC . "config.system.php", $sContent);
|
||||
|
||||
$sBaikalVersion = BAIKAL_VERSION;
|
||||
$sEncryptionKey = md5(microtime() . rand());
|
||||
|
||||
# Setting "BAIKAL_CONFIGURED_VERSION"
|
||||
$sNewConstants =<<<PHP
|
||||
# A random 32 bytes key that will be used to encrypt data
|
||||
define("BAIKAL_ENCRYPTION_KEY", "{$sEncryptionKey}");
|
||||
|
||||
# The currently configured Baïkal version
|
||||
define("BAIKAL_CONFIGURED_VERSION", "{$sBaikalVersion}");
|
||||
PHP;
|
||||
|
||||
# Writing results to file
|
||||
file_put_contents(BAIKAL_PATH_SPECIFIC . "config.system.php", $sContent . "\n\n" . $sNewConstants);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,13 +169,10 @@ define("BAIKAL_PATH_SABREDAV", BAIKAL_PATH_FRAMEWORKS . "SabreDAV/lib/Sabre/");
|
|||
define("BAIKAL_AUTH_REALM", "BaikalDAV");
|
||||
|
||||
# Should begin and end with a "/"
|
||||
define("BAIKAL_CARD_BASEURI", "/card.php/");
|
||||
define("BAIKAL_CARD_BASEURI", BAIKAL_BASEURI . "card.php/");
|
||||
|
||||
# Should begin and end with a "/"
|
||||
define("BAIKAL_CAL_BASEURI", "/cal.php/");
|
||||
|
||||
# SQLite DB path
|
||||
define("BAIKAL_SQLITE_FILE", BAIKAL_PATH_SPECIFIC . "db/baikal.sqlite");
|
||||
define("BAIKAL_CAL_BASEURI", BAIKAL_BASEURI . "cal.php/");
|
||||
CODE;
|
||||
$sCode = trim($sCode);
|
||||
return $sCode;
|
||||
|
|
|
@ -152,6 +152,9 @@ class Collection extends \Flake\Core\FLObject implements \Iterator {
|
|||
} else {
|
||||
$this->aMeta[$sKey] =& $mValue;
|
||||
}
|
||||
|
||||
$res = NULL;
|
||||
return $res; # To avoid 'Notice: Only variable references should be returned by reference'
|
||||
|
||||
} elseif(
|
||||
strlen($sName) > 7 &&
|
||||
|
@ -172,5 +175,7 @@ class Collection extends \Flake\Core\FLObject implements \Iterator {
|
|||
} else {
|
||||
throw new \Exception("Method " . $sName . "() not found on " . get_class($this));
|
||||
}
|
||||
|
||||
debug("laaaaaaaaaaaaa:" . $sName);
|
||||
}
|
||||
}
|
36
CoreVersions/Baikal_0.1/Frameworks/Flake/Util/Frameworks.php
Normal file
36
CoreVersions/Baikal_0.1/Frameworks/Flake/Util/Frameworks.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/***************************************************************
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2012 Jérôme Schneider <mail@jeromeschneider.fr>
|
||||
* All rights reserved
|
||||
*
|
||||
* http://baikal.codr.fr
|
||||
*
|
||||
* This script is part of the Baïkal Server project. The Baïkal
|
||||
* Server project is free software; you can redistribute it
|
||||
* and/or modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
namespace Flake\Util;
|
||||
|
||||
class Frameworks extends \Flake\Core\FLObject {
|
||||
private function __construct() { # private constructor to force static class
|
||||
}
|
||||
|
||||
public static function enabled($sFramework) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
|
@ -27,7 +27,10 @@
|
|||
namespace Flake\Util;
|
||||
|
||||
class Tools extends \Flake\Core\FLObject {
|
||||
|
||||
|
||||
private function __construct() { # private constructor to force static class
|
||||
}
|
||||
|
||||
public static function getCurrentUrl() {
|
||||
if(MONGOOSE_SERVER) {
|
||||
$sUrl = $GLOBALS["_SERVER"]["REQUEST_URI"];
|
||||
|
|
|
@ -26,8 +26,14 @@
|
|||
|
||||
define("FLAKE_URI", BAIKAL_URI);
|
||||
define("FLAKE_DB_FILEPATH", BAIKAL_SQLITE_FILE);
|
||||
define("FLAKE_TIMEZONE", BAIKAL_TIMEZONE);
|
||||
define("FLAKE_PATH_FRAMEWORKS", BAIKAL_PATH_FRAMEWORKS);
|
||||
define("FLAKE_PATH_WWWROOT", BAIKAL_PATH_WWWROOT);
|
||||
|
||||
define("FLAKE_SAFEHASH_SALT", "une-clef-super-secrete");
|
||||
define("FLAKE_LOCALE", "fr_FR.UTF-8");
|
||||
define("FLAKE_LOCALE", "fr_FR.UTF-8");
|
||||
|
||||
if(defined("BAIKAL_TIMEZONE")) {
|
||||
define("FLAKE_TIMEZONE", BAIKAL_TIMEZONE);
|
||||
} else {
|
||||
define("FLAKE_TIMEZONE", "Europe/Paris");
|
||||
}
|
Loading…
Add table
Reference in a new issue