1 ) return; if($an_de>$an_a){ $tmp=$an_de; $an_de=$an_a; $an_a=$tmp; } $db=connDb(); if(getCgiVar("st")=="2" || getVar("st")=="2" || getVar("st")=="" ) $sortClause="order by annee desc,date_sort desc, idcp desc, idca desc, idcr desc"; if(getCgiVar("st")=="1" || getVar("st")=="1"){ $sortClause="order by marquec, marquee, marquer"; /// marquec a inserer } mysql_query("drop table if exists sess_".session_id(),$db); if($marque=='Indiff' || $marque == 'Indifférent') $marque='%'; $query_ent="create table sess_".session_id(). " (select idc,0 as idt,idcp,idca,idcr,idce,upper(marquec) as marquec, annee,date_sort,(SELECT distinct nom from Marque where ide=idce) as marquee ,(SELECT distinct marque from archives where id=idcr and id>0 limit 0, 1) as marquer from criteres where ((actifc is null or actifc=1) or ((idca is not null))) and (annee >= $an_de and annee <=$an_a ) and ( upper(marquec) like(upper('$marque')) or idce in (SELECT distinct ide FROM `Marque` WHERE upper(nom) like (upper('$marque'))) or idcr in (SELECT distinct id FROM `archives` WHERE upper(marque) like(upper('$marque'))) and annee > 0 ) and( (idcp is null or idcp not in (select p from deleted)) and (idca is null or idca not in (select a from deleted)) and (idcr is null or idcr not in (select r from deleted))) $sortClause )"; if($type =='Articles'){ $query_ent="create table sess_".session_id(). " (select idc,0 as idt,idcp,idca,idcr,idce,upper(marquec) as marquec ,annee,date_sort ,(SELECT distinct nom from Marque where ide=idce) as marquee ,(SELECT distinct marque from archives where id=idcr and id>0 limit 0, 1) as marquer from criteres where (annee >= $an_de and annee <=$an_a ) and (idca is not null and idca not in ((select a from deleted))) and ( upper(marquec) like(upper('$marque')) or idce in (SELECT distinct ide FROM `Marque` WHERE upper(nom) like (upper('$marque'))))and annee > 0) $sortClause"; } else if($type =='Produits'){ $query_ent="create table sess_".session_id(). " (select idc,0 as idt,idcp,idca,idcr,idce,upper(marquec) as marquec ,annee, date_sort ,(SELECT distinct nom from Marque where ide=idce) as marquee ,(SELECT distinct marque from archives where id=idcr and id>0 limit 0, 1) as marquer from criteres where (actifc is null or actifc=1) and (annee >= $an_de and annee <=$an_a ) and (idcp is not null and idcp not in ((select p from deleted))) and ( upper(marquec) like(upper('$marque')) or idce in (SELECT distinct ide FROM `Marque` WHERE upper(nom) like (upper('$marque'))))and annee > 0) $sortClause"; } else if($type =='Archives'){ $query_ent="create table sess_".session_id(). " (select idc,0 as idt,idcp,idca,idcr,idce,upper(marquec) as marquec ,annee, date_sort ,(SELECT distinct nom from Marque where ide=idce) as marquee ,(SELECT distinct marque from archives where id=idcr and id>0 limit 0, 1) as marquer from criteres where (actifc is null or actifc=1) and (annee >= $an_de and annee <=$an_a ) and (idcr is not null and idcr not in ((select r from deleted))) and ( upper(marquec) like(upper('$marque')) or idcr in (SELECT distinct id FROM `archives` WHERE upper(marque) like(upper('$marque'))))and annee > 0) $sortClause"; } $res=mysql_query($query_ent,$db); if(getCgiVar("st")=="1" || getVar("st")=="1"){ $res=mysql_query("create table tmp_".session_id()." (select * from sess_".session_id()." ".$sortClause.")",$db); mysql_query("drop table if exists sess_".session_id(),$db); mysql_query("ALTER TABLE tmp_".session_id()." RENAME TO sess_".session_id()); } mysql_query("update sess_".session_id()." set marquee=marquec where marquee is null"); mysql_query("update sess_".session_id()." set marquec=marquee where marquec is null"); mysql_query("update sess_".session_id()." set marquer='~',marquec='~',marquee='~' where marquer ='' and marquec is null and marquee is null"); mysql_query("update sess_".session_id()." join tendances on sess_".session_id().".idcp = tendances.idtp set sess_".session_id().".idt = tendances.idt",$db); mysql_query("update sess_".session_id()." join tendances on sess_".session_id().".idca = tendances.idta set sess_".session_id().".idt = tendances.idt",$db); mysql_query("delete from sess_".session_id()." where idcp is not null and idcp in (select idp from produit where actif='non') and idcp not in( select distinct idcp from criteres idcp is not null and where actifc =1 )",$db); mysql_query("delete from sess_".session_id()." where idcp is not null and actifc =0 )",$db); $res=mysql_query("select * from sess_".session_id()." ".$sortClause,$db); if(mysql_num_rows($res)>0){ //echo ''; if($keywords){ while($resRow=mysql_fetch_array($res)){ if($resRow['idcp']){ if(keywordsProduits($resRow['idcp'],$keywords)){ } else{ $resdel=mysql_query("delete from sess_".session_id()." where idcp=".$resRow['idcp'],$db); } } if($resRow['idca']){ if(keywordsArticles($resRow['idca'],$keywords)){ } else{ $resdel=mysql_query("delete from sess_".session_id()." where idca=".$resRow['idca'],$db); } } if($resRow['idcr']){ if(keywordsArchives($resRow['idcr'],$keywords)){ } else{ $resdel=mysql_query("delete from sess_".session_id()." where idcr=".$resRow['idcr'],$db); } } } } } } function searchFull($type="",$bw='',$year='',$xmas=''){ $trancheMask=0; $diamMask=0; $etanMask=0; $de=""; $a=""; $db=connDb(); if($bw==1){ $resdel=mysql_query("delete from sess_".session_id()." where idce is not null and idce not in (select distinct ide from entreprise WHERE (`actif` = 'o') AND (`halle` IS NOT NULL)) ",$db); } if($xmas==1){ $resdel=mysql_query("delete from sess_".session_id()." where idt is not null and idcp is not null and ( idt not in (select idt from tendances where ann like('2;%') or ann like ('%;2;%')))",$db); $resdel=mysql_query("delete from sess_".session_id()." where idt is not null and idca is not null and ( idt not in (select idt from tendances where ann like('2;%') or ann like ('%;2;%')))",$db); } if($year > 0 && $year > 1962){ $resdel=mysql_query("delete from sess_".session_id()." where annee <> ".$year,$db); } } function print_rss(){ $sessId=session_id(); $cpt=0; $max=20; $result=0; searchSimple("Indiff",(date("Y")-1),date("Y"),"Indiff",""); searchFull(); //$db=connDb(); $res=0; $res=mysql_query("select * from sess_"."$sessId"." order by annee desc,date_sort desc limit 20"); if(mysql_num_rows($res)<=0){ session_destroy(); session_start(); $sessId=session_id(); searchSimple("Indiff",(date("Y")-1),date("Y"),"Indiff",""); searchFull(); $res=mysql_query("select * from sess_"."$sessId"." order by annee desc,date_sort desc limit 20"); } while($result=mysql_fetch_array($res)){ //echo '>>>'.$sessId; //echo "\n"; if($result['idca'] > 0){ if(print_item_news($result)) $cpt++; } else if($result['idcp'] > 0){ if(print_item_prod($result)) $cpt++; } if($cpt>=$max) break; } return ''; } function print_item_prod($res){ $lg=$_GET['lg']; $L=''; if($lg=='fr') $L=1; if($lg=='de') $L=2; if($lg=='it') $L=3; if($lg=='es') $L=4; if($lg=='zh') $L=5; //echo $res['idcp'] ; $db=connDb(); $rss_query=" SELECT produit.idp, produit.nom, produit.date_update, entreprise.nom as nom_ent, produit_$lg.texte_desc_0 FROM produit INNER JOIN produit_$lg ON (produit.idp = produit_$lg.idp) INNER JOIN entreprise ON (produit.entreprise = entreprise.ide) WHERE (produit.actif = 'oui' and produit.idp=".$res['idcp'].") ORDER BY produit.date_update DESC LIMIT 20 "; $ann=mysql_query($rss_query,$db); $tann=mysql_fetch_array($ann); $lart=htmlspecialchars("http://www.swisstime.ch/".$lg."-rss-p".$tann['idp'].".html"); $lart=htmlspecialchars("http://www.swisstime.ch/".$lg."-rss-p".$tann['idp'].".html"); echo "\n\n"; echo "".htmlspecialchars($tann['nom_ent'], ENT_QUOTES, 'UTF-8')." ".htmlspecialchars($tann['nom'], ENT_QUOTES, 'UTF-8')."\n"; echo "".$lart."\n"; echo "".htmlspecialchars($lart, ENT_QUOTES, 'UTF-8')."\n"; echo ""; if(file_exists("doc/produit_img/".$tann['idp']."/vig/v_".$tann['idp']."_1.jpg")){ echo htmlspecialchars("\"\""); } echo htmlspecialchars($tann['texte_desc_0'], ENT_QUOTES, 'UTF-8')."\n"; if(file_exists("doc/produit_img/".$tann['idp']."/img/i_".$tann['idp']."_1.jpg")){ echo ""; } echo "".date("r",strtotime($tann['date_update']))."\n"; echo "".$lart."\n"; echo "\n"; } function print_item_news($res){ $lg=$_GET['lg']?$_GET['lg']:'en'; $L=''; if($lg=='fr') $L=1; if($lg=='de') $L=2; if($lg=='it') $L=3; if($lg=='es') $L=4; if($lg=='zh') $L=5; //echo $res['idcp'] ; $db=connDb(); $rss_query=" SELECT news.ida, news.titre, news.debut, news.entreprise, news.resume, entreprise.nom as nom_ent FROM news INNER JOIN entreprise ON (news.entreprise = entreprise.ide) WHERE (news.ida=".$res['idca'].") ORDER BY news.debut DESC LIMIT 20 "; $ann=mysql_query($rss_query,$db); $tann=mysql_fetch_array($ann); $lart=htmlspecialchars("http://www.swisstime.ch/".$lg."-rss-n".$tann['ida'].".html"); echo "\n\n"; echo "".htmlspecialchars($tann['nom_ent'], ENT_QUOTES, 'UTF-8')." ".htmlspecialchars($tann['titre'], ENT_QUOTES, 'UTF-8')."\n"; echo "".$lart."\n"; echo "".htmlspecialchars($lart, ENT_QUOTES, 'UTF-8')."\n"; echo ""; /*if(file_exists("doc/produit_img/".$tann['ida']."/vig/v_".$tann['ida']."_1.jpg")){ echo htmlspecialchars("\"\""); }*/ echo htmlspecialchars($tann['resume'], ENT_QUOTES, 'UTF-8')."\n"; if(file_exists("doc/actualite/".$tann['ida']."/img/i_".$tann['ida']."_1.jpg")){ echo ""; } echo "".date("r",strtotime($tann['debut']))."\n"; echo "".$lart."\n"; echo "\n"; } $url_site="http://www.swisstime.ch"; $db_host="localhost"; $db_user="root"; $db_pass="exige190"; $db_base="swissti"; if(!$db = mysql_connect($db_host,$db_user,$db_pass)){ sleep(3); if(!$db = mysql_connect($db_host,$db_user,$db_pass)){ $fatal_error="Connexion au serveur de données impossible."; } } mysql_query("SET NAMES 'latin1'"); mysql_select_db($db_base,$db); header("Content-type: application/rss+xml; charset=utf-8"); error_reporting(0); echo "\n"; echo "\n"; //include("sys/init.php"); echo "\n"; echo "SwissTime\n"; echo "".htmlspecialchars("http://www.swisstime.ch/")."\n"; echo "\n"; echo "".htmlspecialchars("http://www.swisstime.ch/image/tec/rss_fil_logo.png")."\n"; echo "SwissTime RSS\n"; echo "".htmlspecialchars("http://www.swisstime.ch/")."\n"; echo "140\n"; // Max 144 echo "200\n"; // Max 400 echo "\n"; echo "".htmlspecialchars($str_rss['desc'])."\n"; echo "en\n"; echo "Copyright 2006-".date('Y')." SwissTime\n"; echo "".date('r')."\n"; echo "http://swisstime.ch/rss.php\n"; echo "GE-net v2.0\n"; echo "1765\n"; echo "info@swisstime.ch (SwissTime)\n"; echo "info@ge-net.com (GE-net)\n"; echo "40\n"; print_rss(); /*$rss_query=" SELECT produit.idp, produit.nom, produit.date_update, produit_$lg.nom_ent, produit_$lg.texte_desc_0 FROM produit INNER JOIN produit_$lg ON (produit.idp = produit_$lg.idp) INNER JOIN entreprise ON (produit.entreprise = entreprise.ide) WHERE (produit.actif = 'oui') ORDER BY produit.date_update DESC LIMIT 20 "; $ann=mysql_query($rss_query,$db); while($tann=mysql_fetch_array($ann)){ $lart=htmlspecialchars("http://www.swisstime.ch/".$lg."-rss-p".$tann['idp'].".html"); echo "\n"; echo "".htmlspecialchars($tann['nom_ent'], ENT_QUOTES, 'UTF-8')." ".htmlspecialchars($tann['nom'], ENT_QUOTES, 'UTF-8')."\n"; echo "".$lart."\n"; echo "".htmlspecialchars($lart, ENT_QUOTES, 'UTF-8')."\n"; echo ""; if(file_exists("doc/produit_img/".$tann['idp']."/vig/v_".$tann['idp']."_1.jpg")){ echo htmlspecialchars("\"\""); } echo htmlspecialchars($tann['texte_desc_0'], ENT_QUOTES, 'UTF-8')."\n"; if(file_exists("doc/produit_img/".$tann['idp']."/img/i_".$tann['idp']."_1.jpg")){ echo ""; } echo "".date("r",strtotime($tann['date_update']))."\n"; echo "".$lart."\n"; echo "\n"; } */ echo "\n"; echo "\n"; echo ""; ?>