mirror of
https://github.com/Aviortheking/Blog_IMIE.git
synced 2025-06-13 10:39:19 +00:00
changes
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
require_once "functions.php";
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 'On');
|
||||
|
||||
//renvoie vers le fichier css si il est demand<6E>
|
||||
|
@ -28,7 +28,54 @@ $search = function () {
|
||||
$router->addRoute("/^\/search\/$/", $search); // route "/search/*"
|
||||
|
||||
$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);
|
||||
|
@ -266,41 +266,43 @@ function loadTags($ctnt) {
|
||||
|
||||
|
||||
$head = $dom->getElementsByTagName("head");
|
||||
$t = $dom->createDocumentFragment();
|
||||
$p = file_get_contents("../html/includes/head.html");
|
||||
$t->appendXML($p);
|
||||
$head->item(0)->appendChild($t);
|
||||
if($head->count() >= 1) {
|
||||
$t = $dom->createDocumentFragment();
|
||||
$p = file_get_contents("../html/includes/head.html");
|
||||
$t->appendXML($p);
|
||||
$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");
|
||||
}
|
||||
|
||||
//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();
|
||||
|
||||
|
Reference in New Issue
Block a user