diff --git a/brain/data/Auth.inc.php b/brain/data/Auth.inc.php
index 0f3e1fc..b367d0e 100644
--- a/brain/data/Auth.inc.php
+++ b/brain/data/Auth.inc.php
@@ -2,11 +2,20 @@
class Auth
{
- private $configs;
-
- public function getSettings()
- {
- //return $this->secret;
- }
-
-}
\ No newline at end of file
+ private $configs;
+
+ public function __construct()
+ {
+ session_start();
+ }
+
+ public function sessionStatus()
+ {
+ if (isset($_SESSION["member"])) {
+ return true;
+ } else {
+ return false;
+ }
+ //return $this->secret;
+ }
+}
diff --git a/brain/data/Settings.inc.php b/brain/data/Settings.inc.php
index 485d0d5..c3a4b67 100644
--- a/brain/data/Settings.inc.php
+++ b/brain/data/Settings.inc.php
@@ -2,14 +2,18 @@
class Settings
{
- private $folks;
- private $tags;
- private $settings;
-
- public function getFolks()
- {
- return $this->folks = json_decode(file_get_contents('config/folks.json'), true);
- //return $this->secret;
- }
-
-}
\ No newline at end of file
+ private $folks;
+ private $tags;
+ private $settings;
+
+ public function __construct()
+ {
+ //gets all settings files and converts to php objects
+ $this->folks = json_decode(file_get_contents("config/folks.json"), true);
+ $this->tags = json_decode(file_get_contents("config/tags.json"), true);
+ $this->settings = json_decode(
+ file_get_contents("config/settings.json"),
+ true
+ );
+ }
+}
diff --git a/brain/views/dash/forms/login.twig b/brain/views/dash/forms/login.twig
new file mode 100644
index 0000000..f8d6e86
--- /dev/null
+++ b/brain/views/dash/forms/login.twig
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/brain/views/dash/frame.twig b/brain/views/dash/frame.twig
new file mode 100644
index 0000000..4dd68dd
--- /dev/null
+++ b/brain/views/dash/frame.twig
@@ -0,0 +1,64 @@
+
+
+
+
+
+ {% block title %}
+ {{ title }}
+ {% endblock %}
+
+ {% block stylesheets %}{% endblock %}
+
+
+
+
+
+
+ {% block mainContent %}{% endblock %}
+
+
+
+
+
+
+ {% block javascripts %}{% endblock %}
+
+
\ No newline at end of file
diff --git a/brain/views/dash/start.twig b/brain/views/dash/start.twig
new file mode 100644
index 0000000..43f0579
--- /dev/null
+++ b/brain/views/dash/start.twig
@@ -0,0 +1,25 @@
+{% extends "dash/frame.twig" %}
+
+{% block title %}
+ {{ title }}
+{% endblock %}
+
+{% block stylesheets %}
+
+ {% endblock %}
+
+ {% block mainContent %}
+
+
+ {% if status %}
+ DASH INDEX
+ {% else %}
+ {{ include("dash/forms/login.twig") }}
+ {% endif %}
+
+
+ {% endblock %}
+
+ {% block javascripts %}
+
+ {% endblock %}
\ No newline at end of file
diff --git a/brain/views/default/dash-index.twig b/brain/views/default/dash-index.twig
deleted file mode 100644
index 7fe2d86..0000000
--- a/brain/views/default/dash-index.twig
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
- {{ title }}
-
-
-
- There are
- {{ totalPages }}
- pages total, hoss.
-
- {% for page in pages %}
- {# {{ page.title }}
- #}
- {{ page["title"] }}
- {{ page['filePath'] }}
-
- {% endfor %}
-
-
-
-
\ No newline at end of file
diff --git a/brain/views/default/index.twig b/brain/views/default/index.twig
deleted file mode 100644
index 3c68293..0000000
--- a/brain/views/default/index.twig
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
- {{ title }}
-
-
-
-
-
\ No newline at end of file
diff --git a/brain/views/front/start.twig b/brain/views/front/start.twig
new file mode 100644
index 0000000..e69de29
diff --git a/index.php b/index.php
index a525bce..aad022f 100644
--- a/index.php
+++ b/index.php
@@ -1,4 +1,6 @@
add(TwigMiddleware::create($app, $twig));
//Index
@@ -26,24 +28,29 @@ $app->get("/[{first}[/{second}]]", function (
$response->getBody()->write("FIND A PAGE, B!");
} else {
//$response->getBody()->write("This is the dash, brah!");
- if (isset($args["second"])) {
- $section = $args["second"];
+
+ if ($first == "dashboard") {
+ if (isset($args["second"])) {
+ $section = $args["second"];
+ } else {
+ $section = "index";
+ }
+
+ $dash = new DashControl();
+ $pages = $dash->getPages($section);
+
+ $count = count($pages);
+
+ //$response->getBody()->write("There are " . $count . " pages, champ");
+ $auth = new Auth();
+ return $view->render($response, "dash/start.twig", [
+ "title" => "Fipamo Dash",
+ "status" => $auth->sessionStatus(),
+ "pages" => $pages,
+ "totalPages" => $count,
+ ]);
} else {
- $section = "front";
}
-
- $dash = new DashControl();
- $pages = $dash->getPages($section);
-
- $count = count($pages);
-
- //$response->getBody()->write("There are ".$count." pages, champ");
-
- return $view->render($response, "dash-index.twig", [
- "title" => "Fipamo Dash",
- "pages" => $pages,
- "totalPages" => $count,
- ]);
}
} else {
$response->getBody()->write("No Params, Homie!");
@@ -59,19 +66,19 @@ $app->get("/[{first}[/{second}]]", function (
//Dashboard Index
/**
$app->get('/@/dashboard', function (Request $request, Response $response) {
- $index = new IndexControl();
- $settings = new Settings();
- $folks = $settings->getFolks();
- $secret = $index->getSecret();
- $view = Twig::fromRequest($request);
-
- return $view->render($response, 'index.twig', [
- 'title' => 'This is Fipamo',
- 'name' => 'Ro',
- 'occupation'=>'pretty cool... I guess',
- 'folks' => $folks[0]['handle'],
- 'secret' => $secret
- ]);
+ $index = new IndexControl();
+ $settings = new Settings();
+ $folks = $settings->getFolks();
+ $secret = $index->getSecret();
+ $view = Twig::fromRequest($request);
+
+ return $view->render($response, 'index.twig', [
+ 'title' => 'This is Fipamo',
+ 'name' => 'Ro',
+ 'occupation'=>'pretty cool... I guess',
+ 'folks' => $folks[0]['handle'],
+ 'secret' => $secret
+ ]);
});
**/
$app->run();