mirror of
https://github.com/Aviortheking/Blog_IMIE.git
synced 2025-04-22 10:52:09 +00:00
sdf
This commit is contained in:
parent
2fbb783f60
commit
1c278c681c
@ -103,8 +103,11 @@ var submit = () => {
|
|||||||
http.onreadystatechange = function() {//Call a function when the state changes.
|
http.onreadystatechange = function() {//Call a function when the state changes.
|
||||||
if(http.readyState == 4 && http.status == 200) {
|
if(http.readyState == 4 && http.status == 200) {
|
||||||
// document.write(http.responseText);
|
// document.write(http.responseText);
|
||||||
let href = window.location.href.replace("edit/", "");
|
let href = window.location.href;
|
||||||
href.replace("new/", "");
|
href = href.split("/");
|
||||||
|
href.pop();
|
||||||
|
href.pop();
|
||||||
|
href = href.join("/");
|
||||||
window.location = href;
|
window.location = href;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,16 @@ use App\DB\Tag;
|
|||||||
|
|
||||||
|
|
||||||
class PostController extends Controller {
|
class PostController extends Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @route /^\/post\/$/
|
||||||
|
* @title Modification d'article
|
||||||
|
*/
|
||||||
|
public function blog() {
|
||||||
|
header("Location: /post/".Post::list(true, 1)[0]->getId() . "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @route /^\/post\/[0-9]+\/edit\/$/
|
* @route /^\/post\/[0-9]+\/edit\/$/
|
||||||
* @editor
|
* @editor
|
||||||
@ -45,7 +55,7 @@ class PostController extends Controller {
|
|||||||
* @title Ajout d'Article
|
* @title Ajout d'Article
|
||||||
*/
|
*/
|
||||||
public function postAdd() {
|
public function postAdd() {
|
||||||
|
var_dump($_POST);
|
||||||
if(isset($_POST["title"]) && isset($_POST["category"]) && isset($_POST["content"]) && isset($_POST["tags"])) {
|
if(isset($_POST["title"]) && isset($_POST["category"]) && isset($_POST["content"]) && isset($_POST["tags"])) {
|
||||||
$post = new Post();
|
$post = new Post();
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ class Post {
|
|||||||
|
|
||||||
public static function list($recent = true, $limit = 100, $term = "") {
|
public static function list($recent = true, $limit = 100, $term = "") {
|
||||||
$sort = $recent ? "DESC" : "ASC";
|
$sort = $recent ? "DESC" : "ASC";
|
||||||
$query = "SELECT * FROM posts WHERE title LIKE :el OR content LIKE :el ORDER BY dt " . $sort . " LIMIT " . $limit;
|
$query = "SELECT * FROM posts WHERE title LIKE :el OR content LIKE :el ORDER BY id " . $sort . " LIMIT " . $limit;
|
||||||
|
|
||||||
$pdo = Functions::connect();
|
$pdo = Functions::connect();
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ class Post {
|
|||||||
public static function listByCategory($categoryId = null, $recent = true, $limit = 100, $el = "") {
|
public static function listByCategory($categoryId = null, $recent = true, $limit = 100, $el = "") {
|
||||||
$sort = $recent ? "DESC" : "ASC";
|
$sort = $recent ? "DESC" : "ASC";
|
||||||
$cat = $categoryId !== null ? "AND category=" . $categoryId : "";
|
$cat = $categoryId !== null ? "AND category=" . $categoryId : "";
|
||||||
$query = "SELECT * FROM posts WHERE (title LIKE :el OR content LIKE :el ) " . $cat . " ORDER BY dt " . $sort . " LIMIT " . $limit;
|
$query = "SELECT * FROM posts WHERE (title LIKE :el OR content LIKE :el ) " . $cat . " ORDER BY id " . $sort . " LIMIT " . $limit;
|
||||||
|
|
||||||
$pdo = Functions::connect();
|
$pdo = Functions::connect();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user