From 61974ea048c9683a4b9910c37f133607e7139f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81ro=CC=82me=20Schneider?= Date: Sat, 28 Apr 2012 13:21:17 +0200 Subject: [PATCH 1/7] Working on web admin --- .gitignore | 0 .../Frameworks/Baikal/Core/Bootstrap.php | 155 ------------------ .../Frameworks/Baikal/Core/ClassLoader.php | 0 .../0.2.0/Frameworks/Baikal/Core/Tools.php | 27 ++- .../0.2.0/Frameworks/Baikal/Framework.php | 97 +++++++++++ .../Frameworks/Baikal/Model/AddressBook.php | 0 .../Baikal/Model/AddressBook/Contact.php | 0 .../Frameworks/Baikal/Model/Calendar.php | 0 .../Baikal/Model/Calendar/Event.php | 0 .../0.2.0/Frameworks/Baikal/Model/Config.php | 0 .../Baikal/Model/Config/Standard.php | 0 .../Frameworks/Baikal/Model/Config/System.php | 0 .../Frameworks/Baikal/Model/Principal.php | 0 .../0.2.0/Frameworks/Baikal/Model/User.php | 0 .../BaikalAdmin/Controller/Dashboard.php | 0 .../Controller/Install/AdminPassword.php | 0 .../Controller/Install/Initialize.php | 33 ++-- .../Controller/Install/VersionUpgrade.php | 0 .../Controller/Navigation/Topbar.php | 0 .../Controller/Navigation/Topbar/Install.php | 0 .../Controller/Settings/Standard.php | 2 +- .../Controller/Settings/System.php | 2 +- .../Controller/User/AddressBooks.php | 0 .../BaikalAdmin/Controller/User/Calendars.php | 0 .../BaikalAdmin/Controller/Users.php | 0 .../Frameworks/BaikalAdmin/Core/Auth.php | 2 +- .../BaikalAdmin/Core/ClassLoader.php | 0 .../Frameworks/BaikalAdmin/Core/View.php | 0 .../{Core/Bootstrap.php => Framework.php} | 32 ++-- .../Frameworks/BaikalAdmin/Model/Install.php | 0 .../Resources/GlyphiconsPro/glyph-dark.png | Bin .../Resources/GlyphiconsPro/glyph2x-dark.png | Bin .../Resources/GlyphiconsPro/glyphpro-2x.css | 0 .../Resources/GlyphiconsPro/glyphpro.css | 0 .../GlyphiconsPro/test-glyphpro2x.html | 0 .../Resources/Strings/EN/Exceptions.json | 3 + .../Templates/AddressBooks/Listing.html | 0 .../Templates/Calendars/Listing.html | 0 .../Resources/Templates/Page/index.html | 0 .../Templates/Page/page-bg-light.png | Bin .../Resources/Templates/Page/page-bg.png | Bin .../Resources/Templates/Page/style.css | 0 .../Resources/Templates/Users/Listing.html | 0 .../BaikalAdmin/Route/Dashboard.php | 0 .../Frameworks/BaikalAdmin/Route/Install.php | 0 .../BaikalAdmin/Route/Settings/Standard.php | 0 .../BaikalAdmin/Route/Settings/System.php | 0 .../BaikalAdmin/Route/User/AddressBooks.php | 0 .../BaikalAdmin/Route/User/Calendars.php | 0 .../Frameworks/BaikalAdmin/Route/Users.php | 0 .../BaikalAdmin/View/AddressBooks/Listing.php | 0 .../BaikalAdmin/View/Calendars/Listing.php | 0 .../BaikalAdmin/View/Users/Listing.php | 0 .../Frameworks/BaikalAdmin/WWWRoot/index.php | 9 +- .../BaikalAdmin/WWWRoot/install/index.php | 9 +- .../0.2.0/Frameworks/BaikalAdmin/config.php | 0 .../0.2.0/Frameworks/Flake/Core/Bootstrap.php | 81 +++++++-- .../Frameworks/Flake/Core/ClassLoader.php | 50 ++++-- .../Flake/Core/DocumentedException.php | 83 ++++++++++ .../Core/Framework.php} | 8 +- .../0.2.0/Frameworks/Flake/Core/Requester.php | 0 .../Frameworks/Flake/Util/Frameworks.php | 19 +++ .../Flake/Util/Router/QuestionMarkRewrite.php | 0 .../0.2.0/Frameworks/Flake/Util/Tools.php | 67 +++++--- .../0.2.0/Frameworks/Flake/config.php | 6 - .../Frameworks/Formal/Core/ClassLoader.php | 0 .../0.2.0/Frameworks/Formal/Core/Message.php | 0 .../0.2.0/Frameworks/Formal/Element.php | 0 .../Frameworks/Formal/Element/Checkbox.php | 0 .../Frameworks/Formal/Element/Listbox.php | 0 .../Frameworks/Formal/Element/Password.php | 0 .../0.2.0/Frameworks/Formal/Element/Text.php | 0 CoreVersions/0.2.0/Frameworks/Formal/Form.php | 0 .../Frameworks/Formal/Form/Morphology.php | 0 .../0.2.0/Frameworks/Formal/Framework.php | 37 +++++ .../Versions/Tabulator.0.0.1/Colorize.php | 0 .../Tabulator.0.0.1/Tabulator.cli.php | 0 .../Tabulator.0.0.1/Tabulator.html.php | 0 .../Versions/Tabulator.0.0.1/Tabulator.php | 0 .../Tabulator.0.0.1/TabulatorColumn.php | 0 .../css/bootstrap-responsive.css | 0 .../css/bootstrap-responsive.min.css | 0 .../TwitterBootstrap.2.0.2/css/bootstrap.css | 0 .../css/bootstrap.min.css | 0 .../img/glyphicons-halflings-orig.png | Bin .../img/glyphicons-halflings-white.png | Bin .../img/glyphicons-halflings.png | Bin .../js/bootstrap-popover.js | 0 .../js/bootstrap-tooltip.js | 0 .../TwitterBootstrap.2.0.2/js/bootstrap.js | 0 .../js/bootstrap.min.js | 0 .../js/jquery-1.7.1.min.js | 0 CoreVersions/0.2.0/Resources/Web/README.md | 0 CoreVersions/0.2.0/Scripts/adminpassword.php | 2 +- CoreVersions/0.2.0/WWWRoot/cal.php | 2 +- CoreVersions/0.2.0/WWWRoot/card.php | 2 +- CoreVersions/0.2.0/WWWRoot/index.php | 2 +- Specific/db/baikal.sqlite | Bin 14336 -> 14336 bytes html/.htaccess | 0 99 files changed, 463 insertions(+), 267 deletions(-) mode change 100644 => 100755 .gitignore delete mode 100644 CoreVersions/0.2.0/Frameworks/Baikal/Core/Bootstrap.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Baikal/Core/ClassLoader.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Baikal/Core/Tools.php create mode 100755 CoreVersions/0.2.0/Frameworks/Baikal/Framework.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Baikal/Model/AddressBook.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Baikal/Model/AddressBook/Contact.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Baikal/Model/Calendar.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Baikal/Model/Calendar/Event.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Baikal/Model/Config.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/Standard.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/System.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Baikal/Model/Principal.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Baikal/Model/User.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/AdminPassword.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar/Install.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/Standard.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/System.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/AddressBooks.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/Calendars.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Users.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/ClassLoader.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/View.php rename CoreVersions/0.2.0/Frameworks/BaikalAdmin/{Core/Bootstrap.php => Framework.php} (57%) mode change 100644 => 100755 mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Model/Install.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyph-dark.png mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyph2x-dark.png mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyphpro-2x.css mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyphpro.css mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/test-glyphpro2x.html create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Strings/EN/Exceptions.json mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/AddressBooks/Listing.html mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Calendars/Listing.html mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Page/index.html mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Page/page-bg-light.png mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Page/page-bg.png mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Page/style.css mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Users/Listing.html mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Dashboard.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Install.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Settings/Standard.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Settings/System.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/User/AddressBooks.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/User/Calendars.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Users.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/AddressBooks/Listing.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Calendars/Listing.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Users/Listing.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/config.php create mode 100755 CoreVersions/0.2.0/Frameworks/Flake/Core/DocumentedException.php rename CoreVersions/0.2.0/Frameworks/{Formal/Core/Bootstrap.php => Flake/Core/Framework.php} (83%) mode change 100644 => 100755 mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Flake/Core/Requester.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Flake/Util/Frameworks.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Flake/Util/Router/QuestionMarkRewrite.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Flake/config.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Formal/Core/ClassLoader.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Formal/Core/Message.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Formal/Element.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Formal/Element/Checkbox.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Formal/Element/Listbox.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Formal/Element/Password.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Formal/Element/Text.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Formal/Form.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Formal/Form/Morphology.php create mode 100755 CoreVersions/0.2.0/Frameworks/Formal/Framework.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/Colorize.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/Tabulator.cli.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/Tabulator.html.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/Tabulator.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/TabulatorColumn.php mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/css/bootstrap-responsive.css mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/css/bootstrap-responsive.min.css mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/css/bootstrap.css mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/css/bootstrap.min.css mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/img/glyphicons-halflings-orig.png mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/img/glyphicons-halflings-white.png mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/img/glyphicons-halflings.png mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/bootstrap-popover.js mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/bootstrap-tooltip.js mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/bootstrap.js mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/bootstrap.min.js mode change 100644 => 100755 CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/jquery-1.7.1.min.js mode change 100644 => 100755 CoreVersions/0.2.0/Resources/Web/README.md mode change 100644 => 100755 html/.htaccess diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Core/Bootstrap.php b/CoreVersions/0.2.0/Frameworks/Baikal/Core/Bootstrap.php deleted file mode 100644 index 35f071e..0000000 --- a/CoreVersions/0.2.0/Frameworks/Baikal/Core/Bootstrap.php +++ /dev/null @@ -1,155 +0,0 @@ - -* 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! -***************************************************************/ - - -function rmBeginSlash($sString) { - if(substr($sString, 0, 1) === "/") { - $sString = substr($sString, 1); - } - - return $sString; -} - -function rmEndSlash($sString) { - if(substr($sString, -1) === "/") { - $sString = substr($sString, 0, -1); - } - - return $sString; -} - -function appendSlash($sString) { - if(substr($sString, -1) !== "/") { - $sString .= "/"; - } - - return $sString; -} - -function prependSlash($sString) { - if(substr($sString, 0, 1) !== "/") { - $sString = "/" . $sString; - } - - return $sString; -} - -function installTool() { - if(defined("BAIKAL_CONTEXT_INSTALL") && BAIKAL_CONTEXT_INSTALL === TRUE) { - return; - } else { - $sInstallToolUrl = BAIKAL_URI . "admin/install/"; - header("Location: " . $sInstallToolUrl); - exit(0); - } -} - -# Asserting PHP 5.3.0+ -if(version_compare(PHP_VERSION, '5.3.0', '<')) { - die('Baikal Fatal Error: Baikal requires PHP 5.3.0+ to run properly. You version is: ' . PHP_VERSION . '.'); -} - -# Registering Baikal classloader -define("BAIKAL_PATH_FRAMEWORKROOT", dirname(dirname(__FILE__)) . "/"); -require_once(BAIKAL_PATH_FRAMEWORKROOT . '/Core/ClassLoader.php'); -\Baikal\Core\ClassLoader::register(); - -\Baikal\Core\Tools::assertEnvironmentIsOk(); - -# determine Baïkal install root path -# not using realpath here to avoid symlinks resolution - -define("BAIKAL_PATH_ROOT", dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . "/"); # ../../../../../ -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 -$sScript = substr($_SERVER["SCRIPT_FILENAME"], strlen($_SERVER["DOCUMENT_ROOT"])); -$sDirName = appendSlash(dirname($sScript)); -$sBaseUrl = appendSlash(substr($sDirName, 0, -1 * strlen(BAIKAL_CONTEXT_BASEURI))); -$aParts = explode("/", $_SERVER["SERVER_PROTOCOL"]); -$sProtocol = strtolower(array_shift($aParts)); -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( - !file_exists(BAIKAL_PATH_SPECIFIC . "config.php") || - !file_exists(BAIKAL_PATH_SPECIFIC . "config.system.php") -) { - installTool(); -} else { - require_once(BAIKAL_PATH_SPECIFIC . "config.php"); - require_once(BAIKAL_PATH_SPECIFIC . "config.system.php"); - date_default_timezone_set(BAIKAL_TIMEZONE); - - # Check that Baïkal is already configured - if(!defined("BAIKAL_CONFIGURED_VERSION")) { - installTool(); - - } else { - - # Check that running version matches configured version - if(version_compare(BAIKAL_VERSION, BAIKAL_CONFIGURED_VERSION) > 0) { - installTool(); - - } else { - - # Check that admin password is set - if(!defined("BAIKAL_ADMIN_PASSWORDHASH")) { - installTool(); - } - - \Baikal\Core\Tools::assertBaikalIsOk(); - - # Establishing connection with database - $GLOBALS["DB"] = new \Flake\Core\Database\Sqlite(BAIKAL_SQLITE_FILE); - - # Mapping PHP errors to exceptions; needed by SabreDAV - function exception_error_handler($errno, $errstr, $errfile, $errline) { - throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); - } - - set_error_handler("exception_error_handler"); - - unset($bShouldCheckEnv); - - # SabreDAV Autoloader - require_once(BAIKAL_PATH_SABREDAV . 'autoload.php'); - } - } -} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Core/ClassLoader.php b/CoreVersions/0.2.0/Frameworks/Baikal/Core/ClassLoader.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Core/Tools.php b/CoreVersions/0.2.0/Frameworks/Baikal/Core/Tools.php old mode 100644 new mode 100755 index a498b43..096602b --- a/CoreVersions/0.2.0/Frameworks/Baikal/Core/Tools.php +++ b/CoreVersions/0.2.0/Frameworks/Baikal/Core/Tools.php @@ -48,50 +48,59 @@ class Tools { } } + public static function configureEnvironment() { + set_exception_handler('\Baikal\Core\Tools::handleException'); + ini_set("error_reporting", E_ALL); + } + + function handleException($exception) { + echo $exception; + } + public static function assertBaikalIsOk() { # Asserting DB file exists - if(!file_exists(BAIKAL_SQLITE_FILE)) { + if(!file_exists(PROJECT_SQLITE_FILE)) { throw new \Exception("DB file does not exist. To create it, please copy 'Core/Resources/baikal.empty.sqlite' to 'Specific/db/baikal.sqlite'."); } # Asserting DB file is readable - if(!is_readable(BAIKAL_SQLITE_FILE)) { + if(!is_readable(PROJECT_SQLITE_FILE)) { throw new \Exception("DB file is not readable. Please give read permissions to httpd user on file 'Specific/db/baikal.sqlite'."); } # Asserting DB file is writable - if(!is_writable(BAIKAL_SQLITE_FILE)) { + if(!is_writable(PROJECT_SQLITE_FILE)) { throw new \Exception("DB file is not writable. Please give write permissions to httpd user on file 'Specific/db/baikal.sqlite'."); } # Asserting config file exists - if(!file_exists(BAIKAL_PATH_SPECIFIC . "config.php")) { + if(!file_exists(PROJECT_PATH_SPECIFIC . "config.php")) { throw new \Exception("Specific/config.php does not exist. Please use the Install tool to create it."); } # Asserting config file is readable - if(!is_readable(BAIKAL_PATH_SPECIFIC . "config.php")) { + if(!is_readable(PROJECT_PATH_SPECIFIC . "config.php")) { throw new \Exception("Specific/config.php is not readable. Please give read permissions to httpd user on file 'Specific/config.php'."); } # Asserting config file is writable - if(!is_writable(BAIKAL_PATH_SPECIFIC . "config.php")) { + if(!is_writable(PROJECT_PATH_SPECIFIC . "config.php")) { throw new \Exception("Specific/config.php is not writable. Please give write permissions to httpd user on file 'Specific/config.php'."); } # Asserting system config file exists - if(!file_exists(BAIKAL_PATH_SPECIFIC . "config.system.php")) { + if(!file_exists(PROJECT_PATH_SPECIFIC . "config.system.php")) { throw new \Exception("Specific/config.system.php does not exist. Please use the Install tool to create it."); } # Asserting system config file is readable - if(!is_readable(BAIKAL_PATH_SPECIFIC . "config.system.php")) { + if(!is_readable(PROJECT_PATH_SPECIFIC . "config.system.php")) { throw new \Exception("Specific/config.system.php is not readable. Please give read permissions to httpd user on file 'Specific/config.system.php'."); } # Asserting system config file is writable - if(!is_writable(BAIKAL_PATH_SPECIFIC . "config.system.php")) { + if(!is_writable(PROJECT_PATH_SPECIFIC . "config.system.php")) { throw new \Exception("Specific/config.system.php is not writable. Please give write permissions to httpd user on file 'Specific/config.system.php'."); } } diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Framework.php b/CoreVersions/0.2.0/Frameworks/Baikal/Framework.php new file mode 100755 index 0000000..5959680 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/Baikal/Framework.php @@ -0,0 +1,97 @@ + +* 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 Baikal; + +class Framework extends \Flake\Core\Framework { + + public static function installTool() { + if(defined("BAIKAL_CONTEXT_INSTALL") && BAIKAL_CONTEXT_INSTALL === TRUE) { + return; + } else { + $sInstallToolUrl = PROJECT_URI . "admin/install/"; + header("Location: " . $sInstallToolUrl); + exit(0); + } + } + + public static function bootstrap() { + + # Registering Baikal classloader + define("BAIKAL_PATH_FRAMEWORKROOT", dirname(__FILE__) . "/"); + require_once(BAIKAL_PATH_FRAMEWORKROOT . '/Core/ClassLoader.php'); + \Baikal\Core\ClassLoader::register(); + + \Baikal\Core\Tools::assertEnvironmentIsOk(); + \Baikal\Core\Tools::configureEnvironment(); + + # Check that a config file exists + if( + !file_exists(PROJECT_PATH_SPECIFIC . "config.php") || + !file_exists(PROJECT_PATH_SPECIFIC . "config.system.php") + ) { + self::installTool(); + } else { + require_once(PROJECT_PATH_SPECIFIC . "config.php"); + require_once(PROJECT_PATH_SPECIFIC . "config.system.php"); + date_default_timezone_set(BAIKAL_TIMEZONE); + + # Check that Baïkal is already configured + if(!defined("BAIKAL_CONFIGURED_VERSION")) { + self::installTool(); + + } else { + + # Check that running version matches configured version + if(version_compare(BAIKAL_VERSION, BAIKAL_CONFIGURED_VERSION) > 0) { + self::installTool(); + + } else { + + # Check that admin password is set + if(!defined("BAIKAL_ADMIN_PASSWORDHASH")) { + self::installTool(); + } + + \Baikal\Core\Tools::assertBaikalIsOk(); + + set_error_handler("\Baikal\Framework::exception_error_handler"); + + unset($bShouldCheckEnv); + + # SabreDAV Autoloader + require_once(BAIKAL_PATH_SABREDAV . 'autoload.php'); + } + } + } + + } + + # Mapping PHP errors to exceptions; needed by SabreDAV + function exception_error_handler($errno, $errstr, $errfile, $errline) { + throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); + } +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Model/AddressBook.php b/CoreVersions/0.2.0/Frameworks/Baikal/Model/AddressBook.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Model/AddressBook/Contact.php b/CoreVersions/0.2.0/Frameworks/Baikal/Model/AddressBook/Contact.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Model/Calendar.php b/CoreVersions/0.2.0/Frameworks/Baikal/Model/Calendar.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Model/Calendar/Event.php b/CoreVersions/0.2.0/Frameworks/Baikal/Model/Calendar/Event.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config.php b/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/Standard.php b/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/Standard.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/System.php b/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/System.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Model/Principal.php b/CoreVersions/0.2.0/Frameworks/Baikal/Model/Principal.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Model/User.php b/CoreVersions/0.2.0/Frameworks/Baikal/Model/User.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/AdminPassword.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/AdminPassword.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php old mode 100644 new mode 100755 index 86d5246..2dc0192 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php @@ -35,8 +35,13 @@ class Initialize extends \Flake\Core\Controller { public function __construct() { parent::__construct(); + # Assert that /Specific is writable + if(!file_exists(PROJECT_PATH_SPECIFIC) || !is_dir(PROJECT_PATH_SPECIFIC) || !is_writable(PROJECT_PATH_SPECIFIC)) { + throw new \Flake\Core\DocumentedException("specificreadonly"); + } + $this->createDefaultConfigFilesIfNeeded(); - $this->oModel = new \Baikal\Model\Config\Standard(BAIKAL_PATH_SPECIFIC . "config.php"); + $this->oModel = new \Baikal\Model\Config\Standard(PROJECT_PATH_SPECIFIC . "config.php"); # Assert that config file is writable if(!$this->oModel->writable()) { @@ -53,7 +58,7 @@ class Initialize extends \Flake\Core\Controller { $this->oForm->execute(); if($this->oForm->persisted()) { - $sContent = file_get_contents(BAIKAL_PATH_SPECIFIC . "config.system.php"); + $sContent = file_get_contents(PROJECT_PATH_SPECIFIC . "config.system.php"); $sBaikalVersion = BAIKAL_VERSION; $sEncryptionKey = md5(microtime() . rand()); @@ -68,7 +73,7 @@ define("BAIKAL_CONFIGURED_VERSION", "{$sBaikalVersion}"); PHP; # Writing results to file - file_put_contents(BAIKAL_PATH_SPECIFIC . "config.system.php", $sContent . "\n\n" . $sNewConstants); + file_put_contents(PROJECT_PATH_SPECIFIC . "config.system.php", $sContent . "\n\n" . $sNewConstants); } } } @@ -85,7 +90,7 @@ PHP; HTML; if($this->oForm->persisted()) { - $sHtml .= "

