Working on structure

Former-commit-id: 57c57fca40
This commit is contained in:
Jérôme Schneider 2012-03-24 20:29:36 +01:00
parent 3228f1929a
commit 9a76e88902
12 changed files with 58 additions and 60 deletions

View file

@ -36,7 +36,7 @@ class Tools {
$aUsers = array();
# Fetching user
$stmt = BaikalTools::db()->prepare("SELECT * FROM users");
$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;

View file

@ -1,4 +1,16 @@
<?php
define("BAIKALADMIN_PATH_ROOT", dirname(dirname(__FILE__)) . "/");
# Bootstrap Baikal 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");
# Registering BaikalAdmin classloader
require_once(dirname(__FILE__) . '/ClassLoader.php');
\BaikalAdmin\Core\ClassLoader::register();
\BaikalAdmin\Core\ClassLoader::register();
# Include BaikalAdmin Framework config
require_once(BAIKALADMIN_PATH_ROOT . "config.php");

View file

@ -1,19 +1,7 @@
<?php
define("BAIKALADMIN_PATH_ROOT", BAIKAL_PATH_FRAMEWORKS . "BaikalAdmin/");
define("BAIKALADMIN_PATH_TEMPLATES", BAIKALADMIN_PATH_ROOT . "Resources/Templates/");
define("FLAKE_DB_FILEPATH", BAIKAL_SQLITE_FILE);
define("FLAKE_TIMEZONE", BAIKAL_TIMEZONE);
define("FLAKE_PATH_FRAMEWORKS", BAIKAL_PATH_FRAMEWORKS);
define("FLAKE_PATH_ROOT", BAIKAL_PATH_FRAMEWORKS . "Flake/");
define("FLAKE_PATH_WWWROOT", BAIKAL_PATH_WWWROOT);
define("FLAKE_SAFEHASH_SALT", "une-clef-super-secrete");
define("FLAKE_LOCALE", "fr_FR.UTF-8");
# TODO: CHANGE THIS
define("FLAKE_BASEURL", "http://baikal.jeromeschneider.fr/");
$GLOBALS["ROUTES"] = array(
"default" => "\BaikalAdmin\Route\User\Listing",
);

View file

@ -31,18 +31,9 @@ define("BAIKAL_CONTEXT", TRUE);
define("BAIKAL_CONTEXT_ADMIN", TRUE);
define("PATH_ENTRYDIR", dirname(__FILE__) . "/");
# Bootstrap Baikal Core
require_once(dirname(PATH_ENTRYDIR) . "/Baikal/Core/Bootstrap.php"); # ../, symlink-safe
# Include BaikalAdmin config files
require_once(PATH_ENTRYDIR . "config.php");
# Bootstrap BaikalAdmin
require_once(PATH_ENTRYDIR . "Core/Bootstrap.php");
# Bootstrap Flake
require_once(FLAKE_PATH_ROOT . "Core/Bootstrap.php");
# Evaluate assertions
\BaikalAdmin\Core\Auth::assertEnabled();
\BaikalAdmin\Core\Auth::assertAuthentified();
@ -57,10 +48,4 @@ $oPage->setBaseUrl(FLAKE_BASEURL);
\Flake\Util\Router::route($oPage);
# Render the page
echo $oPage->render();
/*require_once(BAIKAL_PATH_FRAMEWORKS . "Baikal/Includes.php");
BaikalAdmin::assertEnabled();
BaikalAdmin::assertAuthentified();
BaikalAdmin::handleRequest();*/
echo $oPage->render();

View file

@ -1,5 +1,7 @@
<?php
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);
@ -23,6 +25,9 @@ if(!function_exists("debug")) {
require_once(FLAKE_PATH_ROOT . 'Core/ClassLoader.php');
\Flake\Core\ClassLoader::register();
# Include Flake Framework config
require_once(FLAKE_PATH_ROOT . "config.php");
if(!\Flake\Util\Tools::isCliPhp()) {
session_start();
\Flake\Util\Tools::decode_GET();

View file

@ -0,0 +1,11 @@
<?php
define("FLAKE_DB_FILEPATH", BAIKAL_SQLITE_FILE);
define("FLAKE_TIMEZONE", BAIKAL_TIMEZONE);
define("FLAKE_PATH_FRAMEWORKS", BAIKAL_PATH_FRAMEWORKS);
define("FLAKE_PATH_WWWROOT", BAIKAL_PATH_WWWROOT);
define("FLAKE_SAFEHASH_SALT", "une-clef-super-secrete");
define("FLAKE_LOCALE", "fr_FR.UTF-8");
# TODO: CHANGE THIS
define("FLAKE_BASEURL", "http://baikal.jeromeschneider.fr/");

View file

@ -28,9 +28,8 @@
define("BAIKAL_CONTEXT", TRUE);
define("BAIKAL_CONTEXT_CLI", TRUE);
define("PATH_ENTRYDIR", dirname(__FILE__) . "/");
require_once(PATH_ENTRYDIR . "../Bootstrap.php");
require_once(BAIKAL_PATH_WWWROOT . "classes/BaikalTools.php");
# Bootstraping Baikal
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Core/Frameworks/Baikal/Core/Bootstrap.php"); # ../../../
$sUsername = @trim($argv[1]);
@ -45,7 +44,7 @@ if(($user = $stmt->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_FIRST)) === FALSE) {
die("User not found; aborting.\n");
}
$sCalendarID = BaikalTools::bashPrompt("Calendar Key (a unique, lower-case, alphanum token, like perso or sailing): ");
$sCalendarID = \Baikal\Core\Tools::bashPrompt("Calendar Key (a unique, lower-case, alphanum token, like 'perso' or 'sailing'): ");
if($sCalendarID === "") {
die("Calendar Key cannot be empty.\n");
}
@ -66,7 +65,7 @@ if(($cal = $stmt->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_FIRST)) !== FALSE) {
die("This Calendar Key is already in use for this user; aborting.\n");
}
$sCalendarName = BaikalTools::bashPrompt("Calendar Display Name: ");
$sCalendarName = \Baikal\Core\Tools::bashPrompt("Calendar Display Name: ");
if($sCalendarName === "") {
die("Calendar Display Name cannot be empty.\n");
}

