pull/17/head
brongniart 6 months ago
parent 2acca76e1b
commit 0e5c6e26c4

@ -0,0 +1,150 @@
<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
use Twig\TemplateWrapper;
/* quote.html */
class __TwigTemplate_e80b479dc855245ef0d42a4f64b1f83e extends Template
{
private Source $source;
/**
* @var array<string, Template>
*/
private array $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
}
protected function doDisplay(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
// line 1
yield "<html>
<body>
<div class=\"Quote_container\">
<img class=\"image_carac\" src=\"";
// line 4
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["srcImg"] ?? null), "html", null, true);
yield "\" alt=\"";
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["nameCarac"] ?? null), "html", null, true);
yield "\">
<h1 class=\"quote_content\">
<strong>
";
// line 7
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["quoteContent"] ?? null), "html", null, true);
yield "
</strong>
</h1>
<ul>
<li>
";
// line 12
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["sourceName"] ?? null), "html", null, true);
yield "
</li>
<li>
";
// line 15
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["nameCarac"] ?? null), "html", null, true);
yield "
</li>
<li>
";
// line 18
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["dateSortie"] ?? null), "html", null, true);
yield "
</li>
</ul>
<div class=\"like\">
<p>
";
// line 23
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["nbLike"] ?? null), "html", null, true);
yield "
</p>
</div>
</div>
<div class=\"Comment_Container\">
";
// line 28
if ((Twig\Extension\CoreExtension::length($this->env->getCharset(), ($context["comment"] ?? null)) > 0)) {
yield " <div>
";
// line 29
$context['_parent'] = $context;
$context['_seq'] = CoreExtension::ensureTraversable(($context["comment"] ?? null));
foreach ($context['_seq'] as $context["_key"] => $context["com"]) {
// line 30
yield " <p class=\"userCom\">";
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["com"], "user", [], "any", false, false, false, 30), "html", null, true);
yield "</p>
<p class=\"com\">";
// line 31
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["com"], "content", [], "any", false, false, false, 31), "html", null, true);
yield "</p>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_key'], $context['com'], $context['_parent']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 32
yield " </div>
";
}
// line 34
yield " </div>
</body>
</html>";
yield from [];
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName(): string
{
return "quote.html";
}
/**
* @codeCoverageIgnore
*/
public function isTraitable(): bool
{
return false;
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo(): array
{
return array ( 116 => 34, 112 => 32, 104 => 31, 99 => 30, 95 => 29, 91 => 28, 83 => 23, 75 => 18, 69 => 15, 63 => 12, 55 => 7, 47 => 4, 42 => 1,);
}
public function getSourceContext(): Source
{
return new Source("", "quote.html", "/home/www/kekentin/public_html/WF/WF-Website/vue/templates/quote.html");
}
}

@ -16,6 +16,7 @@ $mdp = '';
//Vues //Vues
$vues['erreur'] = 'vue/erreur.php'; $vues['erreur'] = 'vue/erreur.php';
$vues['accueil'] = 'vue/accueil.php'; $vues['accueil'] = 'vue/accueil.php';
$vues['quote'] = 'vue/quote.php';
//Style css //Style css
$style['accueil'] = 'public/styles/styleAccueil.css'; $style['accueil'] = 'public/styles/styleAccueil.css';

