nb total de news:$totalnews
"; if (isset($_GET["typebackend"])) $typebackend = $_GET["typebackend"]; if (!isset($typebackend)) $typebackend = "all"; switch($typebackend) { case "txt": gen_txt($language); break; case "atom": gen_atom($language); break; case "opml": gen_opml($language); break; case "rss": gen_rss($language); break; case "all": default: gen_rss("en"); gen_rss("fr"); gen_atom("en"); gen_atom("fr"); //gen_opml("en"); //gen_opml("fr"); gen_txt("en"); gen_txt("fr"); } function gen_txt($language) { global $NbMax; extract(parse_ini_file("/web/website/config/pip.ini")); $FileNews="news/news.$language"; $totalnews = gettotal("$FileNews","file"); $outputfile = "../backends/txt/tourmentine.$language.txt"; if ($NbMax > $totalnews) $NbMax = $totalnews; if ($totalnews >= 1) { $backend = fopen("$outputfile","w"); for($n = 0 ; $n < $NbMax ; $n++) { $newsnb = $totalnews-$n; $MyNews = getnews($FileNews,$newsnb,"file"); fwrite ($backend," %%\n"); fwrite ($backend,$MyNews["date"]."\n"); fwrite ($backend,$MyNews["titre"]."\n"); #fwrite ($backend,"$urlsite/index.php?modulepage=affnews&File=$FileNews&start=".$newsnb."\n"); fwrite ($backend,"$urlsite/billet.".$newsnb.".".$language.".html\n"); } fclose($backend); echo "
$outputfile généré.
"; } else echo "fichier non créé : nombre de news insuffisant ($totalnews)
"; } function gen_atom($language) { global $NbMax; extract(parse_ini_file("/web/website/config/pip.ini")); $FileNews="news/news.$language"; $totalnews = gettotal("$FileNews","file"); // entete atom $entete = " $titlesite $descriptionsite WebLoom n http://tourmentine.com/ ".date("c")."\n\n"; $outputfile = "../backends/atom/tourmentine.$language.xml"; if ($NbMax > $totalnews) $NbMax = $totalnews; if ($totalnews >= 1) { $backend = fopen("$outputfile","w"); fwrite($backend,$entete); for($n = 0 ; $n < $NbMax ; $n++) { $newsnb = $totalnews-$n; $MyNews = getnews("$FileNews",$newsnb,"file"); fwrite ($backend," \n"); fwrite ($backend," ".$MyNews["titre"]."\n"); if (strlen(strip_tags($MyNews["message"])) > 100) $summary = substr(strip_tags($MyNews["message"]), 0, 100)."..."; else $summary = strip_tags($MyNews["message"]); fwrite ($backend," ".$summary."\n"); fwrite ($backend," \n\n\n"); fwrite ($backend," \n"); fwrite ($backend," ".date("c",$MyNews["timestamp"])."\n"); fwrite ($backend," ".date("c",$MyNews["timestamp"])."\n"); fwrite ($backend," $urlsite/billet.".$newsnb.".html\n"); fwrite ($backend," \n\n"); } fwrite ($backend,""); fclose($backend); echo "
$outputfile généré.
"; } else echo "fichier non créé : nombre de news insuffisant ($totalnews)
"; } function gen_opml($language) { global $NbMax; extract(parse_ini_file("/web/website/config/pip.ini")); $FileNews="news/news.$language"; $totalnews = gettotal("$FileNews","file"); $entete = " $titlesite \n\n"; $outputfile = "../backends/opml/tourmentine.$language.opml"; if ($NbMax > $totalnews) $NbMax = $totalnews; if ($totalnews >= 1) { $backend = fopen("$outputfile","w"); fwrite($backend,$entete); for($n = 0 ; $n < $NbMax ; $n++) { $newsnb = $totalnews-$n; $MyNews = getnews("$FileNews",$newsnb,"file"); fwrite ($backend," \n"); } fwrite ($backend," \n"); fclose($backend); echo "
$outputfile généré.
"; } else echo "fichier non créé : nombre de news insuffisant ($totalnews)
"; } function gen_rss($language) { global $NbMax; extract(parse_ini_file("/www/website/config/pip.ini")); $FileNews="news/news.$language"; $totalnews = gettotal("$FileNews","file"); // entete rss $entete = " $titlesite $linksite $descriptionsite $language ".date("r")." ".date("r")." $MailAdr (Nico) Nico $MailAdr (Nico) WebLoom beta\n\n"; $outputfile = "../backends/xml/tourmentine.$language.rss"; if ($NbMax > $totalnews) $NbMax = $totalnews; if ($totalnews >= 1) { $backend = fopen("$outputfile","w"); fwrite($backend,$entete); for($n = 0 ; $n < $NbMax ; $n++) { $newsnb = $totalnews-$n; $MyNews = getnews("$FileNews",$newsnb,"file"); fwrite ($backend," \n"); fwrite ($backend," ".$MyNews["titre"]."\n"); //fwrite ($backend," ".$MyNews["nom"]."\n"); fwrite ($backend," \n"); fwrite ($backend," $urlsite/billet.".$newsnb.".".$language.".html\n"); fwrite ($backend," ".date("r",$MyNews["timestamp"])."\n"); fwrite ($backend," \n\n"); } fwrite ($backend," \n\n"); fclose($backend); echo "
$outputfile généré.
"; } else echo "fichier non créé : nombre de news insuffisant ($totalnews)
"; } ?>