mirror of
https://github.com/Aviortheking/Blog_IMIE.git
synced 2025-06-15 03:29:19 +00:00
pouet
This commit is contained in:
@ -11,20 +11,16 @@ class HomeController extends Controller {
|
||||
|
||||
/**
|
||||
* @route /^\/$/
|
||||
* @title Accueil
|
||||
*/
|
||||
public function home() {
|
||||
return file_get_contents(DIR."/html/index.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* @route /^\/post\/[0-9]+\/$/
|
||||
*/
|
||||
public function post() {
|
||||
return file_get_contents(DIR."/html/post.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* @route /^\/search\//
|
||||
* @title Rechercher
|
||||
*/
|
||||
public function search() {
|
||||
return file_get_contents(DIR."/html/search.html");
|
||||
|
@ -11,6 +11,7 @@ class LoginController extends Controller {
|
||||
|
||||
/**
|
||||
* @route /^\/login\/$/
|
||||
* @title Login
|
||||
*/
|
||||
public function login() {
|
||||
|
||||
@ -38,6 +39,7 @@ class LoginController extends Controller {
|
||||
|
||||
/**
|
||||
* @route /^\/register\/$/
|
||||
* @title Register
|
||||
*/
|
||||
public function register() {
|
||||
if(isset($_POST["password"]) && isset($_POST["username"]) && Author::getByUsername($_POST["username"]) === null) {
|
||||
|
@ -7,10 +7,11 @@ use App\DB\Post;
|
||||
use App\DB\Tag;
|
||||
|
||||
|
||||
class AddEditController extends Controller {
|
||||
class PostController extends Controller {
|
||||
/**
|
||||
* @route /^\/post\/[0-9]+\/edit\/$/
|
||||
* @editor
|
||||
* @title Modification d'article
|
||||
*/
|
||||
public function postEdit() {
|
||||
if(isset($_GET["post"]) && isset($_GET["title"]) && isset($_GET["category"]) && isset($_GET["content"]) && isset($_GET["tags"])) {
|
||||
@ -42,6 +43,7 @@ class AddEditController extends Controller {
|
||||
/**
|
||||
* @route /^\/post\/new\/*$/
|
||||
* @editor
|
||||
* @title Ajout d'Article
|
||||
*/
|
||||
public function postAdd() {
|
||||
|
||||
@ -75,4 +77,13 @@ class AddEditController extends Controller {
|
||||
|
||||
return file_get_contents(DIR."/html/post_new.html");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @route /^\/post\/[0-9]+\/$/
|
||||
* @title Article
|
||||
*/
|
||||
public function post() {
|
||||
return file_get_contents(DIR."/html/post.html");
|
||||
}
|
||||
}
|
48
assets/php/Controller/UserController.php
Normal file
48
assets/php/Controller/UserController.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
use App\Controller;
|
||||
use App\DB\Author;
|
||||
|
||||
class UserController extends Controller {
|
||||
|
||||
|
||||
/**
|
||||
* @route /^\/users\/new\/$/
|
||||
* @admin
|
||||
* @title Ajouter un utilisateur
|
||||
*/
|
||||
public function addUser() {
|
||||
|
||||
if(isset($_POST["username"]) && isset($_POST["password"]) && isset($_POST["role"])) {
|
||||
$user = new Author();
|
||||
$user->setUsername($_POST["username"]);
|
||||
$user->setPassword($_POST["password"]);
|
||||
Author::add($user);
|
||||
header("Location: /users/");
|
||||
}
|
||||
|
||||
return \file_get_contents(DIR . "/html/user_add.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* @route /^\/users\/$/
|
||||
* @admin
|
||||
* @title liste des utilisateurs
|
||||
*/
|
||||
public function listUser() {
|
||||
return \file_get_contents(DIR."/html/user_list.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* @route /^\/user\/edit\/$/
|
||||
* @admin
|
||||
* @title Modifier un utilisateur
|
||||
*/
|
||||
public function editUser() {
|
||||
return \file_get_contents(DIR."/html/user_edit.html");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user