public function reecrire($url = "")
 {
     $ret = 0;
     if ($url == "") {
         $url = $this->texte_url_reecrite();
     }
     $url = eregurl($url);
     $param = "&" . $this->clef_url_reecrite();
     $reecriture = new Reecriture();
     if (!$reecriture->charger($url)) {
         $reecriture->charger_param($this->colonne, $param, $this->lang, 1);
         if ($reecriture->url != $url) {
             $reecriture->actif = 0;
             $reecriture->maj();
             $reecriture = new Reecriture();
             $reecriture->fond = $this->colonne;
             $reecriture->url = $url;
             $reecriture->param = $param;
             $reecriture->lang = $this->lang;
             $reecriture->actif = 1;
             $ret = $reecriture->add();
         }
     }
     return $ret;
 }
예제 #2
0
$rewrite_active = Variable::lire("rewrite", 0);
// Si le rewrite est activé, on doit rediriger les pages non réécrites vers les pages réécrites (duplicate content).
$tab_fond_rewrite = array("rubrique", "produit", "dossier", "contenu");
if (isset($_GET['fond']) && in_array($_GET['fond'], $tab_fond_rewrite)) {
    if ($rewrite_active == 1) {
        $redir = new Reecriture();
        if ($redir->charger_url_classique($_SERVER['QUERY_STRING'], ActionsLang::instance()->get_id_langue_courante(), 1)) {
            header("HTTP/1.1 301 Moved Permanently");
            redirige(urlfond() . "/" . $redir->url);
        }
    }
}
// Chargement du contexte dans le cas d'une réécriture
if ($url != "") {
    $reecriture = new Reecriture();
    if ($reecriture->charger($url)) {
        if (!$reecriture->actif) {
            $redir = new Reecriture();
            if ($redir->charger_param($reecriture->fond, $reecriture->param, $reecriture->lang, 1)) {
                header("HTTP/1.1 301 Moved Permanently");
                redirige(urlsite($reecriture->lang) . "/" . $redir->url);
            }
        }
        // Si un changement de langue est demandé
        if (isset($_GET['lang'])) {
            // Rediriger vers l'URL dans cette langue, si elle existe
            $redir = new Reecriture();
            if ($redir->charger_param($reecriture->fond, $reecriture->param, $lang, 1)) {
                header("HTTP/1.1 301 Moved Permanently");
                redirige(urlsite($lang) . "/" . $redir->url);
            }
예제 #3
0
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;
}
예제 #4
0
                $reecriture->maj();
                $reecriture_new = new Reecriture();
                $reecriture_new->url = $reecriture->url;
                $reecriture_new->fond = 'nexisteplus';
                $reecriture_new->param = $reecriture->param . '&ancienfond=' . $reecriture->fond;
                $reecriture_new->actif = 1;
                $reecriture_new->lang = $reecriture->lang;
                $reecriture_new->add();
            }
            break;
        case 'dossier':
            preg_match("#id_dossier=([0-9]+)([^[0-9]])*#", $a->param, $match);
            $id = $match[1];
            $dossier = new Dossier();
            if (!$dossier->charger($id)) {
                $reecriture = new Reecriture();
                $reecriture->charger($a->url);
                $reecriture->actif = 0;
                $reecriture->maj();
                $reecriture_new = new Reecriture();
                $reecriture_new->url = $reecriture->url;
                $reecriture_new->fond = 'nexisteplus';
                $reecriture_new->param = $reecriture->param . '&ancienfond=' . $reecriture->fond;
                $reecriture_new->actif = 1;
                $reecriture_new->lang = $reecriture->lang;
                $reecriture_new->add();
            }
            break;
    }
}
/*fin gestion retroactivité des url reecrites des produits supprimés*/
예제 #5
0
/*                                                                                   */
/*      This program is free software; you can redistribute it and/or modify         */
/*      it under the terms of the GNU General Public License as published by         */
/*      the Free Software Foundation; either version 3 of the License                */
/*                                                                                   */
/*      This program is distributed in the hope that it will be useful,              */
/*      but WITHOUT ANY WARRANTY; without even the implied warranty of               */
/*      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                */
/*      GNU General Public License for more details.                                 */
/*                                                                                   */
/*      You should have received a copy of the GNU General Public License            */
/*	    along with this program. If not, see <http://www.gnu.org/licenses/>.         */
/*                                                                                   */
/*************************************************************************************/
require_once __DIR__ . "/../pre.php";
require_once __DIR__ . "/../auth.php";
require_once __DIR__ . "/../../fonctions/divers.php";
if (!est_autorise("acces_catalogue")) {
    exit;
}
header('Content-Type: text/html; charset=utf-8');
$reecriture = new Reecriture();
if ($reecriture->charger($_GET['url'])) {
    ?>
		<img src="gfx/interdiction.png" style="float: right;" />
	<?php 
} else {
    ?>
		<img src="gfx/validation.png" style="float: right;" />
	<?php 
}