diff --git a/__cms__/controleur/chemin_page.php b/__cms__/controleur/chemin_page.php index 5361665..cc411af 100644 --- a/__cms__/controleur/chemin_page.php +++ b/__cms__/controleur/chemin_page.php @@ -1,19 +1,21 @@ chemin = CheminPage::nettoyer_chemin($chemin); + $this->chemin = explode('/', CheminPage::nettoyer_chemin($chemin)); } public function get() { - return $this->chemin; + return '/'.join($this->chemin, '/'); } public function enfant($nom) { - return $this->chemin . '/' . CheminPage::nettoyer_chemin($nom); + return '/'.join($this->chemin, '/') . '/' . CheminPage::nettoyer_chemin($nom); } public function parent() { @@ -30,10 +32,15 @@ class CheminPage { // * Ne contient pas '\0' // * Ne contient pas '../' // * Ne contient pas de double occurence de '/' - // * Ni d'autres bizarreries des chemins de fichiers. // * Ne contient pas _prop_ // * Ne se termine pas par '/' - // * Commence par '/' + // * Ne commence pas par '/' + // * Ni d'autres bizarreries des chemins de fichiers. + + $chemin = preg_replace("/\\0/", '', $chemin); // TODO : vérifier si c'est bien ça ! + $chemin = Path::normalize($chemin); + $chemin = preg_replace("/^\/*/", '', $chemin); + $chemin = preg_replace("/\/*$/", '', $chemin); // TODO return $chemin; diff --git a/galerie/index.php b/galerie/index.php index 75e7734..c200608 100644 --- a/galerie/index.php +++ b/galerie/index.php @@ -2,6 +2,6 @@ require_once("../__cms__/cms.php"); -CMS::affiche("/galerie"); +CMS::affiche("/galerie", $_GET); ?> diff --git a/index.php b/index.php index a6a4cf1..9f3b52b 100644 --- a/index.php +++ b/index.php @@ -2,6 +2,6 @@ require_once("__cms__/cms.php"); -CMS::affiche('/', $_GET["action"], $_GET); +CMS::affiche('/', $_GET); ?> \ No newline at end of file