From c3de69cddceafe3bdbc970d524a9af9c6fa082a5 Mon Sep 17 00:00:00 2001 From: s0dy Date: Mon, 25 Feb 2019 10:43:45 +0100 Subject: [PATCH 1/2] change db user/pass --- bdd_proj.sql | 6 +++--- project/assets/php/functions.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bdd_proj.sql b/bdd_proj.sql index 74895f6..37d5b4e 100755 --- a/bdd_proj.sql +++ b/bdd_proj.sql @@ -12,7 +12,7 @@ CREATE TABLE posts ( url VARCHAR(32), content TEXT, short varchar(256), - dt DATETIME DEFAULT CURRENT_TIMESTAMP, + dt TIMESTAMP DEFAULT CURRENT_TIMESTAMP, categorie INT, author INT ); @@ -83,8 +83,8 @@ FROM post INNER JOIN users BY post.author=user.id LIMIT 1; --- requette 3 : comme la 1 sauf uniquement les 6 posts les plus récents --- requete lancée lors sur la page d'accueil +-- requette 3 : comme la 1 sauf uniquement les 6 posts les plus r�cents +-- requete lanc�e lors sur la page d'accueil SELECT title, categories.name as categorie, dt as date, short as content FROM posts INNER JOIN categories ON categories.id=posts.categorie diff --git a/project/assets/php/functions.php b/project/assets/php/functions.php index 010e838..ff1f516 100755 --- a/project/assets/php/functions.php +++ b/project/assets/php/functions.php @@ -13,8 +13,8 @@ function endsWith($haystack, $needle) { function connect() { $host = "localhost"; $db = "blog"; - $user = "root"; - $pass = "root"; + $user = "blog"; + $pass = "blog"; $charset="utf8mb4"; $dsn = "mysql:host=$host;dbname=$db;charset=$charset"; From 864f71074adaa77312ceb1870956ae2afbb6049d Mon Sep 17 00:00:00 2001 From: Avior Date: Mon, 25 Feb 2019 11:05:17 +0100 Subject: [PATCH 2/2] apprenez l'HTML ! --- project/assets/html/index.html | 8 ++++---- project/assets/php/pages.php | 4 ++-- project/assets/php/tagHandler.php | 16 ---------------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/project/assets/html/index.html b/project/assets/html/index.html index 642da4d..5cbb2fd 100755 --- a/project/assets/html/index.html +++ b/project/assets/html/index.html @@ -12,7 +12,7 @@
-

L'actualité de nos campus...

+

L'actualité de nos campus...

Ceci est un magnifique titre

@@ -30,7 +30,6 @@
-

Articles récents

@@ -49,14 +48,15 @@
-

+

+
diff --git a/project/assets/php/pages.php b/project/assets/php/pages.php index 2199846..69d74fa 100755 --- a/project/assets/php/pages.php +++ b/project/assets/php/pages.php @@ -27,7 +27,7 @@ $search = function () { $router->addRoute("/^\/search\/$/", $search); // route "/search/*" -$post = function() { +$edit = function() { $_POST = array_merge($_POST, $_GET); //debug uniquement var_dump($_POST); /* @@ -78,4 +78,4 @@ $post = function() { $prepared->execute(); }; -$router->addRoute("/^\/post\/" . $postCharacters . "+\/edit\/*$/", $post); +$router->addRoute("/^\/post\/" . $postCharacters . "+\/edit\/*$/", $edit); diff --git a/project/assets/php/tagHandler.php b/project/assets/php/tagHandler.php index adcd024..2821df5 100755 --- a/project/assets/php/tagHandler.php +++ b/project/assets/php/tagHandler.php @@ -273,34 +273,18 @@ function loadTags($ctnt) { $head->item(0)->appendChild($t); } - $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"); }