Attention: Fichier de nouvelles $File.csv inexistant !!
"; else { // lecture des messages $fd = fopen("$File.csv","r"); fseek($fd,unstr($File,$NNb-1)); $data = fgetcsv($fd, 10000, ","); $news["index"] = $data[0]; $news["categorie"] = stripcslashes($data[1]); $news["timestamp"] = $data[2]; $news["date"] = date("d/m/Y",$data[2]); $news["heure"] = date("H:i",$data[2]); if ($data[3] == "") $news["nom"] = "Anonyme"; else if ($data[4] == "") $news["nom"] = stripcslashes($data[3]); else $news["nom"] = "".stripcslashes($data[3])."\n"; $news["email"] = $data[4]; $news["icone"] = $data[5]; $news["titre"] = stripcslashes($data[6]); $news["message"] = parse_string(stripcslashes($data[7])); $news["referencelocale"] = "?modulepage=affnews&start=".$data[0]; $news["referenceabsolue"] = "http://www.tourmentine.com/?modulepage=commentnews&idnews=".$data[0]."&NbMaxNews=5"; } return $news; } // renvoie les NbMsg dernieres news d'un fichier donné sous forme d'un tableau ŕ deux dimensions function getlastnews($FileName, $NbMsg) { if (!(file_exists("$FileName.csv"))) echo "Aucune nouvelle pour l'instant !
Attention: Fichier de nouvelles '$File' inexistant !!
"; else { // lecture des messages $totmsg = gettotal($FileName); $fd = fopen("$FileName.csv","r"); fseek($fd,unstr($FileName,($totmsg-$NbMsg))); for($i=0;$i<$NbMsg;$i++) { $data = fgetcsv($fd, 10000, ","); $tabnews[$i]["index"] = $data[0]; $tabnews[$i]["categorie"] = $data[1]; $tabnews[$i]["date"] = date("d/m/Y",$data[2]); $tabnews[$i]["heure"] = date("H:i",$data[2]); $tabnews[$i]["timestamp"] = $data[2]; if ($data[3] == "") $tabnews["nom"] = "Anonyme"; else if ($data[3] == "") $tabnews[$i]["nom"] = stripcslashes($data[3]); else $tabnews[$i]["nom"] = "".stripcslashes($data[3])."\n"; $tabnews[$i]["nom"] = $data[3]; $tabnews[$i]["email"] = $data[4]; $tabnews[$i]["icone"] = $data[5]; $tabnews[$i]["titre"] = stripcslashes($data[6]); $tabnews[$i]["message"] = parse_string(stripcslashes($data[7])); $tabnews[$i]["referencelocale"] = "?modulepage=affnews&start=".$data[0]; $tabnews[$i]["referenceabsolue"] = "http://www.ifrance.com/phpinfo/index.php?modulepage=affnews&File=$FileName&start=".$data[0]."&NbMaxNews=5"; $GoldbookFile = "$FileName.".$data[$i][0]; if (file_exists("$GoldbookFile.csv")) $tabnews[$i]["nbcommentaires"] = countcsv($GoldbookFile); else $tabnews[$i]["nbcommentaires"] = 0; } fclose($fd); } unset($data); return $tabnews; } ?>