$j) { if (preg_match('/^theme=([0-9][0-9]*)$/',$j,$matches)) { $theme=$matches[1]; } elseif (preg_match('/^date=([a-z][a-z]*)$/',$j,$matches)) { $date=$matches[1]; } elseif (preg_match('/^lang=([a-z][a-z]*)$/',$j,$matches)) { $xlang=$matches[1]; } } if ($date != "avenir") { $date="recent"; } include("serverconf.inc.php"); global $link; $link = mysql_connect($server, $user, $pass) or die("Connection impossible: " . mysql_error() . "\n
\n
Contactez l'administrateur."); /* On travaille exclusivement sur une base */ mysql_select_db($dbase) or die("Impossible de travailler sur '$dbase': " . mysql_error() . "\n
\n
Contactez " . "l'administrateur."); $channeldescriptionsupp=""; $themefrom=""; $themecondition=""; $langcondition=""; $themelimit=""; $themelink=""; if ($theme != "") { $themerequest="SELECT t.intitule FROM themes as t WHERE t.id_theme = ".$theme; $res=mysql_query($themerequest); $intitule="(inconnu)"; while ($row=mysql_fetch_array($res)) { $intitule=$row['intitule']; } if ($intitule != "(inconnu)") { $channeldescriptionsupp=" en ".$intitule; $themefrom=", rel_themes as rt"; $themecondition="AND rt.id_conf=c.id_conf AND rt.id_theme = ".$theme; $themelimit=" LIMIT 10"; $themelink="/index.php?res=themes&idtheme=".$theme; } else { $theme=""; } } $filename="delai.txt"; if ($date == "recent") { $delay="-45 days"; if (file_exists($filename)) { $actufile=file($filename); if ($actufile != FALSE) { foreach ($actufile as $line) { if (preg_match('/^rssrecent=(-[0-9][0-9]* days)[ \n\r]*$/',$line,$matches)) { $delay=$matches[1]; } } } } $datelimite = date("Y-m-d", strtotime($delay)); $datecondition = "c.date<=NOW() AND mise_en_ligne=\"1\""; if ($theme == "") { $datecondition.="AND TO_DAYS(c.lastupload) > TO_DAYS('".$datelimite."')"; } $dateorder="DESC"; $channeltitle="Nouveautés de Savoirs en multimédia".$channeldescriptionsupp; $channeldescription="Les dernières conférences ".$channeldescriptionsupp."mises en ligne sur le site de Savoirs en multimédia"; } else { $delay="+15 days"; if (file_exists($filename)) { $actufile=file($filename); if ($actufile != FALSE) { foreach ($actufile as $line) { if (preg_match('/^rssavenir=(\+[0-9][0-9]* days)[ \r\n]*$/',$line,$matches)) { $delay=$matches[1]; } } } } $datelimite = date("Y-m-d", strtotime($delay)); $datecondition = "c.date>=NOW()"; if ($theme == "") { $datecondition.=" AND TO_DAYS(c.lastupload) < TO_DAYS('".$datelimite."')"; } $dateorder="ASC"; $channeltitle="Agenda de Savoirs en multimédia".$channeldescriptionsupp; $channeldescription="Les prochaines conférences".$channeldescriptionsupp." concernant Savoirs en multimédia"; } if ($xlang!="") { $langcondition="AND c.lang='".$xlang."' "; } $trans_tbl = get_html_translation_table(HTML_ENTITIES); $ttr=array(); foreach($trans_tbl as $k => $v) { $ttr[$v] = utf8_encode($k); } $replacearray=array( "’" => "'", " " => " ", "‚" => "'", "ƒ" => "f", "„" => "«", "…" => "...", "…" => "...", "’" => "'", "†" => "+", "‡" => "++", // "ˆ" => "", "‰" => " pour mille", "‹" => "`", "‘" => "`", "“" => "`", "’" => "'", "•" => "ˆ", "–" => "--", "—" => "---", "˜" => "~", "™" => "(tm)", "›" => "'" ); function decodex($string) { global $ttr,$replacearray; $string=str_replace(array_keys($replacearray),array_values($replacearray),$string); $string = strtr($string, $ttr); return $string; } function decode($string) { $string=decodex($string); $string=htmlspecialchars($string); return $string; } function filterhtml($string) { $string=preg_replace("/^

/","",$string); $string=preg_replace("/<\/P>$/","",$string); return $string; } $channel="\n".decode($channeltitle)."http://www.diffusion.ens.fr".$themelink.""; $channel.="".decode($channeldescription).""; $channel.="fr-fr"; //$channel.="60"; $channel.="http://www.diffusion.ens.fr/images/logo_small.pngLogo Savoirs en multimédiahttp://www.diffusion.ens.fr"; $content=""; $req="SELECT DISTINCT c.titre, c.date, c.description, c.lang, c.id_conf, c2.titre as titre_c, c.lastupload " ."FROM conf as c, cycles as c2, rel_cycles as r2, rel_groupes_cycles as rgc, groupes as gr".$themefrom." " ."WHERE (".$datecondition." ".$themecondition." ".$langcondition." " ."AND c.id_conf=r2.id_conf AND r2.id_cycle=c2.id_cycle " ."AND rgc.id_cycle=c2.id_cycle AND rgc.id_groupe=gr.id_groupe AND gr.catalogue=1) " ."ORDER BY c.date ".$dateorder.$themelimit; $res=mysql_query($req); $dtmax=-1; while ($row=mysql_fetch_array($res)) { $content.=""; $req2='SELECT p.nom, p.prenom FROM rel_orateurs as r, personnes as p WHERE (r.id_conf=\''.$row['id_conf'].'\' AND r.id_pers=p.id_pers) ORDER BY p.nom'; $res2=mysql_query($req2); $auteur=""; $total=mysql_num_rows($res2); while ($row2=mysql_fetch_array($res2)) $auteur.=", ".$row2['prenom']." ".$row2['nom']; $auteur=substr($auteur,2); $dt=strtotime($row['lastupload']); if ($dt>$dtmax) $dtmax=$dt; $content.="".decode($row['titre']).""; $content.="http://www.diffusion.ens.fr/index.php?res=conf&idconf=".$row['id_conf'].""; $content.="http://www.diffusion.ens.fr/index.php?res=conf&idconf=".$row['id_conf']."\n"; $content.="" .decode("

Avec ".$auteur.", dans le cadre du cycle : ".$row['titre_c'].". Enregistré le ".substr($row['date'],8,2) .substr($row['date'],4,4).substr($row['date'],0,4)." à".substr($row['date'],10,6).".

" ."

".filterhtml($row['description'])."

") .""; $content.="lang:".$row['lang'].""; $content.="".date("r",$dt).""; $content.="\n"; } $channel.="".date("r",$dtmax).""; $channel.="".date("r",$dtmax)."\n"; $channel.=$content; $channel.="\n"; header('Content-type: application/rss+xml'); echo "\n\n".$channel."\n"; mysql_close($link); ?>