[pLog-svn] r3176 - plog/trunk/class/dao
pwestbro at devel.lifetype.net
pwestbro at devel.lifetype.net
Mon Apr 3 07:03:22 GMT 2006
Author: pwestbro
Date: 2006-04-03 07:03:21 +0000 (Mon, 03 Apr 2006)
New Revision: 3176
Modified:
plog/trunk/class/dao/articles.class.php
Log:
Fixed the calendar display. Now all of day links are correct
Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php 2006-04-03 07:00:06 UTC (rev 3175)
+++ plog/trunk/class/dao/articles.class.php 2006-04-03 07:03:21 UTC (rev 3176)
@@ -589,32 +589,43 @@
if( $month == null )
$month = $t->getMonth();
- // build a valid timestamp for the query
- $dateTimestamp = $year.$month."00000000";
-
$blogs = new Blogs();
$blogInfo = $blogs->getBlogInfo( $blogId );
$blogSettings = $blogInfo->getSettings();
+ $timeDifference = $blogSettings->getValue( "time_offset" );
+
+ $SecondsDiff = $timeDifference * 3600;
+
// check whether we're supposed to show posts that happen in the future or not
$prefix = $this->getPrefix();
$numPostsPerDayQuery = "SELECT date
FROM {$prefix}articles
WHERE status = 1
- AND blog_id = $blogId
- AND date >= $dateTimestamp";
- if( !$blogSettings->getValue( "show_future_posts_in_calendar" ))
- $numPostsPerDayQuery .= " AND date <= NOW()";
+ AND blog_id = $blogId";
+ if( !$blogSettings->getValue( "show_future_posts_in_calendar" )) {
+ $numPostsPerDayQuery .= " AND MONTH(FROM_UNIXTIME(UNIX_TIMESTAMP(date) + $SecondsDiff)) = $month ";
+ $numPostsPerDayQuery .= " AND YEAR(FROM_UNIXTIME(UNIX_TIMESTAMP(date) + $SecondsDiff)) = $year ";
+ $numPostsPerDayQuery .= " AND date <= NOW()";
+ } else {
+ $numPostsPerDayQuery .= " AND MONTH(FROM_UNIXTIME(UNIX_TIMESTAMP(date) + $SecondsDiff)) = $month ";
+ $numPostsPerDayQuery .= " AND YEAR(FROM_UNIXTIME(UNIX_TIMESTAMP(date) + $SecondsDiff)) = $year ";
+ }
$result = $this->Execute( $numPostsPerDayQuery );
if( !$result )
return Array();
+ include_once( PLOG_CLASS_PATH.'class/data/timestamp.class.php' );
+
$postsPerDay = Array();
while( $row = $result->FetchRow()) {
- $day = substr($row['date'],6,2);
- $postsPerDay[$day] = 1;
+ // we can use this auxiliary function to help us...
+ $date = Timestamp::getDateWithOffset( $row['date'], $timeDifference );
+
+ $day = substr($date,6,2);
+ $postsPerDay[intval($day)] = 1;
}
return $postsPerDay;
More information about the pLog-svn
mailing list