forked from projects/fipamo
set up views structure, started Auth class for session management
This commit is contained in:
parent
31d5e1192c
commit
cf752fd8c0
9 changed files with 170 additions and 87 deletions
|
@ -4,9 +4,18 @@ class Auth
|
||||||
{
|
{
|
||||||
private $configs;
|
private $configs;
|
||||||
|
|
||||||
public function getSettings()
|
public function __construct()
|
||||||
{
|
{
|
||||||
//return $this->secret;
|
session_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sessionStatus()
|
||||||
|
{
|
||||||
|
if (isset($_SESSION["member"])) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//return $this->secret;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -6,10 +6,14 @@ class Settings
|
||||||
private $tags;
|
private $tags;
|
||||||
private $settings;
|
private $settings;
|
||||||
|
|
||||||
public function getFolks()
|
public function __construct()
|
||||||
{
|
{
|
||||||
return $this->folks = json_decode(file_get_contents('config/folks.json'), true);
|
//gets all settings files and converts to php objects
|
||||||
//return $this->secret;
|
$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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
11
brain/views/dash/forms/login.twig
Normal file
11
brain/views/dash/forms/login.twig
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<div id="dash-login">
|
||||||
|
<div id="dash-form" class="dash-form">
|
||||||
|
<form id="login" class='login' , name="login" action="/@/dashboard/login" method="POST">
|
||||||
|
<input type="text" name="handle" class="form-control" placeholder="Handle" required ">
|
||||||
|
<input type="password" name="password" class="form-control" placeholder="Password" required">
|
||||||
|
<button id="login-btn" , class='login-btn' , type='submit'>
|
||||||
|
Let's see some ID
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
64
brain/views/dash/frame.twig
Normal file
64
brain/views/dash/frame.twig
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>
|
||||||
|
{% block title %}
|
||||||
|
{{ title }}
|
||||||
|
{% endblock %}
|
||||||
|
</title>
|
||||||
|
{% block stylesheets %}{% endblock %}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="notifications" class="notifications">
|
||||||
|
<div id="notifyMessage" class="notifyMessage">
|
||||||
|
<div id="notify-good" class="notify-icon">
|
||||||
|
<svg class="menu-icon"><use xlink:href="/assets/images/global/sprite.svg#entypo-emoji-flirt"/></svg>
|
||||||
|
</div>
|
||||||
|
<div id="notify-lame" class="notify-icon">
|
||||||
|
<svg class="menu-icon"><use xlink:href="/assets/images/global/sprite.svg#entypo-emoji-sad"/></svg>
|
||||||
|
</div>
|
||||||
|
<div id="notify-working" class="notify-icon">
|
||||||
|
<svg class="menu-icon"><use xlink:href="/assets/images/global/sprite.svg#entypo-cog"/></svg>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="main-content" class="main-container">
|
||||||
|
<section id="dash-index-content">
|
||||||
|
<header id="header">
|
||||||
|
<div id="wrapper">
|
||||||
|
<div id="left">
|
||||||
|
<a href="/dashboard"><img id="the-logo" src="/public/assets/images/global/the-logo.svg"/></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="right"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</header>
|
||||||
|
{% block mainContent %}{% endblock %}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
{% if options['showFooter'] is defined %}
|
||||||
|
<!-- NO FOOTER -->
|
||||||
|
{% else %}
|
||||||
|
<div class="inner">
|
||||||
|
<div class="columns">
|
||||||
|
<div id="footer_left" class="column">
|
||||||
|
<a href="#">About</a><br/>
|
||||||
|
</div>
|
||||||
|
<div id="footer_right " class="column">
|
||||||
|
<a href="#">FAQ</a><br/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
{% block javascripts %}{% endblock %}
|
||||||
|
</body>
|
||||||
|
</html>
|
25
brain/views/dash/start.twig
Normal file
25
brain/views/dash/start.twig
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{% extends "dash/frame.twig" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{{ title }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block stylesheets %}
|
||||||
|
<link rel="stylesheet" type="text/css" href="/public/assets/css/dash.css">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block mainContent %}
|
||||||
|
<div id="dash-index">
|
||||||
|
<div id="dash-index-wrapper">
|
||||||
|
{% if status %}
|
||||||
|
DASH INDEX
|
||||||
|
{% else %}
|
||||||
|
{{ include("dash/forms/login.twig") }}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block javascripts %}
|
||||||
|
<script src="/public/assets/scripts/dash.min.js" type="text/javascript"></script>
|
||||||
|
{% endblock %}
|
|
@ -1,25 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>{{ title }}</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
There are
|
|
||||||
{{ totalPages }}
|
|
||||||
pages total, hoss.
|
|
||||||
<br/>
|
|
||||||
{% for page in pages %}
|
|
||||||
{# <a href="/blog/{{ page.slug }}">{{ page.title }}</a><br/><br/>
|
|
||||||
#}
|
|
||||||
{{ page["title"] }}
|
|
||||||
{{ page['filePath'] }}
|
|
||||||
<br/>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
|
@ -1,12 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>{{ title }}</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body></body>
|
|
||||||
|
|
||||||
</html>
|
|
0
brain/views/front/start.twig
Normal file
0
brain/views/front/start.twig
Normal file
19
index.php
19
index.php
|
@ -1,4 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
require __DIR__ . "/vendor/autoload.php";
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
use Slim\Factory\AppFactory;
|
use Slim\Factory\AppFactory;
|
||||||
|
@ -7,10 +9,10 @@ use Slim\Views\TwigMiddleware;
|
||||||
|
|
||||||
include "brain/controller/IndexControl.inc.php";
|
include "brain/controller/IndexControl.inc.php";
|
||||||
include "brain/controller/DashControl.inc.php";
|
include "brain/controller/DashControl.inc.php";
|
||||||
|
include "brain/data/Auth.inc.php";
|
||||||
|
|
||||||
require __DIR__ . "/vendor/autoload.php";
|
|
||||||
$app = AppFactory::create();
|
$app = AppFactory::create();
|
||||||
$twig = Twig::create("brain/views/default/");
|
$twig = Twig::create("brain/views/");
|
||||||
$app->add(TwigMiddleware::create($app, $twig));
|
$app->add(TwigMiddleware::create($app, $twig));
|
||||||
|
|
||||||
//Index
|
//Index
|
||||||
|
@ -26,10 +28,12 @@ $app->get("/[{first}[/{second}]]", function (
|
||||||
$response->getBody()->write("FIND A PAGE, B!");
|
$response->getBody()->write("FIND A PAGE, B!");
|
||||||
} else {
|
} else {
|
||||||
//$response->getBody()->write("This is the dash, brah!");
|
//$response->getBody()->write("This is the dash, brah!");
|
||||||
|
|
||||||
|
if ($first == "dashboard") {
|
||||||
if (isset($args["second"])) {
|
if (isset($args["second"])) {
|
||||||
$section = $args["second"];
|
$section = $args["second"];
|
||||||
} else {
|
} else {
|
||||||
$section = "front";
|
$section = "index";
|
||||||
}
|
}
|
||||||
|
|
||||||
$dash = new DashControl();
|
$dash = new DashControl();
|
||||||
|
@ -37,13 +41,16 @@ $app->get("/[{first}[/{second}]]", function (
|
||||||
|
|
||||||
$count = count($pages);
|
$count = count($pages);
|
||||||
|
|
||||||
//$response->getBody()->write("There are ".$count." pages, champ");
|
//$response->getBody()->write("There are " . $count . " pages, champ");
|
||||||
|
$auth = new Auth();
|
||||||
return $view->render($response, "dash-index.twig", [
|
return $view->render($response, "dash/start.twig", [
|
||||||
"title" => "Fipamo Dash",
|
"title" => "Fipamo Dash",
|
||||||
|
"status" => $auth->sessionStatus(),
|
||||||
"pages" => $pages,
|
"pages" => $pages,
|
||||||
"totalPages" => $count,
|
"totalPages" => $count,
|
||||||
]);
|
]);
|
||||||
|
} else {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$response->getBody()->write("No Params, Homie!");
|
$response->getBody()->write("No Params, Homie!");
|
||||||
|
|
Loading…
Reference in a new issue