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