View file

@ -28,9 +28,8 @@
define("BAIKAL_CONTEXT", TRUE);
define("BAIKAL_CONTEXT_CLI", TRUE);
define("PATH_ENTRYDIR", dirname(__FILE__) . "/");
require_once(PATH_ENTRYDIR . "../Bootstrap.php");
require_once(BAIKAL_PATH_WWWROOT . "classes/BaikalTools.php");
# Bootstraping Baikal
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Core/Frameworks/Baikal/Core/Bootstrap.php"); # ../../../
$sUsername = @trim($argv[1]);
@ -38,8 +37,8 @@ if($sUsername === "") {
die("You have to provide a username; aborting.\n");
}
$sPassword = BaikalTools::bashPromptSilent("Password: ");
$sPasswordConfirm = BaikalTools::bashPromptSilent("Confirm password: ");
$sPassword = \Baikal\Core\Tools::bashPromptSilent("Password: ");
$sPasswordConfirm = \Baikal\Core\Tools::bashPromptSilent("Confirm password: ");
if($sPassword === "") {
die("Password cannot be empty.\n");
@ -51,8 +50,8 @@ if($sPassword !== $sPasswordConfirm) {
$sHash = md5($sUsername . ':' . BAIKAL_AUTH_REALM . ':' . $sPassword);
$sEmail = BaikalTools::bashPrompt("Email: ");
$sDisplayName = BaikalTools::bashPrompt("Display name: ");
$sEmail = \Baikal\Core\Tools::bashPrompt("Email: ");
$sDisplayName = \Baikal\Core\Tools::bashPrompt("Display name: ");
try {
$stmt = $pdo->prepare("INSERT INTO users (username, digesta1) VALUES (?, ?)");

View file

@ -28,10 +28,11 @@
define("BAIKAL_CONTEXT", TRUE);
define("BAIKAL_CONTEXT_CLI", TRUE);
define("PATH_ENTRYDIR", dirname(__FILE__) . "/");
require_once(PATH_ENTRYDIR . "../Bootstrap.php");
require_once(BAIKAL_PATH_WWWROOT . "classes/BaikalTools.php");
require_once(BAIKAL_PATH_WWWROOT . "classes/BaikalAdmin.php");
# Bootstraping Baikal
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Core/Frameworks/Baikal/Core/Bootstrap.php"); # ../../../
# Bootstraping BaikalAdmin
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Core/Frameworks/BaikalAdmin/Core/Bootstrap.php"); # ../../../
$sConfigFile = BAIKAL_PATH_SPECIFIC . "config.php";
@ -52,8 +53,8 @@ if(!defined("BAIKAL_ADMIN_PASSWORDHASH")) {
$bFound = TRUE;
}
$sPassword = BaikalTools::bashPromptSilent("New admin password: ");
$sPasswordConfirm = BaikalTools::bashPromptSilent("Confirm new admin password: ");
$sPassword = \Baikal\Core\Tools::bashPromptSilent("New admin password: ");
$sPasswordConfirm = \Baikal\Core\Tools::bashPromptSilent("Confirm new admin password: ");
if($sPassword === "") {
die("Password cannot be empty.\n");
@ -63,7 +64,7 @@ if($sPassword !== $sPasswordConfirm) {
die("Passwords don't match; aborting.\n");
}
$sHash = BaikalAdmin::hashAdminPassword($sPassword);
$sHash = \BaikalAdmin\Core\Auth::hashAdminPassword($sPassword);
echo ("\nNew password hash:" . $sHash . "\n");
$sFileContents = file_get_contents($sConfigFile);

View file

@ -28,9 +28,8 @@
define("BAIKAL_CONTEXT", TRUE);
define("BAIKAL_CONTEXT_CLI", TRUE);
define("PATH_ENTRYDIR", dirname(__FILE__) . "/");
require_once(PATH_ENTRYDIR . "../Bootstrap.php");
require_once(BAIKAL_PATH_WWWROOT . "classes/BaikalTools.php");
# Bootstraping Baikal
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Core/Frameworks/Baikal/Core/Bootstrap.php"); # ../../../
$sUsername = @trim($argv[1]);
@ -45,7 +44,7 @@ if(($user = $stmt->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_FIRST)) === FALSE) {
die("User not found; aborting.\n");
}
$sCalendarID = BaikalTools::bashPrompt("Calendar Key: ");
$sCalendarID = \Baikal\Core\Tools::bashPrompt("Calendar Key: ");
if($sCalendarID === "") {
die("Calendar Key cannot be empty.\n");
}

View file

@ -28,9 +28,8 @@
define("BAIKAL_CONTEXT", TRUE);
define("BAIKAL_CONTEXT_CLI", TRUE);
define("PATH_ENTRYDIR", dirname(__FILE__) . "/");
require_once(PATH_ENTRYDIR . "../Bootstrap.php");
require_once(BAIKAL_PATH_WWWROOT . "classes/BaikalTools.php");
# Bootstraping Baikal
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/Core/Frameworks/Baikal/Core/Bootstrap.php"); # ../../../
$sUsername = isset($argv[1]) ? trim($argv[1]) : "";
@ -59,13 +58,13 @@ echo "--User found--\nid:\t\t" . $user["id"] . "\nemail:\t\t" . $principal["emai
echo "\n--Please enter new values--\n";
$sPassword = BaikalTools::bashPromptSilent("Password (empty to leave untouched): ");
$sPassword = \Baikal\Core\Tools::bashPromptSilent("Password (empty to leave untouched): ");
$sHash = "";
$sEmail = "";
$sDisplayName = "";
if($sPassword !== "") {
$sPasswordConfirm = BaikalTools::bashPromptSilent("Confirm password: ");
$sPasswordConfirm = \Baikal\Core\Tools::bashPromptSilent("Confirm password: ");
if($sPassword !== $sPasswordConfirm) {
die("Passwords don't match; aborting.\n");
}
@ -73,8 +72,8 @@ if($sPassword !== "") {
$sHash = md5($sUsername . ':' . BAIKAL_AUTH_REALM . ':' . $sPassword);
}
$sEmail = BaikalTools::bashPrompt("Email (empty to leave untouched): ");
$sDisplayName = BaikalTools::bashPrompt("Display name (empty to leave untouched): ");
$sEmail = \Baikal\Core\Tools::bashPrompt("Email (empty to leave untouched): ");
$sDisplayName = \Baikal\Core\Tools::bashPrompt("Display name (empty to leave untouched): ");
if($sHash === "" && $sEmail === "" && $sDisplayName === "") {

Binary file not shown.