Merge branch 'master' of gitlab.com:aviortheking/blog_imie

This commit is contained in:
s0dy 2019-02-25 10:44:08 +01:00
commit 803c59d6c9
8 changed files with 124 additions and 83 deletions

View File

@ -26,7 +26,7 @@ RewriteCond %{REQUEST_FILENAME} !-f
# (ex : blog.delta-wings.net/flag?p=5 va devenir de notre coté -> blog.delta-wings.net/assets/php/handler.php?page=flag&p=5) # (ex : blog.delta-wings.net/flag?p=5 va devenir de notre coté -> blog.delta-wings.net/assets/php/handler.php?page=flag&p=5)
RewriteRule ^(.*)$ /assets/php/handler.php?page=$1 [L,QSA] RewriteRule ^(.*)$ /assets/php/handler.php?page=$1 [L,QSA]
# indique unr redirection lorque on obtient une page d'erreur 403 (interdiction d'accès (permet de "cacher" les fichiers critiques)) # indique une redirection lorque on obtient une page d'erreur 403 (interdiction d'accès (permet de "cacher" les fichiers critiques))
# on redirige vars note handler pour qu'il afficher la page 404 # on redirige vars note handler pour qu'il afficher la page 404
ErrorDocument 403 /assets/php/handler.php?page=404 ErrorDocument 403 /assets/php/handler.php?page=404
@ -70,25 +70,25 @@ Options All -Indexes
# si le serveur apache a le module mod_deflate.c # si le serveur apache a le module mod_deflate.c
# on va indiquer que le serveur prend en charge a compression GZIP (compression pour les photos (gif, jpeg, png)) # on va indiquer que le serveur prend en charge a compression GZIP (compression pour les photos (gif, jpeg, png))
<IfModule mod_deflate.c> <IfModule mod_deflate.c>
SetOutputFilter DEFLATE SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \ SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary \.(?:gif|jpe?g|png)$ no-gzip dont-vary
</IfModule> </IfModule>
# si le module mod_expires.c existe # si le module mod_expires.c existe
# on donne un temps de mise en cache navigateur au fichiers si dessous # on donne un temps de mise en cache navigateur au fichiers si dessous
<IfModule mod_expires.c> <IfModule mod_expires.c>
ExpiresActive on ExpiresActive on
ExpiresByType image/jpg "access 2 month" ExpiresByType image/jpg "access 2 month"
ExpiresByType image/gif "access 2 month" ExpiresByType image/gif "access 2 month"
ExpiresByType image/jpeg "access 2 month" ExpiresByType image/jpeg "access 2 month"
ExpiresByType image/png "access 2 month" ExpiresByType image/png "access 2 month"
ExpiresByType text/css "access 2 month" ExpiresByType text/css "access 2 month"
ExpiresByType application/x-javascript "access plus 2 month" ExpiresByType application/x-javascript "access plus 2 month"
ExpiresByType text/javascript "access plus 2 month" ExpiresByType text/javascript "access plus 2 month"
ExpiresByType application/javascript "access plus 2 month" ExpiresByType application/javascript "access plus 2 month"
ExpiresByType image/x-icon "access plus 12 month" ExpiresByType image/x-icon "access plus 12 month"
ExpiresByType image/icon "access plus 12 month" ExpiresByType image/icon "access plus 12 month"
ExpiresByType application/x-ico "access plus 12 month" ExpiresByType application/x-ico "access plus 12 month"
ExpiresByType application/ico "access plus 12 month" ExpiresByType application/ico "access plus 12 month"
</IfModule> </IfModule>

View File

