1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
| <?
/**
* Edit par Aurélien le 28/08/2010
*
* Page news.
*
* Affiche le texte et les infos d'une news de type : News-reportage-cinema....
*
*/
//includes
/**/ require_once("./includes/inc_commentairesFunctions.php");
/**/ require_once("./includes/inc_newsFunctions.php");
//on définie une news par défaut
$nbrNewsId = 100;
$pageId = 1;
$IsShowCommentaire = false;
// initialise les variables GET
if ( isSet($_GET['pageId']) && is_numeric($_GET['pageId'])) { $pageId = $_GET['pageId']; }
//recupération des varibales GET.
if ( !isSet($_GET['id'])
|| strlen($_GET['id']) == 0
|| strlen($_GET['id']) > 5
|| !is_numeric($_GET['id'])
) {
//on vérifie le passage de l'id par la selection de page Commentaire
if ( ( isSet($_GET['linkId']) && strlen($_GET['linkId']) != 0 && is_numeric($_GET['linkId']) ) ) {
$nbrNewsId = $_GET['linkId'];
$IsShowCommentaire = true;
} else {
// si l'id n'est pas passée en variable
setErrorMessage(L_ERROR_NEWS);
?>
<script>
window.location = '../n63show.php';
</script>
<? exit();
}
} else {
$nbrNewsId = $_GET["id"];
}
// par défaut l'affichage des commentaire est false.
if(isSet($_GET['Show']))
{
$IsShowCommentaire = $_GET['Show'];
}
// je selectionne le news en cours
$newsReq = getNewsFromId($nbrNewsId );
$newValue = mysql_fetch_array($newsReq);
// si la news n'existe pas
if ( !$newValue ) {
setErrorMessage(L_ERROR_NEWS);
?>
<script>
window.location = '../n63show.php';
</script>
<? exit();
}
// j'incrémente de 1
$newsvue = $newValue['NEWS_VUE'] + 1;
// je met la base de donnée a jour
UpdateNewsStat($nbrNewsId, $newsvue);
//je change la balise Color
$newValue['NEWS_TEXT'] = changeStringBalise($newValue['NEWS_TEXT'], 'color', '<span class="gentitle">');
//je change la balise title
$newValue['NEWS_TEXT'] = changeStringBalise($newValue['NEWS_TEXT'], 'title', '<span class="title">');
?>
<table width="580" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<fieldset>
<legend class="legend"><? echo($newValue['CATEGORIE']) ?> </legend>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><p align="left" class="title"><strong><? echo($newValue['NEWS_TITLE']) ?></strong>
</p>
<p align="left"> Par <? echo($newValue['NEWS_POSTER']) ?>,
publié le <? echo(moveDateString($newValue['NEWS_DATE'])) ?> <br>
</p></td>
</tr>
<tr>
<td height="20" colspan="2" valign="top"><hr /></td>
</tr>
<tr>
<td height="20" colspan="2" valign="top"><hr /></td>
</tr>
<tr>
<td>
<p align="center"><img src="/coope/<? echo($newValue['NEWS_ARTICLE_IMAGE']) ?>" width="450" /><br />
</p>
</td>
</tr>
</table>
<br>
</td>
</tr>
<tr>
<td><p align="left"><? echo($newValue['NEWS_TEXT']) ?><br />
</p></td>
</tr>
</table>
</fieldset>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> <p><strong>
<? // on calcul le nombre de commentaires pour cette page !!
$nTotalcommentaires = countAllMessage("news",$nbrNewsId,$newValue['NEWS_DATE']);
// pour afficher le "s" au plurieurs de commentaire
if ( $nTotalcommentaires > 1 ) {
$comm_texte = "commentaires";
} else {
$comm_texte = "commentaire";
} ?>
<br>
<img src="/images/img_fleche_agenda.gif" width="15" height="15" align="absmiddle" />
Vos commentaires :</strong> il y a <b><span class="gentitle"><? echo($nTotalcommentaires)?></span></b>
<? echo($comm_texte)?><br />
<? if ( !$IsShowCommentaire ) { ?>
<span class="gentitle">[</span> <a href="n63show.php?link=news&id=<? echo($nbrNewsId) ?>&Show=true">Voir
les commentaires et postez le votre</a> <span class="gentitle">]</span>
<br />
<? } ?>
</p></td>
</tr>
</table>
<br>
<?
if ( $IsShowCommentaire ) {
//on affiche la liste des commenatires
showMessageList("news",$nbrNewsId,$link,$nTotalcommentaires,$pageId);
?>
<div align="right">[ <a href="/n63show.php?link=commentaire&commentaireId=<? echo($newValue['NEWS_ID']) ?>&commentaireType=News">Ajouter
un commentaire</a> ]</div>
<br />
<? } ?>
<p align="left"> </p></td>
</tr>
</table> |
Partager