mirror of
https://github.com/Aviortheking/Blog_IMIE.git
synced 2025-06-15 03:29:19 +00:00
plein de modifs :O
This commit is contained in:
@ -17,58 +17,12 @@ class HomeController extends Controller {
|
||||
}
|
||||
|
||||
/**
|
||||
* @route /^\/post\/new\/*$/
|
||||
*/
|
||||
public function postAdd() {
|
||||
|
||||
// var_dump($_SESSION["author"]);
|
||||
// die;
|
||||
|
||||
if(isset($_GET["title"]) && isset($_GET["category"]) && isset($_GET["content"]) && isset($_GET["tags"])) {
|
||||
$post = new Post();
|
||||
|
||||
$post->setTitle($_GET["title"]);
|
||||
$post->setContent($_GET["content"]);
|
||||
$post->setCategory($_GET["category"]);
|
||||
// $post->setAuthor();
|
||||
$tags = explode(",", $_GET["tags"]);
|
||||
$tgs = array();
|
||||
foreach ($tags as $tag) {
|
||||
$new_tag = explode(":", $tag);
|
||||
if(count($new_tag) > 1) {
|
||||
$t = new Tag();
|
||||
$t->setName($new_tag[1]);
|
||||
$tgs[] = Tag::add($t)->getId();
|
||||
} else {
|
||||
$tgs[] = $tag;
|
||||
}
|
||||
}
|
||||
$post->setTags($tgs);
|
||||
$post->setAuthor($_SESSION["author"]->getId());
|
||||
Post::add($post);
|
||||
}
|
||||
|
||||
return file_get_contents(DIR."/html/post_new.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* @route /^\/post\/[a-z0-9]+\/$/
|
||||
* @route /^\/post\/[0-9]+\/$/
|
||||
*/
|
||||
public function post() {
|
||||
return file_get_contents(DIR."/html/post.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* @route /^\/post\/[a-z0-9]+\/edit\/$/
|
||||
*/
|
||||
public function postEdit() {
|
||||
return file_get_contents(DIR."/html/post_edit.html");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @route /^\/search\//
|
||||
*/
|
||||
|
Reference in New Issue
Block a user