206 lines
6.8 KiB
PHP
206 lines
6.8 KiB
PHP
|
<?php
|
|||
|
/*
|
|||
|
Name : affnews.php
|
|||
|
Author : NicoSoft
|
|||
|
Cr<EFBFBD>ation: 14/08/01
|
|||
|
MAJ : 05/02/04
|
|||
|
*/
|
|||
|
include_once "themes/default/theme.php";
|
|||
|
require_once "include/standard.inc.php";
|
|||
|
require_once "include/news.inc.php";
|
|||
|
require_once "include/lang.inc.php";
|
|||
|
|
|||
|
switch($lang)
|
|||
|
{
|
|||
|
case "fr":
|
|||
|
setlocale (LC_ALL, 'fr_FR.ISO8859-1');
|
|||
|
$add_a_comment = "Ajouter un commentaire";
|
|||
|
$one_comment = " commentaire";
|
|||
|
$nb_comment = " commentaires";
|
|||
|
$no_comment = "aucun commentaire";
|
|||
|
$posted_on = "Post<EFBFBD> le";
|
|||
|
break;
|
|||
|
case "es":
|
|||
|
setlocale (LC_ALL, 'es_ES.ISO8859-1');
|
|||
|
$add_a_comment = "<EFBFBD>Comentarios?";
|
|||
|
$one_comment = " comentario";
|
|||
|
$nb_comment = " comentarios";
|
|||
|
$no_comment = "No comentarios";
|
|||
|
$posted_on = "Enviado el";
|
|||
|
break;
|
|||
|
case "eo":
|
|||
|
setlocale (LC_ALL, 'eo_EO.UTF-8');
|
|||
|
$add_a_comment = "Komentaroj?";
|
|||
|
$one_comment = " komentaro";
|
|||
|
$nb_comment = " komentarioj";
|
|||
|
$posted_on = "Sendita je";
|
|||
|
break;
|
|||
|
default:
|
|||
|
$add_a_comment = "Add a comment";
|
|||
|
$one_comment = " comment";
|
|||
|
$nb_comment = " comments";
|
|||
|
$no_comment = "No comment";
|
|||
|
$posted_on = "Posted on";
|
|||
|
}
|
|||
|
|
|||
|
// 5 nouvelles <20> la fois par d<>faut
|
|||
|
if ($_GET["NbMaxNews"] != "")
|
|||
|
$NbMaxNews = $_GET["NbMaxNews"];
|
|||
|
|
|||
|
if ($_GET["BoxNbMaxNews"] != "")
|
|||
|
$BoxNbMaxNews = $_GET["BoxNbMaxNews"];
|
|||
|
|
|||
|
if ($_GET["titleonly"] != "")
|
|||
|
$titleonly = $_GET["titleonly"];
|
|||
|
|
|||
|
if ($_GET["cropdate"] != "")
|
|||
|
$cropdate = $_GET["cropdate"];
|
|||
|
|
|||
|
if ($_GET["start"] != "")
|
|||
|
$start = $_GET["start"];
|
|||
|
|
|||
|
if (!isset($NbMaxNews))
|
|||
|
$NbMaxNews = 5;
|
|||
|
|
|||
|
if (!isset($FileNews) || $FileNews == "")
|
|||
|
{
|
|||
|
if (file_exists("news/news.$lang.csv"))
|
|||
|
$FileNews="news/news.$lang";
|
|||
|
else
|
|||
|
$FileNews="news/news.en";
|
|||
|
}
|
|||
|
$totalnews = gettotal($FileNews);
|
|||
|
|
|||
|
if (!isset($start))
|
|||
|
$start = $totalnews;
|
|||
|
|
|||
|
if ($totalnews <= 0)
|
|||
|
echo " <table>\n <tr>\n <td><b>Rien pour l'instant !</b></td>\n </tr>\n </table>\n";
|
|||
|
else
|
|||
|
{
|
|||
|
if (isset($titleonly))
|
|||
|
{
|
|||
|
if (!isset($BoxNbMaxNews))
|
|||
|
$BoxNbMaxNews = 5;
|
|||
|
|
|||
|
if ($BoxNbMaxNews > $totalnews)
|
|||
|
$BoxNbMaxNews = $totalnews;
|
|||
|
|
|||
|
if ($BoxNbMaxNews < $totalnews)
|
|||
|
{
|
|||
|
$footerbox = 1;
|
|||
|
$footerboxtext .= "($totalnews)";
|
|||
|
//$footerlien = "http://tourmentine.com/?modulepage=affnews&File=$FileNews&start=$totalnews&NbMaxNews=$totalnews";
|
|||
|
$footerlien = "http://tourmentine.com/titres.html";
|
|||
|
}
|
|||
|
if (!isset($cropdate))
|
|||
|
$cropdate=0;
|
|||
|
|
|||
|
$tabnews = getlastnews($FileNews, $BoxNbMaxNews);
|
|||
|
|
|||
|
for ($i=$BoxNbMaxNews-1 ; $i>=0 ; $i--)
|
|||
|
{
|
|||
|
echo "<a href='http://tourmentine.com/billet.".($totalnews-$BoxNbMaxNews+$i+1).".html'>";
|
|||
|
if ($cropdate != 0)
|
|||
|
//echo substr($tabnews[$i]["date"],0,$cropdate).":";
|
|||
|
echo substr(short_date($tabnews[$i]["timestamp"],$lang),0,$cropdate).":";
|
|||
|
|
|||
|
echo $tabnews[$i]["titre"]."</a><br/>\n";
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (isset($newsnb))
|
|||
|
{
|
|||
|
$MyNews = getnews($FileNews,$newsnb);
|
|||
|
echo " <table>\n <tr>\n";
|
|||
|
|
|||
|
//if (isset($MyNews["icone"]) && ($MyNews["icone"] != ""))
|
|||
|
// echo "<td align='center' width='100'><img src='".$MyNews["icone"]."' width='80' heigh='80' alt='' title='' /></td><td> </td>\n";
|
|||
|
|
|||
|
//if (isset($cadrenews) && ($cadrenews != 0))
|
|||
|
echo " <td class='centernews' width='100%'>\n";
|
|||
|
//else
|
|||
|
// echo " <td>\n";
|
|||
|
|
|||
|
echo $MyNews["message"]."\n </td>\n </tr>\n </table>\n";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (!isset($NbMaxNews))
|
|||
|
$NbMaxNews = 5;
|
|||
|
|
|||
|
if ($NbMaxNews > $totalnews)
|
|||
|
$NbMaxNews = $totalnews;
|
|||
|
|
|||
|
$headclass="centerhead";
|
|||
|
$bodyclass="centerbody";
|
|||
|
|
|||
|
$headstartcode .= "<font name='verdana' size='4' class='centerhead'>";
|
|||
|
$headendcode .="</font>\n";
|
|||
|
|
|||
|
for($i =0 ; $i < $NbMaxNews ; $i++)
|
|||
|
{
|
|||
|
$newsnb = $start-$i;
|
|||
|
unset($MyNews);
|
|||
|
$MyNews = getnews($FileNews,$newsnb);
|
|||
|
$footerbox = 1;
|
|||
|
|
|||
|
//$MyNews["date"] = strftime("%A %e %B %Y",mktime(0,0,0,substr($MyNews["date"],3,2),substr($MyNews["date"],0,2),substr($MyNews["date"],6,4)));
|
|||
|
|
|||
|
if (isset($footerbox))
|
|||
|
{
|
|||
|
$forumfile = $FileNews.".".$newsnb.".forum.csv";
|
|||
|
|
|||
|
if (file_exists($forumfile))
|
|||
|
{
|
|||
|
$fp = fopen ($forumfile, "r");
|
|||
|
$row=0;
|
|||
|
while ($data = fgetcsv ($fp, 1000, ","))
|
|||
|
$row++;
|
|||
|
$MyNews["commentaires"] = $row;
|
|||
|
}
|
|||
|
else
|
|||
|
$MyNews["commentaires"] = 0;
|
|||
|
|
|||
|
if ($MyNews["commentaires"] < 1)
|
|||
|
{
|
|||
|
if (file_exists($forumfile) && !is_writable($forumfile))
|
|||
|
$str = $no_messages;
|
|||
|
else
|
|||
|
$str = "<a href='comment.".$newsnb.".0000.html'>$add_a_comment</a>";
|
|||
|
}
|
|||
|
else if ($MyNews["commentaires"] > 1)
|
|||
|
$str = "<a href='billet.".$MyNews["index"].".html'>".$MyNews["commentaires"]."$nb_comment</a>";
|
|||
|
else $str = "<a href='billet.".$newsnb.".html'>".$MyNews["commentaires"]." $one_comment</a>";
|
|||
|
|
|||
|
$footerboxtext = "\n <table align='left'>\n <tr>\n <td>$posted_on ".long_date($MyNews["timestamp"],$lang)."</td>\n </tr>\n </table>\n <table align='right'>\n <tr>\n <td class='nbcomment'>$str</td>\n </tr>\n </table>\n";
|
|||
|
}
|
|||
|
|
|||
|
$AIcon = $MyNews["icone"];
|
|||
|
$AMessage = $MyNews["message"];
|
|||
|
|
|||
|
$module = "affnews";
|
|||
|
$titre = $MyNews["titre"];
|
|||
|
//echo " <table>\n <tr>\n";
|
|||
|
|
|||
|
//echo " <td class='centernews' width='100%'>\n";
|
|||
|
//echo $MyNews["message"]."\n </td>\n </tr>\n </table>\n";
|
|||
|
$bodyclass="centerbody";
|
|||
|
include "modules/magicbox.php";
|
|||
|
|
|||
|
if ($newsnb <= 1)
|
|||
|
{
|
|||
|
unset($newsnb);
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
unset($totalnews);
|
|||
|
unset($MyNews);
|
|||
|
|
|||
|
?>
|