Commit 1d44e697 authored by Corentin Bettiol's avatar Corentin Bettiol 💻

admin part

parent 12500846
......@@ -3,6 +3,7 @@ l3m_projects
name
link
content
shortContent
l3m_blog
id
......
......@@ -7,6 +7,7 @@
bottom: 0;
left: 0;
opacity: 0.4;
z-index: -1;
}
#videoFond > video {
width: 100%;
......@@ -37,6 +38,7 @@
}
}
header, #menu{
z-index: 2;
#header, article, #footer{
background-color: rgba(240,240,240,0.4) !important;
opacity: 0.9 !important;
}
\ No newline at end of file
......@@ -28,7 +28,7 @@ CSS
border-bottom: 5px solid #ccc;
}
article p, #pageTitle, article h3, article ul, article form{
article p, #pageTitle, article h3, article ul, article form, #listAdmin{
max-width: 1500px;
margin: 30px auto;
}
......@@ -66,13 +66,13 @@ h2{
h3 a{
text-decoration: none;
text-shadow: 0 0 1px #69f;
transition: padding-left 0.3s, text-shadow 0.3s;
transition: padding-left 0.3s, text-shadow 0.3s, color 0.3s;
}
h3 a:hover{
padding-left: 5px;
text-shadow: -5px 0 4px #BBf;
transition: padding-left 0.3s, text-shadow 0.3s;
transition: padding-left 0.3s, text-shadow 0.3s, color 0.3s;
}
#listMenu{
......@@ -173,6 +173,53 @@ input[type="submit"]:hover{
transition: background-color 0.3s;
}
#listAdmin{
display: flex;
flex-wrap: wrap;
}
#listAdmin article{
flex: 45%;
}
#listAdmin h3{
margin: auto;
text-align: center;
}
#listAdmin article:first-child{
border-right: 5px solid #ccc;
}
.listAdmin{
display: flex;
align-items: center;
justify-content: space-evenly;
}
.listAdmin b{
display: inline-block;
width: 50%;
border-right: 1px solid #ccc;
}
.listAdmin span{
padding: 3px;
}
.editLink{
background-color: #d9d9d9;
padding: 7px 7px 10px 7px;
border-bottom: 0px solid #ccc;
transition: background-color 0.3s, color 0.3s, border 0.05s, padding 0.05s;
}
.editLink:hover{
background-color: #f0f0f0;
padding: 7px;
border-bottom: 3px solid #ccc;
transition: background-color 0.3s, color 0.3s, border 0.0.5s, padding 0.05s;
}
/*
====
......
......@@ -2,6 +2,7 @@
require_once("site/model/config.php");
require_once("site/model/Base.php");
require_once("site/model/AdminManager.php");
require_once("site/model/BlogManager.php");
require_once("site/model/ProjectsManager.php");
......@@ -96,21 +97,20 @@ function loginAdminPage($pageName){
function writeAdminPage($pageName){
if(verifyAdminConnect())
$admin = new AdminManager();
if($admin->verifyAdminConnect()){
$blogposts = $admin->getBlogPosts();
$projects = $admin->getProjects();
require("site/view/private/admin.php");
else{
require("site/view/private/loginFormView.php");
}
}
function verifyAdminConnect(){
return isset($_SESSION['user']) && $_SESSION['user'] == user && isset($_SESSION['pass']) && password_verify($_SESSION['pass'], pass);
else
require("site/view/private/loginFormView.php");
}
function decoAdminPage(){
$_SESSION = array();
header("Location:/");
}
......
<?php
class AdminManager extends Base
{
public function getBlogPosts()
{
$db = $this->dbConnect();
$req = $db->query('SELECT * FROM l3m_blog ORDER BY id DESC');
return $req;
}
public function getProjects()
{
$db = $this->dbConnect();
$req = $db->query('SELECT * FROM l3m_projects ORDER BY id DESC');
return $req;
}
public function verifyAdminConnect(){
return isset($_SESSION['user']) && $_SESSION['user'] == user && isset($_SESSION['pass']) && password_verify($_SESSION['pass'], pass);
}
}
\ No newline at end of file
<?php
if(!isset($admin)){
header("Location:/patate");
exit();
}
?>
<article>
<h3>🔧 Administration</h3>
<p>Todo : toutes les fonctionnalités hyper chiadées & ultra stylées.</p>
</article>
<article>
<section id="listAdmin">
<article>
<h3>Liste des posts de blog</h3>
<form action="patate/submitb" method="get" accept-charset="utf-8">
<input type="submit" value="Nouveau billet" />
</form>
<?php include("site/view/private/listBlogPostView.php"); ?>
</article>
<article>
<h3>Liste des projets</h3>
<nav>
<ul>
<li><a href="/patatedouce/b">Nouveau post du blog</a></li>
<li><a href="/patatedouce/lb">Lister les articles</a></li>
<li><a href="/patatedouce/p">Nouveau projet</a></li>
<li><a href="/patatedouce/lp">Lister les projets</a></li>
</ul>
</nav>
<form action="patate/submitp" method="get" accept-charset="utf-8">
<input type="submit" value="Nouveau projet" />
</form>
<?php include("site/view/private/listProjectsView.php"); ?>
</article>
</section>
</article>
\ No newline at end of file
<?php
if(!isset($admin)){
header("Location:/patate");
exit();
}
$hr = false;
foreach ($blogposts as $post){
$post['datetime'] = new DateTime($post['time']);
$post['link'] = str_replace(" ", "-", $post['title']);
if(!$hr)
$hr = true;
else
echo "<hr />";
?>
<article>
<p class="listAdmin">
<b><a href="/article/<?php echo $post['link']; ?>"><?php echo $post['title'] ?></a></b>
<span class="postInfos"><?php echo date_format($post['datetime'], 'd/m/Y à H:i'); ?></span> <a class="editLink" href="/patate/blog/<?php echo $post['link'] ."/edit"; ?>">éditer</a>
</p>
</article>
<?php
}
if(!$hr){
?>
<article>
<h4>Pas de post</h4>
<p>Aucun billet n'a encore été publié, patience !</p>
</article>
<?php
}
<?php
if(!isset($admin)){
header("Location:/patate");
exit();
}
$hr = false;
foreach ($projects as $project){
$project['internalLink'] = str_replace(" ", "-", $project['name']);
if(!$hr)
$hr = true;
else
echo "<hr />";
?>
<article>
<p class="listAdmin">
<b><a href="/project/<?php echo $project['internalLink']; ?>"><?php echo $project['name'] ?></a></b>
<span class="postInfos"><?php echo $project['link']; ?></span> <a class="editLink" href="/patate/projet/<?php echo $project['internalLink'] ."/edit"; ?>">éditer</a>
</p>
</article>
<?php
}
if(!$hr){
?>
<article>
<h4>Pas de projet</h4>
<p>Aucun projet n'a encore été publié, patience !</p>
</article>
<?php
}
<?php
if(!isset($pageName)){
header("Location:/");
exit();
}
$hr = false;
foreach ($blogposts as $blogpost){
$blogpost['link'] = str_replace(" ", "-", $blogpost['title']);
$blogpost['datetime'] = new DateTime($blogpost['time']);
if(!$hr)
$hr = true;
else
echo "<hr />";
$blogpost['datetime'] = new DateTime($blogpost['time']);
include("site/view/public/blogPostView.php");
}
if(!$hr){
......@@ -19,5 +26,3 @@
</article>
<?php
}
?>
\ No newline at end of file
<article>
<h3>13/01/19</h3>
<h3>14/01/19</h3>
<ul>
<li>Modifications partie admin; ajout des listes des projets et des billets de blog</li>
<li>Ajout de boutons pour poster un billet de blog ou un projet</li>
<li>Changement de la structure des projets (voir bdd.txt), maintenant ils auront une description courte et une description longue accessible si on clique sur un lien particulier</li>
<li>Changement de design de la page 404 (première utilisation du <i>!important</i>, berk)</li>
<li>Sécurisation des pages (redirection vers le formulaire si accès incorrect)</li>
</ul>
</article>
<article>
<h3><a href="https://git.bitmycode.com/sodimel/l3m-website/commit/d38afd228a472bb750a26a221397761cb51d9c9b" title="commit d38afd22">13/01/19</a></h3>
<ul>
<li>Ajout du formulaire au panneau d'administration</li>
......
......@@ -2,6 +2,7 @@
$hr = false;
foreach ($projects as $project){
$project['internalLink'] = str_replace(" ", "-", $project['name']);
if(!$hr)
$hr = true;
else
......@@ -10,7 +11,8 @@
<article>
<h3><a href="<?php echo $project['link']; ?>"><?php echo $project['name']; ?></a></h3>
<p>
<?php echo $project['content']; ?>
<?php echo $project['shortContent']; ?><br />
<span class="postInfos"><a href="/project/<?php echo $project['internalLink']; ?>">Plus d'infos.</a></span>
</p>
</article>
<?php
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment