il n'y a pas eu de leak de mot de passe ici ;)

This commit is contained in:
2019-01-28 16:25:30 +01:00
parent e2f71dd59b
commit 7a8dcd2da1
30 changed files with 254 additions and 285 deletions

40
project/assets/css/style.css Normal file → Executable file
View File

@ -63,14 +63,9 @@ h2{
font-weight: 600;
font-size: 17px;
}
<<<<<<< HEAD
.test{
height: 300vh;
=======
.contenue{
height: 285vh;
>>>>>>> 5029010f15d22427dc323fafc747a1a08afbeb77
}
.articleHome{
margin: auto;
@ -193,7 +188,7 @@ h2{
.bloc-plus{
margin-top: 40px;
float: right;
background-color: #190034;;
background-color: #190034;
padding: 10px 15px;
color: white;
}
@ -327,21 +322,44 @@ input {outline: none}
}
.fullFooter{
font-family: 'Open Sans', sans-serif;
width: 100%;
height: 220px;
background-color: grey;
background-color: #190034;
font-weight: bold;
}
.iconFooter{
.upFooter{
height: 160px;
background-color: lightgray;
background-color: #42027e;
text-align: center;
}
.lowFooter{
text-align: center;
}
.lowFooterItem{
font-size:16px;
color: white;
padding-top:22px;
display: inline-block;
margin-right:15px;
}
.iconOnFooter{
padding-top:125px;
padding-top:60px;
display: inline-block;
color: black;
}
.pad{
padding:0;
}
.phraseFooter{
font-size: 18px;
padding-top:10px;
color: white;
}
#twi{
height: 18px;
width: 18px;

0
project/assets/font/blod.otf Normal file → Executable file
View File

0
project/assets/font/roman.otf Normal file → Executable file
View File

0
project/assets/html/404.html Normal file → Executable file
View File

17
project/assets/html/includes/footer.html Normal file → Executable file
View File

@ -1,15 +1,24 @@
<footer>
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="col-12 pad">
<div class="fullFooter">
<div class="iconFooter">
<div class="upFooter">
<ul>
<li class="iconOnFooter"><a><tag type="svg" file="twitter" style="color: white; width: 18px; height: 18px"/></a></li>
<li class="iconOnFooter"><a><tag type="svg" file="facebook" style="color: white; width: 18px; height: 18px"/></a></li>
<li class="iconOnFooter"><a><tag type="svg" file="twitter" style="color: white; width: 18px; height: 18px"/></a></li>
</ul>
<p class="phraseFooter">Suivez-nous sur les réxseaux</p>
</div>
<div class="lowFooter">
<ul>
<li class="lowFooterItem">Politique et confidentialité</li>
<li class="lowFooterItem">Mentions légales</li>
<li class="lowFooterItem">Contact</li>
<li class="lowFooterItem">Connexion</li>
</ul>
</div>
</dwhite
</div>
</div>
</div>
</div>

14
project/assets/html/includes/head.html Normal file → Executable file
View File

@ -1,8 +1,6 @@
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Page Title</title>
<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" type="text/css" media="screen" href="/assets/css/style.css"/>
</head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Page Title</title>
<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" type="text/css" media="screen" href="/assets/css/style.css"/>

4
project/assets/html/includes/header.html Normal file → Executable file
View File

@ -6,8 +6,8 @@
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<ul>
<li class="item_nav_imie" ><a>Connexion</a></li>
<li class="item_nav_imie" ><a>Acc<EFBFBD>s Net-Ypar<EFBFBD>o</a></li>
<li class="item_nav_imie" ><a>IMIE Num<EFBFBD>rique</a></li>
<li class="item_nav_imie" ><a>Accès Net-Yparéo</a></li>
<li class="item_nav_imie" ><a>IMIE Numérique</a></li>
<li class="item_nav_imie" ><a><tag type="svg" file="twitter" style="color: white; width: 18px; height: 18px"/></a></li>
<li class="item_nav_imie" ><a><tag type="svg" file="facebook" style="color: white; width: 18px; height: 18px"/></a></li>
</ul>

198
project/assets/html/index.html Normal file → Executable file
View File

@ -1,145 +1,65 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<header>
<tag type="includes" file="header" />
</header>
<main class="contenue container">
<div class="bloc_principal">
<div class="cover-black">
<div class="bloc_principal_titre">
<h1>L'actualité de nos campus...</h1>
</div>
<div class="articleHome">
<h2 id="titre-home">Ceci est un magnifique titre</h2>
<p class="p-home">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed
do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit
in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<div class="bloc-plus">
En savoir plus
</div>
</div>
</div>
</div>
</div>
<h3 id="titre-between">Articles récents</h3>
<div class="row articles">
<div class="col-12 col-md-6 col-lg-4">
<div class="article dev">
<h4 class="title">Mettre en place un serveur web sous linux</h4>
<div class="etiquettes">
<span class="cat">
DEV
</span>
<span class="date">
26-06-2018
</span>
</div>
<p class="text">
Dum apud Persas, ut supra narravimus, perfidia regis motus agitat insperatos,
et in eois tractibus bella rediviva consurgunt, anno sexto decimo et eo diutius
post Nepotiani exitium, saeviens per urbem aeternam urebat cuncta Bellona, ex primordiis
</p>
</div>
</div>
<div class="col-12 col-md-6 col-lg-4">
<div class="article digi">
<h4 class="title">Mettre en place un serveur web sous linux</h4>
<div class="etiquettes">
<span class="cat">
DIGI
</span>
<span class="date">
26-06-2018
</span>
</div>
<p class="text">Dum apud Persas, ut supra narravimus, perfidia regis motus agitat insperatos,
et in eois tractibus bella rediviva consurgunt, anno sexto decimo et eo diutius
post Nepotiani exitium, saeviens per urbem aeternam urebat cuncta Bellona, ex primordiis
</p>
</div>
</div>
<div class="col-12 col-md-6 col-lg-4">
<div class="article ops">
<h4 class="title">Mettre en place un serveur web sous linux</h4>
<div class="etiquettes">
<span class="cat">
OPS
</span>
<span class="date">
26-06-2018
</span>
</div>
<p class="text">Dum apud Persas, ut supra narravimus, perfidia regis motus agitat insperatos,
et in eois tractibus bella rediviva consurgunt, anno sexto decimo et eo diutius
post Nepotiani exitium, saeviens per urbem aeternam urebat cuncta Bellona, ex primordiis
</p>
</div>
</div>
<div class="col-12 col-md-6 col-lg-4">
<div class="article ops">
<h4 class="title">Mettre en place un serveur web sous linux</h4>
<div class="etiquettes">
<span class="cat">
OPS
</span>
<span class="date">
26-06-2018
</span>
</div>
<p class="text">Dum apud Persas, ut supra narravimus, perfidia regis motus agitat insperatos,
et in eois tractibus bella rediviva consurgunt, anno sexto decimo et eo diutius
post Nepotiani exitium, saeviens per urbem aeternam urebat cuncta Bellona, ex primordiis
</p>
</div>
</div>
<div class="col-12 col-md-6 col-lg-4">
<div class="article devops">
<h4 class="title">Mettre en place un serveur web sous linux</h4>
<div class="etiquettes">
<span class="cat">
DEVOPS
</span>
<span class="date">
26-06-2018
</span>
</div>
<p class="text">Dum apud Persas, ut supra narravimus, perfidia regis motus agitat insperatos,
et in eois tractibus bella rediviva consurgunt, anno sexto decimo et eo diutius
post Nepotiani exitium, saeviens per urbem aeternam urebat cuncta Bellona, ex primordiis
</p>
</div>
</div>
<html lang="fr">
<div class="col-12 col-md-6 col-lg-4">
<div class="article ops">
<h4 class="title">Mettre en place un serveur web sous linux</h4>
<div class="etiquettes">
<span class="cat">
OPS
</span>
<span class="date">
26-06-2018
</span>
</div>
<p class="text">Dum apud Persas, ut supra narravimus, perfidia regis motus agitat insperatos,
et in eois tractibus bella rediviva consurgunt, anno sexto decimo et eo diutius
post Nepotiani exitium, saeviens per urbem aeternam urebat cuncta Bellona, ex primordiis
</p>
<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>L'actualité de nos campus...</h1>
</div>
<div class="test2">
<h2 id="titre-home">Ceci est un magnifique titre</h2>
<p class="p-home">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed
do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit
in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<div class="bloc-plus">
En savoir plus
</div>
</div>
</div>
</main>
<footer>
<tag type="includes" file="footer" />
</footer>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</div>
</div>
<h3 id="titre-between">Articles récents</h3>
<div class="row articles">
<tag type="loop" for="posts" limit="6">
<div class="col-12 col-md-6 col-lg-4">
<div class="article column-categorie">
<h4 class="title">
<loop column="title" />
</h4>
<div class="etiquettes">
<span class="cat">
<loop column="categorie" />
</span>
<span class="date">
<loop column="date" />
</span>
</div>
<div class="text">
<loop column="content" />
</p>
</div>
</div>
</tag>
</div>
</main>
<footer>
<tag type="includes" file="footer" />
</footer>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
</body>
</html>

0
project/assets/html/post.html Normal file → Executable file
View File

0
project/assets/html/search.html Normal file → Executable file
View File

0
project/assets/img/facebook.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 376 B

After

Width:  |  Height:  |  Size: 376 B

0
project/assets/img/img-home.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 931 KiB

After

Width:  |  Height:  |  Size: 931 KiB

2
project/assets/img/logo-imie-blog.svg Normal file → Executable file
View File

@ -1,4 +1,4 @@
<svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 738.1 233.6" style="enable-background:new 0 0 738.1 233.6;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

2
project/assets/img/mignify.svg Normal file → Executable file
View File

@ -1,4 +1,4 @@
<svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}

Before

Width:  |  Height:  |  Size: 648 B

After

Width:  |  Height:  |  Size: 634 B

0
project/assets/img/search-solid.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 559 B

After

Width:  |  Height:  |  Size: 559 B

0
project/assets/img/twitter.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1007 B

After

Width:  |  Height:  |  Size: 1007 B

0
project/assets/js/script.js Normal file → Executable file
View File

20
project/assets/php/functions.php Normal file → Executable file
View File

@ -9,3 +9,23 @@ function endsWith($haystack, $needle) {
return (substr($haystack, -$length) === $needle);
}
function connect() {
$host = "127.0.0.1";
$db = "blog";
$user = "username";
$pass = "motdepasse";
$charset="utf8mb4";
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
try {
$pdo = new PDO($dsn, $user, $pass);
} catch (\PDOException $e) {
throw new \PDOException($e->getMessage(), (int)$e->getCode());
}
return $pdo;
}
function getBDD() {
}

View File

@ -2,13 +2,13 @@
require_once "functions.php";
ini_set('display_errors', 'On');
//renvoie vers le fichier css si il est demand<6E>
//renvoie vers le fichier css si il est demand<6E>
if(endsWith($_GET["page"], ".css")) {
echo file_get_contents("../css/style.css");
die;
}
//renvoie vers le fichier js si demand<6E>
//renvoie vers le fichier js si demand<6E>
if(endsWith($_GET["page"], ".js")) {
echo file_get_contents("../js/script.js");
die;
@ -22,10 +22,10 @@ if($_GET["page"] != "" && !endsWith($_GET["page"], "/") && sizeof($_GET) <= 1) {
die;
}
//enleve les / du d<>but & fin
//enleve les / du d<>but & fin
$_GET['page'] = trim($_GET['page'], '/');
// si taille sup<75>rieur <20> 1 $_getpost = element
// si taille sup<75>rieur <20> 1 $_getpost = element
if(sizeof(explode("/", $_GET["page"])) > 1) {
$_GET["post"] = explode("/", $_GET["page"])[1];
}
@ -42,13 +42,14 @@ if(strlen($_GET['page']) > 1) {
//page de test pour des functions
// A ENLEVER LORS DES COMMITS DE FIN
if($_GET["page"] == "test") {
// var_dump($_GET);
if($_GET["page"] == "/test/") {
include_once "test.php";
die;
}
/**
* D<>marrage du routage du contenu
* D<>marrage du routage du contenu
*/
include_once "router.php";
@ -60,7 +61,4 @@ include_once "pages.php";
include_once "tagHandler.php";
$pokemon = loadTags($router->search($_GET["page"])(), false);
//TODO trouver pourquoi il y a un pb avec l'UTF-8
//(actuellement forcer des compiler en "Windows 1252")
$pokemon = htmlspecialchars_decode($pokemon, ENT_HTML5);
echo $pokemon;

2
project/assets/php/pages.php Normal file → Executable file
View File

@ -1,7 +1,7 @@
<?php
include_once "router.php";
//recup<EFBFBD>ration du router
//recupération du router
$router = Router::getRouter();
//page d'accueil

4
project/assets/php/router.php Normal file → Executable file
View File

@ -12,11 +12,11 @@ class Router {
//definit le router
public function __construct() {
//TODO faire que si un router existe daj<EFBFBD> retourner le routeur existant
//TODO faire que si un router existe déjà retourner le routeur existant
Router::$router = $this;
}
//fonction static pour recuperer un router d<EFBFBD>j<EFBFBD> cr<EFBFBD><EFBFBD>
//fonction static pour recuperer un router déjà crée
public static function getRouter() {
return Router::$router;
}

77
project/assets/php/tagHandler.php Normal file → Executable file
View File

@ -35,7 +35,7 @@ class Bold extends Tag {
public function render() {
//recuperation de la balise de base (<tag type="bold">pouet</tag>)
$pok = $this->getDOM();
//recuperation du document (necessaire a la cr<63>ation de balises
//recuperation du document (necessaire a la cr<63>ation de balises
$doc = $this->getDoc();
//creation de la balise "span"
$res = $doc->createElement("span");
@ -150,6 +150,7 @@ class Includes extends Tag {
// var_dump($attr);
// var_dump(file_get_contents("../html/includes/".$attr.".html"));
$p = file_get_contents("../html/includes/".$attr.".html");
// var_dump($p);
appendHTML($el->parentNode, $p);
$el->setAttribute("style", $el->getAttribute("style"));
@ -171,7 +172,10 @@ class Svg extends Tag {
}
/**
* input <tag type="loop" for="(table)" limit="(nombre-max g<>n<EFBFBD>r<EFBFBD>)" />
* input
* <tag type="loop" for="(table)" limit="(nombre-max g<>n<EFBFBD>r<EFBFBD>)">
* <loop column="element"/>
* </tag>
* return something
*/
class Loop extends Tag {
@ -182,59 +186,40 @@ class Loop extends Tag {
$limit = (int) $el->getAttribute("limit");
//testing purpose variable
$posts = array(
array(
'title'=> "a",
'url'=> "e",
'content'=> "<p>i</p>",
'date'=> "2018-09-20"
),
array(
'title'=> "b",
'url'=> "f",
'content'=> "<p>j</p>",
'date'=> "2018-09-21"
),
array(
'title'=> "c",
'url'=> "g",
'content'=> "<p>k</p>",
'date'=> "2018-09-22"
),
array(
'title'=> "d",
'url'=> "h",
'content'=> "<p>l</p>",
'date'=> "2018-09-23"
),
array(
'title'=> "z",
'url'=> "z",
'content'=> "<p>z</p>",
'date'=> "2018-10-23"
),
);
require_once 'functions.php';
//if($limit == 0) $limit = count($posts);
$pdo = connect();
$query = $pdo->query("SELECT title, categories.name as categorie, dt as date, short as content
FROM posts
INNER JOIN categories ON categories.id=posts.categorie
ORDER BY date DESC
LIMIT 6;");
$posts = $query->fetchAll();
$parent = $el->parentNode;
//var_dump($parent);
for ($i=0; $i < $limit; $i++) {
//var_dump($i);
$pok = $el->childNodes->item(1)->cloneNode(true);
$pok = $el->childNodes->item(0)->cloneNode(true);
$parent->insertBefore($pok, $el);
$elements = $pok->getElementsByTagName("loop");
foreach ($elements as $ele) {
if($ele->getAttribute("column") == "content") {
appendHTML($ele, $posts[$i][$ele->getAttribute("column")]);
appendHTML($ele->parentNode, $posts[$i]["content"]);
} else {
$txt = $doc->createTextNode($posts[$i][$ele->getAttribute("column")]);
$ele->parentNode->insertBefore($txt, $ele);
}
}
$finder = new DomXPath($doc);
$nodes = $finder->query("//*[contains(@class, 'column-cat')]");
// var_dump($nodes);
if(sizeof($nodes) >= 1) $nodes[0]->setAttribute("class", str_replace("column-categorie", $posts[$i]["categorie"], $nodes[0]->getAttribute("class")));
}
$loop = $parent->getElementsByTagName("loop");
@ -251,7 +236,13 @@ function appendHTML(DOMNode $parent, $source) {
$html = "<html><body>";
$html .= $source;
$html .= "</body></html>";
$tmpDoc->loadHTML($html);
$tmpDoc->loadHTML('<?xml encoding="UTF-8">'.$html);
foreach ($tmpDoc->childNodes as $item)
if ($item->nodeType == XML_PI_NODE)
$tmpDoc->removeChild($item);
$tmpDoc->encoding = 'UTF-8';
foreach ($tmpDoc->getElementsByTagName('body')->item(0)->childNodes as $node) {
$importedNode = $parent->ownerDocument->importNode($node, true);
$parent->appendChild($importedNode);
@ -262,9 +253,15 @@ function appendHTML(DOMNode $parent, $source) {
function loadTags($ctnt) {
$dom = new DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML($ctnt);
$dom->loadHTML('<?xml encoding="UTF-8">'.$ctnt);
libxml_clear_errors();
// fix UTF-8 problem
foreach ($dom->childNodes as $item)
if ($item->nodeType == XML_PI_NODE)
$dom->removeChild($item);
$dom->encoding = 'UTF-8';
$list = $dom->getElementsByTagName("tag");
$head = $dom->getElementsByTagName("head");

View File

@ -1,57 +1,11 @@
<?php
var_dump($_POST);
$target_dir = dirname(__FILE__, 3) . "/uploads/".date("Y")."/".date("m")."/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
if(isset($_POST["upload"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
include_once "functions.php";
$pdo = connect();
$query = $pdo->query("SELECT title, categorie, dt as date, short as content
FROM posts
ORDER BY date DESC
LIMIT 6");
while($row = $query->fetch()) {
echo $row["title"];
}
// Check if file already exists
if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if(!is_dir($target_dir)) {
mkdir($target_dir, 0777, true);
}
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file ". basename($_FILES["fileToUpload"]["name"]). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
}
?>
<form action="/test/" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="i-play-pokemon-go-everyday" name="upload">
</form>
// var_dump(connect());