Mercurial > defr > DualBlog
diff mood.php @ 0:629389204276
Import initial
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Sat, 20 Oct 2007 14:15:10 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mood.php Sat Oct 20 14:15:10 2007 +0200 @@ -0,0 +1,65 @@ +<?php + setlocale(LC_ALL, "fr_BE.utf8@euro"); + include("classes.php"); + $type = $_GET['type']; + $year = $_GET['year']; + $month = $_GET['month']; + $prevMonth = ($month - 1)%12; if($prevMonth == 0) $prevMonth = 12; $prevYear = ($month == 1)?$year-1:$year; + $nextMonth = $month % 12 + 1; $nextYear = ($month == 12)?$year+1:$year; + $Data = new DataAccess; + include("top.php"); + $Data->Connect(); + if($type != "cal") + $Data->Query("SELECT * FROM Mess Where num_version='Version 10' ORDER BY num_mess DESC"); + else + $Data->Query("SELECT * FROM Mess WHERE YEAR(DatePost)={$year} AND MONTH(DatePost)={$month} ORDER BY num_mess DESC"); + $i=0; + if($type == "cal") { + echo("<div class='cal'>"); + if($prevYear > $startDate['year'] - 1 && $prevMonth > $startDate['month'] - 1) + echo("<a class='calPrev' href='/blog/posts/{$prevYear}/{$prevMonth}'>{$arMonth[$prevMonth - 1]} {$prevYear}</a>"); + else + echo("<a class='calPrev'>{$arMonth[$prevMonth - 1]} {$prevYear}</a>"); + if(($curYear == $nextYear && $nextMonth < $curMonth + 1) || ($nextYear < $curYear) ) + echo("<a class='calNext' href='/blog/posts/{$nextYear}/" . ($month % 12 + 1) ."'>{$arMonth[$month%12]} {$nextYear}</a>"); + else + echo("<a class='calNext'>{$arMonth[$month%12]} {$nextYear}</a>"); + echo("{$arMonth[$month - 1]} {$year}</div> "); + } + while(($row=$Data->GetRow()) && ($i++<10 || $type == "cal")) { + $Mess=$Data->utf8_ensure(str_replace("<P>","<p>",str_replace("</P>","</p>", $row['Message']))); + $dateFormatee = strftime("%A %d %B %Y, %Hh%M", strtotime($row['DatePost'])); + $Titre = $Data->utf8_ensure($row['Titre']); + $Titre_url = str_replace(" ", "_", strip_tags($Titre)); + $Titre_url = str_replace("-", "_", $Titre_url); + echo(" + <div class='PostContent' style='background:url(t_alphaboost.png) bottom right no-repeat;'> + <h2>{$Titre} | <span class='Date'>{$dateFormatee}</span></h2> + <img src='t.png' style='float:left;margin:1.5em 1em 0.5em 0; padding:10px; border:1px #795 solid; background:url(css/Res_Somatic/bg_test.png);' /> + {$Mess}<br /> + <a href=\"/blog/posts/{$row['num_mess']}-{$Titre_url}\">#{$row['num_mess']}</a> - + <a href=\"/blog/posts/{$row['num_mess']}-{$Titre_url}\"> + "); + if(!is_null($row['NbCommentaires']) && $row['NbCommentaires']!=0) + echo("Un 'tit commentaire ( {$row['NbCommentaires']} ) ?"); + else + echo("Un 'tit commentaire ?"); + echo(" + </a> + </div>"); + } + if($type == "cal") { + echo("<div class='cal'>"); + if($prevYear > $startDate['year'] - 1 && $prevMonth > $startDate['month'] - 1) + echo("<a class='calPrev' href='/blog/posts/{$prevYear}/{$prevMonth}'>{$arMonth[$prevMonth - 1]} {$prevYear}</a>"); + else + echo("<a class='calPrev'>{$arMonth[$prevMonth - 1]} {$prevYear}</a>"); + if(($curYear == $nextYear && $nextMonth < $curMonth + 1) || ($nextYear < $curYear) ) + echo("<a class='calNext' href='/blog/posts/{$nextYear}/" . ($month % 12 + 1) ."'>{$arMonth[$month%12]} {$nextYear}</a>"); + else + echo("<a class='calNext'>{$arMonth[$month%12]} {$nextYear}</a>"); + echo("{$arMonth[$month - 1]} {$year}</div> "); + } + $Data->Close(); + include("foot.php"); +?>