From a2f60afeb667126e04812deeebe6836ae31a47bb Mon Sep 17 00:00:00 2001 From: Fil <fil@rezo.net> Date: Sat, 29 Jan 2005 16:08:19 +0000 Subject: [PATCH] renommage --- inc-chercher-squelette.php3 | 54 ++++++++++++++++++++++++++++++++ inc-chercher.php3 | 62 ------------------------------------- 2 files changed, 54 insertions(+), 62 deletions(-) create mode 100644 inc-chercher-squelette.php3 delete mode 100644 inc-chercher.php3 diff --git a/inc-chercher-squelette.php3 b/inc-chercher-squelette.php3 new file mode 100644 index 0000000000..cf00faffaa --- /dev/null +++ b/inc-chercher-squelette.php3 @@ -0,0 +1,54 @@ +<?php + +// Ce fichier ne sera execute qu'une fois +if (defined("_INC_CHERCHER")) return; +define("_INC_CHERCHER", "1"); + +// Ce fichier doit imperativement contenir la fonction chercher-squelette +// (cf commentaires dans inc-calcul) + +function chercher_squelette($fond, $id_rubrique, $lang) { + $ext = $GLOBALS['extension_squelette']; + + // Accrocher un squelette de base dans le chemin + if (!$base = find_in_path("$fond.$ext")) { + // erreur webmaster : $fond ne correspond a rien + erreur_squelette(_T('zbug_info_erreur_squelette2', + array('fichier'=>$fond)), + $dossier); + return ''; + } + + // supprimer le ".html" pour pouvoir affiner par id_rubrique ou par langue + $squelette = substr($base, 0, - strlen(".$ext")); + + // On selectionne, dans l'ordre : + // fond=10 + $f = "$squelette=$id_rubrique"; + if (($id_rubrique > 0) AND (@file_exists("$f.$ext"))) + $squelette = $f; + else { + // fond-10 fond-<rubriques parentes> + while ($id_rubrique > 0) { + $f = "$squelette-$id_rubrique"; + if (@file_exists("$f.$ext")) { + $squelette = $f; + break; + } + else + $id_rubrique = sql_parent($id_rubrique); + } + } + + // Affiner par lang + if ($lang) { + lang_select($lang); + $f = "$squelette.$lang"; + if (@file_exists("$f.$ext")) + $squelette = $f; + } + + return $squelette; +} + +?> diff --git a/inc-chercher.php3 b/inc-chercher.php3 deleted file mode 100644 index 2ec82d4a55..0000000000 --- a/inc-chercher.php3 +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -// Ce fichier ne sera execute qu'une fois -if (defined("_INC_CHERCHER")) return; -define("_INC_CHERCHER", "1"); - -// Ce fichier doit imperativement contenir la fonction chercher-squelette -// (cf commentaires dans inc-calcul) - -function chercher_squelette($fond, $id_rubrique, $dossier, $lang) { - $ext = $GLOBALS['extension_squelette']; - - $d ="$dossier$fond"; - - // On selectionne, dans l'ordre : - // fond=10 - - $f = "$d=$id_rubrique"; - if (($id_rubrique > 0) AND (@file_exists("$f.$ext"))) - $squelette = $f; - - // fond-10 fond-<rubriques parentes> - if (!$squelette) - while ($id_rubrique > 0) { - if (@file_exists("$d-$id_rubrique.$ext")) { - $squelette = "$d-$id_rubrique"; - break; - } - else - $id_rubrique = sql_parent($id_rubrique); - } - - if (!$squelette) { - // fond - if (@file_exists("$d.$ext")) - $squelette = $d; - // fond, a la racine - else if (@file_exists("$fond.$ext")) - $squelette = $fond; - else if (@file_exists("$fond-dist.$ext")) - $squelette = "$fond-dist"; - else { - // erreur webmaster : $fond ne correspond a rien - erreur_squelette(_T('zbug_info_erreur_squelette2', - array('fichier'=>$fond)), - $dossier); - return ''; - } - } - - // Affiner par lang - if ($lang) { - lang_select($lang); - $f = "$squelette.$lang"; - if (@file_exists("$f.$ext")) - $squelette = $f; - } - - return $squelette; -} - -?> -- GitLab