コード例 #1
0
ファイル: boucles.php プロジェクト: anti-conformiste/thelia1
function boucleLangue($texte, $args)
{
    $exclure = lireTag($args, 'exclure');
    $id = lireTag($args, 'id');
    $res = '';
    $url = preg_replace('/[\\&\\?]*lang=[0-9]+/', '', url_page_courante());
    // S'il faut suffixer par lang=x, s'assurer de placer le bon séparateur
    if (!ActionsLang::instance()->get_un_domaine_par_langue()) {
        $url .= strstr($url, '?') == false ? '?' : '&';
    }
    $lng = new Lang();
    $query = 'select * from ' . $lng->table . ' where 1 ';
    if ($id != '') {
        $query .= ' and id in ( ' . $id . ')';
    }
    if ($exclure != '') {
        $query .= ' and id not in ( ' . $exclure . ')';
    }
    // Trouver l'url ré-écrite, si elle existe
    $reecriture = new Reecriture();
    if (Variable::lire("rewrite") != 0) {
        // L'URL de la page courante
        $requrl = lireParam('url', 'string');
        if ($requrl != '') {
            $reecriture->charger($requrl);
        }
    }
    $lngredir = new Reecriture();
    $result = $lng->query($query);
    while ($result && ($row = $lng->fetch_object($result))) {
        $lng->charger($row->id);
        if ($reecriture->actif && $lngredir->charger_param($reecriture->fond, $reecriture->param, $lng->id, 1)) {
            if (ActionsLang::instance()->get_un_domaine_par_langue()) {
                $lngurl = "{$row->url}/{$lngredir->url}";
            } else {
                $lngurl = $lngredir->url;
            }
        } else {
            if (ActionsLang::instance()->get_un_domaine_par_langue()) {
                $lngurl = str_replace(ActionsLang::instance()->get_langue_courante()->url, $row->url, $url);
            } else {
                $lngurl = $url . 'lang=' . $lng->id;
            }
        }
        $tmp = str_replace('#ID', $lng->id, $texte);
        $tmp = str_replace('#DESCRIPTION', $lng->description, $tmp);
        $tmp = str_replace('#CODE', $lng->code, $tmp);
        $tmp = str_replace('#DEFAUT', $lng->defaut ? '1' : '0', $tmp);
        $tmp = str_replace('#URL', $lngurl, $tmp);
        $res .= $tmp;
    }
    return $res;
}
コード例 #2
0
ファイル: moteur.php プロジェクト: anti-conformiste/thelia1
    }
    @(include_once $lang_file);
}
Parseur::setVarFond($res);
// Lire les options définies dans le template
$securise = Parseur::lireVarFond('securise', 'int', 0);
$nopageret = Parseur::lireVarFond('nopageret', 'int', 0);
$reset = Parseur::lireVarFond('reset', 'int', 0);
$panier = Parseur::lireVarFond('panier', 'int', 0);
$transport = Parseur::lireVarFond('transport', 'int', 0);
// fonctions à éxecuter après la lecture des variables de fond
ActionsModules::instance()->appel_module("varfond");
// Page retour
// Supprimer le paramètre "déconnexion" de l'url page retour
if (!$nopageret) {
    $_SESSION["navig"]->urlpageret = supprimer_deconnexion(url_page_courante());
} else {
    if ($_SESSION["navig"]->urlpageret == "") {
        $_SESSION["navig"]->urlpageret = urlfond();
    }
}
// Sécurisation
if ($securise && !$_SESSION["navig"]->connecte) {
    redirige(urlfond("connexion"));
}
// Vérif transport
if ($transport && !$_SESSION["navig"]->commande->transport) {
    redirige(urlfond("adresse"));
}
// Vérif panier
if ($panier && !$_SESSION["navig"]->panier->nbart) {
コード例 #3
0
function substitutions($texte)
{
    global $fond, $action;
    $texte = str_replace("#FOND", $fond, $texte);
    $texte = str_replace("#ACTION", $action, $texte);
    $texte = str_replace("#URLPREC", $_SESSION['navig']->urlprec, $texte);
    $texte = str_replace("#URLPAGERET", $_SESSION['navig']->urlpageret, $texte);
    $texte = str_replace("#URLPANIER", urlfond("panier"), $texte);
    $texte = str_replace("#URLCOMMANDER", urlfond("commande"), $texte);
    $texte = str_replace("#URLNOUVEAU", urlfond("nouveau"), $texte);
    // Supprimer l'éventuel paramètre de déconnexion, en, préservant les éventuels autres.
    $selfurl = supprimer_deconnexion(url_page_courante());
    $parametres = parse_url($selfurl, PHP_URL_QUERY);
    $texte = str_replace("#URLCOURANTEPARAM", $parametres, $texte);
    $texte = str_replace("#URLCOURANTE", escape_ampersand($selfurl), $texte);
    $texte = str_replace("#URLDECONNEXION", escape_ampersand($selfurl . ($parametres != '' ? "&" : "?") . "action=deconnexion"), $texte);
    $texte = str_replace("#URLRECHERCHE", urlfond("recherche"), $texte);
    $texte = str_replace("#URLADRESSE", urlfond("adresse"), $texte);
    $texte = str_replace("#URLPAIEMENT", urlfond("commande"), $texte);
    $texte = str_replace("#URLSOMMAIRE", urlfond(), $texte);
    $texte = str_replace("#URLCOMPTEMODIFIER", urlfond("compte_modifier"), $texte);
    $texte = str_replace("#URLCOMPTE", urlfond("moncompte"), $texte);
    // Substitutions "langue"
    $texte = ActionsLang::instance()->substitutions(ActionsLang::instance()->get_langue_courante(), $texte);
    // Substitutions "devises"
    $texte = ActionsDevises::instance()->substitutions(ActionsDevises::instance()->get_devise_courante(), $texte);
    if (strstr($texte, "#VARIABLE")) {
        $texte = substitvariable($texte);
    }
    if (strstr($texte, "#MESSAGE_")) {
        $texte = substitmessage($texte);
    }
    if (strstr($texte, "#RUBRIQUE_")) {
        $texte = substitrubriques($texte);
    }
    if (strstr($texte, "#PRODUIT_")) {
        $texte = substitproduits($texte);
    }
    if (strstr($texte, "#PANIER_")) {
        $texte = substitpanier($texte);
    }
    if (strstr($texte, "#CLIENT_")) {
        $texte = substitclient($texte);
    }
    if (strstr($texte, "#PAGE_")) {
        $texte = substitpage($texte);
    }
    if (strstr($texte, "#ADRESSE_")) {
        $texte = substitadresse($texte);
    }
    if (strstr($texte, "#COMMANDE_")) {
        $texte = substitcommande($texte);
    }
    if (strstr($texte, "#IMAGE_")) {
        $texte = substitimage($texte);
    }
    if (strstr($texte, "#CARACTERISTIQUE_")) {
        $texte = substitcaracteristique($texte);
    }
    if (strstr($texte, "#DECLINAISON_")) {
        $texte = substitdeclinaison($texte);
    }
    if (strstr($texte, "#DOSSIER_")) {
        $texte = substitdossier($texte);
    }
    if (strstr($texte, "#CONTENU_")) {
        $texte = substitcontenu($texte);
    }
    if (strstr($texte, "#PARRAIN_")) {
        $texte = substitparrain($texte);
    }
    if (strstr($texte, "#PROMO_")) {
        $texte = substitpromo($texte);
    }
    // Traduction du template
    $texte = substitlang($texte);
    if (isset($_GET['errconnex']) && $_GET['errconnex'] == "1") {
        $texte = preg_replace("/\\#ERRCONNEX\\[([^]]*)\\]/", "\\1", $texte);
    } else {
        $texte = preg_replace("/\\#ERRCONNEX\\[([^]]*)\\]/", "", $texte);
    }
    // URL d'un fond, forme: #URLFOND(nom-du-fond)
    if (preg_match_all("`\\#URLFOND\\(([^\\),]+)(:?,([^\\),]+))*\\)`", $texte, $matches, PREG_SET_ORDER)) {
        foreach ($matches as $match) {
            $url = urlfond($match[1], isset($match[2]) ? $match[3] : false, true);
            $texte = str_replace($match[0], $url, $texte);
        }
    }
    // Ajout d'un paramètre à une URL, forme: #AJOUT_PARAMETRE(url,liste-de-paramètres)
    if (preg_match_all("`\\#AJOUTER_PARAMETRE\\(([^\\),]+)(:?,([^\\),]+))*\\)`", $texte, $matches, PREG_SET_ORDER)) {
        foreach ($matches as $match) {
            $url = $match[1];
            if (isset($match[2])) {
                if (strstr($url, '?') !== false) {
                    $url .= "&" . $match[3];
                } else {
                    $url .= "?" . $match[3];
                }
            }
            $texte = str_replace($match[0], $url, $texte);
        }
    }
    $texte = str_replace("index.php", "", $texte);
    return $texte;
}