From a8f5c0189efa25d72869976f34f0a5527687e8b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Wed, 4 Aug 2010 23:14:59 +0200 Subject: [PATCH] =?UTF-8?q?Connexion=20/=20D=C3=A9connexion=20marchent=20!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __cms__/code/modules/admin/connexion.php | 2 +- __cms__/code/modules/modules.php | 4 +- __cms__/code/securite/authentification.php | 2 +- __cms__/code/securite/erreur.php | 2 +- __cms__/code/site/squelette.php | 53 ++++++++++++---------- 5 files changed, 35 insertions(+), 28 deletions(-) diff --git a/__cms__/code/modules/admin/connexion.php b/__cms__/code/modules/admin/connexion.php index d2085b2..5c6a452 100644 --- a/__cms__/code/modules/admin/connexion.php +++ b/__cms__/code/modules/admin/connexion.php @@ -8,7 +8,7 @@ class AdminConnexion { } else { return self::vue($chemin, "connexion échouée"); } - } else if ($action == "déconnexion") { + } else if ($action == "deconnexion") { Authentification::déconnexion(); return self::vue($chemin, "déconnexion"); } else { diff --git a/__cms__/code/modules/modules.php b/__cms__/code/modules/modules.php index eb5d13b..2e63a92 100644 --- a/__cms__/code/modules/modules.php +++ b/__cms__/code/modules/modules.php @@ -10,12 +10,12 @@ class Modules { "post" => qw($post), "file" => qw($file) ); - self::$liste_modules[$type]["get_post"][] = "action"; // Toujours présent. + self::$liste_modules[$type]["get_post"][] = "action"; // Toujours présent. } public static function get_module($chemin) { $type = Stockage::get_prop($chemin, "type"); - if ($type === false || !isset(self::$liste_modules[$type])) { + if (Erreur::is_erreur($type) || !isset(self::$liste_modules[$type])) { Erreur::fatale("Type inconnu (" . var_export($type, true) . ") pour la page " . $chemin->get() . "."); // return false; } diff --git a/__cms__/code/securite/authentification.php b/__cms__/code/securite/authentification.php index 5f5f3dd..924a581 100644 --- a/__cms__/code/securite/authentification.php +++ b/__cms__/code/securite/authentification.php @@ -20,7 +20,7 @@ class Authentification { } public static function est_connecté() { - return get_utilisateur() == "Anonyme"; + return self::get_utilisateur() != "Anonyme"; } public static function déconnexion() { diff --git a/__cms__/code/securite/erreur.php b/__cms__/code/securite/erreur.php index aa88833..a5f0644 100644 --- a/__cms__/code/securite/erreur.php +++ b/__cms__/code/securite/erreur.php @@ -28,7 +28,7 @@ class Erreur { } public static function lecture($message) { - $t = new self("lecture", $message); + return new self("lecture", $message); } public function __construct($type, $message, $string = "[debug:erreur]") { diff --git a/__cms__/code/site/squelette.php b/__cms__/code/site/squelette.php index ee73c54..de10d4b 100644 --- a/__cms__/code/site/squelette.php +++ b/__cms__/code/site/squelette.php @@ -12,29 +12,36 @@ class Squelette { // TODO : chemin css relatif. $racine = new Chemin('/'); $chemin_css = $racine->get_url('?vue=css'); - return -' - - - ' . $page->titre . ' - - - - - -

' . Stockage::get_prop($racine, "nom_site") . '

-
- enfant("connexion")->get_url() . '">connexion -
- -
-'; -// -// + $nl = "\n"; + $ret = ''; + $ret .= '' . $nl; + $ret .= '' . $nl; + $ret .= ' ' . $nl; + $ret .= ' ' . $page->titre . '' . $nl; + $ret .= ' ' . $nl; + $ret .= ' ' . $nl; + $ret .= ' ' . $nl; + $ret .= ' ' . $nl; + $ret .= ' ' . $nl; + $ret .= ' ' . $nl; + $ret .= ' ' . $nl; + $ret .= '

' . Stockage::get_prop($racine, "nom_site") . '

' . $nl; + $ret .= '
' . $nl; + + if (Authentification::est_connecté()) { + $ret .= 'enfant("connexion")->get_url("?action=deconnexion") . '">déconnexion' . $nl; + } else { + $ret .= 'enfant("connexion")->get_url() . '">connexion' . $nl; + } + + $ret .= '
' . $nl; + $ret .= ' ' . $nl; + $ret .= '
' . $nl; + return $ret; } public static function pied() {