This commit is contained in:
2019-03-04 15:18:48 +01:00
parent 731a494eb4
commit 2d506a0095
27 changed files with 431 additions and 1547 deletions

View File

@ -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");

View File

@ -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) {

View File

@ -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");
}
}

View 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");
}
}