include("includes/connect.php");
include("includes/inc_fonctions.inc");
include("mo_boutique/inc_variables.php");
// on va chercher l'intitulé du theme / rubrique
$req_title_page="select news_titre, news_complet,news_promo,style,news_fichier,news_video, news_ref,news_assoc_1,news_assoc_2,news_assoc_3, news_etat, marque_id , ".$nom_table."_news_news.news_id, ".$nom_table."_news_theme.theme_lib, ".$nom_table."_news_theme.theme_id, rubrique_lib,".$nom_table."_news_rubrique.rubrique_id
from ".$nom_table."_news_theme,".$nom_table."_news_rubrique, ".$nom_table."_news_news, ".$nom_table."_correspondance_themes
where ".$nom_table."_news_theme.rubrique_id=".$nom_table."_news_rubrique.rubrique_id and ".$nom_table."_correspondance_themes.news_id=".$nom_table."_news_news.news_id and ".$nom_table."_news_theme.theme_id=".$_GET['theme_id']."
and ".$nom_table."_news_theme.zone_id=1 and news_etat!='sorti' and news_etat!='archive'
and ".$nom_table."_news_news.news_id=".$_GET['news_id']." group by ".$nom_table."_news_news.news_id";
//echo $req_title_page;
$result_title_page=mysql_query($req_title_page);
$nb_result_title_page=@mysql_num_rows($result_title_page);
if($nb_result_title_page!=1){header("location:/");exit();}
$rubrique_id=mysql_result($result_title_page,0,'rubrique_id');
$theme_id=mysql_result($result_title_page,0,'theme_id');
$rubrique_lib_title=mysql_result($result_title_page,0,'rubrique_lib');
$theme_lib_title=mysql_result($result_title_page,0,'theme_lib');
$theme_lib_style=mysql_result($result_title_page,0,'style');
$news_ref=mysql_result($result_title_page,0,'news_ref');
$news_etat=mysql_result($result_title_page,0,'news_etat');
$news_promo=mysql_result($result_title_page,0,'news_promo');
$news_fichier=mysql_result($result_title_page,0,'news_fichier');
$news_video=mysql_result($result_title_page,0,'news_video');
$news_titre=mysql_result($result_title_page,0,'news_titre');
//$news_complet=eregi_replace('\n','
',mysql_result($result_title_page,0,'news_complet'));
$news_complet=mysql_result($result_title_page,0,'news_complet');
$news_complet=str_replace("\\n", "
",$news_complet);
$news_assoc_1=mysql_result($result_title_page,0,'news_assoc_1');
$news_assoc_2=mysql_result($result_title_page,0,'news_assoc_2');
$news_assoc_3=mysql_result($result_title_page,0,'news_assoc_3');
$marque_id=mysql_result($result_title_page,0,'marque_id');
$rewriting_rubrique=rewrite_var($rubrique_lib_title);
$rewriting_theme=rewrite_var($theme_lib_title);
$news_complet_desc=strip_tags($news_complet);
$news_complet_desc=substr($news_complet_desc,0,150);
// gestion de l'url
$mondomaine=$_SERVER['HTTP_HOST'];
$monUrl = $mondomaine.$_SERVER['REQUEST_URI'];
$rewriting_theme=strtolower(rewrite_var($theme_lib_title));
$rewriting_news=strtolower(rewrite_var($news_titre));
$rewriting_ref=rewrite_var($news_ref);
if (($theme_id==35) or ($theme_id==36)){
$url_particulier_bout=$rewriting_theme;
}else{
$url_particulier_bout="objets-publicitaires-".$rewriting_theme."-personnalise";
}
$url_ideale=$mondomaine."/".$url_particulier_bout."-".$rewriting_news.",".$rewriting_ref.",".$theme_id.",".$_GET['news_id'].".html";
//echo $url_ideale;
//echo $monUrl;
// on check qu'on est bien sur l'url idéale
if($monUrl!=$url_ideale){
//echo "-";
// header("Status: 301 Moved Permanently", false, 301);header("location:http://".$url_ideale);exit();
}
$news_desc_completmod=str_replace(CHR(10),"",$news_complet_desc);
$news_desc_completmod=str_replace(CHR(13),"",$news_desc_completmod);
?>