mirror of
https://github.com/Aviortheking/Blog_IMIE.git
synced 2025-04-22 10:52:09 +00:00
corrigé
This commit is contained in:
parent
39701a4a65
commit
e032ef9080
@ -33,16 +33,16 @@ class Controller {
|
||||
/** @var String[] $arr */
|
||||
$arr = preg_split("/ /", $annot);
|
||||
if($arr[0] === "route") {
|
||||
if(preg_match($arr[1], $route)) {
|
||||
if(preg_match($arr[1], $route) && !isset($instance)) {
|
||||
$cl = $class;
|
||||
$instance = new $class();
|
||||
$function = ($method->getName());
|
||||
// return $instance->$function();
|
||||
}
|
||||
} elseif ($arr[0] === "editor" && isset($cl) && $cl == $class) {
|
||||
if(!isset($_SESSION["author"]) || (isset($_SESSION["author"]) && $_SESSION["author"]->getRole() != "ROLE_EDITOR")) header("Location: /login/?redirect=".$_SERVER["REQUEST_URI"]);
|
||||
if(!isset($_SESSION["author"]) || (isset($_SESSION["author"]) && ($_SESSION["author"]->getRole() != "ROLE_EDITOR" && $_SESSION["author"]->getRole() != "ROLE_ADMIN"))) header("Location: /login/?redirect=".$_SERVER["REQUEST_URI"]);
|
||||
} elseif($arr[0] === "admin" && isset($cl) && $cl ==$class) {
|
||||
if(!isset($_SESSION["author"]) || (isset($_SESSION["author"]) && ($_SESSION["author"]->getRole() != "ROLE_ADMIN" || $_SESSION["author"]->getRole() != "ROLE_EDITOR"))) header("Location: /login/?redirect=".$_SERVER["REQUEST_URI"]);
|
||||
if(!isset($_SESSION["author"]) || (isset($_SESSION["author"]) && $_SESSION["author"]->getRole() != "ROLE_ADMIN")) header("Location: /login/?redirect=".$_SERVER["REQUEST_URI"]);
|
||||
}
|
||||
}
|
||||
if(isset($instance)) {
|
||||
|
@ -45,7 +45,7 @@ class AddEditController extends Controller {
|
||||
*/
|
||||
public function postAdd() {
|
||||
|
||||
// var_dump($_SESSION["author"]);
|
||||
var_dump($_GET);
|
||||
// die;
|
||||
|
||||
if(isset($_GET["title"]) && isset($_GET["category"]) && isset($_GET["content"]) && isset($_GET["tags"])) {
|
||||
|
@ -11,7 +11,7 @@ use App\DB\Post;
|
||||
class Editor extends \App\Tags\Tag {
|
||||
public function render() {
|
||||
if($_GET["post"] == "new") $_GET["post"] = null;
|
||||
else $post = Post::get($_GET["post"]);
|
||||
elseif(isset($_GET["post"])) $post = Post::get($_GET["post"]);
|
||||
//recuperation de la balise de base (<tag type="bold">pouet</tag>)
|
||||
$pok = $this->getElement();
|
||||
//recuperation du document (necessaire a la création de balises
|
||||
|
Loading…
x
Reference in New Issue
Block a user