Baïkal is now configured. You may now Access the Baïkal admin"; + $sHtml .= "

Baïkal is now configured. You may now Access the Baïkal admin"; } else { # Display the config form @@ -96,25 +101,25 @@ HTML; } protected function tagConfiguredVersion() { - file_put_contents(BAIKAL_PATH_SPECIFIC . "config.php", $sContent); + file_put_contents(PROJECT_PATH_SPECIFIC . "config.php", $sContent); } protected function createDefaultConfigFilesIfNeeded() { # Create empty config.php if needed - if(!file_exists(BAIKAL_PATH_SPECIFIC . "config.php")) { - @touch(BAIKAL_PATH_SPECIFIC . "config.php"); + if(!file_exists(PROJECT_PATH_SPECIFIC . "config.php")) { + @touch(PROJECT_PATH_SPECIFIC . "config.php"); $sContent = "getDefaultConfig(); - file_put_contents(BAIKAL_PATH_SPECIFIC . "config.php", $sContent); + file_put_contents(PROJECT_PATH_SPECIFIC . "config.php", $sContent); } # Create empty config.system.php if needed - if(!file_exists(BAIKAL_PATH_SPECIFIC . "config.system.php")) { - @touch(BAIKAL_PATH_SPECIFIC . "config.system.php"); + if(!file_exists(PROJECT_PATH_SPECIFIC . "config.system.php")) { + @touch(PROJECT_PATH_SPECIFIC . "config.system.php"); $sContent = "getDefaultSystemConfig(); - file_put_contents(BAIKAL_PATH_SPECIFIC . "config.system.php", $sContent); + file_put_contents(PROJECT_PATH_SPECIFIC . "config.system.php", $sContent); } } @@ -163,16 +168,16 @@ define("BAIKAL_STANDALONE_ALLOWED", FALSE); define("BAIKAL_STANDALONE_PORT", 8888); # PATH to SabreDAV -define("BAIKAL_PATH_SABREDAV", BAIKAL_PATH_FRAMEWORKS . "SabreDAV/lib/Sabre/"); +define("BAIKAL_PATH_SABREDAV", PROJECT_PATH_FRAMEWORKS . "SabreDAV/lib/Sabre/"); # If you change this value, you'll have to re-generate passwords for all your users define("BAIKAL_AUTH_REALM", "BaikalDAV"); # Should begin and end with a "/" -define("BAIKAL_CARD_BASEURI", BAIKAL_BASEURI . "card.php/"); +define("BAIKAL_CARD_BASEURI", PROJECT_BASEURI . "card.php/"); # Should begin and end with a "/" -define("BAIKAL_CAL_BASEURI", BAIKAL_BASEURI . "cal.php/"); +define("BAIKAL_CAL_BASEURI", PROJECT_BASEURI . "cal.php/"); CODE; $sCode = trim($sCode); return $sCode; diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar/Install.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar/Install.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/Standard.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/Standard.php old mode 100644 new mode 100755 index d9c2dbc..c6271d1 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/Standard.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/Standard.php @@ -30,7 +30,7 @@ class Standard extends \Flake\Core\Controller { public function __construct() { parent::__construct(); - $this->oModel = new \Baikal\Model\Config\Standard(BAIKAL_PATH_SPECIFIC . "config.php"); + $this->oModel = new \Baikal\Model\Config\Standard(PROJECT_PATH_SPECIFIC . "config.php"); # Assert that config file is writable if(!$this->oModel->writable()) { diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/System.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/System.php old mode 100644 new mode 100755 index 8063a90..dd0f887 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/System.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/System.php @@ -30,7 +30,7 @@ class System extends \Flake\Core\Controller { public function __construct() { parent::__construct(); - $this->oModel = new \Baikal\Model\Config\System(BAIKAL_PATH_SPECIFIC . "config.system.php"); + $this->oModel = new \Baikal\Model\Config\System(PROJECT_PATH_SPECIFIC . "config.system.php"); # Assert that config file is writable if(!$this->oModel->writable()) { diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/AddressBooks.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/AddressBooks.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/Calendars.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/Calendars.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Users.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Users.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php old mode 100644 new mode 100755 index 7f52b15..e23d88e --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php @@ -44,7 +44,7 @@ class Auth { } $bLocked = TRUE; - $sEnableFile = BAIKAL_PATH_SPECIFIC . "ENABLE_ADMIN"; + $sEnableFile = PROJECT_PATH_SPECIFIC . "ENABLE_ADMIN"; if(file_exists($sEnableFile)) { clearstatcache(); diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/ClassLoader.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/ClassLoader.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/View.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/View.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Bootstrap.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Framework.php old mode 100644 new mode 100755 similarity index 57% rename from CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Bootstrap.php rename to CoreVersions/0.2.0/Frameworks/BaikalAdmin/Framework.php index a544041..2379bb1 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Bootstrap.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Framework.php @@ -24,21 +24,23 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -define("BAIKALADMIN_PATH_ROOT", dirname(dirname(__FILE__)) . "/"); +namespace BaikalAdmin; -# Bootstrap Baïkal Core -require_once(dirname(dirname(dirname(__FILE__))) . "/Baikal/Core/Bootstrap.php"); # ../../, symlink-safe +class Framework extends \Flake\Core\Framework { + + public static function bootstrap() { + define("BAIKALADMIN_PATH_ROOT", dirname(__FILE__) . "/"); # ./ + + \Baikal\Framework::bootstrap(); + \Formal\Framework::bootstrap(); -# Bootstrap Formal -require_once(dirname(dirname(dirname(__FILE__))) . "/Formal/Core/Bootstrap.php"); + # Registering BaikalAdmin classloader + require_once(BAIKALADMIN_PATH_ROOT . '/Core/ClassLoader.php'); + \BaikalAdmin\Core\ClassLoader::register(); + + $GLOBALS["ROUTER"]::setURIPath("admin/"); -# Registering BaikalAdmin classloader -require_once(dirname(__FILE__) . '/ClassLoader.php'); -\BaikalAdmin\Core\ClassLoader::register(); - -# Relative to BAIKAL_URI; so that BAIKAL_URI . BAIKALADMIN_URIPATH corresponds to the full URL to Baïkal admin -define("BAIKALADMIN_URIPATH", "admin/"); -$GLOBALS["ROUTER"]::setURIPath(BAIKALADMIN_URIPATH); - -# Include BaikalAdmin Framework config -require_once(BAIKALADMIN_PATH_ROOT . "config.php"); \ No newline at end of file + # Include BaikalAdmin Framework config + require_once(BAIKALADMIN_PATH_ROOT . "config.php"); + } +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Model/Install.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Model/Install.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyph-dark.png b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyph-dark.png old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyph2x-dark.png b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyph2x-dark.png old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyphpro-2x.css b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyphpro-2x.css old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyphpro.css b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/glyphpro.css old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/test-glyphpro2x.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/test-glyphpro2x.html old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Strings/EN/Exceptions.json b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Strings/EN/Exceptions.json new file mode 100755 index 0000000..4eb7c3f --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Strings/EN/Exceptions.json @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/AddressBooks/Listing.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/AddressBooks/Listing.html old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Calendars/Listing.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Calendars/Listing.html old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Page/index.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Page/index.html old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Page/page-bg-light.png b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Page/page-bg-light.png old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Page/page-bg.png b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Page/page-bg.png old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Page/style.css b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Page/style.css old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Users/Listing.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Users/Listing.html old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Dashboard.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Dashboard.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Install.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Install.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Settings/Standard.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Settings/Standard.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Settings/System.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Settings/System.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/User/AddressBooks.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/User/AddressBooks.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/User/Calendars.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/User/Calendars.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Users.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Users.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/AddressBooks/Listing.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/AddressBooks/Listing.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Calendars/Listing.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Calendars/Listing.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Users/Listing.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Users/Listing.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php old mode 100644 new mode 100755 index 70d5e83..e099170 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php @@ -26,13 +26,16 @@ ini_set("display_errors", 1); error_reporting(E_ALL); -define("BAIKAL_CONTEXT_BASEURI", "/admin/"); +define("PROJECT_CONTEXT_BASEURI", "/admin/"); define("BAIKAL_CONTEXT", TRUE); define("BAIKAL_CONTEXT_ADMIN", TRUE); +# Bootstrap Flake +require_once(dirname(dirname(dirname(__FILE__))) . "/Flake/Core/Bootstrap.php"); # ../../ + # Bootstrap BaikalAdmin -require_once(dirname(dirname(__FILE__)) . "/Core/Bootstrap.php"); # ../ +\BaikalAdmin\Framework::bootstrap(); # Evaluate assertions \BaikalAdmin\Core\Auth::assertEnabled(); @@ -42,7 +45,7 @@ require_once(dirname(dirname(__FILE__)) . "/Core/Bootstrap.php"); # ../ $oPage = new \Flake\Controller\Page(BAIKALADMIN_PATH_TEMPLATES . "Page/index.html"); $oPage->injectHTTPHeaders(); $oPage->setTitle("Baïkal Web Admin"); -$oPage->setBaseUrl(BAIKAL_URI); +$oPage->setBaseUrl(PROJECT_URI); $oPage->zone("navbar")->addBlock(new \BaikalAdmin\Controller\Navigation\Topbar()); diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php old mode 100644 new mode 100755 index 21c5f60..a610846 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php @@ -26,13 +26,16 @@ ini_set("display_errors", 1); error_reporting(E_ALL); -define("BAIKAL_CONTEXT_BASEURI", "/admin/install/"); +define("PROJECT_CONTEXT_BASEURI", "/admin/install/"); define("BAIKAL_CONTEXT", TRUE); define("BAIKAL_CONTEXT_INSTALL", TRUE); +# Bootstrap Flake +require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Flake/Core/Bootstrap.php"); # ../../../ + # Bootstrap BaikalAdmin -require_once(dirname(dirname(dirname(__FILE__))) . "/Core/Bootstrap.php"); # ../../ +\BaikalAdmin\Framework::bootstrap(); # Evaluate assertions \BaikalAdmin\Core\Auth::assertUnlocked(); @@ -41,7 +44,7 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/Core/Bootstrap.php"); # ../ $oPage = new \Flake\Controller\Page(BAIKALADMIN_PATH_TEMPLATES . "Page/index.html"); $oPage->injectHTTPHeaders(); $oPage->setTitle("Baïkal Maintainance"); -$oPage->setBaseUrl(BAIKAL_URI); +$oPage->setBaseUrl(PROJECT_URI); $oPage->zone("navbar")->addBlock(new \BaikalAdmin\Controller\Navigation\Topbar\Install()); diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/config.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/config.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Core/Bootstrap.php b/CoreVersions/0.2.0/Frameworks/Flake/Core/Bootstrap.php index 9f12d54..4f65cd5 100755 --- a/CoreVersions/0.2.0/Frameworks/Flake/Core/Bootstrap.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Core/Bootstrap.php @@ -24,6 +24,14 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ +# Asserting PHP 5.3.0+ +if(version_compare(PHP_VERSION, '5.3.0', '<')) { + die('Flake Fatal Error: Flake requires PHP 5.3.0+ to run properly. Your version is: ' . PHP_VERSION . '.'); +} + +# Define absolute server path to Flake Framework +define("FLAKE_PATH_ROOT", dirname(dirname(__FILE__)) . "/"); # ../ + if(!defined('LF')) { define('LF', chr(10)); } @@ -38,28 +46,77 @@ if(array_key_exists("SERVER_NAME", $_SERVER) && $_SERVER["SERVER_NAME"] === "mon define("MONGOOSE_SERVER", FALSE); } -define("FLAKE_PATH_ROOT", dirname(dirname(__FILE__)) . "/"); # ../ - # Display errors messages, except notices #ini_set("display_errors", 1); #ini_set("error_reporting", E_ALL & ~E_NOTICE); -if(!function_exists("appendSlash")) { - function appendSlash($sPath) { - if($sPath{strlen($sPath) - 1} !== "/") { - $sPath .= "/"; - } - - return $sPath; +function rmBeginSlash($sString) { + if(substr($sString, 0, 1) === "/") { + $sString = substr($sString, 1); } + + return $sString; } +function rmEndSlash($sString) { + if(substr($sString, -1) === "/") { + $sString = substr($sString, 0, -1); + } + + return $sString; +} + +function appendSlash($sString) { + if(substr($sString, -1) !== "/") { + $sString .= "/"; + } + + return $sString; +} + +function prependSlash($sString) { + if(substr($sString, 0, 1) !== "/") { + $sString = "/" . $sString; + } + + return $sString; +} if(!function_exists("debug")) { function debug($mVar, $sHeader=0) { \Flake\Util\Tools::debug($mVar, $sHeader); } } +################################################################################################# + +# determine Flake install root path +# not using realpath here to avoid symlinks resolution + +define("PROJECT_PATH_ROOT", dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . "/"); # ../../../../../ +define("PROJECT_PATH_CORE", PROJECT_PATH_ROOT . "Core/"); +define("PROJECT_PATH_SPECIFIC", PROJECT_PATH_ROOT . "Specific/"); +define("PROJECT_PATH_FRAMEWORKS", PROJECT_PATH_CORE . "Frameworks/"); +define("PROJECT_PATH_WWWROOT", PROJECT_PATH_CORE . "WWWRoot/"); + +# Define path to Baïkal SQLite file +define("PROJECT_SQLITE_FILE", PROJECT_PATH_SPECIFIC . "db/baikal.sqlite"); + +define("PROJECT_SAFEHASH_SALT", "une-clef-super-secrete"); + +require_once(PROJECT_PATH_CORE . "Distrib.php"); + +# Determine PROJECT_URI +$sScript = substr($_SERVER["SCRIPT_FILENAME"], strlen($_SERVER["DOCUMENT_ROOT"])); +$sDirName = appendSlash(dirname($sScript)); +$sBaseUrl = appendSlash(substr($sDirName, 0, -1 * strlen(PROJECT_CONTEXT_BASEURI))); +$aParts = explode("/", $_SERVER["SERVER_PROTOCOL"]); +$sProtocol = strtolower(array_shift($aParts)); +define("PROJECT_BASEURI", $sBaseUrl); +define("PROJECT_URI", $sProtocol . "://" . rmEndSlash($_SERVER["HTTP_HOST"]) . $sBaseUrl); +unset($sScript); unset($sDirName); unset($sBaseUrl); unset($sProtocol); unset($aParts); + +################################################################################################# + require_once(FLAKE_PATH_ROOT . 'Core/ClassLoader.php'); \Flake\Core\ClassLoader::register(); @@ -77,13 +134,13 @@ if(!\Flake\Util\Tools::isCliPhp()) { setlocale(LC_ALL, FLAKE_LOCALE); date_default_timezone_set(FLAKE_TIMEZONE); -if(defined("FLAKE_DB_FILEPATH") && file_exists(FLAKE_DB_FILEPATH) && is_readable(FLAKE_DB_FILEPATH) && !isset($GLOBALS["DB"])) { - $GLOBALS["DB"] = new \Flake\Core\Database\Sqlite(FLAKE_DB_FILEPATH); +if(defined("PROJECT_SQLITE_FILE") && file_exists(PROJECT_SQLITE_FILE) && is_readable(PROJECT_SQLITE_FILE) && !isset($GLOBALS["DB"])) { + $GLOBALS["DB"] = new \Flake\Core\Database\Sqlite(PROJECT_SQLITE_FILE); } $GLOBALS["TEMPLATESTACK"] = array(); -$aUrlInfo = parse_url(FLAKE_URI); +$aUrlInfo = parse_url(PROJECT_URI); define("FLAKE_DOMAIN", $_SERVER["HTTP_HOST"]); define("FLAKE_URIPATH", \Flake\Util\Tools::stripBeginSlash($aUrlInfo["path"])); unset($aUrlInfo); \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Core/ClassLoader.php b/CoreVersions/0.2.0/Frameworks/Flake/Core/ClassLoader.php index 12d70b9..55a5b30 100755 --- a/CoreVersions/0.2.0/Frameworks/Flake/Core/ClassLoader.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Core/ClassLoader.php @@ -34,34 +34,50 @@ class ClassLoader { public static function loadClass($sFullClassName) { + $sClassPath = FALSE; + $aParts = explode("\\", $sFullClassName); if(count($aParts) === 1) { return; } - if($aParts[0] !== "Flake" && $aParts[0] !== "Specific" && $aParts[0] !== "Frameworks") { + # Extracting the Radical + $sRadical = $aParts[0]; + + if(in_array($sRadical, array("Flake", "Specific", "Frameworks"))) { + + if($sRadical === "Flake") { + $sRootPath = FLAKE_PATH_ROOT; + } elseif($sRadical === "Specific") { + $sRootPath = FLAKE_PATH_SPECIFIC; + } else { + $sRootPath = PROJECT_PATH_FRAMEWORKS; + } + + # Stripping radical + array_shift($aParts); + + # Classname is the last part + $sClassName = array_pop($aParts); + + # Path to class + $sClassPath = $sRootPath . implode("/", $aParts) . "/" . $sClassName . ".php"; + + } elseif(count($aParts) > 1) { + if($aParts[1] === "Framework") { + # It must be a Flake Framework + $sClassPath = PROJECT_PATH_FRAMEWORKS . $sRadical . "/Framework.php"; + } + } + + if($sClassPath === FALSE) { return; } - - // ejecting the Radical - $sRadical = array_shift($aParts); - - if($sRadical === "Flake") { - $sRootPath = FLAKE_PATH_ROOT; - } elseif($sRadical === "Specific") { - $sRootPath = FLAKE_PATH_SPECIFIC; # When prefix does not point another namespaced framework, we use "Specific" - } elseif($sRadical === "Frameworks") { - $sRootPath = FLAKE_PATH_FRAMEWORKS; - } - - $sClassName = array_pop($aParts); - $sBasePath = $sRootPath . implode("/", $aParts) . "/"; - $sClassPath = $sBasePath . $sClassName . ".php"; if(file_exists($sClassPath) && is_readable($sClassPath)) { require_once($sClassPath); } else { - echo '

