From 4cfe31574032d8a84a60e8cb7d94e88ec73c347b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Schneider?= Date: Wed, 25 Apr 2012 22:53:25 +0200 Subject: [PATCH] Working on Web admin --- .../Frameworks/Baikal/Core/Bootstrap.php | 32 +++---- .../Frameworks/Baikal/Core/Tools.php | 32 +++---- .../Frameworks/BaikalAdmin/Core/Bootstrap.php | 3 - .../Frameworks/Flake/Core/Bootstrap.php | 11 ++- .../Frameworks/Flake/Core/Database.php | 12 ++- .../Frameworks/Flake/Core/Database/Mysql.php | 78 ------------------ .../Frameworks/Flake/Core/Database/Sqlite.php | 68 +++++++-------- .../Frameworks/Flake/Core/Model/Db.php | 10 +-- .../Frameworks/Flake/Core/Requester/Sql.php | 4 +- .../Frameworks/Flake/Util/Tools.php | 2 +- .../Baikal_0.1/Scripts/addcalendar.php | 2 + CoreVersions/Baikal_0.1/Scripts/adduser.php | 1 + .../Baikal_0.1/Scripts/modcalendar.php | 1 + CoreVersions/Baikal_0.1/Scripts/moduser.php | 1 + CoreVersions/Baikal_0.1/WWWRoot/cal.php | 6 +- CoreVersions/Baikal_0.1/WWWRoot/card.php | 6 +- Specific/db/baikal.sqlite | Bin 14336 -> 14336 bytes 17 files changed, 93 insertions(+), 176 deletions(-) delete mode 100755 CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Database/Mysql.php diff --git a/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Bootstrap.php b/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Bootstrap.php index 9059325..72336df 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Bootstrap.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Bootstrap.php @@ -67,37 +67,26 @@ function installTool() { } } -if(!defined("BAIKAL_CONTEXT") || BAIKAL_CONTEXT !== TRUE) { - die("Bootstrap.php may not be included outside the Baikal context"); -} - +# 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 . '.'); } -if(!defined('PDO::ATTR_DRIVER_NAME')) { - die('Baikal Fatal Error: PDO is unavailable. It\'s required by Baikal.'); -} - -if(!in_array('sqlite', PDO::getAvailableDrivers())) { - die('Baikal Fatal Error: PDO::sqlite is unavailable. It\'s required by Baikal.'); -} - # 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/"); - require_once(BAIKAL_PATH_CORE . "Distrib.php"); # Determine BAIKAL_URI @@ -110,6 +99,7 @@ define("BAIKAL_BASEURI", $sBaseUrl); define("BAIKAL_URI", $sProtocol . "://" . rmEndSlash($_SERVER["HTTP_HOST"]) . $sBaseUrl); unset($sScript); unset($sDirName); unset($sBaseUrl); unset($sProtocol); unset($aParts); + # Check that a config file exists if( !file_exists(BAIKAL_PATH_SPECIFIC . "config.php") || @@ -138,18 +128,20 @@ if( installTool(); } - \Baikal\Core\Tools::assertEnvironmentIsOk(); + \Baikal\Core\Tools::assertBaikalIsOk(); + + # Bootstrap Flake + require_once(BAIKAL_PATH_FRAMEWORKS . "Flake/Core/Bootstrap.php"); - # Database - $pdo = new PDO('sqlite:' . BAIKAL_SQLITE_FILE); - $pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); + # Establishing connection with database + $GLOBALS["DB"] = new \Flake\Core\Database\Sqlite(BAIKAL_SQLITE_FILE); $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 function exception_error_handler($errno, $errstr, $errfile, $errline) { - throw new ErrorException($errstr, 0, $errno, $errfile, $errline); + throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); } set_error_handler("exception_error_handler"); @@ -159,7 +151,7 @@ if( unset($bShouldCheckEnv); - // Autoloader + # SabreDAV Autoloader require_once(BAIKAL_PATH_SABREDAV . 'autoload.php'); } } diff --git a/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Tools.php b/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Tools.php index ce879cd..a498b43 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Tools.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Baikal/Core/Tools.php @@ -32,7 +32,24 @@ class Tools { } public static function assertEnvironmentIsOk() { + # Asserting Baikal Context + if(!defined("BAIKAL_CONTEXT") || BAIKAL_CONTEXT !== TRUE) { + die("Bootstrap.php may not be included outside the Baikal context"); + } + + # Asserting PDO + if(!defined('PDO::ATTR_DRIVER_NAME')) { + die('Baikal Fatal Error: PDO is unavailable. It\'s required by Baikal.'); + } + # Asserting PDO::SQLite + if(!in_array('sqlite', \PDO::getAvailableDrivers())) { + die('Baikal Fatal Error: PDO::sqlite is unavailable. It\'s required by Baikal.'); + } + } + + public static function assertBaikalIsOk() { + # Asserting DB file exists if(!file_exists(BAIKAL_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'."); @@ -79,21 +96,6 @@ class Tools { } } - public static function getUsers() { - - $aUsers = array(); - - # Fetching user - $stmt = \Baikal\Core\Tools::db()->prepare("SELECT * FROM users"); - $stmt->execute(); - while(($user = $stmt->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_FIRST)) !== FALSE) { - $aUsers[] = $user; - } - - reset($aUsers); - return $aUsers; - } - public static function bashPrompt($prompt) { print $prompt; @flush(); diff --git a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Core/Bootstrap.php b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Core/Bootstrap.php index 4a8b025..a544041 100644 --- a/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Core/Bootstrap.php +++ b/CoreVersions/Baikal_0.1/Frameworks/BaikalAdmin/Core/Bootstrap.php @@ -29,9 +29,6 @@ define("BAIKALADMIN_PATH_ROOT", dirname(dirname(__FILE__)) . "/"); # Bootstrap Baïkal Core require_once(dirname(dirname(dirname(__FILE__))) . "/Baikal/Core/Bootstrap.php"); # ../../, symlink-safe -# Bootstrap Flake -require_once(dirname(dirname(dirname(__FILE__))) . "/Flake/Core/Bootstrap.php"); - # Bootstrap Formal require_once(dirname(dirname(dirname(__FILE__))) . "/Formal/Core/Bootstrap.php"); diff --git a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Bootstrap.php b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Bootstrap.php index 63ce1db..9f12d54 100755 --- a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Bootstrap.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Bootstrap.php @@ -40,9 +40,9 @@ if(array_key_exists("SERVER_NAME", $_SERVER) && $_SERVER["SERVER_NAME"] === "mon define("FLAKE_PATH_ROOT", dirname(dirname(__FILE__)) . "/"); # ../ -// les notices PHP ne sont pas affichées -ini_set("display_errors", 1); -ini_set("error_reporting", E_ALL & ~E_NOTICE); +# 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) { @@ -77,9 +77,8 @@ 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)) { - $GLOBALS["DB"] = new \Flake\Core\Database\Sqlite(); - $GLOBALS["DB"]->init(FLAKE_DB_FILEPATH); +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); } $GLOBALS["TEMPLATESTACK"] = array(); diff --git a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Database.php b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Database.php index 65a4767..c1ba62d 100755 --- a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Database.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Database.php @@ -154,8 +154,8 @@ abstract class Database extends \Flake\Core\FLObject { return $query; } - function fullQuoteStr($str, $table) { - return '\''.$this->quoteStr($str, $table).'\''; + function fullQuote($str, $table) { + return '\''.$this->quote($str, $table).'\''; } function fullQuoteArray($arr, $table, $noQuote=FALSE) { @@ -167,7 +167,7 @@ abstract class Database extends \Flake\Core\FLObject { foreach($arr as $k => $v) { if ($noQuote===FALSE || !in_array($k,$noQuote)) { - $arr[$k] = $this->fullQuoteStr($v, $table); + $arr[$k] = $this->fullQuote($v, $table); } } return $arr; @@ -176,10 +176,8 @@ abstract class Database extends \Flake\Core\FLObject { /* fonctions abstraites */ abstract function query($sSql); - - abstract function fetch($rSql); - abstract function sql_insert_id(); + abstract function lastInsertId(); - abstract function quoteStr($str, $table); + abstract function quote($str); } \ No newline at end of file diff --git a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Database/Mysql.php b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Database/Mysql.php deleted file mode 100755 index d3db223..0000000 --- a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Database/Mysql.php +++ /dev/null @@ -1,78 +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; - -class Mysql extends \Flake\Core\Database { - - var $link = FALSE; // current DB link - var $debugOutput = FALSE; - var $store_lastBuiltQuery = TRUE; - var $debug_lastBuiltQuery = ""; - - /* fonctions abstraites */ - - function init($sHost = DB_host, $sLogin = DB_login, $sPassword = DB_password, $sDatabase = DB_database) { - if(is_resource($this->link)) { - $this->messageAndDie("DB already initialized"); - } - - $this->link = mysql_connect( - $sHost, - $sLogin, - $sPassword - ) OR $this->messageAndDie("invalid DB credentials."); - - mysql_select_db($sDatabase, $this->link) OR $this->messageAndDie("could not select DB"); - - // on initialise la connection UTF-8 aux données - mysql_query("set character_set_database='utf8'", $this->link); - mysql_query("set character_set_client='utf8'", $this->link); - mysql_query("set character_set_connection='utf8'", $this->link); - mysql_query("set character_set_results='utf8'", $this->link); - mysql_query("set character_set_server='utf8'", $this->link); - } - - function query($sSql) { - return mysql_query($sSql, $this->link); - } - - function fetch($rSql) { - if(is_resource($rSql)) { - return mysql_fetch_assoc($rSql); - } - - return FALSE; - } - - function sql_insert_id() { - return mysql_insert_id($this->link); - } - - function quoteStr($str, $table) { - return mysql_real_escape_string($str, $this->link); - } -} \ No newline at end of file diff --git a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Database/Sqlite.php b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Database/Sqlite.php index 1d344af..4e2782b 100755 --- a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Database/Sqlite.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Database/Sqlite.php @@ -28,47 +28,49 @@ namespace Flake\Core\Database; class Sqlite extends \Flake\Core\Database { - var $oDb = FALSE; // current DB link - var $debugOutput = FALSE; - var $store_lastBuiltQuery = TRUE; - var $debug_lastBuiltQuery = ""; - var $sDbPath = ""; + protected $oDb = FALSE; // current DB link + protected $debugOutput = FALSE; + protected $store_lastBuiltQuery = TRUE; + protected $debug_lastBuiltQuery = ""; + protected $sDbPath = ""; - function init($sDbPath) { - if(is_object($this->oDb)) { - $this->messageAndDie("DB already initialized"); - } - + public function __construct($sDbPath) { $this->sDbPath = $sDbPath; - $this->oDb = new \SQLite3($this->sDbPath); + $this->oDb = new \PDO('sqlite:' . $this->sDbPath); +# $this->oDb->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); } - function query($sSql) { - return $this->oDb->query($sSql); + public function query($sSql) { + $stmt = $this->oDb->query($sSql); + return new \Flake\Core\Database\SqliteStatement($stmt); + } + + public function lastInsertId() { + return $this->oDb->lastInsertId(); } - function fetch($rSql) { - if(is_object($rSql)) { - return $rSql->fetchArray(SQLITE3_ASSOC); + public function quote($str) { + return substr($this->oDb->quote($str), 1, -1); # stripping first and last quote + } + + public function getPDO() { + return $this->oDb; + } +} + +Class SqliteStatement { + + protected $stmt = null; + + public function __construct($stmt) { + $this->stmt = $stmt; + } + + public function fetch() { + if($this->stmt !== FALSE) { + return $this->stmt->fetch(\PDO::FETCH_ASSOC, \PDO::FETCH_ORI_FIRST); } return FALSE; } - - function sql_insert_id() { - $rSql = $this->query("SELECT last_insert_rowid() as uid"); - if(($aRes = $this->fetch($rSql)) !== FALSE) { - return intval($aRes["uid"]); - } - - return FALSE; - } - - function quoteStr($str, $table=FALSE) { - if(function_exists("sqlite_escape_string")) { - return sqlite_escape_string($str); - } - - return addslashes($str); - } } \ No newline at end of file diff --git a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Model/Db.php b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Model/Db.php index 11ca86a..f76d92e 100755 --- a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Model/Db.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Model/Db.php @@ -72,10 +72,10 @@ abstract class Db extends \Flake\Core\Model { $rSql = $GLOBALS["DB"]->exec_SELECTquery( "*", self::getDataTable(), - self::getPrimaryKey() . "='" . $GLOBALS["DB"]->quoteStr($sPrimary) . "'" + self::getPrimaryKey() . "='" . $GLOBALS["DB"]->quote($sPrimary) . "'" ); - if(($aRs = $GLOBALS["DB"]->fetch($rSql)) === FALSE) { + if(($aRs = $rSql->fetch()) === FALSE) { throw new \Exception("\Flake\Core\Model '" . htmlspecialchars($sPrimary) . "' not found for model " . get_class($this)); } @@ -90,13 +90,13 @@ abstract class Db extends \Flake\Core\Model { $this->getData() ); - $sPrimary = $GLOBALS["DB"]->sql_insert_id(); + $sPrimary = $GLOBALS["DB"]->lastInsertId(); $this->initByPrimary($sPrimary); $this->bFloating = FALSE; } else { $GLOBALS["DB"]->exec_UPDATEquery( self::getDataTable(), - self::getPrimaryKey() . "='" . $GLOBALS["DB"]->quoteStr($this->getPrimary()) . "'", + self::getPrimaryKey() . "='" . $GLOBALS["DB"]->quote($this->getPrimary()) . "'", $this->getData() ); } @@ -105,7 +105,7 @@ abstract class Db extends \Flake\Core\Model { public function destroy() { $GLOBALS["DB"]->exec_DELETEquery( self::getDataTable(), - self::getPrimaryKey() . "='" . $GLOBALS["DB"]->quoteStr($this->getPrimary()) . "'" + self::getPrimaryKey() . "='" . $GLOBALS["DB"]->quote($this->getPrimary()) . "'" ); } 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 ff774cb..99fbc22 100755 --- a/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Requester/Sql.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Flake/Core/Requester/Sql.php @@ -154,7 +154,7 @@ class Sql extends \Flake\Core\FLObject { } protected function escapeSqlValue($sValue) { - return $GLOBALS["DB"]->quoteStr( + return $GLOBALS["DB"]->quote( $sValue, $this->sDataTable ); @@ -207,7 +207,7 @@ class Sql extends \Flake\Core\FLObject { $sSql = $this->getQuery(); $rSql = $GLOBALS["DB"]->query($sSql); - while(($aRs = $GLOBALS["DB"]->fetch($rSql)) !== FALSE) { + while(($aRs = $rSql->fetch()) !== FALSE) { $oCollection->push( $this->reify($aRs) ); diff --git a/CoreVersions/Baikal_0.1/Frameworks/Flake/Util/Tools.php b/CoreVersions/Baikal_0.1/Frameworks/Flake/Util/Tools.php index 8c428eb..16169d5 100755 --- a/CoreVersions/Baikal_0.1/Frameworks/Flake/Util/Tools.php +++ b/CoreVersions/Baikal_0.1/Frameworks/Flake/Util/Tools.php @@ -109,7 +109,7 @@ class Tools extends \Flake\Core\FLObject { array_pop($trail); // la ligne d'appel à debug array_pop($trail); // la ligne d'appel à debug $aLastNode = array_pop($trail); // l'appel qui nous intéresse - $brOrHeader = $aLastNode['class'].$aLastNode['type'].$aLastNode['function']; + $brOrHeader = @strval($aLastNode['class']).@strval($aLastNode['type']).@strval($aLastNode['function']); } if ($brOrHeader) { diff --git a/CoreVersions/Baikal_0.1/Scripts/addcalendar.php b/CoreVersions/Baikal_0.1/Scripts/addcalendar.php index d1d2b67..e6de7bb 100755 --- a/CoreVersions/Baikal_0.1/Scripts/addcalendar.php +++ b/CoreVersions/Baikal_0.1/Scripts/addcalendar.php @@ -31,6 +31,8 @@ define("BAIKAL_CONTEXT_CLI", TRUE); # Bootstraping Baikal require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Core/Frameworks/Baikal/Core/Bootstrap.php"); # ../../../ +$pdo = $GLOBALS["DB"]->getPDO(); + $sUsername = @trim($argv[1]); if($sUsername === "") { diff --git a/CoreVersions/Baikal_0.1/Scripts/adduser.php b/CoreVersions/Baikal_0.1/Scripts/adduser.php index 0f8e48a..ab01c76 100755 --- a/CoreVersions/Baikal_0.1/Scripts/adduser.php +++ b/CoreVersions/Baikal_0.1/Scripts/adduser.php @@ -30,6 +30,7 @@ define("BAIKAL_CONTEXT_CLI", TRUE); # Bootstraping Baikal require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Core/Frameworks/Baikal/Core/Bootstrap.php"); # ../../../ +$pdo = $GLOBALS["DB"]->getPDO(); $sUsername = @trim($argv[1]); diff --git a/CoreVersions/Baikal_0.1/Scripts/modcalendar.php b/CoreVersions/Baikal_0.1/Scripts/modcalendar.php index 12ef207..828eac9 100755 --- a/CoreVersions/Baikal_0.1/Scripts/modcalendar.php +++ b/CoreVersions/Baikal_0.1/Scripts/modcalendar.php @@ -30,6 +30,7 @@ define("BAIKAL_CONTEXT_CLI", TRUE); # Bootstraping Baikal require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Core/Frameworks/Baikal/Core/Bootstrap.php"); # ../../../ +$pdo = $GLOBALS["DB"]->getPDO(); $sUsername = @trim($argv[1]); diff --git a/CoreVersions/Baikal_0.1/Scripts/moduser.php b/CoreVersions/Baikal_0.1/Scripts/moduser.php index 4fa9e1c..0e0680c 100755 --- a/CoreVersions/Baikal_0.1/Scripts/moduser.php +++ b/CoreVersions/Baikal_0.1/Scripts/moduser.php @@ -30,6 +30,7 @@ define("BAIKAL_CONTEXT_CLI", TRUE); # Bootstraping Baikal require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Core/Frameworks/Baikal/Core/Bootstrap.php"); # ../../../ +$pdo = $GLOBALS["DB"]->getPDO(); $sUsername = isset($argv[1]) ? trim($argv[1]) : ""; diff --git a/CoreVersions/Baikal_0.1/WWWRoot/cal.php b/CoreVersions/Baikal_0.1/WWWRoot/cal.php index 36c3be7..4b03ef0 100755 --- a/CoreVersions/Baikal_0.1/WWWRoot/cal.php +++ b/CoreVersions/Baikal_0.1/WWWRoot/cal.php @@ -35,9 +35,9 @@ if(!defined("BAIKAL_CAL_ENABLED") || BAIKAL_CAL_ENABLED !== TRUE) { } # Backends -$authBackend = new Sabre_DAV_Auth_Backend_PDO($pdo); -$principalBackend = new Sabre_DAVACL_PrincipalBackend_PDO($pdo); -$calendarBackend = new Sabre_CalDAV_Backend_PDO($pdo); +$authBackend = new Sabre_DAV_Auth_Backend_PDO($GLOBALS["DB"]->getPDO()); +$principalBackend = new Sabre_DAVACL_PrincipalBackend_PDO($GLOBALS["DB"]->getPDO()); +$calendarBackend = new Sabre_CalDAV_Backend_PDO($GLOBALS["DB"]->getPDO()); # Directory structure $nodes = array( diff --git a/CoreVersions/Baikal_0.1/WWWRoot/card.php b/CoreVersions/Baikal_0.1/WWWRoot/card.php index 4599a7d..701cbe7 100755 --- a/CoreVersions/Baikal_0.1/WWWRoot/card.php +++ b/CoreVersions/Baikal_0.1/WWWRoot/card.php @@ -35,9 +35,9 @@ if(!defined("BAIKAL_CARD_ENABLED") || BAIKAL_CARD_ENABLED !== TRUE) { } # Backends -$authBackend = new Sabre_DAV_Auth_Backend_PDO($pdo); -$principalBackend = new Sabre_DAVACL_PrincipalBackend_PDO($pdo); -$carddavBackend = new Sabre_CardDAV_Backend_PDO($pdo); +$authBackend = new Sabre_DAV_Auth_Backend_PDO($GLOBALS["DB"]->getPDO()); +$principalBackend = new Sabre_DAVACL_PrincipalBackend_PDO($GLOBALS["DB"]->getPDO()); +$carddavBackend = new Sabre_CardDAV_Backend_PDO($GLOBALS["DB"]->getPDO()); # Setting up the directory tree $nodes = array( diff --git a/Specific/db/baikal.sqlite b/Specific/db/baikal.sqlite index 4d4494e8137f336e8ff528dc3a94f99b078be778..2f7aa39a3b5fd87aeb4c953b2095898584a50885 100755 GIT binary patch delta 33 gcmZoDXegK