@ -3,20 +3,23 @@ namespace Controleur;
Class FrontControler{ Class FrontControler{
private $listAction = ['visitor' => array('accueil','search','quote','login','singin'), private $listAction;
'user' => array('quiz','commentary','favorite','logout'),
'admin' => array()];
private string $role = 'visitor'; private string $role = 'visitor';
public function __construct(){ public function __construct(){
global $twig; global $twig;
$this->listAction = ['visitor' => array('accueil','search','quote','login','singin'),
'user' => array('quiz','commentary','favorite','logout'),
'admin' => array('null')];
$dVueEreur = []; $dVueEreur = [];
$router = new \AltoRouter(); $router = new \AltoRouter();
$router->map('GET', '/', 'VisitorControler'); $router->map('GET', '/', 'VisitorControler');
/* /*
'i' => '[0-9]++' 'i' => '[0-9]++'
'a' => '[0-9A-Za-z]++' 'a' => '[0-9A-Za-z]++'
@ -25,11 +28,11 @@ Class FrontControler{
'**' => '.++' '**' => '.++'
'' => '[^/\.]++' '' => '[^/\.]++'
*/ */
$router->map('GET|POST', '/quote/[a:action]?', 'VisitorControler');
$match = $router->match(); $router->map('GET|POST', '/quote/[i:arg]?', 'VisitorControler');
$action = array(); $match = $router->match();
$action = NULL;
if(!$match){ if(!$match){
$dVueEreur[] = "Requette introuvable"; $dVueEreur[] = "Requette introuvable";
@ -40,6 +43,10 @@ Class FrontControler{
$action=$match['params']['action'] ?? 'accueil'; $action=$match['params']['action'] ?? 'accueil';
//Si existe, on lappelle //Si existe, on lappelle
if(!$this->ifExisteAction($action)){
$dVueEreur[] = "Action introuvable";
$this->vueErreur($dVueEreur);
}
$controller = '\\Controleur\\' . $controller; $controller = '\\Controleur\\' . $controller;
$controller = new $controller; $controller = new $controller;
@ -54,7 +61,11 @@ Class FrontControler{
} }
private function ifExisteAction(string $action):bool { private function ifExisteAction(string $action):bool {
if( in_array($action , $listAction['admin']) || in_array($action , $listAction['user']) || in_array($action , $listAction['visiteur'])) return true; if( in_array($action , $this->listAction['admin']) ||
in_array($action , $this->listAction['user']) ||
in_array($action , $this->listAction['visitor']) ) {
return true;
}
return false; return false;
} }

@ -4,30 +4,20 @@ namespace Controleur;
Class VisitorControler{ Class VisitorControler{
public function __construct(){ public function __construct(){
global $vues; $action = explode('/',$_SERVER['PHP_SELF']);
require_once $vues['accueil']; var_dump( $action[2]);
} }
public function accueil(){
global $vues;
require_once $vues['accueil'];
private function ifExisteAction(string $action):bool {
if( in_array($action , $listAction['visiteur'])) return true;
return false;
}
private function verifDroit(string $action):bool {
if( in_array($action , $listAction['admin']) && $role == 'admin') return true;
elseif( in_array($action , $listAction['user']) && ($role == 'admin' || $role == 'user') ) return true;
elseif(in_array($action , $listAction['visitor']) && ($role == 'admin'|| $role == 'user'|| $role == 'visitor')) return true;
return false;
} }
private function vueErreur(array $dVueErreur){ public function quote(array $arg){
global $vues; global $vues;
echo "{$dVueErreur[0]}"; foreach( $arg as $i){
require_once $vues['erreur']; echo "{$i}";
}
require_once $vues['quote'];
} }
} }

@ -1,28 +0,0 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wiki Fantasy</title>
<link id="favicon" rel="icon" href="images/dark.svg" type="image/x-icon" />
<script src="script/truncateQuotes.js"></script>
<link rel="stylesheet" href="<?php global $style; echo $style['accueil']; ?>"> <!-- Import de styleAccueil.css -->
<script defer src="script/theme-toggle.js"></script> <!-- Import du script -->
</head>
<body class="<?php echo $_SESSION['theme'];?>">
<div class="container">
<div class="header">
<div class="nav">
<a href="favorite.html"><img src="images/coeur.svg" alt="coeur" width="67px" height="67px" onmousedown="return false"></a>
<img id="theme-icon" src="images/dark.svg" alt="toggle theme" width="72px" height="37px" onmousedown="return false" onclick="toggleTheme()">
<a href="quiz.html"><img src="images/quizz.svg" alt="quizz" width="51px" height="82px" onmousedown="return false"></a>
</div>
<div class="logo">
<a href="accueil.html"><img src="images/WIKIFANTASY.png" alt="Logo" width="227px" height="106px" onmousedown="return false"></a>
</div>
<div class="user">
<a href="profil.html"><img src="images/user_dark.png" alt="user" width="70px" height="70px" onmousedown="return false"></a>
</div>
</div>
</div>

@ -1,29 +0,0 @@
<?php
// appele avec index.php ne pas metre si controleur fonctionnel
require __DIR__ . '/../vendor/autoload.php';
$loader = new \Twig\Loader\FilesystemLoader('templates');
$twig = new \Twig\Environment($loader, [
'cache' => false,
]);
//
echo $twig->render('quote.html', array(
'srcImg' => "../default.jpg",
'nameCarac' => "default",
'quoteContent' => "je test la page",
'sourceName' => "une source",
'dateSortie' => "1999",
'nbLike' => "0",
'comment'=> array(
array(
'user'=>'toto',
'content'=>'12345674fkjgvhgtfoidshfziutgfos'
),
array(
'user'=> 'tata',
'content'=>'azertyuiopqsdfghjklmwxcvbn'
)
)));
?>
Loading…
Cancel
Save