diff --git a/app/controller/campaign.php b/app/controller/campaign.php index 0f52b53d5414db0acfb3398c62f547c8c0886886..118d808b10ed1357c1321c9bd5d1c5c464ee9be1 100644 --- a/app/controller/campaign.php +++ b/app/controller/campaign.php @@ -6,24 +6,6 @@ class Campaign extends Controller /* Page principale du site */ - public function beforeRoute($f3, $args) - { - parent::beforeRoute($f3, $args); - - // Valeur par défaut du bloc de contenu - $f3->set('block_content', 'campaign/empty.html'); - - // Get the database - $f3->set('SESSION.errors', []); - } - - public function afterRoute($f3, $args) - { - parent::afterRoute($f3, $args); - // Rendu HTML de la page - echo \Template::instance()->render('campaign/base.html'); - } - public static function show($f3, $args) { // Let's do some math first @@ -75,8 +57,7 @@ class Campaign extends Controller // Page d'attente public function wait($f3) { - echo \Template::instance()->render('campaign/wait.html'); - exit; + $f3->set('block_content', 'campaign/wait.html'); } // Que fait la Quadrature ? diff --git a/app/controller/controller.php b/app/controller/controller.php index 8bcd4fd1c1396e42de0bcb092be37318ed802130..4fcac0a98d3b18fe6cda17ab61b5ad0d25cf1204 100644 --- a/app/controller/controller.php +++ b/app/controller/controller.php @@ -12,6 +12,9 @@ class Controller // Fonction appelée avant routage public function beforeRoute($f3, $args) { + // Template de base par défaut + $this->template = "base.html"; + if (php_sapi_name() == 'cli') { $HTTP_HOST = 'localhost'; } else { @@ -62,9 +65,6 @@ class Controller $this->sanitizeForms($f3); } - // Log dir - //$f3->set('LOGS', LOGS); - $f3->set('mail', array( "from" => "contact@laquadrature.net", "fromName" => "La Quadrature du Net" @@ -83,11 +83,27 @@ class Controller ); asort($atailles); $f3->set('atailles', $atailles); + + // Ceci n'est valable que pour les tests en CLI + if (strlen($f3["RESPONSE"])>0) { + $f3->clear("RESPONSE"); + return; + } } // Fonction appelée après routage public function afterRoute($f3, $args) { + // Ceci n'est valable que pour les tests en CLI + if (strlen($f3["RESPONSE"])>0) { + echo $f3["RESPONSE"]; + return; + } + + // Rendu de la page + if ($this->template!='') { + echo \Template::instance()->render($this->template); + } } // Fonction utilisée pour sanitiser les données diff --git a/app/view/base.html b/app/view/base.html new file mode 100644 index 0000000000000000000000000000000000000000..45a444e71fe34942a2f636afdafafdb98e84204d --- /dev/null +++ b/app/view/base.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/app/view/footer.html b/app/view/footer.html new file mode 100644 index 0000000000000000000000000000000000000000..4f0133c036bd2adb4c6ae6f743d100713bcc1aa3 --- /dev/null +++ b/app/view/footer.html @@ -0,0 +1,26 @@ + + + + diff --git a/app/view/header.html b/app/view/header.html new file mode 100644 index 0000000000000000000000000000000000000000..677fadafaacb5536fb64c5a8b25999912c7c0885 --- /dev/null +++ b/app/view/header.html @@ -0,0 +1,29 @@ + + {{ _("Soutenez La Quadrature du Net !") }} + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/view/toolbar.html b/app/view/toolbar.html new file mode 100644 index 0000000000000000000000000000000000000000..705384a7c0c6985b69b86e183d267507bf1e6259 --- /dev/null +++ b/app/view/toolbar.html @@ -0,0 +1,155 @@ + + + + + + + +