. */ /** * Convertie la date au format valide pour les flux RSS. * * @param $date : la date au format des news. * * @return La date au format RSS. */ function conv_date ($date) { $d = explode ('/', $date); return date ('r', mktime ('0', '0', '0', $d[1], $d[0], substr ($d[2], 0, 4))); } $affnvlCheminBaseNvl = 'data/nouvelles'; $affnvlBaseNvl = $affnvlCheminBaseNvl.'/dbn.txt'; include_once ('include/config.php'); include_once ('include/fonctions.php'); include_once ('include/fonctions_lock.php'); header ('Content-Type: application/xml'); if (version_compare (PHP_VERSION, '5.1.0', '>=')) { date_default_timezone_set ('Europe/Paris'); } echo ''."\n"; echo ''."\n"; echo ' '."\n"; echo ' '.$cfgSite[0].''."\n"; echo ' http://'.$cfgSite[3].''."\n"; echo ' '.$cfgSite[1].''."\n"; echo ' fr-FR'."\n"; /* verrouillage */ if ($verrou = acq_verrou_partage ($affnvlCheminBaseNvl.'/.lock')) { /* Lecture de la base de donnees */ $fichier = file ($affnvlBaseNvl); /* déverrouillage */ liberation_verrou ($verrou); /* Extraction des noms des fichiers "actifs" */ $data = array (); for ($i = 0; $i < count ($fichier); $i++) { $pos = explode ('|', trim ($fichier[$i])); if (trim ($pos[1]) == 'active') { $data[] = trim ($pos[0]); } } $nb_data = count ($data); /* Affichage des donnees */ if (!empty ($data)) { for ($i = 0; $i < $nb_data; $i++) { $filename = $affnvlCheminBaseNvl.'/'.$data[$i]; if (file_exists ($filename)) { include ($filename); echo ' '."\n"; echo ' '.$ntitre.''."\n"; echo ' http://'.$cfgSite[3].'/nouvelles.php'."\n"; echo ' '.conv_date ($ndate).''."\n"; echo ' '."\n"; echo ' '.($i + 1).''."\n"; echo ' '."\n"; } } } } echo ' '."\n"; echo ''."\n"; ?>