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