コード例 #1
0
ファイル: Logout.php プロジェクト: Zyko0/Baikal
 public function execute()
 {
     \BaikalAdmin\Core\Auth::unAuthenticate();
     $sControllerForDefaultRoute = $GLOBALS["ROUTER"]::getControllerForRoute("default");
     $sLink = $GLOBALS["ROUTER"]::buildRouteForController($sControllerForDefaultRoute, "loggedout");
     \Flake\Util\Tools::redirect($sLink);
 }
コード例 #2
0
ファイル: Standard.php プロジェクト: paulproteus/Baikal
 public function set($sProp, $sValue)
 {
     if ($sProp === "BAIKAL_ADMIN_PASSWORDHASH" || $sProp === "BAIKAL_ADMIN_PASSWORDHASH_CONFIRM") {
         # Special handling for password and passwordconfirm
         if ($sProp === "BAIKAL_ADMIN_PASSWORDHASH" && $sValue !== "") {
             parent::set("BAIKAL_ADMIN_PASSWORDHASH", \BaikalAdmin\Core\Auth::hashAdminPassword($sValue));
         }
         return $this;
     }
     parent::set($sProp, $sValue);
 }
コード例 #3
0
ファイル: Database.php プロジェクト: Zyko0/Baikal
 public function render()
 {
     $sBigIcon = "glyph2x-magic";
     $sBaikalVersion = BAIKAL_VERSION;
     $oView = new \BaikalAdmin\View\Install\Database();
     $oView->setData("baikalversion", BAIKAL_VERSION);
     if ($this->oForm->persisted()) {
         \BaikalAdmin\Core\Auth::lockInstall();
         $sMessage = "<p>Baïkal is now installed, and it's database properly configured. <strong>For security reasons, this installation wizard is now disabled.</strong></p>";
         $sMessage . "<p>&nbsp;</p>";
         $sMessage .= "<p><a class='btn btn-success' href='" . PROJECT_URI . "admin/'>Start using Baïkal</a></p>";
         $sForm = "";
     } else {
         $sMessage = "";
         $sForm = $this->oForm->render();
     }
     $oView->setData("message", $sMessage);
     $oView->setData("form", $sForm);
     return $oView->render();
 }
コード例 #4
0
ファイル: Login.php プロジェクト: DamienCassou/baikal_ynh
 public function render()
 {
     $sActionUrl = \Flake\Util\Tools::getCurrentUrl();
     $sSubmittedFlagName = "auth";
     $sMessage = "";
     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 = "******";
     }
     $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();
 }
コード例 #5
0
ファイル: index.php プロジェクト: DamienCassou/baikal_ynh
} else {
    # Dedicated server mode
    define("PROJECT_PATH_ROOT", dirname(dirname(getcwd())) . "/");
    #../../
}
if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) {
    die('<h1>Incomplete installation</h1><p>Ba&iuml;kal dependencies have not been installed. Please, execute "<strong>composer install</strong>" in the folder where you installed Ba&iuml;kal.');
}
require PROJECT_PATH_ROOT . 'vendor/autoload.php';
# Bootstraping Flake
\Flake\Framework::bootstrap();
# Bootstrap BaikalAdmin
\BaikalAdmin\Framework::bootstrap();
# Assert that BaikalAdmin is enabled
\BaikalAdmin\Core\Auth::assertEnabled();
# Create and setup a page object
$oPage = new \Flake\Controller\Page(BAIKALADMIN_PATH_TEMPLATES . "Page/index.html");
$oPage->injectHTTPHeaders();
$oPage->setTitle("Baïkal " . BAIKAL_VERSION . " Web Admin");
$oPage->setBaseUrl(PROJECT_URI);
# Authentication
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 {
    $oPage->zone("navbar")->addBlock(new \BaikalAdmin\Controller\Navigation\Topbar());
    # Route the request
    $GLOBALS["ROUTER"]::route($oPage);
}
# Render the page
echo $oPage->render();
コード例 #6
0
ファイル: index.php プロジェクト: paolomainardi/Baikal
    #../../
} else {
    # Dedicated server mode
    define("PROJECT_PATH_ROOT", dirname(dirname(dirname(getcwd()))) . "/");
    # ../../../
}
if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) {
    die('<h1>Incomplete installation</h1><p>Ba&iuml;kal dependencies have not been installed. Please, execute "<strong>composer install</strong>" in the folder where you installed Ba&iuml;kal.');
}
require PROJECT_PATH_ROOT . "vendor/autoload.php";
# Bootstraping Flake
\Flake\Framework::bootstrap();
# Bootstrap BaikalAdmin
\BaikalAdmin\Framework::bootstrap();
# Evaluate assertions
\BaikalAdmin\Core\Auth::assertUnlocked();
# Create and setup a page object
$oPage = new \Flake\Controller\Page(BAIKALADMIN_PATH_TEMPLATES . "Page/index.html");
$oPage->injectHTTPHeaders();
$oPage->setTitle("Baïkal Maintainance");
$oPage->setBaseUrl(PROJECT_URI);
$oPage->zone("navbar")->addBlock(new \BaikalAdmin\Controller\Navigation\Topbar\Install());
if (!defined("BAIKAL_CONFIGURED_VERSION")) {
    # we have to upgrade Baïkal (existing installation)
    $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Install\Initialize());
} elseif (!defined("BAIKAL_ADMIN_PASSWORDHASH")) {
    # we have to set an admin password
    $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Install\Initialize());
} else {
    if (BAIKAL_CONFIGURED_VERSION !== BAIKAL_VERSION) {
        # we have to upgrade Baïkal
コード例 #7
0
ファイル: index.php プロジェクト: jeromeschneider/baikal
}
if (!file_exists(PROJECT_PATH_ROOT . 'vendor/')) {
    die('<h1>Incomplete installation</h1><p>Ba&iuml;kal dependencies have not been installed. Please, execute "<strong>composer install</strong>" in the folder where you installed Ba&iuml;kal.');
}
require PROJECT_PATH_ROOT . 'vendor/autoload.php';
# Bootstraping Flake
\Flake\Framework::bootstrap();
# Bootstrap BaikalAdmin
\BaikalAdmin\Framework::bootstrap();
# Create and setup a page object
$oPage = new \Flake\Controller\Page(BAIKALADMIN_PATH_TEMPLATES . "Page/index.html");
$oPage->injectHTTPHeaders();
$oPage->setTitle("Baïkal " . BAIKAL_VERSION . " Web Admin");
$oPage->setBaseUrl(PROJECT_URI);
if (!\BaikalAdmin\Core\Auth::isAuthenticated()) {
    if (\BaikalAdmin\Core\Auth::authenticate()) {
        // Redirect to itself
        header('Location: ' . $_SERVER['REQUEST_URI']);
        exit;
    } else {
        // Draw login page
        $oPage->zone("navbar")->addBlock(new \BaikalAdmin\Controller\Navigation\Topbar\Anonymous());
        $oPage->zone("Payload")->addBlock(new \BaikalAdmin\Controller\Login());
    }
} else {
    // CSRF token check
    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
        if (!isset($_POST['CSRF_TOKEN'])) {
            throw new \Exception('CSRF token was not submitted. Try removing your cookies and log in again');
        }
        if ($_POST['CSRF_TOKEN'] !== $_SESSION['CSRF_TOKEN']) {