@ -98,21 +98,28 @@ h2{
.item_nav_imie a{ .item_nav_imie a{
text-decoration: none; text-decoration: none;
color: white; color: white;
-webkit-transition: 400ms;
-o-transition: 400ms;
transition: 400ms;
} }
.item_nav_imie a:hover{ .item_nav_imie a:hover{
color: #6e6e6e; color: #a5a5a5;
} }
.item_nav_imie{ .item_nav_imie{
display: inline-block; display: inline-block;
padding-left: 20px;
padding-top: 10px;
color: white; color: white;
float: right; float: right;
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
} }
.social{
padding: 11px 0px 0px 20px;
}
.link{
padding: 9px 0px 0px 20px;
}
.item_nav_blog_gauche{ .item_nav_blog_gauche{
padding-top:25px; padding-top:25px;
@ -130,13 +137,13 @@ h2{
display: inline-block; display: inline-block;
float: right; float: right;
font-weight: bold; font-weight: bold;
-webkit-transition: 400ms;
-o-transition: 400ms;
transition: 400ms;
} }
.item_nav_blog_droite:hover{ .item_nav_blog_droite:hover{
cursor: pointer; cursor: pointer;
-webkit-transition: 400ms;
-o-transition: 400ms;
transition: 400ms;
} }
.item_nav_blog_droite.dev:hover{ .item_nav_blog_droite.dev:hover{
@ -188,8 +195,7 @@ h2{
color: white; color: white;
} }
.test2{ .test2{
padding-left: 27px; padding: 0px 90px;
padding-right: 27px;
margin-top: 100px; margin-top: 100px;
text-align: center; text-align: center;
} }
@ -208,6 +214,10 @@ h2{
background-color: #190034; background-color: #190034;
padding: 10px 15px; padding: 10px 15px;
color: white; color: white;
-webkit-transition: 300ms;
-o-transition: 300ms;
transition: 300ms;
} }
.bloc-plus:hover{ .bloc-plus:hover{
background-color: #42027e; background-color: #42027e;

View File

@ -5,11 +5,11 @@
<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" ><a>Connexion</a></li> <li class="item_nav_imie link" ><a>Connexion</a></li>
<li class="item_nav_imie" ><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" ><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" ><a href="https://twitter.com/EcoleIMIE"><tag type="svg" file="twitter" style="color: white; width: 18px; height: 18px"/></a></li> <li class="item_nav_imie social" ><a href="https://twitter.com/EcoleIMIE"><tag type="svg" file="twitter" style="color: white; width: 18px; height: 18px"/></a></li>
<li class="item_nav_imie" ><a href="https://www.facebook.com/EcolesIMIE/"><tag type="svg" file="facebook" style="color: white; width: 18px; height: 18px"/></a></li> <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>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -11,7 +11,7 @@ function endsWith($haystack, $needle) {
} }
function connect() { function connect() {
$host = "localhost"; $host = "127.0.0.1";
$db = "blog"; $db = "blog";
$user = "blog"; $user = "blog";
$pass = "blog"; $pass = "blog";
@ -25,7 +25,3 @@ function connect() {
} }
return $pdo; return $pdo;
} }
function getBDD() {
}

View File

@ -1,5 +1,7 @@
<?php <?php
require_once "functions.php"; require_once "functions.php";
error_reporting(E_ALL);
ini_set('display_errors', 'On'); ini_set('display_errors', 'On');
//renvoie vers le fichier css si il est demandé //renvoie vers le fichier css si il est demandé

View File

@ -28,7 +28,54 @@ $search = function () {
$router->addRoute("/^\/search\/$/", $search); // route "/search/*" $router->addRoute("/^\/search\/$/", $search); // route "/search/*"
$post = function() { $post = function() {
var_dump("tst"); $_POST = array_merge($_POST, $_GET); //debug uniquement
var_dump($_POST);
/*
$_POST should contain
post :
id
title
content
category
author
UPDATE posts
SET
title = title,
url = strtolower(preg_replace(["/\ /", '/[\'\/~`\!@#\$%\^&\*\(\)\+=\{\}\[\]\|;:"\<\>,\.\?\\\]/'], ["_", ""], title));
content = content,
short = substr(content, 0, 253) . "...";
category = categoryId
author = authorId
WHERE id = id
*/
require_once "functions.php";
$request = "UPDATE posts SET `title`=:title, `url`=:url, `content`=:content, `short`=:short, `category`=:category, `author`=:author, WHERE `id`=:id";
$title = $_POST["title"];
$url = strtolower(preg_replace(["/\ /", '/[\'\/~`\!@#\$%\^&\*\(\)\+=\{\}\[\]\|;:"\<\>,\.\?\\\]/'], ["_", ""], $title));
$content = $_POST["content"];
$short = substr($content, 0, 253) . "...";
$category = intval($_POST["category"]);
$author = intval($_POST["author"]);
$id = intval($_POST["id"]);
$pdo = connect();
$prepared = $pdo->prepare($request);
$prepared->bindParam(":title", $title);
$prepared->bindParam(":url", $url);
$prepared->bindParam(":content", $content);
$prepared->bindParam(":short", $short);
$prepared->bindParam(":category", $category, PDO::PARAM_INT);
$prepared->bindParam(":author", $author, PDO::PARAM_INT);
$prepared->bindParam(":id", $id, PDO::PARAM_INT);
$prepared->execute();
}; };
$router->addRoute("/^\/post\/" . $postCharacters . "+\/edit\/*$/", $post); $router->addRoute("/^\/post\/" . $postCharacters . "+\/edit\/*$/", $post);

View File

@ -266,41 +266,43 @@ function loadTags($ctnt) {
$head = $dom->getElementsByTagName("head"); $head = $dom->getElementsByTagName("head");
$t = $dom->createDocumentFragment(); if($head->count() >= 1) {
$p = file_get_contents("../html/includes/head.html"); $t = $dom->createDocumentFragment();
$t->appendXML($p); $p = file_get_contents("../html/includes/head.html");
$head->item(0)->appendChild($t); $t->appendXML($p);
$head->item(0)->appendChild($t);
}
$test = array(); $test = array();
$list = $dom->getElementsByTagName("tag");
//charge et supprimme les tags
while($lst = $list->item(0)) {
$tgs = ucfirst($lst->getAttribute("type"));
array_push($test, $tgs);
$tg = new $tgs($dom, $lst, false);
$tg->render();
// var_dump("--------- 1 ---------");
// for ($i=0; $i < $list->count(); $i++) {
// var_dump($list->item($i)->getAttribute("type"));
// }
// echo (htmlspecialchars($dom->saveHTML()));
// var_dump($list[0]->parentNode->nodeName);
$lst->parentNode->removeChild($lst);
// var_dump("--------- 2 ---------");
// for ($i=0; $i < $list->count(); $i++) {
// var_dump($list->item($i)->getAttribute("type"));
// }
// echo (htmlspecialchars($dom->saveHTML()));
$list = $dom->getElementsByTagName("tag"); $list = $dom->getElementsByTagName("tag");
}
//charge et supprimme les tags
while($lst = $list->item(0)) {
$tgs = ucfirst($lst->getAttribute("type"));
array_push($test, $tgs);
$tg = new $tgs($dom, $lst, false);
$tg->render();
// var_dump("--------- 1 ---------");
// for ($i=0; $i < $list->count(); $i++) {
// var_dump($list->item($i)->getAttribute("type"));
// }
// echo (htmlspecialchars($dom->saveHTML()));
// var_dump($list[0]->parentNode->nodeName);
$lst->parentNode->removeChild($lst);
// var_dump("--------- 2 ---------");
// for ($i=0; $i < $list->count(); $i++) {
// var_dump($list->item($i)->getAttribute("type"));
// }
// echo (htmlspecialchars($dom->saveHTML()));
$list = $dom->getElementsByTagName("tag");
}
$res = $dom->saveHTML(); $res = $dom->saveHTML();

View File

@ -1,16 +0,0 @@
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once "assets/php/functions.php";
$host = "localhost";
$db = "blog";
$user = "blog";
$pass = "blog";
$charset="utf8mb4";
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
$pdo = new PDO($dsn, $user, $pass, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
echo "pokemon";
?>