PHP Autoload Error. Cannot find ' . $sFullClassName . '

'; + echo '

PHP Autoload Error. Cannot find ' . $sFullClassName . ' in ' . $sClassPath . '

'; echo "
" . print_r(debug_backtrace(), TRUE) . "
"; die(); } diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Core/DocumentedException.php b/CoreVersions/0.2.0/Frameworks/Flake/Core/DocumentedException.php new file mode 100755 index 0000000..f31be68 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/Flake/Core/DocumentedException.php @@ -0,0 +1,83 @@ + +* 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\Core; + +class DocumentedException extends \Exception { + + protected $aMarkers = array(); + + # Redefine the exception signature + public function __construct($message, $aMarkers = array()) { + $this->aMarkers = $aMarkers; + parent::__construct($message, 0, null); + } + + # custom string representation of object + public function __toString() { + $aDoc = $this->getDocumentation(); + debug($aDoc); + return "" . htmlspecialchars($this->message) . ""; + } + + protected function getSoftrefPath() { + $sSoftRef = $this->getMessage(); + $aTrace = $this->getTrace(); + + if($sSoftRef{0} === "\\") { + # An absolute softref has been given + return $sSoftRef; + } + + if(isset($aTrace[0]["class"])) { + return "\\" . $aTrace[0]["class"] . "#" . $sSoftRef; + } + + return $sSoftRef; + } + + protected function getDocumentation() { + # Determine the documentation softref + $sSoftRefPath = $this->getSoftrefPath(); + return $sSoftRefPath; + + /* + $aParts = explode("#", \Flake\Util\Tools::trimStrings($sSoftRefPath, "\\")); + + $aSegments = explode("\\", $aParts[0]); + $sKey = $aParts[1]; + + # Is it a Framework ? + if(\Flake\Util\Frameworks::isAFramework($aSegments[0])) { + $sPath = \Flake\Util\Frameworks::getPath($aSegments[0]); + die($sPath); + } + + debug($aParts); + return $sSoftRefPath; + */ + } +} diff --git a/CoreVersions/0.2.0/Frameworks/Formal/Core/Bootstrap.php b/CoreVersions/0.2.0/Frameworks/Flake/Core/Framework.php old mode 100644 new mode 100755 similarity index 83% rename from CoreVersions/0.2.0/Frameworks/Formal/Core/Bootstrap.php rename to CoreVersions/0.2.0/Frameworks/Flake/Core/Framework.php index ed02d22..8816fea --- a/CoreVersions/0.2.0/Frameworks/Formal/Core/Bootstrap.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Core/Framework.php @@ -24,8 +24,8 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -define("FORMAL_PATH_ROOT", dirname(dirname(__FILE__)) . "/"); +namespace Flake\Core; -# Registering BaikalAdmin classloader -require_once(dirname(__FILE__) . '/ClassLoader.php'); -\Formal\Core\ClassLoader::register(); \ No newline at end of file +class Framework extends \Flake\Core\FLObject { + +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester.php b/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Util/Frameworks.php b/CoreVersions/0.2.0/Frameworks/Flake/Util/Frameworks.php old mode 100644 new mode 100755 index e6d2e30..170b93f --- a/CoreVersions/0.2.0/Frameworks/Flake/Util/Frameworks.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Util/Frameworks.php @@ -30,7 +30,26 @@ class Frameworks extends \Flake\Core\FLObject { private function __construct() { # private constructor to force static class } + public function isAFramework($sName) { + $sName = trim(\Flake\Util\Tools::trimSlashes($sName)); + if($sName === "" || $sName === "." || $sName === "..") { + return FALSE; + } + + $sFrameworkPath = PROJECT_PATH_FRAMEWORKS . $sName; + return file_exists($sFrameworkPath) && is_dir($sFrameworkPath); + } + public static function enabled($sFramework) { return FALSE; } + + # TODO: Create a 'Framework' Model + public function getPath($sName) { + if(self::isAFramework($sName)) { + throw new \Flake\Core\DocumentedException("notaframework", $sName); + } + + return \Flake\Util\Tools::appendSlash(PROJECT_PATH_FRAMEWORKS . $sName); + } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Util/Router/QuestionMarkRewrite.php b/CoreVersions/0.2.0/Frameworks/Flake/Util/Router/QuestionMarkRewrite.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Util/Tools.php b/CoreVersions/0.2.0/Frameworks/Flake/Util/Tools.php index 0a0e0e9..0620df4 100755 --- a/CoreVersions/0.2.0/Frameworks/Flake/Util/Tools.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Util/Tools.php @@ -65,7 +65,7 @@ class Tools extends \Flake\Core\FLObject { } public static function serverToRelativeWebPath($sAbsPath) { - return "/" . str_replace(FLAKE_PATH_WWWROOT, "", $sAbsPath); + return "/" . str_replace(PROJECT_PATH_WWWROOT, "", $sAbsPath); } public static function view_array($array_in) { @@ -192,7 +192,7 @@ class Tools extends \Flake\Core\FLObject { } public static function safelock($sString) { - return substr(md5(FLAKE_SAFEHASH_SALT . ":" . $sString), 0, 5); + return substr(md5(PROJECT_SAFEHASH_SALT . ":" . $sString), 0, 5); } public static function redirect($sUrl) { @@ -568,42 +568,65 @@ TEST; return $_SERVER['HTTP_USER_AGENT']; } + ########### public static function appendSlash($sString) { - if(substr($sString, -1) !== "/") { - $sString .= "/"; - } - - return $sString; + return self::appendString($sString, "/"); } public static function prependSlash($sString) { - if(substr($sString, 0, 1) !== "/") { - $sString = "/" . $sString; - } - - return $sString; + return self::prependString($sString, "/"); } public static function stripBeginSlash($sString) { - if(substr($sString, 0, 1) === "/") { - $sString = substr($sString, 1); - } - - return $sString; + return self::stripBeginString($sString, "/"); } public static function stripEndSlash($sString) { - if(substr($sString, -1) === "/") { - $sString = substr($sString, 0, -1); - } - - return $sString; + return self::stripEndString($sString, "/"); } public static function trimSlashes($sString) { return self::stripBeginSlash(self::stripEndSlash($sString)); } + ########### + public static function appendString($sString, $sAppend) { + if(substr($sString, -1 * strlen($sAppend)) !== $sAppend) { + $sString .= $sAppend; + } + + return $sString; + } + + public static function prependString($sString, $sAppend) { + if(substr($sString, 0, 1 * strlen($sAppend)) !== $sAppend) { + $sString = $sAppend . $sString; + } + + return $sString; + } + + public static function stripBeginString($sString, $sAppend) { + if(substr($sString, 0, 1 * strlen($sAppend)) === $sAppend) { + $sString = substr($sString, strlen($sAppend)); + } + + return $sString; + } + + public static function stripEndString($sString, $sAppend) { + if(substr($sString, -1 * strlen($sAppend)) === $sAppend) { + $sString = substr($sString, 0, -1 * strlen($sAppend)); + } + + return $sString; + } + + public static function trimStrings($sString, $sAppend) { + return self::stripBeginString(self::stripEndString($sString, $sAppend), $sAppend); + } + ########### + public static function router() { return "\Flake\Util\Router\QuestionMarkRewrite"; } diff --git a/CoreVersions/0.2.0/Frameworks/Flake/config.php b/CoreVersions/0.2.0/Frameworks/Flake/config.php old mode 100644 new mode 100755 index 0e23890..67ab3ca --- a/CoreVersions/0.2.0/Frameworks/Flake/config.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/config.php @@ -24,12 +24,6 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -define("FLAKE_URI", BAIKAL_URI); -define("FLAKE_DB_FILEPATH", BAIKAL_SQLITE_FILE); -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"); if(defined("BAIKAL_TIMEZONE")) { diff --git a/CoreVersions/0.2.0/Frameworks/Formal/Core/ClassLoader.php b/CoreVersions/0.2.0/Frameworks/Formal/Core/ClassLoader.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Formal/Core/Message.php b/CoreVersions/0.2.0/Frameworks/Formal/Core/Message.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Formal/Element.php b/CoreVersions/0.2.0/Frameworks/Formal/Element.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Formal/Element/Checkbox.php b/CoreVersions/0.2.0/Frameworks/Formal/Element/Checkbox.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Formal/Element/Listbox.php b/CoreVersions/0.2.0/Frameworks/Formal/Element/Listbox.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Formal/Element/Password.php b/CoreVersions/0.2.0/Frameworks/Formal/Element/Password.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Formal/Element/Text.php b/CoreVersions/0.2.0/Frameworks/Formal/Element/Text.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Formal/Form.php b/CoreVersions/0.2.0/Frameworks/Formal/Form.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Formal/Form/Morphology.php b/CoreVersions/0.2.0/Frameworks/Formal/Form/Morphology.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Formal/Framework.php b/CoreVersions/0.2.0/Frameworks/Formal/Framework.php new file mode 100755 index 0000000..ce34fd4 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/Formal/Framework.php @@ -0,0 +1,37 @@ + +* 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 Formal; + +class Framework extends \Flake\Core\Framework { + + public static function bootstrap() { + define("FORMAL_PATH_ROOT", dirname(__FILE__) . "/"); + + require_once(dirname(__FILE__) . '/Core/ClassLoader.php'); + \Formal\Core\ClassLoader::register(); + } +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/Colorize.php b/CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/Colorize.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/Tabulator.cli.php b/CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/Tabulator.cli.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/Tabulator.html.php b/CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/Tabulator.html.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/Tabulator.php b/CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/Tabulator.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/TabulatorColumn.php b/CoreVersions/0.2.0/Frameworks/Versions/Tabulator.0.0.1/TabulatorColumn.php old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/css/bootstrap-responsive.css b/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/css/bootstrap-responsive.css old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/css/bootstrap-responsive.min.css b/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/css/bootstrap-responsive.min.css old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/css/bootstrap.css b/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/css/bootstrap.css old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/css/bootstrap.min.css b/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/css/bootstrap.min.css old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/img/glyphicons-halflings-orig.png b/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/img/glyphicons-halflings-orig.png old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/img/glyphicons-halflings-white.png b/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/img/glyphicons-halflings-white.png old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/img/glyphicons-halflings.png b/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/img/glyphicons-halflings.png old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/bootstrap-popover.js b/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/bootstrap-popover.js old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/bootstrap-tooltip.js b/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/bootstrap-tooltip.js old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/bootstrap.js b/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/bootstrap.js old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/bootstrap.min.js b/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/bootstrap.min.js old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/jquery-1.7.1.min.js b/CoreVersions/0.2.0/Frameworks/Versions/TwitterBootstrap.2.0.2/js/jquery-1.7.1.min.js old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Resources/Web/README.md b/CoreVersions/0.2.0/Resources/Web/README.md old mode 100644 new mode 100755 diff --git a/CoreVersions/0.2.0/Scripts/adminpassword.php b/CoreVersions/0.2.0/Scripts/adminpassword.php index dab0494..961ddb1 100755 --- a/CoreVersions/0.2.0/Scripts/adminpassword.php +++ b/CoreVersions/0.2.0/Scripts/adminpassword.php @@ -34,7 +34,7 @@ require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Core/Frameworks/Ba # Bootstraping BaikalAdmin require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Core/Frameworks/BaikalAdmin/Core/Bootstrap.php"); # ../../../ -$sConfigFile = BAIKAL_PATH_SPECIFIC . "config.php"; +$sConfigFile = PROJECT_PATH_SPECIFIC . "config.php"; if(!file_exists($sConfigFile)) { die("Specific/config.php is does not exist. Aborting, cannot modify admin password."); diff --git a/CoreVersions/0.2.0/WWWRoot/cal.php b/CoreVersions/0.2.0/WWWRoot/cal.php index 4b03ef0..a5077ed 100755 --- a/CoreVersions/0.2.0/WWWRoot/cal.php +++ b/CoreVersions/0.2.0/WWWRoot/cal.php @@ -25,7 +25,7 @@ ***************************************************************/ define("BAIKAL_CONTEXT", TRUE); -define("BAIKAL_CONTEXT_BASEURI", "/"); +define("PROJECT_CONTEXT_BASEURI", "/"); # Bootstraping Baikal require_once(dirname(dirname(__FILE__)) . "/Frameworks/Baikal/Core/Bootstrap.php"); diff --git a/CoreVersions/0.2.0/WWWRoot/card.php b/CoreVersions/0.2.0/WWWRoot/card.php index 701cbe7..bdb7282 100755 --- a/CoreVersions/0.2.0/WWWRoot/card.php +++ b/CoreVersions/0.2.0/WWWRoot/card.php @@ -25,7 +25,7 @@ ***************************************************************/ define("BAIKAL_CONTEXT", TRUE); -define("BAIKAL_CONTEXT_BASEURI", "/"); +define("PROJECT_CONTEXT_BASEURI", "/"); # Bootstraping Baikal require_once(dirname(dirname(__FILE__)) . "/Frameworks/Baikal/Core/Bootstrap.php"); diff --git a/CoreVersions/0.2.0/WWWRoot/index.php b/CoreVersions/0.2.0/WWWRoot/index.php index a7a64fc..bc3cec0 100755 --- a/CoreVersions/0.2.0/WWWRoot/index.php +++ b/CoreVersions/0.2.0/WWWRoot/index.php @@ -24,7 +24,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ define("BAIKAL_CONTEXT", TRUE); -define("BAIKAL_CONTEXT_BASEURI", "/"); +define("PROJECT_CONTEXT_BASEURI", "/"); # Bootstraping Baikal require_once(dirname(dirname(__FILE__)) . "/Frameworks/Baikal/Core/Bootstrap.php"); diff --git a/Specific/db/baikal.sqlite b/Specific/db/baikal.sqlite index 32253c211271b12aeda6437c6ce26441f51fe683..a27278539ac7ea2f56ff09de8e0ebaccdc2a9e9a 100755 GIT binary patch delta 387 zcmZoDXegK<%~(58#+kL2LHCi&#*_ujY>dns7??L~7Gzn*9N@>u&Y*27?ao_Jl$n>D zS&*1htY4B^T;h_NmROooqTra4Qj}U;tl*TNpPd2`!zQJWmS3a*(zl6)g#*n3ZU${# zX+~XMUS3rkmLw;#nI#z-SX!C^U7KW?WMPn!oNQ_iG5$LP^LL=m Ox6GUz%%Y4SeT)DP>~?nm delta 46 wcmZoDXegK<%~&~6#+kK}LHCjT#*_uji&;20AXtQFF^dL}t--OGMdJ@U08i=-9{>OV diff --git a/html/.htaccess b/html/.htaccess old mode 100644 new mode 100755 From 13645a7ab5b79ba2adb2bdc47527c4a7b5529caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81ro=CC=82me=20Schneider?= Date: Sun, 29 Apr 2012 00:20:46 +0200 Subject: [PATCH 2/7] Working on web admin --- CoreVersions/0.2.0/WWWRoot/cal.php | 7 +++++-- CoreVersions/0.2.0/WWWRoot/card.php | 7 +++++-- CoreVersions/0.2.0/WWWRoot/index.php | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CoreVersions/0.2.0/WWWRoot/cal.php b/CoreVersions/0.2.0/WWWRoot/cal.php index a5077ed..e6a61d8 100755 --- a/CoreVersions/0.2.0/WWWRoot/cal.php +++ b/CoreVersions/0.2.0/WWWRoot/cal.php @@ -27,8 +27,11 @@ define("BAIKAL_CONTEXT", TRUE); define("PROJECT_CONTEXT_BASEURI", "/"); -# Bootstraping Baikal -require_once(dirname(dirname(__FILE__)) . "/Frameworks/Baikal/Core/Bootstrap.php"); +# Bootstrapping Flake +require_once(dirname(dirname(__FILE__)) . "/Frameworks/Flake/Core/Bootstrap.php"); + +# Bootstrapping Baïkal +\Baikal\Framework::bootstrap(); if(!defined("BAIKAL_CAL_ENABLED") || BAIKAL_CAL_ENABLED !== TRUE) { throw new ErrorException("Baikal CalDAV is disabled.", 0, 255, __FILE__, __LINE__); diff --git a/CoreVersions/0.2.0/WWWRoot/card.php b/CoreVersions/0.2.0/WWWRoot/card.php index bdb7282..3898d68 100755 --- a/CoreVersions/0.2.0/WWWRoot/card.php +++ b/CoreVersions/0.2.0/WWWRoot/card.php @@ -27,8 +27,11 @@ define("BAIKAL_CONTEXT", TRUE); define("PROJECT_CONTEXT_BASEURI", "/"); -# Bootstraping Baikal -require_once(dirname(dirname(__FILE__)) . "/Frameworks/Baikal/Core/Bootstrap.php"); +# Bootstrapping Flake +require_once(dirname(dirname(__FILE__)) . "/Frameworks/Flake/Core/Bootstrap.php"); + +# Bootstrapping Baïkal +\Baikal\Framework::bootstrap(); if(!defined("BAIKAL_CARD_ENABLED") || BAIKAL_CARD_ENABLED !== TRUE) { throw new ErrorException("Baikal CardDAV is disabled.", 0, 255, __FILE__, __LINE__); diff --git a/CoreVersions/0.2.0/WWWRoot/index.php b/CoreVersions/0.2.0/WWWRoot/index.php index bc3cec0..e1b4b43 100755 --- a/CoreVersions/0.2.0/WWWRoot/index.php +++ b/CoreVersions/0.2.0/WWWRoot/index.php @@ -26,8 +26,11 @@ define("BAIKAL_CONTEXT", TRUE); define("PROJECT_CONTEXT_BASEURI", "/"); -# Bootstraping Baikal -require_once(dirname(dirname(__FILE__)) . "/Frameworks/Baikal/Core/Bootstrap.php"); +# Bootstraping Flake +require_once(dirname(dirname(__FILE__)) . "/Frameworks/Flake/Core/Bootstrap.php"); + +# Bootstrapping Baïkal +\Baikal\Framework::bootstrap(); ?> From 09e58888bb3c5520c908a481fa458a4ab94fd1e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81ro=CC=82me=20Schneider?= Date: Fri, 4 May 2012 22:39:09 +0100 Subject: [PATCH 3/7] Working on web admin --- .../0.2.0/Frameworks/Baikal/Core/Tools.php | 4 +- .../0.2.0/Frameworks/Baikal/Framework.php | 8 +- .../Baikal/Model/Config/Standard.php | 20 +-- .../BaikalAdmin/Controller/Dashboard.php | 52 ++++++-- .../Controller/Install/Initialize.php | 2 +- .../Controller/Install/VersionUpgrade.php | 11 +- .../{Install/AdminPassword.php => Login.php} | 66 +++++----- .../Controller/Navigation/Topbar.php | 2 +- .../Navigation/Topbar/Anonymous.php} | 60 +++------ .../Controller/Settings/Standard.php | 8 +- .../Controller/Settings/System.php | 9 +- .../Frameworks/BaikalAdmin/Core/Auth.php | 43 +++---- .../Resources/Templates/Dashboard.html | 119 ++++++++++++++++++ .../Frameworks/BaikalAdmin/View/Dashboard.php | 31 +++++ .../Frameworks/BaikalAdmin/WWWRoot/index.php | 15 ++- .../BaikalAdmin/WWWRoot/install/index.php | 3 +- .../0.2.0/Frameworks/Flake/Core/Requester.php | 1 + .../Frameworks/Flake/Core/Requester/Sql.php | 19 ++- Specific/db/baikal.sqlite | Bin 14336 -> 14336 bytes 19 files changed, 319 insertions(+), 154 deletions(-) rename CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/{Install/AdminPassword.php => Login.php} (52%) rename CoreVersions/0.2.0/Frameworks/BaikalAdmin/{Model/Install.php => Controller/Navigation/Topbar/Anonymous.php} (56%) create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Dashboard.html create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Dashboard.php diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Core/Tools.php b/CoreVersions/0.2.0/Frameworks/Baikal/Core/Tools.php index 096602b..4a778d6 100755 --- a/CoreVersions/0.2.0/Frameworks/Baikal/Core/Tools.php +++ b/CoreVersions/0.2.0/Frameworks/Baikal/Core/Tools.php @@ -53,8 +53,8 @@ class Tools { ini_set("error_reporting", E_ALL); } - function handleException($exception) { - echo $exception; + public static function handleException($exception) { + echo "
" . $exception . "
";
 	}
 	
 	public static function assertBaikalIsOk() {
diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Framework.php b/CoreVersions/0.2.0/Frameworks/Baikal/Framework.php
index 5959680..c4a5fad 100755
--- a/CoreVersions/0.2.0/Frameworks/Baikal/Framework.php
+++ b/CoreVersions/0.2.0/Frameworks/Baikal/Framework.php
@@ -30,8 +30,10 @@ class Framework extends \Flake\Core\Framework {
 	
 	public static function installTool() {	
 		if(defined("BAIKAL_CONTEXT_INSTALL") && BAIKAL_CONTEXT_INSTALL === TRUE) {
+			# Install tool has been launched and we're already on the install page
 			return;
 		} else {
+			# Install tool has been launched; redirecting user
 			$sInstallToolUrl = PROJECT_URI . "admin/install/";
 			header("Location: " . $sInstallToolUrl);
 			exit(0);
@@ -79,9 +81,7 @@ class Framework extends \Flake\Core\Framework {
 					\Baikal\Core\Tools::assertBaikalIsOk();
 
 					set_error_handler("\Baikal\Framework::exception_error_handler");
-
-					unset($bShouldCheckEnv);
-
+					
 					# SabreDAV Autoloader 
 					require_once(BAIKAL_PATH_SABREDAV . 'autoload.php');
 				}
@@ -91,7 +91,7 @@ class Framework extends \Flake\Core\Framework {
 	}
 	
 	# Mapping PHP errors to exceptions; needed by SabreDAV
-	function exception_error_handler($errno, $errstr, $errfile, $errline) {
+	public static function exception_error_handler($errno, $errstr, $errfile, $errline) {
 		throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
 	}
 }
\ No newline at end of file
diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/Standard.php b/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/Standard.php
index 8b91cf5..f1058ff 100755
--- a/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/Standard.php
+++ b/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/Standard.php
@@ -32,13 +32,13 @@ class Standard extends \Baikal\Model\Config {
 		"BAIKAL_TIMEZONE" => array(
 			"type" => "string",
 		),
-		"BAIKAL_CARD_ENABLED" => array(
+		"BAIKAL_ADMIN_ENABLED" => array(
 			"type" => "boolean",
 		),
 		"BAIKAL_CAL_ENABLED" => array(
 			"type" => "boolean",
 		),
-		"BAIKAL_ADMIN_ENABLED" => array(
+		"BAIKAL_CARD_ENABLED" => array(
 			"type" => "boolean",
 		),
 		"BAIKAL_ADMIN_PASSWORDHASH" => array(
@@ -69,8 +69,12 @@ class Standard extends \Baikal\Model\Config {
 		)));
 		
 		$oMorpho->add(new \Formal\Element\Checkbox(array(
-			"prop" => "BAIKAL_CARD_ENABLED",
-			"label" => "Enable CardDAV"
+			"prop" => "BAIKAL_ADMIN_ENABLED",
+			"label" => "Enable Web Admin",
+			"popover" => array(
+				"title" => "Warning !",
+				"content" => "If disabled, you'll lose access to this very admin interface !",
+			),
 		)));
 		
 		$oMorpho->add(new \Formal\Element\Checkbox(array(
@@ -79,12 +83,8 @@ class Standard extends \Baikal\Model\Config {
 		)));
 		
 		$oMorpho->add(new \Formal\Element\Checkbox(array(
-			"prop" => "BAIKAL_ADMIN_ENABLED",
-			"label" => "Enable Web Admin",
-			"popover" => array(
-				"title" => "Warning !",
-				"content" => "If disabled, you'll lose access to this very admin interface !",
-			),
+			"prop" => "BAIKAL_CARD_ENABLED",
+			"label" => "Enable CardDAV"
 		)));
 		
 		$oMorpho->add(new \Formal\Element\Password(array(
diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php
index 9a42c37..b21807c 100755
--- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php
+++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php
@@ -32,17 +32,47 @@ class Dashboard extends \Flake\Core\Controller {
 	}
 	
 	public function render() {
-		$sLinkUsers = \BaikalAdmin\Controller\Users::link();
+		$oView = new \BaikalAdmin\View\Dashboard();
+		$oView->setData("BAIKAL_VERSION", BAIKAL_VERSION);
 		
-		$sMessage =<<
-* Nombre d'utilisateurs
-* Nombre de calendriers
-* Nombre d'évènements
-* Version + Mise à jour de baikal
-* Lien vers liste des utilisateurs
-* Lien vers paramétrage
-MESSAGE; - return $sMessage; + # Services status + $oView->setData("BAIKAL_CAL_ENABLED", BAIKAL_CAL_ENABLED); + $oView->setData("BAIKAL_CARD_ENABLED", BAIKAL_CARD_ENABLED); + + # Statistics: Users + $iNbUsers = \Baikal\Model\User::getBaseRequester()->count(); + $oView->setData("nbusers", $iNbUsers); + + # Statistics: CalDAV + $iNbCalendars = \Baikal\Model\Calendar::getBaseRequester()->count(); + $oView->setData("nbcalendars", $iNbCalendars); + + $iNbEvents = \Baikal\Model\Calendar\Event::getBaseRequester()->count(); + $oView->setData("nbevents", $iNbEvents); + + if($iNbCalendars > 0) { + $fEventsPerCalendarAvg = $iNbEvents / $iNbCalendars; + } else { + $fEventsPerCalendarAvg = 0; + } + + $oView->setData("eventspercalendaravg", $fEventsPerCalendarAvg); + + # Statistics: CardDAV + $iNbBooks = \Baikal\Model\AddressBook::getBaseRequester()->count(); + $oView->setData("nbbooks", $iNbBooks); + + $iNbContacts = \Baikal\Model\AddressBook\Contact::getBaseRequester()->count(); + $oView->setData("nbcontacts", $iNbEvents); + + if($iNbBooks > 0) { + $fContactsPerBookAvg = $iNbContacts / $iNbBooks; + } else { + $fContactsPerBookAvg = 0; + } + + $oView->setData("contactsperbookavg", $fContactsPerBookAvg); + + return $oView->render(); } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php index 2dc0192..29e33ec 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php @@ -79,7 +79,7 @@ PHP; } public function render() { - $sBigIcon = \BaikalAdmin\Model\Install::bigicon(); + $sBigIcon = "glyph2x-magic"; $sBaikalVersion = BAIKAL_VERSION; $sHtml = << HTML; -/* $sHtml .= <<What is this ? -

- This is the Baïkal Install Tool.
- It's displayed because you just installed or upgraded your Baïkal installation.
- Baïkal requires some maintenance in order to ensure everything works as expected. -

-HTML; -*/ return $sHtml; } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/AdminPassword.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Login.php similarity index 52% rename from CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/AdminPassword.php rename to CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Login.php index ef2a39a..f0a60c4 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/AdminPassword.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Login.php @@ -24,48 +24,48 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -namespace BaikalAdmin\Controller\Install; +namespace BaikalAdmin\Controller; -class AdminPassword extends \Flake\Core\Controller { - - protected $aMessages = array(); - protected $oModel; # \BaikalAdmin\Model\Install - protected $oForm; # \Formal\Form - -/* public function __construct() { - parent::__construct(); - - $this->oModel = new \BaikalAdmin\Model\Install(); - - $this->oForm = $this->oModel->formForThisModelInstance(array( - "close" => FALSE - )); - } - - public function execute() { - if($this->oForm->submitted()) { - $this->oForm->execute(); - } - }*/ +class Login extends \Flake\Core\Controller { public function execute() { } - + public function render() { - $sBigIcon = \BaikalAdmin\Model\Install::bigicon(); - $sBaikalVersion = BAIKAL_VERSION; + $sActionUrl = \Flake\Util\Tools::getCurrentUrl(); + $sSubmittedFlagName = "auth"; + $sLogin = htmlspecialchars(\Flake\Util\Tools::POST("login")); + $sPassword = htmlspecialchars(\Flake\Util\Tools::POST("password")); + if(trim($sLogin) === "") { + $sLogin = "admin"; + } + + $sForm =<<
-

Baïkal maintainance wizard

-

Maintaining Baïkal {$sBaikalVersion}

+

Authentication

+

Please authenticate to access Baïkal Web Admin.

-HTML; - $sHtml .= <<You have to set a password for the admin user.

-HTML; + + +
+

+ + +

- return $sHtml; +

+ + +

+ +
+ +
+
+
+FORM; + return $sForm; } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php index 17744df..1ab1b08 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php @@ -73,7 +73,7 @@ class Topbar extends \Flake\Core\Controller { Baïkal Web Admin +HTML; + return $sHtml; } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/Standard.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/Standard.php index c6271d1..4c04e69 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/Standard.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/Standard.php @@ -49,6 +49,12 @@ class Standard extends \Flake\Core\Controller { } public function render() { - return $this->oForm->render(); + + $sHeader =<<
+

Baïkal settings

+ +FORM; + return $sHeader . $this->oForm->render(); } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/System.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/System.php index dd0f887..4c91955 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/System.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/System.php @@ -49,11 +49,18 @@ class System extends \Flake\Core\Controller { } public function render() { + + $sHeader =<< +

Baïkal system settings

+ +FORM; + $sMessage = \Formal\Core\Message::notice( "Do not change anything on this page unless you really know what you are doing.
You might break Baïkal if you misconfigure something here.", "Warning !", FALSE ); - return $sMessage . $this->oForm->render(); + return $sHeader . $sMessage . $this->oForm->render(); } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php index e23d88e..bc6facc 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php @@ -27,7 +27,7 @@ namespace BaikalAdmin\Core; class Auth { - static function assertEnabled() { + public static function assertEnabled() { if(!defined("BAIKAL_ADMIN_ENABLED") || BAIKAL_ADMIN_ENABLED !== TRUE) { die("

Baïkal Admin is disabled.

To enable it, set BAIKAL_ADMIN_ENABLED to TRUE in Specific/config.php"); } @@ -35,7 +35,7 @@ class Auth { self::assertUnlocked(); } - static function assertUnlocked() { + public static function assertUnlocked() { if(defined("BAIKAL_CONTEXT_INSTALL") && BAIKAL_CONTEXT_INSTALL === TRUE) { $sToolName = "Baïkal Install Tool"; @@ -68,41 +68,30 @@ class Auth { die("

" . $sToolName . " is locked.

To unlock it, create an empty file named ENABLE_ADMIN in Specific/"); } } - - static function assertAuthentified() { - if(!self::isAuthentified()) { - header(utf8_decode('WWW-Authenticate: Basic realm="Baïkal admin"')); - header('HTTP/1.0 401 Unauthorized'); - die("Please authenticate."); + + public static function isAuthenticated() { + if(isset($_SESSION["baikaladminauth"]) && $_SESSION["baikaladminauth"] === md5(BAIKAL_ADMIN_PASSWORDHASH)) { + return TRUE; } - - return TRUE; - } - - static function isAuthentified() { - - if(array_key_exists("PHP_AUTH_USER", $_SERVER)) { - $sUser = $_SERVER["PHP_AUTH_USER"]; - } else { - $sUser = FALSE; + + if(intval(\Flake\Util\Tools::POST("auth")) !== 1) { + return FALSE; } - - if(array_key_exists("PHP_AUTH_PW", $_SERVER)) { - $sPass = $_SERVER["PHP_AUTH_PW"]; - } else { - $sPass = FALSE; - } - + + $sUser = \Flake\Util\Tools::POST("login"); + $sPass = \Flake\Util\Tools::POST("password"); + $sPassHash = self::hashAdminPassword($sPass); - + if($sUser === "admin" && $sPassHash === BAIKAL_ADMIN_PASSWORDHASH) { + $_SESSION["baikaladminauth"] = md5(BAIKAL_ADMIN_PASSWORDHASH); return TRUE; } return FALSE; } - static function hashAdminPassword($sPassword) { + public static function hashAdminPassword($sPassword) { return md5('admin:' . BAIKAL_AUTH_REALM . ':' . $sPassword); } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Dashboard.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Dashboard.html new file mode 100755 index 0000000..4acbb08 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Dashboard.html @@ -0,0 +1,119 @@ +
+

Dashboard

+
+ +
+ +
+
+

Version

+

This systems runs Baïkal

+
+
+

Services

+ + + + + + + + + + + + + + + + +
Web adminOn

CalDAV
CardDAV
+
+
+

License and credits

+ +

Baïkal is open source software, and released under the terms of the GNU GPL v3.

+

Baïkal is developped by Jérôme Schneider. You can contact him at mail@jeromeschneider.fr.

+

Baïkal is based upon other open source projects. Read the README.md file to learn about that.

+

+
+
+
+ +
+ +
+
+

Users

+ + + + + + + +
Registered users
+
+
+

CalDAV

+ + + + + + + + + + + + + + + +
Number of calendars
Number of events
Events per calendar avg.
+
+
+

CardDAV

+ + + + + + + + + + + + + + + +
Number of address books
Number of contacts
Contacts per book avg.
+
+
+
\ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Dashboard.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Dashboard.php new file mode 100755 index 0000000..790bbbb --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Dashboard.php @@ -0,0 +1,31 @@ + +* 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 BaikalAdmin\View; + +class Dashboard extends \BaikalAdmin\Core\View { + +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php index e099170..460212e 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php @@ -37,9 +37,8 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/Flake/Core/Bootstrap.php"); # Bootstrap BaikalAdmin \BaikalAdmin\Framework::bootstrap(); -# Evaluate assertions +# Assert that BaikalAdmin is enabled \BaikalAdmin\Core\Auth::assertEnabled(); -\BaikalAdmin\Core\Auth::assertAuthentified(); # Create and setup a page object $oPage = new \Flake\Controller\Page(BAIKALADMIN_PATH_TEMPLATES . "Page/index.html"); @@ -47,10 +46,16 @@ $oPage->injectHTTPHeaders(); $oPage->setTitle("Baïkal Web Admin"); $oPage->setBaseUrl(PROJECT_URI); -$oPage->zone("navbar")->addBlock(new \BaikalAdmin\Controller\Navigation\Topbar()); +# Authentication +if(\BaikalAdmin\Core\Auth::isAuthenticated() === FALSE) { + $oPage->zone("navbar")->addBlock(new \BaikalAdmin\Controller\Navigation\Topbar\Anonymous()); + $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Login()); +} else { + $oPage->zone("navbar")->addBlock(new \BaikalAdmin\Controller\Navigation\Topbar()); -# Route the request -$GLOBALS["ROUTER"]::route($oPage); + # Route the request + $GLOBALS["ROUTER"]::route($oPage); +} # Render the page echo $oPage->render(); \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php index a610846..12c5a81 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php @@ -54,8 +54,7 @@ if(!defined("BAIKAL_CONFIGURED_VERSION")) { } elseif(!defined("BAIKAL_ADMIN_PASSWORDHASH")) { # we have to set an admin password - $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Install\AdminPassword()); - + $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Install\Initialize()); } else { # we have to initialize Baïkal (new installation) $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Install\VersionUpgrade()); diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester.php b/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester.php index a4416cb..7cdeb5c 100755 --- a/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester.php @@ -45,4 +45,5 @@ abstract class Requester extends \Flake\Core\FLObject { } public abstract function execute(); + public abstract function count(); } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester/Sql.php b/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester/Sql.php index 769f95c..62e5ffc 100755 --- a/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester/Sql.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester/Sql.php @@ -170,7 +170,7 @@ class Sql extends \Flake\Core\FLObject { return $this->bHasBeenExecuted; } - public function getQuery() { + public function getQuery($sFields = "*") { $sWhere = "1=1"; $sOrderBy = ""; $sLimit = ""; @@ -194,7 +194,7 @@ class Sql extends \Flake\Core\FLObject { } return $GLOBALS["DB"]->SELECTquery( - "*", + $sFields, $this->sDataTable, $sWhere, "", @@ -202,6 +202,10 @@ class Sql extends \Flake\Core\FLObject { $sLimit ); } + + public function getCountQuery() { + return $this->getQuery("count(*) as nbitems"); + } public function execute() { $oCollection = new \Flake\Core\CollectionTyped($this->sModelClass); @@ -218,4 +222,15 @@ class Sql extends \Flake\Core\FLObject { return $oCollection; } + + public function count() { + $sSql = $this->getCountQuery(); + + $rSql = $GLOBALS["DB"]->query($sSql); + if(($aRs = $rSql->fetch()) !== FALSE) { + return intval($aRs["nbitems"]); + } + + return 0; + } } \ No newline at end of file diff --git a/Specific/db/baikal.sqlite b/Specific/db/baikal.sqlite index a27278539ac7ea2f56ff09de8e0ebaccdc2a9e9a..169db6b98f4c4ed104a3873757e65f26dec91295 100755 GIT binary patch delta 417 zcmZwCJx{_=6b9gXdoa|GCXz~!V1R@eV@OeGfjVg-j0yu`L<_w&O-OswmL2#7n!3y2 z#scY|Fwq&p=nk{1rEZPe8Q$}}=M3qPKBw^b<>VHR=a28eGSEaYgXVlxgJg$^BB7ij z9JO?#r&FbGUr?f2ruz|<_~v%X_DPnSmNR%7D7x*6G~bX;R#z6KOH!#w$#u^y2Boq_o~kpGsMlY?25u_U#) Ggb@G=( Date: Mon, 7 May 2012 19:04:53 +0200 Subject: [PATCH 4/7] Working on web admin --- .../BaikalAdmin/Controller/Dashboard.php | 16 ----- .../Controller/Install/Initialize.php | 25 ++++---- .../BaikalAdmin/Controller/Login.php | 59 ++++++++++-------- .../BaikalAdmin/Controller/Logout.php | 43 +++++++++++++ .../Controller/Navigation/Topbar.php | 37 +++++------ .../Navigation/Topbar/Anonymous.php | 13 +--- .../Controller/Navigation/Topbar/Install.php | 13 +--- .../Controller/Settings/Standard.php | 10 ++- .../Controller/Settings/System.php | 16 +++-- .../Controller/User/AddressBooks.php | 27 ++++---- .../BaikalAdmin/Controller/User/Calendars.php | 27 ++++---- .../BaikalAdmin/Controller/Users.php | 25 ++++---- .../Frameworks/BaikalAdmin/Core/Auth.php | 10 +++ .../Resources/Templates/Dashboard.html | 8 --- .../Templates/Install/Initialize.html | 8 +++ .../Resources/Templates/Login.html | 25 ++++++++ .../Templates/Navigation/Topbar.html | 21 +++++++ .../Navigation/Topbar/Anonymous.html | 7 +++ .../Templates/Navigation/Topbar/Install.html | 7 +++ .../Templates/Settings/Standard.html | 5 ++ .../Resources/Templates/Settings/System.html | 6 ++ .../Listing.html => User/AddressBooks.html} | 6 +- .../Listing.html => User/Calendars.html} | 6 +- .../{Users/Listing.html => Users.html} | 6 +- .../Frameworks/BaikalAdmin/Route/Logout.php | 34 ++++++++++ .../Listing.php => Install/Initialize.php} | 4 +- .../View/{Users/Listing.php => Login.php} | 5 +- .../BaikalAdmin/View/Navigation/Topbar.php | 31 +++++++++ .../View/Navigation/Topbar/Anonymous.php | 31 +++++++++ .../View/Navigation/Topbar/Install.php | 31 +++++++++ .../BaikalAdmin/View/Settings/Standard.php | 31 +++++++++ .../Listing.php => Settings/System.php} | 5 +- .../BaikalAdmin/View/User/AddressBooks.php | 30 +++++++++ .../BaikalAdmin/View/User/Calendars.php | 30 +++++++++ .../Frameworks/BaikalAdmin/View/Users.php | 30 +++++++++ .../Frameworks/BaikalAdmin/WWWRoot/index.php | 5 +- .../0.2.0/Frameworks/BaikalAdmin/config.php | 3 +- Specific/db/baikal.sqlite | Bin 14336 -> 14336 bytes 38 files changed, 520 insertions(+), 176 deletions(-) create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Logout.php create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Install/Initialize.html create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Login.html create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar.html create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar/Anonymous.html create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar/Install.html create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Settings/Standard.html create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Settings/System.html rename CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/{AddressBooks/Listing.html => User/AddressBooks.html} (96%) rename CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/{Calendars/Listing.html => User/Calendars.html} (96%) rename CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/{Users/Listing.html => Users.html} (96%) create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Logout.php rename CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/{AddressBooks/Listing.php => Install/Initialize.php} (91%) rename CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/{Users/Listing.php => Login.php} (92%) create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Navigation/Topbar.php create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Navigation/Topbar/Anonymous.php create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Navigation/Topbar/Install.php create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Settings/Standard.php rename CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/{Calendars/Listing.php => Settings/System.php} (92%) create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/User/AddressBooks.php create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/User/Calendars.php create mode 100755 CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Users.php diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php index b21807c..5f03791 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php @@ -50,14 +50,6 @@ class Dashboard extends \Flake\Core\Controller { $iNbEvents = \Baikal\Model\Calendar\Event::getBaseRequester()->count(); $oView->setData("nbevents", $iNbEvents); - if($iNbCalendars > 0) { - $fEventsPerCalendarAvg = $iNbEvents / $iNbCalendars; - } else { - $fEventsPerCalendarAvg = 0; - } - - $oView->setData("eventspercalendaravg", $fEventsPerCalendarAvg); - # Statistics: CardDAV $iNbBooks = \Baikal\Model\AddressBook::getBaseRequester()->count(); $oView->setData("nbbooks", $iNbBooks); @@ -65,14 +57,6 @@ class Dashboard extends \Flake\Core\Controller { $iNbContacts = \Baikal\Model\AddressBook\Contact::getBaseRequester()->count(); $oView->setData("nbcontacts", $iNbEvents); - if($iNbBooks > 0) { - $fContactsPerBookAvg = $iNbContacts / $iNbBooks; - } else { - $fContactsPerBookAvg = 0; - } - - $oView->setData("contactsperbookavg", $fContactsPerBookAvg); - return $oView->render(); } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php index 29e33ec..cfa900b 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php @@ -81,23 +81,22 @@ PHP; public function render() { $sBigIcon = "glyph2x-magic"; $sBaikalVersion = BAIKAL_VERSION; - - $sHtml = << -

Baïkal initialization wizard

-

Configure your new Baïkal {$sBaikalVersion} installation.

- -HTML; + + $oView = new \BaikalAdmin\View\Install\Initialize(); + $oView->setData("baikalversion", BAIKAL_VERSION); if($this->oForm->persisted()) { - $sHtml .= "

Baïkal is now configured. You may now Access the Baïkal admin"; - + $sMessage = "

Baïkal is now configured. You may now Access the Baïkal admin"; + $sForm = ""; } else { - # Display the config form - $sHtml .= $this->oForm->render(); + $sMessage = ""; + $sForm = $this->oForm->render(); } - - return $sHtml; + + $oView->setData("message", $sMessage); + $oView->setData("form", $sForm); + + return $oView->render(); } protected function tagConfiguredVersion() { diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Login.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Login.php index f0a60c4..e907480 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Login.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Login.php @@ -34,38 +34,43 @@ class Login extends \Flake\Core\Controller { public function render() { $sActionUrl = \Flake\Util\Tools::getCurrentUrl(); $sSubmittedFlagName = "auth"; + + if(self::isSubmitted() && !\BaikalAdmin\Core\Auth::isAuthenticated()) { + $sMessage = \Formal\Core\Message::error( + "The login/password you provided is invalid. Please retry.", + "Authentication error" + ); + } elseif(self::justLoggedOut()) { + $sMessage = \Formal\Core\Message::notice( + "You have been disconnected from your session.", + "Session ended", + FALSE + ); + } + $sLogin = htmlspecialchars(\Flake\Util\Tools::POST("login")); $sPassword = htmlspecialchars(\Flake\Util\Tools::POST("password")); + if(trim($sLogin) === "") { $sLogin = "admin"; } - - $sForm =<< -

Authentication

-

Please authenticate to access Baïkal Web Admin.

- - - - -
-

- - -

- -

- - -

-
- -
-
- -FORM; - return $sForm; + $oView = new \BaikalAdmin\View\Login(); + $oView->setData("message", $sMessage); + $oView->setData("actionurl", $sActionUrl); + $oView->setData("submittedflagname", $sSubmittedFlagName); + $oView->setData("login", $sLogin); + $oView->setData("password", $sPassword); + + return $oView->render(); + } + + protected static function isSubmitted() { + return (intval(\Flake\Util\Tools::POST("auth")) === 1); + } + + protected static function justLoggedOut() { + $aParams = $GLOBALS["ROUTER"]::getURLParams(); + return (!empty($aParams) && $aParams[0] === "loggedout"); } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Logout.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Logout.php new file mode 100755 index 0000000..4194db6 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Logout.php @@ -0,0 +1,43 @@ + +* 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 BaikalAdmin\Controller; + +class Logout extends \Flake\Core\Controller { + + public function execute() { + \BaikalAdmin\Core\Auth::unAuthenticate(); + + $sControllerForDefaultRoute = $GLOBALS["ROUTER"]::getControllerForRoute("default"); +# debug($sControllerForDefaultRoute); +# die(); + $sLink = $GLOBALS["ROUTER"]::buildRouteForController($sControllerForDefaultRoute, "loggedout"); + \Flake\Util\Tools::redirect($sLink); + } + + public function render() { + } +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php index 1ab1b08..4dddd7d 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php @@ -33,6 +33,8 @@ class Topbar extends \Flake\Core\Controller { public function render() { + $oView = new \BaikalAdmin\View\Navigation\Topbar(); + $sCurrentRoute = $GLOBALS["ROUTER"]::getCurrentRoute(); $sActiveHome = $sActiveUsers = $sActiveSettingsStandard = $sActiveSettingsSystem = ""; @@ -41,6 +43,7 @@ class Topbar extends \Flake\Core\Controller { $sUsersLink = \BaikalAdmin\Controller\Users::link(); $sSettingsStandardLink = \BaikalAdmin\Controller\Settings\Standard::link(); $sSettingsSystemLink = \BaikalAdmin\Controller\Settings\System::link(); + $sLogoutLink = \BaikalAdmin\Controller\Logout::link(); if($sCurrentRoute === "default") { $sActiveHome = "active"; @@ -61,28 +64,16 @@ class Topbar extends \Flake\Core\Controller { $sActiveSettingsSystem = "active"; } - $sHtml =<< - - -HTML; - return $sHtml; + $oView->setData("activehome", $sActiveHome); + $oView->setData("activeusers", $sActiveUsers); + $oView->setData("activesettingsstandard", $sActiveSettingsStandard); + $oView->setData("activesettingssystem", $sActiveSettingsSystem); + $oView->setData("homelink", $sHomeLink); + $oView->setData("userslink", $sUsersLink); + $oView->setData("settingsstandardlink", $sSettingsStandardLink); + $oView->setData("settingssystemlink", $sSettingsSystemLink); + $oView->setData("logoutlink", $sLogoutLink); + + return $oView->render(); } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar/Anonymous.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar/Anonymous.php index e7c00f6..842efd5 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar/Anonymous.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar/Anonymous.php @@ -32,16 +32,7 @@ class Anonymous extends \Flake\Core\Controller { } public function render() { - - $sHtml =<< - - -HTML; - return $sHtml; + $oView = new \BaikalAdmin\View\Navigation\Topbar\Anonymous(); + return $oView->render(); } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar/Install.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar/Install.php index 0e25499..a1306b1 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar/Install.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Navigation/Topbar/Install.php @@ -32,16 +32,7 @@ class Install extends \Flake\Core\Controller { } public function render() { - - $sHtml =<< - - -HTML; - return $sHtml; + $oView = new \BaikalAdmin\View\Navigation\Topbar\Install(); + return $oView->render(); } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/Standard.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/Standard.php index 4c04e69..91701b9 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/Standard.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/Standard.php @@ -50,11 +50,9 @@ class Standard extends \Flake\Core\Controller { public function render() { - $sHeader =<<
-

Baïkal settings

- -FORM; - return $sHeader . $this->oForm->render(); + $oView = new \BaikalAdmin\View\Settings\Standard(); + $oView->setData("form", $this->oForm->render()); + + return $oView->render(); } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/System.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/System.php index 4c91955..9841f2a 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/System.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Settings/System.php @@ -50,17 +50,15 @@ class System extends \Flake\Core\Controller { public function render() { - $sHeader =<< -

Baïkal system settings

- -FORM; - - $sMessage = \Formal\Core\Message::notice( + $oView = new \BaikalAdmin\View\Settings\System(); + $oView->setData("message", \Formal\Core\Message::notice( "Do not change anything on this page unless you really know what you are doing.
You might break Baïkal if you misconfigure something here.", "Warning !", FALSE - ); - return $sHeader . $sMessage . $this->oForm->render(); + )); + + $oView->setData("form", $this->oForm->render()); + + return $oView->render(); } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/AddressBooks.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/AddressBooks.php index f3dc1d0..55fe2c4 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/AddressBooks.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/AddressBooks.php @@ -118,29 +118,28 @@ class AddressBooks extends \Flake\Core\Controller { public function render() { - $sHtml = ""; + $oView = new \BaikalAdmin\View\User\AddressBooks(); - # Render list of users - $oAddressBooks = $this->oUser->getAddressBooksBaseRequester()->execute(); - - $oView = new \BaikalAdmin\View\AddressBooks\Listing(); + # User $oView->setData("user", $this->oUser); - $oView->setData("addressbooks", $oAddressBooks); - $sHtml .= $oView->render(); - # Render form - $sHtml .= ""; + # Render list of address books + $oAddressBooks = $this->oUser->getAddressBooksBaseRequester()->execute(); + $oView->setData("addressbooks", $oAddressBooks); + + # Messages $sMessages = implode("\n", $this->aMessages); + $oView->setData("messages", $sMessages); if(self::newRequested() || self::editRequested()) { - # We have to display the User form - $sHtml .= $this->oForm->render(); + $sForm = $this->oForm->render(); } else { - # No form is displayed; simply display messages, if any - $sHtml .= $sMessages; + $sForm = ""; } + + $oView->setData("form", $sForm); - return $sHtml; + return $oView->render(); } protected function initForm() { diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/Calendars.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/Calendars.php index ca06df1..6a9ae52 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/Calendars.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/User/Calendars.php @@ -123,29 +123,28 @@ class Calendars extends \Flake\Core\Controller { public function render() { - $sHtml = ""; + $oView = new \BaikalAdmin\View\User\Calendars(); - # Render list of users - $oCalendars = $this->oUser->getCalendarsBaseRequester()->execute(); - - $oView = new \BaikalAdmin\View\Calendars\Listing(); + # User $oView->setData("user", $this->oUser); - $oView->setData("calendars", $oCalendars); - $sHtml .= $oView->render(); - # Render form - $sHtml .= ""; + # List of calendars + $oCalendars = $this->oUser->getCalendarsBaseRequester()->execute(); + $oView->setData("calendars", $oCalendars); + + # Messages $sMessages = implode("\n", $this->aMessages); + $oView->setData("messages", $sMessages); if(self::newRequested() || self::editRequested()) { - # We have to display the User form - $sHtml .= $this->oForm->render(); + $sForm = $this->oForm->render(); } else { - # No form is displayed; simply display messages, if any - $sHtml .= $sMessages; + $sForm = ""; } + + $oView->setData("form", $sForm); - return $sHtml; + return $oView->render(); } protected function initForm() { diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Users.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Users.php index 74e5c5b..68c3dfe 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Users.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Users.php @@ -98,28 +98,27 @@ class Users extends \Flake\Core\Controller { } public function render() { - $sHtml = ""; - # Render list of users + $oView = new \BaikalAdmin\View\Users(); + + # List of users $oUsers = \Baikal\Model\User::getBaseRequester()->execute(); - $oView = new \BaikalAdmin\View\Users\Listing(); $oView->setData("users", $oUsers); - $sHtml .= $oView->render(); - - # Render form - $sHtml .= ""; + # Messages $sMessages = implode("\n", $this->aMessages); - + $oView->setData("messages", $sMessages); + + # Form if(self::newRequested() || self::editRequested()) { - # We have to display the User form - $sHtml .= $this->oForm->render(); + $sForm = $this->oForm->render(); } else { - # No form is displayed; simply display messages, if any - $sHtml .= $sMessages; + $sForm = ""; } - return $sHtml; + $oView->setData("form", $sForm); + + return $oView->render(); } protected function initForm() { diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php index bc6facc..4a6f10b 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php @@ -74,6 +74,11 @@ class Auth { return TRUE; } + return FALSE; + } + + public static function authenticate() { + if(intval(\Flake\Util\Tools::POST("auth")) !== 1) { return FALSE; } @@ -89,6 +94,11 @@ class Auth { } return FALSE; + + } + + public static function unAuthenticate() { + unset($_SESSION["baikaladminauth"]); } public static function hashAdminPassword($sPassword) { diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Dashboard.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Dashboard.html index 4acbb08..e7f3e1b 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Dashboard.html +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Dashboard.html @@ -89,10 +89,6 @@ Number of events - - Events per calendar avg. - - @@ -108,10 +104,6 @@ Number of contacts - - Contacts per book avg. - - diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Install/Initialize.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Install/Initialize.html new file mode 100755 index 0000000..0ee9cb9 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Install/Initialize.html @@ -0,0 +1,8 @@ +
+

Baïkal initialization wizard

+

Configure your new Baïkal installation.

+
+ + + + \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Login.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Login.html new file mode 100755 index 0000000..f6e4d54 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Login.html @@ -0,0 +1,25 @@ +
+

Authentication

+

Please authenticate to access Baïkal Web Admin.

+
+ + + + + +
+

+ + +

+ +

+ + +

+ +
+ +
+
+
\ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar.html new file mode 100755 index 0000000..7f8173f --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar.html @@ -0,0 +1,21 @@ + diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar/Anonymous.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar/Anonymous.html new file mode 100755 index 0000000..db737e0 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar/Anonymous.html @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar/Install.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar/Install.html new file mode 100755 index 0000000..0b09bdb --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Navigation/Topbar/Install.html @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Settings/Standard.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Settings/Standard.html new file mode 100755 index 0000000..d2e6b31 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Settings/Standard.html @@ -0,0 +1,5 @@ +
+

Baïkal settings

+
+ + \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Settings/System.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Settings/System.html new file mode 100755 index 0000000..bc3deac --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Settings/System.html @@ -0,0 +1,6 @@ +
+

Baïkal system settings

+
+ + + \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/AddressBooks/Listing.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/User/AddressBooks.html similarity index 96% rename from CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/AddressBooks/Listing.html rename to CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/User/AddressBooks.html index d346217..aac3d9b 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/AddressBooks/Listing.html +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/User/AddressBooks.html @@ -33,4 +33,8 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Calendars/Listing.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/User/Calendars.html similarity index 96% rename from CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Calendars/Listing.html rename to CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/User/Calendars.html index a8603bb..b5005de 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Calendars/Listing.html +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/User/Calendars.html @@ -33,4 +33,8 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Users/Listing.html b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Users.html similarity index 96% rename from CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Users/Listing.html rename to CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Users.html index e62e666..e3f339f 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Users/Listing.html +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Resources/Templates/Users.html @@ -31,4 +31,8 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Logout.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Logout.php new file mode 100755 index 0000000..1aae473 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Route/Logout.php @@ -0,0 +1,34 @@ + +* 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 BaikalAdmin\Route; + +class Logout { + + public static function execute(\Flake\Core\Render\Container &$oRenderContainer) { + $oRenderContainer->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Logout()); + } +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/AddressBooks/Listing.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Install/Initialize.php similarity index 91% rename from CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/AddressBooks/Listing.php rename to CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Install/Initialize.php index efb2f80..9085cdb 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/AddressBooks/Listing.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Install/Initialize.php @@ -24,7 +24,7 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -namespace BaikalAdmin\View\AddressBooks; +namespace BaikalAdmin\View\Install; -class Listing extends \BaikalAdmin\Core\View { +class Initialize extends \BaikalAdmin\Core\View { } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Users/Listing.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Login.php similarity index 92% rename from CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Users/Listing.php rename to CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Login.php index 435ea33..9e9b01a 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Users/Listing.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Login.php @@ -24,7 +24,8 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -namespace BaikalAdmin\View\Users; +namespace BaikalAdmin\View; -class Listing extends \BaikalAdmin\Core\View { +class Login extends \BaikalAdmin\Core\View { + } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Navigation/Topbar.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Navigation/Topbar.php new file mode 100755 index 0000000..6efbc2d --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Navigation/Topbar.php @@ -0,0 +1,31 @@ + +* 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 BaikalAdmin\View\Navigation; + +class Topbar extends \BaikalAdmin\Core\View { + +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Navigation/Topbar/Anonymous.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Navigation/Topbar/Anonymous.php new file mode 100755 index 0000000..a4c6a6e --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Navigation/Topbar/Anonymous.php @@ -0,0 +1,31 @@ + +* 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 BaikalAdmin\View\Navigation\Topbar; + +class Anonymous extends \BaikalAdmin\Core\View { + +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Navigation/Topbar/Install.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Navigation/Topbar/Install.php new file mode 100755 index 0000000..5d6fab0 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Navigation/Topbar/Install.php @@ -0,0 +1,31 @@ + +* 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 BaikalAdmin\View\Navigation\Topbar; + +class Install extends \BaikalAdmin\Core\View { + +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Settings/Standard.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Settings/Standard.php new file mode 100755 index 0000000..cdfb506 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Settings/Standard.php @@ -0,0 +1,31 @@ + +* 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 BaikalAdmin\View\Settings; + +class Standard extends \BaikalAdmin\Core\View { + +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Calendars/Listing.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Settings/System.php similarity index 92% rename from CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Calendars/Listing.php rename to CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Settings/System.php index d05064d..118a819 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Calendars/Listing.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Settings/System.php @@ -24,7 +24,8 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -namespace BaikalAdmin\View\Calendars; +namespace BaikalAdmin\View\Settings; -class Listing extends \BaikalAdmin\Core\View { +class System extends \BaikalAdmin\Core\View { + } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/User/AddressBooks.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/User/AddressBooks.php new file mode 100755 index 0000000..2d0e28f --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/User/AddressBooks.php @@ -0,0 +1,30 @@ + +* 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 BaikalAdmin\View\User; + +class AddressBooks extends \BaikalAdmin\Core\View { +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/User/Calendars.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/User/Calendars.php new file mode 100755 index 0000000..341739c --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/User/Calendars.php @@ -0,0 +1,30 @@ + +* 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 BaikalAdmin\View\User; + +class Calendars extends \BaikalAdmin\Core\View { +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Users.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Users.php new file mode 100755 index 0000000..59ad5f3 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/View/Users.php @@ -0,0 +1,30 @@ + +* 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 BaikalAdmin\View; + +class Users extends \BaikalAdmin\Core\View { +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php index 460212e..d3eae50 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php @@ -47,7 +47,10 @@ $oPage->setTitle("Baïkal Web Admin"); $oPage->setBaseUrl(PROJECT_URI); # Authentication -if(\BaikalAdmin\Core\Auth::isAuthenticated() === FALSE) { +if( + \BaikalAdmin\Core\Auth::isAuthenticated() === FALSE && + \BaikalAdmin\Core\Auth::authenticate() === FALSE +) { $oPage->zone("navbar")->addBlock(new \BaikalAdmin\Controller\Navigation\Topbar\Anonymous()); $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Login()); } else { diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/config.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/config.php index 248ad8a..0e390ce 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/config.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/config.php @@ -33,5 +33,6 @@ $GLOBALS["ROUTES"] = array( "users/addressbooks" => "\BaikalAdmin\Route\User\AddressBooks", "install" => "\BaikalAdmin\Route\Install", "settings/standard" => "\BaikalAdmin\Route\Settings\Standard", - "settings/system" => "\BaikalAdmin\Route\Settings\System" + "settings/system" => "\BaikalAdmin\Route\Settings\System", + "logout" => "\BaikalAdmin\Route\Logout" ); \ No newline at end of file diff --git a/Specific/db/baikal.sqlite b/Specific/db/baikal.sqlite index 169db6b98f4c4ed104a3873757e65f26dec91295..92b4dbb62fc691068f0ab990f862743351e43c43 100755 GIT binary patch delta 1309 zcmbtUL66%+7#(LqcWc!W2$iZVT7p&xsnqe5jgR982&gQ?)4Ah8j!S&8$z5!!yt>6}YW_#N}&vxADd2+#0xj zX*qL@ZryBR$1;h)cQNrAu45=gB=BwGS`Et(CCQBAL0D)EgQ6rwb$?LMil`_{5_SZh z6?++gu}ko-OByEoma#Bg+{F%MD+o?aiY-GyvVt_UO=YB&OO-u=?=XD3rn0H6i@IK_ zizP+FqN&tsqE)ZxNLLj_wKajaD3iF;HJcq=wHVqGOx_lFN=(OV8;ijtb55_*YMG>G zWX)j3DfOsH=)csLGidg+)&8eEO=j{ue7%F6IwKQ!M*sJY=I^Vn{r3(wY^@jtqrCg= zcVhtnkO$8)cW=N=@a*p7*Ys#Be*sAK4Ner^{PO(UXH0H}g}@(#!+sKlNg?)=LjUCc zzJGIEc&i_>aWFn-Eym?KKiR5O6dNJiUYfCzd)DOi|F}#WExhMCm>IFh?8G;d!#I@M zeiDuTN`htfnvLCSEDLncwQUbmo476GT_huxGeXi1%a2X)^=c2Bq}ki4^;)h&uT@p{ z#)_+=>~)q#5o*YKMMkQkQ=}mFWT=kW!bTl?&rwj95wHad>sAsL{a}`7k+g{B8Ei z`V78y5lY+{KsbB+j=0X&rU3p3AHZ}v`3zpY0`uT)pa?5LaP~=uQ9I% s3e9JpyxKStDDswp`7QHzpvXgJVNPao#)8z8qI@O}W>LnH)Z!9G07O Date: Tue, 8 May 2012 00:29:27 +0200 Subject: [PATCH 5/7] Working on web admin --- .../BaikalAdmin/Controller/Dashboard.php | 2 +- .../BaikalAdmin/Controller/Login.php | 1 + .../Frameworks/BaikalAdmin/WWWRoot/index.php | 5 +- .../BaikalAdmin/WWWRoot/install/index.php | 5 +- .../0.2.0/Frameworks/Flake/Core/Bootstrap.php | 146 ---------------- .../0.2.0/Frameworks/Flake/Core/Framework.php | 2 +- .../Frameworks/Flake/Core/Requester/Sql.php | 2 +- .../0.2.0/Frameworks/Flake/Framework.php | 156 ++++++++++++++++++ CoreVersions/0.2.0/WWWRoot/cal.php | 5 +- CoreVersions/0.2.0/WWWRoot/card.php | 5 +- CoreVersions/0.2.0/WWWRoot/index.php | 3 +- Specific/db/baikal.sqlite | Bin 14336 -> 14336 bytes 12 files changed, 174 insertions(+), 158 deletions(-) delete mode 100755 CoreVersions/0.2.0/Frameworks/Flake/Core/Bootstrap.php create mode 100755 CoreVersions/0.2.0/Frameworks/Flake/Framework.php diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php index 5f03791..4758b9a 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Dashboard.php @@ -55,7 +55,7 @@ class Dashboard extends \Flake\Core\Controller { $oView->setData("nbbooks", $iNbBooks); $iNbContacts = \Baikal\Model\AddressBook\Contact::getBaseRequester()->count(); - $oView->setData("nbcontacts", $iNbEvents); + $oView->setData("nbcontacts", $iNbContacts); return $oView->render(); } diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Login.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Login.php index e907480..fcae27f 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Login.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Login.php @@ -34,6 +34,7 @@ class Login extends \Flake\Core\Controller { public function render() { $sActionUrl = \Flake\Util\Tools::getCurrentUrl(); $sSubmittedFlagName = "auth"; + $sMessage = ""; if(self::isSubmitted() && !\BaikalAdmin\Core\Auth::isAuthenticated()) { $sMessage = \Formal\Core\Message::error( diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php index d3eae50..a552947 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php @@ -31,8 +31,9 @@ define("PROJECT_CONTEXT_BASEURI", "/admin/"); define("BAIKAL_CONTEXT", TRUE); define("BAIKAL_CONTEXT_ADMIN", TRUE); -# Bootstrap Flake -require_once(dirname(dirname(dirname(__FILE__))) . "/Flake/Core/Bootstrap.php"); # ../../ +# Bootstraping Flake +require_once(dirname(dirname(dirname(__FILE__))) . "/Flake/Framework.php"); # ../../ +\Flake\Framework::bootstrap(); # Bootstrap BaikalAdmin \BaikalAdmin\Framework::bootstrap(); diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php index 12c5a81..97d169d 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php @@ -31,8 +31,9 @@ define("PROJECT_CONTEXT_BASEURI", "/admin/install/"); define("BAIKAL_CONTEXT", TRUE); define("BAIKAL_CONTEXT_INSTALL", TRUE); -# Bootstrap Flake -require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Flake/Core/Bootstrap.php"); # ../../../ +# Bootstraping Flake +require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Flake/Framework.php"); # ../../../ +\Flake\Framework::bootstrap(); # Bootstrap BaikalAdmin \BaikalAdmin\Framework::bootstrap(); diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Core/Bootstrap.php b/CoreVersions/0.2.0/Frameworks/Flake/Core/Bootstrap.php deleted file mode 100755 index 4f65cd5..0000000 --- a/CoreVersions/0.2.0/Frameworks/Flake/Core/Bootstrap.php +++ /dev/null @@ -1,146 +0,0 @@ - -* 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! -***************************************************************/ - -# Asserting PHP 5.3.0+ -if(version_compare(PHP_VERSION, '5.3.0', '<')) { - die('Flake Fatal Error: Flake requires PHP 5.3.0+ to run properly. Your version is: ' . PHP_VERSION . '.'); -} - -# Define absolute server path to Flake Framework -define("FLAKE_PATH_ROOT", dirname(dirname(__FILE__)) . "/"); # ../ - -if(!defined('LF')) { - define('LF', chr(10)); -} - -if(!defined('CR')) { - define('CR', chr(13)); -} - -if(array_key_exists("SERVER_NAME", $_SERVER) && $_SERVER["SERVER_NAME"] === "mongoose") { - define("MONGOOSE_SERVER", TRUE); -} else { - define("MONGOOSE_SERVER", FALSE); -} - -# Display errors messages, except notices -#ini_set("display_errors", 1); -#ini_set("error_reporting", E_ALL & ~E_NOTICE); - -function rmBeginSlash($sString) { - if(substr($sString, 0, 1) === "/") { - $sString = substr($sString, 1); - } - - return $sString; -} - -function rmEndSlash($sString) { - if(substr($sString, -1) === "/") { - $sString = substr($sString, 0, -1); - } - - return $sString; -} - -function appendSlash($sString) { - if(substr($sString, -1) !== "/") { - $sString .= "/"; - } - - return $sString; -} - -function prependSlash($sString) { - if(substr($sString, 0, 1) !== "/") { - $sString = "/" . $sString; - } - - return $sString; -} -if(!function_exists("debug")) { - function debug($mVar, $sHeader=0) { - \Flake\Util\Tools::debug($mVar, $sHeader); - } -} - -################################################################################################# - -# determine Flake install root path -# not using realpath here to avoid symlinks resolution - -define("PROJECT_PATH_ROOT", dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . "/"); # ../../../../../ -define("PROJECT_PATH_CORE", PROJECT_PATH_ROOT . "Core/"); -define("PROJECT_PATH_SPECIFIC", PROJECT_PATH_ROOT . "Specific/"); -define("PROJECT_PATH_FRAMEWORKS", PROJECT_PATH_CORE . "Frameworks/"); -define("PROJECT_PATH_WWWROOT", PROJECT_PATH_CORE . "WWWRoot/"); - -# Define path to Baïkal SQLite file -define("PROJECT_SQLITE_FILE", PROJECT_PATH_SPECIFIC . "db/baikal.sqlite"); - -define("PROJECT_SAFEHASH_SALT", "une-clef-super-secrete"); - -require_once(PROJECT_PATH_CORE . "Distrib.php"); - -# Determine PROJECT_URI -$sScript = substr($_SERVER["SCRIPT_FILENAME"], strlen($_SERVER["DOCUMENT_ROOT"])); -$sDirName = appendSlash(dirname($sScript)); -$sBaseUrl = appendSlash(substr($sDirName, 0, -1 * strlen(PROJECT_CONTEXT_BASEURI))); -$aParts = explode("/", $_SERVER["SERVER_PROTOCOL"]); -$sProtocol = strtolower(array_shift($aParts)); -define("PROJECT_BASEURI", $sBaseUrl); -define("PROJECT_URI", $sProtocol . "://" . rmEndSlash($_SERVER["HTTP_HOST"]) . $sBaseUrl); -unset($sScript); unset($sDirName); unset($sBaseUrl); unset($sProtocol); unset($aParts); - -################################################################################################# - -require_once(FLAKE_PATH_ROOT . 'Core/ClassLoader.php'); -\Flake\Core\ClassLoader::register(); - -# Include Flake Framework config -require_once(FLAKE_PATH_ROOT . "config.php"); - -# Determine Router class -$GLOBALS["ROUTER"] = \Flake\Util\Tools::router(); - -if(!\Flake\Util\Tools::isCliPhp()) { - ini_set("html_errors", TRUE); - session_start(); -} - -setlocale(LC_ALL, FLAKE_LOCALE); -date_default_timezone_set(FLAKE_TIMEZONE); - -if(defined("PROJECT_SQLITE_FILE") && file_exists(PROJECT_SQLITE_FILE) && is_readable(PROJECT_SQLITE_FILE) && !isset($GLOBALS["DB"])) { - $GLOBALS["DB"] = new \Flake\Core\Database\Sqlite(PROJECT_SQLITE_FILE); -} - -$GLOBALS["TEMPLATESTACK"] = array(); - -$aUrlInfo = parse_url(PROJECT_URI); -define("FLAKE_DOMAIN", $_SERVER["HTTP_HOST"]); -define("FLAKE_URIPATH", \Flake\Util\Tools::stripBeginSlash($aUrlInfo["path"])); -unset($aUrlInfo); \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Core/Framework.php b/CoreVersions/0.2.0/Frameworks/Flake/Core/Framework.php index 8816fea..c14b0af 100755 --- a/CoreVersions/0.2.0/Frameworks/Flake/Core/Framework.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Core/Framework.php @@ -26,6 +26,6 @@ namespace Flake\Core; -class Framework extends \Flake\Core\FLObject { +class Framework { } \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester/Sql.php b/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester/Sql.php index 62e5ffc..e332547 100755 --- a/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester/Sql.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Core/Requester/Sql.php @@ -225,7 +225,7 @@ class Sql extends \Flake\Core\FLObject { public function count() { $sSql = $this->getCountQuery(); - + $rSql = $GLOBALS["DB"]->query($sSql); if(($aRs = $rSql->fetch()) !== FALSE) { return intval($aRs["nbitems"]); diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Framework.php b/CoreVersions/0.2.0/Frameworks/Flake/Framework.php new file mode 100755 index 0000000..2dc1585 --- /dev/null +++ b/CoreVersions/0.2.0/Frameworks/Flake/Framework.php @@ -0,0 +1,156 @@ + +* 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; +require_once(dirname(__FILE__) . "/Core/Framework.php"); # Manual require as Classloader not included yet + + +if(!function_exists("debug")) { + function debug($mVar, $sHeader=0) { + \Flake\Util\Tools::debug($mVar, $sHeader); + } +} + +class Framework extends \Flake\Core\Framework { + + function rmBeginSlash($sString) { + if(substr($sString, 0, 1) === "/") { + $sString = substr($sString, 1); + } + + return $sString; + } + + function rmEndSlash($sString) { + if(substr($sString, -1) === "/") { + $sString = substr($sString, 0, -1); + } + + return $sString; + } + + function appendSlash($sString) { + if(substr($sString, -1) !== "/") { + $sString .= "/"; + } + + return $sString; + } + + function prependSlash($sString) { + if(substr($sString, 0, 1) !== "/") { + $sString = "/" . $sString; + } + + return $sString; + } + + public static function bootstrap() { + # Asserting PHP 5.3.0+ + if(version_compare(PHP_VERSION, '5.3.0', '<')) { + die('Flake Fatal Error: Flake requires PHP 5.3.0+ to run properly. Your version is: ' . PHP_VERSION . '.'); + } + + # Define absolute server path to Flake Framework + define("FLAKE_PATH_ROOT", dirname(__FILE__) . "/"); # ./ + + if(!defined('LF')) { + define('LF', chr(10)); + } + + if(!defined('CR')) { + define('CR', chr(13)); + } + + if(array_key_exists("SERVER_NAME", $_SERVER) && $_SERVER["SERVER_NAME"] === "mongoose") { + define("MONGOOSE_SERVER", TRUE); + } else { + define("MONGOOSE_SERVER", FALSE); + } + + # Display errors messages, except notices + #ini_set("display_errors", 1); + #ini_set("error_reporting", E_ALL & ~E_NOTICE); + + ################################################################################################# + + # determine Flake install root path + # not using realpath here to avoid symlinks resolution + + define("PROJECT_PATH_ROOT", dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/"); # ../../../../../ + define("PROJECT_PATH_CORE", PROJECT_PATH_ROOT . "Core/"); + define("PROJECT_PATH_SPECIFIC", PROJECT_PATH_ROOT . "Specific/"); + define("PROJECT_PATH_FRAMEWORKS", PROJECT_PATH_CORE . "Frameworks/"); + define("PROJECT_PATH_WWWROOT", PROJECT_PATH_CORE . "WWWRoot/"); + + # Define path to Baïkal SQLite file + define("PROJECT_SQLITE_FILE", PROJECT_PATH_SPECIFIC . "db/baikal.sqlite"); + + define("PROJECT_SAFEHASH_SALT", "une-clef-super-secrete"); + + require_once(PROJECT_PATH_CORE . "Distrib.php"); + + # Determine PROJECT_URI + $sScript = substr($_SERVER["SCRIPT_FILENAME"], strlen($_SERVER["DOCUMENT_ROOT"])); + $sDirName = self::appendSlash(dirname($sScript)); + $sBaseUrl = self::appendSlash(substr($sDirName, 0, -1 * strlen(PROJECT_CONTEXT_BASEURI))); + $aParts = explode("/", $_SERVER["SERVER_PROTOCOL"]); + $sProtocol = strtolower(array_shift($aParts)); + define("PROJECT_BASEURI", $sBaseUrl); + define("PROJECT_URI", $sProtocol . "://" . self::rmEndSlash($_SERVER["HTTP_HOST"]) . $sBaseUrl); + unset($sScript); unset($sDirName); unset($sBaseUrl); unset($sProtocol); unset($aParts); + + ################################################################################################# + + require_once(FLAKE_PATH_ROOT . 'Core/ClassLoader.php'); + \Flake\Core\ClassLoader::register(); + + # Include Flake Framework config + require_once(FLAKE_PATH_ROOT . "config.php"); + + # Determine Router class + $GLOBALS["ROUTER"] = \Flake\Util\Tools::router(); + + if(!\Flake\Util\Tools::isCliPhp()) { + ini_set("html_errors", TRUE); + session_start(); + } + + setlocale(LC_ALL, FLAKE_LOCALE); + date_default_timezone_set(FLAKE_TIMEZONE); + + if(defined("PROJECT_SQLITE_FILE") && file_exists(PROJECT_SQLITE_FILE) && is_readable(PROJECT_SQLITE_FILE) && !isset($GLOBALS["DB"])) { + $GLOBALS["DB"] = new \Flake\Core\Database\Sqlite(PROJECT_SQLITE_FILE); + } + + $GLOBALS["TEMPLATESTACK"] = array(); + + $aUrlInfo = parse_url(PROJECT_URI); + define("FLAKE_DOMAIN", $_SERVER["HTTP_HOST"]); + define("FLAKE_URIPATH", \Flake\Util\Tools::stripBeginSlash($aUrlInfo["path"])); + unset($aUrlInfo); + } +} \ No newline at end of file diff --git a/CoreVersions/0.2.0/WWWRoot/cal.php b/CoreVersions/0.2.0/WWWRoot/cal.php index e6a61d8..2fe8cec 100755 --- a/CoreVersions/0.2.0/WWWRoot/cal.php +++ b/CoreVersions/0.2.0/WWWRoot/cal.php @@ -27,8 +27,9 @@ define("BAIKAL_CONTEXT", TRUE); define("PROJECT_CONTEXT_BASEURI", "/"); -# Bootstrapping Flake -require_once(dirname(dirname(__FILE__)) . "/Frameworks/Flake/Core/Bootstrap.php"); +# Bootstraping Flake +require_once(dirname(dirname(__FILE__)) . "/Frameworks/Flake/Framework.php"); +\Flake\Framework::bootstrap(); # Bootstrapping Baïkal \Baikal\Framework::bootstrap(); diff --git a/CoreVersions/0.2.0/WWWRoot/card.php b/CoreVersions/0.2.0/WWWRoot/card.php index 3898d68..c3631d7 100755 --- a/CoreVersions/0.2.0/WWWRoot/card.php +++ b/CoreVersions/0.2.0/WWWRoot/card.php @@ -27,8 +27,9 @@ define("BAIKAL_CONTEXT", TRUE); define("PROJECT_CONTEXT_BASEURI", "/"); -# Bootstrapping Flake -require_once(dirname(dirname(__FILE__)) . "/Frameworks/Flake/Core/Bootstrap.php"); +# Bootstraping Flake +require_once(dirname(dirname(__FILE__)) . "/Frameworks/Flake/Framework.php"); +\Flake\Framework::bootstrap(); # Bootstrapping Baïkal \Baikal\Framework::bootstrap(); diff --git a/CoreVersions/0.2.0/WWWRoot/index.php b/CoreVersions/0.2.0/WWWRoot/index.php index e1b4b43..62ba432 100755 --- a/CoreVersions/0.2.0/WWWRoot/index.php +++ b/CoreVersions/0.2.0/WWWRoot/index.php @@ -27,7 +27,8 @@ define("BAIKAL_CONTEXT", TRUE); define("PROJECT_CONTEXT_BASEURI", "/"); # Bootstraping Flake -require_once(dirname(dirname(__FILE__)) . "/Frameworks/Flake/Core/Bootstrap.php"); +require_once(dirname(dirname(__FILE__)) . "/Frameworks/Flake/Framework.php"); +\Flake\Framework::bootstrap(); # Bootstrapping Baïkal \Baikal\Framework::bootstrap(); diff --git a/Specific/db/baikal.sqlite b/Specific/db/baikal.sqlite index 92b4dbb62fc691068f0ab990f862743351e43c43..db968cac30072d76bac2868986668c6910123112 100755 GIT binary patch delta 945 zcmbV~F>ljA6vusbM2aQ1Dq?{k6cz@=CFk?q*^U9pi5(PZoscFOkRnhVTZ#&#sv{6x zsH=8?h006EPN+-}74ZcsJ_%od&MaI~2Qh$%Dn04my?cM@{qFs@H?}w4=fJ`KwF)>G zKm8yroC?xssUe<@IS>9TkmRL8LaZp1$C0Xys6 zj8t~-*Su1vVmBQ{?zqjhTHPyY$&2NyZ|r`5Gl-&mc{p6pvw~VIx}GBQS8KF697L97 zDRR{-O)q&(k(+L(gprCNq7dmVj7vNyeyqstno}YM3sl4ci2Pm;5*0IOYDk5YhKMkg zhQ4nqvghuq$x+2e`NSSi+08E%(osa1?UtJVg{FqVkG=En89~TRK zW?&P+J`OcVbb~^J>J)0Gj(JdBrAEqi@60*#C}v!WAP6Ey6L&#&KmKtEycPDeF34~z z?riZj?p;aVEpDw~j1e}{pEj#5v#CiSBaA@8PzBmtEp9ebti z-gWGjJGCRCs+v4nx^6u?IXpR>G_AGlX6r9)D1BUQq{69-G15@-ap@MEXNJPSk23Y6 S2cM327r%;N;n-UKcJmiD;P9US delta 92 zcmV-i0HgnaaDZ@-8v%}y976$)v0$bH2=V{}umey6^09&B0ts9L2LLZM8($5R`UX{# yPzSW51QY}Y0Rn^o0)(-FZUU413=0TJf_VW40EHKm4h?#<1rId>0S2=>5yd857#m># From e7808ad75d9599bb195697f607d4fd944c81aede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81ro=CC=82me=20Schneider?= Date: Tue, 8 May 2012 00:56:04 +0200 Subject: [PATCH 6/7] Working on web admin --- .../Frameworks/BaikalAdmin/Controller/Install/Initialize.php | 2 +- .../0.2.0/Frameworks/Flake/Core/DocumentedException.php | 2 +- CoreVersions/0.2.0/Frameworks/Flake/Util/Frameworks.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php index cfa900b..438b9d6 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php @@ -37,7 +37,7 @@ class Initialize extends \Flake\Core\Controller { # Assert that /Specific is writable if(!file_exists(PROJECT_PATH_SPECIFIC) || !is_dir(PROJECT_PATH_SPECIFIC) || !is_writable(PROJECT_PATH_SPECIFIC)) { - throw new \Flake\Core\DocumentedException("specificreadonly"); + throw new \Exception("Specific/ dir is readonly. Baïkal Admin requires write permissions on this dir."); } $this->createDefaultConfigFilesIfNeeded(); diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Core/DocumentedException.php b/CoreVersions/0.2.0/Frameworks/Flake/Core/DocumentedException.php index f31be68..ff86525 100755 --- a/CoreVersions/0.2.0/Frameworks/Flake/Core/DocumentedException.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Core/DocumentedException.php @@ -39,7 +39,7 @@ class DocumentedException extends \Exception { # custom string representation of object public function __toString() { $aDoc = $this->getDocumentation(); - debug($aDoc); + \Flake\Util\Tools::debug($aDoc); return "" . htmlspecialchars($this->message) . ""; } diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Util/Frameworks.php b/CoreVersions/0.2.0/Frameworks/Flake/Util/Frameworks.php index 170b93f..73c8b9e 100755 --- a/CoreVersions/0.2.0/Frameworks/Flake/Util/Frameworks.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Util/Frameworks.php @@ -47,7 +47,7 @@ class Frameworks extends \Flake\Core\FLObject { # TODO: Create a 'Framework' Model public function getPath($sName) { if(self::isAFramework($sName)) { - throw new \Flake\Core\DocumentedException("notaframework", $sName); + throw new \Flake\Core\Exception(htmlspecialchars($$sName) . " is not a framework.", $sName); } return \Flake\Util\Tools::appendSlash(PROJECT_PATH_FRAMEWORKS . $sName); From 38152e0e3f204548a1b7dd099b0606ec4d447808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81ro=CC=82me=20Schneider?= Date: Tue, 8 May 2012 23:36:30 +0200 Subject: [PATCH 7/7] Working on web admin --- .../Frameworks/Baikal/Model/Config/Standard.php | 13 +++++++++++++ .../BaikalAdmin/Controller/Install/Initialize.php | 3 +++ .../0.2.0/Frameworks/BaikalAdmin/Core/Auth.php | 4 ++++ .../0.2.0/Frameworks/BaikalAdmin/Framework.php | 2 +- .../0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php | 5 +++-- .../BaikalAdmin/WWWRoot/install/index.php | 9 ++++----- CoreVersions/0.2.0/Frameworks/Flake/Framework.php | 5 ++--- CoreVersions/0.2.0/Frameworks/Formal/Framework.php | 4 ++-- CoreVersions/0.2.0/WWWRoot/cal.php | 3 ++- CoreVersions/0.2.0/WWWRoot/card.php | 3 ++- CoreVersions/0.2.0/WWWRoot/index.php | 3 ++- 11 files changed, 38 insertions(+), 16 deletions(-) diff --git a/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/Standard.php b/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/Standard.php index f1058ff..d9165ab 100755 --- a/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/Standard.php +++ b/CoreVersions/0.2.0/Frameworks/Baikal/Model/Config/Standard.php @@ -35,6 +35,9 @@ class Standard extends \Baikal\Model\Config { "BAIKAL_ADMIN_ENABLED" => array( "type" => "boolean", ), + "BAIKAL_ADMIN_AUTOLOCKENABLED" => array( + "type" => "boolean", + ), "BAIKAL_CAL_ENABLED" => array( "type" => "boolean", ), @@ -54,6 +57,7 @@ class Standard extends \Baikal\Model\Config { "BAIKAL_CARD_ENABLED" => "", "BAIKAL_CAL_ENABLED" => "", "BAIKAL_ADMIN_ENABLED" => "", + "BAIKAL_ADMIN_AUTOLOCKENABLED" => "", "BAIKAL_ADMIN_PASSWORDHASH" => "" ); @@ -77,6 +81,15 @@ class Standard extends \Baikal\Model\Config { ), ))); + $oMorpho->add(new \Formal\Element\Checkbox(array( + "prop" => "BAIKAL_ADMIN_AUTOLOCKENABLED", + "label" => "Enable Web Admin autolock", + "popover" => array( + "title" => "Web admin autolock", + "content" => "If enabled, you'll have to create a file named ENABLE_ADMIN in Specific/ prior to every admin use." + ) + ))); + $oMorpho->add(new \Formal\Element\Checkbox(array( "prop" => "BAIKAL_CAL_ENABLED", "label" => "Enable CalDAV" diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php index 438b9d6..3131b4e 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Controller/Install/Initialize.php @@ -142,6 +142,9 @@ define("BAIKAL_CAL_ENABLED", TRUE); # Baïkal Web Admin ON/OFF switch; default TRUE define("BAIKAL_ADMIN_ENABLED", TRUE); +# Baïkal Web Admin autolock ON/OFF switch; default TRUE +define("BAIKAL_ADMIN_AUTOLOCKENABLED", TRUE); + # Baïkal Web admin password hash; Set by Core/Scripts/adminpassword.php or via Baïkal Web Admin define("BAIKAL_ADMIN_PASSWORDHASH", ""); CODE; diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php index 4a6f10b..d7af35b 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Core/Auth.php @@ -37,6 +37,10 @@ class Auth { public static function assertUnlocked() { + if(defined("BAIKAL_ADMIN_AUTOLOCKENABLED") && BAIKAL_ADMIN_AUTOLOCKENABLED === FALSE) { + return TRUE; + } + if(defined("BAIKAL_CONTEXT_INSTALL") && BAIKAL_CONTEXT_INSTALL === TRUE) { $sToolName = "Baïkal Install Tool"; } else { diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Framework.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Framework.php index 2379bb1..419ddb5 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Framework.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/Framework.php @@ -29,7 +29,7 @@ namespace BaikalAdmin; class Framework extends \Flake\Core\Framework { public static function bootstrap() { - define("BAIKALADMIN_PATH_ROOT", dirname(__FILE__) . "/"); # ./ + define("BAIKALADMIN_PATH_ROOT", PROJECT_PATH_ROOT . "Core/Frameworks/BaikalAdmin/"); # ./ \Baikal\Framework::bootstrap(); \Formal\Framework::bootstrap(); diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php index a552947..236e268 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/index.php @@ -26,13 +26,14 @@ ini_set("display_errors", 1); error_reporting(E_ALL); -define("PROJECT_CONTEXT_BASEURI", "/admin/"); define("BAIKAL_CONTEXT", TRUE); define("BAIKAL_CONTEXT_ADMIN", TRUE); +define("PROJECT_CONTEXT_BASEURI", "/admin/"); +define("PROJECT_PATH_ROOT", dirname(dirname(getcwd())) . "/"); #../../ # Bootstraping Flake -require_once(dirname(dirname(dirname(__FILE__))) . "/Flake/Framework.php"); # ../../ +require_once(PROJECT_PATH_ROOT . "Core/Frameworks/Flake/Framework.php"); # ../../ \Flake\Framework::bootstrap(); # Bootstrap BaikalAdmin diff --git a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php index 97d169d..743921d 100755 --- a/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php +++ b/CoreVersions/0.2.0/Frameworks/BaikalAdmin/WWWRoot/install/index.php @@ -26,13 +26,15 @@ ini_set("display_errors", 1); error_reporting(E_ALL); -define("PROJECT_CONTEXT_BASEURI", "/admin/install/"); define("BAIKAL_CONTEXT", TRUE); define("BAIKAL_CONTEXT_INSTALL", TRUE); +define("PROJECT_CONTEXT_BASEURI", "/admin/install/"); +define("PROJECT_PATH_ROOT", dirname(dirname(dirname(getcwd()))) . "/"); # ../../../ + # Bootstraping Flake -require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Flake/Framework.php"); # ../../../ +require_once(PROJECT_PATH_ROOT . "Core/Frameworks/Flake/Framework.php"); \Flake\Framework::bootstrap(); # Bootstrap BaikalAdmin @@ -61,8 +63,5 @@ if(!defined("BAIKAL_CONFIGURED_VERSION")) { $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Install\VersionUpgrade()); } -# Route the request -//$GLOBALS["ROUTER"]::route($oPage); - # Render the page echo $oPage->render(); \ No newline at end of file diff --git a/CoreVersions/0.2.0/Frameworks/Flake/Framework.php b/CoreVersions/0.2.0/Frameworks/Flake/Framework.php index 2dc1585..87a2d34 100755 --- a/CoreVersions/0.2.0/Frameworks/Flake/Framework.php +++ b/CoreVersions/0.2.0/Frameworks/Flake/Framework.php @@ -25,7 +25,7 @@ ***************************************************************/ namespace Flake; -require_once(dirname(__FILE__) . "/Core/Framework.php"); # Manual require as Classloader not included yet +require_once(PROJECT_PATH_ROOT . "Core/Frameworks/Flake/Core/Framework.php"); # Manual require as Classloader not included yet if(!function_exists("debug")) { @@ -75,7 +75,7 @@ class Framework extends \Flake\Core\Framework { } # Define absolute server path to Flake Framework - define("FLAKE_PATH_ROOT", dirname(__FILE__) . "/"); # ./ + define("FLAKE_PATH_ROOT", PROJECT_PATH_ROOT . "Core/Frameworks/Flake/"); # ./ if(!defined('LF')) { define('LF', chr(10)); @@ -100,7 +100,6 @@ class Framework extends \Flake\Core\Framework { # determine Flake install root path # not using realpath here to avoid symlinks resolution - define("PROJECT_PATH_ROOT", dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/"); # ../../../../../ define("PROJECT_PATH_CORE", PROJECT_PATH_ROOT . "Core/"); define("PROJECT_PATH_SPECIFIC", PROJECT_PATH_ROOT . "Specific/"); define("PROJECT_PATH_FRAMEWORKS", PROJECT_PATH_CORE . "Frameworks/"); diff --git a/CoreVersions/0.2.0/Frameworks/Formal/Framework.php b/CoreVersions/0.2.0/Frameworks/Formal/Framework.php index ce34fd4..ad62d44 100755 --- a/CoreVersions/0.2.0/Frameworks/Formal/Framework.php +++ b/CoreVersions/0.2.0/Frameworks/Formal/Framework.php @@ -29,9 +29,9 @@ namespace Formal; class Framework extends \Flake\Core\Framework { public static function bootstrap() { - define("FORMAL_PATH_ROOT", dirname(__FILE__) . "/"); + define("FORMAL_PATH_ROOT", PROJECT_PATH_ROOT . "Core/Frameworks/Formal/"); - require_once(dirname(__FILE__) . '/Core/ClassLoader.php'); + require_once(FORMAL_PATH_ROOT . 'Core/ClassLoader.php'); \Formal\Core\ClassLoader::register(); } } \ No newline at end of file diff --git a/CoreVersions/0.2.0/WWWRoot/cal.php b/CoreVersions/0.2.0/WWWRoot/cal.php index 2fe8cec..ccc7018 100755 --- a/CoreVersions/0.2.0/WWWRoot/cal.php +++ b/CoreVersions/0.2.0/WWWRoot/cal.php @@ -26,9 +26,10 @@ define("BAIKAL_CONTEXT", TRUE); define("PROJECT_CONTEXT_BASEURI", "/"); +define("PROJECT_PATH_ROOT", dirname(getcwd()) . "/"); #../ # Bootstraping Flake -require_once(dirname(dirname(__FILE__)) . "/Frameworks/Flake/Framework.php"); +require_once(PROJECT_PATH_ROOT . "Core/Frameworks/Flake/Framework.php"); \Flake\Framework::bootstrap(); # Bootstrapping Baïkal diff --git a/CoreVersions/0.2.0/WWWRoot/card.php b/CoreVersions/0.2.0/WWWRoot/card.php index c3631d7..9865ee7 100755 --- a/CoreVersions/0.2.0/WWWRoot/card.php +++ b/CoreVersions/0.2.0/WWWRoot/card.php @@ -26,9 +26,10 @@ define("BAIKAL_CONTEXT", TRUE); define("PROJECT_CONTEXT_BASEURI", "/"); +define("PROJECT_PATH_ROOT", dirname(getcwd()) . "/"); #../ # Bootstraping Flake -require_once(dirname(dirname(__FILE__)) . "/Frameworks/Flake/Framework.php"); +require_once(PROJECT_PATH_ROOT . "Core/Frameworks/Flake/Framework.php"); \Flake\Framework::bootstrap(); # Bootstrapping Baïkal diff --git a/CoreVersions/0.2.0/WWWRoot/index.php b/CoreVersions/0.2.0/WWWRoot/index.php index 62ba432..607fb2a 100755 --- a/CoreVersions/0.2.0/WWWRoot/index.php +++ b/CoreVersions/0.2.0/WWWRoot/index.php @@ -25,9 +25,10 @@ ***************************************************************/ define("BAIKAL_CONTEXT", TRUE); define("PROJECT_CONTEXT_BASEURI", "/"); +define("PROJECT_PATH_ROOT", dirname(getcwd()) . "/"); #../ # Bootstraping Flake -require_once(dirname(dirname(__FILE__)) . "/Frameworks/Flake/Framework.php"); +require_once(PROJECT_PATH_ROOT . "Core/Frameworks/Flake/Framework.php"); \Flake\Framework::bootstrap(); # Bootstrapping Baïkal