| webmaster@0 | 1 <?php | 
| webmaster@0 | 2     setlocale(LC_ALL, "fr_FR.utf8@euro", "fr_FR.utf8"); | 
| webmaster@0 | 3     ini_set("display_errors", "off"); | 
| webmaster@0 | 4      include("classes.php"); | 
| webmaster@0 | 5      $type = $_GET['type']; | 
| webmaster@0 | 6      $year = $_GET['year']; | 
| webmaster@0 | 7      $month = $_GET['month']; | 
| webmaster@5 | 8      $prevMonth = ($month - 1)%12; if($prevMonth == 0) $prevMonth = 12; | 
| webmaster@5 | 9      $prevYear = ($month == 1)? $year-1 : $year; | 
| webmaster@5 | 10      $nextMonth = $month % 12 + 1; | 
| webmaster@5 | 11      $nextYear = ($month == 12) ? $year+1 : $year; | 
| webmaster@0 | 12      $Data = new DataAccess; | 
| webmaster@0 | 13      include("top.php"); | 
| webmaster@0 | 14      $Data->Connect(); | 
| webmaster@6 | 15      $query = ($type != 'cal') ? | 
| webmaster@6 | 16      "	SELECT * | 
| webmaster@6 | 17 	FROM Mess | 
| webmaster@6 | 18         WHERE num_version='Version 10' | 
| webmaster@6 | 19         ORDER BY num_mess DESC | 
| webmaster@6 | 20         LIMIT 10 | 
| webmaster@6 | 21      " : " | 
| webmaster@6 | 22         SELECT * | 
| webmaster@6 | 23         FROM Mess | 
| webmaster@6 | 24         WHERE YEAR(DatePost)={$year} AND MONTH(DatePost)={$month} | 
| webmaster@6 | 25         ORDER BY num_mess DESC | 
| webmaster@6 | 26      "; | 
| webmaster@6 | 27      $Data->query($query); | 
| webmaster@0 | 28      if($type == "cal") { | 
| webmaster@0 | 29 	echo("<div class='cal'>"); | 
| webmaster@0 | 30 	if($prevYear > $startDate['year'] - 1 || ($prevYear > $startDate['Year'] - 2 && $prevMonth > $startDate['month'] - 1)) | 
| webmaster@0 | 31 		echo("<a class='calPrev' href='/blog/posts/{$prevYear}/{$prevMonth}'>{$arMonth[$prevMonth - 1]} {$prevYear}</a>"); | 
| webmaster@0 | 32 	else | 
| webmaster@0 | 33 	    echo("<a class='calPrev'>{$arMonth[$prevMonth - 1]} {$prevYear}</a>"); | 
| webmaster@0 | 34 	if(($curYear == $nextYear && $nextMonth < $curMonth + 1) || ($nextYear < $curYear) ) | 
| webmaster@0 | 35 	    echo("<a class='calNext' href='/blog/posts/{$nextYear}/" . ($month % 12 + 1)  ."'>{$arMonth[$month%12]} {$nextYear}</a>"); | 
| webmaster@0 | 36 	else | 
| webmaster@0 | 37 	    echo("<a class='calNext'>{$arMonth[$month%12]} {$nextYear}</a>"); | 
| webmaster@0 | 38 	echo("{$arMonth[$month - 1]} {$year}</div> "); | 
| webmaster@0 | 39     } | 
| webmaster@6 | 40     while($row=$Data->GetRow()) { | 
| webmaster@0 | 41     $mood = ''; | 
| webmaster@0 | 42     $Mess=$Data->utf8_ensure(str_replace("<P>","<p>",str_replace("</P>","</p>", $row['Message']))); | 
| webmaster@0 | 43     $dateFormatee = strftime("%A %d %B %Y, %Hh%M", strtotime($row['DatePost'])); | 
| webmaster@0 | 44     $Titre = $Data->utf8_ensure($row['Titre']); | 
| webmaster@0 | 45     $Titre_url = str_replace(" ", "_", strip_tags($Titre)); | 
| webmaster@0 | 46     $Titre_url = str_replace("-", "_", $Titre_url); | 
| webmaster@0 | 47     $Titre_url = str_replace(array("é", "è"), "e", $Titre_url); | 
| webmaster@0 | 48     $Titre_url = str_replace("à", "a", $Titre_url); | 
| webmaster@0 | 49     $Titre_url = str_replace("ù", "u", $Titre_url); | 
| webmaster@0 | 50     $Titre_url = str_replace(array("î", "ï"), "i", $Titre_url); | 
| webmaster@0 | 51     if(!empty($row['Emot'])) { | 
| webmaster@0 | 52 	$mood = "<img src='/blog/mood/{$row['Emot']}.png' alt='Mood : {$row['Emot']}' class='mood' />"; | 
| webmaster@0 | 53 	$row['Emot'] = " " . $row['Emot']; | 
| webmaster@0 | 54     } | 
| webmaster@0 | 55     $nbTags = $Data->Query(" | 
| webmaster@0 | 56 	SELECT T.Tag | 
| webmaster@0 | 57 	FROM Tags T, Lien_Tags_Posts L | 
| webmaster@0 | 58 	WHERE L.idMess={$row['num_mess']} AND  L.idTag = T.idTag | 
| webmaster@0 | 59 	ORDER BY T.Tag | 
| webmaster@0 | 60       ", 2); | 
| webmaster@0 | 61       $tags = ''; | 
| webmaster@0 | 62       if($nbTags > 0) | 
| webmaster@0 | 63       { | 
| webmaster@0 | 64 	$tags = "<span class='Tags'><em>Tags</em> :"; | 
| webmaster@0 | 65 	while(0 !== ($tag = $Data->GetRow(2))) | 
| webmaster@0 | 66 	    $tags .= " <a href='/blog/tags/{$tag['Tag']}'>{$tag['Tag']}</a> |"; | 
| webmaster@0 | 67 	$tags = substr($tags, 0, -1) . ' ;</span><br />'; | 
| webmaster@0 | 68       } | 
| webmaster@0 | 69 | 
| webmaster@0 | 70       echo(" | 
| webmaster@0 | 71        <div class='PostContent{$row['Emot']}'> | 
| webmaster@0 | 72 	<h2>{$Titre} | <span class='Date'>{$dateFormatee}</span></h2> | 
| webmaster@0 | 73 	{$mood} | 
| webmaster@0 | 74 	{$Mess} | 
| webmaster@0 | 75 	<p class='postInfos'> | 
| webmaster@0 | 76 	{$tags} | 
| webmaster@0 | 77 	<a href=\"/blog/posts/{$row['num_mess']}-{$Titre_url}\">#{$row['num_mess']}</a> - | 
| webmaster@0 | 78 	<a href=\"/blog/posts/{$row['num_mess']}-{$Titre_url}\"> | 
| webmaster@0 | 79 	 "); | 
| webmaster@0 | 80       if(!is_null($row['NbCommentaires']) && $row['NbCommentaires']!=0) | 
| webmaster@0 | 81 	echo("Un 'tit commentaire ( {$row['NbCommentaires']} ) ?"); | 
| webmaster@0 | 82       else | 
| webmaster@0 | 83        echo("Un 'tit commentaire ?"); | 
| webmaster@0 | 84       echo(" | 
| webmaster@0 | 85         </a> | 
| webmaster@0 | 86 	</p> | 
| webmaster@0 | 87        </div>"); | 
| webmaster@0 | 88      } | 
| webmaster@0 | 89      if($type == "cal") { | 
| webmaster@0 | 90 	echo("<div class='cal'>"); | 
| webmaster@0 | 91 	if($prevYear > $startDate['year'] - 1 && $prevMonth > $startDate['month'] - 1) | 
| webmaster@0 | 92 		echo("<a class='calPrev' href='/blog/posts/{$prevYear}/{$prevMonth}'>{$arMonth[$prevMonth - 1]} {$prevYear}</a>"); | 
| webmaster@0 | 93 	else | 
| webmaster@0 | 94 		echo("<a class='calPrev'>{$arMonth[$prevMonth - 1]} {$prevYear}</a>"); | 
| webmaster@0 | 95 	if(($curYear == $nextYear && $nextMonth < $curMonth + 1) || ($nextYear < $curYear) ) | 
| webmaster@0 | 96 		echo("<a class='calNext' href='/blog/posts/{$nextYear}/" . ($month % 12 + 1)  ."'>{$arMonth[$month%12]} {$nextYear}</a>"); | 
| webmaster@0 | 97 	else | 
| webmaster@0 | 98 		echo("<a class='calNext'>{$arMonth[$month%12]} {$nextYear}</a>"); | 
| webmaster@0 | 99 	echo("{$arMonth[$month - 1]} {$year}</div> "); | 
| webmaster@0 | 100      } | 
| webmaster@0 | 101      $Data->Close(); | 
| webmaster@0 | 102      include("foot.php"); | 
| webmaster@0 | 103 ?> |