mirror of
https://github.com/Aviortheking/Blog_IMIE.git
synced 2025-04-22 10:52:09 +00:00
pouet
This commit is contained in:
parent
731a494eb4
commit
2d506a0095
@ -564,10 +564,11 @@ input {
|
|||||||
.filtre {
|
.filtre {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 6px 10px 6px 10px;
|
padding: 6px 10px 6px 10px;
|
||||||
color: white;
|
color: #fff;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dev-color {
|
.dev-color {
|
||||||
@ -599,7 +600,7 @@ input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tag {
|
.tag {
|
||||||
color: white;
|
color: #fff;
|
||||||
background-color: #cccccc;
|
background-color: #cccccc;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -617,7 +618,7 @@ input {
|
|||||||
.phraseFooter {
|
.phraseFooter {
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
color: white;
|
color: #fff;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,7 +637,7 @@ input {
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
width: 180px;
|
width: 180px;
|
||||||
color: white;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
#glass {
|
#glass {
|
||||||
@ -650,7 +651,7 @@ input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#titre-home {
|
#titre-home {
|
||||||
color: white;
|
color: #fff;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@ -748,8 +749,31 @@ form.login > input {
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
form.login >input[type="submit"] {
|
form.login >input[type="submit"], form.login > a {
|
||||||
left: -46%;
|
left: -44%;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
form.login > a {
|
||||||
|
left: -28%;
|
||||||
|
margin-top: 65px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
td, th {
|
||||||
|
border: 1px solid #dddddd;
|
||||||
|
text-align: left;
|
||||||
|
padding: 8px;
|
||||||
|
background:#fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<title>Page Title</title>
|
<title></title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous" />
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous" />
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/style.css"/>
|
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/style.css"/>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="nav_imie">
|
<div class="nav_imie">
|
||||||
|
<tag type="element" />
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="item_nav_imie link"><a>Connexion</a></li>
|
|
||||||
<li class="item_nav_imie link"><a href="https://imie44.ymag.cloud">Accès Net-Yparéo</a></li>
|
<li class="item_nav_imie link"><a href="https://imie44.ymag.cloud">Accès Net-Yparéo</a></li>
|
||||||
<li class="item_nav_imie link"><a href="https://www.imie.fr">IMIE Numérique</a></li>
|
<li class="item_nav_imie link"><a href="https://www.imie.fr">IMIE Numérique</a></li>
|
||||||
<li class="item_nav_imie social"><a href="https://twitter.com/EcoleIMIE">
|
<li class="item_nav_imie social"><a href="https://twitter.com/EcoleIMIE">
|
||||||
@ -13,7 +13,21 @@
|
|||||||
<li class="item_nav_imie social"><a href="https://www.facebook.com/EcolesIMIE/">
|
<li class="item_nav_imie social"><a href="https://www.facebook.com/EcolesIMIE/">
|
||||||
<tag type="svg" file="facebook" style="color: white; width: 18px; height: 18px" /></a></li>
|
<tag type="svg" file="facebook" style="color: white; width: 18px; height: 18px" /></a></li>
|
||||||
<li class="item_nav_imie link" style="float: left">
|
<li class="item_nav_imie link" style="float: left">
|
||||||
<tag type="user" />
|
<tag type="isLoggedIn">
|
||||||
|
<if true>
|
||||||
|
<tag type="user" column="username" />
|
||||||
|
</if>
|
||||||
|
<if false>
|
||||||
|
<a href="/login">Connection</a>
|
||||||
|
</if>
|
||||||
|
</tag>
|
||||||
|
</li>
|
||||||
|
<li class="item_nav_imie link" style="float: left">
|
||||||
|
<tag type="isLoggedIn" role="ROLE_ADMIN">
|
||||||
|
<if true>
|
||||||
|
<a href="/users">Utilisateurs</a>
|
||||||
|
</if>
|
||||||
|
</tag>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -29,8 +43,14 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li class="item_nav_blog_logo"><a href="/">
|
<li class="item_nav_blog_logo"><a href="/">
|
||||||
<tag type="svg" file="logo-imie-blog" style="color: white; width: 200px; height: 64px; margin-top: 6px;" /></a></li>
|
<tag type="svg" file="logo-imie-blog" style="color: white; width: 200px; height: 64px; margin-top: 6px;" /></a></li>
|
||||||
<li class="item_nav_blog_droite_icon"><input id="search" type="text" placeholder="Recherche"><a>
|
<li class="item_nav_blog_droite_icon">
|
||||||
<tag type="svg" file="mignify" style="color: rgba(0, 0, 0, .5); width: 18px; height: 18px" /></a></li>
|
<form method="dialog" action="/search">
|
||||||
|
<input name="term" id="search" class="el-search" type="text" placeholder="Recherche">
|
||||||
|
<button type="submit">
|
||||||
|
<tag type="svg" file="mignify" style="color: rgba(0, 0, 0, .5); width: 18px; height: 18px" />
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
<li class="item_nav_blog_droite devops"><a>DEVOPS</a></li>
|
<li class="item_nav_blog_droite devops"><a>DEVOPS</a></li>
|
||||||
<li class="item_nav_blog_droite ops"><a>OPS</a></li>
|
<li class="item_nav_blog_droite ops"><a>OPS</a></li>
|
||||||
<li class="item_nav_blog_droite digi"><a>DIGI</a></li>
|
<li class="item_nav_blog_droite digi"><a>DIGI</a></li>
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
<input name="password" id="password" type="password" placeholder="password" />
|
<input name="password" id="password" type="password" placeholder="password" />
|
||||||
|
|
||||||
<input type="submit" class="bloc-plus" value="Login"/>
|
<input type="submit" class="bloc-plus" value="Login"/>
|
||||||
|
<a href="/register" class="bloc-plus">Register</a>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -11,13 +11,17 @@
|
|||||||
<main class="test container">
|
<main class="test container">
|
||||||
<div class="bloc-post">
|
<div class="bloc-post">
|
||||||
<div class="container-post post article-cat">
|
<div class="container-post post article-cat">
|
||||||
<h2 class="title"><tag type="article" column="title" /></h2>
|
<h2 class="title">
|
||||||
|
<tag type="article" column="title" />
|
||||||
|
</h2>
|
||||||
<div class="etiquettes">
|
<div class="etiquettes">
|
||||||
<span class="cat"><tag type="article" column="category"/></span>
|
<span class="cat">
|
||||||
<span class="date"><tag type="article" column="datetime"/></span>
|
<tag type="article" column="category" /></span>
|
||||||
|
<span class="date">
|
||||||
|
<tag type="article" column="datetime" /></span>
|
||||||
</div>
|
</div>
|
||||||
<p class="post text">
|
<p class="post text">
|
||||||
<tag type="article" column="content"/>
|
<tag type="article" column="content" />
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="credit">
|
<div class="credit">
|
||||||
@ -26,8 +30,12 @@
|
|||||||
<a>
|
<a>
|
||||||
<tag type="svg" file="avatar" style="color: white; height: 64px" /></a>
|
<tag type="svg" file="avatar" style="color: white; height: 64px" /></a>
|
||||||
<div class="by">
|
<div class="by">
|
||||||
<h3 class="name"><tag type="authorTag" column="username" /></h3>
|
<h3 class="name">
|
||||||
<h3 class="job"><tag type="authorTag" column="job" /></h3>
|
<tag type="authorTag" column="username" />
|
||||||
|
</h3>
|
||||||
|
<h3 class="job">
|
||||||
|
<tag type="authorTag" column="job" />
|
||||||
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -45,8 +53,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bloc-recent">
|
<div class="bloc-recent">
|
||||||
<div class="contenue-recent">Article précédent</div>
|
<tag type="isLoggedIn" reol="ROLE_EDITOR">
|
||||||
<div class="contenue-recent next">Article suivant</div>
|
<if true>
|
||||||
|
<a href="./edit" class="contenue-recent next">Editer l'article</a>
|
||||||
|
</if>
|
||||||
|
</tag>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3 id="titre-between">Dans le même thème</h3>
|
<h3 id="titre-between">Dans le même thème</h3>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<input name="username" id="username" type="text" placeholder="username" />
|
<input name="username" id="username" type="text" placeholder="username" />
|
||||||
<input name="password" id="password" type="password" placeholder="password" />
|
<input name="password" id="password" type="password" placeholder="password" />
|
||||||
|
|
||||||
<input type="submit" class="bloc-plus" value="Login"/>
|
<input type="submit" class="bloc-plus" value="Register"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -43,7 +43,14 @@
|
|||||||
</tag>
|
</tag>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bloc-filter">
|
<div class="bloc-filter int-search">
|
||||||
|
<p class="title-small">Catégories</p>
|
||||||
|
<a data-category="3" class="filtre dev-color">dev</a>
|
||||||
|
<a data-category="4" class="filtre digi-color">digi</a>
|
||||||
|
<a data-category="2" class="filtre ops-color">ops</a>
|
||||||
|
<a data-category="1" class="filtre devops-color">devops</a>
|
||||||
|
<p class="title-small">Tags</p>
|
||||||
|
<tag type="tags" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
|
40
assets/html/user_add.html
Normal file
40
assets/html/user_add.html
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<tag type="includes" file="header" />
|
||||||
|
</header>
|
||||||
|
<main class="test container">
|
||||||
|
<div class="bloc_principal">
|
||||||
|
<div class="cover-black">
|
||||||
|
<div class="bloc_principal_titre">
|
||||||
|
<h1>LE BLOG DES APPRENANTS</h1>
|
||||||
|
</div>
|
||||||
|
<div class="cover-text">
|
||||||
|
<h2 id="titre-home">Voilà les informations que vous devez entrer pour créer un utilisateur</h2>
|
||||||
|
<div class="p-home">
|
||||||
|
<form name="login" id="name" method="POST" class="login" action="/users/new/">
|
||||||
|
<input name="username" id="username" type="text" placeholder="Nom d'utilisateur" />
|
||||||
|
<input name="password" id="password" type="password" placeholder="Mot de passe" />
|
||||||
|
<select name="role" id="role">
|
||||||
|
<option default value="ROLE_USER">Utilisateur</option>
|
||||||
|
<option value="ROLE_EDITOR">Editeur</option>
|
||||||
|
<option value="ROLE_ADMIN">Administrateur</option>
|
||||||
|
</select>
|
||||||
|
<input type="submit" class="bloc-plus" value="Créer"/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<tag type="includes" file="footer" />
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
40
assets/html/user_edit.html
Normal file
40
assets/html/user_edit.html
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<tag type="includes" file="header" />
|
||||||
|
</header>
|
||||||
|
<main class="test container">
|
||||||
|
<div class="bloc_principal">
|
||||||
|
<div class="cover-black">
|
||||||
|
<div class="bloc_principal_titre">
|
||||||
|
<h1>LE BLOG DES APPRENANTS</h1>
|
||||||
|
</div>
|
||||||
|
<div class="cover-text">
|
||||||
|
<h2 id="titre-home">Voilà les informations que vous devez entrer pour créer un utilisateur</h2>
|
||||||
|
<div class="p-home">
|
||||||
|
<form name="login" id="name" method="POST" class="login" action="./edit">
|
||||||
|
<input name="username" id="username" type="text" placeholder="Nom d'utilisateur" />
|
||||||
|
<input name="password" id="password" type="password" placeholder="Mot de passe" />
|
||||||
|
<select>
|
||||||
|
<option value="ROLE_USER">Utilisateur</option>
|
||||||
|
<option value="ROLE_EDITOR">Editeur</option>
|
||||||
|
<option value="ROLE_ADMIN">Administrateur</option>
|
||||||
|
</select>
|
||||||
|
<input type="submit" class="bloc-plus" value="Créer"/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<tag type="includes" file="footer" />
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
49
assets/html/user_list.html
Normal file
49
assets/html/user_list.html
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<tag type="includes" file="header" />
|
||||||
|
</header>
|
||||||
|
<main class="test container">
|
||||||
|
<div class="bloc_principal">
|
||||||
|
<div class="cover-black">
|
||||||
|
<div class="bloc_principal_titre">
|
||||||
|
<h1>LE BLOG DES APPRENANTS</h1>
|
||||||
|
</div>
|
||||||
|
<div class="cover-text">
|
||||||
|
<h2 id="titre-home">cliquez sur un utilisateur pour le modifier</h2>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Nom d'utilisateur</th>
|
||||||
|
<th>Role</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tag type="users">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<loop column="username" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<loop column="role" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tag>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<a href="/users/new" class="bloc-plus">Nouvel utilisateur</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<tag type="includes" file="footer" />
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -95,3 +95,17 @@ if(document.querySelector(".addTag") != null) {
|
|||||||
document.querySelector(".addTag").addEventListener("click", addTag);
|
document.querySelector(".addTag").addEventListener("click", addTag);
|
||||||
document.querySelector(".submitPost").addEventListener("click", submit);
|
document.querySelector(".submitPost").addEventListener("click", submit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.querySelector("#search + a").addEventListener("click", function() {
|
||||||
|
window.location = window.location.pathname + "?term=" + document.querySelector("#search").value;
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll(".int-search .filtre").forEach(function(el) {
|
||||||
|
el.addEventListener("click", function() {
|
||||||
|
var tagW = new URL(window.location).searchParams.get("tag");
|
||||||
|
var tag = (tagW != null ? "&tag=" + tagW : "");
|
||||||
|
var termW = new URL(window.location).searchParams.get("term");
|
||||||
|
var term = (termW != null ? "&term=" + termW : "");
|
||||||
|
window.location = window.location.pathname + "?category=" + this.getAttribute("data-category") + tag + term;
|
||||||
|
})
|
||||||
|
})
|
||||||
|
@ -43,6 +43,9 @@ class Controller {
|
|||||||
if(!isset($_SESSION["author"]) || (isset($_SESSION["author"]) && ($_SESSION["author"]->getRole() != "ROLE_EDITOR" && $_SESSION["author"]->getRole() != "ROLE_ADMIN"))) header("Location: /login/?redirect=".$_SERVER["REQUEST_URI"]);
|
if(!isset($_SESSION["author"]) || (isset($_SESSION["author"]) && ($_SESSION["author"]->getRole() != "ROLE_EDITOR" && $_SESSION["author"]->getRole() != "ROLE_ADMIN"))) header("Location: /login/?redirect=".$_SERVER["REQUEST_URI"]);
|
||||||
} elseif($arr[0] === "admin" && isset($cl) && $cl ==$class) {
|
} elseif($arr[0] === "admin" && isset($cl) && $cl ==$class) {
|
||||||
if(!isset($_SESSION["author"]) || (isset($_SESSION["author"]) && $_SESSION["author"]->getRole() != "ROLE_ADMIN")) header("Location: /login/?redirect=".$_SERVER["REQUEST_URI"]);
|
if(!isset($_SESSION["author"]) || (isset($_SESSION["author"]) && $_SESSION["author"]->getRole() != "ROLE_ADMIN")) header("Location: /login/?redirect=".$_SERVER["REQUEST_URI"]);
|
||||||
|
} elseif($arr[0] === "title" && isset($cl) && $cl == $class) {
|
||||||
|
array_shift($arr);
|
||||||
|
$_GET['page_title'] = join(" ", $arr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isset($instance)) {
|
if(isset($instance)) {
|
||||||
@ -51,6 +54,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$_GET["page_title"] = "404 error";
|
||||||
header("HTTP/1.0 404 Not Found");
|
header("HTTP/1.0 404 Not Found");
|
||||||
return file_get_contents(DIR."/html/404.html");
|
return file_get_contents(DIR."/html/404.html");
|
||||||
|
|
||||||
|
@ -11,20 +11,16 @@ class HomeController extends Controller {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @route /^\/$/
|
* @route /^\/$/
|
||||||
|
* @title Accueil
|
||||||
*/
|
*/
|
||||||
public function home() {
|
public function home() {
|
||||||
return file_get_contents(DIR."/html/index.html");
|
return file_get_contents(DIR."/html/index.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @route /^\/post\/[0-9]+\/$/
|
|
||||||
*/
|
|
||||||
public function post() {
|
|
||||||
return file_get_contents(DIR."/html/post.html");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @route /^\/search\//
|
* @route /^\/search\//
|
||||||
|
* @title Rechercher
|
||||||
*/
|
*/
|
||||||
public function search() {
|
public function search() {
|
||||||
return file_get_contents(DIR."/html/search.html");
|
return file_get_contents(DIR."/html/search.html");
|
||||||
|
@ -11,6 +11,7 @@ class LoginController extends Controller {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @route /^\/login\/$/
|
* @route /^\/login\/$/
|
||||||
|
* @title Login
|
||||||
*/
|
*/
|
||||||
public function login() {
|
public function login() {
|
||||||
|
|
||||||
@ -38,6 +39,7 @@ class LoginController extends Controller {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @route /^\/register\/$/
|
* @route /^\/register\/$/
|
||||||
|
* @title Register
|
||||||
*/
|
*/
|
||||||
public function register() {
|
public function register() {
|
||||||
if(isset($_POST["password"]) && isset($_POST["username"]) && Author::getByUsername($_POST["username"]) === null) {
|
if(isset($_POST["password"]) && isset($_POST["username"]) && Author::getByUsername($_POST["username"]) === null) {
|
||||||
|
@ -7,10 +7,11 @@ use App\DB\Post;
|
|||||||
use App\DB\Tag;
|
use App\DB\Tag;
|
||||||
|
|
||||||
|
|
||||||
class AddEditController extends Controller {
|
class PostController extends Controller {
|
||||||
/**
|
/**
|
||||||
* @route /^\/post\/[0-9]+\/edit\/$/
|
* @route /^\/post\/[0-9]+\/edit\/$/
|
||||||
* @editor
|
* @editor
|
||||||
|
* @title Modification d'article
|
||||||
*/
|
*/
|
||||||
public function postEdit() {
|
public function postEdit() {
|
||||||
if(isset($_GET["post"]) && isset($_GET["title"]) && isset($_GET["category"]) && isset($_GET["content"]) && isset($_GET["tags"])) {
|
if(isset($_GET["post"]) && isset($_GET["title"]) && isset($_GET["category"]) && isset($_GET["content"]) && isset($_GET["tags"])) {
|
||||||
@ -42,6 +43,7 @@ class AddEditController extends Controller {
|
|||||||
/**
|
/**
|
||||||
* @route /^\/post\/new\/*$/
|
* @route /^\/post\/new\/*$/
|
||||||
* @editor
|
* @editor
|
||||||
|
* @title Ajout d'Article
|
||||||
*/
|
*/
|
||||||
public function postAdd() {
|
public function postAdd() {
|
||||||
|
|
||||||
@ -75,4 +77,13 @@ class AddEditController extends Controller {
|
|||||||
|
|
||||||
return file_get_contents(DIR."/html/post_new.html");
|
return file_get_contents(DIR."/html/post_new.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @route /^\/post\/[0-9]+\/$/
|
||||||
|
* @title Article
|
||||||
|
*/
|
||||||
|
public function post() {
|
||||||
|
return file_get_contents(DIR."/html/post.html");
|
||||||
|
}
|
||||||
}
|
}
|
48
assets/php/Controller/UserController.php
Normal file
48
assets/php/Controller/UserController.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
use App\Controller;
|
||||||
|
use App\DB\Author;
|
||||||
|
|
||||||
|
class UserController extends Controller {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @route /^\/users\/new\/$/
|
||||||
|
* @admin
|
||||||
|
* @title Ajouter un utilisateur
|
||||||
|
*/
|
||||||
|
public function addUser() {
|
||||||
|
|
||||||
|
if(isset($_POST["username"]) && isset($_POST["password"]) && isset($_POST["role"])) {
|
||||||
|
$user = new Author();
|
||||||
|
$user->setUsername($_POST["username"]);
|
||||||
|
$user->setPassword($_POST["password"]);
|
||||||
|
Author::add($user);
|
||||||
|
header("Location: /users/");
|
||||||
|
}
|
||||||
|
|
||||||
|
return \file_get_contents(DIR . "/html/user_add.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @route /^\/users\/$/
|
||||||
|
* @admin
|
||||||
|
* @title liste des utilisateurs
|
||||||
|
*/
|
||||||
|
public function listUser() {
|
||||||
|
return \file_get_contents(DIR."/html/user_list.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @route /^\/user\/edit\/$/
|
||||||
|
* @admin
|
||||||
|
* @title Modifier un utilisateur
|
||||||
|
*/
|
||||||
|
public function editUser() {
|
||||||
|
return \file_get_contents(DIR."/html/user_edit.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
18
assets/php/Tags/Element.php
Normal file
18
assets/php/Tags/Element.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Tags;
|
||||||
|
|
||||||
|
use DomXPath;
|
||||||
|
|
||||||
|
class Element extends Tag {
|
||||||
|
public function render() {
|
||||||
|
$el = $this->getElement();
|
||||||
|
$term = isset($_GET["term"]) ? $_GET["term"] : "";
|
||||||
|
if($el->hasAttribute("el")) $el->parentNode->insertBefore($this->getDoc()->createTextNode($term), $el);
|
||||||
|
else {
|
||||||
|
$finder = new DomXPath($this->getDoc());
|
||||||
|
$nodes = $finder->query("//*[contains(@class, 'el-search')]");
|
||||||
|
if(count($nodes) >= 1) $nodes[0]->setAttribute("value", $term);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -20,15 +20,24 @@ class IsLoggedIn extends Tag {
|
|||||||
|
|
||||||
$el = $this->getElement();
|
$el = $this->getElement();
|
||||||
|
|
||||||
|
|
||||||
|
if(isset($_SESSION["author"])) {
|
||||||
|
if($el->hasAttribute("role") || !$_SESSION["author"]->getRole() == "ROLE_ADMIN") {
|
||||||
|
$loggedin = $el->getAttribute("role") == $_SESSION["author"]->getRole();
|
||||||
|
} else $loggedin = true;
|
||||||
|
} else $loggedin = false;
|
||||||
|
|
||||||
|
|
||||||
//debugging purpose
|
//debugging purpose
|
||||||
$loggedin = false;
|
// $loggedin = false;
|
||||||
|
// var_dump($loggedin);
|
||||||
|
|
||||||
foreach ($el->getElementsByTagName("if") as $element) {
|
foreach ($el->getElementsByTagName("if") as $element) {
|
||||||
if($element->hasAttribute("true") && $loggedin) {
|
if($element->hasAttribute("true") && $loggedin) {
|
||||||
$r = $element->childNodes->item(1);
|
$r = $element->childNodes->item(0);
|
||||||
$el->parentNode->insertBefore($r, $el);
|
$el->parentNode->insertBefore($r, $el);
|
||||||
} elseif ($element->hasAttribute("false")) {
|
} elseif ($element->hasAttribute("false") && !isset($_SESSION["author"])) {
|
||||||
$r = $element->childNodes->item(1);
|
$r = $element->childNodes->item(0);
|
||||||
$el->parentNode->insertBefore($r, $el);
|
$el->parentNode->insertBefore($r, $el);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,10 @@ class Loop extends Tag {
|
|||||||
$category = $el->getAttribute("category") != '' ? Post::get($_GET["post"])->getCategory()->getId() : $category;
|
$category = $el->getAttribute("category") != '' ? Post::get($_GET["post"])->getCategory()->getId() : $category;
|
||||||
$tag = isset($_GET["tag"]) && intval($_GET["tag"]) ? (int) $_GET["tag"] : -1;
|
$tag = isset($_GET["tag"]) && intval($_GET["tag"]) ? (int) $_GET["tag"] : -1;
|
||||||
|
|
||||||
|
$term = isset($_GET["term"]) ? $_GET["term"] : "";
|
||||||
|
|
||||||
if($category != -1) {
|
if($category != -1) {
|
||||||
$posts = Post::listByCategory($category, $isRecent, $limit);
|
$posts = Post::listByCategory($category, $isRecent, $limit, $term);
|
||||||
if(isset($_GET["post"])) {
|
if(isset($_GET["post"])) {
|
||||||
$postsList = array();
|
$postsList = array();
|
||||||
foreach ($posts as $post) {
|
foreach ($posts as $post) {
|
||||||
@ -38,7 +40,7 @@ class Loop extends Tag {
|
|||||||
$posts = $postsList;
|
$posts = $postsList;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$posts = Post::list($isRecent, $limit);
|
$posts = Post::list($isRecent, $limit, $term);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($tag != -1) {
|
if($tag != -1) {
|
||||||
|
@ -81,6 +81,11 @@ class Tag {
|
|||||||
$head->item(0)->appendChild($t);
|
$head->item(0)->appendChild($t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$title = $dom->getElementsByTagName("title");
|
||||||
|
if($title->count() >= 1) {
|
||||||
|
$title->item(0)->appendChild($dom->createTextnode($_GET["page_title"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$list = $dom->getElementsByTagName("tag");
|
$list = $dom->getElementsByTagName("tag");
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ namespace App\Tags;
|
|||||||
|
|
||||||
use App\Tags\Tag;
|
use App\Tags\Tag;
|
||||||
use App\DB\Post;
|
use App\DB\Post;
|
||||||
|
use App\DB\Tag as AppTag;
|
||||||
|
|
||||||
class Tags extends Tag {
|
class Tags extends Tag {
|
||||||
public function render() {
|
public function render() {
|
||||||
@ -12,12 +13,17 @@ class Tags extends Tag {
|
|||||||
|
|
||||||
$doc = $this->getDoc();
|
$doc = $this->getDoc();
|
||||||
|
|
||||||
$post = Post::get($_GET["post"]);
|
$tags = isset($_GET["post"]) ? Post::get($_GET["post"])->getTags() : AppTag::list();
|
||||||
/** @var \App\DB\Tag $tag */
|
/** @var \App\DB\Tag $tag */
|
||||||
foreach ($post->getTags() as $tag) {
|
foreach ($tags as $tag) {
|
||||||
$res = $doc->createElement("a");
|
$res = $doc->createElement("a");
|
||||||
$res->setAttribute("href", "/search/?tag=" . $tag->getId());
|
$url = "?tag=" . $tag->getId();
|
||||||
$res->setAttribute("class", "tag");
|
if(isset($_GET["term"])) $url .= "&term=" . $_GET["term"];
|
||||||
|
if(isset($_GET["category"])) $url .= "&category=" . $_GET["category"];
|
||||||
|
$res->setAttribute("href", "/search/" . $url);
|
||||||
|
$classes = "tag";
|
||||||
|
if(isset($_GET["tag"]) && $tag->getId() == $_GET["tag"]) $classes .= " active";
|
||||||
|
$res->setAttribute("class", $classes);
|
||||||
$text = $doc->createTextNode($tag->getName());
|
$text = $doc->createTextNode($tag->getName());
|
||||||
$res->appendChild($text);
|
$res->appendChild($text);
|
||||||
$pok->parentNode->insertBefore($res, $pok);
|
$pok->parentNode->insertBefore($res, $pok);
|
||||||
|
@ -5,6 +5,10 @@ namespace App\Tags;
|
|||||||
class User extends Tag {
|
class User extends Tag {
|
||||||
public function render() {
|
public function render() {
|
||||||
$el = $this->getElement();
|
$el = $this->getElement();
|
||||||
if(isset($_SESSION["author"])) $el->parentNode->insertBefore($this->getDoc()->createTextNode($_SESSION["author"]->getId()), $el);
|
if(isset($_SESSION["author"])) {
|
||||||
|
$col = $el->getAttribute("column");
|
||||||
|
$func = "get" . ucfirst($col);
|
||||||
|
$el->parentNode->insertBefore($this->getDoc()->createTextNode($_SESSION["author"]->$func()), $el);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
assets/php/Tags/UserEditor.php
Normal file
15
assets/php/Tags/UserEditor.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Tags;
|
||||||
|
|
||||||
|
use App\DB\Category;
|
||||||
|
use DateTime;
|
||||||
|
use App\DB\Tag;
|
||||||
|
use App\DB\Post;
|
||||||
|
|
||||||
|
|
||||||
|
class UserEditor extends \App\Tags\Tag {
|
||||||
|
public function render() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
36
assets/php/Tags/Users.php
Normal file
36
assets/php/Tags/Users.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Tags;
|
||||||
|
|
||||||
|
use App\DB\Author;
|
||||||
|
|
||||||
|
|
||||||
|
class Users extends Tag {
|
||||||
|
public function render() {
|
||||||
|
$el = $this->getElement();
|
||||||
|
$doc = $this->getDoc();
|
||||||
|
$parent = $el->parentNode;
|
||||||
|
foreach (Author::list(true, 1000) as $user) {
|
||||||
|
$pok = $el->childNodes->item(0)->cloneNode(true);
|
||||||
|
|
||||||
|
$parent->insertBefore($pok, $el);
|
||||||
|
|
||||||
|
$elements = $pok->getElementsByTagName("loop");
|
||||||
|
|
||||||
|
foreach ($elements as $ele) {
|
||||||
|
$col = 'get' . ucfirst($ele->getAttribute("column"));
|
||||||
|
$txt = $doc->createTextNode($user->$col());
|
||||||
|
$ele->parentNode->insertBefore($txt, $ele);
|
||||||
|
}
|
||||||
|
|
||||||
|
$loop = $pok->getElementsByTagName("loop");
|
||||||
|
|
||||||
|
while ($loop->count() >= 1) {
|
||||||
|
$loop->item(0)->parentNode->removeChild($loop->item(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -137,12 +137,17 @@ class Post {
|
|||||||
* @return Post[]
|
* @return Post[]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static function list($recent = true, $limit = 100) {
|
public static function list($recent = true, $limit = 100, $term = "") {
|
||||||
$sort = $recent ? "DESC" : "ASC";
|
$sort = $recent ? "DESC" : "ASC";
|
||||||
$query = "SELECT * FROM posts ORDER BY dt " . $sort . " LIMIT " . $limit;
|
$query = "SELECT * FROM posts WHERE title LIKE :el OR content LIKE :el ORDER BY dt " . $sort . " LIMIT " . $limit;
|
||||||
|
|
||||||
$pdo = Functions::connect();
|
$pdo = Functions::connect();
|
||||||
$posts = $pdo->query($query)->fetchAll();
|
|
||||||
|
$prp = $pdo->prepare($query);
|
||||||
|
$term = "%" . $term . "%";
|
||||||
|
$prp->bindValue(":el", $term);
|
||||||
|
$prp->execute();
|
||||||
|
$posts = $prp->fetchAll();
|
||||||
|
|
||||||
$res = array();
|
$res = array();
|
||||||
|
|
||||||
@ -163,13 +168,22 @@ class Post {
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function listByCategory($categoryId = null, $recent = true, $limit = 100) {
|
public static function listByCategory($categoryId = null, $recent = true, $limit = 100, $el = "") {
|
||||||
$sort = $recent ? "DESC" : "ASC";
|
$sort = $recent ? "DESC" : "ASC";
|
||||||
$cat = $categoryId !== null ? "WHERE category=" . $categoryId : "";
|
$cat = $categoryId !== null ? "AND category=" . $categoryId : "";
|
||||||
$query = "SELECT * FROM posts " . $cat . " ORDER BY dt " . $sort . " LIMIT " . $limit;
|
$query = "SELECT * FROM posts WHERE (title LIKE :el OR content LIKE :el ) " . $cat . " ORDER BY dt " . $sort . " LIMIT " . $limit;
|
||||||
|
|
||||||
$pdo = Functions::connect();
|
$pdo = Functions::connect();
|
||||||
$posts = $pdo->query($query)->fetchAll();
|
|
||||||
|
$prp = $pdo->prepare($query);
|
||||||
|
|
||||||
|
$el = "%" . $el . "%";
|
||||||
|
|
||||||
|
$prp->bindValue(":el", $el);
|
||||||
|
$prp->execute();
|
||||||
|
// var_dump($prp->errorInfo());
|
||||||
|
// die;
|
||||||
|
$posts = $prp->fetchAll();
|
||||||
|
|
||||||
$res = array();
|
$res = array();
|
||||||
|
|
||||||
|
@ -9,9 +9,6 @@
|
|||||||
"email": "florian.bouillon@delta-wings.net"
|
"email": "florian.bouillon@delta-wings.net"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require-dev": {
|
|
||||||
"phpunit/phpunit": "^8"
|
|
||||||
},
|
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": [
|
"classmap": [
|
||||||
"assets/php/"
|
"assets/php/"
|
||||||
|
1489
composer.lock
generated
1489
composer.lock
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user