diff --git a/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Bootstrap.php b/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Bootstrap.php index cf4b449..c5fcbe8 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Bootstrap.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Bootstrap.php @@ -142,14 +142,12 @@ if( $bShouldCheckEnv = ((!defined("BAIKAL_CONTEXT_CLI") || BAIKAL_CONTEXT_CLI === FALSE) && (!defined("BAIKAL_CONTEXT_ADMIN") || BAIKAL_CONTEXT_ADMIN === FALSE)); if($bShouldCheckEnv === TRUE) { - # Mapping PHP errors to exceptions + # 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"); - } else { - error_reporting(E_ALL ^ E_NOTICE); } unset($bShouldCheckEnv); diff --git a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php index 47b4534..17744df 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php +++ b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php @@ -34,7 +34,7 @@ class Topbar extends \Flake\Core\Controller { public function render() { $sCurrentRoute = $GLOBALS["ROUTER"]::getCurrentRoute(); - $sActiveHome = $sActiveUsers = $sActiveSettings = $sActiveSystemSettings = ""; + $sActiveHome = $sActiveUsers = $sActiveSettingsStandard = $sActiveSettingsSystem = ""; $sControllerForDefaultRoute = $GLOBALS["ROUTER"]::getControllerForRoute("default"); $sHomeLink = $sControllerForDefaultRoute::link(); diff --git a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/User/AddressBooks.php b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/User/AddressBooks.php index 3d46bb2..f3dc1d0 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/User/AddressBooks.php +++ b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/User/AddressBooks.php @@ -164,12 +164,12 @@ class AddressBooks extends \Flake\Core\Controller { protected static function newRequested() { $aParams = $GLOBALS["ROUTER"]::getURLParams(); - return $aParams[1] === "new"; + return (count($aParams) >= 2) && $aParams[1] === "new"; } protected static function editRequested() { $aParams = $GLOBALS["ROUTER"]::getURLParams(); - if(($aParams[1] === "edit") && intval($aParams[2]) > 0) { + if((count($aParams) >= 3) && ($aParams[1] === "edit") && intval($aParams[2]) > 0) { return intval($aParams[2]); } @@ -178,7 +178,7 @@ class AddressBooks extends \Flake\Core\Controller { protected static function deleteRequested() { $aParams = $GLOBALS["ROUTER"]::getURLParams(); - if(($aParams[1] === "delete") && intval($aParams[2]) > 0) { + if((count($aParams) >= 3) && ($aParams[1] === "delete") && intval($aParams[2]) > 0) { return intval($aParams[2]); } @@ -191,7 +191,7 @@ class AddressBooks extends \Flake\Core\Controller { } $aParams = $GLOBALS["ROUTER"]::getURLParams(); - if($aParams[3] === "confirm") { + if((count($aParams) >= 4) && $aParams[3] === "confirm") { return $iPrimary; } diff --git a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/User/Calendars.php b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/User/Calendars.php index 890a307..ca06df1 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/User/Calendars.php +++ b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/User/Calendars.php @@ -169,12 +169,12 @@ class Calendars extends \Flake\Core\Controller { protected static function newRequested() { $aParams = $GLOBALS["ROUTER"]::getURLParams(); - return $aParams[1] === "new"; + return (count($aParams) >= 2) && $aParams[1] === "new"; } protected static function editRequested() { $aParams = $GLOBALS["ROUTER"]::getURLParams(); - if(($aParams[1] === "edit") && intval($aParams[2]) > 0) { + if((count($aParams) >= 3) && ($aParams[1] === "edit") && intval($aParams[2]) > 0) { return intval($aParams[2]); } @@ -183,7 +183,7 @@ class Calendars extends \Flake\Core\Controller { protected static function deleteRequested() { $aParams = $GLOBALS["ROUTER"]::getURLParams(); - if(($aParams[1] === "delete") && intval($aParams[2]) > 0) { + if((count($aParams) >= 3) && ($aParams[1] === "delete") && intval($aParams[2]) > 0) { return intval($aParams[2]); } @@ -196,7 +196,7 @@ class Calendars extends \Flake\Core\Controller { } $aParams = $GLOBALS["ROUTER"]::getURLParams(); - if($aParams[3] === "confirm") { + if((count($aParams) >= 4) && $aParams[3] === "confirm") { return $iPrimary; } diff --git a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/Users.php b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/Users.php index 28cf632..74e5c5b 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/Users.php +++ b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Controller/Users.php @@ -134,7 +134,7 @@ class Users extends \Flake\Core\Controller { protected static function editRequested() { $aParams = $GLOBALS["ROUTER"]::getURLParams(); - if(($aParams[0] === "edit") && intval($aParams[1]) > 0) { + if((count($aParams) >= 2) && ($aParams[0] === "edit") && intval($aParams[1]) > 0) { return intval($aParams[1]); } @@ -143,7 +143,7 @@ class Users extends \Flake\Core\Controller { protected static function deleteRequested() { $aParams = $GLOBALS["ROUTER"]::getURLParams(); - if(($aParams[0] === "delete") && intval($aParams[1]) > 0) { + if((count($aParams) >= 2) && ($aParams[0] === "delete") && intval($aParams[1]) > 0) { return intval($aParams[1]); } @@ -156,7 +156,7 @@ class Users extends \Flake\Core\Controller { } $aParams = $GLOBALS["ROUTER"]::getURLParams(); - if($aParams[2] === "confirm") { + if((count($aParams) >= 3) && $aParams[2] === "confirm") { return $iUser; } @@ -165,7 +165,7 @@ class Users extends \Flake\Core\Controller { protected static function newRequested() { $aParams = $GLOBALS["ROUTER"]::getURLParams(); - return $aParams[0] === "new"; + return (count($aParams) >= 1) && $aParams[0] === "new"; } public static function linkNew() { diff --git a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Core/Auth.php b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Core/Auth.php index 31b8e4d..7f52b15 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Core/Auth.php +++ b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Core/Auth.php @@ -37,7 +37,7 @@ class Auth { static function assertUnlocked() { - if(defined("BAIKAL_CONTEXT_INSTALL") || BAIKAL_CONTEXT_INSTALL !== TRUE) { + if(defined("BAIKAL_CONTEXT_INSTALL") && BAIKAL_CONTEXT_INSTALL === TRUE) { $sToolName = "Baïkal Install Tool"; } else { $sToolName = "Baïkal Admin"; diff --git a/CoreVersions/Baikal_0.1/Frameworks/Flake/Controller/Kickstart.php b/CoreVersions/Baikal_0.1/Frameworks/Flake/Controller/Kickstart.php deleted file mode 100755 index f05578d..0000000 --- a/CoreVersions/Baikal_0.1/Frameworks/Flake/Controller/Kickstart.php +++ /dev/null @@ -1,59 +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! -***************************************************************/ - -namespace Flake\Controller; - -class Kickstart extends \Flake\Core\Controller { - - public function execute() { - if(array_key_exists("helloworld", self::cli()->aArgs)) { - $this->action_helloworld(); - } - } - - public static function &cli() { - return $GLOBALS["oCli"]; - } - - public function __call($sName, $aArguments) { - if(substr($sName, 0, 4) === "cli_") { - $sCallName = substr($sName, 4); - - if(method_exists(self::cli(), $sCallName)) { - return call_user_func_array(array(self::cli(), $sCallName), $aArguments); - } - } - - die("Undefined method " . $sName); - } - - public function render() { - } - - public function action_helloworld() { - $this->cli_echoFlush($this->cli_header("Hello, World !")); - } -} \ No newline at end of file diff --git a/CoreVersions/Baikal_0.1/Frameworks/Flake/Controller/Page.php b/CoreVersions/Baikal_0.1/Frameworks/Flake/Controller/Page.php index 966c753..190269f 100755 --- a/CoreVersions/Baikal_0.1/Frameworks/Flake/Controller/Page.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Flake/Controller/Page.php @@ -28,71 +28,54 @@ namespace Flake\Controller; class Page extends \Flake\Core\Render\Container { - var $sTitle = ""; - var $sMetaKeywords = ""; - var $sMetaDescription = ""; - var $sTemplatePath = ""; + protected $sTitle = ""; + protected $sMetaKeywords = ""; + protected $sMetaDescription = ""; + protected $sTemplatePath = ""; - function __construct($sTemplatePath) { + public function __construct($sTemplatePath) { $this->sTemplatePath = $sTemplatePath; } - function setTitle($sTitle) { + public function setTitle($sTitle) { $this->sTitle = $sTitle; } - function setMetaKeywords($sKeywords) { + public function setMetaKeywords($sKeywords) { $this->sMetaKeywords = $sKeywords; } - function setMetaDescription($sDescription) { + public function setMetaDescription($sDescription) { $this->sMetaDescription = $sDescription; } - function getTitle() { + public function getTitle() { return $this->sTitle; } - function getMetaKeywords() { + public function getMetaKeywords() { $sString = str_replace(array("le", "la", "les", "de", "des", "un", "une"), " ", $this->sMetaKeywords); $sString = \Flake\Util\Tools::stringToUrlToken($sString); return implode(", ", explode("-", $sString)); } - function getMetaDescription() { + public function getMetaDescription() { return $this->sMetaDescription; } - function setBaseUrl($sBaseUrl) { + public function setBaseUrl($sBaseUrl) { $this->sBaseUrl = $sBaseUrl; } - function getBaseUrl() { + public function getBaseUrl() { return $this->sBaseUrl; } - - function renderBlocks() { - $aHtml = array(); - reset($this->aSequence); - while(list($sKey,) = each($this->aSequence)) { - $this->aSequence[$sKey]["rendu"] = $this->aSequence[$sKey]["block"]->render(); - } - - $aHtml = array(); - reset($this->aBlocks); - while(list($sZone,) = each($this->aBlocks)) { - $aHtml[$sZone] = implode("", $this->aBlocks[$sZone]); - } - - reset($aHtml); - return $aHtml; + + public function injectHTTPHeaders() { + header("Content-Type: text/html; charset=UTF-8"); } - function injectHTTPHeaders() { - header("Content-Type: text/html; charset=utf-8"); - } - - function render() { + public function render() { $this->execute(); $aRenderedBlocks = $this->renderBlocks(); @@ -109,35 +92,56 @@ class Page extends \Flake\Core\Render\Container { return $sHtml; } - function execute() { + public function execute() { reset($this->aSequence); while(list($sKey,) = each($this->aSequence)) { $this->aSequence[$sKey]["block"]->execute(); } } - function addCss($sCssAbsPath) { + public function addCss($sCssAbsPath) { - $sCompiledPath = PATH_buildcss; - $sFileName = basename($sCssAbsPath); - - $sCompiledFilePath = $sCompiledPath . \Flake\Util\Tools::shortMD5($sFileName) . "_" . $sFileName; - - if(substr(strtolower($sCompiledFilePath), -4) !== ".css") { - $sCompiledFilePath .= ".css"; - } - - if(!file_exists($sCompiledPath)) { - @mkdir($sCompiledPath); - if(!file_exists($sCompiledPath)) { - die("Page: Cannot create " . $sCompiledPath); + if(\Flake\Util\Frameworks::enabled("LessPHP")) { + $sCompiledPath = PATH_buildcss; + $sFileName = basename($sCssAbsPath); + + $sCompiledFilePath = $sCompiledPath . \Flake\Util\Tools::shortMD5($sFileName) . "_" . $sFileName; + + if(substr(strtolower($sCompiledFilePath), -4) !== ".css") { + $sCompiledFilePath .= ".css"; } + + if(!file_exists($sCompiledPath)) { + @mkdir($sCompiledPath); + if(!file_exists($sCompiledPath)) { + die("Page: Cannot create " . $sCompiledPath); + } + } + + \Frameworks\LessPHP\Delegate::compileCss($sCssAbsPath, $sCompiledFilePath); + $sCssUrl = \Flake\Util\Tools::serverToRelativeWebPath($sCompiledFilePath); + } else { + $sCssUrl = \Flake\Util\Tools::serverToRelativeWebPath($sCssAbsPath); } - \Frameworks\LessPHP\Delegate::compileCss($sCssAbsPath, $sCompiledFilePath); - $sCssUrl = \Flake\Util\Tools::serverToRelativeWebPath($sCompiledFilePath); - $sHtml = ""; $this->zone("head")->addBlock(new \Flake\Controller\HtmlBlock($sHtml)); } + + protected function renderBlocks() { + $aHtml = array(); + reset($this->aSequence); + while(list($sKey,) = each($this->aSequence)) { + $this->aSequence[$sKey]["rendu"] = $this->aSequence[$sKey]["block"]->render(); + } + + $aHtml = array(); + reset($this->aBlocks); + while(list($sZone,) = each($this->aBlocks)) { + $aHtml[$sZone] = implode("", $this->aBlocks[$sZone]); + } + + reset($aHtml); + return $aHtml; + } } \ No newline at end of file diff --git a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Requester/Sql.php b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Requester/Sql.php index 99fbc22..769f95c 100755 --- a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Requester/Sql.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Requester/Sql.php @@ -162,7 +162,8 @@ class Sql extends \Flake\Core\FLObject { protected function &reify($aData) { $sTemp = $this->sModelClass; - return new $sTemp($aData[$sTemp::getPrimaryKey()]); + $res = new $sTemp($aData[$sTemp::getPrimaryKey()]); + return $res; # To address 'Notice: Only variable references should be returned by reference' } public function hasBeenExecuted() { @@ -170,9 +171,11 @@ class Sql extends \Flake\Core\FLObject { } public function getQuery() { - if(empty($this->aClauses)) { - $sWhere = "1=1"; - } else { + $sWhere = "1=1"; + $sOrderBy = ""; + $sLimit = ""; + + if(!empty($this->aClauses)) { $sWhere = implode(" AND ", $this->aClauses); } @@ -180,8 +183,6 @@ class Sql extends \Flake\Core\FLObject { $sOrderBy = $this->sOrderField . " " . $this->sOrderDirection; } - $sLimit = ""; - if($this->iLimitStart !== FALSE) { if($this->iLimitNumber !== FALSE) { $sLimit = $this->iLimitStart . ", " . $this->iLimitNumber; diff --git a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Requester/Universal.php b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Requester/Universal.php deleted file mode 100644 index f1c238a..0000000 --- a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Requester/Universal.php +++ /dev/null @@ -1,117 +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! -***************************************************************/ - -namespace Flake\Core\Requester; - -class Universal extends \Flake\Core\Requester { - - protected $aClauses = array( - "equals" => array(), - "notequals" => array(), - "like" => array(), - "likebeginning" => array(), - "likeend" => array(), - "notlike" => array(), - "notlikebeginning" => array(), - "notlikeend" => array(), - "in" => array(), - "notin" => array(), - ); - - protected $sModelClass = ""; - protected $sOrderField = ""; - protected $sOrderDirection = "ASC"; - protected $iLimitStart = FALSE; - protected $iLimitNumber = FALSE; - protected $bHasBeenExecuted = FALSE; - - public function __call($sName, $aArguments) { - if(substr(strtolower($sName), 0, 9) === "addclause") { - array_unshift($aArguments, substr(strtolower($sName), 9)); - return call_user_func_array(array($this, "addClause"), $aArguments); - } elseif(substr(strtolower($sName), 0, 10) === "getclauses") { - return call_user_func_array(array($this, "getClauses"), array(substr(strtolower($sName), 10))); - } - - throw new \Exception("__get(): method " . htmlspecialchars($sName) . " not found"); - } - - public function addClause($sClauseType, $sPropName, $sPropValue) { - if(is_numeric($sClauseType) || !array_key_exists($sClauseType, $this->aClauses)) { - throw new \Exception("Undefined clause type: " . htmlspecialchars($sClauseType)); - } - - if(!array_key_exists($sPropName, $this->aClauses[$sClauseType])) { - $this->aClauses[$sClauseType][$sPropName] = array(); - } - - $this->aClauses[$sClauseType][$sPropName][] = $sPropValue; - - return $this; - } - - public function getClauses($sClauseType) { - if(is_numeric($sClauseType) || !array_key_exists($sClauseType, $this->aClauses)) { - throw new \Exception("Undefined clause type: " . htmlspecialchars($sClauseType)); - } - - reset($this->aClauses[$sClauseType]); - return $this->aClauses[$sClauseType]; - } - - public function orderBy($sOrderField, $sOrderDirection = "ASC") { - $this->sOrderField = $sOrderField; - $this->sOrderDirection = $sOrderDirection; - return $this; - } - - public function setLimitStart($iLimitStart) { - $this->iLimitStart = $iLimitStart; - return $this; - } - - public function setLimitNumber($iLimitNumber) { - $this->iLimitNumber = $iLimitNumber; - return $this; - } - - protected function &reify($aData) { - die(__FILE__ . ":" . __LINE__ . ": À implémenter"); - - $sTemp = $this->sModelClass; - return new $sTemp($aData[$sTemp::getPrimaryKey()]); - } - - public function hasBeenExecuted() { - return $this->bHasBeenExecuted; - } - - public function execute() { - $oCollection = new \Flake\Core\CollectionTyped($this->sModelClass); - $this->bHasBeenExecuted = TRUE; - return $oCollection; - } -} \ No newline at end of file diff --git a/CoreVersions/Baikal_0.1/Frameworks/Flake/Util/Router/QuestionMarkRewrite.php b/CoreVersions/Baikal_0.1/Frameworks/Flake/Util/Router/QuestionMarkRewrite.php index 2e07247..38abfd4 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/Flake/Util/Router/QuestionMarkRewrite.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Flake/Util/Router/QuestionMarkRewrite.php @@ -37,10 +37,15 @@ class QuestionMarkRewrite extends \Flake\Util\Router { if(trim($sUrl) === "") { return "default"; } else { + + $aMatches = array(); $aURI = parse_url($sUrl); - $sRoutePart = \Flake\Util\Tools::stripBeginSlash($aURI["query"]); - $aMatches = array(); + if(array_key_exists("query", $aURI)) { + $sRoutePart = \Flake\Util\Tools::stripBeginSlash($aURI["query"]); + } else { + $sRoutePart = ""; + } $aRoutes = self::getRoutes(); reset($aRoutes); diff --git a/Specific/db/baikal.sqlite b/Specific/db/baikal.sqlite index 2f7aa39..6670fea 100755 Binary files a/Specific/db/baikal.sqlite and b/Specific/db/baikal.sqlite differ